OptionElement option = readOption(keyValueSeparator); String name = option.name(); Object value = option.value();
OptionElement option = readOption(keyValueSeparator); String name = option.name(); Object value = option.value();
/** Reads an enum constant like "ROCK = 0;". The label is the constant name. */ private EnumConstantElement readEnumConstant( String documentation, Location location, String label) { reader.require('='); int tag = reader.readInt(); ImmutableList.Builder<OptionElement> options = ImmutableList.builder(); if (reader.peekChar() == '[') { reader.readChar(); while (true) { options.add(readOption('=')); char c = reader.readChar(); if (c == ']') { break; } if (c != ',') { throw reader.unexpected("Expected ',' or ']"); } } } reader.require(';'); documentation = reader.tryAppendTrailingDocumentation(documentation); return EnumConstantElement.builder(location) .name(label) .tag(tag) .documentation(documentation) .options(options.build()) .build(); }
if (reader.peekChar('[')) { while (true) { OptionElement option = readOption('='); if (option.name().equals("default")) {
pos++; while (true) { OptionElement option = readOption('='); if (option.name().equals("default")) {
return null; } else if (label.equals("option")) { OptionElement result = readOption('='); reader.require(';'); return result;
return null; } else if (label.equals("option")) { OptionElement result = readOption('='); if (readChar() != ';') throw unexpected("expected ';'"); return result; readChar(); while (true) { options.add(readOption('=')); char c = readChar(); if (c == ']') {