Branch Coverage

blib/lib/PPIx/Regexp/Tokenizer.pm
Criterion Covered Total %
branch 177 238 74.3


line true false branch
123 0 742 if ref $class
129 0 742 if (exists $args{'default_modifiers'} and "ARRAY" ne ref $args{'default_modifiers'})
167 11 731 if (__instance($re, 'PPI::Element')) { }
2 729 elsif (ref $re) { }
168 0 11 unless is_ppi_regexp_element($re)
173 0 11 $re->isa('PPI::Token::HereDoc') ? :
190 0 740 if $self->{'trace'}
208 21 694 unless $self->{'capture'}
209 0 694 unless defined wantarray
210 694 0 wantarray ? :
220 0 10182 unless defined $name
222 0 10182 if ($self->{'trace'})
226 9461 721 unless @args
228 593 128 if ('CODE' eq ref $cookie) { }
0 128 elsif (defined $cookie) { }
246 0 57 unless defined $name
259 8 326 unless "HASH" eq ref $self->{'effective_modifiers'}
272 0 330 unless @args
275 2602 0 / \A PPIx::Regexp:: /msx ? :
322 317 5827 if ($char eq '\\' and $finish ne '\\') { }
1 5826 elsif ($bracketed and $char eq $start) { }
588 5238 elsif ($char eq $finish) { }
328 587 1 if --$nest < 0
338 0 16627 unless "Regexp" eq ref $regexp
342 3623 13004 unless defined $self->{'find'}
344 14779 1848 unless $self->{'find'} =~ /$regexp/msx
349 3778 489 if (defined $-[$inx] and defined $+[$inx]) { }
369 0 1848 wantarray ? :
386 0 4133 unless caller eq __PACKAGE__ or $self->{'cursor_curr'} > $self->{'cursor_orig'}
397 0 4133 unless my $code = $self->can($handler)
406 0 4133 if $self->{'trace'}
418 222 5021 unless defined $class
420 0 5243 if ($length + $self->{'cursor_curr'} > $self->{'cursor_limit'})
422 0 0 unless $length = $self->{'cursor_limit'} - $self->{'cursor_curr'}
425 0 5243 unless $class =~ / \A PPIx::Regexp:: /msx
433 0 5243 if $self->{'trace'}
434 0 5243 if $self->{'trace'} > 1
439 5099 144 unless $arg
0 5243 unless my $token = $class->__new($content, "tokenizer", $self, %{{} unless $arg;})
443 94 5149 if $self->{'index_locations'}
446 5078 165 if $token->significant
448 37 5206 if $token->isa("PPIx::Regexp::Token::Unknown")
458 56 3559 unless &$cookie($self, $token)
465 5078 165 if $token->significant
503 282 6 if @{$self->{'modifiers'};} > 1
510 3 7 if exists $mod->{$modifier}
521 5241 4655 if (@{$self->{'pending'};})
525 1099 3556 if ($self->{'cursor_curr'} >= $self->{'cursor_limit'})
527 539 560 if $self->{'cursor_limit'} >= length $self->{'content'}
528 0 560 if $self->{'mode'} eq "finish"
533 4116 0 if (my(@tokens) = $self->get_token)
547 65 314 unless defined $offset
548 0 379 if $offset < 0
550 0 379 if $offset >= $self->{'cursor_limit'}
557 0 83 unless defined $self->{'find'}
564 19 2394 unless defined $method
568 0 2394 unless $self->{'prior_significant_token'}->can($method)
598 145 4 if (not defined $iterator) { }
4 0 elsif ($iterator->isa('PPI::Element')) { }
0 0 elsif ('CODE' ne ref $iterator) { }
602 2 143 if $self->{'index_locations'}
606 126 19 unless $ppi->find("PPI::Token::Operator")
608 136 15 unless my $op = shift @ops
630 4 15 unless $elem->isa("PPI::Token::Cast")
633 10 5 if ($content =~ / ( .* ) \* \z /msx) { }
5 0 elsif ($accept->{$content}) { }
636 8 2 if $accept->{$1}
641 0 5 unless my $next = $elem->snext_sibling
643 0 5 unless $next->isa("PPI::Structure::Subscript")
672 328 2708 if ($self->{'expect_next'})
676 334 2702 if ($self->{'expect'})
682 2493 543 if exists $self->{'known'}{$mode}
699 203 8408 unless $class->can($handler)
776 0 3623 if $self->{'cursor_curr'} > $self->{'cursor_limit'}
796 0 1657 if $self->{'trace'}
798 537 1120 if ("kaput" eq $mode)
807 8 2 unless defined $err
819 2 105 if $token->{'location'}
824 11 1 if (__instance($self->{'source'}, "PPI::Element"))
826 11 0 if (my $doc = $self->{'source'}->document)
834 0 105 unless $loc->{'location'}
836 105 0 if (defined(my $content = $token->content))
841 2 103 if (pos $content)
848 102 3 if (my $chars = length($content) - pos($content))
850 5 97 if ($loc->{'tab_width'} > 1 and $content =~ / \t /msx) { }
856 5 5 if ($part eq "\t") { }
876 0 537 unless $self->find_regexp(qr/ \A ( \s* ) ( qr | m | s )? ( \s* ) ( . ) /msx)
882 388 149 unless defined $type
885 6 531 unless $type or $delim_start =~ m[ \A [/?] \z ]msx
888 2 147 if $type and not $next_white and $delim_start =~ / \A \w \z /msx
897 1 528 if "" ne $leading_white
902 8 521 if "" ne $next_white
909 0 529 if $self->{'trace'}
911 529 0 if (my $offset = $self->find_matching_delimiter) { }
914 0 529 if $self->{'trace'}
915 46 483 if ($self->__number_of_extra_parts) { }
917 7 39 if ($self->close_bracket($self->{'delimiter_start'})) { }
946 0 46 if $self->{'trace'}
947 44 2 if (my $s_off = $self->find_matching_delimiter) { }
951 0 44 if $self->{'trace'}
957 0 2 if $self->{'trace'}
1002 1 526 if (my $len = $self->find_regexp(qr/ \A \s+ /msx))
1006 1 526 if (my $len = $self->find_regexp(qr/ \A .+ /msx))
1042 0 0 unless $self->find_regexp(qr/ \A ( \s* ) ( qr | m | s )? ( \s* ) (?: [^\w\s] ) /msx)
1048 0 0 unless defined $type
1055 0 0 if "" ne $leading_white
1060 0 0 if "" ne $next_white
1104 0 13478 if $self->{'trace'}
1108 731 2302 ref $_ ? :
3009 10469 if @tokens
1125 2 16 if ($character eq "\\" and $self->{'cursor_limit'} - $self->{'cursor_curr'} > 1)
1142 5 4 if ($character eq "\\" and defined(my $next = $self->peek(1)))
1145 0 0 if ($self->interpolates or $next eq "'" or $next eq "\\")
1159 0 560 if $self->{'cursor_limit'} > length $self->{'content'}
1164 516 44 if ($self->{'cursor_curr'} == $self->{'cursor_modifiers'}) { }
1184 7 37 if ($self->close_bracket($self->{'delimiter_start'}))
1202 3 4 if $accept = $self->find_regexp(qr/ \A \s+ /msx)
1215 11 33 if ($self->modifier('e*')) { }
1243 11 516 if ($self->{'index_locations'})