aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-14 13:03:27 +0100
committerAleksey Kladov <[email protected]>2018-08-14 13:03:27 +0100
commit109658332a75ca91d6dc2bf573e0ab77fa5619ca (patch)
tree9227430826c75e184577623c25e54489b1033865 /crates/libsyntax2/src
parent199e3b73c712a74e36bbb75eebf9e9418f1b1341 (diff)
Support raw strings in lexer
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r--crates/libsyntax2/src/lexer/strings.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/lexer/strings.rs b/crates/libsyntax2/src/lexer/strings.rs
index e3704fbb3..fbae767e5 100644
--- a/crates/libsyntax2/src/lexer/strings.rs
+++ b/crates/libsyntax2/src/lexer/strings.rs
@@ -55,6 +55,11 @@ pub(crate) fn scan_string(ptr: &mut Ptr) {
55} 55}
56 56
57pub(crate) fn scan_raw_string(ptr: &mut Ptr) { 57pub(crate) fn scan_raw_string(ptr: &mut Ptr) {
58 let mut hashes = 0;
59 while ptr.next_is('#') {
60 hashes += 1;
61 ptr.bump();
62 }
58 if !ptr.next_is('"') { 63 if !ptr.next_is('"') {
59 return; 64 return;
60 } 65 }
@@ -62,7 +67,14 @@ pub(crate) fn scan_raw_string(ptr: &mut Ptr) {
62 67
63 while let Some(c) = ptr.bump() { 68 while let Some(c) = ptr.bump() {
64 if c == '"' { 69 if c == '"' {
65 return; 70 let mut hashes_left = hashes;
71 while ptr.next_is('#') && hashes_left > 0{
72 hashes_left -= 1;
73 ptr.bump();
74 }
75 if hashes_left == 0 {
76 return;
77 }
66 } 78 }
67 } 79 }
68} 80}