aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Medeiros <sqmedeiros@gmail.com>2014-10-30 16:29:35 -0300
committerSergio Medeiros <sqmedeiros@gmail.com>2014-10-30 16:29:35 -0300
commit5cc11088848a7884980bc00a96c9f3189e6de505 (patch)
tree207b843f717001b3bbfcc931462c40d21ca67946
parent4ad8fea6fed78219990819daa18934c577d8bd8a (diff)
downloadlpeglabel-5cc11088848a7884980bc00a96c9f3189e6de505.tar.gz
lpeglabel-5cc11088848a7884980bc00a96c9f3189e6de505.tar.bz2
lpeglabel-5cc11088848a7884980bc00a96c9f3189e6de505.zip
Updating printree
-rw-r--r--lpprint.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lpprint.c b/lpprint.c
index 03239fd..0730ca9 100644
--- a/lpprint.c
+++ b/lpprint.c
@@ -165,7 +165,8 @@ static const char *tagnames[] = {
165 "not", "and", 165 "not", "and",
166 "call", "opencall", "rule", "grammar", 166 "call", "opencall", "rule", "grammar",
167 "behind", 167 "behind",
168 "capture", "run-time" 168 "capture", "run-time",
169 "throw", "labeled-choice" /* labeled failure */
169}; 170};
170 171
171 172
@@ -193,7 +194,7 @@ void printtree (TTree *tree, int ident) {
193 } 194 }
194 case TBehind: { 195 case TBehind: {
195 printf(" %d\n", tree->u.n); 196 printf(" %d\n", tree->u.n);
196 printtree(sib1(tree), ident + 2); 197 printtree(sib1(tree), ident + 2);
197 break; 198 break;
198 } 199 }
199 case TCapture: { 200 case TCapture: {
@@ -216,8 +217,15 @@ void printtree (TTree *tree, int ident) {
216 assert(rule->tag == TTrue); /* sentinel */ 217 assert(rule->tag == TTrue); /* sentinel */
217 break; 218 break;
218 } 219 }
220 case TThrow: { /* labeled failure */
221 printf(" labels: %d\n", tree->labels);
222 break;
223 }
219 default: { 224 default: {
220 int sibs = numsiblings[tree->tag]; 225 int sibs = numsiblings[tree->tag];
226 if (tree->tag == TLabChoice) { /* labeled failure */
227 printf(" labels: %d\n", tree->labels);
228 }
221 printf("\n"); 229 printf("\n");
222 if (sibs >= 1) { 230 if (sibs >= 1) {
223 printtree(sib1(tree), ident + 2); 231 printtree(sib1(tree), ident + 2);