Syntax should not allow numbers touching identifiers
Code like 'a = 1print()' should not be accepted.
This commit is contained in:
@@ -306,4 +306,13 @@ assert(not load"a = 'non-ending string\n'")
|
||||
assert(not load"a = '\\345'")
|
||||
assert(not load"a = [=x]")
|
||||
|
||||
local function malformednum (n, exp)
|
||||
local s, msg = load("return " .. n)
|
||||
assert(not s and string.find(msg, exp))
|
||||
end
|
||||
|
||||
malformednum("0xe-", "near <eof>")
|
||||
malformednum("0xep-p", "malformed number")
|
||||
malformednum("1print()", "malformed number")
|
||||
|
||||
print('OK')
|
||||
|
||||
Reference in New Issue
Block a user