Documentation ¶
Index ¶
- Constants
- Variables
- type BindMap
- func (x *BindMap) AsMap() map[string]r.Value
- func (x *BindMap) Clear()
- func (x *BindMap) Del(key string)
- func (x *BindMap) Ensure() *BindMap
- func (x *BindMap) Get(key string) (r.Value, bool)
- func (x *BindMap) Get1(key string) r.Value
- func (x *BindMap) Merge(binds map[string]r.Value)
- func (x *BindMap) Set(key string, val r.Value)
- type CallFrame
- type CallStack
- type Cmd
- type Cmds
- type Constructor
- type Env
- func (env *Env) AsPackage() imports.Package
- func (env *Env) CallerFrame() *CallFrame
- func (env *Env) ChangePackage(path string) *Env
- func (env *Env) CurrentFrame() *CallFrame
- func (env *Env) DefineConst(name string, t r.Type, value r.Value) r.Value
- func (env *Env) DefineFunc(name string, t r.Type, value r.Value) r.Value
- func (env *Env) DefineVar(name string, t r.Type, value r.Value) r.Value
- func (env *Env) Eval(src interface{}) (r.Value, []r.Value)
- func (env *Env) Eval1(src interface{}) r.Value
- func (env *Env) EvalAst(in ast2.Ast) (r.Value, []r.Value)
- func (env *Env) EvalAst1(in ast2.Ast) r.Value
- func (env *Env) EvalNode(node ast.Node) (r.Value, []r.Value)
- func (env *Env) EvalNode1(node ast.Node) r.Value
- func (env *Env) FileEnv() *Env
- func (env *Env) Inspect(str string)
- func (env *Env) MacroExpand(in ast.Node) (out ast.Node, everExpanded bool)
- func (env *Env) MacroExpand1(in ast.Node) (out ast.Node, expanded bool)
- func (env *Env) MacroExpandAstCodewalk(in Ast) (out Ast, anythingExpanded bool)
- func (env *Env) MacroExpandCodewalk(in ast.Node) (out ast.Node, anythingExpanded bool)
- func (env *Env) MergePackage(pkg imports.Package)
- func (env *Env) Parse(src interface{}) ast2.Ast
- func (env *Env) ParseOnly(src interface{}) ast2.Ast
- func (env *Env) ShowPackage(packageName string)
- func (env *Env) TopEnv() *Env
- func (env *Env) ValueOf(name string) (value r.Value)
- type Error_builtin
- type Function
- type Interp
- func (ir *Interp) ChangePackage(path string)
- func (ir *Interp) Cmd(src string) (string, CmdOpt)
- func (ir *Interp) EvalFile(filePath string)
- func (ir *Interp) Interrupt(sig os.Signal)
- func (ir *Interp) ParseEvalPrint(str string) (callAgain bool)
- func (ir *Interp) Read() (string, int)
- func (ir *Interp) ReadParseEvalPrint() (callAgain bool)
- func (ir *Interp) Repl(in *bufio.Reader)
- func (ir *Interp) ReplStdin()
- type Macro
- type Methods
- type PackageName
- type ThreadGlobals
- type TypeMap
- type TypedValue
Constants ¶
const MultiThread = true
Variables ¶
var (
NilREnv = []r.Value{r.ValueOf(nilEnv)}
)
Functions ¶
This section is empty.
Types ¶
type BindMap ¶
type BindMap struct {
// contains filtered or unexported fields
}
func (*BindMap) Ensure ¶
ALWAYS use pointers to BindMap, because it contains a sync.RWMutex and https://golang.org/pkg/sync/#RWMutex states "A RWMutex must not be copied after first use."
type Constructor ¶
type Constructor struct {
// contains filtered or unexported fields
}
type Env ¶
type Env struct { *ThreadGlobals Binds BindMap Types TypeMap Proxies TypeMap Outer *Env CallStack *CallStack Name, Path string // contains filtered or unexported fields }
func (*Env) CallerFrame ¶
CallerFrame returns the CallFrame representing the caller's function. needed by recover()
func (*Env) ChangePackage ¶
func (*Env) CurrentFrame ¶
CurrentFrame returns the CallFrame representing the current function call
func (*Env) MacroExpand ¶
MacroExpand repeatedly invokes MacroExpand1 as long as the node represents a macro call. it returns the resulting node.
func (*Env) MacroExpand1 ¶
if node represents a macro call, MacroExpand1 executes it and returns the resulting node. Otherwise returns the node argument unchanged
func (*Env) MacroExpandAstCodewalk ¶
func (*Env) MacroExpandCodewalk ¶
MacroExpandCodewalk traverses the whole AST tree using pre-order traversal, and replaces each node with the result of MacroExpand(node). It implements the macroexpansion phase
func (*Env) MergePackage ¶
func (*Env) ShowPackage ¶
type Error_builtin ¶
type Error_builtin struct { Obj interface{} Error_ func() string }
func (*Error_builtin) Error ¶
func (Proxy *Error_builtin) Error() string
type Interp ¶
type Interp struct {
*Env
}
func (*Interp) ChangePackage ¶
func (*Interp) Cmd ¶
execute one of the REPL commands starting with ':' return any remainder string to be evaluated, and the options to evaluate it
func (*Interp) ParseEvalPrint ¶
func (*Interp) Read ¶
return read string and position of first non-comment token. return "", -1 on EOF
func (*Interp) ReadParseEvalPrint ¶
type Methods ¶
type Methods map[string]TypedValue
*
- inside Methods, each string is the method name
- and each TypedValue is {
- Type: the method signature, i.e. the type of a func() *without* the receiver (to allow comparison with Interface methods)
- Value: the method implementation, i.e. a func() whose first argument is the receiver,
- }
type PackageName ¶
type PackageName = genimport.PackageName
type ThreadGlobals ¶
type ThreadGlobals struct { *Globals AllMethods map[r.Type]Methods // methods implemented by interpreted code // contains filtered or unexported fields }
func NewThreadGlobals ¶
func NewThreadGlobals() *ThreadGlobals
func (*ThreadGlobals) ObjMethodByName ¶
ObjMethodByName returns a function value corresponding to the method of obj with the given name. The arguments to a Call on the returned function should not include a receiver; the returned function will always use obj as the receiver. It returns the zero Value if no method was found.
type TypedValue ¶
type TypedValue struct {
// contains filtered or unexported fields
}
Source Files ¶
- assignment.go
- binaryexpr.go
- builtin.go
- call.go
- cmd.go
- declaration.go
- env.go
- env_multithread.go
- eval.go
- expr.go
- file.go
- for.go
- function.go
- global.go
- identifier.go
- import.go
- inspect.go
- interface.go
- interpreter.go
- literal.go
- macroexpand.go
- method.go
- number.go
- output.go
- quasiquote.go
- select.go
- statement.go
- switch.go
- switch_type.go
- type.go
- unaryexpr.go
- x_package.go