diff options
Diffstat (limited to 'crates/libsyntax2')
-rw-r--r-- | crates/libsyntax2/src/lexer/strings.rs | 16 | ||||
-rw-r--r-- | crates/libsyntax2/tests/data/lexer/0008_byte_strings.rs | 1 | ||||
-rw-r--r-- | crates/libsyntax2/tests/data/lexer/0008_byte_strings.txt | 8 |
3 files changed, 11 insertions, 14 deletions
diff --git a/crates/libsyntax2/src/lexer/strings.rs b/crates/libsyntax2/src/lexer/strings.rs index a6da97d47..e6ade54a4 100644 --- a/crates/libsyntax2/src/lexer/strings.rs +++ b/crates/libsyntax2/src/lexer/strings.rs | |||
@@ -102,23 +102,11 @@ pub(crate) fn scan_raw_string(ptr: &mut Ptr) { | |||
102 | } | 102 | } |
103 | 103 | ||
104 | fn scan_byte(ptr: &mut Ptr) { | 104 | fn scan_byte(ptr: &mut Ptr) { |
105 | if ptr.next_is('\'') { | 105 | scan_char(ptr) |
106 | ptr.bump(); | ||
107 | return; | ||
108 | } | ||
109 | ptr.bump(); | ||
110 | if ptr.next_is('\'') { | ||
111 | ptr.bump(); | ||
112 | return; | ||
113 | } | ||
114 | } | 106 | } |
115 | 107 | ||
116 | fn scan_byte_string(ptr: &mut Ptr) { | 108 | fn scan_byte_string(ptr: &mut Ptr) { |
117 | while let Some(c) = ptr.bump() { | 109 | scan_string(ptr) |
118 | if c == '"' { | ||
119 | return; | ||
120 | } | ||
121 | } | ||
122 | } | 110 | } |
123 | 111 | ||
124 | fn scan_raw_byte_string(ptr: &mut Ptr) { | 112 | fn scan_raw_byte_string(ptr: &mut Ptr) { |
diff --git a/crates/libsyntax2/tests/data/lexer/0008_byte_strings.rs b/crates/libsyntax2/tests/data/lexer/0008_byte_strings.rs index 9dd1570de..b54930f5e 100644 --- a/crates/libsyntax2/tests/data/lexer/0008_byte_strings.rs +++ b/crates/libsyntax2/tests/data/lexer/0008_byte_strings.rs | |||
@@ -1,2 +1,3 @@ | |||
1 | b'' b'x' b"foo" br"" | 1 | b'' b'x' b"foo" br"" |
2 | b''suf b""ix br""br | 2 | b''suf b""ix br""br |
3 | b'\n' b'\\' b'\'' b'hello' | ||
diff --git a/crates/libsyntax2/tests/data/lexer/0008_byte_strings.txt b/crates/libsyntax2/tests/data/lexer/0008_byte_strings.txt index ed8cd4bab..bc03b51a8 100644 --- a/crates/libsyntax2/tests/data/lexer/0008_byte_strings.txt +++ b/crates/libsyntax2/tests/data/lexer/0008_byte_strings.txt | |||
@@ -12,3 +12,11 @@ BYTE_STRING 5 "b\"\"ix" | |||
12 | WHITESPACE 1 " " | 12 | WHITESPACE 1 " " |
13 | RAW_BYTE_STRING 6 "br\"\"br" | 13 | RAW_BYTE_STRING 6 "br\"\"br" |
14 | WHITESPACE 1 "\n" | 14 | WHITESPACE 1 "\n" |
15 | BYTE 5 "b\'\\n\'" | ||
16 | WHITESPACE 1 " " | ||
17 | BYTE 5 "b\'\\\\\'" | ||
18 | WHITESPACE 1 " " | ||
19 | BYTE 5 "b\'\\\'\'" | ||
20 | WHITESPACE 1 " " | ||
21 | BYTE 8 "b\'hello\'" | ||
22 | WHITESPACE 1 "\n" | ||