diff options
author | Technosophos <[email protected]> | 2013-04-19 18:28:24 -0500 |
---|---|---|
committer | Technosophos <[email protected]> | 2013-04-19 18:28:24 -0500 |
commit | 3abbd5f597060533118897889e05b104fa7597be (patch) | |
tree | 7918baa64c87f6631cc54c7c669796d07f5144b9 /src/HTML5 | |
parent | 5e62b1cc928e2fb9b5cc644931972a25ffffe935 (diff) |
Finished minor refactoring of tokenizer.
Diffstat (limited to 'src/HTML5')
-rw-r--r-- | src/HTML5/Parser/Scanner.php | 18 | ||||
-rw-r--r-- | src/HTML5/Parser/Tokenizer.php | 17 |
2 files changed, 9 insertions, 26 deletions
diff --git a/src/HTML5/Parser/Scanner.php b/src/HTML5/Parser/Scanner.php index 7277dc9..1ab9b8b 100644 --- a/src/HTML5/Parser/Scanner.php +++ b/src/HTML5/Parser/Scanner.php @@ -64,15 +64,6 @@ class Scanner { } /** - * Silently consume N chars. - */ - public function consume($count = 1) { - for ($i = 0; $i < $count; ++$i) { - $this->next(); - } - } - - /** * Get the current character. * * Note, this does not advance the pointer. @@ -88,6 +79,15 @@ class Scanner { } /** + * Silently consume N chars. + */ + public function consume($count = 1) { + for ($i = 0; $i < $count; ++$i) { + $this->next(); + } + } + + /** * Unconsume some of the data. This moves the data pointer backwards. * * @param int $howMany diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index a64a832..f3e45e1 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -766,7 +766,6 @@ class Tokenizer { $tok = $this->scanner->next(); } while (!$this->sequenceMatches(']]>')); - //while (!$this->isCdataClose()); // Consume ]]> $this->scanner->consume(3); @@ -775,22 +774,6 @@ class Tokenizer { return TRUE; } - /** - * Check whether the parser has reached the end of a CDATA section. - */ - protected function isCdataClose() { - $tok = $this->scanner->current(); - if ($tok != ']') { - return FALSE; - } - $tok = $this->scanner->next(); - if ($tok == ']' && $this->scanner->peek() == '>') { - return TRUE; - } - // Unconsume one char and return. - $this->scanner->unconsume(); - return FALSE; - } // ================================================================ // Non-HTML5 |