values

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertMainFunction

func AssertMainFunction(v Value) error

func IsBool

func IsBool(v_ Value) bool

func IsFloat

func IsFloat(v_ Value) bool

func IsInt

func IsInt(v_ Value) bool

func IsSampler2D

func IsSampler2D(v_ Value) bool

func IsSamplerCube

func IsSamplerCube(v_ Value) bool

func IsScalar

func IsScalar(v_ Value) bool

func IsSimple

func IsSimple(v_ Value) bool

func IsStruct

func IsStruct(v Value) bool

func IsVec

func IsVec(v_ Value) bool

Types

type Array

type Array struct {
	ValueData
	// contains filtered or unexported fields
}

func (*Array) Check

func (v *Array) Check(other_ Value, ctx context.Context) error

func (*Array) EvalFunction

func (v *Array) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Array) GetIndex

func (v *Array) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*Array) GetMember

func (v *Array) GetMember(key string, ctx context.Context) (Value, error)

func (*Array) Length

func (v *Array) Length() int

func (*Array) SetIndex

func (v *Array) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*Array) SetMember

func (v *Array) SetMember(key string, arg Value, ctx context.Context) error

func (*Array) TypeName

func (v *Array) TypeName() string

type Callable

type Callable interface {
	EvalCall(args []Value, ctx context.Context) (Value, error)
}

type ContextValue

type ContextValue struct {
	// contains filtered or unexported fields
}

give a different context to a value

func (*ContextValue) Check

func (v *ContextValue) Check(v_ Value, ctx context.Context) error

func (*ContextValue) Context

func (v *ContextValue) Context() context.Context

func (*ContextValue) EvalFunction

func (v *ContextValue) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*ContextValue) GetIndex

func (v *ContextValue) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*ContextValue) GetMember

func (v *ContextValue) GetMember(key string, ctx context.Context) (Value, error)

func (*ContextValue) Instantiate

func (v *ContextValue) Instantiate(ctx context.Context) (Value, error)

func (*ContextValue) Length

func (v *ContextValue) Length() int

func (*ContextValue) LiteralIntValue

func (v *ContextValue) LiteralIntValue() (int, bool)

func (*ContextValue) SetIndex

func (v *ContextValue) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*ContextValue) SetMember

func (v *ContextValue) SetMember(key string, arg Value, ctx context.Context) error

func (*ContextValue) TypeName

func (v *ContextValue) TypeName() string

type Function

type Function struct {
	ValueData
	// contains filtered or unexported fields
}

func (*Function) Check

func (v *Function) Check(other_ Value, ctx context.Context) error

same interface isn't good enough, needs to be a

func (*Function) EvalFunction

func (v *Function) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Function) GetIndex

func (v *Function) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*Function) GetMember

func (v *Function) GetMember(key string, ctx context.Context) (Value, error)

func (*Function) Length

func (v *Function) Length() int

func (*Function) LiteralIntValue

func (v *Function) LiteralIntValue() (int, bool)

func (*Function) SetIndex

func (v *Function) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*Function) SetMember

func (v *Function) SetMember(key string, arg Value, ctx context.Context) error

func (*Function) TypeName

func (v *Function) TypeName() string

type FunctionOverloads

type FunctionOverloads struct {
	// contains filtered or unexported fields
}

func (*FunctionOverloads) EvalCall

func (fo *FunctionOverloads) EvalCall(args []Value, ctx context.Context) (Value, error)

type LiteralInt

type LiteralInt struct {
	Scalar
	// contains filtered or unexported fields
}

func AssertLiteralInt

func AssertLiteralInt(v_ Value) (*LiteralInt, error)

func NewLiteralInt

func NewLiteralInt(i int, ctx context.Context) *LiteralInt

func (*LiteralInt) LiteralIntValue

func (v *LiteralInt) LiteralIntValue() (int, bool)

type Sampler2D

type Sampler2D struct {
	ValueData
}

func (*Sampler2D) Check

func (v *Sampler2D) Check(other_ Value, ctx context.Context) error

func (*Sampler2D) EvalFunction

func (v *Sampler2D) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Sampler2D) GetIndex

func (v *Sampler2D) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*Sampler2D) GetMember

func (v *Sampler2D) GetMember(key string, ctx context.Context) (Value, error)

func (*Sampler2D) Length

func (v *Sampler2D) Length() int

func (*Sampler2D) LiteralIntValue

func (v *Sampler2D) LiteralIntValue() (int, bool)

func (*Sampler2D) SetIndex

func (v *Sampler2D) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*Sampler2D) SetMember

func (v *Sampler2D) SetMember(key string, arg Value, ctx context.Context) error

func (*Sampler2D) TypeName

func (v *Sampler2D) TypeName() string

type Sampler2DType

type Sampler2DType struct {
	TypeData
}

func (*Sampler2DType) Check

func (v *Sampler2DType) Check(other Value, ctx context.Context) error

func (*Sampler2DType) EvalFunction

func (v *Sampler2DType) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Sampler2DType) Instantiate

func (v *Sampler2DType) Instantiate(ctx context.Context) (Value, error)

type SamplerCube

type SamplerCube struct {
	ValueData
}

func (*SamplerCube) Check

func (v *SamplerCube) Check(other_ Value, ctx context.Context) error

func (*SamplerCube) EvalFunction

func (v *SamplerCube) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*SamplerCube) GetIndex

func (v *SamplerCube) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*SamplerCube) GetMember

func (v *SamplerCube) GetMember(key string, ctx context.Context) (Value, error)

func (*SamplerCube) Length

func (v *SamplerCube) Length() int

func (*SamplerCube) LiteralIntValue

func (v *SamplerCube) LiteralIntValue() (int, bool)

func (*SamplerCube) SetIndex

func (v *SamplerCube) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*SamplerCube) SetMember

func (v *SamplerCube) SetMember(key string, arg Value, ctx context.Context) error

func (*SamplerCube) TypeName

func (v *SamplerCube) TypeName() string

type SamplerCubeType

type SamplerCubeType struct {
	TypeData
}

func (*SamplerCubeType) Check

func (v *SamplerCubeType) Check(other Value, ctx context.Context) error

func (*SamplerCubeType) EvalFunction

func (v *SamplerCubeType) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*SamplerCubeType) Instantiate

func (v *SamplerCubeType) Instantiate(ctx context.Context) (Value, error)

type Scalar

type Scalar struct {
	ValueData
	// contains filtered or unexported fields
}

func AssertBool

func AssertBool(v_ Value) (*Scalar, error)

func AssertFloat

func AssertFloat(v_ Value) (*Scalar, error)

func AssertInt

func AssertInt(v_ Value) (*Scalar, error)

func (*Scalar) Check

func (v *Scalar) Check(other_ Value, ctx context.Context) error

func (*Scalar) EvalFunction

func (v *Scalar) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Scalar) GetIndex

func (v *Scalar) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*Scalar) GetMember

func (v *Scalar) GetMember(key string, ctx context.Context) (Value, error)

func (*Scalar) Length

func (v *Scalar) Length() int

func (*Scalar) SetIndex

func (v *Scalar) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*Scalar) SetMember

func (v *Scalar) SetMember(key string, arg Value, ctx context.Context) error

func (*Scalar) TypeName

func (v *Scalar) TypeName() string

type ScalarType

type ScalarType struct {
	TypeData
}

func (*ScalarType) Check

func (v *ScalarType) Check(other Value, ctx context.Context) error

func (*ScalarType) EvalFunction

func (v *ScalarType) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*ScalarType) Instantiate

func (v *ScalarType) Instantiate(ctx context.Context) (Value, error)

type Struct

type Struct struct {
	ValueData
	// contains filtered or unexported fields
}

func AssertStruct

func AssertStruct(v Value) (*Struct, error)

func (*Struct) Check

func (v *Struct) Check(other_ Value, ctx context.Context) error

func (*Struct) EvalFunction

func (v *Struct) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Struct) GetIndex

func (v *Struct) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*Struct) GetMember

func (v *Struct) GetMember(key string, ctx context.Context) (Value, error)

func (*Struct) GetStructable

func (v *Struct) GetStructable() Structable

func (*Struct) Length

func (v *Struct) Length() int

func (*Struct) SetIndex

func (v *Struct) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*Struct) SetMember

func (v *Struct) SetMember(key string, arg Value, ctx context.Context) error

func (*Struct) TypeName

func (v *Struct) TypeName() string

type StructType

type StructType struct {
	TypeData
	// contains filtered or unexported fields
}

func (*StructType) Check

func (v *StructType) Check(other Value, ctx context.Context) error

func (*StructType) EvalFunction

func (v *StructType) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*StructType) Instantiate

func (v *StructType) Instantiate(ctx context.Context) (Value, error)

type Structable

type Structable interface {
	Name() string
	CheckConstruction(args []Value, ctx context.Context) error
	GetMember(key string, ctx context.Context) (Value, error)
	SetMember(key string, arg Value, ctx context.Context) error
}

type TypeData

type TypeData struct {
	// contains filtered or unexported fields
}

func (*TypeData) Context

func (v *TypeData) Context() context.Context

func (*TypeData) GetIndex

func (v *TypeData) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*TypeData) GetMember

func (v *TypeData) GetMember(key string, ctx context.Context) (Value, error)

func (*TypeData) Length

func (v *TypeData) Length() int

func (*TypeData) LiteralIntValue

func (v *TypeData) LiteralIntValue() (int, bool)

func (*TypeData) SetIndex

func (v *TypeData) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*TypeData) SetMember

func (v *TypeData) SetMember(key string, arg Value, ctx context.Context) error

func (*TypeData) TypeName

func (v *TypeData) TypeName() string

type Value

type Value interface {
	Context() context.Context

	TypeName() string
	Check(other Value, ctx context.Context) error // types can check values, values can check values

	Instantiate(ctx context.Context) (Value, error)                // only works for types, err if not a type
	EvalFunction(args []Value, ctx context.Context) (Value, error) // method returns nil Value

	GetMember(key string, ctx context.Context) (Value, error)
	SetMember(key string, arg Value, ctx context.Context) error

	GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)
	SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

	LiteralIntValue() (int, bool)
	Length() int // mostly 1, more than 1 for vectors and arrays
}

func NewAnyAllFunction

func NewAnyAllFunction(ctx context.Context) Value

func NewArray

func NewArray(content Value, length int, ctx context.Context) Value

func NewBVec2

func NewBVec2(ctx context.Context) Value

func NewBVec3

func NewBVec3(ctx context.Context) Value

func NewBVec4

func NewBVec4(ctx context.Context) Value

func NewBool

func NewBool(ctx context.Context) Value

func NewBuiltinFunction

func NewBuiltinFunction(args [][]Value, ctx context.Context) Value

func NewClampFunction

func NewClampFunction(ctx context.Context) Value

func NewCompareFunction

func NewCompareFunction(ctx context.Context) Value

func NewContextValue

func NewContextValue(val Value, ctx context.Context) Value

func NewCrossFunction

func NewCrossFunction(ctx context.Context) Value

func NewDotFunction

func NewDotFunction(ctx context.Context) Value

func NewFloat

func NewFloat(ctx context.Context) Value

func NewFunction

func NewFunction(fn Callable, ctx context.Context) Value

func NewIVec2

func NewIVec2(ctx context.Context) Value

func NewIVec3

func NewIVec3(ctx context.Context) Value

func NewIVec4

func NewIVec4(ctx context.Context) Value

func NewInt

func NewInt(ctx context.Context) Value

func NewLengthFunction

func NewLengthFunction(ctx context.Context) Value

func NewMinMaxFunction

func NewMinMaxFunction(ctx context.Context) Value

func NewMixFunction

func NewMixFunction(ctx context.Context) Value

func NewNotFunction

func NewNotFunction(ctx context.Context) Value

func NewOneOrTwoToOneFunction

func NewOneOrTwoToOneFunction(ctx context.Context) Value

func NewOneToOneFunction

func NewOneToOneFunction(ctx context.Context) Value

func NewSampler2D

func NewSampler2D(ctx context.Context) Value

func NewSampler2DType

func NewSampler2DType(ctx context.Context) Value

func NewSamplerCube

func NewSamplerCube(ctx context.Context) Value

func NewSamplerCubeType

func NewSamplerCubeType(ctx context.Context) Value

func NewScalar

func NewScalar(typeName string, ctx context.Context) Value

func NewScalarType

func NewScalarType(name string, ctx context.Context) Value

func NewSmoothStepFunction

func NewSmoothStepFunction(ctx context.Context) Value

func NewStepFunction

func NewStepFunction(ctx context.Context) Value

func NewStruct

func NewStruct(t Structable, ctx context.Context) Value

func NewStructType

func NewStructType(t Structable, ctx context.Context) Value

func NewTexture2DFunction

func NewTexture2DFunction(ctx context.Context) Value

func NewTextureCubeFunction

func NewTextureCubeFunction(ctx context.Context) Value

func NewThreeToOneFunction

func NewThreeToOneFunction(ctx context.Context) Value

func NewTwoToOneFunction

func NewTwoToOneFunction(ctx context.Context) Value

func NewVec

func NewVec(compName string, n int, ctx context.Context) Value

func NewVec2

func NewVec2(ctx context.Context) Value

func NewVec3

func NewVec3(ctx context.Context) Value

func NewVec4

func NewVec4(ctx context.Context) Value

func NewVecType

func NewVecType(compType string, n int, ctx context.Context) Value

func UnpackContextValue

func UnpackContextValue(val Value) Value

type ValueData

type ValueData struct {
	// contains filtered or unexported fields
}

func (*ValueData) Context

func (v *ValueData) Context() context.Context

func (*ValueData) Instantiate

func (v *ValueData) Instantiate(ctx context.Context) (Value, error)

func (*ValueData) LiteralIntValue

func (v *ValueData) LiteralIntValue() (int, bool)

type Vec

type Vec struct {
	ValueData
	// contains filtered or unexported fields
}

func (*Vec) Check

func (v *Vec) Check(other_ Value, ctx context.Context) error

func (*Vec) EvalFunction

func (v *Vec) EvalFunction(args []Value, ctx context.Context) (Value, error)

func (*Vec) GetIndex

func (v *Vec) GetIndex(idx *LiteralInt, ctx context.Context) (Value, error)

func (*Vec) GetMember

func (v *Vec) GetMember(key string, ctx context.Context) (Value, error)

func (*Vec) Length

func (v *Vec) Length() int

func (*Vec) SetIndex

func (v *Vec) SetIndex(idx *LiteralInt, arg Value, ctx context.Context) error

func (*Vec) SetMember

func (v *Vec) SetMember(key string, arg Value, ctx context.Context) error

func (*Vec) TypeName

func (v *Vec) TypeName() string

type VecType

type VecType struct {
	TypeData
	// contains filtered or unexported fields
}

func (*VecType) Check

func (v *VecType) Check(other Value, ctx context.Context) error

func (*VecType) EvalFunction

func (v *VecType) EvalFunction(args []Value, ctx context.Context) (Value, error)

can't vecs also take other vecs as arguments?

func (*VecType) Instantiate

func (v *VecType) Instantiate(ctx context.Context) (Value, error)

Jump to

Keyboard shortcuts

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