summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-04-10 09:54:02 -0400
committerMatt Farina <[email protected]>2013-04-10 09:54:02 -0400
commit115ce6b633e14050f93049f96b14bf0b6f5f631f (patch)
treeb53b478f4d0d79b80f1dfcbef774bdf73bc37ae9 /src/HTML5/Parser
parent2ec566af35cc522baba481323674231f22fa3e05 (diff)
Added some documentation to the parser.
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r--src/HTML5/Parser/Scanner.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/HTML5/Parser/Scanner.php b/src/HTML5/Parser/Scanner.php
index 5e45ffe..33621fd 100644
--- a/src/HTML5/Parser/Scanner.php
+++ b/src/HTML5/Parser/Scanner.php
@@ -15,27 +15,67 @@ class Scanner {
protected $char;
protected $is;
+ /**
+ * Create a new Scanner.
+ *
+ * @param \HTML5\InputStream $input
+ * An InputStream to be scanned.
+ */
public function __construct($input) {
$this->is = $input;
}
+ /**
+ * Get the current position.
+ *
+ * @return int
+ * The current intiger byte position.
+ */
public function position() {
return $this->is->position();
}
+ /**
+ * Take a peek at the next character in the data.
+ *
+ * @return string
+ * The next character.
+ */
public function peek() {
return $this->is->peek();
}
+ /**
+ * Get the next character.
+ *
+ * Note: This advances the pointer.
+ *
+ * @return string
+ * The next character.
+ */
public function next() {
$this->char = $this->is->char();
return $this->char;
}
+ /**
+ * Get the current character.
+ *
+ * Note, this does not advance the pointer.
+ *
+ * @return string
+ * The current character.
+ */
public function current() {
return $this->char;
}
+ /**
+ * Unconsume some of the data. This moves the data pointer backwards.
+ *
+ * @param int $howMany
+ * The number of characters to move the pointer back.
+ */
public function unconsume($howMany = 1) {
for ($i = 0; $i < $howMany; ++$i) {
$this->is->unconsume();