Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef llex_h
00008 #define llex_h
00009
00010 #include "lobject.h"
00011 #include "lzio.h"
00012
00013
00014 #define FIRST_RESERVED 257
00015
00016
00017
00018
00019
00020
00021
00022 enum RESERVED {
00023
00024 TK_AND = FIRST_RESERVED, TK_BREAK,
00025 TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
00026 TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
00027 TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
00028
00029 TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS,
00030 TK_NUMBER, TK_NAME, TK_STRING
00031 };
00032
00033
00034 #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
00035
00036
00037 typedef union {
00038 lua_Number r;
00039 TString *ts;
00040 } SemInfo;
00041
00042
00043 typedef struct Token {
00044 int token;
00045 SemInfo seminfo;
00046 } Token;
00047
00048
00049
00050
00051 typedef struct LexState {
00052 int current;
00053 int linenumber;
00054 int lastline;
00055 Token t;
00056 Token lookahead;
00057 struct FuncState *fs;
00058 struct lua_State *L;
00059 ZIO *z;
00060 Mbuffer *buff;
00061 struct Dyndata *dyd;
00062 TString *source;
00063 TString *envn;
00064 char decpoint;
00065 } LexState;
00066
00067
00068 LUAI_FUNC void luaX_init (lua_State *L);
00069 LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
00070 TString *source, int firstchar);
00071 LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
00072 LUAI_FUNC void luaX_next (LexState *ls);
00073 LUAI_FUNC int luaX_lookahead (LexState *ls);
00074 LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
00075 LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
00076
00077
00078 #endif