当前位置: 首页>>代码示例>>C#>>正文


C# SyntaxToken.ToFullString方法代码示例

本文整理汇总了C#中SyntaxToken.ToFullString方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxToken.ToFullString方法的具体用法?C# SyntaxToken.ToFullString怎么用?C# SyntaxToken.ToFullString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SyntaxToken的用法示例。


在下文中一共展示了SyntaxToken.ToFullString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetKeywordTooltip


//.........这里部分代码省略.........
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to modify a declaration of a field or local variable. It specifies that the value of the field or the local variable cannot be modified.", Highlight ("const", colorStyle.KeywordModifiers));
				break;
			case SyntaxKind.ContinueKeyword:
				result.SignatureMarkup = Highlight ("continue", colorStyle.KeywordJump) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), Highlight ("continue", colorStyle.KeywordJump) + ";");
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} statement passes control to the next iteration of the enclosing iteration statement in which it appears.", Highlight ("continue", colorStyle.KeywordJump));
				break;
			case SyntaxKind.DefaultKeyword:
				result.SignatureMarkup = Highlight ("default", colorStyle.KeywordSelection) + keywordSign;
				result.SummaryMarkup = "";
				if (node.Parent != null) {
					if (node.Parent is DefaultExpressionSyntax) {
						result.AddCategory (GettextCatalog.GetString ("Form"),
						                    GettextCatalog.GetString ("{0} (Type)", Highlight ("default", colorStyle.KeywordSelection)));
						break;
					} else if (node.Parent is SwitchStatementSyntax) {
						result.AddCategory (GettextCatalog.GetString ("Form"),
						                    GettextCatalog.GetString ("{0} (expression) { \n  {1} constant-expression:\n    statement\n    jump-statement\n  [{2}:\n    statement\n    jump-statement]\n}",
						                    Highlight ("switch", colorStyle.KeywordSelection), Highlight ("case", colorStyle.KeywordSelection), Highlight ("default", colorStyle.KeywordSelection)));
						break;
					}
				}
				result.AddCategory (GettextCatalog.GetString ("Form"),
						            GettextCatalog.GetString ("{0} (Type)\n\nor\n\n{1} (expression) { \n  {2} constant-expression:\n    statement\n    jump-statement\n  [{3}:\n    statement\n    jump-statement]\n}", 
						                                      Highlight ("default", colorStyle.KeywordSelection), Highlight ("switch", colorStyle.KeywordSelection), Highlight ("case", colorStyle.KeywordSelection), Highlight ("default", colorStyle.KeywordSelection))
						           );
				break;
			case SyntaxKind.DelegateKeyword:
				result.SignatureMarkup = Highlight ("delegate", colorStyle.KeywordDeclaration) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("[attributes] [modifiers] {0} result-type identifier ([formal-parameters]);", Highlight ("delegate", colorStyle.KeywordDeclaration)));
				result.SummaryMarkup = GettextCatalog.GetString ("A {0} declaration defines a reference type that can be used to encapsulate a method with a specific signature.", Highlight ("delegate", colorStyle.KeywordDeclaration));
				break;
			case SyntaxKind.IdentifierToken:
				if (node.ToFullString () == "nameof" && node.Parent?.Parent?.Kind () == SyntaxKind.InvocationExpression)
					goto case SyntaxKind.NameOfKeyword;

				if (node.ToFullString () == "dynamic") {
					result.SignatureMarkup = Highlight ("dynamic", colorStyle.KeywordContext) + keywordSign;
					result.SummaryMarkup = GettextCatalog.GetString ("The {0} type allows for an object to bypass compile-time type checking and resolve type checking during run-time.", Highlight ("dynamic", colorStyle.KeywordContext));
				} else {
					return null;
				}
				break;
			case SyntaxKind.DescendingKeyword:
				result.SignatureMarkup = Highlight ("descending", colorStyle.KeywordContext) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Query Form"), GettextCatalog.GetString ("{0} ordering-statement {1}", Highlight ("orderby", colorStyle.KeywordContext), Highlight ("descending", colorStyle.KeywordContext)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to set the sorting order from largest to smallest in a query expression.", Highlight ("descending", colorStyle.KeywordContext));
				break;
			case SyntaxKind.DoKeyword:
				result.SignatureMarkup = Highlight ("do", colorStyle.KeywordIteration) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("{0} statement {1} (expression);", Highlight ("do", colorStyle.KeywordIteration), Highlight ("while", colorStyle.KeywordIteration)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} statement executes a statement or a block of statements repeatedly until a specified expression evaluates to false.", Highlight ("do", colorStyle.KeywordIteration));
				break;
			case SyntaxKind.ElseKeyword:
				result.SignatureMarkup = Highlight ("else", colorStyle.KeywordSelection) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("{0} (expression)\n  statement1\n  [{1}\n  statement2]", Highlight ("if", colorStyle.KeywordSelection), Highlight ("else", colorStyle.KeywordSelection)));
				result.SummaryMarkup = "";
				break;
			case SyntaxKind.EnumKeyword:
				result.SignatureMarkup = Highlight ("enum", colorStyle.KeywordDeclaration) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("[attributes] [modifiers] {0} identifier [:base-type] {{ enumerator-list }} [;]", Highlight ("enum", colorStyle.KeywordDeclaration)));
				result.SummaryMarkup = GettextCatalog.GetString ("The {0} keyword is used to declare an enumeration, a distinct type consisting of a set of named constants called the enumerator list.", Highlight ("enum", colorStyle.KeywordDeclaration));
				break;
			case SyntaxKind.EventKeyword:
				result.SignatureMarkup = Highlight ("event", colorStyle.KeywordModifiers) + keywordSign;
				result.AddCategory (GettextCatalog.GetString ("Form"), GettextCatalog.GetString ("[attributes] [modifiers] {0} type declarator;\n[attributes] [modifiers] {0} type member-name {{ accessor-declarations }};", Highlight ("event", colorStyle.KeywordModifiers)));
开发者ID:kdubau,项目名称:monodevelop,代码行数:67,代码来源:SignatureMarkupCreator.cs

示例2: HandleWhitespaceToken

        private static void HandleWhitespaceToken(SyntaxTreeAnalysisContext context, SyntaxToken token)
        {
            string fullString = token.ToFullString();
            if (fullString.IndexOf('\t') < 0)
            {
                // No hard tabs were found.
                return;
            }

            // Tabs must not be used.
            context.ReportDiagnostic(Diagnostic.Create(Descriptor, token.GetLocation()));
        }
开发者ID:umaranis,项目名称:StyleCopAnalyzers,代码行数:12,代码来源:SA1027TabsMustNotBeUsed.cs

示例3: GetConstraintTooltip

		public TooltipInformation GetConstraintTooltip (SyntaxToken keyword)
		{
			var result = new TooltipInformation ();

			var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha);
			var colorString = MonoDevelop.Components.HelperMethods.GetColorString (color);

			var keywordSign = "<span foreground=\"" + colorString + "\"> " + GettextCatalog.GetString ("(keyword)") + "</span>";

			result.SignatureMarkup = Highlight (keyword.ToFullString (), colorStyle.KeywordTypes) + keywordSign;

			switch (keyword.Parent.Kind ()) {
			case SyntaxKind.ClassConstraint:
				result.AddCategory (GettextCatalog.GetString ("Constraint"), GettextCatalog.GetString ("The type argument must be a reference type; this applies also to any class, interface, delegate, or array type."));
				break;
			case SyntaxKind.ConstructorConstraint:
				result.AddCategory (GettextCatalog.GetString ("Constraint"), GettextCatalog.GetString ("The type argument must have a public parameterless constructor. When used together with other constraints, the new() constraint must be specified last."));
				break;
			case SyntaxKind.StructConstraint:
				result.AddCategory (GettextCatalog.GetString ("Constraint"), GettextCatalog.GetString ("The type argument must be a value type. Any value type except Nullable can be specified. See Using Nullable Types (C# Programming Guide) for more information."));
				break;
			}

			return result;
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:25,代码来源:SignatureMarkupCreator.cs

示例4: VisitToken

 public override void VisitToken(SyntaxToken token) => Add(token.ToFullString(), _scriptCode);
开发者ID:ibebbs,项目名称:Wyam,代码行数:1,代码来源:LiftingWalker.cs


注:本文中的SyntaxToken.ToFullString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。