interp_a

package
v0.0.0-...-6ef1766 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 13 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltinAdd

func BuiltinAdd(args []interface{}) ([]interface{}, error)

func BuiltinApply

func BuiltinApply(args []interface{}) ([]interface{}, error)

BuiltinApply applies arguments to a section of code which wants to receive arguments

func BuiltinCat

func BuiltinCat(args []interface{}) ([]interface{}, error)

func BuiltinCatFromList

func BuiltinCatFromList(args []interface{}) ([]interface{}, error)

func BuiltinCatRepeat

func BuiltinCatRepeat(args []interface{}) ([]interface{}, error)

func BuiltinCodeCallsData

func BuiltinCodeCallsData(args []interface{}) ([]interface{}, error)

func BuiltinDivide

func BuiltinDivide(args []interface{}) ([]interface{}, error)

func BuiltinDo

func BuiltinDo(args []interface{}) ([]interface{}, error)

BuiltinDo creates a sub-evaluator with return operations and evaluates each argument, discarding the return value of each argument.

To concatenate return values, simply do: do (return-push (function-a)) (return-push (function-b)) (return)

func BuiltinFnTemplate

func BuiltinFnTemplate(args []interface{}) ([]interface{}, error)

func BuiltinForeach

func BuiltinForeach(args []interface{}) ([]interface{}, error)

func BuiltinFormat

func BuiltinFormat(args []interface{}) ([]interface{}, error)

func BuiltinIf

func BuiltinIf(args []interface{}) ([]interface{}, error)

func BuiltinInt

func BuiltinInt(args []interface{}) ([]interface{}, error)

func BuiltinJoinLF

func BuiltinJoinLF(args []interface{}) ([]interface{}, error)

func BuiltinJsonDecodeOne

func BuiltinJsonDecodeOne(args []interface{}) ([]interface{}, error)

func BuiltinJsonEncodeOne

func BuiltinJsonEncodeOne(args []interface{}) ([]interface{}, error)

func BuiltinLess

func BuiltinLess(args []interface{}) ([]interface{}, error)

func BuiltinListToCsvletsN

func BuiltinListToCsvletsN(args []interface{}) ([]interface{}, error)

func BuiltinMultiply

func BuiltinMultiply(args []interface{}) ([]interface{}, error)

func BuiltinPassthrough

func BuiltinPassthrough(args []interface{}) ([]interface{}, error)

func BuiltinReduce

func BuiltinReduce(args []interface{}) ([]interface{}, error)

func BuiltinSlurp

func BuiltinSlurp(args []interface{}) ([]interface{}, error)

func BuiltinStore

func BuiltinStore(args []interface{}) ([]interface{}, error)

func BuiltinStrings

func BuiltinStrings(args []interface{}) ([]interface{}, error)

func BuiltinSubtract

func BuiltinSubtract(args []interface{}) ([]interface{}, error)

func BuiltinTie

func BuiltinTie(args []interface{}) ([]interface{}, error)

func BuiltinUnfile

func BuiltinUnfile(args []interface{}) ([]interface{}, error)

func HostServer

func HostServer(
	connParams ServerParams,
	evaluator CanEvaluate,
) error

func ListToMap

func ListToMap(items []interface{}) (map[string]interface{}, error)

Types

type ArgGetter

type ArgGetter struct {
	Value []interface{}
}

func MakeArgGetter

func MakeArgGetter() *ArgGetter

func (*ArgGetter) Bind

func (rs *ArgGetter) Bind(eval HybridEvaluator)

type CanEvaluate

type CanEvaluate interface {
	OpEvaluate(args []interface{}) ([]interface{}, error)
}

type CanMakeChildEvaluator

type CanMakeChildEvaluator interface {
	MakeChild() CanEvaluate
}

type ConnectionParams

type ConnectionParams struct {
	Address string
}

type ErrorFunctionNotFound

type ErrorFunctionNotFound struct {
	FunctionName string
}

func (ErrorFunctionNotFound) Error

func (err ErrorFunctionNotFound) Error() string

type ErrorType

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

func (ErrorType) Error

func (et ErrorType) Error() string

func (ErrorType) Return

func (et ErrorType) Return() ([]interface{}, error)

func (ErrorType) String

func (et ErrorType) String() string

type HybridEvaluator

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

func NewHybridEvaluator

func NewHybridEvaluator(
	functionsMap map[string]HybridEvaluatorEntry,
) (HybridEvaluator, error)

func (HybridEvaluator) AddEvaluator

func (evaluator HybridEvaluator) AddEvaluator(
	name string, function Operation,
)

func (HybridEvaluator) AddOperation

func (evaluator HybridEvaluator) AddOperation(
	name string, function Operation,
)

func (HybridEvaluator) GetEntry

func (evaluator HybridEvaluator) GetEntry(args []interface{},
) (string, HybridEvaluatorEntry, bool, error)

func (HybridEvaluator) GetOperation

func (evaluator HybridEvaluator) GetOperation(
	name string,
) (Operation, HybridEvaluatorEntryTag, bool)

func (HybridEvaluator) MakeChild

func (evaluator HybridEvaluator) MakeChild() HybridEvaluator

func (HybridEvaluator) OpAddEvaluator

func (evaluator HybridEvaluator) OpAddEvaluator(
	args []interface{},
) ([]interface{}, error)

func (HybridEvaluator) OpAddOperation

func (evaluator HybridEvaluator) OpAddOperation(
	args []interface{},
) ([]interface{}, error)

func (HybridEvaluator) OpEvaluate

func (evaluator HybridEvaluator) OpEvaluate(
	args []interface{},
) ([]interface{}, error)

func (HybridEvaluator) OpGetOperation

func (evaluator HybridEvaluator) OpGetOperation(
	args []interface{},
) ([]interface{}, error)

func (HybridEvaluator) OpListOperations

func (evaluator HybridEvaluator) OpListOperations(
	args []interface{},
) ([]interface{}, error)

func (HybridEvaluator) RunEntry

func (evaluator HybridEvaluator) RunEntry(
	entry HybridEvaluatorEntry,
	args []interface{},
) ([]interface{}, error)

func (HybridEvaluator) SetDefaultBehaviour

func (evaluator HybridEvaluator) SetDefaultBehaviour(
	op Operation,
	tag HybridEvaluatorEntryTag,
)

type HybridEvaluatorEntry

type HybridEvaluatorEntry struct {
	Tag HybridEvaluatorEntryTag
	Op  Operation
}

type HybridEvaluatorEntryTag

type HybridEvaluatorEntryTag int
const (
	// EntryIsOperation indicates that the function expects its arguments to be
	// evaluated before the function is called.
	EntryIsOperation HybridEvaluatorEntryTag = iota

	// EntryIsEvaluator indicates that the function does not expect its
	// arguments to be evaluated, and does not need any evaluator function.
	EntryIsEvaluator

	// EntryIsControl indicates that the function does not expect its arguments
	// to be evaluated, but the function should always recieve the default
	// evaluator as the first parameter implicitly.
	EntryIsControl

	// EntryIsNone indicates that nothing exists in the entry
	// (currently only used for defaultBehaviour)
	EntryIsNone
)

type InterpreterFactoryA

type InterpreterFactoryA struct{}

func (InterpreterFactoryA) MakeEmpty

func (ifa InterpreterFactoryA) MakeEmpty() HybridEvaluator

MakeEmpty makes an evaluator with only mutator functions

func (InterpreterFactoryA) MakeExec

func (ifa InterpreterFactoryA) MakeExec() HybridEvaluator

MakeExec makes the root operation for the interpreter, which is a HybridEvaluator with builtin functions already added to it.

type Operation

type Operation func(args []interface{}) ([]interface{}, error)

func NewOperationMux

func NewOperationMux(
	functionsMap map[string]Operation,
) (Operation, error)

type RemoteEvaluator

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

func (*RemoteEvaluator) Init

func (evaluator *RemoteEvaluator) Init(
	connParams ConnectionParams,
)

func (RemoteEvaluator) OpEvaluate

func (evaluator RemoteEvaluator) OpEvaluate(args []interface{}) ([]interface{}, error)

type ReturnState

type ReturnState struct {
	Value []interface{}
	Ready bool
}

func MakeReturnState

func MakeReturnState() *ReturnState

func (*ReturnState) Bind

func (rs *ReturnState) Bind(eval HybridEvaluator)

type ServerParams

type ServerParams struct {
	Address string
}

Jump to

Keyboard shortcuts

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