1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21
this.
TextWindow
= new SlidingTextWindow(text);
669 references to TextWindow
Microsoft.CodeAnalysis.CSharp (669)
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)
37
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 (477)
164
this.
TextWindow
.Reset(position);
306
this.LexSyntaxTrivia(afterFirstToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
325
this.LexSyntaxTrivia(afterFirstToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
445
int startingPosition =
TextWindow
.Position;
448
character =
TextWindow
.PeekChar();
457
TextWindow
.AdvanceChar();
458
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.SlashEqualsToken : SyntaxKind.SlashToken;
462
if (this.
TextWindow
.PeekChar(1) is >= '0' and <= '9')
464
var atDotPosition = this.
TextWindow
.Position;
466
atDotPosition == this.
TextWindow
.LexemeStartPosition)
475
this.
TextWindow
.Reset(atDotPosition - 1);
476
var priorCharacterIsDot = this.
TextWindow
.PeekChar() is '.';
477
this.
TextWindow
.Reset(atDotPosition);
482
TextWindow
.AdvanceChar();
493
TextWindow
.AdvanceChar();
500
TextWindow
.AdvanceChar();
505
TextWindow
.AdvanceChar();
506
info.Kind =
TextWindow
.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken;
510
TextWindow
.AdvanceChar();
515
TextWindow
.AdvanceChar();
520
TextWindow
.AdvanceChar();
521
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken;
525
TextWindow
.AdvanceChar();
527
TextWindow
.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken :
528
TextWindow
.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken;
532
TextWindow
.AdvanceChar();
533
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken;
537
TextWindow
.AdvanceChar();
542
TextWindow
.AdvanceChar();
547
TextWindow
.AdvanceChar();
552
TextWindow
.AdvanceChar();
557
TextWindow
.AdvanceChar();
562
TextWindow
.AdvanceChar();
567
TextWindow
.AdvanceChar();
568
info.Kind =
TextWindow
.TryAdvance('?')
569
?
TextWindow
.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken
574
TextWindow
.AdvanceChar();
576
TextWindow
.TryAdvance('=') ? SyntaxKind.PlusEqualsToken :
577
TextWindow
.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken;
581
TextWindow
.AdvanceChar();
583
TextWindow
.TryAdvance('=') ? SyntaxKind.MinusEqualsToken :
584
TextWindow
.TryAdvance('-') ? SyntaxKind.MinusMinusToken :
585
TextWindow
.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken;
589
TextWindow
.AdvanceChar();
590
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken;
594
TextWindow
.AdvanceChar();
596
TextWindow
.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken :
597
TextWindow
.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken;
601
TextWindow
.AdvanceChar();
602
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken;
606
TextWindow
.AdvanceChar();
608
TextWindow
.TryAdvance('=') ? SyntaxKind.BarEqualsToken :
609
TextWindow
.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken;
613
TextWindow
.AdvanceChar();
615
TextWindow
.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken :
616
TextWindow
.TryAdvance('<')
617
?
TextWindow
.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken
622
TextWindow
.AdvanceChar();
623
info.Kind =
TextWindow
.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken;
630
Debug.Assert(
TextWindow
.PeekChar() == '@');
632
if (
TextWindow
.PeekChar(1) == ':')
637
this.AddError(
TextWindow
.Position + 1, width: 1, ErrorCode.ERR_ExpectedVerbatimLiteral);
640
info.Text =
TextWindow
.GetText(false);
645
info.Text =
TextWindow
.GetText(intern: true);
686
if (!
TextWindow
.IsReallyAtEnd())
717
TextWindow
.AdvanceChar();
722
if (char.IsHighSurrogate(character) && char.IsLowSurrogate(
TextWindow
.PeekChar()))
723
TextWindow
.AdvanceChar();
731
info.Text =
TextWindow
.GetText(intern: true);
735
int end =
TextWindow
.Text.Length;
736
info.Text =
TextWindow
.Text.ToString(TextSpan.FromBounds(startingPosition, end));
737
TextWindow
.Reset(end);
754
Debug.Assert(
TextWindow
.PeekChar() == '@');
757
while (
TextWindow
.PeekChar(index) == '@')
762
if (
TextWindow
.PeekChar(index) == '"')
768
else if (
TextWindow
.PeekChar(index) == '$')
780
Debug.Assert(
TextWindow
.PeekChar() == '$');
782
if (
TextWindow
.PeekChar(1) is '$' or '@' or '"')
807
int start =
TextWindow
.Position;
808
while (
TextWindow
.PeekChar() is >= '0' and <= '9')
810
TextWindow
.AdvanceChar();
813
return start <
TextWindow
.Position;
819
if (
TextWindow
.PeekChar() == '_')
834
char ch =
TextWindow
.PeekChar();
851
TextWindow
.AdvanceChar();
862
int start =
TextWindow
.Position;
877
ch =
TextWindow
.PeekChar();
880
ch =
TextWindow
.PeekChar(1);
883
TextWindow
.AdvanceChar(2);
889
TextWindow
.AdvanceChar(2);
900
if (
TextWindow
.PeekChar() is 'L' or 'l')
902
TextWindow
.AdvanceChar();
904
if (
TextWindow
.PeekChar() is 'u' or 'U')
906
TextWindow
.AdvanceChar();
910
else if (
TextWindow
.PeekChar() is 'u' or 'U')
912
TextWindow
.AdvanceChar();
914
if (
TextWindow
.PeekChar() is 'L' or 'l')
916
TextWindow
.AdvanceChar();
925
if (this.ModeIs(LexerMode.DebuggerSyntax) &&
TextWindow
.PeekChar() == '#')
928
TextWindow
.AdvanceChar();
929
info.StringValue = info.Text =
TextWindow
.GetText(intern: true);
935
if ((ch =
TextWindow
.PeekChar()) == '.')
937
var ch2 =
TextWindow
.PeekChar(1);
942
TextWindow
.AdvanceChar();
949
TextWindow
.Reset(start);
954
if ((ch =
TextWindow
.PeekChar()) is 'E' or 'e')
957
TextWindow
.AdvanceChar();
959
if ((ch =
TextWindow
.PeekChar()) is '-' or '+')
962
TextWindow
.AdvanceChar();
965
if (!(((ch =
TextWindow
.PeekChar()) >= '0' && ch <= '9') || ch == '_'))
978
ch =
TextWindow
.PeekChar();
983
TextWindow
.AdvanceChar();
988
TextWindow
.AdvanceChar();
993
TextWindow
.AdvanceChar();
1003
TextWindow
.AdvanceChar();
1008
TextWindow
.AdvanceChar();
1013
TextWindow
.AdvanceChar();
1018
TextWindow
.AdvanceChar();
1020
if (
TextWindow
.PeekChar() is 'u' or 'U')
1022
TextWindow
.AdvanceChar();
1029
TextWindow
.AdvanceChar();
1030
if (
TextWindow
.PeekChar() is 'L' or 'l')
1032
TextWindow
.AdvanceChar();
1040
this.AddError(MakeError(start,
TextWindow
.Position - start, ErrorCode.ERR_InvalidNumber));
1052
info.Text =
TextWindow
.GetText(true);
1054
var valueText =
TextWindow
.Intern(_builder);
1065
info.DecimalValue = this.GetValueDecimal(valueText, start,
TextWindow
.Position);
1345
var currentOffset =
TextWindow
.Offset;
1346
var characterWindow =
TextWindow
.CharacterWindow;
1347
var characterWindowCount =
TextWindow
.CharacterWindowCount;
1410
TextWindow
.AdvanceChar(length);
1411
info.Text = info.StringValue =
TextWindow
.Intern(characterWindow, startOffset, length);
1443
int start =
TextWindow
.Position;
1446
while (
TextWindow
.PeekChar() == '@')
1448
TextWindow
.AdvanceChar();
1451
var atCount =
TextWindow
.Position - start;
1459
char ch =
TextWindow
.PeekChar();
1482
if (!
TextWindow
.IsReallyAtEnd())
1502
(char.ToLower(
TextWindow
.PeekChar(1)) == 'x'))
1536
if (_identLen == 0 && this.ModeIs(LexerMode.DebuggerSyntax) &&
TextWindow
.PeekChar(1) == '>')
1539
TextWindow
.AdvanceChar(2);
1566
TextWindow
.AdvanceChar();
1590
TextWindow
.AdvanceChar();
1601
var width =
TextWindow
.Width; // exact size of input characters
1604
info.Text =
TextWindow
.GetInternedText();
1613
info.StringValue =
TextWindow
.Intern(_identBuffer, 0, _identLen);
1621
var valueText =
TextWindow
.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset);
1642
TextWindow
.Reset(start);
1658
int start =
TextWindow
.Position;
1677
int beforeConsumed =
TextWindow
.Position;
1681
if (
TextWindow
.PeekChar() == '&')
1686
TextWindow
.Reset(beforeConsumed);
1692
consumedChar =
TextWindow
.NextChar();
1712
if (!isEscaped && (
TextWindow
.Position == beforeConsumed + 1) &&
1713
TextWindow
.PeekChar() is 'u' or 'U')
1719
TextWindow
.Reset(beforeConsumed);
1741
TextWindow
.Reset(beforeConsumed);
1759
TextWindow
.Reset(beforeConsumed);
1762
if (!
TextWindow
.IsReallyAtEnd())
1767
TextWindow
.Reset(beforeConsumed);
1789
TextWindow
.Reset(beforeConsumed);
1810
var width =
TextWindow
.Width; // exact size of input characters
1815
info.StringValue =
TextWindow
.GetInternedText();
1820
info.StringValue =
TextWindow
.Intern(_identBuffer, 0, _identLen);
1821
info.Text =
TextWindow
.GetText(intern: false);
1830
TextWindow
.Reset(start);
1899
char ch =
TextWindow
.PeekChar();
1927
if ((ch =
TextWindow
.PeekChar(1)) == '/')
1929
if (!this.SuppressDocumentationCommentParse &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
1949
if (!this.SuppressDocumentationCommentParse &&
TextWindow
.PeekChar(2) == '*' &&
1950
TextWindow
.PeekChar(3) != '*' &&
TextWindow
.PeekChar(3) != '/')
1971
if ((ch =
TextWindow
.PeekChar(1)) == '*')
1974
this.AddError(
TextWindow
.Position, width: 1, ErrorCode.ERR_UnexpectedCharacter, '@');
2034
var text =
TextWindow
.GetText(false);
2048
var text =
TextWindow
.GetText(false);
2059
var position =
TextWindow
.Position;
2060
var text =
TextWindow
.Text;
2093
this.AddError(
TextWindow
.Position, s_conflictMarkerLength,
2096
var startCh = this.
TextWindow
.PeekChar();
2122
var ch = this.
TextWindow
.PeekChar();
2141
this.
TextWindow
.AdvanceChar();
2144
if (this.
TextWindow
.Width > 0)
2146
this.AddTrivia(SyntaxFactory.DisabledText(
TextWindow
.GetText(false)), ref triviaList);
2160
while (SyntaxFacts.IsNewLine(this.
TextWindow
.PeekChar()))
2162
this.
TextWindow
.AdvanceChar();
2165
if (this.
TextWindow
.Width > 0)
2167
this.AddTrivia(SyntaxFactory.EndOfLine(
TextWindow
.GetText(false)), ref triviaList);
2175
var ch = this.
TextWindow
.PeekChar();
2181
this.
TextWindow
.AdvanceChar();
2184
this.AddTrivia(SyntaxFactory.ConflictMarker(
TextWindow
.GetText(false)), ref triviaList);
2205
Debug.Assert(
TextWindow
.PeekChar() == delimiter &&
TextWindow
.PeekChar(1) == '*');
2206
TextWindow
.AdvanceChar(2);
2211
if ((ch =
TextWindow
.PeekChar()) == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd())
2216
else if (ch == '*' &&
TextWindow
.PeekChar(1) == delimiter)
2218
TextWindow
.AdvanceChar(2);
2224
TextWindow
.AdvanceChar();
2232
while (!SyntaxFacts.IsNewLine(ch =
TextWindow
.PeekChar()) &&
2233
(ch != SlidingTextWindow.InvalidCharacter || !
TextWindow
.IsReallyAtEnd()))
2235
TextWindow
.AdvanceChar();
2246
switch (ch =
TextWindow
.PeekChar())
2249
TextWindow
.AdvanceChar();
2250
return
TextWindow
.TryAdvance('\n') ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.CarriageReturn;
2252
TextWindow
.AdvanceChar();
2257
TextWindow
.AdvanceChar();
2275
char ch =
TextWindow
.PeekChar();
2287
TextWindow
.AdvanceChar();
2304
if (
TextWindow
.Width == 1 && onlySpaces)
2310
var width =
TextWindow
.Width;
2315
TextWindow
.CharacterWindow,
2316
TextWindow
.LexemeRelativeStart,
2320
TextWindow
);
2324
return CreateWhitespaceTrivia(
TextWindow
);
2385
if (SyntaxFacts.IsWhitespace(
TextWindow
.PeekChar()))
2410
int lastLineStart =
TextWindow
.Position;
2416
char ch =
TextWindow
.PeekChar();
2420
if (!
TextWindow
.IsReallyAtEnd())
2426
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2430
if (lastLineStart <
TextWindow
.Position && !allWhitespace)
2435
TextWindow
.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line
2436
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2440
lastLineStart =
TextWindow
.Position;
2451
TextWindow
.AdvanceChar();
2483
var ch = this.
TextWindow
.PeekChar();
2489
else if (ch is SlidingTextWindow.InvalidCharacter && this.
TextWindow
.IsReallyAtEnd())
2497
this.
TextWindow
.AdvanceChar();
2524
switch (character =
TextWindow
.PeekChar())
2527
if (!
TextWindow
.IsReallyAtEnd())
2542
TextWindow
.AdvanceChar();
2547
TextWindow
.AdvanceChar();
2552
TextWindow
.AdvanceChar();
2557
TextWindow
.AdvanceChar();
2562
TextWindow
.AdvanceChar();
2567
TextWindow
.AdvanceChar();
2568
if (
TextWindow
.PeekChar() == '=')
2570
TextWindow
.AdvanceChar();
2581
TextWindow
.AdvanceChar();
2582
if (
TextWindow
.PeekChar() == '=')
2584
TextWindow
.AdvanceChar();
2595
if (
TextWindow
.PeekChar(1) == '&')
2597
TextWindow
.AdvanceChar(2);
2605
if (
TextWindow
.PeekChar(1) == '|')
2607
TextWindow
.AdvanceChar(2);
2626
info.Text =
TextWindow
.GetText(true);
2670
TextWindow
.AdvanceChar();
2674
info.Text =
TextWindow
.GetText(true);
2689
var pos =
TextWindow
.Position;
2704
TextWindow
.Reset(pos);
2721
char ch =
TextWindow
.PeekChar();
2725
if (
TextWindow
.PeekChar(1) == '/')
2729
var text =
TextWindow
.GetText(false);
2775
Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) ||
TextWindow
.PeekChar() == SlidingTextWindow.InvalidCharacter);
2784
this.AddError(
TextWindow
.LexemeStartPosition,
TextWindow
.Width, ErrorCode.ERR_OpenEndedComment);
2820
switch (ch =
TextWindow
.PeekChar())
2837
if (!
TextWindow
.IsReallyAtEnd())
2863
info.StringValue = info.Text =
TextWindow
.GetText(intern: false);
2870
Debug.Assert(
TextWindow
.PeekChar() == '<');
2872
if (
TextWindow
.PeekChar(1) == '!')
2874
if (
TextWindow
.PeekChar(2) == '-'
2875
&&
TextWindow
.PeekChar(3) == '-')
2877
TextWindow
.AdvanceChar(4);
2880
else if (
TextWindow
.PeekChar(2) == '['
2881
&&
TextWindow
.PeekChar(3) == 'C'
2882
&&
TextWindow
.PeekChar(4) == 'D'
2883
&&
TextWindow
.PeekChar(5) == 'A'
2884
&&
TextWindow
.PeekChar(6) == 'T'
2885
&&
TextWindow
.PeekChar(7) == 'A'
2886
&&
TextWindow
.PeekChar(8) == '[')
2888
TextWindow
.AdvanceChar(9);
2894
TextWindow
.AdvanceChar();
2898
else if (
TextWindow
.PeekChar(1) == '/')
2900
TextWindow
.AdvanceChar(2);
2903
else if (
TextWindow
.PeekChar(1) == '?')
2905
TextWindow
.AdvanceChar(2);
2910
TextWindow
.AdvanceChar();
2919
Debug.Assert(
TextWindow
.PeekChar() == '&');
2920
TextWindow
.AdvanceChar();
2926
if (IsXmlNameStartChar(ch =
TextWindow
.PeekChar()))
2928
while (IsXmlNameChar(ch =
TextWindow
.PeekChar()))
2936
TextWindow
.AdvanceChar();
2965
TextWindow
.AdvanceChar();
2966
bool isHex =
TextWindow
.PeekChar() == 'x';
2971
TextWindow
.AdvanceChar(); // x
2972
while (SyntaxFacts.IsHexDigit(ch =
TextWindow
.PeekChar()))
2974
TextWindow
.AdvanceChar();
2985
while (SyntaxFacts.IsDecDigit(ch =
TextWindow
.PeekChar()))
2987
TextWindow
.AdvanceChar();
2997
if (
TextWindow
.PeekChar() != ';')
3042
ch =
TextWindow
.PeekChar();
3045
TextWindow
.AdvanceChar();
3059
info.Text =
TextWindow
.GetText(true);
3087
if (
TextWindow
.PeekChar() == ']' &&
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3089
TextWindow
.AdvanceChar(3);
3090
info.StringValue = info.Text =
TextWindow
.GetText(false);
3097
var ch =
TextWindow
.PeekChar();
3101
if (!
TextWindow
.IsReallyAtEnd())
3106
info.StringValue = info.Text =
TextWindow
.GetText(false);
3112
info.StringValue = info.Text =
TextWindow
.GetText(false);
3116
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3119
info.StringValue = info.Text =
TextWindow
.GetText(false);
3126
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3128
info.StringValue = info.Text =
TextWindow
.GetText(false);
3140
TextWindow
.AdvanceChar();
3187
switch (ch =
TextWindow
.PeekChar())
3194
TextWindow
.AdvanceChar();
3199
if (
TextWindow
.PeekChar(1) == '>')
3201
TextWindow
.AdvanceChar(2);
3209
TextWindow
.AdvanceChar();
3214
TextWindow
.AdvanceChar();
3219
TextWindow
.AdvanceChar();
3224
TextWindow
.AdvanceChar();
3234
if (!
TextWindow
.IsReallyAtEnd())
3243
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3266
TextWindow
.AdvanceChar();
3268
info.StringValue = info.Text =
TextWindow
.GetText(false);
3280
int start =
TextWindow
.Position;
3284
char ch =
TextWindow
.PeekChar();
3296
TextWindow
.AdvanceChar();
3304
info.Text =
TextWindow
.GetText(start,
TextWindow
.Position - start, intern: true);
3361
switch (ch =
TextWindow
.PeekChar())
3366
TextWindow
.AdvanceChar();
3376
TextWindow
.AdvanceChar();
3389
TextWindow
.AdvanceChar();
3399
if (!
TextWindow
.IsReallyAtEnd())
3426
var ch =
TextWindow
.PeekChar();
3432
info.StringValue = info.Text =
TextWindow
.GetText(false);
3441
info.StringValue = info.Text =
TextWindow
.GetText(false);
3451
info.StringValue = info.Text =
TextWindow
.GetText(false);
3455
if (!
TextWindow
.IsReallyAtEnd())
3460
info.StringValue = info.Text =
TextWindow
.GetText(false);
3464
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3467
info.StringValue = info.Text =
TextWindow
.GetText(false);
3479
TextWindow
.AdvanceChar();
3518
switch (
TextWindow
.PeekChar())
3525
if (!
TextWindow
.IsReallyAtEnd())
3533
info.Text = info.StringValue =
TextWindow
.NextChar().ToString();
3578
int beforeConsumed =
TextWindow
.Position;
3579
char consumedChar =
TextWindow
.NextChar();
3605
info.Text =
TextWindow
.GetText(intern: false);
3610
if (!
TextWindow
.IsReallyAtEnd())
3620
TextWindow
.Reset(beforeConsumed);
3625
TextWindow
.Reset(beforeConsumed);
3628
TextWindow
.Reset(beforeConsumed);
3654
Debug.Assert(
TextWindow
.Position > beforeConsumed, "First character or entity has been consumed.");
3684
if (
TextWindow
.PeekChar() == '.')
3769
string actualText =
TextWindow
.GetText(intern: false);
3782
TextWindow
.Reset(beforeConsumed);
3815
if (
TextWindow
.PeekChar() == '@')
3817
TextWindow
.NextChar();
3818
info.Text =
TextWindow
.GetText(intern: true);
3828
else if (
TextWindow
.PeekChar() == '&')
3837
char bad =
TextWindow
.NextChar();
3838
info.Text =
TextWindow
.GetText(intern: false);
3866
char peekCh =
TextWindow
.PeekChar();
3871
TextWindow
.AdvanceChar();
3877
int pos =
TextWindow
.Position;
3887
TextWindow
.Reset(pos);
3984
switch (ch =
TextWindow
.PeekChar())
3987
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3989
TextWindow
.AdvanceChar(3);
4002
if (!
TextWindow
.IsReallyAtEnd())
4028
var ch =
TextWindow
.PeekChar();
4032
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4034
info.StringValue = info.Text =
TextWindow
.GetText(false);
4042
info.StringValue = info.Text =
TextWindow
.GetText(false);
4046
if (!
TextWindow
.IsReallyAtEnd())
4051
info.StringValue = info.Text =
TextWindow
.GetText(false);
4055
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4058
info.StringValue = info.Text =
TextWindow
.GetText(false);
4070
TextWindow
.AdvanceChar();
4106
switch (ch =
TextWindow
.PeekChar())
4109
if (
TextWindow
.PeekChar(1) == '-')
4111
if (
TextWindow
.PeekChar(2) == '>')
4113
TextWindow
.AdvanceChar(3);
4119
TextWindow
.AdvanceChar(2);
4133
if (!
TextWindow
.IsReallyAtEnd())
4158
var ch =
TextWindow
.PeekChar();
4162
if (
TextWindow
.PeekChar(1) == '-')
4164
info.StringValue = info.Text =
TextWindow
.GetText(false);
4172
info.StringValue = info.Text =
TextWindow
.GetText(false);
4176
if (!
TextWindow
.IsReallyAtEnd())
4181
info.StringValue = info.Text =
TextWindow
.GetText(false);
4185
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4188
info.StringValue = info.Text =
TextWindow
.GetText(false);
4200
TextWindow
.AdvanceChar();
4237
switch (ch =
TextWindow
.PeekChar())
4240
if (
TextWindow
.PeekChar(1) == '>')
4242
TextWindow
.AdvanceChar(2);
4255
if (!
TextWindow
.IsReallyAtEnd())
4282
var ch =
TextWindow
.PeekChar();
4286
if (
TextWindow
.PeekChar(1) == '>')
4288
info.StringValue = info.Text =
TextWindow
.GetText(false);
4296
info.StringValue = info.Text =
TextWindow
.GetText(false);
4300
if (!
TextWindow
.IsReallyAtEnd())
4305
info.StringValue = info.Text =
TextWindow
.GetText(false);
4309
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4312
info.StringValue = info.Text =
TextWindow
.GetText(false);
4324
TextWindow
.AdvanceChar();
4336
var start =
TextWindow
.Position;
4345
if (
TextWindow
.PeekChar() == '/'
4346
&&
TextWindow
.PeekChar(1) == '*'
4347
&&
TextWindow
.PeekChar(2) == '*'
4348
&&
TextWindow
.PeekChar(3) != '*')
4350
TextWindow
.AdvanceChar(3);
4351
var text =
TextWindow
.GetText(true);
4366
char ch =
TextWindow
.PeekChar();
4373
TextWindow
.AdvanceChar();
4377
if (this.StyleIs(XmlDocCommentStyle.SingleLine) &&
TextWindow
.PeekChar(1) == '/' &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
4379
TextWindow
.AdvanceChar(3);
4380
var text =
TextWindow
.GetText(true);
4391
while (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) != '/')
4393
TextWindow
.AdvanceChar();
4396
var text =
TextWindow
.GetText(true);
4406
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4408
TextWindow
.AdvanceChar(2);
4435
TextWindow
.Reset(start);
4442
var text =
TextWindow
.GetText(true);
4454
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4456
TextWindow
.AdvanceChar(2);
4457
var text =
TextWindow
.GetText(true);
4470
char ch =
TextWindow
.PeekChar();
4492
char ch =
TextWindow
.PeekChar();
4511
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4537
if (
TextWindow
.PeekChar() == '\\')
4539
var ch2 =
TextWindow
.PeekChar(1);
4558
return
TextWindow
.PeekChar();
4564
int position =
TextWindow
.Position;
4570
TextWindow
.Reset(position);
4576
var ch =
TextWindow
.PeekChar();
4580
var ch2 =
TextWindow
.PeekChar(1);
4589
TextWindow
.AdvanceChar();
4603
int start =
TextWindow
.Position;
4604
char character =
TextWindow
.PeekChar();
4606
TextWindow
.AdvanceChar();
4608
character =
TextWindow
.PeekChar();
4613
TextWindow
.AdvanceChar();
4614
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4625
character =
TextWindow
.PeekChar();
4637
TextWindow
.AdvanceChar();
4658
TextWindow
.AdvanceChar();
4659
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4670
char ch2 =
TextWindow
.PeekChar();
4685
TextWindow
.AdvanceChar();
4709
Debug.Assert(
TextWindow
.PeekChar() == '&');
4712
TextWindow
.AdvanceChar();
4716
switch (
TextWindow
.PeekChar())
4719
if (
TextWindow
.AdvanceIfMatches("lt;"))
4726
if (
TextWindow
.AdvanceIfMatches("gt;"))
4733
if (
TextWindow
.AdvanceIfMatches("amp;"))
4738
else if (
TextWindow
.AdvanceIfMatches("apos;"))
4745
if (
TextWindow
.AdvanceIfMatches("quot;"))
4753
TextWindow
.AdvanceChar(); //#
4757
if (
TextWindow
.AdvanceIfMatches("x"))
4760
while (SyntaxFacts.IsHexDigit(digit =
TextWindow
.PeekChar()))
4762
TextWindow
.AdvanceChar();
4778
while (SyntaxFacts.IsDecDigit(digit =
TextWindow
.PeekChar()))
4780
TextWindow
.AdvanceChar();
4794
if (
TextWindow
.AdvanceIfMatches(";"))
4809
return new SyntaxDiagnosticInfo(start -
TextWindow
.LexemeStartPosition,
4810
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);