Branch Coverage

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


line true false branch
122 0 739 if ref $class
128 0 739 if (exists $args{'default_modifiers'} and "ARRAY" ne ref $args{'default_modifiers'})
166 11 728 if (__instance($re, 'PPI::Element')) { }
2 726 elsif (ref $re) { }
167 0 11 unless is_ppi_regexp_element($re)
172 0 11 $re->isa('PPI::Token::HereDoc') ? :
189 0 737 if $self->{'trace'}
207 21 691 unless $self->{'capture'}
208 0 691 unless defined wantarray
209 691 0 wantarray ? :
219 0 10177 unless defined $name
221 0 10177 if ($self->{'trace'})
225 9456 721 unless @args
227 593 128 if ('CODE' eq ref $cookie) { }
0 128 elsif (defined $cookie) { }
245 0 57 unless defined $name
258 8 324 unless "HASH" eq ref $self->{'effective_modifiers'}
271 0 330 unless @args
274 2602 0 / \A PPIx::Regexp:: /msx ? :
321 317 5805 if ($char eq '\\' and $finish ne '\\') { }
1 5804 elsif ($bracketed and $char eq $start) { }
582 5222 elsif ($char eq $finish) { }
327 581 1 if --$nest < 0
337 0 16631 unless "Regexp" eq ref $regexp
341 3620 13011 unless defined $self->{'find'}
343 14791 1840 unless $self->{'find'} =~ /$regexp/msx
348 3758 489 if (defined $-[$inx] and defined $+[$inx]) { }
368 0 1840 wantarray ? :
385 0 4114 unless caller eq "PPIx::Regexp::Tokenizer" or $self->{'cursor_curr'} > $self->{'cursor_orig'}
396 0 4114 unless my $code = $self->can($handler)
405 0 4114 if $self->{'trace'}
417 222 4994 unless defined $class
419 0 5216 if ($length + $self->{'cursor_curr'} > $self->{'cursor_limit'})
421 0 0 unless $length = $self->{'cursor_limit'} - $self->{'cursor_curr'}
424 0 5216 unless $class =~ / \A PPIx::Regexp:: /msx
432 0 5216 if $self->{'trace'}
433 0 5216 if $self->{'trace'} > 1
438 5073 143 unless $arg
0 5216 unless my $token = $class->__new($content, "tokenizer", $self, %{{} unless $arg;})
442 94 5122 if $self->{'index_locations'}
445 5053 163 if $token->significant
447 37 5179 if $token->isa("PPIx::Regexp::Token::Unknown")
457 56 3559 unless &$cookie($self, $token)
464 5053 163 if $token->significant
502 282 6 if @{$self->{'modifiers'};} > 1
509 3 7 if exists $mod->{$modifier}
520 5214 4633 if (@{$self->{'pending'};})
524 1091 3542 if ($self->{'cursor_curr'} >= $self->{'cursor_limit'})
526 536 555 if $self->{'cursor_limit'} >= length $self->{'content'}
527 0 555 if $self->{'mode'} eq "finish"
532 4097 0 if (my(@tokens) = $self->get_token)
546 65 314 unless defined $offset
547 0 379 if $offset < 0
549 0 379 if $offset >= $self->{'cursor_limit'}
556 0 83 unless defined $self->{'find'}
563 19 2394 unless defined $method
567 0 2394 unless $self->{'prior_significant_token'}->can($method)
597 144 4 if (not defined $iterator) { }
4 0 elsif ($iterator->isa('PPI::Element')) { }
0 0 elsif ('CODE' ne ref $iterator) { }
601 2 142 if $self->{'index_locations'}
605 125 19 unless $ppi->find("PPI::Token::Operator")
607 135 15 unless my $op = shift @ops
629 4 15 unless $elem->isa("PPI::Token::Cast")
632 10 5 if ($content =~ / ( .* ) \* \z /msx) { }
5 0 elsif ($accept->{$content}) { }
635 8 2 if $accept->{$1}
640 0 5 unless my $next = $elem->snext_sibling
642 0 5 unless $next->isa("PPI::Structure::Subscript")
671 328 2697 if ($self->{'expect_next'})
675 334 2691 if ($self->{'expect'})
681 2487 538 if exists $self->{'known'}{$mode}
698 189 8367 unless $class->can($handler)
775 0 3620 if $self->{'cursor_curr'} > $self->{'cursor_limit'}
795 0 1644 if $self->{'trace'}
797 534 1110 if ("kaput" eq $mode)
806 8 2 unless defined $err
818 2 105 if $token->{'location'}
823 11 1 if (__instance($self->{'source'}, "PPI::Element"))
825 11 0 if (my $doc = $self->{'source'}->document)
833 0 105 unless $loc->{'location'}
835 105 0 if (defined(my $content = $token->content))
840 2 103 if (pos $content)
847 102 3 if (my $chars = length($content) - pos($content))
849 5 97 if ($loc->{'tab_width'} > 1 and $content =~ / \t /msx) { }
855 5 5 if ($part eq "\t") { }
875 0 534 unless $self->find_regexp(qr/ \A ( \s* ) ( qr | m | s )? ( \s* ) ( . ) /msx)
881 388 146 unless defined $type
884 6 528 unless $type or $delim_start =~ m[ \A [/?] \z ]msx
887 2 144 if $type and not $next_white and $delim_start =~ / \A \w \z /msx
896 1 525 if "" ne $leading_white
901 8 518 if "" ne $next_white
908 0 526 if $self->{'trace'}
910 526 0 if (my $offset = $self->find_matching_delimiter) { }
913 0 526 if $self->{'trace'}
914 43 483 if ($self->__number_of_extra_parts) { }
916 7 36 if ($self->close_bracket($self->{'delimiter_start'})) { }
945 0 43 if $self->{'trace'}
946 41 2 if (my $s_off = $self->find_matching_delimiter) { }
950 0 41 if $self->{'trace'}
956 0 2 if $self->{'trace'}
1001 1 523 if (my $len = $self->find_regexp(qr/ \A \s+ /msx))
1005 1 523 if (my $len = $self->find_regexp(qr/ \A .+ /msx))
1041 0 0 unless $self->find_regexp(qr/ \A ( \s* ) ( qr | m | s )? ( \s* ) (?: [^\w\s] ) /msx)
1047 0 0 unless defined $type
1054 0 0 if "" ne $leading_white
1059 0 0 if "" ne $next_white
1103 0 13467 if $self->{'trace'}
1107 729 2293 ref $_ ? :
2998 10469 if @tokens
1124 2 16 if ($character eq "\\" and $self->{'cursor_limit'} - $self->{'cursor_curr'} > 1)
1141 5 4 if ($character eq "\\" and defined(my $next = $self->peek(1)))
1144 0 0 if ($self->interpolates or $next eq "'" or $next eq "\\")
1158 0 555 if $self->{'cursor_limit'} > length $self->{'content'}
1163 514 41 if ($self->{'cursor_curr'} == $self->{'cursor_modifiers'}) { }
1183 7 34 if ($self->close_bracket($self->{'delimiter_start'}))
1201 3 4 if $accept = $self->find_regexp(qr/ \A \s+ /msx)
1214 10 31 if ($self->modifier('e*')) { }
1242 11 513 if ($self->{'index_locations'})