コード例 #1
0
ファイル: MainForm.cs プロジェクト: windcatcher/SharpDevelop
 /// <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();
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Rpinski/SharpDevelop
		/// <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();
			}			
		}