// parse optional modifiers, type, and member name
final int mods = parseModifiers();
final String typeOrName = parseType();
if (typeOrName == null) {
if (mods != 0) {
throw new ParseException(msgUnexpectedEOF(), 0);
}
return null; // no member to parse
}
final String memberName = parseIdentifier(); // null if constructor
// parse optional field value or parameter+exception list
final String value;
final String[] params;
final String[] excepts;
{
final String tvp = parseToken();
if (tvp.equals(";")) {
value = null;
params = null;
excepts = null;
} else if (tvp.equals("=")) {
// parse field value
value = demandLiteral();
demandToken(";");
params = null;
excepts = null;
} else if (tvp.equals("(")) {
// parse optional parameter and exception list
params = parseParameterList();
demandToken(")");
final String tt = parseToken();
if (tt.equals("throws")) {
excepts = demandIdentifierList();
demandToken(";");
} else if (tt.equals(";")) {
excepts = new String[]{};
} else {
throw new ParseException(msgUnexpectedToken(tt), 0);
}
value = null;
} else {
throw new ParseException(msgUnexpectedToken(tvp), 0);
}
}
// verify field, constructor, or method
String name = memberName;