public function buildTree(TokenIterator $iterator) {
    $this->skipped = [];
    $this->skipParent = NULL;
    $this->docComment = NULL;
    $this->skippedDocComment = [];
    $this->iterator = $iterator;
    $this->current = $this->iterator->current();
    $this->currentType = $this->current ? $this->current->getType() : NULL;
    $top = new RootNode();
    $this->top = $top;
    if ($this->currentType && $this->currentType !== T_OPEN_TAG) {
      $node = new TemplateNode();
      // Parse any template statements that proceed the opening PHP tag.
      $this->templateStatementList($node);
      $top->addChild($node);
    }
    if ($this->tryMatch(T_OPEN_TAG, $top, NULL, TRUE, TRUE)) {
      $this->topStatementList($top);
    }
    return $top;
  }
public function buildTree(TokenIterator $iterator) {
    $this->skipped = [];
    $this->skipParent = NULL;
    $this->docComment = NULL;
    $this->skippedDocComment = [];
    $this->iterator = $iterator;
    $this->current = $this->iterator->current();
    $this->currentType = $this->current ? $this->current->getType() : NULL;
    $top = new RootNode();
    $this->top = $top;
    if ($this->currentType && $this->currentType !== T_OPEN_TAG) {
      $node = new TemplateNode();
      // Parse any template statements that proceed the opening PHP tag.
      $this->templateStatementList($node);
      $top->addChild($node);
    }
    if ($this->tryMatch(T_OPEN_TAG, $top, NULL, TRUE, TRUE)) {
      $this->topStatementList($top);
    }
    return $top;
  }
public function buildTree ( TokenIterator $ iterator ) { $ this -> skipped = [ ] ; $ this -> skipParent = NULL ; $ this -> docComment = NULL ; $ this -> skippedDocComment = [ ] ; $ this -> iterator = $ iterator ; $ this -> current = $ this -> iterator -> current ( ) ; $ this -> currentType = $ this -> current ? $ this -> current -> getType ( ) : NULL ; $ top = new RootNode ( ) ; $ this -> top = $ top ; if ( $ this -> currentType && $ this -> currentType !== T_OPEN_TAG ) { $ node = new TemplateNode ( ) ; // Parse any template statements that proceed the opening PHP tag. $ this -> templateStatementList ( $ node ) ; $ top -> addChild ( $ node ) ; } if ( $ this -> tryMatch ( T_OPEN_TAG , $ top , NULL , TRUE , TRUE ) ) { $ this -> topStatementList ( $ top ) ; } return $ top ; }
Build a syntax tree from the token iterator.
@param TokenIterator $iterator
@return RootNode Root node of the tree
Build a syntax tree from the token iterator .