diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-16 15:39:46 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-16 15:39:46 -0300 |
commit | 955def034814e96f5f8e42def2e47ca6817ef103 (patch) | |
tree | d8eea96980860d1d1e5005ee6ecedb47fa64d594 /llex.c | |
parent | 9c3b3f82fe1b0942183ddeef2e16d60bab4f4c06 (diff) | |
download | lua-955def034814e96f5f8e42def2e47ca6817ef103.tar.gz lua-955def034814e96f5f8e42def2e47ca6817ef103.tar.bz2 lua-955def034814e96f5f8e42def2e47ca6817ef103.zip |
new names for string formating functions
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llex.c,v 1.100 2002/05/07 17:36:56 roberto Exp roberto $ | 2 | ** $Id: llex.c,v 1.101 2002/05/15 18:57:44 roberto Exp roberto $ |
3 | ** Lexical Analyzer | 3 | ** Lexical Analyzer |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -51,7 +51,7 @@ void luaX_init (lua_State *L) { | |||
51 | 51 | ||
52 | void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) { | 52 | void luaX_checklimit (LexState *ls, int val, int limit, const char *msg) { |
53 | if (val > limit) { | 53 | if (val > limit) { |
54 | msg = luaO_pushstr(ls->L, "too many %s (limit=%d)", msg, limit); | 54 | msg = luaO_pushfstring(ls->L, "too many %s (limit=%d)", msg, limit); |
55 | luaX_syntaxerror(ls, msg); | 55 | luaX_syntaxerror(ls, msg); |
56 | } | 56 | } |
57 | } | 57 | } |
@@ -61,7 +61,7 @@ static void luaX_error (LexState *ls, const char *s, const char *token) { | |||
61 | lua_State *L = ls->L; | 61 | lua_State *L = ls->L; |
62 | char buff[MAXSRC]; | 62 | char buff[MAXSRC]; |
63 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); | 63 | luaO_chunkid(buff, getstr(ls->source), MAXSRC); |
64 | luaO_pushstr(L, "%s:%d: %s near `%s'", buff, ls->linenumber, s, token); | 64 | luaO_pushfstring(L, "%s:%d: %s near `%s'", buff, ls->linenumber, s, token); |
65 | luaD_errorobj(L, L->top - 1, LUA_ERRSYNTAX); | 65 | luaD_errorobj(L, L->top - 1, LUA_ERRSYNTAX); |
66 | } | 66 | } |
67 | 67 | ||
@@ -70,13 +70,13 @@ void luaX_syntaxerror (LexState *ls, const char *msg) { | |||
70 | const char *lasttoken; | 70 | const char *lasttoken; |
71 | switch (ls->t.token) { | 71 | switch (ls->t.token) { |
72 | case TK_NAME: | 72 | case TK_NAME: |
73 | lasttoken = luaO_pushstr(ls->L, "%s", getstr(ls->t.seminfo.ts)); | 73 | lasttoken = luaO_pushfstring(ls->L, "%s", getstr(ls->t.seminfo.ts)); |
74 | break; | 74 | break; |
75 | case TK_STRING: | 75 | case TK_STRING: |
76 | lasttoken = luaO_pushstr(ls->L, "\"%s\"", getstr(ls->t.seminfo.ts)); | 76 | lasttoken = luaO_pushfstring(ls->L, "\"%s\"", getstr(ls->t.seminfo.ts)); |
77 | break; | 77 | break; |
78 | case TK_NUMBER: | 78 | case TK_NUMBER: |
79 | lasttoken = luaO_pushstr(ls->L, "%f", ls->t.seminfo.r); | 79 | lasttoken = luaO_pushfstring(ls->L, "%f", ls->t.seminfo.r); |
80 | break; | 80 | break; |
81 | default: | 81 | default: |
82 | lasttoken = luaX_token2str(ls, ls->t.token); | 82 | lasttoken = luaX_token2str(ls, ls->t.token); |
@@ -89,7 +89,7 @@ void luaX_syntaxerror (LexState *ls, const char *msg) { | |||
89 | const char *luaX_token2str (LexState *ls, int token) { | 89 | const char *luaX_token2str (LexState *ls, int token) { |
90 | if (token < FIRST_RESERVED) { | 90 | if (token < FIRST_RESERVED) { |
91 | lua_assert(token == (char)token); | 91 | lua_assert(token == (char)token); |
92 | return luaO_pushstr(ls->L, "%c", token); | 92 | return luaO_pushfstring(ls->L, "%c", token); |
93 | } | 93 | } |
94 | else | 94 | else |
95 | return token2string[token-FIRST_RESERVED]; | 95 | return token2string[token-FIRST_RESERVED]; |
@@ -397,7 +397,7 @@ int luaX_lex (LexState *LS, SemInfo *seminfo) { | |||
397 | int c = LS->current; | 397 | int c = LS->current; |
398 | if (iscntrl(c)) | 398 | if (iscntrl(c)) |
399 | luaX_error(LS, "invalid control char", | 399 | luaX_error(LS, "invalid control char", |
400 | luaO_pushstr(LS->L, "char(%d)", c)); | 400 | luaO_pushfstring(LS->L, "char(%d)", c)); |
401 | next(LS); | 401 | next(LS); |
402 | return c; /* single-char tokens (+ - / ...) */ | 402 | return c; /* single-char tokens (+ - / ...) */ |
403 | } | 403 | } |