Skip to main content

Crate caixa_ast

Crate caixa_ast 

Source
Expand description

caixa-ast — span-aware Lisp AST, shared by caixa-fmt, caixa-lint, and caixa-lsp.

Why a sibling of tatara-lisp::Sexp? Because tatara-lisp’s reader throws away byte positions (it’s a compiler — once the Sexp is typed, positions are slack). Tools care about positions: the formatter must re-emit at the original column; the linter must highlight the exact region; the LSP must compute ranges. This crate adds span + trivia (comments, blank lines) to every node while keeping a free conversion to the plain tatara_lisp::Sexp for the downstream compile pipeline.

The surface grammar matches tatara-lisp exactly (list, symbol, keyword, string, int, float, bool, nil, quote/quasiquote/unquote/ splice) — parse the same source, get equivalent trees.

Re-exports§

pub use lexer::Token;
pub use lexer::TokenKind;
pub use lexer::tokenize;
pub use node::Node;
pub use node::NodeKind;
pub use parser::ParseError;
pub use parser::parse;
pub use span::Position;
pub use span::Span;
pub use span::line_column;
pub use trivia::Trivia;
pub use trivia::TriviaKind;
pub use visit::Visitor;
pub use visit::walk;

Modules§

lexer
Lisp lexer — scans source into tokens with byte spans.
node
parser
Top-down parser — consumes the lexer’s token stream, emits Nodes with leading trivia attached.
span
Byte-offset spans — minimal and cheap. Line/column are computed on demand.
trivia
Trivia — whitespace, blank lines, and comments attached to nodes.
visit
Visitor — depth-first walk over a crate::Node tree.