diff options
Diffstat (limited to 'src/HTML5/Parser/Scanner.php')
-rw-r--r-- | src/HTML5/Parser/Scanner.php | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/src/HTML5/Parser/Scanner.php b/src/HTML5/Parser/Scanner.php index 0260391..2500dab 100644 --- a/src/HTML5/Parser/Scanner.php +++ b/src/HTML5/Parser/Scanner.php @@ -85,16 +85,57 @@ class Scanner { } } + /** + * Get the next group of that is a hex value. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @todo There is a potential for many false positives with this method. Make it more accurate. + * + * @return string + * The next group that is a hex value. + */ public function getHex() { - $this->charsWhile(self::CHARS_HEX); + return $this->is->charsWhile(self::CHARS_HEX); } + + /** + * Get the next group of characters that are ASCII Alpha characters. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string + * The next group of ASCII alpha characters. + */ public function getAsciiAlpha() { - $this->charsWhile(self::CHARS_ALPHA); + return $this->is->charsWhile(self::CHARS_ALPHA); } + + /** + * Get the next group of characters that are ASCII Alpha characters and numbers. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string + * The next group of ASCII alpha characters and numbers. + */ public function getAsciiAlphaNum() { - $this->charsWhile(self::CHARS_ALNUM); + return $this->is->charsWhile(self::CHARS_ALNUM); } + + /** + * Get the next group of numbers. + * + * Note, along with getting the characters the pointer in the data will be + * moved as well. + * + * @return string + * The next group of numbers. + */ public function getNumeric() { - $this->charsWhile('0123456789'); + return $this->is->charsWhile('0123456789'); } } |