709 references to CurrentToken
Microsoft.CodeAnalysis.CSharp (709)
Parser\DirectiveParser.cs (28)
50
SyntaxKind contextualKind = this.
CurrentToken
.ContextualKind;
89
result = (this.
CurrentToken
.Kind == SyntaxKind.OpenParenToken) ?
366
switch (this.
CurrentToken
.Kind)
387
if (this.
CurrentToken
.Kind == SyntaxKind.StringLiteralToken &&
388
(line.IsMissing || line.GetTrailingTriviaWidth() > 0 || this.
CurrentToken
.GetLeadingTriviaWidth() > 0)) //require separation between line number and file name
403
Debug.Assert(
CurrentToken
.Kind == SyntaxKind.OpenParenToken);
422
var characterOffset = (
CurrentToken
.Kind == SyntaxKind.NumericLiteralToken) ?
535
SyntaxToken setting = this.
CurrentToken
.Kind switch
543
SyntaxToken target = this.
CurrentToken
.Kind switch
564
if (this.
CurrentToken
.ContextualKind == SyntaxKind.WarningKeyword)
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)
779
if (this.
CurrentToken
.Kind == SyntaxKind.ExclamationToken)
790
var k = this.
CurrentToken
.Kind;
Parser\DocumentationCommentParser.cs (74)
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
532
SyntaxToken current = this.
CurrentToken
;
539
current = this.
CurrentToken
;
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)
631
if (IsNonAsciiQuotationMark(this.
CurrentToken
))
636
var quoteKind = this.
CurrentToken
.Kind == SyntaxKind.SingleQuoteToken
650
if (IsNonAsciiQuotationMark(this.
CurrentToken
))
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)
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)
1021
if (operatorToken2.GetTrailingTriviaWidth() == 0 &&
CurrentToken
.GetLeadingTriviaWidth() == 0 &&
1022
CurrentToken
.Kind is (SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken))
1069
else if (
CurrentToken
.Kind == SyntaxKind.EqualsToken)
1079
else if (
CurrentToken
.Kind == SyntaxKind.GreaterThanEqualsToken)
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)
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)
1530
return
CurrentToken
.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken) ||
1531
IsNonAsciiQuotationMark(
CurrentToken
);
1586
switch (
CurrentToken
.Kind)
1598
return
CurrentToken
.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken) ||
1599
IsNonAsciiQuotationMark(
CurrentToken
);
Parser\LanguageParser.cs (563)
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)
676
if (this.
CurrentToken
.ContextualKind != SyntaxKind.GlobalKeyword || this.PeekToken(1).Kind != SyntaxKind.UsingKeyword)
863
switch (this.
CurrentToken
.Kind)
872
return IsPossibleStartOfTypeDeclaration(this.
CurrentToken
.Kind);
878
if (this.
CurrentToken
.ContextualKind == SyntaxKind.PartialKeyword)
895
return this.
CurrentToken
.Kind == SyntaxKind.CloseBraceToken;
920
return this.
CurrentToken
.Kind == SyntaxKind.ExternKeyword
933
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.ExternKeyword);
957
var globalToken = this.
CurrentToken
.ContextualKind == SyntaxKind.GlobalKeyword
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));
1022
return this.
CurrentToken
.Kind == SyntaxKind.OpenBracketToken
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 &&
1208
if (this.
CurrentToken
.Kind != SyntaxKind.OpenParenToken)
1268
if (this.
CurrentToken
.Kind == SyntaxKind.IdentifierToken)
1359
var newMod = GetModifierExcludingScoped(this.
CurrentToken
);
1496
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.
CurrentToken
) != DeclarationModifiers.None);
1515
(this.
CurrentToken
.ContextualKind == SyntaxKind.PartialKeyword))
1532
var currentTokenKind = this.
CurrentToken
.Kind;
1554
var currentTokenKind = this.
CurrentToken
.Kind;
1572
if (SyntaxFacts.IsPredefinedType(this.
CurrentToken
.Kind))
1579
if (IsNonContextualModifier(this.
CurrentToken
))
1614
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.PartialKeyword);
1655
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.PartialKeyword);
1670
switch (this.
CurrentToken
.Kind)
1673
if (this.
CurrentToken
.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword)
1693
switch (this.
CurrentToken
.Kind)
1711
Debug.Assert(
CurrentToken
.ContextualKind == SyntaxKind.RecordKeyword);
1715
throw ExceptionUtilities.UnexpectedValue(this.
CurrentToken
.Kind);
1721
Debug.Assert(this.
CurrentToken
.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword or SyntaxKind.InterfaceKeyword ||
1722
this.
CurrentToken
.ContextualKind == SyntaxKind.RecordKeyword);
1741
var paramList =
CurrentToken
.Kind == SyntaxKind.OpenParenToken
1753
if (this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword)
1764
if (
CurrentToken
.Kind == SyntaxKind.SemicolonToken)
1788
SyntaxKind kind = this.
CurrentToken
.Kind;
1826
closeBrace = WithAdditionalDiagnostics(closeBrace, this.GetExpectedTokenError(SyntaxKind.CloseBraceToken, this.
CurrentToken
.Kind));
1853
if (this.
CurrentToken
.ContextualKind == SyntaxKind.RecordKeyword)
1856
recordModifier = this.
CurrentToken
.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword
1863
if (this.
CurrentToken
.Kind is SyntaxKind.StructKeyword or SyntaxKind.ClassKeyword &&
1998
SyntaxKind kind = this.
CurrentToken
.Kind;
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)
2095
if (GetModifierExcludingScoped(this.
CurrentToken
) != DeclarationModifiers.None)
2127
this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword &&
2134
while (this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword)
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
2169
|| this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword)
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
2282
if (this.
CurrentToken
.ContextualKind == SyntaxKind.AllowsKeyword &&
2296
if (this.
CurrentToken
.Kind == SyntaxKind.CommaToken && PeekToken(1).Kind == SyntaxKind.RefKeyword)
2314
return CanStartMember(this.
CurrentToken
.Kind);
2375
switch (this.
CurrentToken
.Kind)
2385
if (
CurrentToken
.ContextualKind == SyntaxKind.RecordKeyword)
2521
switch (this.
CurrentToken
.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)
2919
if (GetModifierExcludingScoped(this.
CurrentToken
) != DeclarationModifiers.None &&
2920
this.
CurrentToken
.ContextualKind is not (SyntaxKind.PartialKeyword or SyntaxKind.AsyncKeyword or SyntaxKind.RequiredKeyword or SyntaxKind.FileKeyword) &&
2923
var misplacedModifier = this.
CurrentToken
;
2967
incompleteMember.FullWidth + this.
CurrentToken
.GetLeadingTriviaWidth(),
2968
this.
CurrentToken
.Width,
2970
this.
CurrentToken
.Text);
2987
|| this.
CurrentToken
.Kind is not SyntaxKind.OpenParenToken and not SyntaxKind.OpenBraceToken and not SyntaxKind.EqualsGreaterThanToken) &&
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)
3225
if (this.
CurrentToken
.Kind != SyntaxKind.IdentifierToken)
3230
if (this.
CurrentToken
.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword)
3270
return this.
CurrentToken
.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword or SyntaxKind.OperatorKeyword;
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;
3480
if (this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword)
3485
else if (this.
CurrentToken
.Kind == SyntaxKind.ColonToken)
3488
var colonToken = this.
CurrentToken
;
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 ||
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);
3779
if (
CurrentToken
.Kind == SyntaxKind.UncheckedKeyword)
3798
var firstToken = this.
CurrentToken
;
3831
if (SyntaxFacts.IsAnyOverloadableOperator(this.
CurrentToken
.Kind))
3840
if (this.
CurrentToken
.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)
3874
var tk = this.
CurrentToken
;
3879
tk = this.
CurrentToken
;
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
4181
|| SyntaxFacts.GetAccessorDeclarationKind(this.
CurrentToken
.ContextualKind) != SyntaxKind.None
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
4205
if (GetModifierExcludingScoped(this.
CurrentToken
) == DeclarationModifiers.None)
4353
var token = (first && !this.
CurrentToken
.ContainsDiagnostics) ? this.EatTokenWithPrejudice(expected) : this.EatToken();
4379
var token = (first && !this.
CurrentToken
.ContainsDiagnostics) ? this.EatTokenWithPrejudice(errorCode) : this.EatToken();
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)
4754
while (IsParameterModifierExcludingScoped(this.
CurrentToken
))
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)
4880
if (explicitInterfaceOpt != null && this.
CurrentToken
.Kind == SyntaxKind.SemicolonToken)
4907
if (this.
CurrentToken
.Kind == SyntaxKind.SemicolonToken)
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)
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 ||
5447
this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword))
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);
5506
if (this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword)
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)
5719
var ctk = this.
CurrentToken
.Kind;
5731
result = this.AddError(result, ErrorCode.ERR_InvalidExprTerm, this.
CurrentToken
.Text);
5757
if (this.
CurrentToken
.ContextualKind == SyntaxKind.PartialKeyword)
5770
return
CurrentToken
.ContextualKind == SyntaxKind.FieldKeyword &&
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)
5952
switch (this.
CurrentToken
.Kind)
6034
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.LessThanToken);
6044
while (this.
CurrentToken
.Kind == SyntaxKind.CommaToken)
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)
6254
if (tokenBreaksTypeArgumentList(this.
CurrentToken
))
6263
if (this.
CurrentToken
.Kind is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1)))
6272
if (this.
CurrentToken
.Kind is SyntaxKind.IdentifierToken
6278
if (this.
CurrentToken
.Kind == SyntaxKind.CommaToken || this.IsPossibleType())
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 &&
6422
=> this.
CurrentToken
.Kind == SyntaxKind.GreaterThanToken;
6426
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.LessThanToken);
6464
if (this.
CurrentToken
.Kind == SyntaxKind.ThisKeyword)
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)
6704
return this.
CurrentToken
.Kind == SyntaxKind.ColonColonToken
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);
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)
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)
7101
switch (
CurrentToken
)
7116
if (
CurrentToken
.Kind == SyntaxKind.OpenBracketToken)
7133
Debug.Assert(
CurrentToken
.Kind == SyntaxKind.CommaToken);
7146
if (!IsPossibleFunctionPointerParameterListStart(
CurrentToken
))
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)
7413
return this.
CurrentToken
.Kind != SyntaxKind.ColonToken;
7440
if (IsTrueIdentifier(this.
CurrentToken
))
7449
if (this.
CurrentToken
.ContextualKind is SyntaxKind.AsyncKeyword or SyntaxKind.AwaitKeyword or SyntaxKind.FromKeyword)
7503
if (this.
CurrentToken
.Kind is SyntaxKind.OpenBracketToken)
7512
this.
CurrentToken
.Kind is SyntaxKind.OpenParenToken or // ctor parameters
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)
7694
if (!IsPossibleFunctionPointerParameterListStart(
CurrentToken
))
7737
Debug.Assert(
CurrentToken
.Kind == SyntaxKind.CommaToken);
7748
lessThanToken.IsMissing &&
CurrentToken
.Kind == SyntaxKind.CloseParenToken
7771
if (
CurrentToken
.Kind == SyntaxKind.IdentifierToken)
7775
switch (
CurrentToken
)
7779
managedSpecifier = EatContextualToken(
CurrentToken
.ContextualKind);
7799
if (
CurrentToken
.Kind == SyntaxKind.OpenBracketToken)
7817
Debug.Assert(
CurrentToken
.Kind == SyntaxKind.CommaToken);
7847
=>
CurrentToken
.Kind == SyntaxKind.DelegateKeyword && PeekToken(1).Kind == SyntaxKind.AsteriskToken;
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)
8076
bool beginsWithAwait = this.
CurrentToken
.ContextualKind == SyntaxKind.AwaitKeyword;
8112
if (this.
CurrentToken
.ContextualKind == SyntaxKind.AwaitKeyword &&
8153
=>
CurrentToken
.ContextualKind == SyntaxKind.AwaitKeyword && PeekToken(1).Kind == SyntaxKind.UsingKeyword;
8167
return this.
CurrentToken
.ContextualKind == SyntaxKind.YieldKeyword &&
8177
var tk = this.
CurrentToken
.Kind;
8205
tk = this.
CurrentToken
.ContextualKind;
8226
bool? typedIdentifier = IsPossibleTypedIdentifierStart(this.
CurrentToken
, this.PeekToken(1), allowThisKeyword: false);
8247
var tk = this.
CurrentToken
.ContextualKind;
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)
8385
if (this.
CurrentToken
.Kind is SyntaxKind.OpenBraceToken)
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);
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)
9039
var keywordKind = this.
CurrentToken
.ContextualKind;
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);
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);
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
9222
if (this.
CurrentToken
.ContextualKind == SyntaxKind.ScopedKeyword)
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)
9423
if (this.IsInAsync && this.
CurrentToken
.ContextualKind == SyntaxKind.AwaitKeyword)
9431
if (this.
CurrentToken
.ContextualKind == SyntaxKind.ScopedKeyword)
9434
if (ScanType() != ScanTypeFlags.NotType && this.
CurrentToken
.Kind == SyntaxKind.IdentifierToken)
9481
return this.
CurrentToken
.Kind == SyntaxKind.CommaToken;
9483
return this.
CurrentToken
.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken;
9496
if (!this.
CurrentToken
.IsIdentifierVar())
9535
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.GotoKeyword);
9543
if (this.
CurrentToken
.Kind is SyntaxKind.CaseKeyword or SyntaxKind.DefaultKeyword)
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,
9678
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.YieldKeyword);
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)
9816
if (this.
CurrentToken
.ContextualKind == SyntaxKind.WhenKeyword && node is ExpressionSyntax ex)
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)
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;
10009
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.WhileKeyword);
10044
else if (this.
CurrentToken
.Kind == SyntaxKind.UsingKeyword)
10137
if (this.
CurrentToken
.ContextualKind == SyntaxKind.ScopedKeyword)
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)
10223
return
CurrentToken
.ContextualKind == SyntaxKind.UnderscoreToken
10230
if (this.
CurrentToken
.ContextualKind != SyntaxKind.WhenKeyword)
10314
switch (this.
CurrentToken
.Kind)
10327
while (IsDeclarationModifier(k = this.
CurrentToken
.ContextualKind) || IsAdditionalLocalFunctionModifier(k))
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)
10388
while (IsAdditionalLocalFunctionModifier(this.
CurrentToken
.ContextualKind));
10529
if (this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword)
10572
if (IsScript && this.
CurrentToken
.Kind == SyntaxKind.EndOfFileToken)
10616
SyntaxKind tk = this.
CurrentToken
.Kind;
10662
return this.IsTrueIdentifier() || this.
CurrentToken
.ContextualKind == SyntaxKind.FromKeyword;
10898
return (this.IsScript || this.IsInAsync) && this.
CurrentToken
.ContextualKind == SyntaxKind.AwaitKeyword;
10903
if (this.
CurrentToken
.ContextualKind == SyntaxKind.AwaitKeyword)
10981
var tk = this.
CurrentToken
.Kind;
11023
if (this.
CurrentToken
.ContextualKind == SyntaxKind.FromKeyword && IsInQuery)
11030
this.AddError(this.EatToken(), ErrorCode.ERR_InvalidExprTerm, this.
CurrentToken
.Text));
11077
if (this.
CurrentToken
.Kind == SyntaxKind.QuestionToken && precedence <= Precedence.Conditional)
11156
if (operatorExpressionKind == SyntaxKind.SimpleAssignmentExpression &&
CurrentToken
.Kind == SyntaxKind.RefKeyword &&
11185
var token1 = this.
CurrentToken
;
11294
if (this.
CurrentToken
.Kind != SyntaxKind.ColonToken &&
11309
if (this.
CurrentToken
.Kind == SyntaxKind.ColonToken)
11321
if (this.
CurrentToken
.Kind == SyntaxKind.EndOfFileToken && this.lexer.InterpolationFollowedByColon)
11376
=> IsAtDotDotToken(this.
CurrentToken
, this.PeekToken(1));
11393
if (this.
CurrentToken
is { Kind: SyntaxKind.DotToken } token3 &&
11463
var tk = this.
CurrentToken
.Kind;
11499
return this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_InvalidExprTerm, this.
CurrentToken
.Text);
11528
return this.AddError(this.CreateMissingIdentifierName(), ErrorCode.ERR_InvalidExprTerm, this.
CurrentToken
.Text);
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());
11677
if (this.
CurrentToken
.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia) &&
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)
11794
Debug.Assert(this.
CurrentToken
.Kind == SyntaxKind.QuestionToken);
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)
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)
12081
if (this.
CurrentToken
.Kind == SyntaxKind.OpenParenToken)
12154
Debug.Assert(
CurrentToken
.Kind == SyntaxKind.OpenParenToken);
12239
Debug.Assert(
CurrentToken
.Kind == SyntaxKind.OpenParenToken);
12266
if (IsParameterModifierExcludingScoped(this.
CurrentToken
) || this.
CurrentToken
.ContextualKind == SyntaxKind.ScopedKeyword)
12295
if (this.
CurrentToken
.Kind == SyntaxKind.OpenBracketToken)
12303
switch (this.
CurrentToken
.Kind)
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 &&
12489
return CanFollowCast(this.
CurrentToken
.Kind);
12520
return this.
CurrentToken
.ContextualKind is SyntaxKind.OrKeyword or SyntaxKind.AndKeyword;
12549
if (
CurrentToken
.Kind == SyntaxKind.OpenBracketToken)
12565
if (this.
CurrentToken
.Kind == SyntaxKind.StaticKeyword)
12570
else if (this.
CurrentToken
.ContextualKind == SyntaxKind.AsyncKeyword &&
12584
if (this.
CurrentToken
.Kind == SyntaxKind.EqualsGreaterThanToken)
12594
if (this.
CurrentToken
.Kind == SyntaxKind.OpenParenToken)
12602
if (this.
CurrentToken
.Kind == SyntaxKind.IdentifierToken &&
12613
if (this.
CurrentToken
.ContextualKind == SyntaxKind.AsyncKeyword &&
12622
if (st == ScanTypeFlags.NotType || this.
CurrentToken
.Kind != SyntaxKind.OpenParenToken)
12639
if (this.
CurrentToken
.Kind == SyntaxKind.IdentifierToken &&
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;
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);
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)
13261
if (this.
CurrentToken
.ContextualKind == SyntaxKind.AsyncKeyword &&
13276
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.AsyncKeyword);
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);
13443
if (IsParameterModifierExcludingScoped(this.
CurrentToken
) || this.
CurrentToken
.ContextualKind == SyntaxKind.ScopedKeyword)
13471
if (IsPredefinedType(this.
CurrentToken
.Kind))
13477
if (this.
CurrentToken
.Kind == SyntaxKind.OpenParenToken)
13487
if (this.IsTrueIdentifier(this.
CurrentToken
))
13513
=> IsTokenQueryContextualKeyword(this.
CurrentToken
);
13555
return this.
CurrentToken
.ContextualKind == SyntaxKind.FromKeyword &&
13608
return this.ScanType() != ScanTypeFlags.NotType && this.
CurrentToken
.Kind is SyntaxKind.IdentifierToken or SyntaxKind.InKeyword;
13633
switch (this.
CurrentToken
.ContextualKind)
13657
SelectOrGroupClauseSyntax selectOrGroupBy = this.
CurrentToken
.ContextualKind switch
13669
this.
CurrentToken
.ContextualKind == SyntaxKind.IntoKeyword
13676
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.FromKeyword);
13685
(this.
CurrentToken
.Kind != SyntaxKind.IdentifierToken || SyntaxFacts.IsQueryContextualKeyword(this.
CurrentToken
.ContextualKind)))
13709
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.JoinKeyword);
13722
into: this.
CurrentToken
.ContextualKind == SyntaxKind.IntoKeyword
13729
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.LetKeyword);
13739
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.WhereKeyword);
13747
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.OrderByKeyword);
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)
13796
if (this.
CurrentToken
.ContextualKind is SyntaxKind.AscendingKeyword or SyntaxKind.DescendingKeyword)
13810
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.SelectKeyword);
13818
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.GroupKeyword);
13828
Debug.Assert(this.
CurrentToken
.ContextualKind == SyntaxKind.IntoKeyword);
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)
423
var leading = this.
CurrentToken
.GetLeadingTrivia();
Parser\LanguageParser_Patterns.cs (29)
61
while (this.
CurrentToken
.ContextualKind == SyntaxKind.OrKeyword)
78
var tk =
CurrentToken
.Kind;
84
if (tk == SyntaxKind.IdentifierToken && this.
CurrentToken
.ContextualKind != SyntaxKind.UnderscoreToken &&
85
(this.
CurrentToken
.ContextualKind != SyntaxKind.NameOfKeyword || this.PeekToken(1).Kind != SyntaxKind.OpenParenToken))
107
while (this.
CurrentToken
.ContextualKind == SyntaxKind.AndKeyword)
121
switch (this.
CurrentToken
.Kind)
143
switch (this.
CurrentToken
.Kind)
160
if (this.
CurrentToken
.ContextualKind == SyntaxKind.NotKeyword)
175
var tk = this.
CurrentToken
.Kind;
187
if (
CurrentToken
.ContextualKind == SyntaxKind.UnderscoreToken)
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)
388
switch (
CurrentToken
.ContextualKind)
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\SyntaxParser.cs (12)
488
var ct = this.
CurrentToken
;
498
=> this.
CurrentToken
.Kind == kind ? this.EatToken() : null;
525
var ct = this.
CurrentToken
;
533
return CreateMissingToken(kind, this.
CurrentToken
.Kind, reportError: true);
541
var ct = this.
CurrentToken
;
548
var replacement = CreateMissingToken(expected, this.
CurrentToken
.Kind, reportError: true);
584
if (this.
CurrentToken
.Kind != kind)
598
if (this.
CurrentToken
.Kind != kind)
610
var token = this.
CurrentToken
;
632
if (this.
CurrentToken
.ContextualKind != kind)
646
var contextualKind = this.
CurrentToken
.ContextualKind;
736
SyntaxToken ct = this.
CurrentToken
;