Skip to main content

oak_core/tree/
mod.rs

1//! Red-green tree implementation for efficient kind tree representation.
2//!
3//! This module provides the core red-green tree data structures that enable
4//! efficient incremental parsing and kind tree manipulation.
5//!
6//! # Key Components
7//!
8//! - **Green Trees**: Immutable, position-agnostic kind tree nodes allocated in an Arena.
9//! - **Red Trees**: Position-aware kind tree nodes computed from green trees.
10//!
11//! # Architecture
12//!
13//! The red-green tree design enables:
14//! - **Incremental Parsing**: Only re-parse changed regions of source code
15//! - **Memory Efficiency**: Arena-based allocation with minimal overhead
16//! - **Performance**: Zero-copy node construction and fast traversal
17
18mod cursor;
19mod green_tree;
20mod metadata;
21pub mod red_tree;
22mod typed;
23
24pub use self::{
25    cursor::Cursor,
26    green_tree::{GreenLeaf, GreenNode, GreenTree},
27    metadata::{ProvenancePart, TokenProvenance},
28    red_tree::{RedChildren, RedLeaf, RedNode, RedTree},
29    typed::TypedNode,
30};
31
32pub use triomphe::Arc;