28 lines
436 B
Go
28 lines
436 B
Go
package types
|
|
|
|
// Parse creates a new type from a list of tokens.
|
|
func Parse(name string) *Type {
|
|
switch name {
|
|
case "Int":
|
|
return Int
|
|
case "Int64":
|
|
return Int64
|
|
case "Int32":
|
|
return Int32
|
|
case "Int16":
|
|
return Int16
|
|
case "Int8":
|
|
return Int8
|
|
case "Float":
|
|
return Float
|
|
case "Float64":
|
|
return Float64
|
|
case "Float32":
|
|
return Float32
|
|
case "Pointer":
|
|
return Pointer
|
|
default:
|
|
panic("Unknown type " + name)
|
|
}
|
|
}
|