use rowan::{ast::AstNode, TextRange}; use rustc_hash::FxHashSet; use syntax::latex::{self, HasBrack, HasCurly}; use titlecase::titlecase; use parser::SyntaxConfig; use super::Span; use crate::semantics::tex::latex::SyntaxToken; fn maybe_prepend_prefix( map: &Vec<(String, String)>, command: &Option, name: &Span, ) -> Span { match command { Some(x) => Span::new( map.iter() .find_map(|(k, v)| if k == &x.text()[1..] { Some(v) } else { None }) .unwrap_or(&String::new()) .to_owned() + &name.text, name.range, ), None => name.clone(), } } #[derive(Debug, Clone, Default)] pub struct Semantics { pub links: Vec, pub labels: Vec