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