class TokenStream

Represents a token stream.

Properties

$current

Methods

__construct(array $tokens, string $expression = '')

No description

string
__toString()

Returns a string representation of the token stream.

next()

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

expect(array|int $type, string|null $value = null, string|null $message = null)

Tests a token.

bool
isEOF()

Checks if end of stream was reached.

string
getExpression()

No description

Details

at line 27
__construct(array $tokens, string $expression = '')

Parameters

array $tokens
string $expression

at line 39
string __toString()

Returns a string representation of the token stream.

Return Value

string

at line 47
next()

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

at line 65
expect(array|int $type, string|null $value = null, string|null $message = null)

Tests a token.

Parameters

array|int $type The type to test
string|null $value The token value
string|null $message The syntax error message

at line 79
bool isEOF()

Checks if end of stream was reached.

Return Value

bool

at line 89
string getExpression()

Return Value

string