summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/HTML5/Parser/Tokenizer.php53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php
index 62c39f1..be09b21 100644
--- a/src/HTML5/Parser/Tokenizer.php
+++ b/src/HTML5/Parser/Tokenizer.php
@@ -164,7 +164,7 @@ class Tokenizer
}
$this->text .= $tok;
- $this->scanner->next();
+ $this->scanner->consume();
}
}
}
@@ -219,7 +219,7 @@ class Tokenizer
}
$this->buffer($tok);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -315,8 +315,8 @@ class Tokenizer
// Comment:
if ('-' == $tok && '-' == $this->scanner->peek()) {
- $this->scanner->next(); // Consume the other '-'
- $this->scanner->next(); // Next char.
+ $this->scanner->consume(2);
+
return $this->comment();
} elseif ('D' == $tok || 'd' == $tok) { // Doctype
return $this->doctype();
@@ -367,7 +367,7 @@ class Tokenizer
}
$this->events->endTag($name);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -405,7 +405,7 @@ class Tokenizer
$this->setTextMode($mode, $name);
}
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -417,7 +417,7 @@ class Tokenizer
{
$tok = $this->scanner->current();
if ('/' == $tok) {
- $this->scanner->next();
+ $this->scanner->consume();
$this->scanner->whitespace();
$tok = $this->scanner->current();
@@ -482,7 +482,7 @@ class Tokenizer
// Really, only '=' can be the char here. Everything else gets absorbed
// under one rule or another.
$name = $tok;
- $this->scanner->next();
+ $this->scanner->consume();
}
$isValidAttribute = true;
@@ -524,7 +524,7 @@ class Tokenizer
if ('=' != $this->scanner->current()) {
return null;
}
- $this->scanner->next();
+ $this->scanner->consume();
// 8.1.2.3
$this->scanner->whitespace();
@@ -538,7 +538,7 @@ class Tokenizer
return null;
case '"':
case "'":
- $this->scanner->next();
+ $this->scanner->consume();
return $this->quotedAttributeValue($tok);
case '>':
@@ -585,7 +585,7 @@ class Tokenizer
}
break;
}
- $this->scanner->next();
+ $this->scanner->consume();
return $val;
}
@@ -639,7 +639,7 @@ class Tokenizer
$this->flushBuffer();
$this->events->comment($comment);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -660,7 +660,7 @@ class Tokenizer
// Parse error. Emit the comment token.
$this->parseError("Expected comment data, got '>'");
$this->events->comment('');
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -675,7 +675,7 @@ class Tokenizer
}
$this->events->comment($comment);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -704,7 +704,7 @@ class Tokenizer
// Advance one, and test for '->'
if ('-' == $this->scanner->next() && '>' == $this->scanner->peek()) {
- $this->scanner->next(); // Consume the last '>'
+ $this->scanner->consume(); // Consume the last '>'
return true;
}
// Unread '-';
@@ -772,12 +772,12 @@ class Tokenizer
if (0 == strlen($doctypeName)) {
$this->parseError('Expected a DOCTYPE name. Got nothing.');
$this->events->doctype($doctypeName, 0, null, true);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
$this->events->doctype($doctypeName);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -809,7 +809,7 @@ class Tokenizer
$this->scanner->whitespace();
if ('>' == $this->scanner->current()) {
$this->events->doctype($doctypeName, $type, $id, false);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -819,7 +819,7 @@ class Tokenizer
$this->scanner->charsUntil('>');
$this->parseError('Malformed DOCTYPE.');
$this->events->doctype($doctypeName, $type, $id, true);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -830,7 +830,7 @@ class Tokenizer
$this->parseError('Expected PUBLIC or SYSTEM. Got %s.', $pub);
$this->events->doctype($doctypeName, 0, null, true);
- $this->scanner->next();
+ $this->scanner->consume();
return true;
}
@@ -847,10 +847,10 @@ class Tokenizer
{
$tok = $this->scanner->current();
if ('"' == $tok || "'" == $tok) {
- $this->scanner->next();
+ $this->scanner->consume();
$ret = $this->scanner->charsUntil($tok . $stopchars);
if ($this->scanner->current() == $tok) {
- $this->scanner->next();
+ $this->scanner->consume();
} else {
// Parse error because no close quote.
$this->parseError('Expected %s, got %s', $tok, $this->scanner->current());
@@ -873,7 +873,7 @@ class Tokenizer
return false;
}
$cdata = '';
- $this->scanner->next();
+ $this->scanner->consume();
$chars = $this->scanner->charsWhile('CDAT');
if ('CDATA' != $chars || '[' != $this->scanner->current()) {
@@ -948,8 +948,7 @@ class Tokenizer
}
}
- $this->scanner->next(); // >
- $this->scanner->next(); // Next token.
+ $this->scanner->consume(2); // Consume the closing tag
$this->events->processingInstruction($procName, $data);
return true;
@@ -981,7 +980,7 @@ class Tokenizer
return $buffer;
}
$buffer .= $this->scanner->current();
- $this->scanner->next();
+ $this->scanner->consume();
}
// If we get here, we hit the EOF.
@@ -1158,7 +1157,7 @@ class Tokenizer
// We have an entity. We're done here.
if (';' === $tok) {
- $this->scanner->next();
+ $this->scanner->consume();
return $entity;
}