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


C# CSharpOutputVisitor类代码示例

本文整理汇总了C#中CSharpOutputVisitor的典型用法代码示例。如果您正苦于以下问题:C# CSharpOutputVisitor类的具体用法?C# CSharpOutputVisitor怎么用?C# CSharpOutputVisitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ToText

		public static string ToText(AbstractNode node)
		{
			var output = new CSharpOutputVisitor();
			node.AcceptVisitor(output, null);

			return output.Text;
		}
开发者ID:iamnilay3,项目名称:ravendb,代码行数:7,代码来源:QueryParsingUtils.cs

示例2: GenerateText

		public static string GenerateText(TypeDeclaration type, OrderedPartCollection<AbstractDynamicCompilationExtension> extensions)
		{
			var unit = new CompilationUnit();

			var namespaces = new HashSet<string>
			{
				typeof (SystemTime).Namespace,
				typeof (AbstractViewGenerator).Namespace,
				typeof (Enumerable).Namespace,
				typeof (IEnumerable<>).Namespace,
				typeof (IEnumerable).Namespace,
				typeof (int).Namespace,
				typeof (LinqOnDynamic).Namespace,
				typeof(Field).Namespace,
			};
			foreach (var extension in extensions)
			{
				foreach (var ns in extension.Value.GetNamespacesToImport())
				{
					namespaces.Add(ns);
				}
			}

			foreach (var ns in namespaces)
			{
				unit.AddChild(new Using(ns));
			}

			unit.AddChild(type);
			var output = new CSharpOutputVisitor();
			unit.AcceptVisitor(output, null);

			return output.Text;
		}
开发者ID:iamnilay3,项目名称:ravendb,代码行数:34,代码来源:QueryParsingUtils.cs

示例3: rewriteCode_CSharp

 public void rewriteCode_CSharp(CompilationUnit unit, IList<ISpecial> specials)
 {        	
     var outputVisitor  = new CSharpOutputVisitor();    		
     using (SpecialNodesInserter.Install(specials, outputVisitor)) {
         unit.AcceptVisitor(outputVisitor, null);
     }
     //codeTextBox.Text = outputVisitor.Text.Replace("\t", "  ");
     CSharpCode = outputVisitor.Text;
 }
开发者ID:pusp,项目名称:o2platform,代码行数:9,代码来源:AstDetails.cs

示例4: OutputNode

		public string OutputNode (ProjectDom dom, INode node, string indent)
		{
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor ();
			CSharpFormatter.SetFormatOptions (outputVisitor, dom != null && dom.Project != null ? dom.Project.Policies : null);
			int col = CSharpFormatter.GetColumn (indent, 0, 4);
			outputVisitor.OutputFormatter.IndentationLevel = System.Math.Max (0, col / 4);
			node.AcceptVisitor (outputVisitor, null);
			return outputVisitor.Text;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:9,代码来源:CSharpNRefactoryASTProvider.cs

示例5: GenerateParams

		protected string GenerateParams(Type eventType, bool paramNames)
		{
			CSharpOutputVisitor v = new CSharpOutputVisitor();
			MethodDeclaration md = ConvertEventInvokeMethodToNRefactory(CurrentClassPart, eventType, "name");
			if (md != null) {
				v.AppendCommaSeparatedList(md.Parameters);
			}
			return v.Text;
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:9,代码来源:CSharpDesignerGenerator.cs

示例6: TestProgram

		void TestProgram(string program)
		{
			IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
			parser.Parse();
			Assert.AreEqual("", parser.Errors.ErrorOutput);
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
			outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
			Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
			Assert.AreEqual(StripWhitespace(program), StripWhitespace(outputVisitor.Text));
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:10,代码来源:CSharpOutputTest.cs

示例7: GenerateCode

		protected override string GenerateCode(INode unit, bool installSpecials)
		{
			CSharpOutputVisitor visitor = new CSharpOutputVisitor();
			
			if (installSpecials) {
				SpecialNodesInserter.Install(this.specialsList, visitor);
			}
			
			unit.AcceptVisitor(visitor, null);
			return visitor.Text;
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:11,代码来源:CSharpMethodExtractor.cs

示例8: TestProgram

		public void TestProgram(string input, string expectedOutput)
		{
			IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(input));
			parser.Parse();
			Assert.AreEqual("", parser.Errors.ErrorOutput);
			parser.CompilationUnit.AcceptVisitor(new VBNetToCSharpConvertVisitor(), null);
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
			outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
			Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
			Assert.AreEqual(expectedOutput, outputVisitor.Text);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:VBToCSharpConverterTest.cs

示例9: TestExpression

		void TestExpression(string expression)
		{
			// SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly
			IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(expression + ";"));
			Expression e = parser.ParseExpression();
			Assert.AreEqual("", parser.Errors.ErrorOutput);
			Assert.IsNotNull(e, "ParseExpression returned null");
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
			e.AcceptVisitor(outputVisitor, null);
			Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
			Assert.AreEqual(StripWhitespace(expression), StripWhitespace(outputVisitor.Text));
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:12,代码来源:CSharpOutputTest.cs

示例10: GenerateCode

        private static string GenerateCode(INode unit/*, bool installSpecials*/)
        {
            CSharpOutputVisitor visitor = new CSharpOutputVisitor();

            //			if (installSpecials)
            //			{
            //				SpecialNodesInserter.Install(this.specialsList, visitor);
            //			}

            unit.AcceptVisitor(visitor, null);
            return visitor.Text;
        }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:12,代码来源:INodeExt.cs

示例11: csharpCode

 public static string csharpCode(this INode iNode)
 {
     try
     {
         var outputVisitor = new CSharpOutputVisitor();
         iNode.AcceptVisitor(outputVisitor, null);
         return outputVisitor.Text;
     }
     catch (Exception ex)
     {
         ex.log("in CSharpSourceCode_ExtensionMethods.csharpCode");
         return "error creating source code for iNode. Error message was: ".format(ex.Message) ;
     }
 }
开发者ID:CallMeSteve,项目名称:FluentSharp,代码行数:14,代码来源:CSharpSourceCode_ExtensionMethods.cs

示例12: GenerateText

        public static string GenerateText(TypeDeclaration type)
        {
            var unit = new CompilationUnit();
            unit.AddChild(new Using(typeof (AbstractViewGenerator).Namespace));
            unit.AddChild(new Using(typeof (Enumerable).Namespace));
            unit.AddChild(new Using(typeof (int).Namespace));
            unit.AddChild(new Using(typeof (LinqOnDynamic).Namespace));
            unit.AddChild(type);

            var output = new CSharpOutputVisitor();
            unit.AcceptVisitor(output, null);

            return output.Text;
        }
开发者ID:kenegozi,项目名称:ravendb,代码行数:14,代码来源:QueryParsingUtils.cs

示例13: TestProgram

		public void TestProgram(string input, string expectedOutput)
		{
			IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(input));
			parser.Parse();
			Assert.AreEqual("", parser.Errors.ErrorOutput);
			parser.CompilationUnit.AcceptVisitor(new VBNetConstructsConvertVisitor(), null);
			parser.CompilationUnit.AcceptVisitor(new ToCSharpConvertVisitor(), null);
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
			outputVisitor.Options.IndentationChar = ' ';
			outputVisitor.Options.IndentSize = 2;
			outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
			Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
			Assert.AreEqual(expectedOutput.Replace("\r", ""), outputVisitor.Text.Replace("\r", ""));
		}
开发者ID:sharpmonkey,项目名称:SharpDevelop,代码行数:14,代码来源:VBNetToCSharpConverterTest.cs

示例14: TestProgram

		void TestProgram(string program)
		{
			IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
			parser.Parse();
			Assert.AreEqual("", parser.Errors.ErrorOutput);
			CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
			using (SpecialNodesInserter.Install(parser.Lexer.SpecialTracker.RetrieveSpecials(),
			                                    outputVisitor)) {
				outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
			}
			Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
			Assert.AreEqual(program.Replace("\r", ""), outputVisitor.Text.TrimEnd().Replace("\r", ""));
			parser.Dispose();
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:14,代码来源:SpecialOutputVisitor.cs

示例15: Main

		static int Main(string[] args)
		{
			File.Delete("conversion.log");
			
			try {
				List<string> map = new List<string>()
				{
					"..\\Controller\\Profiler",
					"..\\Controller\\Data\\UnmanagedCallTreeNode",
					"..\\Controller\\structs"
				};

				foreach (string path in map)
				{
					using (IParser parser = ParserFactory.CreateParser(path + ".cs"))
					{
						parser.Parse();

						if (parser.Errors.Count > 0)
						{
							string message = "Parser errors in file " + path + ":\n" + parser.Errors.ErrorOutput;
							Console.WriteLine(message);
							File.WriteAllText(path + "64.cs", message);
							return 2;
						}
						
						var specials = parser.Lexer.SpecialTracker.RetrieveSpecials().Where(item => item is PreprocessingDirective);
						
						parser.CompilationUnit.AcceptVisitor(new Converter(), null);
						CSharpOutputVisitor output = new CSharpOutputVisitor();
						SpecialNodesInserter.Install(specials, output);
						parser.CompilationUnit.AcceptVisitor(output, null);

						if (!File.Exists(path + "64.cs") || File.ReadAllText(path + "64.cs") != output.Text) {
							File.WriteAllText(path + "64.cs", output.Text);
						}
					}
				}

				return 0;
			} catch (Exception e) {
				File.WriteAllText("conversion.log", e.ToString());
				return -1;
			}
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:45,代码来源:Program.cs


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