Implemented struct pointer types

This commit is contained in:
2025-02-05 15:16:00 +01:00
parent 85568949a2
commit 5d38a4980a
17 changed files with 190 additions and 102 deletions

View File

@ -1,27 +0,0 @@
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 PointerAny
default:
panic("Unknown type " + name)
}
}

View File

@ -1,16 +0,0 @@
package types
import "git.akyoto.dev/cli/q/src/token"
// ParseList generates a list of types from comma separated tokens.
func ParseList(tokens token.List, source []byte) []Type {
var list []Type
tokens.Split(func(parameter token.List) error {
typ := Parse(parameter.Text(source))
list = append(list, typ)
return nil
})
return list
}