TokenIterator
class TokenIterator
internal |
Traversing helper.
Properties
array | $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 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.
Returns next expected token or throws exception.
No description
Moves cursor to next token.
Looks for (first) (not) wanted tokens.
Details
at line 32
__construct(array $tokens)
No description
at line 42
array|null
currentToken()
Returns current token.
at line 54
string|null
currentValue()
Returns current token value.
at line 67
array|null
nextToken()
Returns next token.
at line 78
string|null
nextValue()
Returns next token value.
at line 89
array[]
nextAll()
Returns all next tokens.
at line 100
array[]
nextUntil($arg)
Returns all next tokens until it sees a given token type or value.
at line 111
string
joinAll()
Returns concatenation of all next token values.
at line 122
string
joinUntil($arg)
Returns concatenation of all next tokens until it sees a given token type or value.
at line 133
bool
isCurrent($arg)
Checks the current token.
at line 150
bool
isNext()
Checks the next token existence.
at line 161
bool
isPrev()
Checks the previous token existence.
at line 173
string
expectNextValue()
Returns next expected token or throws exception.
at line 189
TokenIterator
reset()
No description
at line 199
protected
next()
Moves cursor to next token.
at line 215
protected mixed
scan($wanted, $onlyFirst, $advance, $strings = false, $until = false, $prev = false)
Looks for (first) (not) wanted tokens.
Traits
Better OOP experience.