1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/draft/Doctrine/Query/Production/SimpleConditionalExpression.php
2007-12-10 20:02:41 +00:00

51 lines
1.6 KiB
PHP

<?php
/**
* SimpleConditionalExpression =
* Expression (ComparisonExpression | BetweenExpression | LikeExpression |
* InExpression | NullComparisonExpression | QuantifiedExpression) |
* ExistsExpression
*/
class Doctrine_Query_Production_SimpleConditionalExpression extends Doctrine_Query_Production
{
protected function _getExpressionType() {
if ($this->_isNextToken(Doctrine_Query_Token::T_NOT)) {
$token = $this->_parser->getScanner()->peek();
$this->_parser->getScanner()->resetPeek();
} else {
$token = $this->_parser->lookahead;
}
return $token['type'];
}
public function execute(array $params = array())
{
if ($this->_getExpressionType() === Doctrine_Query_Token::T_EXISTS) {
$this->ExistsExpression();
} else {
$this->Expression();
switch ($this->_getExpressionType()) {
case Doctrine_Query_Token::T_BETWEEN:
$this->BetweenExpression();
break;
case Doctrine_Query_Token::T_LIKE:
$this->LikeExpression();
break;
case Doctrine_Query_Token::T_IN:
$this->InExpression();
break;
case Doctrine_Query_Token::T_IS:
$this->NullComparisonExpression();
break;
case Doctrine_Query_Token::T_NONE:
$this->ComparisonExpression();
break;
default:
$this->_parser->syntaxError();
}
}
}
}