blob: bb8db3e5cc2bec25033e787acc758485e30a5942 [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001<?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): void;
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
44 */
45 public function getTag();
46}