|
@@ -34,16 +34,9 @@ class TransChoiceTokenParser extends TransTokenParser
|
|
|
|
|
|
$vars = new \Twig_Node_Expression_Array(array(), $lineno);
|
|
|
|
|
|
- $body = null;
|
|
|
$count = $this->parser->getExpressionParser()->parseExpression();
|
|
|
- $domain = new \Twig_Node_Expression_Constant('messages', $lineno);
|
|
|
|
|
|
- if (!$stream->test(\Twig_Token::BLOCK_END_TYPE) && $stream->test('for')) {
|
|
|
- // {% transchoice count for "message" %}
|
|
|
- // {% transchoice count for message %}
|
|
|
- $stream->next();
|
|
|
- $body = $this->parser->getExpressionParser()->parseExpression();
|
|
|
- }
|
|
|
+ $domain = new \Twig_Node_Expression_Constant('messages', $lineno);
|
|
|
|
|
|
if ($stream->test('with')) {
|
|
|
// {% transchoice count with vars %}
|
|
@@ -57,11 +50,9 @@ class TransChoiceTokenParser extends TransTokenParser
|
|
|
$domain = $this->parser->getExpressionParser()->parseExpression();
|
|
|
}
|
|
|
|
|
|
- if (null === $body) {
|
|
|
- // {% transchoice count %}message{% endtranschoice %}
|
|
|
- $stream->expect(\Twig_Token::BLOCK_END_TYPE);
|
|
|
- $body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true);
|
|
|
- }
|
|
|
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
|
|
|
+
|
|
|
+ $body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true);
|
|
|
|
|
|
if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) {
|
|
|
throw new \Twig_Error_Syntax('A message must be a simple text.');
|