Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewScope ¶
NewScope creates a Scope derived from parent (or root if parent == nil) with the given names. New Idents corresponding to the names are returned, as well. Invariant: for i, name in names: scope.Lookup(name) == ids[i] && parent.Lookup(name) != ids[i]
func ValidIdent ¶
func ValidIdentPrefix ¶
ValidIdentPrefix returns length (in bytes) of the longest prefix of s that is a valid identifier.
Types ¶
type Bindings ¶
type Bindings struct {
// contains filtered or unexported fields
}
Bindings is a set of runtime bindings of Idents. Bindings are always read-only.
func NewBindings ¶
NewBindings creates a Bindings derived from parent (or root if parent == nil) with the given value binds. The caller must not mutate the binds map after calling NewBindings.
func (*Bindings) Scoped ¶
func (binds *Bindings) Scoped(scp *Scope) ScopedBindings
type Ident ¶
type Ident struct {
// contains filtered or unexported fields
}
Ident is a unique identifier in a particular Scope, to be bound to a (real-only) value at runtime in a Bindings of that Scope.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope is lexical scope, a collection of in-scope Idents at some location in a program source. It may have a parent, inheriting Idents. A Scope is "instantiated" at runtime with Bind by binding values to its Idents.
Scope is always read-only.
type ScopedBindings ¶
ScopedBindings combines a Scope and Bindings to give the visible symbols and their bound values at a particular point in a program.