Skip to main content

zerodds_idl_parse/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3//! Crate `zerodds-idl-parse`. Safety classification: **STANDARD**.
4//!
5//! Not **SAFE**, and that is the specification's own line:
6//! `docs/architecture/04_safety_by_architecture.md` §2 lists the safe
7//! subset and says the `zerodds-idl*` tools do not belong to the
8//! no_std safety profile. The parser runs at code-generation time; the
9//! SAFE marker it used to carry was applied across the board and made
10//! `dds_no_panic_in_safe` demand a contract this crate never signed.
11//!
12//! A hand-written recursive-descent parser for OMG IDL 4.2 that builds
13//! the lossless CST in `zerodds-idl-cst`.
14//!
15//! It never stops at the first error. A syntax error is diagnosed, the
16//! offending range becomes an error node, and parsing resynchronises at
17//! the next declaration boundary — so a file with three mistakes reports
18//! three rather than costing three runs.
19//!
20//! ## Spec
21//!
22//! - `docs/specs/zerodds-idl-frontend-1.0.md` §3 (parsing), §7
23//!   (diagnostics).
24//! - OMG IDL 4.2 §7.4 (grammar).
25//!
26//! ## Layer position
27//!
28//! Layer 1 of the frontend — over `zerodds-idl-cst`.
29#![no_std]
30#![forbid(unsafe_code)]
31
32extern crate alloc;
33
34#[cfg(test)]
35extern crate std;
36
37mod decl;
38pub mod diagnostic;
39pub mod dialect;
40pub mod parser;
41pub mod preprocess;
42mod suffix;
43mod type_spec;
44
45pub use diagnostic::{Diagnostic, DiagnosticCode, Severity, refused_by_a_clause};
46pub use dialect::{Dialect, VendorFlag};
47pub use parser::{Parse, Parser, parse, parse_preprocessed, parse_preprocessed_with, parse_with};
48pub use preprocess::{
49    FileLoader, MemoryLoader, Origin, Preprocessed, Provenance, ProvenanceMacro, SourceMap,
50    preprocess, preprocess_with,
51};