You are here

private function Parser::parseElementNode in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/css-selector/Parser/Parser.php \Symfony\Component\CssSelector\Parser\Parser::parseElementNode()

Parses next element node.

Parameters

TokenStream $stream:

Return value

Node\ElementNode

1 call to Parser::parseElementNode()
Parser::parseSimpleSelector in vendor/symfony/css-selector/Parser/Parser.php
Parses next simple node (hash, class, pseudo, negation).

File

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

Class

Parser
CSS selector parser.

Namespace

Symfony\Component\CssSelector\Parser

Code

private function parseElementNode(TokenStream $stream) {
  $peek = $stream
    ->getPeek();
  if ($peek
    ->isIdentifier() || $peek
    ->isDelimiter(array(
    '*',
  ))) {
    if ($peek
      ->isIdentifier()) {
      $namespace = $stream
        ->getNext()
        ->getValue();
    }
    else {
      $stream
        ->getNext();
      $namespace = null;
    }
    if ($stream
      ->getPeek()
      ->isDelimiter(array(
      '|',
    ))) {
      $stream
        ->getNext();
      $element = $stream
        ->getNextIdentifierOrStar();
    }
    else {
      $element = $namespace;
      $namespace = null;
    }
  }
  else {
    $element = $namespace = null;
  }
  return new Node\ElementNode($namespace, $element);
}