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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! Syntax highlighting driver for reovim.
//!
//! **IMPORTANT:** This crate defines ONLY the trait interface for syntax
//! highlighting. It does NOT depend on tree-sitter or any parsing library.
//! Those are implementation details of language modules (`server/modules/treesitter-*/`).
//!
//! # Design Philosophy
//!
//! This crate follows the Linux kernel "mechanism vs policy" principle:
//!
//! - **Driver provides MECHANISM**: The [`HighlightCategory`] type and [`Annotation`] struct
//! define HOW highlights are represented (open, string-based categories).
//! - **Modules provide POLICY**: Language modules decide WHAT categories to emit.
//!
//! # Architecture
//!
//! ```text
//! server/lib/drivers/syntax/ <-- HighlightCategory, Annotation, SyntaxDriver
//! ^
//! | implements
//! |
//! server/lib/drivers/syntax-treesitter/ <-- Tree-sitter based implementations
//! ```
//!
//! # Components
//!
//! - [`SyntaxDriver`] - Main parsing and highlighting interface
//! - [`SyntaxDriverFactory`] - Creates drivers for languages
//! - [`LanguageRegistry`] - Language detection and metadata
//! - [`SyntaxCache`] - Highlight result caching
//! - [`HighlightCategory`] - Open string-based highlight categories
//! - [`Annotation`] - A highlighted byte range with category and kind
//! - [`SyntaxEdit`] - Edit description for incremental parsing
//! - [`FoldRange`], [`FoldKind`] - Foldable code regions
//! - [`Injection`] - Embedded language regions
//! - [`LanguageInfo`], [`CommentTokens`] - Language metadata
//!
//! # Example
//!
//! ```ignore
//! use reovim_driver_syntax::*;
//!
//! // Factory creates drivers for supported languages
//! let factory: Box<dyn SyntaxDriverFactory> = get_factory();
//!
//! // Create driver for Rust
//! let mut driver = factory.create("rust").unwrap();
//!
//! // Parse content
//! driver.parse("fn main() { println!(\"Hello\"); }");
//!
//! // Get highlights for rendering
//! let highlights = driver.highlights(0..100);
//! for ann in highlights {
//! println!("{:?}: {}", ann.byte_range(), ann.category.as_str());
//! }
//! ```
//!
//! # NO tree-sitter dependency!
//!
//! This crate must NOT depend on tree-sitter or any parsing library.
//! Tree-sitter is an implementation detail of language modules.
// ============================================================================
// Modules
// ============================================================================
// ============================================================================
// Re-exports
// ============================================================================
// Core traits
pub use ;
// Types
pub use ;
// Error types
pub use ModuleError;
// Per-session syntax driver storage
pub use SyntaxSessionState;