public function parseExpression($precedence = 0) {
$expr = $this
->getPrimary();
$token = $this->parser
->getCurrentToken();
while ($this
->isBinary($token) && $this->binaryOperators[$token
->getValue()]['precedence'] >= $precedence) {
$op = $this->binaryOperators[$token
->getValue()];
$this->parser
->getStream()
->next();
if (isset($op['callable'])) {
$expr = call_user_func($op['callable'], $this->parser, $expr);
}
else {
$expr1 = $this
->parseExpression(self::OPERATOR_LEFT === $op['associativity'] ? $op['precedence'] + 1 : $op['precedence']);
$class = $op['class'];
$expr = new $class($expr, $expr1, $token
->getLine());
}
$token = $this->parser
->getCurrentToken();
}
if (0 === $precedence) {
return $this
->parseConditionalExpression($expr);
}
return $expr;
}