aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-09-15 14:29:52 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-09-15 14:29:52 -0300
commit98ec7995912af0aaaf9a97c5bc1be17e9b601af9 (patch)
treeabc823aa4f22f434cef2452a09b7fe7b8d385fe7
parentb6888a158b43c7391e2e4837cf4ae91e8c5e8371 (diff)
downloadlua-98ec7995912af0aaaf9a97c5bc1be17e9b601af9.tar.gz
lua-98ec7995912af0aaaf9a97c5bc1be17e9b601af9.tar.bz2
lua-98ec7995912af0aaaf9a97c5bc1be17e9b601af9.zip
Detail
Code for multi-character tokens can start right after maximum char.
-rw-r--r--llex.c1
-rw-r--r--llex.h8
2 files changed, 7 insertions, 2 deletions
diff --git a/llex.c b/llex.c
index 90a7951f..3d6b2b97 100644
--- a/llex.c
+++ b/llex.c
@@ -81,7 +81,6 @@ void luaX_init (lua_State *L) {
81 81
82const char *luaX_token2str (LexState *ls, int token) { 82const 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));
85 if (lisprint(token)) 84 if (lisprint(token))
86 return luaO_pushfstring(ls->L, "'%c'", token); 85 return luaO_pushfstring(ls->L, "'%c'", token);
87 else /* control character */ 86 else /* control character */
diff --git a/llex.h b/llex.h
index d1a4cba7..389d2f86 100644
--- a/llex.h
+++ b/llex.h
@@ -7,11 +7,17 @@
7#ifndef llex_h 7#ifndef llex_h
8#define llex_h 8#define llex_h
9 9
10#include <limits.h>
11
10#include "lobject.h" 12#include "lobject.h"
11#include "lzio.h" 13#include "lzio.h"
12 14
13 15
14#define FIRST_RESERVED 257 16/*
17** Single-char tokens (terminal symbols) are represented by their own
18** numeric code. Other tokens start at the following value.
19*/
20#define FIRST_RESERVED (UCHAR_MAX + 1)
15 21
16 22
17#if !defined(LUA_ENV) 23#if !defined(LUA_ENV)