types

package
v0.0.0-...-67b6ef9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	ElemType Type
}

func NewArrayType

func NewArrayType(elemType Type) *ArrayType

func (*ArrayType) BasicType

func (a *ArrayType) BasicType() BasicType

func (*ArrayType) Equal

func (a *ArrayType) Equal(b Type) bool

func (*ArrayType) String

func (a *ArrayType) String() string

type BasicType

type BasicType int
const (
	INT BasicType = iota
	BYTE
	FLOAT
	BOOL
	STRING
	ARRAY
	MAP
	FUNCTION
	STRUCT
	NULL
	ANY

	// Special types
	ALL
	VARIADIC
	IDENT
	INVALID
)

func (BasicType) BasicType

func (b BasicType) BasicType() BasicType

func (BasicType) Equal

func (b BasicType) Equal(t Type) bool

func (BasicType) String

func (b BasicType) String() string

type FuncType

type FuncType struct {
	ParTypes []Type
	RetType  Type
}

func (*FuncType) BasicType

func (f *FuncType) BasicType() BasicType

func (*FuncType) Equal

func (f *FuncType) Equal(t Type) bool

func (*FuncType) String

func (f *FuncType) String() string

type MapType

type MapType struct {
	KeyType Type
	ValType Type
}

func NewMapType

func NewMapType(keyType, valType Type) *MapType

func (*MapType) BasicType

func (m *MapType) BasicType() BasicType

func (*MapType) Equal

func (m *MapType) Equal(b Type) bool

func (*MapType) String

func (m *MapType) String() string

type MulType

type MulType struct {
	Typs []Type
}

func NewMulType

func NewMulType(typs ...Type) *MulType

func (*MulType) BasicType

func (a *MulType) BasicType() BasicType

func (*MulType) Equal

func (a *MulType) Equal(b Type) bool

func (*MulType) String

func (a *MulType) String() string

type StructField

type StructField struct {
	Name string
	Type Type
}

func NewStructField

func NewStructField(name string, typ Type) StructField

type StructType

type StructType struct {
	Fields []StructField
}

func NewStruct

func NewStruct(fields ...StructField) *StructType

func (*StructType) BasicType

func (s *StructType) BasicType() BasicType

func (*StructType) Equal

func (s *StructType) Equal(t Type) bool

func (*StructType) String

func (s *StructType) String() string

type Type

type Type interface {
	fmt.Stringer

	BasicType() BasicType
	Equal(Type) bool
}

func NewFuncType

func NewFuncType(parTyps []Type, retType Type) Type

func ParseType

func ParseType(typ string, names map[string]Type) (Type, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL