Skip to main content

zerodds_idl_cst/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3//! Crate `zerodds-idl-cst`. Safety classification: **SAFE**.
4//!
5//! The lossless concrete syntax tree for OMG IDL 4.2: tokens that carry
6//! their trivia, and a green/red tree that reproduces its input byte for
7//! byte — including for files that fail to parse, because error recovery
8//! inserts nodes rather than dropping input.
9//!
10//! This crate holds the tree. The parser that builds it is
11//! `zerodds-idl-parse`; the lowering that consumes it is
12//! `zerodds-idl-lower`.
13//!
14//! ## Spec
15//!
16//! - `docs/specs/zerodds-idl-frontend-1.0.md` §1 (lexing), §2 (the tree).
17//! - OMG IDL 4.2 §7.2 (lexical conventions), §7.4 (grammar).
18//!
19//! ## Layer position
20//!
21//! Layer 0 of the frontend — no dependencies.
22#![no_std]
23#![forbid(unsafe_code)]
24
25extern crate alloc;
26
27// The unit-test harness itself needs std; the crate does not.
28#[cfg(test)]
29extern crate std;
30
31pub mod lex;
32pub mod span;
33pub mod token;
34pub mod tree;
35
36pub use lex::{Lexer, lex, literal_value};
37pub use span::{LineColumn, Span};
38pub use token::{
39    KEYWORDS, Radix, Token, TokenKind, TokenValue, Trivia, TriviaKind, identifier_name,
40    keyword_collision,
41};
42pub use tree::{
43    Checkpoint, CstKind, GreenChild, GreenNode, GreenToken, SyntaxNode, SyntaxSpans, TreeBuilder,
44};