Documentation
¶
Overview ¶
Package astutil provides shared AST walking utilities for ELPS lisp values.
These helpers are used by both the lint and analysis packages for traversing parsed ELPS expressions.
Index ¶
- func ArgCount(sexpr *lisp.LVal) int
- func CollectFormals(formals *lisp.LVal, defs map[string]bool)
- func HeadSymbol(sexpr *lisp.LVal) string
- func PackageNameArg(arg *lisp.LVal) string
- func SourceOf(v *lisp.LVal) *lisp.LVal
- func UserDefined(exprs []*lisp.LVal) map[string]bool
- func Walk(exprs []*lisp.LVal, fn func(node *lisp.LVal, parent *lisp.LVal, depth int))
- func WalkSExprs(exprs []*lisp.LVal, fn func(sexpr *lisp.LVal, depth int))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectFormals ¶
CollectFormals extracts symbol names from a formals list, skipping &rest, &optional, and &key markers.
func HeadSymbol ¶
HeadSymbol returns the symbol name at the head of an s-expression, or "".
func PackageNameArg ¶ added in v1.39.0
PackageNameArg extracts a package name from a use-package or in-package argument. Handles quoted symbols ('testing), bare symbols (testing), and strings ("testing").
func SourceOf ¶
SourceOf returns the best source location for a node. Prefers the node's own source, falls back to first child's source.
func UserDefined ¶
UserDefined returns the set of names defined or bound in the source that shadow builtins. This includes:
- Function/macro names from defun/defmacro
- Parameter names from defun/defmacro/lambda formals lists
The result is file-global (not scope-aware), which is conservative: it may suppress a valid finding but will never produce a false positive.
Types ¶
This section is empty.