mirror of
https://github.com/lua/lua
synced 2024-11-22 21:01:26 +03:00
details ("luaX_token2str" doesn't need LexState)
This commit is contained in:
parent
afb5ef72e1
commit
e1a127245d
4
llex.c
4
llex.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: llex.c,v 1.22 1998/06/19 18:47:06 roberto Exp roberto $
|
** $Id: llex.c,v 1.23 1998/07/06 22:04:58 roberto Exp roberto $
|
||||||
** Lexical Analizer
|
** Lexical Analizer
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -59,7 +59,7 @@ void luaX_error (LexState *ls, char *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void luaX_token2str (LexState *ls, int token, char *s) {
|
void luaX_token2str (int token, char *s) {
|
||||||
if (token < 255) {
|
if (token < 255) {
|
||||||
s[0] = token;
|
s[0] = token;
|
||||||
s[1] = 0;
|
s[1] = 0;
|
||||||
|
4
llex.h
4
llex.h
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: llex.h,v 1.8 1998/05/27 13:03:40 roberto Exp roberto $
|
** $Id: llex.h,v 1.9 1998/06/19 16:14:09 roberto Exp roberto $
|
||||||
** Lexical Analizer
|
** Lexical Analizer
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -56,7 +56,7 @@ void luaX_setinput (LexState *LS, ZIO *z);
|
|||||||
int luaX_lex (LexState *LS);
|
int luaX_lex (LexState *LS);
|
||||||
void luaX_syntaxerror (LexState *ls, char *s, char *token);
|
void luaX_syntaxerror (LexState *ls, char *s, char *token);
|
||||||
void luaX_error (LexState *ls, char *s);
|
void luaX_error (LexState *ls, char *s);
|
||||||
void luaX_token2str (LexState *ls, int token, char *s);
|
void luaX_token2str (int token, char *s);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lparser.c,v 1.2 1998/06/24 14:48:15 roberto Exp roberto $
|
** $Id: lparser.c,v 1.3 1998/07/06 22:07:51 roberto Exp roberto $
|
||||||
** LL(1) Parser and code generator for Lua
|
** LL(1) Parser and code generator for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -580,7 +580,7 @@ static void next (LexState *ls) {
|
|||||||
|
|
||||||
static void error_expected (LexState *ls, int token) {
|
static void error_expected (LexState *ls, int token) {
|
||||||
char buff[100], t[TOKEN_LEN];
|
char buff[100], t[TOKEN_LEN];
|
||||||
luaX_token2str(ls, token, t);
|
luaX_token2str(token, t);
|
||||||
sprintf(buff, "`%s' expected", t);
|
sprintf(buff, "`%s' expected", t);
|
||||||
luaX_error(ls, buff);
|
luaX_error(ls, buff);
|
||||||
}
|
}
|
||||||
@ -591,8 +591,8 @@ static void error_unmatched (LexState *ls, int what, int who, int where) {
|
|||||||
else {
|
else {
|
||||||
char buff[100];
|
char buff[100];
|
||||||
char t_what[TOKEN_LEN], t_who[TOKEN_LEN];
|
char t_what[TOKEN_LEN], t_who[TOKEN_LEN];
|
||||||
luaX_token2str(ls, what, t_what);
|
luaX_token2str(what, t_what);
|
||||||
luaX_token2str(ls, who, t_who);
|
luaX_token2str(who, t_who);
|
||||||
sprintf(buff, "`%s' expected (to close `%s' at line %d)",
|
sprintf(buff, "`%s' expected (to close `%s' at line %d)",
|
||||||
t_what, t_who, where);
|
t_what, t_who, where);
|
||||||
luaX_error(ls, buff);
|
luaX_error(ls, buff);
|
||||||
|
Loading…
Reference in New Issue
Block a user