diff options
author | Technosophos <[email protected]> | 2013-04-12 17:37:44 -0500 |
---|---|---|
committer | Technosophos <[email protected]> | 2013-04-12 17:37:44 -0500 |
commit | 1fdc03495c7702422638941235fde4fa3f327232 (patch) | |
tree | d5b4f19af3ee3ed3b4c909d2e8b02e72c4bf90a5 /src/HTML5/Parser | |
parent | 9b23c378489e40d4eeea1cb5d304acd3909c2d1d (diff) |
BogusCOmments. How cool.
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r-- | src/HTML5/Parser/Tokenizer.php | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index a23e1f4..b84f9bf 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -235,8 +235,18 @@ class Tokenizer { // Comment: if ($tok == '-' && $this->scanner->peek() == '-') { + $this->scanner->next(); // Consume the other '-' + $this->scanner->next(); // Next char. + return $this->comment(); } + elseif($tok == 'D') { + } + elseif($tok == '[') { + } + // FINISH + $this->parseError("Expected <!--, <![CDATA[, or <!DOCTYPE. Got <!%s", $tok); + $this->bogusComment('<!'); return TRUE; } @@ -472,10 +482,11 @@ class Tokenizer { return TRUE; } - protected function commentStart() { - } - protected function commentStartDash() { - } + /** + * Read a comment. + * + * Expects the first tok to be inside of the comment. + */ protected function comment() { $tok = $this->scanner->current(); $comment = ''; @@ -504,17 +515,18 @@ class Tokenizer { } protected function isCommentEnd() { + // EOF + if($this->scanner->current() === FALSE) { + // Hit the end. + $this->parseError("Unexpected EOF in a comment."); + return TRUE; + } + // If it doesn't start with -, not the end. if($this->scanner->current() != '-') { return FALSE; } - // EOF - if($this->scanner->Current() === FALSE) { - // Hit the end. - $this->events->parseError("Unexpected EOF in a comment."); - return TRUE; - } // Advance one, and test for '->' if ($this->scanner->next() == '-' |