Mercurial > hg > Applications > Grep
comparison c/regexParser/node.cc @ 112:ec485345daf9 pairPro
some function use static
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 23 Nov 2015 15:54:19 +0900 |
parents | a3adc5c24e19 |
children | 66c633575b53 |
comparison
equal
deleted
inserted
replaced
111:1d30f70702df | 112:ec485345daf9 |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include "regexParser.h" | 2 #include "regexParser.h" |
3 | 3 |
4 void descendTree(NodePtr n, int d) { | 4 static void descendTree(NodePtr,int); |
5 void printTree(NodePtr); | |
6 | |
7 static void descendTree(NodePtr n, int d) { | |
5 if (n->right != NULL) { | 8 if (n->right != NULL) { |
6 d++; | 9 descendTree(n->right, d+1); |
7 descendTree(n->right, d); | |
8 d--; | 10 d--; |
9 } | 11 } |
10 if (n->tokenType == 'a') { | 12 if (n->tokenType == 'a') { |
11 printf("%*c%c(%d)\n",d*4, ' ',n->Value.character,n->nodeNumber); | 13 printf("%*c%c(%d)\n",d*4, ' ',n->Value.character,n->nodeNumber); |
12 } else { | 14 } else { |
13 printf("%*c%c\n",d*4, ' ',n->Value.character); | 15 printf("%*c%c\n",d*4, ' ',n->Value.character); |
14 } | 16 } |
15 | 17 |
16 if (n->left != NULL) { | 18 if (n->left != NULL) { |
17 d++; | 19 descendTree(n->left, d+1); |
18 descendTree(n->left, d); | |
19 d--; | 20 d--; |
20 } | 21 } |
21 } | 22 } |
22 | 23 |
23 void printTree(NodePtr n) { | 24 void printTree(NodePtr n) { |