| 1 | package DTL::Fast::Tag; | ||||||||||||
| 2 | 36 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 36 | ▶ | use parent 'DTL::Fast::Parser'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | |||||||||||||
| 5 | 36 | ▶ | use DTL::Fast; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 36 | ▶ | use DTL::Fast::Template; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | sub new | ||||||||||||
| 9 | { | ||||||||||||
| 10 | 843 | ▶ | my( $proto, $parameter, %kwargs ) = @_; | ||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||
| 11 | 843 | ▶ | $parameter //= ''; | ||||||||||
|
Condition50%1/2
$parameter //= ""
MC/DC0%0/1
$parameter //= ""
$parameter
Truth table50%1/2
A
A= $parameter
| |||||||||||||
| 12 | |||||||||||||
| 13 | 843 | $parameter =~ s/^\s+|\s+$//gs; | |||||||||||
| 14 | |||||||||||||
| 15 | 843 | $kwargs{'parameter'} = $parameter; | |||||||||||
| 16 | |||||||||||||
| 17 | 843 | return $proto->SUPER::new(%kwargs); | |||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 22 | ▶ | sub parse_parameters{return shift;} | ||||||||||
|
Subroutine
parse_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 21 | |||||||||||||
| 22 | sub parse_chunks | ||||||||||||
| 23 | { | ||||||||||||
| 24 | 843 | ▶ | my( $self ) = @_; | ||||||||||
|
Subroutine
parse_chunks: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 25 | 843 | $self->parse_parameters(); | |||||||||||
| 26 | |||||||||||||
| 27 | $DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $self->{'_open_tag_lines'} | ||||||||||||
| 28 | 828 | ▶ | if $self->{'_open_tag_lines'}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 29 | |||||||||||||
| 30 | 828 | return $self->SUPER::parse_chunks(); | |||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | sub get_close_tag | ||||||||||||
| 34 | { | ||||||||||||
| 35 | 0 | ▶ | my( $self ) = @_; | ||||||||||
|
Subroutine
get_close_tag: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 36 | 0 | die sprintf( | |||||||||||
| 37 | "ABSTRACT method get_close_tag, must be overriden in %s" | ||||||||||||
| 38 | , ref $self | ||||||||||||
| 39 | ); | ||||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | # Close tag processor | ||||||||||||
| 43 | sub parse_tag_chunk | ||||||||||||
| 44 | { | ||||||||||||
| 45 | 946 | ▶ | my( $self, $tag_name, $tag_param, $chunk_lines ) = @_; | ||||||||||
|
Subroutine
parse_tag_chunk: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 46 | |||||||||||||
| 47 | 946 | my $result = undef; | |||||||||||
| 48 | |||||||||||||
| 49 | 946 | ▶ | if( $tag_name eq $self->get_close_tag ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 50 | { | ||||||||||||
| 51 | 640 | $self->{'raw_chunks'} = []; # this stops parsing | |||||||||||
| 52 | 640 | $DTL::Fast::Template::CURRENT_TEMPLATE_LINE += $chunk_lines; | |||||||||||
| 53 | } | ||||||||||||
| 54 | else | ||||||||||||
| 55 | { | ||||||||||||
| 56 | 306 | $result = $self->SUPER::parse_tag_chunk($tag_name, $tag_param, $chunk_lines); | |||||||||||
| 57 | } | ||||||||||||
| 58 | |||||||||||||
| 59 | 922 | return $result; | |||||||||||
| 60 | } | ||||||||||||
| 61 | |||||||||||||
| 62 | # returns restored opening tag | ||||||||||||
| 63 | sub open_tag_syntax | ||||||||||||
| 64 | { | ||||||||||||
| 65 | 2 | ▶ | my ($self) = @_; | ||||||||||
|
Subroutine
open_tag_syntax: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 66 | |||||||||||||
| 67 | return join( ' ', | ||||||||||||
| 68 | grep( | ||||||||||||
| 69 | $_ | ||||||||||||
| 70 | , ( | ||||||||||||
| 71 | '{%' | ||||||||||||
| 72 | , $DTL::Fast::KNOWN_SLUGS{ref $self} | ||||||||||||
| 73 | 2 | , $self->{'parameter'} | |||||||||||
| 74 | , '%}' | ||||||||||||
| 75 | ) | ||||||||||||
| 76 | ) | ||||||||||||
| 77 | ); | ||||||||||||
| 78 | } | ||||||||||||
| 79 | |||||||||||||
| 80 | # returns restored opening tag | ||||||||||||
| 81 | sub open_tag_syntax_with_line_number | ||||||||||||
| 82 | { | ||||||||||||
| 83 | 2 | ▶ | my ($self) = @_; | ||||||||||
|
Subroutine
open_tag_syntax_with_line_number: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||
| 84 | 2 | ▶ | return $self->open_tag_syntax().' at line '.($self->{'_template_line'} // 'unknown'); | ||||||||||
|
Condition50%1/2
$self->{"_template_line"} // "unknown"
MC/DC0%0/1
$self->{"_template_line"} // "unknown"
$self->{"_template_line"}
Truth table50%1/2
A
A= $self->{"_template_line"}
| |||||||||||||
| 85 | } | ||||||||||||
| 86 | |||||||||||||
| 87 | sub get_block_parse_error | ||||||||||||
| 88 | { | ||||||||||||
| 89 | 1 | ▶ | my ($self, $message) = @_; | ||||||||||
|
Subroutine
get_block_parse_error: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||
| 90 | return $self->get_parse_error( | ||||||||||||
| 91 | $message, | ||||||||||||
| 92 | 'Block' => sprintf( | ||||||||||||
| 93 | '%s at line %s' | ||||||||||||
| 94 | , ref $self | ||||||||||||
| 95 | 1 | ▶ | , $self->{'_template_line'} // 'unknown' | ||||||||||
|
Condition50%1/2
$self->{"_template_line"} // "unknown"
MC/DC0%0/1
$self->{"_template_line"} // "unknown"
$self->{"_template_line"}
Truth table50%1/2
A
A= $self->{"_template_line"}
| |||||||||||||
| 96 | ) | ||||||||||||
| 97 | ); | ||||||||||||
| 98 | } | ||||||||||||
| 99 | |||||||||||||
| 100 | 36 | 1; | |||||||||||