150 references to PeekToken
Microsoft.CodeAnalysis.CSharp (150)
Parser\DocumentationCommentParser.cs (1)
1381else if (CurrentToken.Kind == SyntaxKind.IdentifierToken && PeekToken(1).Kind == SyntaxKind.ColonColonToken)
Parser\LanguageParser.cs (146)
662if (isGlobal && (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken || (!IsScript && IsPossibleTopLevelUsingLocalDeclarationStatement()))) 676if (this.CurrentToken.ContextualKind != SyntaxKind.GlobalKeyword || this.PeekToken(1).Kind != SyntaxKind.UsingKeyword) 884else if (this.PeekToken(1).Kind == SyntaxKind.NamespaceKeyword) 921&& this.PeekToken(1) is { Kind: SyntaxKind.IdentifierToken, ContextualKind: SyntaxKind.AliasKeyword } 922&& this.PeekToken(2).Kind == SyntaxKind.IdentifierToken 923&& this.PeekToken(3).Kind == SyntaxKind.SemicolonToken; 1011if (type.IsMissing && this.PeekToken(1).Kind == SyntaxKind.SemicolonToken) 1023&& IsGlobalAttributeTarget(this.PeekToken(1)) 1024&& this.PeekToken(2).Kind == SyntaxKind.ColonToken; 1109=> IsSomeWord(this.CurrentToken.Kind) && this.PeekToken(1).Kind == SyntaxKind.ColonToken; 1166this.PeekToken(1).Kind == SyntaxKind.DotToken) 1270switch (this.PeekToken(1).Kind) 1382var nextToken = PeekToken(1); 1413var next = PeekToken(1); 1416isStructOrRecordKeyword(PeekToken(2)))) 1500if (IsNonContextualModifier(PeekToken(1))) 1535(currentTokenKind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && PeekToken(1).Kind == SyntaxKind.OperatorKeyword)) 1615var nextToken = this.PeekToken(1); 1673if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 1864this.PeekToken(1).ContextualKind == SyntaxKind.RecordKeyword && 1865this.PeekToken(2).Kind is SyntaxKind.IdentifierToken) 2002!(kind == SyntaxKind.DelegateKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken or SyntaxKind.OpenParenToken)) 2128this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 2129this.PeekToken(2).Kind == SyntaxKind.ColonToken; 2230return (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && PeekToken(1).Kind == SyntaxKind.RefKeyword) || this.IsTrueIdentifier(); 2271PeekToken(1).Kind == SyntaxKind.AsteriskToken 2283PeekToken(1).Kind == SyntaxKind.RefKeyword) 2296if (this.CurrentToken.Kind == SyntaxKind.CommaToken && PeekToken(1).Kind == SyntaxKind.RefKeyword) 2524if (this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 2531if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2538switch (this.PeekToken(1).Kind) 2567if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2904if (CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3016(this.CurrentToken.Kind is SyntaxKind.SemicolonToken && IsStartOfPropertyBody(this.PeekToken(1).Kind))) 3069if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 3230if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3241var kind = this.PeekToken(1).Kind; 3248IsStartOfPropertyBody(this.PeekToken(2).Kind)) 3618else if (this.PeekToken(1).Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword) 3620possibleConversion = !SyntaxFacts.IsAnyOverloadableOperator(this.PeekToken(2).Kind); 3624possibleConversion = !SyntaxFacts.IsAnyOverloadableOperator(this.PeekToken(1).Kind); 3800this.PeekToken(1).Kind is SyntaxKind.OperatorKeyword) 4211while (GetModifierExcludingScoped(this.PeekToken(peekIndex)) != DeclarationModifiers.None) 4216var token = this.PeekToken(peekIndex); 4712if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 5060if (flags.HasFlag(VariableFlags.ForStatement) && this.PeekToken(1).Kind != SyntaxKind.SemicolonToken) 5064if (!IsTrueIdentifier(this.PeekToken(1))) 5069if (this.PeekToken(2).Kind is not (SyntaxKind.SemicolonToken or SyntaxKind.EqualsToken or SyntaxKind.CloseParenToken)) 5819if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 5840if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 5986case SyntaxKind.GreaterThanToken when ((options & NameOptions.AfterIs) != 0) && this.PeekToken(1).Kind != SyntaxKind.GreaterThanToken: 6007(options & NameOptions.AfterTupleComma) != 0 && this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken || 6008(options & NameOptions.FirstElementOfPossibleTupleLiteral) != 0 && this.PeekToken(1).Kind == SyntaxKind.CommaToken) 6263if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1))) 6273&& this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 6357if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 6401this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken) 6428while (this.PeekToken(n).Kind == SyntaxKind.CommaToken) 6431return this.PeekToken(n).Kind == SyntaxKind.GreaterThanToken; 6716if (this.PeekToken(1).Kind == SyntaxKind.ThisKeyword) 6909isAlias = this.PeekToken(1).Kind == SyntaxKind.ColonColonToken; 7100var peek1 = PeekToken(1); 7221if (this.CurrentToken.Kind == SyntaxKind.VoidKeyword && this.PeekToken(1).Kind != SyntaxKind.AsteriskToken) 7396switch (this.PeekToken(1).Kind) 7452var nextToken = PeekToken(1); 7526switch (this.PeekToken(i).Kind) 7774SyntaxToken peek1 = PeekToken(1); 7847=> CurrentToken.Kind == SyntaxKind.DelegateKeyword && PeekToken(1).Kind == SyntaxKind.AsteriskToken; 7917|| (this.CurrentToken.ContextualKind is SyntaxKind.SwitchKeyword or SyntaxKind.WithKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken); 8113this.PeekToken(1).Kind == SyntaxKind.ForEachKeyword) 8119if (PeekToken(2).Kind == SyntaxKind.OpenParenToken) 8146=> PeekToken(1).Kind == SyntaxKind.OpenParenToken ? ParseUsingStatement(attributes) : ParseLocalDeclarationStatement(attributes); 8153=> CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && PeekToken(1).Kind == SyntaxKind.UsingKeyword; 8157return this.PeekToken(1).Kind == SyntaxKind.ColonToken && this.IsTrueIdentifier(); 8162return this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 8168this.PeekToken(1).Kind is SyntaxKind.ReturnKeyword or SyntaxKind.BreakKeyword; 8181this.PeekToken(1).Kind is not SyntaxKind.DotToken // e.g. `int.Parse()` is an expression 8190Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8196Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8226bool? typedIdentifier = IsPossibleTypedIdentifierStart(this.CurrentToken, this.PeekToken(1), allowThisKeyword: false); 8251var token1 = PeekToken(1); 8255if (PeekToken(2).Kind == SyntaxKind.IdentifierToken && 8256PeekToken(3).Kind == SyntaxKind.IdentifierToken) 8271var token4Kind = PeekToken(4).Kind; 8324var tk = PeekToken(1).Kind; 8534SyntaxToken nextToken = PeekToken(1); 8574if (SyntaxFacts.IsPredefinedType(PeekToken(2).Kind)) 8581if (IsTypeModifierOrTypeKeyword(PeekToken(2).Kind)) 8591bool? typedIdentifier = IsPossibleTypedIdentifierStart(nextToken, PeekToken(2), allowThisKeyword: true); 9097if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 9224if (this.PeekToken(1).Kind == SyntaxKind.RefKeyword) 9439if (this.PeekToken(1).Kind == SyntaxKind.CommaToken) 9447if (this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken) 9501switch (this.PeekToken(1).Kind) 9786(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword && this.PeekToken(1).Kind != SyntaxKind.OpenParenToken); 9948switch (this.PeekToken(1).Kind) 10002bool condition3 = st == ScanTypeFlags.NonGenericTypeOrExpression || this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 10023Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10914var next = PeekToken(1); 11196&& this.PeekToken(1) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token2 11201if (this.PeekToken(2) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token3 11228if (token1Kind == SyntaxKind.SwitchKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11231if (token1Kind == SyntaxKind.WithKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11376=> IsAtDotDotToken(this.CurrentToken, this.PeekToken(1)); 11410if (this.PeekToken(1) is not { Kind: SyntaxKind.DotToken } token4 || 11517else if (IsCurrentTokenFieldInKeywordContext() && PeekToken(1).Kind != SyntaxKind.ColonColonToken) 11646if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken) 11678this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 11679this.PeekToken(2).ContextualKind == SyntaxKind.IdentifierToken) 11782while (this.PeekToken(tokenIndex).Kind == SyntaxKind.StaticKeyword || 11783this.PeekToken(tokenIndex).ContextualKind == SyntaxKind.AsyncKeyword) 11788return this.PeekToken(tokenIndex).Kind == SyntaxKind.DelegateKeyword && 11789this.PeekToken(tokenIndex + 1).Kind != SyntaxKind.AsteriskToken; 11795var nextToken = this.PeekToken(1); 11801if (nextTokenKind == SyntaxKind.DotToken && !IsAtDotDotToken(nextToken, this.PeekToken(2))) 11877while (this.PeekToken(index).Kind == SyntaxKind.ExclamationToken) 11880return this.PeekToken(index).Kind 12028var nameColon = this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.ColonToken 12167var tk = this.PeekToken(curTk++); 12179return this.PeekToken(curTk - 1).Kind == SyntaxKind.CloseParenToken && 12180this.PeekToken(curTk).Kind == SyntaxKind.EqualsGreaterThanToken; 12184if (IsTrueIdentifier(this.PeekToken(1))) 12190if (this.PeekToken(skipIndex).Kind == SyntaxKind.CloseParenToken 12191&& this.PeekToken(skipIndex + 1).Kind == SyntaxKind.EqualsGreaterThanToken) 12198if (this.PeekToken(1).Kind == SyntaxKind.CloseParenToken 12199&& this.PeekToken(2).Kind == SyntaxKind.EqualsGreaterThanToken) 12207if (this.PeekToken(1).Kind == SyntaxKind.ParamsKeyword) 12216var token1 = this.PeekToken(1); 12224var token2 = this.PeekToken(2); 12309return this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken; 12481this.PeekToken(1).Kind == SyntaxKind.CloseBracketToken) 12536var token1 = this.PeekToken(1); 12571this.PeekToken(1).Kind == SyntaxKind.StaticKeyword) 12603this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 12640this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 12779return this.CurrentToken.Kind == SyntaxKind.NewKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 12829return IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 13068return this.PeekToken(1).Kind == SyntaxKind.OpenBracketToken; 13278switch (this.PeekToken(1).Kind) 13358var identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13498var peek1 = this.PeekToken(1); 13563var pk1 = this.PeekToken(1).Kind; 13571var pk2 = this.PeekToken(2).Kind; 13679var type = this.PeekToken(1).Kind != SyntaxKind.InKeyword 13684if (this.PeekToken(1).ContextualKind == SyntaxKind.InKeyword && 13712type: this.PeekToken(1).Kind != SyntaxKind.InKeyword
Parser\LanguageParser_Patterns.cs (2)
85(this.CurrentToken.ContextualKind != SyntaxKind.NameOfKeyword || this.PeekToken(1).Kind != SyntaxKind.OpenParenToken)) 394var tk = PeekToken(1).Kind;
Parser\SyntaxParser.cs (1)
178PeekToken(offset - _tokenOffset);