W3cubDocs

/Symfony 4.1

TokenStream

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.

Token getNext()

Returns next token.

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

$this push(Token $token)

Pushes a token.

Parameters

Token $token

Return Value

$this

$this freeze()

Freezes stream.

Return Value

$this

Token getNext()

Returns next token.

Return Value

Token

Exceptions

InternalErrorException If there is no more token

Token getPeek()

Returns peeked token.

Return Value

Token

Token[] getUsed()

Returns used tokens.

Return Value

Token[]

string getNextIdentifier()

Returns nex identifier token.

Return Value

string The identifier token value

Exceptions

SyntaxErrorException If next token is not an identifier

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

skipWhitespace()

Skips next whitespace if any.

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/CssSelector/Parser/TokenStream.html