Documentation ¶
Overview ¶
Package eval handles evaluation of nodes and consists the runtime of the shell.
Index ¶
Constants ¶
const ( // FdNil is a special impossible fd value. Used for "close fd" in // syscall.ProcAttr.Files. FdNil uintptr = ^uintptr(0) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Closure ¶
type Closure struct { ArgNames []string Op Op Enclosed map[string]*Value Bounds [2]StreamType }
Closure is a closure.
func NewClosure ¶
type ClosureType ¶
type ClosureType struct {
Bounds [2]StreamType
}
func (ClosureType) Caret ¶
func (ct ClosureType) Caret(t Type) Type
func (ClosureType) Default ¶
func (st ClosureType) Default() Value
type Command ¶
type Command struct { Func builtinFuncImpl // A builtin function Special strOp // A builtin special form Path string // External command full path Closure *Closure // The closure value }
A Command is either a builtin function, a builtin special form, an external command or a closure.
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler compiles an Elvish AST into an Op.
func NewCompiler ¶
func NewCompiler() *Compiler
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env provides access to environment variables.
type Evaluator ¶
type Evaluator struct { Compiler *Compiler // contains filtered or unexported fields }
Evaluator maintains runtime context of elvish code within a single goroutine. When elvish code spawns goroutines, the Evaluator is copied and has certain components replaced.
func NewEvaluator ¶
func NewEvaluator() *Evaluator
NewEvaluator creates a new Evaluator from a slice of environment strings in the form "key=value".
func (*Evaluator) Eval ¶
Eval evaluates a chunk node n. The name and text of it is used for diagnostic messages.
func (*Evaluator) MakeCompilerScope ¶
type StateUpdate ¶
StateUpdate represents a change of state of a command.
type StreamType ¶
type StreamType byte
StreamType represents what form of data stream a command expects on each port.
type StringType ¶
type StringType struct { }
func (StringType) Caret ¶
func (st StringType) Caret(t Type) Type
func (StringType) Default ¶
func (st StringType) Default() Value
Notes ¶
Bugs ¶
the fn builtin now modifies the closure in place, making it possible to write:
var f; set f = { }
fn g a b $f // Changes arity of $f!
When evaluating closures, async access to globals, in and out can be problematic.
Closure arguments is (again) not supported