| 1 |
<?php |
| 2 |
/** |
| 3 |
* PHPExcel |
| 4 |
* |
| 5 |
* Copyright (c) 2006 - 2014 PHPExcel |
| 6 |
* |
| 7 |
* This library is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU Lesser General Public |
| 9 |
* License as published by the Free Software Foundation; either |
| 10 |
* version 2.1 of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This library is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
* Lesser General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU Lesser General Public |
| 18 |
* License along with this library; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
* |
| 21 |
* @category PHPExcel |
| 22 |
* @package PHPExcel_Calculation |
| 23 |
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
| 24 |
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
| 25 |
* @version ##VERSION##, ##DATE## |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
/* |
| 30 |
PARTLY BASED ON: |
| 31 |
Copyright (c) 2007 E. W. Bachtal, Inc. |
| 32 |
|
| 33 |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| 34 |
and associated documentation files (the "Software"), to deal in the Software without restriction, |
| 35 |
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 36 |
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |
| 37 |
subject to the following conditions: |
| 38 |
|
| 39 |
The above copyright notice and this permission notice shall be included in all copies or substantial |
| 40 |
portions of the Software. |
| 41 |
|
| 42 |
The software is provided "as is", without warranty of any kind, express or implied, including but not |
| 43 |
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In |
| 44 |
no event shall the authors or copyright holders be liable for any claim, damages or other liability, |
| 45 |
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the |
| 46 |
software or the use or other dealings in the software. |
| 47 |
|
| 48 |
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html |
| 49 |
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html |
| 50 |
*/ |
| 51 |
|
| 52 |
|
| 53 |
/** |
| 54 |
* PHPExcel_Calculation_FormulaToken |
| 55 |
* |
| 56 |
* @category PHPExcel |
| 57 |
* @package PHPExcel_Calculation |
| 58 |
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel) |
| 59 |
*/ |
| 60 |
class PHPExcel_Calculation_FormulaToken { |
| 61 |
/* Token types */ |
| 62 |
const TOKEN_TYPE_NOOP = 'Noop'; |
| 63 |
const TOKEN_TYPE_OPERAND = 'Operand'; |
| 64 |
const TOKEN_TYPE_FUNCTION = 'Function'; |
| 65 |
const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression'; |
| 66 |
const TOKEN_TYPE_ARGUMENT = 'Argument'; |
| 67 |
const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix'; |
| 68 |
const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix'; |
| 69 |
const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix'; |
| 70 |
const TOKEN_TYPE_WHITESPACE = 'Whitespace'; |
| 71 |
const TOKEN_TYPE_UNKNOWN = 'Unknown'; |
| 72 |
|
| 73 |
/* Token subtypes */ |
| 74 |
const TOKEN_SUBTYPE_NOTHING = 'Nothing'; |
| 75 |
const TOKEN_SUBTYPE_START = 'Start'; |
| 76 |
const TOKEN_SUBTYPE_STOP = 'Stop'; |
| 77 |
const TOKEN_SUBTYPE_TEXT = 'Text'; |
| 78 |
const TOKEN_SUBTYPE_NUMBER = 'Number'; |
| 79 |
const TOKEN_SUBTYPE_LOGICAL = 'Logical'; |
| 80 |
const TOKEN_SUBTYPE_ERROR = 'Error'; |
| 81 |
const TOKEN_SUBTYPE_RANGE = 'Range'; |
| 82 |
const TOKEN_SUBTYPE_MATH = 'Math'; |
| 83 |
const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation'; |
| 84 |
const TOKEN_SUBTYPE_INTERSECTION = 'Intersection'; |
| 85 |
const TOKEN_SUBTYPE_UNION = 'Union'; |
| 86 |
|
| 87 |
/** |
| 88 |
* Value |
| 89 |
* |
| 90 |
* @var string |
| 91 |
*/ |
| 92 |
private $_value; |
| 93 |
|
| 94 |
/** |
| 95 |
* Token Type (represented by TOKEN_TYPE_*) |
| 96 |
* |
| 97 |
* @var string |
| 98 |
*/ |
| 99 |
private $_tokenType; |
| 100 |
|
| 101 |
/** |
| 102 |
* Token SubType (represented by TOKEN_SUBTYPE_*) |
| 103 |
* |
| 104 |
* @var string |
| 105 |
*/ |
| 106 |
private $_tokenSubType; |
| 107 |
|
| 108 |
/** |
| 109 |
* Create a new PHPExcel_Calculation_FormulaToken |
| 110 |
* |
| 111 |
* @param string $pValue |
| 112 |
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*) |
| 113 |
* @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*) |
| 114 |
*/ |
| 115 |
public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) |
| 116 |
{ |
| 117 |
// Initialise values |
| 118 |
$this->_value = $pValue; |
| 119 |
$this->_tokenType = $pTokenType; |
| 120 |
$this->_tokenSubType = $pTokenSubType; |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* Get Value |
| 125 |
* |
| 126 |
* @return string |
| 127 |
*/ |
| 128 |
public function getValue() { |
| 129 |
return $this->_value; |
| 130 |
} |
| 131 |
|
| 132 |
/** |
| 133 |
* Set Value |
| 134 |
* |
| 135 |
* @param string $value |
| 136 |
*/ |
| 137 |
public function setValue($value) { |
| 138 |
$this->_value = $value; |
| 139 |
} |
| 140 |
|
| 141 |
/** |
| 142 |
* Get Token Type (represented by TOKEN_TYPE_*) |
| 143 |
* |
| 144 |
* @return string |
| 145 |
*/ |
| 146 |
public function getTokenType() { |
| 147 |
return $this->_tokenType; |
| 148 |
} |
| 149 |
|
| 150 |
/** |
| 151 |
* Set Token Type |
| 152 |
* |
| 153 |
* @param string $value |
| 154 |
*/ |
| 155 |
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN) { |
| 156 |
$this->_tokenType = $value; |
| 157 |
} |
| 158 |
|
| 159 |
/** |
| 160 |
* Get Token SubType (represented by TOKEN_SUBTYPE_*) |
| 161 |
* |
| 162 |
* @return string |
| 163 |
*/ |
| 164 |
public function getTokenSubType() { |
| 165 |
return $this->_tokenSubType; |
| 166 |
} |
| 167 |
|
| 168 |
/** |
| 169 |
* Set Token SubType |
| 170 |
* |
| 171 |
* @param string $value |
| 172 |
*/ |
| 173 |
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) { |
| 174 |
$this->_tokenSubType = $value; |
| 175 |
} |
| 176 |
} |
| 177 |
|