File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -178,8 +178,9 @@ SyntaxModelContext::SyntaxModelContext(SourceFile &SrcFile)
178
178
}
179
179
180
180
case tok::unknown: {
181
- if (Tok.getRawText ().startswith (" \" " )) {
182
- // This is an invalid string literal
181
+ if (Tok.getRawText ().ltrim (' #' ).startswith (" \" " )) {
182
+ // This is likely an invalid single-line ("), multi-line ("""),
183
+ // or raw (#", ##", #""", etc.) string literal.
183
184
Kind = SyntaxNodeKind::String;
184
185
break ;
185
186
}
Original file line number Diff line number Diff line change @@ -197,6 +197,25 @@ class SubCls : MyCls, Prot {}
197
197
func genFn< T : Prot where T. Blarg : Prot2 > ( _: T ) -> Int { }
198
198
199
199
func f( x: Int ) -> Int {
200
+
201
+ // CHECK: <str>#"This is a raw string"#</str>
202
+ #"This is a raw string"#
203
+
204
+ // CHECK: <str>##"This is also a raw string"##</str>
205
+ ##"This is also a raw string"##
206
+
207
+ // CHECK: <str>###"This is an unterminated raw string"</str>
208
+ ###"This is an unterminated raw string"
209
+
210
+ // CHECK: <str>#"""This is a multiline raw string"""#</str>
211
+ #"""This is a multiline raw string"""#
212
+
213
+ // CHECK: <str>#"This is an </str>\#<anchor>(</anchor>interpolated<anchor>)</anchor><str> raw string"#</str>
214
+ #"This is an \#(interpolated) raw string"#
215
+
216
+ // CHECK: <str>#"This is a raw string with an invalid \##( ) interpolation"#</str>
217
+ #"This is a raw string with an invalid \##( ) interpolation" #
218
+
200
219
// CHECK: <str> " This is string </ str> \< anchor> ( </ anchor> genFn ( { ( a: < type> Int</ type> - > < type> Int</ type> ) < kw> in</ kw> a} ) < anchor> ) </ anchor> < str> interpolation" </ str>
201
220
" This is string \( genFn ( { ( a: Int -> Int ) in a} ) ) interpolation "
202
221
You can’t perform that action at this time.
0 commit comments