Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 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 | |
| 12 | namespace Twig\TokenParser; |
| 13 | |
| 14 | use Twig\Error\SyntaxError; |
| 15 | use Twig\Node\Node; |
| 16 | use Twig\Parser; |
| 17 | use Twig\Token; |
| 18 | |
| 19 | /** |
| 20 | * Interface implemented by token parsers. |
| 21 | * |
| 22 | * @author Fabien Potencier <fabien@symfony.com> |
| 23 | */ |
| 24 | interface 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 | } |