mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
More correct raw ident handling
This commit is contained in:
parent
302508d5bb
commit
2ffea72f74
3 changed files with 58 additions and 5 deletions
|
@ -190,16 +190,19 @@ fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind {
|
|||
}
|
||||
|
||||
fn scan_ident(c: char, ptr: &mut Ptr) -> SyntaxKind {
|
||||
match (c, ptr.current()) {
|
||||
let is_raw = match (c, ptr.current()) {
|
||||
('r', Some('#')) => {
|
||||
ptr.bump();
|
||||
true
|
||||
}
|
||||
('_', Some(c)) if !is_ident_continue(c) => return UNDERSCORE,
|
||||
_ => {}
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
ptr.bump_while(is_ident_continue);
|
||||
if let Some(kind) = SyntaxKind::from_keyword(ptr.current_token_text()) {
|
||||
return kind;
|
||||
if !is_raw {
|
||||
if let Some(kind) = SyntaxKind::from_keyword(ptr.current_token_text()) {
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
IDENT
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue