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