forked from oils-for-unix/oils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosh_tdop.h
50 lines (35 loc) · 935 Bytes
/
osh_tdop.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
// Replacement for osh/arith_parse
#ifndef FRONTEND_TDOP_H
#define FRONTEND_TDOP_H
#include "_gen/frontend/id_kind.asdl.h"
#include "_gen/frontend/syntax.asdl.h"
using id_kind_asdl::Id_t;
using syntax_asdl::arith_expr_t;
using syntax_asdl::word_t;
namespace tdop {
class TdopParser; // forward declaration
typedef arith_expr_t* (*LeftFunc)(TdopParser*, word_t*, arith_expr_t*, int);
typedef arith_expr_t* (*NullFunc)(TdopParser*, word_t*, int);
struct LeftInfo {
LeftFunc led;
int lbp;
int rbp;
DISALLOW_COPY_AND_ASSIGN(LeftInfo)
};
struct NullInfo {
NullFunc nud;
int bp;
DISALLOW_COPY_AND_ASSIGN(NullInfo)
};
class ParserSpec {
public:
// No fields
ParserSpec() : GC_CLASS_FIXED(header_, kZeroMask, sizeof(ParserSpec)) {
}
LeftInfo* LookupLed(Id_t id);
NullInfo* LookupNud(Id_t id);
DISALLOW_COPY_AND_ASSIGN(ParserSpec)
GC_OBJ(header_);
};
} // namespace tdop
#endif // FRONTEND_TDOP_H