]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/twig/twig/lib/Twig/TokenParser/Extends.php
4 * This file is part of Twig.
6 * (c) 2009 Fabien Potencier
7 * (c) 2009 Armin Ronacher
9 * For the full copyright and license information, please view the LICENSE
10 * file that was distributed with this source code.
14 * Extends a template by another one.
17 * {% extends "base.html" %}
20 class Twig_TokenParser_Extends
extends Twig_TokenParser
23 * Parses a token and returns a node.
25 * @param Twig_Token $token A Twig_Token instance
27 * @return Twig_NodeInterface A Twig_NodeInterface instance
29 public function parse(Twig_Token
$token)
31 if (!$this->parser
->isMainScope()) {
32 throw new Twig_Error_Syntax('Cannot extend from a block', $token->getLine(), $this->parser
->getFilename());
35 if (null !== $this->parser
->getParent()) {
36 throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine(), $this->parser
->getFilename());
38 $this->parser
->setParent($this->parser
->getExpressionParser()->parseExpression());
40 $this->parser
->getStream()->expect(Twig_Token
::BLOCK_END_TYPE
);
44 * Gets the tag name associated with this token parser.
46 * @return string The tag name
48 public function getTag()