You are here

function PHPExcel_Writer_Excel5_Parser::_match 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::_match()

* Checks if it's a valid token. * * @access private *

Parameters

mixed $token The token to check.: * @return mixed The checked token or false on failure

1 call to PHPExcel_Writer_Excel5_Parser::_match()
PHPExcel_Writer_Excel5_Parser::_advance in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5/Parser.php
* Advance to the next valid token. * * @access private

File

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

Class

PHPExcel_Writer_Excel5_Parser
PHPExcel_Writer_Excel5_Parser

Code

function _match($token) {
  switch ($token) {
    case "+":
    case "-":
    case "*":
    case "/":
    case "(":
    case ")":
    case ",":
    case ";":
    case ">=":
    case "<=":
    case "=":
    case "<>":
    case "^":
    case "&":
    case "%":
      return $token;
      break;
    case ">":
      if ($this->_lookahead == '=') {

        // it's a GE token
        break;
      }
      return $token;
      break;
    case "<":

      // it's a LE or a NE token
      if ($this->_lookahead == '=' or $this->_lookahead == '>') {
        break;
      }
      return $token;
      break;
    default:

      // if it's a reference A1 or $A$1 or $A1 or A$1
      if (preg_match('/^\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->_lookahead) and $this->_lookahead != ':' and $this->_lookahead != '.' and $this->_lookahead != '!') {
        return $token;
      }
      elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\\!\\\$?[A-Ia-i]?[A-Za-z]\\\$?[0-9]+\$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and $this->_lookahead != ':' and $this->_lookahead != '.') {
        return $token;
      }
      elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\\!\\\$?[A-Ia-i]?[A-Za-z]\\\$?[0-9]+\$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and $this->_lookahead != ':' and $this->_lookahead != '.') {
        return $token;
      }
      elseif (preg_match('/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?[0-9]+:(\\$)?[A-Ia-i]?[A-Za-z](\\$)?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
        return $token;
      }
      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", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
        return $token;
      }
      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", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
        return $token;
      }
      elseif (is_numeric($token) and (!is_numeric($token . $this->_lookahead) or $this->_lookahead == '') and $this->_lookahead != '!' and $this->_lookahead != ':') {
        return $token;
      }
      elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and substr_count($token, '"') % 2 == 0) {
        return $token;
      }
      elseif (preg_match("/^#[A-Z0\\/]{3,5}[!?]{1}\$/", $token) or $token == '#N/A') {
        return $token;
      }
      elseif (preg_match("", $token) and $this->_lookahead == "(") {
        return $token;
      }
      elseif (substr($token, -1) == ')') {
        return $token;
      }
      return '';
  }
}