Menu

#54 luaj incorrectly parses unfinished string

v3.0.1
open
nobody
None
5
2018-06-11
2018-06-11
stbe
No

originally a typo in a user's script, but not yielding a parse-error: (note the incorrectly matched quote signs)

print('unfinished")
print("string')

this chunk only yields in one single function call in the Lua parser (no errors/exceptions):
function: print
argument: string: "unfinished\")\nprint(\"string"

thus, the 2nd function call is not executed ...

Lua has a special multi-line mechanism, but single or double quoted strings may not break over the line. (however '\n' is a valid character in a string)

the Lua parser must not accept the example above.

Discussion


Log in to post a comment.