Files
skynet/3rd/lua/llex.h
云风 eaa60ca8dd Update to lua 5.4 (#1174)
* update to lua 5.4.0-rc1

* remove LUA_ERRGCMM

* use age bits for shared

* remove unused lbitlib.c

* use luaV_fastget

* fix #1174

* suspend函数tailcall优化

* 防止没有session导致未调用suspend

* luaH_setint check shared (#1184)

* set LUA_GCGEN by default

* fix #1174 (#1186)

checkshared in sweeplist

* update to lua 5.4 rc2

* update to lua 5.4 rc4

* move skynet.profile into snlua

* Use lua_sethook to interrupt tight loops

* remove lua_checksig

* critical condition for signals

* update to lua 5.4 released

* lua 5.4 bugfix

* update lua bugfix

* fix lua_sharestring (#1224)

* update lua

* update lua 5.4

* update README

* add skynet.select

* add test

* test error & discard

* yield session

* request error has no error message

* add timeout to skynet.select

* bugfix

* for lua 5.4

* new version

* bugfix

* bugfix

* use if instead of while

* make local

* yield in select for

* update lua 5.4.1

* change lua version (#1245)

Co-authored-by: xiaojin <xiaojin@onemt.com.cn>

* update lua version number

Co-authored-by: hong <hongling0@gmail.com>
Co-authored-by: hong <hongling-0@qq.com>
Co-authored-by: 风---自由 <996442717qqcom@gmail.com>
Co-authored-by: xiaojin <xiaojin@onemt.com.cn>
2020-10-10 13:36:59 +08:00

92 lines
2.3 KiB
C

/*
** $Id: llex.h $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
#ifndef llex_h
#define llex_h
#include <limits.h>
#include "lobject.h"
#include "lzio.h"
/*
** 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)
#define LUA_ENV "_ENV"
#endif
/*
* WARNING: if you change the order of this enumeration,
* grep "ORDER RESERVED"
*/
enum RESERVED {
/* terminal symbols denoted by reserved words */
TK_AND = FIRST_RESERVED, TK_BREAK,
TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
/* other terminal symbols */
TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE,
TK_SHL, TK_SHR,
TK_DBCOLON, TK_EOS,
TK_FLT, TK_INT, TK_NAME, TK_STRING
};
/* number of reserved words */
#define NUM_RESERVED (cast_int(TK_WHILE-FIRST_RESERVED + 1))
typedef union {
lua_Number r;
lua_Integer i;
TString *ts;
} SemInfo; /* semantics information */
typedef struct Token {
int token;
SemInfo seminfo;
} Token;
/* state of the lexer plus state of the parser when shared by all
functions */
typedef struct LexState {
int current; /* current character (charint) */
int linenumber; /* input line counter */
int lastline; /* line of last token 'consumed' */
Token t; /* current token */
Token lookahead; /* look ahead token */
struct FuncState *fs; /* current function (parser) */
struct lua_State *L;
ZIO *z; /* input stream */
Mbuffer *buff; /* buffer for tokens */
Table *h; /* to avoid collection/reuse strings */
struct Dyndata *dyd; /* dynamic structures used by the parser */
TString *source; /* current source name */
TString *envn; /* environment variable name */
} LexState;
LUAI_FUNC void luaX_init (lua_State *L);
LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
TString *source, int firstchar);
LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
LUAI_FUNC void luaX_next (LexState *ls);
LUAI_FUNC int luaX_lookahead (LexState *ls);
LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
#endif