/** PackageSpecifier: Identifier "/" PackageSpecifier* */ private SimpleClassTypeSignature parsePackageNameAndSimpleClassTypeSignature() { // Parse both any optional leading PackageSpecifier as well as // the following SimpleClassTypeSignature. String id = parseIdentifier(); if (current() == '/') { // package name StringBuilder idBuild = new StringBuilder(id); while (current() == '/') { advance(); idBuild.append("."); idBuild.append(parseIdentifier()); } id = idBuild.toString(); } switch (current()) { case ';': return SimpleClassTypeSignature.make(id, false, new TypeArgument[0]); // all done! case '<': if (DEBUG) System.out.println("\t remainder: " + remainder()); return SimpleClassTypeSignature.make(id, false, parseTypeArguments()); default: throw error("expected '<' or ';' but got " + current()); } }
private String parseIdentifier() { StringBuilder result = new StringBuilder(); while (!Character.isWhitespace(current())) { char c = current(); switch (c) { case ';': case '.': case '/': case '[': case ':': case '>': case '<': return result.toString(); default: { result.append(c); advance(); } } } return result.toString(); }