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\Parser; 16use Twig\Token; 17 18/** 19 * Interface implemented by token parsers. 20 * 21 * @author Fabien Potencier <fabien@symfony.com> 22 */ 23interface TokenParserInterface 24{ 25 /** 26 * Sets the parser associated with this token parser. 27 */ 28 public function setParser(Parser $parser); 29 30 /** 31 * Parses a token and returns a node. 32 * 33 * @return \Twig_NodeInterface 34 * 35 * @throws SyntaxError 36 */ 37 public function parse(Token $token); 38 39 /** 40 * Gets the tag name associated with this token parser. 41 * 42 * @return string The tag name 43 */ 44 public function getTag(); 45} 46 47class_alias('Twig\TokenParser\TokenParserInterface', 'Twig_TokenParserInterface'); 48 49// Ensure that the aliased name is loaded to keep BC for classes implementing the typehint with the old aliased name. 50class_exists('Twig\Token'); 51class_exists('Twig\Parser'); 52