@@ 861-885 (lines=25) @@ | ||
858 | } |
|
859 | } |
|
860 | ||
861 | private function commentState() { |
|
862 | /* Consume the next input character: */ |
|
863 | $this->char++; |
|
864 | $char = $this->char(); |
|
865 | ||
866 | /* U+002D HYPHEN-MINUS (-) */ |
|
867 | if($char === '-') { |
|
868 | /* Switch to the comment dash state */ |
|
869 | $this->state = 'commentDash'; |
|
870 | ||
871 | /* EOF */ |
|
872 | } elseif($this->char === $this->EOF) { |
|
873 | /* Parse error. Emit the comment token. Reconsume the EOF character |
|
874 | in the data state. */ |
|
875 | $this->emitToken($this->token); |
|
876 | $this->char--; |
|
877 | $this->state = 'data'; |
|
878 | ||
879 | /* Anything else */ |
|
880 | } else { |
|
881 | /* Append the input character to the comment token's data. Stay in |
|
882 | the comment state. */ |
|
883 | $this->token['data'] .= $char; |
|
884 | } |
|
885 | } |
|
886 | ||
887 | private function commentDashState() { |
|
888 | /* Consume the next input character: */ |
|
@@ 887-912 (lines=26) @@ | ||
884 | } |
|
885 | } |
|
886 | ||
887 | private function commentDashState() { |
|
888 | /* Consume the next input character: */ |
|
889 | $this->char++; |
|
890 | $char = $this->char(); |
|
891 | ||
892 | /* U+002D HYPHEN-MINUS (-) */ |
|
893 | if($char === '-') { |
|
894 | /* Switch to the comment end state */ |
|
895 | $this->state = 'commentEnd'; |
|
896 | ||
897 | /* EOF */ |
|
898 | } elseif($this->char === $this->EOF) { |
|
899 | /* Parse error. Emit the comment token. Reconsume the EOF character |
|
900 | in the data state. */ |
|
901 | $this->emitToken($this->token); |
|
902 | $this->char--; |
|
903 | $this->state = 'data'; |
|
904 | ||
905 | /* Anything else */ |
|
906 | } else { |
|
907 | /* Append a U+002D HYPHEN-MINUS (-) character and the input |
|
908 | character to the comment token's data. Switch to the comment state. */ |
|
909 | $this->token['data'] .= '-'.$char; |
|
910 | $this->state = 'comment'; |
|
911 | } |
|
912 | } |
|
913 | ||
914 | private function commentEndState() { |
|
915 | /* Consume the next input character: */ |
|
@@ 1050-1067 (lines=18) @@ | ||
1047 | } |
|
1048 | } |
|
1049 | ||
1050 | private function bogusDoctypeState() { |
|
1051 | /* Consume the next input character: */ |
|
1052 | $this->char++; |
|
1053 | $char = $this->char(); |
|
1054 | ||
1055 | if($char === '>') { |
|
1056 | $this->emitToken($this->token); |
|
1057 | $this->state = 'data'; |
|
1058 | ||
1059 | } elseif($this->char === $this->EOF) { |
|
1060 | $this->emitToken($this->token); |
|
1061 | $this->char--; |
|
1062 | $this->state = 'data'; |
|
1063 | ||
1064 | } else { |
|
1065 | // Stay in the bogus DOCTYPE state. |
|
1066 | } |
|
1067 | } |
|
1068 | ||
1069 | private function entity() { |
|
1070 | $start = $this->char; |