@@ -220,6 +220,21 @@ class Token {
220
220
default : return false ;
221
221
}
222
222
}
223
+
224
+ // / \brief True if the string literal token is multiline.
225
+ bool isMultilineString () const {
226
+ return MultilineString;
227
+ }
228
+ // / \brief Count of extending escaping '#'.
229
+ unsigned getCustomDelimiterLen () const {
230
+ return CustomDelimiterLen;
231
+ }
232
+ // / \brief Set characteristics of string literal token.
233
+ void setStringLiteral (bool IsMultilineString, unsigned CustomDelimiterLen) {
234
+ assert (Kind == tok::string_literal);
235
+ this ->MultilineString = IsMultilineString;
236
+ this ->CustomDelimiterLen = CustomDelimiterLen;
237
+ }
223
238
224
239
// / getLoc - Return a source location identifier for the specified
225
240
// / offset in the current file.
@@ -268,25 +283,16 @@ class Token {
268
283
void setText (StringRef T) { Text = T; }
269
284
270
285
// / \brief Set the token to the specified kind and source range.
271
- void setToken (tok K, StringRef T, unsigned CommentLength = 0 ,
272
- bool IsMultilineString = false , unsigned CustomDelimiterLen = 0 ) {
286
+ void setToken (tok K, StringRef T, unsigned CommentLength = 0 ) {
273
287
Kind = K;
274
288
Text = T;
275
289
this ->CommentLength = CommentLength;
276
290
EscapedIdentifier = false ;
277
- this ->MultilineString = IsMultilineString ;
278
- this ->CustomDelimiterLen = CustomDelimiterLen ;
291
+ this ->MultilineString = false ;
292
+ this ->CustomDelimiterLen = 0 ;
279
293
assert (this ->CustomDelimiterLen == CustomDelimiterLen &&
280
294
" custom string delimiter length > 255" );
281
295
}
282
-
283
- bool isMultilineString () const {
284
- return MultilineString;
285
- }
286
-
287
- unsigned getCustomDelimiterLen () const {
288
- return CustomDelimiterLen;
289
- }
290
296
};
291
297
292
298
} // end namespace swift
0 commit comments