460 |
sub BOGUS_DOCTYPE_STATE () { 32 } |
sub BOGUS_DOCTYPE_STATE () { 32 } |
461 |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
sub AFTER_ATTRIBUTE_VALUE_QUOTED_STATE () { 33 } |
462 |
sub SELF_CLOSING_START_TAG_STATE () { 34 } |
sub SELF_CLOSING_START_TAG_STATE () { 34 } |
463 |
|
sub CDATA_BLOCK_STATE () { 35 } |
464 |
|
|
465 |
sub DOCTYPE_TOKEN () { 1 } |
sub DOCTYPE_TOKEN () { 1 } |
466 |
sub COMMENT_TOKEN () { 2 } |
sub COMMENT_TOKEN () { 2 } |
1686 |
} else { |
} else { |
1687 |
!!!cp (135); |
!!!cp (135); |
1688 |
} |
} |
1689 |
|
} elsif ($self->{insertion_mode} & IN_FOREIGN_CONTENT_IM and |
1690 |
|
$self->{open_elements}->[-1]->[1] & FOREIGN_EL and |
1691 |
|
$self->{next_char} == 0x005B) { # [ |
1692 |
|
!!!next-input-character; |
1693 |
|
push @next_char, $self->{next_char}; |
1694 |
|
if ($self->{next_char} == 0x0043) { # C |
1695 |
|
!!!next-input-character; |
1696 |
|
push @next_char, $self->{next_char}; |
1697 |
|
if ($self->{next_char} == 0x0044) { # D |
1698 |
|
!!!next-input-character; |
1699 |
|
push @next_char, $self->{next_char}; |
1700 |
|
if ($self->{next_char} == 0x0041) { # A |
1701 |
|
!!!next-input-character; |
1702 |
|
push @next_char, $self->{next_char}; |
1703 |
|
if ($self->{next_char} == 0x0054) { # T |
1704 |
|
!!!next-input-character; |
1705 |
|
push @next_char, $self->{next_char}; |
1706 |
|
if ($self->{next_char} == 0x0041) { # A |
1707 |
|
!!!next-input-character; |
1708 |
|
push @next_char, $self->{next_char}; |
1709 |
|
if ($self->{next_char} == 0x005B) { # [ |
1710 |
|
!!!cp (135.1); |
1711 |
|
$self->{state} = CDATA_BLOCK_STATE; |
1712 |
|
!!!next-input-character; |
1713 |
|
redo A; |
1714 |
|
} else { |
1715 |
|
!!!cp (135.2); |
1716 |
|
} |
1717 |
|
} else { |
1718 |
|
!!!cp (135.3); |
1719 |
|
} |
1720 |
|
} else { |
1721 |
|
!!!cp (135.4); |
1722 |
|
} |
1723 |
|
} else { |
1724 |
|
!!!cp (135.5); |
1725 |
|
} |
1726 |
|
} else { |
1727 |
|
!!!cp (135.6); |
1728 |
|
} |
1729 |
|
} else { |
1730 |
|
!!!cp (135.7); |
1731 |
|
} |
1732 |
} else { |
} else { |
1733 |
!!!cp (136); |
!!!cp (136); |
1734 |
} |
} |
2453 |
!!!next-input-character; |
!!!next-input-character; |
2454 |
redo A; |
redo A; |
2455 |
} |
} |
2456 |
|
} elsif ($self->{state} == CDATA_BLOCK_STATE) { |
2457 |
|
my $s = ''; |
2458 |
|
|
2459 |
|
my ($l, $c) = ($self->{line}, $self->{column}); |
2460 |
|
|
2461 |
|
CS: while ($self->{next_char} != -1) { |
2462 |
|
if ($self->{next_char} == 0x005D) { # ] |
2463 |
|
!!!next-input-character; |
2464 |
|
if ($self->{next_char} == 0x005D) { # ] |
2465 |
|
!!!next-input-character; |
2466 |
|
MDC: { |
2467 |
|
if ($self->{next_char} == 0x003E) { # > |
2468 |
|
!!!cp (221.1); |
2469 |
|
!!!next-input-character; |
2470 |
|
last CS; |
2471 |
|
} elsif ($self->{next_char} == 0x005D) { # ] |
2472 |
|
!!!cp (221.2); |
2473 |
|
$s .= ']'; |
2474 |
|
!!!next-input-character; |
2475 |
|
redo MDC; |
2476 |
|
} else { |
2477 |
|
!!!cp (221.3); |
2478 |
|
$s .= ']]'; |
2479 |
|
# |
2480 |
|
} |
2481 |
|
} # MDC |
2482 |
|
} else { |
2483 |
|
!!!cp (221.4); |
2484 |
|
$s .= ']'; |
2485 |
|
# |
2486 |
|
} |
2487 |
|
} else { |
2488 |
|
!!!cp (221.5); |
2489 |
|
# |
2490 |
|
} |
2491 |
|
$s .= chr $self->{next_char}; |
2492 |
|
!!!next-input-character; |
2493 |
|
} # CS |
2494 |
|
|
2495 |
|
$self->{state} = DATA_STATE; |
2496 |
|
## next-input-character done or EOF, which is reconsumed. |
2497 |
|
|
2498 |
|
if (length $s) { |
2499 |
|
!!!cp (221.6); |
2500 |
|
!!!emit ({type => CHARACTER_TOKEN, data => $s, |
2501 |
|
line => $l, column => $c}); |
2502 |
|
} else { |
2503 |
|
!!!cp (221.7); |
2504 |
|
} |
2505 |
|
|
2506 |
|
redo A; |
2507 |
|
|
2508 |
|
## ISSUE: "text tokens" in spec. |
2509 |
|
## TODO: Streaming support |
2510 |
} else { |
} else { |
2511 |
die "$0: $self->{state}: Unknown state"; |
die "$0: $self->{state}: Unknown state"; |
2512 |
} |
} |