|
@@ 2717-2720 (lines=4) @@
|
| 2714 |
|
} elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
| 2715 |
|
// echo 'Element is a Closing bracket<br />'; |
| 2716 |
|
$expectingOperand = false; |
| 2717 |
|
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
| 2718 |
|
if ($o2 === NULL) return $this->_raiseFormulaError('Formula Error: Unexpected closing brace ")"'); |
| 2719 |
|
else $output[] = $o2; |
| 2720 |
|
} |
| 2721 |
|
$d = $stack->last(2); |
| 2722 |
|
if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
| 2723 |
|
$functionName = $matches[1]; // Get the function name |
|
@@ 2796-2799 (lines=4) @@
|
| 2793 |
|
|
| 2794 |
|
} elseif ($opCharacter == ',') { // Is this the separator for function arguments? |
| 2795 |
|
// echo 'Element is a Function argument separator<br />'; |
| 2796 |
|
while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
| 2797 |
|
if ($o2 === NULL) return $this->_raiseFormulaError("Formula Error: Unexpected ,"); |
| 2798 |
|
else $output[] = $o2; // pop the argument expression stuff and push onto the output |
| 2799 |
|
} |
| 2800 |
|
// If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
| 2801 |
|
// so push a null onto the stack |
| 2802 |
|
if (($expectingOperand) || (!$expectingOperator)) { |
|
@@ 2979-2983 (lines=5) @@
|
| 2976 |
|
} |
| 2977 |
|
} |
| 2978 |
|
|
| 2979 |
|
while (($op = $stack->pop()) !== NULL) { // pop everything off the stack and push onto output |
| 2980 |
|
if ((is_array($opCharacter) && $opCharacter['value'] == '(') || ($opCharacter === '(')) |
| 2981 |
|
return $this->_raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
| 2982 |
|
$output[] = $op; |
| 2983 |
|
} |
| 2984 |
|
return $output; |
| 2985 |
|
} // function _parseFormula() |
| 2986 |
|
|