private $env;
/** @var array<string, array{precedence: int, class: class-string<AbstractUnary>}> */
private $unaryOperators;
/** @var array<string, array{precedence: int, class: class-string<AbstractBinary>, associativity: self::OPERATOR_*}> */
private $binaryOperators;
public function __construct(Parser
$parser, Environment
$env) { $this->parser =
$parser;
$this->env =
$env;
$this->unaryOperators =
$env->
getUnaryOperators();
$this->binaryOperators =
$env->
getBinaryOperators();
} public function parseExpression($precedence = 0,
$allowArrow = false
) { if ($allowArrow &&
$arrow =
$this->
parseArrow()) { return $arrow;
} $expr =
$this->
getPrimary();
$token =
$this->parser->
getCurrentToken();
while ($this->
isBinary($token) &&
$this->binaryOperators
[$token->
getValue()]['precedence'
] >=
$precedence) {