valadoc r17 - in trunk/src: doclets/htmlhelpers libvaladoc



Author: flobrosch
Date: Mon Nov 10 16:00:00 2008
New Revision: 17
URL: http://svn.gnome.org/viewvc/valadoc?rev=17&view=rev

Log:

 - @inheritDoc:
  - structs
  - classes
  - properties



Modified:
   trunk/src/doclets/htmlhelpers/htmlhelpers.vala
   trunk/src/libvaladoc/doctree.vala
   trunk/src/libvaladoc/parser.vala

Modified: trunk/src/doclets/htmlhelpers/htmlhelpers.vala
==============================================================================
--- trunk/src/doclets/htmlhelpers/htmlhelpers.vala	(original)
+++ trunk/src/doclets/htmlhelpers/htmlhelpers.vala	Mon Nov 10 16:00:00 2008
@@ -1418,6 +1418,7 @@
 		m.write_comment ( file );
 
 		if ( m.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, m );
 			this.write_package_note ( file, m );
 		}
@@ -1469,6 +1470,7 @@
 		del.write_comment ( file );
 
 		if ( del.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, del );
 			this.write_package_note ( file, del );
 		}
@@ -1488,6 +1490,7 @@
 		field.write_comment ( file );
 
 		if ( field.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, field );
 			this.write_package_note ( file, field );
 		}
@@ -1507,6 +1510,7 @@
 		constant.write_comment ( file );
 
 		if ( constant.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, constant );
 			this.write_package_note ( file, constant );
 		}
@@ -1536,6 +1540,7 @@
 		en.write_comment ( file );
 
 		if ( en.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, en );
 			this.write_package_note ( file, en );
 		}
@@ -1630,6 +1635,7 @@
 		file.printf ( "\n\t\t\t\t</div>\n" );
 		cl.write_comment ( file );
 		if ( cl.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, cl );
 			this.write_package_note ( file, cl );
 		}
@@ -1660,6 +1666,7 @@
 		file.printf ( "\n\t\t\t\t</div>\n" );
 		iface.write_comment ( file );
 		if ( iface.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, iface );
 			this.write_package_note ( file, iface );
 		}
@@ -1683,6 +1690,7 @@
 		file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
 		errdom.write_comment ( file );
 		if ( errdom.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, errdom );
 			this.write_package_note ( file, errdom );
 		}
@@ -1707,6 +1715,7 @@
 
 		stru.write_comment ( file );
 		if ( stru.parent is Namespace ) {
+			file.puts ( "\t\t\t\t<br />\n" );
 			this.write_namespace_note ( file, stru );
 			this.write_package_note ( file, stru );
 		}

Modified: trunk/src/libvaladoc/doctree.vala
==============================================================================
--- trunk/src/libvaladoc/doctree.vala	(original)
+++ trunk/src/libvaladoc/doctree.vala	Mon Nov 10 16:00:00 2008
@@ -2221,13 +2221,37 @@
 		}
 	}
 
+	public Property base_property {
+		private set;
+		get;
+	}
+
 	// internal
 	public void set_type_references ( ) {
+		if ( this.is_override ) {
+			Vala.Property vp = ( this.vproperty.base_property == null )? this.vproperty.base_interface_property : this.vproperty.base_property;
+			this.base_property = this.head.search_vala_symbol ( vp );
+		}
 		this.set_return_type_references ( );
 	}
 
-	// internal
 	public void parse_comment ( Valadoc.Parser docparser ) {
+		if ( this.documentation != null )
+			return ;
+
+		if ( this.comment_string == null )
+			return ;
+
+		bool tmp = Parser.is_documentation ( this.comment_string );
+		if ( tmp == false )
+			return ;
+
+		if ( this.is_override && Parser.is_inherit_doc ( this.comment_string ) ) {
+			this.base_property.parse_comment ( docparser );
+			this.documentation = this.base_property.documentation;
+			return ;
+		}
+
 		this.parse_comment_helper ( docparser, CommentContext.PROPERTY );
 	}
 
@@ -2349,8 +2373,8 @@
 	}
 
 	public Method base_method {
+		private set;
 		get;
-		set;
 	}
 
 	public TypeReference return_type {
@@ -2373,6 +2397,7 @@
 		get;
 	}
 
+	// FIXME
 	public string?# comment_str {
 		get {
 			return this.vmethod.source_reference.comment;
@@ -2498,6 +2523,11 @@
 
 	// internal
 	public void set_type_references ( ) {
+		if ( this.is_override ) {
+			Vala.Method vm = ( this.vmethod.base_method == null )? this.vmethod.base_interface_method : this.vmethod.base_method;
+			this.base_method = this.head.search_vala_symbol ( vm );
+		}
+
 		this.set_return_type_references ( );
 
 		this.set_exception_type_references ( );
@@ -2720,7 +2750,8 @@
 		this.methods = new Gee.ArrayList<Method> ();
 	}
 
-	protected Class? parent_class {
+	// Rename to parent_element
+	protected ContainerDataType? parent_class {
 		private set;
 		get;
 	}
@@ -2769,6 +2800,9 @@
 			if ( element is Class ) {
 				this.parent_class = (Class)element;
 			}
+			else if ( element is Struct ) {
+				this.parent_class = (Struct)element;
+			}
 		}
 	}
 
@@ -3045,7 +3079,21 @@
 
 	// internal
 	public override void parse_comments ( Valadoc.Parser docparser ) {
-		this.parse_comment_helper ( docparser, CommentContext.CLASS );
+		if ( this.documentation != null )
+			return ;
+
+		if ( this.comment_string != null ) {
+			bool tmp = Parser.is_documentation ( this.comment_string );
+			if ( tmp == true ) {
+				if ( Parser.is_inherit_doc ( this.comment_string ) && this.parent_class != null ) {
+					this.parent_class.parse_comments ( docparser );
+					this.documentation = this.parent_class.documentation;
+				}
+				else {
+					this.parse_comment_helper ( docparser, CommentContext.CLASS );
+				}
+			}
+		}
 
 		this.parse_construction_method_comments ( docparser );
 		this.parse_delegate_comments ( docparser );
@@ -3084,12 +3132,12 @@
 		foreach ( Field f in flst ) {
 			this.fields.add ( f );
 		}
-
+/*
 		var plst = dtype.get_property_list ( );
 		foreach ( Property prop in plst ) {
 			this.properties.add ( prop );
 		}
-
+*/
 		var proplst = dtype.get_property_list ( );
 		foreach ( Property p in proplst ) {
 			if ( p.is_private )
@@ -3108,31 +3156,13 @@
 			if ( m.is_private )
 				continue ;
 
-			if ( m.is_virtual || m.is_override || m.is_abstract ) {
-				Method m2 = get_new_method ( m );
-				if ( m2 != null )
-					m2.base_method = m;
-					continue ;
-			}
-
 			this.methods.add ( m );
 		}
 	}
 
-	// rename - base_method?
-	private Method? get_new_method ( Method overwritten_method ) {
-		foreach ( Method m in this.methods ) {
-			if ( !m.is_override )
-				continue ;
-
-			if ( m.name == overwritten_method.name  )
-				return m;			
-		}
-		return null;
-	}
-
 	private void inheritance_interface ( Interface dtype ) {
 		var plst = dtype.get_property_list ( );
+
 		foreach ( Property p in plst ) {
 			if ( p.is_private )
 				continue ;
@@ -3621,6 +3651,7 @@
 		this.add_methods_and_construction_methods ( vmethods );
 	}
 
+	// TODO remove
 	public string?# comment_str {
 		get {
 			return this.vstruct.source_reference.comment;
@@ -3650,7 +3681,27 @@
 
 	// internal
 	public override void parse_comments ( Valadoc.Parser docparser ) {
-		this.parse_comment_helper ( docparser, CommentContext.STRUCT );
+		if ( this.documentation != null )
+			return ;
+
+		if ( this.parent_class != null ) {
+			stdout.printf ( "{>>>>>[%s]<<<<<}\n", this.parent_class.comment_string );
+		}
+
+
+		if ( this.comment_string != null ) {
+			bool tmp = Parser.is_documentation ( this.comment_string );
+			if ( tmp == true ) {
+				if ( Parser.is_inherit_doc ( this.comment_string ) && this.parent_class != null ) {
+					this.parent_class.parse_comments ( docparser );
+					this.documentation = this.parent_class.documentation;
+				}
+				else {
+					this.parse_comment_helper ( docparser, CommentContext.STRUCT );
+				}
+			}
+		}
+
 		this.parse_construction_method_comments ( docparser );
 		this.parse_constant_comments ( docparser );
 		this.parse_field_comments ( docparser );

Modified: trunk/src/libvaladoc/parser.vala
==============================================================================
--- trunk/src/libvaladoc/parser.vala	(original)
+++ trunk/src/libvaladoc/parser.vala	Mon Nov 10 16:00:00 2008
@@ -733,6 +733,54 @@
 	}
 
 	public DocumentationTree? parse ( Valadoc.Tree tree, Valadoc.Basic me, string str2 ) {
+		if ( me is Valadoc.Property ) {
+			stdout.printf ( "PROPERTY\n" );
+		}
+		else if ( me is Valadoc.Signal ) {
+			stdout.printf ( "SIGNAL\n" );
+		}
+		else if ( me is Valadoc.Class ) {
+			stdout.printf ( "CLASS\n" );
+		}
+		else if ( me is Valadoc.Interface ) {
+			stdout.printf ( "INTERFACE\n" );
+		}
+		else if ( me is Valadoc.Delegate ) {
+			stdout.printf ( "DELEGATE\n" );
+		}
+		else if ( me is Valadoc.Namespace ) {
+			stdout.printf ( "NAMESPACE\n" );
+		}
+		else if ( me is Valadoc.Method ) {
+			stdout.printf ( "METHOD\n" );
+		}
+		else if ( me is Valadoc.Field ) {
+			stdout.printf ( "FIELD\n" );
+		}
+		else if ( me is Valadoc.Constant ) {
+			stdout.printf ( "CONSTANT\n" );
+		}
+		else if ( me is Valadoc.Struct ) {
+			stdout.printf ( "STRUCT\n" );
+		}
+		else if ( me is Valadoc.Enum ) {
+			stdout.printf ( "ENUM\n" );
+		}
+		else if ( me is Valadoc.EnumValue ) {
+			stdout.printf ( "ENUMVALUE\n" );
+		}
+		else if ( me is Valadoc.ErrorCode ) {
+			stdout.printf ( "ERRORCODE\n" );
+		}
+		else if ( me is Valadoc.ErrorDomain ) {
+			stdout.printf ( "ERRORDOMAIN\n" );
+		}
+		else {
+			stdout.printf ( "Gut ^_^\n" );
+		}
+
+		stdout.printf ( "============= %s =============\n", me.full_name() );
+
 		string str = str2;
 
 		GLib.StringBuilder buf = new GLib.StringBuilder ();
@@ -743,9 +791,10 @@
 
 
 		bool tmp = this.skip_documentation_header ( ref str, ref linenr, ref pos );
-		if ( tmp == false )
+		if ( tmp == false ) {
+		stdout.printf ( "-----------------------\n" );
 			return null;
-
+		}
 
 		Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
 		string? currtagname = null;
@@ -795,6 +844,7 @@
 
 				InlineTaglet itag = this.parse_bracket ( tree, me, ref str, ref linestart, ref linestartnr, ref linenr, ref pos );
 				if ( itag == null ) {
+		stdout.printf ( "-----------------------\n" );
 					return null;
 				}
 				content.add ( itag );
@@ -803,6 +853,7 @@
 			else if ( chr == '}' ) {
 				string line = this.extract_line ( linestart );
 				this.reporter.add_error (linenr, pos, linenr, pos, "syntax error.\n", line );
+		stdout.printf ( "-----------------------\n" );
 				return null;
 			}
 			else if ( chr == '@' && prevchr.isspace() ) {
@@ -833,11 +884,12 @@
 			content.add ( strtag );
 		}
 
+		stdout.printf ( "-----------------------\n" );
+
 		this.append_new_tag ( tree, me, doctree, currtagname, content, currtagline, currtagstartlinenr, currtagstartpos );
 		tmp = this.check_foother ( ref linestart, linenr );
 		if ( tmp == false )
 			return null;
-
 		return doctree;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]