948 |
if ({ |
if ({ |
949 |
0x0022 => 1, # " |
0x0022 => 1, # " |
950 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
951 |
|
0x003C => 1, # < |
952 |
0x003D => 1, # = |
0x003D => 1, # = |
953 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
954 |
!!!cp (55); |
!!!cp (55); |
1071 |
|
|
1072 |
redo A; |
redo A; |
1073 |
} else { |
} else { |
1074 |
if ($self->{nc} == 0x0022 or # " |
if ({ |
1075 |
$self->{nc} == 0x0027) { # ' |
0x0022 => 1, # " |
1076 |
|
0x0027 => 1, # ' |
1077 |
|
0x003C => 1, # < |
1078 |
|
}->{$self->{nc}}) { |
1079 |
!!!cp (69); |
!!!cp (69); |
1080 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1081 |
!!!parse-error (type => 'bad attribute name'); |
!!!parse-error (type => 'bad attribute name'); |
1186 |
!!!cp (78.2); |
!!!cp (78.2); |
1187 |
} |
} |
1188 |
|
|
1189 |
if ($self->{nc} == 0x0022 or # " |
if ({ |
1190 |
$self->{nc} == 0x0027) { # ' |
0x0022 => 1, # " |
1191 |
|
0x0027 => 1, # ' |
1192 |
|
0x003C => 1, # < |
1193 |
|
}->{$self->{nc}}) { |
1194 |
!!!cp (78); |
!!!cp (78); |
1195 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1196 |
!!!parse-error (type => 'bad attribute name'); |
!!!parse-error (type => 'bad attribute name'); |
1277 |
|
|
1278 |
redo A; |
redo A; |
1279 |
} else { |
} else { |
1280 |
if ($self->{nc} == 0x003D) { # = |
if ($self->{nc} == 0x003D or $self->{nc} == 0x003C) { # =, < |
1281 |
!!!cp (93); |
!!!cp (93); |
1282 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1283 |
!!!parse-error (type => 'bad attribute value'); |
!!!parse-error (type => 'bad attribute value'); |
1323 |
$self->{state} = ENTITY_STATE; |
$self->{state} = ENTITY_STATE; |
1324 |
!!!next-input-character; |
!!!next-input-character; |
1325 |
redo A; |
redo A; |
1326 |
|
} elsif ($self->{is_xml} and |
1327 |
|
$is_space->{$self->{nc}}) { |
1328 |
|
!!!cp (97.1); |
1329 |
|
$self->{ca}->{value} .= ' '; |
1330 |
|
## Stay in the state. |
1331 |
|
!!!next-input-character; |
1332 |
|
redo A; |
1333 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
1334 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1335 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1377 |
} |
} |
1378 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1379 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1380 |
q["&<], |
qq["&<\x09\x0C\x20], |
1381 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1382 |
|
|
1383 |
## Stay in the state |
## Stay in the state |
1414 |
$self->{state} = ENTITY_STATE; |
$self->{state} = ENTITY_STATE; |
1415 |
!!!next-input-character; |
!!!next-input-character; |
1416 |
redo A; |
redo A; |
1417 |
|
} elsif ($self->{is_xml} and |
1418 |
|
$is_space->{$self->{nc}}) { |
1419 |
|
!!!cp (103.1); |
1420 |
|
$self->{ca}->{value} .= ' '; |
1421 |
|
## Stay in the state. |
1422 |
|
!!!next-input-character; |
1423 |
|
redo A; |
1424 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
1425 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1426 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1468 |
} |
} |
1469 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1470 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1471 |
q['&<], |
qq['&<\x09\x0C\x20], |
1472 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1473 |
|
|
1474 |
## Stay in the state |
## Stay in the state |
1580 |
0x0022 => 1, # " |
0x0022 => 1, # " |
1581 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
1582 |
0x003D => 1, # = |
0x003D => 1, # = |
1583 |
|
0x003C => 1, # < |
1584 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
1585 |
!!!cp (115); |
!!!cp (115); |
1586 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1590 |
} |
} |
1591 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1592 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1593 |
q["'=& >], |
qq["'=& \x09\x0C>], |
1594 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1595 |
|
|
1596 |
## Stay in the state |
## Stay in the state |
2126 |
redo A; |
redo A; |
2127 |
} else { |
} else { |
2128 |
!!!cp (154); |
!!!cp (154); |
|
## XML5: Not a parse error. |
|
|
!!!parse-error (type => 'dash in comment', |
|
|
line => $self->{line_prev}, |
|
|
column => $self->{column_prev}); |
|
2129 |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
2130 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
2131 |
!!!next-input-character; |
!!!next-input-character; |
2137 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
2138 |
!!!next-input-character; |
!!!next-input-character; |
2139 |
redo A; |
redo A; |
2140 |
|
} elsif ($self->{nc} == -1) { |
2141 |
|
!!!cp (155.1); |
2142 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2143 |
|
$self->{ct}->{quirks} = 1; |
2144 |
|
|
2145 |
|
$self->{state} = DATA_STATE; |
2146 |
|
## Reconsume. |
2147 |
|
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2148 |
|
|
2149 |
|
redo A; |
2150 |
} else { |
} else { |
2151 |
!!!cp (156); |
!!!cp (156); |
2152 |
## XML5: Unless EOF, swith to the bogus comment state. |
## XML5: Swith to the bogus comment state. |
2153 |
!!!parse-error (type => 'no space before DOCTYPE name'); |
!!!parse-error (type => 'no space before DOCTYPE name'); |
2154 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
2155 |
## reconsume |
## reconsume |
2174 |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2175 |
|
|
2176 |
redo A; |
redo A; |
2177 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2178 |
|
!!!cp (158.1); |
2179 |
|
$self->{ct}->{name} # DOCTYPE |
2180 |
|
= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2181 |
|
delete $self->{ct}->{quirks}; |
2182 |
|
$self->{state} = DOCTYPE_NAME_STATE; |
2183 |
|
!!!next-input-character; |
2184 |
|
redo A; |
2185 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2186 |
!!!cp (159); |
!!!cp (159); |
2187 |
!!!parse-error (type => 'no DOCTYPE name'); |
!!!parse-error (type => 'no DOCTYPE name'); |
2228 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2229 |
|
|
2230 |
redo A; |
redo A; |
2231 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2232 |
|
!!!cp (162.1); |
2233 |
|
$self->{ct}->{name} # DOCTYPE |
2234 |
|
.= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2235 |
|
delete $self->{ct}->{quirks}; |
2236 |
|
## Stay in the state. |
2237 |
|
!!!next-input-character; |
2238 |
|
redo A; |
2239 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2240 |
!!!cp (163); |
!!!cp (163); |
2241 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2257 |
redo A; |
redo A; |
2258 |
} else { |
} else { |
2259 |
!!!cp (164); |
!!!cp (164); |
2260 |
$self->{ct}->{name} |
$self->{ct}->{name} .= chr ($self->{nc}); # DOCTYPE |
2261 |
.= chr ($self->{nc}); # DOCTYPE |
## Stay in the state. |
|
## Stay in the state |
|
2262 |
!!!next-input-character; |
!!!next-input-character; |
2263 |
redo A; |
redo A; |
2264 |
} |
} |
3260 |
my $code = $self->{kwd}; |
my $code = $self->{kwd}; |
3261 |
my $l = $self->{line_prev}; |
my $l = $self->{line_prev}; |
3262 |
my $c = $self->{column_prev}; |
my $c = $self->{column_prev}; |
3263 |
if ($charref_map->{$code}) { |
if ((not $self->{is_xml} and $charref_map->{$code}) or |
3264 |
|
($self->{is_xml} and 0xD800 <= $code and $code <= 0xDFFF) or |
3265 |
|
($self->{is_xml} and $code == 0x0000)) { |
3266 |
!!!cp (1015); |
!!!cp (1015); |
3267 |
!!!parse-error (type => 'invalid character reference', |
!!!parse-error (type => 'invalid character reference', |
3268 |
text => (sprintf 'U+%04X', $code), |
text => (sprintf 'U+%04X', $code), |
3375 |
my $code = $self->{kwd}; |
my $code = $self->{kwd}; |
3376 |
my $l = $self->{line_prev}; |
my $l = $self->{line_prev}; |
3377 |
my $c = $self->{column_prev}; |
my $c = $self->{column_prev}; |
3378 |
if ($charref_map->{$code}) { |
if ((not $self->{is_xml} and $charref_map->{$code}) or |
3379 |
|
($self->{is_xml} and 0xD800 <= $code and $code <= 0xDFFF) or |
3380 |
|
($self->{is_xml} and $code == 0x0000)) { |
3381 |
!!!cp (1008); |
!!!cp (1008); |
3382 |
!!!parse-error (type => 'invalid character reference', |
!!!parse-error (type => 'invalid character reference', |
3383 |
text => (sprintf 'U+%04X', $code), |
text => (sprintf 'U+%04X', $code), |
3706 |
## XML5: Not defined yet. |
## XML5: Not defined yet. |
3707 |
|
|
3708 |
## TODO: |
## TODO: |
3709 |
|
|
3710 |
|
if (not $self->{stop_processing} and |
3711 |
|
not $self->{document}->xml_standalone) { |
3712 |
|
!!!parse-error (type => 'stop processing', ## TODO: type |
3713 |
|
level => $self->{level}->{info}); |
3714 |
|
$self->{stop_processing} = 1; |
3715 |
|
} |
3716 |
|
|
3717 |
!!!next-input-character; |
!!!next-input-character; |
3718 |
redo A; |
redo A; |
3719 |
} elsif ($self->{nc} == 0x005D) { # ] |
} elsif ($self->{nc} == 0x005D) { # ] |
3948 |
} |
} |
3949 |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
3950 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3951 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3952 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3953 |
!!!next-input-character; |
!!!next-input-character; |
3954 |
redo A; |
redo A; |
3996 |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
3997 |
attrdefs => [], |
attrdefs => [], |
3998 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3999 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
4000 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
4001 |
!!!next-input-character; |
!!!next-input-character; |
4002 |
redo A; |
redo A; |
4045 |
} |
} |
4046 |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
4047 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
4048 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 8}; |
4049 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
4050 |
!!!next-input-character; |
!!!next-input-character; |
4051 |
redo A; |
redo A; |