class TokenStream

Represents a token stream.

Properties

$current

Methods

__construct(array $tokens)

Constructor.

string
__toString()

Returns a string representation of the token stream.

next()

Sets the pointer to the next token and returns the old one.

expect($type, $value = null, $message = null)

Tests a token.

bool
isEOF()

Checks if end of stream was reached.

Details

at line line 31
__construct(array $tokens)

Constructor.

Parameters

array $tokens An array of tokens

at line line 42
string __toString()

Returns a string representation of the token stream.

Return Value

string

at line line 50
next()

Sets the pointer to the next token and returns the old one.

at line line 64
expect($type, $value = null, $message = null)

Tests a token.

Parameters

$type
$value
$message

at line line 78
bool isEOF()

Checks if end of stream was reached.

Return Value

bool