4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
16 * {% import 'forms.html' as forms %}
21 class Twig_TokenParser_Import extends Twig_TokenParser
23 public function parse(Twig_Token $token)
25 $macro = $this->parser->getExpressionParser()->parseExpression();
26 $this->parser->getStream()->expect('as');
27 $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine());
28 $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
30 $this->parser->addImportedSymbol('template', $var->getAttribute('name'));
32 return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag());
35 public function getTag()
41 class_alias('Twig_TokenParser_Import', 'Twig\TokenParser\ImportTokenParser', false);