4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Bridge\Twig\TokenParser
;
14 use Symfony\Bridge\Twig\Node\TransDefaultDomainNode
;
17 * Token Parser for the 'trans_default_domain' tag.
19 * @author Fabien Potencier <fabien@symfony.com>
21 class TransDefaultDomainTokenParser
extends \Twig_TokenParser
24 * Parses a token and returns a node.
26 * @param \Twig_Token $token A Twig_Token instance
28 * @return \Twig_NodeInterface A Twig_NodeInterface instance
30 public function parse(\Twig_Token
$token)
32 $expr = $this->parser
->getExpressionParser()->parseExpression();
34 $this->parser
->getStream()->expect(\Twig_Token
::BLOCK_END_TYPE
);
36 return new TransDefaultDomainNode($expr, $token->getLine(), $this->getTag());
40 * Gets the tag name associated with this token parser.
42 * @return string The tag name
44 public function getTag()
46 return 'trans_default_domain';