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