public Reference parse ( String sig ) throws ParseException { // Break sig apart into qualifiedExpr member paramTypes. JCTree qualExpr ; Name member ; List < JCTree > paramTypes ; Log . DeferredDiagnosticHandler deferredDiagnosticHandler = new Log . DeferredDiagnosticHandler ( fac . log ) ; try { int hash = sig . indexOf ( "#" ) ; int lparen = sig . indexOf ( "(" , hash + 1 ) ; if ( hash == - 1 ) { if ( lparen == - 1 ) { qualExpr = parseType ( sig ) ; member = null ; } else { qualExpr = null ; member = parseMember ( sig . substring ( 0 , lparen ) ) ; } } else { qualExpr = ( hash == 0 ) ? null : parseType ( sig . substring ( 0 , hash ) ) ; if ( lparen == - 1 ) member = parseMember ( sig . substring ( hash + 1 ) ) ; else member = parseMember ( sig . substring ( hash + 1 , lparen ) ) ; } if ( lparen < 0 ) { paramTypes = null ; } else { int rparen = sig . indexOf ( ")" , lparen ) ; if ( rparen != sig . length ( ) - 1 ) throw new ParseException ( "dc.ref.bad.parens" ) ; paramTypes = parseParams ( sig . substring ( lparen + 1 , rparen ) ) ; } if ( ! deferredDiagnosticHandler . getDiagnostics ( ) . isEmpty ( ) ) throw new ParseException ( "dc.ref.syntax.error" ) ; } finally { fac . log . popDiagnosticHandler ( deferredDiagnosticHandler ) ; } return new Reference ( qualExpr , member , paramTypes ) ; }
Parse a reference to an API element as may be found in doc comment .