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)
220
return CreateForGlobalFailure(lexer.
TextWindow
.Position, createEmptyNodeFunc(this));
230
builder.Add(SyntaxFactory.BadToken(null, lexer.
TextWindow
.Text.ToString(), null));
Parser\Lexer.cs (480)
164
this.
TextWindow
.Reset(position);
306
this.LexSyntaxTrivia(isFollowingToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
325
this.LexSyntaxTrivia(isFollowingToken:
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, '@');
2005
var savePosition =
TextWindow
.Position;
2011
var text =
TextWindow
.Text.GetSubText(TextSpan.FromBounds(savePosition,
TextWindow
.Position));
2060
var text =
TextWindow
.GetText(false);
2074
var text =
TextWindow
.GetText(false);
2085
var position =
TextWindow
.Position;
2086
var text =
TextWindow
.Text;
2119
this.AddError(
TextWindow
.Position, s_conflictMarkerLength,
2122
var startCh = this.
TextWindow
.PeekChar();
2148
var ch = this.
TextWindow
.PeekChar();
2167
this.
TextWindow
.AdvanceChar();
2170
if (this.
TextWindow
.Width > 0)
2172
this.AddTrivia(SyntaxFactory.DisabledText(
TextWindow
.GetText(false)), ref triviaList);
2186
while (SyntaxFacts.IsNewLine(this.
TextWindow
.PeekChar()))
2188
this.
TextWindow
.AdvanceChar();
2191
if (this.
TextWindow
.Width > 0)
2193
this.AddTrivia(SyntaxFactory.EndOfLine(
TextWindow
.GetText(false)), ref triviaList);
2201
var ch = this.
TextWindow
.PeekChar();
2207
this.
TextWindow
.AdvanceChar();
2210
this.AddTrivia(SyntaxFactory.ConflictMarker(
TextWindow
.GetText(false)), ref triviaList);
2231
Debug.Assert(
TextWindow
.PeekChar() == delimiter &&
TextWindow
.PeekChar(1) == '*');
2232
TextWindow
.AdvanceChar(2);
2237
if ((ch =
TextWindow
.PeekChar()) == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd())
2242
else if (ch == '*' &&
TextWindow
.PeekChar(1) == delimiter)
2244
TextWindow
.AdvanceChar(2);
2250
TextWindow
.AdvanceChar();
2258
while (!SyntaxFacts.IsNewLine(ch =
TextWindow
.PeekChar()) &&
2259
(ch != SlidingTextWindow.InvalidCharacter || !
TextWindow
.IsReallyAtEnd()))
2261
TextWindow
.AdvanceChar();
2272
switch (ch =
TextWindow
.PeekChar())
2275
TextWindow
.AdvanceChar();
2276
return
TextWindow
.TryAdvance('\n') ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.CarriageReturn;
2278
TextWindow
.AdvanceChar();
2283
TextWindow
.AdvanceChar();
2301
char ch =
TextWindow
.PeekChar();
2313
TextWindow
.AdvanceChar();
2330
if (
TextWindow
.Width == 1 && onlySpaces)
2336
var width =
TextWindow
.Width;
2341
TextWindow
.CharacterWindow,
2342
TextWindow
.LexemeRelativeStart,
2346
TextWindow
);
2350
return CreateWhitespaceTrivia(
TextWindow
);
2409
if (SyntaxFacts.IsWhitespace(
TextWindow
.PeekChar()))
2443
int lastLineStart =
TextWindow
.Position;
2449
char ch =
TextWindow
.PeekChar();
2453
if (!
TextWindow
.IsReallyAtEnd())
2459
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2463
if (lastLineStart <
TextWindow
.Position && !allWhitespace)
2468
TextWindow
.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line
2469
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2473
lastLineStart =
TextWindow
.Position;
2484
TextWindow
.AdvanceChar();
2516
var ch = this.
TextWindow
.PeekChar();
2522
else if (ch is SlidingTextWindow.InvalidCharacter && this.
TextWindow
.IsReallyAtEnd())
2530
this.
TextWindow
.AdvanceChar();
2557
switch (character =
TextWindow
.PeekChar())
2560
if (!
TextWindow
.IsReallyAtEnd())
2575
TextWindow
.AdvanceChar();
2580
TextWindow
.AdvanceChar();
2585
TextWindow
.AdvanceChar();
2590
TextWindow
.AdvanceChar();
2595
TextWindow
.AdvanceChar();
2600
TextWindow
.AdvanceChar();
2601
if (
TextWindow
.PeekChar() == '=')
2603
TextWindow
.AdvanceChar();
2614
TextWindow
.AdvanceChar();
2615
if (
TextWindow
.PeekChar() == '=')
2617
TextWindow
.AdvanceChar();
2628
if (
TextWindow
.PeekChar(1) == '&')
2630
TextWindow
.AdvanceChar(2);
2638
if (
TextWindow
.PeekChar(1) == '|')
2640
TextWindow
.AdvanceChar(2);
2659
info.Text =
TextWindow
.GetText(true);
2703
TextWindow
.AdvanceChar();
2707
info.Text =
TextWindow
.GetText(true);
2722
var pos =
TextWindow
.Position;
2737
TextWindow
.Reset(pos);
2754
char ch =
TextWindow
.PeekChar();
2758
if (
TextWindow
.PeekChar(1) == '/')
2762
var text =
TextWindow
.GetText(false);
2808
Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) ||
TextWindow
.PeekChar() == SlidingTextWindow.InvalidCharacter);
2817
this.AddError(
TextWindow
.LexemeStartPosition,
TextWindow
.Width, ErrorCode.ERR_OpenEndedComment);
2853
switch (ch =
TextWindow
.PeekChar())
2870
if (!
TextWindow
.IsReallyAtEnd())
2896
info.StringValue = info.Text =
TextWindow
.GetText(intern: false);
2903
Debug.Assert(
TextWindow
.PeekChar() == '<');
2905
if (
TextWindow
.PeekChar(1) == '!')
2907
if (
TextWindow
.PeekChar(2) == '-'
2908
&&
TextWindow
.PeekChar(3) == '-')
2910
TextWindow
.AdvanceChar(4);
2913
else if (
TextWindow
.PeekChar(2) == '['
2914
&&
TextWindow
.PeekChar(3) == 'C'
2915
&&
TextWindow
.PeekChar(4) == 'D'
2916
&&
TextWindow
.PeekChar(5) == 'A'
2917
&&
TextWindow
.PeekChar(6) == 'T'
2918
&&
TextWindow
.PeekChar(7) == 'A'
2919
&&
TextWindow
.PeekChar(8) == '[')
2921
TextWindow
.AdvanceChar(9);
2927
TextWindow
.AdvanceChar();
2931
else if (
TextWindow
.PeekChar(1) == '/')
2933
TextWindow
.AdvanceChar(2);
2936
else if (
TextWindow
.PeekChar(1) == '?')
2938
TextWindow
.AdvanceChar(2);
2943
TextWindow
.AdvanceChar();
2952
Debug.Assert(
TextWindow
.PeekChar() == '&');
2953
TextWindow
.AdvanceChar();
2959
if (IsXmlNameStartChar(ch =
TextWindow
.PeekChar()))
2961
while (IsXmlNameChar(ch =
TextWindow
.PeekChar()))
2969
TextWindow
.AdvanceChar();
2998
TextWindow
.AdvanceChar();
2999
bool isHex =
TextWindow
.PeekChar() == 'x';
3004
TextWindow
.AdvanceChar(); // x
3005
while (SyntaxFacts.IsHexDigit(ch =
TextWindow
.PeekChar()))
3007
TextWindow
.AdvanceChar();
3018
while (SyntaxFacts.IsDecDigit(ch =
TextWindow
.PeekChar()))
3020
TextWindow
.AdvanceChar();
3030
if (
TextWindow
.PeekChar() != ';')
3075
ch =
TextWindow
.PeekChar();
3078
TextWindow
.AdvanceChar();
3092
info.Text =
TextWindow
.GetText(true);
3120
if (
TextWindow
.PeekChar() == ']' &&
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3122
TextWindow
.AdvanceChar(3);
3123
info.StringValue = info.Text =
TextWindow
.GetText(false);
3130
var ch =
TextWindow
.PeekChar();
3134
if (!
TextWindow
.IsReallyAtEnd())
3139
info.StringValue = info.Text =
TextWindow
.GetText(false);
3145
info.StringValue = info.Text =
TextWindow
.GetText(false);
3149
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3152
info.StringValue = info.Text =
TextWindow
.GetText(false);
3159
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3161
info.StringValue = info.Text =
TextWindow
.GetText(false);
3173
TextWindow
.AdvanceChar();
3220
switch (ch =
TextWindow
.PeekChar())
3227
TextWindow
.AdvanceChar();
3232
if (
TextWindow
.PeekChar(1) == '>')
3234
TextWindow
.AdvanceChar(2);
3242
TextWindow
.AdvanceChar();
3247
TextWindow
.AdvanceChar();
3252
TextWindow
.AdvanceChar();
3257
TextWindow
.AdvanceChar();
3267
if (!
TextWindow
.IsReallyAtEnd())
3276
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3299
TextWindow
.AdvanceChar();
3301
info.StringValue = info.Text =
TextWindow
.GetText(false);
3313
int start =
TextWindow
.Position;
3317
char ch =
TextWindow
.PeekChar();
3329
TextWindow
.AdvanceChar();
3337
info.Text =
TextWindow
.GetText(start,
TextWindow
.Position - start, intern: true);
3394
switch (ch =
TextWindow
.PeekChar())
3399
TextWindow
.AdvanceChar();
3409
TextWindow
.AdvanceChar();
3422
TextWindow
.AdvanceChar();
3432
if (!
TextWindow
.IsReallyAtEnd())
3459
var ch =
TextWindow
.PeekChar();
3465
info.StringValue = info.Text =
TextWindow
.GetText(false);
3474
info.StringValue = info.Text =
TextWindow
.GetText(false);
3484
info.StringValue = info.Text =
TextWindow
.GetText(false);
3488
if (!
TextWindow
.IsReallyAtEnd())
3493
info.StringValue = info.Text =
TextWindow
.GetText(false);
3497
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3500
info.StringValue = info.Text =
TextWindow
.GetText(false);
3512
TextWindow
.AdvanceChar();
3551
switch (
TextWindow
.PeekChar())
3558
if (!
TextWindow
.IsReallyAtEnd())
3566
info.Text = info.StringValue =
TextWindow
.NextChar().ToString();
3611
int beforeConsumed =
TextWindow
.Position;
3612
char consumedChar =
TextWindow
.NextChar();
3638
info.Text =
TextWindow
.GetText(intern: false);
3643
if (!
TextWindow
.IsReallyAtEnd())
3653
TextWindow
.Reset(beforeConsumed);
3658
TextWindow
.Reset(beforeConsumed);
3661
TextWindow
.Reset(beforeConsumed);
3687
Debug.Assert(
TextWindow
.Position > beforeConsumed, "First character or entity has been consumed.");
3717
if (
TextWindow
.PeekChar() == '.')
3802
string actualText =
TextWindow
.GetText(intern: false);
3815
TextWindow
.Reset(beforeConsumed);
3848
if (
TextWindow
.PeekChar() == '@')
3850
TextWindow
.NextChar();
3851
info.Text =
TextWindow
.GetText(intern: true);
3861
else if (
TextWindow
.PeekChar() == '&')
3870
char bad =
TextWindow
.NextChar();
3871
info.Text =
TextWindow
.GetText(intern: false);
3899
char peekCh =
TextWindow
.PeekChar();
3904
TextWindow
.AdvanceChar();
3910
int pos =
TextWindow
.Position;
3920
TextWindow
.Reset(pos);
4017
switch (ch =
TextWindow
.PeekChar())
4020
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4022
TextWindow
.AdvanceChar(3);
4035
if (!
TextWindow
.IsReallyAtEnd())
4061
var ch =
TextWindow
.PeekChar();
4065
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4067
info.StringValue = info.Text =
TextWindow
.GetText(false);
4075
info.StringValue = info.Text =
TextWindow
.GetText(false);
4079
if (!
TextWindow
.IsReallyAtEnd())
4084
info.StringValue = info.Text =
TextWindow
.GetText(false);
4088
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4091
info.StringValue = info.Text =
TextWindow
.GetText(false);
4103
TextWindow
.AdvanceChar();
4139
switch (ch =
TextWindow
.PeekChar())
4142
if (
TextWindow
.PeekChar(1) == '-')
4144
if (
TextWindow
.PeekChar(2) == '>')
4146
TextWindow
.AdvanceChar(3);
4152
TextWindow
.AdvanceChar(2);
4166
if (!
TextWindow
.IsReallyAtEnd())
4191
var ch =
TextWindow
.PeekChar();
4195
if (
TextWindow
.PeekChar(1) == '-')
4197
info.StringValue = info.Text =
TextWindow
.GetText(false);
4205
info.StringValue = info.Text =
TextWindow
.GetText(false);
4209
if (!
TextWindow
.IsReallyAtEnd())
4214
info.StringValue = info.Text =
TextWindow
.GetText(false);
4218
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4221
info.StringValue = info.Text =
TextWindow
.GetText(false);
4233
TextWindow
.AdvanceChar();
4270
switch (ch =
TextWindow
.PeekChar())
4273
if (
TextWindow
.PeekChar(1) == '>')
4275
TextWindow
.AdvanceChar(2);
4288
if (!
TextWindow
.IsReallyAtEnd())
4315
var ch =
TextWindow
.PeekChar();
4319
if (
TextWindow
.PeekChar(1) == '>')
4321
info.StringValue = info.Text =
TextWindow
.GetText(false);
4329
info.StringValue = info.Text =
TextWindow
.GetText(false);
4333
if (!
TextWindow
.IsReallyAtEnd())
4338
info.StringValue = info.Text =
TextWindow
.GetText(false);
4342
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4345
info.StringValue = info.Text =
TextWindow
.GetText(false);
4357
TextWindow
.AdvanceChar();
4369
var start =
TextWindow
.Position;
4378
if (
TextWindow
.PeekChar() == '/'
4379
&&
TextWindow
.PeekChar(1) == '*'
4380
&&
TextWindow
.PeekChar(2) == '*'
4381
&&
TextWindow
.PeekChar(3) != '*')
4383
TextWindow
.AdvanceChar(3);
4384
var text =
TextWindow
.GetText(true);
4399
char ch =
TextWindow
.PeekChar();
4406
TextWindow
.AdvanceChar();
4410
if (this.StyleIs(XmlDocCommentStyle.SingleLine) &&
TextWindow
.PeekChar(1) == '/' &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
4412
TextWindow
.AdvanceChar(3);
4413
var text =
TextWindow
.GetText(true);
4424
while (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) != '/')
4426
TextWindow
.AdvanceChar();
4429
var text =
TextWindow
.GetText(true);
4439
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4441
TextWindow
.AdvanceChar(2);
4468
TextWindow
.Reset(start);
4475
var text =
TextWindow
.GetText(true);
4487
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4489
TextWindow
.AdvanceChar(2);
4490
var text =
TextWindow
.GetText(true);
4503
char ch =
TextWindow
.PeekChar();
4525
char ch =
TextWindow
.PeekChar();
4544
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4570
if (
TextWindow
.PeekChar() == '\\')
4572
var ch2 =
TextWindow
.PeekChar(1);
4591
return
TextWindow
.PeekChar();
4597
int position =
TextWindow
.Position;
4603
TextWindow
.Reset(position);
4609
var ch =
TextWindow
.PeekChar();
4613
var ch2 =
TextWindow
.PeekChar(1);
4622
TextWindow
.AdvanceChar();
4636
int start =
TextWindow
.Position;
4637
char character =
TextWindow
.PeekChar();
4639
TextWindow
.AdvanceChar();
4641
character =
TextWindow
.PeekChar();
4646
TextWindow
.AdvanceChar();
4647
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4658
character =
TextWindow
.PeekChar();
4670
TextWindow
.AdvanceChar();
4691
TextWindow
.AdvanceChar();
4692
if (!SyntaxFacts.IsHexDigit(
TextWindow
.PeekChar()))
4703
char ch2 =
TextWindow
.PeekChar();
4718
TextWindow
.AdvanceChar();
4742
Debug.Assert(
TextWindow
.PeekChar() == '&');
4745
TextWindow
.AdvanceChar();
4749
switch (
TextWindow
.PeekChar())
4752
if (
TextWindow
.AdvanceIfMatches("lt;"))
4759
if (
TextWindow
.AdvanceIfMatches("gt;"))
4766
if (
TextWindow
.AdvanceIfMatches("amp;"))
4771
else if (
TextWindow
.AdvanceIfMatches("apos;"))
4778
if (
TextWindow
.AdvanceIfMatches("quot;"))
4786
TextWindow
.AdvanceChar(); //#
4790
if (
TextWindow
.AdvanceIfMatches("x"))
4793
while (SyntaxFacts.IsHexDigit(digit =
TextWindow
.PeekChar()))
4795
TextWindow
.AdvanceChar();
4811
while (SyntaxFacts.IsDecDigit(digit =
TextWindow
.PeekChar()))
4813
TextWindow
.AdvanceChar();
4827
if (
TextWindow
.AdvanceIfMatches(";"))
4842
return new SyntaxDiagnosticInfo(start -
TextWindow
.LexemeStartPosition,
4843
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);