public function Twig_TokenParser_Sandbox::parse

Parses a token and returns a node.

Parameters

Twig_Token $token A Twig_Token instance:

Return value

Twig_NodeInterface A Twig_NodeInterface instance

Overrides Twig_TokenParserInterface::parse

File

drupal/core/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php, line 32

Class

Twig_TokenParser_Sandbox
Marks a section of a template as untrusted code that must be evaluated in the sandbox mode.

Code

public function parse(Twig_Token $token) {
  $this->parser
    ->getStream()
    ->expect(Twig_Token::BLOCK_END_TYPE);
  $body = $this->parser
    ->subparse(array(
    $this,
    'decideBlockEnd',
  ), true);
  $this->parser
    ->getStream()
    ->expect(Twig_Token::BLOCK_END_TYPE);
  return new Twig_Node_Sandbox($body, $token
    ->getLine(), $this
    ->getTag());
}