From 1294b09d8eff59a5fa00a43a2c462d338546da1f Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 16 Apr 2013 15:46:28 -0300 Subject: first implementation of literal integers (no constant folding yet) --- lparser.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lparser.c') diff --git a/lparser.c b/lparser.c index b83b0c33..0ac318ff 100644 --- a/lparser.c +++ b/lparser.c @@ -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; -- cgit v1.2.3-55-g6feb