Пример #1
0
 public function parse(Parser $parser, Stream $stream)
 {
     $node = $this->helper->createRenderBlockNode($parser->getCurrentBlock(), $this->helper->createContext($stream->next()->test(Token::IDENTIFIER, 'using'), $stream, $parser));
     $expression = $node->getChild('expression');
     if (!$expression instanceof FunctionNode) {
         throw new \UnexpectedValueException("An instance of FunctionNode was expected");
     }
     $expression->addArgument(new DataNode(true));
     return $node;
 }
Пример #2
0
 public function parse(Parser $parser, Stream $stream)
 {
     //force the optimizer to compile $environment by always using a temp variable
     $environmentNode = new TempVariableNode('environment');
     $parentTemplate = $parser->parseExpression($stream);
     $contextNode = $this->helper->createContext($stream->current()->test(Token::IDENTIFIER, 'using'), $stream, $parser);
     $node = new TagNode($this, ['template' => $this->parseClass($parser, $stream, $parentTemplate)]);
     $node->addChild($environmentNode, 'environment');
     $node->addChild($contextNode, 'context');
     return $node;
 }
Пример #3
0
 public function parse(Parser $parser, Stream $stream)
 {
     return $this->helper->createRenderBlockNode($stream->expect(Token::IDENTIFIER)->getValue(), $this->helper->createContext($stream->next()->test(Token::IDENTIFIER, 'using'), $stream, $parser));
 }
Пример #4
0
 public function parse(Parser $parser, Stream $stream)
 {
     return $this->helper->createRenderFunctionNode($parser->parseExpression($stream), $this->helper->createContext($stream->current()->test(Token::IDENTIFIER, 'using'), $stream, $parser));
 }