/** * This method parses a method- or property-postfix expression. This expression * will contain the given node as method or property identifier. * * @param PHP_Depend_Code_ASTNode $node The identifier for the parsed postfix * expression node. This node will be the first child of the returned * postfix node instance. * * @return PHP_Depend_Code_ASTNode * @throws PHP_Depend_Parser_Exception When an error occured during the * parsing process. * @since 0.9.6 */ private function _parseMethodOrPropertyPostfix(PHP_Depend_Code_ASTNode $node) { // Strip optional comments $this->_consumeComments(); // Get next token type $tokenType = $this->_tokenizer->peek(); switch ($tokenType) { case self::T_PARENTHESIS_OPEN: $postfix = $this->_builder->buildASTMethodPostfix($node->getImage()); $postfix->addChild($node); $postfix->addChild($this->_parseArguments()); return $this->_parseOptionalMemberPrimaryPrefix($postfix); default: $postfix = $this->_builder->buildASTPropertyPostfix($node->getImage()); $postfix->addChild($node); return $this->_parseOptionalMemberPrimaryPrefix($postfix); } }
/** * Parses a method postfix node instance. * * @param PHP_Depend_Code_ASTNode $node Node that represents the image of * the method postfix node. * * @return PHP_Depend_Code_ASTMethodPostfix * @since 0.11.0 */ private function _parseMethodPostfix(PHP_Depend_Code_ASTNode $node) { $args = $this->_parseArguments(); $postfix = $this->_builder->buildASTMethodPostfix($node->getImage()); $postfix->addChild($node); $postfix->addChild($args); $postfix->setEndLine($args->getEndLine()); $postfix->setEndColumn($args->getEndColumn()); $postfix->setStartLine($node->getStartLine()); $postfix->setStartColumn($node->getStartColumn()); return $postfix; }