164 |
sub MD_NAME_STATE () { 69 } |
sub MD_NAME_STATE () { 69 } |
165 |
sub DOCTYPE_ENTITY_PARAMETER_BEFORE_STATE () { 70 } |
sub DOCTYPE_ENTITY_PARAMETER_BEFORE_STATE () { 70 } |
166 |
sub DOCTYPE_ATTLIST_NAME_AFTER_STATE () { 71 } |
sub DOCTYPE_ATTLIST_NAME_AFTER_STATE () { 71 } |
167 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_NAME_STATE () { 72 } |
168 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_NAME_AFTER_STATE () { 73 } |
169 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_TYPE_STATE () { 74 } |
170 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_TYPE_AFTER_STATE () { 75 } |
171 |
|
sub BEFORE_ALLOWED_TOKEN_STATE () { 76 } |
172 |
|
sub ALLOWED_TOKEN_STATE () { 77 } |
173 |
|
sub AFTER_ALLOWED_TOKEN_STATE () { 78 } |
174 |
|
sub AFTER_ALLOWED_TOKENS_STATE () { 79 } |
175 |
|
sub BEFORE_ATTR_DEFAULT_STATE () { 80 } |
176 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_BEFORE_STATE () { 81 } |
177 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_STATE () { 82 } |
178 |
|
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_AFTER_STATE () { 83 } |
179 |
|
sub AFTER_ATTLIST_ATTR_VALUE_QUOTED_STATE () { 84 } |
180 |
|
sub BEFORE_NDATA_STATE () { 85 } |
181 |
|
sub NDATA_STATE () { 86 } |
182 |
|
sub AFTER_NDATA_STATE () { 87 } |
183 |
|
sub BEFORE_NOTATION_NAME_STATE () { 88 } |
184 |
|
sub NOTATION_NAME_STATE () { 89 } |
185 |
|
sub DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE () { 90 } |
186 |
|
sub DOCTYPE_ENTITY_VALUE_SINGLE_QUOTED_STATE () { 91 } |
187 |
|
sub ENTITY_VALUE_ENTITY_STATE () { 92 } |
188 |
|
sub AFTER_ELEMENT_NAME_STATE () { 93 } |
189 |
|
sub BEFORE_ELEMENT_CONTENT_STATE () { 94 } |
190 |
|
sub CONTENT_KEYWORD_STATE () { 95 } |
191 |
|
sub AFTER_CM_GROUP_OPEN_STATE () { 96 } |
192 |
|
sub CM_ELEMENT_NAME_STATE () { 97 } |
193 |
|
sub AFTER_CM_ELEMENT_NAME_STATE () { 98 } |
194 |
|
sub AFTER_CM_GROUP_CLOSE_STATE () { 99 } |
195 |
|
sub AFTER_MD_DEF_STATE () { 100 } |
196 |
|
sub BOGUS_MD_STATE () { 101 } |
197 |
|
|
198 |
## Tree constructor state constants (see Whatpm::HTML for the full |
## Tree constructor state constants (see Whatpm::HTML for the full |
199 |
## list and descriptions) |
## list and descriptions) |
1287 |
redo A; |
redo A; |
1288 |
} |
} |
1289 |
} elsif ($self->{state} == ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE) { |
} elsif ($self->{state} == ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE) { |
1290 |
## XML5: "Tag attribute value double quoted state". |
## XML5: "Tag attribute value double quoted state" and "DOCTYPE |
1291 |
|
## ATTLIST attribute value double quoted state". |
1292 |
|
|
1293 |
if ($self->{nc} == 0x0022) { # " |
if ($self->{nc} == 0x0022) { # " |
1294 |
!!!cp (95); |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1295 |
## XML5: "Tag attribute name before state". |
!!!cp (95.1); |
1296 |
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
## XML5: "DOCTYPE ATTLIST name after state". |
1297 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1298 |
|
$self->{state} = AFTER_ATTLIST_ATTR_VALUE_QUOTED_STATE; |
1299 |
|
} else { |
1300 |
|
!!!cp (95); |
1301 |
|
## XML5: "Tag attribute name before state". |
1302 |
|
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
1303 |
|
} |
1304 |
!!!next-input-character; |
!!!next-input-character; |
1305 |
redo A; |
redo A; |
1306 |
} elsif ($self->{nc} == 0x0026) { # & |
} elsif ($self->{nc} == 0x0026) { # & |
1321 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1322 |
!!!cp (97); |
!!!cp (97); |
1323 |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
1324 |
|
|
1325 |
|
$self->{state} = DATA_STATE; |
1326 |
|
$self->{s_kwd} = ''; |
1327 |
|
## reconsume |
1328 |
|
!!!emit ($self->{ct}); # start tag |
1329 |
|
redo A; |
1330 |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
1331 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1332 |
if ($self->{ct}->{attributes}) { |
if ($self->{ct}->{attributes}) { |
1336 |
## NOTE: This state should never be reached. |
## NOTE: This state should never be reached. |
1337 |
!!!cp (99); |
!!!cp (99); |
1338 |
} |
} |
1339 |
|
|
1340 |
|
$self->{state} = DATA_STATE; |
1341 |
|
$self->{s_kwd} = ''; |
1342 |
|
## reconsume |
1343 |
|
!!!emit ($self->{ct}); # end tag |
1344 |
|
redo A; |
1345 |
|
} elsif ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1346 |
|
## XML5: No parse error above; not defined yet. |
1347 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1348 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
1349 |
|
## Reconsume. |
1350 |
|
!!!emit ($self->{ct}); # ATTLIST |
1351 |
|
redo A; |
1352 |
} else { |
} else { |
1353 |
die "$0: $self->{ct}->{type}: Unknown token type"; |
die "$0: $self->{ct}->{type}: Unknown token type"; |
1354 |
} |
} |
|
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
|
## reconsume |
|
|
|
|
|
!!!emit ($self->{ct}); # start tag or end tag |
|
|
|
|
|
redo A; |
|
1355 |
} else { |
} else { |
1356 |
|
## XML5 [ATTLIST]: Not defined yet. |
1357 |
if ($self->{is_xml} and $self->{nc} == 0x003C) { # < |
if ($self->{is_xml} and $self->{nc} == 0x003C) { # < |
1358 |
!!!cp (100); |
!!!cp (100); |
1359 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1371 |
redo A; |
redo A; |
1372 |
} |
} |
1373 |
} elsif ($self->{state} == ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE) { |
} elsif ($self->{state} == ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE) { |
1374 |
## XML5: "Tag attribute value single quoted state". |
## XML5: "Tag attribute value single quoted state" and "DOCTYPE |
1375 |
|
## ATTLIST attribute value single quoted state". |
1376 |
|
|
1377 |
if ($self->{nc} == 0x0027) { # ' |
if ($self->{nc} == 0x0027) { # ' |
1378 |
!!!cp (101); |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1379 |
## XML5: "Before attribute name state" (sic). |
!!!cp (101.1); |
1380 |
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
## XML5: "DOCTYPE ATTLIST name after state". |
1381 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1382 |
|
$self->{state} = AFTER_ATTLIST_ATTR_VALUE_QUOTED_STATE; |
1383 |
|
} else { |
1384 |
|
!!!cp (101); |
1385 |
|
## XML5: "Before attribute name state" (sic). |
1386 |
|
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
1387 |
|
} |
1388 |
!!!next-input-character; |
!!!next-input-character; |
1389 |
redo A; |
redo A; |
1390 |
} elsif ($self->{nc} == 0x0026) { # & |
} elsif ($self->{nc} == 0x0026) { # & |
1405 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1406 |
!!!cp (103); |
!!!cp (103); |
1407 |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
1408 |
|
|
1409 |
|
$self->{state} = DATA_STATE; |
1410 |
|
$self->{s_kwd} = ''; |
1411 |
|
## reconsume |
1412 |
|
!!!emit ($self->{ct}); # start tag |
1413 |
|
redo A; |
1414 |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
1415 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1416 |
if ($self->{ct}->{attributes}) { |
if ($self->{ct}->{attributes}) { |
1420 |
## NOTE: This state should never be reached. |
## NOTE: This state should never be reached. |
1421 |
!!!cp (105); |
!!!cp (105); |
1422 |
} |
} |
1423 |
|
|
1424 |
|
$self->{state} = DATA_STATE; |
1425 |
|
$self->{s_kwd} = ''; |
1426 |
|
## reconsume |
1427 |
|
!!!emit ($self->{ct}); # end tag |
1428 |
|
redo A; |
1429 |
|
} elsif ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1430 |
|
## XML5: No parse error above; not defined yet. |
1431 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1432 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
1433 |
|
## Reconsume. |
1434 |
|
!!!emit ($self->{ct}); # ATTLIST |
1435 |
|
redo A; |
1436 |
} else { |
} else { |
1437 |
die "$0: $self->{ct}->{type}: Unknown token type"; |
die "$0: $self->{ct}->{type}: Unknown token type"; |
1438 |
} |
} |
|
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
|
## reconsume |
|
|
|
|
|
!!!emit ($self->{ct}); # start tag or end tag |
|
|
|
|
|
redo A; |
|
1439 |
} else { |
} else { |
1440 |
|
## XML5 [ATTLIST]: Not defined yet. |
1441 |
if ($self->{is_xml} and $self->{nc} == 0x003C) { # < |
if ($self->{is_xml} and $self->{nc} == 0x003C) { # < |
1442 |
!!!cp (106); |
!!!cp (106); |
1443 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1458 |
## XML5: "Tag attribute value unquoted state". |
## XML5: "Tag attribute value unquoted state". |
1459 |
|
|
1460 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
1461 |
!!!cp (107); |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1462 |
## XML5: "Tag attribute name before state". |
!!!cp (107.1); |
1463 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1464 |
|
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
1465 |
|
} else { |
1466 |
|
!!!cp (107); |
1467 |
|
## XML5: "Tag attribute name before state". |
1468 |
|
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1469 |
|
} |
1470 |
!!!next-input-character; |
!!!next-input-character; |
1471 |
redo A; |
redo A; |
1472 |
} elsif ($self->{nc} == 0x0026) { # & |
} elsif ($self->{nc} == 0x0026) { # & |
1487 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1488 |
!!!cp (109); |
!!!cp (109); |
1489 |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
1490 |
|
|
1491 |
|
$self->{state} = DATA_STATE; |
1492 |
|
$self->{s_kwd} = ''; |
1493 |
|
!!!next-input-character; |
1494 |
|
!!!emit ($self->{ct}); # start tag |
1495 |
|
redo A; |
1496 |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
1497 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1498 |
if ($self->{ct}->{attributes}) { |
if ($self->{ct}->{attributes}) { |
1502 |
## NOTE: This state should never be reached. |
## NOTE: This state should never be reached. |
1503 |
!!!cp (111); |
!!!cp (111); |
1504 |
} |
} |
1505 |
|
|
1506 |
|
$self->{state} = DATA_STATE; |
1507 |
|
$self->{s_kwd} = ''; |
1508 |
|
!!!next-input-character; |
1509 |
|
!!!emit ($self->{ct}); # end tag |
1510 |
|
redo A; |
1511 |
|
} elsif ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1512 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1513 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
1514 |
|
!!!next-input-character; |
1515 |
|
!!!emit ($self->{ct}); # ATTLIST |
1516 |
|
redo A; |
1517 |
} else { |
} else { |
1518 |
die "$0: $self->{ct}->{type}: Unknown token type"; |
die "$0: $self->{ct}->{type}: Unknown token type"; |
1519 |
} |
} |
|
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
|
!!!next-input-character; |
|
|
|
|
|
!!!emit ($self->{ct}); # start tag or end tag |
|
|
|
|
|
redo A; |
|
1520 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!parse-error (type => 'unclosed tag'); |
|
1521 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1522 |
!!!cp (112); |
!!!cp (112); |
1523 |
|
!!!parse-error (type => 'unclosed tag'); |
1524 |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
$self->{last_stag_name} = $self->{ct}->{tag_name}; |
1525 |
|
|
1526 |
|
$self->{state} = DATA_STATE; |
1527 |
|
$self->{s_kwd} = ''; |
1528 |
|
## reconsume |
1529 |
|
!!!emit ($self->{ct}); # start tag |
1530 |
|
redo A; |
1531 |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{ct}->{type} == END_TAG_TOKEN) { |
1532 |
|
!!!parse-error (type => 'unclosed tag'); |
1533 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1534 |
if ($self->{ct}->{attributes}) { |
if ($self->{ct}->{attributes}) { |
1535 |
!!!cp (113); |
!!!cp (113); |
1538 |
## NOTE: This state should never be reached. |
## NOTE: This state should never be reached. |
1539 |
!!!cp (114); |
!!!cp (114); |
1540 |
} |
} |
1541 |
|
|
1542 |
|
$self->{state} = DATA_STATE; |
1543 |
|
$self->{s_kwd} = ''; |
1544 |
|
## reconsume |
1545 |
|
!!!emit ($self->{ct}); # end tag |
1546 |
|
redo A; |
1547 |
|
} elsif ($self->{ct}->{type} == ATTLIST_TOKEN) { |
1548 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
1549 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
1550 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
1551 |
|
## Reconsume. |
1552 |
|
!!!emit ($self->{ct}); # ATTLIST |
1553 |
|
redo A; |
1554 |
} else { |
} else { |
1555 |
die "$0: $self->{ct}->{type}: Unknown token type"; |
die "$0: $self->{ct}->{type}: Unknown token type"; |
1556 |
} |
} |
|
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
|
## reconsume |
|
|
|
|
|
!!!emit ($self->{ct}); # start tag or end tag |
|
|
|
|
|
redo A; |
|
1557 |
} else { |
} else { |
1558 |
if ({ |
if ({ |
1559 |
0x0022 => 1, # " |
0x0022 => 1, # " |
2229 |
!!!next-input-character; |
!!!next-input-character; |
2230 |
redo A; |
redo A; |
2231 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
2232 |
!!!cp (166); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2233 |
$self->{state} = DATA_STATE; |
!!!cp (166); |
2234 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2235 |
|
$self->{s_kwd} = ''; |
2236 |
|
} else { |
2237 |
|
!!!cp (166.1); |
2238 |
|
!!!parse-error (type => 'no md def'); ## TODO: type |
2239 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2240 |
|
} |
2241 |
|
|
2242 |
!!!next-input-character; |
!!!next-input-character; |
2243 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2244 |
redo A; |
redo A; |
2245 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2246 |
!!!cp (167); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2247 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (167); |
2248 |
$self->{state} = DATA_STATE; |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2249 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2250 |
## reconsume |
$self->{s_kwd} = ''; |
2251 |
|
$self->{ct}->{quirks} = 1; |
2252 |
$self->{ct}->{quirks} = 1; |
} else { |
2253 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (167.12); |
2254 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2255 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2256 |
|
} |
2257 |
|
|
2258 |
|
## Reconsume. |
2259 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2260 |
redo A; |
redo A; |
2261 |
} elsif ($self->{nc} == 0x0050 or # P |
} elsif ($self->{nc} == 0x0050 or # P |
2262 |
$self->{nc} == 0x0070) { # p |
$self->{nc} == 0x0070) { # p |
2272 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
2273 |
!!!next-input-character; |
!!!next-input-character; |
2274 |
redo A; |
redo A; |
2275 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{nc} == 0x0022 and # " |
2276 |
|
($self->{ct}->{type} == GENERAL_ENTITY_TOKEN or |
2277 |
|
$self->{ct}->{type} == PARAMETER_ENTITY_TOKEN)) { |
2278 |
|
!!!cp (167.21); |
2279 |
|
$self->{state} = DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE; |
2280 |
|
$self->{ct}->{value} = ''; # ENTITY |
2281 |
|
!!!next-input-character; |
2282 |
|
redo A; |
2283 |
|
} elsif ($self->{nc} == 0x0027 and # ' |
2284 |
|
($self->{ct}->{type} == GENERAL_ENTITY_TOKEN or |
2285 |
|
$self->{ct}->{type} == PARAMETER_ENTITY_TOKEN)) { |
2286 |
|
!!!cp (167.22); |
2287 |
|
$self->{state} = DOCTYPE_ENTITY_VALUE_SINGLE_QUOTED_STATE; |
2288 |
|
$self->{ct}->{value} = ''; # ENTITY |
2289 |
|
!!!next-input-character; |
2290 |
|
redo A; |
2291 |
|
} elsif ($self->{is_xml} and |
2292 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2293 |
|
$self->{nc} == 0x005B) { # [ |
2294 |
!!!cp (167.3); |
!!!cp (167.3); |
2295 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2296 |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
2299 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2300 |
redo A; |
redo A; |
2301 |
} else { |
} else { |
2302 |
!!!cp (180); |
!!!parse-error (type => 'string after DOCTYPE name'); ## TODO: type |
2303 |
!!!parse-error (type => 'string after DOCTYPE name'); |
|
2304 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2305 |
|
!!!cp (180); |
2306 |
|
$self->{ct}->{quirks} = 1; |
2307 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2308 |
|
} else { |
2309 |
|
!!!cp (180.1); |
2310 |
|
$self->{state} = BOGUS_MD_STATE; |
2311 |
|
} |
2312 |
|
|
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
|
2313 |
!!!next-input-character; |
!!!next-input-character; |
2314 |
redo A; |
redo A; |
2315 |
} |
} |
2351 |
!!!next-input-character; |
!!!next-input-character; |
2352 |
redo A; |
redo A; |
2353 |
} else { |
} else { |
2354 |
!!!cp (169); |
!!!parse-error (type => 'string after DOCTYPE name', ## TODO: type |
|
!!!parse-error (type => 'string after DOCTYPE name', |
|
2355 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
2356 |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
2357 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2358 |
|
!!!cp (169); |
2359 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
$self->{ct}->{quirks} = 1; |
2360 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2361 |
|
} else { |
2362 |
|
!!!cp (169.1); |
2363 |
|
$self->{state} = BOGUS_MD_STATE; |
2364 |
|
} |
2365 |
## Reconsume. |
## Reconsume. |
2366 |
redo A; |
redo A; |
2367 |
} |
} |
2403 |
!!!next-input-character; |
!!!next-input-character; |
2404 |
redo A; |
redo A; |
2405 |
} else { |
} else { |
2406 |
!!!cp (172); |
!!!parse-error (type => 'string after DOCTYPE name', ## TODO: type |
|
!!!parse-error (type => 'string after DOCTYPE name', |
|
2407 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
2408 |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
2409 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2410 |
|
!!!cp (172); |
2411 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
$self->{ct}->{quirks} = 1; |
2412 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2413 |
|
} else { |
2414 |
|
!!!cp (172.1); |
2415 |
|
$self->{state} = BOGUS_MD_STATE; |
2416 |
|
} |
2417 |
## Reconsume. |
## Reconsume. |
2418 |
redo A; |
redo A; |
2419 |
} |
} |
2436 |
!!!next-input-character; |
!!!next-input-character; |
2437 |
redo A; |
redo A; |
2438 |
} elsif ($self->{nc} eq 0x003E) { # > |
} elsif ($self->{nc} eq 0x003E) { # > |
|
!!!cp (184); |
|
2439 |
!!!parse-error (type => 'no PUBLIC literal'); |
!!!parse-error (type => 'no PUBLIC literal'); |
2440 |
|
|
2441 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2442 |
$self->{s_kwd} = ''; |
!!!cp (184); |
2443 |
|
$self->{state} = DATA_STATE; |
2444 |
|
$self->{s_kwd} = ''; |
2445 |
|
$self->{ct}->{quirks} = 1; |
2446 |
|
} else { |
2447 |
|
!!!cp (184.1); |
2448 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2449 |
|
} |
2450 |
|
|
2451 |
!!!next-input-character; |
!!!next-input-character; |
2452 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2453 |
redo A; |
redo A; |
2454 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2455 |
!!!cp (185); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2456 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (185); |
2457 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2458 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2459 |
$self->{s_kwd} = ''; |
$self->{s_kwd} = ''; |
2460 |
|
$self->{ct}->{quirks} = 1; |
2461 |
|
} else { |
2462 |
|
!!!cp (185.1); |
2463 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2464 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2465 |
|
} |
2466 |
|
|
2467 |
## reconsume |
## reconsume |
|
|
|
|
$self->{ct}->{quirks} = 1; |
|
2468 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
2469 |
redo A; |
redo A; |
2470 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2471 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2472 |
|
$self->{nc} == 0x005B) { # [ |
2473 |
!!!cp (186.1); |
!!!cp (186.1); |
2474 |
!!!parse-error (type => 'no PUBLIC literal'); |
!!!parse-error (type => 'no PUBLIC literal'); |
2475 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2479 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2480 |
redo A; |
redo A; |
2481 |
} else { |
} else { |
|
!!!cp (186); |
|
2482 |
!!!parse-error (type => 'string after PUBLIC'); |
!!!parse-error (type => 'string after PUBLIC'); |
|
$self->{ct}->{quirks} = 1; |
|
2483 |
|
|
2484 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2485 |
|
!!!cp (186); |
2486 |
|
$self->{ct}->{quirks} = 1; |
2487 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2488 |
|
} else { |
2489 |
|
!!!cp (186.2); |
2490 |
|
$self->{state} = BOGUS_MD_STATE; |
2491 |
|
} |
2492 |
|
|
2493 |
!!!next-input-character; |
!!!next-input-character; |
2494 |
redo A; |
redo A; |
2495 |
} |
} |
2500 |
!!!next-input-character; |
!!!next-input-character; |
2501 |
redo A; |
redo A; |
2502 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
|
!!!cp (188); |
|
2503 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2504 |
|
|
2505 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2506 |
$self->{s_kwd} = ''; |
!!!cp (188); |
2507 |
!!!next-input-character; |
$self->{state} = DATA_STATE; |
2508 |
|
$self->{s_kwd} = ''; |
2509 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2510 |
!!!emit ($self->{ct}); # DOCTYPE |
} else { |
2511 |
|
!!!cp (188.1); |
2512 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2513 |
|
} |
2514 |
|
|
2515 |
|
!!!next-input-character; |
2516 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2517 |
redo A; |
redo A; |
2518 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (189); |
|
2519 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2520 |
|
|
2521 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2522 |
$self->{s_kwd} = ''; |
!!!cp (189); |
2523 |
## reconsume |
$self->{state} = DATA_STATE; |
2524 |
|
$self->{s_kwd} = ''; |
2525 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2526 |
|
} else { |
2527 |
|
!!!cp (189.1); |
2528 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2529 |
|
} |
2530 |
|
|
2531 |
|
## Reconsume. |
2532 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
2533 |
redo A; |
redo A; |
2534 |
} else { |
} else { |
2535 |
!!!cp (190); |
!!!cp (190); |
2536 |
$self->{ct}->{pubid} # DOCTYPE |
$self->{ct}->{pubid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2537 |
$self->{read_until}->($self->{ct}->{pubid}, q[">], |
$self->{read_until}->($self->{ct}->{pubid}, q[">], |
2538 |
length $self->{ct}->{pubid}); |
length $self->{ct}->{pubid}); |
2539 |
|
|
2548 |
!!!next-input-character; |
!!!next-input-character; |
2549 |
redo A; |
redo A; |
2550 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
|
!!!cp (192); |
|
2551 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2552 |
|
|
2553 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2554 |
$self->{s_kwd} = ''; |
!!!cp (192); |
2555 |
!!!next-input-character; |
$self->{state} = DATA_STATE; |
2556 |
|
$self->{s_kwd} = ''; |
2557 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2558 |
!!!emit ($self->{ct}); # DOCTYPE |
} else { |
2559 |
|
!!!cp (192.1); |
2560 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2561 |
|
} |
2562 |
|
|
2563 |
|
!!!next-input-character; |
2564 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2565 |
redo A; |
redo A; |
2566 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (193); |
|
2567 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2568 |
|
|
2569 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2570 |
$self->{s_kwd} = ''; |
!!!cp (193); |
2571 |
|
$self->{state} = DATA_STATE; |
2572 |
|
$self->{s_kwd} = ''; |
2573 |
|
$self->{ct}->{quirks} = 1; |
2574 |
|
} else { |
2575 |
|
!!!cp (193.1); |
2576 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2577 |
|
} |
2578 |
|
|
2579 |
## reconsume |
## reconsume |
2580 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2581 |
redo A; |
redo A; |
2582 |
} else { |
} else { |
2583 |
!!!cp (194); |
!!!cp (194); |
2584 |
$self->{ct}->{pubid} # DOCTYPE |
$self->{ct}->{pubid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2585 |
$self->{read_until}->($self->{ct}->{pubid}, q['>], |
$self->{read_until}->($self->{ct}->{pubid}, q['>], |
2586 |
length $self->{ct}->{pubid}); |
length $self->{ct}->{pubid}); |
2587 |
|
|
2597 |
redo A; |
redo A; |
2598 |
} elsif ($self->{nc} == 0x0022) { # " |
} elsif ($self->{nc} == 0x0022) { # " |
2599 |
!!!cp (196); |
!!!cp (196); |
2600 |
$self->{ct}->{sysid} = ''; # DOCTYPE |
$self->{ct}->{sysid} = ''; # DOCTYPE/ENTITY/NOTATION |
2601 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
2602 |
!!!next-input-character; |
!!!next-input-character; |
2603 |
redo A; |
redo A; |
2604 |
} elsif ($self->{nc} == 0x0027) { # ' |
} elsif ($self->{nc} == 0x0027) { # ' |
2605 |
!!!cp (197); |
!!!cp (197); |
2606 |
$self->{ct}->{sysid} = ''; # DOCTYPE |
$self->{ct}->{sysid} = ''; # DOCTYPE/ENTITY/NOTATION |
2607 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
2608 |
!!!next-input-character; |
!!!next-input-character; |
2609 |
redo A; |
redo A; |
2610 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
2611 |
if ($self->{is_xml}) { |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2612 |
!!!cp (198.1); |
if ($self->{is_xml}) { |
2613 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!cp (198.1); |
2614 |
|
!!!parse-error (type => 'no SYSTEM literal'); |
2615 |
|
} else { |
2616 |
|
!!!cp (198); |
2617 |
|
} |
2618 |
|
$self->{state} = DATA_STATE; |
2619 |
|
$self->{s_kwd} = ''; |
2620 |
} else { |
} else { |
2621 |
!!!cp (198); |
if ($self->{ct}->{type} == NOTATION_TOKEN) { |
2622 |
|
!!!cp (198.2); |
2623 |
|
} else { |
2624 |
|
!!!cp (198.3); |
2625 |
|
!!!parse-error (type => 'no SYSTEM literal'); |
2626 |
|
} |
2627 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2628 |
} |
} |
2629 |
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
2630 |
!!!next-input-character; |
!!!next-input-character; |
2631 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2632 |
redo A; |
redo A; |
2633 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2634 |
!!!cp (199); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2635 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (199); |
2636 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2637 |
$self->{state} = DATA_STATE; |
|
2638 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2639 |
|
$self->{s_kwd} = ''; |
2640 |
|
$self->{ct}->{quirks} = 1; |
2641 |
|
} else { |
2642 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2643 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2644 |
|
} |
2645 |
|
|
2646 |
## reconsume |
## reconsume |
2647 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2648 |
redo A; |
redo A; |
2649 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2650 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2651 |
|
$self->{nc} == 0x005B) { # [ |
2652 |
!!!cp (200.1); |
!!!cp (200.1); |
2653 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
2654 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2658 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2659 |
redo A; |
redo A; |
2660 |
} else { |
} else { |
|
!!!cp (200); |
|
2661 |
!!!parse-error (type => 'string after PUBLIC literal'); |
!!!parse-error (type => 'string after PUBLIC literal'); |
|
$self->{ct}->{quirks} = 1; |
|
2662 |
|
|
2663 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2664 |
|
!!!cp (200); |
2665 |
|
$self->{ct}->{quirks} = 1; |
2666 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2667 |
|
} else { |
2668 |
|
!!!cp (200.2); |
2669 |
|
$self->{state} = BOGUS_MD_STATE; |
2670 |
|
} |
2671 |
|
|
2672 |
!!!next-input-character; |
!!!next-input-character; |
2673 |
redo A; |
redo A; |
2674 |
} |
} |
2691 |
!!!next-input-character; |
!!!next-input-character; |
2692 |
redo A; |
redo A; |
2693 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
|
!!!cp (204); |
|
2694 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
|
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
2695 |
!!!next-input-character; |
!!!next-input-character; |
2696 |
|
|
2697 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2698 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (204); |
2699 |
|
$self->{state} = DATA_STATE; |
2700 |
|
$self->{s_kwd} = ''; |
2701 |
|
$self->{ct}->{quirks} = 1; |
2702 |
|
} else { |
2703 |
|
!!!cp (204.1); |
2704 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2705 |
|
} |
2706 |
|
|
2707 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2708 |
redo A; |
redo A; |
2709 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2710 |
!!!cp (205); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2711 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (205); |
2712 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2713 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2714 |
$self->{s_kwd} = ''; |
$self->{s_kwd} = ''; |
2715 |
|
$self->{ct}->{quirks} = 1; |
2716 |
|
} else { |
2717 |
|
!!!cp (205.1); |
2718 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2719 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2720 |
|
} |
2721 |
|
|
2722 |
## reconsume |
## reconsume |
2723 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2724 |
redo A; |
redo A; |
2725 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2726 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2727 |
|
$self->{nc} == 0x005B) { # [ |
2728 |
!!!cp (206.1); |
!!!cp (206.1); |
2729 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
2730 |
|
|
2735 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2736 |
redo A; |
redo A; |
2737 |
} else { |
} else { |
|
!!!cp (206); |
|
2738 |
!!!parse-error (type => 'string after SYSTEM'); |
!!!parse-error (type => 'string after SYSTEM'); |
|
$self->{ct}->{quirks} = 1; |
|
2739 |
|
|
2740 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2741 |
|
!!!cp (206); |
2742 |
|
$self->{ct}->{quirks} = 1; |
2743 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2744 |
|
} else { |
2745 |
|
!!!cp (206.2); |
2746 |
|
$self->{state} = BOGUS_MD_STATE; |
2747 |
|
} |
2748 |
|
|
2749 |
!!!next-input-character; |
!!!next-input-character; |
2750 |
redo A; |
redo A; |
2751 |
} |
} |
2756 |
!!!next-input-character; |
!!!next-input-character; |
2757 |
redo A; |
redo A; |
2758 |
} elsif (not $self->{is_xml} and $self->{nc} == 0x003E) { # > |
} elsif (not $self->{is_xml} and $self->{nc} == 0x003E) { # > |
|
!!!cp (208); |
|
2759 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2760 |
|
|
2761 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2762 |
$self->{s_kwd} = ''; |
!!!cp (208); |
2763 |
|
$self->{state} = DATA_STATE; |
2764 |
|
$self->{s_kwd} = ''; |
2765 |
|
$self->{ct}->{quirks} = 1; |
2766 |
|
} else { |
2767 |
|
!!!cp (208.1); |
2768 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2769 |
|
} |
2770 |
|
|
2771 |
!!!next-input-character; |
!!!next-input-character; |
2772 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2773 |
redo A; |
redo A; |
2774 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (209); |
|
2775 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2776 |
|
|
2777 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2778 |
$self->{s_kwd} = ''; |
!!!cp (209); |
2779 |
|
$self->{state} = DATA_STATE; |
2780 |
|
$self->{s_kwd} = ''; |
2781 |
|
$self->{ct}->{quirks} = 1; |
2782 |
|
} else { |
2783 |
|
!!!cp (209.1); |
2784 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2785 |
|
} |
2786 |
|
|
2787 |
## reconsume |
## reconsume |
2788 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2789 |
redo A; |
redo A; |
2790 |
} else { |
} else { |
2791 |
!!!cp (210); |
!!!cp (210); |
2792 |
$self->{ct}->{sysid} # DOCTYPE |
$self->{ct}->{sysid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2793 |
$self->{read_until}->($self->{ct}->{sysid}, q[">], |
$self->{read_until}->($self->{ct}->{sysid}, q[">], |
2794 |
length $self->{ct}->{sysid}); |
length $self->{ct}->{sysid}); |
2795 |
|
|
2816 |
|
|
2817 |
redo A; |
redo A; |
2818 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (213); |
|
2819 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2820 |
|
|
2821 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2822 |
$self->{s_kwd} = ''; |
!!!cp (213); |
2823 |
## reconsume |
$self->{state} = DATA_STATE; |
2824 |
|
$self->{s_kwd} = ''; |
2825 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2826 |
!!!emit ($self->{ct}); # DOCTYPE |
} else { |
2827 |
|
!!!cp (213.1); |
2828 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2829 |
|
} |
2830 |
|
|
2831 |
|
## reconsume |
2832 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2833 |
redo A; |
redo A; |
2834 |
} else { |
} else { |
2835 |
!!!cp (214); |
!!!cp (214); |
2836 |
$self->{ct}->{sysid} # DOCTYPE |
$self->{ct}->{sysid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2837 |
$self->{read_until}->($self->{ct}->{sysid}, q['>], |
$self->{read_until}->($self->{ct}->{sysid}, q['>], |
2838 |
length $self->{ct}->{sysid}); |
length $self->{ct}->{sysid}); |
2839 |
|
|
2843 |
} |
} |
2844 |
} elsif ($self->{state} == AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE) { |
} elsif ($self->{state} == AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE) { |
2845 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
2846 |
!!!cp (215); |
if ($self->{ct}->{type} == GENERAL_ENTITY_TOKEN) { |
2847 |
## Stay in the state |
!!!cp (215.1); |
2848 |
|
$self->{state} = BEFORE_NDATA_STATE; |
2849 |
|
} else { |
2850 |
|
!!!cp (215); |
2851 |
|
## Stay in the state |
2852 |
|
} |
2853 |
!!!next-input-character; |
!!!next-input-character; |
2854 |
redo A; |
redo A; |
2855 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
2856 |
!!!cp (216); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2857 |
$self->{state} = DATA_STATE; |
!!!cp (216); |
2858 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2859 |
!!!next-input-character; |
$self->{s_kwd} = ''; |
2860 |
|
} else { |
2861 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (216.1); |
2862 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2863 |
|
} |
2864 |
|
|
2865 |
|
!!!next-input-character; |
2866 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2867 |
|
redo A; |
2868 |
|
} elsif ($self->{ct}->{type} == GENERAL_ENTITY_TOKEN and |
2869 |
|
($self->{nc} == 0x004E or # N |
2870 |
|
$self->{nc} == 0x006E)) { # n |
2871 |
|
!!!cp (216.2); |
2872 |
|
!!!parse-error (type => 'no space before NDATA'); ## TODO: type |
2873 |
|
$self->{state} = NDATA_STATE; |
2874 |
|
$self->{kwd} = chr $self->{nc}; |
2875 |
|
!!!next-input-character; |
2876 |
redo A; |
redo A; |
2877 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2878 |
!!!cp (217); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2879 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (217); |
2880 |
$self->{state} = DATA_STATE; |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2881 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2882 |
## reconsume |
$self->{s_kwd} = ''; |
2883 |
|
$self->{ct}->{quirks} = 1; |
2884 |
$self->{ct}->{quirks} = 1; |
} else { |
2885 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (217.1); |
2886 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2887 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2888 |
|
} |
2889 |
|
|
2890 |
|
## reconsume |
2891 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2892 |
redo A; |
redo A; |
2893 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2894 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2895 |
|
$self->{nc} == 0x005B) { # [ |
2896 |
!!!cp (218.1); |
!!!cp (218.1); |
2897 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2898 |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
2901 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2902 |
redo A; |
redo A; |
2903 |
} else { |
} else { |
|
!!!cp (218); |
|
2904 |
!!!parse-error (type => 'string after SYSTEM literal'); |
!!!parse-error (type => 'string after SYSTEM literal'); |
|
#$self->{ct}->{quirks} = 1; |
|
2905 |
|
|
2906 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2907 |
|
!!!cp (218); |
2908 |
|
#$self->{ct}->{quirks} = 1; |
2909 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2910 |
|
} else { |
2911 |
|
!!!cp (218.2); |
2912 |
|
$self->{state} = BOGUS_MD_STATE; |
2913 |
|
} |
2914 |
|
|
2915 |
|
!!!next-input-character; |
2916 |
|
redo A; |
2917 |
|
} |
2918 |
|
} elsif ($self->{state} == BEFORE_NDATA_STATE) { |
2919 |
|
if ($is_space->{$self->{nc}}) { |
2920 |
|
!!!cp (218.3); |
2921 |
|
## Stay in the state. |
2922 |
|
!!!next-input-character; |
2923 |
|
redo A; |
2924 |
|
} elsif ($self->{nc} == 0x003E) { # > |
2925 |
|
!!!cp (218.4); |
2926 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2927 |
|
!!!next-input-character; |
2928 |
|
!!!emit ($self->{ct}); # ENTITY |
2929 |
|
redo A; |
2930 |
|
} elsif ($self->{nc} == 0x004E or # N |
2931 |
|
$self->{nc} == 0x006E) { # n |
2932 |
|
!!!cp (218.5); |
2933 |
|
$self->{state} = NDATA_STATE; |
2934 |
|
$self->{kwd} = chr $self->{nc}; |
2935 |
|
!!!next-input-character; |
2936 |
|
redo A; |
2937 |
|
} elsif ($self->{nc} == -1) { |
2938 |
|
!!!cp (218.6); |
2939 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2940 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2941 |
|
## reconsume |
2942 |
|
!!!emit ($self->{ct}); # ENTITY |
2943 |
|
redo A; |
2944 |
|
} else { |
2945 |
|
!!!cp (218.7); |
2946 |
|
!!!parse-error (type => 'string after SYSTEM literal'); |
2947 |
|
$self->{state} = BOGUS_MD_STATE; |
2948 |
!!!next-input-character; |
!!!next-input-character; |
2949 |
redo A; |
redo A; |
2950 |
} |
} |
3078 |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3079 |
$self->{entity_add} => 1, |
$self->{entity_add} => 1, |
3080 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
3081 |
!!!cp (1001); |
if ($self->{is_xml}) { |
3082 |
|
!!!cp (1001.1); |
3083 |
|
!!!parse-error (type => 'bare ero', |
3084 |
|
line => $self->{line_prev}, |
3085 |
|
column => $self->{column_prev} |
3086 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
3087 |
|
} else { |
3088 |
|
!!!cp (1001); |
3089 |
|
## No error |
3090 |
|
} |
3091 |
## Don't consume |
## Don't consume |
|
## No error |
|
3092 |
## Return nothing. |
## Return nothing. |
3093 |
# |
# |
3094 |
} elsif ($self->{nc} == 0x0023) { # # |
} elsif ($self->{nc} == 0x0023) { # # |
3097 |
$self->{kwd} = '#'; |
$self->{kwd} = '#'; |
3098 |
!!!next-input-character; |
!!!next-input-character; |
3099 |
redo A; |
redo A; |
3100 |
} elsif ((0x0041 <= $self->{nc} and |
} elsif ($self->{is_xml} or |
3101 |
|
(0x0041 <= $self->{nc} and |
3102 |
$self->{nc} <= 0x005A) or # A..Z |
$self->{nc} <= 0x005A) or # A..Z |
3103 |
(0x0061 <= $self->{nc} and |
(0x0061 <= $self->{nc} and |
3104 |
$self->{nc} <= 0x007A)) { # a..z |
$self->{nc} <= 0x007A)) { # a..z |
3142 |
redo A; |
redo A; |
3143 |
} |
} |
3144 |
} elsif ($self->{state} == ENTITY_HASH_STATE) { |
} elsif ($self->{state} == ENTITY_HASH_STATE) { |
3145 |
if ($self->{nc} == 0x0078 or # x |
if ($self->{nc} == 0x0078) { # x |
|
$self->{nc} == 0x0058) { # X |
|
3146 |
!!!cp (995); |
!!!cp (995); |
3147 |
$self->{state} = HEXREF_X_STATE; |
$self->{state} = HEXREF_X_STATE; |
3148 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3149 |
!!!next-input-character; |
!!!next-input-character; |
3150 |
redo A; |
redo A; |
3151 |
|
} elsif ($self->{nc} == 0x0058) { # X |
3152 |
|
!!!cp (995.1); |
3153 |
|
if ($self->{is_xml}) { |
3154 |
|
!!!parse-error (type => 'uppercase hcro'); ## TODO: type |
3155 |
|
} |
3156 |
|
$self->{state} = HEXREF_X_STATE; |
3157 |
|
$self->{kwd} .= chr $self->{nc}; |
3158 |
|
!!!next-input-character; |
3159 |
|
redo A; |
3160 |
} elsif (0x0030 <= $self->{nc} and |
} elsif (0x0030 <= $self->{nc} and |
3161 |
$self->{nc} <= 0x0039) { # 0..9 |
$self->{nc} <= 0x0039) { # 0..9 |
3162 |
!!!cp (994); |
!!!cp (994); |
3364 |
redo A; |
redo A; |
3365 |
} |
} |
3366 |
} elsif ($self->{state} == ENTITY_NAME_STATE) { |
} elsif ($self->{state} == ENTITY_NAME_STATE) { |
3367 |
if (length $self->{kwd} < 30 and |
if ((0x0041 <= $self->{nc} and # a |
3368 |
## NOTE: Some number greater than the maximum length of entity name |
$self->{nc} <= 0x005A) or # x |
3369 |
((0x0041 <= $self->{nc} and # a |
(0x0061 <= $self->{nc} and # a |
3370 |
$self->{nc} <= 0x005A) or # x |
$self->{nc} <= 0x007A) or # z |
3371 |
(0x0061 <= $self->{nc} and # a |
(0x0030 <= $self->{nc} and # 0 |
3372 |
$self->{nc} <= 0x007A) or # z |
$self->{nc} <= 0x0039) or # 9 |
3373 |
(0x0030 <= $self->{nc} and # 0 |
$self->{nc} == 0x003B or # ; |
3374 |
$self->{nc} <= 0x0039) or # 9 |
($self->{is_xml} and |
3375 |
$self->{nc} == 0x003B)) { # ; |
not ($is_space->{$self->{nc}} or |
3376 |
|
{ |
3377 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3378 |
|
$self->{entity_add} => 1, |
3379 |
|
}->{$self->{nc}}))) { |
3380 |
our $EntityChar; |
our $EntityChar; |
3381 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3382 |
if (defined $EntityChar->{$self->{kwd}}) { |
if (defined $EntityChar->{$self->{kwd}} or |
3383 |
|
$self->{ge}->{$self->{kwd}}) { |
3384 |
if ($self->{nc} == 0x003B) { # ; |
if ($self->{nc} == 0x003B) { # ; |
3385 |
!!!cp (1020); |
if (defined $self->{ge}->{$self->{kwd}}) { |
3386 |
$self->{entity__value} = $EntityChar->{$self->{kwd}}; |
if ($self->{ge}->{$self->{kwd}}->{only_text}) { |
3387 |
|
!!!cp (1020.1); |
3388 |
|
$self->{entity__value} = $self->{ge}->{$self->{kwd}}->{value}; |
3389 |
|
} else { |
3390 |
|
if (defined $self->{ge}->{$self->{kwd}}->{notation}) { |
3391 |
|
!!!cp (1020.2); |
3392 |
|
!!!parse-error (type => 'unparsed entity', ## TODO: type |
3393 |
|
value => $self->{kwd}); |
3394 |
|
} else { |
3395 |
|
!!!cp (1020.3); |
3396 |
|
} |
3397 |
|
$self->{entity__value} = '&' . $self->{kwd}; ## TODO: expand |
3398 |
|
} |
3399 |
|
} else { |
3400 |
|
if ($self->{is_xml}) { |
3401 |
|
!!!cp (1020.4); |
3402 |
|
!!!parse-error (type => 'entity not declared', ## TODO: type |
3403 |
|
value => $self->{kwd}, |
3404 |
|
level => { |
3405 |
|
'amp;' => $self->{level}->{warn}, |
3406 |
|
'quot;' => $self->{level}->{warn}, |
3407 |
|
'lt;' => $self->{level}->{warn}, |
3408 |
|
'gt;' => $self->{level}->{warn}, |
3409 |
|
'apos;' => $self->{level}->{warn}, |
3410 |
|
}->{$self->{kwd}} || |
3411 |
|
$self->{level}->{must}); |
3412 |
|
} else { |
3413 |
|
!!!cp (1020); |
3414 |
|
} |
3415 |
|
$self->{entity__value} = $EntityChar->{$self->{kwd}}; |
3416 |
|
} |
3417 |
$self->{entity__match} = 1; |
$self->{entity__match} = 1; |
3418 |
!!!next-input-character; |
!!!next-input-character; |
3419 |
# |
# |
3761 |
$self->{state} = MD_HYPHEN_STATE; |
$self->{state} = MD_HYPHEN_STATE; |
3762 |
!!!next-input-character; |
!!!next-input-character; |
3763 |
redo A; |
redo A; |
3764 |
} elsif ($self->{nc} == 0x0045) { # E |
} elsif ($self->{nc} == 0x0045 or # E |
3765 |
|
$self->{nc} == 0x0065) { # e |
3766 |
$self->{state} = MD_E_STATE; |
$self->{state} = MD_E_STATE; |
3767 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3768 |
!!!next-input-character; |
!!!next-input-character; |
3769 |
redo A; |
redo A; |
3770 |
} elsif ($self->{nc} == 0x0041) { # A |
} elsif ($self->{nc} == 0x0041 or # A |
3771 |
|
$self->{nc} == 0x0061) { # a |
3772 |
$self->{state} = MD_ATTLIST_STATE; |
$self->{state} = MD_ATTLIST_STATE; |
3773 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3774 |
!!!next-input-character; |
!!!next-input-character; |
3775 |
redo A; |
redo A; |
3776 |
} elsif ($self->{nc} == 0x004E) { # N |
} elsif ($self->{nc} == 0x004E or # N |
3777 |
|
$self->{nc} == 0x006E) { # n |
3778 |
$self->{state} = MD_NOTATION_STATE; |
$self->{state} = MD_NOTATION_STATE; |
3779 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3780 |
!!!next-input-character; |
!!!next-input-character; |
3792 |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded. |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded. |
3793 |
redo A; |
redo A; |
3794 |
} elsif ($self->{state} == MD_E_STATE) { |
} elsif ($self->{state} == MD_E_STATE) { |
3795 |
if ($self->{nc} == 0x004E) { # N |
if ($self->{nc} == 0x004E or # N |
3796 |
|
$self->{nc} == 0x006E) { # n |
3797 |
$self->{state} = MD_ENTITY_STATE; |
$self->{state} = MD_ENTITY_STATE; |
3798 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3799 |
!!!next-input-character; |
!!!next-input-character; |
3800 |
redo A; |
redo A; |
3801 |
} elsif ($self->{nc} == 0x004C) { # L |
} elsif ($self->{nc} == 0x004C or # L |
3802 |
|
$self->{nc} == 0x006C) { # l |
3803 |
## XML5: <!ELEMENT> not supported. |
## XML5: <!ELEMENT> not supported. |
3804 |
$self->{state} = MD_ELEMENT_STATE; |
$self->{state} = MD_ELEMENT_STATE; |
3805 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3817 |
redo A; |
redo A; |
3818 |
} |
} |
3819 |
} elsif ($self->{state} == MD_ENTITY_STATE) { |
} elsif ($self->{state} == MD_ENTITY_STATE) { |
3820 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3821 |
'EN' => 0x0054, # T |
undef, |
3822 |
'ENT' => 0x0049, # I |
undef, |
3823 |
'ENTI' => 0x0054, # T |
0x0054, # T |
3824 |
}->{$self->{kwd}}) { |
0x0049, # I |
3825 |
|
0x0054, # T |
3826 |
|
]->[length $self->{kwd}] or |
3827 |
|
$self->{nc} == [ |
3828 |
|
undef, |
3829 |
|
undef, |
3830 |
|
0x0074, # t |
3831 |
|
0x0069, # i |
3832 |
|
0x0074, # t |
3833 |
|
]->[length $self->{kwd}]) { |
3834 |
## Stay in the state. |
## Stay in the state. |
3835 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3836 |
!!!next-input-character; |
!!!next-input-character; |
3837 |
redo A; |
redo A; |
3838 |
} elsif ($self->{kwd} eq 'ENTIT' and |
} elsif ((length $self->{kwd}) == 5 and |
3839 |
$self->{nc} == 0x0059) { # Y |
($self->{nc} == 0x0059 or # Y |
3840 |
$self->{ct} = {type => GENERAL_ENTITY_TOKEN, name => '', text => '', |
$self->{nc} == 0x0079)) { # y |
3841 |
|
if ($self->{kwd} ne 'ENTIT' or $self->{nc} == 0x0079) { |
3842 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3843 |
|
text => 'ENTITY', |
3844 |
|
line => $self->{line_prev}, |
3845 |
|
column => $self->{column_prev} - 4); |
3846 |
|
} |
3847 |
|
$self->{ct} = {type => GENERAL_ENTITY_TOKEN, name => '', |
3848 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3849 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 6}; |
3850 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3862 |
redo A; |
redo A; |
3863 |
} |
} |
3864 |
} elsif ($self->{state} == MD_ELEMENT_STATE) { |
} elsif ($self->{state} == MD_ELEMENT_STATE) { |
3865 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3866 |
'EL' => 0x0045, # E |
undef, |
3867 |
'ELE' => 0x004D, # M |
undef, |
3868 |
'ELEM' => 0x0045, # E |
0x0045, # E |
3869 |
'ELEME' => 0x004E, # N |
0x004D, # M |
3870 |
}->{$self->{kwd}}) { |
0x0045, # E |
3871 |
|
0x004E, # N |
3872 |
|
]->[length $self->{kwd}] or |
3873 |
|
$self->{nc} == [ |
3874 |
|
undef, |
3875 |
|
undef, |
3876 |
|
0x0065, # e |
3877 |
|
0x006D, # m |
3878 |
|
0x0065, # e |
3879 |
|
0x006E, # n |
3880 |
|
]->[length $self->{kwd}]) { |
3881 |
## Stay in the state. |
## Stay in the state. |
3882 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3883 |
!!!next-input-character; |
!!!next-input-character; |
3884 |
redo A; |
redo A; |
3885 |
} elsif ($self->{kwd} eq 'ELEMEN' and |
} elsif ((length $self->{kwd}) == 6 and |
3886 |
$self->{nc} == 0x0054) { # T |
($self->{nc} == 0x0054 or # T |
3887 |
|
$self->{nc} == 0x0074)) { # t |
3888 |
|
if ($self->{kwd} ne 'ELEMEN' or $self->{nc} == 0x0074) { |
3889 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3890 |
|
text => 'ELEMENT', |
3891 |
|
line => $self->{line_prev}, |
3892 |
|
column => $self->{column_prev} - 5); |
3893 |
|
} |
3894 |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
3895 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3896 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3897 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3898 |
!!!next-input-character; |
!!!next-input-character; |
3899 |
redo A; |
redo A; |
3909 |
redo A; |
redo A; |
3910 |
} |
} |
3911 |
} elsif ($self->{state} == MD_ATTLIST_STATE) { |
} elsif ($self->{state} == MD_ATTLIST_STATE) { |
3912 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3913 |
'A' => 0x0054, # T |
undef, |
3914 |
'AT' => 0x0054, # T |
0x0054, # T |
3915 |
'ATT' => 0x004C, # L |
0x0054, # T |
3916 |
'ATTL' => 0x0049, # I |
0x004C, # L |
3917 |
'ATTLI' => 0x0053, # S |
0x0049, # I |
3918 |
}->{$self->{kwd}}) { |
0x0053, # S |
3919 |
|
]->[length $self->{kwd}] or |
3920 |
|
$self->{nc} == [ |
3921 |
|
undef, |
3922 |
|
0x0074, # t |
3923 |
|
0x0074, # t |
3924 |
|
0x006C, # l |
3925 |
|
0x0069, # i |
3926 |
|
0x0073, # s |
3927 |
|
]->[length $self->{kwd}]) { |
3928 |
## Stay in the state. |
## Stay in the state. |
3929 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3930 |
!!!next-input-character; |
!!!next-input-character; |
3931 |
redo A; |
redo A; |
3932 |
} elsif ($self->{kwd} eq 'ATTLIS' and |
} elsif ((length $self->{kwd}) == 6 and |
3933 |
$self->{nc} == 0x0054) { # T |
($self->{nc} == 0x0054 or # T |
3934 |
|
$self->{nc} == 0x0074)) { # t |
3935 |
|
if ($self->{kwd} ne 'ATTLIS' or $self->{nc} == 0x0074) { |
3936 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3937 |
|
text => 'ATTLIST', |
3938 |
|
line => $self->{line_prev}, |
3939 |
|
column => $self->{column_prev} - 5); |
3940 |
|
} |
3941 |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
3942 |
|
attrdefs => [], |
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; |
3957 |
redo A; |
redo A; |
3958 |
} |
} |
3959 |
} elsif ($self->{state} == MD_NOTATION_STATE) { |
} elsif ($self->{state} == MD_NOTATION_STATE) { |
3960 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3961 |
'N' => 0x004F, # O |
undef, |
3962 |
'NO' => 0x0054, # T |
0x004F, # O |
3963 |
'NOT' => 0x0041, # A |
0x0054, # T |
3964 |
'NOTA' => 0x0054, # T |
0x0041, # A |
3965 |
'NOTAT' => 0x0049, # I |
0x0054, # T |
3966 |
'NOTATI' => 0x004F, # O |
0x0049, # I |
3967 |
}->{$self->{kwd}}) { |
0x004F, # O |
3968 |
|
]->[length $self->{kwd}] or |
3969 |
|
$self->{nc} == [ |
3970 |
|
undef, |
3971 |
|
0x006F, # o |
3972 |
|
0x0074, # t |
3973 |
|
0x0061, # a |
3974 |
|
0x0074, # t |
3975 |
|
0x0069, # i |
3976 |
|
0x006F, # o |
3977 |
|
]->[length $self->{kwd}]) { |
3978 |
## Stay in the state. |
## Stay in the state. |
3979 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3980 |
!!!next-input-character; |
!!!next-input-character; |
3981 |
redo A; |
redo A; |
3982 |
} elsif ($self->{kwd} eq 'NOTATIO' and |
} elsif ((length $self->{kwd}) == 7 and |
3983 |
$self->{nc} == 0x004E) { # N |
($self->{nc} == 0x004E or # N |
3984 |
|
$self->{nc} == 0x006E)) { # n |
3985 |
|
if ($self->{kwd} ne 'NOTATIO' or $self->{nc} == 0x006E) { |
3986 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3987 |
|
text => 'NOTATION', |
3988 |
|
line => $self->{line_prev}, |
3989 |
|
column => $self->{column_prev} - 6); |
3990 |
|
} |
3991 |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
3992 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3993 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 8}; |
3994 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3995 |
!!!next-input-character; |
!!!next-input-character; |
3996 |
redo A; |
redo A; |
4099 |
## XML5: "DOCTYPE ENTITY name state" and "DOCTYPE ATTLIST name state". |
## XML5: "DOCTYPE ENTITY name state" and "DOCTYPE ATTLIST name state". |
4100 |
|
|
4101 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
4102 |
## TODO: |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
4103 |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4104 |
|
} elsif ($self->{ct}->{type} == ELEMENT_TOKEN) { |
4105 |
|
$self->{state} = AFTER_ELEMENT_NAME_STATE; |
4106 |
|
} else { # ENTITY/NOTATION |
4107 |
|
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
4108 |
|
} |
4109 |
!!!next-input-character; |
!!!next-input-character; |
4110 |
redo A; |
redo A; |
4111 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
4112 |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
4113 |
# |
# |
4114 |
} else { |
} else { |
4115 |
!!!parse-error (type => 'no md body'); ## TODO: type |
!!!parse-error (type => 'no md def'); ## TODO: type |
4116 |
} |
} |
4117 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4118 |
!!!next-input-character; |
!!!next-input-character; |
4146 |
## XML5: No parse error. |
## XML5: No parse error. |
4147 |
!!!parse-error (type => 'unclosed md'); ## TODO: type |
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4148 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4149 |
|
!!!emit ($self->{ct}); |
4150 |
redo A; |
redo A; |
4151 |
} else { |
} else { |
4152 |
## XML5: Not defined yet. |
## XML5: Not defined yet. |
4153 |
|
$self->{ca} = {name => chr ($self->{nc}), # attrdef |
4154 |
## TODO: ... |
tokens => [], |
4155 |
|
line => $self->{line}, column => $self->{column}}; |
4156 |
$self->{state} = BOGUS_COMMENT_STATE; |
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_NAME_STATE; |
4157 |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded |
!!!next-input-character; |
4158 |
|
redo A; |
4159 |
|
} |
4160 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_NAME_STATE) { |
4161 |
|
if ($is_space->{$self->{nc}}) { |
4162 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_NAME_AFTER_STATE; |
4163 |
|
!!!next-input-character; |
4164 |
|
redo A; |
4165 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4166 |
|
## XML5: Same as "anything else". |
4167 |
|
!!!parse-error (type => 'no attr type'); ## TODO: type |
4168 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4169 |
|
!!!next-input-character; |
4170 |
|
!!!emit ($self->{ct}); # ATTLIST |
4171 |
|
redo A; |
4172 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4173 |
|
## XML5: Same as "anything else". |
4174 |
|
!!!parse-error (type => 'no space before paren'); ## TODO: type |
4175 |
|
$self->{state} = BEFORE_ALLOWED_TOKEN_STATE; |
4176 |
|
!!!next-input-character; |
4177 |
|
redo A; |
4178 |
|
} elsif ($self->{nc} == -1) { |
4179 |
|
## XML5: No parse error. |
4180 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4181 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4182 |
|
!!!next-input-character; |
4183 |
|
!!!emit ($self->{ct}); # ATTLIST |
4184 |
|
redo A; |
4185 |
|
} else { |
4186 |
|
## XML5: Not defined yet. |
4187 |
|
$self->{ca}->{name} .= chr $self->{nc}; |
4188 |
|
## Stay in the state. |
4189 |
|
!!!next-input-character; |
4190 |
|
redo A; |
4191 |
|
} |
4192 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_NAME_AFTER_STATE) { |
4193 |
|
if ($is_space->{$self->{nc}}) { |
4194 |
|
## Stay in the state. |
4195 |
|
!!!next-input-character; |
4196 |
|
redo A; |
4197 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4198 |
|
## XML5: Same as "anything else". |
4199 |
|
!!!parse-error (type => 'no attr type'); ## TODO: type |
4200 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4201 |
|
!!!next-input-character; |
4202 |
|
!!!emit ($self->{ct}); # ATTLIST |
4203 |
|
redo A; |
4204 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4205 |
|
## XML5: Same as "anything else". |
4206 |
|
$self->{state} = BEFORE_ALLOWED_TOKEN_STATE; |
4207 |
|
!!!next-input-character; |
4208 |
|
redo A; |
4209 |
|
} elsif ($self->{nc} == -1) { |
4210 |
|
## XML5: No parse error. |
4211 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4212 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4213 |
|
!!!next-input-character; |
4214 |
|
!!!emit ($self->{ct}); |
4215 |
|
redo A; |
4216 |
|
} else { |
4217 |
|
## XML5: Not defined yet. |
4218 |
|
$self->{ca}->{type} = chr $self->{nc}; |
4219 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_TYPE_STATE; |
4220 |
|
!!!next-input-character; |
4221 |
|
redo A; |
4222 |
|
} |
4223 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_TYPE_STATE) { |
4224 |
|
if ($is_space->{$self->{nc}}) { |
4225 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_TYPE_AFTER_STATE; |
4226 |
|
!!!next-input-character; |
4227 |
|
redo A; |
4228 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4229 |
|
## XML5: Same as "anything else". |
4230 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4231 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_BEFORE_STATE; |
4232 |
|
!!!next-input-character; |
4233 |
|
redo A; |
4234 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4235 |
|
## XML5: Same as "anything else". |
4236 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4237 |
|
$self->{ca}->{value} = ''; |
4238 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4239 |
|
!!!next-input-character; |
4240 |
|
redo A; |
4241 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4242 |
|
## XML5: Same as "anything else". |
4243 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4244 |
|
$self->{ca}->{value} = ''; |
4245 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4246 |
|
!!!next-input-character; |
4247 |
|
redo A; |
4248 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4249 |
|
## XML5: Same as "anything else". |
4250 |
|
!!!parse-error (type => 'no attr default'); ## TODO: type |
4251 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4252 |
|
!!!next-input-character; |
4253 |
|
!!!emit ($self->{ct}); # ATTLIST |
4254 |
|
redo A; |
4255 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4256 |
|
## XML5: Same as "anything else". |
4257 |
|
!!!parse-error (type => 'no space before paren'); ## TODO: type |
4258 |
|
$self->{state} = BEFORE_ALLOWED_TOKEN_STATE; |
4259 |
|
!!!next-input-character; |
4260 |
|
redo A; |
4261 |
|
} elsif ($self->{nc} == -1) { |
4262 |
|
## XML5: No parse error. |
4263 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4264 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4265 |
|
!!!next-input-character; |
4266 |
|
!!!emit ($self->{ct}); |
4267 |
|
redo A; |
4268 |
|
} else { |
4269 |
|
## XML5: Not defined yet. |
4270 |
|
$self->{ca}->{type} .= chr $self->{nc}; |
4271 |
|
## Stay in the state. |
4272 |
|
!!!next-input-character; |
4273 |
|
redo A; |
4274 |
|
} |
4275 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_TYPE_AFTER_STATE) { |
4276 |
|
if ($is_space->{$self->{nc}}) { |
4277 |
|
## Stay in the state. |
4278 |
|
!!!next-input-character; |
4279 |
|
redo A; |
4280 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4281 |
|
## XML5: Same as "anything else". |
4282 |
|
$self->{state} = BEFORE_ALLOWED_TOKEN_STATE; |
4283 |
|
!!!next-input-character; |
4284 |
|
redo A; |
4285 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4286 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_BEFORE_STATE; |
4287 |
|
!!!next-input-character; |
4288 |
|
redo A; |
4289 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4290 |
|
## XML5: Same as "anything else". |
4291 |
|
$self->{ca}->{value} = ''; |
4292 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4293 |
|
!!!next-input-character; |
4294 |
|
redo A; |
4295 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4296 |
|
## XML5: Same as "anything else". |
4297 |
|
$self->{ca}->{value} = ''; |
4298 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4299 |
|
!!!next-input-character; |
4300 |
|
redo A; |
4301 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4302 |
|
## XML5: Same as "anything else". |
4303 |
|
!!!parse-error (type => 'no attr default'); ## TODO: type |
4304 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4305 |
|
!!!next-input-character; |
4306 |
|
!!!emit ($self->{ct}); # ATTLIST |
4307 |
|
redo A; |
4308 |
|
} elsif ($self->{nc} == -1) { |
4309 |
|
## XML5: No parse error. |
4310 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4311 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4312 |
|
!!!next-input-character; |
4313 |
|
!!!emit ($self->{ct}); |
4314 |
|
redo A; |
4315 |
|
} else { |
4316 |
|
## XML5: Switch to the "DOCTYPE bogus comment state". |
4317 |
|
!!!parse-error (type => 'unquoted attr value'); ## TODO: type |
4318 |
|
$self->{ca}->{value} = ''; |
4319 |
|
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
4320 |
|
## Reconsume. |
4321 |
|
redo A; |
4322 |
|
} |
4323 |
|
} elsif ($self->{state} == BEFORE_ALLOWED_TOKEN_STATE) { |
4324 |
|
if ($is_space->{$self->{nc}}) { |
4325 |
|
## Stay in the state. |
4326 |
|
!!!next-input-character; |
4327 |
|
redo A; |
4328 |
|
} elsif ($self->{nc} == 0x007C) { # | |
4329 |
|
!!!parse-error (type => 'empty allowed token'); ## TODO: type |
4330 |
|
## Stay in the state. |
4331 |
|
!!!next-input-character; |
4332 |
|
redo A; |
4333 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4334 |
|
!!!parse-error (type => 'empty allowed token'); ## TODO: type |
4335 |
|
$self->{state} = AFTER_ALLOWED_TOKENS_STATE; |
4336 |
|
!!!next-input-character; |
4337 |
|
redo A; |
4338 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4339 |
|
!!!parse-error (type => 'unclosed allowed tokens'); ## TODO: type |
4340 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4341 |
|
!!!next-input-character; |
4342 |
|
!!!emit ($self->{ct}); # ATTLIST |
4343 |
|
redo A; |
4344 |
|
} elsif ($self->{nc} == -1) { |
4345 |
|
## XML5: No parse error. |
4346 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4347 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4348 |
|
!!!next-input-character; |
4349 |
|
!!!emit ($self->{ct}); |
4350 |
|
redo A; |
4351 |
|
} else { |
4352 |
|
push @{$self->{ca}->{tokens}}, chr $self->{nc}; |
4353 |
|
$self->{state} = ALLOWED_TOKEN_STATE; |
4354 |
|
!!!next-input-character; |
4355 |
|
redo A; |
4356 |
|
} |
4357 |
|
} elsif ($self->{state} == ALLOWED_TOKEN_STATE) { |
4358 |
|
if ($is_space->{$self->{nc}}) { |
4359 |
|
$self->{state} = AFTER_ALLOWED_TOKEN_STATE; |
4360 |
|
!!!next-input-character; |
4361 |
|
redo A; |
4362 |
|
} elsif ($self->{nc} == 0x007C) { # | |
4363 |
|
$self->{state} = BEFORE_ALLOWED_TOKEN_STATE; |
4364 |
|
!!!next-input-character; |
4365 |
|
redo A; |
4366 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4367 |
|
$self->{state} = AFTER_ALLOWED_TOKENS_STATE; |
4368 |
|
!!!next-input-character; |
4369 |
|
redo A; |
4370 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4371 |
|
!!!parse-error (type => 'unclosed allowed tokens'); ## TODO: type |
4372 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4373 |
|
!!!next-input-character; |
4374 |
|
!!!emit ($self->{ct}); # ATTLIST |
4375 |
|
redo A; |
4376 |
|
} elsif ($self->{nc} == -1) { |
4377 |
|
## XML5: No parse error. |
4378 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4379 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4380 |
|
!!!next-input-character; |
4381 |
|
!!!emit ($self->{ct}); |
4382 |
|
redo A; |
4383 |
|
} else { |
4384 |
|
$self->{ca}->{tokens}->[-1] .= chr $self->{nc}; |
4385 |
|
## Stay in the state. |
4386 |
|
!!!next-input-character; |
4387 |
|
redo A; |
4388 |
|
} |
4389 |
|
} elsif ($self->{state} == AFTER_ALLOWED_TOKEN_STATE) { |
4390 |
|
if ($is_space->{$self->{nc}}) { |
4391 |
|
## Stay in the state. |
4392 |
|
!!!next-input-character; |
4393 |
|
redo A; |
4394 |
|
} elsif ($self->{nc} == 0x007C) { # | |
4395 |
|
$self->{state} = BEFORE_ALLOWED_TOKEN_STATE; |
4396 |
|
!!!next-input-character; |
4397 |
|
redo A; |
4398 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4399 |
|
$self->{state} = AFTER_ALLOWED_TOKENS_STATE; |
4400 |
|
!!!next-input-character; |
4401 |
|
redo A; |
4402 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4403 |
|
!!!parse-error (type => 'unclosed allowed tokens'); ## TODO: type |
4404 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4405 |
|
!!!next-input-character; |
4406 |
|
!!!emit ($self->{ct}); # ATTLIST |
4407 |
|
redo A; |
4408 |
|
} elsif ($self->{nc} == -1) { |
4409 |
|
## XML5: No parse error. |
4410 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4411 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4412 |
|
!!!next-input-character; |
4413 |
|
!!!emit ($self->{ct}); |
4414 |
|
redo A; |
4415 |
|
} else { |
4416 |
|
!!!parse-error (type => 'space in allowed token', ## TODO: type |
4417 |
|
line => $self->{line_prev}, |
4418 |
|
column => $self->{column_prev}); |
4419 |
|
$self->{ca}->{tokens}->[-1] .= ' ' . chr $self->{nc}; |
4420 |
|
$self->{state} = ALLOWED_TOKEN_STATE; |
4421 |
|
!!!next-input-character; |
4422 |
|
redo A; |
4423 |
|
} |
4424 |
|
} elsif ($self->{state} == AFTER_ALLOWED_TOKENS_STATE) { |
4425 |
|
if ($is_space->{$self->{nc}}) { |
4426 |
|
$self->{state} = BEFORE_ATTR_DEFAULT_STATE; |
4427 |
|
!!!next-input-character; |
4428 |
|
redo A; |
4429 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4430 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4431 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_BEFORE_STATE; |
4432 |
|
!!!next-input-character; |
4433 |
|
redo A; |
4434 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4435 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4436 |
|
$self->{ca}->{value} = ''; |
4437 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4438 |
|
!!!next-input-character; |
4439 |
|
redo A; |
4440 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4441 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4442 |
|
$self->{ca}->{value} = ''; |
4443 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4444 |
|
!!!next-input-character; |
4445 |
|
redo A; |
4446 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4447 |
|
!!!parse-error (type => 'no attr default'); ## TODO: type |
4448 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4449 |
|
!!!next-input-character; |
4450 |
|
!!!emit ($self->{ct}); # ATTLIST |
4451 |
|
redo A; |
4452 |
|
} elsif ($self->{nc} == -1) { |
4453 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4454 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4455 |
|
!!!next-input-character; |
4456 |
|
!!!emit ($self->{ct}); |
4457 |
|
redo A; |
4458 |
|
} else { |
4459 |
|
!!!parse-error (type => 'unquoted attr value'); ## TODO: type |
4460 |
|
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
4461 |
|
## Reconsume. |
4462 |
|
redo A; |
4463 |
|
} |
4464 |
|
} elsif ($self->{state} == BEFORE_ATTR_DEFAULT_STATE) { |
4465 |
|
if ($is_space->{$self->{nc}}) { |
4466 |
|
## Stay in the state. |
4467 |
|
!!!next-input-character; |
4468 |
|
redo A; |
4469 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4470 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_BEFORE_STATE; |
4471 |
|
!!!next-input-character; |
4472 |
|
redo A; |
4473 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4474 |
|
$self->{ca}->{value} = ''; |
4475 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4476 |
|
!!!next-input-character; |
4477 |
|
redo A; |
4478 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4479 |
|
$self->{ca}->{value} = ''; |
4480 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4481 |
|
!!!next-input-character; |
4482 |
|
redo A; |
4483 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4484 |
|
!!!parse-error (type => 'no attr default'); ## TODO: type |
4485 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4486 |
|
!!!next-input-character; |
4487 |
|
!!!emit ($self->{ct}); # ATTLIST |
4488 |
|
redo A; |
4489 |
|
} elsif ($self->{nc} == -1) { |
4490 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4491 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4492 |
|
!!!next-input-character; |
4493 |
|
!!!emit ($self->{ct}); |
4494 |
|
redo A; |
4495 |
|
} else { |
4496 |
|
!!!parse-error (type => 'unquoted attr value'); ## TODO: type |
4497 |
|
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
4498 |
|
## Reconsume. |
4499 |
|
redo A; |
4500 |
|
} |
4501 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_BEFORE_STATE) { |
4502 |
|
if ($is_space->{$self->{nc}}) { |
4503 |
|
## XML5: No parse error. |
4504 |
|
!!!parse-error (type => 'no default type'); ## TODO: type |
4505 |
|
$self->{state} = BOGUS_MD_STATE; |
4506 |
## Reconsume. |
## Reconsume. |
4507 |
redo A; |
redo A; |
4508 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4509 |
|
## XML5: Same as "anything else". |
4510 |
|
$self->{ca}->{value} = ''; |
4511 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4512 |
|
!!!next-input-character; |
4513 |
|
redo A; |
4514 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4515 |
|
## XML5: Same as "anything else". |
4516 |
|
$self->{ca}->{value} = ''; |
4517 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4518 |
|
!!!next-input-character; |
4519 |
|
redo A; |
4520 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4521 |
|
## XML5: Same as "anything else". |
4522 |
|
!!!parse-error (type => 'no attr default'); ## TODO: type |
4523 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4524 |
|
!!!next-input-character; |
4525 |
|
!!!emit ($self->{ct}); # ATTLIST |
4526 |
|
redo A; |
4527 |
|
} elsif ($self->{nc} == -1) { |
4528 |
|
## XML5: No parse error. |
4529 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4530 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4531 |
|
!!!next-input-character; |
4532 |
|
!!!emit ($self->{ct}); |
4533 |
|
redo A; |
4534 |
|
} else { |
4535 |
|
$self->{ca}->{default} = chr $self->{nc}; |
4536 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_STATE; |
4537 |
|
!!!next-input-character; |
4538 |
|
redo A; |
4539 |
|
} |
4540 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_STATE) { |
4541 |
|
if ($is_space->{$self->{nc}}) { |
4542 |
|
$self->{state} = DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_AFTER_STATE; |
4543 |
|
!!!next-input-character; |
4544 |
|
redo A; |
4545 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4546 |
|
## XML5: Same as "anything else". |
4547 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4548 |
|
$self->{ca}->{value} = ''; |
4549 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4550 |
|
!!!next-input-character; |
4551 |
|
redo A; |
4552 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4553 |
|
## XML5: Same as "anything else". |
4554 |
|
!!!parse-error (type => 'no space before default value'); ## TODO: type |
4555 |
|
$self->{ca}->{value} = ''; |
4556 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4557 |
|
!!!next-input-character; |
4558 |
|
redo A; |
4559 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4560 |
|
## XML5: Same as "anything else". |
4561 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
4562 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4563 |
|
!!!next-input-character; |
4564 |
|
!!!emit ($self->{ct}); # ATTLIST |
4565 |
|
redo A; |
4566 |
|
} elsif ($self->{nc} == -1) { |
4567 |
|
## XML5: No parse error. |
4568 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4569 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
4570 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4571 |
|
!!!next-input-character; |
4572 |
|
!!!emit ($self->{ct}); |
4573 |
|
redo A; |
4574 |
|
} else { |
4575 |
|
$self->{ca}->{default} .= chr $self->{nc}; |
4576 |
|
## Stay in the state. |
4577 |
|
!!!next-input-character; |
4578 |
|
redo A; |
4579 |
|
} |
4580 |
|
} elsif ($self->{state} == DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_AFTER_STATE) { |
4581 |
|
if ($is_space->{$self->{nc}}) { |
4582 |
|
## Stay in the state. |
4583 |
|
!!!next-input-character; |
4584 |
|
redo A; |
4585 |
|
} elsif ($self->{nc} == 0x0022) { # " |
4586 |
|
$self->{ca}->{value} = ''; |
4587 |
|
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
4588 |
|
!!!next-input-character; |
4589 |
|
redo A; |
4590 |
|
} elsif ($self->{nc} == 0x0027) { # ' |
4591 |
|
$self->{ca}->{value} = ''; |
4592 |
|
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
4593 |
|
!!!next-input-character; |
4594 |
|
redo A; |
4595 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4596 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
4597 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4598 |
|
!!!next-input-character; |
4599 |
|
!!!emit ($self->{ct}); # ATTLIST |
4600 |
|
redo A; |
4601 |
|
} elsif ($self->{nc} == -1) { |
4602 |
|
## XML5: No parse error. |
4603 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4604 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
4605 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; ## XML5: "Data state". |
4606 |
|
!!!next-input-character; |
4607 |
|
!!!emit ($self->{ct}); |
4608 |
|
redo A; |
4609 |
|
} else { |
4610 |
|
## XML5: Not defined yet. |
4611 |
|
if ($self->{ca}->{default} eq 'FIXED') { |
4612 |
|
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
4613 |
|
} else { |
4614 |
|
push @{$self->{ct}->{attrdefs}}, $self->{ca}; |
4615 |
|
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4616 |
|
} |
4617 |
|
## Reconsume. |
4618 |
|
redo A; |
4619 |
|
} |
4620 |
|
} elsif ($self->{state} == AFTER_ATTLIST_ATTR_VALUE_QUOTED_STATE) { |
4621 |
|
if ($is_space->{$self->{nc}} or |
4622 |
|
$self->{nc} == -1 or |
4623 |
|
$self->{nc} == 0x003E) { # > |
4624 |
|
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4625 |
|
## Reconsume. |
4626 |
|
redo A; |
4627 |
|
} else { |
4628 |
|
!!!parse-error (type => 'no space before attr name'); ## TODO: type |
4629 |
|
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4630 |
|
## Reconsume. |
4631 |
|
redo A; |
4632 |
|
} |
4633 |
|
} elsif ($self->{state} == NDATA_STATE) { |
4634 |
|
## ASCII case-insensitive |
4635 |
|
if ($self->{nc} == [ |
4636 |
|
undef, |
4637 |
|
0x0044, # D |
4638 |
|
0x0041, # A |
4639 |
|
0x0054, # T |
4640 |
|
]->[length $self->{kwd}] or |
4641 |
|
$self->{nc} == [ |
4642 |
|
undef, |
4643 |
|
0x0064, # d |
4644 |
|
0x0061, # a |
4645 |
|
0x0074, # t |
4646 |
|
]->[length $self->{kwd}]) { |
4647 |
|
!!!cp (172.2); |
4648 |
|
## Stay in the state. |
4649 |
|
$self->{kwd} .= chr $self->{nc}; |
4650 |
|
!!!next-input-character; |
4651 |
|
redo A; |
4652 |
|
} elsif ((length $self->{kwd}) == 4 and |
4653 |
|
($self->{nc} == 0x0041 or # A |
4654 |
|
$self->{nc} == 0x0061)) { # a |
4655 |
|
if ($self->{kwd} ne 'NDAT' or $self->{nc} == 0x0061) { # a |
4656 |
|
!!!cp (172.3); |
4657 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
4658 |
|
text => 'NDATA', |
4659 |
|
line => $self->{line_prev}, |
4660 |
|
column => $self->{column_prev} - 4); |
4661 |
|
} else { |
4662 |
|
!!!cp (172.4); |
4663 |
|
} |
4664 |
|
$self->{state} = AFTER_NDATA_STATE; |
4665 |
|
!!!next-input-character; |
4666 |
|
redo A; |
4667 |
|
} else { |
4668 |
|
!!!parse-error (type => 'string after literal', ## TODO: type |
4669 |
|
line => $self->{line_prev}, |
4670 |
|
column => $self->{column_prev} + 1 |
4671 |
|
- length $self->{kwd}); |
4672 |
|
!!!cp (172.5); |
4673 |
|
$self->{state} = BOGUS_MD_STATE; |
4674 |
|
## Reconsume. |
4675 |
|
redo A; |
4676 |
|
} |
4677 |
|
} elsif ($self->{state} == AFTER_NDATA_STATE) { |
4678 |
|
if ($is_space->{$self->{nc}}) { |
4679 |
|
$self->{state} = BEFORE_NOTATION_NAME_STATE; |
4680 |
|
!!!next-input-character; |
4681 |
|
redo A; |
4682 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4683 |
|
!!!parse-error (type => 'no notation name'); ## TODO: type |
4684 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4685 |
|
!!!next-input-character; |
4686 |
|
!!!emit ($self->{ct}); # ENTITY |
4687 |
|
redo A; |
4688 |
|
} elsif ($self->{nc} == -1) { |
4689 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4690 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4691 |
|
!!!next-input-character; |
4692 |
|
!!!emit ($self->{ct}); # ENTITY |
4693 |
|
redo A; |
4694 |
|
} else { |
4695 |
|
!!!parse-error (type => 'string after literal', ## TODO: type |
4696 |
|
line => $self->{line_prev}, |
4697 |
|
column => $self->{column_prev} + 1 |
4698 |
|
- length $self->{kwd}); |
4699 |
|
$self->{state} = BOGUS_MD_STATE; |
4700 |
|
## Reconsume. |
4701 |
|
redo A; |
4702 |
|
} |
4703 |
|
} elsif ($self->{state} == BEFORE_NOTATION_NAME_STATE) { |
4704 |
|
if ($is_space->{$self->{nc}}) { |
4705 |
|
## Stay in the state. |
4706 |
|
!!!next-input-character; |
4707 |
|
redo A; |
4708 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4709 |
|
!!!parse-error (type => 'no notation name'); ## TODO: type |
4710 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4711 |
|
!!!next-input-character; |
4712 |
|
!!!emit ($self->{ct}); # ENTITY |
4713 |
|
redo A; |
4714 |
|
} elsif ($self->{nc} == -1) { |
4715 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4716 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4717 |
|
!!!next-input-character; |
4718 |
|
!!!emit ($self->{ct}); # ENTITY |
4719 |
|
redo A; |
4720 |
|
} else { |
4721 |
|
$self->{ct}->{notation} = chr $self->{nc}; # ENTITY |
4722 |
|
$self->{state} = NOTATION_NAME_STATE; |
4723 |
|
!!!next-input-character; |
4724 |
|
redo A; |
4725 |
|
} |
4726 |
|
} elsif ($self->{state} == NOTATION_NAME_STATE) { |
4727 |
|
if ($is_space->{$self->{nc}}) { |
4728 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4729 |
|
!!!next-input-character; |
4730 |
|
redo A; |
4731 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4732 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4733 |
|
!!!next-input-character; |
4734 |
|
!!!emit ($self->{ct}); # ENTITY |
4735 |
|
redo A; |
4736 |
|
} elsif ($self->{nc} == -1) { |
4737 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4738 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4739 |
|
!!!next-input-character; |
4740 |
|
!!!emit ($self->{ct}); # ENTITY |
4741 |
|
redo A; |
4742 |
|
} else { |
4743 |
|
$self->{ct}->{notation} .= chr $self->{nc}; # ENTITY |
4744 |
|
## Stay in the state. |
4745 |
|
!!!next-input-character; |
4746 |
|
redo A; |
4747 |
|
} |
4748 |
|
} elsif ($self->{state} == DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE) { |
4749 |
|
if ($self->{nc} == 0x0022) { # " |
4750 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4751 |
|
!!!next-input-character; |
4752 |
|
redo A; |
4753 |
|
} elsif ($self->{nc} == 0x0026) { # & |
4754 |
|
$self->{prev_state} = $self->{state}; |
4755 |
|
$self->{state} = ENTITY_VALUE_ENTITY_STATE; |
4756 |
|
$self->{entity_add} = 0x0022; # " |
4757 |
|
!!!next-input-character; |
4758 |
|
redo A; |
4759 |
|
## TODO: % |
4760 |
|
} elsif ($self->{nc} == -1) { |
4761 |
|
!!!parse-error (type => 'unclosed entity value'); ## TODO: type |
4762 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4763 |
|
## Reconsume. |
4764 |
|
!!!emit ($self->{ct}); # ENTITY |
4765 |
|
redo A; |
4766 |
|
} else { |
4767 |
|
$self->{ct}->{value} .= chr $self->{nc}; # ENTITY |
4768 |
|
!!!next-input-character; |
4769 |
|
redo A; |
4770 |
|
} |
4771 |
|
} elsif ($self->{state} == DOCTYPE_ENTITY_VALUE_SINGLE_QUOTED_STATE) { |
4772 |
|
if ($self->{nc} == 0x0027) { # ' |
4773 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4774 |
|
!!!next-input-character; |
4775 |
|
redo A; |
4776 |
|
} elsif ($self->{nc} == 0x0026) { # & |
4777 |
|
$self->{prev_state} = $self->{state}; |
4778 |
|
$self->{state} = ENTITY_VALUE_ENTITY_STATE; |
4779 |
|
$self->{entity_add} = 0x0027; # ' |
4780 |
|
!!!next-input-character; |
4781 |
|
redo A; |
4782 |
|
## TODO: % |
4783 |
|
} elsif ($self->{nc} == -1) { |
4784 |
|
!!!parse-error (type => 'unclosed entity value'); ## TODO: type |
4785 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4786 |
|
## Reconsume. |
4787 |
|
!!!emit ($self->{ct}); # ENTITY |
4788 |
|
redo A; |
4789 |
|
} else { |
4790 |
|
$self->{ct}->{value} .= chr $self->{nc}; # ENTITY |
4791 |
|
!!!next-input-character; |
4792 |
|
redo A; |
4793 |
|
} |
4794 |
|
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
4795 |
|
if ($is_space->{$self->{nc}} or |
4796 |
|
{ |
4797 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
4798 |
|
$self->{entity_add} => 1, |
4799 |
|
}->{$self->{nc}}) { |
4800 |
|
!!!parse-error (type => 'bare ero', |
4801 |
|
line => $self->{line_prev}, |
4802 |
|
column => $self->{column_prev} |
4803 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
4804 |
|
## Don't consume |
4805 |
|
## Return nothing. |
4806 |
|
# |
4807 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4808 |
|
$self->{ca} = $self->{ct}; |
4809 |
|
$self->{state} = ENTITY_HASH_STATE; |
4810 |
|
$self->{kwd} = '#'; |
4811 |
|
!!!next-input-character; |
4812 |
|
redo A; |
4813 |
|
} else { |
4814 |
|
# |
4815 |
} |
} |
4816 |
|
|
4817 |
|
$self->{ct}->{value} .= '&'; |
4818 |
|
$self->{state} = $self->{prev_state}; |
4819 |
|
## Reconsume. |
4820 |
|
redo A; |
4821 |
|
} elsif ($self->{state} == AFTER_ELEMENT_NAME_STATE) { |
4822 |
|
if ($is_space->{$self->{nc}}) { |
4823 |
|
$self->{state} = BEFORE_ELEMENT_CONTENT_STATE; |
4824 |
|
!!!next-input-character; |
4825 |
|
redo A; |
4826 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4827 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4828 |
|
$self->{ct}->{content} = ['(']; |
4829 |
|
$self->{group_depth} = 1; |
4830 |
|
!!!next-input-character; |
4831 |
|
redo A; |
4832 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4833 |
|
!!!parse-error (type => 'no md def'); ## TODO: type |
4834 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4835 |
|
!!!next-input-character; |
4836 |
|
!!!emit ($self->{ct}); # ELEMENT |
4837 |
|
redo A; |
4838 |
|
} elsif ($self->{nc} == -1) { |
4839 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4840 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4841 |
|
!!!next-input-character; |
4842 |
|
!!!emit ($self->{ct}); # ELEMENT |
4843 |
|
redo A; |
4844 |
|
} else { |
4845 |
|
$self->{ct}->{content} = [chr $self->{nc}]; |
4846 |
|
$self->{state} = CONTENT_KEYWORD_STATE; |
4847 |
|
!!!next-input-character; |
4848 |
|
redo A; |
4849 |
|
} |
4850 |
|
} elsif ($self->{state} == CONTENT_KEYWORD_STATE) { |
4851 |
|
if ($is_space->{$self->{nc}}) { |
4852 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4853 |
|
!!!next-input-character; |
4854 |
|
redo A; |
4855 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4856 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4857 |
|
!!!next-input-character; |
4858 |
|
!!!emit ($self->{ct}); # ELEMENT |
4859 |
|
redo A; |
4860 |
|
} elsif ($self->{nc} == -1) { |
4861 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4862 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4863 |
|
!!!next-input-character; |
4864 |
|
!!!emit ($self->{ct}); # ELEMENT |
4865 |
|
redo A; |
4866 |
|
} else { |
4867 |
|
$self->{ct}->{content}->[-1] .= chr $self->{nc}; # ELEMENT |
4868 |
|
## Stay in the state. |
4869 |
|
!!!next-input-character; |
4870 |
|
redo A; |
4871 |
|
} |
4872 |
|
} elsif ($self->{state} == AFTER_CM_GROUP_OPEN_STATE) { |
4873 |
|
if ($is_space->{$self->{nc}}) { |
4874 |
|
## Stay in the state. |
4875 |
|
!!!next-input-character; |
4876 |
|
redo A; |
4877 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4878 |
|
$self->{group_depth}++; |
4879 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4880 |
|
## Stay in the state. |
4881 |
|
!!!next-input-character; |
4882 |
|
redo A; |
4883 |
|
} elsif ($self->{nc} == 0x007C or # | |
4884 |
|
$self->{nc} == 0x002C) { # , |
4885 |
|
!!!parse-error (type => 'empty element name'); ## TODO: type |
4886 |
|
## Stay in the state. |
4887 |
|
!!!next-input-character; |
4888 |
|
redo A; |
4889 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4890 |
|
!!!parse-error (type => 'empty element name'); ## TODO: type |
4891 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4892 |
|
$self->{group_depth}--; |
4893 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4894 |
|
!!!next-input-character; |
4895 |
|
redo A; |
4896 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4897 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4898 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4899 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4900 |
|
!!!next-input-character; |
4901 |
|
!!!emit ($self->{ct}); # ELEMENT |
4902 |
|
redo A; |
4903 |
|
} elsif ($self->{nc} == -1) { |
4904 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4905 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4906 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4907 |
|
!!!next-input-character; |
4908 |
|
!!!emit ($self->{ct}); # ELEMENT |
4909 |
|
redo A; |
4910 |
|
} else { |
4911 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4912 |
|
$self->{state} = CM_ELEMENT_NAME_STATE; |
4913 |
|
!!!next-input-character; |
4914 |
|
redo A; |
4915 |
|
} |
4916 |
|
} elsif ($self->{state} == CM_ELEMENT_NAME_STATE) { |
4917 |
|
if ($is_space->{$self->{nc}}) { |
4918 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
4919 |
|
!!!next-input-character; |
4920 |
|
redo A; |
4921 |
|
} elsif ($self->{nc} == 0x002A or # * |
4922 |
|
$self->{nc} == 0x002B or # + |
4923 |
|
$self->{nc} == 0x003F) { # ? |
4924 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4925 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
4926 |
|
!!!next-input-character; |
4927 |
|
redo A; |
4928 |
|
} elsif ($self->{nc} == 0x007C or # | |
4929 |
|
$self->{nc} == 0x002C) { # , |
4930 |
|
push @{$self->{ct}->{content}}, $self->{nc} == 0x007C ? ' | ' : ', '; |
4931 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4932 |
|
!!!next-input-character; |
4933 |
|
redo A; |
4934 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4935 |
|
$self->{group_depth}--; |
4936 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4937 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4938 |
|
!!!next-input-character; |
4939 |
|
redo A; |
4940 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4941 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4942 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4943 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4944 |
|
!!!next-input-character; |
4945 |
|
!!!emit ($self->{ct}); # ELEMENT |
4946 |
|
redo A; |
4947 |
|
} elsif ($self->{nc} == -1) { |
4948 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4949 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4950 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4951 |
|
!!!next-input-character; |
4952 |
|
!!!emit ($self->{ct}); # ELEMENT |
4953 |
|
redo A; |
4954 |
|
} else { |
4955 |
|
$self->{ct}->{content}->[-1] .= chr $self->{nc}; |
4956 |
|
## Stay in the state. |
4957 |
|
!!!next-input-character; |
4958 |
|
redo A; |
4959 |
|
} |
4960 |
|
} elsif ($self->{state} == AFTER_CM_ELEMENT_NAME_STATE) { |
4961 |
|
if ($is_space->{$self->{nc}}) { |
4962 |
|
## Stay in the state. |
4963 |
|
!!!next-input-character; |
4964 |
|
redo A; |
4965 |
|
} elsif ($self->{nc} == 0x007C or # | |
4966 |
|
$self->{nc} == 0x002C) { # , |
4967 |
|
push @{$self->{ct}->{content}}, $self->{nc} == 0x007C ? ' | ' : ', '; |
4968 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4969 |
|
!!!next-input-character; |
4970 |
|
redo A; |
4971 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4972 |
|
$self->{group_depth}--; |
4973 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4974 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4975 |
|
!!!next-input-character; |
4976 |
|
redo A; |
4977 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4978 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4979 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4980 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4981 |
|
!!!next-input-character; |
4982 |
|
!!!emit ($self->{ct}); # ELEMENT |
4983 |
|
redo A; |
4984 |
|
} elsif ($self->{nc} == -1) { |
4985 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4986 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4987 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4988 |
|
!!!next-input-character; |
4989 |
|
!!!emit ($self->{ct}); # ELEMENT |
4990 |
|
redo A; |
4991 |
|
} else { |
4992 |
|
!!!parse-error (type => 'after element name'); ## TODO: type |
4993 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4994 |
|
$self->{state} = BOGUS_MD_STATE; |
4995 |
|
!!!next-input-character; |
4996 |
|
redo A; |
4997 |
|
} |
4998 |
|
} elsif ($self->{state} == AFTER_CM_GROUP_CLOSE_STATE) { |
4999 |
|
if ($is_space->{$self->{nc}}) { |
5000 |
|
if ($self->{group_depth}) { |
5001 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5002 |
|
} else { |
5003 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
5004 |
|
} |
5005 |
|
!!!next-input-character; |
5006 |
|
redo A; |
5007 |
|
} elsif ($self->{nc} == 0x002A or # * |
5008 |
|
$self->{nc} == 0x002B or # + |
5009 |
|
$self->{nc} == 0x003F) { # ? |
5010 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5011 |
|
if ($self->{group_depth}) { |
5012 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5013 |
|
} else { |
5014 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
5015 |
|
} |
5016 |
|
!!!next-input-character; |
5017 |
|
redo A; |
5018 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
5019 |
|
if ($self->{group_depth}) { |
5020 |
|
$self->{group_depth}--; |
5021 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5022 |
|
## Stay in the state. |
5023 |
|
!!!next-input-character; |
5024 |
|
redo A; |
5025 |
|
} else { |
5026 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5027 |
|
$self->{state} = BOGUS_MD_STATE; |
5028 |
|
## Reconsume. |
5029 |
|
redo A; |
5030 |
|
} |
5031 |
|
} elsif ($self->{nc} == 0x003E) { # > |
5032 |
|
if ($self->{group_depth}) { |
5033 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
5034 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5035 |
|
} |
5036 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5037 |
|
!!!next-input-character; |
5038 |
|
!!!emit ($self->{ct}); # ELEMENT |
5039 |
|
redo A; |
5040 |
|
} elsif ($self->{nc} == -1) { |
5041 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5042 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5043 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5044 |
|
!!!next-input-character; |
5045 |
|
!!!emit ($self->{ct}); # ELEMENT |
5046 |
|
redo A; |
5047 |
|
} else { |
5048 |
|
if ($self->{group_depth}) { |
5049 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5050 |
|
} else { |
5051 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5052 |
|
$self->{state} = BOGUS_MD_STATE; |
5053 |
|
} |
5054 |
|
## Reconsume. |
5055 |
|
redo A; |
5056 |
|
} |
5057 |
|
} elsif ($self->{state} == AFTER_MD_DEF_STATE) { |
5058 |
|
if ($is_space->{$self->{nc}}) { |
5059 |
|
## Stay in the state. |
5060 |
|
!!!next-input-character; |
5061 |
|
redo A; |
5062 |
|
} elsif ($self->{nc} == 0x003E) { # > |
5063 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5064 |
|
!!!next-input-character; |
5065 |
|
!!!emit ($self->{ct}); # ENTITY/ELEMENT |
5066 |
|
redo A; |
5067 |
|
} elsif ($self->{nc} == -1) { |
5068 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5069 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5070 |
|
!!!next-input-character; |
5071 |
|
!!!emit ($self->{ct}); # ENTITY/ELEMENT |
5072 |
|
redo A; |
5073 |
|
} else { |
5074 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5075 |
|
$self->{state} = BOGUS_MD_STATE; |
5076 |
|
## Reconsume. |
5077 |
|
redo A; |
5078 |
|
} |
5079 |
|
} elsif ($self->{state} == BOGUS_MD_STATE) { |
5080 |
|
if ($self->{nc} == 0x003E) { # > |
5081 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5082 |
|
!!!next-input-character; |
5083 |
|
!!!emit ($self->{ct}); # ATTLIST/ENTITY/NOTATION |
5084 |
|
redo A; |
5085 |
|
} elsif ($self->{nc} == -1) { |
5086 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5087 |
|
## Reconsume. |
5088 |
|
!!!emit ($self->{ct}); # ATTLIST/ENTITY/NOTATION |
5089 |
|
redo A; |
5090 |
|
} else { |
5091 |
|
## Stay in the state. |
5092 |
|
!!!next-input-character; |
5093 |
|
redo A; |
5094 |
|
} |
5095 |
} else { |
} else { |
5096 |
die "$0: $self->{state}: Unknown state"; |
die "$0: $self->{state}: Unknown state"; |
5097 |
} |
} |
5102 |
|
|
5103 |
1; |
1; |
5104 |
## $Date$ |
## $Date$ |
5105 |
|
|