Parses a token and returns a node.
Twig_Token $token A Twig_Token instance:
Twig_NodeInterface A Twig_NodeInterface instance
Overrides Twig_TokenParserInterface::parse
public function parse(Twig_Token $token) {
$name = $this->parser
->getVarName();
$ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token
->getLine()), true, $token
->getLine(), $this
->getTag());
$filter = $this->parser
->getExpressionParser()
->parseFilterExpressionRaw($ref, $this
->getTag());
$this->parser
->getStream()
->expect(Twig_Token::BLOCK_END_TYPE);
$body = $this->parser
->subparse(array(
$this,
'decideBlockEnd',
), true);
$this->parser
->getStream()
->expect(Twig_Token::BLOCK_END_TYPE);
$block = new Twig_Node_Block($name, $body, $token
->getLine());
$this->parser
->setBlock($name, $block);
return new Twig_Node_Print($filter, $token
->getLine(), $this
->getTag());
}