Ardour
9.0-pre0-386-g96ef4d20f2
llex.h
Go to the documentation of this file.
1
/*
2
** $Id: llex.h,v 1.79.1.1 2017/04/19 17:20:42 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
17
#if !defined(LUA_ENV)
18
#define LUA_ENV "_ENV"
19
#endif
20
21
22
/*
23
* WARNING: if you change the order of this enumeration,
24
* grep "ORDER RESERVED"
25
*/
26
enum
RESERVED
{
27
/* terminal symbols denoted by reserved words */
28
TK_AND
=
FIRST_RESERVED
,
TK_BREAK
,
29
TK_DO
,
TK_ELSE
,
TK_ELSEIF
,
TK_END
,
TK_FALSE
,
TK_FOR
,
TK_FUNCTION
,
30
TK_GOTO
,
TK_IF
,
TK_IN
,
TK_LOCAL
,
TK_NIL
,
TK_NOT
,
TK_OR
,
TK_REPEAT
,
31
TK_RETURN
,
TK_THEN
,
TK_TRUE
,
TK_UNTIL
,
TK_WHILE
,
32
/* other terminal symbols */
33
TK_IDIV
,
TK_CONCAT
,
TK_DOTS
,
TK_EQ
,
TK_GE
,
TK_LE
,
TK_NE
,
34
TK_SHL
,
TK_SHR
,
35
TK_DBCOLON
,
TK_EOS
,
36
TK_FLT
,
TK_INT
,
TK_NAME
,
TK_STRING
37
};
38
39
/* number of reserved words */
40
#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1))
41
42
43
typedef
union
{
44
lua_Number
r
;
45
lua_Integer
i
;
46
TString
*
ts
;
47
}
SemInfo
;
/* semantics information */
48
49
50
typedef
struct
Token
{
51
int
token
;
52
SemInfo
seminfo
;
53
}
Token
;
54
55
56
/* state of the lexer plus state of the parser when shared by all
57
functions */
58
typedef
struct
LexState
{
59
int
current
;
/* current character (charint) */
60
int
linenumber
;
/* input line counter */
61
int
lastline
;
/* line of last token 'consumed' */
62
Token
t
;
/* current token */
63
Token
lookahead
;
/* look ahead token */
64
struct
FuncState
*
fs
;
/* current function (parser) */
65
struct
lua_State
*
L
;
66
ZIO
*
z
;
/* input stream */
67
Mbuffer
*
buff
;
/* buffer for tokens */
68
Table
*
h
;
/* to avoid collection/reuse strings */
69
struct
Dyndata
*
dyd
;
/* dynamic structures used by the parser */
70
TString
*
source
;
/* current source name */
71
TString
*
envn
;
/* environment variable name */
72
}
LexState
;
73
74
75
LUAI_FUNC
void
luaX_init
(
lua_State
*L);
76
LUAI_FUNC
void
luaX_setinput
(
lua_State
*L,
LexState
*ls,
ZIO
*z,
77
TString
*source,
int
firstchar);
78
LUAI_FUNC
TString
*
luaX_newstring
(
LexState
*ls,
const
char
*str,
size_t
l);
79
LUAI_FUNC
void
luaX_next
(
LexState
*ls);
80
LUAI_FUNC
int
luaX_lookahead
(
LexState
*ls);
81
LUAI_FUNC
l_noret
luaX_syntaxerror
(
LexState
*ls,
const
char
*s);
82
LUAI_FUNC
const
char
*
luaX_token2str
(
LexState
*ls,
int
token);
83
84
85
#endif
luaX_setinput
void luaX_setinput(lua_State *L, LexState *ls, ZIO *z, TString *source, int firstchar)
luaX_init
void luaX_init(lua_State *L)
FIRST_RESERVED
#define FIRST_RESERVED
Definition:
llex.h:14
luaX_newstring
TString * luaX_newstring(LexState *ls, const char *str, size_t l)
luaX_next
void luaX_next(LexState *ls)
LexState
struct LexState LexState
luaX_syntaxerror
void luaX_syntaxerror(LexState *ls, const char *s)
RESERVED
RESERVED
Definition:
llex.h:26
TK_FALSE
@ TK_FALSE
Definition:
llex.h:29
TK_STRING
@ TK_STRING
Definition:
llex.h:36
TK_DO
@ TK_DO
Definition:
llex.h:29
TK_BREAK
@ TK_BREAK
Definition:
llex.h:28
TK_GE
@ TK_GE
Definition:
llex.h:33
TK_DBCOLON
@ TK_DBCOLON
Definition:
llex.h:35
TK_ELSE
@ TK_ELSE
Definition:
llex.h:29
TK_DOTS
@ TK_DOTS
Definition:
llex.h:33
TK_END
@ TK_END
Definition:
llex.h:29
TK_WHILE
@ TK_WHILE
Definition:
llex.h:31
TK_LOCAL
@ TK_LOCAL
Definition:
llex.h:30
TK_IF
@ TK_IF
Definition:
llex.h:30
TK_TRUE
@ TK_TRUE
Definition:
llex.h:31
TK_NE
@ TK_NE
Definition:
llex.h:33
TK_THEN
@ TK_THEN
Definition:
llex.h:31
TK_FOR
@ TK_FOR
Definition:
llex.h:29
TK_IDIV
@ TK_IDIV
Definition:
llex.h:33
TK_FLT
@ TK_FLT
Definition:
llex.h:36
TK_CONCAT
@ TK_CONCAT
Definition:
llex.h:33
TK_NAME
@ TK_NAME
Definition:
llex.h:36
TK_IN
@ TK_IN
Definition:
llex.h:30
TK_NIL
@ TK_NIL
Definition:
llex.h:30
TK_NOT
@ TK_NOT
Definition:
llex.h:30
TK_INT
@ TK_INT
Definition:
llex.h:36
TK_REPEAT
@ TK_REPEAT
Definition:
llex.h:30
TK_EOS
@ TK_EOS
Definition:
llex.h:35
TK_FUNCTION
@ TK_FUNCTION
Definition:
llex.h:29
TK_OR
@ TK_OR
Definition:
llex.h:30
TK_UNTIL
@ TK_UNTIL
Definition:
llex.h:31
TK_RETURN
@ TK_RETURN
Definition:
llex.h:31
TK_LE
@ TK_LE
Definition:
llex.h:33
TK_SHR
@ TK_SHR
Definition:
llex.h:34
TK_AND
@ TK_AND
Definition:
llex.h:28
TK_EQ
@ TK_EQ
Definition:
llex.h:33
TK_GOTO
@ TK_GOTO
Definition:
llex.h:30
TK_ELSEIF
@ TK_ELSEIF
Definition:
llex.h:29
TK_SHL
@ TK_SHL
Definition:
llex.h:34
Token
struct Token Token
luaX_lookahead
int luaX_lookahead(LexState *ls)
luaX_token2str
const char * luaX_token2str(LexState *ls, int token)
l_noret
#define l_noret
Definition:
llimits.h:143
lobject.h
lua_Integer
LUA_INTEGER lua_Integer
Definition:
lua-5.3.5/lua.h:93
lua_Number
double lua_Number
Definition:
lua-5.3.5/lua.h:89
LUAI_FUNC
#define LUAI_FUNC
Definition:
luaconf.h:282
lzio.h
Dyndata
Definition:
lparser.h:95
FuncState
Definition:
lparser.h:111
LexState
Definition:
llex.h:58
LexState::fs
struct FuncState * fs
Definition:
llex.h:64
LexState::source
TString * source
Definition:
llex.h:70
LexState::h
Table * h
Definition:
llex.h:68
LexState::envn
TString * envn
Definition:
llex.h:71
LexState::dyd
struct Dyndata * dyd
Definition:
llex.h:69
LexState::z
ZIO * z
Definition:
llex.h:66
LexState::t
Token t
Definition:
llex.h:62
LexState::linenumber
int linenumber
Definition:
llex.h:60
LexState::lastline
int lastline
Definition:
llex.h:61
LexState::buff
Mbuffer * buff
Definition:
llex.h:67
LexState::current
int current
Definition:
llex.h:59
LexState::lookahead
Token lookahead
Definition:
llex.h:63
LexState::L
struct lua_State * L
Definition:
llex.h:65
Mbuffer
Definition:
lzio.h:23
TString
Definition:
lobject.h:303
Table
Definition:
lobject.h:497
Token
Definition:
llex.h:50
Token::seminfo
SemInfo seminfo
Definition:
llex.h:52
Token::token
int token
Definition:
llex.h:51
Zio
Definition:
lzio.h:55
lua_State
Definition:
lstate.h:178
SemInfo
Definition:
llex.h:43
SemInfo::ts
TString * ts
Definition:
llex.h:46
SemInfo::r
lua_Number r
Definition:
llex.h:44
SemInfo::i
lua_Integer i
Definition:
llex.h:45
libs
lua
lua-5.3.5
llex.h
Generated on Sun Nov 10 2024 05:34:27 for Ardour by
1.9.1