예제 #1
0
파일: Parser.php 프로젝트: rouffj/pdepend
 /**
  * Parses the init part of a for-statement.
  *
  * <code>
  *      ------------------------
  * for ($x = 0, $y = 23, $z = 42; $x < $y; ++$x) {}
  *      ------------------------
  * </code>
  *
  * @return PHP_Depend_Code_ASTForInit
  * @since 0.9.8
  */
 private function _parseForInit()
 {
     $this->consumeComments();
     if (self::T_SEMICOLON === $this->tokenizer->peek()) {
         return null;
     }
     $this->_tokenStack->push();
     $init = $this->builder->buildASTForInit();
     $this->_parseExpressionList($init);
     return $this->_setNodePositionsAndReturn($init);
 }
예제 #2
0
 /**
  * Parses the init part of a for-statement.
  *
  * <code>
  *      ------------------------
  * for ($x = 0, $y = 23, $z = 42; $x < $y; ++$x) {}
  *      ------------------------
  * </code>
  *
  * @return PHP_Depend_Code_ASTForInit
  * @since 0.9.8
  */
 private function _parseForInit()
 {
     if ($expr = $this->_parseOptionalExpression()) {
         $init = $this->_builder->buildASTForInit();
         $init->addChild($expr);
         $init->configureLinesAndColumns($expr->getStartLine(), $expr->getEndLine(), $expr->getStartColumn(), $expr->getEndColumn());
         return $init;
     }
     return null;
 }