@@ 3151-3156 (lines=6) @@ | ||
3148 | $expectingOperator = false; |
|
3149 | } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
|
3150 | $expectingOperand = false; |
|
3151 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3152 | if ($o2 === null) { |
|
3153 | return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); |
|
3154 | } |
|
3155 | $output[] = $o2; |
|
3156 | } |
|
3157 | $d = $stack->last(2); |
|
3158 | if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3159 | $functionName = $matches[1]; // Get the function name |
|
@@ 3216-3221 (lines=6) @@ | ||
3213 | } |
|
3214 | ++$index; |
|
3215 | } elseif ($opCharacter == ',') { // Is this the separator for function arguments? |
|
3216 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3217 | if ($o2 === null) { |
|
3218 | return $this->raiseFormulaError('Formula Error: Unexpected ,'); |
|
3219 | } |
|
3220 | $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3221 | } |
|
3222 | // If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
|
3223 | // so push a null onto the stack |
|
3224 | if (($expectingOperand) || (!$expectingOperator)) { |
|
@@ 3390-3395 (lines=6) @@ | ||
3387 | } |
|
3388 | } |
|
3389 | ||
3390 | while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output |
|
3391 | if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { |
|
3392 | return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3393 | } |
|
3394 | $output[] = $op; |
|
3395 | } |
|
3396 | ||
3397 | return $output; |
|
3398 | } |