ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Extends.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) Fabien Potencier
7  * (c) Armin Ronacher
8  *
9  * For the full copyright and license information, please view the LICENSE
10  * file that was distributed with this source code.
11  */
12 
23 {
24  public function parse(Twig_Token $token)
25  {
26  $stream = $this->parser->getStream();
27 
28  if (!$this->parser->isMainScope()) {
29  throw new Twig_Error_Syntax('Cannot extend from a block.', $token->getLine(), $stream->getSourceContext());
30  }
31 
32  if (null !== $this->parser->getParent()) {
33  throw new Twig_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $stream->getSourceContext());
34  }
35  $this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
36 
38  }
39 
40  public function getTag()
41  {
42  return 'extends';
43  }
44 }
45 
46 class_alias('Twig_TokenParser_Extends', 'Twig\TokenParser\ExtendsTokenParser', false);
parse(Twig_Token $token)
Parses a token and returns a node.
Definition: Extends.php:24
$stream
PHP stream implementation.
Exception thrown when a syntax error occurs during lexing or parsing of a template.
Definition: Syntax.php:18
Base class for all token parsers.
Definition: TokenParser.php:17
getTag()
Gets the tag name associated with this token parser.
Definition: Extends.php:40
getLine()
Definition: Token.php:87
Extends a template by another one.
Definition: Extends.php:22
const BLOCK_END_TYPE
Definition: Token.php:30