ctx

package
v0.0.0-...-3042a1c Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(conf *config.Config) value.Context

NewContext returns a new execution context: the stack and variables, plus the execution configuration.

Types

type Context

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

Context holds execution context, specifically the binding of names to values and operators. It is the only implementation of ../value/Context, but since it references the value package, there would be a cycle if that package depended on this type definition.

func (*Context) Assign

func (c *Context) Assign(name string, val value.Value)

Assign assigns the variable the value. The variable must be defined either in the current function or globally. Inside a function, new variables become locals.

func (*Context) Config

func (c *Context) Config() *config.Config

func (*Context) Declare

func (c *Context) Declare(name string)

Declare makes the name a variable while parsing the next function.

func (*Context) Eval

func (c *Context) Eval(exprs []value.Expr) []value.Value

Eval evaluates a list of expressions.

func (*Context) EvalBinary

func (c *Context) EvalBinary(left value.Value, op string, right value.Value) value.Value

EvalBinary evaluates a binary operator.

func (*Context) EvalUnary

func (c *Context) EvalUnary(op string, right value.Value) value.Value

EvalUnary evaluates a unary operator.

func (*Context) ForgetAll

func (c *Context) ForgetAll()

ForgetAll forgets the declared variables.

func (*Context) Lookup

func (c *Context) Lookup(name string) value.Value

Lookup returns the value of a symbol.

func (*Context) SetConstants

func (c *Context) SetConstants()

SetConstants re-assigns the fundamental constant values using the current setting of floating-point precision.

func (*Context) UserDefined

func (c *Context) UserDefined(op string, isBinary bool) bool

Jump to

Keyboard shortcuts

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