aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lexer/mod.rs7
-rw-r--r--src/lexer/strings.rs2
2 files changed, 3 insertions, 6 deletions
diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs
index be86416c4..3e49b1c2b 100644
--- a/src/lexer/mod.rs
+++ b/src/lexer/mod.rs
@@ -11,7 +11,7 @@ mod numbers;
11use self::numbers::scan_number; 11use self::numbers::scan_number;
12 12
13mod strings; 13mod strings;
14use self::strings::{string_literal_start, scan_char, scan_byte_char_or_string, scan_string, scan_raw_string}; 14use self::strings::{is_string_literal_start, scan_char, scan_byte_char_or_string, scan_string, scan_raw_string};
15 15
16pub fn next_token(text: &str) -> Token { 16pub fn next_token(text: &str) -> Token {
17 assert!(!text.is_empty()); 17 assert!(!text.is_empty());
@@ -23,10 +23,7 @@ pub fn next_token(text: &str) -> Token {
23} 23}
24 24
25fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind { 25fn next_token_inner(c: char, ptr: &mut Ptr) -> SyntaxKind {
26 // Note: r as in r" or r#" is part of a raw string literal, 26 let ident_start = is_ident_start(c) && !is_string_literal_start(c, ptr.next(), ptr.nnext());
27 // b as in b' is part of a byte literal.
28 // They are not identifiers, and are handled further down.
29 let ident_start = is_ident_start(c) && !string_literal_start(c, ptr.next(), ptr.nnext());
30 if ident_start { 27 if ident_start {
31 return scan_ident(c, ptr); 28 return scan_ident(c, ptr);
32 } 29 }
diff --git a/src/lexer/strings.rs b/src/lexer/strings.rs
index 2c1d86374..116d31760 100644
--- a/src/lexer/strings.rs
+++ b/src/lexer/strings.rs
@@ -3,7 +3,7 @@ use syntax_kinds::*;
3 3
4use lexer::ptr::Ptr; 4use lexer::ptr::Ptr;
5 5
6pub(crate) fn string_literal_start(c: char, c1: Option<char>, c2: Option<char>) -> bool { 6pub(crate) fn is_string_literal_start(c: char, c1: Option<char>, c2: Option<char>) -> bool {
7 match (c, c1, c2) { 7 match (c, c1, c2) {
8 ('r', Some('"'), _) | 8 ('r', Some('"'), _) |
9 ('r', Some('#'), _) | 9 ('r', Some('#'), _) |