1 write to TextWindow
Microsoft.CodeAnalysis.CSharp (1)
Parser\AbstractLexer.cs (1)
21this.TextWindow = new SlidingTextWindow(text);
671 references to TextWindow
Microsoft.CodeAnalysis.CSharp (671)
Parser\AbstractLexer.cs (4)
26this.TextWindow.Dispose(); 31TextWindow.Start(); 134return position >= TextWindow.LexemeStartPosition ? position - TextWindow.LexemeStartPosition : position;
Parser\Blender.cs (1)
69_newPosition = lexer.TextWindow.Position;
Parser\Blender.Reader.cs (1)
165if (_lexer.TextWindow.Position != _newPosition)
Parser\DirectiveParser.cs (1)
36var hashPosition = lexer.TextWindow.Position;
Parser\LanguageParser.cs (2)
219return CreateForGlobalFailure(lexer.TextWindow.Position, createEmptyNodeFunc(this)); 229builder.Add(SyntaxFactory.BadToken(null, lexer.TextWindow.Text.ToString(), null));
Parser\Lexer.cs (479)
172this.TextWindow.Reset(position); 310this.LexSyntaxTrivia(isFollowingToken: TextWindow.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache); 329this.LexSyntaxTrivia(isFollowingToken: TextWindow.Position > 0, isTrailing: false, triviaList: ref _leadingTriviaCache); 449int startingPosition = TextWindow.Position; 452character = TextWindow.PeekChar(); 461TextWindow.AdvanceChar(); 462info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.SlashEqualsToken : SyntaxKind.SlashToken; 466if (this.TextWindow.PeekChar(1) is >= '0' and <= '9') 468var atDotPosition = this.TextWindow.Position; 470atDotPosition == this.TextWindow.LexemeStartPosition) 478if (this.TextWindow.PreviousChar() is '.') 481TextWindow.AdvanceChar(); 492TextWindow.AdvanceChar(); 499TextWindow.AdvanceChar(); 504TextWindow.AdvanceChar(); 505info.Kind = TextWindow.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken; 509TextWindow.AdvanceChar(); 514TextWindow.AdvanceChar(); 519TextWindow.AdvanceChar(); 520info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken; 524TextWindow.AdvanceChar(); 526TextWindow.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken : 527TextWindow.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken; 531TextWindow.AdvanceChar(); 532info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken; 536TextWindow.AdvanceChar(); 541TextWindow.AdvanceChar(); 546TextWindow.AdvanceChar(); 551TextWindow.AdvanceChar(); 556TextWindow.AdvanceChar(); 561TextWindow.AdvanceChar(); 566TextWindow.AdvanceChar(); 567info.Kind = TextWindow.TryAdvance('?') 568? TextWindow.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken 573TextWindow.AdvanceChar(); 575TextWindow.TryAdvance('=') ? SyntaxKind.PlusEqualsToken : 576TextWindow.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken; 580TextWindow.AdvanceChar(); 582TextWindow.TryAdvance('=') ? SyntaxKind.MinusEqualsToken : 583TextWindow.TryAdvance('-') ? SyntaxKind.MinusMinusToken : 584TextWindow.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken; 588TextWindow.AdvanceChar(); 589info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken; 593TextWindow.AdvanceChar(); 595TextWindow.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken : 596TextWindow.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken; 600TextWindow.AdvanceChar(); 601info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken; 605TextWindow.AdvanceChar(); 607TextWindow.TryAdvance('=') ? SyntaxKind.BarEqualsToken : 608TextWindow.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken; 612TextWindow.AdvanceChar(); 614TextWindow.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken : 615TextWindow.TryAdvance('<') 616? TextWindow.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken 621TextWindow.AdvanceChar(); 622info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken; 629Debug.Assert(TextWindow.PeekChar() == '@'); 631if (TextWindow.PeekChar(1) == ':') 636this.AddError(TextWindow.Position + 1, width: 1, ErrorCode.ERR_ExpectedVerbatimLiteral); 639info.Text = TextWindow.GetText(false); 644info.Text = TextWindow.GetText(intern: true); 685if (!TextWindow.IsReallyAtEnd()) 716TextWindow.AdvanceChar(); 721if (char.IsHighSurrogate(character) && char.IsLowSurrogate(TextWindow.PeekChar())) 722TextWindow.AdvanceChar(); 730info.Text = TextWindow.GetText(intern: true); 734int end = TextWindow.Text.Length; 735info.Text = TextWindow.Text.ToString(TextSpan.FromBounds(startingPosition, end)); 736TextWindow.Reset(end); 753Debug.Assert(TextWindow.PeekChar() == '@'); 756while (TextWindow.PeekChar(index) == '@') 761if (TextWindow.PeekChar(index) == '"') 767else if (TextWindow.PeekChar(index) == '$') 779Debug.Assert(TextWindow.PeekChar() == '$'); 781if (TextWindow.PeekChar(1) is '$' or '@' or '"') 806int start = TextWindow.Position; 807while (TextWindow.PeekChar() is >= '0' and <= '9') 809TextWindow.AdvanceChar(); 812return start < TextWindow.Position; 818if (TextWindow.PeekChar() == '_') 833char ch = TextWindow.PeekChar(); 850TextWindow.AdvanceChar(); 861int start = TextWindow.Position; 876ch = TextWindow.PeekChar(); 879ch = TextWindow.PeekChar(1); 882TextWindow.AdvanceChar(2); 888TextWindow.AdvanceChar(2); 899if (TextWindow.PeekChar() is 'L' or 'l') 901TextWindow.AdvanceChar(); 903if (TextWindow.PeekChar() is 'u' or 'U') 905TextWindow.AdvanceChar(); 909else if (TextWindow.PeekChar() is 'u' or 'U') 911TextWindow.AdvanceChar(); 913if (TextWindow.PeekChar() is 'L' or 'l') 915TextWindow.AdvanceChar(); 924if (this.ModeIs(LexerMode.DebuggerSyntax) && TextWindow.PeekChar() == '#') 927TextWindow.AdvanceChar(); 928info.StringValue = info.Text = TextWindow.GetText(intern: true); 934if ((ch = TextWindow.PeekChar()) == '.') 936var ch2 = TextWindow.PeekChar(1); 941TextWindow.AdvanceChar(); 948TextWindow.Reset(start); 953if ((ch = TextWindow.PeekChar()) is 'E' or 'e') 956TextWindow.AdvanceChar(); 958if ((ch = TextWindow.PeekChar()) is '-' or '+') 961TextWindow.AdvanceChar(); 964if (!(((ch = TextWindow.PeekChar()) >= '0' && ch <= '9') || ch == '_')) 977ch = TextWindow.PeekChar(); 982TextWindow.AdvanceChar(); 987TextWindow.AdvanceChar(); 992TextWindow.AdvanceChar(); 1002TextWindow.AdvanceChar(); 1007TextWindow.AdvanceChar(); 1012TextWindow.AdvanceChar(); 1017TextWindow.AdvanceChar(); 1019if (TextWindow.PeekChar() is 'u' or 'U') 1021TextWindow.AdvanceChar(); 1028TextWindow.AdvanceChar(); 1029if (TextWindow.PeekChar() is 'L' or 'l') 1031TextWindow.AdvanceChar(); 1039this.AddError(MakeError(start, TextWindow.Position - start, ErrorCode.ERR_InvalidNumber)); 1051info.Text = TextWindow.GetText(true); 1053var valueText = TextWindow.Intern(_builder); 1064info.DecimalValue = this.GetValueDecimal(valueText, start, TextWindow.Position); 1344var currentOffset = TextWindow.Offset; 1345var characterWindow = TextWindow.CharacterWindow; 1346var characterWindowCount = TextWindow.CharacterWindowCount; 1409TextWindow.AdvanceChar(length); 1410info.Text = info.StringValue = TextWindow.Intern(characterWindow, startOffset, length); 1442int start = TextWindow.Position; 1445while (TextWindow.PeekChar() == '@') 1447TextWindow.AdvanceChar(); 1450var atCount = TextWindow.Position - start; 1458char ch = TextWindow.PeekChar(); 1481if (!TextWindow.IsReallyAtEnd()) 1501(char.ToLower(TextWindow.PeekChar(1)) == 'x')) 1535if (_identLen == 0 && this.ModeIs(LexerMode.DebuggerSyntax) && TextWindow.PeekChar(1) == '>') 1538TextWindow.AdvanceChar(2); 1565TextWindow.AdvanceChar(); 1589TextWindow.AdvanceChar(); 1600var width = TextWindow.Width; // exact size of input characters 1603info.Text = TextWindow.GetInternedText(); 1612info.StringValue = TextWindow.Intern(_identBuffer, 0, _identLen); 1620var valueText = TextWindow.Intern(_identBuffer, objectAddressOffset, _identLen - objectAddressOffset); 1641TextWindow.Reset(start); 1657int start = TextWindow.Position; 1676int beforeConsumed = TextWindow.Position; 1680if (TextWindow.PeekChar() == '&') 1685TextWindow.Reset(beforeConsumed); 1691consumedChar = TextWindow.NextChar(); 1711if (!isEscaped && (TextWindow.Position == beforeConsumed + 1) && 1712TextWindow.PeekChar() is 'u' or 'U') 1718TextWindow.Reset(beforeConsumed); 1740TextWindow.Reset(beforeConsumed); 1758TextWindow.Reset(beforeConsumed); 1761if (!TextWindow.IsReallyAtEnd()) 1766TextWindow.Reset(beforeConsumed); 1788TextWindow.Reset(beforeConsumed); 1809var width = TextWindow.Width; // exact size of input characters 1814info.StringValue = TextWindow.GetInternedText(); 1819info.StringValue = TextWindow.Intern(_identBuffer, 0, _identLen); 1820info.Text = TextWindow.GetText(intern: false); 1829TextWindow.Reset(start); 1898char ch = TextWindow.PeekChar(); 1926if ((ch = TextWindow.PeekChar(1)) == '/') 1928if (!this.SuppressDocumentationCommentParse && TextWindow.PeekChar(2) == '/' && TextWindow.PeekChar(3) != '/') 1948if (!this.SuppressDocumentationCommentParse && TextWindow.PeekChar(2) == '*' && 1949TextWindow.PeekChar(3) != '*' && TextWindow.PeekChar(3) != '/') 1970if ((ch = TextWindow.PeekChar(1)) == '*') 1973this.AddError(TextWindow.Position, width: 1, ErrorCode.ERR_UnexpectedCharacter, '@'); 2004var savePosition = TextWindow.Position; 2010var text = TextWindow.Text.GetSubText(TextSpan.FromBounds(savePosition, TextWindow.Position)); 2059var text = TextWindow.GetText(false); 2073var text = TextWindow.GetText(false); 2084var position = TextWindow.Position; 2085var text = TextWindow.Text; 2118this.AddError(TextWindow.Position, s_conflictMarkerLength, 2121var startCh = this.TextWindow.PeekChar(); 2147var ch = this.TextWindow.PeekChar(); 2166this.TextWindow.AdvanceChar(); 2169if (this.TextWindow.Width > 0) 2171this.AddTrivia(SyntaxFactory.DisabledText(TextWindow.GetText(false)), ref triviaList); 2185while (SyntaxFacts.IsNewLine(this.TextWindow.PeekChar())) 2187this.TextWindow.AdvanceChar(); 2190if (this.TextWindow.Width > 0) 2192this.AddTrivia(SyntaxFactory.EndOfLine(TextWindow.GetText(false)), ref triviaList); 2200var ch = this.TextWindow.PeekChar(); 2206this.TextWindow.AdvanceChar(); 2209this.AddTrivia(SyntaxFactory.ConflictMarker(TextWindow.GetText(false)), ref triviaList); 2230Debug.Assert(TextWindow.PeekChar() == delimiter && TextWindow.PeekChar(1) == '*'); 2231TextWindow.AdvanceChar(2); 2236if ((ch = TextWindow.PeekChar()) == SlidingTextWindow.InvalidCharacter && TextWindow.IsReallyAtEnd()) 2241else if (ch == '*' && TextWindow.PeekChar(1) == delimiter) 2243TextWindow.AdvanceChar(2); 2249TextWindow.AdvanceChar(); 2257while (!SyntaxFacts.IsNewLine(ch = TextWindow.PeekChar()) && 2258(ch != SlidingTextWindow.InvalidCharacter || !TextWindow.IsReallyAtEnd())) 2260TextWindow.AdvanceChar(); 2271switch (ch = TextWindow.PeekChar()) 2274TextWindow.AdvanceChar(); 2275return TextWindow.TryAdvance('\n') ? SyntaxFactory.CarriageReturnLineFeed : SyntaxFactory.CarriageReturn; 2277TextWindow.AdvanceChar(); 2282TextWindow.AdvanceChar(); 2300char ch = TextWindow.PeekChar(); 2312TextWindow.AdvanceChar(); 2329if (TextWindow.Width == 1 && onlySpaces) 2335var width = TextWindow.Width; 2340TextWindow.CharacterWindow, 2341TextWindow.LexemeRelativeStart, 2345TextWindow); 2349return CreateWhitespaceTrivia(TextWindow); 2408if (SyntaxFacts.IsWhitespace(TextWindow.PeekChar())) 2442int lastLineStart = TextWindow.Position; 2448char ch = TextWindow.PeekChar(); 2452if (!TextWindow.IsReallyAtEnd()) 2458return TextWindow.Width > 0 ? SyntaxFactory.DisabledText(TextWindow.GetText(false)) : null; 2462if (lastLineStart < TextWindow.Position && !allWhitespace) 2467TextWindow.Reset(lastLineStart); // reset so directive parser can consume the starting whitespace on this line 2468return TextWindow.Width > 0 ? SyntaxFactory.DisabledText(TextWindow.GetText(false)) : null; 2472lastLineStart = TextWindow.Position; 2483TextWindow.AdvanceChar(); 2515var ch = this.TextWindow.PeekChar(); 2521else if (ch is SlidingTextWindow.InvalidCharacter && this.TextWindow.IsReallyAtEnd()) 2529this.TextWindow.AdvanceChar(); 2574switch (character = TextWindow.PeekChar()) 2577if (!TextWindow.IsReallyAtEnd()) 2592TextWindow.AdvanceChar(); 2597TextWindow.AdvanceChar(); 2602TextWindow.AdvanceChar(); 2607TextWindow.AdvanceChar(); 2612TextWindow.AdvanceChar(); 2617TextWindow.AdvanceChar(); 2622TextWindow.AdvanceChar(); 2623if (TextWindow.PeekChar() == '=') 2625TextWindow.AdvanceChar(); 2636TextWindow.AdvanceChar(); 2637if (TextWindow.PeekChar() == '=') 2639TextWindow.AdvanceChar(); 2650if (TextWindow.PeekChar(1) == '&') 2652TextWindow.AdvanceChar(2); 2660if (TextWindow.PeekChar(1) == '|') 2662TextWindow.AdvanceChar(2); 2681info.Text = TextWindow.GetText(true); 2725TextWindow.AdvanceChar(); 2729info.Text = TextWindow.GetText(true); 2744var pos = TextWindow.Position; 2759TextWindow.Reset(pos); 2776char ch = TextWindow.PeekChar(); 2780if (TextWindow.PeekChar(1) == '/') 2784var text = TextWindow.GetText(false); 2830Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter); 2839this.AddError(TextWindow.LexemeStartPosition, TextWindow.Width, ErrorCode.ERR_OpenEndedComment); 2875switch (ch = TextWindow.PeekChar()) 2892if (!TextWindow.IsReallyAtEnd()) 2918info.StringValue = info.Text = TextWindow.GetText(intern: false); 2925Debug.Assert(TextWindow.PeekChar() == '<'); 2927if (TextWindow.PeekChar(1) == '!') 2929if (TextWindow.PeekChar(2) == '-' 2930&& TextWindow.PeekChar(3) == '-') 2932TextWindow.AdvanceChar(4); 2935else if (TextWindow.PeekChar(2) == '[' 2936&& TextWindow.PeekChar(3) == 'C' 2937&& TextWindow.PeekChar(4) == 'D' 2938&& TextWindow.PeekChar(5) == 'A' 2939&& TextWindow.PeekChar(6) == 'T' 2940&& TextWindow.PeekChar(7) == 'A' 2941&& TextWindow.PeekChar(8) == '[') 2943TextWindow.AdvanceChar(9); 2949TextWindow.AdvanceChar(); 2953else if (TextWindow.PeekChar(1) == '/') 2955TextWindow.AdvanceChar(2); 2958else if (TextWindow.PeekChar(1) == '?') 2960TextWindow.AdvanceChar(2); 2965TextWindow.AdvanceChar(); 2974Debug.Assert(TextWindow.PeekChar() == '&'); 2975TextWindow.AdvanceChar(); 2981if (IsXmlNameStartChar(ch = TextWindow.PeekChar())) 2983while (IsXmlNameChar(ch = TextWindow.PeekChar())) 2991TextWindow.AdvanceChar(); 3020TextWindow.AdvanceChar(); 3021bool isHex = TextWindow.PeekChar() == 'x'; 3026TextWindow.AdvanceChar(); // x 3027while (SyntaxFacts.IsHexDigit(ch = TextWindow.PeekChar())) 3029TextWindow.AdvanceChar(); 3040while (SyntaxFacts.IsDecDigit(ch = TextWindow.PeekChar())) 3042TextWindow.AdvanceChar(); 3052if (TextWindow.PeekChar() != ';') 3097ch = TextWindow.PeekChar(); 3100TextWindow.AdvanceChar(); 3114info.Text = TextWindow.GetText(true); 3142if (TextWindow.PeekChar() == ']' && TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3144TextWindow.AdvanceChar(3); 3145info.StringValue = info.Text = TextWindow.GetText(false); 3152var ch = TextWindow.PeekChar(); 3156if (!TextWindow.IsReallyAtEnd()) 3161info.StringValue = info.Text = TextWindow.GetText(false); 3167info.StringValue = info.Text = TextWindow.GetText(false); 3171if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3174info.StringValue = info.Text = TextWindow.GetText(false); 3181if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 3183info.StringValue = info.Text = TextWindow.GetText(false); 3195TextWindow.AdvanceChar(); 3242switch (ch = TextWindow.PeekChar()) 3249TextWindow.AdvanceChar(); 3254if (TextWindow.PeekChar(1) == '>') 3256TextWindow.AdvanceChar(2); 3264TextWindow.AdvanceChar(); 3269TextWindow.AdvanceChar(); 3274TextWindow.AdvanceChar(); 3279TextWindow.AdvanceChar(); 3289if (!TextWindow.IsReallyAtEnd()) 3298if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3321TextWindow.AdvanceChar(); 3323info.StringValue = info.Text = TextWindow.GetText(false); 3335int start = TextWindow.Position; 3339char ch = TextWindow.PeekChar(); 3351TextWindow.AdvanceChar(); 3359info.Text = TextWindow.GetText(start, TextWindow.Position - start, intern: true); 3416switch (ch = TextWindow.PeekChar()) 3421TextWindow.AdvanceChar(); 3431TextWindow.AdvanceChar(); 3444TextWindow.AdvanceChar(); 3454if (!TextWindow.IsReallyAtEnd()) 3481var ch = TextWindow.PeekChar(); 3487info.StringValue = info.Text = TextWindow.GetText(false); 3496info.StringValue = info.Text = TextWindow.GetText(false); 3506info.StringValue = info.Text = TextWindow.GetText(false); 3510if (!TextWindow.IsReallyAtEnd()) 3515info.StringValue = info.Text = TextWindow.GetText(false); 3519if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 3522info.StringValue = info.Text = TextWindow.GetText(false); 3534TextWindow.AdvanceChar(); 3573switch (TextWindow.PeekChar()) 3580if (!TextWindow.IsReallyAtEnd()) 3588info.Text = info.StringValue = TextWindow.NextChar().ToString(); 3633int beforeConsumed = TextWindow.Position; 3634char consumedChar = TextWindow.NextChar(); 3660info.Text = TextWindow.GetText(intern: false); 3665if (!TextWindow.IsReallyAtEnd()) 3675TextWindow.Reset(beforeConsumed); 3680TextWindow.Reset(beforeConsumed); 3683TextWindow.Reset(beforeConsumed); 3709Debug.Assert(TextWindow.Position > beforeConsumed, "First character or entity has been consumed."); 3739if (TextWindow.PeekChar() == '.') 3824string actualText = TextWindow.GetText(intern: false); 3837TextWindow.Reset(beforeConsumed); 3870if (TextWindow.PeekChar() == '@') 3872TextWindow.NextChar(); 3873info.Text = TextWindow.GetText(intern: true); 3883else if (TextWindow.PeekChar() == '&') 3892char bad = TextWindow.NextChar(); 3893info.Text = TextWindow.GetText(intern: false); 3921char peekCh = TextWindow.PeekChar(); 3926TextWindow.AdvanceChar(); 3932int pos = TextWindow.Position; 3942TextWindow.Reset(pos); 4039switch (ch = TextWindow.PeekChar()) 4042if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 4044TextWindow.AdvanceChar(3); 4057if (!TextWindow.IsReallyAtEnd()) 4083var ch = TextWindow.PeekChar(); 4087if (TextWindow.PeekChar(1) == ']' && TextWindow.PeekChar(2) == '>') 4089info.StringValue = info.Text = TextWindow.GetText(false); 4097info.StringValue = info.Text = TextWindow.GetText(false); 4101if (!TextWindow.IsReallyAtEnd()) 4106info.StringValue = info.Text = TextWindow.GetText(false); 4110if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4113info.StringValue = info.Text = TextWindow.GetText(false); 4125TextWindow.AdvanceChar(); 4161switch (ch = TextWindow.PeekChar()) 4164if (TextWindow.PeekChar(1) == '-') 4166if (TextWindow.PeekChar(2) == '>') 4168TextWindow.AdvanceChar(3); 4174TextWindow.AdvanceChar(2); 4188if (!TextWindow.IsReallyAtEnd()) 4213var ch = TextWindow.PeekChar(); 4217if (TextWindow.PeekChar(1) == '-') 4219info.StringValue = info.Text = TextWindow.GetText(false); 4227info.StringValue = info.Text = TextWindow.GetText(false); 4231if (!TextWindow.IsReallyAtEnd()) 4236info.StringValue = info.Text = TextWindow.GetText(false); 4240if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4243info.StringValue = info.Text = TextWindow.GetText(false); 4255TextWindow.AdvanceChar(); 4292switch (ch = TextWindow.PeekChar()) 4295if (TextWindow.PeekChar(1) == '>') 4297TextWindow.AdvanceChar(2); 4310if (!TextWindow.IsReallyAtEnd()) 4337var ch = TextWindow.PeekChar(); 4341if (TextWindow.PeekChar(1) == '>') 4343info.StringValue = info.Text = TextWindow.GetText(false); 4351info.StringValue = info.Text = TextWindow.GetText(false); 4355if (!TextWindow.IsReallyAtEnd()) 4360info.StringValue = info.Text = TextWindow.GetText(false); 4364if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4367info.StringValue = info.Text = TextWindow.GetText(false); 4379TextWindow.AdvanceChar(); 4391var start = TextWindow.Position; 4400if (TextWindow.PeekChar() == '/' 4401&& TextWindow.PeekChar(1) == '*' 4402&& TextWindow.PeekChar(2) == '*' 4403&& TextWindow.PeekChar(3) != '*') 4405TextWindow.AdvanceChar(3); 4406var text = TextWindow.GetText(true); 4421char ch = TextWindow.PeekChar(); 4428TextWindow.AdvanceChar(); 4432if (this.StyleIs(XmlDocCommentStyle.SingleLine) && TextWindow.PeekChar(1) == '/' && TextWindow.PeekChar(2) == '/' && TextWindow.PeekChar(3) != '/') 4434TextWindow.AdvanceChar(3); 4435var text = TextWindow.GetText(true); 4446while (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) != '/') 4448TextWindow.AdvanceChar(); 4451var text = TextWindow.GetText(true); 4461if (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) == '/') 4463TextWindow.AdvanceChar(2); 4490TextWindow.Reset(start); 4497var text = TextWindow.GetText(true); 4509if (TextWindow.PeekChar() == '*' && TextWindow.PeekChar(1) == '/') 4511TextWindow.AdvanceChar(2); 4512var text = TextWindow.GetText(true); 4525char ch = TextWindow.PeekChar(); 4547char ch = TextWindow.PeekChar(); 4566if (this.StyleIs(XmlDocCommentStyle.Delimited) && TextWindow.PeekChar(1) == '/') 4592if (TextWindow.PeekChar() == '\\') 4594var ch2 = TextWindow.PeekChar(1); 4613return TextWindow.PeekChar(); 4619int position = TextWindow.Position; 4625TextWindow.Reset(position); 4631var ch = TextWindow.PeekChar(); 4635var ch2 = TextWindow.PeekChar(1); 4644TextWindow.AdvanceChar(); 4658int start = TextWindow.Position; 4659char character = TextWindow.PeekChar(); 4661TextWindow.AdvanceChar(); 4663character = TextWindow.PeekChar(); 4668TextWindow.AdvanceChar(); 4669if (!SyntaxFacts.IsHexDigit(TextWindow.PeekChar())) 4680character = TextWindow.PeekChar(); 4692TextWindow.AdvanceChar(); 4713TextWindow.AdvanceChar(); 4714if (!SyntaxFacts.IsHexDigit(TextWindow.PeekChar())) 4725char ch2 = TextWindow.PeekChar(); 4740TextWindow.AdvanceChar(); 4764Debug.Assert(TextWindow.PeekChar() == '&'); 4767TextWindow.AdvanceChar(); 4771switch (TextWindow.PeekChar()) 4774if (TextWindow.AdvanceIfMatches("lt;")) 4781if (TextWindow.AdvanceIfMatches("gt;")) 4788if (TextWindow.AdvanceIfMatches("amp;")) 4793else if (TextWindow.AdvanceIfMatches("apos;")) 4800if (TextWindow.AdvanceIfMatches("quot;")) 4808TextWindow.AdvanceChar(); //# 4812if (TextWindow.AdvanceIfMatches("x")) 4815while (SyntaxFacts.IsHexDigit(digit = TextWindow.PeekChar())) 4817TextWindow.AdvanceChar(); 4833while (SyntaxFacts.IsDecDigit(digit = TextWindow.PeekChar())) 4835TextWindow.AdvanceChar(); 4849if (TextWindow.AdvanceIfMatches(";")) 4864return new SyntaxDiagnosticInfo(start - TextWindow.LexemeStartPosition, 4865TextWindow.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);