`luaX_syntaxerror' does not need to be public

This commit is contained in:
Roberto Ierusalimschy
2001-11-16 14:29:10 -02:00
parent 26bf2adace
commit 39395e1211
2 changed files with 19 additions and 14 deletions

30
llex.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: llex.c,v 1.89 2001/07/22 00:59:36 roberto Exp $
** $Id: llex.c,v 1.91 2001/08/31 19:46:07 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -58,7 +58,8 @@ void luaX_checklimit (LexState *ls, int val, int limit, const l_char *msg) {
}
void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token) {
static void luaX_syntaxerror (LexState *ls, const l_char *s,
const l_char *token) {
l_char buff[MAXSRC];
luaO_chunkid(buff, getstr(ls->source), MAXSRC);
luaO_verror(ls->L,
@@ -67,16 +68,6 @@ void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token) {
}
void luaX_error (LexState *ls, const l_char *s, int token) {
l_char buff[TOKEN_LEN];
luaX_token2str(token, buff);
if (buff[0] == l_c('\0'))
luaX_syntaxerror(ls, s, cast(l_char *, G(ls->L)->Mbuffer));
else
luaX_syntaxerror(ls, s, buff);
}
void luaX_token2str (int token, l_char *s) {
if (token < FIRST_RESERVED) {
lua_assert(token == (l_char)token);
@@ -88,6 +79,21 @@ void luaX_token2str (int token, l_char *s) {
}
static l_char *token2str_all (LexState *ls, int token, l_char *s) {
luaX_token2str(token, s);
if (s[0] == l_c('\0'))
return cast(l_char *, G(ls->L)->Mbuffer);
else
return s;
}
void luaX_error (LexState *ls, const l_char *s, int token) {
l_char buff[TOKEN_LEN];
luaX_syntaxerror(ls, s, token2str_all(ls, token, buff));
}
static void luaX_invalidchar (LexState *ls, int c) {
l_char buff[8];
sprintf(buff, l_s("0x%02X"), uchar(c));

3
llex.h
View File

@@ -1,5 +1,5 @@
/*
** $Id: llex.h,v 1.37 2001/07/22 00:59:36 roberto Exp $
** $Id: llex.h,v 1.38 2001/08/31 19:46:07 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -65,7 +65,6 @@ void luaX_init (lua_State *L);
void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
int luaX_lex (LexState *LS, SemInfo *seminfo);
void luaX_checklimit (LexState *ls, int val, int limit, const l_char *msg);
void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token);
void luaX_error (LexState *ls, const l_char *s, int token);
void luaX_token2str (int token, l_char *s);