Re-implement rust string highlighting via tool attribute

This commit is contained in:
Lukas Wirth 2025-01-10 13:49:35 +01:00
parent 897f7e579e
commit bf669dab84
72 changed files with 386 additions and 173 deletions

View file

@ -185,6 +185,14 @@ impl ast::Attr {
Some((self.simple_name()?, tt))
}
pub fn as_simple_path(&self) -> Option<ast::Path> {
let meta = self.meta()?;
if meta.eq_token().is_some() || meta.token_tree().is_some() {
return None;
}
self.path()
}
pub fn simple_name(&self) -> Option<SmolStr> {
let path = self.meta()?.path()?;
match (path.segment(), path.qualifier()) {