mirror of
https://github.com/lua/lua
synced 2024-11-26 06:39:41 +03:00
details
This commit is contained in:
parent
16024861bd
commit
e9a670695a
7
llex.c
7
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') {
|
||||
|
7
llex.h
7
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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user