diff options
Diffstat (limited to 'crates/ra_syntax/src/parsing/lexer.rs')
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index 36e841609..3ae42912c 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -214,3 +214,12 @@ fn scan_literal_suffix(ptr: &mut Ptr) { | |||
214 | } | 214 | } |
215 | ptr.bump_while(is_ident_continue); | 215 | ptr.bump_while(is_ident_continue); |
216 | } | 216 | } |
217 | |||
218 | pub fn classify_literal(text: &str) -> Option<Token> { | ||
219 | let tkn = next_token(text); | ||
220 | if !tkn.kind.is_literal() || tkn.len.to_usize() != text.len() { | ||
221 | return None; | ||
222 | } | ||
223 | |||
224 | Some(tkn) | ||
225 | } | ||