diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-16 15:46:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-16 15:46:28 -0300 |
commit | 1294b09d8eff59a5fa00a43a2c462d338546da1f (patch) | |
tree | aec3bb6fbfdefba54fae9f0ebabda72885d1a3a7 /lparser.c | |
parent | d4f0c4435d026e5621b4b777c872815cee6f57bb (diff) | |
download | lua-github-1294b09d8eff59a5fa00a43a2c462d338546da1f.tar.gz |
first implementation of literal integers (no constant folding yet)
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.129 2012/08/06 13:36:34 roberto Exp roberto $ +** $Id: lparser.c,v 2.130 2013/02/06 13:37:39 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -935,14 +935,19 @@ static void suffixedexp (LexState *ls, expdesc *v) { static void simpleexp (LexState *ls, expdesc *v) { - /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... | + /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | constructor | FUNCTION body | suffixedexp */ switch (ls->t.token) { - case TK_NUMBER: { - init_exp(v, VKNUM, 0); + case TK_FLT: { + init_exp(v, VKFLT, 0); v->u.nval = ls->t.seminfo.r; break; } + case TK_INT: { + init_exp(v, VKINT, 0); + v->u.ival = ls->t.seminfo.i; + break; + } case TK_STRING: { codestring(ls, v, ls->t.seminfo.ts); break; |