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);
836 references to SyntaxToken
Microsoft.CodeAnalysis.CSharp (832)
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)
37var hash = this.EatToken(SyntaxKind.HashToken, false); 88var lineKeyword = this.EatContextualToken(contextualKind); 117var id = this.EatToken(SyntaxKind.IdentifierToken, false); 118var end = this.ParseEndOfDirective(ignoreErrors: true); 137private DirectiveTriviaSyntax ParseIfDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive) 140var eod = this.ParseEndOfDirective(ignoreErrors: false); 146private DirectiveTriviaSyntax ParseElifDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool endIsActive) 149var eod = this.ParseEndOfDirective(ignoreErrors: false); 174private DirectiveTriviaSyntax ParseElseDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool endIsActive) 176var eod = this.ParseEndOfDirective(ignoreErrors: false); 196private DirectiveTriviaSyntax ParseEndIfDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool endIsActive) 198var eod = this.ParseEndOfDirective(ignoreErrors: false); 215private DirectiveTriviaSyntax ParseRegionDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive) 220private DirectiveTriviaSyntax ParseEndRegionDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive) 222var eod = this.ParseEndOfDirectiveWithOptionalPreprocessingMessage(); 237private DirectiveTriviaSyntax ParseDefineOrUndefDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool isFollowingToken) 244var name = this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_IdentifierExpected); 246var end = this.ParseEndOfDirective(ignoreErrors: name.IsMissing); 279private DirectiveTriviaSyntax ParseErrorOrWarningDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive) 281var eod = this.ParseEndOfDirectiveWithOptionalPreprocessingMessage(); 361private DirectiveTriviaSyntax ParseLineDirective(SyntaxToken hash, SyntaxToken id, bool isActive) 363SyntaxToken line; 364SyntaxToken file = null; 397var end = this.ParseEndOfDirective(ignoreErrors: line.IsMissing || !isActive, afterLineNumber: sawLineButNotFile); 401private LineSpanDirectiveTriviaSyntax ParseLineSpanDirective(SyntaxToken hash, SyntaxToken lineKeyword, bool isActive) 412var minus = EatToken(SyntaxKind.MinusToken, reportError: reportError); 422var characterOffset = (CurrentToken.Kind == SyntaxKind.NumericLiteralToken) ? 431var file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError); 439var endOfDirective = this.ParseEndOfDirective(ignoreErrors: !reportError); 442static bool noTriviaBetween(SyntaxToken token1, SyntaxToken token2) 452var openParen = EatToken(SyntaxKind.OpenParenToken, reportError); 455var lineToken = ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxLineValue, out line); 457var comma = EatToken(SyntaxKind.CommaToken, reportError); 460var characterToken = ParseLineDirectiveNumericLiteral(ref reportError, minValue: 1, maxValue: MaxCharacterValue, out character); 462var closeParen = EatToken(SyntaxKind.CloseParenToken, reportError); 468private SyntaxToken ParseLineDirectiveNumericLiteral(ref bool reportError, int minValue, int maxValue, out int value) 470var token = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_LineSpanDirectiveInvalidValue, reportError: reportError); 488private DirectiveTriviaSyntax ParseReferenceDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool isFollowingToken) 502SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); 504var end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive); 508private DirectiveTriviaSyntax ParseLoadDirective(SyntaxToken hash, SyntaxToken keyword, bool isActive, bool isFollowingToken) 522SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); 524var end = this.ParseEndOfDirective(ignoreErrors: file.IsMissing || !isActive); 528private DirectiveTriviaSyntax ParseNullableDirective(SyntaxToken hash, SyntaxToken token, bool isActive) 535SyntaxToken setting = this.CurrentToken.Kind switch 543SyntaxToken target = this.CurrentToken.Kind switch 552var end = this.ParseEndOfDirective(ignoreErrors: setting.IsMissing || target?.IsMissing == true || !isActive); 556private DirectiveTriviaSyntax ParsePragmaDirective(SyntaxToken hash, SyntaxToken pragma, bool isActive) 566var warning = this.EatContextualToken(SyntaxKind.WarningKeyword); 567SyntaxToken style; 575SyntaxToken id; 619var end = this.ParseEndOfDirective(hasError || !isActive, afterPragma: true); 625var end = this.ParseEndOfDirective(ignoreErrors: true, afterPragma: true); 631var checksum = this.EatToken(); 632var file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive); 633var guid = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !file.IsMissing); 643var bytes = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !guid.IsMissing); 664var eod = this.ParseEndOfDirective(ignoreErrors: hasError, afterPragma: true); 669var warning = this.EatToken(SyntaxKind.WarningKeyword, ErrorCode.WRN_IllegalPragma, reportError: isActive); 670var style = this.EatToken(SyntaxKind.DisableKeyword, reportError: false); 671var eod = this.ParseEndOfDirective(ignoreErrors: true, afterPragma: true); 676private DirectiveTriviaSyntax ParseShebangDirective(SyntaxToken hash, SyntaxToken exclamation, bool isActive) 684private SyntaxToken ParseEndOfDirectiveWithOptionalPreprocessingMessage() 687private SyntaxToken ParseEndOfDirective(bool ignoreErrors, bool afterPragma = false, bool afterLineNumber = false) 689var skippedTokens = new SyntaxListBuilder<SyntaxToken>(); 695skippedTokens = new SyntaxListBuilder<SyntaxToken>(10); 720SyntaxToken endOfDirective = this.CurrentToken.Kind == SyntaxKind.EndOfDirectiveToken 743var op = this.EatToken(); 756var op = this.EatToken(); 769var op = this.EatToken(); 781var op = this.EatToken(); 794var open = this.EatToken(); 796var close = this.EatToken(SyntaxKind.CloseParenToken); 799var identifier = TruncateIdentifier(this.EatToken()); 811private 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 (350)
183SyntaxToken? tmp = null; 190var eof = this.EatToken(SyntaxKind.EndOfFileToken); 231var fileAsTrivia = _syntaxFactory.SkippedTokensTrivia(builder.ToList<SyntaxToken>()); 253var namespaceToken = this.EatToken(SyntaxKind.NamespaceKeyword); 262SyntaxToken? openBrace = null; 263SyntaxToken? semicolon = null; 363ref SyntaxToken? openBraceOrSemicolon, 412[NotNullIfNotNull(nameof(openBraceOrSemicolon))] ref SyntaxToken? openBraceOrSemicolon, 564[NotNullIfNotNull(nameof(openBraceOrSemicolon))] ref SyntaxToken? openBraceOrSemicolon, 616var token = this.EatToken(); 731var skippedToken = EatToken(); 817ref SyntaxToken? openBrace, 851ref SyntaxToken? openBraceOrSemicolon, 957var globalToken = this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword 963var usingToken = this.EatToken(SyntaxKind.UsingKeyword); 964var staticToken = this.TryEatToken(SyntaxKind.StaticKeyword); 965var unsafeToken = this.TryEatToken(SyntaxKind.UnsafeKeyword); 978SyntaxToken semicolon; 1027private static bool IsGlobalAttributeTarget(SyntaxToken token) 1123var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 1140var closeBracket = this.EatToken(SyntaxKind.CloseBracketToken); 1175LanguageParser @this, ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<AttributeSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 1211var openParen = this.EatToken(SyntaxKind.OpenParenToken); 1230LanguageParser @this, ref SyntaxToken openParen, SeparatedSyntaxListBuilder<AttributeArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 1291private static DeclarationModifiers GetModifierExcludingScoped(SyntaxToken token) 1366SyntaxToken scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false); 1378SyntaxToken modTok; 1382var nextToken = PeekToken(1); 1413var next = PeekToken(1); 1474bool isStructOrRecordKeyword(SyntaxToken token) 1607private static bool IsNonContextualModifier(SyntaxToken nextToken) 1615var nextToken = this.PeekToken(1); 1727if (!tryScanRecordStart(out var keyword, out var recordModifier)) 1738var name = this.ParseIdentifierToken(); 1761SyntaxToken semicolon; 1762SyntaxToken? openBrace; 1763SyntaxToken? closeBrace; 1851bool tryScanRecordStart([NotNullWhen(true)] out SyntaxToken? keyword, out SyntaxToken? recordModifier) 1868var misplacedToken = this.EatToken(); 1885static TypeDeclarationSyntax constructTypeDeclaration(ContextAwareSyntax syntaxFactory, SyntaxList<AttributeListSyntax> attributes, SyntaxListBuilder modifiers, SyntaxToken keyword, SyntaxToken? recordModifier, 1886SyntaxToken name, TypeParameterListSyntax typeParameters, ParameterListSyntax? paramList, BaseListSyntax baseList, SyntaxListBuilder<TypeParameterConstraintClauseSyntax> constraints, 1887SyntaxToken? openBrace, SyntaxListBuilder<MemberDeclarationSyntax> members, SyntaxToken? closeBrace, SyntaxToken semicolon) 1889var modifiersList = (SyntaxList<SyntaxToken>)modifiers.ToList(); 1968private void SkipBadMemberListTokens(ref SyntaxToken openBrace, SyntaxListBuilder members) 1980openBrace = (SyntaxToken)tmp; 1992var token = this.EatToken(); 2060var colon = this.TryEatToken(SyntaxKind.ColonToken); 2115PostSkipAction skipBadBaseListTokens(ref SyntaxToken colon, SeparatedSyntaxListBuilder<BaseTypeSyntax> list, SyntaxKind expected) 2142var where = this.EatContextualToken(SyntaxKind.WhereKeyword); 2147var colon = this.EatToken(SyntaxKind.ColonToken); 2175SyntaxToken separatorToken = this.EatToken(SyntaxKind.CommaToken); 2285var allows = this.EatContextualToken(SyntaxKind.AllowsKeyword); 2454new SyntaxList<SyntaxToken>(), 2591var identifier = this.EatToken(); 2738SyntaxToken identifierOrThisOpt; 2923var misplacedModifier = this.CurrentToken; 2940ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt, SyntaxToken identifierOrThisOpt, TypeParameterListSyntax typeParameterListOpt, 2981ref ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt, ref SyntaxToken identifierOrThisOpt, 3004ExplicitInterfaceSpecifierSyntax explicitInterfaceOpt, SyntaxToken identifierOrThisOpt, 3151SyntaxToken identifierOrThisOpt; 3203SyntaxToken identifierOrThisOpt) 3282if (child is not SyntaxToken token) 3306var name = this.ParseIdentifierToken(); 3316this.ParseBlockAndExpressionBodiesWithSemicolon(out var body, out var expressionBody, out var semicolon); 3328var colon = this.EatToken(SyntaxKind.ColonToken); 3335SyntaxToken token; 3361var tilde = this.EatToken(SyntaxKind.TildeToken); 3363var name = this.ParseIdentifierToken(); 3370out BlockSyntax body, out ArrowExpressionClauseSyntax expressionBody, out SyntaxToken semicolon); 3382out SyntaxToken semicolon, 3470SyntaxToken identifier, 3488var colonToken = this.CurrentToken; 3509this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out var semicolon); 3635var style = this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword 3642SyntaxToken opKeyword; 3672var checkedKeyword = TryEatCheckedOrHandleUnchecked(ref opKeyword); 3691this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out var semicolon); 3719SyntaxToken separator = null; 3777private SyntaxToken TryEatCheckedOrHandleUnchecked(ref SyntaxToken operatorKeyword) 3798var firstToken = this.CurrentToken; 3825var opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3826var checkedKeyword = TryEatCheckedOrHandleUnchecked(ref opKeyword); 3827SyntaxToken opToken; 3874var tk = this.CurrentToken; 3878var opToken2 = this.EatToken(); 3935this.ParseBlockAndExpressionBodiesWithSemicolon(out var blockBody, out var expressionBody, out var semicolon); 3965SyntaxToken thisKeyword, 3981SyntaxToken semicolon = null; 4025SyntaxToken identifier, 4062var equals = this.EatToken(SyntaxKind.EqualsToken); 4067SyntaxToken semicolon = null; 4116var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 4161var refKeyword = this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 4169private PostSkipAction SkipBadAccessorListTokens(ref SyntaxToken openBrace, SyntaxListBuilder<AccessorDeclarationSyntax> list, ErrorCode error) 4216var token = this.PeekToken(peekIndex); 4353var token = (first && !this.CurrentToken.ContainsDiagnostics) ? this.EatTokenWithPrejudice(expected) : this.EatToken(); 4379var token = (first && !this.CurrentToken.ContainsDiagnostics) ? this.EatTokenWithPrejudice(errorCode) : this.EatToken(); 4402var accessorName = this.EatToken(SyntaxKind.IdentifierToken, 4433SyntaxToken semicolon = null; 4487private SyntaxToken EatAccessorSemicolon() 4493private static SyntaxKind GetAccessorKind(SyntaxToken accessorName) 4513var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken); 4524var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); 4585out SyntaxToken open, 4586out SyntaxToken close, 4611LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 4700SyntaxToken identifier; 4719var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 4729internal static bool NoTriviaBetween(SyntaxToken token1, SyntaxToken token2) 4734private static bool IsParameterModifierExcludingScoped(SyntaxToken token) 4766SyntaxToken scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter); 4806var eventToken = this.EatToken(); 4817SyntaxToken eventToken, 4821SyntaxToken identifierOrThisOpt; 4847SyntaxToken identifier; 4878SyntaxToken semicolon = null; 4909var semi = this.EatToken(); 4926if (modifiers is [.., SyntaxToken { Kind: SyntaxKind.ScopedKeyword } scopedKeyword]) 4942SyntaxToken eventToken, 5019SyntaxList<SyntaxToken> mods, 5206SyntaxList<SyntaxToken> mods, 5277var missingIdentifier = CreateMissingIdentifierToken(); 5295var name = this.ParseIdentifierToken(); 5322var equals = this.EatToken(); 5325var refKeyword = isLocalOrField && !isConst && this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 5393args.AddSeparator((SyntaxToken)item); 5497var delegateToken = this.EatToken(SyntaxKind.DelegateKeyword); 5501var name = this.ParseIdentifierToken(); 5530var enumToken = this.EatToken(SyntaxKind.EnumKeyword); 5531var name = this.ParseIdentifierToken(); 5545var colon = this.EatToken(SyntaxKind.ColonToken); 5555SyntaxToken semicolon; 5556SyntaxToken openBrace; 5557SyntaxToken closeBrace; 5601LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<EnumMemberDeclarationSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 5618var memberName = this.ParseIdentifierToken(); 5654private static SyntaxToken CreateMissingIdentifierToken() 5696private bool IsTrueIdentifier(SyntaxToken token) 5717private SyntaxToken ParseIdentifierToken(ErrorCode code = ErrorCode.ERR_IdentifierExpected) 5730var result = CreateMissingIdentifierToken(); 5735SyntaxToken identifierToken = this.EatToken(); 5785var open = this.EatToken(SyntaxKind.LessThanToken); 5804LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<TypeParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 5880this.ParseTypeArgumentList(out var open, types, out var close); 5934out var greaterThanToken, out bool isDefinitelyTypeArgumentList); 6030out SyntaxToken greaterThanToken, 6043var start = this.EatToken(); 6218private void ParseTypeArgumentList(out SyntaxToken open, SeparatedSyntaxListBuilder<TypeSyntax> types, out SyntaxToken close) 6291static bool tokenBreaksTypeArgumentList(SyntaxToken token) 6436out SyntaxToken identifierOrThisOpt, 6452SyntaxToken separator = null; 6572private void AccumulateExplicitInterfaceName(ref NameSyntax explicitInterfaceName, ref SyntaxToken separator) 6634SyntaxToken separator = null; 6721var separator = this.EatToken(); 6731SyntaxToken separator) 6773private SyntaxToken ConvertToMissingWithTrailingTrivia(SyntaxToken token, SyntaxKind expectedKind) 6775var newToken = SyntaxFactory.MissingToken(expectedKind); 6843private ScanTypeFlags ScanType(out SyntaxToken lastTokenOfType, bool forPattern = false) 6853private ScanTypeFlags ScanNamedTypePart(out SyntaxToken lastTokenOfType) 6872private ScanTypeFlags ScanType(ParseTypeMode mode, out SyntaxToken lastTokenOfType) 7046private ScanTypeFlags ScanTupleType(out SyntaxToken lastTokenOfType) 7090private ScanTypeFlags ScanFunctionPointerType(out SyntaxToken lastTokenOfType) 7100var peek1 = PeekToken(1); 7160var ignoredModifiers = _pool.Allocate<SyntaxToken>(); 7298var question = TryEatNullableQualifierIfApplicable(type, mode); 7360private SyntaxToken TryEatNullableQualifierIfApplicable( 7374var questionToken = this.EatToken(); 7452var nextToken = PeekToken(1); 7542var open = this.EatToken(SyntaxKind.OpenBracketToken); 7604var open = this.EatToken(SyntaxKind.OpenParenToken); 7643private PostSkipAction SkipBadArrayRankSpecifierTokens(ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expected) 7656var token = this.EatToken(); 7689var @delegate = EatToken(SyntaxKind.DelegateKeyword); 7690var asterisk = EatToken(SyntaxKind.AsteriskToken); 7696var lessThanTokenError = WithAdditionalDiagnostics(SyntaxFactory.MissingToken(SyntaxKind.LessThanToken), GetExpectedTokenError(SyntaxKind.LessThanToken, SyntaxKind.None)); 7714var lessThanToken = EatTokenAsKind(SyntaxKind.LessThanToken); 7723var modifiers = _pool.Allocate<SyntaxToken>(); 7773SyntaxToken managedSpecifier; 7774SyntaxToken peek1 = PeekToken(1); 7801var openBracket = EatToken(SyntaxKind.OpenBracketToken); 7821var closeBracket = EatToken(SyntaxKind.CloseBracketToken); 7849private static bool IsPossibleFunctionPointerParameterListStart(SyntaxToken token) 8251var token1 = PeekToken(1); 8371SyntaxToken identifierOrThisOpt; 8534SyntaxToken nextToken = PeekToken(1); 8615private bool? IsPossibleTypedIdentifierStart(SyntaxToken current, SyntaxToken next, bool allowThisKeyword) 8689(SyntaxToken)openBrace, 8720(SyntaxToken)openBrace, 8854var @fixed = this.EatToken(SyntaxKind.FixedKeyword); 8855var openParen = this.EatToken(SyntaxKind.OpenParenToken); 8939var @try = this.EatToken(SyntaxKind.TryKeyword); 9014var @catch = this.EatToken(); 9021var openParen = this.EatToken(); 9025SyntaxToken name = null; 9033var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9042var whenKeyword = this.EatContextualToken(SyntaxKind.WhenKeyword); 9054var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9058var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9102var keyword = this.EatToken(); 9113var @do = this.EatToken(SyntaxKind.DoKeyword); 9115var @while = this.EatToken(SyntaxKind.WhileKeyword); 9116var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9179var forToken = this.EatToken(SyntaxKind.ForKeyword); 9180var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9183var firstSemicolonToken = eatCommaOrSemicolon(); 9189var secondSemicolonToken = eatCommaOrSemicolon(); 9266SyntaxToken eatCommaOrSemicolon() 9271SyntaxToken eatUnexpectedTokensAndCloseParenToken() 9278var result = this.EatToken(SyntaxKind.CloseParenToken); 9285SeparatedSyntaxList<ExpressionSyntax> parseForStatementExpressionList(ref SyntaxToken startToken, bool allowSemicolonAsSeparator) 9297LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 9315SyntaxList<AttributeListSyntax> attributes, SyntaxToken awaitTokenOpt) 9325SyntaxToken @foreach; 9331var skippedForToken = this.EatToken(); 9340var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9343var @in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected); 9350var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9358SyntaxToken identifier; 9368identifier = SyntaxToken.WithValue(SyntaxKind.IdentifierToken, discard.LeadingTrivia.Node, discard.Text, discard.ValueText, discard.TrailingTrivia.Node); 9466SyntaxToken lastTokenOfType; 9537var @goto = this.EatToken(SyntaxKind.GotoKeyword); 9539SyntaxToken caseOrDefault = null; 9570var stack = ArrayBuilder<(SyntaxToken, SyntaxToken, ExpressionSyntax, SyntaxToken, StatementSyntax, SyntaxToken)>.GetInstance(); 9575var ifKeyword = this.EatToken(SyntaxKind.IfKeyword); 9576var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9578var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9581var elseKeyword = this.CurrentToken.Kind != SyntaxKind.ElseKeyword ? 9680var yieldToken = ConvertToKeyword(this.EatToken()); 9681SyntaxToken returnOrBreak; 9717parseSwitchHeader(out var switchKeyword, out var openParen, out var expression, out var closeParen, out var openBrace); 9734out SyntaxToken switchKeyword, 9735out SyntaxToken openParen, 9737out SyntaxToken closeParen, 9738out SyntaxToken openBrace) 9802var caseKeyword = this.EatToken(); 9880private UsingStatementSyntax ParseUsingStatement(SyntaxList<AttributeListSyntax> attributes, SyntaxToken awaitTokenOpt = null) 9882var @using = this.EatToken(SyntaxKind.UsingKeyword); 9883var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9921SyntaxToken scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false); 10037SyntaxToken awaitKeyword, usingKeyword; 10062SyntaxToken scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false); 10094if (attributes.Count == 0 && mods.Count > 0 && IsAccessibilityModifier(((SyntaxToken)mods[0]).ContextualKind)) 10112var mod = (SyntaxToken)mods[i]; 10135private SyntaxToken ParsePossibleScopedKeyword(bool isFunctionPointerParameter) 10141SyntaxToken scopedKeyword = this.EatContextualToken(SyntaxKind.ScopedKeyword); 10174var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10247VariableFlags initialFlags, SyntaxToken? scopedKeyword) 10273SyntaxList<SyntaxToken> mods, 10274SyntaxToken? scopedKeyword, 10329SyntaxToken mod; 10448SyntaxList<SyntaxToken> modifiers, 10450SyntaxToken identifier) 10475var modifier = modifiers[i]; 10538SyntaxToken semicolon; 10571SyntaxToken semicolon; 10914var next = PeekToken(1); 11106var operatorToken = eatOperatorToken(operatorTokenKind); 11185var token1 = this.CurrentToken; 11239SyntaxToken eatOperatorToken(SyntaxKind operatorTokenKind) 11251var token1 = EatToken(); 11252var token2 = EatToken(); 11264var token1 = EatToken(); 11266var token3 = EatToken(); 11289var questionToken = this.EatToken(); 11378public static bool IsAtDotDotToken(SyntaxToken token1, SyntaxToken token2) 11386public SyntaxToken EatDotDotToken() 11389var token1 = this.EatToken(); 11390var token2 = this.EatToken(); 11392var dotDotToken = SyntaxFactory.Token(token1.GetLeadingTrivia(), SyntaxKind.DotDotToken, token2.GetTrailingTrivia()); 11424var scopedKeyword = isScoped 11441private ExpressionSyntax ParseIsExpression(ExpressionSyntax leftOperand, SyntaxToken opToken) 11582var refKeyword = this.EatToken(); 11795var nextToken = this.PeekToken(1); 11896openToken: out SyntaxToken openToken, 11898closeToken: out SyntaxToken closeToken, 11912openToken: out SyntaxToken openToken, 11914closeToken: out SyntaxToken closeToken, 11921out SyntaxToken openToken, 11923out SyntaxToken closeToken, 11991LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 12034SyntaxToken refKindKeyword = null; 12080var keyword = this.EatToken(); 12124var checkedOrUnchecked = this.EatToken(); 12167var tk = this.PeekToken(curTk++); 12216var token1 = this.PeekToken(1); 12224var token2 = this.PeekToken(2); 12283var identifier = this.IsTrueIdentifier() ? this.EatToken() : CreateMissingIdentifierToken(); 12285var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 12343var openParen = this.EatToken(SyntaxKind.OpenParenToken); 12371private TupleExpressionSyntax ParseTupleExpressionTail(SyntaxToken openParen, ArgumentSyntax firstArg) 12536var token1 = this.PeekToken(1); 12739var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 12756LanguageParser @this, ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<CollectionElementSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 12785var @new = this.EatToken(SyntaxKind.NewKeyword); 12789var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 12839SyntaxToken @new = this.EatToken(SyntaxKind.NewKeyword); 12912private WithExpressionSyntax ParseWithExpression(ExpressionSyntax receiverExpression, SyntaxToken withKeyword) 12914var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 12939var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13013LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13046var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13073var @new = this.EatToken(SyntaxKind.NewKeyword); 13074var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13113var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13131LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13149var @stackalloc = this.EatToken(SyntaxKind.StackAllocKeyword); 13150var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13208var @delegate = this.EatToken(SyntaxKind.DelegateKeyword); 13227var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13249private SyntaxList<SyntaxToken> ParseAnonymousFunctionModifiers() 13348var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13358var identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13363var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13381var openParen = this.EatToken(SyntaxKind.OpenParenToken); 13403LanguageParser @this, ref SyntaxToken openParen, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13453var identifier = this.ParseIdentifierToken(); 13456var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 13498var peek1 = this.PeekToken(1); 13515private static bool IsTokenQueryContextualKeyword(SyntaxToken token) 13535private static bool IsTokenStartOfNewQueryClause(SyntaxToken token) 13677var @from = this.EatContextualToken(SyntaxKind.FromKeyword); 13683SyntaxToken name; 13748var @orderby = this.EatContextualToken(SyntaxKind.OrderByKeyword); 13793SyntaxToken direction = null; 13889LanguageParser parser, ref SyntaxToken openToken, SeparatedSyntaxListBuilder<TNode> builder, SyntaxKind expectedKind, SyntaxKind closeTokenKind) where TNode : GreenNode; 13921ref SyntaxToken openToken, 13943ref SyntaxToken openToken, 14119SyntaxListBuilder<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; 2490private SyntaxToken LexDirectiveToken() 2503var token = Create(in info, null, directiveTriviaCache, errors); 2509public SyntaxToken LexEndOfDirectiveWithOptionalPreprocessingMessage() 2546var endOfDirective = SyntaxFactory.Token(leading, SyntaxKind.EndOfDirectiveToken, trailing); 2826private SyntaxToken LexXmlToken() 3182private SyntaxToken LexXmlElementTagToken() 3197SyntaxToken? token = DocumentationCommentXmlTokens.LookupToken(tagInfo.Text, leading); 3368private SyntaxToken LexXmlAttributeTextToken() 3521private SyntaxToken LexXmlCharacter() 3577private SyntaxToken LexXmlCrefOrNameToken() 3990private SyntaxToken LexXmlCDataSectionTextToken() 4112private SyntaxToken LexXmlCommentTextToken() 4242private 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(); 900var oldToken = node as SyntaxToken ?? node.GetFirstToken(); 901var newToken = AddSkippedSyntax(oldToken, skippedSyntax, trailing: false); 919var token = node as SyntaxToken; 926var lastToken = node.GetLastToken(); 927var newToken = AddSkippedSyntax(lastToken, skippedSyntax, trailing: true); 936internal SyntaxToken AddSkippedSyntax(SyntaxToken target, GreenNode skippedSyntax, bool trailing) 949SyntaxToken token = node as SyntaxToken; 957SyntaxToken tk = token.TokenWithLeadingTrivia(null).TokenWithTrailingTrivia(null); 1096protected static SyntaxToken ConvertToKeyword(SyntaxToken token) 1115protected static SyntaxToken ConvertToIdentifier(SyntaxToken token) 1119var 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);