Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ceguilua/src/lua-5.0.3/lua/llex.h @ 1803

Last change on this file since 1803 was 1803, checked in by rgrieder, 16 years ago

added files for lua 5.1.3, lua 5.0.3, CEGUILua-0.6.1 and CEGUILua-0.5.0b

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1/*
2** $Id: llex.h,v 1.47 2003/02/28 17:19:47 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/* maximum length of a reserved word */
17#define TOKEN_LEN       (sizeof("function")/sizeof(char))
18
19
20/*
21* WARNING: if you change the order of this enumeration,
22* grep "ORDER RESERVED"
23*/
24enum 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_FALSE, TK_FOR, TK_FUNCTION,
28  TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
29  TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
30  /* other terminal symbols */
31  TK_NAME, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
32  TK_STRING, TK_EOS
33};
34
35/* number of reserved words */
36#define NUM_RESERVED    (cast(int, TK_WHILE-FIRST_RESERVED+1))
37
38
39typedef union {
40  lua_Number r;
41  TString *ts;
42} SemInfo;  /* semantics information */
43
44
45typedef struct Token {
46  int token;
47  SemInfo seminfo;
48} Token;
49
50
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;  /* `FuncState' is private to the parser */
58  struct lua_State *L;
59  ZIO *z;  /* input stream */
60  Mbuffer *buff;  /* buffer for tokens */
61  TString *source;  /* current source name */
62  int nestlevel;  /* level of nested non-terminals */
63} LexState;
64
65
66void luaX_init (lua_State *L);
67void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source);
68int luaX_lex (LexState *LS, SemInfo *seminfo);
69void luaX_checklimit (LexState *ls, int val, int limit, const char *msg);
70void luaX_syntaxerror (LexState *ls, const char *s);
71void luaX_errorline (LexState *ls, const char *s, const char *token, int line);
72const char *luaX_token2str (LexState *ls, int token);
73
74
75#endif
Note: See TracBrowser for help on using the repository browser.