#![allow(dead_code)]
mod char_ext;
mod char_string;
mod document;
mod lexing;
mod linting;
pub mod parsers;
mod punctuation;
mod span;
mod spell;
mod token;
pub use char_string::{CharString, CharStringExt};
pub use document::Document;
pub use linting::{Lint, LintGroup, LintGroupConfig, LintKind, Linter, Suggestion};
pub use punctuation::{Punctuation, Quote};
pub use span::Span;
pub use spell::{Dictionary, FullDictionary, MergedDictionary};
pub use token::{FatToken, Token, TokenKind, TokenStringExt};
pub fn remove_overlaps(lints: &mut Vec<Lint>) {
if lints.len() < 2 {
return;
}
lints.sort_by_key(|l| l.span.start);
let mut remove_indices = Vec::new();
for i in 0..lints.len() - 1 {
let cur = &lints[i];
let next = &lints[i + 1];
if cur.span.overlaps_with(next.span) {
if next.priority < cur.priority {
remove_indices.push(i);
} else {
remove_indices.push(i + 1);
}
}
}
let mut index = 0;
lints.retain(|_| {
index += 1;
!remove_indices.contains(&(index - 1))
})
}