387 |
if ($self->{next_char} == 0x0026) { # & |
if ($self->{next_char} == 0x0026) { # & |
388 |
if ($self->{content_model} & CM_ENTITY and # PCDATA | RCDATA |
if ($self->{content_model} & CM_ENTITY and # PCDATA | RCDATA |
389 |
not $self->{escape}) { |
not $self->{escape}) { |
390 |
|
!!!cp (1); |
391 |
$self->{state} = ENTITY_DATA_STATE; |
$self->{state} = ENTITY_DATA_STATE; |
392 |
!!!next-input-character; |
!!!next-input-character; |
393 |
redo A; |
redo A; |
394 |
} else { |
} else { |
395 |
|
!!!cp (2); |
396 |
# |
# |
397 |
} |
} |
398 |
} elsif ($self->{next_char} == 0x002D) { # - |
} elsif ($self->{next_char} == 0x002D) { # - |
401 |
if ($self->{prev_char}->[0] == 0x002D and # - |
if ($self->{prev_char}->[0] == 0x002D and # - |
402 |
$self->{prev_char}->[1] == 0x0021 and # ! |
$self->{prev_char}->[1] == 0x0021 and # ! |
403 |
$self->{prev_char}->[2] == 0x003C) { # < |
$self->{prev_char}->[2] == 0x003C) { # < |
404 |
|
!!!cp (3); |
405 |
$self->{escape} = 1; |
$self->{escape} = 1; |
406 |
|
} else { |
407 |
|
!!!cp (4); |
408 |
} |
} |
409 |
|
} else { |
410 |
|
!!!cp (5); |
411 |
} |
} |
412 |
} |
} |
413 |
|
|
416 |
if ($self->{content_model} & CM_FULL_MARKUP or # PCDATA |
if ($self->{content_model} & CM_FULL_MARKUP or # PCDATA |
417 |
(($self->{content_model} & CM_LIMITED_MARKUP) and # CDATA | RCDATA |
(($self->{content_model} & CM_LIMITED_MARKUP) and # CDATA | RCDATA |
418 |
not $self->{escape})) { |
not $self->{escape})) { |
419 |
|
!!!cp (6); |
420 |
$self->{state} = TAG_OPEN_STATE; |
$self->{state} = TAG_OPEN_STATE; |
421 |
!!!next-input-character; |
!!!next-input-character; |
422 |
redo A; |
redo A; |
423 |
} else { |
} else { |
424 |
|
!!!cp (7); |
425 |
# |
# |
426 |
} |
} |
427 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
429 |
($self->{content_model} & CM_LIMITED_MARKUP)) { # RCDATA | CDATA |
($self->{content_model} & CM_LIMITED_MARKUP)) { # RCDATA | CDATA |
430 |
if ($self->{prev_char}->[0] == 0x002D and # - |
if ($self->{prev_char}->[0] == 0x002D and # - |
431 |
$self->{prev_char}->[1] == 0x002D) { # - |
$self->{prev_char}->[1] == 0x002D) { # - |
432 |
|
!!!cp (8); |
433 |
delete $self->{escape}; |
delete $self->{escape}; |
434 |
|
} else { |
435 |
|
!!!cp (9); |
436 |
} |
} |
437 |
|
} else { |
438 |
|
!!!cp (10); |
439 |
} |
} |
440 |
|
|
441 |
# |
# |
442 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
443 |
|
!!!cp (11); |
444 |
!!!emit ({type => END_OF_FILE_TOKEN}); |
!!!emit ({type => END_OF_FILE_TOKEN}); |
445 |
last A; ## TODO: ok? |
last A; ## TODO: ok? |
446 |
|
} else { |
447 |
|
!!!cp (12); |
448 |
} |
} |
449 |
# Anything else |
# Anything else |
450 |
my $token = {type => CHARACTER_TOKEN, |
my $token = {type => CHARACTER_TOKEN, |
464 |
# next-input-character is already done |
# next-input-character is already done |
465 |
|
|
466 |
unless (defined $token) { |
unless (defined $token) { |
467 |
|
!!!cp (13); |
468 |
!!!emit ({type => CHARACTER_TOKEN, data => '&'}); |
!!!emit ({type => CHARACTER_TOKEN, data => '&'}); |
469 |
} else { |
} else { |
470 |
|
!!!cp (14); |
471 |
!!!emit ($token); |
!!!emit ($token); |
472 |
} |
} |
473 |
|
|
475 |
} elsif ($self->{state} == TAG_OPEN_STATE) { |
} elsif ($self->{state} == TAG_OPEN_STATE) { |
476 |
if ($self->{content_model} & CM_LIMITED_MARKUP) { # RCDATA | CDATA |
if ($self->{content_model} & CM_LIMITED_MARKUP) { # RCDATA | CDATA |
477 |
if ($self->{next_char} == 0x002F) { # / |
if ($self->{next_char} == 0x002F) { # / |
478 |
|
!!!cp (15); |
479 |
!!!next-input-character; |
!!!next-input-character; |
480 |
$self->{state} = CLOSE_TAG_OPEN_STATE; |
$self->{state} = CLOSE_TAG_OPEN_STATE; |
481 |
redo A; |
redo A; |
482 |
} else { |
} else { |
483 |
|
!!!cp (16); |
484 |
## reconsume |
## reconsume |
485 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
486 |
|
|
490 |
} |
} |
491 |
} elsif ($self->{content_model} & CM_FULL_MARKUP) { # PCDATA |
} elsif ($self->{content_model} & CM_FULL_MARKUP) { # PCDATA |
492 |
if ($self->{next_char} == 0x0021) { # ! |
if ($self->{next_char} == 0x0021) { # ! |
493 |
|
!!!cp (17); |
494 |
$self->{state} = MARKUP_DECLARATION_OPEN_STATE; |
$self->{state} = MARKUP_DECLARATION_OPEN_STATE; |
495 |
!!!next-input-character; |
!!!next-input-character; |
496 |
redo A; |
redo A; |
497 |
} elsif ($self->{next_char} == 0x002F) { # / |
} elsif ($self->{next_char} == 0x002F) { # / |
498 |
|
!!!cp (18); |
499 |
$self->{state} = CLOSE_TAG_OPEN_STATE; |
$self->{state} = CLOSE_TAG_OPEN_STATE; |
500 |
!!!next-input-character; |
!!!next-input-character; |
501 |
redo A; |
redo A; |
502 |
} elsif (0x0041 <= $self->{next_char} and |
} elsif (0x0041 <= $self->{next_char} and |
503 |
$self->{next_char} <= 0x005A) { # A..Z |
$self->{next_char} <= 0x005A) { # A..Z |
504 |
|
!!!cp (19); |
505 |
$self->{current_token} |
$self->{current_token} |
506 |
= {type => START_TAG_TOKEN, |
= {type => START_TAG_TOKEN, |
507 |
tag_name => chr ($self->{next_char} + 0x0020)}; |
tag_name => chr ($self->{next_char} + 0x0020)}; |
510 |
redo A; |
redo A; |
511 |
} elsif (0x0061 <= $self->{next_char} and |
} elsif (0x0061 <= $self->{next_char} and |
512 |
$self->{next_char} <= 0x007A) { # a..z |
$self->{next_char} <= 0x007A) { # a..z |
513 |
|
!!!cp (20); |
514 |
$self->{current_token} = {type => START_TAG_TOKEN, |
$self->{current_token} = {type => START_TAG_TOKEN, |
515 |
tag_name => chr ($self->{next_char})}; |
tag_name => chr ($self->{next_char})}; |
516 |
$self->{state} = TAG_NAME_STATE; |
$self->{state} = TAG_NAME_STATE; |
517 |
!!!next-input-character; |
!!!next-input-character; |
518 |
redo A; |
redo A; |
519 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
520 |
|
!!!cp (21); |
521 |
!!!parse-error (type => 'empty start tag'); |
!!!parse-error (type => 'empty start tag'); |
522 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
523 |
!!!next-input-character; |
!!!next-input-character; |
526 |
|
|
527 |
redo A; |
redo A; |
528 |
} elsif ($self->{next_char} == 0x003F) { # ? |
} elsif ($self->{next_char} == 0x003F) { # ? |
529 |
|
!!!cp (22); |
530 |
!!!parse-error (type => 'pio'); |
!!!parse-error (type => 'pio'); |
531 |
$self->{state} = BOGUS_COMMENT_STATE; |
$self->{state} = BOGUS_COMMENT_STATE; |
532 |
## $self->{next_char} is intentionally left as is |
## $self->{next_char} is intentionally left as is |
533 |
redo A; |
redo A; |
534 |
} else { |
} else { |
535 |
|
!!!cp (23); |
536 |
!!!parse-error (type => 'bare stago'); |
!!!parse-error (type => 'bare stago'); |
537 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
538 |
## reconsume |
## reconsume |
554 |
my $c = ord substr ($self->{last_emitted_start_tag_name}, $i, 1); |
my $c = ord substr ($self->{last_emitted_start_tag_name}, $i, 1); |
555 |
my $C = 0x0061 <= $c && $c <= 0x007A ? $c - 0x0020 : $c; |
my $C = 0x0061 <= $c && $c <= 0x007A ? $c - 0x0020 : $c; |
556 |
if ($self->{next_char} == $c or $self->{next_char} == $C) { |
if ($self->{next_char} == $c or $self->{next_char} == $C) { |
557 |
|
!!!cp (24); |
558 |
!!!next-input-character; |
!!!next-input-character; |
559 |
next TAGNAME; |
next TAGNAME; |
560 |
} else { |
} else { |
561 |
|
!!!cp (25); |
562 |
$self->{next_char} = shift @next_char; # reconsume |
$self->{next_char} = shift @next_char; # reconsume |
563 |
!!!back-next-input-character (@next_char); |
!!!back-next-input-character (@next_char); |
564 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
578 |
$self->{next_char} == 0x003E or # > |
$self->{next_char} == 0x003E or # > |
579 |
$self->{next_char} == 0x002F or # / |
$self->{next_char} == 0x002F or # / |
580 |
$self->{next_char} == -1) { |
$self->{next_char} == -1) { |
581 |
|
!!!cp (26); |
582 |
$self->{next_char} = shift @next_char; # reconsume |
$self->{next_char} = shift @next_char; # reconsume |
583 |
!!!back-next-input-character (@next_char); |
!!!back-next-input-character (@next_char); |
584 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
585 |
!!!emit ({type => CHARACTER_TOKEN, data => '</'}); |
!!!emit ({type => CHARACTER_TOKEN, data => '</'}); |
586 |
redo A; |
redo A; |
587 |
} else { |
} else { |
588 |
|
!!!cp (27); |
589 |
$self->{next_char} = shift @next_char; |
$self->{next_char} = shift @next_char; |
590 |
!!!back-next-input-character (@next_char); |
!!!back-next-input-character (@next_char); |
591 |
# and consume... |
# and consume... |
592 |
} |
} |
593 |
} else { |
} else { |
594 |
## No start tag token has ever been emitted |
## No start tag token has ever been emitted |
595 |
|
!!!cp (28); |
596 |
# next-input-character is already done |
# next-input-character is already done |
597 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
598 |
!!!emit ({type => CHARACTER_TOKEN, data => '</'}); |
!!!emit ({type => CHARACTER_TOKEN, data => '</'}); |
602 |
|
|
603 |
if (0x0041 <= $self->{next_char} and |
if (0x0041 <= $self->{next_char} and |
604 |
$self->{next_char} <= 0x005A) { # A..Z |
$self->{next_char} <= 0x005A) { # A..Z |
605 |
|
!!!cp (29); |
606 |
$self->{current_token} = {type => END_TAG_TOKEN, |
$self->{current_token} = {type => END_TAG_TOKEN, |
607 |
tag_name => chr ($self->{next_char} + 0x0020)}; |
tag_name => chr ($self->{next_char} + 0x0020)}; |
608 |
$self->{state} = TAG_NAME_STATE; |
$self->{state} = TAG_NAME_STATE; |
610 |
redo A; |
redo A; |
611 |
} elsif (0x0061 <= $self->{next_char} and |
} elsif (0x0061 <= $self->{next_char} and |
612 |
$self->{next_char} <= 0x007A) { # a..z |
$self->{next_char} <= 0x007A) { # a..z |
613 |
|
!!!cp (30); |
614 |
$self->{current_token} = {type => END_TAG_TOKEN, |
$self->{current_token} = {type => END_TAG_TOKEN, |
615 |
tag_name => chr ($self->{next_char})}; |
tag_name => chr ($self->{next_char})}; |
616 |
$self->{state} = TAG_NAME_STATE; |
$self->{state} = TAG_NAME_STATE; |
617 |
!!!next-input-character; |
!!!next-input-character; |
618 |
redo A; |
redo A; |
619 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
620 |
|
!!!cp (31); |
621 |
!!!parse-error (type => 'empty end tag'); |
!!!parse-error (type => 'empty end tag'); |
622 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
623 |
!!!next-input-character; |
!!!next-input-character; |
624 |
redo A; |
redo A; |
625 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
626 |
|
!!!cp (32); |
627 |
!!!parse-error (type => 'bare etago'); |
!!!parse-error (type => 'bare etago'); |
628 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
629 |
# reconsume |
# reconsume |
632 |
|
|
633 |
redo A; |
redo A; |
634 |
} else { |
} else { |
635 |
|
!!!cp (33); |
636 |
!!!parse-error (type => 'bogus end tag'); |
!!!parse-error (type => 'bogus end tag'); |
637 |
$self->{state} = BOGUS_COMMENT_STATE; |
$self->{state} = BOGUS_COMMENT_STATE; |
638 |
## $self->{next_char} is intentionally left as is |
## $self->{next_char} is intentionally left as is |
644 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
645 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
646 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
647 |
|
!!!cp (34); |
648 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
649 |
!!!next-input-character; |
!!!next-input-character; |
650 |
redo A; |
redo A; |
651 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
652 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
653 |
|
!!!cp (35); |
654 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
655 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
656 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
657 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
658 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
659 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
660 |
|
!!!cp (36); |
661 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
662 |
|
} else { |
663 |
|
!!!cp (37); |
664 |
} |
} |
665 |
} else { |
} else { |
666 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
673 |
redo A; |
redo A; |
674 |
} elsif (0x0041 <= $self->{next_char} and |
} elsif (0x0041 <= $self->{next_char} and |
675 |
$self->{next_char} <= 0x005A) { # A..Z |
$self->{next_char} <= 0x005A) { # A..Z |
676 |
|
!!!cp (38); |
677 |
$self->{current_token}->{tag_name} .= chr ($self->{next_char} + 0x0020); |
$self->{current_token}->{tag_name} .= chr ($self->{next_char} + 0x0020); |
678 |
# start tag or end tag |
# start tag or end tag |
679 |
## Stay in this state |
## Stay in this state |
682 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
683 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
684 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
685 |
|
!!!cp (39); |
686 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
687 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
688 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
689 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
690 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
691 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
692 |
|
!!!cp (40); |
693 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
694 |
|
} else { |
695 |
|
!!!cp (41); |
696 |
} |
} |
697 |
} else { |
} else { |
698 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
709 |
$self->{current_token}->{type} == START_TAG_TOKEN and |
$self->{current_token}->{type} == START_TAG_TOKEN and |
710 |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
711 |
# permitted slash |
# permitted slash |
712 |
|
!!!cp (42); |
713 |
# |
# |
714 |
} else { |
} else { |
715 |
|
!!!cp (43); |
716 |
!!!parse-error (type => 'nestc'); |
!!!parse-error (type => 'nestc'); |
717 |
} |
} |
718 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
719 |
# next-input-character is already done |
# next-input-character is already done |
720 |
redo A; |
redo A; |
721 |
} else { |
} else { |
722 |
|
!!!cp (44); |
723 |
$self->{current_token}->{tag_name} .= chr $self->{next_char}; |
$self->{current_token}->{tag_name} .= chr $self->{next_char}; |
724 |
# start tag or end tag |
# start tag or end tag |
725 |
## Stay in the state |
## Stay in the state |
732 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
733 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
734 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
735 |
|
!!!cp (45); |
736 |
## Stay in the state |
## Stay in the state |
737 |
!!!next-input-character; |
!!!next-input-character; |
738 |
redo A; |
redo A; |
739 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
740 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
741 |
|
!!!cp (46); |
742 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
743 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
744 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
745 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
746 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
747 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
748 |
|
!!!cp (47); |
749 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
750 |
|
} else { |
751 |
|
!!!cp (48); |
752 |
} |
} |
753 |
} else { |
} else { |
754 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
761 |
redo A; |
redo A; |
762 |
} elsif (0x0041 <= $self->{next_char} and |
} elsif (0x0041 <= $self->{next_char} and |
763 |
$self->{next_char} <= 0x005A) { # A..Z |
$self->{next_char} <= 0x005A) { # A..Z |
764 |
|
!!!cp (49); |
765 |
$self->{current_attribute} = {name => chr ($self->{next_char} + 0x0020), |
$self->{current_attribute} = {name => chr ($self->{next_char} + 0x0020), |
766 |
value => ''}; |
value => ''}; |
767 |
$self->{state} = ATTRIBUTE_NAME_STATE; |
$self->{state} = ATTRIBUTE_NAME_STATE; |
773 |
$self->{current_token}->{type} == START_TAG_TOKEN and |
$self->{current_token}->{type} == START_TAG_TOKEN and |
774 |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
775 |
# permitted slash |
# permitted slash |
776 |
|
!!!cp (50); |
777 |
# |
# |
778 |
} else { |
} else { |
779 |
|
!!!cp (51); |
780 |
!!!parse-error (type => 'nestc'); |
!!!parse-error (type => 'nestc'); |
781 |
} |
} |
782 |
## Stay in the state |
## Stay in the state |
785 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
786 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
787 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
788 |
|
!!!cp (52); |
789 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
790 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
791 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
792 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
793 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
794 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
795 |
|
!!!cp (53); |
796 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
797 |
|
} else { |
798 |
|
!!!cp (54); |
799 |
} |
} |
800 |
} else { |
} else { |
801 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
812 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
813 |
0x003D => 1, # = |
0x003D => 1, # = |
814 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
815 |
|
!!!cp (55); |
816 |
!!!parse-error (type => 'bad attribute name'); |
!!!parse-error (type => 'bad attribute name'); |
817 |
|
} else { |
818 |
|
!!!cp (56); |
819 |
} |
} |
820 |
$self->{current_attribute} = {name => chr ($self->{next_char}), |
$self->{current_attribute} = {name => chr ($self->{next_char}), |
821 |
value => ''}; |
value => ''}; |
827 |
my $before_leave = sub { |
my $before_leave = sub { |
828 |
if (exists $self->{current_token}->{attributes} # start tag or end tag |
if (exists $self->{current_token}->{attributes} # start tag or end tag |
829 |
->{$self->{current_attribute}->{name}}) { # MUST |
->{$self->{current_attribute}->{name}}) { # MUST |
830 |
|
!!!cp (57); |
831 |
!!!parse-error (type => 'duplicate attribute:'.$self->{current_attribute}->{name}); |
!!!parse-error (type => 'duplicate attribute:'.$self->{current_attribute}->{name}); |
832 |
## Discard $self->{current_attribute} # MUST |
## Discard $self->{current_attribute} # MUST |
833 |
} else { |
} else { |
834 |
|
!!!cp (58); |
835 |
$self->{current_token}->{attributes}->{$self->{current_attribute}->{name}} |
$self->{current_token}->{attributes}->{$self->{current_attribute}->{name}} |
836 |
= $self->{current_attribute}; |
= $self->{current_attribute}; |
837 |
} |
} |
842 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
843 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
844 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
845 |
|
!!!cp (59); |
846 |
$before_leave->(); |
$before_leave->(); |
847 |
$self->{state} = AFTER_ATTRIBUTE_NAME_STATE; |
$self->{state} = AFTER_ATTRIBUTE_NAME_STATE; |
848 |
!!!next-input-character; |
!!!next-input-character; |
849 |
redo A; |
redo A; |
850 |
} elsif ($self->{next_char} == 0x003D) { # = |
} elsif ($self->{next_char} == 0x003D) { # = |
851 |
|
!!!cp (60); |
852 |
$before_leave->(); |
$before_leave->(); |
853 |
$self->{state} = BEFORE_ATTRIBUTE_VALUE_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_VALUE_STATE; |
854 |
!!!next-input-character; |
!!!next-input-character; |
856 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
857 |
$before_leave->(); |
$before_leave->(); |
858 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
859 |
|
!!!cp (61); |
860 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
861 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
862 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
863 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
864 |
|
!!!cp (62); |
865 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
866 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
867 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
877 |
redo A; |
redo A; |
878 |
} elsif (0x0041 <= $self->{next_char} and |
} elsif (0x0041 <= $self->{next_char} and |
879 |
$self->{next_char} <= 0x005A) { # A..Z |
$self->{next_char} <= 0x005A) { # A..Z |
880 |
|
!!!cp (63); |
881 |
$self->{current_attribute}->{name} .= chr ($self->{next_char} + 0x0020); |
$self->{current_attribute}->{name} .= chr ($self->{next_char} + 0x0020); |
882 |
## Stay in the state |
## Stay in the state |
883 |
!!!next-input-character; |
!!!next-input-character; |
889 |
$self->{current_token}->{type} == START_TAG_TOKEN and |
$self->{current_token}->{type} == START_TAG_TOKEN and |
890 |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
891 |
# permitted slash |
# permitted slash |
892 |
|
!!!cp (64); |
893 |
# |
# |
894 |
} else { |
} else { |
895 |
|
!!!cp (65); |
896 |
!!!parse-error (type => 'nestc'); |
!!!parse-error (type => 'nestc'); |
897 |
} |
} |
898 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
902 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
903 |
$before_leave->(); |
$before_leave->(); |
904 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
905 |
|
!!!cp (66); |
906 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
907 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
908 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
909 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
910 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
911 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
912 |
|
!!!cp (67); |
913 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
914 |
|
} else { |
915 |
|
!!!cp (68); |
916 |
} |
} |
917 |
} else { |
} else { |
918 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
926 |
} else { |
} else { |
927 |
if ($self->{next_char} == 0x0022 or # " |
if ($self->{next_char} == 0x0022 or # " |
928 |
$self->{next_char} == 0x0027) { # ' |
$self->{next_char} == 0x0027) { # ' |
929 |
|
!!!cp (69); |
930 |
!!!parse-error (type => 'bad attribute name'); |
!!!parse-error (type => 'bad attribute name'); |
931 |
|
} else { |
932 |
|
!!!cp (70); |
933 |
} |
} |
934 |
$self->{current_attribute}->{name} .= chr ($self->{next_char}); |
$self->{current_attribute}->{name} .= chr ($self->{next_char}); |
935 |
## Stay in the state |
## Stay in the state |
942 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
943 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
944 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
945 |
|
!!!cp (71); |
946 |
## Stay in the state |
## Stay in the state |
947 |
!!!next-input-character; |
!!!next-input-character; |
948 |
redo A; |
redo A; |
949 |
} elsif ($self->{next_char} == 0x003D) { # = |
} elsif ($self->{next_char} == 0x003D) { # = |
950 |
|
!!!cp (72); |
951 |
$self->{state} = BEFORE_ATTRIBUTE_VALUE_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_VALUE_STATE; |
952 |
!!!next-input-character; |
!!!next-input-character; |
953 |
redo A; |
redo A; |
954 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
955 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
956 |
|
!!!cp (73); |
957 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
958 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
959 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
960 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
961 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
962 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
963 |
|
!!!cp (74); |
964 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
965 |
|
} else { |
966 |
|
!!!cp (75); |
967 |
} |
} |
968 |
} else { |
} else { |
969 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
976 |
redo A; |
redo A; |
977 |
} elsif (0x0041 <= $self->{next_char} and |
} elsif (0x0041 <= $self->{next_char} and |
978 |
$self->{next_char} <= 0x005A) { # A..Z |
$self->{next_char} <= 0x005A) { # A..Z |
979 |
|
!!!cp (76); |
980 |
$self->{current_attribute} = {name => chr ($self->{next_char} + 0x0020), |
$self->{current_attribute} = {name => chr ($self->{next_char} + 0x0020), |
981 |
value => ''}; |
value => ''}; |
982 |
$self->{state} = ATTRIBUTE_NAME_STATE; |
$self->{state} = ATTRIBUTE_NAME_STATE; |
988 |
$self->{current_token}->{type} == START_TAG_TOKEN and |
$self->{current_token}->{type} == START_TAG_TOKEN and |
989 |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
990 |
# permitted slash |
# permitted slash |
991 |
|
!!!cp (77); |
992 |
# |
# |
993 |
} else { |
} else { |
994 |
|
!!!cp (78); |
995 |
!!!parse-error (type => 'nestc'); |
!!!parse-error (type => 'nestc'); |
996 |
## TODO: Different error type for <aa / bb> than <aa/> |
## TODO: Different error type for <aa / bb> than <aa/> |
997 |
} |
} |
1001 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1002 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
1003 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1004 |
|
!!!cp (79); |
1005 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1006 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1007 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1008 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1009 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1010 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1011 |
|
!!!cp (80); |
1012 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1013 |
|
} else { |
1014 |
|
!!!cp (81); |
1015 |
} |
} |
1016 |
} else { |
} else { |
1017 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1023 |
|
|
1024 |
redo A; |
redo A; |
1025 |
} else { |
} else { |
1026 |
|
!!!cp (82); |
1027 |
$self->{current_attribute} = {name => chr ($self->{next_char}), |
$self->{current_attribute} = {name => chr ($self->{next_char}), |
1028 |
value => ''}; |
value => ''}; |
1029 |
$self->{state} = ATTRIBUTE_NAME_STATE; |
$self->{state} = ATTRIBUTE_NAME_STATE; |
1036 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
1037 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1038 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1039 |
|
!!!cp (83); |
1040 |
## Stay in the state |
## Stay in the state |
1041 |
!!!next-input-character; |
!!!next-input-character; |
1042 |
redo A; |
redo A; |
1043 |
} elsif ($self->{next_char} == 0x0022) { # " |
} elsif ($self->{next_char} == 0x0022) { # " |
1044 |
|
!!!cp (84); |
1045 |
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
$self->{state} = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; |
1046 |
!!!next-input-character; |
!!!next-input-character; |
1047 |
redo A; |
redo A; |
1048 |
} elsif ($self->{next_char} == 0x0026) { # & |
} elsif ($self->{next_char} == 0x0026) { # & |
1049 |
|
!!!cp (85); |
1050 |
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
1051 |
## reconsume |
## reconsume |
1052 |
redo A; |
redo A; |
1053 |
} elsif ($self->{next_char} == 0x0027) { # ' |
} elsif ($self->{next_char} == 0x0027) { # ' |
1054 |
|
!!!cp (86); |
1055 |
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
$self->{state} = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; |
1056 |
!!!next-input-character; |
!!!next-input-character; |
1057 |
redo A; |
redo A; |
1058 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1059 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1060 |
|
!!!cp (87); |
1061 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1062 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1063 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1064 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1065 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1066 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1067 |
|
!!!cp (88); |
1068 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1069 |
|
} else { |
1070 |
|
!!!cp (89); |
1071 |
} |
} |
1072 |
} else { |
} else { |
1073 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1081 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1082 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
1083 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1084 |
|
!!!cp (90); |
1085 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1086 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1087 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1088 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1089 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1090 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1091 |
|
!!!cp (91); |
1092 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1093 |
|
} else { |
1094 |
|
!!!cp (92); |
1095 |
} |
} |
1096 |
} else { |
} else { |
1097 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1104 |
redo A; |
redo A; |
1105 |
} else { |
} else { |
1106 |
if ($self->{next_char} == 0x003D) { # = |
if ($self->{next_char} == 0x003D) { # = |
1107 |
|
!!!cp (93); |
1108 |
!!!parse-error (type => 'bad attribute value'); |
!!!parse-error (type => 'bad attribute value'); |
1109 |
|
} else { |
1110 |
|
!!!cp (94); |
1111 |
} |
} |
1112 |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
1113 |
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
$self->{state} = ATTRIBUTE_VALUE_UNQUOTED_STATE; |
1116 |
} |
} |
1117 |
} elsif ($self->{state} == ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE) { |
} elsif ($self->{state} == ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE) { |
1118 |
if ($self->{next_char} == 0x0022) { # " |
if ($self->{next_char} == 0x0022) { # " |
1119 |
|
!!!cp (95); |
1120 |
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
1121 |
!!!next-input-character; |
!!!next-input-character; |
1122 |
redo A; |
redo A; |
1123 |
} elsif ($self->{next_char} == 0x0026) { # & |
} elsif ($self->{next_char} == 0x0026) { # & |
1124 |
|
!!!cp (96); |
1125 |
$self->{last_attribute_value_state} = $self->{state}; |
$self->{last_attribute_value_state} = $self->{state}; |
1126 |
$self->{state} = ENTITY_IN_ATTRIBUTE_VALUE_STATE; |
$self->{state} = ENTITY_IN_ATTRIBUTE_VALUE_STATE; |
1127 |
!!!next-input-character; |
!!!next-input-character; |
1129 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1130 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1131 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1132 |
|
!!!cp (97); |
1133 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1134 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1135 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1136 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1137 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1138 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1139 |
|
!!!cp (98); |
1140 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1141 |
|
} else { |
1142 |
|
!!!cp (99); |
1143 |
} |
} |
1144 |
} else { |
} else { |
1145 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1151 |
|
|
1152 |
redo A; |
redo A; |
1153 |
} else { |
} else { |
1154 |
|
!!!cp (100); |
1155 |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
1156 |
## Stay in the state |
## Stay in the state |
1157 |
!!!next-input-character; |
!!!next-input-character; |
1159 |
} |
} |
1160 |
} elsif ($self->{state} == ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE) { |
} elsif ($self->{state} == ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE) { |
1161 |
if ($self->{next_char} == 0x0027) { # ' |
if ($self->{next_char} == 0x0027) { # ' |
1162 |
|
!!!cp (101); |
1163 |
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
$self->{state} = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; |
1164 |
!!!next-input-character; |
!!!next-input-character; |
1165 |
redo A; |
redo A; |
1166 |
} elsif ($self->{next_char} == 0x0026) { # & |
} elsif ($self->{next_char} == 0x0026) { # & |
1167 |
|
!!!cp (102); |
1168 |
$self->{last_attribute_value_state} = $self->{state}; |
$self->{last_attribute_value_state} = $self->{state}; |
1169 |
$self->{state} = ENTITY_IN_ATTRIBUTE_VALUE_STATE; |
$self->{state} = ENTITY_IN_ATTRIBUTE_VALUE_STATE; |
1170 |
!!!next-input-character; |
!!!next-input-character; |
1172 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1173 |
!!!parse-error (type => 'unclosed attribute value'); |
!!!parse-error (type => 'unclosed attribute value'); |
1174 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1175 |
|
!!!cp (103); |
1176 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1177 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1178 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1179 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1180 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1181 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1182 |
|
!!!cp (104); |
1183 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1184 |
|
} else { |
1185 |
|
!!!cp (105); |
1186 |
} |
} |
1187 |
} else { |
} else { |
1188 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1194 |
|
|
1195 |
redo A; |
redo A; |
1196 |
} else { |
} else { |
1197 |
|
!!!cp (106); |
1198 |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
1199 |
## Stay in the state |
## Stay in the state |
1200 |
!!!next-input-character; |
!!!next-input-character; |
1206 |
$self->{next_char} == 0x000B or # HT |
$self->{next_char} == 0x000B or # HT |
1207 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1208 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1209 |
|
!!!cp (107); |
1210 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1211 |
!!!next-input-character; |
!!!next-input-character; |
1212 |
redo A; |
redo A; |
1213 |
} elsif ($self->{next_char} == 0x0026) { # & |
} elsif ($self->{next_char} == 0x0026) { # & |
1214 |
|
!!!cp (108); |
1215 |
$self->{last_attribute_value_state} = $self->{state}; |
$self->{last_attribute_value_state} = $self->{state}; |
1216 |
$self->{state} = ENTITY_IN_ATTRIBUTE_VALUE_STATE; |
$self->{state} = ENTITY_IN_ATTRIBUTE_VALUE_STATE; |
1217 |
!!!next-input-character; |
!!!next-input-character; |
1218 |
redo A; |
redo A; |
1219 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1220 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1221 |
|
!!!cp (109); |
1222 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1223 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1224 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1225 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1226 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1227 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1228 |
|
!!!cp (110); |
1229 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1230 |
|
} else { |
1231 |
|
!!!cp (111); |
1232 |
} |
} |
1233 |
} else { |
} else { |
1234 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1242 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1243 |
!!!parse-error (type => 'unclosed tag'); |
!!!parse-error (type => 'unclosed tag'); |
1244 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1245 |
|
!!!cp (112); |
1246 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1247 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1248 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1249 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1250 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1251 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1252 |
|
!!!cp (113); |
1253 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1254 |
|
} else { |
1255 |
|
!!!cp (114); |
1256 |
} |
} |
1257 |
} else { |
} else { |
1258 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1269 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
1270 |
0x003D => 1, # = |
0x003D => 1, # = |
1271 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
1272 |
|
!!!cp (115); |
1273 |
!!!parse-error (type => 'bad attribute value'); |
!!!parse-error (type => 'bad attribute value'); |
1274 |
|
} else { |
1275 |
|
!!!cp (116); |
1276 |
} |
} |
1277 |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
$self->{current_attribute}->{value} .= chr ($self->{next_char}); |
1278 |
## Stay in the state |
## Stay in the state |
1289 |
-1); |
-1); |
1290 |
|
|
1291 |
unless (defined $token) { |
unless (defined $token) { |
1292 |
|
!!!cp (117); |
1293 |
$self->{current_attribute}->{value} .= '&'; |
$self->{current_attribute}->{value} .= '&'; |
1294 |
} else { |
} else { |
1295 |
|
!!!cp (118); |
1296 |
$self->{current_attribute}->{value} .= $token->{data}; |
$self->{current_attribute}->{value} .= $token->{data}; |
1297 |
$self->{current_attribute}->{has_reference} = $token->{has_reference}; |
$self->{current_attribute}->{has_reference} = $token->{has_reference}; |
1298 |
## ISSUE: spec says "append the returned character token to the current attribute's value" |
## ISSUE: spec says "append the returned character token to the current attribute's value" |
1307 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
1308 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1309 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1310 |
|
!!!cp (118); |
1311 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1312 |
!!!next-input-character; |
!!!next-input-character; |
1313 |
redo A; |
redo A; |
1314 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1315 |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
if ($self->{current_token}->{type} == START_TAG_TOKEN) { |
1316 |
|
!!!cp (119); |
1317 |
$self->{current_token}->{first_start_tag} |
$self->{current_token}->{first_start_tag} |
1318 |
= not defined $self->{last_emitted_start_tag_name}; |
= not defined $self->{last_emitted_start_tag_name}; |
1319 |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
$self->{last_emitted_start_tag_name} = $self->{current_token}->{tag_name}; |
1320 |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
} elsif ($self->{current_token}->{type} == END_TAG_TOKEN) { |
1321 |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
$self->{content_model} = PCDATA_CONTENT_MODEL; # MUST |
1322 |
if ($self->{current_token}->{attributes}) { |
if ($self->{current_token}->{attributes}) { |
1323 |
|
!!!cp (120); |
1324 |
!!!parse-error (type => 'end tag attribute'); |
!!!parse-error (type => 'end tag attribute'); |
1325 |
|
} else { |
1326 |
|
!!!cp (121); |
1327 |
} |
} |
1328 |
} else { |
} else { |
1329 |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
die "$0: $self->{current_token}->{type}: Unknown token type"; |
1340 |
$self->{current_token}->{type} == START_TAG_TOKEN and |
$self->{current_token}->{type} == START_TAG_TOKEN and |
1341 |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
$permitted_slash_tag_name->{$self->{current_token}->{tag_name}}) { |
1342 |
# permitted slash |
# permitted slash |
1343 |
|
!!!cp (122); |
1344 |
# |
# |
1345 |
} else { |
} else { |
1346 |
|
!!!cp (123); |
1347 |
!!!parse-error (type => 'nestc'); |
!!!parse-error (type => 'nestc'); |
1348 |
} |
} |
1349 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1350 |
# next-input-character is already done |
# next-input-character is already done |
1351 |
redo A; |
redo A; |
1352 |
} else { |
} else { |
1353 |
|
!!!cp (124); |
1354 |
!!!parse-error (type => 'no space between attributes'); |
!!!parse-error (type => 'no space between attributes'); |
1355 |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
$self->{state} = BEFORE_ATTRIBUTE_NAME_STATE; |
1356 |
## reconsume |
## reconsume |
1363 |
|
|
1364 |
BC: { |
BC: { |
1365 |
if ($self->{next_char} == 0x003E) { # > |
if ($self->{next_char} == 0x003E) { # > |
1366 |
|
!!!cp (124); |
1367 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1368 |
!!!next-input-character; |
!!!next-input-character; |
1369 |
|
|
1371 |
|
|
1372 |
redo A; |
redo A; |
1373 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1374 |
|
!!!cp (125); |
1375 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1376 |
## reconsume |
## reconsume |
1377 |
|
|
1379 |
|
|
1380 |
redo A; |
redo A; |
1381 |
} else { |
} else { |
1382 |
|
!!!cp (126); |
1383 |
$token->{data} .= chr ($self->{next_char}); |
$token->{data} .= chr ($self->{next_char}); |
1384 |
!!!next-input-character; |
!!!next-input-character; |
1385 |
redo BC; |
redo BC; |
1386 |
} |
} |
1387 |
} # BC |
} # BC |
1388 |
|
|
1389 |
|
die "$0: _get_next_token: unexpected case [BC]"; |
1390 |
} elsif ($self->{state} == MARKUP_DECLARATION_OPEN_STATE) { |
} elsif ($self->{state} == MARKUP_DECLARATION_OPEN_STATE) { |
1391 |
## (only happen if PCDATA state) |
## (only happen if PCDATA state) |
1392 |
|
|
1397 |
!!!next-input-character; |
!!!next-input-character; |
1398 |
push @next_char, $self->{next_char}; |
push @next_char, $self->{next_char}; |
1399 |
if ($self->{next_char} == 0x002D) { # - |
if ($self->{next_char} == 0x002D) { # - |
1400 |
|
!!!cp (127); |
1401 |
$self->{current_token} = {type => COMMENT_TOKEN, data => ''}; |
$self->{current_token} = {type => COMMENT_TOKEN, data => ''}; |
1402 |
$self->{state} = COMMENT_START_STATE; |
$self->{state} = COMMENT_START_STATE; |
1403 |
!!!next-input-character; |
!!!next-input-character; |
1404 |
redo A; |
redo A; |
1405 |
|
} else { |
1406 |
|
!!!cp (128); |
1407 |
} |
} |
1408 |
} elsif ($self->{next_char} == 0x0044 or # D |
} elsif ($self->{next_char} == 0x0044 or # D |
1409 |
$self->{next_char} == 0x0064) { # d |
$self->{next_char} == 0x0064) { # d |
1431 |
push @next_char, $self->{next_char}; |
push @next_char, $self->{next_char}; |
1432 |
if ($self->{next_char} == 0x0045 or # E |
if ($self->{next_char} == 0x0045 or # E |
1433 |
$self->{next_char} == 0x0065) { # e |
$self->{next_char} == 0x0065) { # e |
1434 |
## ISSUE: What a stupid code this is! |
!!!cp (129); |
1435 |
|
## TODO: What a stupid code this is! |
1436 |
$self->{state} = DOCTYPE_STATE; |
$self->{state} = DOCTYPE_STATE; |
1437 |
!!!next-input-character; |
!!!next-input-character; |
1438 |
redo A; |
redo A; |
1439 |
|
} else { |
1440 |
|
!!!cp (130); |
1441 |
} |
} |
1442 |
|
} else { |
1443 |
|
!!!cp (131); |
1444 |
} |
} |
1445 |
|
} else { |
1446 |
|
!!!cp (132); |
1447 |
} |
} |
1448 |
|
} else { |
1449 |
|
!!!cp (133); |
1450 |
} |
} |
1451 |
|
} else { |
1452 |
|
!!!cp (134); |
1453 |
} |
} |
1454 |
|
} else { |
1455 |
|
!!!cp (135); |
1456 |
} |
} |
1457 |
|
} else { |
1458 |
|
!!!cp (136); |
1459 |
} |
} |
1460 |
|
|
1461 |
!!!parse-error (type => 'bogus comment'); |
!!!parse-error (type => 'bogus comment'); |
1468 |
## ISSUE: spec is somewhat unclear on "is the first character that will be in the comment"; what is "that will be in the comment" is what the algorithm defines, isn't it? |
## ISSUE: spec is somewhat unclear on "is the first character that will be in the comment"; what is "that will be in the comment" is what the algorithm defines, isn't it? |
1469 |
} elsif ($self->{state} == COMMENT_START_STATE) { |
} elsif ($self->{state} == COMMENT_START_STATE) { |
1470 |
if ($self->{next_char} == 0x002D) { # - |
if ($self->{next_char} == 0x002D) { # - |
1471 |
|
!!!cp (137); |
1472 |
$self->{state} = COMMENT_START_DASH_STATE; |
$self->{state} = COMMENT_START_DASH_STATE; |
1473 |
!!!next-input-character; |
!!!next-input-character; |
1474 |
redo A; |
redo A; |
1475 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1476 |
|
!!!cp (138); |
1477 |
!!!parse-error (type => 'bogus comment'); |
!!!parse-error (type => 'bogus comment'); |
1478 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1479 |
!!!next-input-character; |
!!!next-input-character; |
1482 |
|
|
1483 |
redo A; |
redo A; |
1484 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1485 |
|
!!!cp (139); |
1486 |
!!!parse-error (type => 'unclosed comment'); |
!!!parse-error (type => 'unclosed comment'); |
1487 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1488 |
## reconsume |
## reconsume |
1491 |
|
|
1492 |
redo A; |
redo A; |
1493 |
} else { |
} else { |
1494 |
|
!!!cp (140); |
1495 |
$self->{current_token}->{data} # comment |
$self->{current_token}->{data} # comment |
1496 |
.= chr ($self->{next_char}); |
.= chr ($self->{next_char}); |
1497 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
1500 |
} |
} |
1501 |
} elsif ($self->{state} == COMMENT_START_DASH_STATE) { |
} elsif ($self->{state} == COMMENT_START_DASH_STATE) { |
1502 |
if ($self->{next_char} == 0x002D) { # - |
if ($self->{next_char} == 0x002D) { # - |
1503 |
|
!!!cp (141); |
1504 |
$self->{state} = COMMENT_END_STATE; |
$self->{state} = COMMENT_END_STATE; |
1505 |
!!!next-input-character; |
!!!next-input-character; |
1506 |
redo A; |
redo A; |
1507 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1508 |
|
!!!cp (142); |
1509 |
!!!parse-error (type => 'bogus comment'); |
!!!parse-error (type => 'bogus comment'); |
1510 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1511 |
!!!next-input-character; |
!!!next-input-character; |
1514 |
|
|
1515 |
redo A; |
redo A; |
1516 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1517 |
|
!!!cp (143); |
1518 |
!!!parse-error (type => 'unclosed comment'); |
!!!parse-error (type => 'unclosed comment'); |
1519 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1520 |
## reconsume |
## reconsume |
1523 |
|
|
1524 |
redo A; |
redo A; |
1525 |
} else { |
} else { |
1526 |
|
!!!cp (144); |
1527 |
$self->{current_token}->{data} # comment |
$self->{current_token}->{data} # comment |
1528 |
.= '-' . chr ($self->{next_char}); |
.= '-' . chr ($self->{next_char}); |
1529 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
1532 |
} |
} |
1533 |
} elsif ($self->{state} == COMMENT_STATE) { |
} elsif ($self->{state} == COMMENT_STATE) { |
1534 |
if ($self->{next_char} == 0x002D) { # - |
if ($self->{next_char} == 0x002D) { # - |
1535 |
|
!!!cp (145); |
1536 |
$self->{state} = COMMENT_END_DASH_STATE; |
$self->{state} = COMMENT_END_DASH_STATE; |
1537 |
!!!next-input-character; |
!!!next-input-character; |
1538 |
redo A; |
redo A; |
1539 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1540 |
|
!!!cp (146); |
1541 |
!!!parse-error (type => 'unclosed comment'); |
!!!parse-error (type => 'unclosed comment'); |
1542 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1543 |
## reconsume |
## reconsume |
1546 |
|
|
1547 |
redo A; |
redo A; |
1548 |
} else { |
} else { |
1549 |
|
!!!cp (147); |
1550 |
$self->{current_token}->{data} .= chr ($self->{next_char}); # comment |
$self->{current_token}->{data} .= chr ($self->{next_char}); # comment |
1551 |
## Stay in the state |
## Stay in the state |
1552 |
!!!next-input-character; |
!!!next-input-character; |
1554 |
} |
} |
1555 |
} elsif ($self->{state} == COMMENT_END_DASH_STATE) { |
} elsif ($self->{state} == COMMENT_END_DASH_STATE) { |
1556 |
if ($self->{next_char} == 0x002D) { # - |
if ($self->{next_char} == 0x002D) { # - |
1557 |
|
!!!cp (148); |
1558 |
$self->{state} = COMMENT_END_STATE; |
$self->{state} = COMMENT_END_STATE; |
1559 |
!!!next-input-character; |
!!!next-input-character; |
1560 |
redo A; |
redo A; |
1561 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1562 |
|
!!!cp (149); |
1563 |
!!!parse-error (type => 'unclosed comment'); |
!!!parse-error (type => 'unclosed comment'); |
1564 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1565 |
## reconsume |
## reconsume |
1568 |
|
|
1569 |
redo A; |
redo A; |
1570 |
} else { |
} else { |
1571 |
|
!!!cp (150); |
1572 |
$self->{current_token}->{data} .= '-' . chr ($self->{next_char}); # comment |
$self->{current_token}->{data} .= '-' . chr ($self->{next_char}); # comment |
1573 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
1574 |
!!!next-input-character; |
!!!next-input-character; |
1576 |
} |
} |
1577 |
} elsif ($self->{state} == COMMENT_END_STATE) { |
} elsif ($self->{state} == COMMENT_END_STATE) { |
1578 |
if ($self->{next_char} == 0x003E) { # > |
if ($self->{next_char} == 0x003E) { # > |
1579 |
|
!!!cp (151); |
1580 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1581 |
!!!next-input-character; |
!!!next-input-character; |
1582 |
|
|
1584 |
|
|
1585 |
redo A; |
redo A; |
1586 |
} elsif ($self->{next_char} == 0x002D) { # - |
} elsif ($self->{next_char} == 0x002D) { # - |
1587 |
|
!!!cp (152); |
1588 |
!!!parse-error (type => 'dash in comment'); |
!!!parse-error (type => 'dash in comment'); |
1589 |
$self->{current_token}->{data} .= '-'; # comment |
$self->{current_token}->{data} .= '-'; # comment |
1590 |
## Stay in the state |
## Stay in the state |
1591 |
!!!next-input-character; |
!!!next-input-character; |
1592 |
redo A; |
redo A; |
1593 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1594 |
|
!!!cp (153); |
1595 |
!!!parse-error (type => 'unclosed comment'); |
!!!parse-error (type => 'unclosed comment'); |
1596 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1597 |
## reconsume |
## reconsume |
1600 |
|
|
1601 |
redo A; |
redo A; |
1602 |
} else { |
} else { |
1603 |
|
!!!cp (154); |
1604 |
!!!parse-error (type => 'dash in comment'); |
!!!parse-error (type => 'dash in comment'); |
1605 |
$self->{current_token}->{data} .= '--' . chr ($self->{next_char}); # comment |
$self->{current_token}->{data} .= '--' . chr ($self->{next_char}); # comment |
1606 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
1613 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
1614 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1615 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1616 |
|
!!!cp (155); |
1617 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
1618 |
!!!next-input-character; |
!!!next-input-character; |
1619 |
redo A; |
redo A; |
1620 |
} else { |
} else { |
1621 |
|
!!!cp (156); |
1622 |
!!!parse-error (type => 'no space before DOCTYPE name'); |
!!!parse-error (type => 'no space before DOCTYPE name'); |
1623 |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
$self->{state} = BEFORE_DOCTYPE_NAME_STATE; |
1624 |
## reconsume |
## reconsume |
1630 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
1631 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1632 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1633 |
|
!!!cp (157); |
1634 |
## Stay in the state |
## Stay in the state |
1635 |
!!!next-input-character; |
!!!next-input-character; |
1636 |
redo A; |
redo A; |
1637 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1638 |
|
!!!cp (158); |
1639 |
!!!parse-error (type => 'no DOCTYPE name'); |
!!!parse-error (type => 'no DOCTYPE name'); |
1640 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1641 |
!!!next-input-character; |
!!!next-input-character; |
1643 |
!!!emit ({type => DOCTYPE_TOKEN, quirks => 1}); |
!!!emit ({type => DOCTYPE_TOKEN, quirks => 1}); |
1644 |
|
|
1645 |
redo A; |
redo A; |
1646 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1647 |
|
!!!cp (159); |
1648 |
!!!parse-error (type => 'no DOCTYPE name'); |
!!!parse-error (type => 'no DOCTYPE name'); |
1649 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1650 |
## reconsume |
## reconsume |
1653 |
|
|
1654 |
redo A; |
redo A; |
1655 |
} else { |
} else { |
1656 |
|
!!!cp (160); |
1657 |
$self->{current_token} |
$self->{current_token} |
1658 |
= {type => DOCTYPE_TOKEN, |
= {type => DOCTYPE_TOKEN, |
1659 |
name => chr ($self->{next_char}), |
name => chr ($self->{next_char}), |
1671 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
1672 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1673 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1674 |
|
!!!cp (161); |
1675 |
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
1676 |
!!!next-input-character; |
!!!next-input-character; |
1677 |
redo A; |
redo A; |
1678 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1679 |
|
!!!cp (162); |
1680 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1681 |
!!!next-input-character; |
!!!next-input-character; |
1682 |
|
|
1684 |
|
|
1685 |
redo A; |
redo A; |
1686 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1687 |
|
!!!cp (163); |
1688 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
1689 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1690 |
## reconsume |
## reconsume |
1694 |
|
|
1695 |
redo A; |
redo A; |
1696 |
} else { |
} else { |
1697 |
|
!!!cp (164); |
1698 |
$self->{current_token}->{name} |
$self->{current_token}->{name} |
1699 |
.= chr ($self->{next_char}); # DOCTYPE |
.= chr ($self->{next_char}); # DOCTYPE |
1700 |
## Stay in the state |
## Stay in the state |
1707 |
$self->{next_char} == 0x000B or # VT |
$self->{next_char} == 0x000B or # VT |
1708 |
$self->{next_char} == 0x000C or # FF |
$self->{next_char} == 0x000C or # FF |
1709 |
$self->{next_char} == 0x0020) { # SP |
$self->{next_char} == 0x0020) { # SP |
1710 |
|
!!!cp (165); |
1711 |
## Stay in the state |
## Stay in the state |
1712 |
!!!next-input-character; |
!!!next-input-character; |
1713 |
redo A; |
redo A; |
1714 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1715 |
|
!!!cp (166); |
1716 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1717 |
!!!next-input-character; |
!!!next-input-character; |
1718 |
|
|
1720 |
|
|
1721 |
redo A; |
redo A; |
1722 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1723 |
|
!!!cp (167); |
1724 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
1725 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1726 |
## reconsume |
## reconsume |
1746 |
!!!next-input-character; |
!!!next-input-character; |
1747 |
if ($self->{next_char} == 0x0043 or # C |
if ($self->{next_char} == 0x0043 or # C |
1748 |
$self->{next_char} == 0x0063) { # c |
$self->{next_char} == 0x0063) { # c |
1749 |
|
!!!cp (168); |
1750 |
$self->{state} = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE; |
$self->{state} = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE; |
1751 |
!!!next-input-character; |
!!!next-input-character; |
1752 |
redo A; |
redo A; |
1753 |
|
} else { |
1754 |
|
!!!cp (169); |
1755 |
} |
} |
1756 |
|
} else { |
1757 |
|
!!!cp (170); |
1758 |
} |
} |
1759 |
|
} else { |
1760 |
|
!!!cp (171); |
1761 |
} |
} |
1762 |
|
} else { |
1763 |
|
!!!cp (172); |
1764 |
} |
} |
1765 |
|
} else { |
1766 |
|
!!!cp (173); |
1767 |
} |
} |
1768 |
|
|
1769 |
# |
# |
1784 |
!!!next-input-character; |
!!!next-input-character; |
1785 |
if ($self->{next_char} == 0x004D or # M |
if ($self->{next_char} == 0x004D or # M |
1786 |
$self->{next_char} == 0x006D) { # m |
$self->{next_char} == 0x006D) { # m |
1787 |
|
!!!cp (174); |
1788 |
$self->{state} = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE; |
$self->{state} = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE; |
1789 |
!!!next-input-character; |
!!!next-input-character; |
1790 |
redo A; |
redo A; |
1791 |
|
} else { |
1792 |
|
!!!cp (175); |
1793 |
} |
} |
1794 |
|
} else { |
1795 |
|
!!!cp (176); |
1796 |
} |
} |
1797 |
|
} else { |
1798 |
|
!!!cp (177); |
1799 |
} |
} |
1800 |
|
} else { |
1801 |
|
!!!cp (178); |
1802 |
} |
} |
1803 |
|
} else { |
1804 |
|
!!!cp (179); |
1805 |
} |
} |
1806 |
|
|
1807 |
# |
# |
1808 |
} else { |
} else { |
1809 |
|
!!!cp (180); |
1810 |
!!!next-input-character; |
!!!next-input-character; |
1811 |
# |
# |
1812 |
} |
} |
1822 |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
1823 |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
1824 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
1825 |
|
!!!cp (181); |
1826 |
## Stay in the state |
## Stay in the state |
1827 |
!!!next-input-character; |
!!!next-input-character; |
1828 |
redo A; |
redo A; |
1829 |
} elsif ($self->{next_char} eq 0x0022) { # " |
} elsif ($self->{next_char} eq 0x0022) { # " |
1830 |
|
!!!cp (182); |
1831 |
$self->{current_token}->{public_identifier} = ''; # DOCTYPE |
$self->{current_token}->{public_identifier} = ''; # DOCTYPE |
1832 |
$self->{state} = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; |
1833 |
!!!next-input-character; |
!!!next-input-character; |
1834 |
redo A; |
redo A; |
1835 |
} elsif ($self->{next_char} eq 0x0027) { # ' |
} elsif ($self->{next_char} eq 0x0027) { # ' |
1836 |
|
!!!cp (183); |
1837 |
$self->{current_token}->{public_identifier} = ''; # DOCTYPE |
$self->{current_token}->{public_identifier} = ''; # DOCTYPE |
1838 |
$self->{state} = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; |
1839 |
!!!next-input-character; |
!!!next-input-character; |
1840 |
redo A; |
redo A; |
1841 |
} elsif ($self->{next_char} eq 0x003E) { # > |
} elsif ($self->{next_char} eq 0x003E) { # > |
1842 |
|
!!!cp (184); |
1843 |
!!!parse-error (type => 'no PUBLIC literal'); |
!!!parse-error (type => 'no PUBLIC literal'); |
1844 |
|
|
1845 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1850 |
|
|
1851 |
redo A; |
redo A; |
1852 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1853 |
|
!!!cp (185); |
1854 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
1855 |
|
|
1856 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1861 |
|
|
1862 |
redo A; |
redo A; |
1863 |
} else { |
} else { |
1864 |
|
!!!cp (186); |
1865 |
!!!parse-error (type => 'string after PUBLIC'); |
!!!parse-error (type => 'string after PUBLIC'); |
1866 |
$self->{current_token}->{quirks} = 1; |
$self->{current_token}->{quirks} = 1; |
1867 |
|
|
1871 |
} |
} |
1872 |
} elsif ($self->{state} == DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE) { |
} elsif ($self->{state} == DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE) { |
1873 |
if ($self->{next_char} == 0x0022) { # " |
if ($self->{next_char} == 0x0022) { # " |
1874 |
|
!!!cp (187); |
1875 |
$self->{state} = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; |
$self->{state} = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; |
1876 |
!!!next-input-character; |
!!!next-input-character; |
1877 |
redo A; |
redo A; |
1878 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1879 |
|
!!!cp (188); |
1880 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
1881 |
|
|
1882 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1887 |
|
|
1888 |
redo A; |
redo A; |
1889 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1890 |
|
!!!cp (189); |
1891 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
1892 |
|
|
1893 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1898 |
|
|
1899 |
redo A; |
redo A; |
1900 |
} else { |
} else { |
1901 |
|
!!!cp (190); |
1902 |
$self->{current_token}->{public_identifier} # DOCTYPE |
$self->{current_token}->{public_identifier} # DOCTYPE |
1903 |
.= chr $self->{next_char}; |
.= chr $self->{next_char}; |
1904 |
## Stay in the state |
## Stay in the state |
1907 |
} |
} |
1908 |
} elsif ($self->{state} == DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE) { |
} elsif ($self->{state} == DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE) { |
1909 |
if ($self->{next_char} == 0x0027) { # ' |
if ($self->{next_char} == 0x0027) { # ' |
1910 |
|
!!!cp (191); |
1911 |
$self->{state} = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; |
$self->{state} = AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE; |
1912 |
!!!next-input-character; |
!!!next-input-character; |
1913 |
redo A; |
redo A; |
1914 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1915 |
|
!!!cp (192); |
1916 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
1917 |
|
|
1918 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1923 |
|
|
1924 |
redo A; |
redo A; |
1925 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1926 |
|
!!!cp (193); |
1927 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
1928 |
|
|
1929 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1934 |
|
|
1935 |
redo A; |
redo A; |
1936 |
} else { |
} else { |
1937 |
|
!!!cp (194); |
1938 |
$self->{current_token}->{public_identifier} # DOCTYPE |
$self->{current_token}->{public_identifier} # DOCTYPE |
1939 |
.= chr $self->{next_char}; |
.= chr $self->{next_char}; |
1940 |
## Stay in the state |
## Stay in the state |
1946 |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
1947 |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
1948 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
1949 |
|
!!!cp (195); |
1950 |
## Stay in the state |
## Stay in the state |
1951 |
!!!next-input-character; |
!!!next-input-character; |
1952 |
redo A; |
redo A; |
1953 |
} elsif ($self->{next_char} == 0x0022) { # " |
} elsif ($self->{next_char} == 0x0022) { # " |
1954 |
|
!!!cp (196); |
1955 |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
1956 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
1957 |
!!!next-input-character; |
!!!next-input-character; |
1958 |
redo A; |
redo A; |
1959 |
} elsif ($self->{next_char} == 0x0027) { # ' |
} elsif ($self->{next_char} == 0x0027) { # ' |
1960 |
|
!!!cp (197); |
1961 |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
1962 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
1963 |
!!!next-input-character; |
!!!next-input-character; |
1964 |
redo A; |
redo A; |
1965 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
1966 |
|
!!!cp (198); |
1967 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1968 |
!!!next-input-character; |
!!!next-input-character; |
1969 |
|
|
1971 |
|
|
1972 |
redo A; |
redo A; |
1973 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
1974 |
|
!!!cp (199); |
1975 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
1976 |
|
|
1977 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
1982 |
|
|
1983 |
redo A; |
redo A; |
1984 |
} else { |
} else { |
1985 |
|
!!!cp (200); |
1986 |
!!!parse-error (type => 'string after PUBLIC literal'); |
!!!parse-error (type => 'string after PUBLIC literal'); |
1987 |
$self->{current_token}->{quirks} = 1; |
$self->{current_token}->{quirks} = 1; |
1988 |
|
|
1995 |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
1996 |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
1997 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
1998 |
|
!!!cp (201); |
1999 |
## Stay in the state |
## Stay in the state |
2000 |
!!!next-input-character; |
!!!next-input-character; |
2001 |
redo A; |
redo A; |
2002 |
} elsif ($self->{next_char} == 0x0022) { # " |
} elsif ($self->{next_char} == 0x0022) { # " |
2003 |
|
!!!cp (202); |
2004 |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
2005 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; |
2006 |
!!!next-input-character; |
!!!next-input-character; |
2007 |
redo A; |
redo A; |
2008 |
} elsif ($self->{next_char} == 0x0027) { # ' |
} elsif ($self->{next_char} == 0x0027) { # ' |
2009 |
|
!!!cp (203); |
2010 |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
$self->{current_token}->{system_identifier} = ''; # DOCTYPE |
2011 |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
$self->{state} = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; |
2012 |
!!!next-input-character; |
!!!next-input-character; |
2013 |
redo A; |
redo A; |
2014 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
2015 |
|
!!!cp (204); |
2016 |
!!!parse-error (type => 'no SYSTEM literal'); |
!!!parse-error (type => 'no SYSTEM literal'); |
2017 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2018 |
!!!next-input-character; |
!!!next-input-character; |
2022 |
|
|
2023 |
redo A; |
redo A; |
2024 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
2025 |
|
!!!cp (205); |
2026 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2027 |
|
|
2028 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2033 |
|
|
2034 |
redo A; |
redo A; |
2035 |
} else { |
} else { |
2036 |
|
!!!cp (206); |
2037 |
!!!parse-error (type => 'string after SYSTEM'); |
!!!parse-error (type => 'string after SYSTEM'); |
2038 |
$self->{current_token}->{quirks} = 1; |
$self->{current_token}->{quirks} = 1; |
2039 |
|
|
2043 |
} |
} |
2044 |
} elsif ($self->{state} == DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE) { |
} elsif ($self->{state} == DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE) { |
2045 |
if ($self->{next_char} == 0x0022) { # " |
if ($self->{next_char} == 0x0022) { # " |
2046 |
|
!!!cp (207); |
2047 |
$self->{state} = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; |
$self->{state} = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; |
2048 |
!!!next-input-character; |
!!!next-input-character; |
2049 |
redo A; |
redo A; |
2050 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
2051 |
|
!!!cp (208); |
2052 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2053 |
|
|
2054 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2059 |
|
|
2060 |
redo A; |
redo A; |
2061 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
2062 |
|
!!!cp (209); |
2063 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2064 |
|
|
2065 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2070 |
|
|
2071 |
redo A; |
redo A; |
2072 |
} else { |
} else { |
2073 |
|
!!!cp (210); |
2074 |
$self->{current_token}->{system_identifier} # DOCTYPE |
$self->{current_token}->{system_identifier} # DOCTYPE |
2075 |
.= chr $self->{next_char}; |
.= chr $self->{next_char}; |
2076 |
## Stay in the state |
## Stay in the state |
2079 |
} |
} |
2080 |
} elsif ($self->{state} == DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE) { |
} elsif ($self->{state} == DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE) { |
2081 |
if ($self->{next_char} == 0x0027) { # ' |
if ($self->{next_char} == 0x0027) { # ' |
2082 |
|
!!!cp (211); |
2083 |
$self->{state} = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; |
$self->{state} = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; |
2084 |
!!!next-input-character; |
!!!next-input-character; |
2085 |
redo A; |
redo A; |
2086 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
2087 |
|
!!!cp (212); |
2088 |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
!!!parse-error (type => 'unclosed PUBLIC literal'); |
2089 |
|
|
2090 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2095 |
|
|
2096 |
redo A; |
redo A; |
2097 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
2098 |
|
!!!cp (213); |
2099 |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
!!!parse-error (type => 'unclosed SYSTEM literal'); |
2100 |
|
|
2101 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2106 |
|
|
2107 |
redo A; |
redo A; |
2108 |
} else { |
} else { |
2109 |
|
!!!cp (214); |
2110 |
$self->{current_token}->{system_identifier} # DOCTYPE |
$self->{current_token}->{system_identifier} # DOCTYPE |
2111 |
.= chr $self->{next_char}; |
.= chr $self->{next_char}; |
2112 |
## Stay in the state |
## Stay in the state |
2118 |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
0x0009 => 1, 0x000A => 1, 0x000B => 1, 0x000C => 1, 0x0020 => 1, |
2119 |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
#0x000D => 1, # HT, LF, VT, FF, SP, CR |
2120 |
}->{$self->{next_char}}) { |
}->{$self->{next_char}}) { |
2121 |
|
!!!cp (215); |
2122 |
## Stay in the state |
## Stay in the state |
2123 |
!!!next-input-character; |
!!!next-input-character; |
2124 |
redo A; |
redo A; |
2125 |
} elsif ($self->{next_char} == 0x003E) { # > |
} elsif ($self->{next_char} == 0x003E) { # > |
2126 |
|
!!!cp (216); |
2127 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2128 |
!!!next-input-character; |
!!!next-input-character; |
2129 |
|
|
2131 |
|
|
2132 |
redo A; |
redo A; |
2133 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
2134 |
|
!!!cp (217); |
2135 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2136 |
|
|
2137 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2142 |
|
|
2143 |
redo A; |
redo A; |
2144 |
} else { |
} else { |
2145 |
|
!!!cp (218); |
2146 |
!!!parse-error (type => 'string after SYSTEM literal'); |
!!!parse-error (type => 'string after SYSTEM literal'); |
2147 |
#$self->{current_token}->{quirks} = 1; |
#$self->{current_token}->{quirks} = 1; |
2148 |
|
|
2152 |
} |
} |
2153 |
} elsif ($self->{state} == BOGUS_DOCTYPE_STATE) { |
} elsif ($self->{state} == BOGUS_DOCTYPE_STATE) { |
2154 |
if ($self->{next_char} == 0x003E) { # > |
if ($self->{next_char} == 0x003E) { # > |
2155 |
|
!!!cp (219); |
2156 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2157 |
!!!next-input-character; |
!!!next-input-character; |
2158 |
|
|
2160 |
|
|
2161 |
redo A; |
redo A; |
2162 |
} elsif ($self->{next_char} == -1) { |
} elsif ($self->{next_char} == -1) { |
2163 |
|
!!!cp (220); |
2164 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2165 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2166 |
## reconsume |
## reconsume |
2169 |
|
|
2170 |
redo A; |
redo A; |
2171 |
} else { |
} else { |
2172 |
|
!!!cp (221); |
2173 |
## Stay in the state |
## Stay in the state |
2174 |
!!!next-input-character; |
!!!next-input-character; |
2175 |
redo A; |
redo A; |