source: pro-violet-viettel/www/deploy/20150304/application/third_party/Twig/TokenParser/Extends.php @ 780

Last change on this file since 780 was 780, checked in by dungnv, 10 years ago
File size: 1.0 KB
Line 
1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) 2009 Fabien Potencier
7 * (c) 2009 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 */
12class Twig_TokenParser_Extends extends Twig_TokenParser
13{
14    /**
15     * Parses a token and returns a node.
16     *
17     * @param Twig_Token $token A Twig_Token instance
18     *
19     * @return Twig_NodeInterface A Twig_NodeInterface instance
20     */
21    public function parse(Twig_Token $token)
22    {
23        if (null !== $this->parser->getParent()) {
24            throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine());
25        }
26        $this->parser->setParent($this->parser->getExpressionParser()->parseExpression());
27
28        $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
29
30        return null;
31    }
32
33    /**
34     * Gets the tag name associated with this token parser.
35     *
36     * @param string The tag name
37     */
38    public function getTag()
39    {
40        return 'extends';
41    }
42}
Note: See TracBrowser for help on using the repository browser.