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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # cabalist-parser
//!
//! A Rust library that parses `.cabal` files into a concrete syntax tree (CST),
//! preserving every byte of the original source: whitespace, comments, blank
//! lines, indentation style. The CST can be rendered back to text with
//! byte-identical round-tripping when no edits have been made.
//!
//! The parser maintains two representations:
//!
//! - **CST (Concrete Syntax Tree):** A flat-arena tree that captures every byte
//! of the source. This is what gets mutated during edits and rendered back to
//! text.
//!
//! - **AST (Abstract Syntax Tree):** A typed, ergonomic view derived from the
//! CST for querying and validation. *(Implemented in a separate module.)*
//!
//! ## Quick start
//!
//! ```
//! use cabalist_parser::parse;
//!
//! let source = "cabal-version: 3.0\nname: my-package\nversion: 0.1.0.0\n";
//! let result = parse(source);
//!
//! // No diagnostics for a valid file.
//! assert!(result.diagnostics.is_empty());
//!
//! // Round-trip: render produces the original source.
//! assert_eq!(result.cst.render(), source);
//! ```
/// Typed abstract syntax tree derived from the CST.
/// Concrete syntax tree with byte-identical round-trip fidelity.
/// Parser diagnostics (errors and warnings).
/// CST mutation operations (add, remove, update fields).
/// Lexer that tokenizes `.cabal` source into CST nodes.
/// Parser that builds a CST from source text.
/// Byte spans and node identifiers.
/// Structural validation of parsed `.cabal` files.
// Re-export the main entry point and key types at the crate root.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ParseResult;
pub use ;
pub use validate;
/// Parse a `.cabal` source string into a [`ParseResult`] containing the CST
/// and any diagnostics.
///
/// The returned CST preserves every byte of the input. Calling
/// [`CabalCst::render()`] on an unmodified CST produces byte-identical output.