From 2ffea72f7481eafb564a0910c4b3a8ccae4a5c27 Mon Sep 17 00:00:00 2001 From: Josh Robson Chase Date: Wed, 23 Jan 2019 13:55:31 -0500 Subject: More correct raw ident handling --- crates/ra_syntax/src/lexer.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/lexer.rs b/crates/ra_syntax/src/lexer.rs index 0c3847120..f9362120e 100644 --- a/crates/ra_syntax/src/lexer.rs +++ b/crates/ra_syntax/src/lexer.rs @@ -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 } -- cgit v1.2.3