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