Skip to content

Commit

Permalink
Fix sequential alternations and LTM interaction.
Browse files Browse the repository at this point in the history
The first branch of the alternation should be factored into the
longest prefix.
  • Loading branch information
jnthn committed Jul 15, 2015
1 parent 1dd3a77 commit 5834191
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/QRegex/NFA.nqp
Expand Up @@ -160,6 +160,21 @@ class QRegex::NFA {
dentout($to);
}

method altseq($node, $from, $to) {
if +@($node) {
my $indent := dentin();
my int $st := self.regex_nfa($node[0], $from, $to);
$to := $st if $to < 0 && $st > 0;
$st := self.addedge($from, $to, $EDGE_EPSILON, 0);
$to := $st if $to < 0 && $st > 0;
note("$indent ...altseq returns $to") if $nfadeb;
dentout($to);
}
else {
self.fate($node, $from, $to);
}
}

method anchor($node, $from, $to) {
self.addedge($from, $to, $EDGE_EPSILON, 0);
}
Expand Down

0 comments on commit 5834191

Please sign in to comment.