847 references to Kind
Microsoft.CodeAnalysis.CSharp (847)
Declarations\DeclarationTreeBuilder.cs (4)
1054
if (member.
Kind
== SyntaxKind.MethodDeclaration)
1081
switch (member.
Kind
)
1131
switch (member.
Kind
)
1229
switch (member.
Kind
)
Parser\DirectiveParser.cs (31)
89
result = (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken) ?
247
if (keyword.
Kind
== SyntaxKind.DefineKeyword)
282
bool isError = keyword.
Kind
== SyntaxKind.ErrorKeyword;
296
if (t.
Kind
== SyntaxKind.WhitespaceTrivia)
366
switch (this.CurrentToken.
Kind
)
375
if (isActive && !line.IsMissing && line.
Kind
== SyntaxKind.NumericLiteralToken)
387
if (this.CurrentToken.
Kind
== SyntaxKind.StringLiteralToken &&
403
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.OpenParenToken);
422
var characterOffset = (CurrentToken.
Kind
== SyntaxKind.NumericLiteralToken) ?
476
else if (token.
Kind
== SyntaxKind.NumericLiteralToken)
535
SyntaxToken setting = this.CurrentToken.
Kind
switch
543
SyntaxToken target = this.CurrentToken.
Kind
switch
568
if (this.CurrentToken.
Kind
== SyntaxKind.DisableKeyword || this.CurrentToken.
Kind
== SyntaxKind.RestoreKeyword)
573
while (this.CurrentToken.
Kind
!= SyntaxKind.EndOfDirectiveToken)
578
if (this.CurrentToken.
Kind
== SyntaxKind.NumericLiteralToken)
590
else if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
611
if (this.CurrentToken.
Kind
!= SyntaxKind.CommaToken)
629
else if (this.CurrentToken.
Kind
== SyntaxKind.ChecksumKeyword)
692
if (this.CurrentToken.
Kind
!= SyntaxKind.EndOfDirectiveToken &&
693
this.CurrentToken.
Kind
!= SyntaxKind.EndOfFileToken)
712
while (this.CurrentToken.
Kind
!= SyntaxKind.EndOfDirectiveToken &&
713
this.CurrentToken.
Kind
!= SyntaxKind.EndOfFileToken)
720
SyntaxToken endOfDirective = this.CurrentToken.
Kind
== SyntaxKind.EndOfDirectiveToken
741
while (this.CurrentToken.
Kind
== SyntaxKind.BarBarToken)
754
while (this.CurrentToken.
Kind
== SyntaxKind.AmpersandAmpersandToken)
767
while (this.CurrentToken.
Kind
== SyntaxKind.EqualsEqualsToken || this.CurrentToken.
Kind
== SyntaxKind.ExclamationEqualsToken)
771
left = SyntaxFactory.BinaryExpression(SyntaxFacts.GetBinaryExpression(op.
Kind
), left, op, right);
779
if (this.CurrentToken.
Kind
== SyntaxKind.ExclamationToken)
790
var k = this.CurrentToken.
Kind
;
Parser\DocumentationCommentParser.cs (79)
81
if (this.CurrentToken.
Kind
!= SyntaxKind.EndOfDocumentationCommentToken)
101
bool endTag = this.CurrentToken.
Kind
== SyntaxKind.LessThanSlashToken;
108
while (this.CurrentToken.
Kind
!= SyntaxKind.EndOfDocumentationCommentToken)
147
switch (this.CurrentToken.
Kind
)
171
switch (this.CurrentToken.
Kind
)
190
while (this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralToken
191
|| this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralNewLineToken
192
|| this.CurrentToken.
Kind
== SyntaxKind.XmlEntityLiteralToken)
218
if (this.CurrentToken.
Kind
== SyntaxKind.GreaterThanToken)
258
if (this.CurrentToken.
Kind
!= SyntaxKind.GreaterThanToken)
328
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
452
switch (this.CurrentToken.
Kind
)
525
SyntaxToken openQuote = EatToken(this.CurrentToken.
Kind
== SyntaxKind.SingleQuoteToken
533
if ((current.
Kind
== SyntaxKind.XmlTextLiteralToken || current.
Kind
== SyntaxKind.XmlEntityLiteralToken) &&
534
current.ValueText != SyntaxFacts.GetText(openQuote.
Kind
) &&
540
if ((current.
Kind
== SyntaxKind.XmlTextLiteralToken || current.
Kind
== SyntaxKind.XmlEntityLiteralToken) &&
556
SyntaxKind quoteKind = startQuote.
Kind
;
574
SyntaxKind quoteKind = startQuote.
Kind
;
592
SyntaxKind quoteKind = startQuote.
Kind
;
606
while (this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralToken
607
|| this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralNewLineToken
608
|| this.CurrentToken.
Kind
== SyntaxKind.XmlEntityLiteralToken
609
|| this.CurrentToken.
Kind
== SyntaxKind.LessThanToken)
612
if (token.
Kind
== SyntaxKind.LessThanToken)
636
var quoteKind = this.CurrentToken.
Kind
== SyntaxKind.SingleQuoteToken
685
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
725
while (this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralToken
726
|| this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralNewLineToken
727
|| this.CurrentToken.
Kind
== SyntaxKind.MinusMinusToken)
730
if (token.
Kind
== SyntaxKind.MinusMinusToken)
752
while (this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralToken
753
|| this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralNewLineToken)
774
while (this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralToken
775
|| this.CurrentToken.
Kind
== SyntaxKind.XmlTextLiteralNewLineToken)
900
else if (type.Kind != SyntaxKind.QualifiedName && this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
940
switch (CurrentToken.
Kind
)
971
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.ThisKeyword);
983
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.OperatorKeyword);
989
if (SyntaxFacts.IsAnyOverloadableOperator(CurrentToken.
Kind
))
1002
if (SyntaxFacts.IsUnaryOperatorDeclarationToken(CurrentToken.
Kind
) || SyntaxFacts.IsBinaryExpressionOperatorToken(CurrentToken.
Kind
))
1015
if (operatorToken.
Kind
== SyntaxKind.GreaterThanToken && operatorToken.GetTrailingTriviaWidth() == 0 && CurrentToken.GetLeadingTriviaWidth() == 0)
1017
if (CurrentToken.
Kind
== SyntaxKind.GreaterThanToken)
1022
CurrentToken.
Kind
is (SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken))
1026
if (operatorToken3.
Kind
== SyntaxKind.GreaterThanToken)
1069
else if (CurrentToken.
Kind
== SyntaxKind.EqualsToken)
1079
else if (CurrentToken.
Kind
== SyntaxKind.GreaterThanEqualsToken)
1103
Debug.Assert(SyntaxFacts.IsAnyOverloadableOperator(operatorToken.
Kind
));
1115
(isConversion || SyntaxFacts.IsAnyOverloadableOperator(CurrentToken.
Kind
)))
1124
if (CurrentToken.
Kind
== SyntaxKind.UncheckedKeyword)
1141
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.ExplicitKeyword ||
1142
CurrentToken.
Kind
== SyntaxKind.ImplicitKeyword);
1179
if (CurrentToken.
Kind
!= openKind)
1189
while (CurrentToken.
Kind
== SyntaxKind.CommaToken || IsPossibleCrefParameter())
1193
if (CurrentToken.
Kind
!= closeKind)
1204
Debug.Assert(CurrentToken.
Kind
!= SyntaxKind.CommaToken);
1229
SyntaxKind kind = this.CurrentToken.
Kind
;
1251
switch (CurrentToken.
Kind
)
1261
if (CurrentToken.
Kind
== SyntaxKind.ReadOnlyKeyword && refKindOpt is not null)
1263
if (refKindOpt.
Kind
!= SyntaxKind.RefKeyword)
1288
if (CurrentToken.
Kind
!= SyntaxKind.LessThanToken)
1310
var currentKind = CurrentToken.
Kind
;
1312
SyntaxFacts.IsPredefinedType(CurrentToken.
Kind
))
1372
if (SyntaxFacts.IsPredefinedType(CurrentToken.
Kind
))
1381
else if (CurrentToken.
Kind
== SyntaxKind.IdentifierToken && PeekToken(1).
Kind
== SyntaxKind.ColonColonToken)
1401
if (checkForMember && (leftName.IsMissing || CurrentToken.
Kind
!= SyntaxKind.DotToken))
1413
while (CurrentToken.
Kind
== SyntaxKind.DotToken)
1422
if (checkForMember && (rightName.IsMissing || CurrentToken.
Kind
!= SyntaxKind.DotToken))
1444
if (CurrentToken.
Kind
== SyntaxKind.QuestionToken)
1449
while (CurrentToken.
Kind
== SyntaxKind.AsteriskToken)
1454
if (CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
1460
while (CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
1466
while (this.CurrentToken.
Kind
!= SyntaxKind.CloseBracketToken)
1468
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
1518
switch (CurrentToken.
Kind
)
1586
switch (CurrentToken.
Kind
)
Parser\LanguageParser.cs (652)
97
if (this.CurrentToken.
Kind
== SyntaxKind.EndOfFileToken)
252
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.NamespaceKeyword);
265
if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
269
else if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken || IsPossibleNamespaceMemberDeclaration())
587
switch (this.CurrentToken.
Kind
)
662
if (isGlobal && (this.PeekToken(1).
Kind
== SyntaxKind.OpenParenToken || (!IsScript && IsPossibleTopLevelUsingLocalDeclarationStatement())))
676
if (this.CurrentToken.ContextualKind != SyntaxKind.GlobalKeyword || this.PeekToken(1).
Kind
!= SyntaxKind.UsingKeyword)
863
switch (this.CurrentToken.
Kind
)
872
return IsPossibleStartOfTypeDeclaration(this.CurrentToken.
Kind
);
884
else if (this.PeekToken(1).
Kind
== SyntaxKind.NamespaceKeyword)
895
return this.CurrentToken.
Kind
== SyntaxKind.CloseBraceToken;
920
return this.CurrentToken.
Kind
== SyntaxKind.ExternKeyword
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;
933
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ExternKeyword);
961
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.UsingKeyword);
968
if (staticToken is null && unsafeToken != null && this.CurrentToken.
Kind
== SyntaxKind.StaticKeyword)
980
var isAliasToFunctionPointer = alias != null && this.CurrentToken.
Kind
== SyntaxKind.DelegateKeyword;
999
type = WithAdditionalDiagnostics(CreateMissingIdentifierName(), GetExpectedTokenError(SyntaxKind.IdentifierToken, this.CurrentToken.
Kind
));
1011
if (type.IsMissing && this.PeekToken(1).
Kind
== SyntaxKind.SemicolonToken)
1022
return this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken
1024
&& this.PeekToken(2).
Kind
== SyntaxKind.ColonToken;
1042
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenBracketToken)
1060
if (SyntaxFacts.IsLiteralExpression(this.CurrentToken.
Kind
))
1104
return this.CurrentToken.
Kind
== SyntaxKind.CloseBracketToken
1109
=> IsSomeWord(this.CurrentToken.
Kind
) && this.PeekToken(1).
Kind
== SyntaxKind.ColonToken;
1154
if (this.CurrentToken.
Kind
== SyntaxKind.DotToken)
1160
if (this.CurrentToken.
Kind
== SyntaxKind.MinusGreaterThanToken)
1165
if (this.CurrentToken.
Kind
== SyntaxKind.QuestionToken &&
1166
this.PeekToken(1).
Kind
== SyntaxKind.DotToken)
1208
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
1268
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
1270
switch (this.PeekToken(1).
Kind
)
1292
=> GetModifierExcludingScoped(token.
Kind
, token.ContextualKind);
1388
else if (nextToken.
Kind
== SyntaxKind.NamespaceKeyword)
1394
nextToken.
Kind
is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword ||
1395
(IsPossibleStartOfTypeDeclaration(nextToken.
Kind
) && GetModifierExcludingScoped(nextToken) != DeclarationModifiers.None))
1470
Debug.Assert(modTok.
Kind
is not (SyntaxKind.OutKeyword or SyntaxKind.InKeyword));
1476
if (token.
Kind
== SyntaxKind.StructKeyword)
1496
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.CurrentToken) != DeclarationModifiers.None);
1532
var currentTokenKind = this.CurrentToken.
Kind
;
1535
(currentTokenKind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && PeekToken(1).
Kind
== SyntaxKind.OperatorKeyword))
1554
var currentTokenKind = this.CurrentToken.
Kind
;
1572
if (SyntaxFacts.IsPredefinedType(this.CurrentToken.
Kind
))
1616
switch (nextToken.
Kind
)
1670
switch (this.CurrentToken.
Kind
)
1673
if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).
Kind
== SyntaxKind.UsingKeyword)
1693
switch (this.CurrentToken.
Kind
)
1715
throw ExceptionUtilities.UnexpectedValue(this.CurrentToken.
Kind
);
1721
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword or SyntaxKind.InterfaceKeyword ||
1741
var paramList = CurrentToken.
Kind
== SyntaxKind.OpenParenToken
1764
if (CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
1788
SyntaxKind kind = this.CurrentToken.
Kind
;
1796
var member = this.ParseMemberDeclaration(keyword.
Kind
);
1826
closeBrace = WithAdditionalDiagnostics(closeBrace, this.GetExpectedTokenError(SyntaxKind.CloseBraceToken, this.CurrentToken.
Kind
));
1856
recordModifier = this.CurrentToken.
Kind
is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword
1863
if (this.CurrentToken.
Kind
is SyntaxKind.StructKeyword or SyntaxKind.ClassKeyword &&
1865
this.PeekToken(2).
Kind
is SyntaxKind.IdentifierToken)
1876
recordModifier = SyntaxFactory.MissingToken(misplacedToken.
Kind
);
1892
switch (keyword.
Kind
)
1943
SyntaxKind declarationKind = recordModifier?.
Kind
== SyntaxKind.StructKeyword ? SyntaxKind.RecordStructDeclaration : SyntaxKind.RecordDeclaration;
1961
throw ExceptionUtilities.UnexpectedValue(keyword.
Kind
);
1998
SyntaxKind kind = this.CurrentToken.
Kind
;
2002
!(kind == SyntaxKind.DelegateKeyword && this.PeekToken(1).
Kind
is SyntaxKind.OpenBraceToken or SyntaxKind.OpenParenToken))
2046
return this.IsPossibleMemberStart() || this.CurrentToken.
Kind
== SyntaxKind.CloseBraceToken;
2051
return this.CurrentToken.
Kind
is SyntaxKind.ColonToken or SyntaxKind.OpenBraceToken
2068
list.Add(this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken
2075
if (this.CurrentToken.
Kind
is SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken ||
2081
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
2128
this.PeekToken(1).
Kind
== SyntaxKind.IdentifierToken &&
2129
this.PeekToken(2).
Kind
== SyntaxKind.ColonToken;
2152
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken || this.IsCurrentTokenWhereOfConstraintClause())
2166
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
2167
|| ((_termState & TerminatorState.IsEndOfRecordOrClassOrStructOrInterfaceSignature) != 0 && this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
2168
|| this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken
2173
else if (haveComma = (this.CurrentToken.
Kind
== SyntaxKind.CommaToken) || this.IsPossibleTypeParameterConstraint())
2221
switch (this.CurrentToken.
Kind
)
2230
return (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && PeekToken(1).
Kind
== SyntaxKind.RefKeyword) || this.IsTrueIdentifier();
2232
return IsPredefinedType(this.CurrentToken.
Kind
);
2238
return this.CurrentToken.
Kind
switch
2250
this.CurrentToken.
Kind
== SyntaxKind.QuestionToken
2271
PeekToken(1).
Kind
== SyntaxKind.AsteriskToken
2283
PeekToken(1).
Kind
== SyntaxKind.RefKeyword)
2296
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken && PeekToken(1).
Kind
== SyntaxKind.RefKeyword)
2314
return CanStartMember(this.CurrentToken.
Kind
);
2375
switch (this.CurrentToken.
Kind
)
2521
switch (this.CurrentToken.
Kind
)
2524
if (this.PeekToken(1).
Kind
== SyntaxKind.OpenBraceToken)
2531
if (this.PeekToken(1).
Kind
== SyntaxKind.OpenParenToken)
2538
switch (this.PeekToken(1).
Kind
)
2567
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken && this.PeekToken(1).
Kind
== SyntaxKind.OpenParenToken)
2601
if (this.CurrentToken.
Kind
== SyntaxKind.ConstKeyword)
2614
if (this.CurrentToken.
Kind
== SyntaxKind.EventKeyword)
2620
if (this.CurrentToken.
Kind
== SyntaxKind.FixedKeyword)
2632
if (this.CurrentToken.
Kind
== SyntaxKind.NamespaceKeyword)
2654
if (this.CurrentToken.
Kind
is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken &&
2899
if (CurrentToken.
Kind
== SyntaxKind.UsingKeyword)
2904
if (CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).
Kind
== SyntaxKind.UsingKeyword)
2987
|| this.CurrentToken.
Kind
is not SyntaxKind.OpenParenToken and not SyntaxKind.OpenBraceToken and not SyntaxKind.EqualsGreaterThanToken) &&
3007
if (identifierOrThisOpt.
Kind
== SyntaxKind.ThisKeyword)
3015
if (IsStartOfPropertyBody(this.CurrentToken.
Kind
) ||
3016
(this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken && IsStartOfPropertyBody(this.PeekToken(1).
Kind
)))
3069
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken && this.PeekToken(1).
Kind
== SyntaxKind.OpenParenToken)
3075
if (this.CurrentToken.
Kind
== SyntaxKind.TildeToken)
3081
if (this.CurrentToken.
Kind
== SyntaxKind.ConstKeyword)
3087
if (this.CurrentToken.
Kind
== SyntaxKind.EventKeyword)
3093
if (this.CurrentToken.
Kind
== SyntaxKind.FixedKeyword)
3208
if (identifierOrThisOpt.
Kind
!= SyntaxKind.IdentifierToken)
3225
if (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken)
3230
if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).
Kind
== SyntaxKind.UsingKeyword)
3241
var kind = this.PeekToken(1).
Kind
;
3248
IsStartOfPropertyBody(this.PeekToken(2).
Kind
))
3270
return this.CurrentToken.
Kind
is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword or SyntaxKind.OperatorKeyword;
3292
if (token.
Kind
!= SyntaxKind.None)
3312
var initializer = this.CurrentToken.
Kind
== SyntaxKind.ColonToken
3331
var kind = this.CurrentToken.
Kind
== SyntaxKind.BaseKeyword
3336
if (this.CurrentToken.
Kind
is SyntaxKind.BaseKeyword or SyntaxKind.ThisKeyword)
3348
var argumentList = this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken
3360
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.TildeToken);
3386
if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
3394
blockBody = this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
3398
expressionBody = this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken
3409
else if (parseSemicolonAfterBlock && this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
3421
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
3427
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
3433
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken)
3449
=> this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken;
3453
return this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken;
3457
=> this.CurrentToken.
Kind
is SyntaxKind.DotToken or SyntaxKind.ColonColonToken;
3460
=> this.CurrentToken.
Kind
== (errored ? SyntaxKind.CloseParenToken : SyntaxKind.GreaterThanToken);
3463
=> this.CurrentToken.
Kind
== SyntaxKind.CloseBracketToken;
3485
else if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
3538
switch (this.CurrentToken.
Kind
)
3557
if (this.CurrentToken.
Kind
is not (SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword))
3561
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
3571
if (this.CurrentToken.
Kind
== SyntaxKind.OperatorKeyword)
3585
(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken))
3591
separatorKind = this.CurrentToken.
Kind
;
3613
if (this.CurrentToken.
Kind
!= SyntaxKind.OperatorKeyword ||
3618
else if (this.PeekToken(1).
Kind
is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword)
3620
possibleConversion = !SyntaxFacts.IsAnyOverloadableOperator(this.PeekToken(2).
Kind
);
3624
possibleConversion = !SyntaxFacts.IsAnyOverloadableOperator(this.PeekToken(1).
Kind
);
3635
var style = this.CurrentToken.
Kind
is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword
3645
if (!style.IsMissing && explicitInterfaceOpt is not null && this.CurrentToken.
Kind
!= SyntaxKind.OperatorKeyword && style.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia))
3677
bool couldBeParameterList = this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken;
3682
this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
3713
if (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken)
3730
if (this.CurrentToken.
Kind
== SyntaxKind.OperatorKeyword)
3740
(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken);
3747
if (separator?.
Kind
== SyntaxKind.ColonColonToken)
3767
if (separator.
Kind
!= SyntaxKind.DotToken)
3769
separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.
Kind
, separator.GetLeadingTriviaWidth(), separator.Width));
3779
if (CurrentToken.
Kind
== SyntaxKind.UncheckedKeyword)
3799
if (firstToken.
Kind
is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword &&
3800
this.PeekToken(1).
Kind
is SyntaxKind.OperatorKeyword)
3831
if (SyntaxFacts.IsAnyOverloadableOperator(this.CurrentToken.
Kind
))
3840
if (this.CurrentToken.
Kind
is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)
3873
var opKind = opToken.
Kind
;
3875
if (opToken.
Kind
== SyntaxKind.GreaterThanToken && tk.
Kind
== SyntaxKind.GreaterThanToken &&
3881
if (tk.
Kind
== SyntaxKind.GreaterThanToken &&
3968
Debug.Assert(thisKeyword.
Kind
== SyntaxKind.ThisKeyword);
3984
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken)
3992
if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
4001
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken
4036
if (this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken)
4042
Debug.Assert(IsStartOfPropertyBody(this.CurrentToken.
Kind
));
4044
var accessorList = this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
4052
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken)
4060
else if (this.CurrentToken.
Kind
== SyntaxKind.EqualsToken)
4072
else if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
4126
if (this.CurrentToken.
Kind
== SyntaxKind.CloseBraceToken)
4161
var refKeyword = this.CurrentToken.
Kind
== SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression)
4179
return this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken
4182
|| this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken // for accessor blocks w/ missing keyword
4183
|| this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken // for empty body accessors w/ missing keyword
4217
if (token.
Kind
is SyntaxKind.CloseBraceToken or SyntaxKind.EndOfFileToken)
4435
bool currentTokenIsSemicolon = this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken;
4436
bool currentTokenIsArrow = this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken;
4437
bool currentTokenIsOpenBraceToken = this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken;
4622
return this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken;
4627
switch (this.CurrentToken.
Kind
)
4639
return IsParameterModifierExcludingScoped(this.CurrentToken) || IsPossibleScopedKeyword(isFunctionPointerParameter: false) || IsPredefinedType(this.CurrentToken.
Kind
);
4691
if (this.CurrentToken.
Kind
== SyntaxKind.ArgListKeyword)
4702
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken && IsCurrentTokenWhereOfConstraintClause())
4712
if (this.CurrentToken.
Kind
is SyntaxKind.OpenBracketToken && this.PeekToken(1).
Kind
is SyntaxKind.CloseBracketToken)
4736
switch (token.
Kind
)
4756
if (this.CurrentToken.
Kind
is SyntaxKind.RefKeyword or SyntaxKind.OutKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword)
4773
while (this.CurrentToken.
Kind
is (SyntaxKind.RefKeyword or SyntaxKind.OutKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword))
4786
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.FixedKeyword);
4804
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.EventKeyword);
4828
if (explicitInterfaceOpt != null && this.CurrentToken.
Kind
is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken)
4853
else if (identifierOrThisOpt.
Kind
!= SyntaxKind.IdentifierToken)
4855
Debug.Assert(identifierOrThisOpt.
Kind
== SyntaxKind.ThisKeyword);
4864
Debug.Assert(identifier.
Kind
== SyntaxKind.IdentifierToken);
4880
if (explicitInterfaceOpt != null && this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
4907
if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
4926
if (modifiers is [.., SyntaxToken {
Kind
: SyntaxKind.ScopedKeyword } scopedKeyword])
4960
if (this.CurrentToken.
Kind
== SyntaxKind.DotToken)
4976
return this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken;
5041
if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
5045
else if (stopOnCloseParen && this.CurrentToken.
Kind
== SyntaxKind.CloseParenToken)
5049
else if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
5060
if (flags.HasFlag(VariableFlags.ForStatement) && this.PeekToken(1).
Kind
!= SyntaxKind.SemicolonToken)
5069
if (this.PeekToken(2).
Kind
is not (SyntaxKind.SemicolonToken or SyntaxKind.EqualsToken or SyntaxKind.CloseParenToken))
5253
var currentTokenKind = this.CurrentToken.
Kind
;
5263
currentTokenKind = this.CurrentToken.
Kind
;
5314
switch (this.CurrentToken.
Kind
)
5325
var refKeyword = isLocalOrField && !isConst && this.CurrentToken.
Kind
== SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression)
5402
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsToken)
5438
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken);
5446
(this.CurrentToken.
Kind
is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken ||
5457
switch (this.CurrentToken.
Kind
)
5469
return this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
5476
return this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken || this.IsPossibleExpression();
5495
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.DelegateKeyword);
5528
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.EnumKeyword);
5543
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
5559
if (CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
5620
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsToken)
5625
this.CurrentToken.
Kind
is SyntaxKind.CommaToken or SyntaxKind.CloseBraceToken
5635
return this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken || this.IsTrueIdentifier();
5640
return this.CurrentToken.
Kind
is SyntaxKind.DotToken or SyntaxKind.ColonColonToken;
5679
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
5699
token.
Kind
== SyntaxKind.IdentifierToken &&
5719
var ctk = this.CurrentToken.
Kind
;
5777
if (this.CurrentToken.
Kind
!= SyntaxKind.LessThanToken)
5819
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken && this.PeekToken(1).
Kind
!= SyntaxKind.CloseBracketToken)
5823
if (this.CurrentToken.
Kind
is SyntaxKind.InKeyword or SyntaxKind.OutKeyword)
5840
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken && this.PeekToken(1).
Kind
!= SyntaxKind.CloseBracketToken)
5850
this.CurrentToken.
Kind
is SyntaxKind.InKeyword or SyntaxKind.OutKeyword ? EatToken() : null,
5867
if (this.CurrentToken.
Kind
== SyntaxKind.LessThanToken)
5877
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.LessThanToken);
5902
if (this.CurrentToken.
Kind
!= SyntaxKind.LessThanToken)
5950
Debug.Assert(greaterThanToken.
Kind
== SyntaxKind.GreaterThanToken);
5952
switch (this.CurrentToken.
Kind
)
5986
case 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)
6034
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.LessThanToken);
6044
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
6047
Debug.Assert(start.
Kind
== SyntaxKind.LessThanToken);
6048
Debug.Assert(greaterThanToken.
Kind
== SyntaxKind.GreaterThanToken);
6061
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
6067
if (this.CurrentToken.
Kind
== SyntaxKind.GreaterThanToken)
6076
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
6111
isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.
Kind
is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken;
6138
isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.
Kind
is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken;
6160
isDefinitelyTypeArgumentList = this.CurrentToken.
Kind
== SyntaxKind.CommaToken;
6178
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken);
6180
if (this.CurrentToken.
Kind
!= SyntaxKind.GreaterThanToken)
6186
if (this.CurrentToken.
Kind
is SyntaxKind.IdentifierToken)
6195
if (lastScannedType is ScanTypeFlags.TupleType && this.CurrentToken.
Kind
is SyntaxKind.OpenParenToken)
6208
isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken;
6220
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.LessThanToken);
6230
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
6247
if (this.CurrentToken.
Kind
== SyntaxKind.GreaterThanToken)
6263
if (this.CurrentToken.
Kind
is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1)))
6272
if (this.CurrentToken.
Kind
is SyntaxKind.IdentifierToken
6273
&& this.PeekToken(1).
Kind
is SyntaxKind.CloseBracketToken)
6278
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken || this.IsPossibleType())
6303
switch (token.
Kind
)
6357
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken && this.PeekToken(1).
Kind
!= SyntaxKind.CloseBracketToken)
6373
var varianceToken = this.CurrentToken.
Kind
is SyntaxKind.InKeyword or SyntaxKind.OutKeyword
6400
this.CurrentToken.
Kind
is not SyntaxKind.CommaToken and not SyntaxKind.GreaterThanToken &&
6401
this.PeekToken(1).
Kind
is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken)
6422
=> this.CurrentToken.
Kind
== SyntaxKind.GreaterThanToken;
6426
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.LessThanToken);
6428
while (this.PeekToken(n).
Kind
== SyntaxKind.CommaToken)
6431
return this.PeekToken(n).
Kind
== SyntaxKind.GreaterThanToken;
6464
if (this.CurrentToken.
Kind
== SyntaxKind.ThisKeyword)
6490
if (separator != null && separator.
Kind
== SyntaxKind.ColonColonToken)
6509
if (separator.
Kind
!= SyntaxKind.DotToken)
6511
separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.
Kind
, separator.GetLeadingTriviaWidth(), separator.Width));
6515
if (isEvent && this.CurrentToken.
Kind
is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken)
6586
separator = this.CurrentToken.
Kind
== SyntaxKind.ColonColonToken
6599
if (this.CurrentToken.
Kind
== SyntaxKind.ColonColonToken)
6628
if (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken)
6664
if (separator != null && separator.
Kind
== SyntaxKind.ColonColonToken)
6691
if (separator.
Kind
!= SyntaxKind.DotToken)
6693
separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.
Kind
, separator.GetLeadingTriviaWidth(), separator.Width));
6704
return this.CurrentToken.
Kind
== SyntaxKind.ColonColonToken
6716
if (this.PeekToken(1).
Kind
== SyntaxKind.ThisKeyword)
6733
Debug.Assert(separator.
Kind
is SyntaxKind.DotToken or SyntaxKind.ColonColonToken);
6736
switch (separator.
Kind
)
6834
var tk = this.CurrentToken.
Kind
;
6855
if (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken || !this.IsTrueIdentifier())
6862
if (this.CurrentToken.
Kind
== SyntaxKind.LessThanToken)
6877
if (this.CurrentToken.
Kind
== SyntaxKind.RefKeyword)
6882
if (this.CurrentToken.
Kind
== SyntaxKind.ReadOnlyKeyword)
6889
if (this.CurrentToken.
Kind
is SyntaxKind.IdentifierToken or SyntaxKind.ColonColonToken)
6892
if (this.CurrentToken.
Kind
is SyntaxKind.ColonColonToken)
6906
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.IdentifierToken);
6909
isAlias = this.PeekToken(1).
Kind
== SyntaxKind.ColonColonToken;
6946
else if (IsPredefinedType(this.CurrentToken.
Kind
))
6952
else if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
6957
if (result == ScanTypeFlags.NotType || mode == ParseTypeMode.DefinitePattern && this.CurrentToken.
Kind
!= SyntaxKind.OpenBracketToken)
6977
switch (this.CurrentToken.
Kind
)
6980
when lastTokenOfType.
Kind
is not SyntaxKind.QuestionToken // don't allow `Type??`
7018
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
7023
if (this.CurrentToken.
Kind
!= SyntaxKind.CloseBracketToken)
7056
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
7074
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken);
7076
if (this.CurrentToken.
Kind
== SyntaxKind.CloseParenToken)
7098
if (CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
7106
case var _ when peek1.
Kind
== SyntaxKind.OpenBracketToken:
7116
if (CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
7133
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.CommaToken);
7156
var validStartingToken = EatToken().
Kind
== SyntaxKind.LessThanToken;
7186
if (!validStartingToken && CurrentToken.
Kind
== SyntaxKind.CloseParenToken)
7200
isNotExpectedFunction: static p => p.CurrentToken.
Kind
!= SyntaxKind.CommaToken,
7221
if (this.CurrentToken.
Kind
== SyntaxKind.VoidKeyword && this.PeekToken(1).
Kind
!= SyntaxKind.AsteriskToken)
7246
if (this.CurrentToken.
Kind
== SyntaxKind.RefKeyword)
7250
this.CurrentToken.
Kind
== SyntaxKind.ReadOnlyKeyword ? this.EatToken() : null,
7294
switch (this.CurrentToken.
Kind
)
7342
while (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken);
7363
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.QuestionToken);
7386
if (mode == ParseTypeMode.AfterIs && this.CurrentToken.
Kind
is SyntaxKind.OpenBracketToken)
7396
switch (this.PeekToken(1).
Kind
)
7413
return this.CurrentToken.
Kind
!= SyntaxKind.ColonToken;
7458
var nextTokenKind = nextToken.
Kind
;
7503
if (this.CurrentToken.
Kind
is SyntaxKind.OpenBracketToken)
7512
this.CurrentToken.
Kind
is SyntaxKind.OpenParenToken or // ctor parameters
7526
switch (this.PeekToken(i).
Kind
)
7547
while (IsMakingProgress(ref lastTokenPosition) && this.CurrentToken.
Kind
!= SyntaxKind.CloseBracketToken)
7549
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
7562
if (this.CurrentToken.
Kind
!= SyntaxKind.CloseBracketToken)
7607
if (this.CurrentToken.
Kind
!= SyntaxKind.CloseParenToken)
7611
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
7653
if (IsPredefinedType(this.CurrentToken.
Kind
))
7657
if (token.
Kind
== SyntaxKind.VoidKeyword && this.CurrentToken.
Kind
!= SyntaxKind.AsteriskToken)
7666
if (IsTrueIdentifier() || this.CurrentToken.
Kind
== SyntaxKind.ColonColonToken)
7671
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
7737
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.CommaToken);
7748
lessThanToken.IsMissing && CurrentToken.
Kind
== SyntaxKind.CloseParenToken
7771
if (CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
7787
case var _ when peek1.
Kind
== SyntaxKind.OpenBracketToken:
7799
if (CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
7817
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.CommaToken);
7833
if (managedSpecifier.
Kind
== SyntaxKind.ManagedKeyword && unmanagedCallingConventions != null)
7847
=> CurrentToken.
Kind
== SyntaxKind.DelegateKeyword && PeekToken(1).
Kind
== SyntaxKind.AsteriskToken;
7852
=> token.
Kind
== SyntaxKind.LessThanToken || token.
Kind
== SyntaxKind.OpenParenToken;
7858
while (this.CurrentToken.
Kind
== SyntaxKind.AsteriskToken)
7878
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenBracketToken)
7892
while (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
7902
var isCollectionExpression = this.CurrentToken.
Kind
7915
|| IsExpectedBinaryOperator(this.CurrentToken.
Kind
)
7916
|| IsExpectedAssignmentOperator(this.CurrentToken.
Kind
)
7917
|| (this.CurrentToken.ContextualKind is SyntaxKind.SwitchKeyword or SyntaxKind.WithKeyword && this.PeekToken(1).
Kind
is SyntaxKind.OpenBraceToken);
7921
this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
7980
switch (this.CurrentToken.
Kind
)
8113
this.PeekToken(1).
Kind
== SyntaxKind.ForEachKeyword)
8119
if (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;
8157
return this.PeekToken(1).
Kind
== SyntaxKind.ColonToken && this.IsTrueIdentifier();
8162
return this.PeekToken(1).
Kind
== SyntaxKind.OpenBraceToken;
8168
this.PeekToken(1).
Kind
is SyntaxKind.ReturnKeyword or SyntaxKind.BreakKeyword;
8177
var tk = this.CurrentToken.
Kind
;
8181
this.PeekToken(1).
Kind
is not SyntaxKind.DotToken // e.g. `int.Parse()` is an expression
8190
Debug.Assert(PeekToken(1).
Kind
!= SyntaxKind.OpenParenToken);
8196
Debug.Assert(PeekToken(2).
Kind
!= SyntaxKind.OpenParenToken);
8252
if (token1.
Kind
== SyntaxKind.DotToken &&
8255
if (PeekToken(2).
Kind
== SyntaxKind.IdentifierToken &&
8256
PeekToken(3).
Kind
== SyntaxKind.IdentifierToken)
8271
var token4Kind = PeekToken(4).
Kind
;
8291
if (st == ScanTypeFlags.MustBeType && this.CurrentToken.
Kind
is not SyntaxKind.DotToken and not SyntaxKind.OpenParenToken)
8296
if (st == ScanTypeFlags.NotType || this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken)
8319
if (this.CurrentToken.
Kind
!= SyntaxKind.UsingKeyword)
8324
var tk = PeekToken(1).
Kind
;
8385
if (this.CurrentToken.
Kind
is SyntaxKind.OpenBraceToken)
8391
if (identifierOrThisOpt.
Kind
== SyntaxKind.ThisKeyword)
8406
if (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken)
8413
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsToken)
8422
return this.CurrentToken.
Kind
is SyntaxKind.CommaToken or SyntaxKind.SemicolonToken;
8440
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken || this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword)
8447
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
8531
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.NewKeyword);
8538
switch (nextToken.
Kind
)
8566
if (SyntaxFacts.GetBaseTypeDeclarationKind(nextToken.
Kind
) != SyntaxKind.None)
8574
if (SyntaxFacts.IsPredefinedType(PeekToken(2).
Kind
))
8581
if (IsTypeModifierOrTypeKeyword(PeekToken(2).
Kind
))
8619
switch (next.
Kind
)
8676
CSharpSyntaxNode openBrace = isAccessorBody && this.CurrentToken.
Kind
!= SyntaxKind.OpenBraceToken
8757
while (this.CurrentToken.
Kind
is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken
8789
return this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken
8801
static (p, _) => p.CurrentToken.
Kind
== SyntaxKind.CloseBraceToken,
8809
var tk = this.CurrentToken.
Kind
;
8873
return this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken;
8936
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.TryKeyword or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword);
8949
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword);
8963
if (this.CurrentToken.
Kind
== SyntaxKind.CatchKeyword)
8966
while (this.CurrentToken.
Kind
== SyntaxKind.CatchKeyword)
8972
if (this.CurrentToken.
Kind
== SyntaxKind.FinallyKeyword)
9007
return this.CurrentToken.
Kind
is SyntaxKind.CloseBraceToken or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword;
9012
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.CatchKeyword);
9019
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
9071
return this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken
9080
return this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken
9088
return this.CurrentToken.
Kind
is SyntaxKind.CloseBraceToken
9095
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword);
9097
if (this.PeekToken(1).
Kind
== SyntaxKind.OpenParenToken)
9104
SyntaxFacts.GetCheckStatement(keyword.
Kind
),
9112
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.DoKeyword);
9136
return this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken;
9153
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ForKeyword);
9155
if (this.EatToken().
Kind
== SyntaxKind.OpenParenToken &&
9157
this.EatToken().
Kind
== SyntaxKind.IdentifierToken &&
9158
this.EatToken().
Kind
== SyntaxKind.InKeyword)
9174
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ForKeyword);
9184
var condition = this.CurrentToken.
Kind
is not SyntaxKind.SemicolonToken and not SyntaxKind.CommaToken
9193
var incrementors = this.CurrentToken.
Kind
!= SyntaxKind.CloseParenToken
9224
if (this.PeekToken(1).
Kind
== SyntaxKind.RefKeyword)
9231
isDeclaration = ScanType() != ScanTypeFlags.NotType && this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken;
9235
else if (this.CurrentToken.
Kind
== SyntaxKind.RefKeyword)
9252
else if (this.CurrentToken.
Kind
!= SyntaxKind.SemicolonToken)
9267
=> this.CurrentToken.
Kind
is SyntaxKind.CommaToken
9275
while (this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken or SyntaxKind.CommaToken)
9299
if (@this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken)
9311
return this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken;
9318
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ForEachKeyword || this.CurrentToken.
Kind
== SyntaxKind.ForKeyword);
9329
if (this.CurrentToken.
Kind
== SyntaxKind.ForKeyword)
9434
if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
9439
if (this.PeekToken(1).
Kind
== SyntaxKind.CommaToken)
9447
if (this.PeekToken(1).
Kind
is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken)
9473
if (!ScanDesignation(permitTupleDesignation && (typeIsVar || IsPredefinedType(lastTokenOfType.
Kind
))))
9481
return this.CurrentToken.
Kind
== SyntaxKind.CommaToken;
9483
return this.CurrentToken.
Kind
is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken;
9501
switch (this.PeekToken(1).
Kind
)
9535
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.GotoKeyword);
9543
if (this.CurrentToken.
Kind
is SyntaxKind.CaseKeyword or SyntaxKind.DefaultKeyword)
9546
if (caseOrDefault.
Kind
== SyntaxKind.CaseKeyword)
9568
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.IfKeyword);
9581
var elseKeyword = this.CurrentToken.
Kind
!= SyntaxKind.ElseKeyword ?
9592
if (this.CurrentToken.
Kind
!= SyntaxKind.IfKeyword)
9633
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ElseKeyword);
9647
return this.CurrentToken.
Kind
!= SyntaxKind.ElseKeyword
9656
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.LockKeyword);
9668
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ReturnKeyword);
9672
this.CurrentToken.
Kind
!= SyntaxKind.SemicolonToken ? this.ParsePossibleRefExpression() : null,
9685
if (this.CurrentToken.
Kind
== SyntaxKind.BreakKeyword)
9694
if (this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken)
9715
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.SwitchKeyword or SyntaxKind.CaseKeyword);
9740
if (this.CurrentToken.
Kind
is SyntaxKind.CaseKeyword)
9785
return this.CurrentToken.
Kind
== SyntaxKind.CaseKeyword ||
9786
(this.CurrentToken.
Kind
== SyntaxKind.DefaultKeyword && this.PeekToken(1).
Kind
!= SyntaxKind.OpenParenToken);
9800
if (this.CurrentToken.
Kind
== SyntaxKind.CaseKeyword)
9804
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
9819
if (node.
Kind
== SyntaxKind.DiscardPattern)
9841
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.DefaultKeyword);
9863
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.ThrowKeyword);
9867
this.CurrentToken.
Kind
!= SyntaxKind.SemicolonToken ? this.ParseExpressionCore() : null,
9873
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.UnsafeKeyword);
9941
if (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken)
9948
switch (this.PeekToken(1).
Kind
)
9968
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken &&
10000
bool condition1 = st == ScanTypeFlags.MustBeType && this.CurrentToken.
Kind
!= SyntaxKind.DotToken;
10001
bool condition2 = st != ScanTypeFlags.NotType && this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken;
10002
bool condition3 = st == ScanTypeFlags.NonGenericTypeOrExpression || this.PeekToken(1).
Kind
== SyntaxKind.EqualsToken;
10009
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.WhileKeyword);
10023
Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).
Kind
== SyntaxKind.ColonToken);
10044
else if (this.CurrentToken.
Kind
== SyntaxKind.UsingKeyword)
10143
if (this.CurrentToken.
Kind
is not (SyntaxKind.RefKeyword or SyntaxKind.OutKeyword or SyntaxKind.InKeyword))
10149
? this.CurrentToken.
Kind
is not (SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken)
10150
: this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken))
10172
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
10180
done = (this.CurrentToken.
Kind
== SyntaxKind.CloseParenToken);
10193
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
10314
switch (this.CurrentToken.
Kind
)
10366
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken);
10372
if (IsDeclarationModifier(this.CurrentToken.
Kind
) ||
10373
IsAdditionalLocalFunctionModifier(this.CurrentToken.
Kind
))
10380
if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
10572
if (IsScript && this.CurrentToken.
Kind
== SyntaxKind.EndOfFileToken)
10616
SyntaxKind tk = this.CurrentToken.
Kind
;
10915
switch (next.
Kind
)
10981
var tk = this.CurrentToken.
Kind
;
11077
if (this.CurrentToken.
Kind
== SyntaxKind.QuestionToken && precedence <= Precedence.Conditional)
11152
if (IsExpectedAssignmentOperator(operatorToken.
Kind
))
11156
if (operatorExpressionKind == SyntaxKind.SimpleAssignmentExpression && CurrentToken.
Kind
== SyntaxKind.RefKeyword &&
11173
if (IsExpectedBinaryOperator(operatorToken.
Kind
))
11196
&& this.PeekToken(1) is {
Kind
: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token2
11199
if (token2.
Kind
== SyntaxKind.GreaterThanToken)
11201
if (this.PeekToken(2) is {
Kind
: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token3
11205
token1Kind = token3.
Kind
== SyntaxKind.GreaterThanToken
11228
if (token1Kind == SyntaxKind.SwitchKeyword && this.PeekToken(1).
Kind
== SyntaxKind.OpenBraceToken)
11231
if (token1Kind == SyntaxKind.WithKeyword && this.PeekToken(1).
Kind
== SyntaxKind.OpenBraceToken)
11294
if (this.CurrentToken.
Kind
!= SyntaxKind.ColonToken &&
11309
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
11321
if (this.CurrentToken.
Kind
== SyntaxKind.EndOfFileToken && this.lexer.InterpolationFollowedByColon)
11379
=> token1.
Kind
== SyntaxKind.DotToken &&
11380
token2.
Kind
== SyntaxKind.DotToken &&
11393
if (this.CurrentToken is {
Kind
: SyntaxKind.DotToken } token3 &&
11410
if (this.PeekToken(1) is not {
Kind
: SyntaxKind.DotToken } token4 ||
11463
var tk = this.CurrentToken.
Kind
;
11517
else if (IsCurrentTokenFieldInKeywordContext() && PeekToken(1).
Kind
!= SyntaxKind.ColonColonToken)
11595
if (this.CurrentToken.
Kind
!= SyntaxKind.DotToken || tk == SyntaxKind.VoidKeyword)
11630
switch (this.CurrentToken.
Kind
)
11642
expr = _syntaxFactory.PostfixUnaryExpression(SyntaxFacts.GetPostfixUnaryExpression(this.CurrentToken.
Kind
), expr, this.EatToken());
11646
if (this.PeekToken(1).
Kind
== SyntaxKind.IdentifierToken)
11678
this.PeekToken(1).
Kind
== SyntaxKind.IdentifierToken &&
11714
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.BaseKeyword);
11728
if (precedence > Precedence.Assignment || !(this.CurrentToken.IsIdentifierVar() || IsPredefinedType(this.CurrentToken.
Kind
)))
11737
this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken && ScanDesignator() &&
11738
this.CurrentToken.
Kind
== SyntaxKind.EqualsToken;
11743
switch (this.CurrentToken.
Kind
)
11762
switch (this.CurrentToken.
Kind
)
11782
while (this.PeekToken(tokenIndex).
Kind
== SyntaxKind.StaticKeyword ||
11788
return this.PeekToken(tokenIndex).
Kind
== SyntaxKind.DelegateKeyword &&
11789
this.PeekToken(tokenIndex + 1).
Kind
!= SyntaxKind.AsteriskToken;
11794
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.QuestionToken);
11796
var nextTokenKind = nextToken.
Kind
;
11820
return this.CurrentToken.
Kind
!= SyntaxKind.ColonToken;
11829
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.DotToken or SyntaxKind.OpenBracketToken);
11830
ExpressionSyntax expr = this.CurrentToken.
Kind
switch
11843
while (this.CurrentToken.
Kind
== SyntaxKind.ExclamationToken)
11847
switch (this.CurrentToken.
Kind
)
11877
while (this.PeekToken(index).
Kind
== SyntaxKind.ExclamationToken)
11880
return this.PeekToken(index).
Kind
11933
openToken = this.CurrentToken.
Kind
is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken
11940
if (this.CurrentToken.
Kind
!= closeKind && this.CurrentToken.
Kind
!= SyntaxKind.SemicolonToken)
11968
else if (isIndexer && this.CurrentToken.
Kind
== closeKind)
11984
closeToken = this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken
11993
if (@this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken)
12005
return this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken;
12010
return IsValidArgumentRefKindKeyword(this.CurrentToken.
Kind
) || this.IsPossibleExpression();
12028
var nameColon = this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken && this.PeekToken(1).
Kind
== SyntaxKind.ColonToken
12035
if (IsValidArgumentRefKindKeyword(this.CurrentToken.
Kind
) &&
12037
!(this.CurrentToken.
Kind
== SyntaxKind.RefKeyword &&
12045
if (isIndexer && this.CurrentToken.
Kind
is SyntaxKind.CommaToken or SyntaxKind.CloseBracketToken)
12049
else if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
12061
expression = refKindKeyword?.
Kind
== SyntaxKind.OutKeyword
12081
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
12125
Debug.Assert(checkedOrUnchecked.
Kind
is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword);
12126
var kind = checkedOrUnchecked.
Kind
== SyntaxKind.CheckedKeyword ? SyntaxKind.CheckedExpression : SyntaxKind.UncheckedExpression;
12154
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.OpenParenToken);
12170
if (tk.
Kind
is not SyntaxKind.IdentifierToken and not SyntaxKind.CommaToken
12171
&& !SyntaxFacts.IsPredefinedType(tk.
Kind
)
12179
return this.PeekToken(curTk - 1).
Kind
== SyntaxKind.CloseParenToken &&
12180
this.PeekToken(curTk).
Kind
== SyntaxKind.EqualsGreaterThanToken;
12190
if (this.PeekToken(skipIndex).
Kind
== SyntaxKind.CloseParenToken
12191
&& this.PeekToken(skipIndex + 1).
Kind
== SyntaxKind.EqualsGreaterThanToken)
12198
if (this.PeekToken(1).
Kind
== SyntaxKind.CloseParenToken
12199
&& this.PeekToken(2).
Kind
== SyntaxKind.EqualsGreaterThanToken)
12207
if (this.PeekToken(1).
Kind
== SyntaxKind.ParamsKeyword)
12219
if (token1.
Kind
== SyntaxKind.IdentifierToken)
12226
if (token2.
Kind
== SyntaxKind.CommaToken)
12239
Debug.Assert(CurrentToken.
Kind
== SyntaxKind.OpenParenToken);
12295
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
12303
switch (this.CurrentToken.
Kind
)
12309
return this.PeekToken(1).
Kind
== SyntaxKind.EqualsGreaterThanToken;
12319
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken);
12347
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
12355
if (expression.Kind == SyntaxKind.IdentifierName && this.CurrentToken.
Kind
== SyntaxKind.ColonToken)
12376
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
12381
var argument = expression.Kind != SyntaxKind.IdentifierName || this.CurrentToken.
Kind
!= SyntaxKind.ColonToken
12407
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
12420
if (this.CurrentToken.
Kind
!= SyntaxKind.CloseParenToken)
12427
if (forPattern && this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
12449
return !forPattern || this.CurrentToken.
Kind
switch
12474
return this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken || CanFollowCast(this.CurrentToken.
Kind
);
12480
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken &&
12481
this.PeekToken(1).
Kind
== SyntaxKind.CloseBracketToken)
12489
return CanFollowCast(this.CurrentToken.
Kind
);
12541
if (token1.
Kind
== SyntaxKind.EqualsGreaterThanToken)
12549
if (CurrentToken.
Kind
== SyntaxKind.OpenBracketToken)
12565
if (this.CurrentToken.
Kind
== SyntaxKind.StaticKeyword)
12571
this.PeekToken(1).
Kind
== SyntaxKind.StaticKeyword)
12584
if (this.CurrentToken.
Kind
== SyntaxKind.EqualsGreaterThanToken)
12594
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
12602
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken &&
12603
this.PeekToken(1).
Kind
== SyntaxKind.EqualsGreaterThanToken)
12622
if (st == ScanTypeFlags.NotType || this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
12639
if (this.CurrentToken.
Kind
== SyntaxKind.IdentifierToken &&
12640
this.PeekToken(1).
Kind
== SyntaxKind.EqualsGreaterThanToken)
12647
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
12719
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.NewKeyword);
12738
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken);
12779
return this.CurrentToken.
Kind
== SyntaxKind.NewKeyword && this.PeekToken(1).
Kind
== SyntaxKind.OpenBraceToken;
12787
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken);
12824
return this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken;
12829
return IsTrueIdentifier() && this.PeekToken(1).
Kind
== SyntaxKind.EqualsToken;
12834
return this.CurrentToken.
Kind
== SyntaxKind.OpenBracketToken;
12850
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken)
12860
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
12865
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken)
12887
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
12898
switch (this.CurrentToken.
Kind
)
13028
this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
13039
this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
13067
Debug.Assert(this.CurrentToken.
Kind
is SyntaxKind.NewKeyword or SyntaxKind.StackAllocKeyword);
13068
return this.PeekToken(1).
Kind
== SyntaxKind.OpenBracketToken;
13094
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
13161
if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
13183
this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken ? this.ParseArrayInitializer() : null);
13211
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
13224
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenBraceToken)
13255
if (this.CurrentToken.
Kind
== SyntaxKind.StaticKeyword)
13278
switch (this.PeekToken(1).
Kind
)
13301
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken &&
13338
if (CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
13345
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
13358
var identifier = (this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken && this.PeekToken(1).
Kind
== SyntaxKind.EqualsGreaterThanToken)
13375
=> CurrentToken.
Kind
== SyntaxKind.OpenBraceToken
13414
switch (this.CurrentToken.
Kind
)
13432
return IsPredefinedType(this.CurrentToken.
Kind
);
13471
if (IsPredefinedType(this.CurrentToken.
Kind
))
13477
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken)
13499
if (peek1.
Kind
!= SyntaxKind.CommaToken &&
13500
peek1.
Kind
!= SyntaxKind.CloseParenToken &&
13501
peek1.
Kind
!= SyntaxKind.EqualsGreaterThanToken &&
13502
peek1.
Kind
!= SyntaxKind.OpenBraceToken &&
13503
peek1.
Kind
!= SyntaxKind.EqualsToken)
13563
var pk1 = this.PeekToken(1).
Kind
;
13571
var pk2 = this.PeekToken(2).
Kind
;
13608
return this.ScanType() != ScanTypeFlags.NotType && this.CurrentToken.
Kind
is SyntaxKind.IdentifierToken or SyntaxKind.InKeyword;
13679
var type = this.PeekToken(1).
Kind
!= SyntaxKind.InKeyword
13685
(this.CurrentToken.
Kind
!= SyntaxKind.IdentifierToken || SyntaxFacts.IsQueryContextualKeyword(this.CurrentToken.ContextualKind)))
13712
type: this.PeekToken(1).
Kind
!= SyntaxKind.InKeyword
13755
while (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
13757
if (this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken)
13761
else if (this.CurrentToken.
Kind
== SyntaxKind.CommaToken)
13799
if (direction.
Kind
== SyntaxKind.DescendingKeyword)
13959
if (requireOneElement || this.CurrentToken.
Kind
!= closeTokenKind)
13976
if (this.CurrentToken.
Kind
== closeTokenKind)
13982
nodes.AddSeparator(this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken
13989
if (this.CurrentToken.
Kind
== closeTokenKind)
14024
if (this.CurrentToken.
Kind
== separatorTokenKind)
14029
if (allowSemicolonAsSeparator && this.CurrentToken.
Kind
is SyntaxKind.SemicolonToken)
14118
if (this.CurrentToken.
Kind
== SyntaxKind.EndOfFileToken) return node;
14120
while (this.CurrentToken.
Kind
!= SyntaxKind.EndOfFileToken)
Parser\LanguageParser_InterpolatedString.cs (3)
40
Debug.Assert(this.CurrentToken.
Kind
== SyntaxKind.InterpolatedStringToken);
410
if (this.CurrentToken.
Kind
!= SyntaxKind.CommaToken)
468
Debug.Assert(token.
Kind
== SyntaxKind.StringLiteralToken);
Parser\LanguageParser_Patterns.cs (24)
78
var tk = CurrentToken.
Kind
;
85
(this.CurrentToken.ContextualKind != SyntaxKind.NameOfKeyword || this.PeekToken(1).
Kind
!= SyntaxKind.OpenParenToken))
121
switch (this.CurrentToken.
Kind
)
143
switch (this.CurrentToken.
Kind
)
175
var tk = this.CurrentToken.
Kind
;
192
switch (CurrentToken.
Kind
)
244
switch (this.CurrentToken.
Kind
)
276
(this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken || this.IsValidPatternDesignation(inSwitchArmPattern)))
285
if (this.CurrentToken.
Kind
== SyntaxKind.OpenParenToken && (type != null || !looksLikeCast()))
360
if (this.CurrentToken.
Kind
== SyntaxKind.OpenBraceToken)
386
if (CurrentToken.
Kind
== SyntaxKind.IdentifierToken)
394
var tk = PeekToken(1).
Kind
;
477
if (this.CurrentToken.
Kind
!= SyntaxKind.OpenParenToken)
509
if (this.CurrentToken.
Kind
== SyntaxKind.ColonToken && ConvertPatternToExpressionIfPossible(pattern, permitTypeArguments: true) is ExpressionSyntax expr)
530
this.CurrentToken.
Kind
is
543
if (@this.CurrentToken.
Kind
is SyntaxKind.CloseParenToken or SyntaxKind.CloseBraceToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken)
550
if (@this._termState.HasFlag(TerminatorState.IsExpressionOrPatternInCaseLabelOfSwitchStatement) && @this.CurrentToken.
Kind
is SyntaxKind.ColonToken)
559
if (@this._termState.HasFlag(TerminatorState.IsPatternInSwitchExpressionArm) && @this.CurrentToken.
Kind
is SyntaxKind.EqualsGreaterThanToken or SyntaxKind.ColonToken)
584
while (this.CurrentToken.
Kind
!= SyntaxKind.CloseBraceToken)
590
var errantCase = this.CurrentToken.
Kind
== SyntaxKind.CaseKeyword
609
this.CurrentToken.
Kind
== SyntaxKind.ColonToken
615
if (errantCase is null && switchExpressionCase.FullWidth == 0 && this.CurrentToken.
Kind
!= SyntaxKind.CommaToken)
622
if (this.CurrentToken.
Kind
!= SyntaxKind.CloseBraceToken)
624
var commaToken = this.CurrentToken.
Kind
== SyntaxKind.SemicolonToken
Parser\Lexer.cs (3)
2392
if (directive.
Kind
== SyntaxKind.EndIfDirectiveTrivia || (branching != null && branching.BranchTaken))
2396
else if (directive.
Kind
== SyntaxKind.IfDirectiveTrivia)
2728
else if (tr.
Kind
== SyntaxKind.EndOfLineTrivia)
Parser\SyntaxParser.cs (13)
151
if (token.
Kind
== SyntaxKind.EndOfFileToken)
498
=> this.CurrentToken.
Kind
== kind ? this.EatToken() : null;
526
if (ct.
Kind
== kind)
533
return CreateMissingToken(kind, this.CurrentToken.
Kind
, reportError: true);
542
if (ct.
Kind
== expected)
548
var replacement = CreateMissingToken(expected, this.CurrentToken.
Kind
, reportError: true);
584
if (this.CurrentToken.
Kind
!= kind)
598
if (this.CurrentToken.
Kind
!= kind)
612
if (token.
Kind
!= kind)
614
token = WithAdditionalDiagnostics(token, this.GetExpectedTokenError(kind, token.
Kind
));
796
if (trivia.
Kind
== SyntaxKind.SkippedTokensTrivia)
1098
if (token.
Kind
!= token.ContextualKind)
1119
var identifier = SyntaxToken.Identifier(token.
Kind
, token.LeadingTrivia.Node, token.Text, token.ValueText, token.TrailingTrivia.Node);
Syntax\InternalSyntax\CSharpSyntaxNode.cs (5)
66
public override string KindText => this.
Kind
.ToString();
76
public override bool IsSkippedTokensTrivia => this.
Kind
== SyntaxKind.SkippedTokensTrivia;
77
public override bool IsDocumentationCommentTrivia => SyntaxFacts.IsDocumentationCommentTrivia(this.
Kind
);
247
return this.
Kind
== SyntaxKind.EndOfLineTrivia
248
|| this.
Kind
== SyntaxKind.SingleLineCommentTrivia;
Syntax\InternalSyntax\CSharpSyntaxRewriter.cs (1)
57
Debug.Assert(visited != null && visited.
Kind
!= SyntaxKind.None, "Cannot remove node using Syntax.InternalSyntax.SyntaxRewriter.");
Syntax\InternalSyntax\StructuredTriviaSyntax.cs (1)
18
if (this.
Kind
== SyntaxKind.SkippedTokensTrivia)
Syntax\InternalSyntax\SyntaxToken.cs (7)
255
return this.
Kind
;
269
get { return SyntaxFacts.GetText(this.
Kind
); }
286
switch (this.
Kind
)
349
return new SyntaxTokenWithTrivia(this.
Kind
, trivia, null, this.GetDiagnostics(), this.GetAnnotations());
359
return new SyntaxTokenWithTrivia(this.
Kind
, null, trivia, this.GetDiagnostics(), this.GetAnnotations());
365
return new SyntaxToken(this.
Kind
, this.FullWidth, diagnostics, this.GetAnnotations());
371
return new SyntaxToken(this.
Kind
, this.FullWidth, this.GetDiagnostics(), annotations);
Syntax\InternalSyntax\SyntaxToken.MissingTokenWithTrivia.cs (5)
37
switch (this.
Kind
)
49
return new MissingTokenWithTrivia(this.
Kind
, trivia, this.TrailingField, this.GetDiagnostics(), this.GetAnnotations());
54
return new MissingTokenWithTrivia(this.
Kind
, this.LeadingField, trivia, this.GetDiagnostics(), this.GetAnnotations());
59
return new MissingTokenWithTrivia(this.
Kind
, this.LeadingField, this.TrailingField, diagnostics, this.GetAnnotations());
64
return new MissingTokenWithTrivia(this.
Kind
, this.LeadingField, this.TrailingField, this.GetDiagnostics(), annotations);
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifier.cs (2)
46
return new SyntaxIdentifierWithTrivia(this.
Kind
, this.TextField, this.TextField, trivia, null, this.GetDiagnostics(), this.GetAnnotations());
51
return new SyntaxIdentifierWithTrivia(this.
Kind
, this.TextField, this.TextField, null, trivia, this.GetDiagnostics(), this.GetAnnotations());
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifierWithTrailingTrivia.cs (1)
42
return new SyntaxIdentifierWithTrivia(this.
Kind
, this.TextField, this.TextField, trivia, _trailing, this.GetDiagnostics(), this.GetAnnotations());
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteral.cs (4)
59
return new SyntaxTokenWithValueAndTrivia<T>(this.
Kind
, this.TextField, this.ValueField, trivia, null, this.GetDiagnostics(), this.GetAnnotations());
64
return new SyntaxTokenWithValueAndTrivia<T>(this.
Kind
, this.TextField, this.ValueField, null, trivia, this.GetDiagnostics(), this.GetAnnotations());
69
return new SyntaxTokenWithValue<T>(this.
Kind
, this.TextField, this.ValueField, diagnostics, this.GetAnnotations());
74
return new SyntaxTokenWithValue<T>(this.
Kind
, this.TextField, this.ValueField, this.GetDiagnostics(), annotations);
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteralWithTrivia.cs (4)
65
return new SyntaxTokenWithValueAndTrivia<T>(this.
Kind
, this.TextField, this.ValueField, trivia, _trailing, this.GetDiagnostics(), this.GetAnnotations());
70
return new SyntaxTokenWithValueAndTrivia<T>(this.
Kind
, this.TextField, this.ValueField, _leading, trivia, this.GetDiagnostics(), this.GetAnnotations());
75
return new SyntaxTokenWithValueAndTrivia<T>(this.
Kind
, this.TextField, this.ValueField, _leading, _trailing, diagnostics, this.GetAnnotations());
80
return new SyntaxTokenWithValueAndTrivia<T>(this.
Kind
, this.TextField, this.ValueField, _leading, _trailing, this.GetDiagnostics(), annotations);
Syntax\InternalSyntax\SyntaxToken.SyntaxTokenWithTrivia.cs (4)
58
return new SyntaxTokenWithTrivia(this.
Kind
, trivia, this.TrailingField, this.GetDiagnostics(), this.GetAnnotations());
63
return new SyntaxTokenWithTrivia(this.
Kind
, this.LeadingField, trivia, this.GetDiagnostics(), this.GetAnnotations());
68
return new SyntaxTokenWithTrivia(this.
Kind
, this.LeadingField, this.TrailingField, diagnostics, this.GetAnnotations());
73
return new SyntaxTokenWithTrivia(this.
Kind
, this.LeadingField, this.TrailingField, this.GetDiagnostics(), annotations);
Syntax\InternalSyntax\SyntaxTrivia.cs (2)
67
return new SyntaxTrivia(this.
Kind
, this.Text, diagnostics, GetAnnotations());
72
return new SyntaxTrivia(this.
Kind
, this.Text, GetDiagnostics(), annotations);
Syntax\SyntaxFactory.cs (1)
1668
if (token.
Kind
== SyntaxKind.EndOfFileToken)
Syntax\SyntaxFacts.cs (1)
450
return node.IsIdentifierVar() || IsPredefinedType(node.
Kind
);