]>
Commit | Line | Data |
---|---|---|
c8042e10 DM |
1 | #ifndef Py_PARSER_H\r |
2 | #define Py_PARSER_H\r | |
3 | #ifdef __cplusplus\r | |
4 | extern "C" {\r | |
5 | #endif\r | |
6 | \r | |
7 | \r | |
8 | /* Parser interface */\r | |
9 | \r | |
10 | #define MAXSTACK 1500\r | |
11 | \r | |
12 | typedef struct {\r | |
13 | int s_state; /* State in current DFA */\r | |
14 | dfa *s_dfa; /* Current DFA */\r | |
15 | struct _node *s_parent; /* Where to add next node */\r | |
16 | } stackentry;\r | |
17 | \r | |
18 | typedef struct {\r | |
19 | stackentry *s_top; /* Top entry */\r | |
20 | stackentry s_base[MAXSTACK];/* Array of stack entries */\r | |
21 | /* NB The stack grows down */\r | |
22 | } stack;\r | |
23 | \r | |
24 | typedef struct {\r | |
25 | stack p_stack; /* Stack of parser states */\r | |
26 | grammar *p_grammar; /* Grammar to use */\r | |
27 | node *p_tree; /* Top of parse tree */\r | |
28 | #ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD\r | |
29 | unsigned long p_flags; /* see co_flags in Include/code.h */\r | |
30 | #endif\r | |
31 | } parser_state;\r | |
32 | \r | |
33 | parser_state *PyParser_New(grammar *g, int start);\r | |
34 | void PyParser_Delete(parser_state *ps);\r | |
35 | int PyParser_AddToken(parser_state *ps, int type, char *str, int lineno, int col_offset,\r | |
36 | int *expected_ret);\r | |
37 | void PyGrammar_AddAccelerators(grammar *g);\r | |
38 | \r | |
39 | #ifdef __cplusplus\r | |
40 | }\r | |
41 | #endif\r | |
42 | #endif /* !Py_PARSER_H */\r |