Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Parser.php

function Parser::parserSelectorNode

1 call to Parser::parserSelectorNode()
Parser::parseSelectorList in vendor/symfony/css-selector/Parser/Parser.php

File

vendor/symfony/css-selector/Parser/Parser.php, line 113

Class

Parser
CSS selector parser.

Namespace

Symfony\Component\CssSelector\Parser

Code

private function parserSelectorNode(TokenStream $stream, bool $isArgument = false) : Node\SelectorNode {
    [
        $result,
        $pseudoElement,
    ] = $this->parseSimpleSelector($stream, false, $isArgument);
    while (true) {
        $stream->skipWhitespace();
        $peek = $stream->getPeek();
        if ($peek->isFileEnd() || $peek->isDelimiter([
            ',',
        ]) || $isArgument && $peek->isDelimiter([
            ')',
        ])) {
            break;
        }
        if (null !== $pseudoElement) {
            throw SyntaxErrorException::pseudoElementFound($pseudoElement, 'not at the end of a selector');
        }
        if ($peek->isDelimiter([
            '+',
            '>',
            '~',
        ])) {
            $combinator = $stream->getNext()
                ->getValue();
            $stream->skipWhitespace();
        }
        else {
            $combinator = ' ';
        }
        [
            $nextSelector,
            $pseudoElement,
        ] = $this->parseSimpleSelector($stream, false, $isArgument);
        $result = new Node\CombinedSelectorNode($result, $combinator, $nextSelector);
    }
    return new Node\SelectorNode($result, $pseudoElement);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal