Branch Coverage

blib/lib/Language/P/Lexer.pm
Criterion Covered Total %
branch 178 352 50.5


line true false branch
78 171 78 ref $a ? :
240 615 2458 unless length $$buffer
241 64 3009 unless length $$buffer
243 1 3008 if ($$self{'_start_of_line'} and $$buffer =~ s/^#[ \t]*line[ \t]+([0-9]+)(?:[ \t]+"([^"]+)")?[ \t]*[\r\n]//)
246 1 0 if $2
251 0 3008 if $$buffer =~ s/^([ \t]+)// and defined wantarray
252 536 2472 if ($$buffer =~ s/^([\r\n])//)
253 0 536 if defined wantarray
259 19 2453 if ($$buffer =~ s/^(#.*\n)//)
260 0 19 if defined wantarray
267 2453 0 if length $$buffer
270 372 2081 if ($reset_pos)
282 0 0 if ($$buffer =~ /^\]|^\^/)
290 0 0 unless defined $t
292 0 0 if ($t =~ /^\$/) { }
0 0 elsif ($t =~ /^[0-9][0-9]\]/) { }
0 0 elsif ($t =~ /^[0-9]\]/) { }
0 0 elsif ($t =~ /^\$\w+/) { }
307 0 0 $w >= 0 ? :
315 0 32 if ($$buffer =~ s/^->([{[])//) { }
0 32 elsif ($$buffer =~ s/^{//) { }
3 29 elsif ($$buffer =~ s/^\[//) { }
320 0 0 if (not $self->quote->{'interpolated_pattern'}) { }
0 0 elsif ($$buffer =~ /^[0-9]+,[0-9]*}/) { }
330 3 0 if (not $self->quote->{'interpolated_pattern'}) { }
334 0 0 if (_character_class_insanity($self)) { }
353 0 0 unless length $$buffer
355 0 0 unless $$buffer =~ s/^(\#|:|[imsx]*\-[imsx]*:?|!|=|<=|)//x
366 0 0 if ($c eq '\\') { }
0 0 elsif ($c eq '-') { }
0 0 elsif ($c eq ']') { }
369 0 0 if (my $qp = $quoted_pattern{$qc})
386 249 252 if @{$self->tokens;}
391 187 236 unless (length $$buffer)
392 171 16 if (length $v) { }
406 91 1163 if ($pattern or $interpolated_pattern)
407 1 90 if ($c eq '\\') { }
7 83 elsif ($c eq '(' and not $interpolated_pattern) { }
29 54 elsif (not $interpolated_pattern and my $special = $pattern_special{$c}) { }
410 0 1 if (my $qp = $quoted_pattern{$qc})
412 0 0 if ($pattern) { }
422 0 7 if ($nc eq '?') { }
431 11 18 if ($$special[0] == 76)
434 1 10 if ($qc eq '?')
444 36 1218 if ($to_return)
445 24 12 if (length $v) { }
453 165 1053 if ($c eq '\\' and $self->quote->{'interpolate'}) { }
29 1024 elsif ($c =~ /^[\$\@]$/ and $self->quote->{'interpolate'}) { }
456 165 0 if ($qc =~ /^[a-zA-Z]$/) { }
0 0 elsif ($qc =~ /^[0-9]$/) { }
457 165 0 if ($quoted_chars{$qc}) { }
468 0 29 if ($interpolated_pattern and !length($$buffer) || index("()| \r\n\t", substr($$buffer, 0, 1)) != -1) { }
25 4 elsif (length $v) { }
492 0 21 if (@{$self->tokens;})
493 0 0 if $self->tokens->[-1][1] != 1
499 0 21 if ($flags & 1) { }
500 0 0 unless $$_ =~ /^[ \t\r\n]*\w/
502 4 17 unless $$_ =~ /^[ \t\r\n]*[':\w]/
511 0 342 if (@{$self->tokens;})
512 0 0 if $self->tokens->[-1][1] != 1
518 0 342 if defined $$_ and $$_ =~ /^[ \t\r\n]/
521 0 342 unless length $$_
524 0 342 if ($$_ =~ s/^\^([A-Z\[\\\]^_?])//x)
527 342 0 unless $id
530 342 0 unless $id
531 0 341 if ($flags & 1)
535 0 341 defined $1 ? :
536 0 341 defined $1 ? :
539 0 0 defined $1 ? :
545 1 341 unless $id
548 1 341 unless $id
551 0 0 if ($$_ =~ s/^(\w+)//x) { }
559 0 0 if ($$_ =~ s/^}//x) { }
0 0 elsif ($$_ =~ /^\[|^\{/) { }
571 1 341 unless $id
574 1 341 unless $id
578 29 312 if ($id and $self->quote and $$self{'brackets'} == 0)
590 14 233 if ($$_ =~ s/^0([xb]?)//x)
591 0 14 if ($1 eq 'b') { }
0 14 elsif ($1 eq 'x') { }
593 0 0 if ($$_ =~ s/^([01]+)//) { }
603 0 0 if ($$_ =~ s/^([0-9a-fA-F]+)//) { }
613 0 14 if ($$_ =~ s/^([0-7]+)//) { }
616 0 0 if $$_ =~ /^[89]/
625 231 16 if ($$_ =~ s/^(\d+)//x)
630 0 247 if $$_ =~ /^\.\./
631 2 245 if ($$_ =~ s/^\.(\d*)//x)
633 2 0 unless length $num
634 2 0 if length $1
636 0 247 if ($$_ =~ s/^[eE]([+-]?\d+)//x)
663 0 171 if ($op and not $quote_start)
664 0 0 if ($$_ =~ /^[ \t\r\n]/)
669 0 0 if $$_ =~ /^=>/
670 0 0 unless $$_ =~ s/^([^ \t\r\n])//
675 171 0 $quote_start eq $quote_end ? :
681 0 171 unless length $$_
682 0 171 unless length $$_
687 164 1208 if ($c eq '\\') { }
0 1208 elsif ($paired and $c eq $quote_start) { }
171 1037 elsif ($c eq $quote_end) { }
0 1037 elsif ($is_regex and $c eq '$' || $c eq '@' and $quote_start ne q[']) { }
690 0 164 if ($qc eq $quote_start or $qc eq $quote_end) { }
702 171 0 unless $delim_count
708 0 0 if (length $nc and $nc ne $quote_end and index("()| \r\n\t", $nc) == -1)
719 2 169 $quote_start eq q['] ? :
0 171 $op eq 'qw' ? :
0 171 $op eq 'q' ? :
0 171 $op eq 'qq' ? :
724 0 171 $is_regex ? :
734 0 171 if $$token[1] == 8
736 0 171 if (my $op_descr = $regex_flags{$op}) { }
0 171 elsif ($op eq 'qx' or $op eq '`') { }
0 171 elsif ($op eq 'qw') { }
0 171 elsif ($op eq '<') { }
738 0 0 if ($op eq 's' or $op eq 'tr' or $op eq 'y')
739 0 0 $quote_end{$quote} ? :
774 0 0 if ($$_ =~ s/^[ \t]*(['"`])//) { }
780 0 0 if (not $2) { }
788 0 0 if ($$_ =~ s/\\//)
793 0 0 unless $1
800 0 0 if (not $lex->stream) { }
802 0 0 if ($$_ =~ s/(.*)^$end//m)
811 0 0 if ($line eq $end)
819 0 0 unless $finished
821 0 0 $quote eq '`' ? :
827 4700 2174 if @{$self->tokens;}
833 64 2110 unless length $$_
836 247 1863 if $$_ =~ /^\d|^\.\d/
838 0 1863 if $$_ =~ s/^(q|qq|qx|qw|m|qr|s|tr|y)(?=\W)//x
841 0 1863 if ($$_ =~ /^x[0-9]/ and $expect == 3)
848 321 1542 if ($$_ =~ s/^(::)?(\w+)//x)
850 0 321 $1 ? :
854 2 319 $op || $fqual ? :
855 269 50 $kw ? :
2 319 $op ? :
0 321 $fqual ? :
860 0 102 if ($no_space and $$_ =~ /^::/ || ($type == 1 || $type == 2) && $$_ =~ /^'\w/)
864 0 0 defined $1 ? :
866 0 0 if ($ids =~ s/::$//)
873 37 65 if ($no_space and $type == 1 and $$_ =~ /^\(/)
881 0 321 if ($$_ =~ /^=>/) { }
7 314 elsif ($expect == 1 and $type != 2 and $$_ =~ s/^:(?!:)//) { }
883 0 0 if ($type == 2 and $self->symbol_table->get_symbol($ids, '*')) { }
894 0 314 if ($type == 1 and $ids =~ /^__/)
895 0 0 if ($ids eq '__FILE__') { }
0 0 elsif ($ids eq '__LINE__') { }
0 0 elsif ($ids eq '__PACKAGE__') { }
904 2 312 if ($op)
906 0 2 if ($op == 65 and $expect != 3)
914 171 1371 if $$_ =~ s/^(["'`])//x
916 0 1371 if ($$_ =~ /^
919 0 0 if ($1 eq '<') { }
0 0 elsif ($1 eq '<<') { }
926 76 1295 if $$_ =~ s[^(<=|>=|==|!=|=>|-> |=~|!~ |\.\.|\.\.\. |\+\+|\-\- |\+=|\-=|\*=|/= |\&\&|\|\|)][]x
932 287 1008 if ($$_ =~ s/^\$//x)
933 1 286 if ($$_ =~ /^\#/)
936 0 1 if ($id) { }
946 165 843 if ($$_ =~ s/^([{}\[\]])//)
949 81 84 if ($brack eq '[' or $brack eq '{') { }
952 0 78 if ($brack eq '}' and @{$$self{'pending_brackets'};} and $$self{'pending_brackets'}[-1] == $$self{'brackets'})
963 3 81 if ($$self{'brackets'} == 0 and $self->quote)
969 78 87 if ($brack eq '{')
970 0 78 if ($expect == 2) { }
17 61 elsif ($expect == 3) { }
11 50 elsif ($expect != 4) { }
974 0 17 if ($$_ =~ s/^[ \t]*([[:alpha:]_]+)[ \t]*\}//)
982 0 11 if ($$_ =~ /^}/)
988 11 0 if ($$_ =~ /^([\w"'`])/)
996 0 11 if ($$_ =~ /^=>/ or $$_ =~ /^,/ and $$next[1] != 1)
1007 0 843 if ($$_ =~ s[^/][]x)
1008 0 0 if ($expect == 2 or $expect == 1) { }
1015 0 843 if ($$_ =~ s/^-([rwxoRWXOezsfdlpSugkbctTBMMAC])(?=\W)//)
1017 0 0 if ($$_ =~ /^[ \t]*=>/)
1025 843 0 if $$_ =~ s[^([:;,()\?<>!~=/\\\+\-\.\|^\*%\@&])][]x
1033 0 615 unless $stream
1037 551 64 if (defined $l)