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
//! UTF-8/UTF-16 position tracking, conversion, and span types.
//!
//! This crate provides foundational types for source location tracking in the
//! Perl LSP ecosystem:
//!
//! - [`ByteSpan`]: Byte-offset based spans for parser/AST use
//! - [`LineStartsCache`]: Efficient line index for offset-to-position conversion
//! - [`WirePosition`]/[`WireRange`]: LSP protocol-compatible position types
//!
//! # Example
//!
//! ```
//! use perl_position_tracking::{ByteSpan, LineStartsCache};
//!
//! let source = "line 1\nline 2\nline 3";
//! let cache = LineStartsCache::new(source);
//!
//! // Create a span covering "line 2"
//! let span = ByteSpan::new(7, 13);
//! assert_eq!(span.slice(source), "line 2");
//!
//! // Convert to line/column for LSP
//! let (line, col) = cache.offset_to_position(source, span.start);
//! assert_eq!(line, 1); // 0-indexed
//! assert_eq!(col, 0);
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;