You are here

function PHPExcel_Writer_Excel5_Parser::_fact in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php \PHPExcel_Writer_Excel5_Parser::_fact()

* It parses a factor. It assumes the following rule: * Fact -> ( Expr ) * | CellRef * | CellRange * | Number * | Function * * @access private *

Return value

mixed The parsed ptg'd tree on success

1 call to PHPExcel_Writer_Excel5_Parser::_fact()
PHPExcel_Writer_Excel5_Parser::_term in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php
* It parses a term. It assumes the following rule: * Term -> Fact [("*" | "/") Fact] * * @access private *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php, line 1369

Class

PHPExcel_Writer_Excel5_Parser
PHPExcel_Writer_Excel5_Parser

Code

function _fact() {
  if ($this->_current_token == "(") {
    $this
      ->_advance();

    // eat the "("
    $result = $this
      ->_parenthesizedExpression();
    if ($this->_current_token != ")") {
      throw new PHPExcel_Writer_Exception("')' token expected.");
    }
    $this
      ->_advance();

    // eat the ")"
    return $result;
  }

  // if it's a reference
  if (preg_match('/^\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/', $this->_current_token)) {
    $result = $this
      ->_createTree($this->_current_token, '', '');
    $this
      ->_advance();
    return $result;
  }
  elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\\!\\\$?[A-Ia-i]?[A-Za-z]\\\$?[0-9]+\$/u", $this->_current_token)) {
    $result = $this
      ->_createTree($this->_current_token, '', '');
    $this
      ->_advance();
    return $result;
  }
  elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\\$?[A-Ia-i]?[A-Za-z]\\\$?[0-9]+\$/u", $this->_current_token)) {
    $result = $this
      ->_createTree($this->_current_token, '', '');
    $this
      ->_advance();
    return $result;
  }
  elseif (preg_match('/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?[0-9]+:(\\$)?[A-Ia-i]?[A-Za-z](\\$)?[0-9]+$/', $this->_current_token) or preg_match('/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?[0-9]+\\.\\.(\\$)?[A-Ia-i]?[A-Za-z](\\$)?[0-9]+$/', $this->_current_token)) {

    // must be an error?
    $result = $this
      ->_createTree($this->_current_token, '', '');
    $this
      ->_advance();
    return $result;
  }
  elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\\!\\\$?([A-Ia-i]?[A-Za-z])?\\\$?[0-9]+:\\\$?([A-Ia-i]?[A-Za-z])?\\\$?[0-9]+\$/u", $this->_current_token)) {

    // must be an error?

    //$result = $this->_current_token;
    $result = $this
      ->_createTree($this->_current_token, '', '');
    $this
      ->_advance();
    return $result;
  }
  elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\\$?([A-Ia-i]?[A-Za-z])?\\\$?[0-9]+:\\\$?([A-Ia-i]?[A-Za-z])?\\\$?[0-9]+\$/u", $this->_current_token)) {

    // must be an error?

    //$result = $this->_current_token;
    $result = $this
      ->_createTree($this->_current_token, '', '');
    $this
      ->_advance();
    return $result;
  }
  elseif (is_numeric($this->_current_token)) {
    if ($this->_lookahead == '%') {
      $result = $this
        ->_createTree('ptgPercent', $this->_current_token, '');
      $this
        ->_advance();

      // Skip the percentage operator once we've pre-built that tree
    }
    else {
      $result = $this
        ->_createTree($this->_current_token, '', '');
    }
    $this
      ->_advance();
    return $result;
  }
  elseif (preg_match("", $this->_current_token)) {
    $result = $this
      ->_func();
    return $result;
  }
  throw new PHPExcel_Writer_Exception("Syntax error: " . $this->_current_token . ", lookahead: " . $this->_lookahead . ", current char: " . $this->_current_char);
}