/** * Parses the update part of a for-statement. * * <code> * ------------------------------- * for ($x = 0, $y = 23, $z = 42; $x < $y; ++$x, $y = $x + 1, $z = $x + 2) {} * ------------------------------- * </code> * * @return PHP_Depend_Code_ASTForUpdate * @since 0.9.12 */ private function _parseForUpdate() { $this->consumeComments(); if (self::T_PARENTHESIS_CLOSE === $this->tokenizer->peek()) { return null; } $this->_tokenStack->push(); $update = $this->builder->buildASTForUpdate(); $this->_parseExpressionList($update); return $this->_setNodePositionsAndReturn($update); }
/** * Parses the update part of a for-statement. * * <code> * ------------------------------- * for ($x = 0, $y = 23, $z = 42; $x < $y; ++$x, $y = $x + 1, $z = $x + 2) {} * ------------------------------- * </code> * * @return PHP_Depend_Code_ASTForUpdate * @since 0.9.12 */ private function _parseForUpdate() { $this->_tokenStack->push(); $this->_consumeComments(); $update = null; if (($expr = $this->_parseOptionalExpression()) != null) { $update = $this->_builder->buildASTForUpdate(); $update->addChild($expr); return $this->_setNodePositionsAndReturn($update); } $this->_tokenStack->pop(); return null; }