| |
|
| | |
| |
|
| | #ifndef Py_GRAMMAR_H |
| | #define Py_GRAMMAR_H |
| | #ifdef __cplusplus |
| | extern "C" { |
| | #endif |
| |
|
| | #include "bitset.h" |
| |
|
| | |
| |
|
| | typedef struct { |
| | int lb_type; |
| | const char *lb_str; |
| | } label; |
| |
|
| | #define EMPTY 0 |
| |
|
| | |
| |
|
| | typedef struct { |
| | int ll_nlabels; |
| | const label *ll_label; |
| | } labellist; |
| |
|
| | |
| |
|
| | typedef struct { |
| | short a_lbl; |
| | short a_arrow; |
| | } arc; |
| |
|
| | |
| |
|
| | typedef struct { |
| | int s_narcs; |
| | const arc *s_arc; |
| |
|
| | |
| | int s_lower; |
| | int s_upper; |
| | int *s_accel; |
| | int s_accept; |
| | } state; |
| |
|
| | |
| |
|
| | typedef struct { |
| | int d_type; |
| | char *d_name; |
| | int d_nstates; |
| | state *d_state; |
| | bitset d_first; |
| | } dfa; |
| |
|
| | |
| |
|
| | typedef struct { |
| | int g_ndfas; |
| | const dfa *g_dfa; |
| | const labellist g_ll; |
| | int g_start; |
| | int g_accel; |
| | } grammar; |
| |
|
| | |
| | const dfa *PyGrammar_FindDFA(grammar *g, int type); |
| | const char *PyGrammar_LabelRepr(label *lb); |
| | void PyGrammar_AddAccelerators(grammar *g); |
| | void PyGrammar_RemoveAccelerators(grammar *); |
| |
|
| | #ifdef __cplusplus |
| | } |
| | #endif |
| | #endif |
| |
|