Commit 407267b
committed
regex engine: split EVAL_postponed_AB state
(This commit makes no practical changes in behaviour except for
debugging output.)
Currently, one of the regex engine stack states is EVAL_postponed_AB.
When executing something like /(??{'A'})B/ where A and B represent
general subpatterns, the engine executes the eval code, which returns
the string 'A', which is compiled into a subpattern. Then the engine
pushes an EVAL_postponed_AB state and runs the subpattern until it
reaches an END op. Then it pushes *another* EVAL_postponed_AB state and
runs the B part of the pattern until the final END. Then before
returning success, it pops EVAL_postponed_AB off the stack (twice),
executing any cleanup required. Similarly during failure, the
EVAL_postponed_AB_fail action will be executed once or twice (depending
on whether it failed during A or B).
This commit splits that state into two,
EVAL_postponed_A
EVAL_postponed_B
The first is pushed before running A, the second before running B.
The actions currently remain the same and share the same code; i.e. this
commit just does the equivalent of:
- case EVAL_postponed_AB:
+ case EVAL_postponed_A:
+ case EVAL_postponed_B:
... cleanup code ....
But it makes the code easier to understand, makes debugging output
clearer, and will allow in future for the cleanup behaviours to differ
between A and B.
This commit also fixes up a few debugging messages and code comments
which were still referring to 'EVAL_AB', which was renamed to
EVAL_postponed_AB some years ago.1 parent 676faf6 commit 407267b
3 files changed
+425
-389
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6671 | 6671 | | |
6672 | 6672 | | |
6673 | 6673 | | |
6674 | | - | |
| 6674 | + | |
6675 | 6675 | | |
6676 | 6676 | | |
6677 | 6677 | | |
| |||
8719 | 8719 | | |
8720 | 8720 | | |
8721 | 8721 | | |
8722 | | - | |
| 8722 | + | |
8723 | 8723 | | |
8724 | 8724 | | |
8725 | 8725 | | |
8726 | 8726 | | |
8727 | | - | |
| 8727 | + | |
| 8728 | + | |
| 8729 | + | |
| 8730 | + | |
8728 | 8731 | | |
8729 | 8732 | | |
8730 | | - | |
| 8733 | + | |
8731 | 8734 | | |
8732 | 8735 | | |
8733 | 8736 | | |
| |||
8744 | 8747 | | |
8745 | 8748 | | |
8746 | 8749 | | |
8747 | | - | |
| 8750 | + | |
8748 | 8751 | | |
8749 | 8752 | | |
8750 | 8753 | | |
| |||
8771 | 8774 | | |
8772 | 8775 | | |
8773 | 8776 | | |
8774 | | - | |
| 8777 | + | |
8775 | 8778 | | |
8776 | 8779 | | |
8777 | 8780 | | |
| |||
8780 | 8783 | | |
8781 | 8784 | | |
8782 | 8785 | | |
8783 | | - | |
| 8786 | + | |
| 8787 | + | |
8784 | 8788 | | |
8785 | 8789 | | |
8786 | 8790 | | |
| |||
9902 | 9906 | | |
9903 | 9907 | | |
9904 | 9908 | | |
9905 | | - | |
| 9909 | + | |
9906 | 9910 | | |
9907 | 9911 | | |
9908 | 9912 | | |
| |||
0 commit comments