Branch Coverage

blib/lib/Marpa/R2/HTML.pm
Criterion Covered Total %
branch 166 272 61.0


line true false branch
96 0 0 unless defined $html_token_ix
110 0 0 unless defined $html_token_ix
120 0 415 if $ref_type ne "HASH"
130 0 415 if scalar keys %{$handler_description;}
132 0 415 if ref $action ne "CODE"
135 317 98 if (defined $pseudoclass)
140 4 94 unless $element
151 0 0 if $ref_type ne "ARRAY"
165 93 322 unless ($element, $class) = $specifier =~ /\A ([^.]*) [.] (.*) \z/mosx or ($element, $pseudoclass) = $specifier =~ /\A ([^:]*) [:] (.*) \z/mosx
173 0 415 if ($pseudoclass and not exists $allowed_pseudoclasses->{$pseudoclass})
180 0 415 if ($pseudoclass and $element)
208 91 2 if ($ref_type eq "HASH")
213 0 2 if $ref_type ne "REF"
217 0 2 if $ref_type ne "HASH"
221 0 3 if ($option eq "handlers")
232 0 3 unless (exists $allowed_options->{$option})
240 1 93 if (defined $source_ref) { }
241 0 1 unless ref $source_ref eq "SCALAR"
261 666 675 unless defined $action
263 180 495 if (index($action, "SPE_") == 0)
266 0 180 if $trace_handlers and defined $handler
288 0 495 if $trace_handlers and defined $handler
294 485 856 if defined $handler
296 0 856 if $trace_handlers
310 0 1033 unless defined $first_token_ix
335 0 0 unless defined $tdesc_item_type
337 0 0 if ($tdesc_item_type eq "PHYSICAL_TOKEN")
344 0 0 if ($tdesc_item_type eq "VALUED_SPAN")
362 0 693 unless defined $type
363 0 693 if $type eq "ZERO_SPAN"
364 0 693 if $type eq "RUBY_SLIPPERS_TOKEN"
365 4 689 if ($type eq "VALUES")
380 10 689 unless (defined $next_explicit_token_ix)
384 10 0 if ($tdesc_item_type eq "VALUED_SPAN")
393 224 465 if $next_token_ix < $next_explicit_token_ix
397 588 101 if ($tdesc_item_type eq "VALUED_SPAN")
400 98 490 if (defined $value)
407 591 0 if $next_explicit_token_ix <= $furthest_explicit_token_ix
423 0 0 unless defined $rule_length
438 0 94 if $self->{'document'}
450 0 94 if not $ref_type or $ref_type ne "SCALAR" or not defined ${$document_ref;}
459 2 92 if ($self->{'dump_config'})
481 2116 10672 if (defined $min) { }
533 0 1379 if ($is_cdata)
538 635 744 if ($token_type eq "T")
549 364 271 if substr(${$document;}, $offset, $offset_end - $offset) =~ / [^\x09\x0A\x0C\x0D\x20\x{200B}] /mosx
554 739 5 if ($token_type eq "E" or $token_type eq "S")
563 2 737 if $offset_end <= $offset
569 25 712 unless (defined $terminal_id)
582 75 50 unless (defined $symbol_id)
628 0 92 if ($self->{'dump_AHFA'})
647 11734 2785 unless 0 == index($symbol_name, "E_")
649 184 2601 if $symbol_name eq "E_body" or $symbol_name eq "E_html"
662 2760 11316 if ($candidate_name eq "")
667 0 11316 unless defined $candidate_id
677 8213 6306 unless ($thin_grammar->symbol_is_terminal($rejected_symbol_id))
688 2785 3521 if ($prefix eq "S_")
693 2785 736 if ($prefix eq "E_")
698 2300 4006 if (defined $ruby_vector)
702 460 3546 unless (defined $placement)
703 92 368 if ($rejected_symbol_name eq "CRUFT")
715 1982 1564 defined $primary_group ? :
718 295 3251 if (defined $ruby_vector)
723 3251 0 if (defined $ruby_vector)
736 820 284 unless defined $start_tag_id
774 8 2224 if (defined $empty_element_end_tag)
778 0 8 if ($read_result != $NO_MARPA_ERROR)
781 0 8 if ($trace_terminals)
782 0 0 unless say {$trace_fh;} "Virtual end tag accepted: ", $tracer->symbol_name($empty_element_end_tag)
786 0 8 if ($recce->earleme_complete < 0)
790 0 8 unless defined $current_earleme
803 1469 755 if ($read_result != $UNEXPECTED_TOKEN_ID)
804 0 1469 if ($read_result != $NO_MARPA_ERROR)
807 0 1469 if ($trace_terminals)
808 0 0 unless say {$trace_fh;} "Token accepted: ", $tracer->symbol_name($attempted_symbol_id)
812 0 1469 if ($recce->earleme_complete < 0)
818 1469 0 if (defined $last_html_token_of_marpa_token)
822 0 1469 unless defined $current_earleme
830 0 755 if ($trace_terminals)
831 0 0 unless say {$trace_fh;} "Literal Token not accepted: ", $tracer->symbol_name($attempted_symbol_id)
840 0 755 unless defined $terminals_expected[0]
843 0 6736 if ($trace_terminals)
844 0 0 unless say {$trace_fh;} "Considering candidate: ", $tracer->symbol_name($candidate_id), "; rank is $this_candidate_rank; highest rank so far is $highest_candidate_rank"
849 792 5944 if ($this_candidate_rank > $highest_candidate_rank)
850 0 792 if ($trace_terminals)
851 0 0 unless say {$trace_fh;} "Considering candidate: ", $tracer->symbol_name($candidate_id), "; last seen at ", $terminal_last_seen[$candidate_id], "; current token number is $token_number"
858 0 792 if $terminal_last_seen[$candidate_id] == $token_number
859 0 792 if ($trace_terminals)
860 0 0 unless say {$trace_fh;} "Current best candidate: ", $tracer->symbol_name($candidate_id)
869 752 3 if (defined $virtual_terminal_to_add)
871 0 752 if ($trace_terminals)
872 0 0 unless say {$trace_fh;} "Adding Ruby Slippers token: ", $tracer->symbol_name($virtual_terminal_to_add)
880 0 752 if ($ruby_slippers_result != $NO_MARPA_ERROR)
883 0 752 if ($recce->earleme_complete < 0)
892 346 406 if $is_start_tag[$virtual_terminal_to_add]
896 0 752 unless defined $current_earleme
908 0 3 if ($trace_terminals)
909 0 0 unless say {$trace_fh;} "Adding rejected token as cruft: ", $tracer->symbol_name($attempted_symbol_id)
914 0 3 $token->[0] == $SYMID_CRUFT ? :
917 0 3 if ($trace_cruft or $fatal_cruft_error)
919 0 0 unless defined $current_earleme
931 0 0 unless say {$trace_fh;} qq[Cruft at line $line, column ${col}: "], ${token_range_to_original($self, $token_number, $token_number);}, "\""
937 0 0 if $fatal_cruft_error
948 0 92 if ($trace_terminals)
949 0 0 unless say {$trace_fh;} "at end of tokens"
976 92 6952 unless defined $type
977 2229 4723 if ($type eq "MARPA_STEP_TOKEN")
978 0 2229 if $trace_values
983 760 1469 if ($token_value eq 43)
985 0 760 if $trace_values
1002 0 1469 if $trace_values
1007 4168 555 if ($type eq "MARPA_STEP_RULE")
1008 0 4168 if $trace_values
1021 747 3421 if (defined $action and index($action, "ELE_") == 0)
1028 401 346 if (defined $start_tag_type and $start_tag_type eq "PHYSICAL_TOKEN")
1033 401 0 if ($start_tag_token->[1] eq "S")
1043 741 3427 if (defined $action and index($action, "SPE_") == 0)
1063 117 4051 if ($start_html_token_ix > $end_html_token_ix)
1078 0 4168 if $trace_handlers and $handler
1082 1341 2827 unless (defined $handler)
1088 581 3587 if (ref $handler)
1105 0 5339 unless defined $tdesc_type
1106 471 4868 if ($tdesc_type eq "VALUES")
1112 1635 3233 if $tdesc_type ne "VALUED_SPAN"
1115 2972 615 if (scalar @flat_tdesc_list <= 1)
1133 0 4168 if ($trace_values)
1134 0 0 unless say {*STDERR;} "rule ${rule_id}: ", join(" ", symbol_names_by_rule_id($self, $rule_id))
1137 0 0 unless say {*STDERR;} "Stack:\n", Data::Dumper::Dumper(\@stack)
1143 555 0 if ($type eq "MARPA_STEP_NULLING_SYMBOL")
1147 0 555 if ($trace_values)
1148 0 0 unless say {*STDERR;} join(" ", $type, @step_data, $tracer->symbol_name($symbol_id))
1151 0 0 unless say {*STDERR;} "Stack:\n", Data::Dumper::Dumper(\@stack)
1160 0 92 unless defined $result
1163 4 88 if (ref $self->{'handler_by_species'}{'TOP'}) { }
1173 11 77 if ($type eq "VALUES")
1177 77 0 if ($type eq "VALUED_SPAN")