1 write to _lexer
Microsoft.CodeAnalysis.CSharp (1)
Parser\Lexer_StringLiteral.cs (1)
351
_lexer
= lexer;
126 references to _lexer
Microsoft.CodeAnalysis.CSharp (126)
Parser\Lexer_StringLiteral.cs (126)
361
char ch =
_lexer
.TextWindow.PeekChar();
364
(ch == SlidingTextWindow.InvalidCharacter &&
_lexer
.TextWindow.IsReallyAtEnd());
381
var start =
_lexer
.TextWindow.Position;
383
Debug.Assert(
_lexer
.TextWindow.Position != start);
385
openQuoteRange = start..
_lexer
.TextWindow.Position;
391
closeQuoteRange =
_lexer
.TextWindow.Position..
_lexer
.TextWindow.Position;
414
var window =
_lexer
.TextWindow;
446
var prefixAtCount =
_lexer
.ConsumeAtSignSequence();
447
startingDollarSignCount =
_lexer
.ConsumeDollarSignSequence();
450
var suffixAtCount =
_lexer
.ConsumeAtSignSequence();
451
startingQuoteCount =
_lexer
.ConsumeQuoteSequence();
464
TrySetError(
_lexer
.MakeError(start, window.Position - start, ErrorCode.ERR_StringMustStartWithQuoteCharacter));
475
TrySetError(
_lexer
.MakeError(start, window.Position - start, ErrorCode.ERR_IllegalAtSequence));
481
TrySetError(
_lexer
.MakeError(window.Position - startingQuoteCount, startingQuoteCount, ErrorCode.ERR_NotEnoughQuotesForRawString));
487
_lexer
.ConsumeWhitespace(builder: null);
510
var closeQuotePosition =
_lexer
.TextWindow.Position;
524
closeQuoteRange = closeQuotePosition..
_lexer
.TextWindow.Position;
531
if (
_lexer
.TextWindow.PeekChar() != '"')
537
TrySetError(
_lexer
.MakeError(
538
IsAtEnd(allowNewline: true) ?
_lexer
.TextWindow.Position - 1 :
_lexer
.TextWindow.Position,
544
_lexer
.TextWindow.AdvanceChar(); // "
554
if (
_lexer
.TextWindow.PeekChar() != '"')
560
TrySetError(
_lexer
.MakeError(
561
IsAtEnd(allowNewline: true) ?
_lexer
.TextWindow.Position - 1 :
_lexer
.TextWindow.Position,
566
var closeQuoteCount =
_lexer
.ConsumeQuoteSequence();
578
TrySetError(
_lexer
.MakeError(
579
position:
_lexer
.TextWindow.Position - excessQuoteCount,
595
TrySetError(
_lexer
.MakeError(
596
_lexer
.TextWindow.Position - 1, width: 1, ErrorCode.ERR_UnterminatedRawString));
598
else if (
_lexer
.TextWindow.PeekChar() == '"')
601
var closeQuoteCount =
_lexer
.ConsumeQuoteSequence();
606
TrySetError(
_lexer
.MakeError(
607
position:
_lexer
.TextWindow.Position - closeQuoteCount,
613
_lexer
.TextWindow.AdvancePastNewLine();
614
_lexer
.ConsumeWhitespace(builder: null);
616
var closeQuoteCount =
_lexer
.ConsumeQuoteSequence();
625
TrySetError(
_lexer
.MakeError(
626
position:
_lexer
.TextWindow.Position - excessQuoteCount,
658
switch (
_lexer
.TextWindow.PeekChar())
678
var escapeStart =
_lexer
.TextWindow.Position;
679
char ch =
_lexer
.ScanEscapeSequence(surrogateCharacter: out _);
682
TrySetError(
_lexer
.MakeError(escapeStart,
_lexer
.TextWindow.Position - escapeStart, ErrorCode.ERR_EscapedCurly, ch));
687
_lexer
.TextWindow.AdvanceChar();
694
_lexer
.TextWindow.AdvanceChar();
704
_lexer
.ConsumeWhitespace(builder: null);
705
var beforeQuotesPosition =
_lexer
.TextWindow.Position;
706
var closeQuoteCount =
_lexer
.ConsumeQuoteSequence();
712
this.TrySetError(
_lexer
.MakeError(
713
_lexer
.TextWindow.Position - closeQuoteCount, closeQuoteCount, ErrorCode.ERR_RawStringMustContainContent));
714
_lexer
.TextWindow.Reset(beforeQuotesPosition);
728
var startPosition =
_lexer
.TextWindow.Position;
729
if (SyntaxFacts.IsNewLine(
_lexer
.TextWindow.PeekChar()))
731
_lexer
.TextWindow.AdvancePastNewLine();
732
_lexer
.ConsumeWhitespace(builder: null);
733
var closeQuoteCount =
_lexer
.ConsumeQuoteSequence();
735
_lexer
.TextWindow.Reset(startPosition);
771
if (
_lexer
.TextWindow.PeekChar(1) != '"')
777
_lexer
.TextWindow.AdvanceChar(2); // ""
783
var beforeQuotePosition =
_lexer
.TextWindow.Position;
784
var currentQuoteCount =
_lexer
.ConsumeQuoteSequence();
790
_lexer
.TextWindow.Reset(beforeQuotePosition);
803
var pos =
_lexer
.TextWindow.Position;
804
_lexer
.TextWindow.AdvanceChar(); // }
807
if (
_lexer
.TextWindow.PeekChar() == '}')
809
_lexer
.TextWindow.AdvanceChar(); // }
813
TrySetError(
_lexer
.MakeError(pos, 1, ErrorCode.ERR_UnescapedCurly, "}"));
825
var closeBraceCount =
_lexer
.ConsumeCloseBraceSequence();
828
TrySetError(
_lexer
.MakeError(
829
position:
_lexer
.TextWindow.Position - closeBraceCount,
851
if (
_lexer
.TextWindow.PeekChar(1) == '{')
853
_lexer
.TextWindow.AdvanceChar(2); // {{
857
int openBracePosition =
_lexer
.TextWindow.Position;
858
_lexer
.TextWindow.AdvanceChar();
860
int closeBracePosition =
_lexer
.TextWindow.Position;
861
if (
_lexer
.TextWindow.PeekChar() == '}')
863
_lexer
.TextWindow.AdvanceChar();
867
TrySetError(
_lexer
.MakeError(openBracePosition - 1, 2, ErrorCode.ERR_UnclosedExpressionHole));
873
new Range(closeBracePosition,
_lexer
.TextWindow.Position)));
886
var beforeOpenBracesPosition =
_lexer
.TextWindow.Position;
887
var openBraceCount =
_lexer
.ConsumeOpenBraceSequence();
894
var afterOpenBracePosition =
_lexer
.TextWindow.Position;
899
TrySetError(
_lexer
.MakeError(
908
var beforeCloseBracePosition =
_lexer
.TextWindow.Position;
909
var closeBraceCount =
_lexer
.ConsumeCloseBraceSequence();
914
TrySetError(
_lexer
.MakeError(
922
TrySetError(
_lexer
.MakeError(
931
_lexer
.TextWindow.Reset(beforeCloseBracePosition + startingDollarSignCount);
937
beforeCloseBracePosition..
_lexer
.TextWindow.Position));
953
Debug.Assert(
_lexer
.TextWindow.PeekChar() == ':');
954
_lexer
.TextWindow.AdvanceChar();
957
char ch =
_lexer
.TextWindow.PeekChar();
961
var pos =
_lexer
.TextWindow.Position;
962
ch =
_lexer
.ScanEscapeSequence(surrogateCharacter: out _);
965
TrySetError(
_lexer
.MakeError(pos, 1, ErrorCode.ERR_EscapedCurly, ch));
970
if (kind is InterpolatedStringKind.Verbatim &&
_lexer
.TextWindow.PeekChar(1) == '"')
972
_lexer
.TextWindow.AdvanceChar(2); // ""
981
TrySetError(
_lexer
.MakeError(
982
_lexer
.TextWindow.Position, 1, ErrorCode.ERR_UnexpectedCharacter, ch));
983
_lexer
.TextWindow.AdvanceChar();
995
_lexer
.TextWindow.AdvanceChar();
1008
char ch =
_lexer
.TextWindow.PeekChar();
1022
TrySetError(
_lexer
.MakeError(
_lexer
.TextWindow.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
1023
_lexer
.TextWindow.AdvanceChar();
1028
if (
_lexer
.TryScanInterpolatedString(ref discarded))
1040
colonRange = new Range(
_lexer
.TextWindow.Position,
_lexer
.TextWindow.Position + 1);
1054
TrySetError(
_lexer
.MakeError(
_lexer
.TextWindow.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
1077
if (
_lexer
.TryScanAtStringToken(ref discarded))
1080
if (
_lexer
.TextWindow.PeekChar(1) == '*')
1084
_lexer
.ScanMultiLineComment(isTerminated: out _, delimiter: '@');
1092
switch (
_lexer
.TextWindow.PeekChar(1))
1095
_lexer
.ScanToEndOfLine();
1098
_lexer
.ScanMultiLineComment(isTerminated: out _, '/');
1101
_lexer
.TextWindow.AdvanceChar();
1118
_lexer
.TextWindow.AdvanceChar();
1134
_lexer
.ScanStringLiteral(ref info, inDirective: false);
1139
Debug.Assert(start ==
_lexer
.TextWindow.PeekChar());
1140
_lexer
.TextWindow.AdvanceChar();
1142
if (
_lexer
.TextWindow.PeekChar() == end)
1144
_lexer
.TextWindow.AdvanceChar();