File indexing completed on 2026-11-07 10:37:56
0001
0002
0003
0004
0005
0006
0007 #ifndef llex_h
0008 #define llex_h
0009
0010 #include <limits.h>
0011
0012 #include "lobject.h"
0013 #include "lzio.h"
0014
0015
0016
0017
0018
0019
0020 #define FIRST_RESERVED (UCHAR_MAX + 1)
0021
0022
0023 #if !defined(LUA_ENV)
0024 #define LUA_ENV "_ENV"
0025 #endif
0026
0027
0028
0029
0030
0031
0032 enum RESERVED {
0033
0034 TK_AND = FIRST_RESERVED, TK_BREAK,
0035 TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
0036 TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
0037 TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
0038
0039 TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE,
0040 TK_SHL, TK_SHR,
0041 TK_DBCOLON, TK_EOS,
0042 TK_FLT, TK_INT, TK_NAME, TK_STRING
0043 };
0044
0045
0046 #define NUM_RESERVED (cast_int(TK_WHILE-FIRST_RESERVED + 1))
0047
0048
0049 typedef union {
0050 lua_Number r;
0051 lua_Integer i;
0052 TString *ts;
0053 } SemInfo;
0054
0055
0056 typedef struct Token {
0057 int token;
0058 SemInfo seminfo;
0059 } Token;
0060
0061
0062
0063
0064 typedef struct LexState {
0065 int current;
0066 int linenumber;
0067 int lastline;
0068 Token t;
0069 Token lookahead;
0070 struct FuncState *fs;
0071 struct lua_State *L;
0072 ZIO *z;
0073 Mbuffer *buff;
0074 Table *h;
0075 struct Dyndata *dyd;
0076 TString *source;
0077 TString *envn;
0078 } LexState;
0079
0080
0081 LUAI_FUNC void luaX_init (lua_State *L);
0082 LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
0083 TString *source, int firstchar);
0084 LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
0085 LUAI_FUNC void luaX_next (LexState *ls);
0086 LUAI_FUNC int luaX_lookahead (LexState *ls);
0087 LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
0088 LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
0089
0090
0091 #endif