TokenStream
final class TokenStream
internal |
Methods
__construct(array $tokens)
No description
int
getIndex()
No description
void
seek(int $index)
No description
Token|null
peek(int $offset = 0)
Gets the token at $offset from the current position.
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()
No description
void
error(string|null $message = null)
No description
Details
at line 19
__construct(array $tokens)
No description
at line 26
int
getIndex()
No description
at line 32
void
seek(int $index)
No description
at line 41
Token|null
peek(int $offset = 0)
Gets the token at $offset from the current position.
at line 50
bool
is(int|string ...$kind)
Tells whether the token at current position is of given kind.
at line 65
Token|null
tryConsume(int|string ...$kind)
Consumes the current token of given kind or returns null.
at line 73
string
getIndentation()
No description
at line 83
void
error(string|null $message = null)
No description
at line 93
int|null
findIndex(Position $pos)
No description