@@ -364,19 +364,21 @@ class Lexer {
364
364
enum : char { Literal, Expr } Kind;
365
365
// Loc+Length for the segment inside the string literal, without quotes.
366
366
SourceLoc Loc;
367
- unsigned Length, IndentToStrip;
367
+ unsigned Length, IndentToStrip, CustomDelimiterLen ;
368
368
bool IsFirstSegment, IsLastSegment;
369
369
370
370
static StringSegment getLiteral (SourceLoc Loc, unsigned Length,
371
371
bool IsFirstSegment, bool IsLastSegment,
372
- unsigned IndentToStrip) {
372
+ unsigned IndentToStrip,
373
+ unsigned CustomDelimiterLen) {
373
374
StringSegment Result;
374
375
Result.Kind = Literal;
375
376
Result.Loc = Loc;
376
377
Result.Length = Length;
377
378
Result.IsFirstSegment = IsFirstSegment;
378
379
Result.IsLastSegment = IsLastSegment;
379
380
Result.IndentToStrip = IndentToStrip;
381
+ Result.CustomDelimiterLen = CustomDelimiterLen;
380
382
return Result;
381
383
}
382
384
@@ -388,6 +390,7 @@ class Lexer {
388
390
Result.IsFirstSegment = false ;
389
391
Result.IsLastSegment = false ;
390
392
Result.IndentToStrip = 0 ;
393
+ Result.CustomDelimiterLen = 0 ;
391
394
return Result;
392
395
}
393
396
@@ -404,13 +407,14 @@ class Lexer {
404
407
SmallVectorImpl<char > &Buffer,
405
408
bool IsFirstSegment = false ,
406
409
bool IsLastSegment = false ,
407
- unsigned IndentToStrip = 0 );
410
+ unsigned IndentToStrip = 0 ,
411
+ unsigned CustomDelimiterLen = 0 );
408
412
StringRef getEncodedStringSegment (StringSegment Segment,
409
413
SmallVectorImpl<char > &Buffer) const {
410
414
return getEncodedStringSegment (
411
415
StringRef (getBufferPtrForSourceLoc (Segment.Loc ), Segment.Length ),
412
416
Buffer, Segment.IsFirstSegment , Segment.IsLastSegment ,
413
- Segment.IndentToStrip );
417
+ Segment.IndentToStrip , Segment. CustomDelimiterLen );
414
418
}
415
419
416
420
// / \brief Given a string literal token, separate it into string/expr segments
@@ -474,7 +478,8 @@ class Lexer {
474
478
return diagnose (Loc, Diagnostic (DiagID, std::forward<ArgTypes>(Args)...));
475
479
}
476
480
477
- void formToken (tok Kind, const char *TokStart, bool MultilineString = false );
481
+ void formToken (tok Kind, const char *TokStart, bool IsMultilineString = false ,
482
+ unsigned CustomDelimiterLen = 0 );
478
483
void formEscapedIdentifierToken (const char *TokStart);
479
484
480
485
// / Advance to the end of the line.
@@ -498,10 +503,10 @@ class Lexer {
498
503
void lexTrivia (syntax::Trivia &T, bool IsForTrailingTrivia);
499
504
static unsigned lexUnicodeEscape (const char *&CurPtr, Lexer *Diags);
500
505
501
- unsigned lexCharacter (const char *&CurPtr,
502
- char StopQuote , bool EmitDiagnostics ,
503
- bool MultilineString = false );
504
- void lexStringLiteral ();
506
+ unsigned lexCharacter (const char *&CurPtr, char StopQuote,
507
+ bool EmitDiagnostics , bool IsMultilineString = false ,
508
+ unsigned CustomDelimiterLen = 0 );
509
+ void lexStringLiteral (unsigned CustomDelimiterLen = 0 );
505
510
void lexEscapedIdentifier ();
506
511
507
512
void tryLexEditorPlaceholder ();
0 commit comments