Methods |
public
|
__construct(Iterator $source)
|
#
|
public
|
is(int|string ...$kind): bool
Tells whether the token at current position is of given kind.
Tells whether the token at current position is of given kind.
|
#
|
public
|
peek(int $offset = 0): ?Token
Gets the token at $offset from the current position.
Gets the token at $offset from the current position.
|
#
|
public
|
consume(int|string ...$kind): Token
Consumes the current token (if is of given kind) or throws exception on end.
Consumes the current token (if is of given kind) or throws exception on end.
Throws
|
#
|
public
|
tryConsume(int|string ...$kind): ?Token
Consumes the current token of given kind or returns null.
Consumes the current token of given kind or returns null.
|
#
|
public
|
seek(int $index): void
Sets the input cursor to the position.
Sets the input cursor to the position.
|
#
|
public
|
getIndex(): int
Returns the cursor position.
Returns the cursor position.
|
#
|
public
|
throwUnexpectedException(array $expected = [], string $addendum = '', string $excerpt = ''): never
|
#
|