12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
-
-
-
-
- class Twig_TokenParser_Include extends Twig_TokenParser
- {
-
-
- public function parse(Twig_Token $token)
- {
- $expr = $this->parser->getExpressionParser()->parseExpression();
-
- $variables = null;
- if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'with')) {
- $this->parser->getStream()->next();
-
- $variables = $this->parser->getExpressionParser()->parseExpression();
- }
-
- $only = false;
- if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'only')) {
- $this->parser->getStream()->next();
-
- $only = true;
- }
-
- $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
-
- return new Twig_Node_Include($expr, $variables, $only, $token->getLine(), $this->getTag());
- }
-
-
-
- public function getTag()
- {
- return 'include';
- }
- }
|