Do.php 672 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /*
  3. * This file is part of Twig.
  4. *
  5. * (c) 2011 Fabien Potencier
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Evaluates an expression, discarding the returned value.
  12. */
  13. class Twig_TokenParser_Do extends Twig_TokenParser
  14. {
  15. public function parse(Twig_Token $token)
  16. {
  17. $expr = $this->parser->getExpressionParser()->parseExpression();
  18. $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
  19. return new Twig_Node_Do($expr, $token->getLine(), $this->getTag());
  20. }
  21. public function getTag()
  22. {
  23. return 'do';
  24. }
  25. }