diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-11-02 10:46:30 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-11-02 10:46:30 +0100 |
commit | 1eaeccc15d15d15d2f62ea1648f7dd64722dbd37 (patch) | |
tree | b922cdabc780fa3a8837a6804d2df31793d9e2ca /compiler/nimlexbase.nim | |
parent | e9243a16167b24899d4fcf051f3252b3a5804811 (diff) | |
parent | bd19b5f4d36bb40b4af93d7e15fdfa582e9fe3b7 (diff) | |
download | Nim-1eaeccc15d15d15d2f62ea1648f7dd64722dbd37.tar.gz |
Merge branch 'devel' into araq
Diffstat (limited to 'compiler/nimlexbase.nim')
-rw-r--r-- | compiler/nimlexbase.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/nimlexbase.nim b/compiler/nimlexbase.nim index 047890c44..2e7416645 100644 --- a/compiler/nimlexbase.nim +++ b/compiler/nimlexbase.nim @@ -46,6 +46,7 @@ type # private data: sentinel*: int lineStart*: int # index of last line start in buffer + offsetBase*: int # use ``offsetBase + bufpos`` to get the offset proc openBaseLexer*(L: var TBaseLexer, inputstream: PLLStream, @@ -122,7 +123,8 @@ proc fillBaseLexer(L: var TBaseLexer, pos: int): int = result = pos + 1 # nothing to do else: fillBuffer(L) - L.bufpos = 0 # XXX: is this really correct? + L.offsetBase += pos + 1 + L.bufpos = 0 result = 0 L.lineStart = result @@ -146,6 +148,7 @@ proc skipUTF8BOM(L: var TBaseLexer) = proc openBaseLexer(L: var TBaseLexer, inputstream: PLLStream, bufLen = 8192) = assert(bufLen > 0) L.bufpos = 0 + L.offsetBase = 0 L.bufLen = bufLen L.buf = cast[cstring](alloc(bufLen * chrSize)) L.sentinel = bufLen - 1 |