1use crate::SyntaxKind;
4use rustc_lexer;
5
6#[inline]
7pub fn is_identifier(name: &str, edition: parser::Edition) -> bool {
11 if rustc_lexer::is_ident(name) {
12 if let Some(syntax_kind) = SyntaxKind::from_keyword(name, edition)
13 && syntax_kind.is_strict_keyword(edition)
14 {
15 false
16 } else {
17 true
18 }
19 } else {
20 false
21 }
22}
23
24#[inline]
25pub fn is_raw_identifier(name: &str, edition: parser::Edition) -> bool {
26 let is_keyword = SyntaxKind::from_keyword(name, edition).is_some();
27 is_keyword && !matches!(name, "self" | "crate" | "super" | "Self")
28}