For God so loved the world, that He gave His only begotten Son, that all who believe in Him should not perish but have everlasting life
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
5.5 KiB

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