Fix two-word tests precedence over one-word tests

This commit is contained in:
Fabien Potencier
2024-08-26 15:04:26 +02:00
parent 220b95c080
commit 58d5780ef3
3 changed files with 19 additions and 7 deletions
+7 -7
View File
@@ -750,15 +750,15 @@ class ExpressionParser
$stream = $this->parser->getStream();
$name = $stream->expect(Token::NAME_TYPE)->getValue();
if (!$test = $this->env->getTest($name)) {
if ($stream->test(Token::NAME_TYPE)) {
// try 2-words tests
$name = $name.' '.$this->parser->getCurrentToken()->getValue();
if ($stream->test(Token::NAME_TYPE)) {
// try 2-words tests
$name = $name.' '.$this->parser->getCurrentToken()->getValue();
if ($test = $this->env->getTest($name)) {
$stream->next();
}
if ($test = $this->env->getTest($name)) {
$stream->next();
}
} else {
$test = $this->env->getTest($name);
}
if (!$test) {