-
Notifications
You must be signed in to change notification settings - Fork 4
/
bparser.h
62 lines (51 loc) · 1004 Bytes
/
bparser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef BEAN_PARSER_H
#define BEAN_PARSER_H
#include "blex.h"
#include "bobject.h"
#include "bhash.h"
#define MAX_LEN_ID 255
#define MAX_ARGS 16 // MAX args of function
/*
** Marks the end of a patch list. It is an invalid value both as an absolute
** address, and as a list link (would link an element to itself).
*/
#define NO_JUMP (-1)
typedef struct LocalVar {
TString * name;
TValue value;
} LocalVar;
// Power
typedef enum {
BP_NONE,
BP_LOWEST,
BP_ASSIGN,
BP_CONDITION,
BP_LOGIC_OR,
BP_LOGIC_AND,
BP_EQUAL,
BP_IS,
BP_CMP,
BP_BIT_OR,
BP_BIT_XOR,
BP_BIT_AND,
BP_BIT_SHIFT,
BP_RANGE,
BP_TERM,
BP_FACTOR,
BP_UNARY,
BP_CALL,
BP_DOT,
BP_HIGHTEST
} bindpower;
typedef struct LexState LexState;
typedef void (*denotation_fn) (LexState *ls);
typedef struct symbol {
char * id;
bindpower lbp;
denotation_fn nud;
denotation_fn led;
} symbol;
extern symbol symbol_table[];
void bparser(LexState * ls);
void bparser_for_line(LexState * ls);
#endif