diff options
Diffstat (limited to 'llex.c')
-rw-r--r-- | llex.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -82,7 +82,10 @@ void luaX_init (lua_State *L) { | |||
82 | const char *luaX_token2str (LexState *ls, int token) { | 82 | const char *luaX_token2str (LexState *ls, int token) { |
83 | if (token < FIRST_RESERVED) { /* single-byte symbols? */ | 83 | if (token < FIRST_RESERVED) { /* single-byte symbols? */ |
84 | lua_assert(token == cast_uchar(token)); | 84 | lua_assert(token == cast_uchar(token)); |
85 | return luaO_pushfstring(ls->L, "'%c'", token); | 85 | if (lisprint(token)) |
86 | return luaO_pushfstring(ls->L, "'%c'", token); | ||
87 | else /* control character */ | ||
88 | return luaO_pushfstring(ls->L, "'<\\%d>'", token); | ||
86 | } | 89 | } |
87 | else { | 90 | else { |
88 | const char *s = luaX_tokens[token - FIRST_RESERVED]; | 91 | const char *s = luaX_tokens[token - FIRST_RESERVED]; |