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) |
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 |
# |
# |
3659 |
## XML5: Not defined yet. |
## XML5: Not defined yet. |
3660 |
|
|
3661 |
## TODO: |
## TODO: |
3662 |
|
|
3663 |
|
if (not $self->{stop_processing} and |
3664 |
|
not $self->{document}->xml_standalone) { |
3665 |
|
!!!parse-error (type => 'stop processing', ## TODO: type |
3666 |
|
level => $self->{level}->{info}); |
3667 |
|
$self->{stop_processing} = 1; |
3668 |
|
} |
3669 |
|
|
3670 |
!!!next-input-character; |
!!!next-input-character; |
3671 |
redo A; |
redo A; |
3672 |
} elsif ($self->{nc} == 0x005D) { # ] |
} elsif ($self->{nc} == 0x005D) { # ] |
3769 |
$self->{state} = MD_HYPHEN_STATE; |
$self->{state} = MD_HYPHEN_STATE; |
3770 |
!!!next-input-character; |
!!!next-input-character; |
3771 |
redo A; |
redo A; |
3772 |
} elsif ($self->{nc} == 0x0045) { # E |
} elsif ($self->{nc} == 0x0045 or # E |
3773 |
|
$self->{nc} == 0x0065) { # e |
3774 |
$self->{state} = MD_E_STATE; |
$self->{state} = MD_E_STATE; |
3775 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3776 |
!!!next-input-character; |
!!!next-input-character; |
3777 |
redo A; |
redo A; |
3778 |
} elsif ($self->{nc} == 0x0041) { # A |
} elsif ($self->{nc} == 0x0041 or # A |
3779 |
|
$self->{nc} == 0x0061) { # a |
3780 |
$self->{state} = MD_ATTLIST_STATE; |
$self->{state} = MD_ATTLIST_STATE; |
3781 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3782 |
!!!next-input-character; |
!!!next-input-character; |
3783 |
redo A; |
redo A; |
3784 |
} elsif ($self->{nc} == 0x004E) { # N |
} elsif ($self->{nc} == 0x004E or # N |
3785 |
|
$self->{nc} == 0x006E) { # n |
3786 |
$self->{state} = MD_NOTATION_STATE; |
$self->{state} = MD_NOTATION_STATE; |
3787 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
3788 |
!!!next-input-character; |
!!!next-input-character; |
3800 |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded. |
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded. |
3801 |
redo A; |
redo A; |
3802 |
} elsif ($self->{state} == MD_E_STATE) { |
} elsif ($self->{state} == MD_E_STATE) { |
3803 |
if ($self->{nc} == 0x004E) { # N |
if ($self->{nc} == 0x004E or # N |
3804 |
|
$self->{nc} == 0x006E) { # n |
3805 |
$self->{state} = MD_ENTITY_STATE; |
$self->{state} = MD_ENTITY_STATE; |
3806 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3807 |
!!!next-input-character; |
!!!next-input-character; |
3808 |
redo A; |
redo A; |
3809 |
} elsif ($self->{nc} == 0x004C) { # L |
} elsif ($self->{nc} == 0x004C or # L |
3810 |
|
$self->{nc} == 0x006C) { # l |
3811 |
## XML5: <!ELEMENT> not supported. |
## XML5: <!ELEMENT> not supported. |
3812 |
$self->{state} = MD_ELEMENT_STATE; |
$self->{state} = MD_ELEMENT_STATE; |
3813 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3825 |
redo A; |
redo A; |
3826 |
} |
} |
3827 |
} elsif ($self->{state} == MD_ENTITY_STATE) { |
} elsif ($self->{state} == MD_ENTITY_STATE) { |
3828 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3829 |
'EN' => 0x0054, # T |
undef, |
3830 |
'ENT' => 0x0049, # I |
undef, |
3831 |
'ENTI' => 0x0054, # T |
0x0054, # T |
3832 |
}->{$self->{kwd}}) { |
0x0049, # I |
3833 |
|
0x0054, # T |
3834 |
|
]->[length $self->{kwd}] or |
3835 |
|
$self->{nc} == [ |
3836 |
|
undef, |
3837 |
|
undef, |
3838 |
|
0x0074, # t |
3839 |
|
0x0069, # i |
3840 |
|
0x0074, # t |
3841 |
|
]->[length $self->{kwd}]) { |
3842 |
## Stay in the state. |
## Stay in the state. |
3843 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3844 |
!!!next-input-character; |
!!!next-input-character; |
3845 |
redo A; |
redo A; |
3846 |
} elsif ($self->{kwd} eq 'ENTIT' and |
} elsif ((length $self->{kwd}) == 5 and |
3847 |
$self->{nc} == 0x0059) { # Y |
($self->{nc} == 0x0059 or # Y |
3848 |
$self->{ct} = {type => GENERAL_ENTITY_TOKEN, name => '', text => '', |
$self->{nc} == 0x0079)) { # y |
3849 |
|
if ($self->{kwd} ne 'ENTIT' or $self->{nc} == 0x0079) { |
3850 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3851 |
|
text => 'ENTITY', |
3852 |
|
line => $self->{line_prev}, |
3853 |
|
column => $self->{column_prev} - 4); |
3854 |
|
} |
3855 |
|
$self->{ct} = {type => GENERAL_ENTITY_TOKEN, name => '', |
3856 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3857 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 6}; |
3858 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3870 |
redo A; |
redo A; |
3871 |
} |
} |
3872 |
} elsif ($self->{state} == MD_ELEMENT_STATE) { |
} elsif ($self->{state} == MD_ELEMENT_STATE) { |
3873 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3874 |
'EL' => 0x0045, # E |
undef, |
3875 |
'ELE' => 0x004D, # M |
undef, |
3876 |
'ELEM' => 0x0045, # E |
0x0045, # E |
3877 |
'ELEME' => 0x004E, # N |
0x004D, # M |
3878 |
}->{$self->{kwd}}) { |
0x0045, # E |
3879 |
|
0x004E, # N |
3880 |
|
]->[length $self->{kwd}] or |
3881 |
|
$self->{nc} == [ |
3882 |
|
undef, |
3883 |
|
undef, |
3884 |
|
0x0065, # e |
3885 |
|
0x006D, # m |
3886 |
|
0x0065, # e |
3887 |
|
0x006E, # n |
3888 |
|
]->[length $self->{kwd}]) { |
3889 |
## Stay in the state. |
## Stay in the state. |
3890 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3891 |
!!!next-input-character; |
!!!next-input-character; |
3892 |
redo A; |
redo A; |
3893 |
} elsif ($self->{kwd} eq 'ELEMEN' and |
} elsif ((length $self->{kwd}) == 6 and |
3894 |
$self->{nc} == 0x0054) { # T |
($self->{nc} == 0x0054 or # T |
3895 |
|
$self->{nc} == 0x0074)) { # t |
3896 |
|
if ($self->{kwd} ne 'ELEMEN' or $self->{nc} == 0x0074) { |
3897 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3898 |
|
text => 'ELEMENT', |
3899 |
|
line => $self->{line_prev}, |
3900 |
|
column => $self->{column_prev} - 5); |
3901 |
|
} |
3902 |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
$self->{ct} = {type => ELEMENT_TOKEN, name => '', |
3903 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3904 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3905 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3906 |
!!!next-input-character; |
!!!next-input-character; |
3907 |
redo A; |
redo A; |
3917 |
redo A; |
redo A; |
3918 |
} |
} |
3919 |
} elsif ($self->{state} == MD_ATTLIST_STATE) { |
} elsif ($self->{state} == MD_ATTLIST_STATE) { |
3920 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3921 |
'A' => 0x0054, # T |
undef, |
3922 |
'AT' => 0x0054, # T |
0x0054, # T |
3923 |
'ATT' => 0x004C, # L |
0x0054, # T |
3924 |
'ATTL' => 0x0049, # I |
0x004C, # L |
3925 |
'ATTLI' => 0x0053, # S |
0x0049, # I |
3926 |
}->{$self->{kwd}}) { |
0x0053, # S |
3927 |
|
]->[length $self->{kwd}] or |
3928 |
|
$self->{nc} == [ |
3929 |
|
undef, |
3930 |
|
0x0074, # t |
3931 |
|
0x0074, # t |
3932 |
|
0x006C, # l |
3933 |
|
0x0069, # i |
3934 |
|
0x0073, # s |
3935 |
|
]->[length $self->{kwd}]) { |
3936 |
## Stay in the state. |
## Stay in the state. |
3937 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3938 |
!!!next-input-character; |
!!!next-input-character; |
3939 |
redo A; |
redo A; |
3940 |
} elsif ($self->{kwd} eq 'ATTLIS' and |
} elsif ((length $self->{kwd}) == 6 and |
3941 |
$self->{nc} == 0x0054) { # T |
($self->{nc} == 0x0054 or # T |
3942 |
|
$self->{nc} == 0x0074)) { # t |
3943 |
|
if ($self->{kwd} ne 'ATTLIS' or $self->{nc} == 0x0074) { |
3944 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3945 |
|
text => 'ATTLIST', |
3946 |
|
line => $self->{line_prev}, |
3947 |
|
column => $self->{column_prev} - 5); |
3948 |
|
} |
3949 |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
$self->{ct} = {type => ATTLIST_TOKEN, name => '', |
3950 |
attrdefs => [], |
attrdefs => [], |
3951 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
3952 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 7}; |
3953 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
3954 |
!!!next-input-character; |
!!!next-input-character; |
3955 |
redo A; |
redo A; |
3965 |
redo A; |
redo A; |
3966 |
} |
} |
3967 |
} elsif ($self->{state} == MD_NOTATION_STATE) { |
} elsif ($self->{state} == MD_NOTATION_STATE) { |
3968 |
if ($self->{nc} == { |
if ($self->{nc} == [ |
3969 |
'N' => 0x004F, # O |
undef, |
3970 |
'NO' => 0x0054, # T |
0x004F, # O |
3971 |
'NOT' => 0x0041, # A |
0x0054, # T |
3972 |
'NOTA' => 0x0054, # T |
0x0041, # A |
3973 |
'NOTAT' => 0x0049, # I |
0x0054, # T |
3974 |
'NOTATI' => 0x004F, # O |
0x0049, # I |
3975 |
}->{$self->{kwd}}) { |
0x004F, # O |
3976 |
|
]->[length $self->{kwd}] or |
3977 |
|
$self->{nc} == [ |
3978 |
|
undef, |
3979 |
|
0x006F, # o |
3980 |
|
0x0074, # t |
3981 |
|
0x0061, # a |
3982 |
|
0x0074, # t |
3983 |
|
0x0069, # i |
3984 |
|
0x006F, # o |
3985 |
|
]->[length $self->{kwd}]) { |
3986 |
## Stay in the state. |
## Stay in the state. |
3987 |
$self->{kwd} .= chr $self->{nc}; |
$self->{kwd} .= chr $self->{nc}; |
3988 |
!!!next-input-character; |
!!!next-input-character; |
3989 |
redo A; |
redo A; |
3990 |
} elsif ($self->{kwd} eq 'NOTATIO' and |
} elsif ((length $self->{kwd}) == 7 and |
3991 |
$self->{nc} == 0x004E) { # N |
($self->{nc} == 0x004E or # N |
3992 |
|
$self->{nc} == 0x006E)) { # n |
3993 |
|
if ($self->{kwd} ne 'NOTATIO' or $self->{nc} == 0x006E) { |
3994 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
3995 |
|
text => 'NOTATION', |
3996 |
|
line => $self->{line_prev}, |
3997 |
|
column => $self->{column_prev} - 6); |
3998 |
|
} |
3999 |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
$self->{ct} = {type => NOTATION_TOKEN, name => '', |
4000 |
line => $self->{line_prev}, |
line => $self->{line_prev}, |
4001 |
column => $self->{column_prev} - 6}; |
column => $self->{column_prev} - 8}; |
4002 |
$self->{state} = DOCTYPE_MD_STATE; |
$self->{state} = DOCTYPE_MD_STATE; |
4003 |
!!!next-input-character; |
!!!next-input-character; |
4004 |
redo A; |
redo A; |
4107 |
## XML5: "DOCTYPE ENTITY name state" and "DOCTYPE ATTLIST name state". |
## XML5: "DOCTYPE ENTITY name state" and "DOCTYPE ATTLIST name state". |
4108 |
|
|
4109 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
4110 |
## TODO: |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
4111 |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4112 |
|
} elsif ($self->{ct}->{type} == ELEMENT_TOKEN) { |
4113 |
|
$self->{state} = AFTER_ELEMENT_NAME_STATE; |
4114 |
|
} else { # ENTITY/NOTATION |
4115 |
|
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
4116 |
|
} |
4117 |
!!!next-input-character; |
!!!next-input-character; |
4118 |
redo A; |
redo A; |
4119 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
4120 |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
4121 |
# |
# |
4122 |
} else { |
} else { |
4123 |
!!!parse-error (type => 'no md body'); ## TODO: type |
!!!parse-error (type => 'no md def'); ## TODO: type |
4124 |
} |
} |
4125 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4126 |
!!!next-input-character; |
!!!next-input-character; |
4510 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
4511 |
## XML5: No parse error. |
## XML5: No parse error. |
4512 |
!!!parse-error (type => 'no default type'); ## TODO: type |
!!!parse-error (type => 'no default type'); ## TODO: type |
4513 |
$self->{state} = BOGUS_COMMENT_STATE; |
$self->{state} = BOGUS_MD_STATE; |
|
$self->{ct} = {type => COMMENT_TOKEN, data => ''}; ## Will be discarded |
|
4514 |
## Reconsume. |
## Reconsume. |
4515 |
redo A; |
redo A; |
4516 |
} elsif ($self->{nc} == 0x0022) { # " |
} elsif ($self->{nc} == 0x0022) { # " |
4637 |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
4638 |
## Reconsume. |
## Reconsume. |
4639 |
redo A; |
redo A; |
4640 |
} |
} |
4641 |
|
} elsif ($self->{state} == NDATA_STATE) { |
4642 |
|
## ASCII case-insensitive |
4643 |
|
if ($self->{nc} == [ |
4644 |
|
undef, |
4645 |
|
0x0044, # D |
4646 |
|
0x0041, # A |
4647 |
|
0x0054, # T |
4648 |
|
]->[length $self->{kwd}] or |
4649 |
|
$self->{nc} == [ |
4650 |
|
undef, |
4651 |
|
0x0064, # d |
4652 |
|
0x0061, # a |
4653 |
|
0x0074, # t |
4654 |
|
]->[length $self->{kwd}]) { |
4655 |
|
!!!cp (172.2); |
4656 |
|
## Stay in the state. |
4657 |
|
$self->{kwd} .= chr $self->{nc}; |
4658 |
|
!!!next-input-character; |
4659 |
|
redo A; |
4660 |
|
} elsif ((length $self->{kwd}) == 4 and |
4661 |
|
($self->{nc} == 0x0041 or # A |
4662 |
|
$self->{nc} == 0x0061)) { # a |
4663 |
|
if ($self->{kwd} ne 'NDAT' or $self->{nc} == 0x0061) { # a |
4664 |
|
!!!cp (172.3); |
4665 |
|
!!!parse-error (type => 'lowercase keyword', ## TODO: type |
4666 |
|
text => 'NDATA', |
4667 |
|
line => $self->{line_prev}, |
4668 |
|
column => $self->{column_prev} - 4); |
4669 |
|
} else { |
4670 |
|
!!!cp (172.4); |
4671 |
|
} |
4672 |
|
$self->{state} = AFTER_NDATA_STATE; |
4673 |
|
!!!next-input-character; |
4674 |
|
redo A; |
4675 |
|
} else { |
4676 |
|
!!!parse-error (type => 'string after literal', ## TODO: type |
4677 |
|
line => $self->{line_prev}, |
4678 |
|
column => $self->{column_prev} + 1 |
4679 |
|
- length $self->{kwd}); |
4680 |
|
!!!cp (172.5); |
4681 |
|
$self->{state} = BOGUS_MD_STATE; |
4682 |
|
## Reconsume. |
4683 |
|
redo A; |
4684 |
|
} |
4685 |
|
} elsif ($self->{state} == AFTER_NDATA_STATE) { |
4686 |
|
if ($is_space->{$self->{nc}}) { |
4687 |
|
$self->{state} = BEFORE_NOTATION_NAME_STATE; |
4688 |
|
!!!next-input-character; |
4689 |
|
redo A; |
4690 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4691 |
|
!!!parse-error (type => 'no notation name'); ## TODO: type |
4692 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4693 |
|
!!!next-input-character; |
4694 |
|
!!!emit ($self->{ct}); # ENTITY |
4695 |
|
redo A; |
4696 |
|
} elsif ($self->{nc} == -1) { |
4697 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4698 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4699 |
|
!!!next-input-character; |
4700 |
|
!!!emit ($self->{ct}); # ENTITY |
4701 |
|
redo A; |
4702 |
|
} else { |
4703 |
|
!!!parse-error (type => 'string after literal', ## TODO: type |
4704 |
|
line => $self->{line_prev}, |
4705 |
|
column => $self->{column_prev} + 1 |
4706 |
|
- length $self->{kwd}); |
4707 |
|
$self->{state} = BOGUS_MD_STATE; |
4708 |
|
## Reconsume. |
4709 |
|
redo A; |
4710 |
|
} |
4711 |
|
} elsif ($self->{state} == BEFORE_NOTATION_NAME_STATE) { |
4712 |
|
if ($is_space->{$self->{nc}}) { |
4713 |
|
## Stay in the state. |
4714 |
|
!!!next-input-character; |
4715 |
|
redo A; |
4716 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4717 |
|
!!!parse-error (type => 'no notation name'); ## TODO: type |
4718 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4719 |
|
!!!next-input-character; |
4720 |
|
!!!emit ($self->{ct}); # ENTITY |
4721 |
|
redo A; |
4722 |
|
} elsif ($self->{nc} == -1) { |
4723 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4724 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4725 |
|
!!!next-input-character; |
4726 |
|
!!!emit ($self->{ct}); # ENTITY |
4727 |
|
redo A; |
4728 |
|
} else { |
4729 |
|
$self->{ct}->{notation} = chr $self->{nc}; # ENTITY |
4730 |
|
$self->{state} = NOTATION_NAME_STATE; |
4731 |
|
!!!next-input-character; |
4732 |
|
redo A; |
4733 |
|
} |
4734 |
|
} elsif ($self->{state} == NOTATION_NAME_STATE) { |
4735 |
|
if ($is_space->{$self->{nc}}) { |
4736 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4737 |
|
!!!next-input-character; |
4738 |
|
redo A; |
4739 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4740 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4741 |
|
!!!next-input-character; |
4742 |
|
!!!emit ($self->{ct}); # ENTITY |
4743 |
|
redo A; |
4744 |
|
} elsif ($self->{nc} == -1) { |
4745 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4746 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4747 |
|
!!!next-input-character; |
4748 |
|
!!!emit ($self->{ct}); # ENTITY |
4749 |
|
redo A; |
4750 |
|
} else { |
4751 |
|
$self->{ct}->{notation} .= chr $self->{nc}; # ENTITY |
4752 |
|
## Stay in the state. |
4753 |
|
!!!next-input-character; |
4754 |
|
redo A; |
4755 |
|
} |
4756 |
|
} elsif ($self->{state} == DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE) { |
4757 |
|
if ($self->{nc} == 0x0022) { # " |
4758 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4759 |
|
!!!next-input-character; |
4760 |
|
redo A; |
4761 |
|
} elsif ($self->{nc} == 0x0026) { # & |
4762 |
|
$self->{prev_state} = $self->{state}; |
4763 |
|
$self->{state} = ENTITY_VALUE_ENTITY_STATE; |
4764 |
|
$self->{entity_add} = 0x0022; # " |
4765 |
|
!!!next-input-character; |
4766 |
|
redo A; |
4767 |
|
## TODO: % |
4768 |
|
} elsif ($self->{nc} == -1) { |
4769 |
|
!!!parse-error (type => 'unclosed entity value'); ## TODO: type |
4770 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4771 |
|
## Reconsume. |
4772 |
|
!!!emit ($self->{ct}); # ENTITY |
4773 |
|
redo A; |
4774 |
|
} else { |
4775 |
|
$self->{ct}->{value} .= chr $self->{nc}; # ENTITY |
4776 |
|
!!!next-input-character; |
4777 |
|
redo A; |
4778 |
|
} |
4779 |
|
} elsif ($self->{state} == DOCTYPE_ENTITY_VALUE_SINGLE_QUOTED_STATE) { |
4780 |
|
if ($self->{nc} == 0x0027) { # ' |
4781 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4782 |
|
!!!next-input-character; |
4783 |
|
redo A; |
4784 |
|
} elsif ($self->{nc} == 0x0026) { # & |
4785 |
|
$self->{prev_state} = $self->{state}; |
4786 |
|
$self->{state} = ENTITY_VALUE_ENTITY_STATE; |
4787 |
|
$self->{entity_add} = 0x0027; # ' |
4788 |
|
!!!next-input-character; |
4789 |
|
redo A; |
4790 |
|
## TODO: % |
4791 |
|
} elsif ($self->{nc} == -1) { |
4792 |
|
!!!parse-error (type => 'unclosed entity value'); ## TODO: type |
4793 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4794 |
|
## Reconsume. |
4795 |
|
!!!emit ($self->{ct}); # ENTITY |
4796 |
|
redo A; |
4797 |
|
} else { |
4798 |
|
$self->{ct}->{value} .= chr $self->{nc}; # ENTITY |
4799 |
|
!!!next-input-character; |
4800 |
|
redo A; |
4801 |
|
} |
4802 |
|
} elsif ($self->{state} == ENTITY_VALUE_ENTITY_STATE) { |
4803 |
|
if ($is_space->{$self->{nc}} or |
4804 |
|
{ |
4805 |
|
0x003C => 1, 0x0026 => 1, -1 => 1, # <, & |
4806 |
|
$self->{entity_add} => 1, |
4807 |
|
}->{$self->{nc}}) { |
4808 |
|
!!!parse-error (type => 'bare ero', |
4809 |
|
line => $self->{line_prev}, |
4810 |
|
column => $self->{column_prev} |
4811 |
|
+ ($self->{nc} == -1 ? 1 : 0)); |
4812 |
|
## Don't consume |
4813 |
|
## Return nothing. |
4814 |
|
# |
4815 |
|
} elsif ($self->{nc} == 0x0023) { # # |
4816 |
|
$self->{ca} = $self->{ct}; |
4817 |
|
$self->{state} = ENTITY_HASH_STATE; |
4818 |
|
$self->{kwd} = '#'; |
4819 |
|
!!!next-input-character; |
4820 |
|
redo A; |
4821 |
|
} else { |
4822 |
|
# |
4823 |
|
} |
4824 |
|
|
4825 |
|
$self->{ct}->{value} .= '&'; |
4826 |
|
$self->{state} = $self->{prev_state}; |
4827 |
|
## Reconsume. |
4828 |
|
redo A; |
4829 |
|
} elsif ($self->{state} == AFTER_ELEMENT_NAME_STATE) { |
4830 |
|
if ($is_space->{$self->{nc}}) { |
4831 |
|
$self->{state} = BEFORE_ELEMENT_CONTENT_STATE; |
4832 |
|
!!!next-input-character; |
4833 |
|
redo A; |
4834 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4835 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4836 |
|
$self->{ct}->{content} = ['(']; |
4837 |
|
$self->{group_depth} = 1; |
4838 |
|
!!!next-input-character; |
4839 |
|
redo A; |
4840 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4841 |
|
!!!parse-error (type => 'no md def'); ## TODO: type |
4842 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4843 |
|
!!!next-input-character; |
4844 |
|
!!!emit ($self->{ct}); # ELEMENT |
4845 |
|
redo A; |
4846 |
|
} elsif ($self->{nc} == -1) { |
4847 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4848 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4849 |
|
!!!next-input-character; |
4850 |
|
!!!emit ($self->{ct}); # ELEMENT |
4851 |
|
redo A; |
4852 |
|
} else { |
4853 |
|
$self->{ct}->{content} = [chr $self->{nc}]; |
4854 |
|
$self->{state} = CONTENT_KEYWORD_STATE; |
4855 |
|
!!!next-input-character; |
4856 |
|
redo A; |
4857 |
|
} |
4858 |
|
} elsif ($self->{state} == CONTENT_KEYWORD_STATE) { |
4859 |
|
if ($is_space->{$self->{nc}}) { |
4860 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
4861 |
|
!!!next-input-character; |
4862 |
|
redo A; |
4863 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4864 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4865 |
|
!!!next-input-character; |
4866 |
|
!!!emit ($self->{ct}); # ELEMENT |
4867 |
|
redo A; |
4868 |
|
} elsif ($self->{nc} == -1) { |
4869 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4870 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4871 |
|
!!!next-input-character; |
4872 |
|
!!!emit ($self->{ct}); # ELEMENT |
4873 |
|
redo A; |
4874 |
|
} else { |
4875 |
|
$self->{ct}->{content}->[-1] .= chr $self->{nc}; # ELEMENT |
4876 |
|
## Stay in the state. |
4877 |
|
!!!next-input-character; |
4878 |
|
redo A; |
4879 |
|
} |
4880 |
|
} elsif ($self->{state} == AFTER_CM_GROUP_OPEN_STATE) { |
4881 |
|
if ($is_space->{$self->{nc}}) { |
4882 |
|
## Stay in the state. |
4883 |
|
!!!next-input-character; |
4884 |
|
redo A; |
4885 |
|
} elsif ($self->{nc} == 0x0028) { # ( |
4886 |
|
$self->{group_depth}++; |
4887 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4888 |
|
## Stay in the state. |
4889 |
|
!!!next-input-character; |
4890 |
|
redo A; |
4891 |
|
} elsif ($self->{nc} == 0x007C or # | |
4892 |
|
$self->{nc} == 0x002C) { # , |
4893 |
|
!!!parse-error (type => 'empty element name'); ## TODO: type |
4894 |
|
## Stay in the state. |
4895 |
|
!!!next-input-character; |
4896 |
|
redo A; |
4897 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4898 |
|
!!!parse-error (type => 'empty element name'); ## TODO: type |
4899 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4900 |
|
$self->{group_depth}--; |
4901 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4902 |
|
!!!next-input-character; |
4903 |
|
redo A; |
4904 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4905 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4906 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4907 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4908 |
|
!!!next-input-character; |
4909 |
|
!!!emit ($self->{ct}); # ELEMENT |
4910 |
|
redo A; |
4911 |
|
} elsif ($self->{nc} == -1) { |
4912 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4913 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4914 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4915 |
|
!!!next-input-character; |
4916 |
|
!!!emit ($self->{ct}); # ELEMENT |
4917 |
|
redo A; |
4918 |
|
} else { |
4919 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4920 |
|
$self->{state} = CM_ELEMENT_NAME_STATE; |
4921 |
|
!!!next-input-character; |
4922 |
|
redo A; |
4923 |
|
} |
4924 |
|
} elsif ($self->{state} == CM_ELEMENT_NAME_STATE) { |
4925 |
|
if ($is_space->{$self->{nc}}) { |
4926 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
4927 |
|
!!!next-input-character; |
4928 |
|
redo A; |
4929 |
|
} elsif ($self->{nc} == 0x002A or # * |
4930 |
|
$self->{nc} == 0x002B or # + |
4931 |
|
$self->{nc} == 0x003F) { # ? |
4932 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4933 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
4934 |
|
!!!next-input-character; |
4935 |
|
redo A; |
4936 |
|
} elsif ($self->{nc} == 0x007C or # | |
4937 |
|
$self->{nc} == 0x002C) { # , |
4938 |
|
push @{$self->{ct}->{content}}, $self->{nc} == 0x007C ? ' | ' : ', '; |
4939 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4940 |
|
!!!next-input-character; |
4941 |
|
redo A; |
4942 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4943 |
|
$self->{group_depth}--; |
4944 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4945 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4946 |
|
!!!next-input-character; |
4947 |
|
redo A; |
4948 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4949 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4950 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4951 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4952 |
|
!!!next-input-character; |
4953 |
|
!!!emit ($self->{ct}); # ELEMENT |
4954 |
|
redo A; |
4955 |
|
} elsif ($self->{nc} == -1) { |
4956 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4957 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4958 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4959 |
|
!!!next-input-character; |
4960 |
|
!!!emit ($self->{ct}); # ELEMENT |
4961 |
|
redo A; |
4962 |
|
} else { |
4963 |
|
$self->{ct}->{content}->[-1] .= chr $self->{nc}; |
4964 |
|
## Stay in the state. |
4965 |
|
!!!next-input-character; |
4966 |
|
redo A; |
4967 |
|
} |
4968 |
|
} elsif ($self->{state} == AFTER_CM_ELEMENT_NAME_STATE) { |
4969 |
|
if ($is_space->{$self->{nc}}) { |
4970 |
|
## Stay in the state. |
4971 |
|
!!!next-input-character; |
4972 |
|
redo A; |
4973 |
|
} elsif ($self->{nc} == 0x007C or # | |
4974 |
|
$self->{nc} == 0x002C) { # , |
4975 |
|
push @{$self->{ct}->{content}}, $self->{nc} == 0x007C ? ' | ' : ', '; |
4976 |
|
$self->{state} = AFTER_CM_GROUP_OPEN_STATE; |
4977 |
|
!!!next-input-character; |
4978 |
|
redo A; |
4979 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
4980 |
|
$self->{group_depth}--; |
4981 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
4982 |
|
$self->{state} = AFTER_CM_GROUP_CLOSE_STATE; |
4983 |
|
!!!next-input-character; |
4984 |
|
redo A; |
4985 |
|
} elsif ($self->{nc} == 0x003E) { # > |
4986 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
4987 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4988 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4989 |
|
!!!next-input-character; |
4990 |
|
!!!emit ($self->{ct}); # ELEMENT |
4991 |
|
redo A; |
4992 |
|
} elsif ($self->{nc} == -1) { |
4993 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4994 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4995 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4996 |
|
!!!next-input-character; |
4997 |
|
!!!emit ($self->{ct}); # ELEMENT |
4998 |
|
redo A; |
4999 |
|
} else { |
5000 |
|
!!!parse-error (type => 'after element name'); ## TODO: type |
5001 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5002 |
|
$self->{state} = BOGUS_MD_STATE; |
5003 |
|
!!!next-input-character; |
5004 |
|
redo A; |
5005 |
|
} |
5006 |
|
} elsif ($self->{state} == AFTER_CM_GROUP_CLOSE_STATE) { |
5007 |
|
if ($is_space->{$self->{nc}}) { |
5008 |
|
if ($self->{group_depth}) { |
5009 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5010 |
|
} else { |
5011 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
5012 |
|
} |
5013 |
|
!!!next-input-character; |
5014 |
|
redo A; |
5015 |
|
} elsif ($self->{nc} == 0x002A or # * |
5016 |
|
$self->{nc} == 0x002B or # + |
5017 |
|
$self->{nc} == 0x003F) { # ? |
5018 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5019 |
|
if ($self->{group_depth}) { |
5020 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5021 |
|
} else { |
5022 |
|
$self->{state} = AFTER_MD_DEF_STATE; |
5023 |
|
} |
5024 |
|
!!!next-input-character; |
5025 |
|
redo A; |
5026 |
|
} elsif ($self->{nc} == 0x0029) { # ) |
5027 |
|
if ($self->{group_depth}) { |
5028 |
|
$self->{group_depth}--; |
5029 |
|
push @{$self->{ct}->{content}}, chr $self->{nc}; |
5030 |
|
## Stay in the state. |
5031 |
|
!!!next-input-character; |
5032 |
|
redo A; |
5033 |
|
} else { |
5034 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5035 |
|
$self->{state} = BOGUS_MD_STATE; |
5036 |
|
## Reconsume. |
5037 |
|
redo A; |
5038 |
|
} |
5039 |
|
} elsif ($self->{nc} == 0x003E) { # > |
5040 |
|
if ($self->{group_depth}) { |
5041 |
|
!!!parse-error (type => 'unclosed cm group'); ## TODO: type |
5042 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5043 |
|
} |
5044 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5045 |
|
!!!next-input-character; |
5046 |
|
!!!emit ($self->{ct}); # ELEMENT |
5047 |
|
redo A; |
5048 |
|
} elsif ($self->{nc} == -1) { |
5049 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5050 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
5051 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5052 |
|
!!!next-input-character; |
5053 |
|
!!!emit ($self->{ct}); # ELEMENT |
5054 |
|
redo A; |
5055 |
|
} else { |
5056 |
|
if ($self->{group_depth}) { |
5057 |
|
$self->{state} = AFTER_CM_ELEMENT_NAME_STATE; |
5058 |
|
} else { |
5059 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5060 |
|
$self->{state} = BOGUS_MD_STATE; |
5061 |
|
} |
5062 |
|
## Reconsume. |
5063 |
|
redo A; |
5064 |
|
} |
5065 |
|
} elsif ($self->{state} == AFTER_MD_DEF_STATE) { |
5066 |
|
if ($is_space->{$self->{nc}}) { |
5067 |
|
## Stay in the state. |
5068 |
|
!!!next-input-character; |
5069 |
|
redo A; |
5070 |
|
} elsif ($self->{nc} == 0x003E) { # > |
5071 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5072 |
|
!!!next-input-character; |
5073 |
|
!!!emit ($self->{ct}); # ENTITY/ELEMENT |
5074 |
|
redo A; |
5075 |
|
} elsif ($self->{nc} == -1) { |
5076 |
|
!!!parse-error (type => 'unclosed md'); ## TODO: type |
5077 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5078 |
|
!!!next-input-character; |
5079 |
|
!!!emit ($self->{ct}); # ENTITY/ELEMENT |
5080 |
|
redo A; |
5081 |
|
} else { |
5082 |
|
!!!parse-error (type => 'string after md def'); ## TODO: type |
5083 |
|
$self->{state} = BOGUS_MD_STATE; |
5084 |
|
## Reconsume. |
5085 |
|
redo A; |
5086 |
|
} |
5087 |
|
} elsif ($self->{state} == BOGUS_MD_STATE) { |
5088 |
|
if ($self->{nc} == 0x003E) { # > |
5089 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5090 |
|
!!!next-input-character; |
5091 |
|
!!!emit ($self->{ct}); # ATTLIST/ENTITY/NOTATION |
5092 |
|
redo A; |
5093 |
|
} elsif ($self->{nc} == -1) { |
5094 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
5095 |
|
## Reconsume. |
5096 |
|
!!!emit ($self->{ct}); # ATTLIST/ENTITY/NOTATION |
5097 |
|
redo A; |
5098 |
|
} else { |
5099 |
|
## Stay in the state. |
5100 |
|
!!!next-input-character; |
5101 |
|
redo A; |
5102 |
|
} |
5103 |
} else { |
} else { |
5104 |
die "$0: $self->{state}: Unknown state"; |
die "$0: $self->{state}: Unknown state"; |
5105 |
} |
} |