182 |
sub AFTER_NDATA_STATE () { 87 } |
sub AFTER_NDATA_STATE () { 87 } |
183 |
sub BEFORE_NOTATION_NAME_STATE () { 88 } |
sub BEFORE_NOTATION_NAME_STATE () { 88 } |
184 |
sub NOTATION_NAME_STATE () { 89 } |
sub NOTATION_NAME_STATE () { 89 } |
185 |
sub AFTER_NOTATION_NAME_STATE () { 90 } |
sub DOCTYPE_ENTITY_VALUE_DOUBLE_QUOTED_STATE () { 90 } |
186 |
sub BOGUS_MD_STATE () { 91 } |
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) |
2272 |
$self->{kwd} = chr $self->{nc}; |
$self->{kwd} = chr $self->{nc}; |
2273 |
!!!next-input-character; |
!!!next-input-character; |
2274 |
redo A; |
redo A; |
2275 |
## TODO: " and ' for ENTITY |
} 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 |
} elsif ($self->{is_xml} and |
2292 |
$self->{ct}->{type} == DOCTYPE_TOKEN and |
$self->{ct}->{type} == DOCTYPE_TOKEN and |
2293 |
$self->{nc} == 0x005B) { # [ |
$self->{nc} == 0x005B) { # [ |
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) { # ] |
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; |
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; |
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; |
4110 |
if ($self->{ct}->{type} == ATTLIST_TOKEN) { |
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) { |
} elsif ($self->{ct}->{type} == ELEMENT_TOKEN) { |
4113 |
## TODO: ... |
$self->{state} = AFTER_ELEMENT_NAME_STATE; |
|
$self->{state} = DOCTYPE_ATTLIST_NAME_AFTER_STATE; |
|
4114 |
} else { # ENTITY/NOTATION |
} else { # ENTITY/NOTATION |
4115 |
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
$self->{state} = AFTER_DOCTYPE_NAME_STATE; |
4116 |
} |
} |
4733 |
} |
} |
4734 |
} elsif ($self->{state} == NOTATION_NAME_STATE) { |
} elsif ($self->{state} == NOTATION_NAME_STATE) { |
4735 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
4736 |
$self->{state} = AFTER_NOTATION_NAME_STATE; |
$self->{state} = AFTER_MD_DEF_STATE; |
4737 |
!!!next-input-character; |
!!!next-input-character; |
4738 |
redo A; |
redo A; |
4739 |
} elsif ($self->{nc} == 0x003E) { # > |
} elsif ($self->{nc} == 0x003E) { # > |
4753 |
!!!next-input-character; |
!!!next-input-character; |
4754 |
redo A; |
redo A; |
4755 |
} |
} |
4756 |
} elsif ($self->{state} == AFTER_NOTATION_NAME_STATE) { |
} 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}}) { |
if ($is_space->{$self->{nc}}) { |
4882 |
## Stay in the state. |
## Stay in the state. |
4883 |
!!!next-input-character; |
!!!next-input-character; |
4884 |
redo A; |
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) { # > |
} 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; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4908 |
!!!next-input-character; |
!!!next-input-character; |
4909 |
!!!emit ($self->{ct}); # ENTITY |
!!!emit ($self->{ct}); # ELEMENT |
4910 |
redo A; |
redo A; |
4911 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
4912 |
!!!parse-error (type => 'unclosed md'); ## TODO: type |
!!!parse-error (type => 'unclosed md'); ## TODO: type |
4913 |
|
push @{$self->{ct}->{content}}, (')') x $self->{group_depth}; |
4914 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
4915 |
!!!next-input-character; |
!!!next-input-character; |
4916 |
!!!emit ($self->{ct}); # ENTITY |
!!!emit ($self->{ct}); # ELEMENT |
4917 |
redo A; |
redo A; |
4918 |
} else { |
} else { |
4919 |
!!!parse-error (type => 'string after notation name'); ## TODO: type |
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; |
$self->{state} = BOGUS_MD_STATE; |
5084 |
## Reconsume. |
## Reconsume. |
5085 |
redo A; |
redo A; |
5086 |
} |
} |
|
|
|
|
|
|
5087 |
} elsif ($self->{state} == BOGUS_MD_STATE) { |
} elsif ($self->{state} == BOGUS_MD_STATE) { |
5088 |
if ($self->{nc} == 0x003E) { # > |
if ($self->{nc} == 0x003E) { # > |
5089 |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |