105 |
sub COMMENT_START_DASH_STATE () { 15 } |
sub COMMENT_START_DASH_STATE () { 15 } |
106 |
sub COMMENT_STATE () { 16 } |
sub COMMENT_STATE () { 16 } |
107 |
sub COMMENT_END_STATE () { 17 } |
sub COMMENT_END_STATE () { 17 } |
108 |
|
sub COMMENT_END_BANG_STATE () { 102 } |
109 |
|
sub COMMENT_END_SPACE_STATE () { 103 } ## LAST |
110 |
sub COMMENT_END_DASH_STATE () { 18 } |
sub COMMENT_END_DASH_STATE () { 18 } |
111 |
sub BOGUS_COMMENT_STATE () { 19 } |
sub BOGUS_COMMENT_STATE () { 19 } |
112 |
sub DOCTYPE_STATE () { 20 } |
sub DOCTYPE_STATE () { 20 } |
950 |
if ({ |
if ({ |
951 |
0x0022 => 1, # " |
0x0022 => 1, # " |
952 |
0x0027 => 1, # ' |
0x0027 => 1, # ' |
953 |
|
0x003C => 1, # < |
954 |
0x003D => 1, # = |
0x003D => 1, # = |
955 |
}->{$self->{nc}}) { |
}->{$self->{nc}}) { |
956 |
!!!cp (55); |
!!!cp (55); |
1073 |
|
|
1074 |
redo A; |
redo A; |
1075 |
} else { |
} else { |
1076 |
if ($self->{nc} == 0x0022 or # " |
if ({ |
1077 |
$self->{nc} == 0x0027) { # ' |
0x0022 => 1, # " |
1078 |
|
0x0027 => 1, # ' |
1079 |
|
0x003C => 1, # < |
1080 |
|
}->{$self->{nc}}) { |
1081 |
!!!cp (69); |
!!!cp (69); |
1082 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1083 |
!!!parse-error (type => 'bad attribute name'); |
!!!parse-error (type => 'bad attribute name'); |
1188 |
!!!cp (78.2); |
!!!cp (78.2); |
1189 |
} |
} |
1190 |
|
|
1191 |
if ($self->{nc} == 0x0022 or # " |
if ({ |
1192 |
$self->{nc} == 0x0027) { # ' |
0x0022 => 1, # " |
1193 |
|
0x0027 => 1, # ' |
1194 |
|
0x003C => 1, # < |
1195 |
|
}->{$self->{nc}}) { |
1196 |
!!!cp (78); |
!!!cp (78); |
1197 |
## XML5: Not a parse error. |
## XML5: Not a parse error. |
1198 |
!!!parse-error (type => 'bad attribute name'); |
!!!parse-error (type => 'bad attribute name'); |
2084 |
!!!next-input-character; |
!!!next-input-character; |
2085 |
redo A; |
redo A; |
2086 |
} |
} |
2087 |
} elsif ($self->{state} == COMMENT_END_STATE) { |
} elsif ($self->{state} == COMMENT_END_STATE or |
2088 |
|
$self->{state} == COMMENT_END_BANG_STATE) { |
2089 |
## XML5: "Comment end state" and "DOCTYPE comment end state". |
## XML5: "Comment end state" and "DOCTYPE comment end state". |
2090 |
|
## (No comment end bang state.) |
2091 |
|
|
2092 |
if ($self->{nc} == 0x003E) { # > |
if ($self->{nc} == 0x003E) { # > |
2093 |
if ($self->{in_subset}) { |
if ($self->{in_subset}) { |
2104 |
|
|
2105 |
redo A; |
redo A; |
2106 |
} elsif ($self->{nc} == 0x002D) { # - |
} elsif ($self->{nc} == 0x002D) { # - |
2107 |
!!!cp (152); |
if ($self->{state} == COMMENT_END_BANG_STATE) { |
2108 |
## XML5: Not a parse error. |
!!!cp (154.3); |
2109 |
!!!parse-error (type => 'dash in comment', |
$self->{ct}->{data} .= '--!'; # comment |
2110 |
line => $self->{line_prev}, |
$self->{state} = COMMENT_END_DASH_STATE; |
2111 |
column => $self->{column_prev}); |
} else { |
2112 |
$self->{ct}->{data} .= '-'; # comment |
!!!cp (152); |
2113 |
## Stay in the state |
## XML5: Not a parse error. |
2114 |
|
!!!parse-error (type => 'dash in comment', |
2115 |
|
line => $self->{line_prev}, |
2116 |
|
column => $self->{column_prev}); |
2117 |
|
$self->{ct}->{data} .= '-'; # comment |
2118 |
|
## Stay in the state |
2119 |
|
} |
2120 |
|
!!!next-input-character; |
2121 |
|
redo A; |
2122 |
|
} elsif ($self->{state} != COMMENT_END_BANG_STATE and |
2123 |
|
$is_space->{$self->{nc}}) { |
2124 |
|
!!!cp (152.1); |
2125 |
|
!!!parse-error (type => 'comment end space'); # XXX error type |
2126 |
|
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
2127 |
|
$self->{state} = COMMENT_END_SPACE_STATE; |
2128 |
|
!!!next-input-character; |
2129 |
|
redo A; |
2130 |
|
} elsif ($self->{state} != COMMENT_END_BANG_STATE and |
2131 |
|
$self->{nc} == 0x0021) { # ! |
2132 |
|
!!!cp (152.2); |
2133 |
|
!!!parse-error (type => 'comment end bang'); # XXX error type |
2134 |
|
$self->{state} = COMMENT_END_BANG_STATE; |
2135 |
!!!next-input-character; |
!!!next-input-character; |
2136 |
redo A; |
redo A; |
2137 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2144 |
$self->{state} = DATA_STATE; |
$self->{state} = DATA_STATE; |
2145 |
$self->{s_kwd} = ''; |
$self->{s_kwd} = ''; |
2146 |
} |
} |
2147 |
## reconsume |
## Reconsume. |
2148 |
|
|
2149 |
!!!emit ($self->{ct}); # comment |
!!!emit ($self->{ct}); # comment |
2150 |
|
|
2151 |
redo A; |
redo A; |
2152 |
} else { |
} else { |
2153 |
!!!cp (154); |
!!!cp (154); |
2154 |
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
if ($self->{state} == COMMENT_END_BANG_STATE) { |
2155 |
|
$self->{ct}->{data} .= '--!' . chr ($self->{nc}); # comment |
2156 |
|
} else { |
2157 |
|
$self->{ct}->{data} .= '--' . chr ($self->{nc}); # comment |
2158 |
|
} |
2159 |
$self->{state} = COMMENT_STATE; |
$self->{state} = COMMENT_STATE; |
2160 |
!!!next-input-character; |
!!!next-input-character; |
2161 |
redo A; |
redo A; |
2162 |
} |
} |
2163 |
|
} elsif ($self->{state} == COMMENT_END_SPACE_STATE) { |
2164 |
|
## XML5: Not exist. |
2165 |
|
|
2166 |
|
if ($self->{nc} == 0x003E) { # > |
2167 |
|
if ($self->{in_subset}) { |
2168 |
|
!!!cp (154.4); |
2169 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2170 |
|
} else { |
2171 |
|
!!!cp (154.5); |
2172 |
|
$self->{state} = DATA_STATE; |
2173 |
|
$self->{s_kwd} = ''; |
2174 |
|
} |
2175 |
|
!!!next-input-character; |
2176 |
|
|
2177 |
|
!!!emit ($self->{ct}); # comment |
2178 |
|
|
2179 |
|
redo A; |
2180 |
|
} elsif ($is_space->{$self->{nc}}) { |
2181 |
|
!!!cp (154.6); |
2182 |
|
$self->{ct}->{data} .= chr ($self->{nc}); # comment |
2183 |
|
## Stay in the state. |
2184 |
|
!!!next-input-character; |
2185 |
|
redo A; |
2186 |
|
} elsif ($self->{nc} == -1) { |
2187 |
|
!!!parse-error (type => 'unclosed comment'); |
2188 |
|
if ($self->{in_subset}) { |
2189 |
|
!!!cp (154.7); |
2190 |
|
$self->{state} = DOCTYPE_INTERNAL_SUBSET_STATE; |
2191 |
|
} else { |
2192 |
|
!!!cp (154.8); |
2193 |
|
$self->{state} = DATA_STATE; |
2194 |
|
$self->{s_kwd} = ''; |
2195 |
|
} |
2196 |
|
## Reconsume. |
2197 |
|
|
2198 |
|
!!!emit ($self->{ct}); # comment |
2199 |
|
|
2200 |
|
redo A; |
2201 |
|
} else { |
2202 |
|
!!!cp (154.9); |
2203 |
|
$self->{ct}->{data} .= chr ($self->{nc}); # comment |
2204 |
|
$self->{state} = COMMENT_STATE; |
2205 |
|
!!!next-input-character; |
2206 |
|
redo A; |
2207 |
|
} |
2208 |
} elsif ($self->{state} == DOCTYPE_STATE) { |
} elsif ($self->{state} == DOCTYPE_STATE) { |
2209 |
if ($is_space->{$self->{nc}}) { |
if ($is_space->{$self->{nc}}) { |
2210 |
!!!cp (155); |
!!!cp (155); |
2248 |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
!!!emit ($self->{ct}); # DOCTYPE (quirks) |
2249 |
|
|
2250 |
redo A; |
redo A; |
2251 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2252 |
|
!!!cp (158.1); |
2253 |
|
$self->{ct}->{name} # DOCTYPE |
2254 |
|
= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2255 |
|
delete $self->{ct}->{quirks}; |
2256 |
|
$self->{state} = DOCTYPE_NAME_STATE; |
2257 |
|
!!!next-input-character; |
2258 |
|
redo A; |
2259 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2260 |
!!!cp (159); |
!!!cp (159); |
2261 |
!!!parse-error (type => 'no DOCTYPE name'); |
!!!parse-error (type => 'no DOCTYPE name'); |
2302 |
!!!emit ($self->{ct}); # DOCTYPE |
!!!emit ($self->{ct}); # DOCTYPE |
2303 |
|
|
2304 |
redo A; |
redo A; |
2305 |
|
} elsif (0x0041 <= $self->{nc} and $self->{nc} <= 0x005A) { # A..Z |
2306 |
|
!!!cp (162.1); |
2307 |
|
$self->{ct}->{name} # DOCTYPE |
2308 |
|
.= chr ($self->{nc} + ($self->{is_xml} ? 0 : 0x0020)); |
2309 |
|
delete $self->{ct}->{quirks}; |
2310 |
|
## Stay in the state. |
2311 |
|
!!!next-input-character; |
2312 |
|
redo A; |
2313 |
} elsif ($self->{nc} == -1) { |
} elsif ($self->{nc} == -1) { |
2314 |
!!!cp (163); |
!!!cp (163); |
2315 |
!!!parse-error (type => 'unclosed DOCTYPE'); |
!!!parse-error (type => 'unclosed DOCTYPE'); |
2331 |
redo A; |
redo A; |
2332 |
} else { |
} else { |
2333 |
!!!cp (164); |
!!!cp (164); |
2334 |
$self->{ct}->{name} |
$self->{ct}->{name} .= chr ($self->{nc}); # DOCTYPE |
2335 |
.= chr ($self->{nc}); # DOCTYPE |
## Stay in the state. |
|
## Stay in the state |
|
2336 |
!!!next-input-character; |
!!!next-input-character; |
2337 |
redo A; |
redo A; |
2338 |
} |
} |