Documentation
¶
Index ¶
- Constants
- Variables
- func DeepEqual(t1, t2 Type) bool
- func Equal(t1, t2 Type) bool
- func IsAny(t Type) bool
- func IsList(t Type) bool
- func IsNumeric(t Type) bool
- func IsPrimitive(t Type) bool
- func IsPrimitiveOrVoid(t Type) bool
- func IsStruct(t Type) bool
- func IsTypeAlias(t Type) bool
- func IsTypeDef(t Type) bool
- func IsVoid(t Type) bool
- func ParamTypesEqual(p1, p2 ParameterType) bool
- func StructurallyEqual(t1, t2 *StructType) bool
- type GrammaticalGender
- type ListType
- type ParameterType
- type PrimitiveType
- type StructField
- type StructType
- type Type
- type TypeAlias
- type TypeDef
- type Variable
- type VoidType
Constants ¶
const ( INVALID_GENDER GrammaticalGender = -1 MASKULIN = iota FEMININ NEUTRUM )
Variables ¶
var VARIABLE = Variable{}
Functions ¶
func DeepEqual ¶
checks wether t1 equals t2, that is, wether t1 and t2 refer to the same type throughout TypeAliases and TypeDefs and also List Types
func Equal ¶
checks wether t1 equals t2, that is, wether t1 and t2 refer to the same type throughout TypeAliases but not TypeDefs
func IsPrimitive ¶
func IsPrimitiveOrVoid ¶
func IsTypeAlias ¶
func ParamTypesEqual ¶
func ParamTypesEqual(p1, p2 ParameterType) bool
func StructurallyEqual ¶
func StructurallyEqual(t1, t2 *StructType) bool
checks wether two structs are structurally equal, that is their fields have the same type and are in the same order even ignoring TypeDefs
Types ¶
type ListType ¶
type ListType struct {
Underlying Type
}
func (ListType) Gender ¶
func (ListType) Gender() GrammaticalGender
type ParameterType ¶
represents the type of a function parameter which may be a reference
func (ParameterType) String ¶
func (paramType ParameterType) String() string
type PrimitiveType ¶
type PrimitiveType int
enum type for primitive types (+ void)
const ( ZAHL PrimitiveType = iota // int64 KOMMAZAHL // float64 WAHRHEITSWERT // bool BUCHSTABE // int32 TEXT // string )
func CastPrimitive ¶
func CastPrimitive(t Type) (PrimitiveType, bool)
acts like primitiveType, ok := t.(PrimitiveType) but respects TypeAliases
func (PrimitiveType) Gender ¶
func (p PrimitiveType) Gender() GrammaticalGender
func (PrimitiveType) String ¶
func (p PrimitiveType) String() string
type StructField ¶
represents a single field of a struct
type StructType ¶
type StructType struct { // name of the struct Name string // grammatical gender of the struct name GramGender GrammaticalGender // fields of the struct // in order of declaration Fields []StructField }
represents the type of a ddp struct
func CastStruct ¶
func CastStruct(t Type) (*StructType, bool)
acts like primitiveType, ok := t.(*StructType) but respects TypeAliases
func (*StructType) Gender ¶
func (t *StructType) Gender() GrammaticalGender
func (*StructType) String ¶
func (t *StructType) String() string
type Type ¶
type Type interface { // the grammatical Gender of the Type Gender() GrammaticalGender // string representation of the type (its name) String() string // contains filtered or unexported methods }
holds information about a DDP-Type
func GetListUnderlying ¶
gets the underlying type of a List if typ is not a list it is returned unchanged
func GetNestedListUnderlying ¶
gets the underlying type for nested lists if typ is not a list type typ is returned
func GetUnderlying ¶
returns the underlying type for nested TypeAliases
func ListTrueUnderlying ¶
func TrueUnderlying ¶
returns the underlying type for nested TypeAliases and TypeDefs
type TypeAlias ¶
type TypeAlias struct { Name string Underlying Type GramGender GrammaticalGender }
a type alias only refers to another type with a new name
func CastTypeAlias ¶
func (*TypeAlias) Gender ¶
func (a *TypeAlias) Gender() GrammaticalGender
type TypeDef ¶
type TypeDef struct { Name string Underlying Type GramGender GrammaticalGender }
a typedef defines a new type that is equal to another
func CastTypeDef ¶
func (*TypeDef) Gender ¶
func (d *TypeDef) Gender() GrammaticalGender