diff options
author | Sérgio Queiroz <sqmedeiros@gmail.com> | 2017-12-18 15:39:00 -0300 |
---|---|---|
committer | Sérgio Queiroz <sqmedeiros@gmail.com> | 2017-12-18 15:39:00 -0300 |
commit | c6b98103f0ab2c4afb7216e73f2eacac58cbf952 (patch) | |
tree | a98bef21fff8702c66deac2315a6a10d7d1c26df /lpcode.c | |
parent | 4bdf8d40a9ca5f00e454a38d301a3ab35c9b50d5 (diff) | |
download | lpeglabel-c6b98103f0ab2c4afb7216e73f2eacac58cbf952.tar.gz lpeglabel-c6b98103f0ab2c4afb7216e73f2eacac58cbf952.tar.bz2 lpeglabel-c6b98103f0ab2c4afb7216e73f2eacac58cbf952.zip |
Updating code to use the new syntax/semantics of labels
Diffstat (limited to 'lpcode.c')
-rw-r--r-- | lpcode.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -517,7 +517,8 @@ static int addinstruction (CompileState *compst, Opcode op, int aux) { | |||
517 | static int addoffsetinst (CompileState *compst, Opcode op) { | 517 | static int addoffsetinst (CompileState *compst, Opcode op) { |
518 | int i = addinstruction(compst, op, 0); /* instruction */ | 518 | int i = addinstruction(compst, op, 0); /* instruction */ |
519 | addinstruction(compst, (Opcode)0, 0); /* open space for offset */ | 519 | addinstruction(compst, (Opcode)0, 0); /* open space for offset */ |
520 | assert(op == ITestSet || sizei(&getinstr(compst, i)) == 2); | 520 | assert(op == ITestSet || sizei(&getinstr(compst, i)) == 2 || |
521 | op == IThrowRec); /* labeled failure */ | ||
521 | return i; | 522 | return i; |
522 | } | 523 | } |
523 | 524 | ||
@@ -527,13 +528,13 @@ static void codethrow (CompileState *compst, TTree *throw) { | |||
527 | int recov, aux; | 528 | int recov, aux; |
528 | if (throw->u.s.ps != 0) { | 529 | if (throw->u.s.ps != 0) { |
529 | recov = addoffsetinst(compst, IThrowRec); | 530 | recov = addoffsetinst(compst, IThrowRec); |
531 | assert(sib2(throw)->tag == TRule); | ||
530 | } else { | 532 | } else { |
531 | recov = addinstruction(compst, IThrow, 0); | 533 | recov = addinstruction(compst, IThrow, 0); |
532 | } | 534 | } |
533 | aux = nextinstruction(compst); | 535 | aux = nextinstruction(compst); |
534 | getinstr(compst, aux).i.key = throw->key; /* next instruction keeps only rule name */ | 536 | getinstr(compst, aux).i.key = throw->key; /* next instruction keeps only rule name */ |
535 | getinstr(compst, recov).i.key = sib2(throw)->cap; /* rule number */ | 537 | getinstr(compst, recov).i.key = sib2(throw)->cap; /* rule number */ |
536 | assert(sib2(throw)->tag == TRule); | ||
537 | } | 538 | } |
538 | /* labeled failure */ | 539 | /* labeled failure */ |
539 | 540 | ||