Documentation
¶
Overview ¶
Package sexp is the bounded reader for a restricted-Lisp file: docs/roadmap.sexp and docs/fixes.sexp (through pkg/roadmap), and nova-work's tree file in nova-sprint (its SPEC-WORKLANG.md). It is the one copy of the reader: nova-sprint's worklang package was the same code under another name, and imports this package instead.
A file is data the reader returns, never a program it evaluates. The grammar is a sequence of s-expressions made only of lists, keywords, strings, integers and bare symbols, with every evaluation form refused at the boundary and three bounds enforced as the reader runs -- bytes, nesting depth and node count. Nothing read here is ever evaluated: there is no eval, and a dispatch macro is a refusal with the byte offset that owes it, not a form the reader will run.
Every refusal is a *Refusal carrying exit code 2, so the command that opens a file can print one line and stop, never a partial parse.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Form ¶
type Form struct {
Kind Kind
Offset int
End int
List []Form
Value string // keyword name (no colon) or decoded string
Int int64
}
Form is one restricted s-expression. Offset is the form's first byte and End the byte just past its last, so a refusal can name where in the file it happened.
type Kind ¶
type Kind int
Kind is the type of one restricted form.
const ( // List is a parenthesized form, possibly empty. List Kind = iota // Keyword is a `:name` token, stored without the leading colon. Keyword // String is a double-quoted string, stored decoded. String // Integer is a decimal integer. Integer // Symbol is a bare token such as go-fix or false, stored verbatim. The // plan language uses symbols for values that are not text (kind names, // booleans), and they are data: nothing here is ever evaluated. Symbol )
type Limits ¶
Limits is the three bounds every read is held to. A zero value is not usable; set all three. The names are the flag names a caller may expose: --max-bytes, --max-depth, --max-nodes.