Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
only dedup problematic but easily checkable edges
Most of the dups are in epsilons and fates, with occasional codepoints.
Since it's more difficult to check the values for fancy edges, and not
worth it anyway, just check simple edges.
  • Loading branch information
TimToady committed Dec 3, 2014
1 parent a32de0c commit 1928e4a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/QRegex/NFA.nqp
Expand Up @@ -859,17 +859,19 @@ class QRegex::NFA {
# a small O(N^2) dup remover
$e := 3;
while $e < $eend {
my $f := 0;
while $f < $e {
# in order of likelihood of differences, hopefully
if $edges[$e] != $EDGE_CHARLIST && $edges[$e] != $EDGE_CHARLIST_NEG && $edges[$e+2] == $edges[$f+2] && $edges[$e] == $edges[$f] && $edges[$e+1] == $edges[$f+1] {
nqp::printfh($err, "Deleting dup edge at $s $e/$f\n") if $nfadeb;
$f := $e;
nqp::splice($edges,[],$e,3);
$e := $e - 3;
$eend := $eend - 3;
my int $act := nqp::bitand_i($edges[$e], 0xff);
if $act < $EDGE_CHARLIST {
my $f := 0;
while $f < $e {
if $act == $edges[$f] && $edges[$e+2] == $edges[$f+2] && $edges[$e+1] == $edges[$f+1] {
nqp::printfh($err, "Deleting dup edge at $s $e/$f\n") if $nfadeb;
$f := $e;
nqp::splice($edges,[],$e,3);
$e := $e - 3;
$eend := $eend - 3;
}
$f := $f + 3;
}
$f := $f + 3;
}
$e := $e + 3;
}
Expand Down

0 comments on commit 1928e4a

Please sign in to comment.