summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser/Tokenizer.php
diff options
context:
space:
mode:
authorTechnosophos <[email protected]>2013-04-10 11:50:32 -0500
committerTechnosophos <[email protected]>2013-04-10 11:50:32 -0500
commitee379d29a15560ba9b44d2fd3629f81d217f7d31 (patch)
tree1f40f3d096c67e3407d9a658788cf6c9300ed7bc /src/HTML5/Parser/Tokenizer.php
parentbdd5822cda3df4c1ef6e7a1d66b844ff534491ce (diff)
Added main parsing loop.
Diffstat (limited to 'src/HTML5/Parser/Tokenizer.php')
-rw-r--r--src/HTML5/Parser/Tokenizer.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index 1501ab1..1c5aa18 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -17,18 +17,30 @@ class Tokenizer {
}
/**
+ * Main entry point.
+ */
+ public function parse() {
+ while ($this->consumeData()) {
+ $this->scanner->next();
+ }
+ }
+
+ /**
* 8.2.4.1
*/
- public function consumeData() {
- // Scan a token
- $this->scanner->next();
+ protected function consumeData() {
// Character Ref
$this->characterReference();
// TagOpen
// Null
// EOF
+ if ($this->scanner->current() === FALSE) {
+ $this->events->eof();
+ return FALSE;
+ }
// Character
+ return TRUE;
}
/**