Back to index

python3.2  3.2.2
Functions | Variables
listnode.c File Reference
#include "pgenheaders.h"
#include "token.h"
#include "node.h"

Go to the source code of this file.

Functions

static void list1node (FILE *, node *)
static void listnode (FILE *, node *)
void PyNode_ListTree (node *n)

Variables

static int level
static int atbol

Function Documentation

static void list1node ( FILE *  fp,
node n 
) [static]

Definition at line 29 of file listnode.c.

{
    if (n == 0)
        return;
    if (ISNONTERMINAL(TYPE(n))) {
        int i;
        for (i = 0; i < NCH(n); i++)
            list1node(fp, CHILD(n, i));
    }
    else if (ISTERMINAL(TYPE(n))) {
        switch (TYPE(n)) {
        case INDENT:
            ++level;
            break;
        case DEDENT:
            --level;
            break;
        default:
            if (atbol) {
                int i;
                for (i = 0; i < level; ++i)
                    fprintf(fp, "\t");
                atbol = 0;
            }
            if (TYPE(n) == NEWLINE) {
                if (STR(n) != NULL)
                    fprintf(fp, "%s", STR(n));
                fprintf(fp, "\n");
                atbol = 1;
            }
            else
                fprintf(fp, "%s ", STR(n));
            break;
        }
    }
    else
        fprintf(fp, "? ");
}

Here is the caller graph for this function:

static void listnode ( FILE *  fp,
node n 
) [static]

Definition at line 21 of file listnode.c.

{
    level = 0;
    atbol = 1;
    list1node(fp, n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 13 of file listnode.c.

{
    listnode(stdout, n);
}

Here is the call graph for this function:


Variable Documentation

int atbol [static]

Definition at line 18 of file listnode.c.

int level [static]

Definition at line 18 of file listnode.c.