aboutsummaryrefslogtreecommitdiff
path: root/src/lexer
diff options
context:
space:
mode:
Diffstat (limited to 'src/lexer')
-rw-r--r--src/lexer/strings.rs31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/lexer/strings.rs b/src/lexer/strings.rs
index 40e5e4528..283ce8feb 100644
--- a/src/lexer/strings.rs
+++ b/src/lexer/strings.rs
@@ -33,30 +33,51 @@ pub(crate) fn scan_byte_char_or_string(ptr: &mut Ptr) -> SyntaxKind {
33 match c { 33 match c {
34 '\'' => { 34 '\'' => {
35 scan_byte(ptr); 35 scan_byte(ptr);
36 CHAR 36 BYTE
37 } 37 }
38 '"' => { 38 '"' => {
39 scan_byte_string(ptr); 39 scan_byte_string(ptr);
40 CHAR 40 BYTE_STRING
41 } 41 }
42 'r' => { 42 'r' => {
43 scan_raw_byte_string(ptr); 43 scan_raw_byte_string(ptr);
44 CHAR 44 RAW_BYTE_STRING
45 } 45 }
46 _ => unreachable!(), 46 _ => unreachable!(),
47 } 47 }
48} 48}
49 49
50fn scan_byte(ptr: &mut Ptr) { 50fn scan_byte(ptr: &mut Ptr) {
51 51 if ptr.next_is('\'') {
52 ptr.bump();
53 return
54 }
55 ptr.bump();
56 if ptr.next_is('\'') {
57 ptr.bump();
58 return
59 }
52} 60}
53 61
54fn scan_byte_string(ptr: &mut Ptr) { 62fn scan_byte_string(ptr: &mut Ptr) {
55 63 while let Some(c) = ptr.bump() {
64 if c == '"' {
65 return
66 }
67 }
56} 68}
57 69
58fn scan_raw_byte_string(ptr: &mut Ptr) { 70fn scan_raw_byte_string(ptr: &mut Ptr) {
71 if !ptr.next_is('"') {
72 return
73 }
74 ptr.bump();
59 75
76 while let Some(c) = ptr.bump() {
77 if c == '"' {
78 return
79 }
80 }
60} 81}
61 82
62fn scan_char_or_byte(ptr: &mut Ptr) { 83fn scan_char_or_byte(ptr: &mut Ptr) {