Exemple #1
0
 /**
  * ComparisonOperator ::= "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
  *
  * @return string
  */
 public function ComparisonOperator()
 {
     switch ($this->_lexer->lookahead['value']) {
         case '=':
             $this->match(Lexer::T_EQUALS);
             return '=';
         case '<':
             $this->match(Lexer::T_LOWER_THAN);
             $operator = '<';
             if ($this->_lexer->isNextToken(Lexer::T_EQUALS)) {
                 $this->match(Lexer::T_EQUALS);
                 $operator .= '=';
             } else {
                 if ($this->_lexer->isNextToken(Lexer::T_GREATER_THAN)) {
                     $this->match(Lexer::T_GREATER_THAN);
                     $operator .= '>';
                 }
             }
             return $operator;
         case '>':
             $this->match(Lexer::T_GREATER_THAN);
             $operator = '>';
             if ($this->_lexer->isNextToken(Lexer::T_EQUALS)) {
                 $this->match(Lexer::T_EQUALS);
                 $operator .= '=';
             }
             return $operator;
         case '!':
             $this->match(Lexer::T_NEGATE);
             $this->match(Lexer::T_EQUALS);
             return '<>';
         default:
             $this->syntaxError('=, <, <=, <>, >, >=, !=');
     }
 }
Exemple #2
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');
                 }
             }
         }
     }
 }