class TokenStream

CSS selector token stream.

This component is a port of the Python cssselect library, which is copyright Ian Bicking, see https://github.com/SimonSapin/cssselect.

Methods

$this
push(Token $token)

Pushes a token.

$this
freeze()

Freezes stream.

getNext()

Returns next token.

getPeek()

Returns peeked token.

Token[]
getUsed()

Returns used tokens.

string
getNextIdentifier()

Returns nex identifier token.

string|null
getNextIdentifierOrStar()

Returns nex identifier or star delimiter token.

skipWhitespace()

Skips next whitespace if any.

Details

at line 59
$this push(Token $token)

Pushes a token.

Parameters

Token $token

Return Value

$this

at line 71
$this freeze()

Freezes stream.

Return Value

$this

at line 83
Token getNext()

Returns next token.

Return Value

Token

Exceptions

InternalErrorException If there is no more token

at line 104
Token getPeek()

Returns peeked token.

Return Value

Token

at line 119
Token[] getUsed()

Returns used tokens.

Return Value

Token[]

at line 131
string getNextIdentifier()

Returns nex identifier token.

Return Value

string The identifier token value

Exceptions

SyntaxErrorException If next token is not an identifier

at line 149
string|null getNextIdentifierOrStar()

Returns nex identifier or star delimiter token.

Return Value

string|null The identifier token value or null if star found

Exceptions

SyntaxErrorException If next token is not an identifier or a star delimiter

at line 167
skipWhitespace()

Skips next whitespace if any.