Skip to main content

sdivi_parsing/
lib.rs

1//! File discovery and AST parsing stage for sdivi-rust.
2//!
3//! Provides the [`adapter::LanguageAdapter`] extension point, the
4//! [`feature_record::FeatureRecord`] output type, and the
5//! [`parse::parse_repository`] entry point.
6//!
7//! When compiled with the `test-tree-counter` Cargo feature, `ACTIVE_TREES`
8//! is exposed so language adapters can track live CST objects in tests.
9
10pub mod adapter;
11pub mod feature_record;
12pub mod parse;
13pub mod text;
14pub mod walker;
15
16#[cfg(feature = "test-tree-counter")]
17/// Global counter of live tree-sitter `Tree` objects (test feature only).
18///
19/// Incremented at the start of `parse_file` and decremented after the
20/// `PARSER.with` closure returns; tracks active `parse_file` invocations,
21/// not live `Tree` objects. Tests assert the value returns to zero after
22/// each `parse_file` call.
23pub static ACTIVE_TREES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);