Commit 7e4875f4 authored by zYne's avatar zYne

some updates to new parser

parent ef479892
......@@ -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;
}
}
......@@ -15,5 +15,6 @@ class Doctrine_Query_Production_IdentificationVariable extends Doctrine_Query_Pr
$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())
{
$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->Join();
}
}
......
......@@ -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);
......
......@@ -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);
}
}
......@@ -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}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment