TokenStream
final class TokenStream
| internal |
Methods
No description
No description
No description
No description
Skips comments and whitespace, then checks whether the next token matches one of the given types.
Consumes and returns the next token if it matches one of the given types, or null otherwise.
Returns the whitespace indentation of the token at the current position, i.e. the whitespace token immediately following a newline (or at the start).
No description
Details
at line 19
__construct(array $tokens)
No description
at line 26
int
getPos()
No description
at line 32
void
seek(int $position)
No description
at line 39
array
getTokens()
No description
at line 49
bool
isNext(int|string ...$types)
Skips comments and whitespace, then checks whether the next token matches one of the given types.
With no arguments, checks whether any token remains.
at line 65
Token|null
consume(int|string ...$types)
Consumes and returns the next token if it matches one of the given types, or null otherwise.
With no arguments, consumes any next token.
at line 77
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).
at line 87
void
error(string|null $message = null, int|null $pos = null)
No description