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\Node\DoNode; 15use Twig\Token; 16 17/** 18 * Evaluates an expression, discarding the returned value. 19 */ 20final class DoTokenParser extends AbstractTokenParser 21{ 22 public function parse(Token $token) 23 { 24 $expr = $this->parser->getExpressionParser()->parseExpression(); 25 26 $this->parser->getStream()->expect(/* Token::BLOCK_END_TYPE */ 3); 27 28 return new DoNode($expr, $token->getLine(), $this->getTag()); 29 } 30 31 public function getTag() 32 { 33 return 'do'; 34 } 35} 36 37class_alias('Twig\TokenParser\DoTokenParser', 'Twig_TokenParser_Do'); 38