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);
835 references to SyntaxToken
Microsoft.CodeAnalysis.CSharp (831)
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)
37
var
hash = this.EatToken(SyntaxKind.HashToken, false);
88
var
lineKeyword = this.EatContextualToken(contextualKind);
117
var
id = this.EatToken(SyntaxKind.IdentifierToken, false);
118
var
end = this.ParseEndOfDirective(ignoreErrors: true);
137
private DirectiveTriviaSyntax ParseIfDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
140
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
146
private DirectiveTriviaSyntax ParseElifDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool endIsActive)
149
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
174
private DirectiveTriviaSyntax ParseElseDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool endIsActive)
176
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
196
private DirectiveTriviaSyntax ParseEndIfDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool endIsActive)
198
var
eod = this.ParseEndOfDirective(ignoreErrors: false);
215
private DirectiveTriviaSyntax ParseRegionDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
220
private DirectiveTriviaSyntax ParseEndRegionDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
222
var
eod = this.ParseEndOfDirectiveWithOptionalPreprocessingMessage();
237
private DirectiveTriviaSyntax ParseDefineOrUndefDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool isFollowingToken)
244
var
name = this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_IdentifierExpected);
246
var
end = this.ParseEndOfDirective(ignoreErrors: name.IsMissing);
279
private DirectiveTriviaSyntax ParseErrorOrWarningDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive)
281
var
eod = this.ParseEndOfDirectiveWithOptionalPreprocessingMessage();
361
private DirectiveTriviaSyntax ParseLineDirective(
SyntaxToken
hash,
SyntaxToken
id, bool isActive)
363
SyntaxToken
line;
364
SyntaxToken
file = null;
397
var
end = this.ParseEndOfDirective(ignoreErrors: line.IsMissing || !isActive, afterLineNumber: sawLineButNotFile);
401
private LineSpanDirectiveTriviaSyntax ParseLineSpanDirective(
SyntaxToken
hash,
SyntaxToken
lineKeyword, bool isActive)
412
var
minus = EatToken(SyntaxKind.MinusToken, reportError: reportError);
422
var
characterOffset = (CurrentToken.Kind == SyntaxKind.NumericLiteralToken) ?
431
var
file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError);
439
var
endOfDirective = this.ParseEndOfDirective(ignoreErrors: !reportError);
442
static bool noTriviaBetween(
SyntaxToken
token1,
SyntaxToken
token2)
452
var
openParen = EatToken(SyntaxKind.OpenParenToken, reportError);
455
var
lineToken = ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxLineValue, out line);
457
var
comma = EatToken(SyntaxKind.CommaToken, reportError);
460
var
characterToken = ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxCharacterValue, out character);
462
var
closeParen = EatToken(SyntaxKind.CloseParenToken, reportError);
468
private
SyntaxToken
ParseLineDirectiveNumericLiteral(ref bool reportError, int minValue, int maxValue, out int value)
470
var
token = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_LineSpanDirectiveInvalidValue, reportError: reportError);
488
private DirectiveTriviaSyntax ParseReferenceDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool isFollowingToken)
502
SyntaxToken
file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive);
504
var
end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive);
508
private DirectiveTriviaSyntax ParseLoadDirective(
SyntaxToken
hash,
SyntaxToken
keyword, bool isActive, bool isFollowingToken)
522
SyntaxToken
file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive);
524
var
end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive);
528
private DirectiveTriviaSyntax ParseNullableDirective(
SyntaxToken
hash,
SyntaxToken
token, bool isActive)
535
SyntaxToken
setting = this.CurrentToken.Kind switch
543
SyntaxToken
target = this.CurrentToken.Kind switch
552
var
end = this.ParseEndOfDirective(ignoreErrors: setting.IsMissing || target?.IsMissing == true || !isActive);
556
private DirectiveTriviaSyntax ParsePragmaDirective(
SyntaxToken
hash,
SyntaxToken
pragma, bool isActive)
566
var
warning = this.EatContextualToken(SyntaxKind.WarningKeyword);
567
SyntaxToken
style;
575
SyntaxToken
id;
619
var
end = this.ParseEndOfDirective(hasError || !isActive, afterPragma: true);
625
var
end = this.ParseEndOfDirective(ignoreErrors: true, afterPragma: true);
631
var
checksum = this.EatToken();
632
var
file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive);
633
var
guid = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !file.IsMissing);
643
var
bytes = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !guid.IsMissing);
664
var
eod = this.ParseEndOfDirective(ignoreErrors: hasError, afterPragma: true);
669
var
warning = this.EatToken(SyntaxKind.WarningKeyword, ErrorCode.WRN_IllegalPragma, reportError: isActive);
670
var
style = this.EatToken(SyntaxKind.DisableKeyword, reportError: false);
671
var
eod = this.ParseEndOfDirective(ignoreErrors: true, afterPragma: true);
676
private DirectiveTriviaSyntax ParseShebangDirective(
SyntaxToken
hash,
SyntaxToken
exclamation, bool isActive)
684
private
SyntaxToken
ParseEndOfDirectiveWithOptionalPreprocessingMessage()
687
private
SyntaxToken
ParseEndOfDirective(bool ignoreErrors, bool afterPragma = false, bool afterLineNumber = false)
689
var skippedTokens = new SyntaxListBuilder<
SyntaxToken
>();
695
skippedTokens = new SyntaxListBuilder<
SyntaxToken
>(10);
720
SyntaxToken
endOfDirective = this.CurrentToken.Kind == SyntaxKind.EndOfDirectiveToken
743
var
op = this.EatToken();
756
var
op = this.EatToken();
769
var
op = this.EatToken();
781
var
op = this.EatToken();
794
var
open = this.EatToken();
796
var
close = this.EatToken(SyntaxKind.CloseParenToken);
799
var
identifier = TruncateIdentifier(this.EatToken());
811
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 (349)
183
SyntaxToken
? tmp = null;
190
var
eof = this.EatToken(SyntaxKind.EndOfFileToken);
231
var fileAsTrivia = _syntaxFactory.SkippedTokensTrivia(builder.ToList<
SyntaxToken
>());
253
var
namespaceToken = this.EatToken(SyntaxKind.NamespaceKeyword);
262
SyntaxToken
? openBrace = null;
263
SyntaxToken
? semicolon = null;
363
ref
SyntaxToken
? openBraceOrSemicolon,
412
[NotNullIfNotNull(nameof(openBraceOrSemicolon))] ref
SyntaxToken
? openBraceOrSemicolon,
564
[NotNullIfNotNull(nameof(openBraceOrSemicolon))] ref
SyntaxToken
? openBraceOrSemicolon,
616
var
token = this.EatToken();
731
var
skippedToken = EatToken();
817
ref
SyntaxToken
? openBrace,
851
ref
SyntaxToken
? openBraceOrSemicolon,
957
var
globalToken = this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword
963
var
usingToken = this.EatToken(SyntaxKind.UsingKeyword);
964
var
staticToken = this.TryEatToken(SyntaxKind.StaticKeyword);
965
var
unsafeToken = this.TryEatToken(SyntaxKind.UnsafeKeyword);
978
SyntaxToken
semicolon;
1027
private static bool IsGlobalAttributeTarget(
SyntaxToken
token)
1123
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
1140
var
closeBracket = this.EatToken(SyntaxKind.CloseBracketToken);
1175
LanguageParser @this, ref
SyntaxToken
openBracket, SeparatedSyntaxListBuilder<AttributeSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
1211
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
1230
LanguageParser @this, ref
SyntaxToken
openParen, SeparatedSyntaxListBuilder<AttributeArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
1291
private static DeclarationModifiers GetModifierExcludingScoped(
SyntaxToken
token)
1366
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);
1378
SyntaxToken
modTok;
1382
var
nextToken = PeekToken(1);
1413
var
next = PeekToken(1);
1474
bool isStructOrRecordKeyword(
SyntaxToken
token)
1607
private static bool IsNonContextualModifier(
SyntaxToken
nextToken)
1615
var
nextToken = this.PeekToken(1);
1727
if (!tryScanRecordStart(out
var
keyword, out
var
recordModifier))
1738
var
name = this.ParseIdentifierToken();
1761
SyntaxToken
semicolon;
1762
SyntaxToken
? openBrace;
1763
SyntaxToken
? closeBrace;
1851
bool tryScanRecordStart([NotNullWhen(true)] out
SyntaxToken
? keyword, out
SyntaxToken
? recordModifier)
1868
var
misplacedToken = this.EatToken();
1885
static TypeDeclarationSyntax constructTypeDeclaration(ContextAwareSyntax syntaxFactory, SyntaxList<AttributeListSyntax> attributes, SyntaxListBuilder modifiers,
SyntaxToken
keyword,
SyntaxToken
? recordModifier,
1886
SyntaxToken
name, TypeParameterListSyntax typeParameters, ParameterListSyntax? paramList, BaseListSyntax baseList, SyntaxListBuilder<TypeParameterConstraintClauseSyntax> constraints,
1887
SyntaxToken
? openBrace, SyntaxListBuilder<MemberDeclarationSyntax> members,
SyntaxToken
? closeBrace,
SyntaxToken
semicolon)
1889
var modifiersList = (SyntaxList<
SyntaxToken
>)modifiers.ToList();
1968
private void SkipBadMemberListTokens(ref
SyntaxToken
openBrace, SyntaxListBuilder members)
1980
openBrace = (
SyntaxToken
)tmp;
1992
var
token = this.EatToken();
2057
var
colon = this.TryEatToken(SyntaxKind.ColonToken);
2097
PostSkipAction skipBadBaseListTokens(ref
SyntaxToken
colon, SeparatedSyntaxListBuilder<BaseTypeSyntax> list, SyntaxKind expected)
2124
var
where = this.EatContextualToken(SyntaxKind.WhereKeyword);
2129
var
colon = this.EatToken(SyntaxKind.ColonToken);
2157
SyntaxToken
separatorToken = this.EatToken(SyntaxKind.CommaToken);
2267
var
allows = this.EatContextualToken(SyntaxKind.AllowsKeyword);
2436
new SyntaxList<
SyntaxToken
>(),
2573
var
identifier = this.EatToken();
2720
SyntaxToken
identifierOrThisOpt;
2905
var
misplacedModifier = this.CurrentToken;
2922
ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt,
SyntaxToken
identifierOrThisOpt, TypeParameterListSyntax typeParameterListOpt,
2963
ref ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt, ref
SyntaxToken
identifierOrThisOpt,
2986
ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt,
SyntaxToken
identifierOrThisOpt,
3133
SyntaxToken
identifierOrThisOpt;
3185
SyntaxToken
identifierOrThisOpt)
3264
if (child is not
SyntaxToken
token)
3288
var
name = this.ParseIdentifierToken();
3298
this.ParseBlockAndExpressionBodiesWithSemicolon(out var body, out var expressionBody, out
var
semicolon);
3310
var
colon = this.EatToken(SyntaxKind.ColonToken);
3317
SyntaxToken
token;
3343
var
tilde = this.EatToken(SyntaxKind.TildeToken);
3345
var
name = this.ParseIdentifierToken();
3352
out BlockSyntax body, out ArrowExpressionClauseSyntax expressionBody, out
SyntaxToken
semicolon);
3364
out
SyntaxToken
semicolon,
3452
SyntaxToken
identifier,
3470
var
colonToken = this.CurrentToken;
3491
this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out
var
semicolon);
3617
var
style = this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword
3624
SyntaxToken
opKeyword;
3654
var
checkedKeyword = TryEatCheckedOrHandleUnchecked(ref opKeyword);
3673
this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out
var
semicolon);
3701
SyntaxToken
separator = null;
3759
private
SyntaxToken
TryEatCheckedOrHandleUnchecked(ref
SyntaxToken
operatorKeyword)
3780
var
firstToken = this.CurrentToken;
3807
var
opKeyword = this.EatToken(SyntaxKind.OperatorKeyword);
3808
var
checkedKeyword = TryEatCheckedOrHandleUnchecked(ref opKeyword);
3809
SyntaxToken
opToken;
3856
var
tk = this.CurrentToken;
3860
var
opToken2 = this.EatToken();
3917
this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out
var
semicolon);
3947
SyntaxToken
thisKeyword,
3963
SyntaxToken
semicolon = null;
4007
SyntaxToken
identifier,
4044
var
equals = this.EatToken(SyntaxKind.EqualsToken);
4049
SyntaxToken
semicolon = null;
4098
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
4143
var
refKeyword = this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression)
4151
private PostSkipAction SkipBadAccessorListTokens(ref
SyntaxToken
openBrace, SyntaxListBuilder<AccessorDeclarationSyntax> list, ErrorCode error)
4198
var
token = this.PeekToken(peekIndex);
4335
var
token = (first && !this.CurrentToken.ContainsDiagnostics) ? this.EatTokenWithPrejudice(expected) : this.EatToken();
4361
var
token = (first && !this.CurrentToken.ContainsDiagnostics) ? this.EatTokenWithPrejudice(errorCode) : this.EatToken();
4384
var
accessorName = this.EatToken(SyntaxKind.IdentifierToken,
4415
SyntaxToken
semicolon = null;
4469
private
SyntaxToken
EatAccessorSemicolon()
4475
private static SyntaxKind GetAccessorKind(
SyntaxToken
accessorName)
4495
var parameters = this.ParseParameterList(out
var
open, out
var
close, SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken);
4506
var parameters = this.ParseParameterList(out
var
open, out
var
close, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken);
4567
out
SyntaxToken
open,
4568
out
SyntaxToken
close,
4593
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
4682
SyntaxToken
identifier;
4701
var
equalsToken = TryEatToken(SyntaxKind.EqualsToken);
4711
internal static bool NoTriviaBetween(
SyntaxToken
token1,
SyntaxToken
token2)
4716
private static bool IsParameterModifierExcludingScoped(
SyntaxToken
token)
4748
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter);
4788
var
eventToken = this.EatToken();
4799
SyntaxToken
eventToken,
4803
SyntaxToken
identifierOrThisOpt;
4829
SyntaxToken
identifier;
4860
SyntaxToken
semicolon = null;
4891
var
semi = this.EatToken();
4908
if (modifiers is [..,
SyntaxToken
{ Kind: SyntaxKind.ScopedKeyword } scopedKeyword])
4924
SyntaxToken
eventToken,
5001
SyntaxList<
SyntaxToken
> mods,
5188
SyntaxList<
SyntaxToken
> mods,
5259
var
missingIdentifier = CreateMissingIdentifierToken();
5277
var
name = this.ParseIdentifierToken();
5304
var
equals = this.EatToken();
5307
var
refKeyword = isLocalOrField && !isConst && this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression)
5375
args.AddSeparator((
SyntaxToken
)item);
5479
var
delegateToken = this.EatToken(SyntaxKind.DelegateKeyword);
5483
var
name = this.ParseIdentifierToken();
5512
var
enumToken = this.EatToken(SyntaxKind.EnumKeyword);
5513
var
name = this.ParseIdentifierToken();
5527
var
colon = this.EatToken(SyntaxKind.ColonToken);
5537
SyntaxToken
semicolon;
5538
SyntaxToken
openBrace;
5539
SyntaxToken
closeBrace;
5583
LanguageParser @this, ref
SyntaxToken
openBrace, SeparatedSyntaxListBuilder<EnumMemberDeclarationSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
5600
var
memberName = this.ParseIdentifierToken();
5636
private static
SyntaxToken
CreateMissingIdentifierToken()
5678
private bool IsTrueIdentifier(
SyntaxToken
token)
5699
private
SyntaxToken
ParseIdentifierToken(ErrorCode code = ErrorCode.ERR_IdentifierExpected)
5712
var
result = CreateMissingIdentifierToken();
5717
SyntaxToken
identifierToken = this.EatToken();
5767
var
open = this.EatToken(SyntaxKind.LessThanToken);
5786
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<TypeParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
5862
this.ParseTypeArgumentList(out
var
open, types, out
var
close);
5916
out
var
greaterThanToken, out bool isDefinitelyTypeArgumentList);
6012
out
SyntaxToken
greaterThanToken,
6025
var
start = this.EatToken();
6200
private void ParseTypeArgumentList(out
SyntaxToken
open, SeparatedSyntaxListBuilder<TypeSyntax> types, out
SyntaxToken
close)
6273
static bool tokenBreaksTypeArgumentList(
SyntaxToken
token)
6418
out
SyntaxToken
identifierOrThisOpt,
6434
SyntaxToken
separator = null;
6554
private void AccumulateExplicitInterfaceName(ref NameSyntax explicitInterfaceName, ref
SyntaxToken
separator)
6616
SyntaxToken
separator = null;
6703
var
separator = this.EatToken();
6713
SyntaxToken
separator)
6755
private
SyntaxToken
ConvertToMissingWithTrailingTrivia(
SyntaxToken
token, SyntaxKind expectedKind)
6757
var
newToken = SyntaxFactory.MissingToken(expectedKind);
6825
private ScanTypeFlags ScanType(out
SyntaxToken
lastTokenOfType, bool forPattern = false)
6835
private ScanTypeFlags ScanNamedTypePart(out
SyntaxToken
lastTokenOfType)
6854
private ScanTypeFlags ScanType(ParseTypeMode mode, out
SyntaxToken
lastTokenOfType)
7028
private ScanTypeFlags ScanTupleType(out
SyntaxToken
lastTokenOfType)
7072
private ScanTypeFlags ScanFunctionPointerType(out
SyntaxToken
lastTokenOfType)
7082
var
peek1 = PeekToken(1);
7142
var ignoredModifiers = _pool.Allocate<
SyntaxToken
>();
7280
var
question = TryEatNullableQualifierIfApplicable(type, mode);
7342
private
SyntaxToken
TryEatNullableQualifierIfApplicable(
7356
var
questionToken = this.EatToken();
7434
var
nextToken = PeekToken(1);
7524
var
open = this.EatToken(SyntaxKind.OpenBracketToken);
7586
var
open = this.EatToken(SyntaxKind.OpenParenToken);
7625
private PostSkipAction SkipBadArrayRankSpecifierTokens(ref
SyntaxToken
openBracket, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expected)
7638
var
token = this.EatToken();
7671
var
@delegate = EatToken(SyntaxKind.DelegateKeyword);
7672
var
asterisk = EatToken(SyntaxKind.AsteriskToken);
7678
var
lessThanTokenError = WithAdditionalDiagnostics(SyntaxFactory.MissingToken(SyntaxKind.LessThanToken), GetExpectedTokenError(SyntaxKind.LessThanToken, SyntaxKind.None));
7696
var
lessThanToken = EatTokenAsKind(SyntaxKind.LessThanToken);
7705
var modifiers = _pool.Allocate<
SyntaxToken
>();
7755
SyntaxToken
managedSpecifier;
7756
SyntaxToken
peek1 = PeekToken(1);
7783
var
openBracket = EatToken(SyntaxKind.OpenBracketToken);
7803
var
closeBracket = EatToken(SyntaxKind.CloseBracketToken);
7831
private static bool IsPossibleFunctionPointerParameterListStart(
SyntaxToken
token)
8233
var
token1 = PeekToken(1);
8353
SyntaxToken
identifierOrThisOpt;
8516
SyntaxToken
nextToken = PeekToken(1);
8597
private bool? IsPossibleTypedIdentifierStart(
SyntaxToken
current,
SyntaxToken
next, bool allowThisKeyword)
8671
(
SyntaxToken
)openBrace,
8702
(
SyntaxToken
)openBrace,
8836
var
@fixed = this.EatToken(SyntaxKind.FixedKeyword);
8837
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
8921
var
@try = this.EatToken(SyntaxKind.TryKeyword);
8996
var
@catch = this.EatToken();
9003
var
openParen = this.EatToken();
9007
SyntaxToken
name = null;
9015
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9024
var
whenKeyword = this.EatContextualToken(SyntaxKind.WhenKeyword);
9036
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9040
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9084
var
keyword = this.EatToken();
9095
var
@do = this.EatToken(SyntaxKind.DoKeyword);
9097
var
@while = this.EatToken(SyntaxKind.WhileKeyword);
9098
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9161
var
forToken = this.EatToken(SyntaxKind.ForKeyword);
9162
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9166
SyntaxToken
secondSemicolonToken;
9242
SyntaxToken
eatCommaOrSemicolon()
9247
SyntaxToken
eatUnexpectedTokensAndCloseParenToken()
9254
var
result = this.EatToken(SyntaxKind.CloseParenToken);
9261
SeparatedSyntaxList<ExpressionSyntax> parseForStatementExpressionList(ref
SyntaxToken
startToken, bool allowSemicolonAsSeparator)
9273
LanguageParser @this, ref
SyntaxToken
startToken, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
9291
SyntaxList<AttributeListSyntax> attributes,
SyntaxToken
awaitTokenOpt)
9301
SyntaxToken
@foreach;
9307
var
skippedForToken = this.EatToken();
9316
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9319
var
@in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected);
9326
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9334
SyntaxToken
identifier;
9344
identifier =
SyntaxToken
.WithValue(SyntaxKind.IdentifierToken, discard.LeadingTrivia.Node, discard.Text, discard.ValueText, discard.TrailingTrivia.Node);
9442
SyntaxToken
lastTokenOfType;
9513
var
@goto = this.EatToken(SyntaxKind.GotoKeyword);
9515
SyntaxToken
caseOrDefault = null;
9546
var stack = ArrayBuilder<(
SyntaxToken
,
SyntaxToken
, ExpressionSyntax,
SyntaxToken
, StatementSyntax,
SyntaxToken
)>.GetInstance();
9551
var
ifKeyword = this.EatToken(SyntaxKind.IfKeyword);
9552
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9554
var
closeParen = this.EatToken(SyntaxKind.CloseParenToken);
9557
var
elseKeyword = this.CurrentToken.Kind != SyntaxKind.ElseKeyword ?
9656
var
yieldToken = ConvertToKeyword(this.EatToken());
9657
SyntaxToken
returnOrBreak;
9693
parseSwitchHeader(out
var
switchKeyword, out
var
openParen, out var expression, out
var
closeParen, out
var
openBrace);
9710
out
SyntaxToken
switchKeyword,
9711
out
SyntaxToken
openParen,
9713
out
SyntaxToken
closeParen,
9714
out
SyntaxToken
openBrace)
9778
var
caseKeyword = this.EatToken();
9856
private UsingStatementSyntax ParseUsingStatement(SyntaxList<AttributeListSyntax> attributes,
SyntaxToken
awaitTokenOpt = null)
9858
var
@using = this.EatToken(SyntaxKind.UsingKeyword);
9859
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
9897
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);
10013
SyntaxToken
awaitKeyword, usingKeyword;
10038
SyntaxToken
scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);
10070
if (attributes.Count == 0 && mods.Count > 0 && IsAccessibilityModifier(((
SyntaxToken
)mods[0]).ContextualKind))
10088
var
mod = (
SyntaxToken
)mods[i];
10111
private
SyntaxToken
ParsePossibleScopedKeyword(bool isFunctionPointerParameter)
10117
SyntaxToken
scopedKeyword = this.EatContextualToken(SyntaxKind.ScopedKeyword);
10150
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
10223
VariableFlags initialFlags,
SyntaxToken
? scopedKeyword)
10249
SyntaxList<
SyntaxToken
> mods,
10250
SyntaxToken
? scopedKeyword,
10305
SyntaxToken
mod;
10424
SyntaxList<
SyntaxToken
> modifiers,
10426
SyntaxToken
identifier)
10451
var
modifier = modifiers[i];
10514
SyntaxToken
semicolon;
10547
SyntaxToken
semicolon;
10890
var
next = PeekToken(1);
11082
var
operatorToken = eatOperatorToken(operatorTokenKind);
11161
var
token1 = this.CurrentToken;
11215
SyntaxToken
eatOperatorToken(SyntaxKind operatorTokenKind)
11227
var
token1 = EatToken();
11228
var
token2 = EatToken();
11240
var
token1 = EatToken();
11242
var
token3 = EatToken();
11265
var
questionToken = this.EatToken();
11354
public static bool IsAtDotDotToken(
SyntaxToken
token1,
SyntaxToken
token2)
11362
public
SyntaxToken
EatDotDotToken()
11365
var
token1 = this.EatToken();
11366
var
token2 = this.EatToken();
11368
var
dotDotToken = SyntaxFactory.Token(token1.GetLeadingTrivia(), SyntaxKind.DotDotToken, token2.GetTrailingTrivia());
11400
var
scopedKeyword = isScoped
11417
private ExpressionSyntax ParseIsExpression(ExpressionSyntax leftOperand,
SyntaxToken
opToken)
11558
var
refKeyword = this.EatToken();
11771
var
nextToken = this.PeekToken(1);
11872
openToken: out
SyntaxToken
openToken,
11874
closeToken: out
SyntaxToken
closeToken,
11888
openToken: out
SyntaxToken
openToken,
11890
closeToken: out
SyntaxToken
closeToken,
11897
out
SyntaxToken
openToken,
11899
out
SyntaxToken
closeToken,
11967
LanguageParser @this, ref
SyntaxToken
open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
12010
SyntaxToken
refKindKeyword = null;
12056
var
keyword = this.EatToken();
12100
var
checkedOrUnchecked = this.EatToken();
12143
var
tk = this.PeekToken(curTk++);
12192
var
token1 = this.PeekToken(1);
12200
var
token2 = this.PeekToken(2);
12259
var
identifier = this.IsTrueIdentifier() ? this.EatToken() : CreateMissingIdentifierToken();
12261
var
equalsToken = TryEatToken(SyntaxKind.EqualsToken);
12319
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
12347
private TupleExpressionSyntax ParseTupleExpressionTail(
SyntaxToken
openParen, ArgumentSyntax firstArg)
12512
var
token1 = this.PeekToken(1);
12715
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
12732
LanguageParser @this, ref
SyntaxToken
openBracket, SeparatedSyntaxListBuilder<CollectionElementSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
12761
var
@new = this.EatToken(SyntaxKind.NewKeyword);
12765
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
12815
SyntaxToken
@new = this.EatToken(SyntaxKind.NewKeyword);
12888
private WithExpressionSyntax ParseWithExpression(ExpressionSyntax receiverExpression,
SyntaxToken
withKeyword)
12890
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
12915
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
12989
LanguageParser @this, ref
SyntaxToken
startToken, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind)
13022
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
13049
var
@new = this.EatToken(SyntaxKind.NewKeyword);
13050
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
13089
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
13107
LanguageParser @this, ref
SyntaxToken
openBrace, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
13125
var
@stackalloc = this.EatToken(SyntaxKind.StackAllocKeyword);
13126
var
openBracket = this.EatToken(SyntaxKind.OpenBracketToken);
13184
var
@delegate = this.EatToken(SyntaxKind.DelegateKeyword);
13203
var
openBrace = this.EatToken(SyntaxKind.OpenBraceToken);
13225
private SyntaxList<
SyntaxToken
> ParseAnonymousFunctionModifiers()
13324
var
arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken);
13334
var
identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken)
13339
var
arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken);
13357
var
openParen = this.EatToken(SyntaxKind.OpenParenToken);
13379
LanguageParser @this, ref
SyntaxToken
openParen, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind)
13429
var
identifier = this.ParseIdentifierToken();
13432
var
equalsToken = TryEatToken(SyntaxKind.EqualsToken);
13474
var
peek1 = this.PeekToken(1);
13491
private static bool IsTokenQueryContextualKeyword(
SyntaxToken
token)
13511
private static bool IsTokenStartOfNewQueryClause(
SyntaxToken
token)
13653
var
@from = this.EatContextualToken(SyntaxKind.FromKeyword);
13659
SyntaxToken
name;
13724
var
@orderby = this.EatContextualToken(SyntaxKind.OrderByKeyword);
13769
SyntaxToken
direction = null;
13865
LanguageParser parser, ref
SyntaxToken
openToken, SeparatedSyntaxListBuilder<TNode> builder, SyntaxKind expectedKind, SyntaxKind closeTokenKind) where TNode : GreenNode;
13897
ref
SyntaxToken
openToken,
13919
ref
SyntaxToken
openToken,
14095
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;
2490
private
SyntaxToken
LexDirectiveToken()
2503
var
token = Create(in info, null, directiveTriviaCache, errors);
2509
public
SyntaxToken
LexEndOfDirectiveWithOptionalPreprocessingMessage()
2546
var
endOfDirective = SyntaxFactory.Token(leading, SyntaxKind.EndOfDirectiveToken, trailing);
2826
private
SyntaxToken
LexXmlToken()
3182
private
SyntaxToken
LexXmlElementTagToken()
3197
SyntaxToken
? token = DocumentationCommentXmlTokens.LookupToken(tagInfo.Text, leading);
3368
private
SyntaxToken
LexXmlAttributeTextToken()
3521
private
SyntaxToken
LexXmlCharacter()
3577
private
SyntaxToken
LexXmlCrefOrNameToken()
3990
private
SyntaxToken
LexXmlCDataSectionTextToken()
4112
private
SyntaxToken
LexXmlCommentTextToken()
4242
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();
900
var
oldToken = node as
SyntaxToken
?? node.GetFirstToken();
901
var
newToken = AddSkippedSyntax(oldToken, skippedSyntax, trailing: false);
919
var
token = node as
SyntaxToken
;
926
var
lastToken = node.GetLastToken();
927
var
newToken = AddSkippedSyntax(lastToken, skippedSyntax, trailing: true);
936
internal
SyntaxToken
AddSkippedSyntax(
SyntaxToken
target, GreenNode skippedSyntax, bool trailing)
949
SyntaxToken
token = node as
SyntaxToken
;
957
SyntaxToken
tk = token.TokenWithLeadingTrivia(null).TokenWithTrailingTrivia(null);
1096
protected static
SyntaxToken
ConvertToKeyword(
SyntaxToken
token)
1115
protected static
SyntaxToken
ConvertToIdentifier(
SyntaxToken
token)
1119
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);