| 1 | # Copyright 2022 Jeffrey Kegler | ||||||||||||||||||||||||||||
| 2 | # This file is part of Marpa::R2. Marpa::R2 is free software: you can | ||||||||||||||||||||||||||||
| 3 | # redistribute it and/or modify it under the terms of the GNU Lesser | ||||||||||||||||||||||||||||
| 4 | # General Public License as published by the Free Software Foundation, | ||||||||||||||||||||||||||||
| 5 | # either version 3 of the License, or (at your option) any later version. | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # Marpa::R2 is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||||
| 10 | # Lesser General Public License for more details. | ||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||
| 12 | # You should have received a copy of the GNU Lesser | ||||||||||||||||||||||||||||
| 13 | # General Public License along with Marpa::R2. If not, see | ||||||||||||||||||||||||||||
| 14 | # http://www.gnu.org/licenses/. | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 23 | ▶ | use 5.010001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 23 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | package Marpa::R2::HTML::Callback; | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 23 | ▶ | use vars qw( $VERSION $STRING_VERSION ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 23 | $VERSION = '13.003_000'; | |||||||||||||||||||||||||||
| 24 | 23 | $STRING_VERSION = $VERSION; | |||||||||||||||||||||||||||
| 25 | ## use critic (BuiltinFunctions::ProhibitStringyEval) | ||||||||||||||||||||||||||||
| 26 | 23 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||
| 27 | ## no critic | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | package Marpa::R2::HTML::Internal::Callback; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 23 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub Marpa::R2::HTML::start_tag { | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 97 | ▶ | my $parse_instance = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
start_tag: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 97 | ▶ | Marpa::R2::exception(q{Attempt to fetch start tag outside of a parse}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | if not defined $parse_instance; | ||||||||||||||||||||||||||||
| 38 | 97 | ▶ | return undef if not defined $Marpa::R2::HTML::Internal::START_TAG_IX; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | return ${ | ||||||||||||||||||||||||||||
| 41 | 42 | Marpa::R2::HTML::Internal::token_range_to_original( | |||||||||||||||||||||||||||
| 42 | $parse_instance, | ||||||||||||||||||||||||||||
| 43 | $Marpa::R2::HTML::Internal::START_TAG_IX, | ||||||||||||||||||||||||||||
| 44 | $Marpa::R2::HTML::Internal::START_TAG_IX | ||||||||||||||||||||||||||||
| 45 | ) | ||||||||||||||||||||||||||||
| 46 | }; | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | } ## end sub Marpa::R2::HTML::start_tag | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | # We do not always need the end tag, so it is found lazily, | ||||||||||||||||||||||||||||
| 51 | # unlike the start tag which is determined eagerly. | ||||||||||||||||||||||||||||
| 52 | # Return the end token ix, or undef if none. | ||||||||||||||||||||||||||||
| 53 | # As a side effect set $Marpa::R2::HTML::Internal::END_TAG_IX_REF | ||||||||||||||||||||||||||||
| 54 | # to be a reference to that result | ||||||||||||||||||||||||||||
| 55 | sub end_tag_set { | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 102 | ▶ | my $parse_instance = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
end_tag_set: called CC=6 SCAR=18.3
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # be idempotent -- but this is probably unnecessary | ||||||||||||||||||||||||||||
| 60 | 102 | ▶ | return ${$Marpa::R2::HTML::Internal::END_TAG_IX_REF} | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | if defined $Marpa::R2::HTML::Internal::END_TAG_IX_REF; | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | # default to no end tag | ||||||||||||||||||||||||||||
| 64 | 102 | $Marpa::R2::HTML::Internal::END_TAG_IX_REF = \undef; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | # return undef if the current rule is not an element | ||||||||||||||||||||||||||||
| 67 | 102 | ▶ | return undef if not $Marpa::R2::HTML::Internal::ELEMENT; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 102 | my $arg_n = $Marpa::R2::HTML::Internal::ARG_N; | |||||||||||||||||||||||||||
| 70 | 102 | my $end_tag_tdesc_item = $Marpa::R2::HTML::Internal::STACK->[$arg_n]; | |||||||||||||||||||||||||||
| 71 | 102 | my $end_tag_type = $end_tag_tdesc_item->[0]; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 102 | ▶ | return undef if not defined $end_tag_type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 102 | ▶ | return undef if $end_tag_type ne 'PHYSICAL_TOKEN'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 15 | my $end_tag_token_ix = | |||||||||||||||||||||||||||
| 77 | $end_tag_tdesc_item->[Marpa::R2::HTML::Internal::TDesc::END_TOKEN]; | ||||||||||||||||||||||||||||
| 78 | 15 | my $tokens = $parse_instance->{tokens}; | |||||||||||||||||||||||||||
| 79 | 15 | my $html_token = $tokens->[$end_tag_token_ix]; | |||||||||||||||||||||||||||
| 80 | 15 | my $html_token_type = | |||||||||||||||||||||||||||
| 81 | $html_token->[Marpa::R2::HTML::Internal::Token::TYPE]; | ||||||||||||||||||||||||||||
| 82 | 15 | ▶ | return undef if $html_token_type ne 'E'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 15 | $Marpa::R2::HTML::Internal::END_TAG_IX_REF = \$end_tag_token_ix; | |||||||||||||||||||||||||||
| 84 | 15 | return $end_tag_token_ix; | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | } ## end sub end_tag_set | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | sub Marpa::R2::HTML::end_tag { | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 97 | ▶ | my $parse_instance = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
end_tag: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 91 | 97 | ▶ | Marpa::R2::exception(q{Attempt to fetch an end tag outside of a parse}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | if not defined $parse_instance; | ||||||||||||||||||||||||||||
| 93 | 97 | ▶ | defined $Marpa::R2::HTML::Internal::END_TAG_IX_REF or end_tag_set(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 97 | my $end_tag_token_ix = ${$Marpa::R2::HTML::Internal::END_TAG_IX_REF}; | |||||||||||||||||||||||||||
| 95 | 97 | ▶ | return undef if not defined $end_tag_token_ix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | return ${ | ||||||||||||||||||||||||||||
| 98 | 10 | Marpa::R2::HTML::Internal::token_range_to_original( $parse_instance, | |||||||||||||||||||||||||||
| 99 | $end_tag_token_ix, $end_tag_token_ix, ) | ||||||||||||||||||||||||||||
| 100 | }; | ||||||||||||||||||||||||||||
| 101 | } ## end sub Marpa::R2::HTML::end_tag | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | sub Marpa::R2::HTML::contents { | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 14 | ▶ | my $self = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
contents: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||
| 106 | 14 | ▶ | Marpa::R2::exception( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | q{Attempt to fetch an element contents outside of a parse}) | ||||||||||||||||||||||||||||
| 108 | if not defined $self; | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 14 | ▶ | return undef if not $Marpa::R2::HTML::Internal::ELEMENT; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 14 | ▶ | my $contents_start_ix = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | defined $Marpa::R2::HTML::Internal::START_TAG_IX | ||||||||||||||||||||||||||||
| 114 | ? $Marpa::R2::HTML::Internal::START_TAG_IX + 1 | ||||||||||||||||||||||||||||
| 115 | : $Marpa::R2::HTML::Internal::START_HTML_TOKEN_IX; | ||||||||||||||||||||||||||||
| 116 | 14 | ▶ | defined $Marpa::R2::HTML::Internal::END_TAG_IX_REF or end_tag_set(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 14 | my $end_tag_token_ix = ${$Marpa::R2::HTML::Internal::END_TAG_IX_REF}; | |||||||||||||||||||||||||||
| 118 | 14 | ▶ | my $contents_end_ix = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | defined $end_tag_token_ix | ||||||||||||||||||||||||||||
| 120 | ? $end_tag_token_ix + 1 | ||||||||||||||||||||||||||||
| 121 | : $Marpa::R2::HTML::Internal::END_HTML_TOKEN_IX; | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | # An element does not necessarily have any tokens | ||||||||||||||||||||||||||||
| 124 | 14 | ▶ | return q{} if not defined $contents_start_ix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | my $content_values = [ | ||||||||||||||||||||||||||||
| 127 | 13 | @{$Marpa::R2::HTML::Internal::STACK}[ | |||||||||||||||||||||||||||
| 128 | ( $Marpa::R2::HTML::Internal::ARG_0 + 1 ) | ||||||||||||||||||||||||||||
| 129 | .. ( $Marpa::R2::HTML::Internal::ARG_N - 1 ) | ||||||||||||||||||||||||||||
| 130 | ] | ||||||||||||||||||||||||||||
| 131 | ]; | ||||||||||||||||||||||||||||
| 132 | return ${ | ||||||||||||||||||||||||||||
| 133 | 13 | Marpa::R2::HTML::Internal::range_and_values_to_literal( $self, | |||||||||||||||||||||||||||
| 134 | $contents_start_ix, $contents_end_ix, $content_values ) | ||||||||||||||||||||||||||||
| 135 | }; | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | } ## end sub Marpa::R2::HTML::contents | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | sub Marpa::R2::HTML::values { | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 34 | ▶ | my $parse_instance = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
values: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 142 | 34 | ▶ | Marpa::R2::exception(q{Attempt to examine rule while not in a parse}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | if not defined $parse_instance; | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 34 | my @flat_tdesc_list = (); | |||||||||||||||||||||||||||
| 146 | STACK_IX: | ||||||||||||||||||||||||||||
| 147 | 34 | for my $stack_ix ( | |||||||||||||||||||||||||||
| 148 | $Marpa::R2::HTML::Internal::ARG_0 .. $Marpa::R2::HTML::Internal::ARG_N | ||||||||||||||||||||||||||||
| 149 | ) | ||||||||||||||||||||||||||||
| 150 | { | ||||||||||||||||||||||||||||
| 151 | 119 | my $tdesc_item = $Marpa::R2::HTML::Internal::STACK->[$stack_ix]; | |||||||||||||||||||||||||||
| 152 | 119 | my $type = $tdesc_item->[0]; | |||||||||||||||||||||||||||
| 153 | 119 | ▶ | next STACK_IX if not defined $type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 119 | ▶ | if ( $type eq 'VALUES' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | push @flat_tdesc_list, | ||||||||||||||||||||||||||||
| 156 | 8 | @{ $tdesc_item->[Marpa::R2::HTML::Internal::TDesc::VALUE] }; | |||||||||||||||||||||||||||
| 157 | 8 | next STACK_IX; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | 111 | ▶ | if ( $type eq 'VALUED_SPAN' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | 26 | push @flat_tdesc_list, $tdesc_item; | |||||||||||||||||||||||||||
| 161 | 26 | next STACK_IX; | |||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | } ## end STACK_IX: for my $stack_ix ( $Marpa::R2::HTML::Internal::ARG_0 ...) | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 58 | return [ grep {defined} | |||||||||||||||||||||||||||
| 166 | 34 | map { $_->[Marpa::R2::HTML::Internal::TDesc::VALUE] } | |||||||||||||||||||||||||||
| 167 | @flat_tdesc_list ]; | ||||||||||||||||||||||||||||
| 168 | } ## end sub Marpa::R2::HTML::values | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | sub Marpa::R2::HTML::descendants { | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 543 | ▶ | my ($argspecs) = @_; | ||||||||||||||||||||||||||
|
Subroutine
descendants: called CC=34 SCAR=38.3
Pod
documented
| |||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 543 | my $parse_instance = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | |||||||||||||||||||||||||||
| 175 | 543 | ▶ | Marpa::R2::exception(q{Attempt to fetch an end tag outside of a parse}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | if not defined $parse_instance; | ||||||||||||||||||||||||||||
| 177 | 543 | my $tokens = $parse_instance->{tokens}; | |||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 543 | my @argspecs = (); | |||||||||||||||||||||||||||
| 180 | 543 | for my $argspec ( split /,/xms, $argspecs ) { | |||||||||||||||||||||||||||
| 181 | 1512 | $argspec =~ s/\A \s* //xms; | |||||||||||||||||||||||||||
| 182 | 1512 | $argspec =~ s/ \s* \z//xms; | |||||||||||||||||||||||||||
| 183 | 1512 | push @argspecs, $argspec; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 543 | my @flat_tdesc_list = (); | |||||||||||||||||||||||||||
| 187 | STACK_IX: | ||||||||||||||||||||||||||||
| 188 | 543 | for my $stack_ix ( | |||||||||||||||||||||||||||
| 189 | $Marpa::R2::HTML::Internal::ARG_0 .. $Marpa::R2::HTML::Internal::ARG_N | ||||||||||||||||||||||||||||
| 190 | ) | ||||||||||||||||||||||||||||
| 191 | { | ||||||||||||||||||||||||||||
| 192 | 1621 | my $tdesc_item = $Marpa::R2::HTML::Internal::STACK->[$stack_ix]; | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 1621 | my $type = $tdesc_item->[0]; | |||||||||||||||||||||||||||
| 195 | 1621 | ▶ | next STACK_IX if not defined $type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 1613 | ▶ | next STACK_IX if $type eq 'ZERO_SPAN'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 1504 | ▶ | next STACK_IX if $type eq 'RUBY_SLIPPERS_TOKEN'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 702 | ▶ | if ( $type eq 'VALUES' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | push @flat_tdesc_list, | ||||||||||||||||||||||||||||
| 200 | 152 | @{ $tdesc_item->[Marpa::R2::HTML::Internal::TDesc::VALUE] }; | |||||||||||||||||||||||||||
| 201 | 152 | next STACK_IX; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | 550 | push @flat_tdesc_list, $tdesc_item; | |||||||||||||||||||||||||||
| 204 | } ## end STACK_IX: for my $stack_ix ( $Marpa::R2::HTML::Internal::ARG_0 ...) | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 543 | my $next_token_ix = $Marpa::R2::HTML::Internal::START_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 207 | 543 | my $final_token_ix = $Marpa::R2::HTML::Internal::END_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 543 | my @descendants = (); | |||||||||||||||||||||||||||
| 210 | 543 | TDESC_ITEM: for my $tdesc_item (@flat_tdesc_list) { | |||||||||||||||||||||||||||
| 211 | my ( $tdesc_item_type, $next_explicit_token_ix, | ||||||||||||||||||||||||||||
| 212 | $furthest_explicit_token_ix ) | ||||||||||||||||||||||||||||
| 213 | 929 | = @{$tdesc_item}; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 929 | ▶ | if (not defined $next_explicit_token_ix) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | ## An element can contain no HTML tokens -- it may contain | ||||||||||||||||||||||||||||
| 217 | ## only Ruby Slippers tokens. | ||||||||||||||||||||||||||||
| 218 | ## Treat this as a special case. | ||||||||||||||||||||||||||||
| 219 | 95 | ▶ | if ( $tdesc_item_type eq 'VALUED_SPAN' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$tdesc_item_type eq "VALUED_SPAN" and defined $tdesc_item->[3]
MC/DC0%0/2
$tdesc_item_type eq "VALUED_SPAN" and defined $tdesc_item->[3]
$tdesc_item_type eq "VALUED_SPAN"
defined $tdesc_item->[3]
Truth table33%1/3
A and B
A= $tdesc_item_type eq "VALUED_SPAN"B= defined $tdesc_item->[3]
| |||||||||||||||||||||||||||||
| 220 | and defined $tdesc_item->[Marpa::R2::HTML::Internal::TDesc::VALUE] | ||||||||||||||||||||||||||||
| 221 | ) | ||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||
| 223 | 95 | push @descendants, [ 1, $tdesc_item ]; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | 95 | next TDESC_ITEM; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | push @descendants, | ||||||||||||||||||||||||||||
| 229 | 834 | map { [ 0, $_ ] } | |||||||||||||||||||||||||||
| 230 | ( $next_token_ix .. $next_explicit_token_ix - 1 ); | ||||||||||||||||||||||||||||
| 231 | 834 | ▶ | if ( $tdesc_item_type eq 'VALUED_SPAN' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$tdesc_item_type eq "VALUED_SPAN" and defined $tdesc_item->[3]
MC/DC100%2/2
$tdesc_item_type eq "VALUED_SPAN" and defined $tdesc_item->[3]
$tdesc_item_type eq "VALUED_SPAN"
defined $tdesc_item->[3]
Truth table100%3/3
A and B
A= $tdesc_item_type eq "VALUED_SPAN"B= defined $tdesc_item->[3]
| |||||||||||||||||||||||||||||
| 232 | and defined $tdesc_item->[Marpa::R2::HTML::Internal::TDesc::VALUE] | ||||||||||||||||||||||||||||
| 233 | ) | ||||||||||||||||||||||||||||
| 234 | { | ||||||||||||||||||||||||||||
| 235 | 475 | push @descendants, [ 1, $tdesc_item ]; | |||||||||||||||||||||||||||
| 236 | 475 | $next_token_ix = $furthest_explicit_token_ix + 1; | |||||||||||||||||||||||||||
| 237 | 475 | next TDESC_ITEM; | |||||||||||||||||||||||||||
| 238 | } ## end if ( $tdesc_item_type eq 'VALUED_SPAN' and defined ...) | ||||||||||||||||||||||||||||
| 239 | push @descendants, | ||||||||||||||||||||||||||||
| 240 | 359 | map { [ 0, $_ ] } | |||||||||||||||||||||||||||
| 241 | ( $next_explicit_token_ix .. $furthest_explicit_token_ix ); | ||||||||||||||||||||||||||||
| 242 | 359 | $next_token_ix = $furthest_explicit_token_ix + 1; | |||||||||||||||||||||||||||
| 243 | } ## end TDESC_ITEM: for my $tdesc_item (@flat_tdesc_list) | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | 543 | my @results; | |||||||||||||||||||||||||||
| 246 | 543 | DESCENDANT: for my $descendant (@descendants) { | |||||||||||||||||||||||||||
| 247 | 929 | my @per_descendant_results = (); | |||||||||||||||||||||||||||
| 248 | 929 | my ( $is_valued, $data ) = @{$descendant}; | |||||||||||||||||||||||||||
| 249 | 929 | ARGSPEC: for my $argspec_ix ( 0 .. $#argspecs ) { | |||||||||||||||||||||||||||
| 250 | ## Work with a copy, so we can change it | ||||||||||||||||||||||||||||
| 251 | 2519 | my $argspec = $argspecs[$argspec_ix]; | |||||||||||||||||||||||||||
| 252 | 2519 | my $deref = 1; | |||||||||||||||||||||||||||
| 253 | 2519 | ▶ | if ( $argspec =~ s/_ref\z//xms ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 254 | 0 | $deref = 0; | |||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | 2519 | ▶ | if ( $argspec eq 'literal' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 742 | ▶ | if ($is_valued) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 483 | push @per_descendant_results, | |||||||||||||||||||||||||||
| 259 | q{} | ||||||||||||||||||||||||||||
| 260 | . $data->[Marpa::R2::HTML::Internal::TDesc::VALUE]; | ||||||||||||||||||||||||||||
| 261 | 483 | next ARGSPEC; | |||||||||||||||||||||||||||
| 262 | } ## end if ($is_valued) | ||||||||||||||||||||||||||||
| 263 | 259 | $argspec = 'original'; | |||||||||||||||||||||||||||
| 264 | ## FALL THROUGH | ||||||||||||||||||||||||||||
| 265 | } ## end if ( $argspec eq 'literal' ) | ||||||||||||||||||||||||||||
| 266 | 2036 | ▶ | if ( $argspec eq 'value' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 268 | ▶ | my $value = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | $is_valued | ||||||||||||||||||||||||||||
| 269 | ? $data->[Marpa::R2::HTML::Internal::TDesc::VALUE] | ||||||||||||||||||||||||||||
| 270 | : undef; | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 268 | push @per_descendant_results, $value; | |||||||||||||||||||||||||||
| 273 | 268 | next ARGSPEC; | |||||||||||||||||||||||||||
| 274 | } ## end if ( $argspec eq 'value' ) | ||||||||||||||||||||||||||||
| 275 | 1768 | ▶ | if ( $argspec eq 'original' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | my ( $start_ix, $end_ix ) = | ||||||||||||||||||||||||||||
| 277 | $is_valued | ||||||||||||||||||||||||||||
| 278 | ? ( | ||||||||||||||||||||||||||||
| 279 | 446 | ▶ | @{$data}[ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | Marpa::R2::HTML::Internal::TDesc::START_TOKEN, | ||||||||||||||||||||||||||||
| 281 | Marpa::R2::HTML::Internal::TDesc::END_TOKEN | ||||||||||||||||||||||||||||
| 282 | ] | ||||||||||||||||||||||||||||
| 283 | ) | ||||||||||||||||||||||||||||
| 284 | : ( $data, $data ); | ||||||||||||||||||||||||||||
| 285 | 446 | my $result = | |||||||||||||||||||||||||||
| 286 | Marpa::R2::HTML::Internal::token_range_to_original( | ||||||||||||||||||||||||||||
| 287 | $parse_instance, $start_ix, $end_ix ); | ||||||||||||||||||||||||||||
| 288 | 446 | ▶ | $result = ${$result} if $deref; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 446 | push @per_descendant_results, $result; | |||||||||||||||||||||||||||
| 290 | 446 | next ARGSPEC; | |||||||||||||||||||||||||||
| 291 | } ## end if ( $argspec eq 'original' ) | ||||||||||||||||||||||||||||
| 292 | 1322 | ▶ | if ( $argspec eq 'token_type' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 293 | 661 | ▶ | if ($is_valued) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 294 | 449 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 295 | 449 | next ARGSPEC; | |||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | 212 | my $token_ix = $data; | |||||||||||||||||||||||||||
| 298 | 212 | my $html_token = $tokens->[$token_ix]; | |||||||||||||||||||||||||||
| 299 | 212 | push @per_descendant_results, | |||||||||||||||||||||||||||
| 300 | $html_token->[Marpa::R2::HTML::Internal::Token::TYPE]; | ||||||||||||||||||||||||||||
| 301 | 212 | next ARGSPEC; | |||||||||||||||||||||||||||
| 302 | } ## end if ( $argspec eq 'token_type' ) | ||||||||||||||||||||||||||||
| 303 | 661 | ▶ | if ( $argspec eq 'element' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 304 | 661 | ▶ | if ( not $is_valued ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | 212 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 306 | 212 | next ARGSPEC; | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | 449 | my $rule_id = | |||||||||||||||||||||||||||
| 309 | $data->[Marpa::R2::HTML::Internal::TDesc::RULE_ID]; | ||||||||||||||||||||||||||||
| 310 | my $action = | ||||||||||||||||||||||||||||
| 311 | 449 | $parse_instance->{action_by_rule_id}->[$rule_id]; | |||||||||||||||||||||||||||
| 312 | 449 | ▶ | if ( not defined $action ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 313 | 293 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 314 | 293 | next ARGSPEC; | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | 156 | ▶ | if ( ( index $action, 'ELE_' ) != 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 317 | 0 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 318 | 0 | next ARGSPEC; | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | 156 | push @per_descendant_results, ( substr $action, 4 ); | |||||||||||||||||||||||||||
| 321 | 156 | next ARGSPEC; | |||||||||||||||||||||||||||
| 322 | } ## end if ( $argspec eq 'element' ) | ||||||||||||||||||||||||||||
| 323 | 0 | ▶ | if ( $argspec eq 'pseudoclass' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 324 | ## This argspec needs to be better defined/implemented | ||||||||||||||||||||||||||||
| 325 | ## As of VERSION 2.021_000 it has been removed | ||||||||||||||||||||||||||||
| 326 | ## from the documentation. | ||||||||||||||||||||||||||||
| 327 | 0 | ▶ | if ( not $is_valued ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 328 | 0 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 329 | 0 | next ARGSPEC; | |||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | 0 | my $rule_id = | |||||||||||||||||||||||||||
| 332 | $data->[Marpa::R2::HTML::Internal::TDesc::RULE_ID]; | ||||||||||||||||||||||||||||
| 333 | my $action = | ||||||||||||||||||||||||||||
| 334 | 0 | $parse_instance->{action_by_rule_id}->[$rule_id]; | |||||||||||||||||||||||||||
| 335 | 0 | ▶ | if ( not defined $action ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 336 | 0 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 337 | 0 | next ARGSPEC; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if ( ( index $action, 'SPE_' ) != 0 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 340 | 0 | push @per_descendant_results, undef; | |||||||||||||||||||||||||||
| 341 | 0 | next ARGSPEC; | |||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | 0 | push @per_descendant_results, ( substr $action, 4 ); | |||||||||||||||||||||||||||
| 344 | 0 | push @per_descendant_results, $action; | |||||||||||||||||||||||||||
| 345 | 0 | next ARGSPEC; | |||||||||||||||||||||||||||
| 346 | } ## end if ( $argspec eq 'pseudoclass' ) | ||||||||||||||||||||||||||||
| 347 | 0 | die "Unimplemented argspec: $argspec"; | |||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | } ## end ARGSPEC: for my $argspec_ix ( 0 .. $#argspecs ) | ||||||||||||||||||||||||||||
| 350 | 929 | push @results, \@per_descendant_results; | |||||||||||||||||||||||||||
| 351 | } ## end CHILD: for my $child (@children) | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | 543 | return \@results; | |||||||||||||||||||||||||||
| 354 | } ## end sub Marpa::R2::HTML::descendants | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | sub Marpa::R2::HTML::attributes { | ||||||||||||||||||||||||||||
| 357 | 426 | ▶ | return $Marpa::R2::HTML::Internal::ATTRIBUTES // {}; | ||||||||||||||||||||||||||
|
Subroutine
attributes: called CC=2 SCAR=6.9
Pod
documented
Condition100%2/2
$Marpa::R2::HTML::Internal::ATTRIBUTES // {}
MC/DC100%1/1
$Marpa::R2::HTML::Internal::ATTRIBUTES // {}
$Marpa::R2::HTML::Internal::ATTRIBUTES
Truth table100%2/2
A
A= $Marpa::R2::HTML::Internal::ATTRIBUTES
| |||||||||||||||||||||||||||||
| 358 | } ## end sub Marpa::R2::HTML::attributes | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | # This assumes that a start token, if there is one | ||||||||||||||||||||||||||||
| 361 | # with attributes, is the first token | ||||||||||||||||||||||||||||
| 362 | sub create_fetch_attribute_closure { | ||||||||||||||||||||||||||||
| 363 | 69 | ▶ | my ($attribute) = @_; | ||||||||||||||||||||||||||
|
Subroutine
create_fetch_attribute_closure: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 364 | return sub { | ||||||||||||||||||||||||||||
| 365 | 7 | ▶ | my $attributes = $Marpa::R2::HTML::Internal::ATTRIBUTES; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 366 | 7 | ▶ | return undef if not defined $attributes; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 367 | 4 | return $attributes->{$attribute}; | |||||||||||||||||||||||||||
| 368 | 69 | }; | |||||||||||||||||||||||||||
| 369 | } ## end sub create_fetch_attribute_closure | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 23 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 372 | 23 | *{'Marpa::R2::HTML::id'} = create_fetch_attribute_closure('id'); | |||||||||||||||||||||||||||
| 373 | 23 | *{'Marpa::R2::HTML::class'} = create_fetch_attribute_closure('class'); | |||||||||||||||||||||||||||
| 374 | 23 | *{'Marpa::R2::HTML::title'} = create_fetch_attribute_closure('title'); | |||||||||||||||||||||||||||
| 375 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | package Marpa::R2::HTML::Internal::Callback; | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | sub Marpa::R2::HTML::tagname { | ||||||||||||||||||||||||||||
| 380 | 555 | ▶ | return $Marpa::R2::HTML::Internal::ELEMENT; | ||||||||||||||||||||||||||
|
Subroutine
tagname: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | sub Marpa::R2::HTML::is_empty_element { | ||||||||||||||||||||||||||||
| 384 | 90 | ▶ | return undef if not defined $Marpa::R2::HTML::Internal::ELEMENT; | ||||||||||||||||||||||||||
|
Subroutine
is_empty_element: called CC=2 SCAR=7.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 385 | 90 | my $self = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | |||||||||||||||||||||||||||
| 386 | 90 | return $self->{is_empty_element}->{$Marpa::R2::HTML::Internal::ELEMENT}; | |||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | sub Marpa::R2::HTML::species { | ||||||||||||||||||||||||||||
| 390 | 0 | ▶ | return $Marpa::R2::HTML::Internal::SPECIES; | ||||||||||||||||||||||||||
|
Subroutine
species: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | sub Marpa::R2::HTML::literal_ref { | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 117 | ▶ | my $self = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
literal_ref: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||
| 396 | 117 | ▶ | Marpa::R2::exception( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 397 | q{Attempt to fetch an element contents outside of a parse}) | ||||||||||||||||||||||||||||
| 398 | if not defined $self; | ||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | 117 | my $contents_start_ix = $Marpa::R2::HTML::Internal::START_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||
| 402 | # A rule does not necessarily have any tokens | ||||||||||||||||||||||||||||
| 403 | 117 | ▶ | return \q{} if not defined $contents_start_ix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | 117 | my $contents_end_ix = $Marpa::R2::HTML::Internal::END_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | my $content_values = [ | ||||||||||||||||||||||||||||
| 408 | 117 | @{$Marpa::R2::HTML::Internal::STACK}[ | |||||||||||||||||||||||||||
| 409 | ($Marpa::R2::HTML::Internal::ARG_0) | ||||||||||||||||||||||||||||
| 410 | .. ($Marpa::R2::HTML::Internal::ARG_N) | ||||||||||||||||||||||||||||
| 411 | ] | ||||||||||||||||||||||||||||
| 412 | ]; | ||||||||||||||||||||||||||||
| 413 | 117 | return Marpa::R2::HTML::Internal::range_and_values_to_literal( $self, | |||||||||||||||||||||||||||
| 414 | $contents_start_ix, $contents_end_ix, $content_values ); | ||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||
| 416 | } ## end sub Marpa::R2::HTML::literal_ref | ||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | sub Marpa::R2::HTML::literal { | ||||||||||||||||||||||||||||
| 419 | 117 | ▶ | return ${Marpa::R2::HTML::literal_ref()}; | ||||||||||||||||||||||||||
|
Subroutine
literal: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 420 | } ## end sub Marpa::R2::HTML::literal | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | sub Marpa::R2::HTML::offset { | ||||||||||||||||||||||||||||
| 423 | 7 | ▶ | my $self = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
offset: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 424 | 7 | my $start_token_ix = $Marpa::R2::HTML::Internal::START_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 425 | 7 | ▶ | return undef if not defined $start_token_ix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 426 | 6 | my $tokens = $self->{tokens}; | |||||||||||||||||||||||||||
| 427 | 6 | return $tokens->[$start_token_ix] | |||||||||||||||||||||||||||
| 428 | ->[Marpa::R2::HTML::Internal::Token::START_OFFSET]; | ||||||||||||||||||||||||||||
| 429 | } ## end sub Marpa::R2::HTML::offset | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | sub Marpa::R2::HTML::token_type { | ||||||||||||||||||||||||||||
| 432 | 9 | ▶ | my $self = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
token_type: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 433 | 9 | my $start_token_ix = $Marpa::R2::HTML::Internal::START_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 434 | 9 | ▶ | return undef if not defined $start_token_ix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 435 | 9 | my $tokens = $self->{tokens}; | |||||||||||||||||||||||||||
| 436 | 9 | return $tokens->[$start_token_ix] | |||||||||||||||||||||||||||
| 437 | ->[Marpa::R2::HTML::Internal::Token::TYPE]; | ||||||||||||||||||||||||||||
| 438 | } ## end sub Marpa::R2::HTML::token_type | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | sub Marpa::R2::HTML::original_ref { | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | 4 | ▶ | my $self = $Marpa::R2::HTML::Internal::PARSE_INSTANCE; | ||||||||||||||||||||||||||
|
Subroutine
original_ref: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 443 | 4 | ▶ | Marpa::R2::exception(q{Attempt to look at a rule while not in a parse}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 444 | if not defined $self; | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | 4 | my $start_token_ix = $Marpa::R2::HTML::Internal::START_HTML_TOKEN_IX; | |||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | # An rule does not necessarily have any HTML tokens | ||||||||||||||||||||||||||||
| 449 | 4 | ▶ | return q{} if not defined $start_token_ix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 4 | return Marpa::R2::HTML::Internal::token_range_to_original( $self, | |||||||||||||||||||||||||||
| 452 | $start_token_ix, $Marpa::R2::HTML::Internal::END_HTML_TOKEN_IX ); | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | } ## end sub Marpa::R2::HTML::original_ref | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | sub Marpa::R2::HTML::original { | ||||||||||||||||||||||||||||
| 457 | 4 | ▶ | return ${Marpa::R2::HTML::original_ref()}; | ||||||||||||||||||||||||||
|
Subroutine
original: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 23 | 1; | |||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | # vim: set expandtab shiftwidth=4: | ||||||||||||||||||||||||||||