Mercurial > hg > Applications > Grep
comparison c/regexParser/node.cc @ 134:dbafc753078e pairPro
fix concatination & selection & grouping
author | masa |
---|---|
date | Fri, 04 Dec 2015 17:45:09 +0900 |
parents | a436526756b9 |
children | e1a262ec75f0 |
comparison
equal
deleted
inserted
replaced
133:ccc673449351 | 134:dbafc753078e |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include "node.h" | 2 #include "node.h" |
3 | 3 |
4 static void descendTree(NodePtr n, int d) { | 4 static void descendTree(NodePtr n, int d) { |
5 if (n->right != NULL) { | 5 if (n->left != NULL) { |
6 d++; | 6 d++; |
7 descendTree(n->right, d); | 7 descendTree(n->left, d); |
8 d--; | 8 d--; |
9 } | 9 } |
10 if (n->tokenType != 'a') { | 10 if (n->tokenType != 'a') { |
11 printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); | 11 printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); |
12 } else { | 12 } else { |
15 putchar(n->cc->cond->w->word[i]); | 15 putchar(n->cc->cond->w->word[i]); |
16 } | 16 } |
17 printf("(%lu)\n",n->nodeNumber); | 17 printf("(%lu)\n",n->nodeNumber); |
18 } | 18 } |
19 | 19 |
20 if (n->left != NULL) { | 20 if (n->right != NULL) { |
21 d++; | 21 d++; |
22 descendTree(n->left, d); | 22 descendTree(n->right, d); |
23 d--; | 23 d--; |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 void printTree(NodePtr n) { | 27 void printTree(NodePtr n) { |