@@ 517-541 (lines=25) @@ | ||
514 | the "anything else" entry below. */ |
|
515 | $this->state = 'entityData'; |
|
516 | ||
517 | } elseif ($char === '-') { |
|
518 | /* If the content model flag is set to either the RCDATA state or |
|
519 | the CDATA state, and the escape flag is false, and there are at |
|
520 | least three characters before this one in the input stream, and the |
|
521 | last four characters in the input stream, including this one, are |
|
522 | U+003C LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, |
|
523 | and U+002D HYPHEN-MINUS ("<!--"), then set the escape flag to true. */ |
|
524 | if (($this->content_model === self::RCDATA || $this->content_model === |
|
525 | self::CDATA) && $this->escape === false && |
|
526 | $this->char >= 3 && $this->character($this->char - 4, 4) === '<!--' |
|
527 | ) { |
|
528 | $this->escape = true; |
|
529 | } |
|
530 | ||
531 | /* In any case, emit the input character as a character token. Stay |
|
532 | in the data state. */ |
|
533 | $this->emitToken( |
|
534 | array( |
|
535 | 'type' => self::CHARACTR, |
|
536 | 'data' => $char |
|
537 | ) |
|
538 | ); |
|
539 | ||
540 | /* U+003C LESS-THAN SIGN (<) */ |
|
541 | } elseif ($char === '<' && ($this->content_model === self::PCDATA || |
|
542 | (($this->content_model === self::RCDATA || |
|
543 | $this->content_model === self::CDATA) && $this->escape === false)) |
|
544 | ) { |
|
@@ 556-578 (lines=23) @@ | ||
553 | $this->state = 'tagOpen'; |
|
554 | ||
555 | /* U+003E GREATER-THAN SIGN (>) */ |
|
556 | } elseif ($char === '>') { |
|
557 | /* If the content model flag is set to either the RCDATA state or |
|
558 | the CDATA state, and the escape flag is true, and the last three |
|
559 | characters in the input stream including this one are U+002D |
|
560 | HYPHEN-MINUS, U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN ("-->"), |
|
561 | set the escape flag to false. */ |
|
562 | if (($this->content_model === self::RCDATA || |
|
563 | $this->content_model === self::CDATA) && $this->escape === true && |
|
564 | $this->character($this->char, 3) === '-->' |
|
565 | ) { |
|
566 | $this->escape = false; |
|
567 | } |
|
568 | ||
569 | /* In any case, emit the input character as a character token. |
|
570 | Stay in the data state. */ |
|
571 | $this->emitToken( |
|
572 | array( |
|
573 | 'type' => self::CHARACTR, |
|
574 | 'data' => $char |
|
575 | ) |
|
576 | ); |
|
577 | ||
578 | } elseif ($this->char === $this->EOF) { |
|
579 | /* EOF |
|
580 | Emit an end-of-file token. */ |
|
581 | $this->EOF(); |