177 |
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_STATE () { 82 } |
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_STATE () { 82 } |
178 |
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_AFTER_STATE () { 83 } |
sub DOCTYPE_ATTLIST_ATTRIBUTE_DECLARATION_AFTER_STATE () { 83 } |
179 |
sub AFTER_ATTLIST_ATTR_VALUE_QUOTED_STATE () { 84 } |
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) |
1270 |
|
|
1271 |
redo A; |
redo A; |
1272 |
} else { |
} else { |
1273 |
if ($self->{nc} == 0x003D) { # = |
if ($self->{nc} == 0x003D or $self->{nc} == 0x003C) { # =, < |
1274 |
!!!cp (93); |
!!!cp (93); |
1275 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1276 |
!!!parse-error (type => 'bad attribute value'); |
!!!parse-error (type => 'bad attribute value'); |
1316 |
$self->{state} = ENTITY_STATE; |
$self->{state} = ENTITY_STATE; |
1317 |
!!!next-input-character; |
!!!next-input-character; |
1318 |
redo A; |
redo A; |
1319 |
|
} elsif ($self->{is_xml} and |
1320 |
|
$is_space->{$self->{nc}}) { |
1321 |
|
!!!cp (97.1); |
1322 |
|
$self->{ca}->{value} .= ' '; |
1323 |
|
## Stay in the state. |
1324 |
|
!!!next-input-character; |
1325 |
|
redo A; |
1326 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
1327 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1328 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1370 |
} |
} |
1371 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1372 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1373 |
q["&<], |
qq["&<\x09\x0C\x20], |
1374 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1375 |
|
|
1376 |
## Stay in the state |
## Stay in the state |
1407 |
$self->{state} = ENTITY_STATE; |
$self->{state} = ENTITY_STATE; |
1408 |
!!!next-input-character; |
!!!next-input-character; |
1409 |
redo A; |
redo A; |
1410 |
|
} elsif ($self->{is_xml} and |
1411 |
|
$is_space->{$self->{nc}}) { |
1412 |
|
!!!cp (103.1); |
1413 |
|
$self->{ca}->{value} .= ' '; |
1414 |
|
## Stay in the state. |
1415 |
|
!!!next-input-character; |
1416 |
|
redo A; |
1417 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
1418 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1419 |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
if ($self->{ct}->{type} == START_TAG_TOKEN) { |
1461 |
} |
} |
1462 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1463 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1464 |
q['&<], |
qq['&<\x09\x0C\x20], |
1465 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1466 |
|
|
1467 |
## Stay in the state |
## Stay in the state |
1573 |
0x0022 => 1, # " |
0x0022 => 1, # " |
1574 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
1575 |
0x003D => 1, # = |
0x003D => 1, # = |
1576 |
|
0x003C => 1, # < |
1577 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
1578 |
!!!cp (115); |
!!!cp (115); |
1579 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1583 |
} |
} |
1584 |
$self->{ca}->{value} .= chr ($self->{nc}); |
$self->{ca}->{value} .= chr ($self->{nc}); |
1585 |
$self->{read_until}->($self->{ca}->{value}, |
$self->{read_until}->($self->{ca}->{value}, |
1586 |
q["'=& >], |
qq["'=& \x09\x0C>], |
1587 |
length $self->{ca}->{value}); |
length $self->{ca}->{value}); |
1588 |
|
|
1589 |
## Stay in the state |
## Stay in the state |
2119 |
redo A; |
redo A; |
2120 |
} else { |
} else { |
2121 |
!!!cp (154); |
!!!cp (154); |
|
## XML5: Not a parse error. |
|
|
!!!parse-error (type => 'dash in comment', |
|
|
line => $self->{line_prev}, |
|
|
column => $self->{column_prev}); |
|
2122 |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
2123 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
2124 |
!!!next-input-character; |
!!!next-input-character; |
2130 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
2131 |
!!!next-input-character; |
!!!next-input-character; |
2132 |
redo A; |
redo A; |
2133 |
|
} elsif ($self->{nc} == -1) { |
2134 |
|
!!!cp (155.1); |
2135 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2136 |
|
$self->{ct}->{quirks} = 1; |
2137 |
|
|
2138 |
|
$self->{state} = DATA_STATE; |
2139 |
|
## Reconsume. |
2140 |
|
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2141 |
|
|
2142 |
|
redo A; |
2143 |
} else { |
} else { |
2144 |
!!!cp (156); |
!!!cp (156); |
2145 |
## XML5: Unless EOF, swith to the bogus comment state. |
## XML5: Swith to the bogus comment state. |
2146 |
!!!parse-error (type => 'no space before DOCTYPE name'); |
!!!parse-error (type => 'no space before DOCTYPE name'); |
2147 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
2148 |
## reconsume |
## reconsume |
2167 |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2168 |
|
|
2169 |
redo A; |
redo A; |
2170 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2171 |
|
!!!cp (158.1); |
2172 |
|
$self->{ct}->{name} # DOCTYPE |
2173 |
|
= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2174 |
|
delete $self->{ct}->{quirks}; |
2175 |
|
$self->{state} = DOCTYPE_NAME_STATE; |
2176 |
|
!!!next-input-character; |
2177 |
|
redo A; |
2178 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2179 |
!!!cp (159); |
!!!cp (159); |
2180 |
!!!parse-error (type => 'no DOCTYPE name'); |
!!!parse-error (type => 'no DOCTYPE name'); |
2221 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2222 |
|
|
2223 |
redo A; |
redo A; |
2224 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2225 |
|
!!!cp (162.1); |
2226 |
|
$self->{ct}->{name} # DOCTYPE |
2227 |
|
.= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2228 |
|
delete $self->{ct}->{quirks}; |
2229 |
|
## Stay in the state. |
2230 |
|
!!!next-input-character; |
2231 |
|
redo A; |
2232 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2233 |
!!!cp (163); |
!!!cp (163); |
2234 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2250 |
redo A; |
redo A; |
2251 |
} else { |
} else { |
2252 |
!!!cp (164); |
!!!cp (164); |
2253 |
$self->{ct}->{name} |
$self->{ct}->{name} .= chr ($self->{nc}); # DOCTYPE |
2254 |
.= chr ($self->{nc}); # DOCTYPE |
## Stay in the state. |
|
## Stay in the state |
|
2255 |
!!!next-input-character; |
!!!next-input-character; |
2256 |
redo A; |
redo A; |
2257 |
} |
} |
2265 |
!!!next-input-character; |
!!!next-input-character; |
2266 |
redo A; |
redo A; |
2267 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
2268 |
!!!cp (166); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2269 |
$self->{state} = DATA_STATE; |
!!!cp (166); |
2270 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2271 |
|
$self->{s_kwd} = ''; |
2272 |
|
} else { |
2273 |
|
!!!cp (166.1); |
2274 |
|
!!!parse-error (type => 'no md def'); ## TODO: type |
2275 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2276 |
|
} |
2277 |
|
|
2278 |
!!!next-input-character; |
!!!next-input-character; |
2279 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2280 |
redo A; |
redo A; |
2281 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2282 |
!!!cp (167); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2283 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (167); |
2284 |
$self->{state} = DATA_STATE; |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2285 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2286 |
## reconsume |
$self->{s_kwd} = ''; |
2287 |
|
$self->{ct}->{quirks} = 1; |
2288 |
$self->{ct}->{quirks} = 1; |
} else { |
2289 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (167.12); |
2290 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2291 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2292 |
|
} |
2293 |
|
|
2294 |
|
## Reconsume. |
2295 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2296 |
redo A; |
redo A; |
2297 |
} elsif ($self->{nc} == 0x0050 or # P |
} elsif ($self->{nc} == 0x0050 or # P |
2298 |
$self->{nc} == 0x0070) { # p |
$self->{nc} == 0x0070) { # p |
2308 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
2309 |
!!!next-input-character; |
!!!next-input-character; |
2310 |
redo A; |
redo A; |
2311 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{nc} == 0x0022 and # " |
2312 |
|
($self->{ct}->{type} == GENERAL_ENTITY_TOKEN or |
2313 |
|
$self->{ct}->{type} == PARAMETER_ENTITY_TOKEN)) { |
2314 |
|
!!!cp (167.21); |
2315 |
|
$self->{state} = DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE; |
2316 |
|
$self->{ct}->{value} = ''; # ENTITY |
2317 |
|
!!!next-input-character; |
2318 |
|
redo A; |
2319 |
|
} elsif ($self->{nc} == 0x0027 and # ' |
2320 |
|
($self->{ct}->{type} == GENERAL_ENTITY_TOKEN or |
2321 |
|
$self->{ct}->{type} == PARAMETER_ENTITY_TOKEN)) { |
2322 |
|
!!!cp (167.22); |
2323 |
|
$self->{state} = DOCTYPE_ENTITY_VALUE_SINGLE_QUOTED_STATE; |
2324 |
|
$self->{ct}->{value} = ''; # ENTITY |
2325 |
|
!!!next-input-character; |
2326 |
|
redo A; |
2327 |
|
} elsif ($self->{is_xml} and |
2328 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2329 |
|
$self->{nc} == 0x005B) { # [ |
2330 |
!!!cp (167.3); |
!!!cp (167.3); |
2331 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2332 |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
2335 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2336 |
redo A; |
redo A; |
2337 |
} else { |
} else { |
2338 |
!!!cp (180); |
!!!parse-error (type => 'string after DOCTYPE name'); ## TODO: type |
2339 |
!!!parse-error (type => 'string after DOCTYPE name'); |
|
2340 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2341 |
|
!!!cp (180); |
2342 |
|
$self->{ct}->{quirks} = 1; |
2343 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2344 |
|
} else { |
2345 |
|
!!!cp (180.1); |
2346 |
|
$self->{state} = BOGUS_MD_STATE; |
2347 |
|
} |
2348 |
|
|
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
|
2349 |
!!!next-input-character; |
!!!next-input-character; |
2350 |
redo A; |
redo A; |
2351 |
} |
} |
2387 |
!!!next-input-character; |
!!!next-input-character; |
2388 |
redo A; |
redo A; |
2389 |
} else { |
} else { |
2390 |
!!!cp (169); |
!!!parse-error (type => 'string after DOCTYPE name', ## TODO: type |
|
!!!parse-error (type => 'string after DOCTYPE name', |
|
2391 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
2392 |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
2393 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2394 |
|
!!!cp (169); |
2395 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
$self->{ct}->{quirks} = 1; |
2396 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2397 |
|
} else { |
2398 |
|
!!!cp (169.1); |
2399 |
|
$self->{state} = BOGUS_MD_STATE; |
2400 |
|
} |
2401 |
## Reconsume. |
## Reconsume. |
2402 |
redo A; |
redo A; |
2403 |
} |
} |
2439 |
!!!next-input-character; |
!!!next-input-character; |
2440 |
redo A; |
redo A; |
2441 |
} else { |
} else { |
2442 |
!!!cp (172); |
!!!parse-error (type => 'string after DOCTYPE name', ## TODO: type |
|
!!!parse-error (type => 'string after DOCTYPE name', |
|
2443 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
2444 |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
column => $self->{column_prev} + 1 - length $self->{kwd}); |
2445 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2446 |
|
!!!cp (172); |
2447 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
$self->{ct}->{quirks} = 1; |
2448 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2449 |
|
} else { |
2450 |
|
!!!cp (172.1); |
2451 |
|
$self->{state} = BOGUS_MD_STATE; |
2452 |
|
} |
2453 |
## Reconsume. |
## Reconsume. |
2454 |
redo A; |
redo A; |
2455 |
} |
} |
2472 |
!!!next-input-character; |
!!!next-input-character; |
2473 |
redo A; |
redo A; |
2474 |
} elsif ($self->{nc} eq 0x003E) { # > |
} elsif ($self->{nc} eq 0x003E) { # > |
|
!!!cp (184); |
|
2475 |
!!!parse-error (type => 'no PUBLIC literal'); |
!!!parse-error (type => 'no PUBLIC literal'); |
2476 |
|
|
2477 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2478 |
$self->{s_kwd} = ''; |
!!!cp (184); |
2479 |
|
$self->{state} = DATA_STATE; |
2480 |
|
$self->{s_kwd} = ''; |
2481 |
|
$self->{ct}->{quirks} = 1; |
2482 |
|
} else { |
2483 |
|
!!!cp (184.1); |
2484 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2485 |
|
} |
2486 |
|
|
2487 |
!!!next-input-character; |
!!!next-input-character; |
2488 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2489 |
redo A; |
redo A; |
2490 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2491 |
!!!cp (185); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2492 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (185); |
2493 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2494 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2495 |
$self->{s_kwd} = ''; |
$self->{s_kwd} = ''; |
2496 |
|
$self->{ct}->{quirks} = 1; |
2497 |
|
} else { |
2498 |
|
!!!cp (185.1); |
2499 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2500 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2501 |
|
} |
2502 |
|
|
2503 |
## reconsume |
## reconsume |
|
|
|
|
$self->{ct}->{quirks} = 1; |
|
2504 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
2505 |
redo A; |
redo A; |
2506 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2507 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2508 |
|
$self->{nc} == 0x005B) { # [ |
2509 |
!!!cp (186.1); |
!!!cp (186.1); |
2510 |
!!!parse-error (type => 'no PUBLIC literal'); |
!!!parse-error (type => 'no PUBLIC literal'); |
2511 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2515 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2516 |
redo A; |
redo A; |
2517 |
} else { |
} else { |
|
!!!cp (186); |
|
2518 |
!!!parse-error (type => 'string after PUBLIC'); |
!!!parse-error (type => 'string after PUBLIC'); |
|
$self->{ct}->{quirks} = 1; |
|
2519 |
|
|
2520 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2521 |
|
!!!cp (186); |
2522 |
|
$self->{ct}->{quirks} = 1; |
2523 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2524 |
|
} else { |
2525 |
|
!!!cp (186.2); |
2526 |
|
$self->{state} = BOGUS_MD_STATE; |
2527 |
|
} |
2528 |
|
|
2529 |
!!!next-input-character; |
!!!next-input-character; |
2530 |
redo A; |
redo A; |
2531 |
} |
} |
2536 |
!!!next-input-character; |
!!!next-input-character; |
2537 |
redo A; |
redo A; |
2538 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
|
!!!cp (188); |
|
2539 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2540 |
|
|
2541 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2542 |
$self->{s_kwd} = ''; |
!!!cp (188); |
2543 |
!!!next-input-character; |
$self->{state} = DATA_STATE; |
2544 |
|
$self->{s_kwd} = ''; |
2545 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2546 |
!!!emit ($self->{ct}); # DOCTYPE |
} else { |
2547 |
|
!!!cp (188.1); |
2548 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2549 |
|
} |
2550 |
|
|
2551 |
|
!!!next-input-character; |
2552 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2553 |
redo A; |
redo A; |
2554 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (189); |
|
2555 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2556 |
|
|
2557 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2558 |
$self->{s_kwd} = ''; |
!!!cp (189); |
2559 |
## reconsume |
$self->{state} = DATA_STATE; |
2560 |
|
$self->{s_kwd} = ''; |
2561 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2562 |
|
} else { |
2563 |
|
!!!cp (189.1); |
2564 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2565 |
|
} |
2566 |
|
|
2567 |
|
## Reconsume. |
2568 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
2569 |
redo A; |
redo A; |
2570 |
} else { |
} else { |
2571 |
!!!cp (190); |
!!!cp (190); |
2572 |
$self->{ct}->{pubid} # DOCTYPE |
$self->{ct}->{pubid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2573 |
$self->{read_until}->($self->{ct}->{pubid}, q[">], |
$self->{read_until}->($self->{ct}->{pubid}, q[">], |
2574 |
length $self->{ct}->{pubid}); |
length $self->{ct}->{pubid}); |
2575 |
|
|
2584 |
!!!next-input-character; |
!!!next-input-character; |
2585 |
redo A; |
redo A; |
2586 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
|
!!!cp (192); |
|
2587 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2588 |
|
|
2589 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2590 |
$self->{s_kwd} = ''; |
!!!cp (192); |
2591 |
!!!next-input-character; |
$self->{state} = DATA_STATE; |
2592 |
|
$self->{s_kwd} = ''; |
2593 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2594 |
!!!emit ($self->{ct}); # DOCTYPE |
} else { |
2595 |
|
!!!cp (192.1); |
2596 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2597 |
|
} |
2598 |
|
|
2599 |
|
!!!next-input-character; |
2600 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2601 |
redo A; |
redo A; |
2602 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (193); |
|
2603 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2604 |
|
|
2605 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2606 |
$self->{s_kwd} = ''; |
!!!cp (193); |
2607 |
|
$self->{state} = DATA_STATE; |
2608 |
|
$self->{s_kwd} = ''; |
2609 |
|
$self->{ct}->{quirks} = 1; |
2610 |
|
} else { |
2611 |
|
!!!cp (193.1); |
2612 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2613 |
|
} |
2614 |
|
|
2615 |
## reconsume |
## reconsume |
2616 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2617 |
redo A; |
redo A; |
2618 |
} else { |
} else { |
2619 |
!!!cp (194); |
!!!cp (194); |
2620 |
$self->{ct}->{pubid} # DOCTYPE |
$self->{ct}->{pubid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2621 |
$self->{read_until}->($self->{ct}->{pubid}, q['>], |
$self->{read_until}->($self->{ct}->{pubid}, q['>], |
2622 |
length $self->{ct}->{pubid}); |
length $self->{ct}->{pubid}); |
2623 |
|
|
2633 |
redo A; |
redo A; |
2634 |
} elsif ($self->{nc} == 0x0022) { # " |
} elsif ($self->{nc} == 0x0022) { # " |
2635 |
!!!cp (196); |
!!!cp (196); |
2636 |
$self->{ct}->{sysid} = ''; # DOCTYPE |
$self->{ct}->{sysid} = ''; # DOCTYPE/ENTITY/NOTATION |
2637 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
2638 |
!!!next-input-character; |
!!!next-input-character; |
2639 |
redo A; |
redo A; |
2640 |
} elsif ($self->{nc} == 0x0027) { # ' |
} elsif ($self->{nc} == 0x0027) { # ' |
2641 |
!!!cp (197); |
!!!cp (197); |
2642 |
$self->{ct}->{sysid} = ''; # DOCTYPE |
$self->{ct}->{sysid} = ''; # DOCTYPE/ENTITY/NOTATION |
2643 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
2644 |
!!!next-input-character; |
!!!next-input-character; |
2645 |
redo A; |
redo A; |
2646 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
2647 |
if ($self->{is_xml}) { |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2648 |
!!!cp (198.1); |
if ($self->{is_xml}) { |
2649 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!cp (198.1); |
2650 |
|
!!!parse-error (type => 'no SYSTEM literal'); |
2651 |
|
} else { |
2652 |
|
!!!cp (198); |
2653 |
|
} |
2654 |
|
$self->{state} = DATA_STATE; |
2655 |
|
$self->{s_kwd} = ''; |
2656 |
} else { |
} else { |
2657 |
!!!cp (198); |
if ($self->{ct}->{type} == NOTATION_TOKEN) { |
2658 |
|
!!!cp (198.2); |
2659 |
|
} else { |
2660 |
|
!!!cp (198.3); |
2661 |
|
!!!parse-error (type => 'no SYSTEM literal'); |
2662 |
|
} |
2663 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2664 |
} |
} |
2665 |
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
2666 |
!!!next-input-character; |
!!!next-input-character; |
2667 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2668 |
redo A; |
redo A; |
2669 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2670 |
!!!cp (199); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2671 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (199); |
2672 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2673 |
$self->{state} = DATA_STATE; |
|
2674 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2675 |
|
$self->{s_kwd} = ''; |
2676 |
|
$self->{ct}->{quirks} = 1; |
2677 |
|
} else { |
2678 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2679 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2680 |
|
} |
2681 |
|
|
2682 |
## reconsume |
## reconsume |
2683 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2684 |
redo A; |
redo A; |
2685 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2686 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2687 |
|
$self->{nc} == 0x005B) { # [ |
2688 |
!!!cp (200.1); |
!!!cp (200.1); |
2689 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
2690 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2694 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2695 |
redo A; |
redo A; |
2696 |
} else { |
} else { |
|
!!!cp (200); |
|
2697 |
!!!parse-error (type => 'string after PUBLIC literal'); |
!!!parse-error (type => 'string after PUBLIC literal'); |
|
$self->{ct}->{quirks} = 1; |
|
2698 |
|
|
2699 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2700 |
|
!!!cp (200); |
2701 |
|
$self->{ct}->{quirks} = 1; |
2702 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2703 |
|
} else { |
2704 |
|
!!!cp (200.2); |
2705 |
|
$self->{state} = BOGUS_MD_STATE; |
2706 |
|
} |
2707 |
|
|
2708 |
!!!next-input-character; |
!!!next-input-character; |
2709 |
redo A; |
redo A; |
2710 |
} |
} |
2727 |
!!!next-input-character; |
!!!next-input-character; |
2728 |
redo A; |
redo A; |
2729 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
|
!!!cp (204); |
|
2730 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
|
$self->{state} = DATA_STATE; |
|
|
$self->{s_kwd} = ''; |
|
2731 |
!!!next-input-character; |
!!!next-input-character; |
2732 |
|
|
2733 |
$self->{ct}->{quirks} = 1; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2734 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (204); |
2735 |
|
$self->{state} = DATA_STATE; |
2736 |
|
$self->{s_kwd} = ''; |
2737 |
|
$self->{ct}->{quirks} = 1; |
2738 |
|
} else { |
2739 |
|
!!!cp (204.1); |
2740 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2741 |
|
} |
2742 |
|
|
2743 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2744 |
redo A; |
redo A; |
2745 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2746 |
!!!cp (205); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2747 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (205); |
2748 |
|
!!!parse-error (type => 'unclosed DOCTYPE'); |
2749 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2750 |
$self->{s_kwd} = ''; |
$self->{s_kwd} = ''; |
2751 |
|
$self->{ct}->{quirks} = 1; |
2752 |
|
} else { |
2753 |
|
!!!cp (205.1); |
2754 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2755 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2756 |
|
} |
2757 |
|
|
2758 |
## reconsume |
## reconsume |
2759 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2760 |
redo A; |
redo A; |
2761 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2762 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2763 |
|
$self->{nc} == 0x005B) { # [ |
2764 |
!!!cp (206.1); |
!!!cp (206.1); |
2765 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
2766 |
|
|
2771 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2772 |
redo A; |
redo A; |
2773 |
} else { |
} else { |
|
!!!cp (206); |
|
2774 |
!!!parse-error (type => 'string after SYSTEM'); |
!!!parse-error (type => 'string after SYSTEM'); |
|
$self->{ct}->{quirks} = 1; |
|
2775 |
|
|
2776 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2777 |
|
!!!cp (206); |
2778 |
|
$self->{ct}->{quirks} = 1; |
2779 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2780 |
|
} else { |
2781 |
|
!!!cp (206.2); |
2782 |
|
$self->{state} = BOGUS_MD_STATE; |
2783 |
|
} |
2784 |
|
|
2785 |
!!!next-input-character; |
!!!next-input-character; |
2786 |
redo A; |
redo A; |
2787 |
} |
} |
2792 |
!!!next-input-character; |
!!!next-input-character; |
2793 |
redo A; |
redo A; |
2794 |
} elsif (not $self->{is_xml} and $self->{nc} == 0x003E) { # > |
} elsif (not $self->{is_xml} and $self->{nc} == 0x003E) { # > |
|
!!!cp (208); |
|
2795 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2796 |
|
|
2797 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2798 |
$self->{s_kwd} = ''; |
!!!cp (208); |
2799 |
|
$self->{state} = DATA_STATE; |
2800 |
|
$self->{s_kwd} = ''; |
2801 |
|
$self->{ct}->{quirks} = 1; |
2802 |
|
} else { |
2803 |
|
!!!cp (208.1); |
2804 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2805 |
|
} |
2806 |
|
|
2807 |
!!!next-input-character; |
!!!next-input-character; |
2808 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2809 |
redo A; |
redo A; |
2810 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (209); |
|
2811 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2812 |
|
|
2813 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2814 |
$self->{s_kwd} = ''; |
!!!cp (209); |
2815 |
|
$self->{state} = DATA_STATE; |
2816 |
|
$self->{s_kwd} = ''; |
2817 |
|
$self->{ct}->{quirks} = 1; |
2818 |
|
} else { |
2819 |
|
!!!cp (209.1); |
2820 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2821 |
|
} |
2822 |
|
|
2823 |
## reconsume |
## reconsume |
2824 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
|
$self->{ct}->{quirks} = 1; |
|
|
!!!emit ($self->{ct}); # DOCTYPE |
|
|
|
|
2825 |
redo A; |
redo A; |
2826 |
} else { |
} else { |
2827 |
!!!cp (210); |
!!!cp (210); |
2828 |
$self->{ct}->{sysid} # DOCTYPE |
$self->{ct}->{sysid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2829 |
$self->{read_until}->($self->{ct}->{sysid}, q[">], |
$self->{read_until}->($self->{ct}->{sysid}, q[">], |
2830 |
length $self->{ct}->{sysid}); |
length $self->{ct}->{sysid}); |
2831 |
|
|
2852 |
|
|
2853 |
redo A; |
redo A; |
2854 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
|
!!!cp (213); |
|
2855 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2856 |
|
|
2857 |
$self->{state} = DATA_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2858 |
$self->{s_kwd} = ''; |
!!!cp (213); |
2859 |
## reconsume |
$self->{state} = DATA_STATE; |
2860 |
|
$self->{s_kwd} = ''; |
2861 |
$self->{ct}->{quirks} = 1; |
$self->{ct}->{quirks} = 1; |
2862 |
!!!emit ($self->{ct}); # DOCTYPE |
} else { |
2863 |
|
!!!cp (213.1); |
2864 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2865 |
|
} |
2866 |
|
|
2867 |
|
## reconsume |
2868 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2869 |
redo A; |
redo A; |
2870 |
} else { |
} else { |
2871 |
!!!cp (214); |
!!!cp (214); |
2872 |
$self->{ct}->{sysid} # DOCTYPE |
$self->{ct}->{sysid} .= chr $self->{nc}; # DOCTYPE/ENTITY/NOTATION |
|
.= chr $self->{nc}; |
|
2873 |
$self->{read_until}->($self->{ct}->{sysid}, q['>], |
$self->{read_until}->($self->{ct}->{sysid}, q['>], |
2874 |
length $self->{ct}->{sysid}); |
length $self->{ct}->{sysid}); |
2875 |
|
|
2879 |
} |
} |
2880 |
} elsif ($self->{state} == AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE) { |
} elsif ($self->{state} == AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE) { |
2881 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
2882 |
!!!cp (215); |
if ($self->{ct}->{type} == GENERAL_ENTITY_TOKEN) { |
2883 |
## Stay in the state |
!!!cp (215.1); |
2884 |
|
$self->{state} = BEFORE_NDATA_STATE; |
2885 |
|
} else { |
2886 |
|
!!!cp (215); |
2887 |
|
## Stay in the state |
2888 |
|
} |
2889 |
!!!next-input-character; |
!!!next-input-character; |
2890 |
redo A; |
redo A; |
2891 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
2892 |
!!!cp (216); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2893 |
$self->{state} = DATA_STATE; |
!!!cp (216); |
2894 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2895 |
!!!next-input-character; |
$self->{s_kwd} = ''; |
2896 |
|
} else { |
2897 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (216.1); |
2898 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2899 |
|
} |
2900 |
|
|
2901 |
|
!!!next-input-character; |
2902 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2903 |
|
redo A; |
2904 |
|
} elsif ($self->{ct}->{type} == GENERAL_ENTITY_TOKEN and |
2905 |
|
($self->{nc} == 0x004E or # N |
2906 |
|
$self->{nc} == 0x006E)) { # n |
2907 |
|
!!!cp (216.2); |
2908 |
|
!!!parse-error (type => 'no space before NDATA'); ## TODO: type |
2909 |
|
$self->{state} = NDATA_STATE; |
2910 |
|
$self->{kwd} = chr $self->{nc}; |
2911 |
|
!!!next-input-character; |
2912 |
redo A; |
redo A; |
2913 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2914 |
!!!cp (217); |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2915 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!cp (217); |
2916 |
$self->{state} = DATA_STATE; |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2917 |
$self->{s_kwd} = ''; |
$self->{state} = DATA_STATE; |
2918 |
## reconsume |
$self->{s_kwd} = ''; |
2919 |
|
$self->{ct}->{quirks} = 1; |
2920 |
$self->{ct}->{quirks} = 1; |
} else { |
2921 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!cp (217.1); |
2922 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2923 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2924 |
|
} |
2925 |
|
|
2926 |
|
## reconsume |
2927 |
|
!!!emit ($self->{ct}); # DOCTYPE/ENTITY/NOTATION |
2928 |
redo A; |
redo A; |
2929 |
} elsif ($self->{is_xml} and $self->{nc} == 0x005B) { # [ |
} elsif ($self->{is_xml} and |
2930 |
|
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2931 |
|
$self->{nc} == 0x005B) { # [ |
2932 |
!!!cp (218.1); |
!!!cp (218.1); |
2933 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2934 |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
$self->{ct}->{has_internal_subset} = 1; # DOCTYPE |
2937 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2938 |
redo A; |
redo A; |
2939 |
} else { |
} else { |
|
!!!cp (218); |
|
2940 |
!!!parse-error (type => 'string after SYSTEM literal'); |
!!!parse-error (type => 'string after SYSTEM literal'); |
|
#$self->{ct}->{quirks} = 1; |
|
2941 |
|
|
2942 |
$self->{state} = BOGUS_DOCTYPE_STATE; |
if ($self->{ct}->{type} == DOCTYPE_TOKEN) { |
2943 |
|
!!!cp (218); |
2944 |
|
#$self->{ct}->{quirks} = 1; |
2945 |
|
$self->{state} = BOGUS_DOCTYPE_STATE; |
2946 |
|
} else { |
2947 |
|
!!!cp (218.2); |
2948 |
|
$self->{state} = BOGUS_MD_STATE; |
2949 |
|
} |
2950 |
|
|
2951 |
|
!!!next-input-character; |
2952 |
|
redo A; |
2953 |
|
} |
2954 |
|
} elsif ($self->{state} == BEFORE_NDATA_STATE) { |
2955 |
|
if ($is_space->{$self->{nc}}) { |
2956 |
|
!!!cp (218.3); |
2957 |
|
## Stay in the state. |
2958 |
|
!!!next-input-character; |
2959 |
|
redo A; |
2960 |
|
} elsif ($self->{nc} == 0x003E) { # > |
2961 |
|
!!!cp (218.4); |
2962 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2963 |
|
!!!next-input-character; |
2964 |
|
!!!emit ($self->{ct}); # ENTITY |
2965 |
|
redo A; |
2966 |
|
} elsif ($self->{nc} == 0x004E or # N |
2967 |
|
$self->{nc} == 0x006E) { # n |
2968 |
|
!!!cp (218.5); |
2969 |
|
$self->{state} = NDATA_STATE; |
2970 |
|
$self->{kwd} = chr $self->{nc}; |
2971 |
|
!!!next-input-character; |
2972 |
|
redo A; |
2973 |
|
} elsif ($self->{nc} == -1) { |
2974 |
|
!!!cp (218.6); |
2975 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
2976 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2977 |
|
## reconsume |
2978 |
|
!!!emit ($self->{ct}); # ENTITY |
2979 |
|
redo A; |
2980 |
|
} else { |
2981 |
|
!!!cp (218.7); |
2982 |
|
!!!parse-error (type => 'string after SYSTEM literal'); |
2983 |
|
$self->{state} = BOGUS_MD_STATE; |
2984 |
!!!next-input-character; |
!!!next-input-character; |
2985 |
redo A; |
redo A; |
2986 |
} |
} |
3114 |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3115 |
$self->{entity_add} => 1, |
$self->{entity_add} => 1, |
3116 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
3117 |
!!!cp (1001); |
if ($self->{is_xml}) { |
3118 |
|
!!!cp (1001.1); |
3119 |
|
!!!parse-error (type => 'bare ero', |
3120 |
|
line => $self->{line_prev}, |
3121 |
|
column => $self->{column_prev} |
3122 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
3123 |
|
} else { |
3124 |
|
!!!cp (1001); |
3125 |
|
## No error |
3126 |
|
} |
3127 |
## Don't consume |
## Don't consume |
|
## No error |
|
3128 |
## Return nothing. |
## Return nothing. |
3129 |
# |
# |
3130 |
} elsif ($self->{nc} == 0x0023) { # # |
} elsif ($self->{nc} == 0x0023) { # # |
3133 |
$self->{kwd} = '#'; |
$self->{kwd} = '#'; |
3134 |
!!!next-input-character; |
!!!next-input-character; |
3135 |
redo A; |
redo A; |
3136 |
} elsif ((0x0041 <= $self->{nc} and |
} elsif ($self->{is_xml} or |
3137 |
|
(0x0041 <= $self->{nc} and |
3138 |
$self->{nc} <= 0x005A) or # A..Z |
$self->{nc} <= 0x005A) or # A..Z |
3139 |
(0x0061 <= $self->{nc} and |
(0x0061 <= $self->{nc} and |
3140 |
$self->{nc} <= 0x007A)) { # a..z |
$self->{nc} <= 0x007A)) { # a..z |
3178 |
redo A; |
redo A; |
3179 |
} |
} |
3180 |
} elsif ($self->{state} == ENTITY_HASH_STATE) { |
} elsif ($self->{state} == ENTITY_HASH_STATE) { |
3181 |
if ($self->{nc} == 0x0078 or # x |
if ($self->{nc} == 0x0078) { # x |
|
$self->{nc} == 0x0058) { # X |
|
3182 |
!!!cp (995); |
!!!cp (995); |
3183 |
$self->{state} = HEXREF_X_STATE; |
$self->{state} = HEXREF_X_STATE; |
3184 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3185 |
!!!next-input-character; |
!!!next-input-character; |
3186 |
redo A; |
redo A; |
3187 |
|
} elsif ($self->{nc} == 0x0058) { # X |
3188 |
|
!!!cp (995.1); |
3189 |
|
if ($self->{is_xml}) { |
3190 |
|
!!!parse-error (type => 'uppercase hcro'); ## TODO: type |
3191 |
|
} |
3192 |
|
$self->{state} = HEXREF_X_STATE; |
3193 |
|
$self->{kwd} .= chr $self->{nc}; |
3194 |
|
!!!next-input-character; |
3195 |
|
redo A; |
3196 |
} elsif (0x0030 <= $self->{nc} and |
} elsif (0x0030 <= $self->{nc} and |
3197 |
$self->{nc} <= 0x0039) { # 0..9 |
$self->{nc} <= 0x0039) { # 0..9 |
3198 |
!!!cp (994); |
!!!cp (994); |
3253 |
my $code = $self->{kwd}; |
my $code = $self->{kwd}; |
3254 |
my $l = $self->{line_prev}; |
my $l = $self->{line_prev}; |
3255 |
my $c = $self->{column_prev}; |
my $c = $self->{column_prev}; |
3256 |
if ($charref_map->{$code}) { |
if ((not $self->{is_xml} and $charref_map->{$code}) or |
3257 |
|
($self->{is_xml} and 0xD800 <= $code and $code <= 0xDFFF) or |
3258 |
|
($self->{is_xml} and $code == 0x0000)) { |
3259 |
!!!cp (1015); |
!!!cp (1015); |
3260 |
!!!parse-error (type => 'invalid character reference', |
!!!parse-error (type => 'invalid character reference', |
3261 |
text => (sprintf 'U+%04X', $code), |
text => (sprintf 'U+%04X', $code), |
3368 |
my $code = $self->{kwd}; |
my $code = $self->{kwd}; |
3369 |
my $l = $self->{line_prev}; |
my $l = $self->{line_prev}; |
3370 |
my $c = $self->{column_prev}; |
my $c = $self->{column_prev}; |
3371 |
if ($charref_map->{$code}) { |
if ((not $self->{is_xml} and $charref_map->{$code}) or |
3372 |
|
($self->{is_xml} and 0xD800 <= $code and $code <= 0xDFFF) or |
3373 |
|
($self->{is_xml} and $code == 0x0000)) { |
3374 |
!!!cp (1008); |
!!!cp (1008); |
3375 |
!!!parse-error (type => 'invalid character reference', |
!!!parse-error (type => 'invalid character reference', |
3376 |
text => (sprintf 'U+%04X', $code), |
text => (sprintf 'U+%04X', $code), |
3404 |
redo A; |
redo A; |
3405 |
} |
} |
3406 |
} elsif ($self->{state} == ENTITY_NAME_STATE) { |
} elsif ($self->{state} == ENTITY_NAME_STATE) { |
3407 |
if (length $self->{kwd} < 30 and |
if ((0x0041 <= $self->{nc} and # a |
3408 |
## NOTE: Some number greater than the maximum length of entity name |
$self->{nc} <= 0x005A) or # x |
3409 |
((0x0041 <= $self->{nc} and # a |
(0x0061 <= $self->{nc} and # a |
3410 |
$self->{nc} <= 0x005A) or # x |
$self->{nc} <= 0x007A) or # z |
3411 |
(0x0061 <= $self->{nc} and # a |
(0x0030 <= $self->{nc} and # 0 |
3412 |
$self->{nc} <= 0x007A) or # z |
$self->{nc} <= 0x0039) or # 9 |
3413 |
(0x0030 <= $self->{nc} and # 0 |
$self->{nc} == 0x003B or # ; |
3414 |
$self->{nc} <= 0x0039) or # 9 |
($self->{is_xml} and |
3415 |
$self->{nc} == 0x003B)) { # ; |
not ($is_space->{$self->{nc}} or |
3416 |
|
{ |
3417 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
3418 |
|
$self->{entity_add} => 1, |
3419 |
|
}->{$self->{nc}}))) { |
3420 |
our $EntityChar; |
our $EntityChar; |
3421 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3422 |
if (defined $EntityChar->{$self->{kwd}}) { |
if (defined $EntityChar->{$self->{kwd}} or |
3423 |
|
$self->{ge}->{$self->{kwd}}) { |
3424 |
if ($self->{nc} == 0x003B) { # ; |
if ($self->{nc} == 0x003B) { # ; |
3425 |
!!!cp (1020); |
if (defined $self->{ge}->{$self->{kwd}}) { |
3426 |
$self->{entity__value} = $EntityChar->{$self->{kwd}}; |
if ($self->{ge}->{$self->{kwd}}->{only_text}) { |
3427 |
|
!!!cp (1020.1); |
3428 |
|
$self->{entity__value} = $self->{ge}->{$self->{kwd}}->{value}; |
3429 |
|
} else { |
3430 |
|
if (defined $self->{ge}->{$self->{kwd}}->{notation}) { |
3431 |
|
!!!cp (1020.2); |
3432 |
|
!!!parse-error (type => 'unparsed entity', ## TODO: type |
3433 |
|
value => $self->{kwd}); |
3434 |
|
} else { |
3435 |
|
!!!cp (1020.3); |
3436 |
|
} |
3437 |
|
$self->{entity__value} = '&' . $self->{kwd}; ## TODO: expand |
3438 |
|
} |
3439 |
|
} else { |
3440 |
|
if ($self->{is_xml}) { |
3441 |
|
!!!cp (1020.4); |
3442 |
|
!!!parse-error (type => 'entity not declared', ## TODO: type |
3443 |
|
value => $self->{kwd}, |
3444 |
|
level => { |
3445 |
|
'amp;' => $self->{level}->{warn}, |
3446 |
|
'quot;' => $self->{level}->{warn}, |
3447 |
|
'lt;' => $self->{level}->{warn}, |
3448 |
|
'gt;' => $self->{level}->{warn}, |
3449 |
|
'apos;' => $self->{level}->{warn}, |
3450 |
|
}->{$self->{kwd}} || |
3451 |
|
$self->{level}->{must}); |
3452 |
|
} else { |
3453 |
|
!!!cp (1020); |
3454 |
|
} |
3455 |
|
$self->{entity__value} = $EntityChar->{$self->{kwd}}; |
3456 |
|
} |
3457 |
$self->{entity__match} = 1; |
$self->{entity__match} = 1; |
3458 |
!!!next-input-character; |
!!!next-input-character; |
3459 |
# |
# |
3699 |
## XML5: Not defined yet. |
## XML5: Not defined yet. |
3700 |
|
|
3701 |
## TODO: |
## TODO: |
3702 |
|
|
3703 |
|
if (not $self->{stop_processing} and |
3704 |
|
not $self->{document}->xml_standalone) { |
3705 |
|
!!!parse-error (type => 'stop processing', ## TODO: type |
3706 |
|
level => $self->{level}->{info}); |
3707 |
|
$self->{stop_processing} = 1; |
3708 |
|
} |
3709 |
|
|
3710 |
!!!next-input-character; |
!!!next-input-character; |
3711 |
redo A; |
redo A; |
3712 |
} elsif ($self->{nc} == 0x005D) { # ] |
} elsif ($self->{nc} == 0x005D) { # ] |
3809 |
$self->{state} = MD_HYPHEN_STATE; |
$self->{state} = MD_HYPHEN_STATE; |
3810 |
!!!next-input-character; |
!!!next-input-character; |
3811 |
redo A; |
redo A; |
3812 |
} elsif ($self->{nc} == 0x0045) { # E |
} elsif ($self->{nc} == 0x0045 or # E |
3813 |
|
$self->{nc} == 0x0065) { # e |
3814 |
$self->{state} = MD_E_STATE; |
$self->{state} = MD_E_STATE; |
3815 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3816 |
!!!next-input-character; |
!!!next-input-character; |
3817 |
redo A; |
redo A; |
3818 |
} elsif ($self->{nc} == 0x0041) { # A |
} elsif ($self->{nc} == 0x0041 or # A |
3819 |
|
$self->{nc} == 0x0061) { # a |
3820 |
$self->{state} = MD_ATTLIST_STATE; |
$self->{state} = MD_ATTLIST_STATE; |
3821 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3822 |
!!!next-input-character; |
!!!next-input-character; |
3823 |
redo A; |
redo A; |
3824 |
} elsif ($self->{nc} == 0x004E) { # N |
} elsif ($self->{nc} == 0x004E or # N |
3825 |
|
$self->{nc} == 0x006E) { # n |
3826 |
$self->{state} = MD_NOTATION_STATE; |
$self->{state} = MD_NOTATION_STATE; |
3827 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3828 |
!!!next-input-character; |
!!!next-input-character; |
3840 |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded. |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded. |
3841 |
redo A; |
redo A; |
3842 |
} elsif ($self->{state} == MD_E_STATE) { |
} elsif ($self->{state} == MD_E_STATE) { |
3843 |
if ($self->{nc} == 0x004E) { # N |
if ($self->{nc} == 0x004E or # N |
3844 |
|
$self->{nc} == 0x006E) { # n |
3845 |
$self->{state} = MD_ENTITY_STATE; |
$self->{state} = MD_ENTITY_STATE; |
3846 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3847 |
!!!next-input-character; |
!!!next-input-character; |
3848 |
redo A; |
redo A; |
3849 |
} elsif ($self->{nc} == 0x004C) { # L |
} elsif ($self->{nc} == 0x004C or # L |
3850 |
|
$self->{nc} == 0x006C) { # l |
3851 |
## XML5: <!ELEMENT> not supported. |
## XML5: <!ELEMENT> not supported. |
3852 |
$self->{state} = MD_ELEMENT_STATE; |
$self->{state} = MD_ELEMENT_STATE; |
3853 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3865 |
redo A; |
redo A; |
3866 |
} |
} |
3867 |
} elsif ($self->{state} == MD_ENTITY_STATE) { |
} elsif ($self->{state} == MD_ENTITY_STATE) { |
3868 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3869 |
'EN' => 0x0054, # T |
undef, |
3870 |
'ENT' => 0x0049, # I |
undef, |
3871 |
'ENTI' => 0x0054, # T |
0x0054, # T |
3872 |
}->{$self->{kwd}}) { |
0x0049, # I |
3873 |
|
0x0054, # T |
3874 |
|
]->[length $self->{kwd}] or |
3875 |
|
$self->{nc} == [ |
3876 |
|
undef, |
3877 |
|
undef, |
3878 |
|
0x0074, # t |
3879 |
|
0x0069, # i |
3880 |
|
0x0074, # t |
3881 |
|
]->[length $self->{kwd}]) { |
3882 |
## Stay in the state. |
## Stay in the state. |
3883 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3884 |
!!!next-input-character; |
!!!next-input-character; |
3885 |
redo A; |
redo A; |
3886 |
} elsif ($self->{kwd} eq 'ENTIT' and |
} elsif ((length $self->{kwd}) == 5 and |
3887 |
$self->{nc} == 0x0059) { # Y |
($self->{nc} == 0x0059 or # Y |
3888 |
$self->{ct} = {type => GENERAL_ENTITY_TOKEN, name => '', text => '', |
$self->{nc} == 0x0079)) { # y |
3889 |
|
if ($self->{kwd} ne 'ENTIT' or $self->{nc} == 0x0079) { |
3890 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3891 |
|
text => 'ENTITY', |
3892 |
|
line => $self->{line_prev}, |
3893 |
|
column => $self->{column_prev} - 4); |
3894 |
|
} |
3895 |
|
$self->{ct} = {type => GENERAL_ENTITY_TOKEN, name => '', |
3896 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3897 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 6}; |
3898 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3910 |
redo A; |
redo A; |
3911 |
} |
} |
3912 |
} elsif ($self->{state} == MD_ELEMENT_STATE) { |
} elsif ($self->{state} == MD_ELEMENT_STATE) { |
3913 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3914 |
'EL' => 0x0045, # E |
undef, |
3915 |
'ELE' => 0x004D, # M |
undef, |
3916 |
'ELEM' => 0x0045, # E |
0x0045, # E |
3917 |
'ELEME' => 0x004E, # N |
0x004D, # M |
3918 |
}->{$self->{kwd}}) { |
0x0045, # E |
3919 |
|
0x004E, # N |
3920 |
|
]->[length $self->{kwd}] or |
3921 |
|
$self->{nc} == [ |
3922 |
|
undef, |
3923 |
|
undef, |
3924 |
|
0x0065, # e |
3925 |
|
0x006D, # m |
3926 |
|
0x0065, # e |
3927 |
|
0x006E, # n |
3928 |
|
]->[length $self->{kwd}]) { |
3929 |
## Stay in the state. |
## Stay in the state. |
3930 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3931 |
!!!next-input-character; |
!!!next-input-character; |
3932 |
redo A; |
redo A; |
3933 |
} elsif ($self->{kwd} eq 'ELEMEN' and |
} elsif ((length $self->{kwd}) == 6 and |
3934 |
$self->{nc} == 0x0054) { # T |
($self->{nc} == 0x0054 or # T |
3935 |
|
$self->{nc} == 0x0074)) { # t |
3936 |
|
if ($self->{kwd} ne 'ELEMEN' or $self->{nc} == 0x0074) { |
3937 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3938 |
|
text => 'ELEMENT', |
3939 |
|
line => $self->{line_prev}, |
3940 |
|
column => $self->{column_prev} - 5); |
3941 |
|
} |
3942 |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
3943 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3944 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3945 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3946 |
!!!next-input-character; |
!!!next-input-character; |
3947 |
redo A; |
redo A; |
3957 |
redo A; |
redo A; |
3958 |
} |
} |
3959 |
} elsif ($self->{state} == MD_ATTLIST_STATE) { |
} elsif ($self->{state} == MD_ATTLIST_STATE) { |
3960 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3961 |
'A' => 0x0054, # T |
undef, |
3962 |
'AT' => 0x0054, # T |
0x0054, # T |
3963 |
'ATT' => 0x004C, # L |
0x0054, # T |
3964 |
'ATTL' => 0x0049, # I |
0x004C, # L |
3965 |
'ATTLI' => 0x0053, # S |
0x0049, # I |
3966 |
}->{$self->{kwd}}) { |
0x0053, # S |
3967 |
|
]->[length $self->{kwd}] or |
3968 |
|
$self->{nc} == [ |
3969 |
|
undef, |
3970 |
|
0x0074, # t |
3971 |
|
0x0074, # t |
3972 |
|
0x006C, # l |
3973 |
|
0x0069, # i |
3974 |
|
0x0073, # s |
3975 |
|
]->[length $self->{kwd}]) { |
3976 |
## Stay in the state. |
## Stay in the state. |
3977 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3978 |
!!!next-input-character; |
!!!next-input-character; |
3979 |
redo A; |
redo A; |
3980 |
} elsif ($self->{kwd} eq 'ATTLIS' and |
} elsif ((length $self->{kwd}) == 6 and |
3981 |
$self->{nc} == 0x0054) { # T |
($self->{nc} == 0x0054 or # T |
3982 |
|
$self->{nc} == 0x0074)) { # t |
3983 |
|
if ($self->{kwd} ne 'ATTLIS' or $self->{nc} == 0x0074) { |
3984 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3985 |
|
text => 'ATTLIST', |
3986 |
|
line => $self->{line_prev}, |
3987 |
|
column => $self->{column_prev} - 5); |
3988 |
|
} |
3989 |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
3990 |
attrdefs => [], |
attrdefs => [], |
3991 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3992 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3993 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3994 |
!!!next-input-character; |
!!!next-input-character; |
3995 |
redo A; |
redo A; |
4005 |
redo A; |
redo A; |
4006 |
} |
} |
4007 |
} elsif ($self->{state} == MD_NOTATION_STATE) { |
} elsif ($self->{state} == MD_NOTATION_STATE) { |
4008 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
4009 |
'N' => 0x004F, # O |
undef, |
4010 |
'NO' => 0x0054, # T |
0x004F, # O |
4011 |
'NOT' => 0x0041, # A |
0x0054, # T |
4012 |
'NOTA' => 0x0054, # T |
0x0041, # A |
4013 |
'NOTAT' => 0x0049, # I |
0x0054, # T |
4014 |
'NOTATI' => 0x004F, # O |
0x0049, # I |
4015 |
}->{$self->{kwd}}) { |
0x004F, # O |
4016 |
|
]->[length $self->{kwd}] or |
4017 |
|
$self->{nc} == [ |
4018 |
|
undef, |
4019 |
|
0x006F, # o |
4020 |
|
0x0074, # t |
4021 |
|
0x0061, # a |
4022 |
|
0x0074, # t |
4023 |
|
0x0069, # i |
4024 |
|
0x006F, # o |
4025 |
|
]->[length $self->{kwd}]) { |
4026 |
## Stay in the state. |
## Stay in the state. |
4027 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
4028 |
!!!next-input-character; |
!!!next-input-character; |
4029 |
redo A; |
redo A; |
4030 |
} elsif ($self->{kwd} eq 'NOTATIO' and |
} elsif ((length $self->{kwd}) == 7 and |
4031 |
$self->{nc} == 0x004E) { # N |
($self->{nc} == 0x004E or # N |
4032 |
|
$self->{nc} == 0x006E)) { # n |
4033 |
|
if ($self->{kwd} ne 'NOTATIO' or $self->{nc} == 0x006E) { |
4034 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
4035 |
|
text => 'NOTATION', |
4036 |
|
line => $self->{line_prev}, |
4037 |
|
column => $self->{column_prev} - 6); |
4038 |
|
} |
4039 |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
4040 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
4041 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 8}; |
4042 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
4043 |
!!!next-input-character; |
!!!next-input-character; |
4044 |
redo A; |
redo A; |
4147 |
## XML5: "DOCTYPE ENTITY name state" and "DOCTYPE ATTLIST name state". |
## XML5: "DOCTYPE ENTITY name state" and "DOCTYPE ATTLIST name state". |
4148 |
|
|
4149 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
4150 |
## TODO: |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
4151 |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4152 |
|
} elsif ($self->{ct}->{type} == ELEMENT_TOKEN) { |
4153 |
|
$self->{state} = AFTER_ELEMENT_NAME_STATE; |
4154 |
|
} else { # ENTITY/NOTATION |
4155 |
|
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
4156 |
|
} |
4157 |
!!!next-input-character; |
!!!next-input-character; |
4158 |
redo A; |
redo A; |
4159 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
4160 |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
4161 |
# |
# |
4162 |
} else { |
} else { |
4163 |
!!!parse-error (type => 'no md body'); ## TODO: type |
!!!parse-error (type => 'no md def'); ## TODO: type |
4164 |
} |
} |
4165 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4166 |
!!!next-input-character; |
!!!next-input-character; |
4550 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
4551 |
## XML5: No parse error. |
## XML5: No parse error. |
4552 |
!!!parse-error (type => 'no default type'); ## TODO: type |
!!!parse-error (type => 'no default type'); ## TODO: type |
4553 |
$self->{state} = BOGUS_COMMENT_STATE; |
$self->{state} = BOGUS_MD_STATE; |
|
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded |
|
4554 |
## Reconsume. |
## Reconsume. |
4555 |
redo A; |
redo A; |
4556 |
} elsif ($self->{nc} == 0x0022) { # " |
} elsif ($self->{nc} == 0x0022) { # " |
4677 |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4678 |
## Reconsume. |
## Reconsume. |
4679 |
redo A; |
redo A; |
4680 |
} |
} |
4681 |
|
} elsif ($self->{state} == NDATA_STATE) { |
4682 |
|
## ASCII case-insensitive |
4683 |
|
if ($self->{nc} == [ |
4684 |
|
undef, |
4685 |
|
0x0044, # D |
4686 |
|
0x0041, # A |
4687 |
|
0x0054, # T |
4688 |
|
]->[length $self->{kwd}] or |
4689 |
|
$self->{nc} == [ |
4690 |
|
undef, |
4691 |
|
0x0064, # d |
4692 |
|
0x0061, # a |
4693 |
|
0x0074, # t |
4694 |
|
]->[length $self->{kwd}]) { |
4695 |
|
!!!cp (172.2); |
4696 |
|
## Stay in the state. |
4697 |
|
$self->{kwd} .= chr $self->{nc}; |
4698 |
|
!!!next-input-character; |
4699 |
|
redo A; |
4700 |
|
} elsif ((length $self->{kwd}) == 4 and |
4701 |
|
($self->{nc} == 0x0041 or # A |
4702 |
|
$self->{nc} == 0x0061)) { # a |
4703 |
|
if ($self->{kwd} ne 'NDAT' or $self->{nc} == 0x0061) { # a |
4704 |
|
!!!cp (172.3); |
4705 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
4706 |
|
text => 'NDATA', |
4707 |
|
line => $self->{line_prev}, |
4708 |
|
column => $self->{column_prev} - 4); |
4709 |
|
} else { |
4710 |
|
!!!cp (172.4); |
4711 |
|
} |
4712 |
|
$self->{state} = AFTER_NDATA_STATE; |
4713 |
|
!!!next-input-character; |
4714 |
|
redo A; |
4715 |
|
} else { |
4716 |
|
!!!parse-error (type => 'string after literal', ## TODO: type |
4717 |
|
line => $self->{line_prev}, |
4718 |
|
column => $self->{column_prev} + 1 |
4719 |
|
- length $self->{kwd}); |
4720 |
|
!!!cp (172.5); |
4721 |
|
$self->{state} = BOGUS_MD_STATE; |
4722 |
|
## Reconsume. |
4723 |
|
redo A; |
4724 |
|
} |
4725 |
|
} elsif ($self->{state} == AFTER_NDATA_STATE) { |
4726 |
|
if ($is_space->{$self->{nc}}) { |
4727 |
|
$self->{state} = BEFORE_NOTATION_NAME_STATE; |
4728 |
|
!!!next-input-character; |
4729 |
|
redo A; |
4730 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4731 |
|
!!!parse-error (type => 'no notation name'); ## TODO: type |
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 |
|
!!!parse-error (type => 'string after literal', ## TODO: type |
4744 |
|
line => $self->{line_prev}, |
4745 |
|
column => $self->{column_prev} + 1 |
4746 |
|
- length $self->{kwd}); |
4747 |
|
$self->{state} = BOGUS_MD_STATE; |
4748 |
|
## Reconsume. |
4749 |
|
redo A; |
4750 |
|
} |
4751 |
|
} elsif ($self->{state} == BEFORE_NOTATION_NAME_STATE) { |
4752 |
|
if ($is_space->{$self->{nc}}) { |
4753 |
|
## Stay in the state. |
4754 |
|
!!!next-input-character; |
4755 |
|
redo A; |
4756 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4757 |
|
!!!parse-error (type => 'no notation name'); ## TODO: type |
4758 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4759 |
|
!!!next-input-character; |
4760 |
|
!!!emit ($self->{ct}); # ENTITY |
4761 |
|
redo A; |
4762 |
|
} elsif ($self->{nc} == -1) { |
4763 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4764 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4765 |
|
!!!next-input-character; |
4766 |
|
!!!emit ($self->{ct}); # ENTITY |
4767 |
|
redo A; |
4768 |
|
} else { |
4769 |
|
$self->{ct}->{notation} = chr $self->{nc}; # ENTITY |
4770 |
|
$self->{state} = NOTATION_NAME_STATE; |
4771 |
|
!!!next-input-character; |
4772 |
|
redo A; |
4773 |
|
} |
4774 |
|
} elsif ($self->{state} == NOTATION_NAME_STATE) { |
4775 |
|
if ($is_space->{$self->{nc}}) { |
4776 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4777 |
|
!!!next-input-character; |
4778 |
|
redo A; |
4779 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4780 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4781 |
|
!!!next-input-character; |
4782 |
|
!!!emit ($self->{ct}); # ENTITY |
4783 |
|
redo A; |
4784 |
|
} elsif ($self->{nc} == -1) { |
4785 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4786 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4787 |
|
!!!next-input-character; |
4788 |
|
!!!emit ($self->{ct}); # ENTITY |
4789 |
|
redo A; |
4790 |
|
} else { |
4791 |
|
$self->{ct}->{notation} .= chr $self->{nc}; # ENTITY |
4792 |
|
## Stay in the state. |
4793 |
|
!!!next-input-character; |
4794 |
|
redo A; |
4795 |
|
} |
4796 |
|
} elsif ($self->{state} == DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE) { |
4797 |
|
if ($self->{nc} == 0x0022) { # " |
4798 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4799 |
|
!!!next-input-character; |
4800 |
|
redo A; |
4801 |
|
} elsif ($self->{nc} == 0x0026) { # & |
4802 |
|
$self->{prev_state} = $self->{state}; |
4803 |
|
$self->{state} = ENTITY_VALUE_ENTITY_STATE; |
4804 |
|
$self->{entity_add} = 0x0022; # " |
4805 |
|
!!!next-input-character; |
4806 |
|
redo A; |
4807 |
|
## TODO: % |
4808 |
|
} elsif ($self->{nc} == -1) { |
4809 |
|
!!!parse-error (type => 'unclosed entity value'); ## TODO: type |
4810 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4811 |
|
## Reconsume. |
4812 |
|
!!!emit ($self->{ct}); # ENTITY |
4813 |
|
redo A; |
4814 |
|
} else { |
4815 |
|
$self->{ct}->{value} .= chr $self->{nc}; # ENTITY |
4816 |
|
!!!next-input-character; |
4817 |
|
redo A; |
4818 |
|
} |
4819 |
|
} elsif ($self->{state} == DOCTYPE_ENTITY_VALUE_SINGLE_QUOTED_STATE) { |
4820 |
|
if ($self->{nc} == 0x0027) { # ' |
4821 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4822 |
|
!!!next-input-character; |
4823 |
|
redo A; |
4824 |
|
} elsif ($self->{nc} == 0x0026) { # & |
4825 |
|
$self->{prev_state} = $self->{state}; |
4826 |
|
$self->{state} = ENTITY_VALUE_ENTITY_STATE; |
4827 |
|
$self->{entity_add} = 0x0027; # ' |
4828 |
|
!!!next-input-character; |
4829 |
|
redo A; |
4830 |
|
## TODO: % |
4831 |
|
} elsif ($self->{nc} == -1) { |
4832 |
|
!!!parse-error (type => 'unclosed entity value'); ## TODO: type |
4833 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4834 |
|
## Reconsume. |
4835 |
|
!!!emit ($self->{ct}); # ENTITY |
4836 |
|
redo A; |
4837 |
|
} else { |
4838 |
|
$self->{ct}->{value} .= chr $self->{nc}; # ENTITY |
4839 |
|
!!!next-input-character; |
4840 |
|
redo A; |
4841 |
|
} |
4842 |
|
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
4843 |
|
if ($is_space->{$self->{nc}} or |
4844 |
|
{ |
4845 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
4846 |
|
$self->{entity_add} => 1, |
4847 |
|
}->{$self->{nc}}) { |
4848 |
|
!!!parse-error (type => 'bare ero', |
4849 |
|
line => $self->{line_prev}, |
4850 |
|
column => $self->{column_prev} |
4851 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
4852 |
|
## Don't consume |
4853 |
|
## Return nothing. |
4854 |
|
# |
4855 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4856 |
|
$self->{ca} = $self->{ct}; |
4857 |
|
$self->{state} = ENTITY_HASH_STATE; |
4858 |
|
$self->{kwd} = '#'; |
4859 |
|
!!!next-input-character; |
4860 |
|
redo A; |
4861 |
|
} else { |
4862 |
|
# |
4863 |
|
} |
4864 |
|
|
4865 |
|
$self->{ct}->{value} .= '&'; |
4866 |
|
$self->{state} = $self->{prev_state}; |
4867 |
|
## Reconsume. |
4868 |
|
redo A; |
4869 |
|
} elsif ($self->{state} == AFTER_ELEMENT_NAME_STATE) { |
4870 |
|
if ($is_space->{$self->{nc}}) { |
4871 |
|
$self->{state} = BEFORE_ELEMENT_CONTENT_STATE; |
4872 |
|
!!!next-input-character; |
4873 |
|
redo A; |
4874 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4875 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4876 |
|
$self->{ct}->{content} = ['(']; |
4877 |
|
$self->{group_depth} = 1; |
4878 |
|
!!!next-input-character; |
4879 |
|
redo A; |
4880 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4881 |
|
!!!parse-error (type => 'no md def'); ## TODO: type |
4882 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4883 |
|
!!!next-input-character; |
4884 |
|
!!!emit ($self->{ct}); # ELEMENT |
4885 |
|
redo A; |
4886 |
|
} elsif ($self->{nc} == -1) { |
4887 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4888 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4889 |
|
!!!next-input-character; |
4890 |
|
!!!emit ($self->{ct}); # ELEMENT |
4891 |
|
redo A; |
4892 |
|
} else { |
4893 |
|
$self->{ct}->{content} = [chr $self->{nc}]; |
4894 |
|
$self->{state} = CONTENT_KEYWORD_STATE; |
4895 |
|
!!!next-input-character; |
4896 |
|
redo A; |
4897 |
|
} |
4898 |
|
} elsif ($self->{state} == CONTENT_KEYWORD_STATE) { |
4899 |
|
if ($is_space->{$self->{nc}}) { |
4900 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4901 |
|
!!!next-input-character; |
4902 |
|
redo A; |
4903 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4904 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4905 |
|
!!!next-input-character; |
4906 |
|
!!!emit ($self->{ct}); # ELEMENT |
4907 |
|
redo A; |
4908 |
|
} elsif ($self->{nc} == -1) { |
4909 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4910 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4911 |
|
!!!next-input-character; |
4912 |
|
!!!emit ($self->{ct}); # ELEMENT |
4913 |
|
redo A; |
4914 |
|
} else { |
4915 |
|
$self->{ct}->{content}->[-1] .= chr $self->{nc}; # ELEMENT |
4916 |
|
## Stay in the state. |
4917 |
|
!!!next-input-character; |
4918 |
|
redo A; |
4919 |
|
} |
4920 |
|
} elsif ($self->{state} == AFTER_CM_GROUP_OPEN_STATE) { |
4921 |
|
if ($is_space->{$self->{nc}}) { |
4922 |
|
## Stay in the state. |
4923 |
|
!!!next-input-character; |
4924 |
|
redo A; |
4925 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4926 |
|
$self->{group_depth}++; |
4927 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4928 |
|
## Stay in the state. |
4929 |
|
!!!next-input-character; |
4930 |
|
redo A; |
4931 |
|
} elsif ($self->{nc} == 0x007C or # | |
4932 |
|
$self->{nc} == 0x002C) { # , |
4933 |
|
!!!parse-error (type => 'empty element name'); ## TODO: type |
4934 |
|
## Stay in the state. |
4935 |
|
!!!next-input-character; |
4936 |
|
redo A; |
4937 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4938 |
|
!!!parse-error (type => 'empty element name'); ## TODO: type |
4939 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4940 |
|
$self->{group_depth}--; |
4941 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4942 |
|
!!!next-input-character; |
4943 |
|
redo A; |
4944 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4945 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4946 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4947 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4948 |
|
!!!next-input-character; |
4949 |
|
!!!emit ($self->{ct}); # ELEMENT |
4950 |
|
redo A; |
4951 |
|
} elsif ($self->{nc} == -1) { |
4952 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4953 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4954 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4955 |
|
!!!next-input-character; |
4956 |
|
!!!emit ($self->{ct}); # ELEMENT |
4957 |
|
redo A; |
4958 |
|
} else { |
4959 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4960 |
|
$self->{state} = CM_ELEMENT_NAME_STATE; |
4961 |
|
!!!next-input-character; |
4962 |
|
redo A; |
4963 |
|
} |
4964 |
|
} elsif ($self->{state} == CM_ELEMENT_NAME_STATE) { |
4965 |
|
if ($is_space->{$self->{nc}}) { |
4966 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
4967 |
|
!!!next-input-character; |
4968 |
|
redo A; |
4969 |
|
} elsif ($self->{nc} == 0x002A or # * |
4970 |
|
$self->{nc} == 0x002B or # + |
4971 |
|
$self->{nc} == 0x003F) { # ? |
4972 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4973 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
4974 |
|
!!!next-input-character; |
4975 |
|
redo A; |
4976 |
|
} elsif ($self->{nc} == 0x007C or # | |
4977 |
|
$self->{nc} == 0x002C) { # , |
4978 |
|
push @{$self->{ct}->{content}}, $self->{nc} == 0x007C ? ' | ' : ', '; |
4979 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4980 |
|
!!!next-input-character; |
4981 |
|
redo A; |
4982 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4983 |
|
$self->{group_depth}--; |
4984 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4985 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4986 |
|
!!!next-input-character; |
4987 |
|
redo A; |
4988 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4989 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4990 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4991 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4992 |
|
!!!next-input-character; |
4993 |
|
!!!emit ($self->{ct}); # ELEMENT |
4994 |
|
redo A; |
4995 |
|
} elsif ($self->{nc} == -1) { |
4996 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4997 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4998 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4999 |
|
!!!next-input-character; |
5000 |
|
!!!emit ($self->{ct}); # ELEMENT |
5001 |
|
redo A; |
5002 |
|
} else { |
5003 |
|
$self->{ct}->{content}->[-1] .= chr $self->{nc}; |
5004 |
|
## Stay in the state. |
5005 |
|
!!!next-input-character; |
5006 |
|
redo A; |
5007 |
|
} |
5008 |
|
} elsif ($self->{state} == AFTER_CM_ELEMENT_NAME_STATE) { |
5009 |
|
if ($is_space->{$self->{nc}}) { |
5010 |
|
## Stay in the state. |
5011 |
|
!!!next-input-character; |
5012 |
|
redo A; |
5013 |
|
} elsif ($self->{nc} == 0x007C or # | |
5014 |
|
$self->{nc} == 0x002C) { # , |
5015 |
|
push @{$self->{ct}->{content}}, $self->{nc} == 0x007C ? ' | ' : ', '; |
5016 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
5017 |
|
!!!next-input-character; |
5018 |
|
redo A; |
5019 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
5020 |
|
$self->{group_depth}--; |
5021 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5022 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
5023 |
|
!!!next-input-character; |
5024 |
|
redo A; |
5025 |
|
} elsif ($self->{nc} == 0x003E) { # > |
5026 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
5027 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5028 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5029 |
|
!!!next-input-character; |
5030 |
|
!!!emit ($self->{ct}); # ELEMENT |
5031 |
|
redo A; |
5032 |
|
} elsif ($self->{nc} == -1) { |
5033 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5034 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5035 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5036 |
|
!!!next-input-character; |
5037 |
|
!!!emit ($self->{ct}); # ELEMENT |
5038 |
|
redo A; |
5039 |
|
} else { |
5040 |
|
!!!parse-error (type => 'after element name'); ## TODO: type |
5041 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5042 |
|
$self->{state} = BOGUS_MD_STATE; |
5043 |
|
!!!next-input-character; |
5044 |
|
redo A; |
5045 |
|
} |
5046 |
|
} elsif ($self->{state} == AFTER_CM_GROUP_CLOSE_STATE) { |
5047 |
|
if ($is_space->{$self->{nc}}) { |
5048 |
|
if ($self->{group_depth}) { |
5049 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5050 |
|
} else { |
5051 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
5052 |
|
} |
5053 |
|
!!!next-input-character; |
5054 |
|
redo A; |
5055 |
|
} elsif ($self->{nc} == 0x002A or # * |
5056 |
|
$self->{nc} == 0x002B or # + |
5057 |
|
$self->{nc} == 0x003F) { # ? |
5058 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5059 |
|
if ($self->{group_depth}) { |
5060 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5061 |
|
} else { |
5062 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
5063 |
|
} |
5064 |
|
!!!next-input-character; |
5065 |
|
redo A; |
5066 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
5067 |
|
if ($self->{group_depth}) { |
5068 |
|
$self->{group_depth}--; |
5069 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5070 |
|
## Stay in the state. |
5071 |
|
!!!next-input-character; |
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->{nc} == 0x003E) { # > |
5080 |
|
if ($self->{group_depth}) { |
5081 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
5082 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5083 |
|
} |
5084 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5085 |
|
!!!next-input-character; |
5086 |
|
!!!emit ($self->{ct}); # ELEMENT |
5087 |
|
redo A; |
5088 |
|
} elsif ($self->{nc} == -1) { |
5089 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5090 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5091 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5092 |
|
!!!next-input-character; |
5093 |
|
!!!emit ($self->{ct}); # ELEMENT |
5094 |
|
redo A; |
5095 |
|
} else { |
5096 |
|
if ($self->{group_depth}) { |
5097 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5098 |
|
} else { |
5099 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5100 |
|
$self->{state} = BOGUS_MD_STATE; |
5101 |
|
} |
5102 |
|
## Reconsume. |
5103 |
|
redo A; |
5104 |
|
} |
5105 |
|
} elsif ($self->{state} == AFTER_MD_DEF_STATE) { |
5106 |
|
if ($is_space->{$self->{nc}}) { |
5107 |
|
## Stay in the state. |
5108 |
|
!!!next-input-character; |
5109 |
|
redo A; |
5110 |
|
} elsif ($self->{nc} == 0x003E) { # > |
5111 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5112 |
|
!!!next-input-character; |
5113 |
|
!!!emit ($self->{ct}); # ENTITY/ELEMENT |
5114 |
|
redo A; |
5115 |
|
} elsif ($self->{nc} == -1) { |
5116 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5117 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5118 |
|
!!!next-input-character; |
5119 |
|
!!!emit ($self->{ct}); # ENTITY/ELEMENT |
5120 |
|
redo A; |
5121 |
|
} else { |
5122 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5123 |
|
$self->{state} = BOGUS_MD_STATE; |
5124 |
|
## Reconsume. |
5125 |
|
redo A; |
5126 |
|
} |
5127 |
|
} elsif ($self->{state} == BOGUS_MD_STATE) { |
5128 |
|
if ($self->{nc} == 0x003E) { # > |
5129 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5130 |
|
!!!next-input-character; |
5131 |
|
!!!emit ($self->{ct}); # ATTLIST/ENTITY/NOTATION |
5132 |
|
redo A; |
5133 |
|
} elsif ($self->{nc} == -1) { |
5134 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5135 |
|
## Reconsume. |
5136 |
|
!!!emit ($self->{ct}); # ATTLIST/ENTITY/NOTATION |
5137 |
|
redo A; |
5138 |
|
} else { |
5139 |
|
## Stay in the state. |
5140 |
|
!!!next-input-character; |
5141 |
|
redo A; |
5142 |
|
} |
5143 |
} else { |
} else { |
5144 |
die "$0: $self->{state}: Unknown state"; |
die "$0: $self->{state}: Unknown state"; |
5145 |
} |
} |