Skip to content

Commit ad45f01

Browse files
committed
Twiddle NFA subrule merge logic to avoid needing to boolify.
1 parent abf900a commit ad45f01

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/QRegex/NFA.nqp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ class QRegex::NFA {
137137

138138
method mergesubrule($start, $to, $fate, $cursor, $name) {
139139
nqp::say("adding $name");
140-
my $subrule := $cursor.HOW.find_method($cursor, $name);
141-
my @substates := $subrule.nqpattr('nfa') if $subrule;
140+
my @substates;
141+
if pir::can($cursor, $name) {
142+
@substates := $cursor.HOW.find_method($cursor, $name).nqpattr('nfa');
143+
}
142144
if @substates {
143145
# create an empty end state for the subrule's NFA
144146
my $substart := self.addstate();
@@ -194,6 +196,7 @@ class QRegex::NFA {
194196
@done[$st] := $gen;
195197
for $!states[$st] -> $act, $arg, $to {
196198
if $act == $EDGE_FATE {
199+
say("# crossing fate edge $arg at $offset");
197200
@fatepos[$arg] := $offset;
198201
}
199202
elsif $act == $EDGE_EPSILON && @done[$to] != $gen {

0 commit comments

Comments
 (0)