Filter-Syntactic
view release on metacpan or search on metacpan
lib/Filter/Syntactic.pm view on Meta::CPAN
# Identify and record any nested captures...
for my $c (reverse keys @Filter::Syntactic::captures) {
my $capture = $Filter::Syntactic::captures[$c];
POSSIBLE_OUTER:
for my $prev (@Filter::Syntactic::captures[reverse 0..$c-1]) {
last POSSIBLE_OUTER if $prev->{END} < $capture->{POS};
if ($capture->{END} > $prev->{END}) {
push @{$prev->{OUTERS}}, $capture;
use Scalar::Util 'weaken';
weaken($prev->{OUTERS}[-1]);
}
}
}
# Install replacement code and any adjust outer captures...
for my $capture
(sort {$b->{POS} <=> $a->{POS}} @Filter::Syntactic::captures) {
# Generate replacement code...
my $replacement = do {
local $_ = substr($_, $capture->{POS}, $capture->{LEN});
( run in 0.849 second using v1.01-cache-2.11-cpan-39bf76dae61 )