Branch Coverage

blib/lib/Parse/Stallion.pm
Criterion Covered Total %
branch 447 520 85.9


line true false branch
15 0 1423 if (defined $$parameters{'value_separator'})
21 3123 1116 if (defined $$self{$value}) { }
73 0 25 if (my $pf = $$start_node{'parse_forward'}) { }
25 0 elsif (my $x = $$start_node{'regex_match'}) { }
77 0 0 if (defined $delta_position)
78 0 0 if ($delta_position < 0) { }
89 22 3 if ($$parse_this_ref =~ /$x/cg) { }
90 18 4 if (defined $2) { }
102 22 3 if ($continue_forward)
114 0 22 if ($do_evaluation_in_parsing)
117 0 0 if ($parse_stallion->new_evaluate_tree_node($parameters))
121 1 21 if ($parse_this_length != $current_position and $must_parse_length)
126 21 4 if ($continue_forward) { }
147 0 25 if ($do_evaluation_in_parsing)
159 0 704 if (defined $$parameters{'start_rule'}) { }
160 0 0 unless (defined $$rule{$$parameters{'start_rule'}})
168 25 679 if ($$rule{$start_rule}{'leaf_rule'})
179 0 679 if ($max_steps < 0)
209 75 604 if ($do_evaluation_in_parsing or $$parse_stallion{'no_evaluation'}) { }
240 274 405 if (defined $$parse_hash{'__steps_ref'}) { }
248 87 592 if ($continue_parse) { }
308 202 28570 if ($parse_trace_routine)
311 17810 10962 if ($moving_forward) { }
312 3736 14074 if ($$current_rule{'or_rule'}) { }
12304 1770 elsif ($$current_rule{'and_rule'}) { }
89 1681 elsif ($any_minimize_children and $$current_rule{'minimize_children'} and $not_any_minimum_child || $$current_rule{'minimum_child'} <= $$current_node{'child_count'}) { }
106 1575 elsif ($any_maximum_child and $$current_rule{'maximum_child'} and $$current_rule{'maximum_child'} == $$current_node{'child_count'}) { }
313 1979 1757 if ($moving_down) { }
325 2724 9580 if ($$current_node{'child_count'} == $$current_rule{'subrule_list_count'}) { }
353 972 9990 if ($$current_rule{'leaf_rule'}) { }
3724 6266 elsif ($$current_rule{'or_rule'}) { }
4802 1464 elsif ($$current_rule{'and_rule'}) { }
948 516 elsif (not $moving_down and $not_any_minimize_children || !$$current_rule{'minimize_children'} and $not_any_minimum_child || !$$current_rule{'minimum_child'} || $$current_rule{'minimum_child'} <= $$current_node{'child_count'} and $not_move_back_mode) { }
49 467 elsif ($any_minimize_children and $not_move_back_mode and $$current_rule{'minimize_children'} and $moving_down and $not_any_maximum_child || !$$current_rule{'maximum_child'} || $$current_rule{'maximum_child'} > $$current_node{'child_count'}) { }
233 234 elsif ($$current_node{'child_count'}) { }
357 379 3345 if ($moving_down) { }
361 2746 599 if ($not_move_back_mode and ++$$current_node{'or_child_number'} < $$current_rule{'subrule_list_count'}) { }
375 1449 3353 if ($$current_node{'child_count'}) { }
410 2061 8901 if ($move_back_to_child)
412 5 2056 if $parse_trace_routine
415 1600 461 if $bottom_up
420 461 1600 if ($do_evaluation_in_parsing)
424 14 17 if ($any_match_once and $not_move_back_mode and $$rule{$current_node_name}{'match_once'})
427 11 3 if ($fast_move_back) { }
429 0 11 if $parse_trace_routine
435 0 3 if $parse_trace_routine
441 15929 12843 if ($create_child) { }
5169 7674 elsif ($remove_node) { }
445 1000 14929 if ($any_parse_forward and my $pf = $$new_rule{'parse_forward'}) { }
7048 7881 elsif (my $x = $$new_rule{'regex_match'}) { }
451 936 64 if (defined $delta_position)
452 0 936 if ($delta_position < 0) { }
463 3321 3727 if ($$parse_this_ref =~ /$x/g) { }
464 94 3227 if (defined $2) { }
468 24 3297 if $parse_trace_routine
472 49 3678 if $parse_trace_routine
479 12158 3771 if ($continue_forward) { }
480 2538 9620 if ($current_position > $maximum_position)
484 9226 2932 if ($current_position == $previous_position)
485 7120 2106 if (defined $$position_tree_size{$current_position}) { }
486 2 7118 if ($$position_tree_size{$current_position} < $tree_size - $delta_tree_size)
506 4275 7881 if ($$new_rule{'leaf_rule'}) { }
519 69 12087 if $parse_trace_routine
534 4564 605 if ($bottom_up)
537 9 4555 if ($change_in_tree > 1)
542 537 4632 if (defined $$position_tree_size{$current_position} and $$position_tree_size{$current_position} == $tree_size)
546 33 5136 if $parse_trace_routine
549 3 5166 if ($move_back_mode and $$current_node{'__move_back_to'})
552 0 3 if $parse_trace_routine
556 4866 303 if (defined $current_node)
559 12 4854 if ($any_parse_backtrack and $$current_rule{'parse_backtrack'})
564 3 9 if ($end_parse_now)
576 9899 18868 if ($node_completed)
579 2 9897 if ($current_position == $$current_node{'position_when_entered'} and $parent and defined $$rule{$$parent{'name'}}{'minimum_child'} and $not_any_minimum_child || $$parent{'child_count'} > $$rule{$$parent{'name'}}{'minimum_child'}) { }
585 0 2 if $parse_trace_routine
592 1242 8655 if ($do_evaluation_in_parsing)
595 70 1172 if ($parse_stallion->new_evaluate_tree_node($parameters))
598 0 70 if $parse_trace_routine
602 8655 1172 if $bottom_up
603 63 9764 if $parse_trace_routine
608 9338 489 if ($current_node = $parent)
615 120 369 if (not $current_node and $moving_forward and $must_parse_length and $parse_this_length != $current_position)
621 3 117 if $parse_trace_routine
623 107 13 if $bottom_up
624 1 119 if ($any_match_once and $$rule{$current_node_name}{'match_once'})
626 1 0 if ($fast_move_back) { }
628 0 1 if $parse_trace_routine
634 0 0 if $parse_trace_routine
638 0 796 if ($no_max_steps and $steps == $max_steps)
649 307 370 if (not $moving_forward || $current_node) { }
657 1 676 if ($steps >= $max_steps)
660 369 307 if ($moving_forward) { }
662 51 318 if ($do_evaluation_in_parsing)
709 0 159 if ($$self{'no_evaluation'} = $$parameters{'no_evaluation'} || 0) { }
720 1 158 if (defined $$parameters{'parse_forward'})
724 1 158 if (defined $$parameters{'parse_backtrack'})
728 1 158 if (defined $$parameters{'length_routine'}) { }
734 7 152 if defined $$parameters{'incorporate'}
782 424 0 if (defined $_[0])
784 424 0 if (ref $_[0] eq '')
790 4 420 if (defined $$parameters{'find_all'}) { }
18 402 elsif ($$parameters{'global'}) { }
794 4 14 if (wantarray) { }
801 10 414 if (defined $$parameters{'start_position'})
805 399 25 if (not defined $$parameters{'match_start'}) { }
811 377 47 if (not defined $$parameters{'match_length'}) { }
824 0 424 if (defined $$parameters{'substitution'}) { }
13 411 elsif ($substitute = $$parameters{'substitute'} || 0) { }
826 0 0 if (ref $$parameters{'substitution'} eq 'CODE') { }
839 5 419 if ($$parameters{'parse_trace'})
844 104 19 if ($$current_node{'parent'})
862 0 424 if ($match_maximum and $match_minimum)
865 23 401 if ($match_maximum or $match_minimum)
875 22 444 if ($match_maximum) { }
23 421 elsif ($match_minimum) { }
890 3 701 if ($@)
891 390 311 if ($$parser_results{'parse_succeeded'})
893 39 351 if ($match_maximum and $$parser_results{'final_position'} < $parse_this_length) { }
48 303 elsif ($match_minimum and $$parser_results{'final_position'} > $initial_position) { }
51 252 elsif ($$self{'do_evaluation_in_parsing'}) { }
895 29 10 if ($$parser_results{'final_position'} > $match_position)
897 0 29 if ($$self{'do_evaluation_in_parsing'}) { }
913 0 39 if $$parameters{'parse_hash'}{'__parse_trace_routine'}
916 39 0 if $$parameters{'parse_hash'}{'__bottom_up'}
921 36 12 if ($$parser_results{'final_position'} < $match_position)
923 0 36 if ($$self{'do_evaluation_in_parsing'}) { }
939 0 48 if $$parameters{'parse_hash'}{'__parse_trace_routine'}
942 48 0 if $$parameters{'parse_hash'}{'__bottom_up'}
956 151 123 if (not $parse_succeeded and $not_match_start and $parse_this_length > $initial_position)
967 123 340 if (not $parse_succeeded or $$self{'no_evaluation'}) { }
51 289 elsif ($$self{'do_evaluation_in_parsing'}) { }
971 0 51 unless (defined $to_return)
978 7 281 unless (defined $to_return)
980 40 422 if (defined $to_return and $substitute)
989 43 419 if ($find_all and $parse_succeeded)
991 3 40 if ($match_position == $initial_position)
996 42 1 if ($match_position <= $parse_this_length)
1002 420 0 if ($in_is_string)
1003 13 407 if ($$parameters{'global'} and $parse_succeeded) { }
1011 8 412 if ($find_all)
1020 12 0 unless (defined $$parameters{'match_start'})
1023 10 2 unless (defined $$parameters{'match_length'})
1027 2 10 if ($$parameters{'global'} and wantarray) { }
1032 7 3 if ($$parameters{'parse_info'}{'parse_succeeded'}) { }
1045 2 5 if ($$parameters{'global'}) { }
1125 187 715 if (ref $parm eq 'ARRAY') { }
1132 703 65 if (ref $p[0] eq 'Regexp') { }
1149 37 227 if (ref $parm eq 'ARRAY' and $$parm[0] eq 'EVAL' || $$parm[0] eq 'UNEVAL' || $$parm[0] eq 'SEVAL' || $$parm[0] eq 'RULE_INFO' || $$parm[0] eq 'MATCH_ONCE' || $$parm[0] eq 'MATCH_MIN_FIRST' || $$parm[0] eq 'USE_STRING_MATCH') { }
1160 95 44 if ($#p == 0) { }
44 0 elsif ($#p == 2) { }
1184 263 1905 if ($subrule_count > 1) { }
1201 704 elsif ($rule_type eq 'AND') { }
234 470 elsif ($rule_type eq 'MULTIPLE' and $$rule_hash{'maximum_child'} != 1 || $subrule_count > 1) { }
81 389 elsif ($rule_type eq 'MULTIPLE') { }
341 48 elsif ($rule_type eq 'OR' and !defined($$rule_hash{'rule_count'}{$subrule_alias}) || $subrule_count > $$rule_hash{'rule_count'}{$subrule_alias}) { }
1208 0 7 if (ref $incorporate_list ne 'ARRAY')
1220 0 10 unless (defined $parser_to_incorporate)
1225 4 6 if (defined $$parameters{'prefix'}) { }
1232 1 41 if (defined $$self{'rule'}{$prefix . $rule_name})
1237 26 15 if defined $$rule_to_copy{'sub_rule_name'}
1239 26 15 if (defined $$rule_to_copy{'rule_count'})
1280 1 1625 if ($$self{'rule'}{$rule_name})
1283 58 1567 if (ref $rule eq 'Regexp') { }
0 1567 elsif (ref $rule eq '') { }
1290 0 1625 if (ref $rule ne 'ARRAY')
1296 848 777 if (defined $$parameters{'generated_name'}) { }
1 776 elsif (index($rule_name, $separator) != -1) { }
1311 381 5511 if (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'EVAL') { }
34 5477 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'SEVAL') { }
3 5474 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'UNEVAL') { }
13 5461 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'MATCH_MIN_FIRST') { }
18 5443 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'MATCH_ONCE') { }
0 5443 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'RULE_INFO') { }
733 4710 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'LEAF_DISPLAY') { }
8 4702 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'USE_STRING_MATCH') { }
49 4653 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'PARSE_FORWARD') { }
11 4642 elsif (ref $sub_rule eq 'ARRAY' and $$sub_rule[0] eq 'PARSE_BACKTRACK') { }
0 4642 elsif (not defined $sub_rule) { }
1313 0 381 if ($$self{'rule'}{$rule_name}{'parsing_evaluation'})
1316 374 7 if (ref $$sub_rule[1] eq 'CODE')
1325 0 3 if ($$self{'rule'}{$rule_name}{'parsing_unevaluation'})
1334 0 13 if ($rule_type ne 'MULTIPLE')
1345 0 0 if ($$self{'rule_info'}{$rule_name})
1351 0 733 if ($$self{'rule'}{$rule_name}{'leaf_display'})
1354 0 733 if ($rule_type ne 'LEAF')
1363 1 48 if ($$self{'rule'}{$rule_name}{'parse_forward'})
1371 11 0 if ($rule_type eq 'LEAF') { }
1372 0 11 if ($$self{'rule'}{$rule_name}{'parse_backtrack'})
1395 789 834 if ($rule_type eq 'LEAF') { }
1397 732 57 if (ref $leaf_info eq 'Regexp') { }
10 47 elsif (defined $leaf_info) { }
1399 79 653 if ('' =~ /$leaf_info/)
1404 0 10 if (defined $$self{'rule_info'}{$rule_name})
1419 514 320 if ($rule_type eq 'AND') { }
113 207 elsif ($rule_type eq 'OR') { }
207 0 elsif ($rule_type eq 'MULTIPLE') { }
1431 0 207 if ($max and $min > $max or $min < 0 or $min != int $min or $max != int $max)
1435 70 137 if ($$self{'rule'}{$rule_name}{'maximum_child'})
1438 22 185 if ($$self{'rule'}{$rule_name}{'minimum_child'})
1448 121 1740 if (ref $current_rule eq 'HASH')
1450 0 121 if ($#hash_info != 0)
1456 1013 848 if (ref $current_rule eq '') { }
399 449 elsif (ref $current_rule eq 'Regexp') { }
449 0 elsif (ref $current_rule eq 'ARRAY') { }
1457 977 36 unless (defined $alias)
1463 339 60 unless (defined $alias)
1478 424 25 unless (defined $alias)
1479 81 343 if (defined $$self{'rule'}{$name}{'parsing_evaluation'} or $$self{'rule'}{$name}{'rule_type'} eq 'LEAF')
1491 1518 343 if (defined $$subrule{'alias'}) { }
1504 28 806 if (defined $$self{'rule'}{$rule_name}{'string_evaluation'})
1505 0 28 if ($$self{'rule'}{$rule_name}{'parsing_evaluation'})
1511 2 26 if ($$self{'rule'}{$rule_name}{'use_string_match'}) { }
1516 43 9 if ($param =~ /\w+/ and $param ne '_') { }
9 0 elsif ($param eq '') { }
1527 26 0 if (my $ms = $$self{'rule'}{$rule_name}{'matched_string'})
1533 0 28 if ($@)
1550 1407 214 if ($$self{'rule'}{$rule_to_check}{'subrule_list'})
1554 1469 384 unless ($rules_checked{$rule_name}++)
1562 21 1621 unless ($rules_checked{$rule})
1575 1428 215 if ($$self{'rule'}{$rule}{'subrule_list'})
1578 1 1875 unless ($$self{'rule'}{$rule_name})
1579 1 0 if ($return_list) { }
1599 7 53 if ($$rules_details{$rule_name}{'rule_count'}{$child_rule_name} > 1) { }
1615 157 1 if (scalar keys %$rules_to_set_up_hash)
1622 98 57 unless (defined $start_rule)
1627 1355 12 if ($$subrule{'name'} ne $$self{'rule'}{$rule_name}{'base_rule'})
1633 96 576 unless ($covered_rule{$rule_name})
1638 2 96 unless (defined $start_rule)
1642 1 152 if ($#missing_rules > -1)
1646 152 0 unless ($$self{'unreachable_rules_allowed'})
1649 2 150 if ($#unreachable_rules > -1)
1663 0 1616 if ($checked_rules{$rule})
1670 4970 6028 if ($moving_down) { }
1671 3 4967 if ($active_rules{$current_rule}++)
1676 2678 2289 if ($checked_rules{$current_rule} or $$self{'rule'}{$current_rule}{'leaf_rule'}) { }
1682 318 1971 if ($$self{'rule'}{$current_rule}{'multiple_rule'}) { }
1692 107 5921 if ($previous_allows_zero)
1693 46 61 if ($$self{'rule'}{$current_rule}{'multiple_rule'} or $$self{'rule'}{$current_rule}{'or_rule'}) { }
10 51 elsif ($$self{'rule'}{$current_rule}{'and_rule'} and $active_rules{$current_rule} == $$self{'rule'}{$current_rule}{'subrule_list_count'}) { }
1706 2996 3032 if ($$self{'rule'}{$current_rule}{'multiple_rule'} or $$self{'rule'}{$current_rule}{'leaf_rule'} or $checked_rules{$current_rule}) { }
584 2448 elsif ($active_rules{$current_rule} == $$self{'rule'}{$current_rule}{'subrule_list_count'}) { }
1473 975 elsif ($$self{'rule'}{$current_rule}{'and_rule'}) { }
1725 90 1383 if (defined $$self{'rule'}{$previous_rule}{'zero'} and $$self{'rule'}{$previous_rule}{'zero'} or $$self{'rule'}{$previous_rule}{'multiple_rule'} and $$self{'rule'}{$previous_rule}{'minimum_child'} == 0) { }
1762 187 274 if ($$rule{'use_parse_match'})
1766 3 458 if (defined $subroutine_to_run)
1776 461 0 if ($parent = $$node{'parent'})
1779 246 238 if (my $count = $$node{'passed_params'}{$param}) { }
1780 0 246 if ($count > scalar @{$$parent{'__parameters'}{$param};})
1815 3529 4628 if ($$rule{'use_parse_match'}) { }
9 4619 elsif ($$rule{'use_string_match'}) { }
1826 1556 6601 if ($subroutine_to_run) { }
1833 4410 2191 if ($$rule{'generated'} or $$self{'do_not_compress_eval'}) { }
1256 935 elsif (ref $params_to_eval eq 'HASH' and keys %$params_to_eval == 1) { }
1846 7804 352 if ($parent = $$node{'parent'})
1849 5855 1949 if (defined $alias) { }
1850 2311 3544 if ($$rules_details{$parent_name}{'rule_count'}{$alias} > 1) { }
1861 579 1850 if ($$rules_details{$rule_name}{'rule_count'}{$key} > 1) { }
1312 538 elsif ($$rules_details{$parent_name}{'rule_count'}{$key} > 1) { }
1862 553 26 if (scalar @{$$cv{$key};})
1886 0 5 if (ref $text_ref ne 'SCALAR')