Improved type system
This commit is contained in:
27
src/types/Parse.go
Normal file
27
src/types/Parse.go
Normal file
@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user