@@ 3158-3163 (lines=6) @@ | ||
3155 | $expectingOperator = false; |
|
3156 | } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
|
3157 | $expectingOperand = false; |
|
3158 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3159 | if ($o2 === null) { |
|
3160 | return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); |
|
3161 | } |
|
3162 | $output[] = $o2; |
|
3163 | } |
|
3164 | $d = $stack->last(2); |
|
3165 | if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3166 | $functionName = $matches[1]; // Get the function name |
|
@@ 3223-3228 (lines=6) @@ | ||
3220 | } |
|
3221 | ++$index; |
|
3222 | } elseif ($opCharacter == ',') { // Is this the separator for function arguments? |
|
3223 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3224 | if ($o2 === null) { |
|
3225 | return $this->raiseFormulaError('Formula Error: Unexpected ,'); |
|
3226 | } |
|
3227 | $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3228 | } |
|
3229 | // If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
|
3230 | // so push a null onto the stack |
|
3231 | if (($expectingOperand) || (!$expectingOperator)) { |
|
@@ 3397-3402 (lines=6) @@ | ||
3394 | } |
|
3395 | } |
|
3396 | ||
3397 | while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output |
|
3398 | if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { |
|
3399 | return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3400 | } |
|
3401 | $output[] = $op; |
|
3402 | } |
|
3403 | ||
3404 | return $output; |
|
3405 | } |