Back to index

python3.2  3.2.2
Classes | Defines | Functions
parser.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stackentry
struct  stack
struct  parser_state

Defines

#define MAXSTACK   1500

Functions

parser_statePyParser_New (grammar *g, int start)
void PyParser_Delete (parser_state *ps)
int PyParser_AddToken (parser_state *ps, int type, char *str, int lineno, int col_offset, int *expected_ret)
void PyGrammar_AddAccelerators (grammar *g)

Class Documentation

struct stackentry

Definition at line 12 of file parser.h.

Collaboration diagram for stackentry:
Class Members
dfa * s_dfa
struct _node * s_parent
int s_state
struct stack

Definition at line 18 of file parser.h.

Collaboration diagram for stack:
Class Members
stackentry s_base
stackentry * s_top
struct parser_state

Definition at line 24 of file parser.h.

Collaboration diagram for parser_state:
Class Members
grammar * p_grammar
stack p_stack
node * p_tree

Define Documentation

#define MAXSTACK   1500

Definition at line 10 of file parser.h.


Function Documentation

Definition at line 24 of file acceler.c.

{
    dfa *d;
    int i;
    d = g->g_dfa;
    for (i = g->g_ndfas; --i >= 0; d++)
        fixdfa(g, d);
    g->g_accel = 1;
}

Here is the call graph for this function:

int PyParser_AddToken ( parser_state ps,
int  type,
char *  str,
int  lineno,
int  col_offset,
int expected_ret 
)

Definition at line 96 of file parser.c.

{
    /* NB If you want to save the parse tree,
       you must set p_tree to NULL before calling delparser! */
    PyNode_Free(ps->p_tree);
    PyMem_FREE(ps);
}

Here is the call graph for this function:

Here is the caller graph for this function:

parser_state* PyParser_New ( grammar g,
int  start 
)

Definition at line 72 of file parser.c.

{
    parser_state *ps;

    if (!g->g_accel)
        PyGrammar_AddAccelerators(g);
    ps = (parser_state *)PyMem_MALLOC(sizeof(parser_state));
    if (ps == NULL)
        return NULL;
    ps->p_grammar = g;
#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD
    ps->p_flags = 0;
#endif
    ps->p_tree = PyNode_New(start);
    if (ps->p_tree == NULL) {
        PyMem_FREE(ps);
        return NULL;
    }
    s_reset(&ps->p_stack);
    (void) s_push(&ps->p_stack, PyGrammar_FindDFA(g, start), ps->p_tree);
    return ps;
}

Here is the call graph for this function:

Here is the caller graph for this function: