aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/luajit-2.0/src/lj_lex.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/luajit-2.0/src/lj_lex.h')
-rw-r--r--libraries/luajit-2.0/src/lj_lex.h82
1 files changed, 0 insertions, 82 deletions
diff --git a/libraries/luajit-2.0/src/lj_lex.h b/libraries/luajit-2.0/src/lj_lex.h
deleted file mode 100644
index 1ddf4b5..0000000
--- a/libraries/luajit-2.0/src/lj_lex.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2** Lexical analyzer.
3** Major parts taken verbatim from the Lua interpreter.
4** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
5*/
6
7#ifndef _LJ_LEX_H
8#define _LJ_LEX_H
9
10#include <stdarg.h>
11
12#include "lj_obj.h"
13#include "lj_err.h"
14
15/* Lua lexer tokens. */
16#define TKDEF(_, __) \
17 _(and) _(break) _(do) _(else) _(elseif) _(end) _(false) \
18 _(for) _(function) _(if) _(in) _(local) _(nil) _(not) _(or) \
19 _(repeat) _(return) _(then) _(true) _(until) _(while) \
20 __(concat, ..) __(dots, ...) __(eq, ==) __(ge, >=) __(le, <=) __(ne, ~=) \
21 __(number, <number>) __(name, <name>) __(string, <string>) __(eof, <eof>)
22
23enum {
24 TK_OFS = 256,
25#define TKENUM1(name) TK_##name,
26#define TKENUM2(name, sym) TK_##name,
27TKDEF(TKENUM1, TKENUM2)
28#undef TKENUM1
29#undef TKENUM2
30 TK_RESERVED = TK_while - TK_OFS
31};
32
33typedef int LexToken;
34
35/* Combined bytecode ins/line. Only used during bytecode generation. */
36typedef struct BCInsLine {
37 BCIns ins; /* Bytecode instruction. */
38 BCLine line; /* Line number for this bytecode. */
39} BCInsLine;
40
41/* Info for local variables. Only used during bytecode generation. */
42typedef struct VarInfo {
43 GCRef name; /* Local variable name. */
44 BCPos startpc; /* First point where the local variable is active. */
45 BCPos endpc; /* First point where the local variable is dead. */
46} VarInfo;
47
48/* Lua lexer state. */
49typedef struct LexState {
50 struct FuncState *fs; /* Current FuncState. Defined in lj_parse.c. */
51 struct lua_State *L; /* Lua state. */
52 TValue tokenval; /* Current token value. */
53 TValue lookaheadval; /* Lookahead token value. */
54 int current; /* Current character (charint). */
55 LexToken token; /* Current token. */
56 LexToken lookahead; /* Lookahead token. */
57 MSize n; /* Bytes left in input buffer. */
58 const char *p; /* Current position in input buffer. */
59 SBuf sb; /* String buffer for tokens. */
60 lua_Reader rfunc; /* Reader callback. */
61 void *rdata; /* Reader callback data. */
62 BCLine linenumber; /* Input line counter. */
63 BCLine lastline; /* Line of last token. */
64 GCstr *chunkname; /* Current chunk name (interned string). */
65 const char *chunkarg; /* Chunk name argument. */
66 VarInfo *vstack; /* Stack for names and extents of local variables. */
67 MSize sizevstack; /* Size of variable stack. */
68 MSize vtop; /* Top of variable stack. */
69 BCInsLine *bcstack; /* Stack for bytecode instructions/line numbers. */
70 MSize sizebcstack; /* Size of bytecode stack. */
71 uint32_t level; /* Syntactical nesting level. */
72} LexState;
73
74LJ_FUNC int lj_lex_setup(lua_State *L, LexState *ls);
75LJ_FUNC void lj_lex_cleanup(lua_State *L, LexState *ls);
76LJ_FUNC void lj_lex_next(LexState *ls);
77LJ_FUNC LexToken lj_lex_lookahead(LexState *ls);
78LJ_FUNC const char *lj_lex_token2str(LexState *ls, LexToken token);
79LJ_FUNC_NORET void lj_lex_error(LexState *ls, LexToken token, ErrMsg em, ...);
80LJ_FUNC void lj_lex_init(lua_State *L);
81
82#endif