forked from oils-for-unix/oils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgen2.h
53 lines (42 loc) · 1.25 KB
/
pgen2.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
// pgen2.h
#ifndef LEAKY_PGEN2_H
#define LEAKY_PGEN2_H
#include "_gen/frontend/id_kind.asdl.h"
#include "_gen/frontend/syntax.asdl.h"
#include "mycpp/runtime.h"
// Hacky forward declaration for translated pgen2/pnode.py
// Note: it's probably better to express PNode in ASDL, like Token.
namespace pnode {
class PNode;
}
// Hacky stub
namespace grammar {
class Grammar;
}
namespace parse {
class ParseError {
public:
ParseError(Str* msg, int type_, syntax_asdl::Token* tok);
Str* msg;
syntax_asdl::Token* tok;
int type;
};
class Parser {
public:
// In C, the grammar is a constant, so the grammar arg is ignored. (We can't
// get easily rid of it because the call site has to type check and run in
// Python.)
explicit Parser(grammar::Grammar* grammar) {
}
void setup(int start);
bool addtoken(int typ, syntax_asdl::Token* opaque, int ilabel);
// Probably should delete these
// void shift(int typ, syntax_asdl::Token* opaque, int newstate);
// void push(int typ, syntax_asdl::Token* opaque, Tuple2<List<List<Tuple2<int,
// int>*>*>*, Dict<int, int>*>* newdfa, int newstate); void pop();
// grammar::Grammar* grammar;
pnode::PNode* rootnode;
// List<parse::_StackItem*>* stack;
};
} // namespace parse
#endif // LEAKY_PGEN2_H