summaryrefslogtreecommitdiff
path: root/src/llex.h
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2003-04-11 12:00:00 +0000
committerrepogen <>2003-04-11 12:00:00 +0000
commitf0e4e22f5c119865eb5a8d3844a40df2d5980b3b (patch)
treec4df063a747e9c99f8aba1678588a030993780a9 /src/llex.h
parent1981b7c90eb09e956e969cda5c473be4560af573 (diff)
downloadlua-github-f0e4e22f5c119865eb5a8d3844a40df2d5980b3b.tar.gz
Lua 5.05.0
Diffstat (limited to 'src/llex.h')
-rw-r--r--src/llex.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/llex.h b/src/llex.h
index 3b379960..740e3f6b 100644
--- a/src/llex.h
+++ b/src/llex.h
@@ -1,5 +1,5 @@
/*
-** $Id: llex.h,v 1.31 2000/09/27 17:41:58 roberto Exp $
+** $Id: llex.h,v 1.47 2003/02/28 17:19:47 roberto Exp $
** Lexical Analyzer
** See Copyright Notice in lua.h
*/
@@ -13,8 +13,8 @@
#define FIRST_RESERVED 257
-/* maximum length of a reserved word (+1 for final 0) */
-#define TOKEN_LEN 15
+/* maximum length of a reserved word */
+#define TOKEN_LEN (sizeof("function")/sizeof(char))
/*
@@ -24,19 +24,20 @@
enum RESERVED {
/* terminal symbols denoted by reserved words */
TK_AND = FIRST_RESERVED, TK_BREAK,
- TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FOR, TK_FUNCTION, TK_IF, TK_LOCAL,
- TK_NIL, TK_NOT, TK_OR, TK_REPEAT, TK_RETURN, TK_THEN, TK_UNTIL, TK_WHILE,
+ TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
+ TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
+ TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
/* other terminal symbols */
TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
TK_STRING, TK_EOS
};
/* number of reserved words */
-#define NUM_RESERVED ((int)(TK_WHILE-FIRST_RESERVED+1))
+#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
typedef union {
- Number r;
+ lua_Number r;
TString *ts;
} SemInfo; /* semantics information */
@@ -48,15 +49,17 @@ typedef struct Token {
typedef struct LexState {
- int current; /* current character */
+ int current; /* current character (charint) */
+ int linenumber; /* input line counter */
+ int lastline; /* line of last token `consumed' */
Token t; /* current token */
Token lookahead; /* look ahead token */
struct FuncState *fs; /* `FuncState' is private to the parser */
struct lua_State *L;
- struct zio *z; /* input stream */
- int linenumber; /* input line counter */
- int lastline; /* line of last token `consumed' */
+ ZIO *z; /* input stream */
+ Mbuffer *buff; /* buffer for tokens */
TString *source; /* current source name */
+ int nestlevel; /* level of nested non-terminals */
} LexState;
@@ -64,9 +67,9 @@ void luaX_init (lua_State *L);
void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
int luaX_lex (LexState *LS, SemInfo *seminfo);
void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
-void luaX_syntaxerror (LexState *ls, const char *s, const char *token);
-void luaX_error (LexState *ls, const char *s, int token);
-void luaX_token2str (int token, char *s);
+void luaX_syntaxerror (LexState *ls, const char *s);
+void luaX_errorline (LexState *ls, const char *s, const char *token, int line);
+const char *luaX_token2str (LexState *ls, int token);
#endif