aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Bart <edub4rt@gmail.com>2020-08-23 20:44:50 -0300
committerEduardo Bart <edub4rt@gmail.com>2020-08-23 20:44:50 -0300
commitc66cedbdccce431b9b9b42fb1a7aec81a8c64dfe (patch)
tree98669128a9551b8d35c154b5895a784be0a94d03
parent9d02c572fc0c45d76d73263e51b004be51f359fa (diff)
downloadlpeglabel-c66cedbdccce431b9b9b42fb1a7aec81a8c64dfe.tar.gz
lpeglabel-c66cedbdccce431b9b9b42fb1a7aec81a8c64dfe.tar.bz2
lpeglabel-c66cedbdccce431b9b9b42fb1a7aec81a8c64dfe.zip
Fix issue #27
-rw-r--r--lpcode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lpcode.c b/lpcode.c
index a2d08f7..78c6566 100644
--- a/lpcode.c
+++ b/lpcode.c
@@ -535,16 +535,18 @@ static int addoffsetinst (CompileState *compst, Opcode op) {
535 535
536/* labeled failure */ 536/* labeled failure */
537static void codethrow (CompileState *compst, TTree *throw) { 537static void codethrow (CompileState *compst, TTree *throw) {
538 int recov, aux; 538 int recov, aux, n;
539 if (throw->u.ps != 0) { 539 if (throw->u.ps != 0) {
540 recov = addoffsetinst(compst, IThrowRec); 540 recov = addoffsetinst(compst, IThrowRec);
541 assert(sib1(sib2(throw))->tag == TXInfo); 541 assert(sib1(sib2(throw))->tag == TXInfo);
542 n = sib1(sib2(throw))->u.n;
542 } else { 543 } else {
543 recov = addinstruction(compst, IThrow, 0); 544 recov = addinstruction(compst, IThrow, 0);
545 n = -1;
544 } 546 }
545 aux = nextinstruction(compst); 547 aux = nextinstruction(compst);
546 getinstr(compst, aux).i.key = throw->key; /* next instruction keeps only rule name */ 548 getinstr(compst, aux).i.key = throw->key; /* next instruction keeps only rule name */
547 getinstr(compst, recov).i.key = sib1(sib2(throw))->u.n; /* rule number */ 549 getinstr(compst, recov).i.key = n; /* rule number */
548} 550}
549/* labeled failure */ 551/* labeled failure */
550 552