aboutsummaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-04-09 18:40:39 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-04-09 18:40:39 -0300
commit65d1aa7a779b30bf5b0e7b968b3980b702b08b2c (patch)
tree05590585cbc70bbc5bb9fa8799220e9fc50c0900 /llex.c
parent8004798b0374744208b102bb4cbcf12f904ea120 (diff)
downloadlua-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.c2
1 files changed, 2 insertions, 0 deletions
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) {
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);