443 |
allow_fallback => 1, byte_buffer => \$byte_buffer); |
allow_fallback => 1, byte_buffer => \$byte_buffer); |
444 |
if ($char_stream) { |
if ($char_stream) { |
445 |
$buffer->{buffer} = $byte_buffer; |
$buffer->{buffer} = $byte_buffer; |
446 |
!!!parse-error (type => 'sniffing:chardet', ## TODO: type name |
!!!parse-error (type => 'sniffing:chardet', |
447 |
value => $charset_name, |
text => $charset_name, |
448 |
level => $self->{info_level}, |
level => $self->{level}->{info}, |
449 |
|
layer => 'encode', |
450 |
line => 1, column => 1); |
line => 1, column => 1); |
451 |
$self->{confident} = 0; |
$self->{confident} = 0; |
452 |
last SNIFFING; |
last SNIFFING; |
467 |
allow_fallback => 1, |
allow_fallback => 1, |
468 |
byte_buffer => \$byte_buffer); |
byte_buffer => \$byte_buffer); |
469 |
$buffer->{buffer} = $byte_buffer; |
$buffer->{buffer} = $byte_buffer; |
470 |
!!!parse-error (type => 'sniffing:default', ## TODO: type name |
!!!parse-error (type => 'sniffing:default', |
471 |
value => 'windows-1252', |
text => 'windows-1252', |
472 |
level => $self->{info_level}, |
level => $self->{level}->{info}, |
473 |
line => 1, column => 1); |
line => 1, column => 1, |
474 |
|
layer => 'encode'); |
475 |
$self->{confident} = 0; |
$self->{confident} = 0; |
476 |
} # SNIFFING |
} # SNIFFING |
477 |
|
|
478 |
$self->{input_encoding} = $charset->get_iana_name; |
$self->{input_encoding} = $charset->get_iana_name; |
479 |
if ($e_status & Message::Charset::Info::FALLBACK_ENCODING_IMPL ()) { |
if ($e_status & Message::Charset::Info::FALLBACK_ENCODING_IMPL ()) { |
480 |
!!!parse-error (type => 'chardecode:fallback', ## TODO: type name |
!!!parse-error (type => 'chardecode:fallback', |
481 |
value => $self->{input_encoding}, |
text => $self->{input_encoding}, |
482 |
level => $self->{unsupported_level}, |
level => $self->{level}->{uncertain}, |
483 |
line => 1, column => 1); |
line => 1, column => 1, |
484 |
|
layer => 'encode'); |
485 |
} elsif (not ($e_status & |
} elsif (not ($e_status & |
486 |
Message::Charset::Info::ERROR_REPORTING_ENCODING_IMPL())) { |
Message::Charset::Info::ERROR_REPORTING_ENCODING_IMPL())) { |
487 |
!!!parse-error (type => 'chardecode:no error', ## TODO: type name |
!!!parse-error (type => 'chardecode:no error', |
488 |
value => $self->{input_encoding}, |
text => $self->{input_encoding}, |
489 |
level => $self->{unsupported_level}, |
level => $self->{level}->{uncertain}, |
490 |
line => 1, column => 1); |
line => 1, column => 1, |
491 |
|
layer => 'encode'); |
492 |
} |
} |
493 |
|
|
494 |
$self->{change_encoding} = sub { |
$self->{change_encoding} = sub { |
517 |
## Step 2 |
## Step 2 |
518 |
if (defined $self->{input_encoding} and |
if (defined $self->{input_encoding} and |
519 |
$self->{input_encoding} eq $charset_name) { |
$self->{input_encoding} eq $charset_name) { |
520 |
!!!parse-error (type => 'charset label:matching', ## TODO: type |
!!!parse-error (type => 'charset label:matching', |
521 |
value => $charset_name, |
text => $charset_name, |
522 |
level => $self->{info_level}); |
level => $self->{level}->{info}); |
523 |
$self->{confident} = 1; |
$self->{confident} = 1; |
524 |
return; |
return; |
525 |
} |
} |
526 |
|
|
527 |
!!!parse-error (type => 'charset label detected:'.$self->{input_encoding}. |
!!!parse-error (type => 'charset label detected', |
528 |
':'.$charset_name, level => 'w', token => $token); |
text => $self->{input_encoding}, |
529 |
|
value => $charset_name, |
530 |
|
level => $self->{level}->{warn}, |
531 |
|
token => $token); |
532 |
|
|
533 |
## Step 3 |
## Step 3 |
534 |
# if (can) { |
# if (can) { |
544 |
|
|
545 |
my $char_onerror = sub { |
my $char_onerror = sub { |
546 |
my (undef, $type, %opt) = @_; |
my (undef, $type, %opt) = @_; |
547 |
!!!parse-error (%opt, type => $type, |
!!!parse-error (layer => 'encode', |
548 |
|
%opt, type => $type, |
549 |
line => $self->{line}, column => $self->{column} + 1); |
line => $self->{line}, column => $self->{column} + 1); |
550 |
if ($opt{octets}) { |
if ($opt{octets}) { |
551 |
${$opt{octets}} = "\x{FFFD}"; # relacement character |
${$opt{octets}} = "\x{FFFD}"; # relacement character |
562 |
|
|
563 |
$self->{input_encoding} = $charset->get_iana_name; |
$self->{input_encoding} = $charset->get_iana_name; |
564 |
if ($e_status & Message::Charset::Info::FALLBACK_ENCODING_IMPL ()) { |
if ($e_status & Message::Charset::Info::FALLBACK_ENCODING_IMPL ()) { |
565 |
!!!parse-error (type => 'chardecode:fallback', ## TODO: type name |
!!!parse-error (type => 'chardecode:fallback', |
566 |
value => $self->{input_encoding}, |
text => $self->{input_encoding}, |
567 |
level => $self->{unsupported_level}, |
level => $self->{level}->{uncertain}, |
568 |
line => 1, column => 1); |
line => 1, column => 1, |
569 |
|
layer => 'encode'); |
570 |
} elsif (not ($e_status & |
} elsif (not ($e_status & |
571 |
Message::Charset::Info::ERROR_REPORTING_ENCODING_IMPL())) { |
Message::Charset::Info::ERROR_REPORTING_ENCODING_IMPL())) { |
572 |
!!!parse-error (type => 'chardecode:no error', ## TODO: type name |
!!!parse-error (type => 'chardecode:no error', |
573 |
value => $self->{input_encoding}, |
text => $self->{input_encoding}, |
574 |
level => $self->{unsupported_level}, |
level => $self->{level}->{uncertain}, |
575 |
line => 1, column => 1); |
line => 1, column => 1, |
576 |
|
layer => 'encode'); |
577 |
} |
} |
578 |
$self->{confident} = 1; |
$self->{confident} = 1; |
579 |
$char_stream->onerror ($char_onerror); |
$char_stream->onerror ($char_onerror); |
672 |
0x10FFFE => 1, 0x10FFFF => 1, |
0x10FFFE => 1, 0x10FFFF => 1, |
673 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
674 |
!!!cp ('j5'); |
!!!cp ('j5'); |
675 |
!!!parse-error (type => 'control char', level => $self->{must_level}); |
if ($self->{next_char} < 0x10000) { |
676 |
## TODO: error type documentation |
!!!parse-error (type => 'control char', |
677 |
|
text => (sprintf 'U+%04X', $self->{next_char})); |
678 |
|
} else { |
679 |
|
!!!parse-error (type => 'control char', |
680 |
|
text => (sprintf 'U-%08X', $self->{next_char})); |
681 |
|
} |
682 |
} |
} |
683 |
}; |
}; |
684 |
$self->{prev_char} = [-1, -1, -1]; |
$self->{prev_char} = [-1, -1, -1]; |
707 |
sub new ($) { |
sub new ($) { |
708 |
my $class = shift; |
my $class = shift; |
709 |
my $self = bless { |
my $self = bless { |
710 |
must_level => 'm', |
level => {must => 'm', |
711 |
should_level => 's', |
warn => 'w', |
712 |
good_level => 'w', |
info => 'i', |
713 |
warn_level => 'w', |
uncertain => 'u'}, |
|
info_level => 'i', |
|
|
unsupported_level => 'u', |
|
714 |
}, $class; |
}, $class; |
715 |
$self->{set_next_char} = sub { |
$self->{set_next_char} = sub { |
716 |
$self->{next_char} = -1; |
$self->{next_char} = -1; |
1369 |
if (exists $self->{current_token}->{attributes} # start tag or end tag |
if (exists $self->{current_token}->{attributes} # start tag or end tag |
1370 |
->{$self->{current_attribute}->{name}}) { # MUST |
->{$self->{current_attribute}->{name}}) { # MUST |
1371 |
!!!cp (57); |
!!!cp (57); |
1372 |
!!!parse-error (type => 'duplicate attribute:'.$self->{current_attribute}->{name}, line => $self->{current_attribute}->{line}, column => $self->{current_attribute}->{column}); |
!!!parse-error (type => 'duplicate attribute', text => $self->{current_attribute}->{name}, line => $self->{current_attribute}->{line}, column => $self->{current_attribute}->{column}); |
1373 |
## Discard $self->{current_attribute} # MUST |
## Discard $self->{current_attribute} # MUST |
1374 |
} else { |
} else { |
1375 |
!!!cp (58); |
!!!cp (58); |
2680 |
redo A; |
redo A; |
2681 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
2682 |
!!!cp (208); |
!!!cp (208); |
2683 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2684 |
|
|
2685 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2686 |
!!!next-input-character; |
!!!next-input-character; |
2716 |
redo A; |
redo A; |
2717 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
2718 |
!!!cp (212); |
!!!cp (212); |
2719 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2720 |
|
|
2721 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2722 |
!!!next-input-character; |
!!!next-input-character; |
2925 |
|
|
2926 |
if ($code == 0 or (0xD800 <= $code and $code <= 0xDFFF)) { |
if ($code == 0 or (0xD800 <= $code and $code <= 0xDFFF)) { |
2927 |
!!!cp (1008); |
!!!cp (1008); |
2928 |
!!!parse-error (type => (sprintf 'invalid character reference:U+%04X', $code), line => $l, column => $c); |
!!!parse-error (type => 'invalid character reference', |
2929 |
|
text => (sprintf 'U+%04X', $code), |
2930 |
|
line => $l, column => $c); |
2931 |
$code = 0xFFFD; |
$code = 0xFFFD; |
2932 |
} elsif ($code > 0x10FFFF) { |
} elsif ($code > 0x10FFFF) { |
2933 |
!!!cp (1009); |
!!!cp (1009); |
2934 |
!!!parse-error (type => (sprintf 'invalid character reference:U-%08X', $code), line => $l, column => $c); |
!!!parse-error (type => 'invalid character reference', |
2935 |
|
text => (sprintf 'U-%08X', $code), |
2936 |
|
line => $l, column => $c); |
2937 |
$code = 0xFFFD; |
$code = 0xFFFD; |
2938 |
} elsif ($code == 0x000D) { |
} elsif ($code == 0x000D) { |
2939 |
!!!cp (1010); |
!!!cp (1010); |
2941 |
$code = 0x000A; |
$code = 0x000A; |
2942 |
} elsif (0x80 <= $code and $code <= 0x9F) { |
} elsif (0x80 <= $code and $code <= 0x9F) { |
2943 |
!!!cp (1011); |
!!!cp (1011); |
2944 |
!!!parse-error (type => (sprintf 'C1 character reference:U+%04X', $code), line => $l, column => $c); |
!!!parse-error (type => 'C1 character reference', text => (sprintf 'U+%04X', $code), line => $l, column => $c); |
2945 |
$code = $c1_entity_char->{$code}; |
$code = $c1_entity_char->{$code}; |
2946 |
} |
} |
2947 |
|
|
2974 |
|
|
2975 |
if ($code == 0 or (0xD800 <= $code and $code <= 0xDFFF)) { |
if ($code == 0 or (0xD800 <= $code and $code <= 0xDFFF)) { |
2976 |
!!!cp (1015); |
!!!cp (1015); |
2977 |
!!!parse-error (type => (sprintf 'invalid character reference:U+%04X', $code), line => $l, column => $c); |
!!!parse-error (type => 'invalid character reference', |
2978 |
|
text => (sprintf 'U+%04X', $code), |
2979 |
|
line => $l, column => $c); |
2980 |
$code = 0xFFFD; |
$code = 0xFFFD; |
2981 |
} elsif ($code > 0x10FFFF) { |
} elsif ($code > 0x10FFFF) { |
2982 |
!!!cp (1016); |
!!!cp (1016); |
2983 |
!!!parse-error (type => (sprintf 'invalid character reference:U-%08X', $code), line => $l, column => $c); |
!!!parse-error (type => 'invalid character reference', |
2984 |
|
text => (sprintf 'U-%08X', $code), |
2985 |
|
line => $l, column => $c); |
2986 |
$code = 0xFFFD; |
$code = 0xFFFD; |
2987 |
} elsif ($code == 0x000D) { |
} elsif ($code == 0x000D) { |
2988 |
!!!cp (1017); |
!!!cp (1017); |
2989 |
!!!parse-error (type => 'CR character reference', line => $l, column => $c); |
!!!parse-error (type => 'CR character reference', |
2990 |
|
line => $l, column => $c); |
2991 |
$code = 0x000A; |
$code = 0x000A; |
2992 |
} elsif (0x80 <= $code and $code <= 0x9F) { |
} elsif (0x80 <= $code and $code <= 0x9F) { |
2993 |
!!!cp (1018); |
!!!cp (1018); |
2994 |
!!!parse-error (type => (sprintf 'C1 character reference:U+%04X', $code), line => $l, column => $c); |
!!!parse-error (type => 'C1 character reference', |
2995 |
|
text => (sprintf 'U+%04X', $code), |
2996 |
|
line => $l, column => $c); |
2997 |
$code = $c1_entity_char->{$code}; |
$code = $c1_entity_char->{$code}; |
2998 |
} |
} |
2999 |
|
|
3341 |
B: { |
B: { |
3342 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
3343 |
!!!cp ('t19'); |
!!!cp ('t19'); |
3344 |
!!!parse-error (type => 'in html:#DOCTYPE', token => $token); ## TODO: type |
!!!parse-error (type => 'in html:#DOCTYPE', token => $token); |
3345 |
## Ignore the token |
## Ignore the token |
3346 |
## Stay in the insertion mode. |
## Stay in the insertion mode. |
3347 |
!!!next-token; |
!!!next-token; |
3658 |
## NOTE: An end-of-file token. |
## NOTE: An end-of-file token. |
3659 |
if ($content_model_flag == CDATA_CONTENT_MODEL) { |
if ($content_model_flag == CDATA_CONTENT_MODEL) { |
3660 |
!!!cp ('t43'); |
!!!cp ('t43'); |
3661 |
!!!parse-error (type => 'in CDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in CDATA:#eof', token => $token); |
3662 |
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
} elsif ($content_model_flag == RCDATA_CONTENT_MODEL) { |
3663 |
!!!cp ('t44'); |
!!!cp ('t44'); |
3664 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in RCDATA:#eof', token => $token); |
3665 |
} else { |
} else { |
3666 |
die "$0: $content_model_flag in parse_rcdata"; |
die "$0: $content_model_flag in parse_rcdata"; |
3667 |
} |
} |
3698 |
## Ignore the token |
## Ignore the token |
3699 |
} else { |
} else { |
3700 |
!!!cp ('t48'); |
!!!cp ('t48'); |
3701 |
!!!parse-error (type => 'in CDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in CDATA:#eof', token => $token); |
3702 |
## ISSUE: And ignore? |
## ISSUE: And ignore? |
3703 |
## TODO: mark as "already executed" |
## TODO: mark as "already executed" |
3704 |
} |
} |
3749 |
} # AFE |
} # AFE |
3750 |
unless (defined $formatting_element) { |
unless (defined $formatting_element) { |
3751 |
!!!cp ('t53'); |
!!!cp ('t53'); |
3752 |
!!!parse-error (type => 'unmatched end tag:'.$tag_name, token => $end_tag_token); |
!!!parse-error (type => 'unmatched end tag', text => $tag_name, token => $end_tag_token); |
3753 |
## Ignore the token |
## Ignore the token |
3754 |
!!!next-token; |
!!!next-token; |
3755 |
return; |
return; |
3766 |
last INSCOPE; |
last INSCOPE; |
3767 |
} else { # in open elements but not in scope |
} else { # in open elements but not in scope |
3768 |
!!!cp ('t55'); |
!!!cp ('t55'); |
3769 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, |
!!!parse-error (type => 'unmatched end tag', |
3770 |
|
text => $token->{tag_name}, |
3771 |
token => $end_tag_token); |
token => $end_tag_token); |
3772 |
## Ignore the token |
## Ignore the token |
3773 |
!!!next-token; |
!!!next-token; |
3780 |
} # INSCOPE |
} # INSCOPE |
3781 |
unless (defined $formatting_element_i_in_open) { |
unless (defined $formatting_element_i_in_open) { |
3782 |
!!!cp ('t57'); |
!!!cp ('t57'); |
3783 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, |
!!!parse-error (type => 'unmatched end tag', |
3784 |
|
text => $token->{tag_name}, |
3785 |
token => $end_tag_token); |
token => $end_tag_token); |
3786 |
pop @$active_formatting_elements; # $formatting_element |
pop @$active_formatting_elements; # $formatting_element |
3787 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
3790 |
if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) { |
if (not $self->{open_elements}->[-1]->[0] eq $formatting_element->[0]) { |
3791 |
!!!cp ('t58'); |
!!!cp ('t58'); |
3792 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
3793 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
3794 |
->manakai_local_name, |
->manakai_local_name, |
3795 |
token => $end_tag_token); |
token => $end_tag_token); |
3796 |
} |
} |
3999 |
B: while (1) { |
B: while (1) { |
4000 |
if ($token->{type} == DOCTYPE_TOKEN) { |
if ($token->{type} == DOCTYPE_TOKEN) { |
4001 |
!!!cp ('t73'); |
!!!cp ('t73'); |
4002 |
!!!parse-error (type => 'DOCTYPE in the middle', token => $token); |
!!!parse-error (type => 'in html:#DOCTYPE', token => $token); |
4003 |
## Ignore the token |
## Ignore the token |
4004 |
## Stay in the phase |
## Stay in the phase |
4005 |
!!!next-token; |
!!!next-token; |
4008 |
$token->{tag_name} eq 'html') { |
$token->{tag_name} eq 'html') { |
4009 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
4010 |
!!!cp ('t79'); |
!!!cp ('t79'); |
4011 |
!!!parse-error (type => 'after html:html', token => $token); |
!!!parse-error (type => 'after html', text => 'html', token => $token); |
4012 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
4013 |
} elsif ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
4014 |
!!!cp ('t80'); |
!!!cp ('t80'); |
4015 |
!!!parse-error (type => 'after html:html', token => $token); |
!!!parse-error (type => 'after html', text => 'html', token => $token); |
4016 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
4017 |
} else { |
} else { |
4018 |
!!!cp ('t81'); |
!!!cp ('t81'); |
4073 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
4074 |
!!!cp ('t87.2'); |
!!!cp ('t87.2'); |
4075 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
4076 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
4077 |
->manakai_local_name, |
->manakai_local_name, |
4078 |
token => $token); |
token => $token); |
4079 |
|
|
4151 |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
} elsif ($token->{type} == END_OF_FILE_TOKEN) { |
4152 |
!!!cp ('t87.6'); |
!!!cp ('t87.6'); |
4153 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
4154 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
4155 |
->manakai_local_name, |
->manakai_local_name, |
4156 |
token => $token); |
token => $token); |
4157 |
|
|
4201 |
!!!cp ('t90'); |
!!!cp ('t90'); |
4202 |
## As if </noscript> |
## As if </noscript> |
4203 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4204 |
!!!parse-error (type => 'in noscript:#character', token => $token); |
!!!parse-error (type => 'in noscript:#text', token => $token); |
4205 |
|
|
4206 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4207 |
## As if </head> |
## As if </head> |
4238 |
next B; |
next B; |
4239 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4240 |
!!!cp ('t93.2'); |
!!!cp ('t93.2'); |
4241 |
!!!parse-error (type => 'after head:head', token => $token); ## TODO: error type |
!!!parse-error (type => 'after head', text => 'head', |
4242 |
|
token => $token); |
4243 |
## Ignore the token |
## Ignore the token |
4244 |
!!!nack ('t93.3'); |
!!!nack ('t93.3'); |
4245 |
!!!next-token; |
!!!next-token; |
4246 |
next B; |
next B; |
4247 |
} else { |
} else { |
4248 |
!!!cp ('t95'); |
!!!cp ('t95'); |
4249 |
!!!parse-error (type => 'in head:head', token => $token); # or in head noscript |
!!!parse-error (type => 'in head:head', |
4250 |
|
token => $token); # or in head noscript |
4251 |
## Ignore the token |
## Ignore the token |
4252 |
!!!nack ('t95.1'); |
!!!nack ('t95.1'); |
4253 |
!!!next-token; |
!!!next-token; |
4272 |
!!!cp ('t98'); |
!!!cp ('t98'); |
4273 |
## As if </noscript> |
## As if </noscript> |
4274 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4275 |
!!!parse-error (type => 'in noscript:base', token => $token); |
!!!parse-error (type => 'in noscript', text => 'base', |
4276 |
|
token => $token); |
4277 |
|
|
4278 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
4279 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4284 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
4285 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4286 |
!!!cp ('t100'); |
!!!cp ('t100'); |
4287 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head', |
4288 |
|
text => $token->{tag_name}, token => $token); |
4289 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4290 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4291 |
} else { |
} else { |
4302 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
4303 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4304 |
!!!cp ('t102'); |
!!!cp ('t102'); |
4305 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head', |
4306 |
|
text => $token->{tag_name}, token => $token); |
4307 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4308 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4309 |
} else { |
} else { |
4320 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
4321 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4322 |
!!!cp ('t104'); |
!!!cp ('t104'); |
4323 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head', |
4324 |
|
text => $token->{tag_name}, token => $token); |
4325 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4326 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4327 |
} else { |
} else { |
4390 |
!!!cp ('t111'); |
!!!cp ('t111'); |
4391 |
## As if </noscript> |
## As if </noscript> |
4392 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4393 |
!!!parse-error (type => 'in noscript:title', token => $token); |
!!!parse-error (type => 'in noscript', text => 'title', |
4394 |
|
token => $token); |
4395 |
|
|
4396 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
4397 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4398 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4399 |
!!!cp ('t112'); |
!!!cp ('t112'); |
4400 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head', |
4401 |
|
text => $token->{tag_name}, token => $token); |
4402 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4403 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4404 |
} else { |
} else { |
4419 |
## NOTE: There is a "as if in head" code clone. |
## NOTE: There is a "as if in head" code clone. |
4420 |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
if ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4421 |
!!!cp ('t114'); |
!!!cp ('t114'); |
4422 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head', |
4423 |
|
text => $token->{tag_name}, token => $token); |
4424 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4425 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4426 |
} else { |
} else { |
4441 |
next B; |
next B; |
4442 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
4443 |
!!!cp ('t117'); |
!!!cp ('t117'); |
4444 |
!!!parse-error (type => 'in noscript:noscript', token => $token); |
!!!parse-error (type => 'in noscript', text => 'noscript', |
4445 |
|
token => $token); |
4446 |
## Ignore the token |
## Ignore the token |
4447 |
!!!nack ('t117.1'); |
!!!nack ('t117.1'); |
4448 |
!!!next-token; |
!!!next-token; |
4456 |
!!!cp ('t119'); |
!!!cp ('t119'); |
4457 |
## As if </noscript> |
## As if </noscript> |
4458 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4459 |
!!!parse-error (type => 'in noscript:script', token => $token); |
!!!parse-error (type => 'in noscript', text => 'script', |
4460 |
|
token => $token); |
4461 |
|
|
4462 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
4463 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4464 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4465 |
!!!cp ('t120'); |
!!!cp ('t120'); |
4466 |
!!!parse-error (type => 'after head:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after head', |
4467 |
|
text => $token->{tag_name}, token => $token); |
4468 |
push @{$self->{open_elements}}, |
push @{$self->{open_elements}}, |
4469 |
[$self->{head_element}, $el_category->{head}]; |
[$self->{head_element}, $el_category->{head}]; |
4470 |
} else { |
} else { |
4482 |
!!!cp ('t122'); |
!!!cp ('t122'); |
4483 |
## As if </noscript> |
## As if </noscript> |
4484 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4485 |
!!!parse-error (type => 'in noscript:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in noscript', |
4486 |
|
text => $token->{tag_name}, token => $token); |
4487 |
|
|
4488 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4489 |
## As if </head> |
## As if </head> |
4522 |
!!!cp ('t129'); |
!!!cp ('t129'); |
4523 |
## As if </noscript> |
## As if </noscript> |
4524 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4525 |
!!!parse-error (type => 'in noscript:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in noscript:/', |
4526 |
|
text => $token->{tag_name}, token => $token); |
4527 |
|
|
4528 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4529 |
## As if </head> |
## As if </head> |
4566 |
!!!cp ('t133'); |
!!!cp ('t133'); |
4567 |
## As if </noscript> |
## As if </noscript> |
4568 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4569 |
!!!parse-error (type => 'in noscript:/head', token => $token); |
!!!parse-error (type => 'in noscript:/', |
4570 |
|
text => 'head', token => $token); |
4571 |
|
|
4572 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4573 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4582 |
next B; |
next B; |
4583 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4584 |
!!!cp ('t134.1'); |
!!!cp ('t134.1'); |
4585 |
!!!parse-error (type => 'unmatched end tag:head', token => $token); |
!!!parse-error (type => 'unmatched end tag', text => 'head', |
4586 |
|
token => $token); |
4587 |
## Ignore the token |
## Ignore the token |
4588 |
!!!next-token; |
!!!next-token; |
4589 |
next B; |
next B; |
4600 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM or |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM or |
4601 |
$self->{insertion_mode} == AFTER_HEAD_IM) { |
$self->{insertion_mode} == AFTER_HEAD_IM) { |
4602 |
!!!cp ('t137'); |
!!!cp ('t137'); |
4603 |
!!!parse-error (type => 'unmatched end tag:noscript', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4604 |
|
text => 'noscript', token => $token); |
4605 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
4606 |
!!!next-token; |
!!!next-token; |
4607 |
next B; |
next B; |
4616 |
$self->{insertion_mode} == IN_HEAD_IM or |
$self->{insertion_mode} == IN_HEAD_IM or |
4617 |
$self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
$self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
4618 |
!!!cp ('t140'); |
!!!cp ('t140'); |
4619 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4620 |
|
text => $token->{tag_name}, token => $token); |
4621 |
## Ignore the token |
## Ignore the token |
4622 |
!!!next-token; |
!!!next-token; |
4623 |
next B; |
next B; |
4624 |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
} elsif ($self->{insertion_mode} == AFTER_HEAD_IM) { |
4625 |
!!!cp ('t140.1'); |
!!!cp ('t140.1'); |
4626 |
!!!parse-error (type => 'unmatched end tag:' . $token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4627 |
|
text => $token->{tag_name}, token => $token); |
4628 |
## Ignore the token |
## Ignore the token |
4629 |
!!!next-token; |
!!!next-token; |
4630 |
next B; |
next B; |
4633 |
} |
} |
4634 |
} elsif ($token->{tag_name} eq 'p') { |
} elsif ($token->{tag_name} eq 'p') { |
4635 |
!!!cp ('t142'); |
!!!cp ('t142'); |
4636 |
!!!parse-error (type => 'unmatched end tag:p', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4637 |
|
text => $token->{tag_name}, token => $token); |
4638 |
## Ignore the token |
## Ignore the token |
4639 |
!!!next-token; |
!!!next-token; |
4640 |
next B; |
next B; |
4657 |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
} elsif ($self->{insertion_mode} == IN_HEAD_NOSCRIPT_IM) { |
4658 |
!!!cp ('t143.3'); |
!!!cp ('t143.3'); |
4659 |
## ISSUE: Two parse errors for <head><noscript></br> |
## ISSUE: Two parse errors for <head><noscript></br> |
4660 |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4661 |
|
text => 'br', token => $token); |
4662 |
## As if </noscript> |
## As if </noscript> |
4663 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4664 |
$self->{insertion_mode} = IN_HEAD_IM; |
$self->{insertion_mode} = IN_HEAD_IM; |
4677 |
} |
} |
4678 |
|
|
4679 |
## ISSUE: does not agree with IE7 - it doesn't ignore </br>. |
## ISSUE: does not agree with IE7 - it doesn't ignore </br>. |
4680 |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4681 |
|
text => 'br', token => $token); |
4682 |
## Ignore the token |
## Ignore the token |
4683 |
!!!next-token; |
!!!next-token; |
4684 |
next B; |
next B; |
4685 |
} else { |
} else { |
4686 |
!!!cp ('t145'); |
!!!cp ('t145'); |
4687 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4688 |
|
text => $token->{tag_name}, token => $token); |
4689 |
## Ignore the token |
## Ignore the token |
4690 |
!!!next-token; |
!!!next-token; |
4691 |
next B; |
next B; |
4695 |
!!!cp ('t146'); |
!!!cp ('t146'); |
4696 |
## As if </noscript> |
## As if </noscript> |
4697 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
4698 |
!!!parse-error (type => 'in noscript:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in noscript:/', |
4699 |
|
text => $token->{tag_name}, token => $token); |
4700 |
|
|
4701 |
## Reprocess in the "in head" insertion mode... |
## Reprocess in the "in head" insertion mode... |
4702 |
## As if </head> |
## As if </head> |
4712 |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
} elsif ($self->{insertion_mode} == BEFORE_HEAD_IM) { |
4713 |
## ISSUE: This case cannot be reached? |
## ISSUE: This case cannot be reached? |
4714 |
!!!cp ('t148'); |
!!!cp ('t148'); |
4715 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4716 |
|
text => $token->{tag_name}, token => $token); |
4717 |
## Ignore the token ## ISSUE: An issue in the spec. |
## Ignore the token ## ISSUE: An issue in the spec. |
4718 |
!!!next-token; |
!!!next-token; |
4719 |
next B; |
next B; |
4824 |
|
|
4825 |
!!!cp ('t153'); |
!!!cp ('t153'); |
4826 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
4827 |
value => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
4828 |
## Ignore the token |
## Ignore the token |
4829 |
!!!nack ('t153.1'); |
!!!nack ('t153.1'); |
4830 |
!!!next-token; |
!!!next-token; |
4831 |
next B; |
next B; |
4832 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
4833 |
!!!parse-error (type => 'not closed:caption', token => $token); |
!!!parse-error (type => 'not closed', text => 'caption', |
4834 |
|
token => $token); |
4835 |
|
|
4836 |
## NOTE: As if </caption>. |
## NOTE: As if </caption>. |
4837 |
## have a table element in table scope |
## have a table element in table scope |
4851 |
|
|
4852 |
!!!cp ('t157'); |
!!!cp ('t157'); |
4853 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
4854 |
value => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
4855 |
## Ignore the token |
## Ignore the token |
4856 |
!!!nack ('t157.1'); |
!!!nack ('t157.1'); |
4857 |
!!!next-token; |
!!!next-token; |
4868 |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
4869 |
!!!cp ('t159'); |
!!!cp ('t159'); |
4870 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
4871 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
4872 |
->manakai_local_name, |
->manakai_local_name, |
4873 |
token => $token); |
token => $token); |
4874 |
} else { |
} else { |
4910 |
} # INSCOPE |
} # INSCOPE |
4911 |
unless (defined $i) { |
unless (defined $i) { |
4912 |
!!!cp ('t165'); |
!!!cp ('t165'); |
4913 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4914 |
|
text => $token->{tag_name}, |
4915 |
|
token => $token); |
4916 |
## Ignore the token |
## Ignore the token |
4917 |
!!!next-token; |
!!!next-token; |
4918 |
next B; |
next B; |
4929 |
ne $token->{tag_name}) { |
ne $token->{tag_name}) { |
4930 |
!!!cp ('t167'); |
!!!cp ('t167'); |
4931 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
4932 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
4933 |
->manakai_local_name, |
->manakai_local_name, |
4934 |
token => $token); |
token => $token); |
4935 |
} else { |
} else { |
4946 |
next B; |
next B; |
4947 |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
} elsif ($self->{insertion_mode} == IN_CAPTION_IM) { |
4948 |
!!!cp ('t169'); |
!!!cp ('t169'); |
4949 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
4950 |
|
text => $token->{tag_name}, token => $token); |
4951 |
## Ignore the token |
## Ignore the token |
4952 |
!!!next-token; |
!!!next-token; |
4953 |
next B; |
next B; |
4974 |
|
|
4975 |
!!!cp ('t173'); |
!!!cp ('t173'); |
4976 |
!!!parse-error (type => 'unmatched end tag', |
!!!parse-error (type => 'unmatched end tag', |
4977 |
value => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
4978 |
## Ignore the token |
## Ignore the token |
4979 |
!!!next-token; |
!!!next-token; |
4980 |
next B; |
next B; |
4990 |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
4991 |
!!!cp ('t175'); |
!!!cp ('t175'); |
4992 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
4993 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
4994 |
->manakai_local_name, |
->manakai_local_name, |
4995 |
token => $token); |
token => $token); |
4996 |
} else { |
} else { |
5007 |
next B; |
next B; |
5008 |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
} elsif ($self->{insertion_mode} == IN_CELL_IM) { |
5009 |
!!!cp ('t177'); |
!!!cp ('t177'); |
5010 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5011 |
|
text => $token->{tag_name}, token => $token); |
5012 |
## Ignore the token |
## Ignore the token |
5013 |
!!!next-token; |
!!!next-token; |
5014 |
next B; |
next B; |
5051 |
|
|
5052 |
!!!cp ('t182'); |
!!!cp ('t182'); |
5053 |
!!!parse-error (type => 'unmatched end tag', |
!!!parse-error (type => 'unmatched end tag', |
5054 |
value => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
5055 |
## Ignore the token |
## Ignore the token |
5056 |
!!!next-token; |
!!!next-token; |
5057 |
next B; |
next B; |
5058 |
} # INSCOPE |
} # INSCOPE |
5059 |
} elsif ($token->{tag_name} eq 'table' and |
} elsif ($token->{tag_name} eq 'table' and |
5060 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
5061 |
!!!parse-error (type => 'not closed:caption', token => $token); |
!!!parse-error (type => 'not closed', text => 'caption', |
5062 |
|
token => $token); |
5063 |
|
|
5064 |
## As if </caption> |
## As if </caption> |
5065 |
## have a table element in table scope |
## have a table element in table scope |
5077 |
} # INSCOPE |
} # INSCOPE |
5078 |
unless (defined $i) { |
unless (defined $i) { |
5079 |
!!!cp ('t186'); |
!!!cp ('t186'); |
5080 |
!!!parse-error (type => 'unmatched end tag:caption', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5081 |
|
text => 'caption', token => $token); |
5082 |
## Ignore the token |
## Ignore the token |
5083 |
!!!next-token; |
!!!next-token; |
5084 |
next B; |
next B; |
5093 |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
unless ($self->{open_elements}->[-1]->[1] & CAPTION_EL) { |
5094 |
!!!cp ('t188'); |
!!!cp ('t188'); |
5095 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
5096 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
5097 |
->manakai_local_name, |
->manakai_local_name, |
5098 |
token => $token); |
token => $token); |
5099 |
} else { |
} else { |
5113 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5114 |
if ($self->{insertion_mode} & BODY_TABLE_IMS) { |
if ($self->{insertion_mode} & BODY_TABLE_IMS) { |
5115 |
!!!cp ('t190'); |
!!!cp ('t190'); |
5116 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5117 |
|
text => $token->{tag_name}, token => $token); |
5118 |
## Ignore the token |
## Ignore the token |
5119 |
!!!next-token; |
!!!next-token; |
5120 |
next B; |
next B; |
5128 |
}->{$token->{tag_name}} and |
}->{$token->{tag_name}} and |
5129 |
$self->{insertion_mode} == IN_CAPTION_IM) { |
$self->{insertion_mode} == IN_CAPTION_IM) { |
5130 |
!!!cp ('t192'); |
!!!cp ('t192'); |
5131 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5132 |
|
text => $token->{tag_name}, token => $token); |
5133 |
## Ignore the token |
## Ignore the token |
5134 |
!!!next-token; |
!!!next-token; |
5135 |
next B; |
next B; |
5169 |
} |
} |
5170 |
} |
} |
5171 |
|
|
5172 |
!!!parse-error (type => 'in table:#character', token => $token); |
!!!parse-error (type => 'in table:#text', token => $token); |
5173 |
|
|
5174 |
## As if in body, but insert into foster parent element |
## As if in body, but insert into foster parent element |
5175 |
## ISSUE: Spec says that "whenever a node would be inserted |
## ISSUE: Spec says that "whenever a node would be inserted |
5220 |
!!!next-token; |
!!!next-token; |
5221 |
next B; |
next B; |
5222 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
5223 |
if ({ |
if ({ |
5224 |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
tr => ($self->{insertion_mode} != IN_ROW_IM), |
5225 |
th => 1, td => 1, |
th => 1, td => 1, |
5226 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5227 |
if ($self->{insertion_mode} == IN_TABLE_IM) { |
if ($self->{insertion_mode} == IN_TABLE_IM) { |
5228 |
## Clear back to table context |
## Clear back to table context |
5229 |
while (not ($self->{open_elements}->[-1]->[1] |
while (not ($self->{open_elements}->[-1]->[1] |
5230 |
& TABLE_SCOPING_EL)) { |
& TABLE_SCOPING_EL)) { |
5231 |
!!!cp ('t201'); |
!!!cp ('t201'); |
5232 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5233 |
} |
} |
5234 |
|
|
5235 |
!!!insert-element ('tbody',, $token); |
!!!insert-element ('tbody',, $token); |
5236 |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
$self->{insertion_mode} = IN_TABLE_BODY_IM; |
5237 |
## reprocess in the "in table body" insertion mode... |
## reprocess in the "in table body" insertion mode... |
5238 |
} |
} |
5239 |
|
|
5240 |
if ($self->{insertion_mode} == IN_TABLE_BODY_IM) { |
if ($self->{insertion_mode} == IN_TABLE_BODY_IM) { |
5241 |
unless ($token->{tag_name} eq 'tr') { |
unless ($token->{tag_name} eq 'tr') { |
5242 |
!!!cp ('t202'); |
!!!cp ('t202'); |
5243 |
!!!parse-error (type => 'missing start tag:tr', token => $token); |
!!!parse-error (type => 'missing start tag:tr', token => $token); |
5244 |
} |
} |
5245 |
|
|
5246 |
## Clear back to table body context |
## Clear back to table body context |
5247 |
while (not ($self->{open_elements}->[-1]->[1] |
while (not ($self->{open_elements}->[-1]->[1] |
5248 |
& TABLE_ROWS_SCOPING_EL)) { |
& TABLE_ROWS_SCOPING_EL)) { |
5249 |
!!!cp ('t203'); |
!!!cp ('t203'); |
5250 |
## ISSUE: Can this case be reached? |
## ISSUE: Can this case be reached? |
5251 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
5252 |
} |
} |
5253 |
|
|
5254 |
$self->{insertion_mode} = IN_ROW_IM; |
$self->{insertion_mode} = IN_ROW_IM; |
5255 |
if ($token->{tag_name} eq 'tr') { |
if ($token->{tag_name} eq 'tr') { |
5305 |
unless (defined $i) { |
unless (defined $i) { |
5306 |
!!!cp ('t210'); |
!!!cp ('t210'); |
5307 |
## TODO: This type is wrong. |
## TODO: This type is wrong. |
5308 |
!!!parse-error (type => 'unmacthed end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmacthed end tag', |
5309 |
|
text => $token->{tag_name}, token => $token); |
5310 |
## Ignore the token |
## Ignore the token |
5311 |
!!!nack ('t210.1'); |
!!!nack ('t210.1'); |
5312 |
!!!next-token; |
!!!next-token; |
5350 |
} # INSCOPE |
} # INSCOPE |
5351 |
unless (defined $i) { |
unless (defined $i) { |
5352 |
!!!cp ('t216'); |
!!!cp ('t216'); |
5353 |
## TODO: This erorr type ios wrong. |
## TODO: This erorr type is wrong. |
5354 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5355 |
|
text => $token->{tag_name}, token => $token); |
5356 |
## Ignore the token |
## Ignore the token |
5357 |
!!!nack ('t216.1'); |
!!!nack ('t216.1'); |
5358 |
!!!next-token; |
!!!next-token; |
5427 |
} |
} |
5428 |
} elsif ($token->{tag_name} eq 'table') { |
} elsif ($token->{tag_name} eq 'table') { |
5429 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
5430 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
5431 |
->manakai_local_name, |
->manakai_local_name, |
5432 |
token => $token); |
token => $token); |
5433 |
|
|
5448 |
unless (defined $i) { |
unless (defined $i) { |
5449 |
!!!cp ('t223'); |
!!!cp ('t223'); |
5450 |
## TODO: The following is wrong, maybe. |
## TODO: The following is wrong, maybe. |
5451 |
!!!parse-error (type => 'unmatched end tag:table', token => $token); |
!!!parse-error (type => 'unmatched end tag', text => 'table', |
5452 |
|
token => $token); |
5453 |
## Ignore tokens </table><table> |
## Ignore tokens </table><table> |
5454 |
!!!nack ('t223.1'); |
!!!nack ('t223.1'); |
5455 |
!!!next-token; |
!!!next-token; |
5467 |
!!!cp ('t225'); |
!!!cp ('t225'); |
5468 |
## NOTE: |<table><tr><table>| |
## NOTE: |<table><tr><table>| |
5469 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
5470 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
5471 |
->manakai_local_name, |
->manakai_local_name, |
5472 |
token => $token); |
token => $token); |
5473 |
} else { |
} else { |
5508 |
my $type = lc $token->{attributes}->{type}->{value}; |
my $type = lc $token->{attributes}->{type}->{value}; |
5509 |
if ($type eq 'hidden') { |
if ($type eq 'hidden') { |
5510 |
!!!cp ('t227.3'); |
!!!cp ('t227.3'); |
5511 |
!!!parse-error (type => 'in table:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table', |
5512 |
|
text => $token->{tag_name}, token => $token); |
5513 |
|
|
5514 |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
!!!insert-element ($token->{tag_name}, $token->{attributes}, $token); |
5515 |
|
|
5537 |
# |
# |
5538 |
} |
} |
5539 |
|
|
5540 |
!!!parse-error (type => 'in table:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table', text => $token->{tag_name}, |
5541 |
|
token => $token); |
5542 |
|
|
5543 |
$insert = $insert_to_foster; |
$insert = $insert_to_foster; |
5544 |
# |
# |
5560 |
} # INSCOPE |
} # INSCOPE |
5561 |
unless (defined $i) { |
unless (defined $i) { |
5562 |
!!!cp ('t230'); |
!!!cp ('t230'); |
5563 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5564 |
|
text => $token->{tag_name}, token => $token); |
5565 |
## Ignore the token |
## Ignore the token |
5566 |
!!!nack ('t230.1'); |
!!!nack ('t230.1'); |
5567 |
!!!next-token; |
!!!next-token; |
5602 |
unless (defined $i) { |
unless (defined $i) { |
5603 |
!!!cp ('t235'); |
!!!cp ('t235'); |
5604 |
## TODO: The following is wrong. |
## TODO: The following is wrong. |
5605 |
!!!parse-error (type => 'unmatched end tag:'.$token->{type}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5606 |
|
text => $token->{type}, token => $token); |
5607 |
## Ignore the token |
## Ignore the token |
5608 |
!!!nack ('t236.1'); |
!!!nack ('t236.1'); |
5609 |
!!!next-token; |
!!!next-token; |
5639 |
} # INSCOPE |
} # INSCOPE |
5640 |
unless (defined $i) { |
unless (defined $i) { |
5641 |
!!!cp ('t239'); |
!!!cp ('t239'); |
5642 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5643 |
|
text => $token->{tag_name}, token => $token); |
5644 |
## Ignore the token |
## Ignore the token |
5645 |
!!!nack ('t239.1'); |
!!!nack ('t239.1'); |
5646 |
!!!next-token; |
!!!next-token; |
5686 |
} # INSCOPE |
} # INSCOPE |
5687 |
unless (defined $i) { |
unless (defined $i) { |
5688 |
!!!cp ('t243'); |
!!!cp ('t243'); |
5689 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5690 |
|
text => $token->{tag_name}, token => $token); |
5691 |
## Ignore the token |
## Ignore the token |
5692 |
!!!nack ('t243.1'); |
!!!nack ('t243.1'); |
5693 |
!!!next-token; |
!!!next-token; |
5721 |
} # INSCOPE |
} # INSCOPE |
5722 |
unless (defined $i) { |
unless (defined $i) { |
5723 |
!!!cp ('t249'); |
!!!cp ('t249'); |
5724 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5725 |
|
text => $token->{tag_name}, token => $token); |
5726 |
## Ignore the token |
## Ignore the token |
5727 |
!!!nack ('t249.1'); |
!!!nack ('t249.1'); |
5728 |
!!!next-token; |
!!!next-token; |
5745 |
} # INSCOPE |
} # INSCOPE |
5746 |
unless (defined $i) { |
unless (defined $i) { |
5747 |
!!!cp ('t252'); |
!!!cp ('t252'); |
5748 |
!!!parse-error (type => 'unmatched end tag:tr', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5749 |
|
text => 'tr', token => $token); |
5750 |
## Ignore the token |
## Ignore the token |
5751 |
!!!nack ('t252.1'); |
!!!nack ('t252.1'); |
5752 |
!!!next-token; |
!!!next-token; |
5781 |
} # INSCOPE |
} # INSCOPE |
5782 |
unless (defined $i) { |
unless (defined $i) { |
5783 |
!!!cp ('t256'); |
!!!cp ('t256'); |
5784 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5785 |
|
text => $token->{tag_name}, token => $token); |
5786 |
## Ignore the token |
## Ignore the token |
5787 |
!!!nack ('t256.1'); |
!!!nack ('t256.1'); |
5788 |
!!!next-token; |
!!!next-token; |
5809 |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
tbody => 1, tfoot => 1, thead => 1, # $self->{insertion_mode} == IN_TABLE_IM |
5810 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
5811 |
!!!cp ('t258'); |
!!!cp ('t258'); |
5812 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5813 |
|
text => $token->{tag_name}, token => $token); |
5814 |
## Ignore the token |
## Ignore the token |
5815 |
!!!nack ('t258.1'); |
!!!nack ('t258.1'); |
5816 |
!!!next-token; |
!!!next-token; |
5817 |
next B; |
next B; |
5818 |
} else { |
} else { |
5819 |
!!!cp ('t259'); |
!!!cp ('t259'); |
5820 |
!!!parse-error (type => 'in table:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in table:/', |
5821 |
|
text => $token->{tag_name}, token => $token); |
5822 |
|
|
5823 |
$insert = $insert_to_foster; |
$insert = $insert_to_foster; |
5824 |
# |
# |
5868 |
if ($token->{tag_name} eq 'colgroup') { |
if ($token->{tag_name} eq 'colgroup') { |
5869 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
5870 |
!!!cp ('t264'); |
!!!cp ('t264'); |
5871 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5872 |
|
text => 'colgroup', token => $token); |
5873 |
## Ignore the token |
## Ignore the token |
5874 |
!!!next-token; |
!!!next-token; |
5875 |
next B; |
next B; |
5882 |
} |
} |
5883 |
} elsif ($token->{tag_name} eq 'col') { |
} elsif ($token->{tag_name} eq 'col') { |
5884 |
!!!cp ('t266'); |
!!!cp ('t266'); |
5885 |
!!!parse-error (type => 'unmatched end tag:col', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5886 |
|
text => 'col', token => $token); |
5887 |
## Ignore the token |
## Ignore the token |
5888 |
!!!next-token; |
!!!next-token; |
5889 |
next B; |
next B; |
5913 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
if ($self->{open_elements}->[-1]->[1] & HTML_EL) { |
5914 |
!!!cp ('t269'); |
!!!cp ('t269'); |
5915 |
## TODO: Wrong error type? |
## TODO: Wrong error type? |
5916 |
!!!parse-error (type => 'unmatched end tag:colgroup', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
5917 |
|
text => 'colgroup', token => $token); |
5918 |
## Ignore the token |
## Ignore the token |
5919 |
!!!nack ('t269.1'); |
!!!nack ('t269.1'); |
5920 |
!!!next-token; |
!!!next-token; |
5978 |
tr => 1, td => 1, th => 1, |
tr => 1, td => 1, th => 1, |
5979 |
}->{$token->{tag_name}})) { |
}->{$token->{tag_name}})) { |
5980 |
## TODO: The type below is not good - <select> is replaced by </select> |
## TODO: The type below is not good - <select> is replaced by </select> |
5981 |
!!!parse-error (type => 'not closed:select', token => $token); |
!!!parse-error (type => 'not closed', text => 'select', |
5982 |
|
token => $token); |
5983 |
## NOTE: As if the token were </select> (<select> case) or |
## NOTE: As if the token were </select> (<select> case) or |
5984 |
## as if there were </select> (otherwise). |
## as if there were </select> (otherwise). |
5985 |
## have an element in table scope |
## have an element in table scope |
5997 |
} # INSCOPE |
} # INSCOPE |
5998 |
unless (defined $i) { |
unless (defined $i) { |
5999 |
!!!cp ('t280'); |
!!!cp ('t280'); |
6000 |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6001 |
|
text => 'select', token => $token); |
6002 |
## Ignore the token |
## Ignore the token |
6003 |
!!!nack ('t280.1'); |
!!!nack ('t280.1'); |
6004 |
!!!next-token; |
!!!next-token; |
6022 |
} |
} |
6023 |
} else { |
} else { |
6024 |
!!!cp ('t282'); |
!!!cp ('t282'); |
6025 |
!!!parse-error (type => 'in select:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select', |
6026 |
|
text => $token->{tag_name}, token => $token); |
6027 |
## Ignore the token |
## Ignore the token |
6028 |
!!!nack ('t282.1'); |
!!!nack ('t282.1'); |
6029 |
!!!next-token; |
!!!next-token; |
6041 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6042 |
} else { |
} else { |
6043 |
!!!cp ('t285'); |
!!!cp ('t285'); |
6044 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6045 |
|
text => $token->{tag_name}, token => $token); |
6046 |
## Ignore the token |
## Ignore the token |
6047 |
} |
} |
6048 |
!!!nack ('t285.1'); |
!!!nack ('t285.1'); |
6054 |
pop @{$self->{open_elements}}; |
pop @{$self->{open_elements}}; |
6055 |
} else { |
} else { |
6056 |
!!!cp ('t287'); |
!!!cp ('t287'); |
6057 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6058 |
|
text => $token->{tag_name}, token => $token); |
6059 |
## Ignore the token |
## Ignore the token |
6060 |
} |
} |
6061 |
!!!nack ('t287.1'); |
!!!nack ('t287.1'); |
6077 |
} # INSCOPE |
} # INSCOPE |
6078 |
unless (defined $i) { |
unless (defined $i) { |
6079 |
!!!cp ('t290'); |
!!!cp ('t290'); |
6080 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6081 |
|
text => $token->{tag_name}, token => $token); |
6082 |
## Ignore the token |
## Ignore the token |
6083 |
!!!nack ('t290.1'); |
!!!nack ('t290.1'); |
6084 |
!!!next-token; |
!!!next-token; |
6099 |
tfoot => 1, thead => 1, tr => 1, td => 1, th => 1, |
tfoot => 1, thead => 1, tr => 1, td => 1, th => 1, |
6100 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6101 |
## TODO: The following is wrong? |
## TODO: The following is wrong? |
6102 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6103 |
|
text => $token->{tag_name}, token => $token); |
6104 |
|
|
6105 |
## have an element in table scope |
## have an element in table scope |
6106 |
my $i; |
my $i; |
6141 |
unless (defined $i) { |
unless (defined $i) { |
6142 |
!!!cp ('t297'); |
!!!cp ('t297'); |
6143 |
## TODO: The following error type is correct? |
## TODO: The following error type is correct? |
6144 |
!!!parse-error (type => 'unmatched end tag:select', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6145 |
|
text => 'select', token => $token); |
6146 |
## Ignore the </select> token |
## Ignore the </select> token |
6147 |
!!!nack ('t297.1'); |
!!!nack ('t297.1'); |
6148 |
!!!next-token; ## TODO: ok? |
!!!next-token; ## TODO: ok? |
6159 |
next B; |
next B; |
6160 |
} else { |
} else { |
6161 |
!!!cp ('t299'); |
!!!cp ('t299'); |
6162 |
!!!parse-error (type => 'in select:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in select:/', |
6163 |
|
text => $token->{tag_name}, token => $token); |
6164 |
## Ignore the token |
## Ignore the token |
6165 |
!!!nack ('t299.3'); |
!!!nack ('t299.3'); |
6166 |
!!!next-token; |
!!!next-token; |
6198 |
|
|
6199 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
6200 |
!!!cp ('t301'); |
!!!cp ('t301'); |
6201 |
!!!parse-error (type => 'after html:#character', token => $token); |
!!!parse-error (type => 'after html:#text', token => $token); |
6202 |
|
|
6203 |
## Reprocess in the "after body" insertion mode. |
## Reprocess in the "after body" insertion mode. |
6204 |
} else { |
} else { |
6206 |
} |
} |
6207 |
|
|
6208 |
## "after body" insertion mode |
## "after body" insertion mode |
6209 |
!!!parse-error (type => 'after body:#character', token => $token); |
!!!parse-error (type => 'after body:#text', token => $token); |
6210 |
|
|
6211 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
6212 |
## reprocess |
## reprocess |
6214 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
6215 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
6216 |
!!!cp ('t303'); |
!!!cp ('t303'); |
6217 |
!!!parse-error (type => 'after html:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after html', |
6218 |
|
text => $token->{tag_name}, token => $token); |
6219 |
|
|
6220 |
## Reprocess in the "after body" insertion mode. |
## Reprocess in the "after body" insertion mode. |
6221 |
} else { |
} else { |
6223 |
} |
} |
6224 |
|
|
6225 |
## "after body" insertion mode |
## "after body" insertion mode |
6226 |
!!!parse-error (type => 'after body:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after body', |
6227 |
|
text => $token->{tag_name}, token => $token); |
6228 |
|
|
6229 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
6230 |
!!!ack-later; |
!!!ack-later; |
6233 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
6234 |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_BODY_IM) { |
6235 |
!!!cp ('t305'); |
!!!cp ('t305'); |
6236 |
!!!parse-error (type => 'after html:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after html:/', |
6237 |
|
text => $token->{tag_name}, token => $token); |
6238 |
|
|
6239 |
$self->{insertion_mode} = AFTER_BODY_IM; |
$self->{insertion_mode} = AFTER_BODY_IM; |
6240 |
## Reprocess in the "after body" insertion mode. |
## Reprocess in the "after body" insertion mode. |
6246 |
if ($token->{tag_name} eq 'html') { |
if ($token->{tag_name} eq 'html') { |
6247 |
if (defined $self->{inner_html_node}) { |
if (defined $self->{inner_html_node}) { |
6248 |
!!!cp ('t307'); |
!!!cp ('t307'); |
6249 |
!!!parse-error (type => 'unmatched end tag:html', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6250 |
|
text => 'html', token => $token); |
6251 |
## Ignore the token |
## Ignore the token |
6252 |
!!!next-token; |
!!!next-token; |
6253 |
next B; |
next B; |
6259 |
} |
} |
6260 |
} else { |
} else { |
6261 |
!!!cp ('t309'); |
!!!cp ('t309'); |
6262 |
!!!parse-error (type => 'after body:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after body:/', |
6263 |
|
text => $token->{tag_name}, token => $token); |
6264 |
|
|
6265 |
$self->{insertion_mode} = IN_BODY_IM; |
$self->{insertion_mode} = IN_BODY_IM; |
6266 |
## reprocess |
## reprocess |
6288 |
if ($token->{data} =~ s/^[^\x09\x0A\x0B\x0C\x20]+//) { |
if ($token->{data} =~ s/^[^\x09\x0A\x0B\x0C\x20]+//) { |
6289 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
6290 |
!!!cp ('t311'); |
!!!cp ('t311'); |
6291 |
!!!parse-error (type => 'in frameset:#character', token => $token); |
!!!parse-error (type => 'in frameset:#text', token => $token); |
6292 |
} elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) { |
} elsif ($self->{insertion_mode} == AFTER_FRAMESET_IM) { |
6293 |
!!!cp ('t312'); |
!!!cp ('t312'); |
6294 |
!!!parse-error (type => 'after frameset:#character', token => $token); |
!!!parse-error (type => 'after frameset:#text', token => $token); |
6295 |
} else { # "after html frameset" |
} else { # "after html frameset" |
6296 |
!!!cp ('t313'); |
!!!cp ('t313'); |
6297 |
!!!parse-error (type => 'after html:#character', token => $token); |
!!!parse-error (type => 'after html:#text', token => $token); |
6298 |
|
|
6299 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
6300 |
## Reprocess in the "after frameset" insertion mode. |
## Reprocess in the "after frameset" insertion mode. |
6301 |
!!!parse-error (type => 'after frameset:#character', token => $token); |
!!!parse-error (type => 'after frameset:#text', token => $token); |
6302 |
} |
} |
6303 |
|
|
6304 |
## Ignore the token. |
## Ignore the token. |
6316 |
} elsif ($token->{type} == START_TAG_TOKEN) { |
} elsif ($token->{type} == START_TAG_TOKEN) { |
6317 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
6318 |
!!!cp ('t316'); |
!!!cp ('t316'); |
6319 |
!!!parse-error (type => 'after html:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after html', |
6320 |
|
text => $token->{tag_name}, token => $token); |
6321 |
|
|
6322 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
6323 |
## Process in the "after frameset" insertion mode. |
## Process in the "after frameset" insertion mode. |
6348 |
} else { |
} else { |
6349 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
6350 |
!!!cp ('t321'); |
!!!cp ('t321'); |
6351 |
!!!parse-error (type => 'in frameset:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in frameset', |
6352 |
|
text => $token->{tag_name}, token => $token); |
6353 |
} else { |
} else { |
6354 |
!!!cp ('t322'); |
!!!cp ('t322'); |
6355 |
!!!parse-error (type => 'after frameset:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after frameset', |
6356 |
|
text => $token->{tag_name}, token => $token); |
6357 |
} |
} |
6358 |
## Ignore the token |
## Ignore the token |
6359 |
!!!nack ('t322.1'); |
!!!nack ('t322.1'); |
6363 |
} elsif ($token->{type} == END_TAG_TOKEN) { |
} elsif ($token->{type} == END_TAG_TOKEN) { |
6364 |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
if ($self->{insertion_mode} == AFTER_HTML_FRAMESET_IM) { |
6365 |
!!!cp ('t323'); |
!!!cp ('t323'); |
6366 |
!!!parse-error (type => 'after html:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after html:/', |
6367 |
|
text => $token->{tag_name}, token => $token); |
6368 |
|
|
6369 |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
$self->{insertion_mode} = AFTER_FRAMESET_IM; |
6370 |
## Process in the "after frameset" insertion mode. |
## Process in the "after frameset" insertion mode. |
6377 |
if ($self->{open_elements}->[-1]->[1] & HTML_EL and |
if ($self->{open_elements}->[-1]->[1] & HTML_EL and |
6378 |
@{$self->{open_elements}} == 1) { |
@{$self->{open_elements}} == 1) { |
6379 |
!!!cp ('t325'); |
!!!cp ('t325'); |
6380 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
6381 |
|
text => $token->{tag_name}, token => $token); |
6382 |
## Ignore the token |
## Ignore the token |
6383 |
!!!next-token; |
!!!next-token; |
6384 |
} else { |
} else { |
6404 |
} else { |
} else { |
6405 |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
if ($self->{insertion_mode} == IN_FRAMESET_IM) { |
6406 |
!!!cp ('t330'); |
!!!cp ('t330'); |
6407 |
!!!parse-error (type => 'in frameset:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in frameset:/', |
6408 |
|
text => $token->{tag_name}, token => $token); |
6409 |
} else { |
} else { |
6410 |
!!!cp ('t331'); |
!!!cp ('t331'); |
6411 |
!!!parse-error (type => 'after frameset:/'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'after frameset:/', |
6412 |
|
text => $token->{tag_name}, token => $token); |
6413 |
} |
} |
6414 |
## Ignore the token |
## Ignore the token |
6415 |
!!!next-token; |
!!!next-token; |
6517 |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
$parse_rcdata->(RCDATA_CONTENT_MODEL); |
6518 |
next B; |
next B; |
6519 |
} elsif ($token->{tag_name} eq 'body') { |
} elsif ($token->{tag_name} eq 'body') { |
6520 |
!!!parse-error (type => 'in body:body', token => $token); |
!!!parse-error (type => 'in body', text => 'body', token => $token); |
6521 |
|
|
6522 |
if (@{$self->{open_elements}} == 1 or |
if (@{$self->{open_elements}} == 1 or |
6523 |
not ($self->{open_elements}->[1]->[1] & BODY_EL)) { |
not ($self->{open_elements}->[1]->[1] & BODY_EL)) { |
6637 |
if ($i != -1) { |
if ($i != -1) { |
6638 |
!!!cp ('t355'); |
!!!cp ('t355'); |
6639 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
6640 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
6641 |
->manakai_local_name, |
->manakai_local_name, |
6642 |
token => $token); |
token => $token); |
6643 |
} else { |
} else { |
6905 |
## Ignore the token |
## Ignore the token |
6906 |
} else { |
} else { |
6907 |
!!!cp ('t398'); |
!!!cp ('t398'); |
6908 |
!!!parse-error (type => 'in RCDATA:#'.$token->{type}, token => $token); |
!!!parse-error (type => 'in RCDATA:#eof', token => $token); |
6909 |
} |
} |
6910 |
!!!next-token; |
!!!next-token; |
6911 |
next B; |
next B; |
6924 |
unless ($self->{open_elements}->[-1]->[1] & RUBY_EL) { |
unless ($self->{open_elements}->[-1]->[1] & RUBY_EL) { |
6925 |
!!!cp ('t398.3'); |
!!!cp ('t398.3'); |
6926 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
6927 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
6928 |
->manakai_local_name, |
->manakai_local_name, |
6929 |
token => $token); |
token => $token); |
6930 |
pop @{$self->{open_elements}} |
pop @{$self->{open_elements}} |
6972 |
thead => 1, tr => 1, |
thead => 1, tr => 1, |
6973 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
6974 |
!!!cp ('t401'); |
!!!cp ('t401'); |
6975 |
!!!parse-error (type => 'in body:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'in body', |
6976 |
|
text => $token->{tag_name}, token => $token); |
6977 |
## Ignore the token |
## Ignore the token |
6978 |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
!!!nack ('t401.1'); ## NOTE: |<col/>| or |<frame/>| here is an error. |
6979 |
!!!next-token; |
!!!next-token; |
7058 |
} |
} |
7059 |
|
|
7060 |
!!!parse-error (type => 'start tag not allowed', |
!!!parse-error (type => 'start tag not allowed', |
7061 |
value => $token->{tag_name}, token => $token); |
text => $token->{tag_name}, token => $token); |
7062 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
7063 |
!!!next-token; |
!!!next-token; |
7064 |
next B; |
next B; |
7068 |
unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL) { |
unless ($_->[1] & ALL_END_TAG_OPTIONAL_EL) { |
7069 |
!!!cp ('t403'); |
!!!cp ('t403'); |
7070 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7071 |
value => $_->[0]->manakai_local_name, |
text => $_->[0]->manakai_local_name, |
7072 |
token => $token); |
token => $token); |
7073 |
last; |
last; |
7074 |
} else { |
} else { |
7088 |
unless ($self->{open_elements}->[-1]->[1] & BODY_EL) { |
unless ($self->{open_elements}->[-1]->[1] & BODY_EL) { |
7089 |
!!!cp ('t406'); |
!!!cp ('t406'); |
7090 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7091 |
value => $self->{open_elements}->[1]->[0] |
text => $self->{open_elements}->[1]->[0] |
7092 |
->manakai_local_name, |
->manakai_local_name, |
7093 |
token => $token); |
token => $token); |
7094 |
} else { |
} else { |
7099 |
next B; |
next B; |
7100 |
} else { |
} else { |
7101 |
!!!cp ('t408'); |
!!!cp ('t408'); |
7102 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7103 |
|
text => $token->{tag_name}, token => $token); |
7104 |
## Ignore the token |
## Ignore the token |
7105 |
!!!next-token; |
!!!next-token; |
7106 |
next B; |
next B; |
7128 |
|
|
7129 |
unless (defined $i) { # has an element in scope |
unless (defined $i) { # has an element in scope |
7130 |
!!!cp ('t413'); |
!!!cp ('t413'); |
7131 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7132 |
|
text => $token->{tag_name}, token => $token); |
7133 |
} else { |
} else { |
7134 |
## Step 1. generate implied end tags |
## Step 1. generate implied end tags |
7135 |
while ({ |
while ({ |
7150 |
ne $token->{tag_name}) { |
ne $token->{tag_name}) { |
7151 |
!!!cp ('t412'); |
!!!cp ('t412'); |
7152 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7153 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
7154 |
->manakai_local_name, |
->manakai_local_name, |
7155 |
token => $token); |
token => $token); |
7156 |
} else { |
} else { |
7187 |
|
|
7188 |
unless (defined $i) { # has an element in scope |
unless (defined $i) { # has an element in scope |
7189 |
!!!cp ('t421'); |
!!!cp ('t421'); |
7190 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7191 |
|
text => $token->{tag_name}, token => $token); |
7192 |
} else { |
} else { |
7193 |
## Step 1. generate implied end tags |
## Step 1. generate implied end tags |
7194 |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
7201 |
ne $token->{tag_name}) { |
ne $token->{tag_name}) { |
7202 |
!!!cp ('t417.1'); |
!!!cp ('t417.1'); |
7203 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7204 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
7205 |
->manakai_local_name, |
->manakai_local_name, |
7206 |
token => $token); |
token => $token); |
7207 |
} else { |
} else { |
7233 |
|
|
7234 |
unless (defined $i) { # has an element in scope |
unless (defined $i) { # has an element in scope |
7235 |
!!!cp ('t425.1'); |
!!!cp ('t425.1'); |
7236 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7237 |
|
text => $token->{tag_name}, token => $token); |
7238 |
} else { |
} else { |
7239 |
## Step 1. generate implied end tags |
## Step 1. generate implied end tags |
7240 |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
while ($self->{open_elements}->[-1]->[1] & END_TAG_OPTIONAL_EL) { |
7246 |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
if ($self->{open_elements}->[-1]->[0]->manakai_local_name |
7247 |
ne $token->{tag_name}) { |
ne $token->{tag_name}) { |
7248 |
!!!cp ('t425'); |
!!!cp ('t425'); |
7249 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7250 |
|
text => $token->{tag_name}, token => $token); |
7251 |
} else { |
} else { |
7252 |
!!!cp ('t426'); |
!!!cp ('t426'); |
7253 |
} |
} |
7278 |
ne $token->{tag_name}) { |
ne $token->{tag_name}) { |
7279 |
!!!cp ('t412.1'); |
!!!cp ('t412.1'); |
7280 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7281 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
7282 |
->manakai_local_name, |
->manakai_local_name, |
7283 |
token => $token); |
token => $token); |
7284 |
} else { |
} else { |
7288 |
splice @{$self->{open_elements}}, $i; |
splice @{$self->{open_elements}}, $i; |
7289 |
} else { |
} else { |
7290 |
!!!cp ('t413.1'); |
!!!cp ('t413.1'); |
7291 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7292 |
|
text => $token->{tag_name}, token => $token); |
7293 |
|
|
7294 |
!!!cp ('t415.1'); |
!!!cp ('t415.1'); |
7295 |
## As if <p>, then reprocess the current token |
## As if <p>, then reprocess the current token |
7312 |
next B; |
next B; |
7313 |
} elsif ($token->{tag_name} eq 'br') { |
} elsif ($token->{tag_name} eq 'br') { |
7314 |
!!!cp ('t428'); |
!!!cp ('t428'); |
7315 |
!!!parse-error (type => 'unmatched end tag:br', token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7316 |
|
text => 'br', token => $token); |
7317 |
|
|
7318 |
## As if <br> |
## As if <br> |
7319 |
$reconstruct_active_formatting_elements->($insert_to_current); |
$reconstruct_active_formatting_elements->($insert_to_current); |
7338 |
noscript => 0, ## TODO: if scripting is enabled |
noscript => 0, ## TODO: if scripting is enabled |
7339 |
}->{$token->{tag_name}}) { |
}->{$token->{tag_name}}) { |
7340 |
!!!cp ('t429'); |
!!!cp ('t429'); |
7341 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7342 |
|
text => $token->{tag_name}, token => $token); |
7343 |
## Ignore the token |
## Ignore the token |
7344 |
!!!next-token; |
!!!next-token; |
7345 |
next B; |
next B; |
7371 |
!!!cp ('t431'); |
!!!cp ('t431'); |
7372 |
## NOTE: <x><y></x> |
## NOTE: <x><y></x> |
7373 |
!!!parse-error (type => 'not closed', |
!!!parse-error (type => 'not closed', |
7374 |
value => $self->{open_elements}->[-1]->[0] |
text => $self->{open_elements}->[-1]->[0] |
7375 |
->manakai_local_name, |
->manakai_local_name, |
7376 |
token => $token); |
token => $token); |
7377 |
} else { |
} else { |
7390 |
($node->[1] & SPECIAL_EL or |
($node->[1] & SPECIAL_EL or |
7391 |
$node->[1] & SCOPING_EL)) { |
$node->[1] & SCOPING_EL)) { |
7392 |
!!!cp ('t433'); |
!!!cp ('t433'); |
7393 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}, token => $token); |
!!!parse-error (type => 'unmatched end tag', |
7394 |
|
text => $token->{tag_name}, token => $token); |
7395 |
## Ignore the token |
## Ignore the token |
7396 |
!!!next-token; |
!!!next-token; |
7397 |
last S2; |
last S2; |
7527 |
0x10FFFE => 1, 0x10FFFF => 1, |
0x10FFFE => 1, 0x10FFFF => 1, |
7528 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
7529 |
!!!cp ('i4.1'); |
!!!cp ('i4.1'); |
7530 |
!!!parse-error (type => 'control char', level => $self->{must_level}); |
if ($self->{next_char} < 0x10000) { |
7531 |
## TODO: error type documentation |
!!!parse-error (type => 'control char', |
7532 |
|
text => (sprintf 'U+%04X', $self->{next_char})); |
7533 |
|
} else { |
7534 |
|
!!!parse-error (type => 'control char', |
7535 |
|
text => (sprintf 'U-%08X', $self->{next_char})); |
7536 |
|
} |
7537 |
} |
} |
7538 |
}; |
}; |
7539 |
$p->{prev_char} = [-1, -1, -1]; |
$p->{prev_char} = [-1, -1, -1]; |