| 1 | package Proc::ShellSubset; # Parser for the Bourne-shell subset of doc/parsers/shell-subset-spec.md | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 551 | our $VERSION = '0.13'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 550 | ▶ | use strict; use warnings; use List::Util qw(pairs pairvalues); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Proc::ShellSubset::parse($string, %opt) returns a List, or { error => '...', pos => N, last => N, tree => List }: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # 'last' is the position after the last top-level ';', '&' or newline, 'tree' the part parsed so far, with | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # { ERROR => 1 } where parsing failed (an 'exec' in the wrong place gets ERROR => 1 in its own hash; an 'exec' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # not checked yet when parsing failed has exec => its position, which may be 0: test the key with exists). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # %opt: nocaret (reject ^, as the Bourne shell reads it as |), nopwd (reject $PWD), check (sub: returns a reason to reject), empty (accept | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # an empty string), fdmulti (multi-digit fds), tilde_args (~ after NAME= in arguments), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # brace (parse brace expansion), assign (commands with only settings), param_ops (${x:-w} ${x-w} ${x:+w} ${x+w} ${#x}), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # if (if/elif/else), while (while, until; break and continue inside), for (for NAME in ...; break, continue), case, read. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # List = [ AndOr, ... ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # AndOr = [ Pipeline, '&&' | '||', Pipeline, ..., '&' (only if in background) ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Pipeline = [ '!' (only if negated), Command, ... ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Command = { argv => [Word, ...], env => [NAME, Word, ...], redir => [Redir, ...], exec => 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # | { sub => List, redir => [...] } | { group => List, redir => [...] } | { cd => Word | undef } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # (Proc::ShellSubset::Large adds cd_p => 1 for 'cd -P') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # | { set => [NAME, Word, NAME, Word, ...] } (option assign) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # | { if => [Cond, Then, Cond, Then, ..., Else (if present)] } (Cond, Then, Else: Lists; option if) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # | { while => Cond, do => List } | { until => Cond, do => List } (option while) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # | { for => NAME, in => [Word, ...], do => List } (option for) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # | { case => Word, in => [[Word, ...], List, [Word, ...], List, ...] } (patterns, body; option case) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # (all compound commands may also have redir => [...]; break, continue and read are simple commands) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # (keys only when non-empty; argv->[0] is a plain string; cd alone has cd => undef) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Redir = [ fd, op, Word ] (for <& and >&: [ fd, op, 'digit or -' ]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # Word = 'literal text' | [ Part, ... ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # Part = 'literal text' | [ '$', NAME or '?' or '!' ] | [ '$((', 'expr' ] | [ '$(', List ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # | [ '${', NAME, ':-' | '-' | ':+' | '+', Word ] | [ '${#', NAME ] (option param_ops) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # | the same five with '"' in front ('"$' ...) when inside double quotes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # | [ '~', 'user' or '' ] | [ '*', 'pattern text' ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # | [ '{', Word, Word, ... ] | [ '{..', from, to ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 551 | our ($CUT, $SRC, $LOFF, @ASH) = (0, '', 0); # P1, set by Proc::ShellSubset::Large: stop after this line; the text; lines before | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 23 | ▶ | sub opos { my $q = shift; $q -= $$_[1] for grep $$_[0] <= $q, @ASH; P($q) } # it; [where, how much] alias values moved the rest (B1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
opos: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 551 | our (%O, $M, @OPEN, $ATT, $LAST, $LOOP, $FORALL, $RLIT); # options; position map of a backquote's inside; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # arrays being filled (for the partial tree); how many of them are in the tree; end of the last top-level chain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # depth of the loops around the current command in its shell; Proc::ShellSubset::Large: 'for NAME' loops over "$@", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # and a pattern in a redirection target is literal text (P6: dash, and bash in POSIX mode, do not expand it) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 551 | our %KW = map +($_ => 1), qw(if then else elif fi case esac for while until do done in [[ ]] function select coproc !); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 550 | our %BI = map +($_ => 1), qw(. break continue eval export readonly return set shift times trap unset alias | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | unalias read wait umask ulimit jobs fg bg command getopts hash type fc chdir local source let declare | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | typeset shopt enable builtin caller dirs pushd popd disown mapfile readarray suspend logout help | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | history bind compgen complete compopt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 550 | our %SH = map +($_ => 1), qw(IFS PS1 PS2 PS4 OPTIND PPID OLDPWD LINENO _ BASH BASHOPTS BASHPID DIRSTACK | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | EPOCHREALTIME EPOCHSECONDS EUID FUNCNAME GROUPS HISTCMD HOSTTYPE MACHTYPE OPTERR OSTYPE PIPESTATUS | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | POSIXLY_CORRECT RANDOM SECONDS SHELLOPTS SHLVL SRANDOM UID); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 550 | our $NM = qr/[A-Za-z_][A-Za-z0-9_]*/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 550 | our $END = qr/(?=[ \t\n;&|()<>]|\z)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 550 | our $B = qr/(?:[ \t]|\\\n|#.*)*+/; # blanks, line continuations, a comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 550 | our $BN = qr/(?:[ \t\n]|\\\n|#.*)*+/; # the same, and newlines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 550 | our %STOP = (b => qr/\G(?:(?=[,}])|$END)/, map +($_ => qr/\G$END/), qw(a e r)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 550 | our $PIECE = qr/\G(?: '(?<sq>[^']*)' | (?<dq>") | \\(?<bs>.) | (?<ex>[\$`]) | (?<gl>[*?]) | (?<br>\[) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | | (?<cb>\{(?!\})) | (?<ti>~) | (?<ca>\^) | (?<lit>(?:\{\}|[^ \t\n;&|()<>'"\\\$`*?\[{}^~,\x00-\x1f\x7f])+|,) | (?<bad>.) )/sx; # {} is literal (C2) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 550 | our $ARITH = qr{(?(DEFINE) # the expression grammar of $((...)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | (?<w> [ \t\n]* ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | (?<num> (?: 0[xX][0-9a-fA-F]+ | 0[0-7]* | [1-9][0-9]* ) (?![0-9A-Za-z_]) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | (?<atom> (?&w) (?: [-+!~] (?&w) )* (?: (?&num) | \$? [A-Za-z_][A-Za-z0-9_]* | \$\{[A-Za-z_][A-Za-z0-9_]*\} | \$[?!] | \$\{[?!]\} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | | \( (?&e) (?&w) \) ) ) # $NAME, ${NAME}: substituted as text first (C9) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | (?<op> (?&w) (?: << | >> | <= | >= | == | != | && | \|\| | [-+*/%<>&^|] ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | (?<e> (?&atom) (?: (?&op) (?&atom) )* (?: (?&w) \? (?&e) (?&w) : (?&e) )? ) )}x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3330 | ▶ | our %EX = (q{$} => sub { dollar(@_) }, q{`} => sub { bq(@_) }); # the expansion a $ or ` starts: ($q, $p) -> Part; by name, so Proc::ShellSubset::Large can replace them | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4239 | ▶ | sub P { my $p = shift; $M ? $$M[$p] // $$M[-1] : $p } # position in the original | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
P: called CC=3 SCAR=11.7
Pod
undocumented
Branch: 1 branch
Condition33%1/3
$Proc::ShellSubset::M->[$p] // $Proc::ShellSubset::M->[-1]
MC/DC0%0/2
$Proc::ShellSubset::M->[$p] // $Proc::ShellSubset::M->[-1]
$Proc::ShellSubset::M->[$p]
$Proc::ShellSubset::M->[-1]
Truth table33%1/3
A // B
A= $Proc::ShellSubset::M->[$p]B= $Proc::ShellSubset::M->[-1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2689 | ▶ | sub E { push @{$OPEN[$ATT // -1]}, { ERROR => 1 } if @OPEN; die [shift, P(shift)] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
E: called CC=3 SCAR=11.0
Pod
undocumented
Branch: 1 branch
Condition100%2/2
$Proc::ShellSubset::ATT // -1
MC/DC100%1/1
$Proc::ShellSubset::ATT // -1
$Proc::ShellSubset::ATT
Truth table100%2/2
A
A= $Proc::ShellSubset::ATT
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 247 | ▶ | sub U { /\G$B/gc; E(/\G(.)/s ? 'unexpected ' . ($1 eq "\n" ? 'newline' : "'$1'") : 'unexpected end', pos) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
U: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 5342 | ▶ | sub parse { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=9 SCAR=22.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 5349 | my $s = shift; local %O = @_; local ($M, @OPEN, $ATT); local $LAST = 0; my @l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 5349 | my $t = eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 5349 | local $_ = $s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 5349 | ▶ | E('NUL character', $-[0]) if /\0/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 5348 | ▶ | E(q{starts with - or +: sh would read it as options}, $-[1]) if /\A[ \t\n\r\f\cK]*([-+])/; # Perl skips leading white space, then runs sh -c STRING (U1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 5332 | ▶ | if ($O{check} and my $why = $O{check}->($s)) { E($why, 0) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$Proc::ShellSubset::O{"check"} and my $why = $Proc::ShellSubset::O{"check"}->($s)
MC/DC0%0/2
$Proc::ShellSubset::O{"check"} and my $why = $Proc::ShellSubset::O{"check"}->($s)
$Proc::ShellSubset::O{"check"}
my $why = $Proc::ShellSubset::O{"check"}->($s)
Truth table33%1/3
A and B
A= $Proc::ShellSubset::O{"check"}B= my $why = $Proc::ShellSubset::O{"check"}->($s)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 5332 | shell('', \@l); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 2634 | ▶ | @l or $O{empty} or E('empty command', 0); \@l }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@l or $Proc::ShellSubset::O{"empty"}
MC/DC100%2/2
@l or $Proc::ShellSubset::O{"empty"}
@l
$Proc::ShellSubset::O{"empty"}
Truth table100%3/3
A or B
A= @lB= $Proc::ShellSubset::O{"empty"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 5349 | ▶ | $t // (ref $@ eq 'ARRAY' ? { error => $@->[0], pos => $@->[1], last => $LAST, tree => \@l } : die $@) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$t // (ref $@ eq "ARRAY" ? {"error", $@->[0], "pos", $@->[1], "last", $Proc::ShellSubset::LAST, "tree", \@l} : die($@))
MC/DC100%1/1
$t // (ref $@ eq "ARRAY" ? {"error", $@->[0], "pos", $@->[1], "last", $Proc::ShellSubset::LAST, "tree", \@l} : die($@))
$t
Truth table100%2/2
A
A= $t
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 6604 | ▶ | sub list { # up to ')' (subshell, $()), a word in $t ('\}', 'then', 'elif|else|fi', ...), or the end ('') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: called CC=14 SCAR=26.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 6611 | ▶ | my ($t, $l) = @_; local $OPEN[@OPEN] = $l; my $top = !$t && !$M; # fills @$l in place | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$t || $Proc::ShellSubset::M
MC/DC100%2/2
$t || $Proc::ShellSubset::M
$t
$Proc::ShellSubset::M
Truth table100%3/3
A || B
A= $tB= $Proc::ShellSubset::M
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 6604 | ▶ | my $e = ref $t ? $t : $t eq ')' ? qr/\G(?=\))/ : $t ? qr/\G(?=(?:$t)$END)/ : qr/\G\z/; # or a ready regex | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 6611 | ▶ | while (/\G$BN/gc, !/$e/) { # (zero-length /gc matches can't repeat at one place: test with plain //) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 8147 | push @$l, my $c = []; andor($c); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 5486 | ▶ | if (/\G$B&(?!&)/gc) { push @$c, '&' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 3372 | ▶ | elsif (!/\G$B(?:;(?!;)|\n)/gc) { /\G$B/gc, /$e/ ? last : U() } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 2121 | ▶ | $LAST = pos if $top; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 2121 | ▶ | if ($top && $CUT && substr($_, pos() - 1, 1) eq "\n" and /\G$BN/gc, !/$e/) { # P1 (Proc::ShellSubset::Large): an alias | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$top and $Proc::ShellSubset::CUT and substr($_, pos($_) - 1, 1) eq "\n" and /\G$Proc::ShellSubset::BN/cg, !/$e/
$top and $Proc::ShellSubset::CUT and substr($_, pos($_) - 1, 1) eq "\n"
$top and $Proc::ShellSubset::CUT
MC/DC75%3/4
$top and $Proc::ShellSubset::CUT and substr($_, pos($_) - 1, 1) eq "\n" and /\G$Proc::ShellSubset::BN/cg, !/$e/
$top
$Proc::ShellSubset::CUT
substr($_, pos($_) - 1, 1) eq "\n"
/\G$Proc::ShellSubset::BN/cg, !/$e/
Truth table80%4/5
A and B and C and D
A= $topB= $Proc::ShellSubset::CUTC= substr($_, pos($_) - 1, 1) eq "\n"D= /\G$Proc::ShellSubset::BN/cg, !/$e/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 16 | my $p = opos(pos); # definition known only when it runs: the rest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 16 | push @$l, [[{ rest => substr($SRC, $p), lineoff => $LOFF + (substr($SRC, 0, $p) =~ tr/\n//) }]]; last } } # of the text, parsed then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 3717 | $l } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 6069 | ▶ | sub shell { # a list that runs in a shell of its own: the loops around it don't count, and exec is checked at its end | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shell: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 6077 | local $LOOP = 0; my $l = list(@_); xc($l, 1); $l } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 8140 | ▶ | sub andor { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
andor: called CC=3 SCAR=11.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 8148 | my $ao = shift; local $OPEN[@OPEN] = $ao; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 8140 | ▶ | do { push @$ao, my $p = []; pipeline($p) } while /\G$B(&&|\|\|)$BN/gc && push @$ao, $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/\G$Proc::ShellSubset::B(&&|\|\|)$Proc::ShellSubset::BN/cg and push @$ao, $1
MC/DC50%1/2
/\G$Proc::ShellSubset::B(&&|\|\|)$Proc::ShellSubset::BN/cg and push @$ao, $1
/\G$Proc::ShellSubset::B(&&|\|\|)$Proc::ShellSubset::BN/cg
push @$ao, $1
Truth table66%2/3
A and B
A= /\G$Proc::ShellSubset::B(&&|\|\|)$Proc::ShellSubset::BN/cgB= push @$ao, $1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 8505 | ▶ | sub pipeline { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pipeline: called CC=10 SCAR=23.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 8497 | my $p = shift; local $OPEN[@OPEN] = $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 8497 | ▶ | push @$p, '!' if /\G!(?=[ \t])$B/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 8497 | ▶ | E("'! !'", pos) if @$p && /\G!$END/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$p and /\G!$Proc::ShellSubset::END/
MC/DC100%2/2
@$p and /\G!$Proc::ShellSubset::END/
@$p
/\G!$Proc::ShellSubset::END/
Truth table100%3/3
A and B
A= @$pB= /\G!$Proc::ShellSubset::END/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 8486 | ▶ | do { command($p) } while /\G$B\|(?![|&])$BN/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 5840 | my ($q, @c) = (pos, grep ref, @$p); # each element of a longer pipeline is a subshell: break/continue can't reach the loop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 5840 | ▶ | @c > 1 and ($_->{argv} && $_->{argv}[0] // q{}) =~ /^(?:break|continue)\z/ and E("'$_->{argv}[0]' in a pipeline", $q) for @c } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
@c > 1 and ($_->{"argv"} && $_->{"argv"}[0] // "") =~ /^(?:break|continue)\z/
$_->{"argv"} && $_->{"argv"}[0] // ""
$_->{"argv"} and $_->{"argv"}[0]
MC/DC100%3/3
@c > 1 and ($_->{"argv"} && $_->{"argv"}[0] // "") =~ /^(?:break|continue)\z/
@c > 1
$_->{"argv"}
$_->{"argv"}[0]
Truth table100%4/4
A and B and C
A= @c > 1B= $_->{"argv"}C= $_->{"argv"}[0]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 552 | ▶ | sub kw { /\G$BN/gc; /\G$_[0]$END/gc } # a reserved word, after blanks and newlines | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
kw: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 127 | ▶ | sub part { # a list up to one of the words in $t, into a new array pushed onto @$to; must not be empty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 105 | ▶ | my ($to, $t, $what, $p) = @_; push @$to, my $l = []; list($t, $l); @$l or E("empty $what", $p); $l } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 113 | ▶ | sub body { # a loop's 'do' list up to 'done', one loop deeper for break and continue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
body: called CC=2 SCAR=7.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 113 | my ($c, $p) = @_; local $LOOP = $LOOP + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 105 | ▶ | list('done', $c->{do}); @{$c->{do}} or E('empty loop body', $p); kw('done') } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 599 | ▶ | sub vname { # a variable the string sets: by assignment (C5), for or read | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
vname: called CC=2 SCAR=6.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 577 | ▶ | my ($n, $p) = @_; E("assignment to '$n'", $p) if $n =~ /^(?:HOME|CDPATH|PPID)\z/; name($n, $p) } # PPID: read-only in bash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 9060 | ▶ | sub compound { # if, while, until, for, case (each with its option); pushes the node onto @$pl | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compound: called CC=22 SCAR=30.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 9060 | my ($pl, $p) = @_; my $c; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 9060 | ▶ | if ($O{if} && /\Gif$END/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$Proc::ShellSubset::O{"if"} and /\Gif$Proc::ShellSubset::END/cg
MC/DC100%2/2
$Proc::ShellSubset::O{"if"} and /\Gif$Proc::ShellSubset::END/cg
$Proc::ShellSubset::O{"if"}
/\Gif$Proc::ShellSubset::END/cg
Truth table100%3/3
A and B
A= $Proc::ShellSubset::O{"if"}B= /\Gif$Proc::ShellSubset::END/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 52 | push @$pl, $c = { if => my $arms = [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 52 | ▶ | do { part($arms, 'then', 'condition', $p); kw('then'); part($arms, 'elif|else|fi', "'then' part", $p) } while kw('elif'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 36 | ▶ | part($arms, 'fi', "'else' part", $p) if kw('else'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 36 | kw('fi') } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ▶ | elsif ($O{while} && /\G(while|until)$END/gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$Proc::ShellSubset::O{"while"} and /\G(while|until)$Proc::ShellSubset::END/cg
MC/DC100%2/2
$Proc::ShellSubset::O{"while"} and /\G(while|until)$Proc::ShellSubset::END/cg
$Proc::ShellSubset::O{"while"}
/\G(while|until)$Proc::ShellSubset::END/cg
Truth table100%3/3
A and B
A= $Proc::ShellSubset::O{"while"}B= /\G(while|until)$Proc::ShellSubset::END/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 51 | push @$pl, $c = { $1 => my $cond = [], do => [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 51 | ▶ | list('do', $cond); @$cond or E('empty condition', $p); kw('do'); body($c, $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ▶ | elsif ($O{for} && /\Gfor$END/gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$Proc::ShellSubset::O{"for"} and /\Gfor$Proc::ShellSubset::END/cg
MC/DC100%2/2
$Proc::ShellSubset::O{"for"} and /\Gfor$Proc::ShellSubset::END/cg
$Proc::ShellSubset::O{"for"}
/\Gfor$Proc::ShellSubset::END/cg
Truth table100%3/3
A and B
A= $Proc::ShellSubset::O{"for"}B= /\Gfor$Proc::ShellSubset::END/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 81 | ▶ | /\G$B/gc; my $q = pos; /\G($NM)$END/gc or E("'for' needs a variable name", $q); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 77 | push @$pl, $c = { for => vname("$1", $q), in => my $in = [], do => [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 72 | ▶ | if (kw('in')) { { local $OPEN[@OPEN] = $in; push @$in, word('a') while /\G$B/gc, !/\G(?=[;\n]|\z)/ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 47 | ▶ | /\G$B[;\n]/gc or U() } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 20 | ▶ | else { $FORALL or E("'for' without 'in' (it would loop over \$@)", pos); # for NAME: as for NAME in "$@" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 11 | push @$in, ['', ['"$', '@']]; /\G$B[;\n]/gc } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 58 | ▶ | kw('do') or U(); body($c, $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ▶ | elsif ($O{case} && /\Gcase$END/gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$Proc::ShellSubset::O{"case"} and /\Gcase$Proc::ShellSubset::END/cg
MC/DC100%2/2
$Proc::ShellSubset::O{"case"} and /\Gcase$Proc::ShellSubset::END/cg
$Proc::ShellSubset::O{"case"}
/\Gcase$Proc::ShellSubset::END/cg
Truth table100%3/3
A and B
A= $Proc::ShellSubset::O{"case"}B= /\Gcase$Proc::ShellSubset::END/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 49 | push @$pl, $c = { case => '', in => my $in = [] }; local $OPEN[@OPEN] = $in; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 49 | ▶ | /\G$B/gc; $c->{case} = word('a'); kw('in') or U(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 41 | ▶ | until (kw('esac')) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 61 | /\G\(/gc; push @$in, my $pat = []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 61 | ▶ | { local $OPEN[@OPEN] = $pat; do { /\G$B/gc; push @$pat, word('a') } while /\G$B\|/gc } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 51 | ▶ | /\G$B\)/gc or U(); push @$in, my $l = []; list(qr/\G(?=;;|esac$END)/, $l); /\G;;/gc } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 8982 | $c } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 9485 | ▶ | sub command { # pushes the command onto the pipeline @{$_[0]} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command: called CC=9 SCAR=22.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 9480 | my $pl = shift; my $p = pos; my $c; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 9480 | ▶ | E("'((' at the start of a command", $p) if /\G\(\(/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 9464 | ▶ | if (/\G\(/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 181 | push @$pl, $c = { sub => my $l = [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 181 | ▶ | shell(')', $l); /\G\)/gc; @$l or E('empty subshell', $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | elsif (/\G\{(?=[ \t\n])/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 245 | push @$pl, $c = { group => my $l = [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 224 | ▶ | list('\}', $l); /\G\}/gc; @$l or E('empty group', $p) } # xc: by the parent | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 9061 | ▶ | else { $c = compound($pl, $p) or return simple($pl) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 492 | ▶ | my ($r, @r); push @r, $r while /\G$B/gc, $r = redir(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 489 | ▶ | $c->{redir} = \@r if @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 496 | $c } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 17046 | ▶ | sub redir { # a redirection, or nothing (pos unchanged) if none starts here | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
redir: called CC=11 SCAR=24.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 17054 | my $p = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 17054 | ▶ | E('process substitution (bash)', $p) if /\G[<>]\(/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 17029 | ▶ | /\G([0-9]*)(<<|>>|<>|>\||<&|>&|<|>)$B/gc or return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1284 | ▶ | E('target followed by a redirection operator (dash: a descriptor)', pos) if /\G[0-9]+[<>]/; # x >&2>f (U4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1272 | my ($n, $op) = ($1, $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1286 | ▶ | E('here-document', $p) if $op eq '<<'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1223 | ▶ | E('multi-digit descriptor', $p) if length $n > 1 && !$O{fdmulti}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
length $n > 1 and not $Proc::ShellSubset::O{"fdmulti"}
MC/DC100%2/2
length $n > 1 and not $Proc::ShellSubset::O{"fdmulti"}
length $n > 1
not $Proc::ShellSubset::O{"fdmulti"}
Truth table100%3/3
A and not(B)
A= length $n > 1B= not $Proc::ShellSubset::O{"fdmulti"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1195 | ▶ | my $fd = length $n ? 0 + $n : $op =~ /^</ ? 0 : 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1194 | ▶ | return [$fd, $op, /\G([0-9-])$END/gc ? $1 : E("'$op' takes one digit or '-'", pos)] if $op =~ /&/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 737 | [$fd, $op, word('r')] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 6545 | ▶ | sub simple { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simple: called CC=60 SCAR=42.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 6545 | my $pl = shift; my (@env, @np, @av, @ap, @r, $kw); my $p0 = pos; # @np: NAME, position, ... of the settings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 6566 | push @$pl, my $c = { argv => \@av }; local $OPEN[@OPEN] = \@av; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 6545 | ▶ | while (/\G$B/gc, !/\G(?=[;&|()\n]|\z)/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 16649 | my $p = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 16657 | ▶ | if (my $r = redir()) { push @r, $r } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1099 | ▶ | elsif (!@av and /\G($NM)(\+?)=/gc) { E("'$1+='", $p) if $2; push @np, "$1", $p; push @env, "$1", word('e') } # "$1", not $1: word() matches again | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @av and /\G($Proc::ShellSubset::NM)(\+?)=/cg
MC/DC100%2/2
not @av and /\G($Proc::ShellSubset::NM)(\+?)=/cg
not @av
/\G($Proc::ShellSubset::NM)(\+?)=/cg
Truth table100%3/3
not(A) and B
A= not @avB= /\G($Proc::ShellSubset::NM)(\+?)=/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 14334 | ▶ | else { push @av, word('a'); push @ap, $p; $kw //= substr $_, $p, pos() - $p } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$kw //= substr($_, $p, pos($_) - $p)
MC/DC0%0/2
$kw //= substr($_, $p, pos($_) - $p)
$kw
substr($_, $p, pos($_) - $p)
Truth table66%2/3
A //= B
A= $kwB= substr($_, $p, pos($_) - $p)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 5247 | ▶ | if (!@av && @env && !@r && $O{assign}) { # only settings (C5) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
not @av and @env and not @r and $Proc::ShellSubset::O{"assign"}
not @av and @env and not @r
not @av and @env
MC/DC100%4/4
not @av and @env and not @r and $Proc::ShellSubset::O{"assign"}
not @av
@env
not @r
$Proc::ShellSubset::O{"assign"}
Truth table100%5/5
not(A) and B and not(C) and D
A= not @avB= @envC= not @rD= $Proc::ShellSubset::O{"assign"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 166 | ▶ | vname(splice @np, 0, 2) while @np; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 154 | return %$c = (set => \@env) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 5089 | name(@$_) for grep $$_[0] ne q{IFS}, pairs @np; # bash refuses its own names (UID=5 cmd) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 5070 | ▶ | @av or E(@env || @r ? 'no command name' : 'missing command', $p0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
@env or @r
MC/DC100%2/2
@env or @r
@env
@r
Truth table100%3/3
A or B
A= @envB= @r
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 4909 | ▶ | E('command name not literal', $ap[0]) if ref $av[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 4879 | my $n = $av[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 4879 | ▶ | if ($n eq 'exec') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 129 | shift @av; my $xp = shift @ap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 129 | ▶ | @av or E("'exec' without a command", $p0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 123 | ▶ | E("unsupported 'exec' form", $ap[0]) if ref($av[0]) || $av[0] =~ /^-|^(?:cd|:|exit)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $av[0] or $av[0] =~ /^-|^(?:cd|:|exit)\z/
MC/DC50%1/2
ref $av[0] or $av[0] =~ /^-|^(?:cd|:|exit)\z/
ref $av[0]
$av[0] =~ /^-|^(?:cd|:|exit)\z/
Truth table66%2/3
A or B
A= ref $av[0]B= $av[0] =~ /^-|^(?:cd|:|exit)\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 99 | $c->{exec} = P($xp) } # its position, until xc() has checked it and made it 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 4750 | ▶ | E("keyword '$n'", $ap[0]) if $KW{$n} && $kw eq $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Proc::ShellSubset::KW{$n} and $kw eq $n
MC/DC100%2/2
$Proc::ShellSubset::KW{$n} and $kw eq $n
$Proc::ShellSubset::KW{$n}
$kw eq $n
Truth table100%3/3
A and B
A= $Proc::ShellSubset::KW{$n}B= $kw eq $n
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 4688 | ▶ | if ($n =~ /^(?:break|continue)\z/ && $LOOP) { # inside a loop (options while, for) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$n =~ /^(?:break|continue)\z/ and $Proc::ShellSubset::LOOP
MC/DC100%2/2
$n =~ /^(?:break|continue)\z/ and $Proc::ShellSubset::LOOP
$n =~ /^(?:break|continue)\z/
$Proc::ShellSubset::LOOP
Truth table100%3/3
A and B
A= $n =~ /^(?:break|continue)\z/B= $Proc::ShellSubset::LOOP
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 25 | ▶ | E("unsupported '$n' form", $ap[0]) if @env || @r || @av > 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%9/15
@env or @r or @av > 2 or @av == 2 and !($av[1] =~ /^[1-9][0-9]*\z/) || $av[1] > $Proc::ShellSubset::LOOP
@env or @r or @av > 2
@env or @r
@av == 2 and !($av[1] =~ /^[1-9][0-9]*\z/) || $av[1] > $Proc::ShellSubset::LOOP
not $av[1] =~ /^[1-9][0-9]*\z/ or $av[1] > $Proc::ShellSubset::LOOP
MC/DC33%2/6
@env or @r or @av > 2 or @av == 2 and !($av[1] =~ /^[1-9][0-9]*\z/) || $av[1] > $Proc::ShellSubset::LOOP
@env
@r
@av > 2
@av == 2
not $av[1] =~ /^[1-9][0-9]*\z/
$av[1] > $Proc::ShellSubset::LOOP
Truth table42%3/7
A or B or C or D and not(E) or F
A= @envB= @rC= @av > 2D= @av == 2E= not $av[1] =~ /^[1-9][0-9]*\z/F= $av[1] > $Proc::ShellSubset::LOOP
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | || @av == 2 && ($av[1] !~ /^[1-9][0-9]*\z/ || $av[1] > $LOOP) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | ▶ | elsif ($n eq 'read' && $O{read}) { # read [-r] NAME... (option read) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$n eq "read" and $Proc::ShellSubset::O{"read"}
MC/DC100%2/2
$n eq "read" and $Proc::ShellSubset::O{"read"}
$n eq "read"
$Proc::ShellSubset::O{"read"}
Truth table100%3/3
A and B
A= $n eq "read"B= $Proc::ShellSubset::O{"read"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 64 | ▶ | my $i = ($av[1] // '') eq '-r' ? 2 : 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$av[1] // ""
MC/DC100%1/1
$av[1] // ""
$av[1]
Truth table100%2/2
A
A= $av[1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 72 | ▶ | $i <= $#av or E("'read' without a variable name", $ap[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 60 | ▶ | for my $j ($i .. $#av) { $av[$j] =~ /^$NM\z/ or E("unsupported 'read' argument", $ap[$j]); vname($av[$j], $ap[$j]) } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 369 | elsif ($BI{$n}) { E("builtin '$n'", $ap[0]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 4311 | ▶ | if ($n eq 'cd') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 177 | ▶ | @av <= 2 && !@env && !@r && !defined $ENV{CDPATH} && ($av[1] // '') !~ /^-/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition85%12/14
@av <= 2 and not @env and not @r and not defined $ENV{"CDPATH"} and not +($av[1] // "") =~ /^-/
@av <= 2 and not @env and not @r and not defined $ENV{"CDPATH"}
@av <= 2 and not @env and not @r
@av <= 2 and not @env
$av[1] // ""
MC/DC60%3/5
@av <= 2 and not @env and not @r and not defined $ENV{"CDPATH"} and not +($av[1] // "") =~ /^-/
@av <= 2
not @env
not @r
not defined $ENV{"CDPATH"}
$av[1]
Truth table66%4/6
A and not(B) and not(C) and not(D) and not(E)
A= @av <= 2B= not @envC= not @rD= not defined $ENV{"CDPATH"}E= $av[1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | or E('unsupported cd form', $ap[0]); # C8: the argument may have expansions; cd alone goes home | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | E('cd to $HOME without HOME', $ap[0]) if !defined $ENV{HOME} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 132 | ▶ | && (@av == 1 || ref $av[1] && grep { ref && $$_[0] =~ /^\$/ } @{$av[1]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition8%1/12
not defined $ENV{"HOME"} and @av == 1 || ref $av[1] && grep({ref $_ and $_->[0] =~ /^\$/;} @{$av[1];})
@av == 1 or ref $av[1] and grep {ref $_ and $_->[0] =~ /^\$/;} @{$av[1];}
ref $av[1] and grep {ref $_ and $_->[0] =~ /^\$/;} @{$av[1];}
ref $_ && $_->[0] =~ /^\$/
MC/DC0%0/4
not defined $ENV{"HOME"} and @av == 1 || ref $av[1] && grep({ref $_ and $_->[0] =~ /^\$/;} @{$av[1];})
not defined $ENV{"HOME"}
@av == 1
ref $av[1]
grep {ref $_ and $_->[0] =~ /^\$/;} @{$av[1];}
MC/DC0%0/2
ref $_ && $_->[0] =~ /^\$/
ref $_
$_->[0] =~ /^\$/
Truth table20%1/5
not(A) and B or C and D
A= not defined $ENV{"HOME"}B= @av == 1C= ref $av[1]D= grep {ref $_ and $_->[0] =~ /^\$/;} @{$av[1];}
Truth table0%0/3
A && B
A= ref $_B= $_->[0] =~ /^\$/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 132 | return %$c = (cd => $av[1]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 4170 | ▶ | if ($n =~ /^(?::|exit)\z/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 152 | ▶ | E("settings before '$n'", $p0) if @env; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 141 | ▶ | E('unsupported exit status', $ap[0]) if $n eq 'exit' && (@av > 2 || @av == 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition91%11/12
$n eq "exit" and @av > 2 || @av == 2 && (!($av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $av[1] > 255)
@av > 2 or @av == 2 and !($av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $av[1] > 255
@av == 2 and !($av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $av[1] > 255
not $av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/ or $av[1] > 255
MC/DC80%4/5
$n eq "exit" and @av > 2 || @av == 2 && (!($av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $av[1] > 255)
$n eq "exit"
@av > 2
@av == 2
not $av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/
$av[1] > 255
Truth table83%5/6
A and B or C and not(D) or E
A= $n eq "exit"B= @av > 2C= @av == 2D= not $av[1] =~ /^(?:0|[1-9][0-9]{0,2})\z/E= $av[1] > 255
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | && ($av[1] !~ /^(?:0|[1-9][0-9]{0,2})\z/ || $av[1] > 255)) } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 4234 | ▶ | $c->{env} = \@env if @env; $c->{redir} = \@r if @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 4234 | $c } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 21570 | ▶ | sub word { # $x: a(rgument), e(nv value), r(edirection target), b(race alternative) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
word: called CC=16 SCAR=27.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 21592 | ▶ | my $x = shift; my $p0 = pos; my @s; local $ATT = $ATT // $#OPEN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$Proc::ShellSubset::ATT // $#Proc::ShellSubset::OPEN
MC/DC100%1/1
$Proc::ShellSubset::ATT // $#Proc::ShellSubset::OPEN
$Proc::ShellSubset::ATT
Truth table100%2/2
A
A= $Proc::ShellSubset::ATT
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 21592 | ▶ | return '[' if $x eq 'a' and /\G\[$END/gc; # '[' alone: literal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$x eq "a" and /\G\[$Proc::ShellSubset::END/cg
MC/DC100%2/2
$x eq "a" and /\G\[$Proc::ShellSubset::END/cg
$x eq "a"
/\G\[$Proc::ShellSubset::END/cg
Truth table100%3/3
A and B
A= $x eq "a"B= /\G\[$Proc::ShellSubset::END/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 21432 | ▶ | my $ta = $x eq 'e' || $x eq 'a' && $O{tilde_args} && /\G($NM=)/gc && push @s, [u => $1]; # ~ also after '=' and ':' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition91%11/12
$x eq 'e' || $x eq 'a' && $Proc::ShellSubset::O{'tilde_args'} && /\G($Proc::ShellSubset::NM=)/cg && push(@s, ['u', $1])
$x eq "a" and $Proc::ShellSubset::O{"tilde_args"} and /\G($Proc::ShellSubset::NM=)/cg and push @s, ["u", $1]
$x eq "a" and $Proc::ShellSubset::O{"tilde_args"} and /\G($Proc::ShellSubset::NM=)/cg
$x eq "a" and $Proc::ShellSubset::O{"tilde_args"}
MC/DC80%4/5
$x eq 'e' || $x eq 'a' && $Proc::ShellSubset::O{'tilde_args'} && /\G($Proc::ShellSubset::NM=)/cg && push(@s, ['u', $1])
$x eq 'e'
$x eq "a"
$Proc::ShellSubset::O{"tilde_args"}
/\G($Proc::ShellSubset::NM=)/cg
push @s, ["u", $1]
Truth table83%5/6
A || B and C and D and E
A= $x eq 'e'B= $x eq "a"C= $Proc::ShellSubset::O{"tilde_args"}D= /\G($Proc::ShellSubset::NM=)/cgE= push @s, ["u", $1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 21432 | ▶ | my $te = $ta ? qr{(?=[/:])|$END} : qr{(?=/)|$END}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 21432 | my $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | my %do = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 462 | ▶ | sq => sub { push @s, [q => shift] }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 1454 | ▶ | dq => sub { push @s, [q => '']; dq(\@s, $p) }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 222 | ▶ | bs => sub { $_[0] eq "\n" ? E('backslash-newline in a word', $p) : push @s, [q => shift] }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 2015 | ▶ | ex => sub { push @s, [x => $EX{$_[0]}->('', $p)] }, # also in redirection targets (Q1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 370 | ▶ | gl => sub { $x eq 'r' and return $RLIT ? push(@s, [q => shift]) : E('pattern in a redirection target', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 344 | ▶ | push @s, [$x eq 'e' ? 'u' : 'g', shift] }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 182 | ▶ | br => sub { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 182 | ▶ | $x eq 'r' and return $RLIT ? push(@s, [q => '[']) : E('pattern in a redirection target', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 180 | ▶ | push @s, $x eq 'e' ? [u => '['] : /\G(!?\]?[^\] \t\n;&|()<>'"\\\$`{}^\/,]*\])/gc ? [g => "[$1"] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition100%6/6
$Proc::ShellSubset::RLIT and m(\G\^(\]?[^\] \t\n;&|()<>'"\\\$`{}^/,]*\]))cg
$Proc::ShellSubset::RLIT and bracket(\@s, $p)
MC/DC100%2/2
$Proc::ShellSubset::RLIT and m(\G\^(\]?[^\] \t\n;&|()<>'"\\\$`{}^/,]*\]))cg
$Proc::ShellSubset::RLIT
m(\G\^(\]?[^\] \t\n;&|()<>'"\\\$`{}^/,]*\]))cg
MC/DC100%2/2
$Proc::ShellSubset::RLIT and bracket(\@s, $p)
$Proc::ShellSubset::RLIT
bracket(\@s, $p)
Truth table100%3/3
A and B
A= $Proc::ShellSubset::RLITB= m(\G\^(\]?[^\] \t\n;&|()<>'"\\\$`{}^/,]*\]))cg
Truth table100%3/3
A and B
A= $Proc::ShellSubset::RLITB= bracket(\@s, $p)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | : $RLIT && /\G\^(\]?[^\] \t\n;&|()<>'"\\\$`{}^\/,]*\])/gc ? [g => "[^$1"] # Large: [^...] negates (rule E; the executor reads it) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | : $RLIT && bracket(\@s, $p) ? () # Large: quotes, expansions, '/' inside (post4-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | : /\G(?:\\.|'[^']*'|"(?:[^"\\]|\\.)*"|[^ \t\n;&|()<>\\'"])*?\]/s # a ] later in the word, past quotes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | ? E('bracket expression with a quote, expansion or slash', $p) : [g => '['] }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 219 | ▶ | cb => sub { # a '{' not followed by '}' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=9 SCAR=22.1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 219 | ▶ | $O{brace} && $x eq 'a' or E("unquoted '{'", $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Proc::ShellSubset::O{"brace"} and $x eq "a"
MC/DC100%2/2
$Proc::ShellSubset::O{"brace"} and $x eq "a"
$Proc::ShellSubset::O{"brace"}
$x eq "a"
Truth table100%3/3
A and B
A= $Proc::ShellSubset::O{"brace"}B= $x eq "a"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 12 | ▶ | if (/\G(-?[0-9]+|[A-Za-z])\.\.(-?[0-9]+|[A-Za-z])\}/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 4 | my ($f, $t) = ($1, $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 4 | ▶ | E('mixed brace sequence', $p) if $f =~ /[0-9]/ xor $t =~ /[0-9]/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%2/4
$f =~ /[0-9]/ xor $t =~ /[0-9]/
MC/DC50%1/2
$f =~ /[0-9]/ xor $t =~ /[0-9]/
$f =~ /[0-9]/
$t =~ /[0-9]/
Truth table50%2/4
A xor B
A= $f =~ /[0-9]/B= $t =~ /[0-9]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | return push @s, [x => ['{..', $f, $t]] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 8 | ▶ | my @alt; do { push @alt, word('b') } while /\G,/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 6 | ▶ | /\G\}/gc && @alt > 1 or E('unsupported brace form', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/\G\}/cg and @alt > 1
MC/DC50%1/2
/\G\}/cg and @alt > 1
/\G\}/cg
@alt > 1
Truth table66%2/3
A and B
A= /\G\}/cgB= @alt > 1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 4 | push @s, [x => ['{', @alt]] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 209 | ▶ | ti => sub { # ~ at the start of the word, and with $ta after the NAME= of an argument or an unquoted ':' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=25.5
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 187 | ▶ | return push @s, [u => '~'] if @s && !($ta && $s[-1][0] eq 'u' && ($s[-1][1] =~ /:\z/ || @s == 1 && $x eq 'a')); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition93%14/15
@s and not $ta && $s[-1][0] eq "u" && ($s[-1][1] =~ /:\z/ || @s == 1 && $x eq "a")
$ta && $s[-1][0] eq 'u' && ($s[-1][1] =~ /:\z/ || @s == 1 && $x eq 'a')
$ta and $s[-1][0] eq "u"
$s[-1][1] =~ /:\z/ or @s == 1 and $x eq "a"
@s == 1 and $x eq "a"
MC/DC83%5/6
@s and not $ta && $s[-1][0] eq "u" && ($s[-1][1] =~ /:\z/ || @s == 1 && $x eq "a")
@s
$ta
$s[-1][0] eq "u"
$s[-1][1] =~ /:\z/
@s == 1
$x eq "a"
Truth table85%6/7
A and not(B and C && D or E and F)
A= @sB= $taC= $s[-1][0] eq "u"D= $s[-1][1] =~ /:\z/E= @s == 1F= $x eq "a"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 156 | ▶ | E('~ in a brace alternative', $p) if $x eq 'b'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 156 | ▶ | /\G((?:[A-Za-z0-9._][A-Za-z0-9._-]*)?)$te/gc or E('unsupported ~ form', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 138 | ▶ | E('~ without HOME', $p) if $1 eq '' && !defined $ENV{HOME} && !$Proc::ShellSubset::TILDEPW; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$1 eq "" and not defined $ENV{"HOME"} and not $Proc::ShellSubset::TILDEPW
$1 eq "" and not defined $ENV{"HOME"}
MC/DC0%0/3
$1 eq "" and not defined $ENV{"HOME"} and not $Proc::ShellSubset::TILDEPW
$1 eq ""
not defined $ENV{"HOME"}
not $Proc::ShellSubset::TILDEPW
Truth table50%2/4
A and not(B) and not(C)
A= $1 eq ""B= not defined $ENV{"HOME"}C= not $Proc::ShellSubset::TILDEPW
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 138 | push @s, [x => ['~', $1]] }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 88 | ▶ | ca => sub { E("unquoted '^'", $p) if $O{nocaret}; push @s, [u => '^'] }, # ordinary unless nocaret (C3) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 17881 | ▶ | lit => sub { push @s, [u => shift] }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 66 | ▶ | bad => sub { E({"'" => 'unterminated quote', '\\' => 'final backslash', '}' => "unquoted '}'"}->{$_[0]} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Condition100%2/2
{"'", "unterminated quote", "\\", "final backslash", "}", "unquoted '}'"}->{$_[0]} // sprintf("control character \\x%02x", ord shift())
MC/DC100%1/1
{"'", "unterminated quote", "\\", "final backslash", "}", "unquoted '}'"}->{$_[0]} // sprintf("control character \\x%02x", ord shift())
{"'", "unterminated quote", "\\", "final backslash", "}", "unquoted '}'"}->{$_[0]}
Truth table100%2/2
A
A= {"'", "unterminated quote", "\\", "final backslash", "}", "unquoted '}'"}->{$_[0]}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 21432 | // sprintf('control character \\x%02x', ord shift), $p) }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 21410 | ▶ | until (/$STOP{$x}/) { $p = pos; /$PIECE/gc; my ($k, $v) = %+; $do{$k}($v) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 20178 | ▶ | @s or $x =~ /[eb]/ or E('missing word', $p0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@s or $x =~ /[eb]/
MC/DC100%2/2
@s or $x =~ /[eb]/
@s
$x =~ /[eb]/
Truth table100%3/3
A or B
A= @sB= $x =~ /[eb]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 20098 | my $k = join '', map $$_[0], @s; my @v; # kinds: u(nquoted) q(uoted) g(lob char) x(pansion) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 20098 | ▶ | push @v, defined $1 ? ['*', join '', map $$_[1], splice @s, 0, length $1] : (shift @s)->[1] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | while $k =~ /([ug]*g[ug]*)|./g; # unquoted text next to a pattern character joins it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 20098 | ▶ | dots(@v) and E("pattern that may match '.' or '..'", $p0) unless $RLIT; # dash: yes, bash 5.2: no (U2); Large: never (rule E) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$Proc::ShellSubset::RLIT || dots(@v) && E(q[pattern that may match '.' or '..'], $p0)
dots(@v) and E("pattern that may match '.' or '..'", $p0)
MC/DC0%0/3
$Proc::ShellSubset::RLIT || dots(@v) && E(q[pattern that may match '.' or '..'], $p0)
$Proc::ShellSubset::RLIT
dots(@v)
E("pattern that may match '.' or '..'", $p0)
Truth table0%0/4
A || B and C
A= $Proc::ShellSubset::RLITB= dots(@v)C= E("pattern that may match '.' or '..'", $p0)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 20070 | mkword(@v) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 62 | ▶ | sub bracket { # Large, after '[' (post4-0.04): a bracket expression with quoted members, expansions or '/', as both | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bracket: called CC=12 SCAR=24.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 62 | my ($s, $p, $xq) = @_; my $p0 = pos; my @b = [g => '[']; # shells: quoted characters are members, not operators; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 62 | ▶ | push @b, [g => $1] if /\G([!^])/gc; # an unquoted expansion's characters are active. Pushes its | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 62 | ▶ | push @b, [g => ']'] if /\G\]/gc; # Parts on @$s and returns 1; or 0 with pos unchanged, if | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 62 | ▶ | until (/\G\]/gc) { # the word ends first (then the '[' is literal) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 85 | my $q = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if (/\G(\[:[a-z]+:\])/gc) { push @b, [g => $1] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 46 | elsif (/\G([^\] \t\n;&|()<>'"\\\$`{}^,\[\x00-\x1f\x7f]+|\[)/gc) { push @b, [g => $1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 25 | elsif (/\G'([^']*)'/gc) { push @b, [q => $1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 61 | elsif (/\G\\([^\n])/gc) { push @b, [q => $1] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 88 | elsif (/\G"/gc) { push @b, [q => '']; dq(\@b, $q) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 38 | ▶ | elsif (/\G([\$`])/gc) { push @b, [x => $EX{$1}->($xq // '', $q)] } # $xq: inside "${...}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$xq // ""
MC/DC100%1/1
$xq // ""
$xq
Truth table100%2/2
A
A= $xq
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 27 | elsif (/\G[{}^,]/) { E('bracket expression with a quote, expansion or slash', $p) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 62 | else { pos = $p0; return 0 } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 45 | push @$s, @b, [g => ']']; 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 15292 | ▶ | sub dots { # can a pattern in these Parts match a whole file name component '.' or '..'? (U2) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dots: called CC=17 SCAR=28.3
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 15292 | my ($re, $g) = ('', 0); # the component so far as a regex (only the character '.' matters); has it a pattern? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 15314 | for my $x (@_, '/') { # literal text and patterns, split at '/'; an expansion is taken to match no '.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 33374 | ▶ | for (ref $x ? $$x[0] eq '*' ? map [g => $_], split m{(/)}, $$x[1] : [x => ''] : map [l => $_], split m{(/)}, $x) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 50423 | my ($k, $v) = @$_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 50423 | ▶ | if ($v eq '/') { return 1 if $g && $re =~ /^\\\./ && grep /^$re\z/, '.', '..'; ($re, $g) = ('', 0) } # only a written '.' matches a leading one | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%6/6
$g and $re =~ /^\\\./ and grep /^$re\z/, ".", ".."
$g and $re =~ /^\\\./
MC/DC100%3/3
$g and $re =~ /^\\\./ and grep /^$re\z/, ".", ".."
$g
$re =~ /^\\\./
grep /^$re\z/, ".", ".."
Truth table100%4/4
A and B and C
A= $gB= $re =~ /^\\\./C= grep /^$re\z/, ".", ".."
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 31564 | elsif ($k eq 'l') { $re .= quotemeta $v } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 1656 | elsif ($k eq 'x') { $re .= '(?!)' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 422 | ▶ | else { $g ||= $v =~ /[*?[]/; $re .= $v =~ s{\[(!?)(\]?[^\]]*)\]|([*?])|(.)}{ # a bracket expression: can it match '.'? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$g ||= $v =~ /[*?[]/
MC/DC100%2/2
$g ||= $v =~ /[*?[]/
$g
$v =~ /[*?[]/
Truth table100%3/3
A ||= B
A= $gB= $v =~ /[*?[]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1371 | ▶ | defined $2 ? (($1 ? $2 !~ /\./ : $2 =~ /[.\-]|\[:/) ? q{[.]} : q{(?!)}) : defined $3 ? ($3 eq '*' ? '.*' : '.') : quotemeta $4}gesr } } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 15264 | 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 20268 | ▶ | sub mkword { # a Word from Parts: adjacent strings joined, a lone string bare, nothing '' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkword: called CC=8 SCAR=20.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 20268 | ▶ | my @w; !ref && @w && !ref $w[-1] ? $w[-1] .= $_ : push @w, $_ for @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
not ref $_ and @w and not ref $w[-1]
not ref $_ and @w
MC/DC100%3/3
not ref $_ and @w and not ref $w[-1]
not ref $_
@w
not ref $w[-1]
Truth table100%4/4
not(A) and B and not(C)
A= not ref $_B= @wC= not ref $w[-1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 20268 | ▶ | @w == 1 && !ref $w[0] ? $w[0] : @w ? \@w : '' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
@w == 1 and not ref $w[0]
MC/DC100%2/2
@w == 1 and not ref $w[0]
@w == 1
not ref $w[0]
Truth table100%3/3
A and not(B)
A= @w == 1B= not ref $w[0]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 1494 | ▶ | sub dq { # after '"', up to the closing '"' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dq: called CC=5 SCAR=16.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 1487 | my ($s, $p) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 1487 | ▶ | until (/\G"/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 2685 | ▶ | next if /\G\\\n/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 2682 | ▶ | if (/\G(?:([^"\\\$`]+)|\\([\$`"\\])|(\\))/gc) { push @$s, [q => $+] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1153 | elsif (/\G([\$`])/gc) { push @$s, [x => $EX{$1}->('"', pos() - 1)] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 15 | else { E('unterminated double quote', $p) } } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 2188 | ▶ | sub dollar { # after '$'; $q is '"' inside double quotes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dollar: called CC=19 SCAR=29.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 2187 | my ($q, $p) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 2187 | ▶ | return '$' unless /\G[A-Za-z_0-9{(@*#?\$!\[-]/ or !$q && /\G['"]/; # starts nothing: literal (C1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
/\G[A-Za-z_0-9{(\@*#?\$!\[-]/ or not $q and /\G['"]/
not $q and /\G['"]/
MC/DC100%3/3
/\G[A-Za-z_0-9{(\@*#?\$!\[-]/ or not $q and /\G['"]/
/\G[A-Za-z_0-9{(\@*#?\$!\[-]/
not $q
/\G['"]/
Truth table100%4/4
A or not(B) and C
A= /\G[A-Za-z_0-9{(\@*#?\$!\[-]/B= not $qC= /\G['"]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2103 | ▶ | return [$q . '$((', arith($p)] if /\G\(\(/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1962 | ▶ | if (/\G\(/gc) { my $l = shell(')', []); /\G\)/gc; return [$q . '$(', $l] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1650 | ▶ | return [$q . '$', name("$1", $p)] if /\G(?|\{($NM|[?!])\}|($NM|[?!]))/gc; # $? and $! (corpus-round C6) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 523 | ▶ | if ($O{param_ops}) { # (C7) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 309 | ▶ | return [$q . '${#', name("$1", $p)] if /\G\{#($NM)\}/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 304 | ▶ | if (/\G\{($NM)(:?[-+])/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 55 | my ($n, $op, @w) = ($1, $2); name($n, $p); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 55 | ▶ | until (/\G\}/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 61 | ▶ | if (/\G([^"'\\~*?\[{}\$`\n]+)/gc) { push @w, $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 15 | elsif (/\G([\$`])/gc) { my $x = $1; # \" in `...` inside "${...}": " in bash, \" in dash (U3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 15 | ▶ | E('\\" in backquotes inside "${...}"', pos() - 1) if $x eq '`' && $q && /\G((?:[^`\\]|\\.)*)/s && $1 =~ /\\"/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
$x eq "`" and $q and /\G((?:[^`\\]|\\.)*)/s and $1 =~ /\\"/
$x eq "`" and $q and /\G((?:[^`\\]|\\.)*)/s
$x eq "`" and $q
MC/DC75%3/4
$x eq "`" and $q and /\G((?:[^`\\]|\\.)*)/s and $1 =~ /\\"/
$x eq "`"
$q
/\G((?:[^`\\]|\\.)*)/s
$1 =~ /\\"/
Truth table80%4/5
A and B and C and D
A= $x eq "`"B= $qC= /\G((?:[^`\\]|\\.)*)/sD= $1 =~ /\\"/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 10 | push @w, $EX{$x}->($q, pos() - 1) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 23 | ▶ | else { E(/\G\z/ ? "unterminated '\${'" : "unsupported character in '\${$n$op...}'", pos) } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 27 | return [$q . '${', $n, $op, mkword(@w)] } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 463 | ▶ | E(/\G['"\[]/ ? 'bash-only $ form' : 'unsupported parameter form', $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 3898 | ▶ | sub name { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=7 SCAR=19.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 3897 | my ($n, $p) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | E("shell-set variable '$n'", $p) if $SH{$n} || $n eq 'PWD' && $O{nopwd} || $n =~ /^(?:BASH|COMP|READLINE)_/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 3897 | ▶ | || $n =~ /^(?:PATH|SHELL|TERM|HOSTNAME)\z/ && !defined $ENV{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition86%13/15
$Proc::ShellSubset::SH{$n} or $n eq "PWD" and $Proc::ShellSubset::O{"nopwd"} or $n =~ /^(?:BASH|COMP|READLINE)_/ or $n =~ /^(?:PATH|SHELL|TERM|HOSTNAME)\z/ and not defined $ENV{$n}
$Proc::ShellSubset::SH{$n} or $n eq "PWD" and $Proc::ShellSubset::O{"nopwd"} or $n =~ /^(?:BASH|COMP|READLINE)_/
$Proc::ShellSubset::SH{$n} or $n eq "PWD" and $Proc::ShellSubset::O{"nopwd"}
$n eq "PWD" and $Proc::ShellSubset::O{"nopwd"}
$n =~ /^(?:PATH|SHELL|TERM|HOSTNAME)\z/ and not defined $ENV{$n}
MC/DC66%4/6
$Proc::ShellSubset::SH{$n} or $n eq "PWD" and $Proc::ShellSubset::O{"nopwd"} or $n =~ /^(?:BASH|COMP|READLINE)_/ or $n =~ /^(?:PATH|SHELL|TERM|HOSTNAME)\z/ and not defined $ENV{$n}
$Proc::ShellSubset::SH{$n}
$n eq "PWD"
$Proc::ShellSubset::O{"nopwd"}
$n =~ /^(?:BASH|COMP|READLINE)_/
$n =~ /^(?:PATH|SHELL|TERM|HOSTNAME)\z/
not defined $ENV{$n}
Truth table60%6/10
A or B and C or D or E and not(F)
A= $Proc::ShellSubset::SH{$n}B= $n eq "PWD"C= $Proc::ShellSubset::O{"nopwd"}D= $n =~ /^(?:BASH|COMP|READLINE)_/E= $n =~ /^(?:PATH|SHELL|TERM|HOSTNAME)\z/F= not defined $ENV{$n}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 3832 | $n } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 142 | ▶ | sub arith { # after '$((': check the expression by its grammar, return its text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arith: called CC=4 SCAR=13.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 141 | my $p = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 141 | ▶ | /\G((?&e))(?&w)\)\)$ARITH/gc && $1 !~ /\+\+|--/ or E('bad arithmetic expression', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
/\G((?&e))(?&w)\)\)$Proc::ShellSubset::ARITH/cg and not $1 =~ /\+\+|--/
MC/DC100%2/2
/\G((?&e))(?&w)\)\)$Proc::ShellSubset::ARITH/cg and not $1 =~ /\+\+|--/
/\G((?&e))(?&w)\)\)$Proc::ShellSubset::ARITH/cg
not $1 =~ /\+\+|--/
Truth table100%3/3
A and not(B)
A= /\G((?&e))(?&w)\)\)$Proc::ShellSubset::ARITH/cgB= not $1 =~ /\+\+|--/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 72 | ▶ | my $t = $1; name("$1", $p) while $t =~ /\b($NM)/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 72 | $t } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 202 | ▶ | sub bq { # after '`': find the closing '`', undo its escapes, parse the result as its own string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bq: called CC=4 SCAR=13.9
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 202 | my ($q, $p) = @_; my $s = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 209 | ▶ | /\G((?:[^`\\]|\\.)*)`/sgc or E('unterminated backquote', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 198 | my ($raw, $in, @m) = ($1, ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 198 | ▶ | while ($raw =~ /\\([\$`\\$q])|(\\\n)|(.)/sg) { # a backslash escapes $ ` \ and, inside double quotes, " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1952 | ▶ | E('backslash-newline inside backquotes', $s + $-[0]) if defined $2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1949 | $in .= $+; push @m, P($s + $-[$#-]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 195 | push @m, P(pos() - 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 195 | [$q . '$(', do { local $_ = $in; local $M = \@m; shell('', []) }] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 2642 | ▶ | sub xc { # B3: 'exec' only where nothing can follow it in the shell (or subshell) it replaces | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xc: called CC=20 SCAR=30.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 2650 | my ($l, $ok) = @_; # $ok: nothing follows this list in its shell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 2642 | for my $ch (@$l) { my @p = grep ref, @$ch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 3151 | for my $pl (@p) { my @c = grep ref, @$pl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 3405 | ▶ | my $last = @c > 1 # each element of a longer pipeline is a subshell | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%15/15
@c > 1 || $pl == $p[-1] && $pl->[0] ne '!' && ($ch->[-1] eq '&' || $ok && $ch == $l->[-1])
$pl == $p[-1] and $pl->[0] ne "!" and $ch->[-1] eq "&" || $ok && $ch == $l->[-1]
$pl == $p[-1] and $pl->[0] ne "!"
$ch->[-1] eq "&" or $ok and $ch == $l->[-1]
$ok and $ch == $l->[-1]
MC/DC100%6/6
@c > 1 || $pl == $p[-1] && $pl->[0] ne '!' && ($ch->[-1] eq '&' || $ok && $ch == $l->[-1])
@c > 1
$pl == $p[-1]
$pl->[0] ne "!"
$ch->[-1] eq "&"
$ok
$ch == $l->[-1]
Truth table100%7/7
A || B and C and D or E and F
A= @c > 1B= $pl == $p[-1]C= $pl->[0] ne "!"D= $ch->[-1] eq "&"E= $okF= $ch == $l->[-1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | || $pl == $p[-1] && $pl->[0] ne '!' && ($ch->[-1] eq '&' || $ok && $ch == $l->[-1]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 3405 | for my $x (@c) { # a loop's condition and body, and an if's conditions, are followed by more of the loop or if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 4246 | ▶ | xc($x->{group}, $last) if $x->{group}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 4229 | ▶ | if (my $arms = $x->{if}) { xc($arms->[$_], $_ % 2 || @$arms % 2 && $_ == $#$arms ? $last : 0) for 0 .. $#$arms } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%6/6
$_ % 2 or @$arms % 2 and $_ == $arms->$#*
@$arms % 2 and $_ == $arms->$#*
MC/DC100%3/3
$_ % 2 or @$arms % 2 and $_ == $arms->$#*
$_ % 2
@$arms % 2
$_ == $arms->$#*
Truth table100%4/4
A or B and C
A= $_ % 2B= @$arms % 2C= $_ == $arms->$#*
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 4226 | xc($x->{$_}, 0) for grep $x->{$_}, qw(while until do); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 4223 | ▶ | if (exists $x->{case}) { xc($_, $last) for pairvalues @{$x->{in}} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 4223 | ▶ | if (exists $x->{exec}) { my $xp = $x->{exec}; $x->{exec} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 100 | ▶ | $x->{ERROR} = 1, die ["'exec' with something after it", $xp] if !$last } } } } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 550 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||