Example #1
0
 /**
  * This method parses a static member primary expression. The given node
  * contains the used static class or interface identifier. A static member
  * primary prefix can represent the following code expressions:
  *
  * A static method class:
  *
  * <code>
  * Foo::bar();
  * </code>
  *
  * a static property access:
  *
  * <code>
  * Foo::$bar;
  * </code>
  *
  * or a static constant access:
  *
  * <code>
  * Foo::BAR;
  * </code>
  *
  * @param  \PDepend\Source\AST\ASTNode $node The left node in the parsed member
  *        primary expression.
  * @return \PDepend\Source\AST\ASTMemberPrimaryPrefix
  * @throws \PDepend\Source\Parser\ParserException
  * @since  0.9.6
  */
 private function parseStaticMemberPrimaryPrefix(ASTNode $node)
 {
     $token = $this->consumeToken(Tokens::T_DOUBLE_COLON);
     $prefix = $this->builder->buildAstMemberPrimaryPrefix($token->image);
     $prefix->addChild($node);
     $this->consumeComments();
     switch ($this->tokenizer->peek()) {
         case Tokens::T_STRING:
             $postfix = $this->parseMethodOrConstantPostfix();
             break;
         case Tokens::T_CLASS_FQN:
             $postfix = $this->parseFullQualifiedClassNamePostfix();
             break;
         default:
             $postfix = $this->parseMethodOrPropertyPostfix($this->parsePostfixIdentifier());
             break;
     }
     $prefix->addChild($postfix);
     return $this->parseOptionalMemberPrimaryPrefix($this->parseOptionalIndexExpression($prefix));
 }