App-sh2p
view release on metacpan or search on metacpan
lib/App/sh2p/Compound.pm view on Meta::CPAN
# Further tokenise
$token =~ s/($pattern)/$1 /;
for my $subtok (split (/ /, $token)) {
if ($subtok =~ /^[_A-Za-z]/) {
# Must be a variable!
$subtok = "\$$subtok";
}
elsif ($subtok =~ /\$[A-Z0-9\?#\{\}\[\]]+/i) {
my $special = get_special_var($subtok,0);
$subtok = $special if (defined $special);
}
$out .= "$subtok "
}
}
if (query_semi_colon()) {
lib/App/sh2p/Compound.pm view on Meta::CPAN
if (ina_function()) {
out '@_';
}
else {
out '@ARGV';
}
}
# Often a variable to be converted to a list
# Note: excludes @ and * which indicate an array
if ($for_tokens[0] =~ /\$[A-Z0-9#\{\}\[\]]+/i) {
my $IFS = App::sh2p::Utils::get_special_var('IFS',0);
$IFS =~ s/^"(.*)"/$1/;
out "split /$IFS/,$for_tokens[0]";
shift @for_tokens;
}
if (@for_tokens) {
my @types = App::sh2p::Parser::identify (2, @for_tokens);
App::sh2p::Parser::convert (@for_tokens, @types);
}
lib/App/sh2p/Parser.pm view on Meta::CPAN
elsif ($first =~ /^\w+\[.*\]=/) {
$out[0] = [('ARRAY_ASSIGNMENT',
\&App::sh2p::Handlers::Handle_array_assignment)];
shift @in
}
elsif (is_break($first)) {
$out[0] = [('BREAK',
\&App::sh2p::Handlers::Handle_break)];
shift @in
}
elsif (!$nested && $first =~ /^([\"]?)\$[A-Z0-9#@*{}\[\]]+\1/i) { # Optional " added January 2009
# Not a variable, but a call (variable contains call name)
$out[0] = [('EXTERNAL',
\&App::sh2p::Handlers::Handle_external)];
shift @in;
}
# Now process the rest
for my $token (@in) {
lib/App/sh2p/Parser.pm view on Meta::CPAN
$type = 'GLOB';
$sub = \&App::sh2p::Handlers::Handle_Glob;
}
elsif ( (!@out || ($out[-1]->[0] eq 'BREAK')) &&
!$nested && !is_break($first_char)) { # Must be first token
$type = 'EXTERNAL';
$sub = \&App::sh2p::Handlers::Handle_external;
}
# January 2009 This test must come after the 'EXTERNAL' test,
# otherwise a bare variable is not seen as an external call
elsif ($first_char eq '$' && $token =~ /^\$[A-Z0-9\#\@\*\?\{\}\[\]]+$/i) {
$type = 'VARIABLE';
$sub = \&App::sh2p::Handlers::Handle_variable
}
elsif (is_break($token)) { # 0.06
$type = 'BREAK';
$sub = \&App::sh2p::Handlers::Handle_break;
}
elsif (exists $ioperator{$two_chars} && $nested) {
$sub = $ioperator{$two_chars};
$type = 'OPERATOR'
( run in 0.452 second using v1.01-cache-2.11-cpan-cc502c75498 )