source: vendor/python/2.5/Parser/parser.h

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

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