Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Twiddle NFA subrule merge logic to avoid needing to boolify.
  • Loading branch information
jnthn committed Nov 16, 2011
1 parent abf900a commit ad45f01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/QRegex/NFA.nqp
Expand Up @@ -137,8 +137,10 @@ class QRegex::NFA {

method mergesubrule($start, $to, $fate, $cursor, $name) {
nqp::say("adding $name");
my $subrule := $cursor.HOW.find_method($cursor, $name);
my @substates := $subrule.nqpattr('nfa') if $subrule;
my @substates;
if pir::can($cursor, $name) {
@substates := $cursor.HOW.find_method($cursor, $name).nqpattr('nfa');
}
if @substates {
# create an empty end state for the subrule's NFA
my $substart := self.addstate();
Expand Down Expand Up @@ -194,6 +196,7 @@ class QRegex::NFA {
@done[$st] := $gen;
for $!states[$st] -> $act, $arg, $to {
if $act == $EDGE_FATE {
say("# crossing fate edge $arg at $offset");
@fatepos[$arg] := $offset;
}
elsif $act == $EDGE_EPSILON && @done[$to] != $gen {
Expand Down

0 comments on commit ad45f01

Please sign in to comment.