You are here

protected function XPathQueryParser::handleWord in Feeds XPath Parser 8

Handles one word.

Parameters

string $c: (optional) A single character. Defaults to an empty string.

3 calls to XPathQueryParser::handleWord()
XPathQueryParser::handleQuote in lib/Drupal/feeds_xpathparser/XPathQueryParser.php
Handles quote pairs.
XPathQueryParser::handleWordBoundary in lib/Drupal/feeds_xpathparser/XPathQueryParser.php
Handles word boundaries.
XPathQueryParser::start in lib/Drupal/feeds_xpathparser/XPathQueryParser.php
Begin parsing.

File

lib/Drupal/feeds_xpathparser/XPathQueryParser.php, line 156
Contains \Drupal\feeds_xpathparser\XPathQueryParser.

Class

XPathQueryParser
Pseudo-parser of XPath queries.

Namespace

Drupal\feeds_xpathparser

Code

protected function handleWord($c = '') {
  if ($this->word === '') {
    return;
  }
  if ($c === ':' && drupal_substr($this->query, $this->i + 1, 1) === ':') {
    $this->axis = $this->word;
  }
  if ($c === ':' && drupal_substr($this->query, $this->i - 1, 1) !== ':' && drupal_substr($this->query, $this->i + 1, 1) !== ':') {
    $this->output .= $this->word;
    $this->skipNextWord = TRUE;
    return;
  }
  if ($this->skipNextWord) {
    $this->skipNextWord = FALSE;
    $this->output .= $this->word;
    return;
  }
  if (is_numeric($this->word) || $this->axis === 'attribute' || strpos($this->word, '@') === 0 || $c === '(' || $c === ':') {
    $this->output .= $this->word;
    return;
  }

  // Apply namespace.
  $this->output .= '__default__:' . $this->word;
}