From 98ec7995912af0aaaf9a97c5bc1be17e9b601af9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 15 Sep 2020 14:29:52 -0300 Subject: [PATCH] Detail Code for multi-character tokens can start right after maximum char. --- llex.c | 1 - llex.h | 8 +++++++- 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) { const char *luaX_token2str (LexState *ls, int token) { if (token < FIRST_RESERVED) { /* single-byte symbols? */ - lua_assert(token == cast_uchar(token)); if (lisprint(token)) return luaO_pushfstring(ls->L, "'%c'", token); 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 @@ #ifndef llex_h #define llex_h +#include + #include "lobject.h" #include "lzio.h" -#define FIRST_RESERVED 257 +/* +** Single-char tokens (terminal symbols) are represented by their own +** numeric code. Other tokens start at the following value. +*/ +#define FIRST_RESERVED (UCHAR_MAX + 1) #if !defined(LUA_ENV)