1<?php
2
3/*
4 * This file is part of Twig.
5 *
6 * (c) Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Twig\TokenParser;
13
14use Twig\Error\SyntaxError;
15use Twig\Node\Node;
16use Twig\Parser;
17use Twig\Token;
18
19/**
20 * Interface implemented by token parsers.
21 *
22 * @author Fabien Potencier <fabien@symfony.com>
23 */
24interface TokenParserInterface
25{
26    /**
27     * Sets the parser associated with this token parser.
28     */
29    public function setParser(Parser $parser);
30
31    /**
32     * Parses a token and returns a node.
33     *
34     * @return Node
35     *
36     * @throws SyntaxError
37     */
38    public function parse(Token $token);
39
40    /**
41     * Gets the tag name associated with this token parser.
42     *
43     * @return string The tag name
44     */
45    public function getTag();
46}
47
48class_alias('Twig\TokenParser\TokenParserInterface', 'Twig_TokenParserInterface');
49
50// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name.
51class_exists('Twig\Token');
52class_exists('Twig\Parser');
53