Documentation
¶
Index ¶
- Variables
- type ComplexVariable
- type Interpreter
- func (i *Interpreter) Assign(name string, value language.Object) error
- func (i *Interpreter) Declare(name string, value language.Object, typ *language.Type, mutable bool) error
- func (i *Interpreter) Detach()
- func (i *Interpreter) GetObject(name string) (language.Object, bool)
- func (i *Interpreter) MustDetach()
- func (i *Interpreter) Run(nodes []*astnode.Node) (language.Object, error)
- type Iterator
- type Runtime
- type Scope
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnknownNode = fmt.Errorf("Unknown node") ErrImmutableVariable = fmt.Errorf("Variable is immutable") ErrExpression = fmt.Errorf("Expression error") ErrImportError = fmt.Errorf("Import error") ErrUndefinedVariable = fmt.Errorf("Undefined variable") ErrUnsupported = fmt.Errorf("Unsupported operation") ErrUndefinedFunction = fmt.Errorf("Undefined function") ErrExpectedFunction = fmt.Errorf("Expected function") ErrTypeMismatch = fmt.Errorf("Type mismatch") ErrAst = fmt.Errorf("Ast error") ErrValueError = fmt.Errorf("Value error") ErrInvalid = fmt.Errorf("Invalid syntax") ErrInvalidImpl = fmt.Errorf("Invalid implementation") ErrPrototype = fmt.Errorf("Prototype error") ErrStructInstantiation = fmt.Errorf("Failed to instantiate a struct") ErrVoidAsValue = fmt.Errorf("Cannot use void as value") )
Functions ¶
This section is empty.
Types ¶
type ComplexVariable ¶
type ComplexVariable struct {
// Scope is the scope of the variable.
Scope interface {
GetObject(name string) (language.Object, bool)
BindObject(name string, value language.Object, mutable bool) error
}
// Object is the object that the variable represents.
Object language.Object
}
ComplexVariable represents a variable that is outside of the current interpreter. (For example: otherFile.otherVariable)
type Interpreter ¶
type Interpreter struct {
ID uint
// contains filtered or unexported fields
}
func NewWithParent ¶
func NewWithParent(parent *Interpreter, scope Scope, name ...string) *Interpreter
func (*Interpreter) Detach ¶
func (i *Interpreter) Detach()
func (*Interpreter) GetObject ¶
func (i *Interpreter) GetObject(name string) (language.Object, bool)
func (*Interpreter) MustDetach ¶
func (i *Interpreter) MustDetach()
type Runtime ¶
type Runtime interface {
GetBuiltin(name string) (language.Object, bool)
GetEventProvider() events.Provider
NewID() uint
RemoveInterpreter(id uint)
ImportPackage(name string, dg *debug.Debug) (language.Object, bool)
GetPacker() (*packer.Packer, error)
FindInterpreter(file string) (*Interpreter, bool)
AddInterpreter(file string, interpreter *Interpreter)
}
Click to show internal directories.
Click to hide internal directories.