view c/regexParser/node.cc @ 128:f827682d4687 pairPro

fix
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Tue, 01 Dec 2015 22:50:58 +0900
parents 5d29b6a1b50f
children 7925e9abb078
line wrap: on
line source

#include <stdio.h>
#include "node.h"

static void descendTree(NodePtr n, int d) {
    if (n->right != NULL) {
        d++;
        descendTree(n->right, d);
        d--;
    }

    printf("%*c%s(%lu)\n",d*4, ' ',n->cc->cond->w->word,n->nodeNumber);

    if (n->left != NULL) {
        d++;
        descendTree(n->left, d);
        d--;
    }
}

void printTree(NodePtr n) {
    puts("---Print Node----");
    int d = 0;
    descendTree(n,d);
    puts("-----------------");
}