| 1 | package YATT::Lite::CGen; sub MY () {__PACKAGE__} | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 46 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 46 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 46 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 46 | ▶ | use constant DEBUG_REBUILD => $ENV{DEBUG_YATT_REBUILD}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 46 | ▶ | use base qw(YATT::Lite::VarMaker); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 46 | ▶ | use YATT::Lite::MFields qw/_curtmpl _curwidget _curtoks | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | _altgen _needs_escaping _depth | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | cgen_loader | ||||||||||||||||||||||||||||||||||||||||||||||
| 12 | only_parse | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | no_lineinfo check_lineno | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | _no_last_newline | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | vfs parser sink | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | _scope | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | lcmsg_sink | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | prefer_call_for_entity | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | no_conditional_call | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | / | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 46 | ; | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 46 | ▶ | use YATT::Lite::Core qw(Template Part Folder); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 46 | ▶ | use YATT::Lite::Constants; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 46 | ▶ | use YATT::Lite::Util qw(callerinfo numLines); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 450 | ▶ | sub ensure_generated_for_folders { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ensure_generated_for_folders: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 450 | (my MY $self, my $spec) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | 450 | foreach my Folder $folder (@_) { | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 465 | ▶ | if ($folder->can_generate_code) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 34 | $self->ensure_generated($spec, $folder); | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 662 | ▶ | sub ensure_generated { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ensure_generated: called CC=11 SCAR=25.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 662 | (my MY $self, my $spec, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 38 | 662 | ▶ | my ($type, $kind) = ref $spec ? @$spec : $spec; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 662 | ▶ | $self->{vfs}->error(q{sink is empty}) unless $self->{sink}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 662 | ▶ | return if defined $tmpl->{_product}{$type}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 442 | ▶ | local $self->{_depth} = 1 + ($self->{_depth} // 0); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"_depth"} // 0
MC/DC100%1/1
$self->{"_depth"} // 0
$self->{"_depth"}
Truth table100%2/2
A
A= $self->{"_depth"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 442 | my $pkg = $tmpl->{_product}{$type} = $tmpl->{entns}; | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | 442 | ▶ | if (not defined $tmpl->{_product}{$type}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | croak "package for product $type of $tmpl->{path} is not defined!"; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | print STDERR "# generating $pkg for $type code of " | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 442 | . ($tmpl->{path} // "(undef)") . "\n" | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | if DEBUG_REBUILD; | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | $self->{parser}->parse_body($tmpl) | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | if not $kind or not $self->{only_parse} | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 442 | ▶ | or $self->{only_parse}{$kind}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $kind && $self->{"only_parse"} or $self->{"only_parse"}{$kind}
$kind && $self->{'only_parse'}
MC/DC0%0/3
not $kind && $self->{"only_parse"} or $self->{"only_parse"}{$kind}
$kind
$self->{'only_parse'}
$self->{"only_parse"}{$kind}
Truth table25%1/4
not(A && B) or C
A= $kindB= $self->{'only_parse'}C= $self->{"only_parse"}{$kind}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 433 | $self->setup_inheritance_for($spec, $tmpl); | |||||||||||||||||||||||||||||||||||||||||||||
| 54 | # <!yatt:import> のソースも先に generate しておく。 | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # (子の glob 代入が eval される時点でソース側の sub が必要) GH-256 | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 433 | ▶ | if (my @import_srcs = $tmpl->list_import_sources) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 17 | $self->ensure_generated_for_folders($spec, @import_srcs); | |||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 433 | my @res = $self->generate($tmpl, $kind); | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 398 | ▶ | if (my $sub = $self->{sink}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | $sub->({folder => $tmpl, package => $pkg, kind => 'body' | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | , depth => $self->{_depth}} | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 398 | , @res); | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 397 | $pkg; | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 33 | ▶ | sub with_template { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
with_template: called CC=4 SCAR=14.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 33 | (my MY $self, my Template $tmpl, my ($task, @args)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | 33 | local $self->{_curtmpl} = $tmpl; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | 33 | local $self->{_curline} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | 33 | ▶ | if (ref $task eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 12 | $task->($self, @args); | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 21 | my ($meth, @rest) = YATT::Lite::Util::lexpand($task); | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | 21 | ▶ | unless ($meth) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | Carp::croak "meth is undef"; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 21 | ▶ | my $sub = $self->can($meth) or do { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | Carp::croak "No such method $meth"; | |||||||||||||||||||||||||||||||||||||||||||||
| 81 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 21 | $sub->($self, @rest, @args); | |||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 433 | ▶ | sub generate { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generate: called CC=6 SCAR=20.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 433 | (my MY $self, my Template $tmpl) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | 433 | ▶ | my $kind = shift if @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # XXX: Rewrite this with with_template | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 433 | local $self->{_curtmpl} = $tmpl; | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | 433 | local $self->{_curline} = 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | ($self->generate_preamble($self->{_curtmpl}) | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | , map { | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 647 | my Part $part = $_; | |||||||||||||||||||||||||||||||||||||||||||||
| 95 | 647 | ▶ | if (not $kind or not $self->{only_parse} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not $kind && $self->{"only_parse"} or $kind eq $part->{"kind"}
$kind && $self->{'only_parse'}
MC/DC0%0/3
not $kind && $self->{"only_parse"} or $kind eq $part->{"kind"}
$kind
$self->{'only_parse'}
$kind eq $part->{"kind"}
Truth table25%1/4
not(A && B) or C
A= $kindB= $self->{'only_parse'}C= $kind eq $part->{"kind"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | or $kind eq $part->{kind}) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | my $sub = $self->can("generate_$part->{kind}") | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | or die $self->generror("Can't generate part type: '%s'" | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 647 | ▶ | , $part->{kind}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 647 | $sub->($self, $part, $part->{name}, $tmpl->{path}); | |||||||||||||||||||||||||||||||||||||||||||||
| 101 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | (); | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 433 | } @{$tmpl->{_partlist}}); | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub setup_inheritance_for { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setup_inheritance_for: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | (my MY $self, my $spec, my Template $tmpl) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $self->ensure_generated_for_folders($spec, $tmpl->list_base); | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 325 | ▶ | sub altgen { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
altgen: called CC=3 SCAR=11.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 325 | (my MY $self, my $ns) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | # ns 一つに付き 高々 1回しか、can しないで済むように... と言っても、cgen 自体が複数個作られたら.. | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 325 | ▶ | unless (exists $self->{_altgen}{$ns}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 200 | $self->{_altgen}{$ns} = do { | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | 200 | ▶ | if (my $sub = $self->can("create_altgen_$ns")) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | # 毎回, new し直す。 | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $sub->($self)->generate_node(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 325 | $self->{_altgen}{$ns}; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub create_altgen_js { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_altgen_js: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | require YATT::Lite::CGen::JS; | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | new YATT::Lite::CGen::JS | |||||||||||||||||||||||||||||||||||||||||||||
| 132 | ($self->cf_delegate(qw(vfs parser no_lineinfo check_lineno))); | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | #======================================== | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 997 | ▶ | sub find_var { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_var: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 997 | (my MY $self, my $varName, my $check) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | 997 | ▶ | confess "Undefined varName for find_var!" unless defined $varName; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 997 | ▶ | for (my $scope = $self->{_scope}; $scope; $scope = $scope->[1]) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3486 | ▶ | if (defined (my $var = $scope->[0]{$varName})) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 442 | ▶ | next if $check and not $check->($var); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$check and not &$check($var)
MC/DC0%0/2
$check and not &$check($var)
$check
not &$check($var)
Truth table66%2/3
A and not(B)
A= $checkB= not &$check($var)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 442 | return $var; | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 528 | ▶ | sub find_callable_var { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_callable_var: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 528 | (my MY $self, my $varName) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | 528 | ▶ | $self->find_var($varName, sub {shift->callable}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 232 | ▶ | sub lookup_widget { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lookup_widget: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 232 | (my MY $self, my ($ns, @path)) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | # ns 抜きと、有りで一回ずつ検索する | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | $self->{vfs}->find_part_from($self->{_curtmpl}, @path) | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 232 | ▶ | || $self->{vfs}->find_part_from($self->{_curtmpl}, $ns, @path); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 35 | ▶ | sub generror { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
generror: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 35 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 158 | 35 | my Template $tmpl = $self->{_curtmpl}; | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | 35 | my ($pkg, $file, $line) = caller; | |||||||||||||||||||||||||||||||||||||||||||||
| 160 | 35 | my %opts = ($self->_tmpl_file_line($self->{_curline}), callerinfo()); | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | 35 | $self->_error(\%opts, @_); | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 35 | ▶ | sub _error { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_error: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 35 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 165 | 35 | $self->{vfs}->error(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 35 | ▶ | sub _tmpl_file_line { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tmpl_file_line: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 35 | (my MY $self, my $ln) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | 35 | my Template $tmpl = $self->{_curtmpl}; | |||||||||||||||||||||||||||||||||||||||||||||
| 170 | (tmpl_file => $tmpl->{path} // $tmpl->{name} | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 35 | ▶ | , defined $ln ? (tmpl_line => $ln) : ()); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tmpl->{"path"} // $tmpl->{"name"}
MC/DC0%0/2
$tmpl->{"path"} // $tmpl->{"name"}
$tmpl->{"path"}
$tmpl->{"name"}
Truth table66%2/3
A // B
A= $tmpl->{"path"}B= $tmpl->{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 139 | ▶ | sub add_curline { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_curline: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 139 | (my MY $self, my $text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 139 | $self->{_curline} += numLines($text); | |||||||||||||||||||||||||||||||||||||||||||||
| 177 | 139 | $text; | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 3285 | ▶ | sub sync_curline { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sync_curline: called CC=6 SCAR=18.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 3285 | (my MY $self, my $lineno) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 182 | 3285 | ▶ | return unless defined $lineno; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 2833 | my $diff = $lineno - $self->{_curline}; | |||||||||||||||||||||||||||||||||||||||||||||
| 184 | 2833 | ▶ | die "curline exceeds expected lineno! expect $lineno, curline=$self->{_curline}\n" if $self->{check_lineno} and $diff < 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"check_lineno"} and $diff < 0
MC/DC0%0/2
$self->{"check_lineno"} and $diff < 0
$self->{"check_lineno"}
$diff < 0
Truth table33%1/3
A and B
A= $self->{"check_lineno"}B= $diff < 0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 2833 | ▶ | $self->{_curline} = $lineno if $lineno > $self->{_curline}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 2833 | ▶ | $diff > 0 ? "\n" x $diff : (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # <!yatt:widget ...> や <yatt:call ...> の直後の改行を, | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # ソース上のみの(出力しない)改行に変換する。 | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 1074 | ▶ | sub cut_next_nl { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cut_next_nl: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1074 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | # undef は返したくないので。 | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | return wantarray ? () : '' | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | unless $self->{_curtoks} | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1074 | ▶ | and @{$self->{_curtoks}} and $self->{_curtoks}[0] =~ /^\r?\n$/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%6/6
$self->{"_curtoks"} and @{$self->{"_curtoks"};} and $self->{"_curtoks"}[0] =~ /^\r?\n$/
$self->{"_curtoks"} and @{$self->{"_curtoks"};}
MC/DC100%3/3
$self->{"_curtoks"} and @{$self->{"_curtoks"};} and $self->{"_curtoks"}[0] =~ /^\r?\n$/
$self->{"_curtoks"}
@{$self->{"_curtoks"};}
$self->{"_curtoks"}[0] =~ /^\r?\n$/
Truth table100%4/4
A and B and C
A= $self->{"_curtoks"}B= @{$self->{"_curtoks"};}C= $self->{"_curtoks"}[0] =~ /^\r?\n$/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | return wantarray ? () : '' | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 325 | ▶ | if @{$self->{_curtoks}} == 1; # 最後の一個の改行は、残す。これは "}\n" のため | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 153 | $self->{_curline}++; | |||||||||||||||||||||||||||||||||||||||||||||
| 199 | 153 | shift @{$self->{_curtoks}}; | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 683 | ▶ | sub mkscope { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkscope: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 683 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | 683 | ▶ | return unless @_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 683 | ▶ | my $scope = ref $_[-1] eq 'ARRAY' ? pop : [pop]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 683 | ▶ | while (@_) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 1919 | $scope = [pop, $scope]; | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 683 | $scope; | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | sub terse_dump { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
terse_dump: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | YATT::Lite::Util::terse_dump(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub node_sync_curline { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_sync_curline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | (my MY $self, my $node) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $self->sync_curline($node->[NODE_LNO]); | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 46 | 1; | |||||||||||||||||||||||||||||||||||||||||||||