aboutsummaryrefslogtreecommitdiff
path: root/lpprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'lpprint.c')
-rw-r--r--lpprint.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lpprint.c b/lpprint.c
index 8d5e087..21fb038 100644
--- a/lpprint.c
+++ b/lpprint.c
@@ -61,7 +61,7 @@ void printinst (const Instruction *op, const Instruction *p) {
61 "choice", "jmp", "call", "open_call", 61 "choice", "jmp", "call", "open_call",
62 "commit", "partial_commit", "back_commit", "failtwice", "fail", "giveup", 62 "commit", "partial_commit", "back_commit", "failtwice", "fail", "giveup",
63 "fullcapture", "opencapture", "closecapture", "closeruntime", 63 "fullcapture", "opencapture", "closecapture", "closeruntime",
64 "throw", "recovery", "labeled_choice" /* labeled failure */ 64 "throw", "throw_rec", /* labeled failure */
65 }; 65 };
66 printf("%02ld: %s ", (long)(p - op), names[p->i.code]); 66 printf("%02ld: %s ", (long)(p - op), names[p->i.code]);
67 switch ((Opcode)p->i.code) { 67 switch ((Opcode)p->i.code) {
@@ -108,7 +108,11 @@ void printinst (const Instruction *op, const Instruction *p) {
108 break; 108 break;
109 } 109 }
110 case IThrow: { /* labeled failure */ 110 case IThrow: { /* labeled failure */
111 printf("%d", p->i.aux); 111 printf("(idx = %d)", (p + 1)->i.key);
112 break;
113 }
114 case IThrowRec: { /* labeled failure */
115 printjmp(op, p); printf(" (idx = %d)", (p + 2)->i.key);
112 break; 116 break;
113 } 117 }
114 default: break; 118 default: break;
@@ -159,7 +163,7 @@ static const char *tagnames[] = {
159 "call", "opencall", "rule", "grammar", 163 "call", "opencall", "rule", "grammar",
160 "behind", 164 "behind",
161 "capture", "run-time", 165 "capture", "run-time",
162 "throw", "recov", "labeled-choice" /* labeled failure */ 166 "throw" /* labeled failure */
163}; 167};
164 168
165 169
@@ -212,10 +216,9 @@ void printtree (TTree *tree, int ident) {
212 break; 216 break;
213 } 217 }
214 case TThrow: { /* labeled failure */ 218 case TThrow: { /* labeled failure */
215 if (tree->u.s.ps != 0) 219 if (tree->u.ps != 0)
216 assert(sib2(tree)->tag == TRule); 220 assert(sib2(tree)->tag == TRule);
217 printf(" key: %d (rule: %d)\n", tree->key, sib2(tree)->cap); 221 printf(" key: %d (rule: %d)\n", tree->key, sib2(tree)->cap);
218 printf(" labels: %d\n", tree->u.label);
219 break; 222 break;
220 } 223 }
221 default: { 224 default: {