diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-07-22 16:29:42 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-07-22 16:29:42 -0300 |
commit | e9a670695a764408aae2bd970ded7a58d98921c4 (patch) | |
tree | 4e6b456f909090fced8aad436b6491601a85bfca | |
parent | 16024861bd23ac9f837f956fbeec739878e5d895 (diff) | |
download | lua-e9a670695a764408aae2bd970ded7a58d98921c4.tar.gz lua-e9a670695a764408aae2bd970ded7a58d98921c4.tar.bz2 lua-e9a670695a764408aae2bd970ded7a58d98921c4.zip |
details
-rw-r--r-- | llex.c | 7 | ||||
-rw-r--r-- | llex.h | 7 | ||||
-rw-r--r-- | lparser.c | 8 |
3 files changed, 14 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.35 1999/05/14 12:24:04 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.36 1999/06/17 17:04:03 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 | */ |
@@ -27,7 +27,8 @@ | |||
27 | #define save_and_next(LS) (save(LS->current), next(LS)) | 27 | #define save_and_next(LS) (save(LS->current), next(LS)) |
28 | 28 | ||
29 | 29 | ||
30 | char *reserved [] = {"and", "do", "else", "elseif", "end", "function", | 30 | /* ORDER RESERVED */ |
31 | static char *reserved [] = {"and", "do", "else", "elseif", "end", "function", | ||
31 | "if", "local", "nil", "not", "or", "repeat", "return", "then", | 32 | "if", "local", "nil", "not", "or", "repeat", "return", "then", |
32 | "until", "while"}; | 33 | "until", "while"}; |
33 | 34 | ||
@@ -391,7 +392,7 @@ int luaX_lex (LexState *LS) { | |||
391 | "ambiguous syntax (decimal point x string concatenation)"); | 392 | "ambiguous syntax (decimal point x string concatenation)"); |
392 | } | 393 | } |
393 | } | 394 | } |
394 | fraction: | 395 | fraction: /* LUA_NUMBER */ |
395 | while (isdigit(LS->current)) | 396 | while (isdigit(LS->current)) |
396 | save_and_next(LS); | 397 | save_and_next(LS); |
397 | if (toupper(LS->current) == 'E') { | 398 | if (toupper(LS->current) == 'E') { |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.h,v 1.11 1999/02/25 19:13:56 roberto Exp roberto $ | 2 | ** $Id: llex.h,v 1.12 1999/06/17 17:04:03 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 | */ |
@@ -16,6 +16,11 @@ | |||
16 | /* maximum length of a reserved word (+1 for terminal 0) */ | 16 | /* maximum length of a reserved word (+1 for terminal 0) */ |
17 | #define TOKEN_LEN 15 | 17 | #define TOKEN_LEN 15 |
18 | 18 | ||
19 | |||
20 | /* | ||
21 | * WARNING: if you change the order of this enumeration, | ||
22 | * grep "ORDER RESERVED" | ||
23 | */ | ||
19 | enum RESERVED { | 24 | enum RESERVED { |
20 | /* terminal symbols denoted by reserved words */ | 25 | /* terminal symbols denoted by reserved words */ |
21 | AND = FIRST_RESERVED, | 26 | AND = FIRST_RESERVED, |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 1.36 1999/06/16 13:35:01 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 1.37 1999/06/17 17:04:03 roberto Exp roberto $ |
3 | ** LL(1) Parser and code generator for Lua | 3 | ** LL(1) Parser and code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -145,7 +145,7 @@ static void var_or_func_tail (LexState *ls, vardesc *v); | |||
145 | static void checklimit (LexState *ls, int val, int limit, char *msg) { | 145 | static void checklimit (LexState *ls, int val, int limit, char *msg) { |
146 | if (val > limit) { | 146 | if (val > limit) { |
147 | char buff[100]; | 147 | char buff[100]; |
148 | sprintf(buff, "too many %s (limit=%d)", msg, limit); | 148 | sprintf(buff, "too many %.50s (limit=%d)", msg, limit); |
149 | luaX_error(ls, buff); | 149 | luaX_error(ls, buff); |
150 | } | 150 | } |
151 | } | 151 | } |
@@ -617,7 +617,7 @@ static void next (LexState *ls) { | |||
617 | static void error_expected (LexState *ls, int token) { | 617 | static void error_expected (LexState *ls, int token) { |
618 | char buff[100], t[TOKEN_LEN]; | 618 | char buff[100], t[TOKEN_LEN]; |
619 | luaX_token2str(token, t); | 619 | luaX_token2str(token, t); |
620 | sprintf(buff, "`%s' expected", t); | 620 | sprintf(buff, "`%.20s' expected", t); |
621 | luaX_error(ls, buff); | 621 | luaX_error(ls, buff); |
622 | } | 622 | } |
623 | 623 | ||
@@ -635,7 +635,7 @@ static void error_unmatched (LexState *ls, int what, int who, int where) { | |||
635 | char t_what[TOKEN_LEN], t_who[TOKEN_LEN]; | 635 | char t_what[TOKEN_LEN], t_who[TOKEN_LEN]; |
636 | luaX_token2str(what, t_what); | 636 | luaX_token2str(what, t_what); |
637 | luaX_token2str(who, t_who); | 637 | luaX_token2str(who, t_who); |
638 | sprintf(buff, "`%s' expected (to close `%s' at line %d)", | 638 | sprintf(buff, "`%.20s' expected (to close `%.20s' at line %d)", |
639 | t_what, t_who, where); | 639 | t_what, t_who, where); |
640 | luaX_error(ls, buff); | 640 | luaX_error(ls, buff); |
641 | } | 641 | } |