mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
string is not a keyword
This commit is contained in:
parent
7011094685
commit
b8cac1bb6b
5 changed files with 13 additions and 5 deletions
|
@ -19,6 +19,10 @@ impl Edition {
|
||||||
pub fn at_least_2024(self) -> bool {
|
pub fn at_least_2024(self) -> bool {
|
||||||
self >= Edition::Edition2024
|
self >= Edition::Edition2024
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn at_least_2018(self) -> bool {
|
||||||
|
self >= Edition::Edition2018
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -178,6 +178,12 @@ impl<'a> Converter<'a> {
|
||||||
rustc_lexer::TokenKind::Whitespace => WHITESPACE,
|
rustc_lexer::TokenKind::Whitespace => WHITESPACE,
|
||||||
|
|
||||||
rustc_lexer::TokenKind::Ident if token_text == "_" => UNDERSCORE,
|
rustc_lexer::TokenKind::Ident if token_text == "_" => UNDERSCORE,
|
||||||
|
rustc_lexer::TokenKind::Ident
|
||||||
|
if ["async", "await", "dyn", "try"].contains(&token_text)
|
||||||
|
&& !self.edition.at_least_2018() =>
|
||||||
|
{
|
||||||
|
IDENT
|
||||||
|
}
|
||||||
rustc_lexer::TokenKind::Ident
|
rustc_lexer::TokenKind::Ident
|
||||||
if token_text == "gen" && !self.edition.at_least_2024() =>
|
if token_text == "gen" && !self.edition.at_least_2024() =>
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -193,7 +193,7 @@ Fn =
|
||||||
(body:BlockExpr | ';')
|
(body:BlockExpr | ';')
|
||||||
|
|
||||||
Abi =
|
Abi =
|
||||||
'extern' 'string'?
|
'extern' '@string'?
|
||||||
|
|
||||||
ParamList =
|
ParamList =
|
||||||
'('(
|
'('(
|
||||||
|
|
|
@ -484,6 +484,7 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String {
|
||||||
[lifetime_ident] => { $crate::SyntaxKind::LIFETIME_IDENT };
|
[lifetime_ident] => { $crate::SyntaxKind::LIFETIME_IDENT };
|
||||||
[int_number] => { $crate::SyntaxKind::INT_NUMBER };
|
[int_number] => { $crate::SyntaxKind::INT_NUMBER };
|
||||||
[ident] => { $crate::SyntaxKind::IDENT };
|
[ident] => { $crate::SyntaxKind::IDENT };
|
||||||
|
[string] => { $crate::SyntaxKind::STRING };
|
||||||
[shebang] => { $crate::SyntaxKind::SHEBANG };
|
[shebang] => { $crate::SyntaxKind::SHEBANG };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue