diff src/lua/llex.h @ 11:27763b933818

raise lua sources up one level
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 11:07:39 -0600
parents src/lua/src/llex.h@f9f4f1b99eed
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/lua/llex.h	Sat Mar 03 11:07:39 2012 -0600
     1.3 @@ -0,0 +1,81 @@
     1.4 +/*
     1.5 +** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $
     1.6 +** Lexical Analyzer
     1.7 +** See Copyright Notice in lua.h
     1.8 +*/
     1.9 +
    1.10 +#ifndef llex_h
    1.11 +#define llex_h
    1.12 +
    1.13 +#include "lobject.h"
    1.14 +#include "lzio.h"
    1.15 +
    1.16 +
    1.17 +#define FIRST_RESERVED	257
    1.18 +
    1.19 +/* maximum length of a reserved word */
    1.20 +#define TOKEN_LEN	(sizeof("function")/sizeof(char))
    1.21 +
    1.22 +
    1.23 +/*
    1.24 +* WARNING: if you change the order of this enumeration,
    1.25 +* grep "ORDER RESERVED"
    1.26 +*/
    1.27 +enum RESERVED {
    1.28 +  /* terminal symbols denoted by reserved words */
    1.29 +  TK_AND = FIRST_RESERVED, TK_BREAK,
    1.30 +  TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION,
    1.31 +  TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT,
    1.32 +  TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
    1.33 +  /* other terminal symbols */
    1.34 +  TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
    1.35 +  TK_NAME, TK_STRING, TK_EOS
    1.36 +};
    1.37 +
    1.38 +/* number of reserved words */
    1.39 +#define NUM_RESERVED	(cast(int, TK_WHILE-FIRST_RESERVED+1))
    1.40 +
    1.41 +
    1.42 +/* array with token `names' */
    1.43 +LUAI_DATA const char *const luaX_tokens [];
    1.44 +
    1.45 +
    1.46 +typedef union {
    1.47 +  lua_Number r;
    1.48 +  TString *ts;
    1.49 +} SemInfo;  /* semantics information */
    1.50 +
    1.51 +
    1.52 +typedef struct Token {
    1.53 +  int token;
    1.54 +  SemInfo seminfo;
    1.55 +} Token;
    1.56 +
    1.57 +
    1.58 +typedef struct LexState {
    1.59 +  int current;  /* current character (charint) */
    1.60 +  int linenumber;  /* input line counter */
    1.61 +  int lastline;  /* line of last token `consumed' */
    1.62 +  Token t;  /* current token */
    1.63 +  Token lookahead;  /* look ahead token */
    1.64 +  struct FuncState *fs;  /* `FuncState' is private to the parser */
    1.65 +  struct lua_State *L;
    1.66 +  ZIO *z;  /* input stream */
    1.67 +  Mbuffer *buff;  /* buffer for tokens */
    1.68 +  TString *source;  /* current source name */
    1.69 +  char decpoint;  /* locale decimal point */
    1.70 +} LexState;
    1.71 +
    1.72 +
    1.73 +LUAI_FUNC void luaX_init (lua_State *L);
    1.74 +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z,
    1.75 +                              TString *source);
    1.76 +LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l);
    1.77 +LUAI_FUNC void luaX_next (LexState *ls);
    1.78 +LUAI_FUNC void luaX_lookahead (LexState *ls);
    1.79 +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token);
    1.80 +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s);
    1.81 +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token);
    1.82 +
    1.83 +
    1.84 +#endif