Implement RawAttr::filter

This commit is contained in:
Jonas Schievink 2020-12-18 18:58:42 +01:00
parent 03c177af89
commit 08de1b4fa5
5 changed files with 76 additions and 3 deletions

View file

@ -205,6 +205,13 @@ impl ast::Type {
}
}
impl ast::Attr {
/// Returns `text`, parsed as an attribute, but only if it has no errors.
pub fn parse(text: &str) -> Result<Self, ()> {
parsing::parse_text_fragment(text, parser::FragmentKind::Attr)
}
}
/// Matches a `SyntaxNode` against an `ast` type.
///
/// # Example: