From 65d1aa7a779b30bf5b0e7b968b3980b702b08b2c Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 9 Apr 2019 18:40:39 -0300 Subject: Syntax should not allow numbers touching identifiers Code like 'a = 1print()' should not be accepted. --- llex.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'llex.c') diff --git a/llex.c b/llex.c index b0bab377..bb81cec4 100644 --- a/llex.c +++ b/llex.c @@ -228,6 +228,8 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { save_and_next(ls); else break; } + if (lislalnum(ls->current)) /* is numeral touching an alpha num? */ + save_and_next(ls); /* force an error */ save(ls, '\0'); if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ lexerror(ls, "malformed number", TK_FLT); -- cgit v1.2.3-55-g6feb