Expand description
Zero-dependency, lossless Rust lexer and CST foundation (ridx-syntax).
Guarantees for lex:
- Lossless round-trip: concatenating
&src[t.start as usize..t.end as usize]across all returned tokens reproducessrcbyte-for-byte on arbitrary UTF-8 input. - Panic-free and infallible: malformed or truncated overlay code (unclosed strings,
raw strings, block comments, char literals, invalid escapes, stray bytes) produces
tokens marked with
HAS_ERRORrather than failing. - Context-free atomic punctuation: multi-character operators are represented as
single-character punctuation tokens with
JOINT_NEXTset when adjacent with no intervening trivia.
Re-exports§
pub use parser::parse;pub use parser::parse_for_offset;pub use syntax_kind::SyntaxKind;pub use token::token_at;pub use token::Token;pub use token::TokenKind;pub use token::HAS_ERROR;pub use token::JOINT_NEXT;pub use tree::NodeId;pub use tree::SyntaxTree;
Modules§
- name_
res - Compiler-free local name resolution (
name_res) overcrate::SyntaxTreeandItemDb. - parser
- An error-tolerant recursive-descent parser over the significant tokens. It never fails: what it cannot parse
goes into
Errornodes, and every token ends up in the tree. - sema_fn
- Syntax-only function-body semantics over
SyntaxTree: parameter descriptors, scope-aware parameter use analysis (with shadowing and macroTokenTreeseparation), ownreturn/?extraction, and tail expression lookup. - syntax_
kind - The kinds of syntax tree nodes. Tokens are not nodes: a node covers a range of lexer tokens.
- token
- Token representation, kinds, flags, and binary-search offset lookup.
- tree
- A lossless syntax tree stored flat: nodes in preorder, each covering a range of lexer tokens. Trivia between significant tokens belongs to the innermost node covering both neighbours, and the root covers every token, so the source is recovered from the tokens alone.
- ty_
infer - Compiler-free local type inference engine (
ty_infer) — Phase 3 (Checkboxes 3.1 + 3.2 + 3.3):