$node = $this->parseStringExpression();
break;
+ case Twig_Token::OPERATOR_TYPE:
+ if ('matches' == $token->getValue()) {
+ $this->parser->getStream()->next();
+ $node = new Twig_Node_Expression_Name('matches', $token->getLine());
+ break;
+ }
+
default:
if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) {
$node = $this->parseArrayExpression();
--- /dev/null
+--TEST--
+Twig allows to use 'matches' for a variable name
+--TEMPLATE--
+{% for match in matches %}
+ {{- match }}
+{% endfor %}
+--DATA--
+return array('matches' => array(1, 2, 3))
+--EXPECT--
+1
+2
+3