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