Skip to content

Commit

Permalink
Detail
Browse files Browse the repository at this point in the history
Code for multi-character tokens can start right after maximum char.
  • Loading branch information
roberto-ieru committed Sep 15, 2020
1 parent b6888a1 commit 98ec799
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion llex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 7 additions & 1 deletion llex.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
#ifndef llex_h
#define llex_h

#include <limits.h>

#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)
Expand Down

0 comments on commit 98ec799

Please sign in to comment.