diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-05-14 12:59:04 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-05-14 12:59:04 -0300 |
commit | 36e8771076705d33261a88a3c144967b1840671a (patch) | |
tree | b2c2c7b5fd8487227d9629e7507d91cd1d15a834 /llex.c | |
parent | 27f09415e38b00f16013649d3d91c430a6cc33ff (diff) | |
download | lua-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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 | } |