} elseif ($temp=='(') {
$this->_stackAdd($temp);
} elseif (($this->_stackEmpty()) || (($this->_priority($temp) > $this->_stackPriority()))) {
$this-> _stackAdd($temp);
} else {
while(!$this->_stackEmpty() && ($this->_priority($temp) <= $this->_stackPriority())) {
$this->_outputAdd($this->_stackDelete());
}
$this->_stackAdd($temp);
}
}
}
while(!$this->_stackEmpty()) {
$this->_outputAdd($this->_stackDelete());
}
return $this->_output;
}
function _rpnToValue() {
$time1 = $this->_getMicroTime();
if ($this->_error <> null) {
$this->_value = null;
return $this->_value;
}
$this->_value = 0;
$temp = $this->_output;
do {
$pos = $this->_nextOperator($temp);
if ($pos == -1) {
$this->_error = $this->_raiseError('Syntax error');
$this->_value = null;
return $this->_value;
}
$operator = $this->_operation[$temp[$pos]];
$arg = $operator[2];
$function = $operator[3];
if (($arg==2) && (!isset($temp[$pos-1]) || !is_numeric($temp[$pos-1]) || !isset($temp[$pos-2]) || !is_numeric($temp[$pos-2]))) {
$this->_error = $this->_raiseError('Syntax error');
$this->_value = null;
return $this->_value;
} elseif (($arg==1) && (!isset($temp[$pos-1]) || !is_numeric($temp[$pos-1]))) {
$this->_error = $this->_raiseError('Syntax error');
$this->_value = null;
return $this->_value;
}
if(is_array($function)) {
if($arg==2) $arg_array = array($temp[$pos-2],$temp[$pos-1]);
elseif($arg==1) $arg_array = array($temp[$pos-1]);
else $arg_array = array();
if($function['type'] == 'userFunction') {
$this->_value = call_user_func_array($function['function'], $arg_array);
} else {
$function_array = array(&$function['class'], $function['method']);
$this->_value = call_user_func_array($function_array, $arg_array);
}
} else {
$this->_value = $this->$function($temp, $pos);
}
if ($this->_isNan($this->_value)) {
$this->_error = $this->_raiseError('NAN value');
$this->_value = null;
return $this->_value;
} elseif ($this->_isInfinite($this->_value)) {
$this->_error = $this->_raiseError('Infinite value');
$this->_value = null;
return $this->_value;
} elseif (is_null($this->_value)) {
return $this->_value;
}
$temp = $this->_refresh($temp, $pos, $arg, $this->_value);
} while(count($temp) > 1);
$this->_value = $temp[0];
$time2 = $this->_getMicroTime();
$this->_timer = $time2 - $time1;
return $this->_value;
}
