| 1 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Parsing and Building. part の型を確定させる所まで請け負うことに。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package YATT::Lite::LRXML; sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 77 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 77 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 77 | ▶ | use 5.010; no if $] >= 5.017011, warnings => "experimental"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # 現在宣言 parse 中の template (path キー)。declare_import の循環検出用。GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 77 | our %DECL_PARSING; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 77 | ▶ | use base qw(YATT::Lite::VarMaker); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 77 | ▶ | use fields qw/_re_decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | _re_body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | _re_entopn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | _re_att | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | _re_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | _re_evar _ch_etext | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | _re_eparen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | _re_eopen _re_eclose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | _template | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | _chunklist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | _startln _endln | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | _startpos _curpos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | vfs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | default_part | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | base scheme path encoding debug | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | all | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | special_entities | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | body_argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | body_argument_type | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | _subroutes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | _rootroute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | match_argsroute_first | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | _original_entpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | allow_bare_entity_in_decl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 77 | /; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 77 | ▶ | use YATT::Lite::Core qw(Part Widget Page Action Data Entity Template ArgMacro Import); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 77 | ▶ | use YATT::Lite::VarTypes; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 77 | ▶ | use YATT::Lite::Constants; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 77 | ▶ | use YATT::Lite::Util qw(numLines default untaint_unless_tainted lexpand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 77 | ▶ | use YATT::Lite::RegexpNames; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 77 | require Scalar::Util; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 77 | require Encode; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 77 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 547 | ▶ | sub default_public_part {'page'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_public_part: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 37 | ▶ | sub default_private_part {'widget'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_private_part: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 23 | ▶ | sub default_body_argument { 'body' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_body_argument: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 584 | ▶ | sub default_part_for { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_part_for: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 584 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | $tmpl->{public} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 584 | ▶ | ? $self->default_public_part | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | : $self->default_private_part; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1286 | ▶ | sub after_new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_new: called CC=16 SCAR=29.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 1286 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1286 | $self->SUPER::after_new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1286 | ▶ | Scalar::Util::weaken($self->{vfs}) if $self->{vfs}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1286 | ▶ | $self->{body_argument} //= $self->default_body_argument; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"body_argument"} //= $self->default_body_argument
MC/DC0%0/2
$self->{"body_argument"} //= $self->default_body_argument
$self->{"body_argument"}
$self->default_body_argument
Truth table66%2/3
A //= B
A= $self->{"body_argument"}B= $self->default_body_argument
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1286 | ▶ | $self->{namespace} ||= [qw(yatt perl)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"namespace"} ||= ["yatt", "perl"]
MC/DC100%1/1
$self->{"namespace"} ||= ["yatt", "perl"]
$self->{"namespace"}
Truth table100%2/2
A
A= $self->{"namespace"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1286 | my $nspat = qr!@{[join "|", $self->namespace]}!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1286 | ▶ | $self->{_re_name} ||= $self->re_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_re_name"} ||= $self->re_name
MC/DC0%0/2
$self->{"_re_name"} ||= $self->re_name
$self->{"_re_name"}
$self->re_name
Truth table33%1/3
A ||= B
A= $self->{"_re_name"}B= $self->re_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1286 | ▶ | my $decl_prefix = $] >= 5.030 ? q{(?<=\A|\n)} : ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1286 | ▶ | $self->{_re_decl} ||= qr{$decl_prefix<!(?<declname>$nspat(?::\w++)+)\b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_decl"} ||= qr/$decl_prefix<!(?<declname>$nspat(?::\w++)+)\b
|(?:<!--\#(?<comment>$nspat(?::\w++)*))\b/sx
MC/DC0%0/1
$self->{"_re_decl"} ||= qr/$decl_prefix<!(?<declname>$nspat(?::\w++)+)\b
|(?:<!--\#(?<comment>$nspat(?::\w++)*))\b/sx
$self->{"_re_decl"}
Truth table50%1/2
A
A= $self->{"_re_decl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |(?:<!--\#(?<comment>$nspat(?::\w++)*))\b}xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1286 | my $entOpen = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # qq なので注意 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1286 | my $entbase = qq{(?<entity>$nspat)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1286 | $entbase .= sprintf(q{(?=%s)}, join "|" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | , ':' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | , sprintf(q{(?<lcmsg>%s)}, join "|" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | , q{(?<msgopn>(?:\#\w+)?\[{2,})} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | , q{(?<msgsep>\|{2,})} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | , q{(?<msgclo>\]{2,})})); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1286 | my @entPat = $entbase; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # special の場合は entgroup を呼びたいので、 先に open ( を削っておく。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | push @entPat, sprintf q{(?<special>(?:%s))\(} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | , join "|", lexpand($self->{special_entities}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1286 | ▶ | if $self->{special_entities}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1286 | sprintf q{&(?:%s)}, join "|", @entPat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1286 | ▶ | my $entCloseInAtt = $self->{allow_bare_entity_in_decl} ? "" : ";"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | $self->{_re_att} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1286 | ▶ | ||= qr{(?<ws>\s++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_att"} ||= qr#(?<ws>\s++)
| (?<comment>--+.*?--+)
| (?<macro>%(?:[\w\:\.]+(?:[\w:\.\-=\[\]\{\}\(,\)]+)?);)
|
(?:'(?<sq>[^\']*+)'
|"(?<dq>[^\"]*+)"
|(?<nest>\[) | (?<nestclo>\])
|$entOpen
|(?<bare>[^\s\'\"<>\[\]/=$entCloseInAtt]++)
)
(?<equal>\s*=\s*+)?+
#sx
MC/DC0%0/1
$self->{"_re_att"} ||= qr#(?<ws>\s++)
| (?<comment>--+.*?--+)
| (?<macro>%(?:[\w\:\.]+(?:[\w:\.\-=\[\]\{\}\(,\)]+)?);)
|
(?:'(?<sq>[^\']*+)'
|"(?<dq>[^\"]*+)"
|(?<nest>\[) | (?<nestclo>\])
|$entOpen
|(?<bare>[^\s\'\"<>\[\]/=$entCloseInAtt]++)
)
(?<equal>\s*=\s*+)?+
#sx
$self->{"_re_att"}
Truth table50%1/2
A
A= $self->{"_re_att"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | | (?<comment>--+.*?--+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | | (?<macro>%(?:[\w\:\.]+(?:[\w:\.\-=\[\]\{\}\(,\)]+)?);) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | (?:'(?<sq>[^\']*+)' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |"(?<dq>[^\"]*+)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |(?<nest>\[) | (?<nestclo>\]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |$entOpen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |(?<bare>[^\s\'\"<>\[\]/=$entCloseInAtt]++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | (?<equal>\s*=\s*+)?+ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | }xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1286 | ▶ | $self->{_re_body} ||= qr{$entOpen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_body"} ||= qr"$entOpen
|<(?:(?<clo>/?)(?<opt>:?)(?<elem>$nspat(?::\w++)+)
|\?(?<pi>$nspat(?::\w++)*))\b
"sx
MC/DC0%0/1
$self->{"_re_body"} ||= qr"$entOpen
|<(?:(?<clo>/?)(?<opt>:?)(?<elem>$nspat(?::\w++)+)
|\?(?<pi>$nspat(?::\w++)*))\b
"sx
$self->{"_re_body"}
Truth table50%1/2
A
A= $self->{"_re_body"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |<(?:(?<clo>/?)(?<opt>:?)(?<elem>$nspat(?::\w++)+) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |\?(?<pi>$nspat(?::\w++)*))\b | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | }xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # For entities. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1286 | $self->{_re_entopn} = qr{$entOpen}xs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1286 | ▶ | $self->{_re_eopen} ||= qr{(?<open> [\(\{\[])}xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_eopen"} ||= qr/(?<open> [\(\{\[])/sx
MC/DC0%0/1
$self->{"_re_eopen"} ||= qr/(?<open> [\(\{\[])/sx
$self->{"_re_eopen"}
Truth table50%1/2
A
A= $self->{"_re_eopen"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1286 | ▶ | $self->{_re_eclose} ||= qr{(?<close> [\)\}\]])}xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_eclose"} ||= qr/(?<close> [\)\}\]])/sx
MC/DC0%0/1
$self->{"_re_eclose"} ||= qr/(?<close> [\)\}\]])/sx
$self->{"_re_eclose"}
Truth table50%1/2
A
A= $self->{"_re_eclose"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1286 | ▶ | $self->{_re_evar} ||= qr{: (?<var>\w+)}xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_evar"} ||= qr/: (?<var>\w+)/sx
MC/DC0%0/1
$self->{"_re_evar"} ||= qr/: (?<var>\w+)/sx
$self->{"_re_evar"}
Truth table50%1/2
A
A= $self->{"_re_evar"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1286 | ▶ | $self->{_ch_etext} ||= qr{(?: [^\ \t\n,;:()\[\]{}])}xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_ch_etext"} ||= qr/(?: [^\ \t\n,;:()\[\]{}])/sx
MC/DC0%0/1
$self->{"_ch_etext"} ||= qr/(?: [^\ \t\n,;:()\[\]{}])/sx
$self->{"_ch_etext"}
Truth table50%1/2
A
A= $self->{"_ch_etext"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1286 | ▶ | $self->{_re_eparen} ||= qr{(\( (?<paren> (?: (?> [^()]+) | (?-2) )*) \) )}xs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"_re_eparen"} ||= qr/(\( (?<paren> (?: (?> [^()]+) | (?-2) )*) \) )/sx
MC/DC0%0/1
$self->{"_re_eparen"} ||= qr/(\( (?<paren> (?: (?> [^()]+) | (?-2) )*) \) )/sx
$self->{"_re_eparen"}
Truth table50%1/2
A
A= $self->{"_re_eparen"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 1286 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | use YATT::Lite::Types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 77 | ▶ | ([EntMatch => fields => [qw/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | lcmsg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | msgopn msgsep msgclo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | special | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | /] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | , [AttMatch => fields => [qw/ws comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | macro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | sq dq bare | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | nest nestclo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | equal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | /]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 77 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # Debugging aid. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # YATT::Lite::LRXML->load_from(string => '...template...') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub load_from { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_from: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my ($pack, $loadSpec, $tmplSpec, @moreLoadArgs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | my ($loadType, @loadArgs) = ref $loadSpec ? @$loadSpec : $loadSpec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | unless (defined $loadType) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | croak "Undefined source type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | my $sub = $pack->can("load_${loadType}_into") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | or croak "Unknown source type: $loadType"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my ($tmplFrom, @tmplArgs) = ref $tmplSpec ? @$tmplSpec : $tmplSpec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my Template $tmpl = $pack->Template->new(@tmplArgs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # デフォルトでは body もパースする. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # XXX: オプション名 all だと分かりにくい。公式にする前に、改名すべき。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $sub->($pack, $tmpl, $tmplFrom, all => 1, @loadArgs, @moreLoadArgs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 349 | ▶ | sub load_file_into { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_file_into: called CC=7 SCAR=20.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 349 | my ($pack, $tmpl, $fn) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 349 | ▶ | croak "Template argument is missing! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $tmpl and UNIVERSAL::isa($tmpl, $pack->Template)
MC/DC0%0/2
defined $tmpl and UNIVERSAL::isa($tmpl, $pack->Template)
defined $tmpl
UNIVERSAL::isa($tmpl, $pack->Template)
Truth table33%1/3
A and B
A= defined $tmplB= UNIVERSAL::isa($tmpl, $pack->Template)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | YATT::Lite::Parser->from_file(filename, templateObject)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | unless defined $tmpl and UNIVERSAL::isa($tmpl, $pack->Template); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 349 | ▶ | unless (defined $fn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | croak "filename is undef!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 349 | ▶ | my MY $self = ref $pack ? $pack->configure(@_) : $pack->new(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 349 | ▶ | open my $fh, '<', $fn or die "Can't open $fn: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 349 | ▶ | binmode $fh, ":encoding($$self{encoding})" if $$self{encoding}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 349 | $self->{path} = $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 349 | $self->{scheme} = 'file'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 349 | my $string = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 349 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 349 | untaint_unless_tainted($fn, scalar <$fh>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 349 | $self->load_string_into($tmpl, $string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 644 | ▶ | sub load_string_into { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_string_into: called CC=5 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 644 | (my $pack, my Template $tmpl) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 644 | $tmpl->reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 644 | ▶ | my MY $self = ref $pack ? $pack->configure(@_[1 .. $#_]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | : $pack->new(@_[1 .. $#_]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 644 | ▶ | unless (defined $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | croak "template string is undef!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 644 | $self->parse_decl($tmpl, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 609 | ▶ | $self->parse_body($tmpl) if $self->{all}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 608 | ▶ | wantarray ? ($tmpl, $self) : $tmpl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 604 | ▶ | sub parse_body { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_body: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 604 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 604 | ▶ | return if $tmpl->{_parse_ok}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 597 | $self->{_template} = $tmpl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 597 | $self->parse_widget($_) for $tmpl->list_parts($self->Widget); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 587 | $tmpl->{_parse_ok} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # parse_decllist_entities updates all decllists in given template. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # This method is for inspector and not used from normal code generation pass. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 4 | ▶ | sub parse_decllist_entities { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_decllist_entities: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 4 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 4 | foreach my Part $part ($tmpl->list_parts) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # $self->{startln} = $self->{endln} = $part->{bodyln}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # ($self->{startpos}, $self->{curpos}) = ($part->{startpos}) x 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 8 | ▶ | my $decllist = $part->{_decllist} or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 6 | foreach my $node (@$decllist) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 9 | ▶ | $node->[NODE_TYPE] == TYPE_ATT_TEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 3 | $self->{_endln} = $node->[NODE_LNO]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | my ($type, $dflag, $default) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | = $self->parse_type_dflag_default($node->[NODE_BODY]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 3 | ▶ | if (ref $node->[NODE_PATH]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | ▶ | $node->[NODE_BODY] = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | $type, $dflag, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | (defined $default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | ? lexpand($self->_parse_text_entities_at($node->[NODE_BODY_BEGIN], $default)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | : ())]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 22 | ▶ | sub posinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
posinfo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 22 | (my MY $self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 22 | ($self->{_startpos}, $self->{_curpos}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 2836 | ▶ | sub add_posinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_posinfo: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 2836 | (my MY $self, my ($len, $sync)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 2836 | $self->{_curpos} += $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 2836 | ▶ | $self->{_startpos} = $self->{_curpos} if $sync; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 2836 | $len; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | sub update_posinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
update_posinfo: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my ($sync) = splice @_, 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # $self->{_curpos} = $self->{total} - length $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | $self->{_startpos} = $self->{_curpos} if $sync; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 318 | ▶ | sub ensure_default_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ensure_default_part: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 318 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | my Part $part = $self->build( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $self->primary_ns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | , args => $self->default_part_for($tmpl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | , '', implicit => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | , startpos => $self->{_startpos}, bodypos => $self->{_startpos} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 318 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 318 | $self->add_part($tmpl, $part); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 318 | $part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 644 | ▶ | sub parse_decl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_decl: called CC=21 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 644 | (my MY $self, my Template $tmpl, my $str, my @config) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # local %+; # ← XXX: This causes massive test failure, but why?? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 644 | break_parser(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | # 宣言 parse 中フラグ。declare_import の循環検出に使う。GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # (path キーの registry も持つのは、循環相手の Template object が | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # cached_in の dict 代入前で、object 経由では検出できないケースがあるため) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 644 | local $tmpl->{_decl_parsing} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 644 | ▶ | local $DECL_PARSING{$tmpl->{path} // Scalar::Util::refaddr($tmpl)} = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$tmpl->{"path"} // builtin::refaddr($tmpl)
MC/DC0%0/2
$tmpl->{"path"} // builtin::refaddr($tmpl)
$tmpl->{"path"}
builtin::refaddr($tmpl)
Truth table66%2/3
A // B
A= $tmpl->{"path"}B= builtin::refaddr($tmpl)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 644 | $self->{_template} = $tmpl; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 644 | $self->configure(@config); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 644 | $tmpl->{string} = $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 644 | $tmpl->{utf8} = Encode::is_utf8($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # 宣言/コメントの位置記録。再 parse で重複しないようここで初期化する。GH-258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 644 | $tmpl->{_boundarylist} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 644 | $self->{_startln} = $self->{_endln} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 644 | ($self->{_startpos}, $self->{_curpos}, my $total) = (0, 0, length $str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 644 | my Part $part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 644 | ▶ | while ($str =~ s{^(.*?)($$self{_re_decl})}{}s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 771 | ▶ | if (not $part and (length $1 || $+{comment})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
not $part and length $1 || $+{"comment"}
length $1 or $+{"comment"}
MC/DC66%2/3
not $part and length $1 || $+{"comment"}
not $part
length $1
$+{"comment"}
Truth table75%3/4
not(A) and B or C
A= not $partB= length $1C= $+{"comment"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 159 | $part = $self->ensure_default_part($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 771 | ▶ | $self->add_text($part, $1) if length $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 771 | $self->{_curpos} = $total - length $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 771 | ▶ | if (my $comment_ns = $+{comment}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 22 | ▶ | unless ($str =~ s{^(.*?)-->(\r?\n)?}{}s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | die $self->synerror_at($self->{_startln}, q{Comment is not closed}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 22 | ▶ | my $nlines = numLines($1) + ($2 ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 22 | $self->{_curpos} += length $&; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # Yet another illegular. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # TYPE_COMMENT: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # - NODE_BODY is $nlines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # - NODE_ATTLIST is payload. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 22 | push @{$part->{_toks}}, do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 22 | my $node = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 22 | $node->[NODE_TYPE] = TYPE_COMMENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 22 | @{$node}[NODE_BEGIN, NODE_END] = $self->posinfo($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 22 | $node->[NODE_LNO] = $self->{_startln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 22 | $node->[NODE_PATH] = $comment_ns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 22 | $node->[NODE_BODY] = $nlines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 22 | $node->[NODE_ATTLIST] = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 22 | $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # 不変量: substr(string, startpos, endpos - startpos) はコメント全文。GH-258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 22 | push @{$tmpl->{_boundarylist}}, +{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | kind => 'comment', declkind => $comment_ns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | , startpos => $self->{_startpos}, endpos => $self->{_curpos} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 22 | , lineno => $self->{_startln}, nlines => $nlines | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 22 | $self->{_startln} = $self->{_endln} += $nlines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 22 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 749 | my $declkind = $+{declname}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 749 | my ($ns, $kind) = split /:/, $declkind, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # 宣言境界の先頭 pos/行。この時点の _startpos は宣言先頭を指しており、 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # part の startpos (build 経由) と同じ値になる。GH-258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 749 | my ($decl_startpos, $decl_startln) = ($self->{_startpos}, $self->{_startln}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 749 | ▶ | if (my $sub = $self->can("declare_$kind")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # yatt:args, base, action, argmacro... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # add_part を自分で呼びたい、又は add_part 自体を呼びたくないものは | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # declare_ で処理する. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # 最初に、ここまでの宣言で作られた part を finalize | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # (ただし、宣言抜きで作られた default widget の場合は何もしない) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 368 | ▶ | if ($part and not $part->{implicit}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$part and not $part->{"implicit"}
MC/DC100%2/2
$part and not $part->{"implicit"}
$part
not $part->{"implicit"}
Truth table100%3/3
A and not(B)
A= $partB= not $part->{"implicit"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 29 | $self->finalize_part($part); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | # 戻り値が undef なら、同じ $part を用いつづける。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 368 | my @args = $self->parse_attlist(\$str, 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 368 | my $newpart = $sub->($self, $tmpl, $ns, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 352 | ▶ | if ($newpart) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 307 | $newpart->{_decllist} = \@args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 307 | $part = $newpart; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | elsif ($self->can("build_$kind")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 379 | ▶ | $self->finalize_part($part) if $part; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | # yatt:widget, entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 379 | my (@args) = $self->parse_attlist(\$str, 1); # To delay entity parsing. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 379 | my $saved_attlist = [@args]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # Cut partname="/route/pattern" from @args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 379 | my ($partName, $mapping) = $self->cut_partname_and_route($declkind, \@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 378 | $self->add_part($tmpl, $part = $self->build($ns, $kind, $kind, $partName)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # $part decllist may contain not only attributes but also others | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # like argmacrosand possible future items. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 376 | $part->{_decllist} = $saved_attlist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 376 | ▶ | if ($mapping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 37 | $self->add_route($part, $mapping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 376 | $self->add_args($part, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 2 | die $self->synerror_at($self->{_startln}, q{Unknown declarator (<!%s:%s >)}, $ns, $kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 715 | ▶ | unless ($str =~ s{^>([\ \t]*\r?\n)?}{}s) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | die $self->synerror_at($self->{_startln}, q{Declarator '<!%s:%s' is not closed with '>': %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | , $ns, $kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | , _firstline_only($str)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # <!yatt:...> の直後には改行が必要、とする。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 714 | ▶ | unless ($1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | die $self->synerror_at($self->{_startln}, q{<!%s:%s> must end with newline!}, $ns, $kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 714 | $self->add_posinfo(length $&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 714 | $self->{_endln} += numLines($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | # 不変量: substr(string, startpos, endpos - startpos) は宣言全文 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | # (閉じ '>' + 改行まで)。endpos は続く part の bodypos に等しい。GH-258 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 714 | push @{$tmpl->{_boundarylist}}, +{ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | kind => 'decl', declkind => $declkind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | , startpos => $decl_startpos, endpos => $self->{_curpos} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 714 | , lineno => $decl_startln | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 714 | ▶ | if ($part) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 670 | $part->{bodypos} = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 670 | $part->{bodyln} = $self->{_endln}; # part の本体開始行の初期値 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 736 | $self->{_startpos} = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # Keep _startln in sync as well. add_text does this when body text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | # follows, but for back-to-back declarations nothing else would, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # every following part got the same startln. GH-275 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 736 | $self->{_startln} = $self->{_endln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # Even if no declarations are found, there should be at least one default part. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 609 | ▶ | $part //= $self->ensure_default_part($tmpl); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$part //= $self->ensure_default_part($tmpl)
MC/DC0%0/2
$part //= $self->ensure_default_part($tmpl)
$part
$self->ensure_default_part($tmpl)
Truth table66%2/3
A //= B
A= $partB= $self->ensure_default_part($tmpl)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 609 | push @{$part->{_toks}}, nonmatched($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | # widget->{endln} は, (視覚上の最後の行)より一つ先の行を指す。(末尾の改行を数える分,多い) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 609 | $part->{endln} = $self->{_endln} += numLines($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 609 | $self->finalize_part($part); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 609 | $self->finalize_template($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 398 | ▶ | sub cut_partname_and_route { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cut_partname_and_route: called CC=9 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 398 | (my MY $self, my ($declkind, $argList)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 398 | ▶ | my $nameAtt = YATT::Lite::Constants::cut_first_att($argList) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my Template $tmpl = $self->{_template}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | die $self->synerror_at($self->{_startln}, q{No part name in %s\n%s} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | , $declkind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | , nonmatched($tmpl->{string})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 398 | my ($partName, $mapping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 398 | ▶ | if ($nameAtt->[NODE_TYPE] == TYPE_ATT_NAMEONLY) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 350 | $partName = $nameAtt->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } elsif ($nameAtt->[NODE_TYPE] == TYPE_ATT_TEXT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 48 | ▶ | if (ref $nameAtt->[NODE_BODY]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 1 | my $t = $YATT::Lite::Constants::TYPE_[$nameAtt->[NODE_BODY][0][NODE_TYPE]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | , q{%s got wrong token for route spec: %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | , $declkind, $t); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 47 | ▶ | if ($nameAtt->[NODE_BODY] eq '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 6 | ▶ | $partName = $nameAtt->[NODE_PATH] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$nameAtt->[7] // ""
MC/DC0%0/1
$nameAtt->[7] // ""
$nameAtt->[7]
Truth table50%1/2
A
A= $nameAtt->[7]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # $partName が foo=bar なら pattern として扱う | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | $mapping = $self->parse_location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 41 | ▶ | ($nameAtt->[NODE_BODY], $nameAtt->[NODE_PATH]) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | , q{Invalid location in %s - "%s"} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | , $declkind, $nameAtt->[NODE_BODY]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 41 | ▶ | $partName = $nameAtt->[NODE_PATH] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$nameAtt->[7] // $self->location2name($nameAtt->[8])
MC/DC0%0/2
$nameAtt->[7] // $self->location2name($nameAtt->[8])
$nameAtt->[7]
$self->location2name($nameAtt->[8])
Truth table66%2/3
A // B
A= $nameAtt->[7]B= $self->location2name($nameAtt->[8])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | // $self->location2name($nameAtt->[NODE_BODY]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | die $self->synerror_at($self->{_startln}, q{Invalid part name in %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | , $declkind); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 397 | ($partName, $mapping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 609 | ▶ | sub finalize_template { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_template: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 609 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 609 | $self->fixup_template_foreach_part_posinfo($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 609 | $tmpl->{nlines} = $self->{_endln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 609 | ▶ | if ($self->{match_argsroute_first}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if ($self->{_rootroute}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->subroutes->append($self->{_rootroute}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 609 | ▶ | if ($self->{_subroutes}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 24 | $tmpl->{subroutes} = $self->{_subroutes}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | $tmpl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 609 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 609 | ▶ | sub fixup_template_foreach_part_posinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fixup_template_foreach_part_posinfo: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 609 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | # $default が partlist に足されてなかったら、先頭に足す... 逆か。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # args が、 $default を先頭から削る? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # fixup parts. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # 本体区間は「bodypos 以降で最初の宣言境界」まで (無ければ EOF まで)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # _partlist だけを歩くと <!yatt:argmacro> のような partlist に入らない | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # 宣言を飲み込んでしまう (GH-258)。コメント境界は part 区間の内部要素 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # なので区間を切らない (raw 本体からの除去は part_body_source が行う)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 609 | ▶ | my @decl_boundaries = grep {$_->{kind} eq 'decl'} @{$tmpl->{_boundarylist} // []}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$tmpl->{"_boundarylist"} // []
MC/DC0%0/1
$tmpl->{"_boundarylist"} // []
$tmpl->{"_boundarylist"}
Truth table50%1/2
A
A= $tmpl->{"_boundarylist"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 609 | foreach my Part $part (@{$tmpl->{_partlist}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 963 | ▶ | unless (defined $part->{bodypos}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | die $self->synerror_at($self->{_startln}, q{bodypos is undef}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 963 | my ($next) = grep {$_->{startpos} >= $part->{bodypos}} @decl_boundaries; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | $part->{bodylen} = ($next ? $next->{startpos} : length($tmpl->{string})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 963 | ▶ | - $part->{bodypos}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 963 | ▶ | if ($part->{_toks} and @{$part->{_toks}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$part->{"_toks"} and @{$part->{"_toks"};}
MC/DC100%2/2
$part->{"_toks"} and @{$part->{"_toks"};}
$part->{"_toks"}
@{$part->{"_toks"};}
Truth table100%3/3
A and B
A= $part->{"_toks"}B= @{$part->{"_toks"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # widget 末尾の連続改行を、単一の改行トークンへ変換。(行番号は解析済みだから大丈夫) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 931 | ▶ | if ($part->{_toks}[-1] =~ s/(?:\r?\n)+\Z//) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 846 | push @{$part->{_toks}}, "\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 849 | ▶ | unless $tmpl->{ignore_trailing_newlines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 963 | ▶ | if (my $sub = $part->can('fixup')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 911 | $sub->($part, $tmpl, $self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 1319 | ▶ | sub parse_attlist { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_attlist: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1319 | (my MY $self, my ($strref, @opt)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 1319 | $self->parse_attlist_with_lvalue($self->{_curpos}, undef, $strref, @opt); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 1416 | ▶ | sub parse_attlist_with_lvalue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_attlist_with_lvalue: called CC=25 SCAR=32.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 1416 | (my MY $self, my ($outer_start, $outer_lvalue, $strref, @opt)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # To examine node range in perldebugger, do like following: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | # x substr($self->{_template}{string}, 18, 26-18) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 1416 | my ($for_decl) = @opt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1416 | my (@result, @lvalue); # Note: @lvalue contains position of lvalue expression. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 1416 | my $curln = $self->{_endln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 1416 | ▶ | while ($$strref =~ s{^$$self{_re_att}}{}xs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 4023 | my $start = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 4023 | $self->{_curpos} += length $&; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | # startln は不変に保つ. これは add_part が startln を使うため | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 4023 | $self->{_endln} += numLines($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 4023 | my AttMatch $m = \%+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 4023 | ▶ | next if $m->{ws} || $m->{comment}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$m->{"ws"} or $m->{"comment"}
MC/DC100%2/2
$m->{"ws"} or $m->{"comment"}
$m->{"ws"}
$m->{"comment"}
Truth table100%3/3
A or B
A= $m->{"ws"}B= $m->{"comment"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 2372 | ▶ | if ($m->{macro}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 63 | push @result, $self->mkargmacro($start, $m->{macro}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 63 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 2309 | my @common = ($start, $self->{_curpos}, $curln); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 424 | ▶ | my $mklval = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 424 | ▶ | if (@lvalue) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 329 | my ($s, $p, $l, $n) = splice(@lvalue); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | # For endpos, curpos should be fetched after the parsing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 329 | ($s, $self->{_curpos}, $l, $n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 95 | (@common, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 2309 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # lvalue or rvalue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 2309 | ▶ | if (not $m->{equal}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # rvalue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # create node. may have lvalue. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 1723 | ▶ | if ($m->{nestclo}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # "body = [code p q]" comes here | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 63 | ▶ | unless ($outer_lvalue) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | Carp::croak("syntax error"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 63 | my ($s, $p, $l, $n) = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 63 | ▶ | if ($outer_lvalue && @$outer_lvalue) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$outer_lvalue and @$outer_lvalue
MC/DC50%1/2
$outer_lvalue and @$outer_lvalue
$outer_lvalue
@$outer_lvalue
Truth table66%2/3
A and B
A= $outer_lvalueB= @$outer_lvalue
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 61 | splice(@$outer_lvalue); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 2 | (@common, undef) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 63 | my $node = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 63 | $node->[NODE_TYPE] = TYPE_ATT_NESTED; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 63 | $node->[NODE_BEGIN] = $outer_start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 63 | $node->[NODE_END] = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 63 | $node->[NODE_LNO] = $l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 63 | $node->[NODE_PATH] = $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 63 | $node->[NODE_BODY] = \@result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 63 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 1660 | ▶ | if ($m->{nest}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | # [ 〜 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 97 | push @result, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | $self->parse_attlist_with_lvalue($start, \@lvalue, $strref, @opt); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 1563 | push @result, my $node = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 1563 | ▶ | if ($m->{bare} and is_ident($m->{bare})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$m->{"bare"} and is_ident($m->{"bare"})
MC/DC100%2/2
$m->{"bare"} and is_ident($m->{"bare"})
$m->{"bare"}
is_ident($m->{"bare"})
Truth table100%3/3
A and B
A= $m->{"bare"}B= is_ident($m->{"bare"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 1139 | ▶ | if (@lvalue) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 196 | $node->[NODE_TYPE] = TYPE_ATT_BARENAME; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 196 | @{$node}[NODE_BEGIN, NODE_END, NODE_LNO, NODE_PATH] = splice(@lvalue); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | # NODE_END from the lvalue stops right after '='. Cover the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | # value too, like the other attribute types do. GH-277 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 196 | $node->[NODE_END] = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 196 | $node->[NODE_BODY] = $m->{bare}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 943 | $node->[NODE_TYPE] = TYPE_ATT_NAMEONLY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 943 | @{$node}[NODE_BEGIN, NODE_END, NODE_LNO] = @common; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 943 | $node->[NODE_PATH] = split_ns($m->{bare}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | ▶ | } elsif ($+{entity} or $+{special}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$+{"entity"} or $+{"special"}
MC/DC50%1/2
$+{"entity"} or $+{"special"}
$+{"entity"}
$+{"special"}
Truth table66%2/3
A or B
A= $+{"entity"}B= $+{"special"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | # XXX: 間に space が入ってたら? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 4 | ▶ | if ($m->{lcmsg}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | , q{l10n msg is not allowed here}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 4 | $node->[NODE_TYPE] = TYPE_ATT_TEXT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 4 | @{$node}[NODE_BEGIN, NODE_END, NODE_LNO, NODE_PATH] = $mklval->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | # Below is a workaround for unclosed `<!yatt:args` with `&yatt:var;` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | # There would be a better way to handle this... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 4 | $_ = $$strref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 4 | $node->[NODE_BODY] = [$self->mkentity(@common)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 4 | $node->[NODE_END] = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | 420 | my ($quote, $value) = oneof($m, qw(bare sq dq)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 420 | $node->[NODE_TYPE] = TYPE_ATT_TEXT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 420 | @{$node}[NODE_BEGIN, NODE_END, NODE_LNO, NODE_PATH] = $mklval->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 420 | ▶ | $node->[NODE_BODY_BEGIN] = $start + ($quote ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 420 | ▶ | splice @$node, NODE_BODY, 0, ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | $for_decl ? $value : $self->_parse_text_entities_at( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | $node->[NODE_BODY_BEGIN], $value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 1563 | $node->[NODE_BODY_END] = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | # lvalue expression. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | elsif ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | # m->{equal} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | not @lvalue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | # got lvalue =, continue to rvalue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 586 | ▶ | if ($m->{bare} and is_ident($m->{bare})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$m->{"bare"} and is_ident($m->{"bare"})
MC/DC50%1/2
$m->{"bare"} and is_ident($m->{"bare"})
$m->{"bare"}
is_ident($m->{"bare"})
Truth table66%2/3
A and B
A= $m->{"bare"}B= is_ident($m->{"bare"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 552 | @lvalue = (@common, split_ns($m->{bare})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | elsif ($m->{nestclo}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 34 | my ($s, $p, $l) = @common; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 34 | @lvalue = ($outer_start, undef, $l, [splice @result]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | Carp::croak("unknown"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | # error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | die $self->synerror_at( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | $self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | , q{assignment (=) after assignment (=) is not allowed} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | 3960 | $curln = $self->{_endln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 3960 | ▶ | $self->_verify_token($self->{_curpos}, $$strref) if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 1353 | ▶ | wantarray ? @result : \@result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 63 | ▶ | sub mkargmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkargmacro: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 63 | (my MY $self, my ($start, $string)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | 63 | local $_ = $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | 63 | my $node = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 63 | $node->[NODE_TYPE] = TYPE_ATT_MACRO; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 63 | @{$node}[NODE_BEGIN, NODE_END, NODE_LNO] = ($start, $self->{_curpos}, $self->{_startln}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | # namespace-less なケースも扱いたいので % を : に置換 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 63 | s/^%/:/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | # _parse_entpath だと curpos を移動させてしまうため | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 63 | my (@path) = $self->_parse_pipeline; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 63 | $node->[NODE_PATH] = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 63 | ▶ | if (@path >= 2 and $path[0][0] eq 'var') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@path >= 2 and $path[0][0] eq "var"
MC/DC50%1/2
@path >= 2 and $path[0][0] eq "var"
@path >= 2
$path[0][0] eq "var"
Truth table66%2/3
A and B
A= @path >= 2B= $path[0][0] eq "var"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 17 | my $head = shift @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 17 | $head->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 46 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 63 | splice @$node, NODE_BODY, 0, @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 63 | ▶ | if ($_ ne ';') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | , q{Invalid decl entity: %s (%s remains)}, $string, $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 63 | $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 956 | ▶ | sub mkentity { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkentity: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 956 | (my MY $self) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | # assert @_ == 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 956 | my $node = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 956 | $node->[NODE_TYPE] = TYPE_ENTITY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 956 | @{$node}[NODE_BEGIN, NODE_END, NODE_LNO] = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 956 | ▶ | if (my $ns = $+{entity}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 954 | $node->[NODE_PATH] = $ns; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 954 | splice @$node, NODE_BODY, 0, $self->_parse_entpath; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } elsif (my $special = $+{special}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | 2 | $node->[NODE_BODY] = [call => $special | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | , $self->_parse_entpath(_parse_entgroup => ')')]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | die "mkentity called without entity or special"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 955 | $node->[NODE_END] = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 955 | $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | 1495 | ▶ | sub split_ns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split_ns: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 1495 | ▶ | defined (my $value = shift) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | or return undef; # make sure one scalar. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 1495 | local %+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 1495 | my @names = split /:/, $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 1495 | ▶ | @names > 1 ? \@names : $value; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | # widget の body の構文については、 Template が規定してよい。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 894 | ▶ | sub parse_widget { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_widget: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 894 | (my MY $self, my Widget $widget) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 894 | $self->{_startln} = $self->{_endln} = $widget->{bodyln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | # XXX: 戻り値でも良い気はする。とはいえ、デバッグは楽か。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 894 | ▶ | local $self->{_chunklist} = my $chunks = [@{$widget->{_toks} //= []}]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$widget->{"_toks"} //= []
MC/DC100%1/1
$widget->{"_toks"} //= []
$widget->{"_toks"}
Truth table100%2/2
A
A= $widget->{"_toks"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 894 | ▶ | local $_ = @$chunks && !ref $chunks->[0] ? shift @$chunks : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$chunks and not ref $chunks->[0]
MC/DC100%2/2
@$chunks and not ref $chunks->[0]
@$chunks
not ref $chunks->[0]
Truth table100%3/3
A and not(B)
A= @$chunksB= not ref $chunks->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 894 | $self->{_startpos} = $self->{_curpos} = $widget->{bodypos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 894 | $self->_parse_body($widget, $widget->{_tree} = []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | 884 | push @{$widget->{_tree}}, nonmatched($_); # XXX: nest 時以外 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 884 | $widget; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 1704 | ▶ | sub _get_chunk { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_chunk: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 1704 | (my MY $self, my $sink) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 1704 | my $chunks = $self->{_chunklist}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 1704 | ▶ | if (length $_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 1158 | ▶ | push @$sink, $_ if $sink; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | 1158 | $self->{_startln} = $self->{_endln} += numLines($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 1158 | $self->{_curpos} = $self->{_startpos} += length $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 1158 | $_ = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | # comment の読み飛ばし | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 1704 | ▶ | while (@$chunks and ref $chunks->[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@$chunks and ref $chunks->[0]
MC/DC100%2/2
@$chunks and ref $chunks->[0]
@$chunks
ref $chunks->[0]
Truth table100%3/3
A and B
A= @$chunksB= ref $chunks->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 19 | my $next = shift @$chunks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 19 | ▶ | push @$sink, $next if $sink; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 19 | $self->{_startln} = $self->{_endln} += $next->[NODE_BODY]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 19 | $self->{_curpos} = $self->{_startpos} = $next->[NODE_END]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 1704 | ▶ | return unless @$chunks; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 819 | $_ = shift @$chunks; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 819 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1945 | ▶ | sub nonspace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonspace: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 1945 | local (%+, $&, $1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 1945 | $_[0] =~ /\S/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 1074 | ▶ | sub splitline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
splitline: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 1074 | local (%+, $&, $1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 1074 | split /(?<=\n)/, $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | sub _verify_token { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_verify_token: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | (my MY $self, my $pos) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | unless (defined $pos) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | die $self->synerror_at($self->{_startln}, q{Token pos is undef!: now='%s'}, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | my $tok = $self->{_template}->source_substr($pos, length $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | unless (defined $tok) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | die $self->synerror_at($self->{_startln}, q{Token substr is empty!: now='%s'}, $_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | ▶ | unless ($tok eq $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | die $self->synerror_at($self->{_startln}, q{Token mismatch!: substr='%s', now='%s'} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | , $tok, $_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 22 | ▶ | sub drop_leading_ws { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drop_leading_ws: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | 22 | my $list = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 22 | local (%+, $1, $2, $&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 22 | ▶ | pop @$list while @$list and $list->[-1] =~ /^\s*$/s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@$list and $list->[-1] =~ /^\s*$/s
MC/DC50%1/2
@$list and $list->[-1] =~ /^\s*$/s
@$list
$list->[-1] =~ /^\s*$/s
Truth table66%2/3
A and B
A= @$listB= $list->[-1] =~ /^\s*$/s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | # build($ns, $kind, $partName, @attlist) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 1017 | ▶ | sub build { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | 1017 | (my MY $self, my ($ns, $decl, $kind, $partName, @rest)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 1017 | local %+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | $self->can("build_$kind")-> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | ($self, name => $partName, decl => $decl, kind => $kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | , namespace => $ns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | , folder => $self->{_template} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 1017 | , startpos => $self->{_startpos}, @rest); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 319 | ▶ | sub build_widget { shift->Widget->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_widget: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 625 | ▶ | sub build_page { shift->Page->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_page: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | 17 | ▶ | sub build_action { shift->Action->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_action: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | sub build_data { shift->Data->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_data: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 18 | ▶ | sub build_entity { shift->Entity->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_entity: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 18 | ▶ | sub build_argmacro { shift->ArgMacro->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_argmacro: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 20 | ▶ | sub build_import { shift->Import->new(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_import: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | # declare | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | 21 | ▶ | sub declare_base { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_base: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 21 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | # Accept empty '<!yatt:base>' declaration as nop for parser testing aid. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | 21 | ▶ | $self->{vfs}->declare_base($self, $tmpl, $ns, @args) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | if @args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 20 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | # <!yatt:import [name...]="file" [name...]="file2" ...> (GH-256) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | # name := srcName | local=srcName | srcName:kind | local=srcName:kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | # kind := widget | page | action | entity | argmacro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | # (無注釈はソース内で一意な場合のみ自動判定) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | # kind の妥当性は vfs 側の _find_kind_part__$kind の有無で判定する | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | # (find_kind_part_from dispatch。kind 追加時に LRXML の変更は不要) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | 29 | ▶ | sub declare_import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_import: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | 29 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 29 | ▶ | unless (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 0 | die $self->synerror_at($self->{_startln}, q{No import arg}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 29 | foreach my $att (@args) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 29 | my ($specs, $fn) = $self->cut_import_spec($att); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 29 | my Template $src = $self->{vfs}->import_resolve_source($self, $tmpl, $fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 27 | foreach my $spec (@$specs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 29 | $self->import_1($tmpl, $ns, $src, @$spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | 21 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | # ブラケット群 [name...]="file" を ([[local, srcName, kind], ...], $fn) に分解する。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 29 | ▶ | sub cut_import_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cut_import_spec: called CC=18 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 29 | (my MY $self, my $att) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | 29 | my $names = $att->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 29 | ▶ | unless ($att->[NODE_TYPE] == TYPE_ATT_TEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$att->[0] == 8 and ref $names eq "ARRAY" and not grep({not ref $_;} @$names)
$att->[0] == 8 and ref $names eq "ARRAY"
MC/DC0%0/3
$att->[0] == 8 and ref $names eq "ARRAY" and not grep({not ref $_;} @$names)
$att->[0] == 8
ref $names eq "ARRAY"
not grep({not ref $_;} @$names)
Truth table25%1/4
A and B and not(C)
A= $att->[0] == 8B= ref $names eq "ARRAY"C= not grep({not ref $_;} @$names)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | and ref $names eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 31 | and not grep {not ref $_} @$names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | , q{import decl must use bracket form like [name...]="file"}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | 29 | my $fn = $att->[NODE_BODY]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 29 | my @specs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 29 | foreach my $node (@$names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 31 | my ($local, $srcSpec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 31 | my $type = $node->[NODE_TYPE]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 31 | ▶ | if ($type == TYPE_ATT_NAMEONLY) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | # srcName または srcName:kind (split_ns 済み) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 24 | $srcSpec = $node->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | ▶ | } elsif ($type == TYPE_ATT_BARENAME or $type == TYPE_ATT_TEXT) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$type == 7 or $type == 8
MC/DC0%0/2
$type == 7 or $type == 8
$type == 7
$type == 8
Truth table33%1/3
A or B
A= $type == 7B= $type == 8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | # local=srcName または local="srcName:kind" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | 7 | $local = $node->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | 7 | $srcSpec = $node->[NODE_BODY]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | die $self->synerror_at($self->{_startln}, q{Invalid import name spec}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | 31 | ▶ | if (ref $local) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | , q{Invalid local name for import: %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | , join(":", @$local)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 31 | my ($srcName, $kind) = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 31 | ▶ | if (ref $srcSpec eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 5 | ▶ | unless (@$srcSpec == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | , q{Invalid import name spec: %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | , join(":", @$srcSpec)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 5 | @$srcSpec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | ▶ | } elsif (defined $srcSpec and $srcSpec =~ /^([^:]+):([^:]+)$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $srcSpec and $srcSpec =~ /^([^:]+):([^:]+)$/
MC/DC50%1/2
defined $srcSpec and $srcSpec =~ /^([^:]+):([^:]+)$/
defined $srcSpec
$srcSpec =~ /^([^:]+):([^:]+)$/
Truth table66%2/3
A and B
A= defined $srcSpecB= $srcSpec =~ /^([^:]+):([^:]+)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 5 | ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | 21 | ($srcSpec, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 31 | ▶ | unless (defined $srcName and $srcName ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $srcName and $srcName ne ""
MC/DC0%0/2
defined $srcName and $srcName ne ""
defined $srcName
$srcName ne ""
Truth table33%1/3
A and B
A= defined $srcNameB= $srcName ne ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | die $self->synerror_at($self->{_startln}, q{Invalid import name spec}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 31 | ▶ | if (defined $kind and not $self->{vfs}->can("_find_kind_part__$kind")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $kind and not $self->{"vfs"}->can("_find_kind_part__$kind")
MC/DC0%0/2
defined $kind and not $self->{"vfs"}->can("_find_kind_part__$kind")
defined $kind
not $self->{"vfs"}->can("_find_kind_part__$kind")
Truth table66%2/3
A and not(B)
A= defined $kindB= not $self->{"vfs"}->can("_find_kind_part__$kind")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | , q{Unknown import kind '%s' for '%s'} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | , $kind, $srcName); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 31 | ▶ | push @specs, [$local // $srcName, $srcName, $kind]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$local // $srcName
MC/DC0%0/2
$local // $srcName
$local
$srcName
Truth table66%2/3
A // B
A= $localB= $srcName
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 29 | (\@specs, $fn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | 29 | ▶ | sub import_1 { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import_1: called CC=4 SCAR=14.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 29 | (my MY $self, my Template $tmpl, my $ns, my Template $src | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | , my ($local, $srcName, $kind)) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | (my $ikind, my $found) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 29 | = $self->{vfs}->import_find_source_part($self, $src, $srcName, $kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 23 | ▶ | if ($ikind eq 'argmacro') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 3 | ▶ | if ($tmpl->{_argmacro_dict}{$local}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | , q{Duplicate argmacro %s in %s} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | ▶ | , $local, $tmpl->{path} // $tmpl->{name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$tmpl->{"path"} // $tmpl->{"name"}
MC/DC0%0/2
$tmpl->{"path"} // $tmpl->{"name"}
$tmpl->{"path"}
$tmpl->{"name"}
Truth table0%0/3
A // B
A= $tmpl->{"path"}B= $tmpl->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | # weak ref でも ArgMacro 自身の _on_declare 自己循環が生存を保証する | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | # (declare_argmacro と同じ)。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 3 | Scalar::Util::weaken($tmpl->{_argmacro_dict}{$local} = $found); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 20 | my Import $import = $self->build($ns, import => import => $local); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 20 | $import->{imported_kind} = $ikind; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 20 | $import->{src_name} = $srcName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 20 | Scalar::Util::weaken($import->{src_folder} = $src); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | # 本体を持たない part なので、位置情報だけ整えておく | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | # (fixup_template_foreach_part_posinfo が bodypos を要求する) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | 20 | $import->{bodypos} = $self->{_curpos}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 20 | $import->{bodylen} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 20 | $self->add_part($tmpl, $import); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 277 | ▶ | sub declare_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_args: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | 277 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 277 | my $kind = 'args'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 277 | my $declkind = join(":", $ns, $kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | my Widget $newpart = $self->cut_implicit_default_part($tmpl, $declkind) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | || $self->build($ns, $kind => $self->default_part_for($tmpl), '' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 277 | ▶ | , startln => $self->{_startln}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->cut_implicit_default_part($tmpl, $declkind) || $self->build($ns, $kind, $self->default_part_for($tmpl), '', 'startln', $self->{'_startln'})
MC/DC0%0/2
$self->cut_implicit_default_part($tmpl, $declkind) || $self->build($ns, $kind, $self->default_part_for($tmpl), '', 'startln', $self->{'_startln'})
$self->cut_implicit_default_part($tmpl, $declkind)
$self->build($ns, $kind, $self->default_part_for($tmpl), '', 'startln', $self->{'_startln'})
Truth table66%2/3
A || B
A= $self->cut_implicit_default_part($tmpl, $declkind)B= $self->build($ns, $kind, $self->default_part_for($tmpl), '', 'startln', $self->{'_startln'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 275 | ▶ | if (not grep {/\S/} @{$newpart->{_toks}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | $newpart->configure( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | # startpos => $self->{_curpos}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | startln => $self->{_startln}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | 270 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 270 | $newpart->{_toks} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 275 | $self->cut_root_route_and_install_url_params($newpart, \@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | # $newpart->{startpos} = $self->{_startpos}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | # $newpart->{bodypos} = $self->{_curpos} + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 274 | $self->add_part($tmpl, $newpart, 1); # partlist と Item に足し直す. no_conflict_check | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 274 | $self->add_args($newpart, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 272 | $newpart; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | 283 | ▶ | sub cut_implicit_default_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cut_implicit_default_part: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 283 | (my MY $self, my Template $tmpl, my ($declkind)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 283 | (my Part $oldpart, my @other) = $self->list_default_parts($tmpl); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | 283 | ▶ | unless (not $oldpart or $oldpart->{implicit}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $oldpart or $oldpart->{"implicit"}
MC/DC100%2/2
not $oldpart or $oldpart->{"implicit"}
not $oldpart
$oldpart->{"implicit"}
Truth table100%3/3
not(A) or B
A= not $oldpartB= $oldpart->{"implicit"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | , q{<!%s> at line %d conflicts with <!%s>} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | , $oldpart->syntax_keyword, $oldpart->{startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 3 | , $declkind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 280 | ▶ | if ($oldpart | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$oldpart and $tmpl->{"_partlist"} and @{$tmpl->{"_partlist"};} == 1 and $tmpl->{"_partlist"}[0] == $oldpart
$oldpart and $tmpl->{"_partlist"} and @{$tmpl->{"_partlist"};} == 1
$oldpart and $tmpl->{"_partlist"}
MC/DC50%2/4
$oldpart and $tmpl->{"_partlist"} and @{$tmpl->{"_partlist"};} == 1 and $tmpl->{"_partlist"}[0] == $oldpart
$oldpart
$tmpl->{"_partlist"}
@{$tmpl->{"_partlist"};} == 1
$tmpl->{"_partlist"}[0] == $oldpart
Truth table60%3/5
A and B and C and D
A= $oldpartB= $tmpl->{"_partlist"}C= @{$tmpl->{"_partlist"};} == 1D= $tmpl->{"_partlist"}[0] == $oldpart
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 12 | and $tmpl->{_partlist} and @{$tmpl->{_partlist}} == 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | and $tmpl->{_partlist}[0] == $oldpart) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | # 先頭だったら再利用。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 10 | shift @{$tmpl->{_partlist}}; # == $oldpart | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 270 | ▶ | $oldpart->{suppressed} = 1 if $oldpart; # 途中なら、古いものを隠して、新たに作り直し。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 270 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 275 | ▶ | sub cut_root_route_and_install_url_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cut_root_route_and_install_url_params: called CC=8 SCAR=21.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 275 | (my MY $self, my Part $part, my ($argList)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | 275 | ▶ | return unless @$argList and $argList->[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
@$argList and $argList->[0] and $argList->[0][0] == 8 and not defined $argList->[0][7]
@$argList and $argList->[0] and $argList->[0][0] == 8
@$argList and $argList->[0]
MC/DC75%3/4
@$argList and $argList->[0] and $argList->[0][0] == 8 and not defined $argList->[0][7]
@$argList
$argList->[0]
$argList->[0][0] == 8
not defined $argList->[0][7]
Truth table80%4/5
A and B and C and not(D)
A= @$argListB= $argList->[0]C= $argList->[0][0] == 8D= not defined $argList->[0][7]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | and $argList->[0][NODE_TYPE] == TYPE_ATT_TEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | and not defined $argList->[0]->[NODE_PATH]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 4 | my $patNode = shift @$argList; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 4 | ▶ | if (ref $patNode->[NODE_BODY]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | 1 | my $t = $YATT::Lite::Constants::TYPE_[$patNode->[NODE_BODY][0][NODE_TYPE]]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 1 | , q{%s got wrong token for route spec: %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | , $part->syntax_keyword, $t); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | my $mapping = $self->parse_location($patNode->[NODE_BODY], '', $part) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 3 | ▶ | or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | 0 | , q{Invalid route spec in %s - "%s"} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | , $part->syntax_keyword, $patNode->[NODE_BODY]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 3 | ▶ | if ($self->{match_argsroute_first}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | $self->{_rootroute} = $mapping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 3 | $self->{_subroutes}->append($mapping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | 3 | $self->add_url_params($part, lexpand($mapping->cget('params'))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 19 | ▶ | sub declare_action { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_action: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 19 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 19 | my $kind = 'action'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 19 | my $declkind = join(":", $ns, $kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 19 | my ($partName, $mapping) = $self->cut_partname_and_route($declkind, \@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 19 | ▶ | if ($partName eq '' and not $mapping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$partName eq "" and not $mapping
MC/DC50%1/2
$partName eq "" and not $mapping
$partName eq ""
not $mapping
Truth table66%2/3
A and not(B)
A= $partName eq ""B= not $mapping
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | # implicit な page は suppress | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | # explicit な page は構文エラー(再利用は出来ない) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 6 | my $declname = "$declkind ''"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 6 | ▶ | if (my Part $implicit = $self->cut_implicit_default_part($tmpl, $declname)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 1 | , q{<!%s> conflicts with name-less default widget} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | , "$declkind ''"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | 17 | my Part $newpart = $self->build($ns, $kind => $kind, $partName, startln => $self->{_startln}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | 17 | $self->add_part($tmpl, $newpart, 1); # partlist と Item に足し直す. no_conflict_check | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 17 | ▶ | if ($mapping) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 4 | $self->add_route($newpart, $mapping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 17 | $self->add_args($newpart, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 17 | $newpart; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 283 | ▶ | sub list_default_parts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list_default_parts: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 283 | (my MY $self, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | 283 | ▶ | return unless $tmpl->{_partlist}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 23 | my Part $part = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 23 | ▶ | $part->{name} eq '' and not $part->{suppressed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$part->{'name'} eq '' && !$part->{'suppressed'}
MC/DC50%1/2
$part->{'name'} eq '' && !$part->{'suppressed'}
$part->{'name'} eq ''
!$part->{'suppressed'}
Truth table66%2/3
A && not(B)
A= $part->{'name'} eq ''B= !$part->{'suppressed'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | 21 | } @{$tmpl->{_partlist}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | # <!yatt:config cf=value...> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 4 | ▶ | sub declare_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_config: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 4 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | # XXX: 一方が undef だったら? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 4 | ▶ | $tmpl->configure(map {($_->[NODE_PATH], $_->[NODE_BODY] // 1)} @args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->[8] // 1
MC/DC100%1/1
$_->[8] // 1
$_->[8]
Truth table100%2/2
A
A= $_->[8]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | 4 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | ▶ | sub declare_constants { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_constants: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | $tmpl->{constants} = \@args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | # <!yatt:argmacro macroName=[...output_args...] ...args> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | 18 | ▶ | sub declare_argmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_argmacro: called CC=4 SCAR=15.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | 18 | (my MY $self, my Template $tmpl, my ($ns, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 18 | my $kind = 'argmacro'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 18 | my $declkind = join(":", $ns, $kind); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 18 | ▶ | my $nameAtt = YATT::Lite::Constants::cut_first_att(\@args) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | die $self->synerror_at($self->{_startln}, q{No part name in %s\n%s} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | , $declkind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 0 | , nonmatched($tmpl->{string})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | 18 | my $partName = $nameAtt->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 18 | my $output_args = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | 18 | ▶ | if ($nameAtt->[NODE_TYPE] == TYPE_ATT_NESTED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 18 | $nameAtt->[NODE_BODY] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | my $node = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | $node->[NODE_TYPE] = TYPE_ATT_NAMEONLY; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | $node->[NODE_PATH] = $partName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | [$node]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 18 | ▶ | if ($tmpl->{_argmacro_dict}{$partName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | die $self->synerror_at($self->{_startln}, q{Duplicate argmacro %s in %s} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | , $partName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | , $declkind); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | my Part $newpart = $self->build( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | $ns, $kind => $kind, $partName, startln => $self->{_startln}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | 18 | output_args => $output_args, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 18 | Scalar::Util::weaken($tmpl->{_argmacro_dict}{$partName} = $newpart); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 18 | $self->add_args($newpart, @args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | 18 | $newpart; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 971 | ▶ | sub finalize_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize_part: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | 971 | (my MY $self, my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | my $finalizer = $self->can("finalize__" . $part->{kind}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | 971 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 18 | $finalizer->($self, $part) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 18 | ▶ | sub finalize__argmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finalize__argmacro: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | 18 | (my MY $self, my ArgMacro $argmacro) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 18 | require YATT::Lite::CGen::ArgMacro; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | my $builder = YATT::Lite::CGen::ArgMacro->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | vfs => $self->{vfs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 18 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | $argmacro->{_on_declare} = $builder->with_template( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | $self->{_template}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 18 | generate_on_declare => ($argmacro), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 18 | $argmacro; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 37 | ▶ | sub location2name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
location2name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | 37 | (my MY $self, my $location) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 37 | $location =~ s{([^A-Za-z0-9])}{'_'.sprintf("%02x", unpack("C", $1))}eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | 37 | $location; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | 44 | ▶ | sub parse_location { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_location: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 44 | (my MY $self, my ($location, $name, $item)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | 44 | ▶ | return unless $location =~ m{^/}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 44 | $self->subroutes->create([$name, $location], $item); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 44 | ▶ | sub subroutes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subroutes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | 44 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | 44 | ▶ | $self->{_subroutes} //= $self->SubRoutes->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"_subroutes"} //= $self->SubRoutes->new
MC/DC0%0/2
$self->{"_subroutes"} //= $self->SubRoutes->new
$self->{"_subroutes"}
$self->SubRoutes->new
Truth table66%2/3
A //= B
A= $self->{"_subroutes"}B= $self->SubRoutes->new
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | 24 | ▶ | sub SubRoutes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SubRoutes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 24 | require YATT::Lite::WebMVC0::SubRoutes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | 24 | 'YATT::Lite::WebMVC0::SubRoutes' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 320 | ▶ | sub primary_ns { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
primary_ns: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | 320 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 320 | ▶ | unless ($self->{namespace}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | 'yatt'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 320 | first($self->{namespace}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 1296 | ▶ | sub namespace { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
namespace: called CC=4 SCAR=15.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 1296 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 1296 | ▶ | return unless defined $self->{namespace}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | ref $self->{namespace} && wantarray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 1296 | ? @{$self->{namespace}} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 1296 | ▶ | : $self->{namespace}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $self->{"namespace"} and wantarray
MC/DC0%0/2
ref $self->{"namespace"} and wantarray
ref $self->{"namespace"}
wantarray
Truth table33%1/3
A and B
A= ref $self->{"namespace"}B= wantarray
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 1007 | ▶ | sub add_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_part: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 1007 | (my MY $self, my Template $tmpl, my Part $part, my $no_conflict_check) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 1007 | my $itemKey = $part->item_key; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 1007 | ▶ | if (not $no_conflict_check and defined $tmpl->{_Item}{$itemKey}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $no_conflict_check and defined $tmpl->{"_Item"}{$itemKey}
MC/DC100%2/2
not $no_conflict_check and defined $tmpl->{"_Item"}{$itemKey}
not $no_conflict_check
defined $tmpl->{"_Item"}{$itemKey}
Truth table100%3/3
not(A) and B
A= not $no_conflict_checkB= defined $tmpl->{"_Item"}{$itemKey}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 2 | die $self->synerror_at($self->{_startln}, q{Conflicting part name! '%s'}, $part->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 1005 | ▶ | if ($tmpl->{_partlist} and my Part $prev = $tmpl->{_partlist}[-1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$tmpl->{"_partlist"} and my YATT::Lite::Core::Part $prev = $tmpl->{"_partlist"}[-1]
MC/DC100%2/2
$tmpl->{"_partlist"} and my YATT::Lite::Core::Part $prev = $tmpl->{"_partlist"}[-1]
$tmpl->{"_partlist"}
my YATT::Lite::Core::Part $prev = $tmpl->{"_partlist"}[-1]
Truth table100%3/3
A and B
A= $tmpl->{"_partlist"}B= my YATT::Lite::Core::Part $prev = $tmpl->{"_partlist"}[-1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 366 | $prev->{endln} = $self->{_endln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 1005 | $part->{startln} = $self->{_startln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | 1005 | $part->{bodyln} = $self->{_endln}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 1005 | push @{$tmpl->{_partlist}}, $tmpl->{_Item}{$itemKey} = $part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 41 | ▶ | sub add_route { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_route: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | 41 | (my MY $self, my Part $part, my $mapping) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 41 | $mapping->configure(item => $part); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | 41 | $self->{_subroutes}->append($mapping); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 41 | $self->add_url_params($part, lexpand($mapping->cget('params'))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 392 | ▶ | sub add_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_text: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | 392 | (my MY $self, my Part $part, my $text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 392 | push @{$part->{_toks}}, $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | 392 | $self->add_posinfo(length($text), 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | 392 | $self->{_startln} = $self->{_endln} += numLines($text); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 1516 | ▶ | sub add_lineinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_lineinfo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | 1516 | (my MY $self, my $sink) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | # push @$sink, [TYPE_LINEINFO, $self->{_endln}]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 669 | ▶ | sub parse_arg_spec_for_part { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_arg_spec_for_part: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | 669 | (my MY $self, my Part $part, my $attNode) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | my ($node_type, $lno, $argName, $desc) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 669 | = @{$attNode}[NODE_TYPE, NODE_LNO, NODE_PATH, NODE_BODY]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 669 | my ($type, $dflag, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 669 | ▶ | if ($node_type == TYPE_ATT_NESTED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 43 | my $headDesc = $desc->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 43 | ▶ | $type = $headDesc->[NODE_PATH] || $headDesc->[NODE_BODY]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$headDesc->[7] || $headDesc->[8]
MC/DC0%0/2
$headDesc->[7] || $headDesc->[8]
$headDesc->[7]
$headDesc->[8]
Truth table33%1/3
A || B
A= $headDesc->[7]B= $headDesc->[8]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | # primary of [primary key=val key=val] # delegate:foo の時は BODY に入る? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 626 | ($type, $dflag, $default) = $self->parse_type_dflag_default($desc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 669 | ($type, $argName, nextArgNo($part) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | , $lno, $node_type, $dflag | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | , $default); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 812 | ▶ | sub add_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_args: called CC=13 SCAR=25.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 812 | (my MY $self, my Part $part) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 812 | foreach my $argSpec (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | # XXX: comment もあるし、 %yatt:argmacro; もある。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 731 | ▶ | if ($argSpec->[NODE_TYPE] == TYPE_ATT_MACRO) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | 63 | $self->add_argmacro($part, $argSpec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 52 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 668 | my ($type, $argName, $nextArgNo, $lno, $node_type, $dflag, $default) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | = my @argSpec = $self->parse_arg_spec_for_part($part, $argSpec); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | # x:value のように : で区切った名前は、引数名としては不正 (GH-296) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 668 | ▶ | unless (defined $argName and not ref $argName) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $argName and not ref $argName
MC/DC100%2/2
defined $argName and not ref $argName
defined $argName
not ref $argName
Truth table100%3/3
A and not(B)
A= defined $argNameB= not ref $argName
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | # argmacro と勘違いして &yatt:argmacro; と書いた時に気づきやすいように | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 3 | ▶ | if ($argSpec->[NODE_TYPE] == TYPE_ATT_TEXT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$argSpec->[0] == 8 and @{$argSpec->[8];} == 1 and +(my $entity = $argSpec->[8][0])->[0] == 3
$argSpec->[0] == 8 and @{$argSpec->[8];} == 1
MC/DC33%1/3
$argSpec->[0] == 8 and @{$argSpec->[8];} == 1 and +(my $entity = $argSpec->[8][0])->[0] == 3
$argSpec->[0] == 8
@{$argSpec->[8];} == 1
+(my $entity = $argSpec->[8][0])->[0] == 3
Truth table50%2/4
A and B and C
A= $argSpec->[0] == 8B= @{$argSpec->[8];} == 1C= +(my $entity = $argSpec->[8][0])->[0] == 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | 1 | and @{$argSpec->[NODE_BODY]} == 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | and (my $entity = $argSpec->[NODE_BODY][0])->[NODE_TYPE] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | == TYPE_ENTITY) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | die $self->synerror_at( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | $self->{_startln}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 'Use of entity(%s) is not allowed here. (Did you mean %%%s;?)', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 1 | $self->{_template}->node_source($argSpec), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | $entity->[NODE_BODY][1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | die $self->synerror_at( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | $self->{_startln}, 'Invalid argument spec: %s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | 2 | $self->{_template}->node_source($argSpec), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 665 | ▶ | if (my $var = $part->{_arg_dict}{$argName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 1 | ▶ | if ($var->from_route) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | # Override $type, $dflag, $default of this var. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 1 | $self->set_var_type($var, $type); # type is always overridden. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 1 | $self->set_dflag_default_to($var, $dflag, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | die $self->synerror_at($self->{_startln} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | , 'Argument %s redefined in %s %s' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | , $argName, $part->{kind}, $part->{name}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 664 | my $var = $self->mkvar_at($self->{_startln}, @argSpec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 663 | $self->set_dflag_default_to($var, $dflag, $default); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 663 | my $type = $var->type->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 663 | ▶ | if ($node_type == TYPE_ATT_NESTED) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | # XXX: [delegate:type ...], [code ...] の ... が来る | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | # 仮想的な widget にする? のが一番楽そうではあるか。そうすれば add_args 出来る。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | # $self->add_arg_of_delegate/code/...へ。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | 43 | ▶ | my $sub = $self->can("add_arg_of_type_$type") or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | die $self->synerror_at($self->{_startln}, "Unknown arg type in arg '%s': %s", $argName, $type) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | # 先頭は型名 (code, delegate:foo など) なので、引数としては渡さない (GH-296) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 43 | my (undef, @attlist) = @{$argSpec->[NODE_BODY]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 43 | $sub->($self, $part, $var, \@attlist); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 620 | ▶ | if (my $sub = $self->can("add_arg_of_type_$type")) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 24 | $sub->($self, $part, $var, []); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 596 | push @{$part->{_arg_order}}, $argName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | 596 | $part->{_arg_dict}{$argName} = $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 796 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | # %macroName(renameTo=renameFrom); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 63 | ▶ | sub add_argmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_argmacro: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 63 | (my MY $self, my Part $part, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | # widget 宣言の中で argmacro を呼び出す | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 63 | ▶ | return if $self->add_part_option($part, $node); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 57 | my ArgMacro $argmacro = $self->find_argmacro($node); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 48 | require YATT::Lite::CGen::ArgMacro; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | my $builder = YATT::Lite::CGen::ArgMacro->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | vfs => $self->{vfs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 48 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | $builder->with_template( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | $self->{_template}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 48 | $argmacro->{_on_declare} => ($self, $part, $node) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 48 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | # %yatt:NAME; / %yatt:NAME(VALUE); → $part->configure(yatt_NAME => VALUE // 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | # Part に yatt_NAME field が無ければ偽を返し、argmacro の探索に任せる。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 63 | ▶ | sub add_part_option { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_part_option: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | 63 | (my MY $self, my Part $part, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 63 | my $ns = $node->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 63 | ▶ | return unless defined $ns and $ns eq 'yatt'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ns and $ns eq "yatt"
MC/DC100%2/2
defined $ns and $ns eq "yatt"
defined $ns
$ns eq "yatt"
Truth table100%3/3
A and B
A= defined $nsB= $ns eq "yatt"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 9 | my ($head, @rest) = @{$node}[NODE_BODY .. $#$node]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 9 | ▶ | return if @rest; # %yatt:a:b; は find_argmacro でエラーにする | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | 9 | my ($call, $name, @args) = @$head; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 9 | ▶ | return unless $call eq 'prop' or $call eq 'invoke'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$call eq "prop" or $call eq "invoke"
MC/DC0%0/2
$call eq "prop" or $call eq "invoke"
$call eq "prop"
$call eq "invoke"
Truth table66%2/3
A or B
A= $call eq "prop"B= $call eq "invoke"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 9 | my $optName = "yatt_$name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | 9 | ▶ | return unless exists YATT::Lite::Util::fields_hash($part)->{$optName}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 6 | ▶ | if (@args >= 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 1 | die $self->synerror_at($node->[NODE_LNO] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | , "Too many values for part option '%s'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | , $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 5 | my $value = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 5 | ▶ | if (not @args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | } elsif ($args[0][0] eq 'text') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | 2 | $args[0][1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | 1 | die $self->synerror_at($node->[NODE_LNO] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | , "Invalid value for part option '%s'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | , $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 4 | $part->configure($optName => $value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 57 | ▶ | sub find_argmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_argmacro: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 57 | (my MY $self, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 57 | my $ns = $node->[NODE_PATH]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | 57 | my ($head, @rest) = @{$node}[NODE_BODY .. $#$node]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 57 | my ($call, $macroName, $renameSpec) = @$head; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 57 | ▶ | if (@rest) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | die $self->synerror_at($node->[NODE_LNO] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | , "Invalid argmacro reference '%%%s;'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | 3 | , join(":", grep {defined} $ns, $macroName | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 1 | , map {$_->[1]} @rest)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | # %ns:foo; は Site 設定 argmacro の ns に登録されたものだけを探す。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | # (ページ内定義は %foo; でしか参照できない) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | 56 | ▶ | if (defined $ns) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | 10 | ▶ | unless (grep {$_ eq $ns} $self->namespace) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 1 | die $self->synerror_at($node->[NODE_LNO] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | , "Unknown namespace '%s' in argmacro reference" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | , $ns); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | my $argmacro = $self->{vfs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | 9 | ▶ | && $self->{vfs}->find_argmacro_module($self, $ns, $macroName); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'vfs'} && $self->{'vfs'}->find_argmacro_module($self, $ns, $macroName)
MC/DC50%1/2
$self->{'vfs'} && $self->{'vfs'}->find_argmacro_module($self, $ns, $macroName)
$self->{'vfs'}
$self->{'vfs'}->find_argmacro_module($self, $ns, $macroName)
Truth table66%2/3
A && B
A= $self->{'vfs'}B= $self->{'vfs'}->find_argmacro_module($self, $ns, $macroName)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 9 | ▶ | return $argmacro if $argmacro; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 4 | ▶ | die $self->synerror_at($node->[NODE_LNO] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | , "Unknown argmacro '%s:%s'%s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | , $ns, $macroName | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | , ($self->find_local_argmacro($macroName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | ? " (page-local argmacro '$macroName'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | ." can only be referenced as %$macroName;)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | : "")); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 46 | my $argmacro = $self->find_local_argmacro($macroName); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 46 | ▶ | return $argmacro if $argmacro; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | # Site 設定 argmacro の primary ns (名前空間無しの登録を含む) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 28 | ▶ | if ($self->{vfs} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"vfs"} and $argmacro = $self->{"vfs"}->find_argmacro_module($self, undef, $macroName)
MC/DC50%1/2
$self->{"vfs"} and $argmacro = $self->{"vfs"}->find_argmacro_module($self, undef, $macroName)
$self->{"vfs"}
$argmacro = $self->{"vfs"}->find_argmacro_module($self, undef, $macroName)
Truth table66%2/3
A and B
A= $self->{"vfs"}B= $argmacro = $self->{"vfs"}->find_argmacro_module($self, undef, $macroName)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | and $argmacro = $self->{vfs}->find_argmacro_module($self, undef, $macroName)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | 25 | return $argmacro; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 2 | die $self->synerror_at($node->[NODE_LNO] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | , "Unknown argmacro '%s'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | , $macroName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | # ページ内(import 分を含む)と base 1 段の argmacro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | 50 | ▶ | sub find_local_argmacro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_local_argmacro: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 50 | (my MY $self, my $macroName) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | 50 | my Template $tmpl = $self->{_template}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | 50 | my ArgMacro $argmacro = $tmpl->{_argmacro_dict}{$macroName}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 50 | ▶ | return $argmacro if $argmacro; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | # XXX: ディレクトリからの追加を許すか否か、その場合の意味論… | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 32 | foreach my Part $part ($tmpl->list_base) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | 32 | ▶ | next unless $part->isa(Template); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | 1 | my Template $base = $part; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 1 | ▶ | if ($argmacro = $base->{_argmacro_dict}{$macroName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 1 | return $argmacro | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 31 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 44 | ▶ | sub add_url_params { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_url_params: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 44 | (my MY $self, my Part $part, my @params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 44 | foreach my $param (@params) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | 8 | my ($argName, $type_or_pat) = @$param; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 8 | my $type = 'value'; # XXX: type_or_pat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 8 | my $var = $self->mkvar_at($self->{_startln}, $type, $argName | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | , nextArgNo($part)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 8 | $var->from_route(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 8 | push @{$part->{_arg_order}}, $argName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 8 | $part->{_arg_dict}{$argName} = $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | # code 型は仮想的な Widget を作る。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | 62 | ▶ | sub add_arg_of_type_code { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_arg_of_type_code: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 62 | (my MY $self, my Part $part, my ($var, $attlist)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | 62 | $var->widget(my Widget $virtual = $self->Widget->new(name => $var->varname)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 62 | $self->add_args($virtual, @$attlist); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 61 | my $argName = $var->varname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 61 | push @{$part->{_arg_order}}, $argName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 61 | $part->{_arg_dict}{$argName} = $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | # expr 型の引数宣言 ([expr x y]) も、code と同じく仮想的な Widget に持たせる (GH-294) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 12 | ▶ | sub add_arg_of_type_expr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_arg_of_type_expr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 12 | shift->add_arg_of_type_code(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 5 | ▶ | sub add_arg_of_type_delegate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_arg_of_type_delegate: called CC=15 SCAR=28.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | 5 | (my MY $self, my Widget $widget, my ($var, $attlist)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | # XXX: 引数でない変数も足さないと... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 5 | my $name = $var->varname; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | # XXX: 既に有ったらエラーにしないと。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 5 | $widget->{_var_dict}{$name} = $var; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 5 | my ($type, @subtype) = @{$var->type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | 5 | ▶ | my @wpath = @subtype ? @subtype : $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | my Widget $delegate = $self->{vfs}->find_part_from | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 5 | ▶ | ($widget->{folder}, @wpath) or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 0 | $self->synerror_at($self->{_startln}, "Can't find delegate widget for argument %s=[%s]", $name, join(":", $type, @subtype)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | 5 | $var->weakened_set_widget($delegate); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | 5 | ▶ | unless (Scalar::Util::isweak($var->[YATT::Lite::VarTypes::t_delegate::VSLOT_WIDGET])) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 0 | die "Can't weaken!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 5 | $var->delegate_vars(\ my %delegate_vars); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 5 | my ($attDict, $excludeDict) = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | 5 | my (%attDict, %exclDict); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 5 | foreach my $argSpec (@$attlist) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | 2 | ▶ | if (my $attName = $argSpec->[NODE_PATH]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 1 | ▶ | defined $attDict{$attName} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | and die $self->synerror_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | ($argSpec->[NODE_LNO] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | , "Duplicate argname '%s' in delegate var %s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | , $attName, $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | 1 | $attDict{$attName} = $argSpec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | ▶ | } elsif ($argSpec->[NODE_TYPE] == TYPE_ATT_TEXT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$argSpec->[0] == 8 and ($attName) = $argSpec->[8] =~ /^-(\w+)$/
MC/DC0%0/2
$argSpec->[0] == 8 and ($attName) = $argSpec->[8] =~ /^-(\w+)$/
$argSpec->[0] == 8
($attName) = $argSpec->[8] =~ /^-(\w+)$/
Truth table33%1/3
A and B
A= $argSpec->[0] == 8B= ($attName) = $argSpec->[8] =~ /^-(\w+)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | and ($attName) = $argSpec->[NODE_BODY] =~ /^-(\w+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 1 | ▶ | if (not $delegate->{_arg_dict}{$attName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | 0 | die $self->synerror_at | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | ($argSpec->[NODE_LNO] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | , "No such argument '%s' in delegate to '%s'" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | , $attName, $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 1 | $exclDict{$attName} = $argSpec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | 0 | die $self->synerror_at | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | ($argSpec->[NODE_LNO] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | , "Invalid decl spec for delegate var %s", $name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 5 | (\%attDict, \%exclDict); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 5 | foreach my $argName (@{$delegate->{_arg_order}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | # 既に宣言されている名前は、足さない。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 10 | ▶ | next if $widget->{_arg_dict}{$argName}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | # Ignore [delegate -excluded_var] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | 10 | ▶ | next if $excludeDict->{$argName}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 9 | $delegate_vars{$argName} = my $orig = $delegate->{_arg_dict}{$argName}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 9 | my $actual = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 9 | ▶ | if (my $att = $attDict->{$argName}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 1 | my @new = $self->parse_arg_spec_for_part($widget, $att); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 1 | ▶ | $new[0] ||= $orig->[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$new[0] ||= $orig->[0]
MC/DC0%0/2
$new[0] ||= $orig->[0]
$new[0]
$orig->[0]
Truth table33%1/3
A ||= B
A= $new[0]B= $orig->[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 1 | $self->mkvar_at($self->{_startln}, @new); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | # clone して argno と lineno を変える。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | $self->mkvar_at($widget->{startln}, @$orig) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 8 | ->argno(nextArgNo($widget))->lineno($widget->{startln}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 9 | $widget->{_arg_dict}{$argName} = $actual; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | # XXX: lineno を widget の startln にするのは手抜き。本来は直前の arg のものを使うべき。 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 9 | push @{$widget->{_arg_order}}, $argName; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | 685 | ▶ | sub nextArgNo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nextArgNo: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 685 | (my Part $part) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 685 | ▶ | $part->{_arg_order} ? scalar @{$part->{_arg_order}} : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 44 | ▶ | sub synerror_at { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
synerror_at: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 44 | (my MY $self, my $ln) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 44 | my %opts = ($self->_tmpl_file_line($ln), depth => 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 44 | $self->_error(\%opts, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 45 | ▶ | sub _error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 45 | (my MY $self, my ($opts, $fmt)) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 45 | ▶ | if (my $vfs = $self->{vfs}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 31 | $vfs->error($opts, $fmt, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 14 | sprintf($fmt, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 45 | ▶ | sub _tmpl_file_line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tmpl_file_line: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 45 | (my MY $self, my $ln) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 45 | ▶ | ($$self{path} ? (tmpl_file => $$self{path}) : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | , defined $ln ? (tmpl_line => $ln) : ()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | 1752 | ▶ | sub is_ident { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_ident: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | 1752 | ▶ | return undef unless defined $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 1752 | local %+; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 1752 | $_[0] =~ m{^[[:alpha:]_\:](?:\w+|:)*$}; # To exclude leading digit. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 420 | ▶ | sub oneof { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oneof: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 420 | my $hash = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 420 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 420 | foreach my $key (@_) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | 1120 | ▶ | if (defined(my $value = $hash->{$key})) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | 420 | return $i => $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | } continue { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 700 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | die "really??"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 320 | ▶ | sub first { ref $_[0] ? $_[0][0] : $_[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first: called CC=2 SCAR=7.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 1493 | ▶ | sub nonmatched { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nonmatched: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 1493 | ▶ | return unless defined $_[0] and length $_[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $_[0] and length $_[0]
MC/DC50%1/2
defined $_[0] and length $_[0]
defined $_[0]
length $_[0]
Truth table66%2/3
A and B
A= defined $_[0]B= length $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 596 | $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 8 | ▶ | sub shortened_original_entpath { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shortened_original_entpath: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 8 | (my MY $self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 8 | my $str = $self->{_original_entpath}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 8 | $str =~ s/\n.*\z//s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | 8 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 1 | ▶ | sub _firstline_only { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_firstline_only: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 1 | my ($str) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 1 | $str =~ s/\n.*\z/.../s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 1 | $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | sub _parse_body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | sub _parse_text_entities_at; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | sub _parse_text_entities; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | sub _parse_entpath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | sub _parse_pipeline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | sub _parse_entgroup; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | sub _parse_entterm; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | sub _parse_group_string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | sub _parse_hash; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 0 | ▶ | sub DESTROY {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 27 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=6 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | 27 | ▶ | unless (ref $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 0 | confess "BUG! \$self isn't object!"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 27 | my $sub = our $AUTOLOAD; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 27 | (my $meth = $sub) =~ s/.*:://; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | 27 | ▶ | my $sym = $YATT::Lite::LRXML::{$meth} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | or croak "No such method: $meth"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 27 | ▶ | if ($meth =~ /ent|pipeline/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | require YATT::Lite::LRXML::ParseEntpath | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 11 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | elsif ($meth =~ /body/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | require YATT::Lite::LRXML::ParseBody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 16 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 0 | my MY $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | die $self->synerror_at($self->{_startln}, "Unknown method: %s", $meth); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | 27 | my $code = *{$sym}{CODE} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | 27 | ▶ | or croak "Can't find definition of: $meth"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 27 | goto &$code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 77 | ▶ | use YATT::Lite::Breakpoint qw(break_load_parser break_parser); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | 77 | break_load_parser(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 77 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||