final class TokenStream

internal  
 

Methods

__construct(array $tokens)

No description

int
getIndex()

No description

void
seek(int $index)

No description

bool
is(int|string ...$kind)

Tells whether the token at current position is of given kind.

Token|null
tryConsume(int|string ...$kind)

Consumes the current token of given kind or returns null.

string
getIndentation()

Returns the whitespace indentation of the token at the current position, i.e. the whitespace token immediately following a newline (or at the start).

never
error(string|null $message = null, int|null $pos = null)

Throws a parsing exception with position information from the current or given token.

Details

at line 19
__construct(array $tokens)

No description

Parameters

array $tokens

at line 26
int getIndex()

No description

Return Value

int

at line 32
void seek(int $index)

No description

Parameters

int $index

Return Value

void

at line 41
bool is(int|string ...$kind)

Tells whether the token at current position is of given kind.

Parameters

int|string ...$kind

Return Value

bool

at line 56
Token|null tryConsume(int|string ...$kind)

Consumes the current token of given kind or returns null.

Parameters

int|string ...$kind

Return Value

Token|null

at line 68
string getIndentation()

Returns the whitespace indentation of the token at the current position, i.e. the whitespace token immediately following a newline (or at the start).

Return Value

string

at line 78
never error(string|null $message = null, int|null $pos = null)

Throws a parsing exception with position information from the current or given token.

Parameters

string|null $message
int|null $pos

Return Value

never