/** * 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); }
/** * 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; }