commit e9a670695a764408aae2bd970ded7a58d98921c4
parent 16024861bd23ac9f837f956fbeec739878e5d895
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 22 Jul 1999 16:29:20 -0300
details
Diffstat:
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/llex.c b/llex.c
@@ -1,5 +1,5 @@
/*
-** $Id: llex.c,v 1.35 1999/05/14 12:24:04 roberto Exp roberto $
+** $Id: llex.c,v 1.36 1999/06/17 17:04:03 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -27,7 +27,8 @@
#define save_and_next(LS) (save(LS->current), next(LS))
-char *reserved [] = {"and", "do", "else", "elseif", "end", "function",
+/* ORDER RESERVED */
+static char *reserved [] = {"and", "do", "else", "elseif", "end", "function",
"if", "local", "nil", "not", "or", "repeat", "return", "then",
"until", "while"};
@@ -391,7 +392,7 @@ int luaX_lex (LexState *LS) {
"ambiguous syntax (decimal point x string concatenation)");
}
}
- fraction:
+ fraction: /* LUA_NUMBER */
while (isdigit(LS->current))
save_and_next(LS);
if (toupper(LS->current) == 'E') {
diff --git a/llex.h b/llex.h
@@ -1,5 +1,5 @@
/*
-** $Id: llex.h,v 1.11 1999/02/25 19:13:56 roberto Exp roberto $
+** $Id: llex.h,v 1.12 1999/06/17 17:04:03 roberto Exp roberto $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -16,6 +16,11 @@
/* maximum length of a reserved word (+1 for terminal 0) */
#define TOKEN_LEN 15
+
+/*
+* WARNING: if you change the order of this enumeration,
+* grep "ORDER RESERVED"
+*/
enum RESERVED {
/* terminal symbols denoted by reserved words */
AND = FIRST_RESERVED,
diff --git a/lparser.c b/lparser.c
@@ -1,5 +1,5 @@
/*
-** $Id: lparser.c,v 1.36 1999/06/16 13:35:01 roberto Exp roberto $
+** $Id: lparser.c,v 1.37 1999/06/17 17:04:03 roberto Exp roberto $
** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -145,7 +145,7 @@ static void var_or_func_tail (LexState *ls, vardesc *v);
static void checklimit (LexState *ls, int val, int limit, char *msg) {
if (val > limit) {
char buff[100];
- sprintf(buff, "too many %s (limit=%d)", msg, limit);
+ sprintf(buff, "too many %.50s (limit=%d)", msg, limit);
luaX_error(ls, buff);
}
}
@@ -617,7 +617,7 @@ static void next (LexState *ls) {
static void error_expected (LexState *ls, int token) {
char buff[100], t[TOKEN_LEN];
luaX_token2str(token, t);
- sprintf(buff, "`%s' expected", t);
+ sprintf(buff, "`%.20s' expected", t);
luaX_error(ls, buff);
}
@@ -635,7 +635,7 @@ static void error_unmatched (LexState *ls, int what, int who, int where) {
char t_what[TOKEN_LEN], t_who[TOKEN_LEN];
luaX_token2str(what, t_what);
luaX_token2str(who, t_who);
- sprintf(buff, "`%s' expected (to close `%s' at line %d)",
+ sprintf(buff, "`%.20s' expected (to close `%.20s' at line %d)",
t_what, t_who, where);
luaX_error(ls, buff);
}