[Monodevelop-patches-list] r2232 - trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Feb 4 11:55:59 EST 2005


Author: jluke
Date: 2005-02-04 11:55:59 -0500 (Fri, 04 Feb 2005)
New Revision: 2232

Added:
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/parse.cs
Modified:
   trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am
Log:
add parsing tester


Modified: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am	2005-02-04 09:16:23 UTC (rev 2231)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/Makefile.am	2005-02-04 16:55:59 UTC (rev 2232)
@@ -1,4 +1,5 @@
 ASSEMBLY = CSharpBinding.dll
+PARSE = parse.exe
 
 DLLS = /r:System.Drawing.dll \
 	/r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \
@@ -85,13 +86,21 @@
 		$(build_sources) \
 	&& cp $(ASSEMBLY) $(ADDIN_BUILD)/.
 
+parse: $(PARSE)
+
+$(PARSE): parse.cs $(ASSEMBLY)
+	$(CSC) -out:$@ parse.cs $(DLLS) -r:../../../../../build/AddIns/BackendBindings/$(ASSEMBLY)
+
+run-parse-test:
+	MONO_PATH=../../../../../build/AddIns/BackendBindings/:../../../../../build/bin/ mono $(PARSE) .
+
 csharpbindinglibdir = $(libdir)/monodevelop/AddIns/BackendBindings
 csharpbindinglib_DATA = $(ASSEMBLY) $(ADDIN)
 
 templatesdir = $(csharpbindinglibdir)/templates
 templates_DATA = $(TEMPLATES)
 
-CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
+CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(PARSE) $(PARSE).mdb
 
 EXTRA_DIST = $(FILES) CSharp.glade $(ADDIN) $(TEMPLATES)
 

Added: trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/parse.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/parse.cs	2005-02-04 09:16:23 UTC (rev 2231)
+++ trunk/MonoDevelop/Core/src/AddIns/BackendBindings/CSharpBinding/parse.cs	2005-02-04 16:55:59 UTC (rev 2232)
@@ -0,0 +1,46 @@
+using System;
+using System.IO;
+
+using ICSharpCode.SharpRefactory.Parser;
+using CSharpBinding.Parser;
+
+// recurse a dir for .cs files
+// and print out parsing errors
+class parse
+{
+	static void Main (string[] args)
+	{
+		if (args.Length == 1 && Directory.Exists (args[0]))
+			new parse (args[0]);	
+		else
+			PrintUsage ();
+	}
+
+	static void PrintUsage ()
+	{
+		Console.WriteLine ("usage: parse.exe <dir>");
+	}
+
+	parse (string dir)
+	{
+		string[] files = Directory.GetFiles (dir, "*.cs");
+		if (files.Length < 1)
+			return;
+
+		Parser p = new Parser ();
+		Lexer lexer;
+
+		foreach (string f in files) {
+			lexer = new Lexer (new FileReader (f));
+			p.Parse (lexer);
+			CSharpVisitor v = new CSharpVisitor ();
+			v.Visit (p.compilationUnit, null);
+			v.Cu.ErrorsDuringCompile = p.Errors.count > 0;
+			if (v.Cu.ErrorsDuringCompile)
+				Console.WriteLine ("errors in parsing " + f);
+			foreach (ErrorInfo error in p.Errors.ErrorInformation)
+				Console.WriteLine (error.ToString ());
+		}
+	}
+}
+




More information about the Monodevelop-patches-list mailing list