Documentation
¶
Overview ¶
Package codewalk adapts the interpreter's syntax walker for source analysis. The resolver's historical interpretation of malformed forms, qualification, template references and custom definitions is internal tooling policy.
Index ¶
Constants ¶
const End lisp.WalkEvent = lisp.WalkLeave + 1
End balances each Form, including forms whose visitor skips the children.
Variables ¶
var Forms func(*lisp.CodeWalker, *lisp.LVal) *lisp.LVal
Forms walks runtime syntax with only Form events. Lexical tracking, expansion, and the visitor's ability to skip children are unchanged. Callers that only check calls need not construct events for every leaf.
var Occurrences func(w *lisp.CodeWalker, budget int, form *lisp.LVal) (complete bool)
Occurrences walks form like the runtime walker but visits every occurrence of shared structure, in its own lexical context, instead of walking a node once per scope. budget bounds the lists walked; the result is false when the walk stopped because it ran out.
var PackageForms func([]*lisp.LVal) []*lisp.LVal
PackageForms selects top-level forms and nested package declarations for prescan. It omits quoted data and quasiquote, including template holes.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
Binding describes a custom definition-like form. Children before FormalsIndex are outer-scope code except NameIndex; later children are its body. BindingForm must validate the indices and formals.
type Node ¶
Node is a source event. Owner contains a definition's form; Formals holds its signature; Init is a let initializer. Outer selects the enclosing scope for a parallel initializer or flet closure. Template marks template symbols. The walker reuses this node: copy it to retain an event.
type Walker ¶
type Walker struct {
Visit func(*Node) bool
BindingForm func(*lisp.LVal) *Binding
// Reference, when set, receives references and set! targets instead of
// Visit. Resolution does not need an event's other fields for these
// frequent leaves, so this avoids constructing and copying an event.
Reference func(*lisp.LVal)
// Form, when set, receives forms, operator names and depths instead of
// Form events. Its result has the same meaning as Visit's result.
Form func(*lisp.LVal, string, int) bool
// End, when set, receives completed form depths instead of End events.
End func(int)
// EndDepth optionally selects the depth that needs an End callback.
// The caller updates it as selected forms nest; -1 selects no form.
EndDepth *int
// SkipLiterals omits self-evaluating leaves from Visit.
SkipLiterals bool
// DeclarationsOnly omits definition signatures, bodies and End events.
// Prescan uses it for defun, defmacro and deftype declaration metadata.
DeclarationsOnly bool
// contains filtered or unexported fields
}
Walker preserves source occurrences and has no nesting cap or implicit macro expansion. The resolver controls expansion through Visit.