This commit is contained in:
Ariel Davis 2023-05-05 17:25:10 -07:00
parent 663e11c4b0
commit 59b4916294

View file

@ -9,15 +9,6 @@ use nohash_hasher::IntMap;
pub use text_size::{TextRange, TextSize};
/// Maps flat [`TextSize`] offsets into `(line, column)` representation.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct LineIndex {
/// Offset the beginning of each line, zero-based.
newlines: Box<[TextSize]>,
/// List of non-ASCII characters on each line.
line_wide_chars: IntMap<u32, Box<[WideChar]>>,
}
/// Line/Column information in native, utf8 format.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct LineCol {
@ -77,6 +68,15 @@ impl WideChar {
}
}
/// Maps flat [`TextSize`] offsets into `(line, column)` representation.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct LineIndex {
/// Offset the beginning of each line, zero-based.
newlines: Box<[TextSize]>,
/// List of non-ASCII characters on each line.
line_wide_chars: IntMap<u32, Box<[WideChar]>>,
}
impl LineIndex {
/// Returns a `LineIndex` for the `text`.
pub fn new(text: &str) -> LineIndex {