mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-11 06:15:43 +00:00
Add support for detecting if an expression had explicit parentheses
This commit is contained in:
@@ -169,15 +169,10 @@ class ExpressionParser
|
||||
return $this->parsePostfixExpression(new $class($expr, $token->getLine()));
|
||||
} elseif ($token->test(Token::PUNCTUATION_TYPE, '(')) {
|
||||
$this->parser->getStream()->next();
|
||||
$expr = $this->parseExpression();
|
||||
$expr = $this->parseExpression()->setExplicitParentheses();
|
||||
$this->parser->getStream()->expect(Token::PUNCTUATION_TYPE, ')', 'An opened parenthesis is not properly closed');
|
||||
|
||||
$expr = $this->parsePostfixExpression($expr);
|
||||
if ($expr instanceof NegUnary) {
|
||||
$expr->wrapInParentheses();
|
||||
}
|
||||
|
||||
return $expr;
|
||||
return $this->parsePostfixExpression($expr);
|
||||
}
|
||||
|
||||
return $this->parsePrimaryExpression();
|
||||
|
||||
Reference in New Issue
Block a user