Scanner
class Scanner
The scanner.
This scans over an input stream.
Constants
CHARS_HEX |
|
CHARS_ALNUM |
|
CHARS_ALPHA |
|
Properties
$debug |
Methods
Get the current position.
Take a peek at the next character in the data.
Get the next character.
Get the current character.
Silently consume N chars.
Unconsume some of the data.
Get the next group of that contains hex characters.
Get the next group of characters that are ASCII Alpha characters.
Get the next group of characters that are ASCII Alpha characters and numbers.
Get the next group of numbers.
Consume whitespace.
Returns the current line that is being consumed.
Read chars until something in the mask is encountered.
Read chars as long as the mask matches.
Returns the current column of the current line that the tokenizer is at.
Get all characters until EOF.
Details
at line line 29
__construct(
InputStream $input)
Create a new Scanner.
at line line 39
int
position()
Get the current position.
at line line 49
string
peek()
Take a peek at the next character in the data.
at line line 59
next()
Get the next character.
Note: This advances the pointer.
at line line 71
mixed
current()
Get the current character.
Note, this does not advance the pointer.
at line line 86
consume($count = 1)
Silently consume N chars.
at line line 100
unconsume(
int $howMany = 1)
Unconsume some of the data.
This moves the data pointer backwards.
at line line 113
string
getHex()
Get the next group of that contains hex characters.
Note, along with getting the characters the pointer in the data will be moved as well.
at line line 126
string
getAsciiAlpha()
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.
at line line 139
string
getAsciiAlphaNum()
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.
at line line 152
string
getNumeric()
Get the next group of numbers.
Note, along with getting the characters the pointer in the data will be moved as well.
at line line 162
whitespace()
Consume whitespace.
Whitespace in HTML5 is: formfeed, tab, newline, space.
at line line 172
int
currentLine()
Returns the current line that is being consumed.
at line line 180
charsUntil($mask)
Read chars until something in the mask is encountered.
at line line 188
charsWhile($mask)
Read chars as long as the mask matches.
at line line 200
int
columnOffset()
Returns the current column of the current line that the tokenizer is at.
Newlines are column 0. The first char after a newline is column 1.
at line line 212
int
remainingChars()
Get all characters until EOF.
This consumes characters until the EOF.