@@ 178-199 (lines=22) @@ | ||
175 | the "anything else" entry below. */ |
|
176 | $this->state = 'entityData'; |
|
177 | ||
178 | } elseif($char === '-') { |
|
179 | /* If the content model flag is set to either the RCDATA state or |
|
180 | the CDATA state, and the escape flag is false, and there are at |
|
181 | least three characters before this one in the input stream, and the |
|
182 | last four characters in the input stream, including this one, are |
|
183 | U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, |
|
184 | and U+002D HYPHEN-MINUS ("<!--"), then set the escape flag to true. */ |
|
185 | if(($this->content_model === self::RCDATA || $this->content_model === |
|
186 | self::CDATA) && $this->escape === false && |
|
187 | $this->char >= 3 && $this->character($this->char - 4, 4) === '<!--') { |
|
188 | $this->escape = true; |
|
189 | } |
|
190 | ||
191 | /* In any case, emit the input character as a character token. Stay |
|
192 | in the data state. */ |
|
193 | $this->emitToken(array( |
|
194 | 'type' => self::CHARACTR, |
|
195 | 'data' => $char |
|
196 | )); |
|
197 | ||
198 | /* U+003C LESS-THAN SIGN (<) */ |
|
199 | } elseif($char === '<' && ($this->content_model === self::PCDATA || |
|
200 | (($this->content_model === self::RCDATA || |
|
201 | $this->content_model === self::CDATA) && $this->escape === false))) { |
|
202 | /* When the content model flag is set to the PCDATA state: switch |
|
@@ 213-232 (lines=20) @@ | ||
210 | $this->state = 'tagOpen'; |
|
211 | ||
212 | /* U+003E GREATER-THAN SIGN (>) */ |
|
213 | } elseif($char === '>') { |
|
214 | /* If the content model flag is set to either the RCDATA state or |
|
215 | the CDATA state, and the escape flag is true, and the last three |
|
216 | characters in the input stream including this one are U+002D |
|
217 | HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN ("-->"), |
|
218 | set the escape flag to false. */ |
|
219 | if(($this->content_model === self::RCDATA || |
|
220 | $this->content_model === self::CDATA) && $this->escape === true && |
|
221 | $this->character($this->char, 3) === '-->') { |
|
222 | $this->escape = false; |
|
223 | } |
|
224 | ||
225 | /* In any case, emit the input character as a character token. |
|
226 | Stay in the data state. */ |
|
227 | $this->emitToken(array( |
|
228 | 'type' => self::CHARACTR, |
|
229 | 'data' => $char |
|
230 | )); |
|
231 | ||
232 | } elseif($this->char === $this->EOF) { |
|
233 | /* EOF |
|
234 | Emit an end-of-file token. */ |
|
235 | $this->EOF(); |