/** * Parses an allocation expression. * * <code> * function foo() * { * // ------------- * new bar\Baz(); * // ------------- * * // --------- * new Foo(); * // --------- * } * </code> * * @return PHP_Depend_Code_ASTAllocationExpression * @since 0.9.6 */ private function _parseAllocationExpression() { $this->_tokenStack->push(); $token = $this->consumeToken(self::T_NEW); $allocation = $this->builder->buildASTAllocationExpression($token->image); $allocation = $this->_parseExpressionTypeReference($allocation, true); if ($this->_isNextTokenArguments()) { $allocation->addChild($this->_parseArguments()); } return $this->_setNodePositionsAndReturn($allocation); }