2 ** $Id: llex.h,v 1.72.1.1 2013/04/12 18:48:47 roberto Exp $
4 ** See Copyright Notice in lua.h
14 #define FIRST_RESERVED 257
19 * WARNING: if you change the order of this enumeration,
20 * grep "ORDER 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
33 /* number of reserved words */
34 #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
40 } SemInfo
; /* semantics information */
43 typedef struct Token
{
52 /* state of the lexer plus state of the parser when shared by all
54 typedef struct LexState
{
55 int current
; /* current character (charint) */
56 int linenumber
; /* input line counter */
57 int lastline
; /* line of last token `consumed' */
58 Token t
; /* current token */
59 Token lookahead
; /* look ahead token */
60 struct FuncState
*fs
; /* current function (parser) */
62 ZIO
*z
; /* input stream */
63 Mbuffer
*buff
; /* buffer for tokens */
64 struct Dyndata
*dyd
; /* dynamic structures used by the parser */
65 TString
*source
; /* current source name */
66 TString
*envn
; /* environment variable name */
67 char decpoint
; /* locale decimal point */
71 LUAI_FUNC
void luaX_init (lua_State
*L
);
72 LUAI_FUNC
void luaX_setinput (lua_State
*L
, LexState
*ls
, ZIO
*z
,
73 TString
*source
, int firstchar
);
74 LUAI_FUNC TString
*luaX_newstring (LexState
*ls
, const char *str
, size_t l
);
75 LUAI_FUNC
void luaX_next (LexState
*ls
);
76 LUAI_FUNC
int luaX_lookahead (LexState
*ls
);
77 LUAI_FUNC l_noret
luaX_syntaxerror (LexState
*ls
, const char *s
);
78 LUAI_FUNC
const char *luaX_token2str (LexState
*ls
, int token
);