1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21this.TextWindow = new SlidingTextWindow(text);
672 references to TextWindow
Microsoft.CodeAnalysis.CSharp (672)
Parser\AbstractLexer.cs (4)
26this.TextWindow.Dispose(); 31TextWindow.Start(); 134return position >= TextWindow.LexemeStartPosition ? position - TextWindow.LexemeStartPosition : position;
Parser\Blender.cs (1)
69_newPosition = lexer.TextWindow.Position;
Parser\Blender.Reader.cs (1)
165if (_lexer.TextWindow.Position != _newPosition)
Parser\DirectiveParser.cs (1)
36var hashPosition = lexer.TextWindow.Position;
Parser\LanguageParser.cs (2)
219return CreateForGlobalFailure(lexer.TextWindow.Position, createEmptyNodeFunc(this)); 229builder.Add(SyntaxFactory.BadToken(null, lexer.TextWindow.Text.ToString(), null));
Parser\Lexer.cs (480)
172this.TextWindow.Reset(position); 310this.LexSyntaxTrivia(isFollowingToken: TextWindow.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache); 329this.LexSyntaxTrivia(isFollowingToken: TextWindow.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache); 449int startingPosition = TextWindow.Position; 452character = TextWindow.PeekChar(); 461TextWindow.AdvanceChar(); 462info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.SlashEqualsToken : SyntaxKind.SlashToken; 466if (this.TextWindow.PeekChar(1) is >= '0' and <= '9') 468var atDotPosition = this.TextWindow.Position; 470atDotPosition == this.TextWindow.LexemeStartPosition) 479this.TextWindow.Reset(atDotPosition - 1); 480var priorCharacterIsDot = this.TextWindow.PeekChar() is '.'; 481this.TextWindow.Reset(atDotPosition); 486TextWindow.AdvanceChar(); 497TextWindow.AdvanceChar(); 504TextWindow.AdvanceChar(); 509TextWindow.AdvanceChar(); 510info.Kind = TextWindow.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken; 514TextWindow.AdvanceChar(); 519TextWindow.AdvanceChar(); 524TextWindow.AdvanceChar(); 525info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken; 529TextWindow.AdvanceChar(); 531TextWindow.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken : 532TextWindow.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken; 536TextWindow.AdvanceChar(); 537info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken; 541TextWindow.AdvanceChar(); 546TextWindow.AdvanceChar(); 551TextWindow.AdvanceChar(); 556TextWindow.AdvanceChar(); 561TextWindow.AdvanceChar(); 566TextWindow.AdvanceChar(); 571TextWindow.AdvanceChar(); 572info.Kind = TextWindow.TryAdvance('?') 573? TextWindow.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken 578TextWindow.AdvanceChar(); 580TextWindow.TryAdvance('=') ? SyntaxKind.PlusEqualsToken : 581TextWindow.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken; 585TextWindow.AdvanceChar(); 587TextWindow.TryAdvance('=') ? SyntaxKind.MinusEqualsToken : 588TextWindow.TryAdvance('-') ? SyntaxKind.MinusMinusToken : 589TextWindow.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken; 593TextWindow.AdvanceChar(); 594info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken; 598TextWindow.AdvanceChar(); 600TextWindow.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken : 601TextWindow.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken; 605TextWindow.AdvanceChar(); 606info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken; 610TextWindow.AdvanceChar(); 612TextWindow.TryAdvance('=') ? SyntaxKind.BarEqualsToken : 613TextWindow.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken; 617TextWindow.AdvanceChar(); 619TextWindow.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken : 620TextWindow.TryAdvance('<') 621? TextWindow.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken 626TextWindow.AdvanceChar(); 627info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken; 634Debug.Assert(TextWindow.PeekChar() == '@'); 636if (TextWindow.PeekChar(1) == ':') 641this.AddError(TextWindow.Position + 1, width: 1, ErrorCode.ERR_ExpectedVerbatimLiteral); 644info.Text = TextWindow.GetText(false); 649info.Text = TextWindow.GetText(intern: true); 690if (!TextWindow.IsReallyAtEnd()) 721TextWindow.AdvanceChar(); 726if (char.IsHighSurrogate(character) && char.IsLowSurrogate(TextWindow.PeekChar())) 727TextWindow.AdvanceChar(); 735info.Text = TextWindow.GetText(intern: true); 739int end = TextWindow.Text.Length; 740info.Text = TextWindow.Text.ToString(TextSpan.FromBounds(startingPosition, end)); 741TextWindow.Reset(end); 758Debug.Assert(TextWindow.PeekChar() == '@'); 761while (TextWindow.PeekChar(index) == '@') 766if (TextWindow.PeekChar(index) == '"') 772else if (TextWindow.PeekChar(index) == '$') 784Debug.Assert(TextWindow.PeekChar() == '$'); 786if (TextWindow.PeekChar(1) is '$' or '@' or '"') 811int start = TextWindow.Position; 812while (TextWindow.PeekChar() is >= '0' and <= '9') 814TextWindow.AdvanceChar(); 817return start < TextWindow.Position; 823if (TextWindow.PeekChar() == '_') 838char ch = TextWindow.PeekChar(); 855TextWindow.AdvanceChar(); 866int start = TextWindow.Position; 881ch = TextWindow.PeekChar(); 884ch = TextWindow.PeekChar(1); 887TextWindow.AdvanceChar(2); 893TextWindow.AdvanceChar(2); 904if (TextWindow.PeekChar() is 'L' or 'l') 906TextWindow.AdvanceChar(); 908if (TextWindow.PeekChar() is 'u' or 'U') 910TextWindow.AdvanceChar(); 914else if (TextWindow.PeekChar() is 'u' or 'U') 916TextWindow.AdvanceChar(); 918if (TextWindow.PeekChar() is 'L' or 'l') 920TextWindow.AdvanceChar(); 929if (this.ModeIs(LexerMode.DebuggerSyntax) && TextWindow.PeekChar() == '#') 932TextWindow.AdvanceChar(); 933info.StringValue = info.Text = TextWindow.GetText(intern: true); 939if ((ch = TextWindow.PeekChar()) == '.') 941var ch2 = TextWindow.PeekChar(1); 946TextWindow.AdvanceChar(); 953TextWindow.Reset(start); 958if ((ch = TextWindow.PeekChar()) is 'E' or 'e') 961TextWindow.AdvanceChar(); 963if ((ch = TextWindow.PeekChar()) is '-' or '+') 966TextWindow.AdvanceChar(); 969if (!(((ch = TextWindow.PeekChar()) >= '0' && ch <= '9') || ch == '_')) 982ch = TextWindow.PeekChar(); 987TextWindow.AdvanceChar(); 992TextWindow.AdvanceChar(); 997TextWindow.AdvanceChar(); 1007TextWindow.AdvanceChar(); 1012TextWindow.AdvanceChar(); 1017TextWindow.AdvanceChar(); 1022TextWindow.AdvanceChar(); 1024if (TextWindow.PeekChar() is 'u' or 'U') 1026TextWindow.AdvanceChar(); 1033TextWindow.AdvanceChar(); 1034if (TextWindow.PeekChar() is 'L' or 'l') 1036TextWindow.AdvanceChar(); 1044this.AddError(MakeError(start, TextWindow.Position - start, ErrorCode.ERR_InvalidNumber)); 1056info.Text = TextWindow.GetText(true); 1058var valueText = TextWindow.Intern(_builder); 1069info.DecimalValue = this.GetValueDecimal(valueText, start, TextWindow.Position); 1349var currentOffset = TextWindow.Offset; 1350var characterWindow = TextWindow.CharacterWindow; 1351var characterWindowCount = TextWindow.CharacterWindowCount; 1414TextWindow.AdvanceChar(length); 1415info.Text = info.StringValue = TextWindow.Intern(characterWindow, startOffset, length); 1447int start = TextWindow.Position; 1450while (TextWindow.PeekChar() == '@') 1452TextWindow.AdvanceChar(); 1455var atCount = TextWindow.Position - start; 1463char ch = TextWindow.PeekChar(); 1486if (!TextWindow.IsReallyAtEnd()) 1506(char.ToLower(TextWindow.PeekChar(1)) == 'x')) 1540if (_identLen == 0 && this.ModeIs(LexerMode.DebuggerSyntax) && TextWindow.PeekChar(1) == '>') 1543TextWindow.AdvanceChar(2); 1570TextWindow.AdvanceChar(); 1594TextWindow.AdvanceChar(); 1605var width = TextWindow.Width; // exact size of input characters 1608info.Text = TextWindow.GetInternedText(); 1617info.StringValue = TextWindow.Intern(_identBuffer, 0, _identLen); 1625var valueText = TextWindow.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset); 1646TextWindow.Reset(start); 1662int start = TextWindow.Position; 1681int beforeConsumed = TextWindow.Position; 1685if (TextWindow.PeekChar() == '&') 1690TextWindow.Reset(beforeConsumed); 1696consumedChar = TextWindow.NextChar(); 1716if (!isEscaped && (TextWindow.Position == beforeConsumed + 1) && 1717TextWindow.PeekChar() is 'u' or 'U') 1723TextWindow.Reset(beforeConsumed); 1745TextWindow.Reset(beforeConsumed); 1763TextWindow.Reset(beforeConsumed); 1766if (!TextWindow.IsReallyAtEnd()) 1771TextWindow.Reset(beforeConsumed); 1793TextWindow.Reset(beforeConsumed); 1814var width = TextWindow.Width; // exact size of input characters 1819info.StringValue = TextWindow.GetInternedText(); 1824info.StringValue = TextWindow.Intern(_identBuffer, 0, _identLen); 1825info.Text = TextWindow.GetText(intern: false); 1834TextWindow.Reset(start); 1903char ch = TextWindow.PeekChar(); 1931if ((ch = TextWindow.PeekChar(1)) == '/') 1933if (!this.SuppressDocumentationCommentParse && TextWindow.PeekChar(2) == '/' && TextWindow.PeekChar(3) != '/') 1953if (!this.SuppressDocumentationCommentParse && TextWindow.PeekChar(2) == '*' && 1954TextWindow.PeekChar(3) != '*' && TextWindow.PeekChar(3) != '/') 1975if ((ch = TextWindow.PeekChar(1)) == '*') 1978this.AddError(TextWindow.Position, width: 1, ErrorCode.ERR_UnexpectedCharacter, '@'); 2009var savePosition = TextWindow.Position; 2015var text = TextWindow.Text.GetSubText(TextSpan.FromBounds(savePosition, TextWindow.Position)); 2064var text = TextWindow.GetText(false); 2078var text = TextWindow.GetText(false); 2089var position = TextWindow.Position; 2090var text = TextWindow.Text; 2123this.AddError(TextWindow.Position, s_conflictMarkerLength, 2126var startCh = this.TextWindow.PeekChar(); 2152var ch = this.TextWindow.PeekChar(); 2171this.TextWindow.AdvanceChar(); 2174if (this.TextWindow.Width > 0) 2176this.AddTrivia(SyntaxFactory.DisabledText(TextWindow.GetText(false)), ref triviaList); 2190while (SyntaxFacts.IsNewLine(this.TextWindow.PeekChar())) 2192this.TextWindow.AdvanceChar(); 2195if (this.TextWindow.Width > 0) 2197this.AddTrivia(SyntaxFactory.EndOfLine(TextWindow.GetText(false)), ref triviaList); 2205var ch = this.TextWindow.PeekChar(); 2211this.TextWindow.AdvanceChar(); 2214this.AddTrivia(SyntaxFactory.ConflictMarker(TextWindow.GetText(false)), ref triviaList); 2235Debug.Assert(TextWindow.PeekChar() == delimiter && TextWindow.PeekChar(1) == '*'); 2236TextWindow.AdvanceChar(2); 2241if ((ch = TextWindow.PeekChar()) == SlidingTextWindow.InvalidCharacter && TextWindow.IsReallyAtEnd()) 2246else if (ch == '*' && TextWindow.PeekChar(1) == delimiter) 2248TextWindow.AdvanceChar(2); 2254TextWindow.AdvanceChar(); 2262while (!SyntaxFacts.IsNewLine(ch = TextWindow.PeekChar()) && 2263(ch != SlidingTextWindow.InvalidCharacter || !TextWindow.IsReallyAtEnd())) 2265TextWindow.AdvanceChar(); 2276switch (ch = TextWindow.PeekChar()) 2279TextWindow.AdvanceChar(); 2280return TextWindow.TryAdvance('\n') ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.CarriageReturn; 2282TextWindow.AdvanceChar(); 2287TextWindow.AdvanceChar(); 2305char ch = TextWindow.PeekChar(); 2317TextWindow.AdvanceChar(); 2334if (TextWindow.Width == 1 && onlySpaces) 2340var width = TextWindow.Width; 2345TextWindow.CharacterWindow, 2346TextWindow.LexemeRelativeStart, 2350TextWindow); 2354return CreateWhitespaceTrivia(TextWindow); 2413if (SyntaxFacts.IsWhitespace(TextWindow.PeekChar())) 2447int lastLineStart = TextWindow.Position; 2453char ch = TextWindow.PeekChar(); 2457if (!TextWindow.IsReallyAtEnd()) 2463return TextWindow.Width > 0 ? SyntaxFactory.DisabledText(TextWindow.GetText(false)) : null; 2467if (lastLineStart < TextWindow.Position && !allWhitespace) 2472TextWindow.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line 2473return TextWindow.Width > 0 ? SyntaxFactory.DisabledText(TextWindow.GetText(false)) : null; 2477lastLineStart = TextWindow.Position; 2488TextWindow.AdvanceChar(); 2520var ch = this.TextWindow.PeekChar(); 2526else if (ch is SlidingTextWindow.InvalidCharacter && this.TextWindow.IsReallyAtEnd()) 2534this.TextWindow.AdvanceChar(); 2561switch (character = TextWindow.PeekChar()) 2564if (!TextWindow.IsReallyAtEnd()) 2579TextWindow.AdvanceChar(); 2584TextWindow.AdvanceChar(); 2589TextWindow.AdvanceChar(); 2594TextWindow.AdvanceChar(); 2599TextWindow.AdvanceChar(); 2604TextWindow.AdvanceChar(); 2605if (TextWindow.PeekChar() == '=') 2607TextWindow.AdvanceChar(); 2618TextWindow.AdvanceChar(); 2619if (TextWindow.PeekChar() == '=') 2621TextWindow.AdvanceChar(); 2632if (TextWindow.PeekChar(1) == '&') 2634TextWindow.AdvanceChar(2); 2642if (TextWindow.PeekChar(1) == '|') 2644TextWindow.AdvanceChar(2); 2663info.Text = TextWindow.GetText(true); 2707TextWindow.AdvanceChar(); 2711info.Text = TextWindow.GetText(true); 2726var pos = TextWindow.Position; 2741TextWindow.Reset(pos); 2758char ch = TextWindow.PeekChar(); 2762if (TextWindow.PeekChar(1) == '/') 2766var text = TextWindow.GetText(false); 2812Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter); 2821this.AddError(TextWindow.LexemeStartPosition, TextWindow.Width, ErrorCode.ERR_OpenEndedComment); 2857switch (ch = TextWindow.PeekChar()) 2874if (!TextWindow.IsReallyAtEnd()) 2900info.StringValue = info.Text = TextWindow.GetText(intern: false); 2907Debug.Assert(TextWindow.PeekChar() == '<'); 2909if (TextWindow.PeekChar(1) == '!') 2911if (TextWindow.PeekChar(2) == '-' 2912&& TextWindow.PeekChar(3) == '-') 2914TextWindow.AdvanceChar(4); 2917else if (TextWindow.PeekChar(2) == '[' 2918&& TextWindow.PeekChar(3) == 'C' 2919&& TextWindow.PeekChar(4) == 'D' 2920&& TextWindow.PeekChar(5) == 'A' 2921&& TextWindow.PeekChar(6) == 'T' 2922&& TextWindow.PeekChar(7) == 'A' 2923&& TextWindow.PeekChar(8) == '[') 2925TextWindow.AdvanceChar(9); 2931TextWindow.AdvanceChar(); 2935else if (TextWindow.PeekChar(1) == '/') 2937TextWindow.AdvanceChar(2); 2940else if (TextWindow.PeekChar(1) == '?') 2942TextWindow.AdvanceChar(2); 2947TextWindow.AdvanceChar(); 2956Debug.Assert(TextWindow.PeekChar() == '&'); 2957TextWindow.AdvanceChar(); 2963if (IsXmlNameStartChar(ch = TextWindow.PeekChar())) 2965while (IsXmlNameChar(ch = TextWindow.PeekChar())) 2973TextWindow.AdvanceChar(); 3002TextWindow.AdvanceChar(); 3003bool isHex = TextWindow.PeekChar() == 'x'; 3008TextWindow.AdvanceChar(); // x 3009while (SyntaxFacts.IsHexDigit(ch = TextWindow.PeekChar())) 3011TextWindow.AdvanceChar(); 3022while (SyntaxFacts.IsDecDigit(ch = TextWindow.PeekChar())) 3024TextWindow.AdvanceChar(); 3034if (TextWindow.PeekChar() != ';') 3079ch = TextWindow.PeekChar(); 3082TextWindow.AdvanceChar(); 3096info.Text = TextWindow.GetText(true); 3124if (TextWindow.PeekChar() == ']' && TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3126TextWindow.AdvanceChar(3); 3127info.StringValue = info.Text = TextWindow.GetText(false); 3134var ch = TextWindow.PeekChar(); 3138if (!TextWindow.IsReallyAtEnd()) 3143info.StringValue = info.Text = TextWindow.GetText(false); 3149info.StringValue = info.Text = TextWindow.GetText(false); 3153if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3156info.StringValue = info.Text = TextWindow.GetText(false); 3163if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3165info.StringValue = info.Text = TextWindow.GetText(false); 3177TextWindow.AdvanceChar(); 3224switch (ch = TextWindow.PeekChar()) 3231TextWindow.AdvanceChar(); 3236if (TextWindow.PeekChar(1) == '>') 3238TextWindow.AdvanceChar(2); 3246TextWindow.AdvanceChar(); 3251TextWindow.AdvanceChar(); 3256TextWindow.AdvanceChar(); 3261TextWindow.AdvanceChar(); 3271if (!TextWindow.IsReallyAtEnd()) 3280if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3303TextWindow.AdvanceChar(); 3305info.StringValue = info.Text = TextWindow.GetText(false); 3317int start = TextWindow.Position; 3321char ch = TextWindow.PeekChar(); 3333TextWindow.AdvanceChar(); 3341info.Text = TextWindow.GetText(start, TextWindow.Position - start, intern: true); 3398switch (ch = TextWindow.PeekChar()) 3403TextWindow.AdvanceChar(); 3413TextWindow.AdvanceChar(); 3426TextWindow.AdvanceChar(); 3436if (!TextWindow.IsReallyAtEnd()) 3463var ch = TextWindow.PeekChar(); 3469info.StringValue = info.Text = TextWindow.GetText(false); 3478info.StringValue = info.Text = TextWindow.GetText(false); 3488info.StringValue = info.Text = TextWindow.GetText(false); 3492if (!TextWindow.IsReallyAtEnd()) 3497info.StringValue = info.Text = TextWindow.GetText(false); 3501if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3504info.StringValue = info.Text = TextWindow.GetText(false); 3516TextWindow.AdvanceChar(); 3555switch (TextWindow.PeekChar()) 3562if (!TextWindow.IsReallyAtEnd()) 3570info.Text = info.StringValue = TextWindow.NextChar().ToString(); 3615int beforeConsumed = TextWindow.Position; 3616char consumedChar = TextWindow.NextChar(); 3642info.Text = TextWindow.GetText(intern: false); 3647if (!TextWindow.IsReallyAtEnd()) 3657TextWindow.Reset(beforeConsumed); 3662TextWindow.Reset(beforeConsumed); 3665TextWindow.Reset(beforeConsumed); 3691Debug.Assert(TextWindow.Position > beforeConsumed, "First character or entity has been consumed."); 3721if (TextWindow.PeekChar() == '.') 3806string actualText = TextWindow.GetText(intern: false); 3819TextWindow.Reset(beforeConsumed); 3852if (TextWindow.PeekChar() == '@') 3854TextWindow.NextChar(); 3855info.Text = TextWindow.GetText(intern: true); 3865else if (TextWindow.PeekChar() == '&') 3874char bad = TextWindow.NextChar(); 3875info.Text = TextWindow.GetText(intern: false); 3903char peekCh = TextWindow.PeekChar(); 3908TextWindow.AdvanceChar(); 3914int pos = TextWindow.Position; 3924TextWindow.Reset(pos); 4021switch (ch = TextWindow.PeekChar()) 4024if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 4026TextWindow.AdvanceChar(3); 4039if (!TextWindow.IsReallyAtEnd()) 4065var ch = TextWindow.PeekChar(); 4069if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 4071info.StringValue = info.Text = TextWindow.GetText(false); 4079info.StringValue = info.Text = TextWindow.GetText(false); 4083if (!TextWindow.IsReallyAtEnd()) 4088info.StringValue = info.Text = TextWindow.GetText(false); 4092if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4095info.StringValue = info.Text = TextWindow.GetText(false); 4107TextWindow.AdvanceChar(); 4143switch (ch = TextWindow.PeekChar()) 4146if (TextWindow.PeekChar(1) == '-') 4148if (TextWindow.PeekChar(2) == '>') 4150TextWindow.AdvanceChar(3); 4156TextWindow.AdvanceChar(2); 4170if (!TextWindow.IsReallyAtEnd()) 4195var ch = TextWindow.PeekChar(); 4199if (TextWindow.PeekChar(1) == '-') 4201info.StringValue = info.Text = TextWindow.GetText(false); 4209info.StringValue = info.Text = TextWindow.GetText(false); 4213if (!TextWindow.IsReallyAtEnd()) 4218info.StringValue = info.Text = TextWindow.GetText(false); 4222if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4225info.StringValue = info.Text = TextWindow.GetText(false); 4237TextWindow.AdvanceChar(); 4274switch (ch = TextWindow.PeekChar()) 4277if (TextWindow.PeekChar(1) == '>') 4279TextWindow.AdvanceChar(2); 4292if (!TextWindow.IsReallyAtEnd()) 4319var ch = TextWindow.PeekChar(); 4323if (TextWindow.PeekChar(1) == '>') 4325info.StringValue = info.Text = TextWindow.GetText(false); 4333info.StringValue = info.Text = TextWindow.GetText(false); 4337if (!TextWindow.IsReallyAtEnd()) 4342info.StringValue = info.Text = TextWindow.GetText(false); 4346if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4349info.StringValue = info.Text = TextWindow.GetText(false); 4361TextWindow.AdvanceChar(); 4373var start = TextWindow.Position; 4382if (TextWindow.PeekChar() == '/' 4383&& TextWindow.PeekChar(1) == '*' 4384&& TextWindow.PeekChar(2) == '*' 4385&& TextWindow.PeekChar(3) != '*') 4387TextWindow.AdvanceChar(3); 4388var text = TextWindow.GetText(true); 4403char ch = TextWindow.PeekChar(); 4410TextWindow.AdvanceChar(); 4414if (this.StyleIs(XmlDocCommentStyle.SingleLine) && TextWindow.PeekChar(1) == '/' && TextWindow.PeekChar(2) == '/' && TextWindow.PeekChar(3) != '/') 4416TextWindow.AdvanceChar(3); 4417var text = TextWindow.GetText(true); 4428while (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) != '/') 4430TextWindow.AdvanceChar(); 4433var text = TextWindow.GetText(true); 4443if (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) == '/') 4445TextWindow.AdvanceChar(2); 4472TextWindow.Reset(start); 4479var text = TextWindow.GetText(true); 4491if (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) == '/') 4493TextWindow.AdvanceChar(2); 4494var text = TextWindow.GetText(true); 4507char ch = TextWindow.PeekChar(); 4529char ch = TextWindow.PeekChar(); 4548if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4574if (TextWindow.PeekChar() == '\\') 4576var ch2 = TextWindow.PeekChar(1); 4595return TextWindow.PeekChar(); 4601int position = TextWindow.Position; 4607TextWindow.Reset(position); 4613var ch = TextWindow.PeekChar(); 4617var ch2 = TextWindow.PeekChar(1); 4626TextWindow.AdvanceChar(); 4640int start = TextWindow.Position; 4641char character = TextWindow.PeekChar(); 4643TextWindow.AdvanceChar(); 4645character = TextWindow.PeekChar(); 4650TextWindow.AdvanceChar(); 4651if (!SyntaxFacts.IsHexDigit(TextWindow.PeekChar())) 4662character = TextWindow.PeekChar(); 4674TextWindow.AdvanceChar(); 4695TextWindow.AdvanceChar(); 4696if (!SyntaxFacts.IsHexDigit(TextWindow.PeekChar())) 4707char ch2 = TextWindow.PeekChar(); 4722TextWindow.AdvanceChar(); 4746Debug.Assert(TextWindow.PeekChar() == '&'); 4749TextWindow.AdvanceChar(); 4753switch (TextWindow.PeekChar()) 4756if (TextWindow.AdvanceIfMatches("lt;")) 4763if (TextWindow.AdvanceIfMatches("gt;")) 4770if (TextWindow.AdvanceIfMatches("amp;")) 4775else if (TextWindow.AdvanceIfMatches("apos;")) 4782if (TextWindow.AdvanceIfMatches("quot;")) 4790TextWindow.AdvanceChar(); //# 4794if (TextWindow.AdvanceIfMatches("x")) 4797while (SyntaxFacts.IsHexDigit(digit = TextWindow.PeekChar())) 4799TextWindow.AdvanceChar(); 4815while (SyntaxFacts.IsDecDigit(digit = TextWindow.PeekChar())) 4817TextWindow.AdvanceChar(); 4831if (TextWindow.AdvanceIfMatches(";")) 4846return new SyntaxDiagnosticInfo(start - TextWindow.LexemeStartPosition, 4847TextWindow.Position - start,
Parser\Lexer_RawStringLiteral.cs (45)
19var start = TextWindow.Position; 20while (TextWindow.PeekChar() == ch) 21TextWindow.AdvanceChar(); 23return TextWindow.Position - start; 45var ch = TextWindow.PeekChar(); 50TextWindow.AdvanceChar(); 55=> currentChar == SlidingTextWindow.InvalidCharacter && TextWindow.IsReallyAtEnd(); 68if (SyntaxFacts.IsNewLine(TextWindow.PeekChar())) 90var afterStartDelimiter = TextWindow.LexemeStartPosition + startingQuoteCount; 91var valueLength = TextWindow.Position - afterStartDelimiter; 93info.StringValue = TextWindow.GetText( 123info.Text = TextWindow.GetText(intern: true); 132var currentChar = TextWindow.PeekChar(); 137this.AddError(TextWindow.Position, width: TextWindow.GetNewLineWidth(), ErrorCode.ERR_UnterminatedRawString); 142this.AddError(TextWindow.Position, width: 0, ErrorCode.ERR_UnterminatedRawString); 149TextWindow.AdvanceChar(); 153var beforeEndDelimiter = TextWindow.Position; 166position: TextWindow.Position - excessQuoteCount, 172var afterStartDelimiter = TextWindow.LexemeStartPosition + startingQuoteCount; 175info.StringValue = TextWindow.GetText( 196var afterStartDelimiter = TextWindow.Position; 197Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar())); 211position: TextWindow.Position - startingQuoteCount, 222var tokenEnd = TextWindow.Position; 223TextWindow.Reset(afterStartDelimiter); 224Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar())); 238info.StringValue = this.HasErrors ? "" : TextWindow.Intern(_builder); 242TextWindow.Reset(tokenEnd); 254TextWindow.AdvancePastNewLine(); 269position: TextWindow.Position - excessQuoteCount, 282var currentChar = TextWindow.PeekChar(); 285this.AddError(TextWindow.Position, width: 0, ErrorCode.ERR_UnterminatedRawString); 299position: TextWindow.Position - currentQuoteCount, 307TextWindow.AdvanceChar(); 317Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar())); 319var newLineWidth = TextWindow.GetNewLineWidth(); 324_builder.Append(TextWindow.PeekChar()); 326TextWindow.AdvanceChar(); 329var lineStartPosition = TextWindow.Position; 341var isBlankLine = SyntaxFacts.IsNewLine(TextWindow.PeekChar()); 352width: TextWindow.Position - lineStartPosition, 360width: TextWindow.Position - lineStartPosition, 380var currentChar = TextWindow.PeekChar(); 386TextWindow.AdvanceChar();
Parser\Lexer_StringLiteral.cs (119)
16var quoteCharacter = TextWindow.PeekChar(); 19if (TextWindow.PeekChar() == '"' && 20TextWindow.PeekChar(1) == '"' && 21TextWindow.PeekChar(2) == '"') 35TextWindow.AdvanceChar(); 40char ch = TextWindow.PeekChar(); 54TextWindow.AdvanceChar(); 58(ch == SlidingTextWindow.InvalidCharacter && TextWindow.IsReallyAtEnd())) 63Debug.Assert(TextWindow.Width > 0); 69TextWindow.AdvanceChar(); 76info.Text = TextWindow.GetText(intern: true); 85info.StringValue = TextWindow.Intern(_builder); 105info.Text = TextWindow.GetText(intern: true); 109info.StringValue = TextWindow.Intern(_builder); 120if (TextWindow.PeekChar() is ('u' or 'U') && TextWindow.PeekChar(1) == '8') 122TextWindow.AdvanceChar(2); 131var start = TextWindow.Position; 133char ch = TextWindow.NextChar(); 136ch = TextWindow.NextChar(); 157this.AddError(start, TextWindow.Position - start, info.Code, info.Arguments); 179TextWindow.Reset(start); 185this.AddError(start, TextWindow.Position - start, ErrorCode.ERR_IllegalEscape); 194Debug.Assert(TextWindow.PeekChar() == '@'); 197var start = TextWindow.Position; 198while (TextWindow.PeekChar() == '@') 200TextWindow.AdvanceChar(); 203if (TextWindow.Position - start >= 2) 205this.AddError(start, width: TextWindow.Position - start, ErrorCode.ERR_IllegalAtSequence); 208Debug.Assert(TextWindow.PeekChar() == '"'); 209TextWindow.AdvanceChar(); 213var ch = TextWindow.PeekChar(); 216TextWindow.AdvanceChar(); 217if (TextWindow.PeekChar() == '"') 220TextWindow.AdvanceChar(); 229if (ch == SlidingTextWindow.InvalidCharacter && TextWindow.IsReallyAtEnd()) 237TextWindow.AdvanceChar(); 250info.Text = TextWindow.GetText(intern: false); 293info.Text = TextWindow.GetText(intern: false); 361char ch = _lexer.TextWindow.PeekChar(); 364(ch == SlidingTextWindow.InvalidCharacter && _lexer.TextWindow.IsReallyAtEnd()); 381var start = _lexer.TextWindow.Position; 383Debug.Assert(_lexer.TextWindow.Position != start); 385openQuoteRange = start.._lexer.TextWindow.Position; 391closeQuoteRange = _lexer.TextWindow.Position.._lexer.TextWindow.Position; 414var window = _lexer.TextWindow; 510var closeQuotePosition = _lexer.TextWindow.Position; 524closeQuoteRange = closeQuotePosition.._lexer.TextWindow.Position; 531if (_lexer.TextWindow.PeekChar() != '"') 538IsAtEnd(allowNewline: true) ? _lexer.TextWindow.Position - 1 : _lexer.TextWindow.Position, 544_lexer.TextWindow.AdvanceChar(); // " 554if (_lexer.TextWindow.PeekChar() != '"') 561IsAtEnd(allowNewline: true) ? _lexer.TextWindow.Position - 1 : _lexer.TextWindow.Position, 579position: _lexer.TextWindow.Position - excessQuoteCount, 596_lexer.TextWindow.Position - 1, width: 1, ErrorCode.ERR_UnterminatedRawString)); 598else if (_lexer.TextWindow.PeekChar() == '"') 607position: _lexer.TextWindow.Position - closeQuoteCount, 613_lexer.TextWindow.AdvancePastNewLine(); 626position: _lexer.TextWindow.Position - excessQuoteCount, 658switch (_lexer.TextWindow.PeekChar()) 678var escapeStart = _lexer.TextWindow.Position; 682TrySetError(_lexer.MakeError(escapeStart, _lexer.TextWindow.Position - escapeStart, ErrorCode.ERR_EscapedCurly, ch)); 687_lexer.TextWindow.AdvanceChar(); 694_lexer.TextWindow.AdvanceChar(); 705var beforeQuotesPosition = _lexer.TextWindow.Position; 713_lexer.TextWindow.Position - closeQuoteCount, closeQuoteCount, ErrorCode.ERR_RawStringMustContainContent)); 714_lexer.TextWindow.Reset(beforeQuotesPosition); 728var startPosition = _lexer.TextWindow.Position; 729if (SyntaxFacts.IsNewLine(_lexer.TextWindow.PeekChar())) 731_lexer.TextWindow.AdvancePastNewLine(); 735_lexer.TextWindow.Reset(startPosition); 771if (_lexer.TextWindow.PeekChar(1) != '"') 777_lexer.TextWindow.AdvanceChar(2); // "" 783var beforeQuotePosition = _lexer.TextWindow.Position; 790_lexer.TextWindow.Reset(beforeQuotePosition); 803var pos = _lexer.TextWindow.Position; 804_lexer.TextWindow.AdvanceChar(); // } 807if (_lexer.TextWindow.PeekChar() == '}') 809_lexer.TextWindow.AdvanceChar(); // } 829position: _lexer.TextWindow.Position - closeBraceCount, 851if (_lexer.TextWindow.PeekChar(1) == '{') 853_lexer.TextWindow.AdvanceChar(2); // {{ 857int openBracePosition = _lexer.TextWindow.Position; 858_lexer.TextWindow.AdvanceChar(); 860int closeBracePosition = _lexer.TextWindow.Position; 861if (_lexer.TextWindow.PeekChar() == '}') 863_lexer.TextWindow.AdvanceChar(); 873new Range(closeBracePosition, _lexer.TextWindow.Position))); 886var beforeOpenBracesPosition = _lexer.TextWindow.Position; 894var afterOpenBracePosition = _lexer.TextWindow.Position; 908var beforeCloseBracePosition = _lexer.TextWindow.Position; 931_lexer.TextWindow.Reset(beforeCloseBracePosition + startingDollarSignCount); 937beforeCloseBracePosition.._lexer.TextWindow.Position)); 953Debug.Assert(_lexer.TextWindow.PeekChar() == ':'); 954_lexer.TextWindow.AdvanceChar(); 957char ch = _lexer.TextWindow.PeekChar(); 961var pos = _lexer.TextWindow.Position; 970if (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(); 1008char ch = _lexer.TextWindow.PeekChar(); 1022TrySetError(_lexer.MakeError(_lexer.TextWindow.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString())); 1023_lexer.TextWindow.AdvanceChar(); 1040colonRange = new Range(_lexer.TextWindow.Position, _lexer.TextWindow.Position + 1); 1054TrySetError(_lexer.MakeError(_lexer.TextWindow.Position, 1, ErrorCode.ERR_SyntaxError, endingChar.ToString())); 1080if (_lexer.TextWindow.PeekChar(1) == '*') 1092switch (_lexer.TextWindow.PeekChar(1)) 1101_lexer.TextWindow.AdvanceChar(); 1118_lexer.TextWindow.AdvanceChar(); 1139Debug.Assert(start == _lexer.TextWindow.PeekChar()); 1140_lexer.TextWindow.AdvanceChar(); 1142if (_lexer.TextWindow.PeekChar() == end) 1144_lexer.TextWindow.AdvanceChar();
Parser\QuickScanner.cs (13)
196int i = TextWindow.Offset; 197int n = TextWindow.CharacterWindowCount; 203var charWindow = TextWindow.CharacterWindow; 231TextWindow.AdvanceChar(i - TextWindow.Offset); 238TextWindow.CharacterWindow, 239TextWindow.LexemeRelativeStart, 240i - TextWindow.LexemeRelativeStart, 248TextWindow.Reset(TextWindow.LexemeStartPosition); 256var quickWidth = lexer.TextWindow.Width; 258lexer.TextWindow.Reset(lexer.TextWindow.LexemeStartPosition);
Parser\SyntaxParser.cs (1)
141var size = Math.Min(CachedTokenArraySize, this.lexer.TextWindow.Text.Length / 2);
Syntax\SyntaxTokenParser.cs (5)
54var startingPosition = _lexer.TextWindow.Position; 68var startingPosition = _lexer.TextWindow.Position; 83var startingPosition = _lexer.TextWindow.Position; 96if (position < _lexer.TextWindow.Position) 99_lexer.TextWindow.Reset(position);