Expand description
The rowan-free CST facade.
ronin-core builds its concrete syntax tree on rowan, but the public API
MUST NOT expose any rowan type (TR-009 / INV-7) so the underlying library
stays swappable. This module wraps rowan’s SyntaxNode/SyntaxToken/
SyntaxElement behind ronin-core newtypes whose accessors return only
ronin-core types (SyntaxKind, TextRange, and these newtypes).
§AD-001 — Trivia attachment rule (module invariant, T011)
Exactly one trivia-attachment rule is applied consistently across the whole parser (risk mitigation: “inconsistent trivia model”):
- Leading trivia binds to the following significant token. All whitespace / comments / BOM that precede a significant token are emitted into the green tree immediately before that token, inside the same node the token belongs to.
- Trailing trivia at end-of-input binds to the last token — i.e. trivia
after the final significant token (including a missing trailing newline,
trailing whitespace, or trailing comments) is attached to the nearest
preceding structure (the
SyntaxKind::Rootnode), since there is no following token to bind it to. - A leading UTF-8 BOM is the first leading-trivia token of the document
(AD-008). CRLF vs LF is preserved verbatim inside
SyntaxKind::Whitespacetokens.
This rule is load-bearing for the round-trip invariant (INV-2): because every trivia byte is emitted into exactly one token in source order, concatenating all token texts reproduces the source exactly, regardless of where trivia sits relative to structure.
Re-exports§
pub use kind::SyntaxKind;
Modules§
- ast
- Typed accessors over the CST (TR-010, OBJ4).
- kind
SyntaxKind— the closed classification of every CST node and token.
Structs§
- Syntax
Node - An opaque, navigable interior node of the CST.
- Syntax
Token - An opaque leaf token of the CST, carrying verbatim source text (incl. trivia).
- Text
Range - A half-open byte range
[start, end)into the original source.
Enums§
- Syntax
Element - Either a
SyntaxNodeor aSyntaxToken— a child element in source order.