codewalk

package
v1.73.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

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

End balances each Form, including forms whose visitor skips the children.

Variables

View Source
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.

View Source
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.

View Source
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

type Binding = hook.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

type Node = hook.Node[lisp.LVal, lisp.WalkEvent]

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.

func (*Walker) Walk

func (w *Walker) Walk(form *lisp.LVal) *lisp.LVal

Walk visits form without modifying it. A false Visit skips a Form's children.

Directories

Path Synopsis
Package hook breaks the lisp/codewalk import cycle.
Package hook breaks the lisp/codewalk import cycle.

Jump to

Keyboard shortcuts

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