diff options
Diffstat (limited to 'crates/libsyntax2/src/lexer/strings.rs')
-rw-r--r-- | crates/libsyntax2/src/lexer/strings.rs | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/crates/libsyntax2/src/lexer/strings.rs b/crates/libsyntax2/src/lexer/strings.rs index fbae767e5..795ea97b7 100644 --- a/crates/libsyntax2/src/lexer/strings.rs +++ b/crates/libsyntax2/src/lexer/strings.rs | |||
@@ -15,14 +15,23 @@ pub(crate) fn is_string_literal_start(c: char, c1: Option<char>, c2: Option<char | |||
15 | } | 15 | } |
16 | 16 | ||
17 | pub(crate) fn scan_char(ptr: &mut Ptr) { | 17 | pub(crate) fn scan_char(ptr: &mut Ptr) { |
18 | if ptr.bump().is_none() { | 18 | loop { |
19 | return; // TODO: error reporting is upper in the stack | 19 | if ptr.next_is('\\') { |
20 | } | 20 | ptr.bump(); |
21 | scan_char_or_byte(ptr); | 21 | if ptr.next_is('\\') || ptr.next_is('\'') { |
22 | if !ptr.next_is('\'') { | 22 | ptr.bump(); |
23 | return; // TODO: error reporting | 23 | } |
24 | continue; | ||
25 | } | ||
26 | if ptr.next_is('\'') { | ||
27 | ptr.bump(); | ||
28 | return; | ||
29 | } | ||
30 | if ptr.next_is('\n') { | ||
31 | break; | ||
32 | } | ||
33 | ptr.bump(); | ||
24 | } | 34 | } |
25 | ptr.bump(); | ||
26 | } | 35 | } |
27 | 36 | ||
28 | pub(crate) fn scan_byte_char_or_string(ptr: &mut Ptr) -> SyntaxKind { | 37 | pub(crate) fn scan_byte_char_or_string(ptr: &mut Ptr) -> SyntaxKind { |
@@ -111,8 +120,3 @@ fn scan_raw_byte_string(ptr: &mut Ptr) { | |||
111 | } | 120 | } |
112 | } | 121 | } |
113 | } | 122 | } |
114 | |||
115 | fn scan_char_or_byte(ptr: &mut Ptr) { | ||
116 | //FIXME: deal with escape sequencies | ||
117 | ptr.bump(); | ||
118 | } | ||