Stream
class Stream
Stream of tokens.
Properties
Token[] | $tokens | ||
int | $position | ||
array | $ignored |
Methods
No description
Returns current token.
Returns current token value.
Returns next token.
Returns next token value.
Returns all next tokens.
Returns all next tokens until it sees a given token type or value.
Returns next token or throws exception.
Returns next token value or throws exception.
Returns concatenation of all next token values.
Returns concatenation of all next tokens until it sees a given token type or value.
Checks the current token.
Checks the next token existence.
Checks the previous token existence.
Moves cursor to next token.
Looks for (first) (not) wanted tokens.
Details
at line 31
__construct(array $tokens)
No description
at line 40
Token|null
currentToken()
Returns current token.
at line 49
string|null
currentValue()
Returns current token value.
at line 59
Token|null
nextToken(int|string ...$args)
Returns next token.
at line 69
string|null
nextValue(int|string ...$args)
Returns next token value.
at line 80
array
nextAll(int|string ...$args)
Returns all next tokens.
at line 91
array
nextUntil(int|string ...$args)
Returns all next tokens until it sees a given token type or value.
at line 102
Token
consumeToken(int|string ...$args)
Returns next token or throws exception.
at line 132
string
consumeValue(int|string ...$args)
Returns next token value or throws exception.
at line 142
string
joinAll(int|string ...$args)
Returns concatenation of all next token values.
at line 152
string
joinUntil(int|string ...$args)
Returns concatenation of all next tokens until it sees a given token type or value.
at line 162
bool
isCurrent(int|string ...$args)
Checks the current token.
at line 173
bool
isNext(int|string ...$args)
Checks the next token existence.
at line 183
bool
isPrev(int|string ...$args)
Checks the previous token existence.
at line 192
Stream
reset()
No description
at line 202
protected void
next()
Moves cursor to next token.
at line 212
protected mixed
scan(array $wanted, bool $onlyFirst, bool $advance, bool $strings = false, bool $until = false, bool $prev = false)
Looks for (first) (not) wanted tokens.