@@ 3198-3204 (lines=7) @@ | ||
3195 | } elseif ($opCharacter == ')' && $expectingOperator) { // Are we expecting to close a parenthesis? |
|
3196 | //echo 'Element is a Closing bracket', PHP_EOL; |
|
3197 | $expectingOperand = false; |
|
3198 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3199 | if ($o2 === null) { |
|
3200 | return $this->raiseFormulaError('Formula Error: Unexpected closing brace ")"'); |
|
3201 | } else { |
|
3202 | $output[] = $o2; |
|
3203 | } |
|
3204 | } |
|
3205 | $d = $stack->last(2); |
|
3206 | if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $d['value'], $matches)) { // Did this parenthesis just close a function? |
|
3207 | $functionName = $matches[1]; // Get the function name |
|
@@ 3279-3285 (lines=7) @@ | ||
3276 | ++$index; |
|
3277 | } elseif ($opCharacter == ',') { // Is this the separator for function arguments? |
|
3278 | //echo 'Element is a Function argument separator', PHP_EOL; |
|
3279 | while (($o2 = $stack->pop()) && $o2['value'] != '(') { // Pop off the stack back to the last ( |
|
3280 | if ($o2 === null) { |
|
3281 | return $this->raiseFormulaError("Formula Error: Unexpected ,"); |
|
3282 | } else { |
|
3283 | $output[] = $o2; // pop the argument expression stuff and push onto the output |
|
3284 | } |
|
3285 | } |
|
3286 | // If we've a comma when we're expecting an operand, then what we actually have is a null operand; |
|
3287 | // so push a null onto the stack |
|
3288 | if (($expectingOperand) || (!$expectingOperator)) { |
|
@@ 3469-3474 (lines=6) @@ | ||
3466 | } |
|
3467 | } |
|
3468 | ||
3469 | while (($op = $stack->pop()) !== null) { // pop everything off the stack and push onto output |
|
3470 | if ((is_array($op) && $op['value'] == '(') || ($op === '(')) { |
|
3471 | return $this->raiseFormulaError("Formula Error: Expecting ')'"); // if there are any opening braces on the stack, then braces were unbalanced |
|
3472 | } |
|
3473 | $output[] = $op; |
|
3474 | } |
|
3475 | return $output; |
|
3476 | } |
|
3477 |