Branch Coverage

blib/lib/Marpa/R2/Recognizer.pm
Criterion Covered Total %
branch 151 242 62.4


line true false branch
47 5 211 if (defined($value = $arg_hash->{'trace_file_handle'}))
51 216 0 if (defined($value = $arg_hash->{'grammar'}))
56 0 216 unless defined $grammar
65 0 216 unless $grammar_class eq "Marpa::R2::Grammar"
73 0 216 if ($problems)
83 0 216 unless (defined $recce_c)
85 0 0 if ($error_code == $Marpa::R2::Error::NOT_PRECOMPUTED)
94 213 0 if (defined $grammar->[15] or defined $grammar->[5] or not defined $grammar->[11])
103 7 209 if (defined(my $value = $arg_hash->{'leo'}))
104 3 4 $value ? :
111 2 214 if (defined(my $value = $arg_hash->{'event_if_expected'}))
112 0 2 if ref $value ne "ARRAY"
117 0 18 unless defined $symbol_id
138 0 216 unless ($recce_c->start_input)
146 1 215 if ($recce->[21] > 1)
149 0 1 unless say {$Marpa::R2::Internal::TRACE_FH;} qq[Expecting "$terminal" at earleme 0]
182 46 1240 if (defined $package_source and $package_source ne "legacy")
219 0 1310 if (not $ref_type or $ref_type ne "HASH")
251 0 1310 if (my(@bad_options) = grep({not exists $recognizer_options->{$_};} keys %{$args;}))
260 0 1310 if (defined(my $value = $args->{'event_if_expected'}))
266 0 1310 if (defined(my $value = $args->{'leo'}))
271 84 1226 if (defined(my $value = $args->{'max_parses'}))
275 104 1206 if (defined(my $value = $args->{'semantics_package'}))
278 0 104 if (defined $recce->[1])
286 0 104 if ($recce->[31] ne "semantics_package")
299 96 1214 if (defined(my $value = $args->{'ranking_method'}))
302 0 96 if (defined $recce->[1])
311 0 96 unless exists $ranking_methods->{$value}
316 4 1306 if (defined(my $value = $args->{'trace_fh'}))
322 1 1309 if (defined(my $value = $args->{'trace_file_handle'}))
328 0 1310 if (defined(my $value = $args->{'trace_actions'}))
330 0 0 if ($value)
331 0 0 unless say {$trace_fh;} "Setting trace_actions option"
336 0 1310 if (defined(my $value = $args->{'trace_and_nodes'}))
337 0 0 unless $value =~ /\A\d+\z/msx
342 0 0 if ($value)
343 0 0 unless say {$trace_fh;} "Setting trace_and_nodes option to $value"
348 0 1310 if (defined(my $value = $args->{'trace_bocage'}))
349 0 0 unless $value =~ /\A\d+\z/msx
353 0 0 if ($value)
354 0 0 unless say {$trace_fh;} "Setting trace_bocage option to $value"
359 0 1310 if (defined(my $value = $args->{'trace_or_nodes'}))
360 0 0 unless $value =~ /\A\d+\z/msx
365 0 0 if ($value)
366 0 0 unless say {$trace_fh;} "Setting trace_or_nodes option to $value"
371 5 1305 if (defined(my $value = $args->{'trace_terminals'}))
372 5 0 &Scalar::Util::looks_like_number($value) ? :
374 5 0 if ($value)
375 0 5 unless say {$trace_fh;} "Setting trace_terminals option"
380 0 1310 if (defined(my $value = $args->{'trace_earley_sets'}))
383 0 0 if ($value)
384 0 0 unless say {$trace_fh;} "Setting trace_earley_sets option"
389 4 1306 if (defined(my $value = $args->{'trace_values'}))
391 3 1 if ($value)
392 0 3 unless say {$trace_fh;} "Setting trace_values option"
397 90 1220 if (defined(my $value = $args->{'end'}))
400 0 90 if (defined $recce->[1])
407 35 1275 if (defined(my $value = $args->{'closures'}))
410 0 35 if (defined $recce->[1])
418 0 2980 if ref $closure ne "CODE"
423 0 1310 if (defined(my $value = $args->{'warnings'}))
427 2 1308 if (defined(my $value = $args->{'too_many_earley_items'}))
479 0 7 unless defined $symbol_id
495 3 204 unless (defined $ordinal_arg)
499 0 204 if ($ordinal_arg > $latest_earley_set)
506 196 8 if ($ordinal_arg >= 0)
513 0 8 if $ordinal < 0
522 207 20497 unless defined $item[0]
536 2 2 unless (defined $start_ordinal)
539 0 4 if ($start_ordinal < 0) { }
543 0 4 if ($start_ordinal < 0 or $start_ordinal > $last_ordinal)
550 3 1 if (not defined $end_ordinal) { }
555 1 0 if ($end_ordinal < 0)
558 0 1 if ($end_ordinal < 0)
572 34 21 if ($position < 0)
585 29 2 if ($origins_count <= 3) { }
596 14 17 if ($position >= $rhs_length) { }
5 12 elsif ($position) { }
605 4 27 if $origins_count > 1
621 2 2274 unless $recce->alternative($symbol_name, \$value)
629 0 4264 if not defined $recce or ref $recce ne "Marpa::R2::Recognizer"
634 0 4264 unless defined $symbol_name
639 0 4264 if $recce->[6]
652 0 4264 unless (defined $symbol_id)
659 270 3994 unless defined $value_ref
661 0 0 if ($ref_type ne "SCALAR" and $ref_type ne "REF" and $ref_type ne "VSTRING")
668 345 3649 unless defined $value
679 13 4251 if ($trace_terminals)
680 10 3 $result == $Marpa::R2::Error::NONE ? :
683 0 13 unless say {$trace_fh;} qq[$verb "$symbol_name" at $current_earleme-] . ($length + $current_earleme)
688 3979 285 if $result == $Marpa::R2::Error::NONE
693 1 3 if $result == $Marpa::R2::Error::UNEXPECTED_TOKEN_ID or $result == $Marpa::R2::Error::NO_TOKEN_EXPECTED_HERE or $result == $Marpa::R2::Error::INACCESSIBLE_TOKEN
733 5 111 if ($event_type eq "MARPA_EVENT_EARLEY_ITEM_THRESHOLD")
735 0 5 unless say {$recce->[9];} "Earley item count ($value) exceeds warning threshold"
741 78 33 if ($event_type eq "MARPA_EVENT_SYMBOL_EXPECTED")
746 33 0 if ($event_type eq "MARPA_EVENT_EXHAUSTED")
764 80 22324 $event_count ? :
767 0 22404 if ($recce->[19])
769 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} "=== Earley set $latest_set\n"
771 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} Marpa::R2::show_earley_set($recce, $latest_set)
778 3 22401 if ($trace_terminals > 1)
782 0 3 unless say {$Marpa::R2::Internal::TRACE_FH;} qq[Expecting "$terminal" at $current_earleme]
808 9 9 if ($reversed)
814 0 127 if $length <= 0
819 9 9 if $reversed
823 18 10 if $escaped_chars[$ix] ne " "
855 693 1301 if ($dot_position < 0)
865 482 188 unless defined $leo_base_state
876 185 3 if (defined $predecessor_symbol_id)
893 0 0 unless defined $leo_base_state
925 101 0 if (defined $predecessor_ahm)
961 236 0 if (defined $predecessor_state)
1006 73 697 unless defined $ahm_id_of_yim
1039 0 0 unless $Marpa::R2::Internal::Recognizer::a->[0] <=> $Marpa::R2::Internal::Recognizer::b->[0] or $Marpa::R2::Internal::Recognizer::a->[1] <=> $Marpa::R2::Internal::Recognizer::b->[1]
1061 0 27 unless $Marpa::R2::Internal::Recognizer::a->[0] <=> $Marpa::R2::Internal::Recognizer::b->[0] or $Marpa::R2::Internal::Recognizer::a->[1] <=> $Marpa::R2::Internal::Recognizer::b->[1]
1083 0 0 unless $Marpa::R2::Internal::Recognizer::a->[0] <=> $Marpa::R2::Internal::Recognizer::b->[0] or $Marpa::R2::Internal::Recognizer::a->[1] <=> $Marpa::R2::Internal::Recognizer::b->[1]
1087 338 359 if @pieces
1096 8 73 unless (defined $recce_c->_marpa_r_earley_set_trace($traced_set_id))
1101 73 697 unless defined $item_desc
1117 482 188 unless defined $leo_item_desc
1134 8 73 unless $set_desc