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