| 3331 |
}; # $in_body |
}; # $in_body |
| 3332 |
|
|
| 3333 |
B: { |
B: { |
| 3334 |
if ($self->{insertion_mode} ne 'trailing end') { |
if ($token->{type} eq 'DOCTYPE') { |
| 3335 |
if ($token->{type} eq 'DOCTYPE') { |
!!!parse-error (type => 'DOCTYPE in the middle'); |
| 3336 |
!!!parse-error (type => 'in html:#DOCTYPE'); |
## Ignore the token |
| 3337 |
## Ignore the token |
## Stay in the phase |
| 3338 |
## Stay in the phase |
!!!next-token; |
| 3339 |
!!!next-token; |
redo B; |
| 3340 |
redo B; |
} elsif ($token->{type} eq 'end-of-file') { |
| 3341 |
} elsif ($token->{type} eq 'start tag' and |
if ($token->{insertion_mode} ne 'trailing end') { |
|
$token->{tag_name} eq 'html') { |
|
|
## ISSUE: "aa<html>" is not a parse error. |
|
|
## ISSUE: "<html>" in fragment is not a parse error. |
|
|
unless ($token->{first_start_tag}) { |
|
|
!!!parse-error (type => 'not first start tag'); |
|
|
} |
|
|
my $top_el = $self->{open_elements}->[0]->[0]; |
|
|
for my $attr_name (keys %{$token->{attributes}}) { |
|
|
unless ($top_el->has_attribute_ns (undef, $attr_name)) { |
|
|
$top_el->set_attribute_ns |
|
|
(undef, [undef, $attr_name], |
|
|
$token->{attributes}->{$attr_name}->{value}); |
|
|
} |
|
|
} |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{type} eq 'end-of-file') { |
|
| 3342 |
## Generate implied end tags |
## Generate implied end tags |
| 3343 |
if ({ |
if ({ |
| 3344 |
dd => 1, dt => 1, li => 1, p => 1, td => 1, th => 1, tr => 1, |
dd => 1, dt => 1, li => 1, p => 1, td => 1, th => 1, tr => 1, |
| 3358 |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
!!!parse-error (type => 'not closed:'.$self->{open_elements}->[-1]->[1]); |
| 3359 |
} |
} |
| 3360 |
|
|
|
## Stop parsing |
|
|
last B; |
|
|
|
|
| 3361 |
## ISSUE: There is an issue in the spec. |
## ISSUE: There is an issue in the spec. |
| 3362 |
|
} |
| 3363 |
|
|
| 3364 |
|
## Stop parsing |
| 3365 |
|
last B; |
| 3366 |
|
} elsif ($token->{type} eq 'start tag' and |
| 3367 |
|
$token->{tag_name} eq 'html') { |
| 3368 |
|
if ($self->{insertion_mode} eq 'trailing end') { |
| 3369 |
|
## Turn into the main phase |
| 3370 |
|
!!!parse-error (type => 'after html:html'); |
| 3371 |
|
$self->{insertion_mode} = $previous_insertion_mode; |
| 3372 |
|
} |
| 3373 |
|
|
| 3374 |
|
## ISSUE: "aa<html>" is not a parse error. |
| 3375 |
|
## ISSUE: "<html>" in fragment is not a parse error. |
| 3376 |
|
unless ($token->{first_start_tag}) { |
| 3377 |
|
!!!parse-error (type => 'not first start tag'); |
| 3378 |
|
} |
| 3379 |
|
my $top_el = $self->{open_elements}->[0]->[0]; |
| 3380 |
|
for my $attr_name (keys %{$token->{attributes}}) { |
| 3381 |
|
unless ($top_el->has_attribute_ns (undef, $attr_name)) { |
| 3382 |
|
$top_el->set_attribute_ns |
| 3383 |
|
(undef, [undef, $attr_name], |
| 3384 |
|
$token->{attributes}->{$attr_name}->{value}); |
| 3385 |
|
} |
| 3386 |
|
} |
| 3387 |
|
!!!next-token; |
| 3388 |
|
redo B; |
| 3389 |
|
} elsif ($token->{type} eq 'comment') { |
| 3390 |
|
my $comment = $self->{document}->create_comment ($token->{data}); |
| 3391 |
|
if ($self->{insertion_mode} eq 'trailing end') { |
| 3392 |
|
$self->{document}->append_child ($comment); |
| 3393 |
|
} elsif ($self->{insertion_mode} eq 'after body') { |
| 3394 |
|
$self->{open_elements}->[0]->[0]->append_child ($comment); |
| 3395 |
} else { |
} else { |
| 3396 |
if ($self->{insertion_mode} eq 'before head') { |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
| 3397 |
|
} |
| 3398 |
|
!!!next-token; |
| 3399 |
|
redo B; |
| 3400 |
|
} elsif ($self->{insertion_mode} eq 'before head') { |
| 3401 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
| 3402 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
| 3403 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
| 3413 |
$self->{insertion_mode} = 'in head'; |
$self->{insertion_mode} = 'in head'; |
| 3414 |
## reprocess |
## reprocess |
| 3415 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 3416 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 3417 |
my $attr = $token->{tag_name} eq 'head' ? $token->{attributes} : {}; |
my $attr = $token->{tag_name} eq 'head' ? $token->{attributes} : {}; |
| 3418 |
!!!create-element ($self->{head_element}, 'head', $attr); |
!!!create-element ($self->{head_element}, 'head', $attr); |
| 3464 |
} |
} |
| 3465 |
|
|
| 3466 |
# |
# |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 3467 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 3468 |
if ({base => ($self->{insertion_mode} eq 'in head' or |
if ({base => ($self->{insertion_mode} eq 'in head' or |
| 3469 |
$self->{insertion_mode} eq 'after head'), |
$self->{insertion_mode} eq 'after head'), |
| 3642 |
|
|
| 3643 |
!!!next-token; |
!!!next-token; |
| 3644 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
## NOTE: There is a code clone of "comment in body". |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 3645 |
} else { |
} else { |
| 3646 |
$in_body->($insert_to_current); |
$in_body->($insert_to_current); |
| 3647 |
redo B; |
redo B; |
| 3705 |
|
|
| 3706 |
!!!next-token; |
!!!next-token; |
| 3707 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 3708 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 3709 |
if ({ |
if ({ |
| 3710 |
caption => 1, |
caption => 1, |
| 3871 |
|
|
| 3872 |
!!!next-token; |
!!!next-token; |
| 3873 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
## NOTE: This is a code clone of "comment in body". |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 3874 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 3875 |
if ({ |
if ({ |
| 3876 |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
caption => 1, col => 1, colgroup => 1, tbody => 1, |
| 4052 |
} |
} |
| 4053 |
|
|
| 4054 |
# |
# |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 4055 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 4056 |
if ($token->{tag_name} eq 'col') { |
if ($token->{tag_name} eq 'col') { |
| 4057 |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
| 4157 |
|
|
| 4158 |
!!!next-token; |
!!!next-token; |
| 4159 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
## Copied from 'in table' |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 4160 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 4161 |
if ({ |
if ({ |
| 4162 |
tr => 1, |
tr => 1, |
| 4436 |
|
|
| 4437 |
!!!next-token; |
!!!next-token; |
| 4438 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
## Copied from 'in table' |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 4439 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 4440 |
if ($token->{tag_name} eq 'th' or |
if ($token->{tag_name} eq 'th' or |
| 4441 |
$token->{tag_name} eq 'td') { |
$token->{tag_name} eq 'td') { |
| 4695 |
|
|
| 4696 |
!!!next-token; |
!!!next-token; |
| 4697 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
## NOTE: This is a code clone of "comment in body". |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 4698 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 4699 |
if ({ |
if ({ |
| 4700 |
caption => 1, col => 1, colgroup => 1, |
caption => 1, col => 1, colgroup => 1, |
| 4831 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($token->{data}); |
| 4832 |
!!!next-token; |
!!!next-token; |
| 4833 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 4834 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 4835 |
if ($token->{tag_name} eq 'option') { |
if ($token->{tag_name} eq 'option') { |
| 4836 |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
if ($self->{open_elements}->[-1]->[1] eq 'option') { |
| 5016 |
} |
} |
| 5017 |
|
|
| 5018 |
# |
# |
| 5019 |
!!!parse-error (type => 'after body:#'.$token->{type}); |
!!!parse-error (type => 'after body:#character'); |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[0]->[0]->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
| 5020 |
} elsif ($token->{type} eq 'start tag') { |
} elsif ($token->{type} eq 'start tag') { |
| 5021 |
!!!parse-error (type => 'after body:'.$token->{tag_name}); |
!!!parse-error (type => 'after body:'.$token->{tag_name}); |
| 5022 |
# |
# |
| 5037 |
!!!parse-error (type => 'after body:/'.$token->{tag_name}); |
!!!parse-error (type => 'after body:/'.$token->{tag_name}); |
| 5038 |
} |
} |
| 5039 |
} else { |
} else { |
| 5040 |
!!!parse-error (type => 'after body:#'.$token->{type}); |
die "$0: $token->{type}: Unknown token type"; |
| 5041 |
} |
} |
| 5042 |
|
|
| 5043 |
$self->{insertion_mode} = 'in body'; |
$self->{insertion_mode} = 'in body'; |
| 5044 |
## reprocess |
## reprocess |
| 5045 |
redo B; |
redo B; |
| 5046 |
} elsif ($self->{insertion_mode} eq 'in frameset') { |
} elsif ($self->{insertion_mode} eq 'in frameset') { |
| 5047 |
if ($token->{type} eq 'character') { |
if ($token->{type} eq 'character') { |
| 5048 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
| 5049 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
|
|
|
|
unless (length $token->{data}) { |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} |
|
|
} |
|
| 5050 |
|
|
| 5051 |
# |
unless (length $token->{data}) { |
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
|
| 5052 |
!!!next-token; |
!!!next-token; |
| 5053 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'start tag') { |
|
|
if ($token->{tag_name} eq 'frameset') { |
|
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'frame') { |
|
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
|
|
pop @{$self->{open_elements}}; |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{tag_name} eq 'noframes') { |
|
|
$in_body->($insert_to_current); |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} elsif ($token->{type} eq 'end tag') { |
|
|
if ($token->{tag_name} eq 'frameset') { |
|
|
if ($self->{open_elements}->[-1]->[1] eq 'html' and |
|
|
@{$self->{open_elements}} == 1) { |
|
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
} else { |
|
|
pop @{$self->{open_elements}}; |
|
|
!!!next-token; |
|
|
} |
|
|
|
|
|
## if not inner_html and |
|
|
if ($self->{open_elements}->[-1]->[1] ne 'frameset') { |
|
|
$self->{insertion_mode} = 'after frameset'; |
|
|
} |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} else { |
|
|
# |
|
| 5054 |
} |
} |
| 5055 |
|
} |
| 5056 |
if (defined $token->{tag_name}) { |
|
| 5057 |
!!!parse-error (type => 'in frameset:'.($token->{type} eq 'end tag' ? '/' : '').$token->{tag_name}); |
!!!parse-error (type => 'in frameset:#character'); |
| 5058 |
|
## Ignore the token |
| 5059 |
|
!!!next-token; |
| 5060 |
|
redo B; |
| 5061 |
|
} elsif ($token->{type} eq 'start tag') { |
| 5062 |
|
if ($token->{tag_name} eq 'frameset') { |
| 5063 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
| 5064 |
|
!!!next-token; |
| 5065 |
|
redo B; |
| 5066 |
|
} elsif ($token->{tag_name} eq 'frame') { |
| 5067 |
|
!!!insert-element ($token->{tag_name}, $token->{attributes}); |
| 5068 |
|
pop @{$self->{open_elements}}; |
| 5069 |
|
!!!next-token; |
| 5070 |
|
redo B; |
| 5071 |
|
} elsif ($token->{tag_name} eq 'noframes') { |
| 5072 |
|
$in_body->($insert_to_current); |
| 5073 |
|
redo B; |
| 5074 |
|
} else { |
| 5075 |
|
!!!parse-error (type => 'in frameset:'.$token->{tag_name}); |
| 5076 |
|
## Ignore the token |
| 5077 |
|
!!!next-token; |
| 5078 |
|
redo B; |
| 5079 |
|
} |
| 5080 |
|
} elsif ($token->{type} eq 'end tag') { |
| 5081 |
|
if ($token->{tag_name} eq 'frameset') { |
| 5082 |
|
if ($self->{open_elements}->[-1]->[1] eq 'html' and |
| 5083 |
|
@{$self->{open_elements}} == 1) { |
| 5084 |
|
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
| 5085 |
|
## Ignore the token |
| 5086 |
|
!!!next-token; |
| 5087 |
} else { |
} else { |
| 5088 |
!!!parse-error (type => 'in frameset:#'.$token->{type}); |
pop @{$self->{open_elements}}; |
| 5089 |
|
!!!next-token; |
| 5090 |
} |
} |
| 5091 |
|
|
| 5092 |
|
if (not defined $self->{inner_html_node} and |
| 5093 |
|
$self->{open_elements}->[-1]->[1] ne 'frameset') { |
| 5094 |
|
$self->{insertion_mode} = 'after frameset'; |
| 5095 |
|
} |
| 5096 |
|
redo B; |
| 5097 |
|
} else { |
| 5098 |
|
!!!parse-error (type => 'in frameset:/'.$token->{tag_name}); |
| 5099 |
## Ignore the token |
## Ignore the token |
| 5100 |
!!!next-token; |
!!!next-token; |
| 5101 |
redo B; |
redo B; |
| 5102 |
} elsif ($self->{insertion_mode} eq 'after frameset') { |
} |
| 5103 |
if ($token->{type} eq 'character') { |
} else { |
| 5104 |
|
die "$0: $token->{type}: Unknown token type"; |
| 5105 |
|
} |
| 5106 |
|
} elsif ($self->{insertion_mode} eq 'after frameset') { |
| 5107 |
|
if ($token->{type} eq 'character') { |
| 5108 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
| 5109 |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
$self->{open_elements}->[-1]->[0]->manakai_append_text ($1); |
| 5110 |
|
|
| 5125 |
} |
} |
| 5126 |
redo B; |
redo B; |
| 5127 |
} |
} |
| 5128 |
} elsif ($token->{type} eq 'comment') { |
|
| 5129 |
my $comment = $self->{document}->create_comment ($token->{data}); |
die qq[$0: Character "$token->{data}"]; |
| 5130 |
$self->{open_elements}->[-1]->[0]->append_child ($comment); |
} elsif ($token->{type} eq 'start tag') { |
| 5131 |
!!!next-token; |
if ($token->{tag_name} eq 'noframes') { |
| 5132 |
redo B; |
$in_body->($insert_to_current); |
| 5133 |
} elsif ($token->{type} eq 'start tag') { |
redo B; |
| 5134 |
if ($token->{tag_name} eq 'noframes') { |
} else { |
| 5135 |
$in_body->($insert_to_current); |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}); |
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} elsif ($token->{type} eq 'end tag') { |
|
|
if ($token->{tag_name} eq 'html') { |
|
|
$previous_insertion_mode = $self->{insertion_mode}; |
|
|
$self->{insertion_mode} = 'trailing end'; |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} else { |
|
|
# |
|
|
} |
|
|
} else { |
|
|
die "$0: $token->{type}: Unknown token type"; |
|
|
} |
|
|
|
|
|
!!!parse-error (type => 'after frameset:'.($token->{tag_name} eq 'end tag' ? '/' : '').$token->{tag_name}); |
|
| 5136 |
## Ignore the token |
## Ignore the token |
| 5137 |
!!!next-token; |
!!!next-token; |
| 5138 |
redo B; |
redo B; |
| 5139 |
|
} |
| 5140 |
## ISSUE: An issue in spec there |
} elsif ($token->{type} eq 'end tag') { |
| 5141 |
|
if ($token->{tag_name} eq 'html') { |
| 5142 |
|
$previous_insertion_mode = $self->{insertion_mode}; |
| 5143 |
|
$self->{insertion_mode} = 'trailing end'; |
| 5144 |
|
!!!next-token; |
| 5145 |
|
redo B; |
| 5146 |
} else { |
} else { |
| 5147 |
die "$0: $self->{insertion_mode}: Unknown insertion mode"; |
!!!parse-error (type => 'after frameset:/'.$token->{tag_name}); |
| 5148 |
|
## Ignore the token |
| 5149 |
|
!!!next-token; |
| 5150 |
|
redo B; |
| 5151 |
} |
} |
| 5152 |
|
} else { |
| 5153 |
|
die "$0: $token->{type}: Unknown token type"; |
| 5154 |
} |
} |
| 5155 |
|
|
| 5156 |
|
## ISSUE: An issue in spec here |
| 5157 |
} elsif ($self->{insertion_mode} eq 'trailing end') { |
} elsif ($self->{insertion_mode} eq 'trailing end') { |
| 5158 |
## states in the main stage is preserved yet # MUST |
## states in the main stage is preserved yet # MUST |
| 5159 |
|
|
| 5160 |
if ($token->{type} eq 'DOCTYPE') { |
if ($token->{type} eq 'character') { |
|
!!!parse-error (type => 'after html:#DOCTYPE'); |
|
|
## Ignore the token |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{type} eq 'comment') { |
|
|
my $comment = $self->{document}->create_comment ($token->{data}); |
|
|
$self->{document}->append_child ($comment); |
|
|
!!!next-token; |
|
|
redo B; |
|
|
} elsif ($token->{type} eq 'character') { |
|
| 5161 |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
if ($token->{data} =~ s/^([\x09\x0A\x0B\x0C\x20]+)//) { |
| 5162 |
my $data = $1; |
my $data = $1; |
| 5163 |
## As if in the main phase. |
## As if in the main phase. |
| 5178 |
$self->{insertion_mode} = $previous_insertion_mode; |
$self->{insertion_mode} = $previous_insertion_mode; |
| 5179 |
## reprocess |
## reprocess |
| 5180 |
redo B; |
redo B; |
| 5181 |
} elsif ($token->{type} eq 'start tag' or |
} elsif ($token->{type} eq 'start tag') { |
| 5182 |
$token->{type} eq 'end tag') { |
!!!parse-error (type => 'after html:'.$token->{tag_name}); |
| 5183 |
!!!parse-error (type => 'after html:'.($token->{type} eq 'end tag' ? '/' : '').$token->{tag_name}); |
$self->{insertion_mode} = $previous_insertion_mode; |
| 5184 |
|
## reprocess |
| 5185 |
|
redo B; |
| 5186 |
|
} elsif ($token->{type} eq 'end tag') { |
| 5187 |
|
!!!parse-error (type => 'after html:/'.$token->{tag_name}); |
| 5188 |
$self->{insertion_mode} = $previous_insertion_mode; |
$self->{insertion_mode} = $previous_insertion_mode; |
| 5189 |
## reprocess |
## reprocess |
| 5190 |
redo B; |
redo B; |
|
} elsif ($token->{type} eq 'end-of-file') { |
|
|
## Stop parsing |
|
|
last B; |
|
| 5191 |
} else { |
} else { |
| 5192 |
die "$0: $token->{type}: Unknown token"; |
die "$0: $token->{type}: Unknown token"; |
| 5193 |
} |
} |
| 5194 |
|
} else { |
| 5195 |
|
die "$0: $self->{insertion_mode}: Unknown insertion mode"; |
| 5196 |
} |
} |
| 5197 |
} # B |
} # B |
| 5198 |
|
|