| 1 | package Template::Alloy::Velocity; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | Template::Alloy::Velocity - Velocity (VTL) role | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Template::Alloy; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | our $VERSION = $Template::Alloy::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub new { die "This class is a role for use by packages such as Template::Alloy" } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | ###----------------------------------------------------------------### | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 266 | ▶ | sub parse_tree_velocity { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_tree_velocity: called CC=102 SCAR=54.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 266 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 266 | my $str_ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 266 | ▶ | if (! $str_ref || ! defined $$str_ref) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$str_ref and defined $$str_ref
MC/DC0%0/2
$str_ref and defined $$str_ref
$str_ref
defined $$str_ref
Truth table33%1/3
A and B
A= $str_refB= defined $$str_ref
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | $self->throw('parse.no_string', "No string or undefined during parse", undef, 1); | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 266 | ▶ | local $self->{'V2EQUALS'} = $self->{'V2EQUALS'} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'V2EQUALS'} || 0
MC/DC0%0/1
$self->{'V2EQUALS'} || 0
$self->{'V2EQUALS'}
Truth table50%1/2
A
A= $self->{'V2EQUALS'}
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 266 | ▶ | local $self->{'INTERPOLATE'} = defined($self->{'INTERPOLATE'}) ? $self->{'INTERPOLATE'} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 266 | ▶ | local $self->{'V1DOLLAR'} = defined($self->{'V1DOLLAR'}) ? $self->{'V1DOLLAR'} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 266 | ▶ | local $self->{'ANYCASE'} = defined($self->{'ANYCASE'}) ? $self->{'ANYCASE'} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 266 | ▶ | local $self->{'AUTO_EVAL'} = defined($self->{'AUTO_EVAL'}) ? $self->{'AUTO_EVAL'} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 266 | ▶ | local $self->{'SHOW_UNDEFINED_INTERP'} = defined($self->{'SHOW_UNDEFINED_INTERP'}) ? $self->{'SHOW_UNDEFINED_INTERP'} : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 266 | local $self->{'START_TAG'} = qr{\#}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 266 | ▶ | local $self->{'_start_tag'} = (! $self->{'INTERPOLATE'}) ? $self->{'START_TAG'} : qr{(?: $self->{'START_TAG'} | (\$))}sx; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 266 | local $self->{'_end_tag'}; # changes over time | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 266 | local @{ $Template::Alloy::Parse::ALIASES }{qw(PARSE INCLUDE _INCLUDE ELSEIF)} | |||||||||||||||||||||||||||||||||||||||||
| 38 | = qw(PROCESS INSERT INCLUDE ELSIF); | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 266 | my $dirs = $Template::Alloy::Parse::DIRECTIVES; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 266 | my $aliases = $Template::Alloy::Parse::ALIASES; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 266 | local @{ $dirs }{ keys %$aliases } = values %$aliases; # temporarily add to the table | |||||||||||||||||||||||||||||||||||||||||
| 42 | 266 | local @{ $self }{@Template::Alloy::CONFIG_COMPILETIME} = @{ $self }{@Template::Alloy::CONFIG_COMPILETIME}; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 266 | ▶ | delete $dirs->{'JS'} if ! $self->{'COMPILE_JS'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 266 | my @tree; # the parsed tree | |||||||||||||||||||||||||||||||||||||||||
| 46 | 266 | my $pointer = \@tree; # pointer to current tree to handle nested blocks | |||||||||||||||||||||||||||||||||||||||||
| 47 | 266 | my @state; # maintain block levels | |||||||||||||||||||||||||||||||||||||||||
| 48 | 266 | local $self->{'_state'} = \@state; # allow for items to introspect (usually BLOCKS) | |||||||||||||||||||||||||||||||||||||||||
| 49 | 266 | local $self->{'_no_interp'} = 0; # no interpolation in perl | |||||||||||||||||||||||||||||||||||||||||
| 50 | 266 | my @in_view; # let us know if we are in a view | |||||||||||||||||||||||||||||||||||||||||
| 51 | my @blocks; # storage for defined blocks | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 266 | my @meta; # place to store any found meta information (to go into META) | |||||||||||||||||||||||||||||||||||||||||
| 53 | 266 | my $post_chomp = 0; # previous post_chomp setting | |||||||||||||||||||||||||||||||||||||||||
| 54 | 266 | my $continue = 0; # flag for multiple directives in the same tag | |||||||||||||||||||||||||||||||||||||||||
| 55 | 266 | my $post_op = 0; # found a post-operative DIRECTIVE | |||||||||||||||||||||||||||||||||||||||||
| 56 | 266 | my $capture; # flag to start capture | |||||||||||||||||||||||||||||||||||||||||
| 57 | my $func; | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 266 | my $pre_chomp; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 266 | my $node; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 266 | my $macro_block; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 266 | pos($$str_ref) = 0; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 266 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 64 | ### allow for #set(foo = PROCESS foo) | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 784 | ▶ | if ($capture) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 28 | ▶ | if ($macro_block) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 16 | $macro_block = 0; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 16 | push @state, $capture; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 16 | ▶ | $pointer = $capture->[4] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$capture->[4] ||= []
MC/DC0%0/1
$capture->[4] ||= []
$capture->[4]
Truth table50%1/2
A
A= $capture->[4]
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 16 | undef $capture; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 16 | next; | |||||||||||||||||||||||||||||||||||||||||
| 72 | } elsif ($$str_ref =~ m{ \G \s* (\w+)\b }gcx) { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 12 | ▶ | $func = $self->{'ANYCASE'} ? uc($1) : $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 12 | ▶ | $func = $aliases->{$func} if $aliases->{$func}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | $self->throw('parse', "Found unknown DIRECTIVE ($func)", undef, pos($$str_ref) - length($func)) | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 12 | ▶ | if ! $dirs->{$func}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 12 | $node = [$func, pos($$str_ref) - length($func), undef]; | |||||||||||||||||||||||||||||||||||||||||
| 78 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $self->throw('parse', "Error looking for block in capture DIRECTIVE", undef, pos($$str_ref)); | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 12 | push @{ $capture->[4] }, $node; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 12 | undef $capture; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | ### handle all other | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 87 | ### find the next opening tag | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 756 | ▶ | $$str_ref =~ m{ \G (.*?) $self->{'_start_tag'} }gcxs | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | || last; | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 496 | my ($text, $dollar) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | ### found a text portion - chomp it and store it | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 496 | ▶ | if (length $text) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 160 | ▶ | if (! $post_chomp) { } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | elsif ($post_chomp == 1) { $text =~ s{ ^ [^\S\n]* \n }{}x } | |||||||||||||||||||||||||||||||||||||||||
| 96 | 16 | elsif ($post_chomp == 2) { $text =~ s{ ^ \s+ }{ }x } | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | elsif ($post_chomp == 3) { $text =~ s{ ^ \s+ }{}x } | |||||||||||||||||||||||||||||||||||||||||
| 98 | 160 | ▶ | push @$pointer, $text if length $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | ### handle variable interpolation ($2 eq $) | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 496 | ▶ | if ($dollar) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | ### inspect previous text chunk for escape slashes | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 168 | ▶ | my $n = ($text =~ m{ (\\+) $ }x) ? length($1) : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 168 | ▶ | if ($n && ! $self->{'_no_interp'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$n and not $self->{"_no_interp"}
MC/DC50%1/2
$n and not $self->{"_no_interp"}
$n
not $self->{"_no_interp"}
Truth table66%2/3
A and not(B)
A= $nB= not $self->{"_no_interp"}
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 12 | my $chop = int(($n + 1) / 2); # were there odd escapes | |||||||||||||||||||||||||||||||||||||||||
| 107 | 12 | ▶ | substr($pointer->[-1], -$chop, $chop, '') if defined($pointer->[-1]) && ! ref($pointer->[-1]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $pointer->[-1] and not ref $pointer->[-1]
MC/DC0%0/2
defined $pointer->[-1] and not ref $pointer->[-1]
defined $pointer->[-1]
not ref $pointer->[-1]
Truth table33%1/3
A and not(B)
A= defined $pointer->[-1]B= not ref $pointer->[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 168 | ▶ | if ($self->{'_no_interp'} || $n % 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"_no_interp"} or $n % 2
MC/DC50%1/2
$self->{"_no_interp"} or $n % 2
$self->{"_no_interp"}
$n % 2
Truth table66%2/3
A or B
A= $self->{"_no_interp"}B= $n % 2
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 8 | push @$pointer, $dollar; | |||||||||||||||||||||||||||||||||||||||||
| 111 | 8 | next; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 160 | my $not = $$str_ref =~ m{ \G ! }gcx; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 160 | my $mark = pos($$str_ref); | |||||||||||||||||||||||||||||||||||||||||
| 116 | 160 | my $ref; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 160 | ▶ | if ($$str_ref =~ m{ \G \{ }gcx) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 8 | local $self->{'_operator_precedence'} = 0; # allow operators | |||||||||||||||||||||||||||||||||||||||||
| 119 | 8 | local $self->{'_end_tag'} = qr{\}}; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 8 | $ref = $self->parse_expr($str_ref); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 8 | ▶ | $$str_ref =~ m{ \G \s* $Template::Alloy::Parse::QR_COMMENTS \} }gcxo | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | || $self->throw('parse', 'Missing close }', undef, pos($$str_ref)); | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 152 | local $self->{'_operator_precedence'} = 1; # no operators | |||||||||||||||||||||||||||||||||||||||||
| 125 | 152 | local $Template::Alloy::Parse::QR_COMMENTS = qr{}; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 152 | $ref = $self->parse_expr($str_ref); | |||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 160 | ▶ | $self->throw('parse', "Error while parsing for interpolated string", undef, pos($$str_ref)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | if ! defined $ref; | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 160 | ▶ | if (! $not && $self->{'SHOW_UNDEFINED_INTERP'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $not and $self->{"SHOW_UNDEFINED_INTERP"}
MC/DC50%1/2
not $not and $self->{"SHOW_UNDEFINED_INTERP"}
not $not
$self->{"SHOW_UNDEFINED_INTERP"}
Truth table66%2/3
not(A) and B
A= not $notB= $self->{"SHOW_UNDEFINED_INTERP"}
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 148 | $ref = [[undef, '//', $ref, '$'.substr($$str_ref, $mark, pos($$str_ref)-$mark)], 0]; | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 160 | push @$pointer, ['GET', $mark, pos($$str_ref), $ref]; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 160 | $post_chomp = 0; # no chomping after dollar vars | |||||||||||||||||||||||||||||||||||||||||
| 135 | 160 | next; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | ### allow for escaped # | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 328 | ▶ | my $n = ($text =~ m{ (\\+) $ }x) ? length($1) : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 328 | ▶ | if ($n) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $chop = int(($n + 1) / 2); # were there odd escapes | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | substr($pointer->[-1], -$chop, $chop, '') if defined($pointer->[-1]) && ! ref($pointer->[-1]); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $pointer->[-1] and not ref $pointer->[-1]
MC/DC0%0/2
defined $pointer->[-1] and not ref $pointer->[-1]
defined $pointer->[-1]
not ref $pointer->[-1]
Truth table0%0/3
A and not(B)
A= defined $pointer->[-1]B= not ref $pointer->[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ($n % 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | push @$pointer, '#'; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 328 | ▶ | if ($$str_ref =~ m{ \G \# .*\n? }gcx # single line comment | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$$str_ref =~ / \G \# .*\n? /cgx or $$str_ref =~ / \G \* .*? \*\# /cgsx
MC/DC100%2/2
$$str_ref =~ / \G \# .*\n? /cgx or $$str_ref =~ / \G \* .*? \*\# /cgsx
$$str_ref =~ / \G \# .*\n? /cgx
$$str_ref =~ / \G \* .*? \*\# /cgsx
Truth table100%3/3
A or B
A= $$str_ref =~ / \G \# .*\n? /cgxB= $$str_ref =~ / \G \* .*? \*\# /cgsx
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | || $$str_ref =~ m{ \G \* .*? \*\# }gcxs) { # multi-line comment | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 10 | next; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 318 | ▶ | $$str_ref =~ m{ \G (\w+) }gcx | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$$str_ref =~ / \G (\w+) /cgx or $$str_ref =~ / \G \{ (\w+) (\}) /cgx
MC/DC100%2/2
$$str_ref =~ / \G (\w+) /cgx or $$str_ref =~ / \G \{ (\w+) (\}) /cgx
$$str_ref =~ / \G (\w+) /cgx
$$str_ref =~ / \G \{ (\w+) (\}) /cgx
Truth table100%3/3
A or B
A= $$str_ref =~ / \G (\w+) /cgxB= $$str_ref =~ / \G \{ (\w+) (\}) /cgx
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | || $$str_ref =~ m{ \G \{ (\w+) (\}) }gcx | ||||||||||||||||||||||||||||||||||||||||||
| 155 | || $self->throw('parse', 'Missing directive name', undef, pos($$str_ref)); | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 316 | ▶ | $func = $self->{'ANYCASE'} ? uc($1) : $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | ### make sure we know this directive - if we don't then allow fallback to macros (velocity allows them as directives) | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 316 | ▶ | $func = $aliases->{$func} if $aliases->{$func}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 316 | ▶ | if (! $dirs->{$func}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 12 | my $name = $1; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 12 | ▶ | my $mark = pos($$str_ref) - length($func) - ($2 ? 2 : 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 12 | my $args = 0; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 12 | ▶ | if ($$str_ref =~ m{ \G \( }gcx) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 12 | local $self->{'_operator_precedence'} = 0; # reset precedence | |||||||||||||||||||||||||||||||||||||||||
| 166 | 12 | $args = $self->parse_args($str_ref, {is_parened => 1}); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 12 | ▶ | $$str_ref =~ m{ \G \s* $Template::Alloy::Parse::QR_COMMENTS \) }gcxo | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | || $self->throw('parse.missing.paren', "Missing close \) in directive args", undef, pos($$str_ref)); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 12 | $node = ['GET', $mark, pos($$str_ref), [$name, $args]]; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 12 | push @$pointer, $node; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 12 | next; | |||||||||||||||||||||||||||||||||||||||||
| 173 | #$self->throw('parse', "Found unknow DIRECTIVE ($func)", undef, pos($$str_ref) - length($func)); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 304 | $node = [$func, pos($$str_ref), undef]; | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 304 | ▶ | if ($$str_ref =~ m{ \G \( ([+=~-]?) }gcx) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 198 | $self->{'_end_tag'} = qr{\s*([+=~-]?)\)}; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 198 | $pre_chomp = $1; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 106 | $self->{'_end_tag'} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 106 | $pre_chomp = ''; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | ### take care of chomping (this is an extention to velocity | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 304 | ▶ | $pre_chomp ||= $self->{'PRE_CHOMP'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$pre_chomp ||= $self->{"PRE_CHOMP"}
MC/DC100%2/2
$pre_chomp ||= $self->{"PRE_CHOMP"}
$pre_chomp
$self->{"PRE_CHOMP"}
Truth table100%3/3
A ||= B
A= $pre_chompB= $self->{"PRE_CHOMP"}
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 304 | ▶ | $pre_chomp =~ y/-=~+/1230/ if $pre_chomp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 304 | ▶ | if ($pre_chomp && $pointer->[-1] && ! ref $pointer->[-1]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$pre_chomp and $pointer->[-1] and not ref $pointer->[-1]
$pre_chomp and $pointer->[-1]
MC/DC100%3/3
$pre_chomp and $pointer->[-1] and not ref $pointer->[-1]
$pre_chomp
$pointer->[-1]
not ref $pointer->[-1]
Truth table100%4/4
A and B and not(C)
A= $pre_chompB= $pointer->[-1]C= not ref $pointer->[-1]
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 14 | ▶ | if ($pre_chomp == 1) { $pointer->[-1] =~ s{ (?:\n|^) [^\S\n]* \z }{}x } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | elsif ($pre_chomp == 2) { $pointer->[-1] =~ s{ (\s+) \z }{ }x } | |||||||||||||||||||||||||||||||||||||||||
| 191 | 12 | elsif ($pre_chomp == 3) { $pointer->[-1] =~ s{ (\s+) \z }{}x } | |||||||||||||||||||||||||||||||||||||||||
| 192 | 14 | ▶ | splice(@$pointer, -1, 1, ()) if ! length $pointer->[-1]; # remove the node if it is zero length | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 304 | push @$pointer, $node; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 316 | $$str_ref =~ m{ \G \s+ }gcx; | |||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | ### parse remaining tag details | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 316 | ▶ | if ($func ne 'END') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 236 | $node->[3] = eval { $dirs->{$func}->[0]->($self, $str_ref, $node) }; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 236 | ▶ | if (my $err = $@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 2 | ▶ | $err->node($node) if UNIVERSAL::can($err, 'node') && ! $err->node; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
UNIVERSAL::can($err, "node") and not $err->node
MC/DC0%0/2
UNIVERSAL::can($err, "node") and not $err->node
UNIVERSAL::can($err, "node")
not $err->node
Truth table33%1/3
A and not(B)
A= UNIVERSAL::can($err, "node")B= not $err->node
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 2 | die $err; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 234 | $node->[2] = pos $$str_ref; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | ### handle ending tags - or continuation blocks | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 314 | ▶ | if ($func eq 'END' || $dirs->{$func}->[4]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$func eq "END" or $dirs->{$func}[4]
MC/DC100%2/2
$func eq "END" or $dirs->{$func}[4]
$func eq "END"
$dirs->{$func}[4]
Truth table100%3/3
A or B
A= $func eq "END"B= $dirs->{$func}[4]
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 96 | ▶ | if (! @state) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | print Data::Dumper::Dumper(\@tree); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $self->throw('parse', "Found an $func tag while not in a block", $node, pos($$str_ref)); | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 96 | my $parent_node = pop @state; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | ### handle continuation blocks such as elsif, else, catch etc | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 96 | ▶ | if ($dirs->{$func}->[4]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 16 | pop @$pointer; # we will store the node in the parent instead | |||||||||||||||||||||||||||||||||||||||||
| 221 | 16 | $parent_node->[5] = $node; | |||||||||||||||||||||||||||||||||||||||||
| 222 | 16 | my $parent_type = $parent_node->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 16 | ▶ | if (! $dirs->{$func}->[4]->{$parent_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $self->throw('parse', "Found unmatched nested block", $node, pos($$str_ref)); | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | ### restore the pointer up one level (because we hit the end of a block) | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 96 | ▶ | $pointer = (! @state) ? \@tree : $state[-1]->[4]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | ### normal end block | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 96 | ▶ | if (! $dirs->{$func}->[4]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 80 | ▶ | if ($parent_node->[0] eq 'BLOCK') { # move BLOCKS to front | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 14 | ▶ | if (defined($parent_node->[3]) && @in_view) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $parent_node->[3] and @in_view
MC/DC0%0/2
defined $parent_node->[3] and @in_view
defined $parent_node->[3]
@in_view
Truth table33%1/3
A and B
A= defined $parent_node->[3]B= @in_view
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | push @{ $in_view[-1] }, $parent_node; | |||||||||||||||||||||||||||||||||||||||||
| 236 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 237 | 14 | push @blocks, $parent_node; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 14 | ▶ | if ($pointer->[-1] && ! $pointer->[-1]->[6]) { # capturing doesn't remove the var | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$pointer->[-1] and not $pointer->[-1][6]
MC/DC50%1/2
$pointer->[-1] and not $pointer->[-1][6]
$pointer->[-1]
not $pointer->[-1][6]
Truth table66%2/3
A and not(B)
A= $pointer->[-1]B= not $pointer->[-1][6]
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 4 | splice(@$pointer, -1, 1, ()); | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | } elsif ($parent_node->[0] eq 'VIEW') { | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $ref = { map {($_->[3] => $_->[4])} @{ pop @in_view }}; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | unshift @{ $parent_node->[3] }, $ref; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } elsif ($dirs->{$parent_node->[0]}->[5]) { # allow no_interp to turn on and off | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $self->{'_no_interp'}--; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | ### continuation block - such as an elsif | ||||||||||||||||||||||||||||||||||||||||||
| 251 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 16 | push @state, $node; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 16 | ▶ | $pointer = $node->[4] ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->[4] ||= []
MC/DC0%0/1
$node->[4] ||= []
$node->[4]
Truth table50%1/2
A
A= $node->[4]
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 96 | $node->[2] = pos $$str_ref; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | ### handle block directives | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } elsif ($dirs->{$func}->[2]) { | ||||||||||||||||||||||||||||||||||||||||||
| 259 | 64 | push @state, $node; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 64 | ▶ | $pointer = $node->[4] ||= []; # allow future parsed nodes before END tag to end up in current node | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$node->[4] ||= []
MC/DC0%0/1
$node->[4] ||= []
$node->[4]
Truth table50%1/2
A
A= $node->[4]
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 64 | ▶ | push @in_view, [] if $func eq 'VIEW'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 64 | ▶ | $self->{'_no_interp'}++ if $dirs->{$node->[0]}->[5] # allow no_interp to turn on and off | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | } elsif ($func eq 'META') { | ||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | unshift @meta, @{ $node->[3] }; # first defined win | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $node->[3] = undef; # only let these be defined once - at the front of the tree | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | ### look for the closing tag | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 314 | ▶ | if ($$str_ref =~ m{ \G $self->{'_end_tag'} }gcxs) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 300 | ▶ | $post_chomp = $1 || $self->{'POST_CHOMP'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$1 || $self->{'POST_CHOMP'}
MC/DC100%2/2
$1 || $self->{'POST_CHOMP'}
$1
$self->{'POST_CHOMP'}
Truth table100%3/3
A || B
A= $1B= $self->{'POST_CHOMP'}
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 300 | ▶ | $post_chomp =~ y/-=~+/1230/ if $post_chomp; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 300 | $continue = 0; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 300 | $post_op = 0; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 300 | ▶ | if ($node->[6] && $node->[0] eq 'MACRO') { # allow for MACRO's without a BLOCK | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$node->[6] and $node->[0] eq "MACRO"
MC/DC50%1/2
$node->[6] and $node->[0] eq "MACRO"
$node->[6]
$node->[0] eq "MACRO"
Truth table66%2/3
A and B
A= $node->[6]B= $node->[0] eq "MACRO"
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 16 | $capture = $node; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 16 | $macro_block = 1; | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 300 | next; | |||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | ### setup capturing | ||||||||||||||||||||||||||||||||||||||||||
| 284 | } elsif ($node->[6]) { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 12 | $capture = $node; | |||||||||||||||||||||||||||||||||||||||||
| 286 | 12 | next; | |||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | ### no closing tag | ||||||||||||||||||||||||||||||||||||||||||
| 289 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 2 | $self->throw('parse', "Not sure how to handle tag", $node, pos($$str_ref)); | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | ### cleanup the tree | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 260 | ▶ | unshift(@tree, @blocks) if @blocks; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 260 | ▶ | unshift(@tree, ['META', 1, 1, \@meta]) if @meta; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 260 | ▶ | $self->throw('parse', "Missing end tag", $state[-1], pos($$str_ref)) if @state > 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | ### pull off the last text portion - if any | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 260 | ▶ | if (pos($$str_ref) != length($$str_ref)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 80 | my $text = substr $$str_ref, pos($$str_ref); | |||||||||||||||||||||||||||||||||||||||||
| 302 | 80 | ▶ | if (! $post_chomp) { } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 2 | elsif ($post_chomp == 1) { $text =~ s{ ^ [^\S\n]* \n }{}x } | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | elsif ($post_chomp == 2) { $text =~ s{ ^ \s+ }{ }x } | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | elsif ($post_chomp == 3) { $text =~ s{ ^ \s+ }{}x } | |||||||||||||||||||||||||||||||||||||||||
| 306 | 80 | ▶ | push @$pointer, $text if length $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 260 | return \@tree; | |||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 200 | ▶ | sub merge { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 200 | my ($self, $in, $swap, $out) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 200 | ▶ | local $self->{'SYNTAX'} = $self->{'SYNTAX'} || 'velocity'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'SYNTAX'} || 'velocity'
MC/DC0%0/1
$self->{'SYNTAX'} || 'velocity'
$self->{'SYNTAX'}
Truth table50%1/2
A
A= $self->{'SYNTAX'}
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 200 | return $self->process_simple($in, $swap, $out); | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | ###----------------------------------------------------------------### | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | __END__ | ||||||||||||||||||||||||||||||||||||||||||