types

package
v0.0.0-...-fcffdc5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const SrcDistUnspecified int = -1

Variables

View Source
var TRACE = false

Functions

func AsBool

func AsBool(v Value) bool

func AssertType

func AssertType(v Value, path TypePath)

func Chunk

func Chunk(v Value, ref string) interface{}

func Del

func Del(v Value)

func IsType

func IsType(v Value, path TypePath) bool

func Unint

func Unint(i Value) int

func Unstring

func Unstring(b Value) string

func Unuint

func Unuint(i Value) uint

Types

type Datum

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

func (*Datum) Dump

func (d *Datum) Dump(o *debug.Output)

func (*Datum) Invoke

func (d *Datum) Invoke(usr *Datum, name string, params ...Value) Value

func (*Datum) Realm

func (d *Datum) Realm() *Realm

func (*Datum) SetVar

func (d *Datum) SetVar(name string, value Value)

func (*Datum) String

func (d *Datum) String() string

func (*Datum) SuperInvoke

func (d *Datum) SuperInvoke(usr *Datum, chunk string, name string, params ...Value) Value

func (*Datum) Type

func (d *Datum) Type() TypePath

func (*Datum) UID

func (d *Datum) UID() uint64

func (*Datum) Var

func (d *Datum) Var(name string) Value

type DatumImpl

type DatumImpl interface {
	Type() TypePath
	Var(src *Datum, name string) (Value, bool)
	SetVar(src *Datum, name string, value Value) SetResult
	Proc(src *Datum, usr *Datum, name string, params ...Value) (Value, bool)
	SuperProc(src *Datum, usr *Datum, chunk string, name string, params ...Value) (Value, bool)
	ProcSettings(name string) (ProcSettings, bool)
	Chunk(ref string) interface{}
}

func Unpack

func Unpack(v Value) (DatumImpl, bool)

func UnpackDatum

func UnpackDatum(d *Datum) DatumImpl

type Int

type Int int

func FromBool

func FromBool(b bool) Int

func (Int) Invoke

func (i Int) Invoke(usr *Datum, name string, parameters ...Value) Value

func (Int) SetVar

func (i Int) SetVar(name string, value Value)

func (Int) String

func (i Int) String() string

func (Int) Var

func (i Int) Var(name string) Value

type ProcSettings

type ProcSettings struct {
	Src SrcSetting
}

really just used for verbs (except background which isn't supported yet)

func (ProcSettings) IsZero

func (p ProcSettings) IsZero() bool

type Realm

type Realm struct {
	TreePrivateState interface{} // populated by the TypeTree
	// contains filtered or unexported fields
}

func NewRealm

func NewRealm(tree TypeTree) *Realm

func (*Realm) FindAll

func (r *Realm) FindAll(predicate func(*Datum) bool) (out []Value)

func (*Realm) FindOne

func (r *Realm) FindOne(predicate func(*Datum) bool) Value

returns nil if not found

func (*Realm) IsSubType

func (realm *Realm) IsSubType(path TypePath, of TypePath) bool

func (*Realm) Lookup

func (r *Realm) Lookup(uid uint64) Value

func (*Realm) New

func (realm *Realm) New(path TypePath, usr *Datum, params ...Value) *Datum

func (*Realm) NewDatum

func (realm *Realm) NewDatum(impl DatumImpl) *Datum

func (*Realm) NewPlain

func (realm *Realm) NewPlain(path TypePath, params ...Value) *Datum

func (*Realm) SetWorldRef

func (realm *Realm) SetWorldRef(worldRef interface{})

func (*Realm) WorldRef

func (realm *Realm) WorldRef() interface{}

type Ref

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

long-lived pointers to Values need to be Refs

func Reference

func Reference(v Value) *Ref

func (*Ref) Dereference

func (r *Ref) Dereference() Value

type SetResult

type SetResult int
const (
	SetResultOk SetResult = iota
	SetResultNonexistent
	SetResultReadOnly
)

type SrcSetting

type SrcSetting struct {
	Type SrcSettingType
	Dist int
	In   bool
}

func (SrcSetting) IsZero

func (s SrcSetting) IsZero() bool

type SrcSettingType

type SrcSettingType int
const (
	SrcSettingTypeUsr SrcSettingType = iota
	SrcSettingTypeUsrContents
	SrcSettingTypeUsrLoc
	SrcSettingTypeUsrGroup
	SrcSettingTypeWorld
	SrcSettingTypeWorldContents
	SrcSettingTypeView
	SrcSettingTypeOView
)

func (SrcSettingType) String

func (s SrcSettingType) String() string

type String

type String string

func (String) Invoke

func (s String) Invoke(usr *Datum, name string, parameters ...Value) Value

func (String) SetVar

func (s String) SetVar(name string, value Value)

func (String) String

func (s String) String() string

func (String) Var

func (s String) Var(name string) Value

type TypePath

type TypePath string

func (TypePath) Invoke

func (path TypePath) Invoke(usr *Datum, name string, parameters ...Value) Value

func (TypePath) IsValid

func (path TypePath) IsValid() bool

func (TypePath) SetVar

func (path TypePath) SetVar(name string, value Value)

func (TypePath) String

func (path TypePath) String() string

func (TypePath) Validate

func (path TypePath) Validate()

func (TypePath) Var

func (path TypePath) Var(name string) Value

type TypeTree

type TypeTree interface {
	Parent(path TypePath) TypePath
	New(realm *Realm, path TypePath, params ...Value) *Datum
	PopulateRealm(realm *Realm)
}

type Value

type Value interface {
	Var(name string) Value
	SetVar(name string, value Value)
	Invoke(usr *Datum, name string, parameters ...Value) Value
	String() string
}

a datum or a primitive. a nil Value means null.

func KWParam

func KWParam(params []Value, i int, kwparams map[string]Value, kw string) Value

func Param

func Param(params []Value, i int) Value

Jump to

Keyboard shortcuts

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