diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-09 18:40:39 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-09 18:40:39 -0300 |
commit | 65d1aa7a779b30bf5b0e7b968b3980b702b08b2c (patch) | |
tree | 05590585cbc70bbc5bb9fa8799220e9fc50c0900 /llex.c | |
parent | 8004798b0374744208b102bb4cbcf12f904ea120 (diff) | |
download | lua-65d1aa7a779b30bf5b0e7b968b3980b702b08b2c.tar.gz lua-65d1aa7a779b30bf5b0e7b968b3980b702b08b2c.tar.bz2 lua-65d1aa7a779b30bf5b0e7b968b3980b702b08b2c.zip |
Syntax should not allow numbers touching identifiers
Code like 'a = 1print()' should not be accepted.
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -228,6 +228,8 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { | |||
228 | save_and_next(ls); | 228 | save_and_next(ls); |
229 | else break; | 229 | else break; |
230 | } | 230 | } |
231 | if (lislalnum(ls->current)) /* is numeral touching an alpha num? */ | ||
232 | save_and_next(ls); /* force an error */ | ||
231 | save(ls, '\0'); | 233 | save(ls, '\0'); |
232 | if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ | 234 | if (luaO_str2num(luaZ_buffer(ls->buff), &obj) == 0) /* format error? */ |
233 | lexerror(ls, "malformed number", TK_FLT); | 235 | lexerror(ls, "malformed number", TK_FLT); |