Affix-Infix2Postfix
view release on metacpan or search on metacpan
Infix2Postfix.pm view on Meta::CPAN
sub verify {
my $self=shift;
my $re=$self->{'re'};
my @matches=@_;
return grep { $matches[$_] !~ /^$re$/ } 0..$#matches;
}
sub translate {
my $self=shift;
my $str=shift;
my (@matches,@errors,@res);
@matches=$self->tokenize($str);
@errors=$self->verify(@matches);
if (@errors) {
$self->{ERRSTR}='Bad tokens: '.join(' ',@matches[@errors]);
return undef;
}
@res=$self->elist(@matches);
return @res;
}
sub elist {
my $self=shift;
Infix2Postfix.pm view on Meta::CPAN
}
# print Dumper($cop);
# this is just for parens
if ( $_[0] eq '(' and $_[$#_] eq ')' ) {
if ( $#_<2 ) { die "Empty parens\n"; }
return $self->elist(@_[1..$#_-1]);
}
die "error stack is: @_ error\n";
}
# Preloaded methods go here.
# Autoload methods go after =cut, and are processed by the autosplit program.
1;
__END__
# Below is the stub of documentation for your module. You better edit it!
( run in 0.596 second using v1.01-cache-2.11-cpan-65fba6d93b7 )