[Monodevelop-patches-list] r2559 - in trunk/MonoDevelop/Extras/BooBinding: . Parser

Peter Johanson <latexer@gentoo.org> pjohanson at mono-cvs.ximian.com
Tue May 24 12:07:24 EDT 2005


Author: pjohanson
Date: 2005-05-24 12:07:24 -0400 (Tue, 24 May 2005)
New Revision: 2559

Modified:
   trunk/MonoDevelop/Extras/BooBinding/ChangeLog
   trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
   trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
Log:
Impelement a basic 'parser cache' to be used in the case of parsing errors in files. Also cull out compiler generated fields.


Modified: trunk/MonoDevelop/Extras/BooBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-23 15:43:57 UTC (rev 2558)
+++ trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-24 16:07:24 UTC (rev 2559)
@@ -1,3 +1,12 @@
+2005-05-24  Peter Johanson <latexer at gentoo.org>
+
+	* Parser/Visitor.boo: Cull out compiler
+	generated fields, and note if errors occured
+	before this visitor and return immediate if so.
+	* Parser/BooParser.boo: Keep a cache of successful
+	parser results, and return those for any files that
+	error out due to syntax errors, etc.
+
 2005-05-22  Peter Johanson <latexer at gentoo.org>
 
 	* Parser/Resolver.boo: More cleanups,

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-05-23 15:43:57 UTC (rev 2558)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-05-24 16:07:24 UTC (rev 2559)
@@ -39,6 +39,8 @@
 
 class BooParser(IParser):
 	private _lexerTags as (string)
+
+	private cuCache = Hashtable()
 	
 	LexerTags as (string):
 		get:
@@ -125,6 +127,13 @@
 			if c.Region is not null:
 				c.Region.FileName = fileName
 
+		// The following returns the "last known good" parse results
+		// for a given file. Keeps our parse info from disappearing
+		// when there is a parsing error in a file.
+		if visitor.HadErrors:
+			return cuCache[fileName] as ICompilationUnitBase
+		
+		cuCache[fileName] = visitor.Cu
 		return visitor.Cu
 	
 	def CtrlSpace(parserService as IParserService, project as Project, caretLine as int, caretColumn as int, fileName as string) as ArrayList:

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo	2005-05-23 15:43:57 UTC (rev 2558)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo	2005-05-24 16:07:24 UTC (rev 2559)
@@ -43,9 +43,17 @@
 	
 	_currentClass as Stack = Stack()
 	_firstModule = true
+
+	[Getter(HadErrors)]
+	_hadErrors = false
 	
 	override def Run():
-		//print "RUN"
+		// If we've had errors up to this point, note it and return
+		// immediately.
+		if Errors is not null and Errors.Count > 0:
+			_hadErrors = true
+			return
+
 		try:
 			Visit(CompileUnit)
 		except e:
@@ -227,6 +235,9 @@
 	override def OnField(node as AST.Field):
 		try:
 			//print "Field ${node.Name}"
+			if node.Name.StartsWith("___"):
+				return
+
 			c as Class = _currentClass.Peek()
 			field = Field(ReturnType.CreateReturnType(node), node.Name, GetModifier(node), GetRegion(node))
 			field.Documentation = node.Documentation




More information about the Monodevelop-patches-list mailing list