| 326 |
} elsif ($self->{state} eq 'close tag open') { |
} elsif ($self->{state} eq 'close tag open') { |
| 327 |
if ($self->{content_model_flag} eq 'RCDATA' or |
if ($self->{content_model_flag} eq 'RCDATA' or |
| 328 |
$self->{content_model_flag} eq 'CDATA') { |
$self->{content_model_flag} eq 'CDATA') { |
| 329 |
my @next_char; |
if (defined $self->{last_emitted_start_tag_name}) { |
| 330 |
TAGNAME: for (my $i = 0; $i < length $self->{last_emitted_start_tag_name}; $i++) { |
my @next_char; |
| 331 |
|
TAGNAME: for (my $i = 0; $i < length $self->{last_emitted_start_tag_name}; $i++) { |
| 332 |
|
push @next_char, $self->{next_input_character}; |
| 333 |
|
my $c = ord substr ($self->{last_emitted_start_tag_name}, $i, 1); |
| 334 |
|
my $C = 0x0061 <= $c && $c <= 0x007A ? $c - 0x0020 : $c; |
| 335 |
|
if ($self->{next_input_character} == $c or $self->{next_input_character} == $C) { |
| 336 |
|
!!!next-input-character; |
| 337 |
|
next TAGNAME; |
| 338 |
|
} else { |
| 339 |
|
$self->{next_input_character} = shift @next_char; # reconsume |
| 340 |
|
!!!back-next-input-character (@next_char); |
| 341 |
|
$self->{state} = 'data'; |
| 342 |
|
|
| 343 |
|
!!!emit ({type => 'character', data => '</'}); |
| 344 |
|
|
| 345 |
|
redo A; |
| 346 |
|
} |
| 347 |
|
} |
| 348 |
push @next_char, $self->{next_input_character}; |
push @next_char, $self->{next_input_character}; |
| 349 |
my $c = ord substr ($self->{last_emitted_start_tag_name}, $i, 1); |
|
| 350 |
my $C = 0x0061 <= $c && $c <= 0x007A ? $c - 0x0020 : $c; |
unless ($self->{next_input_character} == 0x0009 or # HT |
| 351 |
if ($self->{next_input_character} == $c or $self->{next_input_character} == $C) { |
$self->{next_input_character} == 0x000A or # LF |
| 352 |
!!!next-input-character; |
$self->{next_input_character} == 0x000B or # VT |
| 353 |
next TAGNAME; |
$self->{next_input_character} == 0x000C or # FF |
| 354 |
} else { |
$self->{next_input_character} == 0x0020 or # SP |
| 355 |
|
$self->{next_input_character} == 0x003E or # > |
| 356 |
|
$self->{next_input_character} == 0x002F or # / |
| 357 |
|
$self->{next_input_character} == -1) { |
| 358 |
$self->{next_input_character} = shift @next_char; # reconsume |
$self->{next_input_character} = shift @next_char; # reconsume |
| 359 |
!!!back-next-input-character (@next_char); |
!!!back-next-input-character (@next_char); |
| 360 |
$self->{state} = 'data'; |
$self->{state} = 'data'; |
|
|
|
| 361 |
!!!emit ({type => 'character', data => '</'}); |
!!!emit ({type => 'character', data => '</'}); |
|
|
|
| 362 |
redo A; |
redo A; |
| 363 |
|
} else { |
| 364 |
|
$self->{next_input_character} = shift @next_char; |
| 365 |
|
!!!back-next-input-character (@next_char); |
| 366 |
|
# and consume... |
| 367 |
} |
} |
| 368 |
} |
} else { |
| 369 |
push @next_char, $self->{next_input_character}; |
## No start tag token has ever been emitted |
| 370 |
|
# next-input-character is already done |
|
unless ($self->{next_input_character} == 0x0009 or # HT |
|
|
$self->{next_input_character} == 0x000A or # LF |
|
|
$self->{next_input_character} == 0x000B or # VT |
|
|
$self->{next_input_character} == 0x000C or # FF |
|
|
$self->{next_input_character} == 0x0020 or # SP |
|
|
$self->{next_input_character} == 0x003E or # > |
|
|
$self->{next_input_character} == 0x002F or # / |
|
|
$self->{next_input_character} == -1) { |
|
|
$self->{next_input_character} = shift @next_char; # reconsume |
|
|
!!!back-next-input-character (@next_char); |
|
| 371 |
$self->{state} = 'data'; |
$self->{state} = 'data'; |
|
|
|
| 372 |
!!!emit ({type => 'character', data => '</'}); |
!!!emit ({type => 'character', data => '</'}); |
|
|
|
| 373 |
redo A; |
redo A; |
|
} else { |
|
|
$self->{next_input_character} = shift @next_char; |
|
|
!!!back-next-input-character (@next_char); |
|
|
# and consume... |
|
| 374 |
} |
} |
| 375 |
} |
} |
| 376 |
|
|
| 431 |
!!!next-input-character; |
!!!next-input-character; |
| 432 |
|
|
| 433 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 434 |
|
|
| 435 |
redo A; |
redo A; |
| 436 |
} elsif (0x0041 <= $self->{next_input_character} and |
} elsif (0x0041 <= $self->{next_input_character} and |
| 456 |
# reconsume |
# reconsume |
| 457 |
|
|
| 458 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 459 |
|
|
| 460 |
redo A; |
redo A; |
| 461 |
} elsif ($self->{next_input_character} == 0x002F) { # / |
} elsif ($self->{next_input_character} == 0x002F) { # / |
| 502 |
!!!next-input-character; |
!!!next-input-character; |
| 503 |
|
|
| 504 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 505 |
|
|
| 506 |
redo A; |
redo A; |
| 507 |
} elsif (0x0041 <= $self->{next_input_character} and |
} elsif (0x0041 <= $self->{next_input_character} and |
| 540 |
# reconsume |
# reconsume |
| 541 |
|
|
| 542 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 543 |
|
|
| 544 |
redo A; |
redo A; |
| 545 |
} else { |
} else { |
| 591 |
!!!next-input-character; |
!!!next-input-character; |
| 592 |
|
|
| 593 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 594 |
|
|
| 595 |
redo A; |
redo A; |
| 596 |
} elsif (0x0041 <= $self->{next_input_character} and |
} elsif (0x0041 <= $self->{next_input_character} and |
| 630 |
# reconsume |
# reconsume |
| 631 |
|
|
| 632 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 633 |
|
|
| 634 |
redo A; |
redo A; |
| 635 |
} else { |
} else { |
| 666 |
!!!next-input-character; |
!!!next-input-character; |
| 667 |
|
|
| 668 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 669 |
|
|
| 670 |
redo A; |
redo A; |
| 671 |
} elsif (0x0041 <= $self->{next_input_character} and |
} elsif (0x0041 <= $self->{next_input_character} and |
| 704 |
# reconsume |
# reconsume |
| 705 |
|
|
| 706 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 707 |
|
|
| 708 |
redo A; |
redo A; |
| 709 |
} else { |
} else { |
| 749 |
!!!next-input-character; |
!!!next-input-character; |
| 750 |
|
|
| 751 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 752 |
|
|
| 753 |
redo A; |
redo A; |
| 754 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 767 |
## reconsume |
## reconsume |
| 768 |
|
|
| 769 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 770 |
|
|
| 771 |
redo A; |
redo A; |
| 772 |
} else { |
} else { |
| 801 |
## reconsume |
## reconsume |
| 802 |
|
|
| 803 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 804 |
|
|
| 805 |
redo A; |
redo A; |
| 806 |
} else { |
} else { |
| 835 |
## reconsume |
## reconsume |
| 836 |
|
|
| 837 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 838 |
|
|
| 839 |
redo A; |
redo A; |
| 840 |
} else { |
} else { |
| 872 |
!!!next-input-character; |
!!!next-input-character; |
| 873 |
|
|
| 874 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 875 |
|
|
| 876 |
redo A; |
redo A; |
| 877 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 890 |
## reconsume |
## reconsume |
| 891 |
|
|
| 892 |
!!!emit ($self->{current_token}); # start tag or end tag |
!!!emit ($self->{current_token}); # start tag or end tag |
|
undef $self->{current_token}; |
|
| 893 |
|
|
| 894 |
redo A; |
redo A; |
| 895 |
} else { |
} else { |
| 948 |
push @next_char, $self->{next_input_character}; |
push @next_char, $self->{next_input_character}; |
| 949 |
if ($self->{next_input_character} == 0x002D) { # - |
if ($self->{next_input_character} == 0x002D) { # - |
| 950 |
$self->{current_token} = {type => 'comment', data => ''}; |
$self->{current_token} = {type => 'comment', data => ''}; |
| 951 |
$self->{state} = 'comment'; |
$self->{state} = 'comment start'; |
| 952 |
!!!next-input-character; |
!!!next-input-character; |
| 953 |
redo A; |
redo A; |
| 954 |
} |
} |
| 998 |
|
|
| 999 |
## ISSUE: typos in spec: chacacters, is is a parse error |
## ISSUE: typos in spec: chacacters, is is a parse error |
| 1000 |
## ISSUE: spec is somewhat unclear on "is the first character that will be in the comment"; what is "that will be in the comment" is what the algorithm defines, isn't it? |
## ISSUE: spec is somewhat unclear on "is the first character that will be in the comment"; what is "that will be in the comment" is what the algorithm defines, isn't it? |
| 1001 |
|
} elsif ($self->{state} eq 'comment start') { |
| 1002 |
|
if ($self->{next_input_character} == 0x002D) { # - |
| 1003 |
|
$self->{state} = 'comment start dash'; |
| 1004 |
|
!!!next-input-character; |
| 1005 |
|
redo A; |
| 1006 |
|
} elsif ($self->{next_input_character} == 0x003E) { # > |
| 1007 |
|
!!!parse-error (type => 'bogus comment'); |
| 1008 |
|
$self->{state} = 'data'; |
| 1009 |
|
!!!next-input-character; |
| 1010 |
|
|
| 1011 |
|
!!!emit ($self->{current_token}); # comment |
| 1012 |
|
|
| 1013 |
|
redo A; |
| 1014 |
|
} elsif ($self->{next_input_character} == -1) { |
| 1015 |
|
!!!parse-error (type => 'unclosed comment'); |
| 1016 |
|
$self->{state} = 'data'; |
| 1017 |
|
## reconsume |
| 1018 |
|
|
| 1019 |
|
!!!emit ($self->{current_token}); # comment |
| 1020 |
|
|
| 1021 |
|
redo A; |
| 1022 |
|
} else { |
| 1023 |
|
$self->{current_token}->{data} # comment |
| 1024 |
|
.= chr ($self->{next_input_character}); |
| 1025 |
|
$self->{state} = 'comment'; |
| 1026 |
|
!!!next-input-character; |
| 1027 |
|
redo A; |
| 1028 |
|
} |
| 1029 |
|
} elsif ($self->{state} eq 'comment start dash') { |
| 1030 |
|
if ($self->{next_input_character} == 0x002D) { # - |
| 1031 |
|
$self->{state} = 'comment end'; |
| 1032 |
|
!!!next-input-character; |
| 1033 |
|
redo A; |
| 1034 |
|
} elsif ($self->{next_input_character} == 0x003E) { # > |
| 1035 |
|
!!!parse-error (type => 'bogus comment'); |
| 1036 |
|
$self->{state} = 'data'; |
| 1037 |
|
!!!next-input-character; |
| 1038 |
|
|
| 1039 |
|
!!!emit ($self->{current_token}); # comment |
| 1040 |
|
|
| 1041 |
|
redo A; |
| 1042 |
|
} elsif ($self->{next_input_character} == -1) { |
| 1043 |
|
!!!parse-error (type => 'unclosed comment'); |
| 1044 |
|
$self->{state} = 'data'; |
| 1045 |
|
## reconsume |
| 1046 |
|
|
| 1047 |
|
!!!emit ($self->{current_token}); # comment |
| 1048 |
|
|
| 1049 |
|
redo A; |
| 1050 |
|
} else { |
| 1051 |
|
$self->{current_token}->{data} # comment |
| 1052 |
|
.= chr ($self->{next_input_character}); |
| 1053 |
|
$self->{state} = 'comment'; |
| 1054 |
|
!!!next-input-character; |
| 1055 |
|
redo A; |
| 1056 |
|
} |
| 1057 |
} elsif ($self->{state} eq 'comment') { |
} elsif ($self->{state} eq 'comment') { |
| 1058 |
if ($self->{next_input_character} == 0x002D) { # - |
if ($self->{next_input_character} == 0x002D) { # - |
| 1059 |
$self->{state} = 'comment dash'; |
$self->{state} = 'comment end dash'; |
| 1060 |
!!!next-input-character; |
!!!next-input-character; |
| 1061 |
redo A; |
redo A; |
| 1062 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1065 |
## reconsume |
## reconsume |
| 1066 |
|
|
| 1067 |
!!!emit ($self->{current_token}); # comment |
!!!emit ($self->{current_token}); # comment |
|
undef $self->{current_token}; |
|
| 1068 |
|
|
| 1069 |
redo A; |
redo A; |
| 1070 |
} else { |
} else { |
| 1073 |
!!!next-input-character; |
!!!next-input-character; |
| 1074 |
redo A; |
redo A; |
| 1075 |
} |
} |
| 1076 |
} elsif ($self->{state} eq 'comment dash') { |
} elsif ($self->{state} eq 'comment end dash') { |
| 1077 |
if ($self->{next_input_character} == 0x002D) { # - |
if ($self->{next_input_character} == 0x002D) { # - |
| 1078 |
$self->{state} = 'comment end'; |
$self->{state} = 'comment end'; |
| 1079 |
!!!next-input-character; |
!!!next-input-character; |
| 1084 |
## reconsume |
## reconsume |
| 1085 |
|
|
| 1086 |
!!!emit ($self->{current_token}); # comment |
!!!emit ($self->{current_token}); # comment |
|
undef $self->{current_token}; |
|
| 1087 |
|
|
| 1088 |
redo A; |
redo A; |
| 1089 |
} else { |
} else { |
| 1098 |
!!!next-input-character; |
!!!next-input-character; |
| 1099 |
|
|
| 1100 |
!!!emit ($self->{current_token}); # comment |
!!!emit ($self->{current_token}); # comment |
|
undef $self->{current_token}; |
|
| 1101 |
|
|
| 1102 |
redo A; |
redo A; |
| 1103 |
} elsif ($self->{next_input_character} == 0x002D) { # - |
} elsif ($self->{next_input_character} == 0x002D) { # - |
| 1112 |
## reconsume |
## reconsume |
| 1113 |
|
|
| 1114 |
!!!emit ($self->{current_token}); # comment |
!!!emit ($self->{current_token}); # comment |
|
undef $self->{current_token}; |
|
| 1115 |
|
|
| 1116 |
redo A; |
redo A; |
| 1117 |
} else { |
} else { |
| 1186 |
!!!next-input-character; |
!!!next-input-character; |
| 1187 |
|
|
| 1188 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1189 |
|
|
| 1190 |
redo A; |
redo A; |
| 1191 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1195 |
|
|
| 1196 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1197 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1198 |
|
|
| 1199 |
redo A; |
redo A; |
| 1200 |
} else { |
} else { |
| 1218 |
!!!next-input-character; |
!!!next-input-character; |
| 1219 |
|
|
| 1220 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1221 |
|
|
| 1222 |
redo A; |
redo A; |
| 1223 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1227 |
|
|
| 1228 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1229 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1230 |
|
|
| 1231 |
redo A; |
redo A; |
| 1232 |
} elsif ($self->{next_input_character} == 0x0050 or # P |
} elsif ($self->{next_input_character} == 0x0050 or # P |
| 1318 |
|
|
| 1319 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1320 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1321 |
|
|
| 1322 |
redo A; |
redo A; |
| 1323 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1328 |
|
|
| 1329 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1330 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1331 |
|
|
| 1332 |
redo A; |
redo A; |
| 1333 |
} else { |
} else { |
| 1349 |
|
|
| 1350 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1351 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1352 |
|
|
| 1353 |
redo A; |
redo A; |
| 1354 |
} else { |
} else { |
| 1371 |
|
|
| 1372 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1373 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1374 |
|
|
| 1375 |
redo A; |
redo A; |
| 1376 |
} else { |
} else { |
| 1403 |
!!!next-input-character; |
!!!next-input-character; |
| 1404 |
|
|
| 1405 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1406 |
|
|
| 1407 |
redo A; |
redo A; |
| 1408 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1413 |
|
|
| 1414 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1415 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1416 |
|
|
| 1417 |
redo A; |
redo A; |
| 1418 |
} else { |
} else { |
| 1446 |
|
|
| 1447 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1448 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1449 |
|
|
| 1450 |
redo A; |
redo A; |
| 1451 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1456 |
|
|
| 1457 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1458 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1459 |
|
|
| 1460 |
redo A; |
redo A; |
| 1461 |
} else { |
} else { |
| 1477 |
|
|
| 1478 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1479 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1480 |
|
|
| 1481 |
redo A; |
redo A; |
| 1482 |
} else { |
} else { |
| 1499 |
|
|
| 1500 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1501 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1502 |
|
|
| 1503 |
redo A; |
redo A; |
| 1504 |
} else { |
} else { |
| 1521 |
!!!next-input-character; |
!!!next-input-character; |
| 1522 |
|
|
| 1523 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1524 |
|
|
| 1525 |
redo A; |
redo A; |
| 1526 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1531 |
|
|
| 1532 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1533 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1534 |
|
|
| 1535 |
redo A; |
redo A; |
| 1536 |
} else { |
} else { |
| 1546 |
|
|
| 1547 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1548 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1549 |
|
|
| 1550 |
redo A; |
redo A; |
| 1551 |
} elsif ($self->{next_input_character} == -1) { |
} elsif ($self->{next_input_character} == -1) { |
| 1555 |
|
|
| 1556 |
delete $self->{current_token}->{correct}; |
delete $self->{current_token}->{correct}; |
| 1557 |
!!!emit ($self->{current_token}); # DOCTYPE |
!!!emit ($self->{current_token}); # DOCTYPE |
|
undef $self->{current_token}; |
|
| 1558 |
|
|
| 1559 |
redo A; |
redo A; |
| 1560 |
} else { |
} else { |
| 2689 |
} |
} |
| 2690 |
} # INSCOPE |
} # INSCOPE |
| 2691 |
|
|
| 2692 |
|
## NOTE: See <http://html5.org/tools/web-apps-tracker?from=925&to=926> |
| 2693 |
## has an element in scope |
## has an element in scope |
| 2694 |
my $i; |
#my $i; |
| 2695 |
INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
#INSCOPE: for (reverse 0..$#{$self->{open_elements}}) { |
| 2696 |
my $node = $self->{open_elements}->[$_]; |
# my $node = $self->{open_elements}->[$_]; |
| 2697 |
if ({ |
# if ({ |
| 2698 |
h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
# h1 => 1, h2 => 1, h3 => 1, h4 => 1, h5 => 1, h6 => 1, |
| 2699 |
}->{$node->[1]}) { |
# }->{$node->[1]}) { |
| 2700 |
$i = $_; |
# $i = $_; |
| 2701 |
last INSCOPE; |
# last INSCOPE; |
| 2702 |
} elsif ({ |
# } elsif ({ |
| 2703 |
table => 1, caption => 1, td => 1, th => 1, |
# table => 1, caption => 1, td => 1, th => 1, |
| 2704 |
button => 1, marquee => 1, object => 1, html => 1, |
# button => 1, marquee => 1, object => 1, html => 1, |
| 2705 |
}->{$node->[1]}) { |
# }->{$node->[1]}) { |
| 2706 |
last INSCOPE; |
# last INSCOPE; |
| 2707 |
} |
# } |
| 2708 |
} # INSCOPE |
#} # INSCOPE |
| 2709 |
|
# |
| 2710 |
if (defined $i) { |
#if (defined $i) { |
| 2711 |
!!!parse-error (type => 'in hn:hn'); |
# !!! parse-error (type => 'in hn:hn'); |
| 2712 |
splice @{$self->{open_elements}}, $i; |
# splice @{$self->{open_elements}}, $i; |
| 2713 |
} |
#} |
| 2714 |
|
|
| 2715 |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
!!!insert-element-t ($token->{tag_name}, $token->{attributes}); |
| 2716 |
|
|
| 2905 |
return; |
return; |
| 2906 |
} else { |
} else { |
| 2907 |
my $at = $token->{attributes}; |
my $at = $token->{attributes}; |
| 2908 |
|
my $form_attrs; |
| 2909 |
|
$form_attrs->{action} = $at->{action} if $at->{action}; |
| 2910 |
|
my $prompt_attr = $at->{prompt}; |
| 2911 |
$at->{name} = {name => 'name', value => 'isindex'}; |
$at->{name} = {name => 'name', value => 'isindex'}; |
| 2912 |
|
delete $at->{action}; |
| 2913 |
|
delete $at->{prompt}; |
| 2914 |
my @tokens = ( |
my @tokens = ( |
| 2915 |
{type => 'start tag', tag_name => 'form'}, |
{type => 'start tag', tag_name => 'form', |
| 2916 |
|
attributes => $form_attrs}, |
| 2917 |
{type => 'start tag', tag_name => 'hr'}, |
{type => 'start tag', tag_name => 'hr'}, |
| 2918 |
{type => 'start tag', tag_name => 'p'}, |
{type => 'start tag', tag_name => 'p'}, |
| 2919 |
{type => 'start tag', tag_name => 'label'}, |
{type => 'start tag', tag_name => 'label'}, |
| 2920 |
{type => 'character', |
); |
| 2921 |
data => 'This is a searchable index. Insert your search keywords here: '}, # SHOULD |
if ($prompt_attr) { |
| 2922 |
## TODO: make this configurable |
push @tokens, {type => 'character', data => $prompt_attr->{value}}; |
| 2923 |
|
} else { |
| 2924 |
|
push @tokens, {type => 'character', |
| 2925 |
|
data => 'This is a searchable index. Insert your search keywords here: '}; # SHOULD |
| 2926 |
|
## TODO: make this configurable |
| 2927 |
|
} |
| 2928 |
|
push @tokens, |
| 2929 |
{type => 'start tag', tag_name => 'input', attributes => $at}, |
{type => 'start tag', tag_name => 'input', attributes => $at}, |
| 2930 |
#{type => 'character', data => ''}, # SHOULD |
#{type => 'character', data => ''}, # SHOULD |
| 2931 |
{type => 'end tag', tag_name => 'label'}, |
{type => 'end tag', tag_name => 'label'}, |
| 2932 |
{type => 'end tag', tag_name => 'p'}, |
{type => 'end tag', tag_name => 'p'}, |
| 2933 |
{type => 'start tag', tag_name => 'hr'}, |
{type => 'start tag', tag_name => 'hr'}, |
| 2934 |
{type => 'end tag', tag_name => 'form'}, |
{type => 'end tag', tag_name => 'form'}; |
|
); |
|
| 2935 |
$token = shift @tokens; |
$token = shift @tokens; |
| 2936 |
!!!back-token (@tokens); |
!!!back-token (@tokens); |
| 2937 |
return; |
return; |
| 3341 |
} |
} |
| 3342 |
redo B; |
redo B; |
| 3343 |
} elsif ($token->{type} eq 'end tag') { |
} elsif ($token->{type} eq 'end tag') { |
| 3344 |
if ($token->{tag_name} eq 'html') { |
if ({head => 1, body => 1, html => 1}->{$token->{tag_name}}) { |
| 3345 |
## As if <head> |
## As if <head> |
| 3346 |
!!!create-element ($self->{head_element}, 'head'); |
!!!create-element ($self->{head_element}, 'head'); |
| 3347 |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
$self->{open_elements}->[-1]->[0]->append_child ($self->{head_element}); |
| 3351 |
redo B; |
redo B; |
| 3352 |
} else { |
} else { |
| 3353 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
| 3354 |
## Ignore the token |
## Ignore the token ## ISSUE: An issue in the spec. |
| 3355 |
!!!next-token; |
!!!next-token; |
| 3356 |
redo B; |
redo B; |
| 3357 |
} |
} |
| 3438 |
$self->{insertion_mode} = 'after head'; |
$self->{insertion_mode} = 'after head'; |
| 3439 |
!!!next-token; |
!!!next-token; |
| 3440 |
redo B; |
redo B; |
| 3441 |
} elsif ($token->{tag_name} eq 'html') { |
} elsif ($token->{tag_name} eq 'body' or |
| 3442 |
|
$token->{tag_name} eq 'html') { |
| 3443 |
# |
# |
| 3444 |
} else { |
} else { |
| 3445 |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
!!!parse-error (type => 'unmatched end tag:'.$token->{tag_name}); |
| 5344 |
spacer => 1, wbr => 1, |
spacer => 1, wbr => 1, |
| 5345 |
}->{$tag_name}; |
}->{$tag_name}; |
| 5346 |
|
|
| 5347 |
|
$s .= "\x0A" if $tag_name eq 'pre' or $tag_name eq 'textarea'; |
| 5348 |
|
|
| 5349 |
if (not $in_cdata and { |
if (not $in_cdata and { |
| 5350 |
style => 1, script => 1, xmp => 1, iframe => 1, |
style => 1, script => 1, xmp => 1, iframe => 1, |
| 5351 |
noembed => 1, noframes => 1, noscript => 1, |
noembed => 1, noframes => 1, noscript => 1, |