@@ 3126-3132 (lines=7) @@ | ||
3123 | $expectingOperator = false; |
|
3124 | } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
|
3125 | $expectingOperand = false; |
|
3126 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3127 | if ($o2 === null) { |
|
3128 | return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); |
|
3129 | } else { |
|
3130 | $output[] = $o2; |
|
3131 | } |
|
3132 | } |
|
3133 | $d = $stack->last(2); |
|
3134 | if (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3135 | $functionName = $matches[1]; // Get the function name |
|
@@ 3192-3198 (lines=7) @@ | ||
3189 | } |
|
3190 | ++$index; |
|
3191 | } elseif ($opCharacter == ',') { // Is this the separator for function arguments? |
|
3192 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3193 | if ($o2 === null) { |
|
3194 | return $this->raiseFormulaError('Formula Error: Unexpected ,'); |
|
3195 | } else { |
|
3196 | $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3197 | } |
|
3198 | } |
|
3199 | // If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
|
3200 | // so push a null onto the stack |
|
3201 | if (($expectingOperand) || (!$expectingOperator)) { |
|
@@ 3368-3373 (lines=6) @@ | ||
3365 | } |
|
3366 | } |
|
3367 | ||
3368 | while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output |
|
3369 | if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { |
|
3370 | return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3371 | } |
|
3372 | $output[] = $op; |
|
3373 | } |
|
3374 | ||
3375 | return $output; |
|
3376 | } |