1
0
mirror of synced 2024-12-13 06:46:03 +03:00

some updates to new parser

This commit is contained in:
zYne 2008-01-17 22:01:40 +00:00
parent ef4798921b
commit 7e4875f4b7
6 changed files with 14 additions and 17 deletions

View File

@ -49,22 +49,14 @@ class Doctrine_Query_Production_AbstractSchemaName extends Doctrine_Query_Produc
*/
public function execute(array $params = array())
{
$table = null;
$token = $this->_parser->lookahead;
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);
} else {
$this->_parser->logError('Identifier expected');
}
return $table;
return $token;
}
}

View File

@ -15,5 +15,6 @@ class Doctrine_Query_Production_IdentificationVariable extends Doctrine_Query_Pr
$this->error('"' . $name . '" is not a identification variable.');
}
*/
return $token;
}
}

View File

@ -6,11 +6,12 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
{
public function execute(array $params = array())
{
$this->RangeVariableDeclaration();
$rangeVarDecl = $this->RangeVariableDeclaration();
while ($this->_isNextToken(Doctrine_Query_Token::T_LEFT) ||
$this->_isNextToken(Doctrine_Query_Token::T_INNER) ||
$this->_isNextToken(Doctrine_Query_Token::T_JOIN)) {
$this->_isNextToken(Doctrine_Query_Token::T_INNER) ||
$this->_isNextToken(Doctrine_Query_Token::T_JOIN)) {
$this->Join();
}
}

View File

@ -19,7 +19,7 @@ class Doctrine_Query_Production_Join extends Doctrine_Query_Production
$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_IDENTIFIER);

View File

@ -6,12 +6,15 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
{
public function execute(array $params = array())
{
$this->AbstractSchemaName();
$abstractSchemaName = $this->AbstractSchemaName();
if ($this->_isNextToken(Doctrine_Query_Token::T_AS)) {
$this->_parser->match(Doctrine_Query_Token::T_AS);
}
$this->IdentificationVariable();
$identifier = $this->IdentificationVariable();
return array('abstractSchemaName' => $abstractSchemaName,
'identifier' => $identifier);
}
}

View File

@ -36,8 +36,8 @@ UpdateItem = PathExpression "=" (Expression | "NULL")
IdentificationVariableDeclaration = RangeVariableDeclaration {Join}
RangeVariableDeclaration = AbstractSchemaName ["AS"] IdentificationVariable
Join = ["LEFT" | "INNER"] "JOIN" PathExpression ["AS"] IdentificationVariable [("ON" | "WITH") ConditionalExpression] [IndexBy]
IndexBy = "INDEXBY" PathExpression
Join = ["LEFT" | "INNER"] "JOIN" RangeVariableDeclaration [("ON" | "WITH") ConditionalExpression] [IndexBy]
IndexBy = "INDEX" "BY" PathExpression
ConditionalExpression = ConditionalTerm {"OR" ConditionalTerm}
ConditionalTerm = ConditionalFactor {"AND" ConditionalFactor}