You are here

private function CssParser::elementName in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/CssParser.php \CssParser::elementName()
  2. 7.2 QueryPath/CssParser.php \CssParser::elementName()
1 call to CssParser::elementName()
CssParser::simpleSelectors in QueryPath/CssParser.php

File

QueryPath/CssParser.php, line 326

Class

CssParser

Code

private function elementName() {
  if ($this->DEBUG) {
    print "ELEMENT NAME\n";
  }
  if ($this->scanner->token === CssToken::pipe) {
    $this->scanner
      ->nextToken();
    $this
      ->consumeWhitespace();
    $elementName = $this->scanner
      ->getNameString();
    $this->handler
      ->element($elementName);
  }
  elseif ($this->scanner->token === CssToken::char) {
    $elementName = $this->scanner
      ->getNameString();
    if ($this->scanner->token == CssToken::pipe) {
      $elementNS = $elementName;
      $this->scanner
        ->nextToken();
      $this
        ->consumeWhitespace();
      if ($this->scanner->token === CssToken::star) {
        $this->handler
          ->anyElementInNS($elementNS);
        $this->scanner
          ->nextToken();
      }
      elseif ($this->scanner->token !== CssToken::char) {
        $this
          ->throwError(CssToken::char, $this->scanner->token);
      }
      else {
        $elementName = $this->scanner
          ->getNameString();
        $this->handler
          ->elementNS($elementName, $elementNS);
      }
    }
    else {
      $this->handler
        ->element($elementName);
    }
  }
}