141 references to PeekToken
Microsoft.CodeAnalysis.CSharp (141)
Parser\DocumentationCommentParser.cs (1)
1381else if (CurrentToken.Kind == SyntaxKind.IdentifierToken && PeekToken(1).Kind == SyntaxKind.ColonColonToken)
Parser\LanguageParser.cs (137)
661if (isGlobal && (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken || (!IsScript && IsPossibleTopLevelUsingLocalDeclarationStatement()))) 675if (this.CurrentToken.ContextualKind != SyntaxKind.GlobalKeyword || this.PeekToken(1).Kind != SyntaxKind.UsingKeyword) 883else if (this.PeekToken(1).Kind == SyntaxKind.NamespaceKeyword) 920&& this.PeekToken(1) is { Kind: SyntaxKind.IdentifierToken, ContextualKind: SyntaxKind.AliasKeyword } 921&& this.PeekToken(2).Kind == SyntaxKind.IdentifierToken 922&& this.PeekToken(3).Kind == SyntaxKind.SemicolonToken; 1010if (type.IsMissing && this.PeekToken(1).Kind == SyntaxKind.SemicolonToken) 1022&& IsGlobalAttributeTarget(this.PeekToken(1)) 1023&& this.PeekToken(2).Kind == SyntaxKind.ColonToken; 1108=> IsSomeWord(this.CurrentToken.Kind) && this.PeekToken(1).Kind == SyntaxKind.ColonToken; 1165this.PeekToken(1).Kind == SyntaxKind.DotToken) 1269switch (this.PeekToken(1).Kind) 1381var nextToken = PeekToken(1); 1412var next = PeekToken(1); 1415isStructOrRecordKeyword(PeekToken(2)))) 1499if (IsNonContextualModifier(PeekToken(1))) 1534(currentTokenKind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && PeekToken(1).Kind == SyntaxKind.OperatorKeyword)) 1614var nextToken = this.PeekToken(1); 1672if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 1863this.PeekToken(1).ContextualKind == SyntaxKind.RecordKeyword && 1864this.PeekToken(2).Kind is SyntaxKind.IdentifierToken) 2001!(kind == SyntaxKind.DelegateKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken or SyntaxKind.OpenParenToken)) 2127this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 2128this.PeekToken(2).Kind == SyntaxKind.ColonToken; 2229return (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && PeekToken(1).Kind == SyntaxKind.RefKeyword) || this.IsTrueIdentifier(); 2270PeekToken(1).Kind == SyntaxKind.AsteriskToken 2282PeekToken(1).Kind == SyntaxKind.RefKeyword) 2295if (this.CurrentToken.Kind == SyntaxKind.CommaToken && PeekToken(1).Kind == SyntaxKind.RefKeyword) 2523if (this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 2530if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2537switch (this.PeekToken(1).Kind) 2566if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2903if (CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3015(this.CurrentToken.Kind is SyntaxKind.SemicolonToken && IsStartOfPropertyBody(this.PeekToken(1).Kind))) 3068if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 3229if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3240var kind = this.PeekToken(1).Kind; 3247IsStartOfPropertyBody(this.PeekToken(2).Kind)) 3617else if (this.PeekToken(1).Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword) 3619possibleConversion = !SyntaxFacts.IsAnyOverloadableOperator(this.PeekToken(2).Kind); 3623possibleConversion = !SyntaxFacts.IsAnyOverloadableOperator(this.PeekToken(1).Kind); 3799this.PeekToken(1).Kind is SyntaxKind.OperatorKeyword) 4210while (GetModifierExcludingScoped(this.PeekToken(peekIndex)) != DeclarationModifiers.None) 4215var token = this.PeekToken(peekIndex); 4711if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 5062if (flags.HasFlag(VariableFlags.ForStatement) && this.PeekToken(1).Kind != SyntaxKind.SemicolonToken) 5066if (!IsTrueIdentifier(this.PeekToken(1))) 5071if (this.PeekToken(2).Kind is not (SyntaxKind.SemicolonToken or SyntaxKind.EqualsToken or SyntaxKind.CloseParenToken)) 5821if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 5842if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 5988case SyntaxKind.GreaterThanToken when ((options & NameOptions.AfterIs) != 0) && this.PeekToken(1).Kind != SyntaxKind.GreaterThanToken: 6009(options & NameOptions.AfterTupleComma) != 0 && this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken || 6010(options & NameOptions.FirstElementOfPossibleTupleLiteral) != 0 && this.PeekToken(1).Kind == SyntaxKind.CommaToken) 6265if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1))) 6275&& this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 6359if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 6403this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken) 6430while (this.PeekToken(n).Kind == SyntaxKind.CommaToken) 6433return this.PeekToken(n).Kind == SyntaxKind.GreaterThanToken; 6718if (this.PeekToken(1).Kind == SyntaxKind.ThisKeyword) 6911isAlias = this.PeekToken(1).Kind == SyntaxKind.ColonColonToken; 7102var peek1 = PeekToken(1); 7223if (this.CurrentToken.Kind == SyntaxKind.VoidKeyword && this.PeekToken(1).Kind != SyntaxKind.AsteriskToken) 7398switch (this.PeekToken(1).Kind) 7454var nextToken = PeekToken(1); 7528switch (this.PeekToken(i).Kind) 7776SyntaxToken peek1 = PeekToken(1); 7849=> CurrentToken.Kind == SyntaxKind.DelegateKeyword && PeekToken(1).Kind == SyntaxKind.AsteriskToken; 7919|| (this.CurrentToken.ContextualKind is SyntaxKind.SwitchKeyword or SyntaxKind.WithKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken); 8115this.PeekToken(1).Kind == SyntaxKind.ForEachKeyword) 8121if (PeekToken(2).Kind == SyntaxKind.OpenParenToken) 8148=> PeekToken(1).Kind == SyntaxKind.OpenParenToken ? ParseUsingStatement(attributes) : ParseLocalDeclarationStatement(attributes); 8155=> CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && PeekToken(1).Kind == SyntaxKind.UsingKeyword; 8159return this.PeekToken(1).Kind == SyntaxKind.ColonToken && this.IsTrueIdentifier(); 8164return this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 8170this.PeekToken(1).Kind is SyntaxKind.ReturnKeyword or SyntaxKind.BreakKeyword; 8183this.PeekToken(1).Kind is not SyntaxKind.DotToken // e.g. `int.Parse()` is an expression 8192Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8198Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8228bool? typedIdentifier = IsPossibleTypedIdentifierStart(this.CurrentToken, this.PeekToken(1), allowThisKeyword: false); 8253var token1 = PeekToken(1); 8257if (PeekToken(2).Kind == SyntaxKind.IdentifierToken && 8258PeekToken(3).Kind == SyntaxKind.IdentifierToken) 8273var token4Kind = PeekToken(4).Kind; 8326var tk = PeekToken(1).Kind; 8536SyntaxToken nextToken = PeekToken(1); 8576if (SyntaxFacts.IsPredefinedType(PeekToken(2).Kind)) 8583if (IsTypeModifierOrTypeKeyword(PeekToken(2).Kind)) 8593bool? typedIdentifier = IsPossibleTypedIdentifierStart(nextToken, PeekToken(2), allowThisKeyword: true); 9099if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 9226if (this.PeekToken(1).Kind == SyntaxKind.RefKeyword) 9441if (this.PeekToken(1).Kind == SyntaxKind.CommaToken) 9449if (this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken) 9503switch (this.PeekToken(1).Kind) 9788(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword && this.PeekToken(1).Kind != SyntaxKind.OpenParenToken); 9950switch (this.PeekToken(1).Kind) 10004bool condition3 = st == ScanTypeFlags.NonGenericTypeOrExpression || this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 10025Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10943var next = PeekToken(1); 11225&& this.PeekToken(1) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token2 11230if (this.PeekToken(2) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token3 11257if (token1Kind == SyntaxKind.SwitchKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11260if (token1Kind == SyntaxKind.WithKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11405=> IsAtDotDotToken(this.CurrentToken, this.PeekToken(1)); 11439if (this.PeekToken(1) is not { Kind: SyntaxKind.DotToken } token4 || 11546else if (IsCurrentTokenFieldInKeywordContext() && PeekToken(1).Kind != SyntaxKind.ColonColonToken) 11675if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken) 11707this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 11708this.PeekToken(2).ContextualKind == SyntaxKind.IdentifierToken) 11811while (this.PeekToken(tokenIndex).Kind == SyntaxKind.StaticKeyword || 11812this.PeekToken(tokenIndex).ContextualKind == SyntaxKind.AsyncKeyword) 11817return this.PeekToken(tokenIndex).Kind == SyntaxKind.DelegateKeyword && 11818this.PeekToken(tokenIndex + 1).Kind != SyntaxKind.AsteriskToken; 11824var nextToken = this.PeekToken(1); 11830if (nextTokenKind == SyntaxKind.DotToken && !IsAtDotDotToken(nextToken, this.PeekToken(2))) 11906while (this.PeekToken(index).Kind == SyntaxKind.ExclamationToken) 11909return this.PeekToken(index).Kind 12057var nameColon = this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.ColonToken 12200var token = this.PeekToken(index++); 12213this.PeekToken(index).Kind == SyntaxKind.EqualsGreaterThanToken; 12285return this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken; 12457this.PeekToken(1).Kind == SyntaxKind.CloseBracketToken) 12512var token1 = this.PeekToken(1); 12547this.PeekToken(1).Kind == SyntaxKind.StaticKeyword) 12579this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 12616this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 12755return this.CurrentToken.Kind == SyntaxKind.NewKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 12805return IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 13044return this.PeekToken(1).Kind == SyntaxKind.OpenBracketToken; 13254switch (this.PeekToken(1).Kind) 13334var identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13473var peek1 = this.PeekToken(1); 13539var pk1 = this.PeekToken(1).Kind; 13547var pk2 = this.PeekToken(2).Kind; 13655var type = this.PeekToken(1).Kind != SyntaxKind.InKeyword 13660if (this.PeekToken(1).ContextualKind == SyntaxKind.InKeyword && 13688type: 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);