Skip to content

Commit ca95cdb

Browse files
bytexenonXmiliaH
andcommitted
fix(tokenizer): fix parsing of long strings with incomplete end sequences
When a long string or comment contained an incomplete end sequence immediately followed by the actual end sequence (e.g. `]=]==]`), the tokenizer would incorrectly consume part of the valid delimiter. This commit should fixed this. Closes #4 Co-authored-by: XmiliaH <[email protected]>
1 parent fc059a8 commit ca95cdb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

the-tiny-lua-compiler.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ function Tokenizer:consumeUntilEndingDelimiter(depth)
370370
elseif self.curChar == "" then
371371
-- End of stream reached without finding the delimiter.
372372
error("Unexpected end of input while searching for ending delimiter")
373+
else
374+
-- Consume the current character and move to the next one in the stream.
375+
self:consume(1)
373376
end
374-
375-
-- Consume the current character and move to the next one in the stream.
376-
self:consume(1)
377377
end
378378
end
379379

0 commit comments

Comments
 (0)