Twig_TokenParser_Import

Imports macros.

Defined (1)

The class is defined in the following location(s).

/vendor/twig/twig/lib/Twig/TokenParser/Import.php  
  1. class Twig_TokenParser_Import extends Twig_TokenParser 
  2. public function parse(Twig_Token $token) 
  3. $macro = $this->parser->getExpressionParser()->parseExpression(); 
  4. $this->parser->getStream()->expect('as'); 
  5. $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); 
  6. $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 
  7.  
  8. $this->parser->addImportedSymbol('template', $var->getAttribute('name')); 
  9.  
  10. return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); 
  11.  
  12. public function getTag() 
  13. return 'import';