summaryrefslogtreecommitdiff
path: root/llex.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-05-14 12:59:04 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-05-14 12:59:04 -0300
commit36e8771076705d33261a88a3c144967b1840671a (patch)
treeb2c2c7b5fd8487227d9629e7507d91cd1d15a834 /llex.c
parent27f09415e38b00f16013649d3d91c430a6cc33ff (diff)
downloadlua-36e8771076705d33261a88a3c144967b1840671a.tar.gz
lua-36e8771076705d33261a88a3c144967b1840671a.tar.bz2
lua-36e8771076705d33261a88a3c144967b1840671a.zip
'luaO_str2int' more generic: accepts white spaces around the numeral
and handles signal
Diffstat (limited to '')
-rw-r--r--llex.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/llex.c b/llex.c
index 9544de4f..b14c0257 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 2.64 2013/04/16 18:46:28 roberto Exp roberto $ 2** $Id: llex.c,v 2.65 2013/04/26 13:07:53 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -248,7 +248,8 @@ static int read_numeral (LexState *ls, SemInfo *seminfo, int isf) {
248 } 248 }
249 save(ls, '\0'); 249 save(ls, '\0');
250 if (!isf) { 250 if (!isf) {
251 if (!luaO_str2int(luaZ_buffer(ls->buff), &seminfo->i)) 251 if (!luaO_str2int(luaZ_buffer(ls->buff), luaZ_bufflen(ls->buff) - 1,
252 &seminfo->i))
252 lexerror(ls, "malformed number", TK_INT); 253 lexerror(ls, "malformed number", TK_INT);
253 return TK_INT; 254 return TK_INT;
254 } 255 }