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-1294b09d8eff59a5fa00a43a2c462d338546da1f.tar.gz lua-1294b09d8eff59a5fa00a43a2c462d338546da1f.tar.bz2 lua-1294b09d8eff59a5fa00a43a2c462d338546da1f.zip |
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 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.129 2012/08/06 13:36:34 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.130 2013/02/06 13:37:39 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -935,14 +935,19 @@ static void suffixedexp (LexState *ls, expdesc *v) { | |||
935 | 935 | ||
936 | 936 | ||
937 | static void simpleexp (LexState *ls, expdesc *v) { | 937 | static void simpleexp (LexState *ls, expdesc *v) { |
938 | /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... | | 938 | /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | |
939 | constructor | FUNCTION body | suffixedexp */ | 939 | constructor | FUNCTION body | suffixedexp */ |
940 | switch (ls->t.token) { | 940 | switch (ls->t.token) { |
941 | case TK_NUMBER: { | 941 | case TK_FLT: { |
942 | init_exp(v, VKNUM, 0); | 942 | init_exp(v, VKFLT, 0); |
943 | v->u.nval = ls->t.seminfo.r; | 943 | v->u.nval = ls->t.seminfo.r; |
944 | break; | 944 | break; |
945 | } | 945 | } |
946 | case TK_INT: { | ||
947 | init_exp(v, VKINT, 0); | ||
948 | v->u.ival = ls->t.seminfo.i; | ||
949 | break; | ||
950 | } | ||
946 | case TK_STRING: { | 951 | case TK_STRING: { |
947 | codestring(ls, v, ls->t.seminfo.ts); | 952 | codestring(ls, v, ls->t.seminfo.ts); |
948 | break; | 953 | break; |