Branch Coverage

blib/lib/Marpa/R2/Value.pm
Criterion Covered Total %
branch 361 544 66.3


line true false branch
37 0 0 unless defined $rank_ref
38 0 0 if $rank_ref == -1
54 1001 28833 unless defined $closure_name
56 0 28833 if ($closure_name eq "")
57 0 0 if defined $p_error
62 16 28817 if $closure_name eq "::undef"
63 24397 4420 if (substr($closure_name, 0, 2) eq "::" or substr($closure_name, 0, 1) eq "[")
69 2994 1426 if (my $closure = $closures->{$closure_name})
70 0 2994 if ($trace_actions)
71 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} qq[Resolved "$closure_name" to explicit closure\n]
80 762 664 if ($closure_name =~ /([:][:])|[']/msx)
84 664 762 unless ($fully_qualified_name)
87 0 664 unless (defined $resolve_package)
109 1262 164 if (defined $closure)
119 35 129 if (defined $closure and defined ${$closure;})
135 1297 129 if (defined $closure)
136 0 1297 if ($trace_actions)
137 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} qq[Successful resolution of action "$closure_name" as $type ], "to ", $fully_qualified_name, "\n"
145 129 0 if ($trace_actions or defined $p_error)
148 0 516 if (defined *{$fully_qualified_name;}{$slot})
152 0 0 if ($trace_actions)
153 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} $error
157 0 0 if defined $p_error
166 129 0 if defined $p_error
167 0 129 if ($trace_actions)
168 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} $error
183 36940 3887 unless defined $semantics
194 8825 22057 unless defined $blessing
195 8825 22057 if $blessing eq "::undef"
199 0 22057 unless (defined $bless_package)
215 37189 3638 unless defined $blessing
216 0 3638 if $blessing eq "::undef"
217 0 3638 if ($blessing =~ /\A [:][:] /msx)
224 0 3638 if ($blessing =~ / [:][:] /msx)
229 0 3638 unless (defined $bless_package)
251 2 2 if (scalar @_ == 1 and ref $_[0])
265 0 2 unless defined $valuator
286 10 50 if ($arg eq "fatal_error")
287 10 40 if ($arg eq "grammar")
288 10 30 if ($arg eq "where")
289 10 20 if ($arg eq "long_where")
290 10 10 if ($arg eq "warnings")
291 10 0 if ($arg eq "eval_ok")
301 6 4 unless $fatal_error_ref_type
302 4 0 if ($fatal_error_ref_type eq $CONTEXT_EXCEPTION_CLASS)
304 2 2 if defined $exception_object
306 2 0 if defined $exception_message
332 0 6 if ($false_eval)
336 4 2 if ($fatal_error)
339 2 4 if ($warnings_count)
344 0 6 unless (scalar @problems)
360 4 2 if ($fatal_error)
383 0 0 if ($op_name eq "bless")
388 0 0 if ($op_name eq "push_constant")
393 0 0 if ($op_name eq "push_one")
398 0 0 if ($op_name eq "result_is_rhs_n")
403 0 0 if ($op_name eq "result_is_n_of_sequence")
408 0 0 if ($op_name eq "result_is_constant")
413 0 0 if ($op_name eq "alternative")
428 0 1398 if $recce->[26]
430 218 1180 if $ordering
441 20 1160 unless ($bocage)
451 95 1065 if ($ranking_method eq "high_rule_only")
455 4 1061 if ($ranking_method eq "rule")
471 2408 28475 unless defined $action_name
475 1 28474 unless ($resolution)
491 1 0 if $Marpa::R2::Context::slr
511 80 738 if (not defined $package_source and defined $per_parse_arg and my $arg_blessing = &Scalar::Util::blessed($per_parse_arg))
523 237 923 if ($package_source eq "legacy")
532 237 923 $package_source eq 'legacy' ? :
536 971 189 unless defined $constructor_package
542 61 128 if ($resolution)
547 128 0 if $package_source ne "legacy"
560 0 1160 unless $default_action_resolution
568 10 1150 if ($default_empty_action)
572 0 10 unless $default_empty_action_resolution
584 13 2395 if (not defined $rule_resolution and $default_empty_action and $grammar_c->rule_length($rule_id) == 0)
593 0 30882 unless ($rule_resolution)
599 0 0 if defined $action
603 0 0 if defined $recce_error
614 22057 8825 if ($blessing ne "::undef")
615 0 22057 if $semantics eq "::!default"
617 94 21963 if $semantics eq "::array"
619 21963 0 if substr($semantics, 0, 1) eq "["
634 0 1159 if ($trace_actions >= 2)
638 0 0 unless say {$trace_file_handle;} "Rule ", $grammar->brief_rule($rule_id), qq[ resolves to "$resolution_name"]
650 0 40827 unless (defined $semantics)
663 0 40827 unless (defined $blessing)
715 22538 7976 if ("[" eq substr($semantics, 0, 1) and "]" eq substr($semantics, -1, 1))
730 7976 0 if $allowed_semantics->{$semantics}
732 0 0 if $semantics =~ / \A rhs \d+ \z /msx
748 8577 21937 if $blessing eq "::undef"
749 0 21937 if ($closure)
751 0 0 if ($ref_type eq "SCALAR")
768 94 21843 if $semantics eq "::array"
769 21843 0 if substr($semantics, 0, 1) eq "["
790 2110 28404 if $grammar_c->rule_is_nullable($rule_id)
801 29032 2100 unless defined $rule_ids
805 0 2100 if $rule_count <= 0
808 2090 10 if ($rule_count == 1)
812 0 2090 if ($trace_actions)
814 0 0 unless say {$trace_file_handle;} qq[Nulled symbol "$lhs_name" ], qq[ resolved to "$resolution_name" from rule ], $grammar->brief_rule($resolution_rule)
828 9 1 if (scalar @empty_rules)
832 0 9 if ($trace_actions)
834 0 0 unless say {$trace_file_handle;} qq[Nulled symbol "$lhs_name" ], qq[ resolved to "$resolution_name" from rule ], $grammar->brief_rule($resolution_rule)
857 0 1 if ($first_closure_name ne $other_closure_name or $first_semantics ne $other_semantics or $first_blessing ne $other_blessing)
879 0 1 if ($trace_actions)
881 0 0 unless say {$trace_file_handle;} qq[Nulled symbol "$lhs_name" ], qq[ resolved to "$resolution_name" from rule ], $grammar->brief_rule($resolution_rule)
909 0 40403 unless ($semantics)
913 3861 36542 if (substr($semantics, 0, 1) eq "[")
920 0 36542 unless ($allowed_semantics->{$semantics})
931 0 40403 unless ($blessing)
935 36789 3614 if $blessing eq "::undef"
937 3614 0 if $blessing =~ /\A [[:alpha:]] [:\w]* \z /msx
979 29032 2100 unless defined $semantic_rule
989 1721 28793 if $semantics eq "::!default"
990 4994 25520 if $semantics eq "::array"
991 28 30486 if $semantics eq "::whatever"
992 1214 29300 if $semantics eq "::first"
1002 36542 3861 if $semantics eq "::!default"
1003 0 40403 if $semantics eq "::array"
1020 30514 40403 if (defined $rule_id)
1033 4531 66386 if (defined $closure and ref $closure eq "CODE")
1039 26862 39524 if (substr($semantics, 0, 1) eq "[")
1049 1768 69149 if ($semantics eq "::undef")
1055 40403 28746 unless defined $rule_id
1057 24180 4566 unless defined $thingy_ref
1059 0 4566 if ($ref_type eq "")
1069 4531 35 if ($ref_type eq "CODE")
1072 497 4034 if defined $nulling_symbol_id and defined $rule_id
1077 30 5 if ($ref_type eq "SCALAR")
1079 0 30 unless (defined $thingy)
1091 5 0 if ($ref_type eq "REF")
1106 36542 32572 if (defined $lexeme_id and $semantics eq "::value")
1112 3861 28711 unless defined $rule_id
1115 1214 27497 if ($semantics =~ /\A [:][:] rhs (\d+) \z/msx)
1119 27497 1214 unless defined $singleton
1122 0 1214 if ($is_discard_sequence_rule)
1127 0 1214 if ($is_sequence_rule)
1134 0 1214 unless (scalar @elements)
1145 0 1214 unless (defined $singleton_element)
1158 0 31358 unless (defined $array_fate)
1166 25551 5807 if ($blessing ne "::undef")
1170 0 31358 if substr($semantics, 0, 1) ne "["
1180 562 83835 if ($result_descriptor eq "g1start")
1184 562 83273 if ($result_descriptor eq "g1len")
1188 4 83269 if ($result_descriptor eq "g1length")
1192 25600 57669 if ($result_descriptor eq "start")
1196 25600 32069 if ($result_descriptor eq "length")
1201 9 32060 if ($result_descriptor eq "lhs")
1202 5 4 if (defined $rule_id)
1207 4 0 if (defined $lexeme_id)
1215 705 31355 if ($result_descriptor eq "name")
1216 654 51 if (defined $rule_id)
1221 51 0 if (defined $lexeme_id)
1226 0 0 if (defined $nulling_symbol_id)
1235 5 31350 if ($result_descriptor eq "symbol")
1236 3 2 if (defined $rule_id)
1242 2 0 if (defined $lexeme_id)
1247 0 0 if (defined $nulling_symbol_id)
1256 5 31345 if ($result_descriptor eq "rule")
1257 3 2 if (defined $rule_id)
1264 31345 0 if ($result_descriptor eq "values" or $result_descriptor eq "value")
1267 3861 27484 if (defined $lexeme_id)
1271 1423 26061 if ($is_sequence_rule)
1272 505 918 $is_discard_sequence_rule ? :
1280 25254 807 if ($rule_length > 0)
1282 34733 14498 $mask->[$_] ? :
1296 30514 40403 if (defined $rule_id)
1300 2100 68817 if (defined $nulling_symbol_id)
1305 40403 30514 if (defined $lexeme_id)
1312 237 873 unless $Marpa::R2::Context::slr
1322 547 326 unless $grammar_c->symbol_is_nullable($start_symbol_id)
1327 326 522 if ($start_symbol_id == $lhs)
1335 326 378 if ($nulling_symbol_id == $start_rhs_symbol_id)
1373 1556 2350 if (scalar @_ != 1)
1374 0 1556 if ref $slr ne "Marpa::R2::Scanless::R"
1380 0 3906 if ($recce->[5] ne "tree")
1391 0 3906 if $furthest_earleme > $last_completed_earleme
1399 2776 1130 if ($tree) { }
1407 662 2114 if $package_source eq "semantics_package"
1408 2114 0 if ($package_source eq "legacy")
1409 0 2114 if (defined $per_parse_arg)
1420 0 0 unless (defined $per_parse_arg)
1434 0 0 unless (defined $arg_blessing)
1450 0 0 if ($arg_blessing ne $required_blessing)
1464 0 2776 unless ($tree)
1472 0 2776 if ($max_parses and $parse_count > $max_parses)
1482 20 1110 unless $order
1488 0 3886 if ($recce->[17])
1489 0 0 unless print {$trace_file_handle;} "AND_NODES: ", $recce->show_and_nodes
1493 0 3886 if ($recce->[20])
1494 0 0 unless print {$trace_file_handle;} "OR_NODES: ", $recce->show_or_nodes
1498 0 3886 if ($recce->[18])
1499 0 0 unless print {$trace_file_handle;} "BOCAGE: ", $recce->show_bocage
1503 105 3781 unless defined $tree->next
1508 1510 2271 if defined $slr
1512 1110 2671 unless ($recce->[32])
1519 48 3732 if defined $per_parse_arg
1525 3725 7 unless defined $per_parse_constructor
1528 4 3 if ($recce->[31] eq 'legacy') { }
1554 0 7 if (not $eval_ok or @warnings)
1569 1509 2271 if ($slr) { }
1580 4654 2271 if defined $token_value
1585 3 3777 $trace_values ? :
1601 105326 0 if $trace_values <= 2
1602 0 0 if ($type eq "nulling")
1603 0 0 unless say {$trace_file_handle;} "Registering semantics for nulling symbol: ", $grammar->symbol_name($id), "\n", " Semantics are ", show_semantics(@raw_ops)
1611 0 0 unless say {$trace_file_handle;} "Registering semantics for ${type}: ", $grammar->symbol_name($id), "\n", " Semantics are ", show_semantics(@raw_ops)
1619 27596 292180 if (ref $raw_op)
1625 51926 53400 if ($type eq "token")
1629 7279 46121 if ($type eq "nulling")
1633 46121 0 if ($type eq "rule")
1646 100 22714 if ($trace_values)
1649 100 14 unless defined $event
1651 14 0 if ($event_type eq "MARPA_STEP_TOKEN")
1659 0 0 unless say {$trace_file_handle;} join(" ", "value event:", map({$_ // "undef";} $event_type, @event_data))
1663 0 100 if ($trace_values >= 9)
1665 0 0 unless printf {$trace_file_handle;} "Stack position %3d:\n", $i
1668 0 0 unless print {$trace_file_handle;} " ", "Data::Dumper"->new([\$value->absolute($i)])->Terse(1)->Dump
1678 3770 19044 unless defined $value_type
1679 30 19014 if $value_type eq "trace"
1681 1324 17690 if ($value_type eq "MARPA_STEP_NULLING_SYMBOL")
1703 0 1324 if (not $eval_ok or @warnings)
1718 0 1324 if $trace_values
1723 17641 49 if ($value_type eq "MARPA_STEP_RULE")
1727 0 17641 unless defined $closure
1730 17641 0 if (ref $closure eq 'CODE') { }
1739 0 17641 if (&Scalar::Util::blessed($values))
1753 10 17631 if (not $eval_ok or @warnings)
1772 18 17613 if ($trace_values)
1773 0 18 unless say {$trace_file_handle;} trace_stack_1($grammar, $recce, $value, $values, $rule_id)
1777 0 18 unless print {$trace_file_handle;} "Calculated and pushed value: ", "Data::Dumper"->new([$result])->Terse(1)->Dump
1787 49 0 if ($value_type eq "MARPA_STEP_TRACE")
1789 2 47 if (my $trace_output = trace_op($grammar, $recce, $value))
1790 0 2 unless print {$trace_file_handle;} $trace_output
1837 1 20 unless defined $irl_id
1852 7 16 if (defined $symbol)
1856 16 7 if (defined $cause_id)
1865 10 13 if (defined $predecessor_id)
1908 45 38 if (defined $cause_id) { }
1932 2 44 unless defined $parent
1951 26 18 if (defined $cause) { }
1959 0 44 if ($verbose)
1960 0 0 defined $parent ? :
1961 0 0 defined $predecessor ? :
1962 0 0 defined $cause ? :
1992 2 41 unless defined $origin
2008 0 57 unless $Marpa::R2::Internal::Value::a->[0] <=> $Marpa::R2::Internal::Value::b->[0] or $Marpa::R2::Internal::Value::a->[1] <=> $Marpa::R2::Internal::Value::b->[1] or $Marpa::R2::Internal::Value::a->[2] <=> $Marpa::R2::Internal::Value::b->[2]
2037 0 0 unless defined $origin
2060 0 0 unless defined $parent
2079 0 0 if (defined $cause) { }
2099 4 40 unless defined $or_node_id
2104 24 16 if ($tree->_marpa_t_nook_is_cause($nook_id))
2108 12 4 if ($tree->_marpa_t_nook_is_predecessor($nook_id))
2119 40 0 $tree->_marpa_t_nook_predecessor_is_ready($nook_id) ? :
2124 40 0 $tree->_marpa_t_nook_cause_is_ready($nook_id) ? :
2133 40 49 unless defined $and_node_id
2135 40 9 if (defined $this_choice and $this_choice == $choice_ix)
2152 4 40 unless defined $nook_text
2165 0 14 unless (defined $nook_ix)
2166 0 0 unless print {$Marpa::R2::Internal::TRACE_FH;} "Nulling valuator\n"
2175 14 0 if (defined $token_id)
2179 14 0 $token_name ? :
0 14 unless print {$Marpa::R2::Internal::TRACE_FH;} "Pushed value from ", Marpa::R2::Recognizer::and_node_tag($recce, $and_node_id), ": ", $token_name ? "$token_name = " : "", "Data::Dumper"->new([\$token_value])->Terse(1)->Dump
2220 17 32 unless $trace_values >= 2
2236 12 20 if $bocage->_marpa_b_or_node_position($or_node_id) != $grammar_c->_marpa_g_irl_length($trace_irl_id)
2240 18 2 unless $virtual_rhs or $virtual_lhs
2242 0 2 if ($virtual_rhs and not $virtual_lhs)
2244 0 0 unless $trace_output .= join("", "Head of Virtual Rule: ", Marpa::R2::Recognizer::and_node_tag($recce, $and_node_id), ", rule: ", $grammar->brief_irl($trace_irl_id), "\n", "Incrementing virtual rule by ", $grammar_c->_marpa_g_real_symbol_count($trace_irl_id), " symbols", "\n")
2258 0 2 if ($virtual_lhs and $virtual_rhs)
2272 2 0 if (not $virtual_rhs and $virtual_lhs)