private ReservedElement readReserved ( Location location , String documentation ) { ImmutableList . Builder < Object > valuesBuilder = ImmutableList . builder ( ) ; while ( true ) { char c = reader . peekChar ( ) ; if ( c == ' ' || c == ' ' ) { valuesBuilder . add ( reader . readQuotedString ( ) ) ; } else { int tagStart = reader . readInt ( ) ; c = reader . peekChar ( ) ; if ( c != ' ' && c != ' ' ) { if ( ! reader . readWord ( ) . equals ( "to" ) ) { throw reader . unexpected ( "expected ',', ';', or 'to'" ) ; } int tagEnd = reader . readInt ( ) ; valuesBuilder . add ( Range . closed ( tagStart , tagEnd ) ) ; } else { valuesBuilder . add ( tagStart ) ; } } c = reader . readChar ( ) ; if ( c == ' ' ) break ; if ( c != ' ' ) throw reader . unexpected ( "expected ',' or ';'" ) ; } ImmutableList < Object > values = valuesBuilder . build ( ) ; if ( values . isEmpty ( ) ) { throw reader . unexpected ( "'reserved' must have at least one field name or tag" ) ; } return new ReservedElement ( location , documentation , values ) ; }
Reads a reserved tags and names list like reserved 10 12 to 14 foo ; .