private DataType readDataType ( ) { String name = readWord ( ) ; switch ( name ) { case "map" : if ( readChar ( ) != ' ' ) throw unexpected ( "expected '<'" ) ; DataType keyType = readDataType ( ) ; if ( readChar ( ) != ' ' ) throw unexpected ( "expected ','" ) ; DataType valueType = readDataType ( ) ; if ( readChar ( ) != ' ' ) throw unexpected ( "expected '>'" ) ; return MapType . create ( keyType , valueType ) ; case "any" : return ScalarType . ANY ; case "bool" : return ScalarType . BOOL ; case "bytes" : return ScalarType . BYTES ; case "double" : return ScalarType . DOUBLE ; case "float" : return ScalarType . FLOAT ; case "fixed32" : return ScalarType . FIXED32 ; case "fixed64" : return ScalarType . FIXED64 ; case "int32" : return ScalarType . INT32 ; case "int64" : return ScalarType . INT64 ; case "sfixed32" : return ScalarType . SFIXED32 ; case "sfixed64" : return ScalarType . SFIXED64 ; case "sint32" : return ScalarType . SINT32 ; case "sint64" : return ScalarType . SINT64 ; case "string" : return ScalarType . STRING ; case "uint32" : return ScalarType . UINT32 ; case "uint64" : return ScalarType . UINT64 ; default : return NamedType . create ( name ) ; } }
Reads a scalar map or type name .