Branch Coverage

blib/lib/Marpa/PP/Recognizer.pm
Criterion Covered Total %
branch 192 300 64.0


line true false branch
183 188 0 if (defined($grammar = $$arg_hash{'grammar'}))
188 0 188 unless defined $grammar
193 0 188 unless $grammar_class eq 'Marpa::PP::Grammar'
198 0 188 if ($problems)
207 0 188 if ($phase != 2)
228 0 9 if ($$grammar[7] and $$recce[21] ne 'none' and not $$grammar[6])
247 188 0 unless (defined $$recce[30])
316 1 187 if ($trace_terminals > 1)
318 0 3 unless say {$Marpa::PP::Internal::TRACE_FH;} qq[Expecting "$terminal" at earleme 0]
372 0 251 if (not $ref_type or $ref_type ne 'HASH')
379 0 251 if (my(@bad_options) = grep({not $_ ~~ ['closures', 'end', 'leo', 'max_parses', 'mode', 'ranking_method', 'too_many_earley_items', 'trace_actions', 'trace_earley_sets', 'trace_fh', 'trace_file_handle', 'trace_tasks', 'trace_terminals', 'trace_values', 'warnings'];} keys %{$args;}))
390 4 247 if (defined(my $value = $$args{'leo'}))
391 2 2 $value ? :
395 66 185 if (defined(my $value = $$args{'max_parses'}))
399 18 233 if (defined(my $value = $$args{'mode'}))
400 0 18 unless ($value ~~ ['default', 'stream'])
409 7 244 if (defined(my $value = $$args{'ranking_method'}))
410 0 7 unless $Marpa::PP::AUTHOR_TEST_ONLY
412 0 7 unless $value ~~ ['constant', 'none']
419 1 250 if (defined(my $value = $$args{'trace_fh'}))
425 4 247 if (defined(my $value = $$args{'trace_file_handle'}))
431 0 251 if (defined(my $value = $$args{'trace_actions'}))
435 0 0 if ($value)
436 0 0 unless say {$trace_fh;} 'Setting trace_actions option'
442 0 251 if (defined(my $value = $$args{'trace_tasks'}))
443 0 0 unless $value =~ /\A\d+\z/msx
447 0 0 if ($value)
448 0 0 unless say {$trace_fh;} "Setting trace_tasks option to $value"
454 3 248 if (defined(my $value = $$args{'trace_terminals'}))
457 3 0 if ($value)
458 0 3 unless say {$trace_fh;} 'Setting trace_terminals option'
464 0 251 if (defined(my $value = $$args{'trace_earley_sets'}))
467 0 0 if ($value)
468 0 0 unless say {$trace_fh;} 'Setting trace_earley_sets option'
474 1 250 if (defined(my $value = $$args{'trace_values'}))
478 0 1 if ($value)
479 0 0 unless say {$trace_fh;} 'Setting trace_values option'
485 57 194 if (defined(my $value = $$args{'end'}))
488 0 57 if ($$recce[23] > 0)
498 30 221 if (defined(my $value = $$args{'closures'}))
501 0 30 if ($$recce[23] > 0)
511 0 2546 if ref $closure ne 'CODE'
516 0 251 if (defined(my $value = $$args{'warnings'}))
520 0 251 if (defined(my $value = $$args{'too_many_earley_items'}))
539 0 165 unless defined $earley_set
554 165 0 if defined $ordinal
581 69 1 if wantarray
596 272 0 if ($predecessor)
600 70 202 if (not defined $cause) { }
617 47 0 if ($leo_item)
643 242 109 if (defined $links and @{$links;})
651 272 0 defined $predecessor ? :
655 202 70 defined $cause ? :
660 271 1 defined $token_name ? :
668 0 30 unless $$a[0] <=> $$b[0] or $$a[1] <=> $$b[1]
675 38 313 if (defined $leo_links and @{$leo_links;})
692 0 9 unless $$a[0] <=> $$b[0] or $$a[1] <=> $$b[1]
722 194 9 if ($predecessor)
734 0 216 unless $$a[0] <=> $$b[0]
776 0 79 unless defined $set
782 0 79 unless defined $postdot_set
824 2 2 if (not defined $start_ordinal) { }
829 0 2 if ($start_ordinal < 0 or $start_ordinal > $last_ordinal)
840 3 1 if (not defined $end_ordinal) { }
845 1 0 if ($end_ordinal < 0)
848 0 1 if ($end_ordinal < 0)
881 37 2 if ($origins_count <= 3) { }
894 18 21 if ($position >= $rhs_length) { }
5 16 elsif ($position) { }
903 4 35 if $origins_count > 1
960 0 52 unless ($NFA_states)
972 0 65 if ($$marpa_rule[12])
982 0 65 if (my $chaf_start = $$marpa_rule[12])
988 0 0 $marpa_position >= scalar @{$chaf_rhs;} ? :
1006 1786 1 defined $recce->alternative(@_) ? :
1013 0 1961 unless defined $recce
1020 0 1961 if $recce_class ne 'Marpa::PP::Recognizer'
1036 0 1961 if $$recce[6]
1039 0 1961 if $$recce[7]
1057 0 1961 unless (defined $symbol_name and $$terminal_names{$symbol_name})
1058 0 0 defined $symbol_name ? :
1069 1 1960 unless ($postdot_data)
1070 1 0 if ($trace_terminals)
1071 0 1 unless say {$trace_fh;} qq[Rejected "$symbol_name" at $current_earleme-] . ($length + $current_earleme)
1080 1 1959 if ($length & -2147483648)
1087 0 1959 if ($length <= 0)
1094 0 1959 if $end_earleme & -2147483648
1111 7 2345 if ref $postdot_item eq $Marpa::PP::Recognizer::LEO_CLASS
1119 0 2345 unless scalar @to_states
1128 805 2345 $reset ? :
1132 110 3040 if (defined $target_item) { }
1133 100 10 if $reset
1134 2 8 if ($$postdot_item[0] ~~ [map({$$_[0][0];} @{$$target_item[2];})])
1170 705 2343 if $reset
1178 1897 60 if ($accepted and $target_ix > $$recce[4])
1186 10 1947 if ($trace_terminals)
1187 10 0 $accepted ? :
1188 0 10 unless say {$trace_fh;} qq[$verb "$symbol_name" at $current_earleme-] . ($length + $current_earleme)
1202 0 70 unless defined $recce
1209 0 70 if $recce_class ne 'Marpa::PP::Recognizer'
1218 0 70 unless defined $tokens
1224 0 70 if (defined $token_ix_ref)
1226 0 0 if (ref $token_ix_ref ne 'SCALAR')
1227 0 0 $ref_type ? :
1233 0 0 if $mode ne 'stream'
1246 0 0 if $$recce[6] and scalar @{$tokens;}
1250 0 0 if $$recce[7] and scalar @{$tokens;}
1263 56 14 unless (scalar @{$tokens;})
1285 13 19 unless my $token_args = $$tokens[${$token_ix_ref;}]
1288 0 19 if ref $token_args ne 'ARRAY'
1293 0 19 if $current_token_earleme < $last_completed_earleme
1300 0 19 unless (defined $symbol_id)
1301 0 0 unless say {$trace_fh;} qq[Attempted to add non-existent symbol named "$symbol_name" at $last_completed_earleme\n]
1308 0 19 unless (defined $result)
1309 0 0 unless ($interactive)
1323 0 19 if $offset < 0
1340 0 17 if $next_token_earleme > $current_token_earleme
1348 69 1 if ($mode eq 'stream')
1355 1 69 if ($mode eq 'default')
1423 22048 17267 unless defined $earley_item
1431 1172 16095 if $earleme_to_complete == $parent
1440 909 14062 unless defined $postdot_data
1447 1828 16232 if ($postdot_item_is_leo) { }
1469 1950 18060 $reset ? :
1480 14231 5779 unless (defined $target_item)
1502 1950 18060 if $reset
1503 1828 16232 if ($postdot_item_is_leo) { }
1526 0 22048 if ($too_many_earley_items >= 0 and (my $item_count = scalar @{$earley_items;}) >= $too_many_earley_items)
1530 0 0 if ($$recce[33])
1531 0 0 unless say {$Marpa::PP::Internal::TRACE_FH;} "Very large earley set: $item_count items at location $earleme_to_complete"
1552 0 22048 if ($trace_earley_sets)
1553 0 0 unless print {$Marpa::PP::Internal::TRACE_FH;} "=== Earley set $earleme_to_complete\n"
1556 0 0 unless print {$Marpa::PP::Internal::TRACE_FH;} Marpa::PP::show_earley_set($earley_set)
1573 21978 70 if ($$recce[9])
1576 1651 35358 if scalar @{$postdot_data;} != 1
1585 30424 4934 if ref $leo_lhs
1608 1047 3887 if defined $$leo_item[5]
1624 2268 1619 ref $first_postdot_item eq $Marpa::PP::Recognizer::LEO_CLASS ? :
1631 2268 1619 defined $predecessor_leo_item ? :
1636 1514 2373 if (defined $predecessor_top_to_state)
1648 1619 754 unless (defined $predecessor_leo_item)
1670 0 1047 if $chain_leo_transition_symbol ~~ \@leo_chain
1688 458 589 ref $chain_first_postdot_item eq $Marpa::PP::Recognizer::LEO_CLASS ? :
1696 589 458 unless defined $predecessor_leo_item
1701 165 293 if defined $$predecessor_leo_item[5]
1711 1212 589 $predecessor_leo_item ? :
1716 1212 589 if (defined $chain_predecessor_top_to_state) { }
1754 3 22045 if ($trace_terminals > 1)
1756 0 4 unless say {$Marpa::PP::Internal::TRACE_FH;} qq[Expecting "$terminal" at $earleme_to_complete]
1762 1906 20142 if (scalar @{$earley_items;} > 0)