Map
Map
represents a language map file. Usually, it is a text file that contains key-value pairs separated by a equal sign. The key is the name of the language feature. The built-in keys are:
- ext: the file extension for the language
- comment: the line comment pattern for the language
- int: the integer type for the language
- int8: the 8-bit integer type for the language
- int16: the 16-bit integer type for the language
- int32: the 32-bit integer type for the language
- int64: the 64-bit integer type for the language
- float32: the 32-bit floating-point type for the language
- float64: the 64-bit floating-point type for the language
- bool: the boolean type for the language
- string: the string type for the language
- byte: the byte type for the language
- bytes: the byte slice type for the language
- any: the any type for the language
- array: the fixed-sized array type for the language
- vector: the slice type for the language
- map: the map type for the language
- box: the box replacement for the language (for java, e.g., box(int) = Integer)
Here are some examples of language map files:
- java.map
- cpp.map
- protobuf.map
java.map
ext=.java
comment=// %T%
# primitive types
int=int
int8=byte
int16=short
int32=int
int64=long
float32=float
float64=double
bool=boolean
string=String
byte=byte
bytes=byte[]
any=Object
map=Map<box(%K%),box(%V%)>
vector=List<box(%T%)>
array=%T%[]
# box types
box(int)=Integer
box(byte)=Byte
box(short)=Short
box(long)=Long
box(float)=Float
box(double)=Double
box(boolean)=Boolean
cpp.map
ext=.h
comment=// %T%
int=int
int8=int8_t
int16=int16_t
int32=int32_t
int64=int64_t
float32=float
float64=double
bool=bool
string=std::string
byte=unsigned char
bytes=std::vector<unsigned char>
any=std::any
map=std::unordered_map<%K%, %V%>
vector=std::vector<%T%>
array=std::array<%T%, %N%>
protobuf.map
ext=.proto
comment=// %T%
int=int32
int8=int32
int16=int32
int32=int32
int64=int64
float32=float
float64=double
bool=bool
string=string
byte=int8
bytes=bytes
any=google.protobuf.Any
map=map<%K%, %V%>
vector=repeated %T.E%
array=repeated %T.E%
tip
- The
%T%
,%K%
,%V%
and%N%
are placeholders for the type, key type, value type and number of array elements. %T.E%
is the final element type of%T%
. It's useful if you need to get the final element type of a vector or array.- Line comments are started with the
#
character and it must be the first character of the line (leading spaces are allowed).
java.map
ext=.java # This is an invalid comment
# Comment must be the first character of the line
# This is a valid comment (leading spaces are allowed)
See Builtin Map Files for more information.