The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
llex.h
Go to the documentation of this file.
1 /*
2 ** Lexical Analyzer
3 ** See Copyright Notice in lua.h
4 */
5 
6 #ifndef llex_h
7 #define llex_h
8 
9 #include "lobject.h"
10 #include "lzio.h"
11 
12 
13 #define FIRST_RESERVED 257
14 
15 
16 
17 /*
18 * WARNING: if you change the order of this enumeration,
19 * grep "ORDER RESERVED"
20 */
21 enum RESERVED {
22  /* terminal symbols denoted by reserved words */
27  /* other terminal symbols */
30 };
31 
32 /* number of reserved words */
33 #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
34 
35 
36 typedef union {
39 } SemInfo; /* semantics information */
40 
41 
42 typedef struct Token {
43  int token;
45 } Token;
46 
47 
48 /* state of the lexer plus state of the parser when shared by all
49  functions */
50 typedef struct LexState {
51  int current; /* current character (charint) */
52  int linenumber; /* input line counter */
53  int lastline; /* line of last token `consumed' */
54  Token t; /* current token */
55  Token lookahead; /* look ahead token */
56  struct FuncState *fs; /* current function (parser) */
57  struct lua_State *L;
58  ZIO *z; /* input stream */
59  Mbuffer *buff; /* buffer for tokens */
60  struct Dyndata *dyd; /* dynamic structures used by the parser */
61  TString *source; /* current source name */
62  TString *envn; /* environment variable name */
63  char decpoint; /* locale decimal point */
64 } LexState;
65 
66 
67 LUAI_FUNC void luaX_init (lua_State *L);
69  TString *source, int firstchar);
70 LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
71 LUAI_FUNC void luaX_next (LexState *ls);
73 LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
74 LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
75 
76 
77 #endif
char decpoint
Definition: llex.h:63
struct Dyndata * dyd
Definition: llex.h:60
GLdouble GLdouble z
Definition: glew.h:1527
Definition: llex.h:26
Definition: llex.h:24
Definition: llex.h:25
TString * envn
Definition: llex.h:62
Definition: llex.h:23
Definition: llex.h:29
LUAI_FUNC void luaX_setinput(lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar)
Definition: llex.cpp:158
Definition: llex.h:24
#define LUAI_FUNC
Definition: luaconf.h:187
Definition: llex.h:36
LUAI_FUNC void luaX_next(LexState *ls)
Definition: llex.cpp:513
Definition: llex.h:25
TString * ts
Definition: llex.h:38
int linenumber
Definition: llex.h:52
LUAI_FUNC void luaX_init(lua_State *L)
Definition: llex.cpp:64
int current
Definition: llex.h:51
int token
Definition: llex.h:43
struct Token Token
RESERVED
Definition: llex.h:21
Token lookahead
Definition: llex.h:55
Definition: llex.h:26
#define l_noret
Definition: llimits.h:108
Definition: llex.h:28
Definition: llex.h:28
Definition: llex.h:24
Token t
Definition: llex.h:54
Definition: llex.h:28
Definition: llex.h:42
GLdouble l
Definition: glew.h:6966
Definition: llex.h:26
Definition: llex.h:25
Definition: llex.h:28
Definition: llex.h:29
SemInfo seminfo
Definition: llex.h:44
Definition: llex.h:24
Definition: llex.h:26
LUAI_FUNC const char * luaX_token2str(LexState *ls, int token)
Definition: llex.cpp:74
Definition: llex.h:25
struct FuncState * fs
Definition: llex.h:56
Definition: llex.h:28
Definition: llex.h:23
Definition: lzio.h:53
Definition: llex.h:26
Definition: llex.h:24
TString * source
Definition: llex.h:61
Definition: llex.h:24
Definition: llex.h:50
lua_Number r
Definition: llex.h:37
Definition: llex.h:25
Definition: llex.h:25
LUAI_FUNC TString * luaX_newstring(LexState *ls, const char *str, size_t l)
Definition: llex.cpp:123
LUAI_FUNC l_noret luaX_syntaxerror(LexState *ls, const char *s)
Definition: llex.cpp:113
Definition: llex.h:28
#define FIRST_RESERVED
Definition: llex.h:13
struct lua_State * L
Definition: llex.h:57
Definition: llex.h:25
Definition: llex.h:25
Definition: lzio.h:22
LUAI_FUNC int luaX_lookahead(LexState *ls)
Definition: llex.cpp:524
struct LexState LexState
Definition: llex.h:28
GLdouble s
Definition: glew.h:1358
Mbuffer * buff
Definition: llex.h:59
GLsizei GLsizei GLchar * source
Definition: glew.h:1800
LUA_NUMBER lua_Number
Definition: lua.h:102
Definition: llex.h:29
ZIO * z
Definition: llex.h:58
int lastline
Definition: llex.h:53