wiki/lisp.lisp
Nodes
A piece of Lisp source with its character range.
A #( ) vector literal.
The package prefix as written, or NIL for the current package; "KEYWORD" for keywords; :uninterned for #:.
A symbol token; nothing is interned.
A quote-like prefix applied to one form.
The guarded form node, or NIL when it was skipped; then TEXT of the whole node still shows it.
A #+ or #- guarded form.
A ; or #| |# comment, TEXT included.
Input the reader skipped for another reason.
The 1-based line on which node starts, given the vector line-starts.
The Eclector client
An Eclector client that builds lisp-node trees.
Quote-like reader macros return marker lists so that
make-expression-result can recognize them; the material is a node.
#. is never evaluated; it becomes a prefix node.
Feature expressions are tokens, not symbols; evaluate them against this
image's *FEATURES* by name so the reader can proceed. Both outcomes are
kept visible: a true branch becomes a lisp-conditional with its form and a
false branch a lisp-conditional whose text still shows it.
Return "#+" or "#-" when the source range begins with one.
#+feature form / #-feature form: two children, the feature and the form.
Reading files
Read text into a list of top-level LISP-NODEs, comments included, in
order. Reader errors are recovered from where Eclector offers a restart and
otherwise end the read; name labels warnings.
READ returns the parse result and the orphan results (comments and other skipped input before it), or EOF and the orphans.
Join runs of line comments separated only by a newline into one
lisp-comment, recursively inside lists, so a comment block is one node.
True when node B starts on the line after the last line of node A, with only indentation between: consecutive comment lines. A's range may or may not include its trailing newline, so count from the end of its text.
Definitions
For a method, the specializer texts of its required parameters, e.g. ("block-world" "t").
One top-level defining form of a source file.
Figure IDs mentioned as #ID in text, in order, without duplicates.
Operators whose top-level forms become definitions. Any other operator whose name starts with DEF or DEFINE- is accepted too.
Return the actual definition name from a ZDEF name-and-options node.
Make a definition for the top-level list node if it defines something.
The DEFINITIONs among the top-level nodes of a file, in order. Comments
that precede a form belong to it, and IN-PACKAGE forms set the package.
The DEFINITIONs of the source file at pathname, in order.
A hash table from figure ID to the DEFINITIONs mentioning it.
The first definition whose name matches name, case-insensitively, with or
without a package prefix on either side.
A piece of Lisp source with its character range.
One top-level defining form of a source file.
A parenthesized list; CHILDREN are nodes in order.
A #( ) vector literal.
A symbol token; nothing is interned.
Any other atom, kept as its source text: numbers, strings, characters, pathnames, and reader-macro results we do not model.
A quote-like prefix applied to one form.
A #+ or #- guarded form.
A ; or #| |# comment, TEXT included.
Input the reader skipped for another reason.
((call tool-call) stream)Anything in a stylesheet: a declaration, rule, at-rule, or style group.
Test whether one compatible scalar is greater than another.
(node line-starts)(text)(position line-starts)Test whether one compatible scalar is less than another.
Addition over compatible quantities.
Test whether one compatible scalar is at most another.
An Eclector client that builds LISP-NODE trees.
((client source-reader) input-stream
package-indicator symbol-name internp)Logical conjunction of tests and raw truth values.
Logical negation of one test or raw truth value.
((client source-reader) result children source)((client source-reader) material)((client source-reader) name)((client source-reader) form)((client source-reader) form)((client source-reader) form)((client source-reader) expression)((client source-reader) expression)Feature expressions are tokens, not symbols; evaluate them against this image's *FEATURES* by name so the reader can proceed. Both outcomes are kept visible: a true branch becomes a LISP-CONDITIONAL with its form and a false branch a LISP-CONDITIONAL whose text still shows it.
((client source-reader) expression)((client source-reader) name initargs)(client source)(client source)Test whether two compatible scalars are equal.
Logical disjunction of tests and raw truth values.
((client source-reader) stream reason children source)(text &key (name "string"))Read TEXT into a list of top-level LISP-NODEs, comments included, in order. Reader errors are recovered from where Eclector offers a restart and otherwise end the read; NAME labels warnings.
(nodes text)Join runs of line comments separated only by a newline into one LISP-COMMENT, recursively inside lists, so a comment block is one node.
(a b text)True when node B starts on the line after the last line of node A, with only indentation between: consecutive comment lines. A's range may or may not include its trailing newline, so count from the end of its text.
(pathname)(&rest ids)(definition)(node)(text)(&optional (count "12"))Print COUNT fresh figure IDs that no page uses (default 12); never six hex digits, which the reader takes for a colour.
(string start)If a #ID mention (six capitals or digits, not all of them hex digits) begins at START, return the index after it.
Operators whose top-level forms become definitions. Any other operator whose name starts with DEF or DEFINE- is accepted too.
(prefix string &key (start 0))(node comments pathname line-starts package)The maximum of compatible quantities.
(nodes pathname line-starts)The DEFINITIONs among the top-level NODES of a file, in order. Comments that precede a form belong to it, and IN-PACKAGE forms set the package.
(pathname &optional (text (uiop:read-file-string pathname)))(definitions)A simple Org table without formulas.
(name definitions &key kind)The first definition whose name matches NAME, case-insensitively, with or without a package prefix on either side.
Reading Lisp source without loading it.
The site is built by luv-wiki, which does not load luv. To show definitions in place we read source files with Eclector into a tree of
lisp-nodeobjects: symbols become tokens (package prefix and name as written), every node keeps its source range, comments and skipped input are kept as nodes, and nothing is interned or evaluated. Over the top-level forms of the files ASDF lists for luv we build adefinitionindex: kind, name, file, line range, and the #ID figure mentions inside.