Skip to content

Commit

Permalink
Change Query\Parser::match to Query\Parser::matchToken including DQL …
Browse files Browse the repository at this point in the history
…functions.
  • Loading branch information
beberlei committed Oct 24, 2020
1 parent 06d17cc commit 2790704
Show file tree
Hide file tree
Showing 20 changed files with 239 additions and 239 deletions.
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/AbsFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Query/AST/Functions/BitAndFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->firstArithmetic = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);
$this->secondArithmetic = $parser->ArithmeticPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Query/AST/Functions/BitOrFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->firstArithmetic = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);
$this->secondArithmetic = $parser->ArithmeticPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
10 changes: 5 additions & 5 deletions lib/Doctrine/ORM/Query/AST/Functions/ConcatFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->firstStringPrimary = $parser->StringPrimary();
$this->concatExpressions[] = $this->firstStringPrimary;

$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);

$this->secondStringPrimary = $parser->StringPrimary();
$this->concatExpressions[] = $this->secondStringPrimary;

while ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);
$this->concatExpressions[] = $parser->StringPrimary();
}

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}

6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/CurrentDateFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/CurrentTimeFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
10 changes: 5 additions & 5 deletions lib/Doctrine/ORM/Query/AST/Functions/DateAddFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ public function getSql(SqlWalker $sqlWalker)
*/
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->firstDateExpression = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);
$this->intervalExpression = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);
$this->unit = $parser->StringPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Query/AST/Functions/DateDiffFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ public function getSql(SqlWalker $sqlWalker)
*/
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->date1 = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);
$this->date2 = $parser->ArithmeticPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
10 changes: 5 additions & 5 deletions lib/Doctrine/ORM/Query/AST/Functions/IdentityFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ public function getSql(SqlWalker $sqlWalker)
*/
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->pathExpression = $parser->SingleValuedAssociationPathExpression();

if ($parser->getLexer()->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA);
$parser->match(Lexer::T_STRING);
$parser->matchToken(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_STRING);

$this->fieldMapping = $parser->getLexer()->token['value'];
}

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/LengthFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->stringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}

public function getReturnType() : Type
Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/ORM/Query/AST/Functions/LocateFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,22 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->firstStringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);

$this->secondStringPrimary = $parser->StringPrimary();

$lexer = $parser->getLexer();
if ($lexer->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);

$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
}

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/LowerFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->stringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
8 changes: 4 additions & 4 deletions lib/Doctrine/ORM/Query/AST/Functions/ModFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);

$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->collectionPathExpression = $parser->CollectionValuedPathExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/SqrtFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
10 changes: 5 additions & 5 deletions lib/Doctrine/ORM/Query/AST/Functions/SubstringFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->stringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);

$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();

$lexer = $parser->getLexer();
if ($lexer->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA);
$parser->matchToken(Lexer::T_COMMA);

$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
}

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
16 changes: 8 additions & 8 deletions lib/Doctrine/ORM/Query/AST/Functions/TrimFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,24 @@ public function parse(Parser $parser)
{
$lexer = $parser->getLexer();

$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->parseTrimMode($parser);

if ($lexer->isNextToken(Lexer::T_STRING)) {
$parser->match(Lexer::T_STRING);
$parser->matchToken(Lexer::T_STRING);

$this->trimChar = $lexer->token['value'];
}

if ($this->leading || $this->trailing || $this->both || $this->trimChar) {
$parser->match(Lexer::T_FROM);
$parser->matchToken(Lexer::T_FROM);
}

$this->stringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}

/**
Expand Down Expand Up @@ -135,23 +135,23 @@ private function parseTrimMode(Parser $parser)
$value = $lexer->lookahead['value'];

if (strcasecmp('leading', $value) === 0) {
$parser->match(Lexer::T_LEADING);
$parser->matchToken(Lexer::T_LEADING);

$this->leading = true;

return;
}

if (strcasecmp('trailing', $value) === 0) {
$parser->match(Lexer::T_TRAILING);
$parser->matchToken(Lexer::T_TRAILING);

$this->trailing = true;

return;
}

if (strcasecmp('both', $value) === 0) {
$parser->match(Lexer::T_BOTH);
$parser->matchToken(Lexer::T_BOTH);

$this->both = true;

Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ORM/Query/AST/Functions/UpperFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$parser->matchToken(Lexer::T_IDENTIFIER);
$parser->matchToken(Lexer::T_OPEN_PARENTHESIS);

$this->stringPrimary = $parser->StringPrimary();

$parser->match(Lexer::T_CLOSE_PARENTHESIS);
$parser->matchToken(Lexer::T_CLOSE_PARENTHESIS);
}
}
Loading

0 comments on commit 2790704

Please sign in to comment.