Ejemplo n.º 1
0
 /// <summary>
 /// Converts C# to python using the code dom generated by the
 /// NRefactory parser.
 /// </summary>
 void RunNRefactoryCSharpCodeDomVisitorClick(object sender, EventArgs e)
 {
     try {
         Clear();
         using (NRefactory.IParser parser = NRefactory.ParserFactory.CreateParser(NRefactory.SupportedLanguage.CSharp, new StringReader(codeTextBox.Text))) {
             parser.ParseMethodBodies = false;
             parser.Parse();
             NRefactory.Visitors.CodeDomVisitor visitor = new NRefactory.Visitors.CodeDomVisitor();
             visitor.VisitCompilationUnit(parser.CompilationUnit, null);
             CodeDomVisitor codeDomVisitor = new CodeDomVisitor(this);
             codeDomVisitor.Visit(visitor.codeCompileUnit);
         }
     } catch (Exception ex) {
         walkerOutputTextBox.Text = ex.ToString();
     }
 }
Ejemplo n.º 2
0
		/// <summary>
		/// Converts C# to python using the code dom generated by the
		/// NRefactory parser.
		/// </summary>
		void RunNRefactoryCSharpCodeDomVisitorClick(object sender, EventArgs e)
		{
			try {
				Clear();
				using (NRefactory.IParser parser = NRefactory.ParserFactory.CreateParser(NRefactory.SupportedLanguage.CSharp, new StringReader(codeTextBox.Text))) {
					parser.ParseMethodBodies = false;
					parser.Parse();
					NRefactory.Visitors.CodeDomVisitor visitor = new NRefactory.Visitors.CodeDomVisitor();
					visitor.VisitCompilationUnit(parser.CompilationUnit, null);
					CodeDomVisitor codeDomVisitor = new CodeDomVisitor(this);
					codeDomVisitor.Visit(visitor.codeCompileUnit);					
				}
			} catch (Exception ex) {
				walkerOutputTextBox.Text = ex.ToString();
			}			
		}