| 85 | |
| 86 | |
| 87 | const char *luaX_token2str (LexState *ls, int token) { |
| 88 | if (token < FIRST_RESERVED) { /* single-byte symbols? */ |
| 89 | if (lisprint(token)) |
| 90 | return luaO_pushfstring(ls->L, "'%c'", token); |
| 91 | else /* control character */ |
| 92 | return luaO_pushfstring(ls->L, "'<\\%d>'", token); |
| 93 | } |
| 94 | else { |
| 95 | const char *s = luaX_tokens[token - FIRST_RESERVED]; |
| 96 | if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ |
| 97 | return luaO_pushfstring(ls->L, "'%s'", s); |
| 98 | else /* names, strings, and numerals */ |
| 99 | return s; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | |
| 104 | static const char *txtToken (LexState *ls, int token) { |
no test coverage detected