| @@ 132-143 (lines=12) @@ | ||
| 129 | } |
|
| 130 | ||
| 131 | if ($state === 0) { |
|
| 132 | if (($token->type === Token::TYPE_KEYWORD) && $token->keyword === 'CHECK') { |
|
| 133 | $state = 0; |
|
| 134 | } elseif(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 135 | $state = 1; |
|
| 136 | array_push($bracketStack, '('); |
|
| 137 | } else { |
|
| 138 | $parser->error( |
|
| 139 | 'Invalid token', |
|
| 140 | $token |
|
| 141 | ); |
|
| 142 | return $ret; |
|
| 143 | } |
|
| 144 | } else if($state === 1) { |
|
| 145 | if(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 146 | array_push($bracketStack, '('); |
|
| @@ 145-157 (lines=13) @@ | ||
| 142 | return $ret; |
|
| 143 | } |
|
| 144 | } else if($state === 1) { |
|
| 145 | if(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 146 | array_push($bracketStack, '('); |
|
| 147 | $state = 1; |
|
| 148 | } elseif($token->type === Token::TYPE_OPERATOR) { |
|
| 149 | $parser->error( |
|
| 150 | 'A Column name was expected!', |
|
| 151 | $token |
|
| 152 | ); |
|
| 153 | return $ret; |
|
| 154 | } else { |
|
| 155 | $ret->columns[] = $token->value; |
|
| 156 | $state = 2; |
|
| 157 | } |
|
| 158 | } elseif ($state === 2) { |
|
| 159 | if(($token->type === Token::TYPE_OPERATOR) || in_array($token->value, self::$operatorsArray)) { |
|
| 160 | if(($token->value === ')')) { |
|
| @@ 182-196 (lines=15) @@ | ||
| 179 | ); |
|
| 180 | return $ret; |
|
| 181 | } |
|
| 182 | } elseif ($state === 3) { |
|
| 183 | if(($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) { |
|
| 184 | $state = 3; |
|
| 185 | array_push($bracketStack, '('); |
|
| 186 | } elseif($token->type === Token::TYPE_OPERATOR) { |
|
| 187 | $parser->error( |
|
| 188 | 'An operand was expected!', |
|
| 189 | $token |
|
| 190 | ); |
|
| 191 | return $ret; |
|
| 192 | } else { |
|
| 193 | $ret->operands[] = $token->value; |
|
| 194 | $state = 4; |
|
| 195 | } |
|
| 196 | } elseif ($state === 4) { |
|
| 197 | if (($token->value === 'AND') || ($token->value === 'OR')) { |
|
| 198 | $ret->logicalOperators[] = $token->value; |
|
| 199 | $state = 1; |
|