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
//! Document analysis and navigation for Lex
//!
//! This crate provides semantic analysis capabilities for Lex documents,
//! enabling features like reference resolution, symbol extraction, token
//! classification, and document navigation.
//!
//! # Architecture
//!
//! The crate is organized into several modules:
//!
//! - `utils`: Core document traversal and lookup utilities
//! - `references`: Reference resolution and target conversion
//! - `inline`: Inline span detection (bold, italic, code, references)
//! - `tokens`: Semantic token extraction and classification
//! - `symbols`: Document structure and symbol hierarchy
//! - `hover`: Preview text extraction for hover tooltips
//! - `folding`: Foldable range detection
//! - `navigation`: Go-to-definition and find-references
//!
//! # Design Principles
//!
//! - **Stateless**: All functions operate on immutable AST references
//! - **Reusable**: Not tied to LSP protocol - usable by CLI, editor plugins, etc.
//! - **Well-tested**: Comprehensive unit tests using official sample fixtures
//! - **AST-focused**: Works directly with lex-parser AST types
//!
//! # Usage
//!
//! ```rust,ignore
//! use lex_analysis::{tokens, symbols, navigation};
//! use lex_core::parse;
//!
//! let document = parse("1. Introduction\n\nHello world")?;
//!
//! // Extract tokens for syntax highlighting
//! let tokens = tokens::extract_semantic_tokens(&document);
//!
//! // Build document outline
//! let symbols = symbols::extract_document_symbols(&document);
//!
//! // Resolve references
//! let defs = navigation::find_definition(&document, position);
//! ```
// Core utilities
// Analysis features
// Test support (available in tests and as dev-dependency)