getSubParser() public method

Get a parser with the same environment that this one
public getSubParser ( ) : Parser
return Parser a new parser with the same environment
Example #1
0
 /**
  * Process a directive that should parces the next node as a "sub" document
  */
 public final function process(Parser $parser, $node, $variable, $data, array $options)
 {
     $subParser = $parser->getSubParser();
     if ($node instanceof CodeNode) {
         $document = $subParser->parseLocal($node->getValue());
     } else {
         $document = $node;
     }
     $newNode = $this->processSub($parser, $document, $variable, $data, $options);
     if ($newNode) {
         if ($variable) {
             $parser->getEnvironment()->setVariable($variable, $newNode);
         } else {
             $parser->getDocument()->addNode($newNode);
         }
     }
 }