parser tests work

This commit is contained in:
Aleksey Kladov 2021-12-12 17:58:45 +03:00
parent 26bfd6023f
commit 6ce587ba5a
8 changed files with 92 additions and 140 deletions

View file

@ -334,6 +334,18 @@ impl SyntaxKind {
};
Some(kw)
}
pub fn from_contextual_keyword(ident: &str) -> Option<SyntaxKind> {
let kw = match ident {
"auto" => AUTO_KW,
"default" => DEFAULT_KW,
"existential" => EXISTENTIAL_KW,
"union" => UNION_KW,
"raw" => RAW_KW,
"macro_rules" => MACRO_RULES_KW,
_ => return None,
};
Some(kw)
}
pub fn from_char(c: char) -> Option<SyntaxKind> {
let tok = match c {
';' => SEMICOLON,