annotate lib/lua/lua-5.2.2/llex.h @ 1996:f7e8c4d4a01b

sound id fix
author zipi
date Sun, 03 Nov 2013 14:29:45 +0000
parents 41cc4dd3c122
children
rev   line source
1866
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
1 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
2 ** $Id: llex.h,v 1.72 2011/11/30 12:43:51 roberto Exp $
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
3 ** Lexical Analyzer
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
4 ** See Copyright Notice in lua.h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
5 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
7 #ifndef llex_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
8 #define llex_h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
9
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
10 #include "lobject.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
11 #include "lzio.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
12
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
13
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
14 #define FIRST_RESERVED 257
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
15
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
16
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
17
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
18 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
19 * WARNING: if you change the order of this enumeration,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
20 * grep "ORDER RESERVED"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
21 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
22 enum RESERVED {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
23 /* terminal symbols denoted by reserved words */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
24 TK_AND = FIRST_RESERVED, TK_BREAK,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
25 TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
26 TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
27 TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
28 /* other terminal symbols */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
29 TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_DBCOLON, TK_EOS,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
30 TK_NUMBER, TK_NAME, TK_STRING
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
31 };
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
32
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
33 /* number of reserved words */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
34 #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
35
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
36
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
37 typedef union {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
38 lua_Number r;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
39 TString *ts;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
40 } SemInfo; /* semantics information */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
41
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
42
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
43 typedef struct Token {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
44 int token;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
45 SemInfo seminfo;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
46 } Token;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
47
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
48
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
49 /* state of the lexer plus state of the parser when shared by all
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
50 functions */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
51 typedef struct LexState {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
52 int current; /* current character (charint) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
53 int linenumber; /* input line counter */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
54 int lastline; /* line of last token `consumed' */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
55 Token t; /* current token */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
56 Token lookahead; /* look ahead token */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
57 struct FuncState *fs; /* current function (parser) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
58 struct lua_State *L;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
59 ZIO *z; /* input stream */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
60 Mbuffer *buff; /* buffer for tokens */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
61 struct Dyndata *dyd; /* dynamic structures used by the parser */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
62 TString *source; /* current source name */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
63 TString *envn; /* environment variable name */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
64 char decpoint; /* locale decimal point */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
65 } LexState;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
66
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
67
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
68 LUAI_FUNC void luaX_init (lua_State *L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
69 LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
70 TString *source, int firstchar);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
71 LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
72 LUAI_FUNC void luaX_next (LexState *ls);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
73 LUAI_FUNC int luaX_lookahead (LexState *ls);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
74 LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
75 LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
76
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
77
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
78 #endif