1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21
this.
TextWindow
= new SlidingTextWindow(text);
672 references to TextWindow
Microsoft.CodeAnalysis.CSharp (672)
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 (480)
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();
2561
switch (character =
TextWindow
.PeekChar())
2564
if (!
TextWindow
.IsReallyAtEnd())
2579
TextWindow
.AdvanceChar();
2584
TextWindow
.AdvanceChar();
2589
TextWindow
.AdvanceChar();
2594
TextWindow
.AdvanceChar();
2599
TextWindow
.AdvanceChar();
2604
TextWindow
.AdvanceChar();
2605
if (
TextWindow
.PeekChar() == '=')
2607
TextWindow
.AdvanceChar();
2618
TextWindow
.AdvanceChar();
2619
if (
TextWindow
.PeekChar() == '=')
2621
TextWindow
.AdvanceChar();
2632
if (
TextWindow
.PeekChar(1) == '&')
2634
TextWindow
.AdvanceChar(2);
2642
if (
TextWindow
.PeekChar(1) == '|')
2644
TextWindow
.AdvanceChar(2);
2663
info.Text =
TextWindow
.GetText(true);
2707
TextWindow
.AdvanceChar();
2711
info.Text =
TextWindow
.GetText(true);
2726
var pos =
TextWindow
.Position;
2741
TextWindow
.Reset(pos);
2758
char ch =
TextWindow
.PeekChar();
2762
if (
TextWindow
.PeekChar(1) == '/')
2766
var text =
TextWindow
.GetText(false);
2812
Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) ||
TextWindow
.PeekChar() == SlidingTextWindow.InvalidCharacter);
2821
this.AddError(
TextWindow
.LexemeStartPosition,
TextWindow
.Width, ErrorCode.ERR_OpenEndedComment);
2857
switch (ch =
TextWindow
.PeekChar())
2874
if (!
TextWindow
.IsReallyAtEnd())
2900
info.StringValue = info.Text =
TextWindow
.GetText(intern: false);
2907
Debug.Assert(
TextWindow
.PeekChar() == '<');
2909
if (
TextWindow
.PeekChar(1) == '!')
2911
if (
TextWindow
.PeekChar(2) == '-'
2912
&&
TextWindow
.PeekChar(3) == '-')
2914
TextWindow
.AdvanceChar(4);
2917
else if (
TextWindow
.PeekChar(2) == '['
2918
&&
TextWindow
.PeekChar(3) == 'C'
2919
&&
TextWindow
.PeekChar(4) == 'D'
2920
&&
TextWindow
.PeekChar(5) == 'A'
2921
&&
TextWindow
.PeekChar(6) == 'T'
2922
&&
TextWindow
.PeekChar(7) == 'A'
2923
&&
TextWindow
.PeekChar(8) == '[')
2925
TextWindow
.AdvanceChar(9);
2931
TextWindow
.AdvanceChar();
2935
else if (
TextWindow
.PeekChar(1) == '/')
2937
TextWindow
.AdvanceChar(2);
2940
else if (
TextWindow
.PeekChar(1) == '?')
2942
TextWindow
.AdvanceChar(2);
2947
TextWindow
.AdvanceChar();
2956
Debug.Assert(
TextWindow
.PeekChar() == '&');
2957
TextWindow
.AdvanceChar();
2963
if (IsXmlNameStartChar(ch =
TextWindow
.PeekChar()))
2965
while (IsXmlNameChar(ch =
TextWindow
.PeekChar()))
2973
TextWindow
.AdvanceChar();
3002
TextWindow
.AdvanceChar();
3003
bool isHex =
TextWindow
.PeekChar() == 'x';
3008
TextWindow
.AdvanceChar(); // x
3009
while (SyntaxFacts.IsHexDigit(ch =
TextWindow
.PeekChar()))
3011
TextWindow
.AdvanceChar();
3022
while (SyntaxFacts.IsDecDigit(ch =
TextWindow
.PeekChar()))
3024
TextWindow
.AdvanceChar();
3034
if (
TextWindow
.PeekChar() != ';')
3079
ch =
TextWindow
.PeekChar();
3082
TextWindow
.AdvanceChar();
3096
info.Text =
TextWindow
.GetText(true);
3124
if (
TextWindow
.PeekChar() == ']' &&
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3126
TextWindow
.AdvanceChar(3);
3127
info.StringValue = info.Text =
TextWindow
.GetText(false);
3134
var ch =
TextWindow
.PeekChar();
3138
if (!
TextWindow
.IsReallyAtEnd())
3143
info.StringValue = info.Text =
TextWindow
.GetText(false);
3149
info.StringValue = info.Text =
TextWindow
.GetText(false);
3153
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3156
info.StringValue = info.Text =
TextWindow
.GetText(false);
3163
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3165
info.StringValue = info.Text =
TextWindow
.GetText(false);
3177
TextWindow
.AdvanceChar();
3224
switch (ch =
TextWindow
.PeekChar())
3231
TextWindow
.AdvanceChar();
3236
if (
TextWindow
.PeekChar(1) == '>')
3238
TextWindow
.AdvanceChar(2);
3246
TextWindow
.AdvanceChar();
3251
TextWindow
.AdvanceChar();
3256
TextWindow
.AdvanceChar();
3261
TextWindow
.AdvanceChar();
3271
if (!
TextWindow
.IsReallyAtEnd())
3280
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3303
TextWindow
.AdvanceChar();
3305
info.StringValue = info.Text =
TextWindow
.GetText(false);
3317
int start =
TextWindow
.Position;
3321
char ch =
TextWindow
.PeekChar();
3333
TextWindow
.AdvanceChar();
3341
info.Text =
TextWindow
.GetText(start,
TextWindow
.Position - start, intern: true);
3398
switch (ch =
TextWindow
.PeekChar())
3403
TextWindow
.AdvanceChar();
3413
TextWindow
.AdvanceChar();
3426
TextWindow
.AdvanceChar();
3436
if (!
TextWindow
.IsReallyAtEnd())
3463
var ch =
TextWindow
.PeekChar();
3469
info.StringValue = info.Text =
TextWindow
.GetText(false);
3478
info.StringValue = info.Text =
TextWindow
.GetText(false);
3488
info.StringValue = info.Text =
TextWindow
.GetText(false);
3492
if (!
TextWindow
.IsReallyAtEnd())
3497
info.StringValue = info.Text =
TextWindow
.GetText(false);
3501
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3504
info.StringValue = info.Text =
TextWindow
.GetText(false);
3516
TextWindow
.AdvanceChar();
3555
switch (
TextWindow
.PeekChar())
3562
if (!
TextWindow
.IsReallyAtEnd())
3570
info.Text = info.StringValue =
TextWindow
.NextChar().ToString();
3615
int beforeConsumed =
TextWindow
.Position;
3616
char consumedChar =
TextWindow
.NextChar();
3642
info.Text =
TextWindow
.GetText(intern: false);
3647
if (!
TextWindow
.IsReallyAtEnd())
3657
TextWindow
.Reset(beforeConsumed);
3662
TextWindow
.Reset(beforeConsumed);
3665
TextWindow
.Reset(beforeConsumed);
3691
Debug.Assert(
TextWindow
.Position > beforeConsumed, "First character or entity has been consumed.");
3721
if (
TextWindow
.PeekChar() == '.')
3806
string actualText =
TextWindow
.GetText(intern: false);
3819
TextWindow
.Reset(beforeConsumed);
3852
if (
TextWindow
.PeekChar() == '@')
3854
TextWindow
.NextChar();
3855
info.Text =
TextWindow
.GetText(intern: true);
3865
else if (
TextWindow
.PeekChar() == '&')
3874
char bad =
TextWindow
.NextChar();
3875
info.Text =
TextWindow
.GetText(intern: false);
3903
char peekCh =
TextWindow
.PeekChar();
3908
TextWindow
.AdvanceChar();
3914
int pos =
TextWindow
.Position;
3924
TextWindow
.Reset(pos);
4021
switch (ch =
TextWindow
.PeekChar())
4024
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4026
TextWindow
.AdvanceChar(3);
4039
if (!
TextWindow
.IsReallyAtEnd())
4065
var ch =
TextWindow
.PeekChar();
4069
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4071
info.StringValue = info.Text =
TextWindow
.GetText(false);
4079
info.StringValue = info.Text =
TextWindow
.GetText(false);
4083
if (!
TextWindow
.IsReallyAtEnd())
4088
info.StringValue = info.Text =
TextWindow
.GetText(false);
4092
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4095
info.StringValue = info.Text =
TextWindow
.GetText(false);
4107
TextWindow
.AdvanceChar();
4143
switch (ch =
TextWindow
.PeekChar())
4146
if (
TextWindow
.PeekChar(1) == '-')
4148
if (
TextWindow
.PeekChar(2) == '>')
4150
TextWindow
.AdvanceChar(3);
4156
TextWindow
.AdvanceChar(2);
4170
if (!
TextWindow
.IsReallyAtEnd())
4195
var ch =
TextWindow
.PeekChar();
4199
if (
TextWindow
.PeekChar(1) == '-')
4201
info.StringValue = info.Text =
TextWindow
.GetText(false);
4209
info.StringValue = info.Text =
TextWindow
.GetText(false);
4213
if (!
TextWindow
.IsReallyAtEnd())
4218
info.StringValue = info.Text =
TextWindow
.GetText(false);
4222
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4225
info.StringValue = info.Text =
TextWindow
.GetText(false);
4237
TextWindow
.AdvanceChar();
4274
switch (ch =
TextWindow
.PeekChar())
4277
if (
TextWindow
.PeekChar(1) == '>')
4279
TextWindow
.AdvanceChar(2);
4292
if (!
TextWindow
.IsReallyAtEnd())
4319
var ch =
TextWindow
.PeekChar();
4323
if (
TextWindow
.PeekChar(1) == '>')
4325
info.StringValue = info.Text =
TextWindow
.GetText(false);
4333
info.StringValue = info.Text =
TextWindow
.GetText(false);
4337
if (!
TextWindow
.IsReallyAtEnd())
4342
info.StringValue = info.Text =
TextWindow
.GetText(false);
4346
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4349
info.StringValue = info.Text =
TextWindow
.GetText(false);
4361
TextWindow
.AdvanceChar();
4373
var start =
TextWindow
.Position;
4382
if (
TextWindow
.PeekChar() == '/'
4383
&&
TextWindow
.PeekChar(1) == '*'
4384
&&
TextWindow
.PeekChar(2) == '*'
4385
&&
TextWindow
.PeekChar(3) != '*')
4387
TextWindow
.AdvanceChar(3);
4388
var text =
TextWindow
.GetText(true);
4403
char ch =
TextWindow
.PeekChar();
4410
TextWindow
.AdvanceChar();
4414
if (this.StyleIs(XmlDocCommentStyle.SingleLine) &&
TextWindow
.PeekChar(1) == '/' &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
4416
TextWindow
.AdvanceChar(3);
4417
var text =
TextWindow
.GetText(true);
4428
while (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) != '/')
4430
TextWindow
.AdvanceChar();
4433
var text =
TextWindow
.GetText(true);
4443
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4445
TextWindow
.AdvanceChar(2);
4472
TextWindow
.Reset(start);
4479
var text =
TextWindow
.GetText(true);
4491
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4493
TextWindow
.AdvanceChar(2);
4494
var text =
TextWindow
.GetText(true);
4507
char ch =
TextWindow
.PeekChar();
4529
char ch =
TextWindow
.PeekChar();
4548
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4574
if (
TextWindow
.PeekChar() == '\\')
4576
var ch2 =
TextWindow
.PeekChar(1);
4595
return
TextWindow
.PeekChar();
4601
int position =
TextWindow
.Position;
4607
TextWindow
.Reset(position);
4613
var ch =
TextWindow
.PeekChar();
4617
var ch2 =
TextWindow
.PeekChar(1);
4626
TextWindow
.AdvanceChar();
4640
int start =
TextWindow
.Position;
4641
char character =
TextWindow
.PeekChar();
4643
TextWindow
.AdvanceChar();
4645
character =
TextWindow
.PeekChar();
4650
TextWindow
.AdvanceChar();
4651
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4662
character =
TextWindow
.PeekChar();
4674
TextWindow
.AdvanceChar();
4695
TextWindow
.AdvanceChar();
4696
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4707
char ch2 =
TextWindow
.PeekChar();
4722
TextWindow
.AdvanceChar();
4746
Debug.Assert(
TextWindow
.PeekChar() == '&');
4749
TextWindow
.AdvanceChar();
4753
switch (
TextWindow
.PeekChar())
4756
if (
TextWindow
.AdvanceIfMatches("lt;"))
4763
if (
TextWindow
.AdvanceIfMatches("gt;"))
4770
if (
TextWindow
.AdvanceIfMatches("amp;"))
4775
else if (
TextWindow
.AdvanceIfMatches("apos;"))
4782
if (
TextWindow
.AdvanceIfMatches("quot;"))
4790
TextWindow
.AdvanceChar(); //#
4794
if (
TextWindow
.AdvanceIfMatches("x"))
4797
while (SyntaxFacts.IsHexDigit(digit =
TextWindow
.PeekChar()))
4799
TextWindow
.AdvanceChar();
4815
while (SyntaxFacts.IsDecDigit(digit =
TextWindow
.PeekChar()))
4817
TextWindow
.AdvanceChar();
4831
if (
TextWindow
.AdvanceIfMatches(";"))
4846
return new SyntaxDiagnosticInfo(start -
TextWindow
.LexemeStartPosition,
4847
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);