2
0
forked from Wavyzz/dolibarr

Fix syntax

This commit is contained in:
Laurent Destailleur
2020-07-03 00:36:56 +02:00
parent b45bfd258d
commit fd617658ef

View File

@@ -270,11 +270,12 @@ class EvalMath
// =============== // ===============
} elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis? } elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis?
while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last ( while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last (
if (is_null($o2)) if (is_null($o2)) {
return $this->trigger(5, "unexpected ')'", ")"); return $this->trigger(5, "unexpected ')'", ")");
else } else {
$output[] = $o2; $output[] = $o2;
} }
}
if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function? if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function?
$fnn = $matches[1]; // get the function name $fnn = $matches[1]; // get the function name
$arg_count = $stack->pop(); // see how many arguments there were (cleverly stored on the stack, thank you) $arg_count = $stack->pop(); // see how many arguments there were (cleverly stored on the stack, thank you)
@@ -293,11 +294,12 @@ class EvalMath
// =============== // ===============
} elseif ($op == ',' and $expecting_op) { // did we just finish a function argument? } elseif ($op == ',' and $expecting_op) { // did we just finish a function argument?
while (($o2 = $stack->pop()) != '(') { while (($o2 = $stack->pop()) != '(') {
if (is_null($o2)) if (is_null($o2)) {
return $this->trigger(5, "unexpected ','", ","); // oops, never had a ( return $this->trigger(5, "unexpected ','", ","); // oops, never had a (
else } else {
$output[] = $o2; // pop the argument expression stuff and push onto the output $output[] = $o2; // pop the argument expression stuff and push onto the output
} }
}
// make sure there was a function // make sure there was a function
if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches))
return $this->trigger(5, "unexpected ','", ","); return $this->trigger(5, "unexpected ','", ",");