1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Parser and pretty-printer for RPM `.spec` files.
//!
//! This crate exposes a distribution-independent AST suitable for tooling
//! such as formatters, linters, and static analyzers. Macros are preserved
//! as AST nodes (never expanded), so consumers can inspect or rewrite the
//! source without losing structural information.
//!
//! # Status
//!
//! Pre-alpha. The AST is in place; the parser and printer are stubs.
//!
//! # Crate layout
//!
//! - [`ast`] — abstract syntax tree.
//! - [`parse_result`] — [`parse_result::ParseResult`] /
//! [`parse_result::Diagnostic`] returned by the parser.
//! - [`parser`] — `&str → ParseResult` (feature `parser`, in progress).
//! - [`printer`] — `AST → String` (feature `printer`, in progress).
//! - [`error`] — fatal error types.
//!
//! # Generic `T` parameter
//!
//! Every "large" AST node carries a `data: T` field; the root is
//! [`ast::SpecFile<T>`]. `T` defaults to `()`. The parser populates it with
//! [`ast::Span`] when a span-aware entry point is used. Validators may
//! choose a richer type to thread their own per-node data (resolved macro
//! values, diagnostics ids, …).
//!
//! # Macro names are verbatim
//!
//! [`ast::MacroRef::name`], [`ast::MacroDef::name`],
//! [`ast::BuildCondition::name`], and the `Other` variants of [`ast::Tag`],
//! [`ast::TagQualifier`], and [`ast::BuiltinMacro`] preserve the exact text
//! written in the source — case is **not** normalized. This invariant exists
//! so that downstream validators can match names against
//! distribution-specific registries.