diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-26 10:08:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-26 10:08:29 -0300 |
commit | a2f5c28a802ae99f2045ab96585fade2c65b2037 (patch) | |
tree | eb2ab3d1fc8dc2084505ed4286502ed75b6721ba /llex.c | |
parent | a80a2b5e561b50c1f64e96c3692614611a325aba (diff) | |
download | lua-a2f5c28a802ae99f2045ab96585fade2c65b2037.tar.gz lua-a2f5c28a802ae99f2045ab96585fade2c65b2037.tar.bz2 lua-a2f5c28a802ae99f2045ab96585fade2c65b2037.zip |
new operation '//' (integer division)
Diffstat (limited to '')
-rw-r--r-- | llex.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 2.63 2013/03/16 21:10:18 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 2.64 2013/04/16 18:46:28 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 | */ |
@@ -38,7 +38,7 @@ static const char *const luaX_tokens [] = { | |||
38 | "end", "false", "for", "function", "goto", "if", | 38 | "end", "false", "for", "function", "goto", "if", |
39 | "in", "local", "nil", "not", "or", "repeat", | 39 | "in", "local", "nil", "not", "or", "repeat", |
40 | "return", "then", "true", "until", "while", | 40 | "return", "then", "true", "until", "while", |
41 | "..", "...", "==", ">=", "<=", "~=", "::", "<eof>", | 41 | "//", "..", "...", "==", ">=", "<=", "~=", "::", "<eof>", |
42 | "<number>", "<number>", "<name>", "<string>" | 42 | "<number>", "<number>", "<name>", "<string>" |
43 | }; | 43 | }; |
44 | 44 | ||
@@ -464,6 +464,11 @@ static int llex (LexState *ls, SemInfo *seminfo) { | |||
464 | if (ls->current != '=') return '>'; | 464 | if (ls->current != '=') return '>'; |
465 | else { next(ls); return TK_GE; } | 465 | else { next(ls); return TK_GE; } |
466 | } | 466 | } |
467 | case '/': { | ||
468 | next(ls); | ||
469 | if (ls->current != '/') return '/'; | ||
470 | else { next(ls); return TK_IDIV; } | ||
471 | } | ||
467 | case '~': { | 472 | case '~': { |
468 | next(ls); | 473 | next(ls); |
469 | if (ls->current != '=') return '~'; | 474 | if (ls->current != '=') return '~'; |