Documentation
¶
Index ¶
- Variables
- func LineHandler(line func(string)) io.Writer
- func ObjectToString(obj Object) string
- func ObjectsEqual(l, r Object) bool
- type BoolObject
- type BuiltinHandler
- type CallArgs
- func (ca *CallArgs) Bind(vars ...interface{}) error
- func (ca CallArgs) BindSwitch(name string, val interface{}) error
- func (ca *CallArgs) CanBind(vars ...interface{}) bool
- func (ca CallArgs) HasSwitch(name string) bool
- func (ca CallArgs) IsTopLevel() bool
- func (ca *CallArgs) NArgs() int
- func (ca *CallArgs) RestAsObjects() []Object
- func (ca *CallArgs) Shift(n int)
- type EchoPrinter
- type ErrRuntime
- type EvalOption
- type GoFunction
- type HashObject
- type Hashable
- type Inst
- func (inst *Inst) Eval(ctx context.Context, r io.Reader, options ...EvalOption) (any, error)
- func (inst *Inst) EvalString(ctx context.Context, expr string) (any, error)
- func (inst *Inst) Out() io.Writer
- func (inst *Inst) SetBuiltin(name string, fn BuiltinHandler)
- func (inst *Inst) SetBuiltinInvokable(name string, fn Invokable)
- func (inst *Inst) SetMissingPseudoVarHandler(h MissingPseudoVarHandler)
- func (inst *Inst) SetPseudoVar(name string, h PseudoVarHandler)
- func (inst *Inst) SetVar(name string, value any)
- type InstOption
- type IntObject
- type Invokable
- type Iterable
- type ListObject
- type Listable
- type MissingBuiltinHandler
- type MissingModifiablePseudoVarHandler
- type MissingPseudoVarHandler
- type ModHashable
- type ModListable
- type ModifiablePseudoVarHandler
- type Module
- type Object
- type OpaqueObject
- type PseudoVarHandler
- type StringListObject
- type StringObject
- type TimeObject
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type BoolObject ¶
type BoolObject bool
func (BoolObject) String ¶
func (b BoolObject) String() string
func (BoolObject) Truthy ¶
func (b BoolObject) Truthy() bool
type CallArgs ¶
type CallArgs struct {
// contains filtered or unexported fields
}
type ErrRuntime ¶
type ErrRuntime struct {
// contains filtered or unexported fields
}
func (ErrRuntime) Error ¶
func (e ErrRuntime) Error() string
type GoFunction ¶
func (GoFunction) String ¶
func (gf GoFunction) String() string
func (GoFunction) Truthy ¶
func (gf GoFunction) Truthy() bool
type HashObject ¶
func (HashObject) Len ¶
func (s HashObject) Len() int
func (HashObject) SetValue ¶
func (s HashObject) SetValue(k string, val Object) error
func (HashObject) String ¶
func (s HashObject) String() string
func (HashObject) Truthy ¶
func (s HashObject) Truthy() bool
func (HashObject) Value ¶
func (s HashObject) Value(k string) Object
type Hashable ¶
type Inst ¶
type Inst struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...InstOption) *Inst
func (*Inst) Eval ¶
func (*Inst) EvalString ¶
func (*Inst) SetBuiltin ¶
func (inst *Inst) SetBuiltin(name string, fn BuiltinHandler)
func (*Inst) SetMissingPseudoVarHandler ¶
func (inst *Inst) SetMissingPseudoVarHandler(h MissingPseudoVarHandler)
func (*Inst) SetPseudoVar ¶
func (inst *Inst) SetPseudoVar(name string, h PseudoVarHandler)
type InstOption ¶
type InstOption func(*Inst)
func WithCustomEchoPrinter ¶
func WithCustomEchoPrinter(echoPrinter EchoPrinter) InstOption
func WithMissingBuiltinHandler ¶
func WithMissingBuiltinHandler(handler MissingBuiltinHandler) InstOption
func WithModule ¶
func WithModule(module Module) InstOption
func WithOut ¶
func WithOut(out io.Writer) InstOption
type Invokable ¶
type Invokable struct {
// contains filtered or unexported fields
}
type Iterable ¶
type ListObject ¶
type ListObject []Object
func NewListObject ¶
func NewListObject() *ListObject
func NewListObjectOfLength ¶ added in v0.1.2
func NewListObjectOfLength(l int) *ListObject
func (*ListObject) Append ¶
func (lo *ListObject) Append(o Object)
func (*ListObject) Index ¶
func (s *ListObject) Index(i int) Object
func (*ListObject) Insert ¶
func (lo *ListObject) Insert(idx int, obj Object) error
func (*ListObject) Len ¶
func (s *ListObject) Len() int
func (*ListObject) SetIndex ¶
func (s *ListObject) SetIndex(i int, toVal Object) error
func (*ListObject) String ¶
func (s *ListObject) String() string
func (*ListObject) Truthy ¶
func (s *ListObject) Truthy() bool
type MissingBuiltinHandler ¶
type MissingModifiablePseudoVarHandler ¶
type MissingModifiablePseudoVarHandler interface {
MissingPseudoVarHandler
Set(ctx context.Context, string, v any) error
}
type MissingPseudoVarHandler ¶
type ModListable ¶
type ModListable interface {
Listable
// Insert adds a new item to the list. idx can be a positive
// number from 0 to len(), in which case the object will be inserted
// at that position, shifting all other elements to the right.
// If idx is negative, then the item will be inserted
// at that position from the right.
Insert(idx int, obj Object) error
// SetIndex replaces the item at index position idx with obj.
SetIndex(idx int, obj Object) error
}
type ModifiablePseudoVarHandler ¶
type ModifiablePseudoVarHandler interface {
PseudoVarHandler
Set(ctx context.Context, v any) error
}
type Module ¶
type Module struct {
Name string
Builtins map[string]BuiltinHandler
}
type OpaqueObject ¶
type OpaqueObject struct {
// contains filtered or unexported fields
}
func Opaque ¶
func Opaque(v any) OpaqueObject
func (OpaqueObject) String ¶
func (p OpaqueObject) String() string
func (OpaqueObject) Truthy ¶
func (p OpaqueObject) Truthy() bool
type StringListObject ¶
type StringListObject []string
func (StringListObject) Index ¶
func (ss StringListObject) Index(i int) Object
func (StringListObject) Len ¶
func (ss StringListObject) Len() int
func (StringListObject) String ¶
func (ss StringListObject) String() string
func (StringListObject) Truthy ¶
func (ss StringListObject) Truthy() bool
type StringObject ¶
type StringObject string
func (StringObject) String ¶
func (s StringObject) String() string
func (StringObject) Truthy ¶
func (s StringObject) Truthy() bool
type TimeObject ¶
func (TimeObject) String ¶
func (t TimeObject) String() string
func (TimeObject) Truthy ¶
func (t TimeObject) Truthy() bool
Source Files
¶
- ast.go
- builtins.go
- env.go
- errors.go
- eval.go
- inst.go
- io.go
- objs.go
- userbuiltin.go
Click to show internal directories.
Click to hide internal directories.