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