1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21
this.
TextWindow
= new SlidingTextWindow(text);
652 references to TextWindow
Microsoft.CodeAnalysis.CSharp (652)
Parser\AbstractLexer.cs (4)
26
this.
TextWindow
.Dispose();
31
TextWindow
.Start();
134
return position >=
TextWindow
.LexemeStartPosition ? position -
TextWindow
.LexemeStartPosition : position;
Parser\Blender.cs (1)
72
_newPosition = lexer.
TextWindow
.Position;
Parser\Blender.Reader.cs (1)
168
if (_lexer.
TextWindow
.Position != _newPosition)
Parser\DirectiveParser.cs (1)
34
var hashPosition = lexer.
TextWindow
.Position;
Parser\LanguageParser.cs (2)
217
return CreateForGlobalFailure(lexer.
TextWindow
.Position, createEmptyNodeFunc(this));
227
builder.Add(SyntaxFactory.BadToken(null, lexer.
TextWindow
.Text.ToString(), null));
Parser\Lexer.cs (466)
163
this.
TextWindow
.Reset(position);
304
this.LexSyntaxTrivia(afterFirstToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
323
this.LexSyntaxTrivia(afterFirstToken:
TextWindow
.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache);
440
int startingPosition =
TextWindow
.Position;
443
character =
TextWindow
.PeekChar();
452
TextWindow
.AdvanceChar();
453
if (
TextWindow
.PeekChar() == '=')
455
TextWindow
.AdvanceChar();
468
TextWindow
.AdvanceChar();
469
if (
TextWindow
.PeekChar() == '.')
471
TextWindow
.AdvanceChar();
472
if (
TextWindow
.PeekChar() == '.')
491
TextWindow
.AdvanceChar();
496
TextWindow
.AdvanceChar();
497
if (
TextWindow
.PeekChar() == ':')
499
TextWindow
.AdvanceChar();
510
TextWindow
.AdvanceChar();
515
TextWindow
.AdvanceChar();
520
TextWindow
.AdvanceChar();
521
if (
TextWindow
.PeekChar() == '=')
523
TextWindow
.AdvanceChar();
534
TextWindow
.AdvanceChar();
535
if ((character =
TextWindow
.PeekChar()) == '=')
537
TextWindow
.AdvanceChar();
542
TextWindow
.AdvanceChar();
553
TextWindow
.AdvanceChar();
554
if (
TextWindow
.PeekChar() == '=')
556
TextWindow
.AdvanceChar();
567
TextWindow
.AdvanceChar();
572
TextWindow
.AdvanceChar();
577
TextWindow
.AdvanceChar();
582
TextWindow
.AdvanceChar();
587
TextWindow
.AdvanceChar();
592
TextWindow
.AdvanceChar();
597
TextWindow
.AdvanceChar();
598
if (
TextWindow
.PeekChar() == '?')
600
TextWindow
.AdvanceChar();
602
if (
TextWindow
.PeekChar() == '=')
604
TextWindow
.AdvanceChar();
620
TextWindow
.AdvanceChar();
621
if ((character =
TextWindow
.PeekChar()) == '=')
623
TextWindow
.AdvanceChar();
628
TextWindow
.AdvanceChar();
639
TextWindow
.AdvanceChar();
640
if ((character =
TextWindow
.PeekChar()) == '=')
642
TextWindow
.AdvanceChar();
647
TextWindow
.AdvanceChar();
652
TextWindow
.AdvanceChar();
663
TextWindow
.AdvanceChar();
664
if (
TextWindow
.PeekChar() == '=')
666
TextWindow
.AdvanceChar();
677
TextWindow
.AdvanceChar();
678
if ((character =
TextWindow
.PeekChar()) == '=')
680
TextWindow
.AdvanceChar();
683
else if (
TextWindow
.PeekChar() == '&')
685
TextWindow
.AdvanceChar();
696
TextWindow
.AdvanceChar();
697
if (
TextWindow
.PeekChar() == '=')
699
TextWindow
.AdvanceChar();
710
TextWindow
.AdvanceChar();
711
if (
TextWindow
.PeekChar() == '=')
713
TextWindow
.AdvanceChar();
716
else if (
TextWindow
.PeekChar() == '|')
718
TextWindow
.AdvanceChar();
729
TextWindow
.AdvanceChar();
730
if (
TextWindow
.PeekChar() == '=')
732
TextWindow
.AdvanceChar();
735
else if (
TextWindow
.PeekChar() == '<')
737
TextWindow
.AdvanceChar();
738
if (
TextWindow
.PeekChar() == '=')
740
TextWindow
.AdvanceChar();
756
TextWindow
.AdvanceChar();
757
if (
TextWindow
.PeekChar() == '=')
759
TextWindow
.AdvanceChar();
773
Debug.Assert(
TextWindow
.PeekChar() == '@');
775
info.Text =
TextWindow
.GetText(intern: true);
868
character =
TextWindow
.PeekCharOrUnicodeEscape(out surrogateCharacter);
880
if (!
TextWindow
.IsReallyAtEnd())
907
TextWindow
.NextCharOrUnicodeEscape(out surrogateCharacter, out error);
912
TextWindow
.AdvanceChar();
918
int end =
TextWindow
.Text.Length;
920
info.Text =
TextWindow
.Text.ToString(new TextSpan(startingPosition, width));
921
TextWindow
.Reset(end);
925
info.Text =
TextWindow
.GetText(intern: true);
935
Debug.Assert(
TextWindow
.PeekChar() == '@');
938
while (
TextWindow
.PeekChar(index) == '@')
943
if (
TextWindow
.PeekChar(index) == '"')
949
else if (
TextWindow
.PeekChar(index) == '$')
961
Debug.Assert(
TextWindow
.PeekChar() == '$');
963
if (
TextWindow
.PeekChar(1) == '$')
969
else if (
TextWindow
.PeekChar(1) == '@' &&
TextWindow
.PeekChar(2) == '@')
975
else if (
TextWindow
.PeekChar(1) == '"')
980
else if (
TextWindow
.PeekChar(1) == '@')
1000
int start =
TextWindow
.Position;
1002
while ((ch =
TextWindow
.PeekChar()) >= '0' && ch <= '9')
1004
TextWindow
.AdvanceChar();
1007
return start <
TextWindow
.Position;
1013
if (
TextWindow
.PeekChar() == '_')
1028
char ch =
TextWindow
.PeekChar();
1045
TextWindow
.AdvanceChar();
1056
int start =
TextWindow
.Position;
1071
ch =
TextWindow
.PeekChar();
1074
ch =
TextWindow
.PeekChar(1);
1077
TextWindow
.AdvanceChar(2);
1083
TextWindow
.AdvanceChar(2);
1094
if ((ch =
TextWindow
.PeekChar()) == 'L' || ch == 'l')
1096
TextWindow
.AdvanceChar();
1098
if ((ch =
TextWindow
.PeekChar()) == 'u' || ch == 'U')
1100
TextWindow
.AdvanceChar();
1104
else if ((ch =
TextWindow
.PeekChar()) == 'u' || ch == 'U')
1106
TextWindow
.AdvanceChar();
1108
if ((ch =
TextWindow
.PeekChar()) == 'L' || ch == 'l')
1110
TextWindow
.AdvanceChar();
1119
if (this.ModeIs(LexerMode.DebuggerSyntax) &&
TextWindow
.PeekChar() == '#')
1122
TextWindow
.AdvanceChar();
1123
info.StringValue = info.Text =
TextWindow
.GetText(intern: true);
1129
if ((ch =
TextWindow
.PeekChar()) == '.')
1131
var ch2 =
TextWindow
.PeekChar(1);
1136
TextWindow
.AdvanceChar();
1143
TextWindow
.Reset(start);
1148
if ((ch =
TextWindow
.PeekChar()) == 'E' || ch == 'e')
1151
TextWindow
.AdvanceChar();
1153
if ((ch =
TextWindow
.PeekChar()) == '-' || ch == '+')
1156
TextWindow
.AdvanceChar();
1159
if (!(((ch =
TextWindow
.PeekChar()) >= '0' && ch <= '9') || ch == '_'))
1174
if ((ch =
TextWindow
.PeekChar()) == 'f' || ch == 'F')
1176
TextWindow
.AdvanceChar();
1181
TextWindow
.AdvanceChar();
1186
TextWindow
.AdvanceChar();
1194
else if ((ch =
TextWindow
.PeekChar()) == 'f' || ch == 'F')
1196
TextWindow
.AdvanceChar();
1201
TextWindow
.AdvanceChar();
1206
TextWindow
.AdvanceChar();
1211
TextWindow
.AdvanceChar();
1213
if ((ch =
TextWindow
.PeekChar()) == 'u' || ch == 'U')
1215
TextWindow
.AdvanceChar();
1222
TextWindow
.AdvanceChar();
1223
if ((ch =
TextWindow
.PeekChar()) == 'L' || ch == 'l')
1225
TextWindow
.AdvanceChar();
1233
this.AddError(MakeError(start,
TextWindow
.Position - start, ErrorCode.ERR_InvalidNumber));
1245
info.Text =
TextWindow
.GetText(true);
1247
var valueText =
TextWindow
.Intern(_builder);
1258
info.DecimalValue = this.GetValueDecimal(valueText, start,
TextWindow
.Position);
1538
var currentOffset =
TextWindow
.Offset;
1539
var characterWindow =
TextWindow
.CharacterWindow;
1540
var characterWindowCount =
TextWindow
.CharacterWindowCount;
1603
TextWindow
.AdvanceChar(length);
1604
info.Text = info.StringValue =
TextWindow
.Intern(characterWindow, startOffset, length);
1696
int start =
TextWindow
.Position;
1699
while (
TextWindow
.PeekChar() == '@')
1701
TextWindow
.AdvanceChar();
1704
var atCount =
TextWindow
.Position - start;
1712
char ch =
TextWindow
.PeekChar();
1717
if (!isEscaped &&
TextWindow
.IsUnicodeEscape())
1722
ch =
TextWindow
.PeekUnicodeEscape(out surrogateCharacter);
1735
if (!
TextWindow
.IsReallyAtEnd())
1806
(char.ToLower(
TextWindow
.PeekChar(1)) == 'x'))
1848
if (_identLen == 0 && this.ModeIs(LexerMode.DebuggerSyntax) &&
TextWindow
.PeekChar(1) == '>')
1851
TextWindow
.AdvanceChar(2);
1873
TextWindow
.NextCharOrUnicodeEscape(out surrogateCharacter, out error);
1878
TextWindow
.AdvanceChar();
1897
TextWindow
.NextCharOrUnicodeEscape(out surrogateCharacter, out error);
1902
TextWindow
.AdvanceChar();
1913
var width =
TextWindow
.Width; // exact size of input characters
1916
info.Text =
TextWindow
.GetInternedText();
1925
info.StringValue =
TextWindow
.Intern(_identBuffer, 0, _identLen);
1933
var valueText =
TextWindow
.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset);
1954
TextWindow
.Reset(start);
1980
int start =
TextWindow
.Position;
1999
int beforeConsumed =
TextWindow
.Position;
2003
if (
TextWindow
.PeekChar() == '&')
2005
if (!
TextWindow
.TryScanXmlEntity(out consumedChar, out consumedSurrogate))
2008
TextWindow
.Reset(beforeConsumed);
2014
consumedChar =
TextWindow
.NextChar();
2034
if (!isEscaped && (
TextWindow
.Position == beforeConsumed + 1) &&
2035
(
TextWindow
.PeekChar() == 'u' ||
TextWindow
.PeekChar() == 'U'))
2041
TextWindow
.Reset(beforeConsumed);
2045
consumedChar =
TextWindow
.NextUnicodeEscape(out consumedSurrogate, out error);
2123
TextWindow
.Reset(beforeConsumed);
2141
TextWindow
.Reset(beforeConsumed);
2144
if (!
TextWindow
.IsReallyAtEnd())
2149
TextWindow
.Reset(beforeConsumed);
2171
TextWindow
.Reset(beforeConsumed);
2192
var width =
TextWindow
.Width; // exact size of input characters
2197
info.StringValue =
TextWindow
.GetInternedText();
2202
info.StringValue =
TextWindow
.Intern(_identBuffer, 0, _identLen);
2203
info.Text =
TextWindow
.GetText(intern: false);
2212
TextWindow
.Reset(start);
2281
char ch =
TextWindow
.PeekChar();
2309
if ((ch =
TextWindow
.PeekChar(1)) == '/')
2311
if (!this.SuppressDocumentationCommentParse &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
2326
var text =
TextWindow
.GetText(false);
2333
if (!this.SuppressDocumentationCommentParse &&
TextWindow
.PeekChar(2) == '*' &&
2334
TextWindow
.PeekChar(3) != '*' &&
TextWindow
.PeekChar(3) != '/')
2355
var text =
TextWindow
.GetText(false);
2418
var position =
TextWindow
.Position;
2419
var text =
TextWindow
.Text;
2452
this.AddError(
TextWindow
.Position, s_conflictMarkerLength,
2455
var startCh = this.
TextWindow
.PeekChar();
2481
var ch = this.
TextWindow
.PeekChar();
2500
this.
TextWindow
.AdvanceChar();
2503
if (this.
TextWindow
.Width > 0)
2505
this.AddTrivia(SyntaxFactory.DisabledText(
TextWindow
.GetText(false)), ref triviaList);
2519
while (SyntaxFacts.IsNewLine(this.
TextWindow
.PeekChar()))
2521
this.
TextWindow
.AdvanceChar();
2524
if (this.
TextWindow
.Width > 0)
2526
this.AddTrivia(SyntaxFactory.EndOfLine(
TextWindow
.GetText(false)), ref triviaList);
2534
var ch = this.
TextWindow
.PeekChar();
2540
this.
TextWindow
.AdvanceChar();
2543
this.AddTrivia(SyntaxFactory.ConflictMarker(
TextWindow
.GetText(false)), ref triviaList);
2563
if (
TextWindow
.PeekChar() == '/' &&
TextWindow
.PeekChar(1) == '*')
2565
TextWindow
.AdvanceChar(2);
2570
if ((ch =
TextWindow
.PeekChar()) == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd())
2575
else if (ch == '*' &&
TextWindow
.PeekChar(1) == '/')
2577
TextWindow
.AdvanceChar(2);
2583
TextWindow
.AdvanceChar();
2599
while (!SyntaxFacts.IsNewLine(ch =
TextWindow
.PeekChar()) &&
2600
(ch != SlidingTextWindow.InvalidCharacter || !
TextWindow
.IsReallyAtEnd()))
2602
TextWindow
.AdvanceChar();
2613
switch (ch =
TextWindow
.PeekChar())
2616
TextWindow
.AdvanceChar();
2617
if (
TextWindow
.PeekChar() == '\n')
2619
TextWindow
.AdvanceChar();
2625
TextWindow
.AdvanceChar();
2630
TextWindow
.AdvanceChar();
2653
char ch =
TextWindow
.PeekChar();
2665
TextWindow
.AdvanceChar();
2682
if (
TextWindow
.Width == 1 && onlySpaces)
2688
var width =
TextWindow
.Width;
2693
TextWindow
.CharacterWindow,
2694
TextWindow
.LexemeRelativeStart,
2710
return SyntaxFactory.Whitespace(
TextWindow
.GetText(intern: true));
2764
if (SyntaxFacts.IsWhitespace(
TextWindow
.PeekChar()))
2789
int lastLineStart =
TextWindow
.Position;
2795
char ch =
TextWindow
.PeekChar();
2799
if (!
TextWindow
.IsReallyAtEnd())
2805
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2809
if (lastLineStart <
TextWindow
.Position && !allWhitespace)
2814
TextWindow
.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line
2815
return
TextWindow
.Width > 0 ? SyntaxFactory.DisabledText(
TextWindow
.GetText(false)) : null;
2819
lastLineStart =
TextWindow
.Position;
2830
TextWindow
.AdvanceChar();
2853
var ch = this.
TextWindow
.PeekChar();
2859
else if (ch is SlidingTextWindow.InvalidCharacter && this.
TextWindow
.IsReallyAtEnd())
2867
this.
TextWindow
.AdvanceChar();
2887
switch (character =
TextWindow
.PeekChar())
2890
if (!
TextWindow
.IsReallyAtEnd())
2905
TextWindow
.AdvanceChar();
2910
TextWindow
.AdvanceChar();
2915
TextWindow
.AdvanceChar();
2920
TextWindow
.AdvanceChar();
2925
TextWindow
.AdvanceChar();
2930
TextWindow
.AdvanceChar();
2931
if (
TextWindow
.PeekChar() == '=')
2933
TextWindow
.AdvanceChar();
2944
TextWindow
.AdvanceChar();
2945
if (
TextWindow
.PeekChar() == '=')
2947
TextWindow
.AdvanceChar();
2958
if (
TextWindow
.PeekChar(1) == '&')
2960
TextWindow
.AdvanceChar(2);
2968
if (
TextWindow
.PeekChar(1) == '|')
2970
TextWindow
.AdvanceChar(2);
2989
info.Text =
TextWindow
.GetText(true);
3001
character =
TextWindow
.PeekCharOrUnicodeEscape(out surrogateCharacter);
3028
TextWindow
.NextCharOrUnicodeEscape(out surrogateCharacter, out error);
3033
TextWindow
.AdvanceChar();
3037
info.Text =
TextWindow
.GetText(true);
3054
var pos =
TextWindow
.Position;
3069
TextWindow
.Reset(pos);
3088
char ch =
TextWindow
.PeekChar();
3092
if (
TextWindow
.PeekChar(1) == '/')
3096
var text =
TextWindow
.GetText(false);
3150
Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) ||
TextWindow
.PeekChar() == SlidingTextWindow.InvalidCharacter);
3159
this.AddError(
TextWindow
.LexemeStartPosition,
TextWindow
.Width, ErrorCode.ERR_OpenEndedComment);
3195
switch (ch =
TextWindow
.PeekChar())
3212
if (!
TextWindow
.IsReallyAtEnd())
3238
info.StringValue = info.Text =
TextWindow
.GetText(intern: false);
3245
Debug.Assert(
TextWindow
.PeekChar() == '<');
3247
if (
TextWindow
.PeekChar(1) == '!')
3249
if (
TextWindow
.PeekChar(2) == '-'
3250
&&
TextWindow
.PeekChar(3) == '-')
3252
TextWindow
.AdvanceChar(4);
3255
else if (
TextWindow
.PeekChar(2) == '['
3256
&&
TextWindow
.PeekChar(3) == 'C'
3257
&&
TextWindow
.PeekChar(4) == 'D'
3258
&&
TextWindow
.PeekChar(5) == 'A'
3259
&&
TextWindow
.PeekChar(6) == 'T'
3260
&&
TextWindow
.PeekChar(7) == 'A'
3261
&&
TextWindow
.PeekChar(8) == '[')
3263
TextWindow
.AdvanceChar(9);
3269
TextWindow
.AdvanceChar();
3273
else if (
TextWindow
.PeekChar(1) == '/')
3275
TextWindow
.AdvanceChar(2);
3278
else if (
TextWindow
.PeekChar(1) == '?')
3280
TextWindow
.AdvanceChar(2);
3285
TextWindow
.AdvanceChar();
3294
Debug.Assert(
TextWindow
.PeekChar() == '&');
3295
TextWindow
.AdvanceChar();
3301
if (IsXmlNameStartChar(ch =
TextWindow
.PeekChar()))
3303
while (IsXmlNameChar(ch =
TextWindow
.PeekChar()))
3311
TextWindow
.AdvanceChar();
3340
TextWindow
.AdvanceChar();
3341
bool isHex =
TextWindow
.PeekChar() == 'x';
3346
TextWindow
.AdvanceChar(); // x
3347
while (SyntaxFacts.IsHexDigit(ch =
TextWindow
.PeekChar()))
3349
TextWindow
.AdvanceChar();
3360
while (SyntaxFacts.IsDecDigit(ch =
TextWindow
.PeekChar()))
3362
TextWindow
.AdvanceChar();
3372
if (
TextWindow
.PeekChar() != ';')
3417
ch =
TextWindow
.PeekChar();
3420
TextWindow
.AdvanceChar();
3434
info.Text =
TextWindow
.GetText(true);
3462
if (
TextWindow
.PeekChar() == ']' &&
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3464
TextWindow
.AdvanceChar(3);
3465
info.StringValue = info.Text =
TextWindow
.GetText(false);
3472
var ch =
TextWindow
.PeekChar();
3476
if (!
TextWindow
.IsReallyAtEnd())
3481
info.StringValue = info.Text =
TextWindow
.GetText(false);
3487
info.StringValue = info.Text =
TextWindow
.GetText(false);
3491
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3494
info.StringValue = info.Text =
TextWindow
.GetText(false);
3501
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
3503
info.StringValue = info.Text =
TextWindow
.GetText(false);
3515
TextWindow
.AdvanceChar();
3562
switch (ch =
TextWindow
.PeekChar())
3569
TextWindow
.AdvanceChar();
3574
if (
TextWindow
.PeekChar(1) == '>')
3576
TextWindow
.AdvanceChar(2);
3584
TextWindow
.AdvanceChar();
3589
TextWindow
.AdvanceChar();
3594
TextWindow
.AdvanceChar();
3599
TextWindow
.AdvanceChar();
3609
if (!
TextWindow
.IsReallyAtEnd())
3618
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3641
TextWindow
.AdvanceChar();
3643
info.StringValue = info.Text =
TextWindow
.GetText(false);
3655
int start =
TextWindow
.Position;
3659
char ch =
TextWindow
.PeekChar();
3671
TextWindow
.AdvanceChar();
3679
info.Text =
TextWindow
.GetText(start,
TextWindow
.Position - start, intern: true);
3736
switch (ch =
TextWindow
.PeekChar())
3741
TextWindow
.AdvanceChar();
3751
TextWindow
.AdvanceChar();
3764
TextWindow
.AdvanceChar();
3774
if (!
TextWindow
.IsReallyAtEnd())
3801
var ch =
TextWindow
.PeekChar();
3807
info.StringValue = info.Text =
TextWindow
.GetText(false);
3816
info.StringValue = info.Text =
TextWindow
.GetText(false);
3826
info.StringValue = info.Text =
TextWindow
.GetText(false);
3830
if (!
TextWindow
.IsReallyAtEnd())
3835
info.StringValue = info.Text =
TextWindow
.GetText(false);
3839
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
3842
info.StringValue = info.Text =
TextWindow
.GetText(false);
3854
TextWindow
.AdvanceChar();
3893
switch (
TextWindow
.PeekChar())
3900
if (!
TextWindow
.IsReallyAtEnd())
3908
info.Text = info.StringValue =
TextWindow
.NextChar().ToString();
3953
int beforeConsumed =
TextWindow
.Position;
3954
char consumedChar =
TextWindow
.NextChar();
3980
info.Text =
TextWindow
.GetText(intern: false);
3985
if (!
TextWindow
.IsReallyAtEnd())
3995
TextWindow
.Reset(beforeConsumed);
4000
TextWindow
.Reset(beforeConsumed);
4001
if (!
TextWindow
.TryScanXmlEntity(out consumedChar, out consumedSurrogate))
4003
TextWindow
.Reset(beforeConsumed);
4029
Debug.Assert(
TextWindow
.Position > beforeConsumed, "First character or entity has been consumed.");
4059
if (
TextWindow
.PeekChar() == '.')
4144
string actualText =
TextWindow
.GetText(intern: false);
4157
TextWindow
.Reset(beforeConsumed);
4190
if (
TextWindow
.PeekChar() == '@')
4192
TextWindow
.NextChar();
4193
info.Text =
TextWindow
.GetText(intern: true);
4203
else if (
TextWindow
.PeekChar() == '&')
4212
char bad =
TextWindow
.NextChar();
4213
info.Text =
TextWindow
.GetText(intern: false);
4241
char peekCh =
TextWindow
.PeekChar();
4246
TextWindow
.AdvanceChar();
4252
int pos =
TextWindow
.Position;
4256
if (
TextWindow
.TryScanXmlEntity(out nextChar, out nextSurrogate)
4262
TextWindow
.Reset(pos);
4359
switch (ch =
TextWindow
.PeekChar())
4362
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4364
TextWindow
.AdvanceChar(3);
4377
if (!
TextWindow
.IsReallyAtEnd())
4403
var ch =
TextWindow
.PeekChar();
4407
if (
TextWindow
.PeekChar(1) == ']' &&
TextWindow
.PeekChar(2) == '>')
4409
info.StringValue = info.Text =
TextWindow
.GetText(false);
4417
info.StringValue = info.Text =
TextWindow
.GetText(false);
4421
if (!
TextWindow
.IsReallyAtEnd())
4426
info.StringValue = info.Text =
TextWindow
.GetText(false);
4430
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4433
info.StringValue = info.Text =
TextWindow
.GetText(false);
4445
TextWindow
.AdvanceChar();
4481
switch (ch =
TextWindow
.PeekChar())
4484
if (
TextWindow
.PeekChar(1) == '-')
4486
if (
TextWindow
.PeekChar(2) == '>')
4488
TextWindow
.AdvanceChar(3);
4494
TextWindow
.AdvanceChar(2);
4508
if (!
TextWindow
.IsReallyAtEnd())
4533
var ch =
TextWindow
.PeekChar();
4537
if (
TextWindow
.PeekChar(1) == '-')
4539
info.StringValue = info.Text =
TextWindow
.GetText(false);
4547
info.StringValue = info.Text =
TextWindow
.GetText(false);
4551
if (!
TextWindow
.IsReallyAtEnd())
4556
info.StringValue = info.Text =
TextWindow
.GetText(false);
4560
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4563
info.StringValue = info.Text =
TextWindow
.GetText(false);
4575
TextWindow
.AdvanceChar();
4612
switch (ch =
TextWindow
.PeekChar())
4615
if (
TextWindow
.PeekChar(1) == '>')
4617
TextWindow
.AdvanceChar(2);
4630
if (!
TextWindow
.IsReallyAtEnd())
4657
var ch =
TextWindow
.PeekChar();
4661
if (
TextWindow
.PeekChar(1) == '>')
4663
info.StringValue = info.Text =
TextWindow
.GetText(false);
4671
info.StringValue = info.Text =
TextWindow
.GetText(false);
4675
if (!
TextWindow
.IsReallyAtEnd())
4680
info.StringValue = info.Text =
TextWindow
.GetText(false);
4684
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
4687
info.StringValue = info.Text =
TextWindow
.GetText(false);
4699
TextWindow
.AdvanceChar();
4711
var start =
TextWindow
.Position;
4720
if (
TextWindow
.PeekChar() == '/'
4721
&&
TextWindow
.PeekChar(1) == '*'
4722
&&
TextWindow
.PeekChar(2) == '*'
4723
&&
TextWindow
.PeekChar(3) != '*')
4725
TextWindow
.AdvanceChar(3);
4726
var text =
TextWindow
.GetText(true);
4741
char ch =
TextWindow
.PeekChar();
4748
TextWindow
.AdvanceChar();
4752
if (this.StyleIs(XmlDocCommentStyle.SingleLine) &&
TextWindow
.PeekChar(1) == '/' &&
TextWindow
.PeekChar(2) == '/' &&
TextWindow
.PeekChar(3) != '/')
4754
TextWindow
.AdvanceChar(3);
4755
var text =
TextWindow
.GetText(true);
4766
while (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) != '/')
4768
TextWindow
.AdvanceChar();
4771
var text =
TextWindow
.GetText(true);
4781
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4783
TextWindow
.AdvanceChar(2);
4810
TextWindow
.Reset(start);
4817
var text =
TextWindow
.GetText(true);
4829
if (
TextWindow
.PeekChar() == '*' &&
TextWindow
.PeekChar(1) == '/')
4831
TextWindow
.AdvanceChar(2);
4832
var text =
TextWindow
.GetText(true);
4845
char ch =
TextWindow
.PeekChar();
4867
char ch =
TextWindow
.PeekChar();
4886
if (this.StyleIs(XmlDocCommentStyle.Delimited) &&
TextWindow
.PeekChar(1) == '/')
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 (118)
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();
172
TextWindow
.Reset(start);
174
ch =
TextWindow
.NextUnicodeEscape(surrogateCharacter: out surrogateCharacter, info: out error);
178
this.AddError(start,
TextWindow
.Position - start, ErrorCode.ERR_IllegalEscape);
187
Debug.Assert(
TextWindow
.PeekChar() == '@');
190
var start =
TextWindow
.Position;
191
while (
TextWindow
.PeekChar() == '@')
193
TextWindow
.AdvanceChar();
196
if (
TextWindow
.Position - start >= 2)
198
this.AddError(start, width:
TextWindow
.Position - start, ErrorCode.ERR_IllegalAtSequence);
201
Debug.Assert(
TextWindow
.PeekChar() == '"');
202
TextWindow
.AdvanceChar();
206
var ch =
TextWindow
.PeekChar();
209
TextWindow
.AdvanceChar();
210
if (
TextWindow
.PeekChar() == '"')
213
TextWindow
.AdvanceChar();
222
if (ch == SlidingTextWindow.InvalidCharacter &&
TextWindow
.IsReallyAtEnd())
230
TextWindow
.AdvanceChar();
243
info.Text =
TextWindow
.GetText(intern: false);
286
info.Text =
TextWindow
.GetText(intern: false);
354
char ch = _lexer.
TextWindow
.PeekChar();
357
(ch == SlidingTextWindow.InvalidCharacter && _lexer.
TextWindow
.IsReallyAtEnd());
374
var start = _lexer.
TextWindow
.Position;
376
Debug.Assert(_lexer.
TextWindow
.Position != start);
378
openQuoteRange = start.._lexer.
TextWindow
.Position;
384
closeQuoteRange = _lexer.
TextWindow
.Position.._lexer.
TextWindow
.Position;
407
var window = _lexer.
TextWindow
;
503
var closeQuotePosition = _lexer.
TextWindow
.Position;
517
closeQuoteRange = closeQuotePosition.._lexer.
TextWindow
.Position;
524
if (_lexer.
TextWindow
.PeekChar() != '"')
531
IsAtEnd(allowNewline: true) ? _lexer.
TextWindow
.Position - 1 : _lexer.
TextWindow
.Position,
537
_lexer.
TextWindow
.AdvanceChar(); // "
547
if (_lexer.
TextWindow
.PeekChar() != '"')
554
IsAtEnd(allowNewline: true) ? _lexer.
TextWindow
.Position - 1 : _lexer.
TextWindow
.Position,
572
position: _lexer.
TextWindow
.Position - excessQuoteCount,
589
_lexer.
TextWindow
.Position - 1, width: 1, ErrorCode.ERR_UnterminatedRawString));
591
else if (_lexer.
TextWindow
.PeekChar() == '"')
600
position: _lexer.
TextWindow
.Position - closeQuoteCount,
606
_lexer.
TextWindow
.AdvancePastNewLine();
619
position: _lexer.
TextWindow
.Position - excessQuoteCount,
651
switch (_lexer.
TextWindow
.PeekChar())
671
var escapeStart = _lexer.
TextWindow
.Position;
675
TrySetError(_lexer.MakeError(escapeStart, _lexer.
TextWindow
.Position - escapeStart, ErrorCode.ERR_EscapedCurly, ch));
680
_lexer.
TextWindow
.AdvanceChar();
687
_lexer.
TextWindow
.AdvanceChar();
698
var beforeQuotesPosition = _lexer.
TextWindow
.Position;
706
_lexer.
TextWindow
.Position - closeQuoteCount, closeQuoteCount, ErrorCode.ERR_RawStringMustContainContent));
707
_lexer.
TextWindow
.Reset(beforeQuotesPosition);
721
var startPosition = _lexer.
TextWindow
.Position;
722
if (SyntaxFacts.IsNewLine(_lexer.
TextWindow
.PeekChar()))
724
_lexer.
TextWindow
.AdvancePastNewLine();
728
_lexer.
TextWindow
.Reset(startPosition);
764
if (_lexer.
TextWindow
.PeekChar(1) != '"')
770
_lexer.
TextWindow
.AdvanceChar(2); // ""
776
var beforeQuotePosition = _lexer.
TextWindow
.Position;
783
_lexer.
TextWindow
.Reset(beforeQuotePosition);
796
var pos = _lexer.
TextWindow
.Position;
797
_lexer.
TextWindow
.AdvanceChar(); // }
800
if (_lexer.
TextWindow
.PeekChar() == '}')
802
_lexer.
TextWindow
.AdvanceChar(); // }
822
position: _lexer.
TextWindow
.Position - closeBraceCount,
844
if (_lexer.
TextWindow
.PeekChar(1) == '{')
846
_lexer.
TextWindow
.AdvanceChar(2); // {{
850
int openBracePosition = _lexer.
TextWindow
.Position;
851
_lexer.
TextWindow
.AdvanceChar();
853
int closeBracePosition = _lexer.
TextWindow
.Position;
854
if (_lexer.
TextWindow
.PeekChar() == '}')
856
_lexer.
TextWindow
.AdvanceChar();
866
new Range(closeBracePosition, _lexer.
TextWindow
.Position)));
879
var beforeOpenBracesPosition = _lexer.
TextWindow
.Position;
887
var afterOpenBracePosition = _lexer.
TextWindow
.Position;
901
var beforeCloseBracePosition = _lexer.
TextWindow
.Position;
924
_lexer.
TextWindow
.Reset(beforeCloseBracePosition + startingDollarSignCount);
930
beforeCloseBracePosition.._lexer.
TextWindow
.Position));
946
Debug.Assert(_lexer.
TextWindow
.PeekChar() == ':');
947
_lexer.
TextWindow
.AdvanceChar();
950
char ch = _lexer.
TextWindow
.PeekChar();
954
var pos = _lexer.
TextWindow
.Position;
963
if (kind is InterpolatedStringKind.Verbatim && _lexer.
TextWindow
.PeekChar(1) == '"')
965
_lexer.
TextWindow
.AdvanceChar(2); // ""
975
_lexer.
TextWindow
.Position, 1, ErrorCode.ERR_UnexpectedCharacter, ch));
976
_lexer.
TextWindow
.AdvanceChar();
988
_lexer.
TextWindow
.AdvanceChar();
1001
char ch = _lexer.
TextWindow
.PeekChar();
1015
TrySetError(_lexer.MakeError(_lexer.
TextWindow
.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
1016
_lexer.
TextWindow
.AdvanceChar();
1033
colonRange = new Range(_lexer.
TextWindow
.Position, _lexer.
TextWindow
.Position + 1);
1047
TrySetError(_lexer.MakeError(_lexer.
TextWindow
.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString()));
1077
switch (_lexer.
TextWindow
.PeekChar(1))
1086
_lexer.
TextWindow
.AdvanceChar();
1103
_lexer.
TextWindow
.AdvanceChar();
1124
Debug.Assert(start == _lexer.
TextWindow
.PeekChar());
1125
_lexer.
TextWindow
.AdvanceChar();
1127
if (_lexer.
TextWindow
.PeekChar() == end)
1129
_lexer.
TextWindow
.AdvanceChar();
Parser\QuickScanner.cs (13)
199
int i =
TextWindow
.Offset;
200
int n =
TextWindow
.CharacterWindowCount;
206
var charWindow =
TextWindow
.CharacterWindow;
234
TextWindow
.AdvanceChar(i -
TextWindow
.Offset);
241
TextWindow
.CharacterWindow,
242
TextWindow
.LexemeRelativeStart,
243
i -
TextWindow
.LexemeRelativeStart,
250
TextWindow
.Reset(
TextWindow
.LexemeStartPosition);
260
var quickWidth =
TextWindow
.Width;
262
TextWindow
.Reset(
TextWindow
.LexemeStartPosition);
Parser\SyntaxParser.cs (1)
125
var size = Math.Min(4096, Math.Max(32, this.lexer.
TextWindow
.Text.Length / 2));