3 types derived from SyntaxToken
Microsoft.CodeAnalysis.CSharp (3)
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifier.cs (1)
13
internal class SyntaxIdentifier :
SyntaxToken
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteral.cs (1)
14
internal class SyntaxTokenWithValue<T> :
SyntaxToken
Syntax\InternalSyntax\SyntaxToken.SyntaxTokenWithTrivia.cs (1)
11
internal class SyntaxTokenWithTrivia :
SyntaxToken
2 instantiations of SyntaxToken
Microsoft.CodeAnalysis.CSharp (2)
Binder\Semantics\Conversions\ConversionsBase.cs (1)
1755
var greenNode = new Syntax.InternalSyntax.LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression, new Syntax.InternalSyntax.
SyntaxToken
(SyntaxKind.NumericLiteralToken));
Syntax\InternalSyntax\SyntaxToken.cs (1)
156
s_tokensWithNoTrivia[(int)kind].Value = new
SyntaxToken
(kind);
832 references to SyntaxToken
Microsoft.CodeAnalysis.CSharp (828)
Parser\BlendedNode.cs (2)
16
internal readonly
SyntaxToken
Token;
19
internal BlendedNode(CSharp.CSharpSyntaxNode node,
SyntaxToken
token, Blender blender)
Parser\Blender.Cursor.cs (1)
148
var
greenToken = Lexer.RescanInterpolatedString((InterpolatedStringExpressionSyntax)node.Green);
Parser\Blender.Reader.cs (5)
144
var
token = this.LexNewToken(mode);
163
private
SyntaxToken
LexNewToken(LexerMode mode)
175
var
token = _lexer.Lex(ref mode);
211
token: (InternalSyntax.
SyntaxToken
)currentNodeOrToken.AsToken().Node);
314
private BlendedNode CreateBlendedNode(CSharp.CSharpSyntaxNode node,
SyntaxToken
token)
Parser\DirectiveParser.cs (92)
38
var
hash = this.EatToken(SyntaxKind.HashToken, false);
93
var
lineKeyword = this.EatContextualToken(contextualKind);
122
var
id = this.EatToken(SyntaxKind.IdentifierToken, false);
123
var
end = this.ParseEndOfDirective(ignoreErrors: true);
145
private DirectiveTriviaSyntax ParseIfDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
148
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
154
private DirectiveTriviaSyntax ParseElifDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool endIsActive)
157
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
182
private DirectiveTriviaSyntax ParseElseDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool endIsActive)
184
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
204
private DirectiveTriviaSyntax ParseEndIfDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool endIsActive)
206
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
223
private DirectiveTriviaSyntax ParseRegionDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
228
private DirectiveTriviaSyntax ParseEndRegionDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
230
var
eod = this.ParseEndOfDirectiveWithOptionalPreprocessingMessage();
245
private DirectiveTriviaSyntax ParseDefineOrUndefDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool isFollowingToken)
252
var
name = this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_IdentifierExpected);
254
var
end = this.ParseEndOfDirective(ignoreErrors: name.IsMissing);
287
private DirectiveTriviaSyntax ParseErrorOrWarningDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
289
var
eod = this.ParseEndOfDirectiveWithOptionalPreprocessingMessage();
369
private DirectiveTriviaSyntax ParseLineDirective(
SyntaxToken
hash,
SyntaxToken
id, bool isActive)
371
SyntaxToken
line;
372
SyntaxToken
file = null;
405
var
end = this.ParseEndOfDirective(ignoreErrors: line.IsMissing || !isActive, afterLineNumber: sawLineButNotFile);
409
private LineSpanDirectiveTriviaSyntax ParseLineSpanDirective(
SyntaxToken
hash,
SyntaxToken
lineKeyword, bool isActive)
420
var
minus = EatToken(SyntaxKind.MinusToken, reportError: reportError);
430
var
characterOffset = (CurrentToken.Kind == SyntaxKind.NumericLiteralToken) ?
439
var
file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError);
447
var
endOfDirective = this.ParseEndOfDirective(ignoreErrors: !reportError);
450
static bool noTriviaBetween(
SyntaxToken
token1,
SyntaxToken
token2)
460
var
openParen = EatToken(SyntaxKind.OpenParenToken, reportError);
463
var
lineToken = ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxLineValue, out line);
465
var
comma = EatToken(SyntaxKind.CommaToken, reportError);
468
var
characterToken = ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxCharacterValue, out character);
470
var
closeParen = EatToken(SyntaxKind.CloseParenToken, reportError);
476
private
SyntaxToken
ParseLineDirectiveNumericLiteral(ref bool reportError, int minValue, int maxValue, out int value)
478
var
token = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_LineSpanDirectiveInvalidValue, reportError: reportError);
496
private DirectiveTriviaSyntax ParseReferenceDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool isFollowingToken)
510
SyntaxToken
file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive);
512
var
end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive);
516
private DirectiveTriviaSyntax ParseLoadDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool isFollowingToken)
530
SyntaxToken
file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive);
532
var
end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive);
536
private DirectiveTriviaSyntax ParseNullableDirective(
SyntaxToken
hash,
SyntaxToken
token, bool isActive)
543
SyntaxToken
setting = this.CurrentToken.Kind switch
551
SyntaxToken
target = this.CurrentToken.Kind switch
560
var
end = this.ParseEndOfDirective(ignoreErrors: setting.IsMissing || target?.IsMissing == true || !isActive);
564
private DirectiveTriviaSyntax ParsePragmaDirective(
SyntaxToken
hash,
SyntaxToken
pragma, bool isActive)
574
var
warning = this.EatContextualToken(SyntaxKind.WarningKeyword);
575
SyntaxToken
style;
583
SyntaxToken
id;
627
var
end = this.ParseEndOfDirective(hasError || !isActive, afterPragma: true);
633
var
end = this.ParseEndOfDirective(ignoreErrors: true, afterPragma: true);
639
var
checksum = this.EatToken();
640
var
file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive);
641
var
guid = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !file.IsMissing);
651
var
bytes = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !guid.IsMissing);
672
var
eod = this.ParseEndOfDirective(ignoreErrors: hasError, afterPragma: true);
677
var
warning = this.EatToken(SyntaxKind.WarningKeyword, ErrorCode.WRN_IllegalPragma, reportError: isActive);
678
var
style = this.EatToken(SyntaxKind.DisableKeyword, reportError: false);
679
var
eod = this.ParseEndOfDirective(ignoreErrors: true, afterPragma: true);
684
private DirectiveTriviaSyntax ParseShebangDirective(
SyntaxToken
hash,
SyntaxToken
exclamation, bool isActive)
692
private
SyntaxToken
ParseEndOfDirectiveWithOptionalPreprocessingMessage()
695
private
SyntaxToken
ParseEndOfDirective(bool ignoreErrors, bool afterPragma = false, bool afterLineNumber = false)
697
var skippedTokens = new SyntaxListBuilder<
SyntaxToken
>();
703
skippedTokens = new SyntaxListBuilder<
SyntaxToken
>(10);
728
SyntaxToken
endOfDirective = this.CurrentToken.Kind == SyntaxKind.EndOfDirectiveToken
751
var
op = this.EatToken();
764
var
op = this.EatToken();
777
var
op = this.EatToken();
789
var
op = this.EatToken();
802
var
open = this.EatToken();
804
var
close = this.EatToken(SyntaxKind.CloseParenToken);
807
var
identifier = TruncateIdentifier(this.EatToken());
819
private static
SyntaxToken
TruncateIdentifier(
SyntaxToken
identifier)
Parser\DocumentationCommentParser.cs (83)
86
var
eoc = this.EatToken(SyntaxKind.EndOfDocumentationCommentToken);
110
var
token = this.EatToken();
204
var
lessThan = this.EatToken(SyntaxKind.LessThanToken); // guaranteed
228
SyntaxToken
greaterThan;
231
var
lessThanSlash = this.EatToken(SyntaxKind.LessThanSlashToken, reportError: false);
281
var
slashGreater = this.EatToken(SyntaxKind.SlashGreaterThanToken, false);
379
var badTokens = default(SyntaxListBuilder<
SyntaxToken
>);
396
badTokens = _pool.Allocate<
SyntaxToken
>();
399
var
token = this.EatToken();
447
var
equals = this.EatToken(SyntaxKind.EqualsToken, false);
464
default(SyntaxList<
SyntaxToken
>),
469
SyntaxToken
startQuote;
470
SyntaxToken
endQuote;
489
var textTokens = _pool.Allocate<
SyntaxToken
>();
525
SyntaxToken
openQuote = EatToken(this.CurrentToken.Kind == SyntaxKind.SingleQuoteToken
532
SyntaxToken
current = this.CurrentToken;
553
private void ParseCrefAttribute(out
SyntaxToken
startQuote, out CrefSyntax cref, out
SyntaxToken
endQuote)
571
private void ParseNameAttribute(out
SyntaxToken
startQuote, out IdentifierNameSyntax identifier, out
SyntaxToken
endQuote)
589
private void ParseXmlAttributeText(out
SyntaxToken
startQuote, SyntaxListBuilder<
SyntaxToken
> textTokens, out
SyntaxToken
endQuote)
611
var
token = this.EatToken();
629
private
SyntaxToken
ParseXmlAttributeStartQuote()
640
var
startQuote = this.EatToken(quoteKind, reportError: false);
648
private
SyntaxToken
ParseXmlAttributeEndQuote(SyntaxKind quoteKind)
655
var
endQuote = this.EatToken(quoteKind, reportError: false);
663
private
SyntaxToken
SkipNonAsciiQuotationMark()
665
var
quote = SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken);
676
private static bool IsNonAsciiQuotationMark(
SyntaxToken
token)
683
var
id = this.EatToken(SyntaxKind.IdentifierToken);
687
var
colon = this.EatToken();
722
var
lessThanExclamationMinusMinusToken = this.EatToken(SyntaxKind.XmlCommentStartToken);
724
var textTokens = _pool.Allocate<
SyntaxToken
>();
729
var
token = this.EatToken();
742
var
minusMinusGreaterThanToken = this.EatToken(SyntaxKind.XmlCommentEndToken);
749
var
startCDataToken = this.EatToken(SyntaxKind.XmlCDataStartToken);
751
var textTokens = new SyntaxListBuilder<
SyntaxToken
>(10);
758
var
endCDataToken = this.EatToken(SyntaxKind.XmlCDataEndToken);
765
var
startProcessingInstructionToken = this.EatToken(SyntaxKind.XmlProcessingInstructionStartToken);
773
var textTokens = new SyntaxListBuilder<
SyntaxToken
>(10);
777
var
textToken = this.EatToken();
785
var
endProcessingInstructionToken = this.EatToken(SyntaxKind.XmlProcessingInstructionEndToken);
841
private
SyntaxToken
WithXmlParseError(
SyntaxToken
node, XmlParseErrorCode code, params string[] args)
908
SyntaxToken
dot = EatToken(SyntaxKind.DotToken);
917
var badTokens = _pool.Allocate<
SyntaxToken
>();
972
SyntaxToken
thisKeyword = EatToken();
984
SyntaxToken
operatorKeyword = EatToken();
985
SyntaxToken
checkedKeyword = TryEatCheckedKeyword(isConversion: false, ref operatorKeyword);
987
SyntaxToken
operatorToken;
1019
var
operatorToken2 = this.EatToken();
1024
var
operatorToken3 = this.EatToken();
1039
var
nonOverloadableOperator = SyntaxFactory.Token(
1071
var
operatorToken2 = this.EatToken();
1081
var
operatorToken2 = this.EatToken();
1082
var
nonOverloadableOperator = SyntaxFactory.Token(
1110
private
SyntaxToken
TryEatCheckedKeyword(bool isConversion, ref
SyntaxToken
operatorKeyword)
1112
SyntaxToken
checkedKeyword = tryEatCheckedOrHandleUnchecked(ref operatorKeyword);
1122
SyntaxToken
tryEatCheckedOrHandleUnchecked(ref
SyntaxToken
operatorKeyword)
1127
var
misplacedToken = AddErrorAsWarning(EatToken(), ErrorCode.ERR_MisplacedUnchecked);
1143
SyntaxToken
implicitOrExplicit = EatToken();
1145
SyntaxToken
operatorKeyword = EatToken(SyntaxKind.OperatorKeyword);
1146
SyntaxToken
checkedKeyword = TryEatCheckedKeyword(isConversion: true, ref operatorKeyword);
1184
SyntaxToken
open = EatToken(openKind);
1195
SyntaxToken
comma = EatToken(SyntaxKind.CommaToken);
1212
SyntaxToken
close = EatToken(closeKind);
1250
SyntaxToken
refKindOpt = null;
1260
SyntaxToken
readOnlyOpt = null;
1266
var
misplacedToken = AddErrorAsWarning(EatToken(), ErrorCode.ERR_RefReadOnlyWrongOrdering);
1286
SyntaxToken
identifierToken = EatToken(SyntaxKind.IdentifierToken);
1293
var
open = EatToken();
1324
SyntaxToken
close = EatToken(SyntaxKind.GreaterThanToken);
1384
SyntaxToken
alias = EatToken();
1392
SyntaxToken
colonColon = EatToken();
1418
SyntaxToken
dot = EatToken();
1462
SyntaxToken
open = EatToken();
1491
var
close = this.EatToken(SyntaxKind.CloseBracketToken);
1563
SyntaxToken
identifierToken = this.EatToken(SyntaxKind.IdentifierToken, reportError: false);
1567
var badTokens = _pool.Allocate<
SyntaxToken
>();
Parser\DocumentationCommentXmlTokens.cs (24)
16
private static readonly
SyntaxToken
s_seeToken = Identifier(DocumentationCommentXmlNames.SeeElementName);
17
private static readonly
SyntaxToken
s_codeToken = Identifier(DocumentationCommentXmlNames.CodeElementName);
18
private static readonly
SyntaxToken
s_listToken = Identifier(DocumentationCommentXmlNames.ListElementName);
19
private static readonly
SyntaxToken
s_paramToken = Identifier(DocumentationCommentXmlNames.ParameterElementName);
20
private static readonly
SyntaxToken
s_valueToken = Identifier(DocumentationCommentXmlNames.ValueElementName);
21
private static readonly
SyntaxToken
s_exampleToken = Identifier(DocumentationCommentXmlNames.ExampleElementName);
22
private static readonly
SyntaxToken
s_includeToken = Identifier(DocumentationCommentXmlNames.IncludeElementName);
23
private static readonly
SyntaxToken
s_remarksToken = Identifier(DocumentationCommentXmlNames.RemarksElementName);
24
private static readonly
SyntaxToken
s_seealsoToken = Identifier(DocumentationCommentXmlNames.SeeAlsoElementName);
25
private static readonly
SyntaxToken
s_summaryToken = Identifier(DocumentationCommentXmlNames.SummaryElementName);
26
private static readonly
SyntaxToken
s_exceptionToken = Identifier(DocumentationCommentXmlNames.ExceptionElementName);
27
private static readonly
SyntaxToken
s_typeparamToken = Identifier(DocumentationCommentXmlNames.TypeParameterElementName);
28
private static readonly
SyntaxToken
s_permissionToken = Identifier(DocumentationCommentXmlNames.PermissionElementName);
29
private static readonly
SyntaxToken
s_typeparamrefToken = Identifier(DocumentationCommentXmlNames.TypeParameterReferenceElementName);
32
private static readonly
SyntaxToken
s_crefToken = IdentifierWithLeadingSpace(DocumentationCommentXmlNames.CrefAttributeName);
33
private static readonly
SyntaxToken
s_fileToken = IdentifierWithLeadingSpace(DocumentationCommentXmlNames.FileAttributeName);
34
private static readonly
SyntaxToken
s_nameToken = IdentifierWithLeadingSpace(DocumentationCommentXmlNames.NameAttributeName);
35
private static readonly
SyntaxToken
s_pathToken = IdentifierWithLeadingSpace(DocumentationCommentXmlNames.PathAttributeName);
36
private static readonly
SyntaxToken
s_typeToken = IdentifierWithLeadingSpace(DocumentationCommentXmlNames.TypeAttributeName);
38
private static
SyntaxToken
Identifier(string text)
43
private static
SyntaxToken
IdentifierWithLeadingSpace(string text)
60
public static
SyntaxToken
? LookupToken(string text, SyntaxListBuilder? leading)
75
private static
SyntaxToken
? LookupXmlElementTag(string text)
157
private static
SyntaxToken
? LookupXmlAttribute(string text)
Parser\LanguageParser.cs (346)
182
SyntaxToken
? tmp = null;
189
var
eof = this.EatToken(SyntaxKind.EndOfFileToken);
230
var fileAsTrivia = _syntaxFactory.SkippedTokensTrivia(builder.ToList<
SyntaxToken
>());
252
var
namespaceToken = this.EatToken(SyntaxKind.NamespaceKeyword);
261
SyntaxToken
? openBrace = null;
262
SyntaxToken
? semicolon = null;
362
ref
SyntaxToken
? openBraceOrSemicolon,
411
[NotNullIfNotNull(nameof(openBraceOrSemicolon))] ref
SyntaxToken
? openBraceOrSemicolon,
563
[NotNullIfNotNull(nameof(openBraceOrSemicolon))] ref
SyntaxToken
? openBraceOrSemicolon,
615
var
token = this.EatToken();
730
var
skippedToken = EatToken();
816
ref
SyntaxToken
? openBrace,
850
ref
SyntaxToken
? openBraceOrSemicolon,
956
var
globalToken = this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword
962
var
usingToken = this.EatToken(SyntaxKind.UsingKeyword);
963
var
staticToken = this.TryEatToken(SyntaxKind.StaticKeyword);
964
var
unsafeToken = this.TryEatToken(SyntaxKind.UnsafeKeyword);
977
SyntaxToken
semicolon;
1026
private static bool IsGlobalAttributeTarget(
SyntaxToken
token)
1122
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
1139
var
closeBracket = this.EatToken(SyntaxKind.CloseBracketToken);
1174
LanguageParser @this, ref
SyntaxToken
openBracket, SeparatedSyntaxListBuilder<AttributeSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
1210
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
1229
LanguageParser @this, ref
SyntaxToken
openParen, SeparatedSyntaxListBuilder<AttributeArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
1290
private static DeclarationModifiers GetModifierExcludingScoped(
SyntaxToken
token)
1365
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);
1377
SyntaxToken
modTok;
1381
var
nextToken = PeekToken(1);
1412
var
next = PeekToken(1);
1473
bool isStructOrRecordKeyword(
SyntaxToken
token)
1606
private static bool IsNonContextualModifier(
SyntaxToken
nextToken)
1614
var
nextToken = this.PeekToken(1);
1726
if (!tryScanRecordStart(out
var
keyword, out
var
recordModifier))
1737
var
name = this.ParseIdentifierToken();
1760
SyntaxToken
semicolon;
1761
SyntaxToken
? openBrace;
1762
SyntaxToken
? closeBrace;
1850
bool tryScanRecordStart([NotNullWhen(true)] out
SyntaxToken
? keyword, out
SyntaxToken
? recordModifier)
1867
var
misplacedToken = this.EatToken();
1884
static TypeDeclarationSyntax constructTypeDeclaration(ContextAwareSyntax syntaxFactory, SyntaxList<AttributeListSyntax> attributes, SyntaxListBuilder modifiers,
SyntaxToken
keyword,
SyntaxToken
? recordModifier,
1885
SyntaxToken
name, TypeParameterListSyntax typeParameters, ParameterListSyntax? paramList, BaseListSyntax baseList, SyntaxListBuilder<TypeParameterConstraintClauseSyntax> constraints,
1886
SyntaxToken
? openBrace, SyntaxListBuilder<MemberDeclarationSyntax> members,
SyntaxToken
? closeBrace,
SyntaxToken
semicolon)
1888
var modifiersList = (SyntaxList<
SyntaxToken
>)modifiers.ToList();
1967
private void SkipBadMemberListTokens(ref
SyntaxToken
openBrace, SyntaxListBuilder members)
1979
openBrace = (
SyntaxToken
)tmp;
1991
var
token = this.EatToken();
2056
var
colon = this.TryEatToken(SyntaxKind.ColonToken);
2096
PostSkipAction skipBadBaseListTokens(ref
SyntaxToken
colon, SeparatedSyntaxListBuilder<BaseTypeSyntax> list, SyntaxKind expected)
2123
var
where = this.EatContextualToken(SyntaxKind.WhereKeyword);
2128
var
colon = this.EatToken(SyntaxKind.ColonToken);
2156
SyntaxToken
separatorToken = this.EatToken(SyntaxKind.CommaToken);
2266
var
allows = this.EatContextualToken(SyntaxKind.AllowsKeyword);
2435
new SyntaxList<
SyntaxToken
>(),
2572
var
identifier = this.EatToken();
2719
SyntaxToken
identifierOrThisOpt;
2904
var
misplacedModifier = this.CurrentToken;
2921
ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt,
SyntaxToken
identifierOrThisOpt, TypeParameterListSyntax typeParameterListOpt,
2962
ref ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt, ref
SyntaxToken
identifierOrThisOpt,
2985
ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt,
SyntaxToken
identifierOrThisOpt,
3132
SyntaxToken
identifierOrThisOpt;
3184
SyntaxToken
identifierOrThisOpt)
3263
if (child is not
SyntaxToken
token)
3287
var
name = this.ParseIdentifierToken();
3297
this.ParseBlockAndExpressionBodiesWithSemicolon(out var body, out var expressionBody, out
var
semicolon);
3309
var
colon = this.EatToken(SyntaxKind.ColonToken);
3316
SyntaxToken
token;
3342
var
tilde = this.EatToken(SyntaxKind.TildeToken);
3344
var
name = this.ParseIdentifierToken();
3351
out BlockSyntax body, out ArrowExpressionClauseSyntax expressionBody, out
SyntaxToken
semicolon);
3363
out
SyntaxToken
semicolon,
3451
SyntaxToken
identifier,
3469
var
colonToken = this.CurrentToken;
3490
this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out
var
semicolon);
3616
var
style = this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword
3623
SyntaxToken
opKeyword;
3653
var
checkedKeyword = TryEatCheckedOrHandleUnchecked(ref opKeyword);
3672
this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out
var
semicolon);
3700
SyntaxToken
separator = null;
3758
private
SyntaxToken
TryEatCheckedOrHandleUnchecked(ref
SyntaxToken
operatorKeyword)
3779
var
firstToken = this.CurrentToken;
3806
var
opKeyword = this.EatToken(SyntaxKind.OperatorKeyword);
3807
var
checkedKeyword = TryEatCheckedOrHandleUnchecked(ref opKeyword);
3808
SyntaxToken
opToken;
3855
var
tk = this.CurrentToken;
3859
var
opToken2 = this.EatToken();
3916
this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out
var
semicolon);
3946
SyntaxToken
thisKeyword,
3962
SyntaxToken
semicolon = null;
4006
SyntaxToken
identifier,
4043
var
equals = this.EatToken(SyntaxKind.EqualsToken);
4048
SyntaxToken
semicolon = null;
4097
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
4142
var
refKeyword = this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression)
4150
private PostSkipAction SkipBadAccessorListTokens(ref
SyntaxToken
openBrace, SyntaxListBuilder<AccessorDeclarationSyntax> list, ErrorCode error)
4197
var
token = this.PeekToken(peekIndex);
4334
var
token = (first && !this.CurrentToken.ContainsDiagnostics) ? this.EatTokenWithPrejudice(expected) : this.EatToken();
4360
var
token = (first && !this.CurrentToken.ContainsDiagnostics) ? this.EatTokenWithPrejudice(errorCode) : this.EatToken();
4383
var
accessorName = this.EatToken(SyntaxKind.IdentifierToken,
4414
SyntaxToken
semicolon = null;
4468
private
SyntaxToken
EatAccessorSemicolon()
4474
private static SyntaxKind GetAccessorKind(
SyntaxToken
accessorName)
4494
var parameters = this.ParseParameterList(out
var
open, out
var
close, SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken);
4505
var parameters = this.ParseParameterList(out
var
open, out
var
close, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
4566
out
SyntaxToken
open,
4567
out
SyntaxToken
close,
4592
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
4681
SyntaxToken
identifier;
4700
var
equalsToken = TryEatToken(SyntaxKind.EqualsToken);
4710
internal static bool NoTriviaBetween(
SyntaxToken
token1,
SyntaxToken
token2)
4715
private static bool IsParameterModifierExcludingScoped(
SyntaxToken
token)
4747
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter);
4787
var
eventToken = this.EatToken();
4798
SyntaxToken
eventToken,
4802
SyntaxToken
identifierOrThisOpt;
4828
SyntaxToken
identifier;
4859
SyntaxToken
semicolon = null;
4890
var
semi = this.EatToken();
4907
if (modifiers is [..,
SyntaxToken
{ Kind: SyntaxKind.ScopedKeyword } scopedKeyword])
4923
SyntaxToken
eventToken,
5000
SyntaxList<
SyntaxToken
> mods,
5163
SyntaxList<
SyntaxToken
> mods,
5234
var
missingIdentifier = CreateMissingIdentifierToken();
5252
var
name = this.ParseIdentifierToken();
5279
var
equals = this.EatToken();
5282
var
refKeyword = isLocalOrField && !isConst && this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression)
5350
args.AddSeparator((
SyntaxToken
)item);
5454
var
delegateToken = this.EatToken(SyntaxKind.DelegateKeyword);
5458
var
name = this.ParseIdentifierToken();
5487
var
enumToken = this.EatToken(SyntaxKind.EnumKeyword);
5488
var
name = this.ParseIdentifierToken();
5502
var
colon = this.EatToken(SyntaxKind.ColonToken);
5512
SyntaxToken
semicolon;
5513
SyntaxToken
openBrace;
5514
SyntaxToken
closeBrace;
5558
LanguageParser @this, ref
SyntaxToken
openBrace, SeparatedSyntaxListBuilder<EnumMemberDeclarationSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
5575
var
memberName = this.ParseIdentifierToken();
5611
private static
SyntaxToken
CreateMissingIdentifierToken()
5653
private bool IsTrueIdentifier(
SyntaxToken
token)
5674
private
SyntaxToken
ParseIdentifierToken(ErrorCode code = ErrorCode.ERR_IdentifierExpected)
5687
var
result = CreateMissingIdentifierToken();
5692
SyntaxToken
identifierToken = this.EatToken();
5742
var
open = this.EatToken(SyntaxKind.LessThanToken);
5761
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<TypeParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
5837
this.ParseTypeArgumentList(out
var
open, types, out
var
close);
5891
out
var
greaterThanToken, out bool isDefinitelyTypeArgumentList);
5987
out
SyntaxToken
greaterThanToken,
6000
var
start = this.EatToken();
6166
private void ParseTypeArgumentList(out
SyntaxToken
open, SeparatedSyntaxListBuilder<TypeSyntax> types, out
SyntaxToken
close)
6239
static bool tokenBreaksTypeArgumentList(
SyntaxToken
token)
6384
out
SyntaxToken
identifierOrThisOpt,
6400
SyntaxToken
separator = null;
6520
private void AccumulateExplicitInterfaceName(ref NameSyntax explicitInterfaceName, ref
SyntaxToken
separator)
6582
SyntaxToken
separator = null;
6669
var
separator = this.EatToken();
6679
SyntaxToken
separator)
6721
private
SyntaxToken
ConvertToMissingWithTrailingTrivia(
SyntaxToken
token, SyntaxKind expectedKind)
6723
var
newToken = SyntaxFactory.MissingToken(expectedKind);
6791
private ScanTypeFlags ScanType(out
SyntaxToken
lastTokenOfType, bool forPattern = false)
6801
private ScanTypeFlags ScanNamedTypePart(out
SyntaxToken
lastTokenOfType)
6820
private ScanTypeFlags ScanType(ParseTypeMode mode, out
SyntaxToken
lastTokenOfType)
6994
private ScanTypeFlags ScanTupleType(out
SyntaxToken
lastTokenOfType)
7038
private ScanTypeFlags ScanFunctionPointerType(out
SyntaxToken
lastTokenOfType)
7048
var
peek1 = PeekToken(1);
7108
var ignoredModifiers = _pool.Allocate<
SyntaxToken
>();
7246
var
question = TryEatNullableQualifierIfApplicable(type, mode);
7308
private
SyntaxToken
TryEatNullableQualifierIfApplicable(
7322
var
questionToken = this.EatToken();
7400
var
nextToken = PeekToken(1);
7490
var
open = this.EatToken(SyntaxKind.OpenBracketToken);
7552
var
open = this.EatToken(SyntaxKind.OpenParenToken);
7591
private PostSkipAction SkipBadArrayRankSpecifierTokens(ref
SyntaxToken
openBracket, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expected)
7604
var
token = this.EatToken();
7637
var
@delegate = EatToken(SyntaxKind.DelegateKeyword);
7638
var
asterisk = EatToken(SyntaxKind.AsteriskToken);
7644
var
lessThanTokenError = WithAdditionalDiagnostics(SyntaxFactory.MissingToken(SyntaxKind.LessThanToken), GetExpectedTokenError(SyntaxKind.LessThanToken, SyntaxKind.None));
7662
var
lessThanToken = EatTokenAsKind(SyntaxKind.LessThanToken);
7671
var modifiers = _pool.Allocate<
SyntaxToken
>();
7721
SyntaxToken
managedSpecifier;
7722
SyntaxToken
peek1 = PeekToken(1);
7749
var
openBracket = EatToken(SyntaxKind.OpenBracketToken);
7769
var
closeBracket = EatToken(SyntaxKind.CloseBracketToken);
7797
private static bool IsPossibleFunctionPointerParameterListStart(
SyntaxToken
token)
8199
var
token1 = PeekToken(1);
8319
SyntaxToken
identifierOrThisOpt;
8482
SyntaxToken
nextToken = PeekToken(1);
8563
private bool? IsPossibleTypedIdentifierStart(
SyntaxToken
current,
SyntaxToken
next, bool allowThisKeyword)
8637
(
SyntaxToken
)openBrace,
8668
(
SyntaxToken
)openBrace,
8802
var
@fixed = this.EatToken(SyntaxKind.FixedKeyword);
8803
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
8887
var
@try = this.EatToken(SyntaxKind.TryKeyword);
8962
var
@catch = this.EatToken();
8969
var
openParen = this.EatToken();
8973
SyntaxToken
name = null;
8981
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
8990
var
whenKeyword = this.EatContextualToken(SyntaxKind.WhenKeyword);
9002
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9006
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9050
var
keyword = this.EatToken();
9061
var
@do = this.EatToken(SyntaxKind.DoKeyword);
9063
var
@while = this.EatToken(SyntaxKind.WhileKeyword);
9064
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9124
var
forToken = this.EatToken(SyntaxKind.ForKeyword);
9125
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9172
SyntaxToken
scopedKeyword = null;
9199
var
semi = this.EatToken(SyntaxKind.SemicolonToken);
9206
var
semi2 = this.EatToken(SyntaxKind.SemicolonToken);
9237
private SeparatedSyntaxList<ExpressionSyntax> ParseForStatementExpressionList(ref
SyntaxToken
startToken)
9250
LanguageParser @this, ref
SyntaxToken
startToken, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
9263
SyntaxList<AttributeListSyntax> attributes,
SyntaxToken
awaitTokenOpt)
9273
SyntaxToken
@foreach;
9279
var
skippedForToken = this.EatToken();
9288
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9291
var
@in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected);
9298
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9306
SyntaxToken
identifier;
9316
identifier =
SyntaxToken
.WithValue(SyntaxKind.IdentifierToken, discard.LeadingTrivia.Node, discard.Text, discard.ValueText, discard.TrailingTrivia.Node);
9414
SyntaxToken
lastTokenOfType;
9485
var
@goto = this.EatToken(SyntaxKind.GotoKeyword);
9487
SyntaxToken
caseOrDefault = null;
9518
var stack = ArrayBuilder<(
SyntaxToken
,
SyntaxToken
, ExpressionSyntax,
SyntaxToken
, StatementSyntax,
SyntaxToken
)>.GetInstance();
9523
var
ifKeyword = this.EatToken(SyntaxKind.IfKeyword);
9524
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9526
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9529
var
elseKeyword = this.CurrentToken.Kind != SyntaxKind.ElseKeyword ?
9628
var
yieldToken = ConvertToKeyword(this.EatToken());
9629
SyntaxToken
returnOrBreak;
9665
parseSwitchHeader(out
var
switchKeyword, out
var
openParen, out var expression, out
var
closeParen, out
var
openBrace);
9682
out
SyntaxToken
switchKeyword,
9683
out
SyntaxToken
openParen,
9685
out
SyntaxToken
closeParen,
9686
out
SyntaxToken
openBrace)
9750
var
caseKeyword = this.EatToken();
9828
private UsingStatementSyntax ParseUsingStatement(SyntaxList<AttributeListSyntax> attributes,
SyntaxToken
awaitTokenOpt = null)
9830
var
@using = this.EatToken(SyntaxKind.UsingKeyword);
9831
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9869
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);
9986
SyntaxToken
awaitKeyword, usingKeyword;
10011
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);
10041
if (attributes.Count == 0 && mods.Count > 0 && IsAccessibilityModifier(((
SyntaxToken
)mods[0]).ContextualKind))
10059
var
mod = (
SyntaxToken
)mods[i];
10082
private
SyntaxToken
ParsePossibleScopedKeyword(bool isFunctionPointerParameter)
10088
SyntaxToken
scopedKeyword = this.EatContextualToken(SyntaxKind.ScopedKeyword);
10121
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
10215
SyntaxList<
SyntaxToken
> mods,
10264
SyntaxToken
mod;
10383
SyntaxList<
SyntaxToken
> modifiers,
10385
SyntaxToken
identifier)
10410
var
modifier = modifiers[i];
10473
SyntaxToken
semicolon;
10506
SyntaxToken
semicolon;
10849
var
next = PeekToken(1);
11041
var
operatorToken = eatOperatorToken(operatorTokenKind);
11120
var
token1 = this.CurrentToken;
11174
SyntaxToken
eatOperatorToken(SyntaxKind operatorTokenKind)
11186
var
token1 = EatToken();
11187
var
token2 = EatToken();
11199
var
token1 = EatToken();
11201
var
token3 = EatToken();
11224
var
questionToken = this.EatToken();
11313
public static bool IsAtDotDotToken(
SyntaxToken
token1,
SyntaxToken
token2)
11321
public
SyntaxToken
EatDotDotToken()
11324
var
token1 = this.EatToken();
11325
var
token2 = this.EatToken();
11327
var
dotDotToken = SyntaxFactory.Token(token1.GetLeadingTrivia(), SyntaxKind.DotDotToken, token2.GetTrailingTrivia());
11359
var
scopedKeyword = isScoped
11376
private ExpressionSyntax ParseIsExpression(ExpressionSyntax leftOperand,
SyntaxToken
opToken)
11517
var
refKeyword = this.EatToken();
11730
var
nextToken = this.PeekToken(1);
11831
openToken: out
SyntaxToken
openToken,
11833
closeToken: out
SyntaxToken
closeToken,
11847
openToken: out
SyntaxToken
openToken,
11849
closeToken: out
SyntaxToken
closeToken,
11856
out
SyntaxToken
openToken,
11858
out
SyntaxToken
closeToken,
11926
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
11969
SyntaxToken
refKindKeyword = null;
12015
var
keyword = this.EatToken();
12059
var
checkedOrUnchecked = this.EatToken();
12102
var
tk = this.PeekToken(curTk++);
12151
var
token1 = this.PeekToken(1);
12159
var
token2 = this.PeekToken(2);
12218
var
identifier = this.IsTrueIdentifier() ? this.EatToken() : CreateMissingIdentifierToken();
12220
var
equalsToken = TryEatToken(SyntaxKind.EqualsToken);
12278
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
12306
private TupleExpressionSyntax ParseTupleExpressionTail(
SyntaxToken
openParen, ArgumentSyntax firstArg)
12471
var
token1 = this.PeekToken(1);
12674
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
12691
LanguageParser @this, ref
SyntaxToken
openBracket, SeparatedSyntaxListBuilder<CollectionElementSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
12720
var
@new = this.EatToken(SyntaxKind.NewKeyword);
12724
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
12774
SyntaxToken
@new = this.EatToken(SyntaxKind.NewKeyword);
12847
private WithExpressionSyntax ParseWithExpression(ExpressionSyntax receiverExpression,
SyntaxToken
withKeyword)
12849
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
12874
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
12948
LanguageParser @this, ref
SyntaxToken
startToken, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind)
12981
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
13008
var
@new = this.EatToken(SyntaxKind.NewKeyword);
13009
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
13048
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
13066
LanguageParser @this, ref
SyntaxToken
openBrace, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
13084
var
@stackalloc = this.EatToken(SyntaxKind.StackAllocKeyword);
13085
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
13143
var
@delegate = this.EatToken(SyntaxKind.DelegateKeyword);
13162
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
13184
private SyntaxList<
SyntaxToken
> ParseAnonymousFunctionModifiers()
13283
var
arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken);
13293
var
identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken)
13298
var
arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken);
13316
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
13338
LanguageParser @this, ref
SyntaxToken
openParen, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
13388
var
identifier = this.ParseIdentifierToken();
13391
var
equalsToken = TryEatToken(SyntaxKind.EqualsToken);
13433
var
peek1 = this.PeekToken(1);
13450
private static bool IsTokenQueryContextualKeyword(
SyntaxToken
token)
13470
private static bool IsTokenStartOfNewQueryClause(
SyntaxToken
token)
13612
var
@from = this.EatContextualToken(SyntaxKind.FromKeyword);
13618
SyntaxToken
name;
13683
var
@orderby = this.EatContextualToken(SyntaxKind.OrderByKeyword);
13728
SyntaxToken
direction = null;
13824
LanguageParser parser, ref
SyntaxToken
openToken, SeparatedSyntaxListBuilder<TNode> builder, SyntaxKind expectedKind, SyntaxKind closeTokenKind) where TNode : GreenNode;
13856
ref
SyntaxToken
openToken,
13878
ref
SyntaxToken
openToken,
14054
SyntaxListBuilder<
SyntaxToken
> b = _pool.Allocate<
SyntaxToken
>();
Parser\LanguageParser_InterpolatedString.cs (10)
41
var
originalToken = this.EatToken();
78
SyntaxToken
getOpenQuote()
238
SyntaxToken
getCloseQuote()
319
private static
SyntaxToken
TokenOrMissingToken(GreenNode? leading, SyntaxKind kind, string text, GreenNode? trailing)
395
SyntaxToken
openBraceToken)
421
(InterpolationFormatClauseSyntax? format,
SyntaxToken
closeBraceToken) getFormatAndCloseBrace()
437
SyntaxToken
getInterpolationCloseToken(GreenNode? leading)
452
private
SyntaxToken
MakeInterpolatedStringTextToken(Lexer.InterpolatedStringKind kind, string text)
467
var
token = tempLexer.Lex(ref mode);
469
var
result = SyntaxFactory.Literal(leading: null, text, SyntaxKind.InterpolatedStringTextToken, token.ValueText, trailing: null);
Parser\LanguageParser_Patterns.cs (9)
279
var
varToken = ConvertToKeyword(typeIdentifierToken);
289
var
openParenToken = this.EatToken(SyntaxKind.OpenParenToken);
299
var
closeParenToken = this.EatToken(SyntaxKind.CloseParenToken);
486
var
openBraceToken = this.EatToken(SyntaxKind.OpenBraceToken);
511
var
colon = EatToken();
540
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind)
568
private SwitchExpressionSyntax ParseSwitchExpression(ExpressionSyntax governingExpression,
SyntaxToken
switchKeyword)
624
var
commaToken = this.CurrentToken.Kind == SyntaxKind.SemicolonToken
637
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
Parser\Lexer.cs (19)
229
public
SyntaxToken
Lex(ref LexerMode mode)
231
var
result = Lex(mode);
240
public
SyntaxToken
Lex(LexerMode mode)
303
private
SyntaxToken
LexSyntaxToken()
338
private
SyntaxToken
Create(in TokenInfo info, SyntaxListBuilder? leading, SyntaxListBuilder? trailing, SyntaxDiagnosticInfo[]? errors)
345
SyntaxToken
token;
2457
private
SyntaxToken
LexDirectiveToken()
2470
var
token = Create(in info, null, directiveTriviaCache, errors);
2476
public
SyntaxToken
LexEndOfDirectiveWithOptionalPreprocessingMessage()
2513
var
endOfDirective = SyntaxFactory.Token(leading, SyntaxKind.EndOfDirectiveToken, trailing);
2793
private
SyntaxToken
LexXmlToken()
3149
private
SyntaxToken
LexXmlElementTagToken()
3164
SyntaxToken
? token = DocumentationCommentXmlTokens.LookupToken(tagInfo.Text, leading);
3335
private
SyntaxToken
LexXmlAttributeTextToken()
3488
private
SyntaxToken
LexXmlCharacter()
3544
private
SyntaxToken
LexXmlCrefOrNameToken()
3957
private
SyntaxToken
LexXmlCDataSectionTextToken()
4079
private
SyntaxToken
LexXmlCommentTextToken()
4209
private
SyntaxToken
LexXmlProcessingInstructionTextToken()
Parser\Lexer_StringLiteral.cs (1)
300
internal static
SyntaxToken
RescanInterpolatedString(InterpolatedStringExpressionSyntax interpolatedString)
Parser\LexerCache.cs (4)
34
private readonly TextKeyedCache<
SyntaxToken
> _tokenMap;
41
_tokenMap = TextKeyedCache<
SyntaxToken
>.GetInstance();
104
internal
SyntaxToken
LookupToken<TArg>(
109
Func<TArg,
SyntaxToken
> createTokenFunction,
Parser\QuickScanner.cs (4)
192
private
SyntaxToken
? QuickScanSyntaxToken()
237
var
token = _cache.LookupToken(
253
private static
SyntaxToken
CreateQuickToken(Lexer lexer)
259
var
token = lexer.LexSyntaxToken();
Parser\SyntaxParser.cs (55)
29
private
SyntaxToken
_currentToken;
30
private ArrayElement<
SyntaxToken
>[] _lexedTokens;
39
private static readonly ObjectPool<ArrayElement<
SyntaxToken
>[]> s_lexedTokensPool = new ObjectPool<ArrayElement<
SyntaxToken
>[]>(() => new ArrayElement<
SyntaxToken
>[CachedTokenArraySize], 2);
149
var
token = lexer.Lex(mode);
316
protected
SyntaxToken
CurrentToken
324
private
SyntaxToken
FetchCurrentToken()
380
private void AddLexedToken(
SyntaxToken
token)
454
private void ReturnLexedTokensToPool(ArrayElement<
SyntaxToken
>[] lexedTokens)
466
protected
SyntaxToken
PeekToken(int n)
486
protected
SyntaxToken
EatToken()
488
var
ct = this.CurrentToken;
497
protected
SyntaxToken
TryEatToken(SyntaxKind kind)
521
protected
SyntaxToken
EatToken(SyntaxKind kind)
525
var
ct = this.CurrentToken;
537
protected
SyntaxToken
EatTokenAsKind(SyntaxKind expected)
541
var
ct = this.CurrentToken;
548
var
replacement = CreateMissingToken(expected, this.CurrentToken.Kind, reportError: true);
552
private
SyntaxToken
CreateMissingToken(SyntaxKind expected, SyntaxKind actual, bool reportError)
555
var
token = SyntaxFactory.MissingToken(expected);
564
private
SyntaxToken
CreateMissingToken(SyntaxKind expected, ErrorCode code, bool reportError)
567
var
token = SyntaxFactory.MissingToken(expected);
576
protected
SyntaxToken
EatToken(SyntaxKind kind, bool reportError)
595
protected
SyntaxToken
EatToken(SyntaxKind kind, ErrorCode code, bool reportError = true)
608
protected
SyntaxToken
EatTokenWithPrejudice(SyntaxKind kind)
610
var
token = this.CurrentToken;
621
protected
SyntaxToken
EatTokenWithPrejudice(ErrorCode errorCode, params object[] args)
623
var
token = this.EatToken();
628
protected
SyntaxToken
EatContextualToken(SyntaxKind kind, ErrorCode code, bool reportError = true)
642
protected
SyntaxToken
EatContextualToken(SyntaxKind kind, bool reportError = true)
736
SyntaxToken
ct = this.CurrentToken;
778
SyntaxToken
token = node as
SyntaxToken
;
834
var
firstToken = node.GetFirstToken();
840
var
firstToken = node.GetFirstToken();
862
var
lastToken = node.GetLastNonmissingToken();
895
var
oldToken = node as
SyntaxToken
?? node.GetFirstToken();
896
var
newToken = AddSkippedSyntax(oldToken, skippedSyntax, trailing: false);
912
var
token = node as
SyntaxToken
;
919
var
lastToken = node.GetLastToken();
920
var
newToken = AddSkippedSyntax(lastToken, skippedSyntax, trailing: true);
929
internal
SyntaxToken
AddSkippedSyntax(
SyntaxToken
target, GreenNode skippedSyntax, bool trailing)
942
SyntaxToken
token = node as
SyntaxToken
;
950
SyntaxToken
tk = token.TokenWithLeadingTrivia(null).TokenWithTrailingTrivia(null);
1089
protected static
SyntaxToken
ConvertToKeyword(
SyntaxToken
token)
1108
protected static
SyntaxToken
ConvertToIdentifier(
SyntaxToken
token)
1112
var
identifier =
SyntaxToken
.Identifier(token.Kind, token.LeadingTrivia.Node, token.Text, token.ValueText, token.TrailingTrivia.Node);
Symbols\Source\AttributeLocation.cs (1)
123
internal static AttributeLocation ToAttributeLocation(this Syntax.InternalSyntax.
SyntaxToken
token)
Syntax\InternalSyntax\CSharpSyntaxNode.cs (8)
98
public
SyntaxToken
GetFirstToken()
100
return (
SyntaxToken
)this.GetFirstTerminal();
103
public
SyntaxToken
GetLastToken()
105
return (
SyntaxToken
)this.GetLastTerminal();
108
public
SyntaxToken
GetLastNonmissingToken()
110
return (
SyntaxToken
)this.GetLastNonmissingTerminal();
199
var
t = node as
SyntaxToken
;
Syntax\InternalSyntax\CSharpSyntaxRewriter.cs (1)
21
public override CSharpSyntaxNode VisitToken(
SyntaxToken
token)
Syntax\InternalSyntax\CSharpSyntaxVisitor.cs (2)
25
public virtual TResult VisitToken(
SyntaxToken
token)
53
public virtual void VisitToken(
SyntaxToken
token)
Syntax\InternalSyntax\SyntaxFactory.cs (55)
32
private static
SyntaxToken
s_xmlCarriageReturnLineFeed;
33
private static
SyntaxToken
XmlCarriageReturnLineFeed
116
public static
SyntaxToken
Token(SyntaxKind kind)
118
return
SyntaxToken
.Create(kind);
121
internal static
SyntaxToken
Token(GreenNode leading, SyntaxKind kind, GreenNode trailing)
123
return
SyntaxToken
.Create(kind, leading, trailing);
127
/// Creates a token whose <see cref="
SyntaxToken
.Text"/> and <see cref="
SyntaxToken
.ValueText"/> are the same.
129
internal static
SyntaxToken
Token(GreenNode leading, SyntaxKind kind, string text, GreenNode trailing)
134
internal static
SyntaxToken
Token(GreenNode leading, SyntaxKind kind, string text, string valueText, GreenNode trailing)
142
return kind >=
SyntaxToken
.FirstTokenWithWellKnownText && kind <=
SyntaxToken
.LastTokenWithWellKnownText && text == defaultText && valueText == defaultText
144
:
SyntaxToken
.WithValue(kind, leading, text, valueText, trailing);
147
internal static
SyntaxToken
MissingToken(SyntaxKind kind)
149
return
SyntaxToken
.CreateMissing(kind);
152
internal static
SyntaxToken
MissingToken(GreenNode leading, SyntaxKind kind, GreenNode trailing)
154
return
SyntaxToken
.CreateMissing(kind, leading, trailing);
157
internal static
SyntaxToken
Identifier(string text)
162
internal static
SyntaxToken
Identifier(GreenNode leading, string text, GreenNode trailing)
167
internal static
SyntaxToken
Identifier(SyntaxKind contextualKind, GreenNode leading, string text, string valueText, GreenNode trailing)
169
return
SyntaxToken
.Identifier(contextualKind, leading, text, valueText, trailing);
172
internal static
SyntaxToken
Literal(GreenNode leading, string text, int value, GreenNode trailing)
174
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
177
internal static
SyntaxToken
Literal(GreenNode leading, string text, uint value, GreenNode trailing)
179
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
182
internal static
SyntaxToken
Literal(GreenNode leading, string text, long value, GreenNode trailing)
184
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
187
internal static
SyntaxToken
Literal(GreenNode leading, string text, ulong value, GreenNode trailing)
189
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
192
internal static
SyntaxToken
Literal(GreenNode leading, string text, float value, GreenNode trailing)
194
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
197
internal static
SyntaxToken
Literal(GreenNode leading, string text, double value, GreenNode trailing)
199
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
202
internal static
SyntaxToken
Literal(GreenNode leading, string text, decimal value, GreenNode trailing)
204
return
SyntaxToken
.WithValue(SyntaxKind.NumericLiteralToken, leading, text, value, trailing);
207
internal static
SyntaxToken
Literal(GreenNode leading, string text, string value, GreenNode trailing)
209
return
SyntaxToken
.WithValue(SyntaxKind.StringLiteralToken, leading, text, value, trailing);
212
internal static
SyntaxToken
Literal(GreenNode leading, string text, SyntaxKind kind, string value, GreenNode trailing)
214
return
SyntaxToken
.WithValue(kind, leading, text, value, trailing);
217
internal static
SyntaxToken
Literal(GreenNode leading, string text, char value, GreenNode trailing)
219
return
SyntaxToken
.WithValue(SyntaxKind.CharacterLiteralToken, leading, text, value, trailing);
222
internal static
SyntaxToken
BadToken(GreenNode leading, string text, GreenNode trailing)
224
return
SyntaxToken
.WithValue(SyntaxKind.BadToken, leading, text, text, trailing);
227
internal static
SyntaxToken
XmlTextLiteral(GreenNode leading, string text, string value, GreenNode trailing)
229
return
SyntaxToken
.WithValue(SyntaxKind.XmlTextLiteralToken, leading, text, value, trailing);
232
internal static
SyntaxToken
XmlTextNewLine(GreenNode leading, string text, string value, GreenNode trailing)
239
return
SyntaxToken
.WithValue(SyntaxKind.XmlTextLiteralNewLineToken, leading, text, value, trailing);
242
internal static
SyntaxToken
XmlTextNewLine(string text)
244
return
SyntaxToken
.WithValue(SyntaxKind.XmlTextLiteralNewLineToken, null, text, text, null);
247
internal static
SyntaxToken
XmlEntity(GreenNode leading, string text, string value, GreenNode trailing)
249
return
SyntaxToken
.WithValue(SyntaxKind.XmlEntityLiteralToken, leading, text, value, trailing);
307
public static SeparatedSyntaxList<TNode> SeparatedList<TNode>(
SyntaxToken
token) where TNode : CSharpSyntaxNode
312
public static SeparatedSyntaxList<TNode> SeparatedList<TNode>(TNode node1,
SyntaxToken
token, TNode node2) where TNode : CSharpSyntaxNode
344
internal static IEnumerable<
SyntaxToken
> GetWellKnownTokens()
346
return
SyntaxToken
.GetWellKnownTokens();
Syntax\InternalSyntax\SyntaxFirstTokenReplacer.cs (8)
16
private readonly
SyntaxToken
_oldToken;
17
private readonly
SyntaxToken
_newToken;
21
private SyntaxFirstTokenReplacer(
SyntaxToken
oldToken,
SyntaxToken
newToken, int diagnosticOffsetDelta)
29
internal static TRoot Replace<TRoot>(TRoot root,
SyntaxToken
oldToken,
SyntaxToken
newToken, int diagnosticOffsetDelta)
44
var
token = node as
SyntaxToken
;
Syntax\InternalSyntax\SyntaxLastTokenReplacer.cs (8)
16
private readonly
SyntaxToken
_oldToken;
17
private readonly
SyntaxToken
_newToken;
21
private SyntaxLastTokenReplacer(
SyntaxToken
oldToken,
SyntaxToken
newToken)
27
internal static TRoot Replace<TRoot>(TRoot root,
SyntaxToken
newToken)
30
var
oldToken = root.GetLastToken();
49
var
token = node as
SyntaxToken
;
Syntax\InternalSyntax\SyntaxListPoolExtensions.cs (2)
11
public static SyntaxList<
SyntaxToken
> ToTokenListAndFree(this SyntaxListPool pool, SyntaxListBuilder builder)
15
return new SyntaxList<
SyntaxToken
>(listNode);
Syntax\InternalSyntax\SyntaxToken.cs (29)
70
internal static
SyntaxToken
Create(SyntaxKind kind)
85
internal static
SyntaxToken
Create(SyntaxKind kind, GreenNode leading, GreenNode trailing)
121
internal static
SyntaxToken
CreateMissing(SyntaxKind kind)
135
internal static
SyntaxToken
CreateMissing(SyntaxKind kind, GreenNode leading, GreenNode trailing)
144
private static readonly ArrayElement<
SyntaxToken
>[] s_tokensWithNoTrivia = new ArrayElement<
SyntaxToken
>[(int)LastTokenWithWellKnownText + 1];
145
private static readonly ArrayElement<
SyntaxToken
>[] s_tokensWithElasticTrivia = new ArrayElement<
SyntaxToken
>[(int)LastTokenWithWellKnownText + 1];
146
private static readonly ArrayElement<
SyntaxToken
>[] s_tokensWithSingleTrailingSpace = new ArrayElement<
SyntaxToken
>[(int)LastTokenWithWellKnownText + 1];
147
private static readonly ArrayElement<
SyntaxToken
>[] s_tokensWithSingleTrailingCRLF = new ArrayElement<
SyntaxToken
>[(int)LastTokenWithWellKnownText + 1];
148
private static readonly ArrayElement<
SyntaxToken
>[] s_missingTokensWithNoTrivia = new ArrayElement<
SyntaxToken
>[(int)LastTokenWithWellKnownText + 1];
150
private static readonly
SyntaxToken
s_missingIdentifierTokenWithNoTrivia = new MissingTokenWithTrivia(SyntaxKind.IdentifierToken, leading: null, trailing: null);
164
internal static IEnumerable<
SyntaxToken
> GetWellKnownTokens()
199
internal static
SyntaxToken
Identifier(string text)
204
internal static
SyntaxToken
Identifier(GreenNode leading, string text, GreenNode trailing)
221
internal static
SyntaxToken
Identifier(SyntaxKind contextualKind, GreenNode leading, string text, string valueText, GreenNode trailing)
231
internal static
SyntaxToken
WithValue<T>(SyntaxKind kind, string text, T value)
236
internal static
SyntaxToken
WithValue<T>(SyntaxKind kind, GreenNode leading, string text, T value, GreenNode trailing)
241
internal static
SyntaxToken
StringLiteral(string text)
246
internal static
SyntaxToken
StringLiteral(CSharpSyntaxNode leading, string text, CSharpSyntaxNode trailing)
347
public virtual
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
357
public virtual
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
364
System.Diagnostics.Debug.Assert(this.GetType() == typeof(
SyntaxToken
));
370
System.Diagnostics.Debug.Assert(this.GetType() == typeof(
SyntaxToken
));
435
var
otherToken = (
SyntaxToken
)other;
Syntax\InternalSyntax\SyntaxToken.MissingTokenWithTrivia.cs (2)
47
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
52
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifier.cs (2)
44
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
49
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifierExtended.cs (2)
47
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
52
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifierWithTrailingTrivia.cs (2)
40
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
45
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxIdentifierWithTrivia.cs (2)
68
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
73
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteral.cs (2)
57
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
62
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxLiteralWithTrivia.cs (2)
63
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
68
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\SyntaxToken.SyntaxTokenWithTrivia.cs (2)
56
public override
SyntaxToken
TokenWithLeadingTrivia(GreenNode trivia)
61
public override
SyntaxToken
TokenWithTrailingTrivia(GreenNode trivia)
Syntax\InternalSyntax\TypeDeclarationSyntax.cs (30)
15
CoreSyntax.SyntaxList<
SyntaxToken
> modifiers,
16
SyntaxToken
keyword,
17
SyntaxToken
identifier,
22
SyntaxToken
openBraceToken,
24
SyntaxToken
closeBraceToken,
25
SyntaxToken
semicolonToken);
32
CoreSyntax.SyntaxList<
SyntaxToken
> modifiers,
33
SyntaxToken
keyword,
34
SyntaxToken
identifier,
39
SyntaxToken
openBraceToken,
41
SyntaxToken
closeBraceToken,
42
SyntaxToken
semicolonToken)
64
CoreSyntax.SyntaxList<
SyntaxToken
> modifiers,
65
SyntaxToken
keyword,
66
SyntaxToken
identifier,
71
SyntaxToken
openBraceToken,
73
SyntaxToken
closeBraceToken,
74
SyntaxToken
semicolonToken)
96
CoreSyntax.SyntaxList<
SyntaxToken
> modifiers,
97
SyntaxToken
keyword,
98
SyntaxToken
identifier,
103
SyntaxToken
openBraceToken,
105
SyntaxToken
closeBraceToken,
106
SyntaxToken
semicolonToken)
129
CoreSyntax.SyntaxList<
SyntaxToken
> modifiers,
130
SyntaxToken
keyword,
131
SyntaxToken
identifier,
136
SyntaxToken
openBraceToken,
138
SyntaxToken
closeBraceToken,
139
SyntaxToken
semicolonToken)
Syntax\SyntaxEquivalence.cs (4)
80
if (((Green.
SyntaxToken
)before).ValueText != ((Green.
SyntaxToken
)after).ValueText)
95
if (((Green.
SyntaxToken
)before).Text != ((Green.
SyntaxToken
)after).Text)
Syntax\SyntaxFactory.cs (1)
1663
var
token = lexer.Lex(InternalSyntax.LexerMode.Syntax);
Syntax\SyntaxFacts.cs (2)
443
internal static bool IsIdentifierVar(this Syntax.InternalSyntax.
SyntaxToken
node)
448
internal static bool IsIdentifierVarOrPredefinedType(this Syntax.InternalSyntax.
SyntaxToken
node)
Syntax\SyntaxTokenParser.cs (3)
55
var
token = _lexer.Lex(InternalSyntax.LexerMode.Syntax);
70
var
containingToken = InternalSyntax.SyntaxFactory.MissingToken(leading: leadingTrivia.Node, SyntaxKind.None, trailing: null);
85
var
containingToken = InternalSyntax.SyntaxFactory.MissingToken(leading: null, SyntaxKind.None, trailing: trailingTrivia.Node);
Syntax\SyntaxTreeDiagnosticEnumerator.cs (3)
142
var
token = node as Syntax.InternalSyntax.
SyntaxToken
;
153
private void PushToken(Syntax.InternalSyntax.
SyntaxToken
token)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
IncrementalParsing\IncrementalParsingTests.cs (2)
3074
var
oldToken = ((Syntax.InternalSyntax.ClassDeclarationSyntax)oldClassC).Identifier;
3075
var
newToken = ((Syntax.InternalSyntax.ClassDeclarationSyntax)newClassC).Identifier;
LexicalAndXml\CrefLexerTests.cs (1)
448
var
token = lexer.Lex(InternalSyntax.LexerMode.XmlCrefQuote | InternalSyntax.LexerMode.XmlDocCommentStyleSingleLine | InternalSyntax.LexerMode.XmlDocCommentLocationInterior);
LexicalAndXml\NameAttributeValueLexerTests.cs (1)
412
var
token = lexer.Lex(InternalSyntax.LexerMode.XmlNameQuote | InternalSyntax.LexerMode.XmlDocCommentStyleSingleLine | InternalSyntax.LexerMode.XmlDocCommentLocationInterior);