class Scanner

The scanner.

This scans over an input stream.

Constants

CHARS_HEX

CHARS_ALNUM

CHARS_ALPHA

Properties

$debug

Methods

__construct( InputStream $input)

Create a new Scanner.

int
position()

Get the current position.

string
peek()

Take a peek at the next character in the data.

next()

Get the next character.

mixed
current()

Get the current character.

consume($count = 1)

Silently consume N chars.

unconsume( int $howMany = 1)

Unconsume some of the data.

string
getHex()

Get the next group of that contains hex characters.

string
getAsciiAlpha()

Get the next group of characters that are ASCII Alpha characters.

string
getAsciiAlphaNum()

Get the next group of characters that are ASCII Alpha characters and numbers.

string
getNumeric()

Get the next group of numbers.

whitespace()

Consume whitespace.

int
currentLine()

Returns the current line that is being consumed.

charsUntil($mask)

Read chars until something in the mask is encountered.

charsWhile($mask)

Read chars as long as the mask matches.

int
columnOffset()

Returns the current column of the current line that the tokenizer is at.

int
remainingChars()

Get all characters until EOF.

Details

at line line 29
__construct( InputStream $input)

Create a new Scanner.

Parameters

InputStream $input An InputStream to be scanned.

at line line 39
int position()

Get the current position.

Return Value

int The current intiger byte position.

at line line 49
string peek()

Take a peek at the next character in the data.

Return Value

string The next character.

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.

Return Value

mixed Any value can be returned. Typically the current character.

at line line 86
consume($count = 1)

Silently consume N chars.

Parameters

$count

at line line 100
unconsume( int $howMany = 1)

Unconsume some of the data.

This moves the data pointer backwards.

Parameters

int $howMany The number of characters to move the pointer back.

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.

Return Value

string The next group that is hex characters.

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.

Return Value

string The next group of ASCII alpha characters.

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.

Return Value

string The next group of ASCII alpha characters and numbers.

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.

Return Value

string The next group of numbers.

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.

Return Value

int The current line number.

at line line 180
charsUntil($mask)

Read chars until something in the mask is encountered.

Parameters

$mask

at line line 188
charsWhile($mask)

Read chars as long as the mask matches.

Parameters

$mask

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.

Return Value

int The column number.

at line line 212
int remainingChars()

Get all characters until EOF.

This consumes characters until the EOF.

Return Value

int The number of characters remaining.