Exemplo n.º 1
0
 /** 
  * Parse multipicative operators (mul, div, mod)
  * 
  * @return AbstractExpression
  */
 private function _parseMultiplicative()
 {
     $this->_recurseEnter();
     $left = $this->_parseUnary();
     while ($this->_getCurrentToken()->identifierIs(ODataConstants::KEYWORD_MULTIPLY) || $this->_getCurrentToken()->identifierIs(ODataConstants::KEYWORD_DIVIDE) || $this->_getCurrentToken()->identifierIs(ODataConstants::KEYWORD_MODULO)) {
         $multiplicativeToken = clone $this->_getCurrentToken();
         $this->_lexer->nextToken();
         $right = $this->_parseUnary();
         $opReturnType = FunctionDescription::verifyAndPromoteArithmeticOpArguments($multiplicativeToken, $left, $right);
         if ($multiplicativeToken->identifierIs(ODataConstants::KEYWORD_MULTIPLY)) {
             $left = new ArithmeticExpression($left, $right, ExpressionType::MULTIPLY, $opReturnType);
         } else {
             if ($multiplicativeToken->identifierIs(ODataConstants::KEYWORD_DIVIDE)) {
                 $left = new ArithmeticExpression($left, $right, ExpressionType::DIVIDE, $opReturnType);
             } else {
                 $left = new ArithmeticExpression($left, $right, ExpressionType::MODULO, $opReturnType);
             }
         }
     }
     $this->_recurseLeave();
     return $left;
 }