123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
-
-
-
-
- class Twig_TokenParser_Include extends Twig_TokenParser
- {
-
-
- public function parse(Twig_Token $token)
- {
- $expr = $this->parser->getExpressionParser()->parseExpression();
-
- $ignoreMissing = false;
- if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'ignore')) {
- $this->parser->getStream()->next();
- $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, 'missing');
-
- $ignoreMissing = true;
- }
-
- $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, $ignoreMissing, $token->getLine(), $this->getTag());
- }
-
-
-
- public function getTag()
- {
- return 'include';
- }
- }
|