mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Add classify_literal and undo expose next_token
This commit is contained in:
parent
1ab78d6056
commit
1ea0238e53
5 changed files with 15 additions and 8 deletions
|
@ -214,3 +214,12 @@ fn scan_literal_suffix(ptr: &mut Ptr) {
|
|||
}
|
||||
ptr.bump_while(is_ident_continue);
|
||||
}
|
||||
|
||||
pub fn classify_literal(text: &str) -> Option<Token> {
|
||||
let tkn = next_token(text);
|
||||
if tkn.kind.is_literal() || tkn.len.to_usize() != text.len() {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(tkn)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue