private function _if() {
    $node = new IfNode();
    $this->mustMatch(T_IF, $node);
    $this->condition($node, 'condition');
    if ($this->tryMatch(':', $node, 'openColon', FALSE, TRUE)) {
      $node->addChild($this->innerIfInnerStatementList(), 'then');
      while ($this->currentType === T_ELSEIF) {
        $this->matchHidden($node);
        $elseIf = new ElseIfNode();
        $this->mustMatch(T_ELSEIF, $elseIf);
        $this->condition($elseIf, 'condition');
        $this->mustMatch(':', $elseIf, 'openColon', FALSE, TRUE);
        $elseIf->addChild($this->innerIfInnerStatementList(), 'then');
        $node->addChild($elseIf);
      }
      if ($this->tryMatch(T_ELSE, $node, 'elseKeyword')) {
        $this->mustMatch(':', $node, 'elseColon', FALSE, TRUE);
        $node->addChild($this->innerStatementListNode(T_ENDIF), 'else');
      }
      $this->mustMatch(T_ENDIF, $node, 'endKeyword');
      $this->endStatement($node);
      return $node;
    }
    else {
      $this->matchHidden($node);
      $node->addChild($this->statement(), 'then');
      while ($this->currentType === T_ELSEIF) {
        $this->matchHidden($node);
        $elseIf = new ElseIfNode();
        $this->mustMatch(T_ELSEIF, $elseIf);
        $this->condition($elseIf, 'condition');
        $this->matchHidden($elseIf);
        $elseIf->addChild($this->statement(), 'then');
        $node->addChild($elseIf);
      }
      if ($this->tryMatch(T_ELSE, $node, 'elseKeyword', FALSE, TRUE)) {
        $node->addChild($this->statement(), 'else');
      }
      return $node;
    }
  }
private function _if() {
    $node = new IfNode();
    $this->mustMatch(T_IF, $node);
    $this->condition($node, 'condition');
    if ($this->tryMatch(':', $node, 'openColon', FALSE, TRUE)) {
      $node->addChild($this->innerIfInnerStatementList(), 'then');
      while ($this->currentType === T_ELSEIF) {
        $this->matchHidden($node);
        $elseIf = new ElseIfNode();
        $this->mustMatch(T_ELSEIF, $elseIf);
        $this->condition($elseIf, 'condition');
        $this->mustMatch(':', $elseIf, 'openColon', FALSE, TRUE);
        $elseIf->addChild($this->innerIfInnerStatementList(), 'then');
        $node->addChild($elseIf);
      }
      if ($this->tryMatch(T_ELSE, $node, 'elseKeyword')) {
        $this->mustMatch(':', $node, 'elseColon', FALSE, TRUE);
        $node->addChild($this->innerStatementListNode(T_ENDIF), 'else');
      }
      $this->mustMatch(T_ENDIF, $node, 'endKeyword');
      $this->endStatement($node);
      return $node;
    }
    else {
      $this->matchHidden($node);
      $node->addChild($this->statement(), 'then');
      while ($this->currentType === T_ELSEIF) {
        $this->matchHidden($node);
        $elseIf = new ElseIfNode();
        $this->mustMatch(T_ELSEIF, $elseIf);
        $this->condition($elseIf, 'condition');
        $this->matchHidden($elseIf);
        $elseIf->addChild($this->statement(), 'then');
        $node->addChild($elseIf);
      }
      if ($this->tryMatch(T_ELSE, $node, 'elseKeyword', FALSE, TRUE)) {
        $node->addChild($this->statement(), 'else');
      }
      return $node;
    }
  }
private function _if ( ) { $ node = new IfNode ( ) ; $ this -> mustMatch ( T_IF , $ node ) ; $ this -> condition ( $ node , 'condition' ) ; if ( $ this -> tryMatch ( ':' , $ node , 'openColon' , FALSE , TRUE ) ) { $ node -> addChild ( $ this -> innerIfInnerStatementList ( ) , 'then' ) ; while ( $ this -> currentType === T_ELSEIF ) { $ this -> matchHidden ( $ node ) ; $ elseIf = new ElseIfNode ( ) ; $ this -> mustMatch ( T_ELSEIF , $ elseIf ) ; $ this -> condition ( $ elseIf , 'condition' ) ; $ this -> mustMatch ( ':' , $ elseIf , 'openColon' , FALSE , TRUE ) ; $ elseIf -> addChild ( $ this -> innerIfInnerStatementList ( ) , 'then' ) ; $ node -> addChild ( $ elseIf ) ; } if ( $ this -> tryMatch ( T_ELSE , $ node , 'elseKeyword' ) ) { $ this -> mustMatch ( ':' , $ node , 'elseColon' , FALSE , TRUE ) ; $ node -> addChild ( $ this -> innerStatementListNode ( T_ENDIF ) , 'else' ) ; } $ this -> mustMatch ( T_ENDIF , $ node , 'endKeyword' ) ; $ this -> endStatement ( $ node ) ; return $ node ; } else { $ this -> matchHidden ( $ node ) ; $ node -> addChild ( $ this -> statement ( ) , 'then' ) ; while ( $ this -> currentType === T_ELSEIF ) { $ this -> matchHidden ( $ node ) ; $ elseIf = new ElseIfNode ( ) ; $ this -> mustMatch ( T_ELSEIF , $ elseIf ) ; $ this -> condition ( $ elseIf , 'condition' ) ; $ this -> matchHidden ( $ elseIf ) ; $ elseIf -> addChild ( $ this -> statement ( ) , 'then' ) ; $ node -> addChild ( $ elseIf ) ; } if ( $ this -> tryMatch ( T_ELSE , $ node , 'elseKeyword' , FALSE , TRUE ) ) { $ node -> addChild ( $ this -> statement ( ) , 'else' ) ; } return $ node ; } }
Parse if control structure.
@return IfNode
Parse if control structure .