TokenStream
in package
Represents a token stream.
Tags
Table of Contents
Properties
- $current : mixed
- $expression : string
- $position : int
- $tokens : array<string|int, mixed>
Methods
- __construct() : mixed
- __toString() : string
- Returns a string representation of the token stream.
- expect() : mixed
- isEOF() : bool
- Checks if end of stream was reached.
- next() : mixed
- Sets the pointer to the next token and returns the old one.
Properties
$current
public
mixed
$current
$expression
private
string
$expression
$position
private
int
$position
= 0
$tokens
private
array<string|int, mixed>
$tokens
Methods
__construct()
public
__construct(array<string|int, mixed> $tokens[, string $expression = '' ]) : mixed
Parameters
- $tokens : array<string|int, mixed>
- $expression : string = ''
__toString()
Returns a string representation of the token stream.
public
__toString() : string
Return values
stringexpect()
public
expect(string $type[, string $value = null ][, string|null $message = null ]) : mixed
Parameters
- $type : string
- $value : string = null
- $message : string|null = null
-
The syntax error message
isEOF()
Checks if end of stream was reached.
public
isEOF() : bool
Return values
boolnext()
Sets the pointer to the next token and returns the old one.
public
next() : mixed