1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21this.TextWindow = new SlidingTextWindow(text);
664 references to TextWindow
Microsoft.CodeAnalysis.CSharp (664)
Parser\AbstractLexer.cs (4)
26this.TextWindow.Dispose(); 31TextWindow.Start(); 134return position >= TextWindow.LexemeStartPosition ? position - TextWindow.LexemeStartPosition : position;
Parser\Blender.cs (1)
72_newPosition = lexer.TextWindow.Position;
Parser\Blender.Reader.cs (1)
168if (_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 (472)
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; 464TextWindow.AdvanceChar(); 465if (TextWindow.TryAdvance('.')) 467if (TextWindow.PeekChar() == '.') 485TextWindow.AdvanceChar(); 490TextWindow.AdvanceChar(); 491info.Kind = TextWindow.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken; 495TextWindow.AdvanceChar(); 500TextWindow.AdvanceChar(); 505TextWindow.AdvanceChar(); 506info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken; 510TextWindow.AdvanceChar(); 512TextWindow.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken : 513TextWindow.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken; 517TextWindow.AdvanceChar(); 518info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken; 522TextWindow.AdvanceChar(); 527TextWindow.AdvanceChar(); 532TextWindow.AdvanceChar(); 537TextWindow.AdvanceChar(); 542TextWindow.AdvanceChar(); 547TextWindow.AdvanceChar(); 552TextWindow.AdvanceChar(); 553info.Kind = TextWindow.TryAdvance('?') 554? TextWindow.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken 559TextWindow.AdvanceChar(); 561TextWindow.TryAdvance('=') ? SyntaxKind.PlusEqualsToken : 562TextWindow.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken; 566TextWindow.AdvanceChar(); 568TextWindow.TryAdvance('=') ? SyntaxKind.MinusEqualsToken : 569TextWindow.TryAdvance('-') ? SyntaxKind.MinusMinusToken : 570TextWindow.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken; 574TextWindow.AdvanceChar(); 575info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken; 579TextWindow.AdvanceChar(); 581TextWindow.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken : 582TextWindow.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken; 586TextWindow.AdvanceChar(); 587info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken; 591TextWindow.AdvanceChar(); 593TextWindow.TryAdvance('=') ? SyntaxKind.BarEqualsToken : 594TextWindow.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken; 598TextWindow.AdvanceChar(); 600TextWindow.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken : 601TextWindow.TryAdvance('<') 602? TextWindow.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken 607TextWindow.AdvanceChar(); 608info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken; 615Debug.Assert(TextWindow.PeekChar() == '@'); 617if (TextWindow.PeekChar(1) == ':') 622this.AddError(TextWindow.Position + 1, width: 1, ErrorCode.ERR_ExpectedVerbatimLiteral); 625info.Text = TextWindow.GetText(false); 630info.Text = TextWindow.GetText(intern: true); 671if (!TextWindow.IsReallyAtEnd()) 702TextWindow.AdvanceChar(); 707if (char.IsHighSurrogate(character) && char.IsLowSurrogate(TextWindow.PeekChar())) 708TextWindow.AdvanceChar(); 716info.Text = TextWindow.GetText(intern: true); 720int end = TextWindow.Text.Length; 721info.Text = TextWindow.Text.ToString(TextSpan.FromBounds(startingPosition, end)); 722TextWindow.Reset(end); 739Debug.Assert(TextWindow.PeekChar() == '@'); 742while (TextWindow.PeekChar(index) == '@') 747if (TextWindow.PeekChar(index) == '"') 753else if (TextWindow.PeekChar(index) == '$') 765Debug.Assert(TextWindow.PeekChar() == '$'); 767if (TextWindow.PeekChar(1) is '$' or '@' or '"') 792int start = TextWindow.Position; 793while (TextWindow.PeekChar() is >= '0' and <= '9') 795TextWindow.AdvanceChar(); 798return start < TextWindow.Position; 804if (TextWindow.PeekChar() == '_') 819char ch = TextWindow.PeekChar(); 836TextWindow.AdvanceChar(); 847int start = TextWindow.Position; 862ch = TextWindow.PeekChar(); 865ch = TextWindow.PeekChar(1); 868TextWindow.AdvanceChar(2); 874TextWindow.AdvanceChar(2); 885if (TextWindow.PeekChar() is 'L' or 'l') 887TextWindow.AdvanceChar(); 889if (TextWindow.PeekChar() is 'u' or 'U') 891TextWindow.AdvanceChar(); 895else if (TextWindow.PeekChar() is 'u' or 'U') 897TextWindow.AdvanceChar(); 899if (TextWindow.PeekChar() is 'L' or 'l') 901TextWindow.AdvanceChar(); 910if (this.ModeIs(LexerMode.DebuggerSyntax) && TextWindow.PeekChar() == '#') 913TextWindow.AdvanceChar(); 914info.StringValue = info.Text = TextWindow.GetText(intern: true); 920if ((ch = TextWindow.PeekChar()) == '.') 922var ch2 = TextWindow.PeekChar(1); 927TextWindow.AdvanceChar(); 934TextWindow.Reset(start); 939if ((ch = TextWindow.PeekChar()) is 'E' or 'e') 942TextWindow.AdvanceChar(); 944if ((ch = TextWindow.PeekChar()) is '-' or '+') 947TextWindow.AdvanceChar(); 950if (!(((ch = TextWindow.PeekChar()) >= '0' && ch <= '9') || ch == '_')) 963ch = TextWindow.PeekChar(); 968TextWindow.AdvanceChar(); 973TextWindow.AdvanceChar(); 978TextWindow.AdvanceChar(); 988TextWindow.AdvanceChar(); 993TextWindow.AdvanceChar(); 998TextWindow.AdvanceChar(); 1003TextWindow.AdvanceChar(); 1005if (TextWindow.PeekChar() is 'u' or 'U') 1007TextWindow.AdvanceChar(); 1014TextWindow.AdvanceChar(); 1015if (TextWindow.PeekChar() is 'L' or 'l') 1017TextWindow.AdvanceChar(); 1025this.AddError(MakeError(start, TextWindow.Position - start, ErrorCode.ERR_InvalidNumber)); 1037info.Text = TextWindow.GetText(true); 1039var valueText = TextWindow.Intern(_builder); 1050info.DecimalValue = this.GetValueDecimal(valueText, start, TextWindow.Position); 1330var currentOffset = TextWindow.Offset; 1331var characterWindow = TextWindow.CharacterWindow; 1332var characterWindowCount = TextWindow.CharacterWindowCount; 1395TextWindow.AdvanceChar(length); 1396info.Text = info.StringValue = TextWindow.Intern(characterWindow, startOffset, length); 1428int start = TextWindow.Position; 1431while (TextWindow.PeekChar() == '@') 1433TextWindow.AdvanceChar(); 1436var atCount = TextWindow.Position - start; 1444char ch = TextWindow.PeekChar(); 1467if (!TextWindow.IsReallyAtEnd()) 1487(char.ToLower(TextWindow.PeekChar(1)) == 'x')) 1521if (_identLen == 0 && this.ModeIs(LexerMode.DebuggerSyntax) && TextWindow.PeekChar(1) == '>') 1524TextWindow.AdvanceChar(2); 1551TextWindow.AdvanceChar(); 1575TextWindow.AdvanceChar(); 1586var width = TextWindow.Width; // exact size of input characters 1589info.Text = TextWindow.GetInternedText(); 1598info.StringValue = TextWindow.Intern(_identBuffer, 0, _identLen); 1606var valueText = TextWindow.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset); 1627TextWindow.Reset(start); 1643int start = TextWindow.Position; 1662int beforeConsumed = TextWindow.Position; 1666if (TextWindow.PeekChar() == '&') 1671TextWindow.Reset(beforeConsumed); 1677consumedChar = TextWindow.NextChar(); 1697if (!isEscaped && (TextWindow.Position == beforeConsumed + 1) && 1698TextWindow.PeekChar() is 'u' or 'U') 1704TextWindow.Reset(beforeConsumed); 1726TextWindow.Reset(beforeConsumed); 1744TextWindow.Reset(beforeConsumed); 1747if (!TextWindow.IsReallyAtEnd()) 1752TextWindow.Reset(beforeConsumed); 1774TextWindow.Reset(beforeConsumed); 1795var width = TextWindow.Width; // exact size of input characters 1800info.StringValue = TextWindow.GetInternedText(); 1805info.StringValue = TextWindow.Intern(_identBuffer, 0, _identLen); 1806info.Text = TextWindow.GetText(intern: false); 1815TextWindow.Reset(start); 1884char ch = TextWindow.PeekChar(); 1912if ((ch = TextWindow.PeekChar(1)) == '/') 1914if (!this.SuppressDocumentationCommentParse && TextWindow.PeekChar(2) == '/' && TextWindow.PeekChar(3) != '/') 1934if (!this.SuppressDocumentationCommentParse && TextWindow.PeekChar(2) == '*' && 1935TextWindow.PeekChar(3) != '*' && TextWindow.PeekChar(3) != '/') 1956if ((ch = TextWindow.PeekChar(1)) == '*') 1959this.AddError(TextWindow.Position, width: 1, ErrorCode.ERR_UnexpectedCharacter, '@'); 2019var text = TextWindow.GetText(false); 2033var text = TextWindow.GetText(false); 2044var position = TextWindow.Position; 2045var text = TextWindow.Text; 2078this.AddError(TextWindow.Position, s_conflictMarkerLength, 2081var startCh = this.TextWindow.PeekChar(); 2107var ch = this.TextWindow.PeekChar(); 2126this.TextWindow.AdvanceChar(); 2129if (this.TextWindow.Width > 0) 2131this.AddTrivia(SyntaxFactory.DisabledText(TextWindow.GetText(false)), ref triviaList); 2145while (SyntaxFacts.IsNewLine(this.TextWindow.PeekChar())) 2147this.TextWindow.AdvanceChar(); 2150if (this.TextWindow.Width > 0) 2152this.AddTrivia(SyntaxFactory.EndOfLine(TextWindow.GetText(false)), ref triviaList); 2160var ch = this.TextWindow.PeekChar(); 2166this.TextWindow.AdvanceChar(); 2169this.AddTrivia(SyntaxFactory.ConflictMarker(TextWindow.GetText(false)), ref triviaList); 2190Debug.Assert(TextWindow.PeekChar() == delimiter && TextWindow.PeekChar(1) == '*'); 2191TextWindow.AdvanceChar(2); 2196if ((ch = TextWindow.PeekChar()) == SlidingTextWindow.InvalidCharacter && TextWindow.IsReallyAtEnd()) 2201else if (ch == '*' && TextWindow.PeekChar(1) == delimiter) 2203TextWindow.AdvanceChar(2); 2209TextWindow.AdvanceChar(); 2217while (!SyntaxFacts.IsNewLine(ch = TextWindow.PeekChar()) && 2218(ch != SlidingTextWindow.InvalidCharacter || !TextWindow.IsReallyAtEnd())) 2220TextWindow.AdvanceChar(); 2231switch (ch = TextWindow.PeekChar()) 2234TextWindow.AdvanceChar(); 2235return TextWindow.TryAdvance('\n') ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.CarriageReturn; 2237TextWindow.AdvanceChar(); 2242TextWindow.AdvanceChar(); 2260char ch = TextWindow.PeekChar(); 2272TextWindow.AdvanceChar(); 2289if (TextWindow.Width == 1 && onlySpaces) 2295var width = TextWindow.Width; 2300TextWindow.CharacterWindow, 2301TextWindow.LexemeRelativeStart, 2305TextWindow); 2309return CreateWhitespaceTrivia(TextWindow); 2370if (SyntaxFacts.IsWhitespace(TextWindow.PeekChar())) 2395int lastLineStart = TextWindow.Position; 2401char ch = TextWindow.PeekChar(); 2405if (!TextWindow.IsReallyAtEnd()) 2411return TextWindow.Width > 0 ? SyntaxFactory.DisabledText(TextWindow.GetText(false)) : null; 2415if (lastLineStart < TextWindow.Position && !allWhitespace) 2420TextWindow.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line 2421return TextWindow.Width > 0 ? SyntaxFactory.DisabledText(TextWindow.GetText(false)) : null; 2425lastLineStart = TextWindow.Position; 2436TextWindow.AdvanceChar(); 2468var ch = this.TextWindow.PeekChar(); 2474else if (ch is SlidingTextWindow.InvalidCharacter && this.TextWindow.IsReallyAtEnd()) 2482this.TextWindow.AdvanceChar(); 2509switch (character = TextWindow.PeekChar()) 2512if (!TextWindow.IsReallyAtEnd()) 2527TextWindow.AdvanceChar(); 2532TextWindow.AdvanceChar(); 2537TextWindow.AdvanceChar(); 2542TextWindow.AdvanceChar(); 2547TextWindow.AdvanceChar(); 2552TextWindow.AdvanceChar(); 2553if (TextWindow.PeekChar() == '=') 2555TextWindow.AdvanceChar(); 2566TextWindow.AdvanceChar(); 2567if (TextWindow.PeekChar() == '=') 2569TextWindow.AdvanceChar(); 2580if (TextWindow.PeekChar(1) == '&') 2582TextWindow.AdvanceChar(2); 2590if (TextWindow.PeekChar(1) == '|') 2592TextWindow.AdvanceChar(2); 2611info.Text = TextWindow.GetText(true); 2655TextWindow.AdvanceChar(); 2659info.Text = TextWindow.GetText(true); 2674var pos = TextWindow.Position; 2689TextWindow.Reset(pos); 2706char ch = TextWindow.PeekChar(); 2710if (TextWindow.PeekChar(1) == '/') 2714var text = TextWindow.GetText(false); 2760Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter); 2769this.AddError(TextWindow.LexemeStartPosition, TextWindow.Width, ErrorCode.ERR_OpenEndedComment); 2805switch (ch = TextWindow.PeekChar()) 2822if (!TextWindow.IsReallyAtEnd()) 2848info.StringValue = info.Text = TextWindow.GetText(intern: false); 2855Debug.Assert(TextWindow.PeekChar() == '<'); 2857if (TextWindow.PeekChar(1) == '!') 2859if (TextWindow.PeekChar(2) == '-' 2860&& TextWindow.PeekChar(3) == '-') 2862TextWindow.AdvanceChar(4); 2865else if (TextWindow.PeekChar(2) == '[' 2866&& TextWindow.PeekChar(3) == 'C' 2867&& TextWindow.PeekChar(4) == 'D' 2868&& TextWindow.PeekChar(5) == 'A' 2869&& TextWindow.PeekChar(6) == 'T' 2870&& TextWindow.PeekChar(7) == 'A' 2871&& TextWindow.PeekChar(8) == '[') 2873TextWindow.AdvanceChar(9); 2879TextWindow.AdvanceChar(); 2883else if (TextWindow.PeekChar(1) == '/') 2885TextWindow.AdvanceChar(2); 2888else if (TextWindow.PeekChar(1) == '?') 2890TextWindow.AdvanceChar(2); 2895TextWindow.AdvanceChar(); 2904Debug.Assert(TextWindow.PeekChar() == '&'); 2905TextWindow.AdvanceChar(); 2911if (IsXmlNameStartChar(ch = TextWindow.PeekChar())) 2913while (IsXmlNameChar(ch = TextWindow.PeekChar())) 2921TextWindow.AdvanceChar(); 2950TextWindow.AdvanceChar(); 2951bool isHex = TextWindow.PeekChar() == 'x'; 2956TextWindow.AdvanceChar(); // x 2957while (SyntaxFacts.IsHexDigit(ch = TextWindow.PeekChar())) 2959TextWindow.AdvanceChar(); 2970while (SyntaxFacts.IsDecDigit(ch = TextWindow.PeekChar())) 2972TextWindow.AdvanceChar(); 2982if (TextWindow.PeekChar() != ';') 3027ch = TextWindow.PeekChar(); 3030TextWindow.AdvanceChar(); 3044info.Text = TextWindow.GetText(true); 3072if (TextWindow.PeekChar() == ']' && TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3074TextWindow.AdvanceChar(3); 3075info.StringValue = info.Text = TextWindow.GetText(false); 3082var ch = TextWindow.PeekChar(); 3086if (!TextWindow.IsReallyAtEnd()) 3091info.StringValue = info.Text = TextWindow.GetText(false); 3097info.StringValue = info.Text = TextWindow.GetText(false); 3101if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3104info.StringValue = info.Text = TextWindow.GetText(false); 3111if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3113info.StringValue = info.Text = TextWindow.GetText(false); 3125TextWindow.AdvanceChar(); 3172switch (ch = TextWindow.PeekChar()) 3179TextWindow.AdvanceChar(); 3184if (TextWindow.PeekChar(1) == '>') 3186TextWindow.AdvanceChar(2); 3194TextWindow.AdvanceChar(); 3199TextWindow.AdvanceChar(); 3204TextWindow.AdvanceChar(); 3209TextWindow.AdvanceChar(); 3219if (!TextWindow.IsReallyAtEnd()) 3228if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3251TextWindow.AdvanceChar(); 3253info.StringValue = info.Text = TextWindow.GetText(false); 3265int start = TextWindow.Position; 3269char ch = TextWindow.PeekChar(); 3281TextWindow.AdvanceChar(); 3289info.Text = TextWindow.GetText(start, TextWindow.Position - start, intern: true); 3346switch (ch = TextWindow.PeekChar()) 3351TextWindow.AdvanceChar(); 3361TextWindow.AdvanceChar(); 3374TextWindow.AdvanceChar(); 3384if (!TextWindow.IsReallyAtEnd()) 3411var ch = TextWindow.PeekChar(); 3417info.StringValue = info.Text = TextWindow.GetText(false); 3426info.StringValue = info.Text = TextWindow.GetText(false); 3436info.StringValue = info.Text = TextWindow.GetText(false); 3440if (!TextWindow.IsReallyAtEnd()) 3445info.StringValue = info.Text = TextWindow.GetText(false); 3449if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3452info.StringValue = info.Text = TextWindow.GetText(false); 3464TextWindow.AdvanceChar(); 3503switch (TextWindow.PeekChar()) 3510if (!TextWindow.IsReallyAtEnd()) 3518info.Text = info.StringValue = TextWindow.NextChar().ToString(); 3563int beforeConsumed = TextWindow.Position; 3564char consumedChar = TextWindow.NextChar(); 3590info.Text = TextWindow.GetText(intern: false); 3595if (!TextWindow.IsReallyAtEnd()) 3605TextWindow.Reset(beforeConsumed); 3610TextWindow.Reset(beforeConsumed); 3613TextWindow.Reset(beforeConsumed); 3639Debug.Assert(TextWindow.Position > beforeConsumed, "First character or entity has been consumed."); 3669if (TextWindow.PeekChar() == '.') 3754string actualText = TextWindow.GetText(intern: false); 3767TextWindow.Reset(beforeConsumed); 3800if (TextWindow.PeekChar() == '@') 3802TextWindow.NextChar(); 3803info.Text = TextWindow.GetText(intern: true); 3813else if (TextWindow.PeekChar() == '&') 3822char bad = TextWindow.NextChar(); 3823info.Text = TextWindow.GetText(intern: false); 3851char peekCh = TextWindow.PeekChar(); 3856TextWindow.AdvanceChar(); 3862int pos = TextWindow.Position; 3872TextWindow.Reset(pos); 3969switch (ch = TextWindow.PeekChar()) 3972if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3974TextWindow.AdvanceChar(3); 3987if (!TextWindow.IsReallyAtEnd()) 4013var ch = TextWindow.PeekChar(); 4017if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 4019info.StringValue = info.Text = TextWindow.GetText(false); 4027info.StringValue = info.Text = TextWindow.GetText(false); 4031if (!TextWindow.IsReallyAtEnd()) 4036info.StringValue = info.Text = TextWindow.GetText(false); 4040if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4043info.StringValue = info.Text = TextWindow.GetText(false); 4055TextWindow.AdvanceChar(); 4091switch (ch = TextWindow.PeekChar()) 4094if (TextWindow.PeekChar(1) == '-') 4096if (TextWindow.PeekChar(2) == '>') 4098TextWindow.AdvanceChar(3); 4104TextWindow.AdvanceChar(2); 4118if (!TextWindow.IsReallyAtEnd()) 4143var ch = TextWindow.PeekChar(); 4147if (TextWindow.PeekChar(1) == '-') 4149info.StringValue = info.Text = TextWindow.GetText(false); 4157info.StringValue = info.Text = TextWindow.GetText(false); 4161if (!TextWindow.IsReallyAtEnd()) 4166info.StringValue = info.Text = TextWindow.GetText(false); 4170if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4173info.StringValue = info.Text = TextWindow.GetText(false); 4185TextWindow.AdvanceChar(); 4222switch (ch = TextWindow.PeekChar()) 4225if (TextWindow.PeekChar(1) == '>') 4227TextWindow.AdvanceChar(2); 4240if (!TextWindow.IsReallyAtEnd()) 4267var ch = TextWindow.PeekChar(); 4271if (TextWindow.PeekChar(1) == '>') 4273info.StringValue = info.Text = TextWindow.GetText(false); 4281info.StringValue = info.Text = TextWindow.GetText(false); 4285if (!TextWindow.IsReallyAtEnd()) 4290info.StringValue = info.Text = TextWindow.GetText(false); 4294if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4297info.StringValue = info.Text = TextWindow.GetText(false); 4309TextWindow.AdvanceChar(); 4321var start = TextWindow.Position; 4330if (TextWindow.PeekChar() == '/' 4331&& TextWindow.PeekChar(1) == '*' 4332&& TextWindow.PeekChar(2) == '*' 4333&& TextWindow.PeekChar(3) != '*') 4335TextWindow.AdvanceChar(3); 4336var text = TextWindow.GetText(true); 4351char ch = TextWindow.PeekChar(); 4358TextWindow.AdvanceChar(); 4362if (this.StyleIs(XmlDocCommentStyle.SingleLine) && TextWindow.PeekChar(1) == '/' && TextWindow.PeekChar(2) == '/' && TextWindow.PeekChar(3) != '/') 4364TextWindow.AdvanceChar(3); 4365var text = TextWindow.GetText(true); 4376while (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) != '/') 4378TextWindow.AdvanceChar(); 4381var text = TextWindow.GetText(true); 4391if (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) == '/') 4393TextWindow.AdvanceChar(2); 4420TextWindow.Reset(start); 4427var text = TextWindow.GetText(true); 4439if (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) == '/') 4441TextWindow.AdvanceChar(2); 4442var text = TextWindow.GetText(true); 4455char ch = TextWindow.PeekChar(); 4477char ch = TextWindow.PeekChar(); 4496if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4522if (TextWindow.PeekChar() == '\\') 4524var ch2 = TextWindow.PeekChar(1); 4543return TextWindow.PeekChar(); 4549int position = TextWindow.Position; 4555TextWindow.Reset(position); 4561var ch = TextWindow.PeekChar(); 4565var ch2 = TextWindow.PeekChar(1); 4574TextWindow.AdvanceChar(); 4588int start = TextWindow.Position; 4589char character = TextWindow.PeekChar(); 4591TextWindow.AdvanceChar(); 4593character = TextWindow.PeekChar(); 4598TextWindow.AdvanceChar(); 4599if (!SyntaxFacts.IsHexDigit(TextWindow.PeekChar())) 4610character = TextWindow.PeekChar(); 4622TextWindow.AdvanceChar(); 4643TextWindow.AdvanceChar(); 4644if (!SyntaxFacts.IsHexDigit(TextWindow.PeekChar())) 4655char ch2 = TextWindow.PeekChar(); 4670TextWindow.AdvanceChar(); 4694Debug.Assert(TextWindow.PeekChar() == '&'); 4697TextWindow.AdvanceChar(); 4701switch (TextWindow.PeekChar()) 4704if (TextWindow.AdvanceIfMatches("lt;")) 4711if (TextWindow.AdvanceIfMatches("gt;")) 4718if (TextWindow.AdvanceIfMatches("amp;")) 4723else if (TextWindow.AdvanceIfMatches("apos;")) 4730if (TextWindow.AdvanceIfMatches("quot;")) 4738TextWindow.AdvanceChar(); //# 4742if (TextWindow.AdvanceIfMatches("x")) 4745while (SyntaxFacts.IsHexDigit(digit = TextWindow.PeekChar())) 4747TextWindow.AdvanceChar(); 4763while (SyntaxFacts.IsDecDigit(digit = TextWindow.PeekChar())) 4765TextWindow.AdvanceChar(); 4779if (TextWindow.AdvanceIfMatches(";")) 4794return new SyntaxDiagnosticInfo(start - TextWindow.LexemeStartPosition, 4795TextWindow.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)
199int i = TextWindow.Offset; 200int n = TextWindow.CharacterWindowCount; 206var charWindow = TextWindow.CharacterWindow; 234TextWindow.AdvanceChar(i - TextWindow.Offset); 241TextWindow.CharacterWindow, 242TextWindow.LexemeRelativeStart, 243i - TextWindow.LexemeRelativeStart, 251TextWindow.Reset(TextWindow.LexemeStartPosition); 259var quickWidth = lexer.TextWindow.Width; 261lexer.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);