class TokenIterator

deprecated use similar Nette\Tokenizer\Stream

Traversing helper.

Properties

array $tokens
int $position
array $ignored

Methods

__construct(array $tokens)

No description

array|null
currentToken()

Returns current token.

string|null
currentValue()

Returns current token value.

array|null
nextToken()

Returns next token.

string|null
nextValue()

Returns next token value.

array[]
nextAll()

Returns all next tokens.

array[]
nextUntil($arg)

Returns all next tokens until it sees a given token type or value.

string
joinAll()

Returns concatenation of all next token values.

string
joinUntil($arg)

Returns concatenation of all next tokens until it sees a given token type or value.

bool
isCurrent($arg)

Checks the current token.

bool
isNext()

Checks the next token existence.

bool
isPrev()

Checks the previous token existence.

reset()

No description

next()

Moves cursor to next token.

mixed
scan($wanted, $onlyFirst, $advance, $strings = false, $until = false, $prev = false)

Looks for (first) (not) wanted tokens.

Details

at line 30
__construct(array $tokens)

No description

Parameters

array $tokens

at line 40
array|null currentToken()

Returns current token.

Return Value

array|null

at line 52
string|null currentValue()

Returns current token value.

Return Value

string|null

at line 65
array|null nextToken()

Returns next token.

Return Value

array|null

at line 76
string|null nextValue()

Returns next token value.

Return Value

string|null

at line 87
array[] nextAll()

Returns all next tokens.

Return Value

array[]

at line 98
array[] nextUntil($arg)

Returns all next tokens until it sees a given token type or value.

Parameters

$arg

Return Value

array[]

at line 109
string joinAll()

Returns concatenation of all next token values.

Return Value

string

at line 120
string joinUntil($arg)

Returns concatenation of all next tokens until it sees a given token type or value.

Parameters

$arg

Return Value

string

at line 131
bool isCurrent($arg)

Checks the current token.

Parameters

$arg

Return Value

bool

at line 148
bool isNext()

Checks the next token existence.

Return Value

bool

at line 159
bool isPrev()

Checks the previous token existence.

Return Value

bool

at line 168
TokenIterator reset()

No description

Return Value

TokenIterator

at line 178
protected next()

Moves cursor to next token.

at line 194
protected mixed scan($wanted, $onlyFirst, $advance, $strings = false, $until = false, $prev = false)

Looks for (first) (not) wanted tokens.

Parameters

$wanted
$onlyFirst
$advance
$strings
$until
$prev

Return Value

mixed