2 ** $Id: llex.h,v 1.31 2000/09/27 17:41:58 roberto Exp $
4 ** See Copyright Notice in lua.h
14 #define FIRST_RESERVED 257
16 /* maximum length of a reserved word (+1 for final 0) */
21 * WARNING: if you change the order of this enumeration,
22 * grep "ORDER RESERVED"
25 /* terminal symbols denoted by reserved words */
26 TK_AND
= FIRST_RESERVED
, TK_BREAK
,
27 TK_DO
, TK_ELSE
, TK_ELSEIF
, TK_END
, TK_FOR
, TK_FUNCTION
, TK_IF
, TK_LOCAL
,
28 TK_NIL
, TK_NOT
, TK_OR
, TK_REPEAT
, TK_RETURN
, TK_THEN
, TK_UNTIL
, TK_WHILE
,
29 /* other terminal symbols */
30 TK_NAME
, TK_CONCAT
, TK_DOTS
, TK_EQ
, TK_GE
, TK_LE
, TK_NE
, TK_NUMBER
,
34 /* number of reserved words */
35 #define NUM_RESERVED ((int)(TK_WHILE-FIRST_RESERVED+1))
41 } SemInfo
; /* semantics information */
44 typedef struct Token
{
50 typedef struct LexState
{
51 int current
; /* current character */
52 Token t
; /* current token */
53 Token lookahead
; /* look ahead token */
54 struct FuncState
*fs
; /* `FuncState' is private to the parser */
56 struct zio
*z
; /* input stream */
57 int linenumber
; /* input line counter */
58 int lastline
; /* line of last token `consumed' */
59 TString
*source
; /* current source name */
63 void luaX_init (lua_State
*L
);
64 void luaX_setinput (lua_State
*L
, LexState
*LS
, ZIO
*z
, TString
*source
);
65 int luaX_lex (LexState
*LS
, SemInfo
*seminfo
);
66 void luaX_checklimit (LexState
*ls
, int val
, int limit
, const char *msg
);
67 void luaX_syntaxerror (LexState
*ls
, const char *s
, const char *token
);
68 void luaX_error (LexState
*ls
, const char *s
, int token
);
69 void luaX_token2str (int token
, char *s
);