1270 |
|
|
1271 |
redo A; |
redo A; |
1272 |
} else { |
} else { |
1273 |
if ($self->{nc} == 0x003D) { # = |
if ($self->{nc} == 0x003D or $self->{nc} == 0x003C) { # =, < |
1274 |
!!!cp (93); |
!!!cp (93); |
1275 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1276 |
!!!parse-error (type => 'bad attribute value'); |
!!!parse-error (type => 'bad attribute value'); |
1316 |
$self->{state} = ENTITY_STATE; |
$self->{state} = ENTITY_STATE; |
1317 |
!!!next-input-character; |
!!!next-input-character; |
1318 |
redo A; |
redo A; |
1319 |
|
} elsif ($self->{is_xml} and |
1320 |
|
$is_space->{$self->{nc}}) { |
1321 |
|
!!!cp (97.1); |
1322 |
|
$self->{ca}->{value} .= ' '; |
1323 |
|
## Stay in the state. |
1324 |
|
!!!next-input-character; |
1325 |
|
redo A; |
1326 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
1327 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1328 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1370 |
} |
} |
1371 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1372 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1373 |
q["&<], |
qq["&<\x09\x0C\x20], |
1374 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1375 |
|
|
1376 |
## Stay in the state |
## Stay in the state |
1407 |
$self->{state} = ENTITY_STATE; |
$self->{state} = ENTITY_STATE; |
1408 |
!!!next-input-character; |
!!!next-input-character; |
1409 |
redo A; |
redo A; |
1410 |
|
} elsif ($self->{is_xml} and |
1411 |
|
$is_space->{$self->{nc}}) { |
1412 |
|
!!!cp (103.1); |
1413 |
|
$self->{ca}->{value} .= ' '; |
1414 |
|
## Stay in the state. |
1415 |
|
!!!next-input-character; |
1416 |
|
redo A; |
1417 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
1418 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1419 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1461 |
} |
} |
1462 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1463 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1464 |
q['&<], |
qq['&<\x09\x0C\x20], |
1465 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1466 |
|
|
1467 |
## Stay in the state |
## Stay in the state |
1573 |
0x0022 => 1, # " |
0x0022 => 1, # " |
1574 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
1575 |
0x003D => 1, # = |
0x003D => 1, # = |
1576 |
|
0x003C => 1, # < |
1577 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
1578 |
!!!cp (115); |
!!!cp (115); |
1579 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1583 |
} |
} |
1584 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1585 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1586 |
q["'=& >], |
qq["'=& \x09\x0C>], |
1587 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1588 |
|
|
1589 |
## Stay in the state |
## Stay in the state |
2119 |
redo A; |
redo A; |
2120 |
} else { |
} else { |
2121 |
!!!cp (154); |
!!!cp (154); |
|
## XML5: Not a parse error. |
|
|
!!!parse-error (type => 'dash in comment', |
|
|
line => $self->{line_prev}, |
|
|
column => $self->{column_prev}); |
|
2122 |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
2123 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
2124 |
!!!next-input-character; |
!!!next-input-character; |
2130 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
2131 |
!!!next-input-character; |
!!!next-input-character; |
2132 |
redo A; |
redo A; |
2133 |
|
} elsif ($self->{nc} == -1) { |
2134 |
|
!!!cp (155.1); |
2135 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2136 |
|
$self->{ct}->{quirks} = 1; |
2137 |
|
|
2138 |
|
$self->{state} = DATA_STATE; |
2139 |
|
## Reconsume. |
2140 |
|
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2141 |
|
|
2142 |
|
redo A; |
2143 |
} else { |
} else { |
2144 |
!!!cp (156); |
!!!cp (156); |
2145 |
## XML5: Unless EOF, swith to the bogus comment state. |
## XML5: Swith to the bogus comment state. |
2146 |
!!!parse-error (type => 'no space before DOCTYPE name'); |
!!!parse-error (type => 'no space before DOCTYPE name'); |
2147 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
2148 |
## reconsume |
## reconsume |
2167 |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2168 |
|
|
2169 |
redo A; |
redo A; |
2170 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2171 |
|
!!!cp (158.1); |
2172 |
|
$self->{ct}->{name} # DOCTYPE |
2173 |
|
= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2174 |
|
delete $self->{ct}->{quirks}; |
2175 |
|
$self->{state} = DOCTYPE_NAME_STATE; |
2176 |
|
!!!next-input-character; |
2177 |
|
redo A; |
2178 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2179 |
!!!cp (159); |
!!!cp (159); |
2180 |
!!!parse-error (type => 'no DOCTYPE name'); |
!!!parse-error (type => 'no DOCTYPE name'); |
2221 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2222 |
|
|
2223 |
redo A; |
redo A; |
2224 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2225 |
|
!!!cp (162.1); |
2226 |
|
$self->{ct}->{name} # DOCTYPE |
2227 |
|
.= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2228 |
|
delete $self->{ct}->{quirks}; |
2229 |
|
## Stay in the state. |
2230 |
|
!!!next-input-character; |
2231 |
|
redo A; |
2232 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2233 |
!!!cp (163); |
!!!cp (163); |
2234 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2250 |
redo A; |
redo A; |
2251 |
} else { |
} else { |
2252 |
!!!cp (164); |
!!!cp (164); |
2253 |
$self->{ct}->{name} |
$self->{ct}->{name} .= chr ($self->{nc}); # DOCTYPE |
2254 |
.= chr ($self->{nc}); # DOCTYPE |
## Stay in the state. |
|
## Stay in the state |
|
2255 |
!!!next-input-character; |
!!!next-input-character; |
2256 |
redo A; |
redo A; |
2257 |
} |
} |
3114 |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3115 |
$self->{entity_add} => 1, |
$self->{entity_add} => 1, |
3116 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
3117 |
!!!cp (1001); |
if ($self->{is_xml}) { |
3118 |
|
!!!cp (1001.1); |
3119 |
|
!!!parse-error (type => 'bare ero', |
3120 |
|
line => $self->{line_prev}, |
3121 |
|
column => $self->{column_prev} |
3122 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
3123 |
|
} else { |
3124 |
|
!!!cp (1001); |
3125 |
|
## No error |
3126 |
|
} |
3127 |
## Don't consume |
## Don't consume |
|
## No error |
|
3128 |
## Return nothing. |
## Return nothing. |
3129 |
# |
# |
3130 |
} elsif ($self->{nc} == 0x0023) { # # |
} elsif ($self->{nc} == 0x0023) { # # |
3133 |
$self->{kwd} = '#'; |
$self->{kwd} = '#'; |
3134 |
!!!next-input-character; |
!!!next-input-character; |
3135 |
redo A; |
redo A; |
3136 |
} elsif ((0x0041 <= $self->{nc} and |
} elsif ($self->{is_xml} or |
3137 |
|
(0x0041 <= $self->{nc} and |
3138 |
$self->{nc} <= 0x005A) or # A..Z |
$self->{nc} <= 0x005A) or # A..Z |
3139 |
(0x0061 <= $self->{nc} and |
(0x0061 <= $self->{nc} and |
3140 |
$self->{nc} <= 0x007A)) { # a..z |
$self->{nc} <= 0x007A)) { # a..z |
3253 |
my $code = $self->{kwd}; |
my $code = $self->{kwd}; |
3254 |
my $l = $self->{line_prev}; |
my $l = $self->{line_prev}; |
3255 |
my $c = $self->{column_prev}; |
my $c = $self->{column_prev}; |
3256 |
if ($charref_map->{$code}) { |
if ((not $self->{is_xml} and $charref_map->{$code}) or |
3257 |
|
($self->{is_xml} and 0xD800 <= $code and $code <= 0xDFFF) or |
3258 |
|
($self->{is_xml} and $code == 0x0000)) { |
3259 |
!!!cp (1015); |
!!!cp (1015); |
3260 |
!!!parse-error (type => 'invalid character reference', |
!!!parse-error (type => 'invalid character reference', |
3261 |
text => (sprintf 'U+%04X', $code), |
text => (sprintf 'U+%04X', $code), |
3368 |
my $code = $self->{kwd}; |
my $code = $self->{kwd}; |
3369 |
my $l = $self->{line_prev}; |
my $l = $self->{line_prev}; |
3370 |
my $c = $self->{column_prev}; |
my $c = $self->{column_prev}; |
3371 |
if ($charref_map->{$code}) { |
if ((not $self->{is_xml} and $charref_map->{$code}) or |
3372 |
|
($self->{is_xml} and 0xD800 <= $code and $code <= 0xDFFF) or |
3373 |
|
($self->{is_xml} and $code == 0x0000)) { |
3374 |
!!!cp (1008); |
!!!cp (1008); |
3375 |
!!!parse-error (type => 'invalid character reference', |
!!!parse-error (type => 'invalid character reference', |
3376 |
text => (sprintf 'U+%04X', $code), |
text => (sprintf 'U+%04X', $code), |
3410 |
$self->{nc} <= 0x007A) or # z |
$self->{nc} <= 0x007A) or # z |
3411 |
(0x0030 <= $self->{nc} and # 0 |
(0x0030 <= $self->{nc} and # 0 |
3412 |
$self->{nc} <= 0x0039) or # 9 |
$self->{nc} <= 0x0039) or # 9 |
3413 |
$self->{nc} == 0x003B) { # ; |
$self->{nc} == 0x003B or # ; |
3414 |
|
($self->{is_xml} and |
3415 |
|
not ($is_space->{$self->{nc}} or |
3416 |
|
{ |
3417 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3418 |
|
$self->{entity_add} => 1, |
3419 |
|
}->{$self->{nc}}))) { |
3420 |
our $EntityChar; |
our $EntityChar; |
3421 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3422 |
if (defined $EntityChar->{$self->{kwd}} or |
if (defined $EntityChar->{$self->{kwd}} or |
3699 |
## XML5: Not defined yet. |
## XML5: Not defined yet. |
3700 |
|
|
3701 |
## TODO: |
## TODO: |
3702 |
|
|
3703 |
|
if (not $self->{stop_processing} and |
3704 |
|
not $self->{document}->xml_standalone) { |
3705 |
|
!!!parse-error (type => 'stop processing', ## TODO: type |
3706 |
|
level => $self->{level}->{info}); |
3707 |
|
$self->{stop_processing} = 1; |
3708 |
|
} |
3709 |
|
|
3710 |
!!!next-input-character; |
!!!next-input-character; |
3711 |
redo A; |
redo A; |
3712 |
} elsif ($self->{nc} == 0x005D) { # ] |
} elsif ($self->{nc} == 0x005D) { # ] |
3941 |
} |
} |
3942 |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
3943 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3944 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3945 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3946 |
!!!next-input-character; |
!!!next-input-character; |
3947 |
redo A; |
redo A; |
3989 |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
3990 |
attrdefs => [], |
attrdefs => [], |
3991 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3992 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3993 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3994 |
!!!next-input-character; |
!!!next-input-character; |
3995 |
redo A; |
redo A; |
4038 |
} |
} |
4039 |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
4040 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
4041 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 8}; |
4042 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
4043 |
!!!next-input-character; |
!!!next-input-character; |
4044 |
redo A; |
redo A; |
4840 |
redo A; |
redo A; |
4841 |
} |
} |
4842 |
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
|
## TODO: XMLize |
|
|
|
|
4843 |
if ($is_space->{$self->{nc}} or |
if ($is_space->{$self->{nc}} or |
4844 |
{ |
{ |
4845 |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
4846 |
$self->{entity_add} => 1, |
$self->{entity_add} => 1, |
4847 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
4848 |
|
!!!parse-error (type => 'bare ero', |
4849 |
|
line => $self->{line_prev}, |
4850 |
|
column => $self->{column_prev} |
4851 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
4852 |
## Don't consume |
## Don't consume |
|
## No error |
|
4853 |
## Return nothing. |
## Return nothing. |
4854 |
# |
# |
4855 |
} elsif ($self->{nc} == 0x0023) { # # |
} elsif ($self->{nc} == 0x0023) { # # |
4858 |
$self->{kwd} = '#'; |
$self->{kwd} = '#'; |
4859 |
!!!next-input-character; |
!!!next-input-character; |
4860 |
redo A; |
redo A; |
|
} elsif ((0x0041 <= $self->{nc} and |
|
|
$self->{nc} <= 0x005A) or # A..Z |
|
|
(0x0061 <= $self->{nc} and |
|
|
$self->{nc} <= 0x007A)) { # a..z |
|
|
# |
|
4861 |
} else { |
} else { |
|
!!!parse-error (type => 'bare ero'); |
|
|
## Return nothing. |
|
4862 |
# |
# |
4863 |
} |
} |
4864 |
|
|