| 1 | # -*- mode: perl; coding: utf-8 -*- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package YATT::LRXML::Node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Media か? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # To cooperate with JSON easily, Nodes should not rely on OO style. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use YATT::Util::Symbol; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use YATT::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | our (@EXPORT_OK, @EXPORT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | @EXPORT_OK = qw(stringify_node | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | stringify_attlist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | create_node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | create_node_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | copy_node_renamed_as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | create_attlist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | node_size | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | node_children | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | node_type_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | node_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | node_nsname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | node_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | node_headings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | node_set_nlines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | node_user_data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | node_user_data_by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | node_attribute_format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | is_attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | is_primary_attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | is_bare_attribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | is_quoted_by_element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | is_empty_element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | quoted_by_element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | copy_array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | EMPTY_ELEMENT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 7 | @EXPORT = @EXPORT_OK; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | ▶ | sub exports { @EXPORT_OK } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exports: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 7 | ▶ | our @NODE_MEMBERS; BEGIN {@NODE_MEMBERS = qw(TYPE FLAG NLINES USER_SLOT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | RAW_NAME BODY)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 7 | ▶ | use YATT::Util::Enum -prefix => '_', @NODE_MEMBERS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 7 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 7 | foreach my $name (@NODE_MEMBERS) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 42 | my $offset = MY->can("_$name")->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 42 | my $func = "node_".lc($name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 42 | ▶ | *{globref(MY, $func)} = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1669 | shift->[$offset] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 42 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 42 | push @EXPORT_OK, $func; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 42 | push @EXPORT, $func; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 7 | our @NODE_TYPES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 7 | our %NODE_TYPES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 7 | our @NODE_FORMAT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 7 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 7 | my @desc = ([text => '%s'] # May not be used. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | , [comment => '<!--#%2$s' . '%1$s-->'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | , [decl_comment => '--%1$s--'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | , [pi => '<?%2$s' . '%1$s?>' ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | , [entity => '%3$s'.'%2$s'.'%1$s;', ['&', '%']] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | , [root => \&stringify_root] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | , [element => \&stringify_element] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | , [attribute => \&stringify_attribute] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | , [declarator => \&stringify_declarator] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | , [html => \&stringify_element] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | , [unknown => \&stringify_unknown] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 7 | $NODE_TYPES{$_->[0]} = keys %NODE_TYPES for @desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 7 | @NODE_TYPES = map {$_->[0]} @desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 7 | ▶ | @NODE_FORMAT = map {ref $_->[1] eq 'CODE' ? $_->[1] : [@$_[1..$#$_]]} @desc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 7 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | my @type_enum = map {uc($_) . '_TYPE'} @NODE_TYPES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | require YATT::Util::Enum; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 7 | import YATT::Util::Enum @type_enum; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 7 | push @EXPORT_OK, @type_enum; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 7 | push @EXPORT, @type_enum; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # ATTRIBUTE の FLAG の意味は、↓これと "ed_by_element が決める。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 7 | ▶ | our @QUOTE_CHAR; BEGIN {@QUOTE_CHAR = ("", '\'', "\"", [qw([ ])])} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # XXX: ↓ 役割は減る予定。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 7 | ▶ | our @QUOTE_TYPES; BEGIN {@QUOTE_TYPES = (1, 2, 0)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 8 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 8 | my $pack = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 8 | bless $pack->create_node(@_), $pack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # $pack->create_node($typeName, $nodeName, $nodeBody) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # $pack->create_node([$typeName, $flag], [@nodePath], @nodeBody) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1491 | ▶ | sub sum_node_nlines { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sum_node_nlines: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 1491 | my $nlines = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 1491 | foreach my $item (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 393 | ▶ | unless (ref $item) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 171 | $nlines += $item =~ tr,\n,,; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } elsif (defined (my $sub = $item->[_NLINES])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 222 | $nlines += $sub; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $nlines += sum_node_nlines(node_children($item)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1491 | $nlines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1353 | ▶ | sub create_node { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_node: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1353 | my ($pack, $type, $name) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 1353 | ▶ | my ($typename, $flag) = ref $type ? @$type : $type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1353 | ▶ | $flag = 0 unless defined $flag; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1353 | my $typeid = $NODE_TYPES{$typename}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 1353 | ▶ | die "Unknown type: $typename" unless defined $typeid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # DEPEND_ALIGNMENT: SET_NLINES: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1353 | [$typeid, $flag, sum_node_nlines(@_), undef, $name, @_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 138 | ▶ | sub create_node_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_node_from: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 138 | my ($pack, $orig, $name) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 138 | my ($typeid, $flag) = @{$orig}[_TYPE, _FLAG]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 138 | ▶ | $name = copy_array($$orig[_RAW_NAME]) unless defined $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # DEPEND_ALIGNMENT: SET_NLINES: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 138 | [$typeid, $flag, sum_node_nlines(@_), undef, $name, @_] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 5 | ▶ | sub copy_node_renamed_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy_node_renamed_as: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 5 | my ($pack, $name, $orig) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 5 | create_node_from($pack, $orig, $name, @{$orig}[_BODY .. $#$orig]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 114 | ▶ | sub node_headings { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_headings: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 114 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 114 | ([$NODE_TYPES[$$node[_TYPE]], $$node[_FLAG]] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | , $$node[_RAW_NAME]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | sub node_body_starting () { _BODY } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 526 | ▶ | sub node_size { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_size: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 526 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 526 | @$node - _BODY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 240 | ▶ | sub node_children { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_children: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 240 | my $node = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 240 | @{$node}[_BODY .. $#$node]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 630 | ▶ | sub node_type_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_type_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 630 | $NODE_TYPES[shift->[_TYPE]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 388 | ▶ | sub is_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_attribute: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 388 | $_[0]->[_TYPE] == ATTRIBUTE_TYPE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 186 | ▶ | sub is_primary_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_primary_attribute: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 186 | ▶ | $_[0]->[_TYPE] == ATTRIBUTE_TYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$_[0][0] == 7 && (!defined($_[0][1]) || $_[0][1] < @YATT::LRXML::Node::QUOTE_CHAR)
not defined $_[0][1] or $_[0][1] < @YATT::LRXML::Node::QUOTE_CHAR
MC/DC100%3/3
$_[0][0] == 7 && (!defined($_[0][1]) || $_[0][1] < @YATT::LRXML::Node::QUOTE_CHAR)
$_[0][0] == 7
not defined $_[0][1]
$_[0][1] < @YATT::LRXML::Node::QUOTE_CHAR
Truth table100%4/4
A && not(B) or C
A= $_[0][0] == 7B= not defined $_[0][1]C= $_[0][1] < @YATT::LRXML::Node::QUOTE_CHAR
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | && (! defined $_[0]->[_FLAG] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | || $_[0]->[_FLAG] < @QUOTE_CHAR); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 6 | ▶ | sub is_bare_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_bare_attribute: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 6 | ▶ | $_[0]->[_TYPE] == ATTRIBUTE_TYPE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[0][0] == 7 and defined $_[0][1]
MC/DC50%1/2
$_[0][0] == 7 and defined $_[0][1]
$_[0][0] == 7
defined $_[0][1]
Truth table66%2/3
A and B
A= $_[0][0] == 7B= defined $_[0][1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | && defined $_[0]->[_FLAG] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | && $_[0]->[_FLAG] == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 138 | ▶ | sub stringify_node { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_node: called CC=7 SCAR=20.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 138 | my ($node) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 138 | my $type = $node->[_TYPE]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 138 | ▶ | if (not defined $type or $type eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $type or $type eq ""
MC/DC0%0/2
not defined $type or $type eq ""
not defined $type
$type eq ""
Truth table33%1/3
not(A) or B
A= not defined $typeB= $type eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | die "Invalid node object: ".YATT::Util::terse_dump($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 138 | ▶ | if (@NODE_FORMAT <= $type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | die "Unknown type: $type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 138 | ▶ | if (ref(my $desc = $NODE_FORMAT[$type]) eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 99 | $desc->($node, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 39 | my ($fmt, $prefix, $suffix) = @$desc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 7 | ▶ | use YATT::Util::redundant_sprintf; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 39 | ▶ | sprintf($fmt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | , stringify_each_by($node) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | , node_nsname($node, '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | , defined $prefix ? $prefix->[$node->[_FLAG]] : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | , defined $suffix ? $suffix->[$node->[_FLAG]] : ''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | # node_path は name スロットを返す。wantarray 対応。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 1854 | ▶ | sub node_path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_path: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 1854 | my ($node, $first, $sep, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 1854 | my $raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 1854 | ▶ | unless (defined ($raw = $node->[_RAW_NAME])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 42 | ▶ | defined $default ? $default : return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } elsif (not ref $raw) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # undef かつ wantarray は只の return に分離した方が良いかも? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 631 | $raw; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 1181 | ▶ | my @names = @$raw[($first || 0) .. $#$raw]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$first || 0
MC/DC100%1/1
$first || 0
$first
Truth table100%2/2
A
A= $first
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | wantarray ? @names : join(($sep || ":") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 1181 | ▶ | , map {defined $_ ? $_ : ''} @names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%2/2
$sep || ':'
MC/DC100%1/1
$sep || ':'
$sep
Truth table100%2/2
A
A= $sep
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # node_nsname は namespace 込みのパスを返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 99 | ▶ | sub node_nsname { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_nsname: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 99 | my ($node, $default, $sep) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 99 | scalar node_path($node, 0, $sep, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # node_name は namespace を除いたパスを返す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | # yatt:else なら else が返る。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 561 | ▶ | sub node_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 561 | my ($node, $default, $sep) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 561 | node_path($node, 1, $sep, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 811 | ▶ | sub node_set_nlines { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_set_nlines: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 811 | my ($node, $nlines) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 811 | $node->[_NLINES] = $nlines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 811 | $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub node_user_data { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_user_data: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my ($node) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $node->[_USER_SLOT] = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $node->[_USER_SLOT]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub node_user_data_by { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_user_data_by: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my ($node) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | my $slot = $node->[_USER_SLOT] ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$node->[3] ||= do {
() = splice(@_, 0, 2);
$obj->$meth(@_)
}
MC/DC0%0/2
$node->[3] ||= do {
() = splice(@_, 0, 2);
$obj->$meth(@_)
}
$node->[3]
do {
() = splice(@_, 0, 2);
$obj->$meth(@_)
}
Truth table0%0/3
A ||= B
A= $node->[3]B= do {
() = splice(@_, 0, 2);
$obj->$meth(@_)
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | my ($obj, $meth) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $obj->$meth(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | wantarray ? @$slot : $slot; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 21 | ▶ | sub stringify_element { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_element: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 21 | my ($elem) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 21 | stringify_as_tag($elem, node_nsname($elem), $elem->[_FLAG]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 6 | ▶ | sub stringify_declarator { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_declarator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 6 | my ($elem, $strip_ns) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | # XXX: 本物にせよ。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 6 | my $tag = node_nsname($elem); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 6 | my $attlist = stringify_each_by($elem, ' ', ' ', '', _BODY); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 6 | "<!$tag$attlist>" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 10 | ▶ | sub stringify_root { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_root: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 10 | my ($elem) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 10 | stringify_each_by($elem | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | , '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | , '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | , '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | , _BODY); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | sub stringify_unknown { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_unknown: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | die 'unknown'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 27 | ▶ | sub stringify_as_tag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_as_tag: called CC=7 SCAR=19.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 27 | my ($node, $name, $is_ee) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 27 | my $bodystart = node_beginning_of_body($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 27 | my $tag = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 27 | ▶ | if (defined $name && is_attribute($node)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $name and is_attribute($node)
MC/DC50%1/2
defined $name and is_attribute($node)
defined $name
is_attribute($node)
Truth table66%2/3
A and B
A= defined $nameB= is_attribute($node)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 6 | ":$name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 21 | $name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 27 | my $attlist = stringify_attlist($node, $bodystart); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 27 | ▶ | if ($is_ee) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 14 | ▶ | stringify_each_by($node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | , $tag ? qq(<$tag$attlist />) : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | , '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | , '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | , $bodystart); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 13 | ▶ | stringify_each_by($node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | , $tag ? qq(<$tag$attlist>) : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | , '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | , $tag ? qq(</$tag>) : '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | , $bodystart); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 27 | ▶ | sub stringify_attlist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_attlist: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 27 | my ($node) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 27 | ▶ | my $bodystart = shift || node_beginning_of_body($node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
shift() || node_beginning_of_body($node)
MC/DC50%1/2
shift() || node_beginning_of_body($node)
shift()
node_beginning_of_body($node)
Truth table66%2/3
A || B
A= shift()B= node_beginning_of_body($node)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # print "[[for @{[$node->get_name]}; <", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 27 | ▶ | return '' if defined $bodystart and _BODY == $bodystart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
defined $bodystart and 5 == $bodystart or not defined $bodystart and $node->$#* < 5
defined $bodystart and 5 == $bodystart
not defined $bodystart and $node->$#* < 5
MC/DC75%3/4
defined $bodystart and 5 == $bodystart or not defined $bodystart and $node->$#* < 5
defined $bodystart
5 == $bodystart
not defined $bodystart
$node->$#* < 5
Truth table57%4/7
A and B or not(C) and D
A= defined $bodystartB= 5 == $bodystartC= not defined $bodystartD= $node->$#* < 5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | or not defined $bodystart and $#$node < _BODY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 13 | ▶ | stringify_each_by($node, ' ', ' ', '', _BODY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | , (defined $bodystart ? ($bodystart - 1) : ())) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 151 | ▶ | sub stringify_each_by { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_each_by: called CC=12 SCAR=25.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 151 | my ($node, $open, $sep, $close) = splice @_, 0, 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 151 | ▶ | $open ||= ''; $sep ||= ''; $close ||= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$open ||= ""
$sep ||= ""
$close ||= ""
MC/DC100%1/1
$open ||= ""
$open
MC/DC100%1/1
$sep ||= ""
$sep
MC/DC100%1/1
$close ||= ""
$close
Truth table100%2/2
A
A= $open
Truth table100%2/2
A
A= $sep
Truth table100%2/2
A
A= $close
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 151 | ▶ | my $from = @_ ? shift : _BODY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 151 | ▶ | my $to = @_ ? shift : $#$node; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 151 | my $result = $open; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 151 | ▶ | if (defined $from and defined $to) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $from and defined $to
MC/DC50%1/2
defined $from and defined $to
defined $from
defined $to
Truth table66%2/3
A and B
A= defined $fromB= defined $to
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | $result .= join $sep, map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 210 | ▶ | unless (defined $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | '' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } elsif (ref $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 94 | my $s = stringify_node($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 94 | ▶ | unless (defined $s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | require YATT::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | die "Can't stringify node: ". YATT::Util::terse_dump($_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 94 | $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 116 | $_ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 141 | } @{$node}[$from .. $to]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 151 | ▶ | $result .= $close if defined $close; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 151 | $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 37 | ▶ | sub node_beginning_of_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_beginning_of_body: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 37 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 50 | ▶ | lsearch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 50 | ▶ | not ref $_ or not is_primary_attribute($_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
ref $_ && is_primary_attribute($_)
MC/DC100%2/2
ref $_ && is_primary_attribute($_)
ref $_
is_primary_attribute($_)
Truth table100%3/3
A && B
A= ref $_B= is_primary_attribute($_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 37 | } $node, _BODY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | #---------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 447 | ▶ | sub create_attlist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_attlist: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 447 | my ($parser) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 447 | my @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 447 | ▶ | while (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 514 | my ($sp, $name, $eq, @values) = splice @_, 0, 6; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 514 | ▶ | my $found = lsearch {defined} \@values; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 514 | my ($subtype, $attname, @attbody) = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 514 | ▶ | unless (defined $found) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | (undef, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | ▶ | } elsif (not defined $name and $found == 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
not defined $name and $found == 2 and $values[$found] =~ /^[\w\:\-\.]+$/
not defined $name and $found == 2
MC/DC100%3/3
not defined $name and $found == 2 and $values[$found] =~ /^[\w\:\-\.]+$/
not defined $name
$found == 2
$values[$found] =~ /^[\w\:\-\.]+$/
Truth table100%4/4
not(A) and B and C
A= not defined $nameB= $found == 2C= $values[$found] =~ /^[\w\:\-\.]+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | and $values[$found] =~ /^[\w\:\-\.]+$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # has single bareword. use it as name and keep value undef. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 275 | (undef, $values[$found]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # parse_entities can return (). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 239 | ($QUOTE_TYPES[$found], $name => | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | $parser->parse_entities($values[$found])); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 514 | ▶ | my @typed; @typed = split /:/, $attname if defined $attname; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # DEPEND_ALIGNMENT: SET_NLINES: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 514 | ▶ | push @result, [ATTRIBUTE_TYPE, $subtype, 0, undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | , @typed > 1 ? \@typed : $attname | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | , @attbody]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 447 | @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 62 | ▶ | sub stringify_attribute { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_attribute: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 62 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 62 | ▶ | if (defined $$node[_FLAG] && $$node[_FLAG] >= @QUOTE_CHAR) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $node->[1] and $node->[1] >= @YATT::LRXML::Node::QUOTE_CHAR
MC/DC100%2/2
defined $node->[1] and $node->[1] >= @YATT::LRXML::Node::QUOTE_CHAR
defined $node->[1]
$node->[1] >= @YATT::LRXML::Node::QUOTE_CHAR
Truth table100%3/3
A and B
A= defined $node->[1]B= $node->[1] >= @YATT::LRXML::Node::QUOTE_CHAR
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 6 | stringify_as_tag($node | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | , node_nsname($node) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | , $$node[_FLAG] - MY->quoted_by_element(0)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 56 | my (@stringify_as) = attribute_stringify_as($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 56 | ▶ | if (@stringify_as == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $stringify_as[0] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 56 | stringify_each_by($node, @stringify_as, _BODY); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 22 | ▶ | sub node_attribute_format { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_attribute_format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 22 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 22 | my ($open, $sep, $close) = attribute_stringify_as($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 22 | ($open, $close); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 78 | ▶ | sub attribute_stringify_as { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
attribute_stringify_as: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 78 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 78 | ▶ | unless (defined $$node[_BODY]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 10 | (join_or_string($$node[_RAW_NAME]), '', ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 68 | ▶ | my $Q = $$node[_FLAG] ? @QUOTE_CHAR[$$node[_FLAG]] : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 68 | ▶ | my ($sep, $opn, $clo) = ref $Q ? (' ', @$Q) : ('', $Q, $Q); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 68 | my $prefix = join_or_empty(join_or_string($$node[_RAW_NAME]), '=').$opn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 68 | ($prefix, $sep, $clo); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 78 | ▶ | sub join_or_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
join_or_string: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 78 | ▶ | ref $_[0] ? join(":", @{$_[0]}) : $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 68 | ▶ | sub join_or_empty { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
join_or_empty: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 68 | my $str = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 68 | foreach my $item (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 131 | ▶ | return '' unless defined $item; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 126 | $str .= $item; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 63 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 248 | ▶ | sub EMPTY_ELEMENT () { 1 + @QUOTE_CHAR } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EMPTY_ELEMENT: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 28 | ▶ | sub quoted_by_element { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quoted_by_element: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 28 | my ($pack, $is_ee) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 28 | ▶ | if ($is_ee) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 16 | EMPTY_ELEMENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 12 | scalar @QUOTE_CHAR; # 3 for now. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 115 | ▶ | sub is_quoted_by_element { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_quoted_by_element: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 115 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 115 | ▶ | defined $node->[_FLAG] && $node->[_FLAG] >= @QUOTE_CHAR; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 124 | ▶ | sub is_empty_element { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_empty_element: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 124 | my ($node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 124 | ▶ | defined $node->[_FLAG] && $node->[_FLAG] == EMPTY_ELEMENT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||