| 1 | package MDOM::Document::Gmake; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | #use Smart::Comments; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | #use Smart::Comments '###', '####'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use Text::Balanced qw( gen_extract_tagged ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use Makefile::DOM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | #use Data::Dump::Streamer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 15 | ▶ | use base 'MDOM::Node'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 15 | ▶ | use List::MoreUtils qw( before all any ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 15 | ▶ | use List::Util qw( first ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 15 | my %_map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 15 | ▶ | %_map = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | COMMENT => 1, # context for parsing multi-line comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | COMMAND => 2, # context for parsing multi-line commands | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | RULE => 3, # context for parsing rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | VOID => 4, # void context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | UNKNOWN => 5, # context for parsing unexpected constructs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 15 | ▶ | use constant \%_map; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 15 | my %_rev_map = reverse %_map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 15 | my @keywords = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | vpath include sinclude | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ifdef ifndef else endif | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | define endef export unexport | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 15 | my $extract_interp_1 = gen_extract_tagged('\$[(]', '[)]', ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 15 | my $extract_interp_2 = gen_extract_tagged('\$[{]', '[}]', ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sub extract_interp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1523 | ▶ | my ($res) = $extract_interp_1->($_[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract_interp: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1523 | ▶ | if (!$res) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1501 | ($res) = $extract_interp_2->($_[0]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1523 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 15 | my ($context, $saved_context); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 75 | ▶ | my $class = ref $_[0] ? ref shift : shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=20.2
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 75 | my $input = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 75 | ▶ | return undef if !defined $input; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 75 | my $in; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 75 | ▶ | if (ref $input) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 75 | ▶ | open $in, '<', $input or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | open $in, $input or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | die "Can't open $input for reading: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 75 | my $self = $class->SUPER::new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 75 | $self->_tokenize($in); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 75 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | sub _tokenize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 75 | ▶ | my ($self, $fh) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tokenize: called CC=33 SCAR=35.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 75 | $context = VOID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 75 | my @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 75 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ### Tokenizing : $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ### ...with context : $_rev_map{$context} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 165 | s/\r\n/\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 165 | ▶ | $_ .= "\n" if !/\n$/s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 165 | ▶ | if ($context == VOID || $context == RULE) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$context == 4 or $context == 3
MC/DC100%2/2
$context == 4 or $context == 3
$context == 4
$context == 3
Truth table100%3/3
A or B
A= $context == 4B= $context == 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 131 | ▶ | if ($context == VOID && s/(?x) ^ (\t\s*) (?= \# ) //) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$context == 4 and s/(?x) ^ (\t\s*) (?= \# ) //
MC/DC100%2/2
$context == 4 and s/(?x) ^ (\t\s*) (?= \# ) //
$context == 4
s/(?x) ^ (\t\s*) (?= \# ) //
Truth table100%3/3
A and B
A= $context == 4B= s/(?x) ^ (\t\s*) (?= \# ) //
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | ### Found comment in VOID context... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | @tokens = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | MDOM::Token::Whitespace->new($1), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | _tokenize_comment($_) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 4 | ▶ | if ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ### Switching context to COMMENT... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | $saved_context = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | $context = COMMENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | $tokens[-2]->add_content("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 4 | $self->__add_elements( @tokens ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ▶ | elsif ($context == RULE and s/^\t//) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$context == 3 and s/^\t//
MC/DC100%2/2
$context == 3 and s/^\t//
$context == 3
s/^\t//
Truth table100%3/3
A and B
A= $context == 3B= s/^\t//
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ### Found a command in RULE context... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 33 | @tokens = _tokenize_command($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | #warn "*@tokens*"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ### Tokens for the command: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 33 | unshift @tokens, MDOM::Token::Separator->new("\t"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 33 | ▶ | if ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ### Switching context to COMMAND... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 4 | $saved_context = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | $context = COMMAND; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 4 | pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 4 | ▶ | if ($tokens[-1]->class =~ /Bare$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 3 | $tokens[-1]->add_content("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | push @tokens, MDOM::Token::Bare->new("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 33 | my $cmd = MDOM::Command->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 33 | $cmd->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 33 | $self->__add_element($cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ### command (post): $cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 33 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 94 | @tokens = _tokenize_normal($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 94 | ▶ | if (@tokens >= 2 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%6/6
@tokens >= 2 and $tokens[-1]->isa("MDOM::Token::Continuation") and $tokens[-2]->isa("MDOM::Token::Comment")
@tokens >= 2 and $tokens[-1]->isa("MDOM::Token::Continuation")
MC/DC100%3/3
@tokens >= 2 and $tokens[-1]->isa("MDOM::Token::Continuation") and $tokens[-2]->isa("MDOM::Token::Comment")
@tokens >= 2
$tokens[-1]->isa("MDOM::Token::Continuation")
$tokens[-2]->isa("MDOM::Token::Comment")
Truth table100%4/4
A and B and C
A= @tokens >= 2B= $tokens[-1]->isa("MDOM::Token::Continuation")C= $tokens[-2]->isa("MDOM::Token::Comment")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | $tokens[-1]->isa('MDOM::Token::Continuation') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | $tokens[-2]->isa('MDOM::Token::Comment')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | ### Found a trailing comment... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ### Switching conext to COMMENT... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | $saved_context = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | $context = COMMENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | $tokens[-2]->add_content("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | $self->__add_elements( _parse_normal(@tokens) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } elsif ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ### Found a line continuation... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ### Switching context to UNKNOWN... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 12 | $saved_context = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 12 | $context = UNKNOWN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ### Parsing it as a normal line... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 80 | $self->__add_elements( _parse_normal(@tokens) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } elsif ($context == COMMENT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 6 | @tokens = _tokenize_comment($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 6 | ▶ | if ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ### Slurping one more continued comment line... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3 | $tokens[-2]->add_content("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 3 | pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 3 | $self->last_token->add_content(join '', @tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | ### Completing comment slurping... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | ### Switching back to context: _state_str($saved_context) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | $context = $saved_context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3 | my $last = pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | $self->last_token->add_content(join '', @tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 3 | $self->last_token->parent->__add_element($last); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } elsif ($context == COMMAND) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 8 | @tokens = _tokenize_command($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ### more tokens for the cmd: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 8 | ▶ | if ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | ### Slurping one more continued command line... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 4 | $tokens[-2]->add_content("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | for my $token (@tokens) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 12 | ▶ | if ($token->class =~ /Interpolation/ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$token->class =~ /Interpolation/ or $self->last_token->class =~ /Interpolation/
MC/DC100%2/2
$token->class =~ /Interpolation/ or $self->last_token->class =~ /Interpolation/
$token->class =~ /Interpolation/
$self->last_token->class =~ /Interpolation/
Truth table100%3/3
A or B
A= $token->class =~ /Interpolation/B= $self->last_token->class =~ /Interpolation/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $self->last_token->class =~ /Interpolation/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 6 | $self->last_token->parent->__add_element($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 6 | $self->last_token->add_content($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | ### Completing command slurping: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | ### Switching back to context: _state_str($saved_context) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 4 | $context = RULE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 4 | my $last = pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | ### last_token: $self->last_token | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 4 | for my $token (@tokens) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 6 | ▶ | if ($token->class =~ /Interpolation/ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$token->class =~ /Interpolation/ or $self->last_token->class =~ /Interpolation/
MC/DC50%1/2
$token->class =~ /Interpolation/ or $self->last_token->class =~ /Interpolation/
$token->class =~ /Interpolation/
$self->last_token->class =~ /Interpolation/
Truth table66%2/3
A or B
A= $token->class =~ /Interpolation/B= $self->last_token->class =~ /Interpolation/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | $self->last_token->class =~ /Interpolation/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | $self->last_token->parent->__add_element($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 4 | $self->last_token->add_content($token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 4 | $self->last_token->parent->__add_element($last); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } elsif ($context == UNKNOWN) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 20 | push @tokens, _tokenize_normal($_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 20 | ▶ | if (@tokens >= 2 && $tokens[-1]->isa('MDOM::Token::Continuation') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
@tokens >= 2 and $tokens[-1]->isa("MDOM::Token::Continuation") and $tokens[-2]->isa("MDOM::Token::Comment")
@tokens >= 2 and $tokens[-1]->isa("MDOM::Token::Continuation")
MC/DC0%0/3
@tokens >= 2 and $tokens[-1]->isa("MDOM::Token::Continuation") and $tokens[-2]->isa("MDOM::Token::Comment")
@tokens >= 2
$tokens[-1]->isa("MDOM::Token::Continuation")
$tokens[-2]->isa("MDOM::Token::Comment")
Truth table50%2/4
A and B and C
A= @tokens >= 2B= $tokens[-1]->isa("MDOM::Token::Continuation")C= $tokens[-2]->isa("MDOM::Token::Comment")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | $tokens[-2]->isa('MDOM::Token::Comment')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $context = COMMENT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $tokens[-2]->add_content("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | pop @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $self->__add_elements( _parse_normal(@tokens) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | } elsif ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | ### Do nothing here...stay in the UNKNOWN context... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 12 | $self->__add_elements( _parse_normal(@tokens) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 12 | $context = $saved_context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | die "Unkown state: $context"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 75 | ▶ | if ($context != RULE && $context != VOID) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$context != 3 and $context != 4
MC/DC0%0/2
$context != 3 and $context != 4
$context != 3
$context != 4
Truth table66%2/3
A and B
A= $context != 3B= $context != 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | warn "unexpected end of input at line $."; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | sub _tokenize_normal { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 114 | ▶ | local $_ = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tokenize_normal: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 114 | my @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 114 | my $pending_token = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 114 | my $next_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | ### TOKENIZING: $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 114 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | # "token = $pending_token"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | #warn pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | #warn '@tokens = ', _dump_tokens2(@tokens); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 1327 | ▶ | if (/(?x) \G [\s\n]+ /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 286 | $next_token = MDOM::Token::Whitespace->new($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | #push @tokens, $next_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | elsif (/(?x) \G (?: :: | := | \?= | \+= | [=:;] )/gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 77 | $next_token = MDOM::Token::Separator->new($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | elsif (/(?x) \G \| /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # XXX This should be a separator... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 3 | $next_token = MDOM::Token::Bare->new($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | elsif (my $res = extract_interp($_)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 15 | $next_token = MDOM::Token::Interpolation->new($res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | elsif (/(?x) \G \$. /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 7 | $next_token = MDOM::Token::Interpolation->new($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | elsif (/(?x) \G \\ ([\#\\\n:]) /gcs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 24 | my $c = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 24 | ▶ | if ($c eq "\n") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 20 | ▶ | push @tokens, MDOM::Token::Bare->new($pending_token) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | if $pending_token ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 20 | push @tokens, MDOM::Token::Continuation->new("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 20 | return @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 4 | $pending_token .= "\\$c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | elsif (/(?x) \G (\# [^\n]*) \\ \n/sgc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 2 | my $s = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | ▶ | push @tokens, MDOM::Token::Bare->new($pending_token) if $pending_token ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 2 | push @tokens, MDOM::Token::Comment->new($s); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | push @tokens, MDOM::Token::Continuation->new("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2 | return @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } elsif (/(?x) \G \# [^\n]* /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 12 | $next_token = MDOM::Token::Comment->new($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } elsif (/(?x) \G . /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 809 | $pending_token .= $&; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 92 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 1213 | ▶ | if ($next_token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 400 | ▶ | if ($pending_token ne '') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 204 | push @tokens, MDOM::Token::Bare->new($pending_token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 204 | $pending_token = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 400 | push @tokens, $next_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 400 | $next_token = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | ### parse_normal result: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 92 | @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | sub _tokenize_command { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 56 | ▶ | my $s = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tokenize_command: called CC=14 SCAR=26.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 56 | my @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 56 | my $pending_token = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 56 | my $next_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 56 | my $strlen = length $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 56 | ▶ | while ($s =~ /(?x) \G (\s*) ([\@+\-]) /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 16 | my ($whitespace, $modifier) = ($1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 16 | ▶ | if ($whitespace) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 7 | push @tokens, MDOM::Token::Whitespace->new($whitespace); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 16 | push @tokens, MDOM::Token::Modifier->new($modifier); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 56 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 607 | my $last = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 607 | ▶ | if ($s =~ /(?x) \G \n /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 45 | $next_token = MDOM::Token::Whitespace->new("\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | #push @tokens, $next_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | elsif (my $res = extract_interp($s)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 11 | $next_token = MDOM::Token::Interpolation->new($res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | elsif ($s =~ /(?x) \G \$. /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 11 | $next_token = MDOM::Token::Interpolation->new($&); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | elsif ($s =~ /(?x) \G \\ ([\#\\\n:]) /gcs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 12 | my $c = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 12 | ▶ | if ($c eq "\n" && pos $s == $strlen) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$c eq "\n" and pos $s == $strlen
MC/DC100%2/2
$c eq "\n" and pos $s == $strlen
$c eq "\n"
pos $s == $strlen
Truth table100%3/3
A and B
A= $c eq "\n"B= pos $s == $strlen
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 8 | $next_token = MDOM::Token::Continuation->new("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 4 | $pending_token .= "\\$c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | elsif ($s =~ /(?x) \G . /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 472 | $pending_token .= $&; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 56 | $last = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 607 | ▶ | if ($next_token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 75 | ▶ | if ($pending_token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 60 | push @tokens, MDOM::Token::Bare->new($pending_token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 60 | $pending_token = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 75 | push @tokens, $next_token; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 75 | $next_token = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 607 | ▶ | last if $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 56 | ▶ | if ($pending_token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | push @tokens, MDOM::Token::Bare->new($pending_token); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $pending_token = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 56 | @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | sub _tokenize_comment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 10 | ▶ | local $_ = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tokenize_comment: called CC=7 SCAR=20.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 10 | my @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 10 | my $pending_token = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 10 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 134 | ▶ | if (/(?x) \G \n /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 6 | ▶ | push @tokens, MDOM::Token::Comment->new($pending_token) if $pending_token ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 6 | push @tokens, MDOM::Token::Whitespace->new("\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 6 | return @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | #push @tokens, $next_token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | elsif (/(?x) \G \\ ([\\\n#:]) /gcs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 4 | my $c = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 4 | ▶ | if ($c eq "\n") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 4 | ▶ | push @tokens, MDOM::Token::Comment->new($pending_token) if $pending_token ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 4 | push @tokens, MDOM::Token::Continuation->new("\\\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 4 | return @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $pending_token .= "\\$c"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | elsif (/(?x) \G . /gc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 124 | $pending_token .= $&; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | sub _parse_normal { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 94 | ▶ | my @tokens = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_normal: called CC=31 SCAR=34.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | ### fed to _parse_normal: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 94 | my @sep = grep { $_->isa('MDOM::Token::Separator') } @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | #### Separators: @sep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 94 | ▶ | if (@tokens == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 8 | return $tokens[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # filter out significant tokens: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 86 | my ($fst, $snd) = grep { $_->significant } @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 86 | my $is_directive; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 86 | ▶ | if ($fst) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 81 | ▶ | if ($fst eq '-include') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 2 | $fst->set_content('include'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 2 | unshift @tokens, MDOM::Token::Modifier->new('-'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 2 | $is_directive = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | ▶ | elsif ($fst eq 'override' && $snd && $snd eq 'define' || | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
$fst eq "override" and $snd and $snd eq "define" or _is_keyword($fst)
$fst eq "override" and $snd and $snd eq "define"
$fst eq "override" and $snd
MC/DC25%1/4
$fst eq "override" and $snd and $snd eq "define" or _is_keyword($fst)
$fst eq "override"
$snd
$snd eq "define"
_is_keyword($fst)
Truth table42%3/7
A and B and C or D
A= $fst eq "override"B= $sndC= $snd eq "define"D= _is_keyword($fst)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | _is_keyword($fst)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 12 | $is_directive = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 81 | ▶ | if ($is_directive) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | ##### Found directives... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 14 | my $node = MDOM::Directive->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 14 | $node->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 14 | return $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 72 | ▶ | if (@sep >= 2 && $sep[0] =~ /^::?$/ and $sep[1] eq ';') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition83%5/6
@sep >= 2 and $sep[0] =~ /^::?$/ and $sep[1] eq ";"
@sep >= 2 and $sep[0] =~ /^::?$/
MC/DC66%2/3
@sep >= 2 and $sep[0] =~ /^::?$/ and $sep[1] eq ";"
@sep >= 2
$sep[0] =~ /^::?$/
$sep[1] eq ";"
Truth table75%3/4
A and B and C
A= @sep >= 2B= $sep[0] =~ /^::?$/C= $sep[1] eq ";"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | #### Found simple rule with inlined command... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 9 | my $rule = MDOM::Rule::Simple->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 9 | ▶ | my @t = before { $_ eq ';' } @tokens; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 9 | $rule->__add_elements(@t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 9 | splice @tokens, 0, scalar(@t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 9 | my @prefix = shift @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 9 | ▶ | if ($tokens[0] && $tokens[0]->isa('MDOM::Token::Whitespace')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tokens[0] and $tokens[0]->isa("MDOM::Token::Whitespace")
MC/DC50%1/2
$tokens[0] and $tokens[0]->isa("MDOM::Token::Whitespace")
$tokens[0]
$tokens[0]->isa("MDOM::Token::Whitespace")
Truth table66%2/3
A and B
A= $tokens[0]B= $tokens[0]->isa("MDOM::Token::Whitespace")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 6 | push @prefix, shift @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 9 | @tokens = (@prefix, _tokenize_command(join '', @tokens)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 9 | ▶ | if ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $saved_context = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | $context = COMMAND; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 9 | my $cmd = MDOM::Command->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 9 | $cmd->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 9 | $rule->__add_elements($cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 9 | $saved_context = RULE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 9 | ▶ | $context = RULE if $context == VOID; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 9 | return $rule; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | ▶ | elsif (@sep >= 2 && $sep[0] eq ':' and $sep[1] =~ /^::?$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
@sep >= 2 and $sep[0] eq ":" and $sep[1] =~ /^::?$/
@sep >= 2 and $sep[0] eq ":"
MC/DC33%1/3
@sep >= 2 and $sep[0] eq ":" and $sep[1] =~ /^::?$/
@sep >= 2
$sep[0] eq ":"
$sep[1] =~ /^::?$/
Truth table50%2/4
A and B and C
A= @sep >= 2B= $sep[0] eq ":"C= $sep[1] =~ /^::?$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | #### Found static pattern rule... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | my $rule = MDOM::Rule::StaticPattern->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 2 | ▶ | my @t = before { $_ eq ';' } @tokens; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 2 | $rule->__add_elements(@t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 2 | splice @tokens, 0, scalar(@t); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 2 | ▶ | if (@tokens) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 1 | my @prefix = shift @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 1 | ▶ | if ($tokens[0] && $tokens[0]->isa('MDOM::Token::Whitespace')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tokens[0] and $tokens[0]->isa("MDOM::Token::Whitespace")
MC/DC0%0/2
$tokens[0] and $tokens[0]->isa("MDOM::Token::Whitespace")
$tokens[0]
$tokens[0]->isa("MDOM::Token::Whitespace")
Truth table33%1/3
A and B
A= $tokens[0]B= $tokens[0]->isa("MDOM::Token::Whitespace")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | push @prefix, shift @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | @tokens = (@prefix, _tokenize_command(join '', @tokens)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | ▶ | if ($tokens[-1]->isa('MDOM::Token::Continuation')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $saved_context = $context; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | $context = COMMAND; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 1 | my $cmd = MDOM::Command->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | $cmd->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 1 | $rule->__add_elements($cmd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 2 | $saved_context = RULE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 2 | ▶ | $context = RULE if $context == VOID; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | return $rule; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | ▶ | elsif (@sep == 1 && $sep[0] =~ /^::?$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@sep == 1 and $sep[0] =~ /^::?$/
MC/DC100%2/2
@sep == 1 and $sep[0] =~ /^::?$/
@sep == 1
$sep[0] =~ /^::?$/
Truth table100%3/3
A and B
A= @sep == 1B= $sep[0] =~ /^::?$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | #### Found simple rule without inlined command... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 36 | my $rule = MDOM::Rule::Simple->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 36 | $rule->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 36 | $saved_context = RULE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 36 | ▶ | $context = RULE if $context == VOID; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 36 | return $rule; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | ▶ | elsif (@sep && $sep[0] =~ /(?x) ^ (?: = | := | \+= | \?= ) $/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
@sep and $sep[0] =~ /(?x) ^ (?: = | := | \+= | \?= ) $/
MC/DC50%1/2
@sep and $sep[0] =~ /(?x) ^ (?: = | := | \+= | \?= ) $/
@sep
$sep[0] =~ /(?x) ^ (?: = | := | \+= | \?= ) $/
Truth table66%2/3
A and B
A= @sepB= $sep[0] =~ /(?x) ^ (?: = | := | \+= | \?= ) $/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 15 | my $assign = MDOM::Assignment->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | ### Assignment tokens: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 15 | $assign->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 15 | $saved_context = VOID; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 15 | ▶ | $context = VOID if $context == RULE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 15 | return $assign; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | elsif (all { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 20 | ▶ | $_->isa('MDOM::Token::Comment') || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | $_->isa('MDOM::Token::Whitespace') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } @tokens) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 5 | @tokens; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | #### Found unkown token sequence: @tokens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 5 | @tokens = _tokenize_command(join '', @tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 5 | my $node = MDOM::Unknown->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 5 | $node->__add_elements(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 5 | $node; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | sub _dump_tokens { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | my @tokens = map { $_->clone } @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump_tokens: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | warn "??? ", (join ' ', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | map { s/\\/\\\\/g; s/\n/\\n/g; s/\t/\\t/g; "[$_]" } @tokens | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | ), "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | sub _state_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | $_rev_map{$saved_context} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_state_str: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | sub _is_keyword { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 777 | ▶ | any { $_[0] eq $_ } @keywords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
_is_keyword: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||