mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
parser tests work
This commit is contained in:
parent
26bfd6023f
commit
6ce587ba5a
8 changed files with 92 additions and 140 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue