Alt-IO-All-new
view release on metacpan or search on metacpan
inc/Pegex/Compiler.pm view on Meta::CPAN
}
sub to_json {
require JSON::XS;
my $self = shift;
return JSON::XS->new->utf8->canonical->pretty->encode($self->tree);
}
sub to_perl {
my $self = shift;
require Data::Dumper;
no warnings 'once';
$Data::Dumper::Terse = 1;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;
my $perl = Data::Dumper::Dumper($self->tree);
$perl =~ s/\?\^:/?-xism:/g;
$perl =~ s!(\.rgx.*?qr/)\(\?-xism:(.*)\)(?=/)!$1$2!g;
die "to_perl failed with non compatible regex in:\n$perl"
if $perl =~ /\?\^/;
return $perl;
}
1;
( run in 1.220 second using v1.01-cache-2.11-cpan-a5abf4f5562 )