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
//! Zero-copy, arena-allocated AST.
//!
//! This module is the AST that the `aozora-lex` pipeline produces and
//! that downstream consumers (`aozora-render`, `aozora`, the FFI /
//! WASM / Python drivers) walk.
//!
//! # Lifetime model
//!
//! Every type carries a single lifetime parameter `'src`, the
//! lifetime of the source text being parsed *and* of the arena
//! allocator that owns the tree's storage. By convention the
//! enclosing `Document<'src>` owns both, so `'src` is the borrow of
//! that document.
//!
//! All AST types are `Copy` because they only contain `Copy` data:
//! `&'src` references, primitives, and `Copy` enums. This means a
//! parsed [`AozoraNode`] can be passed by value without ceremony and
//! the visitor pattern in `aozora-render` does not need
//! `&mut` self for traversal.
//!
//! # Memory ownership
//!
//! Construction allocates into an [`Arena`] (a thin wrapper over
//! `bumpalo::Bump`). Every `&'src str` inside the tree points either
//! to the arena (rewritten / synthesised text) or to the source
//! string (zero-copy borrow of original bytes). When the arena drops,
//! the entire tree drops as a single deallocation; per-node `Drop`
//! never runs.
//!
//! # Why "borrowed"?
//!
//! Every type here borrows its payload from the source / arena
//! rather than owning a heap copy. The "observable equivalence"
//! purity contract permits arena mutation behind the scenes while
//! keeping the public surface deterministic.
pub use Arena;
pub use ;
pub use ;
pub use ;
pub use ;