Esempio n. 1
0
 /**
  * StringPrimary ::= StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression
  */
 public function _StringPrimary()
 {
     if ($this->_lexer->lookahead['type'] === Lexer::T_IDENTIFIER) {
         $peek = $this->_lexer->glimpse();
         if ($peek['value'] == '.') {
             return $this->_StateFieldPathExpression();
         } else {
             if ($peek['value'] == '(') {
                 return $this->_FunctionsReturningStrings();
             } else {
                 $this->syntaxError("'.' or '('");
             }
         }
     } else {
         if ($this->_lexer->lookahead['type'] === Lexer::T_STRING) {
             $this->match(Lexer::T_STRING);
             return $this->_lexer->token['value'];
         } else {
             if ($this->_lexer->lookahead['type'] === Lexer::T_INPUT_PARAMETER) {
                 $this->match(Lexer::T_INPUT_PARAMETER);
                 return new AST\InputParameter($this->_lexer->token['value']);
             } else {
                 if ($this->_isAggregateFunction($this->_lexer->lookahead['type'])) {
                     return $this->_AggregateExpression();
                 } else {
                     $this->syntaxError('StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression');
                 }
             }
         }
     }
 }
Esempio n. 2
0
 /**
  * ComparisonExpression ::= ArithmeticExpression ComparisonOperator ( QuantifiedExpression | ArithmeticExpression )
  *
  * @return \Doctrine\ORM\Query\AST\ComparisonExpression
  */
 public function ComparisonExpression()
 {
     $peek = $this->_lexer->glimpse();
     $leftExpr = $this->ArithmeticExpression();
     $operator = $this->ComparisonOperator();
     $rightExpr = $this->_isNextAllAnySome() ? $this->QuantifiedExpression() : $this->ArithmeticExpression();
     return new AST\ComparisonExpression($leftExpr, $operator, $rightExpr);
 }