some updates to new parser
This commit is contained in:
parent
ef4798921b
commit
7e4875f4b7
@ -49,22 +49,14 @@ class Doctrine_Query_Production_AbstractSchemaName extends Doctrine_Query_Produc
|
|||||||
*/
|
*/
|
||||||
public function execute(array $params = array())
|
public function execute(array $params = array())
|
||||||
{
|
{
|
||||||
$table = null;
|
|
||||||
$token = $this->_parser->lookahead;
|
$token = $this->_parser->lookahead;
|
||||||
|
|
||||||
if ($token['type'] === Doctrine_Query_Token::T_IDENTIFIER) {
|
if ($token['type'] === Doctrine_Query_Token::T_IDENTIFIER) {
|
||||||
|
|
||||||
$table = $this->_parser->getConnection()->getTable($token['value']);
|
|
||||||
|
|
||||||
if ($table === null) {
|
|
||||||
$this->_parser->logError('Table named "' . $name . '" does not exist.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_parser->match(Doctrine_Query_Token::T_IDENTIFIER);
|
$this->_parser->match(Doctrine_Query_Token::T_IDENTIFIER);
|
||||||
} else {
|
} else {
|
||||||
$this->_parser->logError('Identifier expected');
|
$this->_parser->logError('Identifier expected');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $table;
|
return $token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,5 +15,6 @@ class Doctrine_Query_Production_IdentificationVariable extends Doctrine_Query_Pr
|
|||||||
$this->error('"' . $name . '" is not a identification variable.');
|
$this->error('"' . $name . '" is not a identification variable.');
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
return $token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,12 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
|
|||||||
{
|
{
|
||||||
public function execute(array $params = array())
|
public function execute(array $params = array())
|
||||||
{
|
{
|
||||||
$this->RangeVariableDeclaration();
|
$rangeVarDecl = $this->RangeVariableDeclaration();
|
||||||
|
|
||||||
while ($this->_isNextToken(Doctrine_Query_Token::T_LEFT) ||
|
while ($this->_isNextToken(Doctrine_Query_Token::T_LEFT) ||
|
||||||
$this->_isNextToken(Doctrine_Query_Token::T_INNER) ||
|
$this->_isNextToken(Doctrine_Query_Token::T_INNER) ||
|
||||||
$this->_isNextToken(Doctrine_Query_Token::T_JOIN)) {
|
$this->_isNextToken(Doctrine_Query_Token::T_JOIN)) {
|
||||||
|
|
||||||
$this->Join();
|
$this->Join();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ class Doctrine_Query_Production_Join extends Doctrine_Query_Production
|
|||||||
|
|
||||||
$this->_parser->match(Doctrine_Query_Token::T_JOIN);
|
$this->_parser->match(Doctrine_Query_Token::T_JOIN);
|
||||||
|
|
||||||
$this->PathExpression();
|
$this->RangeVariableDeclaration();
|
||||||
|
|
||||||
$this->_parser->match(Doctrine_Query_Token::T_AS);
|
$this->_parser->match(Doctrine_Query_Token::T_AS);
|
||||||
$this->_parser->match(Doctrine_Query_Token::T_IDENTIFIER);
|
$this->_parser->match(Doctrine_Query_Token::T_IDENTIFIER);
|
||||||
|
@ -6,12 +6,15 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
|
|||||||
{
|
{
|
||||||
public function execute(array $params = array())
|
public function execute(array $params = array())
|
||||||
{
|
{
|
||||||
$this->AbstractSchemaName();
|
$abstractSchemaName = $this->AbstractSchemaName();
|
||||||
|
|
||||||
if ($this->_isNextToken(Doctrine_Query_Token::T_AS)) {
|
if ($this->_isNextToken(Doctrine_Query_Token::T_AS)) {
|
||||||
$this->_parser->match(Doctrine_Query_Token::T_AS);
|
$this->_parser->match(Doctrine_Query_Token::T_AS);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->IdentificationVariable();
|
$identifier = $this->IdentificationVariable();
|
||||||
|
|
||||||
|
return array('abstractSchemaName' => $abstractSchemaName,
|
||||||
|
'identifier' => $identifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ UpdateItem = PathExpression "=" (Expression | "NULL")
|
|||||||
IdentificationVariableDeclaration = RangeVariableDeclaration {Join}
|
IdentificationVariableDeclaration = RangeVariableDeclaration {Join}
|
||||||
RangeVariableDeclaration = AbstractSchemaName ["AS"] IdentificationVariable
|
RangeVariableDeclaration = AbstractSchemaName ["AS"] IdentificationVariable
|
||||||
|
|
||||||
Join = ["LEFT" | "INNER"] "JOIN" PathExpression ["AS"] IdentificationVariable [("ON" | "WITH") ConditionalExpression] [IndexBy]
|
Join = ["LEFT" | "INNER"] "JOIN" RangeVariableDeclaration [("ON" | "WITH") ConditionalExpression] [IndexBy]
|
||||||
IndexBy = "INDEXBY" PathExpression
|
IndexBy = "INDEX" "BY" PathExpression
|
||||||
|
|
||||||
ConditionalExpression = ConditionalTerm {"OR" ConditionalTerm}
|
ConditionalExpression = ConditionalTerm {"OR" ConditionalTerm}
|
||||||
ConditionalTerm = ConditionalFactor {"AND" ConditionalFactor}
|
ConditionalTerm = ConditionalFactor {"AND" ConditionalFactor}
|
||||||
|
Loading…
Reference in New Issue
Block a user