class Stream

Stream of tokens.

Properties

Token[] $tokens
int $position
array $ignored

Methods

__construct(array $tokens)

No description

Token|null
currentToken()

Returns current token.

string|null
currentValue()

Returns current token value.

Token|null
nextToken()

Returns next token.

string|null
nextValue()

Returns next token value.

Token[]
nextAll()

Returns all next tokens.

Token[]
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 29
__construct(array $tokens)

No description

Parameters

array $tokens

at line 39
Token|null currentToken()

Returns current token.

Return Value

Token|null

at line 51
string|null currentValue()

Returns current token value.

Return Value

string|null

at line 64
Token|null nextToken()

Returns next token.

Return Value

Token|null

at line 75
string|null nextValue()

Returns next token value.

Return Value

string|null

at line 86
Token[] nextAll()

Returns all next tokens.

Return Value

Token[]

at line 97
Token[] nextUntil($arg)

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

Parameters

$arg

Return Value

Token[]

at line 108
string joinAll()

Returns concatenation of all next token values.

Return Value

string

at line 119
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 130
bool isCurrent($arg)

Checks the current token.

Parameters

$arg

Return Value

bool

at line 147
bool isNext()

Checks the next token existence.

Return Value

bool

at line 158
bool isPrev()

Checks the previous token existence.

Return Value

bool

at line 167
Stream reset()

No description

Return Value

Stream

at line 177
protected next()

Moves cursor to next token.

at line 193
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