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