Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

Module sexpr

Module sexpr 

Source
Expand description

KiCad DSN-style S-expression parsing and deterministic building.

The lexer borrows token text from the source and feeds the parser lazily. An owned tree is allocated only when parse is requested; future typed readers can consume Lexer directly without constructing this tree.

Structs§

Error
Structured parse/build failure.
FormatOptions
Options for the generic token-preserving formatter.
Lexer
Streaming lexer for the KiCad DSN-style dialect.
Patch
One source-preserving replacement over UTF-8 byte offsets.
Position
One-based source line/column plus a zero-based byte offset.
Token
A token borrowing its exact text from the input.

Enums§

ErrorKind
Stable error classification for programmatic diagnostics.
ErrorPhase
The phase that produced an S-expression error.
Sexp
Owned compatibility tree produced on demand.
TokenKind
Borrowed lexical token category.

Functions§

apply_patches
Apply sorted, non-overlapping source patches.
apply_patches_with_limit
Apply sorted, non-overlapping patches while bounding result bytes.
build
Deterministically build a KiCad S-expression from an owned tree.
build_with_limit
Deterministically build while refusing to allocate beyond an output limit.
format
Reformat source tokens without materializing an owned expression tree.
lex
Collect borrowed tokens for diagnostics and compatibility tests.
parse
Parse one UTF-8 KiCad S-expression.
parse_bytes
Parse bytes after validating UTF-8.
utf8_text
Validate bytes and borrow them as UTF-8 without constructing a syntax tree.