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

Peter Johanson <latexer@gentoo.org> pjohanson at mono-cvs.ximian.com
Sun May 22 14:02:53 EDT 2005


Author: pjohanson
Date: 2005-05-22 14:02:53 -0400 (Sun, 22 May 2005)
New Revision: 2556

Modified:
   trunk/MonoDevelop/Extras/BooBinding/ChangeLog
   trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
   trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo
   trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
Log:
Various cleanups, and add support for events to the parser.


Modified: trunk/MonoDevelop/Extras/BooBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-22 09:34:12 UTC (rev 2555)
+++ trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-22 18:02:53 UTC (rev 2556)
@@ -1,3 +1,10 @@
+2005-05-22  Peter Johanson <latexer at gentoo.org>
+
+	* Parser/BooParser.boo:
+	* Parser/Resolver.boo: Various small cleanups
+	* Parser/Visitor.boo: Some small cleanups, and parse
+	events now as well.
+
 2005-05-21  Peter Johanson <latexer at gentoo.org>
 
 	* BooShellPadContent.cs: Make the pad placement

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-05-22 09:34:12 UTC (rev 2555)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/BooParser.boo	2005-05-22 18:02:53 UTC (rev 2556)
@@ -57,11 +57,6 @@
 		return project.ProjectType == BooBinding.BooLanguageBinding.LanguageName
 	
 	def Parse(fileName as string) as ICompilationUnitBase:
-		/*
-		compiler = BooCompiler()
-		compiler.Parameters.Input.Add(FileInput(fileName))
-		return Parse(fileName, compiler)
-		*/
 		content as string
 		using r = StreamReader(fileName):
 			content = r.ReadToEnd()

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo	2005-05-22 09:34:12 UTC (rev 2555)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Resolver.boo	2005-05-22 18:02:53 UTC (rev 2556)
@@ -128,11 +128,7 @@
 		elif member isa Property:
 			print "name: ${name}"
 			property as Property = member
-			/*
-			if property.ReturnType isa BooBinding.Parser.InferredReturnType:
-				print "Return type is an inferred, zapping it!"
-				return ReturnType("System.Object")
-				*/
+
 			return property.ReturnType if name == "value"
 			for para as IParameter in property.Parameters:
 				return para.ReturnType if para.Name == name

Modified: trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo	2005-05-22 09:34:12 UTC (rev 2555)
+++ trunk/MonoDevelop/Extras/BooBinding/Parser/Visitor.boo	2005-05-22 18:02:53 UTC (rev 2556)
@@ -78,7 +78,7 @@
 	private def GetRegion(m as AST.Node):
 		l = m.LexicalInfo
 		return null if (l.Line < 0)
-		return DefaultRegion(l.Line, 0 /*l.Column*/, l.Line, GetLineEnd(l.Line))
+		return DefaultRegion(l.Line - 1, 0 /*l.Column*/, l.Line, GetLineEnd(l.Line))
 	
 	private def GetClientRegion(m as AST.Node) as DefaultRegion:
 		l = m.LexicalInfo
@@ -99,7 +99,7 @@
 			l2 = m.EndSourceLocation
 		return null if l2 == null or l2.Line < 0 or l.Line == l2.Line
 		// TODO: use l.Column / l2.Column when the tab-bug has been fixed
-		return DefaultRegion(l.Line, GetLineEnd(l.Line), l2.Line, GetLineEnd(l2.Line))
+		return DefaultRegion(l.Line - 1, GetLineEnd(l.Line), l2.Line, GetLineEnd(l2.Line))
 	
 	override def OnImport(p as AST.Import):
 		u = Using()
@@ -189,7 +189,6 @@
 			if node.Name.StartsWith("___"):
 				return
 
-			print "Method: ${node.FullName}"
 			method = Method(node.Name, ReturnType.CreateReturnType(node), GetModifier(node), GetRegion(node), GetClientRegion(node))
 			method.Parameters = GetParameters(node.Parameters)
 			method.Node = node
@@ -246,25 +245,16 @@
 			print ex.ToString()
 			raise
 	
-	/*
-	// TODO: Event Declaration
-	override def Visit(eventDeclaration as AST.EventDeclaration, data as object) as object:
-		region as DefaultRegion = GetRegion(eventDeclaration.StartLocation, eventDeclaration.EndLocation)
-		bodyRegion as DefaultRegion = GetRegion(eventDeclaration.BodyStart, eventDeclaration.BodyEnd)
-		type as ReturnType = ReturnType(eventDeclaration.TypeReference)
-		c as Class = _currentClass.Peek()
-		e as Event = null
-		if eventDeclaration.VariableDeclarators != null:
-			for varDecl as ICSharpCode.SharpRefactory.Parser.AST.VariableDeclaration in eventDeclaration.VariableDeclarators:
-				e = Event(varDecl.Name, type, eventDeclaration.Modifier, region, bodyRegion)
-				c.Events.Add(e)
-			
-		else:
-			e = Event(eventDeclaration.Name, type, eventDeclaration.Modifier, region, bodyRegion)
-			c.Events.Add(e)
-		
-		return null
+	override def OnEvent (node as AST.Event):
+		try:
+			ev = Event (node.Name, ReturnType(node.Type), GetModifier(node), GetRegion(node), GetClientRegion(node))
+			ev.Documentation = node.Documentation
+			cast(Class, _currentClass.Peek()).Events.Add(ev)
+		except ex:
+			print ex
+			raise
 	
+	/*
 	// TODO: Detect indexer method and add it as Indexer
 	override def Visit(indexerDeclaration as AST.IndexerDeclaration, data as object) as object:
 		region as DefaultRegion = GetRegion(indexerDeclaration.StartLocation, indexerDeclaration.EndLocation)




More information about the Monodevelop-patches-list mailing list