Branch Coverage

blib/lib/Marpa/HTML.pm
Criterion Covered Total %
branch 104 202 51.4


line true false branch
39 0 0 if defined $Marpa::XS::Installed::VERSION
42 0 6 if ($using_xs) { }
111 12 1374 unless $element
112 687 687 unless $user_handlers
131 528 0 if (defined(my $value = $$tdesc[3]))
145 0 0 unless defined(my $first_token_id = $$tdesc[1])
152 0 0 unless defined(my $last_token_id = $$tdesc[2])
213 687 6 $self ? :
216 687 6 $self ? :
241 2962 303 if ($tdesc_list[0][0] ne 'POINT')
246 2895 370 if ($tdesc_list[-1][0] ne 'POINT')
261 0 3265 if (my $id = Marpa::HTML::id())
262 0 0 if ($user_handler = $$handlers_by_id{$id})
263 0 0 if ($trace_handlers)
264 0 0 unless say {$trace_fh;} "Resolved to user handler by element ($element) and id ($id)"
271 744 2521 if (my $class = Marpa::HTML::class())
272 8 736 if ($user_handler = $$handlers_by_class{$class})
273 0 8 if ($trace_handlers)
274 0 0 unless say {$trace_fh;} "Resolved to user handler by element ($element) and class ($class)"
282 0 3257 if ($trace_handlers and $user_handler)
283 0 0 defined $element ? :
0 0 unless say {$trace_fh;} defined $element ? "Resolved to user handler by element ($element)" : 'Resolved to default user handler'
291 429 2836 if (defined $user_handler)
317 0 6933 if (not $ref_type or $ref_type ne 'ARRAY')
324 0 913 unless (defined(my $value = $$tdesc[3]))
358 3121 3812 if (defined $first_token_id and defined $last_token_id)
359 952 2169 if (defined $first_token_id_in_current_span)
360 952 0 if ($first_token_id <= $last_token_id_in_current_span + 1)
378 3749 63 if (defined $next_tdesc)
379 2169 1580 if (defined $first_token_id_in_current_span)
393 2836 913 if $ref_type eq 'ARRAY' and $$next_tdesc[0] eq 'FINAL'
444 0 0 unless (defined $token_offset)
450 0 0 if ($token_offset < 0 or $token_offset > $#{$html_parser_tokens;})
467 0 0 unless (defined $token_offset)
474 0 0 if ($token_offset < 0 or $token_offset > $#{$html_parser_tokens;}) { }
501 0 413 if $ref_type ne 'HASH'
512 0 413 if scalar keys %{$handler_description;}
514 0 413 if ref $action ne 'CODE'
517 404 9 !$element || $element eq '*' ? :
518 317 96 if (defined $pseudoclass)
524 0 96 if (defined $id)
528 5 91 defined $class ? :
536 0 0 if $ref_type ne 'ARRAY'
549 91 322 unless ($element, $id) = $specifier =~ /\A ([^#]*) [#] (.*) \z/msx or ($element, $class) = $specifier =~ /\A ([^.]*) [.] (.*) \z/msx or ($element, $pseudoclass) = $specifier =~ /\A ([^:]*) [:] (.*) \z/msx
555 0 413 if ($pseudoclass and not $pseudoclass ~~ ['TOP', 'PI', 'DECL', 'COMMENT', 'PROLOG', 'TRAILER', 'WHITESPACE', 'CDATA', 'PCDATA', 'CRUFT'])
564 0 413 if ($pseudoclass and $element)
593 90 0 if ($ref_type eq 'HASH')
597 0 0 if $ref_type ne 'REF'
601 0 0 if $ref_type ne 'HASH'
605 0 0 if ($option eq 'handlers')
608 0 0 unless ($option ~~ ['trace_fh', 'trace_values', 'trace_handlers', 'trace_actions', 'trace_conflicts', 'trace_ambiguity', 'trace_rules', 'trace_QDFA', 'trace_earley_sets', 'trace_terminals', 'trace_cruft'])
869 0 91 if $$self{'document'}
882 0 91 if not $ref_type or $ref_type ne 'SCALAR' or not defined ${$document_ref;}
906 2 1359 if $offset_end <= $offset
918 0 359 $is_cdata ? :
267 359 substr(${$document;}, $offset, $offset_end - $offset) =~ / \A \s* \z /msx ? :
1009 21 29 unless ($terminals{$end_tag})
1083 637 84 unless ($terminal =~ /^[SE]_/msx)
1088 24 60 if ($Marpa::HTML::Internal::EMPTY_ELEMENT{$element})
1094 60 0 if (defined $element_type and $element_type ~~ ['block_element', 'header_element'])
1110 637 687 if $expected_terminal =~ /^S_/msx
1133 0 91 if ($$self{'trace_rules'})
1134 0 0 unless say {$trace_fh;} $grammar->show_rules
1137 0 91 if ($$self{'trace_QDFA'})
1138 0 0 unless say {$trace_fh;} $grammar->show_QDFA
1162 1450 675 if (defined $read_result)
1168 0 675 if ($trace_terminals)
1169 0 0 unless say {$trace_fh;} 'Literal Token not accepted: ', $actual_terminal
1181 0 675 if ($trace_conflicts)
1182 0 0 unless say {$trace_fh;} 'Conflict of virtual choices'
1184 0 0 unless say {$trace_fh;} "Actual Token is $actual_terminal"
1186 0 0 unless say {$trace_fh;} scalar @virtuals_expected, ' virtual terminals expected: ', join(' ', @virtuals_expected)
1197 90 727 if ($candidate eq 'S_table')
1198 86 4 unless ($actual_terminal ~~ ['S_caption', 'S_col', 'S_colgroup', 'S_thead', 'S_tfoot', 'S_tbody', 'S_tr', 'S_th', 'S_td', 'E_caption', 'E_col', 'E_colgroup', 'E_thead', 'E_tfoot', 'E_tbody', 'E_tr', 'E_th', 'E_td', 'E_table'])
1225 372 355 unless ($candidate =~ /^S_/msx)
1239 0 355 unless (defined $candidate_level)
1250 179 176 unless (defined $actual_terminal_level)
1264 56 120 if $candidate_level <= $actual_terminal_level
1271 0 675 if ($trace_terminals)
1272 0 0 unless say {$trace_fh;} 'Converting Token: ', $actual_terminal
1274 0 0 if (defined $virtual_terminal)
1275 0 0 unless say {$trace_fh;} 'Candidate as Virtual Token: ', $virtual_terminal
1286 0 675 if ($trace_terminals > 1 and defined $virtual_terminal)
1289 0 0 unless say {$trace_fh;} "OK as cruft when expecting ${virtual_terminal}: ", join(' ', keys %{$ok_as_cruft{$virtual_terminal};})
1293 0 675 unless defined $virtual_terminal
1295 2 673 if $ok_as_cruft{$virtual_terminal}{$actual_terminal}
1297 370 303 unless $virtual_terminal =~ /^S_/msx
1307 303 0 if ($current_earleme != $earleme_of_last_start_virtual)
1316 0 0 if $start_virtuals_used{$virtual_terminal}++ <= 1
1322 0 0 unless say {$trace_fh;} "Warning: attempt to add <$tagname> twice at the same place"
1338 673 2 if (defined $virtual_token_to_add)
1346 0 2 if ($trace_terminals)
1347 0 0 unless say {$trace_fh;} 'Adding actual token as cruft: ', $actual_terminal
1354 0 2 if ($trace_cruft)
1365 0 0 unless say {$trace_fh;} qq[Cruft at line $line, column ${col}: "], ${tdesc_list_to_literal($self, $$marpa_token[1]);}, '"'
1371 0 91 if ($trace_terminals)
1372 0 0 unless say {$trace_fh;} 'at end of tokens'
1382 4 87 defined $user_top_handler ? :
1388 83 8 if (defined $$self{'user_handlers_by_class'}{'ANY'}{'ANY'})
1400 313 506 if ($pseudoclass_action)
1447 0 91 unless defined $value