コード例 #1
0
ファイル: Parser.php プロジェクト: CobaltBlueDW/oddsandends
 /**
  * This method parses a single for-statement node.
  *
  * @return PHP_Depend_Code_ASTForStatement
  * @since 0.9.8
  */
 private function parseForStatement()
 {
     $this->tokenStack->push();
     $token = $this->consumeToken(self::T_FOR);
     $this->consumeComments();
     $this->consumeToken(self::T_PARENTHESIS_OPEN);
     $stmt = $this->builder->buildAstForStatement($token->image);
     if (($init = $this->parseForInit()) !== null) {
         $stmt->addChild($init);
     }
     $this->consumeToken(self::T_SEMICOLON);
     if (($expr = $this->parseForExpression()) !== null) {
         $stmt->addChild($expr);
     }
     $this->consumeToken(self::T_SEMICOLON);
     if (($update = $this->parseForUpdate()) !== null) {
         $stmt->addChild($update);
     }
     $this->consumeToken(self::T_PARENTHESIS_CLOSE);
     return $this->setNodePositionsAndReturn($this->parseStatementBody($stmt));
 }