Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix NFA construction for the empty literal, so / '' / now gets its NF…
…A built properly. Gets 45-smartmatch.t building and passing again.
  • Loading branch information
jnthn committed Nov 16, 2011
1 parent a915744 commit 5680b10
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/QRegex/NFA.nqp
Expand Up @@ -105,11 +105,16 @@ class QRegex::NFA {
my $litconst := $node[0];
my $litlen := nqp::chars($litconst) - 1;
my $i := 0;
while $i < $litlen {
$from := self.addedge($from, -1, $EDGE_CODEPOINT, nqp::ord($litconst, $i));
$i := $i + 1;
if $litlen >= 0 {
while $i < $litlen {
$from := self.addedge($from, -1, $EDGE_CODEPOINT, nqp::ord($litconst, $i));
$i := $i + 1;
}
self.addedge($from, $to, $EDGE_CODEPOINT, nqp::ord($litconst, $i));
}
else {
self.addedge($from, $to, $EDGE_EPSILON, 0);
}
self.addedge($from, $to, $EDGE_CODEPOINT, nqp::ord($litconst, $i));
}

method subrule($node, $from, $to) {
Expand Down

0 comments on commit 5680b10

Please sign in to comment.