Ejemplo n.º 1
0
 /**
  * Populate node with operands, without any simplification.
  *
  * @param Node $node
  * @retval Node
  * @throws SyntaxErrorException
  */
 protected function naiveHandleExpression($node)
 {
     if ($node->getOperator() == '~') {
         $left = $this->operandStack->pop();
         if ($left === null) {
             throw new SyntaxErrorException();
         }
         $node->setOperator('-');
         $node->setLeft($left);
         return $node;
     }
     $right = $this->operandStack->pop();
     $left = $this->operandStack->pop();
     if ($right === null || $left === null) {
         throw new SyntaxErrorException();
     }
     $node->setLeft($left);
     $node->setRight($right);
     return $node;
 }