diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-11-16 14:29:10 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-11-16 14:29:10 -0200 |
commit | 39395e12118539d983fdefbbc50d3aac3f53ccad (patch) | |
tree | b34031cfe137496033299663909194def09f8e2f | |
parent | 26bf2adaceb18877d836174226d2bfdc3f1fc512 (diff) | |
download | lua-39395e12118539d983fdefbbc50d3aac3f53ccad.tar.gz lua-39395e12118539d983fdefbbc50d3aac3f53ccad.tar.bz2 lua-39395e12118539d983fdefbbc50d3aac3f53ccad.zip |
`luaX_syntaxerror' does not need to be public
-rw-r--r-- | llex.c | 30 | ||||
-rw-r--r-- | llex.h | 3 |
2 files changed, 19 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.89 2001/07/22 00:59:36 roberto Exp $ | 2 | ** $Id: llex.c,v 1.91 2001/08/31 19:46:07 roberto Exp $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -58,7 +58,8 @@ void luaX_checklimit (LexState *ls, int val, int limit, const l_char *msg) { | |||
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token) { | 61 | static void luaX_syntaxerror (LexState *ls, const l_char *s, |
62 | const l_char *token) { | ||
62 | l_char buff[MAXSRC]; | 63 | l_char buff[MAXSRC]; |
63 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); | 64 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); |
64 | luaO_verror(ls->L, | 65 | luaO_verror(ls->L, |
@@ -67,16 +68,6 @@ void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token) { | |||
67 | } | 68 | } |
68 | 69 | ||
69 | 70 | ||
70 | void luaX_error (LexState *ls, const l_char *s, int token) { | ||
71 | l_char buff[TOKEN_LEN]; | ||
72 | luaX_token2str(token, buff); | ||
73 | if (buff[0] == l_c('\0')) | ||
74 | luaX_syntaxerror(ls, s, cast(l_char *, G(ls->L)->Mbuffer)); | ||
75 | else | ||
76 | luaX_syntaxerror(ls, s, buff); | ||
77 | } | ||
78 | |||
79 | |||
80 | void luaX_token2str (int token, l_char *s) { | 71 | void luaX_token2str (int token, l_char *s) { |
81 | if (token < FIRST_RESERVED) { | 72 | if (token < FIRST_RESERVED) { |
82 | lua_assert(token == (l_char)token); | 73 | lua_assert(token == (l_char)token); |
@@ -88,6 +79,21 @@ void luaX_token2str (int token, l_char *s) { | |||
88 | } | 79 | } |
89 | 80 | ||
90 | 81 | ||
82 | static l_char *token2str_all (LexState *ls, int token, l_char *s) { | ||
83 | luaX_token2str(token, s); | ||
84 | if (s[0] == l_c('\0')) | ||
85 | return cast(l_char *, G(ls->L)->Mbuffer); | ||
86 | else | ||
87 | return s; | ||
88 | } | ||
89 | |||
90 | |||
91 | void luaX_error (LexState *ls, const l_char *s, int token) { | ||
92 | l_char buff[TOKEN_LEN]; | ||
93 | luaX_syntaxerror(ls, s, token2str_all(ls, token, buff)); | ||
94 | } | ||
95 | |||
96 | |||
91 | static void luaX_invalidchar (LexState *ls, int c) { | 97 | static void luaX_invalidchar (LexState *ls, int c) { |
92 | l_char buff[8]; | 98 | l_char buff[8]; |
93 | sprintf(buff, l_s("0x%02X"), uchar(c)); | 99 | sprintf(buff, l_s("0x%02X"), uchar(c)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.h,v 1.37 2001/07/22 00:59:36 roberto Exp $ | 2 | ** $Id: llex.h,v 1.38 2001/08/31 19:46:07 roberto Exp $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -65,7 +65,6 @@ void luaX_init (lua_State *L); | |||
65 | void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); | 65 | void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); |
66 | int luaX_lex (LexState *LS, SemInfo *seminfo); | 66 | int luaX_lex (LexState *LS, SemInfo *seminfo); |
67 | void luaX_checklimit (LexState *ls, int val, int limit, const l_char *msg); | 67 | void luaX_checklimit (LexState *ls, int val, int limit, const l_char *msg); |
68 | void luaX_syntaxerror (LexState *ls, const l_char *s, const l_char *token); | ||
69 | void luaX_error (LexState *ls, const l_char *s, int token); | 68 | void luaX_error (LexState *ls, const l_char *s, int token); |
70 | void luaX_token2str (int token, l_char *s); | 69 | void luaX_token2str (int token, l_char *s); |
71 | 70 | ||