1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21
this.
TextWindow
= new SlidingTextWindow(text);
673 references to TextWindow
Microsoft.CodeAnalysis.CSharp (673)
Parser\AbstractLexer.cs (4)
26
this.
TextWindow
.Dispose();
31
TextWindow
.Start();
134
return position >=
TextWindow
.LexemeStartPosition ? position -
TextWindow
.LexemeStartPosition : position;
Parser\Blender.cs (1)
69
_newPosition = lexer.
TextWindow
.Position;
Parser\Blender.Reader.cs (1)
165
if (_lexer.
TextWindow
.Position != _newPosition)
Parser\DirectiveParser.cs (1)
36
var hashPosition = lexer.
TextWindow
.Position;
Parser\LanguageParser.cs (2)
219
return CreateForGlobalFailure(lexer.
TextWindow
.Position, createEmptyNodeFunc(this));
229
builder.Add(SyntaxFactory.BadToken(null, lexer.
TextWindow
.Text.ToString(), null));
Parser\Lexer.cs (481)
172
this.
TextWindow
.Reset(position);
310
this.LexSyntaxTrivia(isFollowingToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
329
this.LexSyntaxTrivia(isFollowingToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
449
int startingPosition =
TextWindow
.Position;
452
character =
TextWindow
.PeekChar();
461
TextWindow
.AdvanceChar();
462
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.SlashEqualsToken : SyntaxKind.SlashToken;
466
if (this.
TextWindow
.PeekChar(1) is >= '0' and <= '9')
468
var atDotPosition = this.
TextWindow
.Position;
470
atDotPosition == this.
TextWindow
.LexemeStartPosition)
479
this.
TextWindow
.Reset(atDotPosition - 1);
480
var priorCharacterIsDot = this.
TextWindow
.PeekChar() is '.';
481
this.
TextWindow
.Reset(atDotPosition);
486
TextWindow
.AdvanceChar();
497
TextWindow
.AdvanceChar();
504
TextWindow
.AdvanceChar();
509
TextWindow
.AdvanceChar();
510
info.Kind =
TextWindow
.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken;
514
TextWindow
.AdvanceChar();
519
TextWindow
.AdvanceChar();
524
TextWindow
.AdvanceChar();
525
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken;
529
TextWindow
.AdvanceChar();
531
TextWindow
.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken :
532
TextWindow
.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken;
536
TextWindow
.AdvanceChar();
537
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken;
541
TextWindow
.AdvanceChar();
546
TextWindow
.AdvanceChar();
551
TextWindow
.AdvanceChar();
556
TextWindow
.AdvanceChar();
561
TextWindow
.AdvanceChar();
566
TextWindow
.AdvanceChar();
571
TextWindow
.AdvanceChar();
572
info.Kind =
TextWindow
.TryAdvance('?')
573
?
TextWindow
.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken
578
TextWindow
.AdvanceChar();
580
TextWindow
.TryAdvance('=') ? SyntaxKind.PlusEqualsToken :
581
TextWindow
.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken;
585
TextWindow
.AdvanceChar();
587
TextWindow
.TryAdvance('=') ? SyntaxKind.MinusEqualsToken :
588
TextWindow
.TryAdvance('-') ? SyntaxKind.MinusMinusToken :
589
TextWindow
.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken;
593
TextWindow
.AdvanceChar();
594
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken;
598
TextWindow
.AdvanceChar();
600
TextWindow
.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken :
601
TextWindow
.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken;
605
TextWindow
.AdvanceChar();
606
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken;
610
TextWindow
.AdvanceChar();
612
TextWindow
.TryAdvance('=') ? SyntaxKind.BarEqualsToken :
613
TextWindow
.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken;
617
TextWindow
.AdvanceChar();
619
TextWindow
.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken :
620
TextWindow
.TryAdvance('<')
621
?
TextWindow
.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken
626
TextWindow
.AdvanceChar();
627
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken;
634
Debug.Assert(
TextWindow
.PeekChar() == '@');
636
if (
TextWindow
.PeekChar(1) == ':')
641
this.AddError(
TextWindow
.Position + 1, width: 1, ErrorCode.ERR_ExpectedVerbatimLiteral);
644
info.Text =
TextWindow
.GetText(false);
649
info.Text =
TextWindow
.GetText(intern: true);
690
if (!
TextWindow
.IsReallyAtEnd())
721
TextWindow
.AdvanceChar();
726
if (char.IsHighSurrogate(character) && char.IsLowSurrogate(
TextWindow
.PeekChar()))
727
TextWindow
.AdvanceChar();
735
info.Text =
TextWindow
.GetText(intern: true);
739
int end =
TextWindow
.Text.Length;
740
info.Text =
TextWindow
.Text.ToString(TextSpan.FromBounds(startingPosition, end));
741
TextWindow
.Reset(end);
758
Debug.Assert(
TextWindow
.PeekChar() == '@');
761
while (
TextWindow
.PeekChar(index) == '@')
766
if (
TextWindow
.PeekChar(index) == '"')
772
else if (
TextWindow
.PeekChar(index) == '$')
784
Debug.Assert(
TextWindow
.PeekChar() == '$');
786
if (
TextWindow
.PeekChar(1) is '$' or '@' or '"')
811
int start =
TextWindow
.Position;
812
while (
TextWindow
.PeekChar() is >= '0' and <= '9')
814
TextWindow
.AdvanceChar();
817
return start <
TextWindow
.Position;
823
if (
TextWindow
.PeekChar() == '_')
838
char ch =
TextWindow
.PeekChar();
855
TextWindow
.AdvanceChar();
866
int start =
TextWindow
.Position;
881
ch =
TextWindow
.PeekChar();
884
ch =
TextWindow
.PeekChar(1);
887
TextWindow
.AdvanceChar(2);
893
TextWindow
.AdvanceChar(2);
904
if (
TextWindow
.PeekChar() is 'L' or 'l')
906
TextWindow
.AdvanceChar();
908
if (
TextWindow
.PeekChar() is 'u' or 'U')
910
TextWindow
.AdvanceChar();
914
else if (
TextWindow
.PeekChar() is 'u' or 'U')
916
TextWindow
.AdvanceChar();
918
if (
TextWindow
.PeekChar() is 'L' or 'l')
920
TextWindow
.AdvanceChar();
929
if (this.ModeIs(LexerMode.DebuggerSyntax) &&
TextWindow
.PeekChar() == '#')
932
TextWindow
.AdvanceChar();
933
info.StringValue = info.Text =
TextWindow
.GetText(intern: true);
939
if ((ch =
TextWindow
.PeekChar()) == '.')
941
var ch2 =
TextWindow
.PeekChar(1);
946
TextWindow
.AdvanceChar();
953
TextWindow
.Reset(start);
958
if ((ch =
TextWindow
.PeekChar()) is 'E' or 'e')
961
TextWindow
.AdvanceChar();
963
if ((ch =
TextWindow
.PeekChar()) is '-' or '+')
966
TextWindow
.AdvanceChar();
969
if (!(((ch =
TextWindow
.PeekChar()) >= '0' && ch <= '9') || ch == '_'))
982
ch =
TextWindow
.PeekChar();
987
TextWindow
.AdvanceChar();
992
TextWindow
.AdvanceChar();
997
TextWindow
.AdvanceChar();
1007
TextWindow
.AdvanceChar();
1012
TextWindow
.AdvanceChar();
1017
TextWindow
.AdvanceChar();
1022
TextWindow
.AdvanceChar();
1024
if (
TextWindow
.PeekChar() is 'u' or 'U')
1026
TextWindow
.AdvanceChar();
1033
TextWindow
.AdvanceChar();
1034
if (
TextWindow
.PeekChar() is 'L' or 'l')
1036
TextWindow
.AdvanceChar();
1044
this.AddError(MakeError(start,
TextWindow
.Position - start, ErrorCode.ERR_InvalidNumber));
1056
info.Text =
TextWindow
.GetText(true);
1058
var valueText =
TextWindow
.Intern(_builder);
1069
info.DecimalValue = this.GetValueDecimal(valueText, start,
TextWindow
.Position);
1349
var currentOffset =
TextWindow
.Offset;
1350
var characterWindow =
TextWindow
.CharacterWindow;
1351
var characterWindowCount =
TextWindow
.CharacterWindowCount;
1414
TextWindow
.AdvanceChar(length);
1415
info.Text = info.StringValue =
TextWindow
.Intern(characterWindow, startOffset, length);
1447
int start =
TextWindow
.Position;
1450
while (
TextWindow
.PeekChar() == '@')
1452
TextWindow
.AdvanceChar();
1455
var atCount =
TextWindow
.Position - start;
1463
char ch =
TextWindow
.PeekChar();
1486
if (!
TextWindow
.IsReallyAtEnd())
1506
(char.ToLower(
TextWindow
.PeekChar(1)) == 'x'))
1540
if (_identLen == 0 && this.ModeIs(LexerMode.DebuggerSyntax) &&
TextWindow
.PeekChar(1) == '>')
1543
TextWindow
.AdvanceChar(2);
1570
TextWindow
.AdvanceChar();
1594
TextWindow
.AdvanceChar();
1605
var width =
TextWindow
.Width; // exact size of input characters
1608
info.Text =
TextWindow
.GetInternedText();
1617
info.StringValue =
TextWindow
.Intern(_identBuffer, 0, _identLen);
1625
var valueText =
TextWindow
.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset);
1646
TextWindow
.Reset(start);
1662
int start =
TextWindow
.Position;
1681
int beforeConsumed =
TextWindow
.Position;
1685
if (
TextWindow
.PeekChar() == '&')
1690
TextWindow
.Reset(beforeConsumed);
1696
consumedChar =
TextWindow
.NextChar();
1716
if (!isEscaped && (
TextWindow
.Position == beforeConsumed + 1) &&
1717
TextWindow
.PeekChar() is 'u' or 'U')
1723
TextWindow
.Reset(beforeConsumed);
1745
TextWindow
.Reset(beforeConsumed);
1763
TextWindow
.Reset(beforeConsumed);
1766
if (!
TextWindow
.IsReallyAtEnd())
1771
TextWindow
.Reset(beforeConsumed);
1793
TextWindow
.Reset(beforeConsumed);
1814
var width =
TextWindow
.Width; // exact size of input characters
1819
info.StringValue =
TextWindow
.GetInternedText();
1824
info.StringValue =
TextWindow
.Intern(_identBuffer, 0, _identLen);
1825
info.Text =
TextWindow
.GetText(intern: false);
1834
TextWindow
.Reset(start);
1903
char ch =
TextWindow
.PeekChar();
1931
if ((ch =
TextWindow
.PeekChar(1)) == '/')
1933
if (!this.SuppressDocumentationCommentParse &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
1953
if (!this.SuppressDocumentationCommentParse &&
TextWindow
.PeekChar(2) == '*' &&
1954
TextWindow
.PeekChar(3) != '*' &&
TextWindow
.PeekChar(3) != '/')
1975
if ((ch =
TextWindow
.PeekChar(1)) == '*')
1978
this.AddError(
TextWindow
.Position, width: 1, ErrorCode.ERR_UnexpectedCharacter, '@');
2009
var savePosition =
TextWindow
.Position;
2015
var text =
TextWindow
.Text.GetSubText(TextSpan.FromBounds(savePosition,
TextWindow
.Position));
2064
var text =
TextWindow
.GetText(false);
2078
var text =
TextWindow
.GetText(false);
2089
var position =
TextWindow
.Position;
2090
var text =
TextWindow
.Text;
2123
this.AddError(
TextWindow
.Position, s_conflictMarkerLength,
2126
var startCh = this.
TextWindow
.PeekChar();
2152
var ch = this.
TextWindow
.PeekChar();
2171
this.
TextWindow
.AdvanceChar();
2174
if (this.
TextWindow
.Width > 0)
2176
this.AddTrivia(SyntaxFactory.DisabledText(
TextWindow
.GetText(false)), ref triviaList);
2190
while (SyntaxFacts.IsNewLine(this.
TextWindow
.PeekChar()))
2192
this.
TextWindow
.AdvanceChar();
2195
if (this.
TextWindow
.Width > 0)
2197
this.AddTrivia(SyntaxFactory.EndOfLine(
TextWindow
.GetText(false)), ref triviaList);
2205
var ch = this.
TextWindow
.PeekChar();
2211
this.
TextWindow
.AdvanceChar();
2214
this.AddTrivia(SyntaxFactory.ConflictMarker(
TextWindow
.GetText(false)), ref triviaList);
2235
Debug.Assert(
TextWindow
.PeekChar() == delimiter &&
TextWindow
.PeekChar(1) == '*');
2236
TextWindow
.AdvanceChar(2);
2241
if ((ch =
TextWindow
.PeekChar()) == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd())
2246
else if (ch == '*' &&
TextWindow
.PeekChar(1) == delimiter)
2248
TextWindow
.AdvanceChar(2);
2254
TextWindow
.AdvanceChar();
2262
while (!SyntaxFacts.IsNewLine(ch =
TextWindow
.PeekChar()) &&
2263
(ch != SlidingTextWindow.InvalidCharacter || !
TextWindow
.IsReallyAtEnd()))
2265
TextWindow
.AdvanceChar();
2276
switch (ch =
TextWindow
.PeekChar())
2279
TextWindow
.AdvanceChar();
2280
return
TextWindow
.TryAdvance('\n') ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.CarriageReturn;
2282
TextWindow
.AdvanceChar();
2287
TextWindow
.AdvanceChar();
2305
char ch =
TextWindow
.PeekChar();
2317
TextWindow
.AdvanceChar();
2334
if (
TextWindow
.Width == 1 && onlySpaces)
2340
var width =
TextWindow
.Width;
2345
TextWindow
.CharacterWindow,
2346
TextWindow
.LexemeRelativeStart,
2350
TextWindow
);
2354
return CreateWhitespaceTrivia(
TextWindow
);
2413
if (SyntaxFacts.IsWhitespace(
TextWindow
.PeekChar()))
2447
int lastLineStart =
TextWindow
.Position;
2453
char ch =
TextWindow
.PeekChar();
2457
if (!
TextWindow
.IsReallyAtEnd())
2463
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2467
if (lastLineStart <
TextWindow
.Position && !allWhitespace)
2472
TextWindow
.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line
2473
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2477
lastLineStart =
TextWindow
.Position;
2488
TextWindow
.AdvanceChar();
2520
var ch = this.
TextWindow
.PeekChar();
2526
else if (ch is SlidingTextWindow.InvalidCharacter && this.
TextWindow
.IsReallyAtEnd())
2534
this.
TextWindow
.AdvanceChar();
2579
switch (character =
TextWindow
.PeekChar())
2582
if (!
TextWindow
.IsReallyAtEnd())
2597
TextWindow
.AdvanceChar();
2602
TextWindow
.AdvanceChar();
2607
TextWindow
.AdvanceChar();
2612
TextWindow
.AdvanceChar();
2617
TextWindow
.AdvanceChar();
2622
TextWindow
.AdvanceChar();
2627
TextWindow
.AdvanceChar();
2628
if (
TextWindow
.PeekChar() == '=')
2630
TextWindow
.AdvanceChar();
2641
TextWindow
.AdvanceChar();
2642
if (
TextWindow
.PeekChar() == '=')
2644
TextWindow
.AdvanceChar();
2655
if (
TextWindow
.PeekChar(1) == '&')
2657
TextWindow
.AdvanceChar(2);
2665
if (
TextWindow
.PeekChar(1) == '|')
2667
TextWindow
.AdvanceChar(2);
2686
info.Text =
TextWindow
.GetText(true);
2730
TextWindow
.AdvanceChar();
2734
info.Text =
TextWindow
.GetText(true);
2749
var pos =
TextWindow
.Position;
2764
TextWindow
.Reset(pos);
2781
char ch =
TextWindow
.PeekChar();
2785
if (
TextWindow
.PeekChar(1) == '/')
2789
var text =
TextWindow
.GetText(false);
2835
Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) ||
TextWindow
.PeekChar() == SlidingTextWindow.InvalidCharacter);
2844
this.AddError(
TextWindow
.LexemeStartPosition,
TextWindow
.Width, ErrorCode.ERR_OpenEndedComment);
2880
switch (ch =
TextWindow
.PeekChar())
2897
if (!
TextWindow
.IsReallyAtEnd())
2923
info.StringValue = info.Text =
TextWindow
.GetText(intern: false);
2930
Debug.Assert(
TextWindow
.PeekChar() == '<');
2932
if (
TextWindow
.PeekChar(1) == '!')
2934
if (
TextWindow
.PeekChar(2) == '-'
2935
&&
TextWindow
.PeekChar(3) == '-')
2937
TextWindow
.AdvanceChar(4);
2940
else if (
TextWindow
.PeekChar(2) == '['
2941
&&
TextWindow
.PeekChar(3) == 'C'
2942
&&
TextWindow
.PeekChar(4) == 'D'
2943
&&
TextWindow
.PeekChar(5) == 'A'
2944
&&
TextWindow
.PeekChar(6) == 'T'
2945
&&
TextWindow
.PeekChar(7) == 'A'
2946
&&
TextWindow
.PeekChar(8) == '[')
2948
TextWindow
.AdvanceChar(9);
2954
TextWindow
.AdvanceChar();
2958
else if (
TextWindow
.PeekChar(1) == '/')
2960
TextWindow
.AdvanceChar(2);
2963
else if (
TextWindow
.PeekChar(1) == '?')
2965
TextWindow
.AdvanceChar(2);
2970
TextWindow
.AdvanceChar();
2979
Debug.Assert(
TextWindow
.PeekChar() == '&');
2980
TextWindow
.AdvanceChar();
2986
if (IsXmlNameStartChar(ch =
TextWindow
.PeekChar()))
2988
while (IsXmlNameChar(ch =
TextWindow
.PeekChar()))
2996
TextWindow
.AdvanceChar();
3025
TextWindow
.AdvanceChar();
3026
bool isHex =
TextWindow
.PeekChar() == 'x';
3031
TextWindow
.AdvanceChar(); // x
3032
while (SyntaxFacts.IsHexDigit(ch =
TextWindow
.PeekChar()))
3034
TextWindow
.AdvanceChar();
3045
while (SyntaxFacts.IsDecDigit(ch =
TextWindow
.PeekChar()))
3047
TextWindow
.AdvanceChar();
3057
if (
TextWindow
.PeekChar() != ';')
3102
ch =
TextWindow
.PeekChar();
3105
TextWindow
.AdvanceChar();
3119
info.Text =
TextWindow
.GetText(true);
3147
if (
TextWindow
.PeekChar() == ']' &&
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3149
TextWindow
.AdvanceChar(3);
3150
info.StringValue = info.Text =
TextWindow
.GetText(false);
3157
var ch =
TextWindow
.PeekChar();
3161
if (!
TextWindow
.IsReallyAtEnd())
3166
info.StringValue = info.Text =
TextWindow
.GetText(false);
3172
info.StringValue = info.Text =
TextWindow
.GetText(false);
3176
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3179
info.StringValue = info.Text =
TextWindow
.GetText(false);
3186
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3188
info.StringValue = info.Text =
TextWindow
.GetText(false);
3200
TextWindow
.AdvanceChar();
3247
switch (ch =
TextWindow
.PeekChar())
3254
TextWindow
.AdvanceChar();
3259
if (
TextWindow
.PeekChar(1) == '>')
3261
TextWindow
.AdvanceChar(2);
3269
TextWindow
.AdvanceChar();
3274
TextWindow
.AdvanceChar();
3279
TextWindow
.AdvanceChar();
3284
TextWindow
.AdvanceChar();
3294
if (!
TextWindow
.IsReallyAtEnd())
3303
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3326
TextWindow
.AdvanceChar();
3328
info.StringValue = info.Text =
TextWindow
.GetText(false);
3340
int start =
TextWindow
.Position;
3344
char ch =
TextWindow
.PeekChar();
3356
TextWindow
.AdvanceChar();
3364
info.Text =
TextWindow
.GetText(start,
TextWindow
.Position - start, intern: true);
3421
switch (ch =
TextWindow
.PeekChar())
3426
TextWindow
.AdvanceChar();
3436
TextWindow
.AdvanceChar();
3449
TextWindow
.AdvanceChar();
3459
if (!
TextWindow
.IsReallyAtEnd())
3486
var ch =
TextWindow
.PeekChar();
3492
info.StringValue = info.Text =
TextWindow
.GetText(false);
3501
info.StringValue = info.Text =
TextWindow
.GetText(false);
3511
info.StringValue = info.Text =
TextWindow
.GetText(false);
3515
if (!
TextWindow
.IsReallyAtEnd())
3520
info.StringValue = info.Text =
TextWindow
.GetText(false);
3524
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3527
info.StringValue = info.Text =
TextWindow
.GetText(false);
3539
TextWindow
.AdvanceChar();
3578
switch (
TextWindow
.PeekChar())
3585
if (!
TextWindow
.IsReallyAtEnd())
3593
info.Text = info.StringValue =
TextWindow
.NextChar().ToString();
3638
int beforeConsumed =
TextWindow
.Position;
3639
char consumedChar =
TextWindow
.NextChar();
3665
info.Text =
TextWindow
.GetText(intern: false);
3670
if (!
TextWindow
.IsReallyAtEnd())
3680
TextWindow
.Reset(beforeConsumed);
3685
TextWindow
.Reset(beforeConsumed);
3688
TextWindow
.Reset(beforeConsumed);
3714
Debug.Assert(
TextWindow
.Position > beforeConsumed, "First character or entity has been consumed.");
3744
if (
TextWindow
.PeekChar() == '.')
3829
string actualText =
TextWindow
.GetText(intern: false);
3842
TextWindow
.Reset(beforeConsumed);
3875
if (
TextWindow
.PeekChar() == '@')
3877
TextWindow
.NextChar();
3878
info.Text =
TextWindow
.GetText(intern: true);
3888
else if (
TextWindow
.PeekChar() == '&')
3897
char bad =
TextWindow
.NextChar();
3898
info.Text =
TextWindow
.GetText(intern: false);
3926
char peekCh =
TextWindow
.PeekChar();
3931
TextWindow
.AdvanceChar();
3937
int pos =
TextWindow
.Position;
3947
TextWindow
.Reset(pos);
4044
switch (ch =
TextWindow
.PeekChar())
4047
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4049
TextWindow
.AdvanceChar(3);
4062
if (!
TextWindow
.IsReallyAtEnd())
4088
var ch =
TextWindow
.PeekChar();
4092
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4094
info.StringValue = info.Text =
TextWindow
.GetText(false);
4102
info.StringValue = info.Text =
TextWindow
.GetText(false);
4106
if (!
TextWindow
.IsReallyAtEnd())
4111
info.StringValue = info.Text =
TextWindow
.GetText(false);
4115
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4118
info.StringValue = info.Text =
TextWindow
.GetText(false);
4130
TextWindow
.AdvanceChar();
4166
switch (ch =
TextWindow
.PeekChar())
4169
if (
TextWindow
.PeekChar(1) == '-')
4171
if (
TextWindow
.PeekChar(2) == '>')
4173
TextWindow
.AdvanceChar(3);
4179
TextWindow
.AdvanceChar(2);
4193
if (!
TextWindow
.IsReallyAtEnd())
4218
var ch =
TextWindow
.PeekChar();
4222
if (
TextWindow
.PeekChar(1) == '-')
4224
info.StringValue = info.Text =
TextWindow
.GetText(false);
4232
info.StringValue = info.Text =
TextWindow
.GetText(false);
4236
if (!
TextWindow
.IsReallyAtEnd())
4241
info.StringValue = info.Text =
TextWindow
.GetText(false);
4245
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4248
info.StringValue = info.Text =
TextWindow
.GetText(false);
4260
TextWindow
.AdvanceChar();
4297
switch (ch =
TextWindow
.PeekChar())
4300
if (
TextWindow
.PeekChar(1) == '>')
4302
TextWindow
.AdvanceChar(2);
4315
if (!
TextWindow
.IsReallyAtEnd())
4342
var ch =
TextWindow
.PeekChar();
4346
if (
TextWindow
.PeekChar(1) == '>')
4348
info.StringValue = info.Text =
TextWindow
.GetText(false);
4356
info.StringValue = info.Text =
TextWindow
.GetText(false);
4360
if (!
TextWindow
.IsReallyAtEnd())
4365
info.StringValue = info.Text =
TextWindow
.GetText(false);
4369
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4372
info.StringValue = info.Text =
TextWindow
.GetText(false);
4384
TextWindow
.AdvanceChar();
4396
var start =
TextWindow
.Position;
4405
if (
TextWindow
.PeekChar() == '/'
4406
&&
TextWindow
.PeekChar(1) == '*'
4407
&&
TextWindow
.PeekChar(2) == '*'
4408
&&
TextWindow
.PeekChar(3) != '*')
4410
TextWindow
.AdvanceChar(3);
4411
var text =
TextWindow
.GetText(true);
4426
char ch =
TextWindow
.PeekChar();
4433
TextWindow
.AdvanceChar();
4437
if (this.StyleIs(XmlDocCommentStyle.SingleLine) &&
TextWindow
.PeekChar(1) == '/' &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
4439
TextWindow
.AdvanceChar(3);
4440
var text =
TextWindow
.GetText(true);
4451
while (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) != '/')
4453
TextWindow
.AdvanceChar();
4456
var text =
TextWindow
.GetText(true);
4466
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4468
TextWindow
.AdvanceChar(2);
4495
TextWindow
.Reset(start);
4502
var text =
TextWindow
.GetText(true);
4514
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4516
TextWindow
.AdvanceChar(2);
4517
var text =
TextWindow
.GetText(true);
4530
char ch =
TextWindow
.PeekChar();
4552
char ch =
TextWindow
.PeekChar();
4571
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4597
if (
TextWindow
.PeekChar() == '\\')
4599
var ch2 =
TextWindow
.PeekChar(1);
4618
return
TextWindow
.PeekChar();
4624
int position =
TextWindow
.Position;
4630
TextWindow
.Reset(position);
4636
var ch =
TextWindow
.PeekChar();
4640
var ch2 =
TextWindow
.PeekChar(1);
4649
TextWindow
.AdvanceChar();
4663
int start =
TextWindow
.Position;
4664
char character =
TextWindow
.PeekChar();
4666
TextWindow
.AdvanceChar();
4668
character =
TextWindow
.PeekChar();
4673
TextWindow
.AdvanceChar();
4674
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4685
character =
TextWindow
.PeekChar();
4697
TextWindow
.AdvanceChar();
4718
TextWindow
.AdvanceChar();
4719
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4730
char ch2 =
TextWindow
.PeekChar();
4745
TextWindow
.AdvanceChar();
4769
Debug.Assert(
TextWindow
.PeekChar() == '&');
4772
TextWindow
.AdvanceChar();
4776
switch (
TextWindow
.PeekChar())
4779
if (
TextWindow
.AdvanceIfMatches("lt;"))
4786
if (
TextWindow
.AdvanceIfMatches("gt;"))
4793
if (
TextWindow
.AdvanceIfMatches("amp;"))
4798
else if (
TextWindow
.AdvanceIfMatches("apos;"))
4805
if (
TextWindow
.AdvanceIfMatches("quot;"))
4813
TextWindow
.AdvanceChar(); //#
4817
if (
TextWindow
.AdvanceIfMatches("x"))
4820
while (SyntaxFacts.IsHexDigit(digit =
TextWindow
.PeekChar()))
4822
TextWindow
.AdvanceChar();
4838
while (SyntaxFacts.IsDecDigit(digit =
TextWindow
.PeekChar()))
4840
TextWindow
.AdvanceChar();
4854
if (
TextWindow
.AdvanceIfMatches(";"))
4869
return new SyntaxDiagnosticInfo(start -
TextWindow
.LexemeStartPosition,
4870
TextWindow
.Position - start,
Parser\Lexer_RawStringLiteral.cs (45)
19
var start =
TextWindow
.Position;
20
while (
TextWindow
.PeekChar() == ch)
21
TextWindow
.AdvanceChar();
23
return
TextWindow
.Position - start;
45
var ch =
TextWindow
.PeekChar();
50
TextWindow
.AdvanceChar();
55
=> currentChar == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd();
68
if (SyntaxFacts.IsNewLine(
TextWindow
.PeekChar()))
90
var afterStartDelimiter =
TextWindow
.LexemeStartPosition + startingQuoteCount;
91
var valueLength =
TextWindow
.Position - afterStartDelimiter;
93
info.StringValue =
TextWindow
.GetText(
123
info.Text =
TextWindow
.GetText(intern: true);
132
var currentChar =
TextWindow
.PeekChar();
137
this.AddError(
TextWindow
.Position, width:
TextWindow
.GetNewLineWidth(), ErrorCode.ERR_UnterminatedRawString);
142
this.AddError(
TextWindow
.Position, width: 0, ErrorCode.ERR_UnterminatedRawString);
149
TextWindow
.AdvanceChar();
153
var beforeEndDelimiter =
TextWindow
.Position;
166
position:
TextWindow
.Position - excessQuoteCount,
172
var afterStartDelimiter =
TextWindow
.LexemeStartPosition + startingQuoteCount;
175
info.StringValue =
TextWindow
.GetText(
196
var afterStartDelimiter =
TextWindow
.Position;
197
Debug.Assert(SyntaxFacts.IsNewLine(
TextWindow
.PeekChar()));
211
position:
TextWindow
.Position - startingQuoteCount,
222
var tokenEnd =
TextWindow
.Position;
223
TextWindow
.Reset(afterStartDelimiter);
224
Debug.Assert(SyntaxFacts.IsNewLine(
TextWindow
.PeekChar()));
238
info.StringValue = this.HasErrors ? "" :
TextWindow
.Intern(_builder);
242
TextWindow
.Reset(tokenEnd);
254
TextWindow
.AdvancePastNewLine();
269
position:
TextWindow
.Position - excessQuoteCount,
282
var currentChar =
TextWindow
.PeekChar();
285
this.AddError(
TextWindow
.Position, width: 0, ErrorCode.ERR_UnterminatedRawString);
299
position:
TextWindow
.Position - currentQuoteCount,
307
TextWindow
.AdvanceChar();
317
Debug.Assert(SyntaxFacts.IsNewLine(
TextWindow
.PeekChar()));
319
var newLineWidth =
TextWindow
.GetNewLineWidth();
324
_builder.Append(
TextWindow
.PeekChar());
326
TextWindow
.AdvanceChar();
329
var lineStartPosition =
TextWindow
.Position;
341
var isBlankLine = SyntaxFacts.IsNewLine(
TextWindow
.PeekChar());
352
width:
TextWindow
.Position - lineStartPosition,
360
width:
TextWindow
.Position - lineStartPosition,
380
var currentChar =
TextWindow
.PeekChar();
386
TextWindow
.AdvanceChar();
Parser\Lexer_StringLiteral.cs (119)
16
var quoteCharacter =
TextWindow
.PeekChar();
19
if (
TextWindow
.PeekChar() == '"' &&
20
TextWindow
.PeekChar(1) == '"' &&
21
TextWindow
.PeekChar(2) == '"')
35
TextWindow
.AdvanceChar();
40
char ch =
TextWindow
.PeekChar();
54
TextWindow
.AdvanceChar();
58
(ch == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd()))
63
Debug.Assert(
TextWindow
.Width > 0);
69
TextWindow
.AdvanceChar();
76
info.Text =
TextWindow
.GetText(intern: true);
85
info.StringValue =
TextWindow
.Intern(_builder);
105
info.Text =
TextWindow
.GetText(intern: true);
109
info.StringValue =
TextWindow
.Intern(_builder);
120
if (
TextWindow
.PeekChar() is ('u' or 'U') &&
TextWindow
.PeekChar(1) == '8')
122
TextWindow
.AdvanceChar(2);
131
var start =
TextWindow
.Position;
133
char ch =
TextWindow
.NextChar();
136
ch =
TextWindow
.NextChar();
157
this.AddError(start,
TextWindow
.Position - start, info.Code, info.Arguments);
179
TextWindow
.Reset(start);
185
this.AddError(start,
TextWindow
.Position - start, ErrorCode.ERR_IllegalEscape);
194
Debug.Assert(
TextWindow
.PeekChar() == '@');
197
var start =
TextWindow
.Position;
198
while (
TextWindow
.PeekChar() == '@')
200
TextWindow
.AdvanceChar();
203
if (
TextWindow
.Position - start >= 2)
205
this.AddError(start, width:
TextWindow
.Position - start, ErrorCode.ERR_IllegalAtSequence);
208
Debug.Assert(
TextWindow
.PeekChar() == '"');
209
TextWindow
.AdvanceChar();
213
var ch =
TextWindow
.PeekChar();
216
TextWindow
.AdvanceChar();
217
if (
TextWindow
.PeekChar() == '"')
220
TextWindow
.AdvanceChar();
229
if (ch == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd())
237
TextWindow
.AdvanceChar();
250
info.Text =
TextWindow
.GetText(intern: false);
293
info.Text =
TextWindow
.GetText(intern: false);
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
;
510
var closeQuotePosition = _lexer.
TextWindow
.Position;
524
closeQuoteRange = closeQuotePosition.._lexer.
TextWindow
.Position;
531
if (_lexer.
TextWindow
.PeekChar() != '"')
538
IsAtEnd(allowNewline: true) ? _lexer.
TextWindow
.Position - 1 : _lexer.
TextWindow
.Position,
544
_lexer.
TextWindow
.AdvanceChar(); // "
554
if (_lexer.
TextWindow
.PeekChar() != '"')
561
IsAtEnd(allowNewline: true) ? _lexer.
TextWindow
.Position - 1 : _lexer.
TextWindow
.Position,
579
position: _lexer.
TextWindow
.Position - excessQuoteCount,
596
_lexer.
TextWindow
.Position - 1, width: 1, ErrorCode.ERR_UnterminatedRawString));
598
else if (_lexer.
TextWindow
.PeekChar() == '"')
607
position: _lexer.
TextWindow
.Position - closeQuoteCount,
613
_lexer.
TextWindow
.AdvancePastNewLine();
626
position: _lexer.
TextWindow
.Position - excessQuoteCount,
658
switch (_lexer.
TextWindow
.PeekChar())
678
var escapeStart = _lexer.
TextWindow
.Position;
682
TrySetError(_lexer.MakeError(escapeStart, _lexer.
TextWindow
.Position - escapeStart, ErrorCode.ERR_EscapedCurly, ch));
687
_lexer.
TextWindow
.AdvanceChar();
694
_lexer.
TextWindow
.AdvanceChar();
705
var beforeQuotesPosition = _lexer.
TextWindow
.Position;
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();
735
_lexer.
TextWindow
.Reset(startPosition);
771
if (_lexer.
TextWindow
.PeekChar(1) != '"')
777
_lexer.
TextWindow
.AdvanceChar(2); // ""
783
var beforeQuotePosition = _lexer.
TextWindow
.Position;
790
_lexer.
TextWindow
.Reset(beforeQuotePosition);
803
var pos = _lexer.
TextWindow
.Position;
804
_lexer.
TextWindow
.AdvanceChar(); // }
807
if (_lexer.
TextWindow
.PeekChar() == '}')
809
_lexer.
TextWindow
.AdvanceChar(); // }
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();
873
new Range(closeBracePosition, _lexer.
TextWindow
.Position)));
886
var beforeOpenBracesPosition = _lexer.
TextWindow
.Position;
894
var afterOpenBracePosition = _lexer.
TextWindow
.Position;
908
var beforeCloseBracePosition = _lexer.
TextWindow
.Position;
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;
970
if (kind is InterpolatedStringKind.Verbatim && _lexer.
TextWindow
.PeekChar(1) == '"')
972
_lexer.
TextWindow
.AdvanceChar(2); // ""
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();
1040
colonRange = new Range(_lexer.
TextWindow
.Position, _lexer.
TextWindow
.Position + 1);
1054
TrySetError(_lexer.MakeError(_lexer.
TextWindow
.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
1080
if (_lexer.
TextWindow
.PeekChar(1) == '*')
1092
switch (_lexer.
TextWindow
.PeekChar(1))
1101
_lexer.
TextWindow
.AdvanceChar();
1118
_lexer.
TextWindow
.AdvanceChar();
1139
Debug.Assert(start == _lexer.
TextWindow
.PeekChar());
1140
_lexer.
TextWindow
.AdvanceChar();
1142
if (_lexer.
TextWindow
.PeekChar() == end)
1144
_lexer.
TextWindow
.AdvanceChar();
Parser\QuickScanner.cs (13)
196
int i =
TextWindow
.Offset;
197
int n =
TextWindow
.CharacterWindowCount;
203
var charWindow =
TextWindow
.CharacterWindow;
231
TextWindow
.AdvanceChar(i -
TextWindow
.Offset);
238
TextWindow
.CharacterWindow,
239
TextWindow
.LexemeRelativeStart,
240
i -
TextWindow
.LexemeRelativeStart,
248
TextWindow
.Reset(
TextWindow
.LexemeStartPosition);
256
var quickWidth = lexer.
TextWindow
.Width;
258
lexer.
TextWindow
.Reset(lexer.
TextWindow
.LexemeStartPosition);
Parser\SyntaxParser.cs (1)
141
var size = Math.Min(CachedTokenArraySize, this.lexer.
TextWindow
.Text.Length / 2);
Syntax\SyntaxTokenParser.cs (5)
54
var startingPosition = _lexer.
TextWindow
.Position;
68
var startingPosition = _lexer.
TextWindow
.Position;
83
var startingPosition = _lexer.
TextWindow
.Position;
96
if (position < _lexer.
TextWindow
.Position)
99
_lexer.
TextWindow
.Reset(position);