valadoc r22 - in trunk/src: doclets/devhelp/taglets/author doclets/devhelp/taglets/link doclets/devhelp/taglets/parameter doclets/devhelp/taglets/return doclets/devhelp/taglets/see doclets/devhelp/taglets/string doclets/devhelp/taglets/throws doclets/devhelp/taglets/version doclets/html/deps doclets/html/taglets/author doclets/html/taglets/link doclets/html/taglets/parameter doclets/html/taglets/return doclets/html/taglets/see doclets/html/taglets/string doclets/html/taglets/throws doclets/html/taglets/version doclets/htmlhelpers doclets/valadoc.org/taglets/author doclets/valadoc.org/taglets/link doclets/valadoc.org/taglets/parameter doclets/valadoc.org/taglets/return doclets/valadoc.org/taglets/see doclets/valadoc.org/taglets/string doclets/valadoc.org/taglets/throws doclets/valadoc.org/taglets/version libvaladoc valadoc
- From: flobrosch svn gnome org
- To: svn-commits-list gnome org
- Subject: valadoc r22 - in trunk/src: doclets/devhelp/taglets/author doclets/devhelp/taglets/link doclets/devhelp/taglets/parameter doclets/devhelp/taglets/return doclets/devhelp/taglets/see doclets/devhelp/taglets/string doclets/devhelp/taglets/throws doclets/devhelp/taglets/version doclets/html/deps doclets/html/taglets/author doclets/html/taglets/link doclets/html/taglets/parameter doclets/html/taglets/return doclets/html/taglets/see doclets/html/taglets/string doclets/html/taglets/throws doclets/html/taglets/version doclets/htmlhelpers doclets/valadoc.org/taglets/author doclets/valadoc.org/taglets/link doclets/valadoc.org/taglets/parameter doclets/valadoc.org/taglets/return doclets/valadoc.org/taglets/see doclets/valadoc.org/taglets/string doclets/valadoc.org/taglets/throws doclets/valadoc.org/taglets/version libvaladoc valadoc
- Date: Sun, 7 Dec 2008 03:33:02 +0000 (UTC)
Author: flobrosch
Date: Sun Dec 7 03:33:02 2008
New Revision: 22
URL: http://svn.gnome.org/viewvc/valadoc?rev=22&view=rev
Log:
- new documentation parser
- new taglet interface
- new error reporter
- short node descriptions \content list
Removed:
trunk/src/doclets/devhelp/taglets/author/
trunk/src/doclets/html/taglets/author/
trunk/src/doclets/valadoc.org/taglets/author/
Modified:
trunk/src/doclets/devhelp/taglets/link/taglet.vala
trunk/src/doclets/devhelp/taglets/parameter/taglet.vala
trunk/src/doclets/devhelp/taglets/return/taglet.vala
trunk/src/doclets/devhelp/taglets/see/taglet.vala
trunk/src/doclets/devhelp/taglets/string/taglet.vala
trunk/src/doclets/devhelp/taglets/throws/taglet.vala
trunk/src/doclets/devhelp/taglets/version/taglet.vala
trunk/src/doclets/html/deps/main.css
trunk/src/doclets/html/taglets/link/taglet.vala
trunk/src/doclets/html/taglets/parameter/taglet.vala
trunk/src/doclets/html/taglets/return/taglet.vala
trunk/src/doclets/html/taglets/see/taglet.vala
trunk/src/doclets/html/taglets/string/Makefile.am
trunk/src/doclets/html/taglets/string/taglet.vala
trunk/src/doclets/html/taglets/throws/taglet.vala
trunk/src/doclets/html/taglets/version/taglet.vala
trunk/src/doclets/htmlhelpers/htmlhelpers.vala
trunk/src/doclets/valadoc.org/taglets/link/taglet.vala
trunk/src/doclets/valadoc.org/taglets/parameter/taglet.vala
trunk/src/doclets/valadoc.org/taglets/return/taglet.vala
trunk/src/doclets/valadoc.org/taglets/see/taglet.vala
trunk/src/doclets/valadoc.org/taglets/string/taglet.vala
trunk/src/doclets/valadoc.org/taglets/throws/taglet.vala
trunk/src/doclets/valadoc.org/taglets/version/taglet.vala
trunk/src/libvaladoc/doctree.vala
trunk/src/libvaladoc/errorreporter.vala
trunk/src/libvaladoc/parser.vala
trunk/src/valadoc/valadoc.vala
Modified: trunk/src/doclets/devhelp/taglets/link/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/link/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/link/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,53 +23,30 @@
using Gee;
-
-public class LinkHtmlTaglet : InlineTaglet, HtmlHelper {
- private string content;
- private string path;
- private string css;
-
- public Settings settings {
- construct set;
- get;
+public class Valadoc.LinkDevhelpTaglet : Valadoc.LinkHtmlHelperTaglet, HtmlHelper {
+ protected override string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos ) {
+ return this.get_html_link ( settings, element, pos );
}
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, string content ) {
- string[] arr = content.split ( "\n" );
- string str = string.joinv ("", arr ).strip();
-
- Valadoc.Basic? element = tree.search_symbol_str ( me, str );
- if ( element == null ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+5, "Linked Type is not available.\n", error_start );
- return false;
- }
-
- this.settings = settings;
- this.css = get_html_content_link_css_class ( element );
- this.path = this.get_html_link ( this.settings, element, me );
-
- this.content = str;
- return true;
+ public override string to_string () {
+ return to_string_imp ( );
}
-
public override bool write ( void* res, int max, int index ) {
- if ( this.path == null )
- ((GLib.FileStream)res).printf ( "<span class=\"%s\">%s</span>", this.css, this.content );
- else
- ((GLib.FileStream)res).printf ( "<a class=\"%s\" href=\"%s\">%s</a>", this.css, this.path, this.content );
+ return write_imp ( res, max, index );
+ }
- return true;
+ public override bool parse ( Settings settings, Tree tree, Basic me, string content, out string[] errmsg ) {
+ return this.parse_imp ( settings, tree, me, content, out errmsg );
}
}
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( LinkHtmlTaglet );
+ GLib.Type type = typeof ( LinkDevhelpTaglet );
taglets.set ( "link", type );
return type;
}
+
Modified: trunk/src/doclets/devhelp/taglets/parameter/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/parameter/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/parameter/taglet.vala Sun Dec 7 03:33:02 2008
@@ -24,104 +24,11 @@
+using Valadoc;
+using GLib;
+using Vala;
+using Gee;
-public class ParameterHtmlTaglet : MainTaglet {
- private Gee.ArrayList<InlineTaglet> content = new Gee.ArrayList<InlineTaglet> ();
- private string paramname = "";
-
- public override int order {
- get { return 100; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Parameters:</h2>\n", css_title );
- file.printf ( "<table class=\"%s\">\n", css_parameter_table );
- return true;
- }
-
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "</table>\n" );
- return true;
- }
-
- private bool check_parameter_name ( Valadoc.ParameterListHandler me, string name ) {
- foreach ( Valadoc.FormalParameter param in me.get_parameter_list ( ) ) {
- if ( param.name == name )
- return true;
- }
- return false;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "@param is not allowed in this contex.\n", error_start );
- return false;
- }
-
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
-
- string strpos = ((StringTaglet)tag).content;
- string paramname;
-
- strpos = this.get_next_word ( strpos, out paramname );
- ((StringTaglet)tag).content = strpos;
- this.paramname = paramname;
-
- if ( this.paramname == "" ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
- if ( !check_parameter_name ( ((Valadoc.ParameterListHandler)me), this.paramname ) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<tr>\n" );
- file.printf ( "\t\t<td class=\"%s\">ptr:</td>\n", css_parameter_table_name );
- file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
- file.puts ( "\t\t\t" );
-
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
-
- file.puts ( "\n" );
- file.printf ( "\t\t</td>\n" );
- file.printf ( "\t</tr>\n" );
- return true;
- }
-}
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
Modified: trunk/src/doclets/devhelp/taglets/return/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/return/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/return/taglet.vala Sun Dec 7 03:33:02 2008
@@ -25,49 +25,6 @@
-public class ReturnHtmlTaglet : MainTaglet {
- private Gee.ArrayList<InlineTaglet> content = new Gee.ArrayList<InlineTaglet> ();
-
- public override int order {
- get { return 300; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
- return true;
- }
-
- public override bool write_block_end ( void* res ) {
- return true;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "@return is not allowed in this contex.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ReturnHtmlTaglet );
Modified: trunk/src/doclets/devhelp/taglets/see/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/see/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/see/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,80 +23,35 @@
using Gee;
-public class SeeHtmlTaglet : MainTaglet, HtmlHelper {
- private string name;
- private string path;
- private string css;
- public override int order {
- get { return 500; }
- }
-
- public Settings settings {
- construct set;
- get;
+public class Valadoc.SeeDevhelpTaglet : SeeHtmlHelperTaglet, HtmlHelper {
+ protected override string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos ) {
+ return this.get_html_link ( settings, element, pos );
}
public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">See:</h2>\n", css_title );
- file.printf ( "<ul class=\"%s\">", css_see_list );
- return true;
+ return this.write_block_start_imp ( ptr );
}
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.puts ( "</ul>" );
- return true;
+ public override bool write_block_end ( void* res ) {
+ return this.write_block_end_imp ( res );
}
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get ( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
- return false;
- }
-
- string[] arr = ((StringTaglet)tag).content.split ( "\n" );
- string str = string.joinv ("", arr ).strip();
-
- Valadoc.Basic? element = tree.search_symbol_str ( me, str );
- if ( element == null ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Linked type is not available.\n", error_start );
- return false;
- }
-
- this.settings = settings;
-
- this.css = get_html_inline_navigation_link_css_class ( element );
- this.path = this.get_html_link ( this.settings, element, me );
- this.name = element.full_name();
- return true;
+ public override bool write ( void* res, int max, int index ) {
+ return this.write_imp ( res, max, index );
}
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<li class=\"%s\"><a href=\"%s\">%s</a></li>\n", this.css, this.path, this.name );
- return true;
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ return this.parse_imp ( settings, tree, me, content, out errmsg );
}
}
+
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( SeeHtmlTaglet );
+ GLib.Type type = typeof ( SeeDevhelpTaglet );
taglets.set ( "see", type );
return type;
}
Modified: trunk/src/doclets/devhelp/taglets/string/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/string/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/string/taglet.vala Sun Dec 7 03:33:02 2008
@@ -25,25 +25,6 @@
-public class StringHtmlTaglet : StringTaglet {
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content ) {
- this.content = content;
- return true;
- }
-
- public override bool write ( void* res, int max , int index ) {
- try {
- string str = new Regex ( Regex.escape_string ("\n")).replace_literal ( this.content, -1, 0, "\n<br>" );
- ((GLib.FileStream)res).puts ( str );
- }
- catch ( RegexError err ) {
- return false;
- }
- return true;
- }
-}
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
@@ -52,3 +33,5 @@
return type;
}
+
+
Modified: trunk/src/doclets/devhelp/taglets/throws/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/throws/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/throws/taglet.vala Sun Dec 7 03:33:02 2008
@@ -24,109 +24,6 @@
-
-public class ExceptionHtmlTaglet : MainTaglet {
- private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
- private string paramname = "";
-
- public override int order {
- get { return 200; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Exceptions:</h2>\n", css_title );
- file.printf ( "<table class=\"%s\">\n", css_exception_table );
- return true;
- }
-
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "</table>\n" );
- return true;
- }
-
- private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) {
- if ( paramname[0] == '.' )
- return false;
-
- foreach ( Valadoc.TypeReference param in me.get_error_domains() ) {
- if ( param.type_name.has_suffix ( paramname ) )
- return true;
- }
- return false;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "@throws is not allowed in this contex.\n", error_start );
- return false;
- }
-
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- string strpos = ((StringTaglet)tag).content;
- string paramname;
-
- strpos = this.get_next_word ( strpos, out paramname );
- ((StringTaglet)tag).content = strpos;
- this.paramname = paramname;
-
- if ( this.paramname == "" ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- if ( !check_exception_parameter_name ( ((Valadoc.ExceptionHandler)me), this.paramname ) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<tr>\n" );
- file.printf ( "\t\t<td class=\"%s\">ptr:</td>\n", css_parameter_table_name );
- file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
- file.puts ( "\t\t\t" );
-
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
-
- file.puts ( "\n" );
- file.printf ( "\t\t</td>\n" );
- file.printf ( "\t</tr>\n" );
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ExceptionHtmlTaglet );
@@ -134,3 +31,4 @@
return type;
}
+
Modified: trunk/src/doclets/devhelp/taglets/version/taglet.vala
==============================================================================
--- trunk/src/doclets/devhelp/taglets/version/taglet.vala (original)
+++ trunk/src/doclets/devhelp/taglets/version/taglet.vala Sun Dec 7 03:33:02 2008
@@ -25,58 +25,12 @@
-public class VersionHtmlTaglet : MainTaglet {
- private string version;
-
- public override int order {
- get { return 400; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Version:</h2>\n", css_title );
- return true;
- }
-
- public override bool write_block_end ( void* res ) {
- return true;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( content.size != 1 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get ( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
- return false;
- }
-
- string str = ((StringTaglet)tag).content;
- this.version = str.strip ( );
- return true;
- }
-
- public override bool write ( void* res, int max, int index ) {
- ((GLib.FileStream)res).printf ( "%s", this.version );
- if ( max != index+1 )
- ((GLib.FileStream)res).puts ( ", " );
-
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( VersionHtmlTaglet );
- taglets.set ( "version", type );
+ GLib.Type type = typeof ( SinceHtmlTaglet );
+ taglets.set ( "since", type );
return type;
}
+
+
Modified: trunk/src/doclets/html/deps/main.css
==============================================================================
--- trunk/src/doclets/html/deps/main.css (original)
+++ trunk/src/doclets/html/deps/main.css Sun Dec 7 03:33:02 2008
@@ -18,6 +18,9 @@
text-align: right;;
}
+.main_inline_navigation_brief_description {
+ color: #808080;
+}
div.cms_message {
}
@@ -176,171 +179,129 @@
}
.css_content_link_constant {
background-image:url(constant.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_namespace {
background-image:url(namespace.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_struct {
background-image:url(struct.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_interface {
background-image:url(interface.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_enum {
background-image:url(enum.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_errordomain {
background-image:url(errordomain.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_delegate {
background-image:url(delegate.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_signal {
background-image:url(signal.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_field {
background-image:url(field.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_enumvalue {
background-image:url(enumvalue.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_errorcode {
background-image:url(errorcode.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_class {
background-image:url(class.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_abstract_class {
background-image:url(abstractclass.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_property {
background-image:url(property.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_virtual_property {
background-image:url(property.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_abstract_property {
background-image:url(property.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_method {
background-image:url(method.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_static_method {
background-image:url(staticmethod.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_virtual_method {
background-image:url(method.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_abstract_method {
background-image:url( abstractmethod.png );
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
.css_content_link_construction_method {
background-image:url(method.png);
- display:inline-block;
- padding-right:17px;
+ padding-left:17px;
+ padding-top:1px;
background-repeat:no-repeat;
- background-position:center right;
- border:0px;
}
Modified: trunk/src/doclets/html/taglets/link/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/link/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/link/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,48 +23,25 @@
using Gee;
-
-
-public class LinkHtmlTaglet : InlineTaglet, LinkHelper {
- private string content;
- private string path;
- private string css;
-
- public Settings settings {
- construct set;
- get;
+public class Valadoc.LinkHtmlTaglet : Valadoc.LinkHtmlHelperTaglet, LinkHelper {
+ protected override string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos ) {
+ return this.get_html_link ( settings, element, pos );
}
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, string content ) {
- string[] arr = content.split ( "\n" );
- string str = string.joinv ("", arr ).strip();
-
- Valadoc.Basic? element = tree.search_symbol_str ( me, str );
- if ( element == null ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+5, "Linked Type is not available.\n", error_start );
- return false;
- }
-
- this.settings = settings;
- this.path = this.get_html_link ( settings, element, me );
- this.css = get_html_content_link_css_class ( element );
- this.content = element.full_name ();
- return true;
+ public override string to_string () {
+ return to_string_imp ( );
}
public override bool write ( void* res, int max, int index ) {
- if ( this.path == null )
- ((GLib.FileStream)res).printf ( "<span class=\"%s\">%s</span>", this.css, this.content );
- else
- ((GLib.FileStream)res).printf ( "<a href=\"%s\" class=\"%s\">%s</a>", this.path, this.css, this.content );
+ return write_imp ( res, max, index );
+ }
- return true;
+ public override bool parse ( Settings settings, Tree tree, Basic me, string content, out string[] errmsg ) {
+ return this.parse_imp ( settings, tree, me, content, out errmsg );
}
}
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( LinkHtmlTaglet );
@@ -72,3 +49,5 @@
return type;
}
+
+
Modified: trunk/src/doclets/html/taglets/parameter/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/parameter/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/parameter/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,118 +23,6 @@
using Gee;
-
-
-public class ParameterHtmlTaglet : MainTaglet {
- private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
- private string paramname = "";
-
- public override int order {
- get { return 100; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
- file.printf ( "<h2 class=\"%s\">Parameters:</h2>\n", css_title );
- file.printf ( "<table class=\"%s\">\n", css_parameter_table );
- return true;
- }
-
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
- file.printf ( "</table>\n" );
- return true;
- }
-
- protected void get_first_word_start_pos ( string str, ref int line, ref int pos ) {
- for ( int i = 0; str[i] != '\0'; i++ ) {
- if ( str[i].isspace() == false )
- return ;
-
- pos++;
-
- if ( str[i] == '\n' ) {
- pos = 0;
- line++;
- }
- }
- }
-
- private bool check_parameter_name ( Valadoc.ParameterListHandler me, string name ) {
- foreach ( Valadoc.FormalParameter param in me.get_parameter_list ( ) ) {
- if ( param.name == name )
- return true;
- }
- return false;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "@param is not allowed in this contex.\n", error_start );
- return false;
- }
-
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
-
- string strpos = ((StringTaglet)tag).content;
- string paramname;
-
- strpos = this.get_next_word ( strpos, out paramname );
- ((StringTaglet)tag).content = strpos;
- this.paramname = paramname;
-
- if ( this.paramname == "" ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
- if ( !check_parameter_name ( ((Valadoc.ParameterListHandler)me), this.paramname ) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<tr>\n" );
- file.printf ( "\t\t<td class=\"%s\">%s:</td>\n", css_parameter_table_name, this.paramname );
- file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
- file.puts ( "\t\t\t" );
-
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
-
- file.puts ( "\n" );
- file.printf ( "\t\t</td>\n" );
- file.printf ( "\t</tr>\n" );
- return true;
- }
-}
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ParameterHtmlTaglet );
Modified: trunk/src/doclets/html/taglets/return/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/return/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/return/taglet.vala Sun Dec 7 03:33:02 2008
@@ -24,54 +24,9 @@
-
-public class ReturnHtmlTaglet : MainTaglet {
- private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
-
- public override int order {
- get { return 300; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
- return true;
- }
-
- public override bool write_block_end ( void* res ) {
- return true;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "@return is not allowed in this contex.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ReturnHtmlTaglet );
taglets.set ( "return", type );
return type;
}
-
Modified: trunk/src/doclets/html/taglets/see/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/see/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/see/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,84 +23,35 @@
using Gee;
-public class SeeHtmlTaglet : MainTaglet, Valadoc.LinkHelper {
- private string name;
- private string path;
- private string css;
- public override int order {
- get { return 500; }
- }
-
- public Settings settings {
- construct set;
- get;
+public class Valadoc.SeeHtmlTaglet : SeeHtmlHelperTaglet, LinkHelper {
+ protected override string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos ) {
+ return this.get_html_link ( settings, element, pos );
}
public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">See:</h2>\n", css_title );
- file.printf ( "<ul class=\"%s\">", css_see_list );
- return true;
+ return this.write_block_start_imp ( ptr );
}
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.puts ( "</ul>" );
- return true;
+ public override bool write_block_end ( void* res ) {
+ return this.write_block_end_imp ( res );
}
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get ( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
- return false;
- }
-
- string[] arr = ((StringTaglet)tag).content.split ( "\n" );
- string str = string.joinv ("", arr ).strip();
-
- Valadoc.Basic? element = tree.search_symbol_str ( me, str );
- if ( element == null ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Linked type is not available.\n", error_start );
- return false;
- }
-
- this.settings = settings;
- this.css = get_html_inline_navigation_link_css_class ( element );
- this.path = this.get_html_link ( settings, element, me );
- this.name = element.full_name ();
- return true;
+ public override bool write ( void* res, int max, int index ) {
+ return this.write_imp ( res, max, index );
}
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- if ( this.path == null )
- file.printf ( "\t<li class=\"%s\">%s</li>\n", this.css, this.name );
- else
- file.printf ( "\t<li class=\"%s\"><a href=\"%s\">%s</a></li>\n", this.css, this.path, this.name );
-
- return true;
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ return this.parse_imp ( settings, tree, me, content, out errmsg );
}
}
+
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( SeeHtmlTaglet );
taglets.set ( "see", type );
return type;
}
-
Modified: trunk/src/doclets/html/taglets/string/Makefile.am
==============================================================================
--- trunk/src/doclets/html/taglets/string/Makefile.am (original)
+++ trunk/src/doclets/html/taglets/string/Makefile.am Sun Dec 7 03:33:02 2008
@@ -11,7 +11,7 @@
libtagletstring.vala.stamp: $(libtagletstring_VALASOURCES)
- $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
+ $(VALAC) -C --vapidir ../../../../vapi --pkg valadoc-1.0 --vapidir ../../linkhelper --vapidir ../../../htmlhelpers/ --pkg libhtmlhelpers-1.0 --pkg libhtmlhelper-1.0 --basedir . --disable-non-null --save-temps $^
touch $@
@@ -32,6 +32,7 @@
AM_CFLAGS = -g \
-I ../../../../libvaladoc/ \
+ -I ../../../htmlhelpers/ \
-I ../../linkhelper/ \
-I ../../ \
$(GLIB_CFLAGS) \
@@ -44,6 +45,7 @@
libtagletstring_la_LIBADD = \
../../../../libvaladoc/libvaladoc.la \
+ ../../../htmlhelpers/libhtmlhelpers.la \
../../linkhelper/libhtmlhelper.la \
$(GLIB_LIBS) \
$(LIBVALA_LIBS) \
Modified: trunk/src/doclets/html/taglets/string/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/string/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/string/taglet.vala Sun Dec 7 03:33:02 2008
@@ -25,26 +25,6 @@
-public class StringHtmlTaglet : StringTaglet {
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content ) {
- this.content = content;
- return true;
- }
-
- public override bool write ( void* res, int max , int index ) {
- try {
- string str = new Regex ( Regex.escape_string ("\n")).replace_literal ( this.content, -1, 0, "\n<br>" );
- ((GLib.FileStream)res).puts ( str );
- }
- catch ( RegexError err ) {
- return false;
- }
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( StringHtmlTaglet );
@@ -52,3 +32,4 @@
return type;
}
+
Modified: trunk/src/doclets/html/taglets/throws/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/throws/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/throws/taglet.vala Sun Dec 7 03:33:02 2008
@@ -24,109 +24,6 @@
-
-public class ExceptionHtmlTaglet : MainTaglet {
- private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
- private string paramname = "";
-
- public override int order {
- get { return 200; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Exceptions:</h2>\n", css_title );
- file.printf ( "<table class=\"%s\">\n", css_exception_table );
- return true;
- }
-
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "</table>\n" );
- return true;
- }
-
- private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) {
- if ( paramname[0] == '.' )
- return false;
-
- foreach ( Valadoc.TypeReference param in me.get_error_domains() ) {
- if ( param.type_name.has_suffix ( paramname ) )
- return true;
- }
- return false;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "@throws is not allowed in this contex.\n", error_start );
- return false;
- }
-
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- string strpos = ((StringTaglet)tag).content;
- string paramname;
-
- strpos = this.get_next_word ( strpos, out paramname );
- ((StringTaglet)tag).content = strpos;
- this.paramname = paramname;
-
- if ( this.paramname == "" ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- if ( !check_exception_parameter_name ( ((Valadoc.ExceptionHandler)me), this.paramname ) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<tr>\n" );
- file.printf ( "\t\t<td class=\"%s\">%s:</td>\n", css_parameter_table_name, this.paramname );
- file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
- file.puts ( "\t\t\t" );
-
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
-
- file.puts ( "\n" );
- file.printf ( "\t\t</td>\n" );
- file.printf ( "\t</tr>\n" );
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ExceptionHtmlTaglet );
Modified: trunk/src/doclets/html/taglets/version/taglet.vala
==============================================================================
--- trunk/src/doclets/html/taglets/version/taglet.vala (original)
+++ trunk/src/doclets/html/taglets/version/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,60 +23,10 @@
using Gee;
-
-
-public class VersionHtmlTaglet : MainTaglet {
- private string version;
-
- public override int order {
- get { return 400; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Version:</h2>\n", css_title );
- return true;
- }
-
- public override bool write_block_end ( void* res ) {
- return true;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( content.size != 1 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get ( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
- return false;
- }
-
- string str = ((StringTaglet)tag).content;
- this.version = str.strip ( );
- return true;
- }
-
- public override bool write ( void* res, int max, int index ) {
- ((GLib.FileStream)res).printf ( "%s", this.version );
- if ( max != index+1 )
- ((GLib.FileStream)res).puts ( ", " );
-
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( VersionHtmlTaglet );
- taglets.set ( "version", type );
+ GLib.Type type = typeof ( SinceHtmlTaglet );
+ taglets.set ( "since", type );
return type;
}
Modified: trunk/src/doclets/htmlhelpers/htmlhelpers.vala
==============================================================================
--- trunk/src/doclets/htmlhelpers/htmlhelpers.vala (original)
+++ trunk/src/doclets/htmlhelpers/htmlhelpers.vala Sun Dec 7 03:33:02 2008
@@ -21,6 +21,10 @@
public const string css_inline_navigation_abstract_method = "main_inline_navigation_abstract_method";
public const string css_inline_navigation_construction_method = "main_inline_navigation_construction_method";
+
+
+public const string css_inline_navigation_brief_description = "main_inline_navigation_brief_description";
+
public const string css_inline_navigation_signal = "main_inline_navigation_signal";
public const string css_inline_navigation_fields = "main_inline_navigation_fields";
public const string css_inline_navigation_abstract_class = "main_inline_navigation_abstract_class";
@@ -261,11 +265,466 @@
}
return "";
}
+}
+
+
+
+
+/* ---- **/
+public abstract class Valadoc.SeeHtmlHelperTaglet : MainTaglet {
+ public override int order { get { return 400; } }
+ private string name;
+ private string link;
+ private string css;
+
+ protected abstract string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos );
+
+ // override-bug
+ protected bool write_block_start_imp ( void* res ) {
+ weak GLib.FileStream file = (GLib.FileStream)res;
+ file.printf ( "<h2 class=\"%s\">See:</h2>\n", css_title );
+ return true;
+ }
+
+ // override-bug
+ protected bool write_block_end_imp ( void* res ) {
+ return true;
+ }
+
+ // override-bug
+ protected bool write_imp ( void* res, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)res;
+ file.printf ( "<a class=\"%s\" href=\"%s\">%s</a>", this.css, this.link, this.name );
+ if ( max != index+1 )
+ file.printf ( ", " );
+
+ return true;
+ }
+
+ // override-bug
+ protected bool parse_imp ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ if ( content.size != 1 ) {
+ errmsg = new string[1];
+ errmsg[0] = "Type name was expected.";
+ return false;
+ }
+
+ Gee.Iterator<DocElement> it = content.iterator ();
+ it.next ();
+
+ DocElement element = it.get ();
+ if ( element is StringTaglet == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Type name was expected.";
+ return false;
+ }
+
+ Valadoc.Basic? node = tree.search_symbol_str ( me, ((StringTaglet)element).content.strip ( ) );
+ if ( node == null ) {
+ errmsg = new string[1];
+ errmsg[0] = "Linked type is not available.";
+ return false;
+ }
+
+ this.name = node.full_name ( );
+ this.css = get_html_content_link_css_class ( node );
+ this.link = this.get_link ( settings, tree, node, me );
+ return true;
+ }
+}
+
+public class Valadoc.SinceHtmlTaglet : MainTaglet {
+ public override int order { get { return 400; } }
+ private StringTaglet content;
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "<h2 class=\"%s\">Since:</h2>\n", css_title );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
+ public override bool write ( void* res, int max, int index ) {
+ ((GLib.FileStream)res).printf ( "%s", this.content.content );
+ if ( max != index+1 )
+ ((GLib.FileStream)res).puts ( ", " );
+ return true;
+ }
+
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ if ( content.size != 1 ) {
+ errmsg = new string[1];
+ errmsg[0] = "Version name was expected.";
+ return false;
+ }
+
+ Gee.Iterator<DocElement> it = content.iterator ();
+ it.next ();
+
+ DocElement element = it.get ();
+ if ( element is StringTaglet == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Version name was expected.";
+ return false;
+ }
+
+ this.content = (StringTaglet)element;
+ return true;
+ }
}
+
+public abstract class Valadoc.LinkHtmlHelperTaglet : InlineTaglet {
+ private string? link = null;
+ private string? name = null;
+ private string? css = null;
+
+ protected abstract string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos );
+
+ protected string to_string_imp ( ) {
+ return this.name;
+ }
+
+ protected bool write_imp ( void* res, int max, int index ) {
+ if ( this.link == null )
+ ((GLib.FileStream)res).printf ( "<span class=\"%s\">%s</span>", this.css, this.name );
+ else
+ ((GLib.FileStream)res).printf ( "<a class=\"%s\" href=\"%s\">%s</a>", this.css, this.link, this.name );
+
+ return true;
+ }
+
+ protected bool parse_imp ( Settings settings, Tree tree, Basic me, string content, out string[] errmsg ) {
+ Valadoc.Basic? element = tree.search_symbol_str ( me, content.strip() );
+ if ( element == null ) {
+ errmsg = new string[1];
+ errmsg[0] = "Linked type is not available.";
+ return false;
+ }
+
+ this.name = element.full_name ();
+ this.css = get_html_content_link_css_class ( element );
+ this.link = this.get_link ( settings, tree, element, me );
+ return true;
+ }
+}
+
+
+public class Valadoc.ExceptionHtmlTaglet : MainTaglet {
+ public override int order { get { return 200; } }
+ private Gee.ArrayList<DocElement> content;
+ private string paramname;
+
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ if ( me is Valadoc.ExceptionHandler == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Tag @throws cannot be used in %s documentation. It can only be used in the following types of documentation: method, signal, delegate.".printf ( this.get_data_type ( me ) );
+ return false;
+ }
+
+ if ( content.size == 0 ) {
+ errmsg = new string[1];
+ errmsg[0] = "Errordomain was expected.";
+ return false;
+ }
+
+
+ Gee.ArrayList<DocElement> contentlst = new Gee.ArrayList<DocElement> ();
+ foreach ( DocElement element in content ) {
+ contentlst.add ( element );
+ }
+
+ DocElement tag = contentlst.get( 0 );
+ if ( tag is StringTaglet == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Exception name was expected.";
+ return false;
+ }
+
+ string str = ((StringTaglet)tag).content;
+ weak string lposa = str.chr (-1, '\n');
+ weak string lposb = str.chr (-1, ' ');
+ weak string lpos;
+
+ long lposaoffset = (lposa == null)? long.MAX : str.pointer_to_offset ( lposa );
+ long lposboffset = (lposb == null)? long.MAX : str.pointer_to_offset ( lposb );
+
+ if ( lposaoffset < lposboffset )
+ lpos = lposa;
+ else
+ lpos = lposb;
+
+ if ( lpos == null ) {
+ this.paramname = str.strip ();
+ ((StringTaglet)tag).content = "";
+ }
+ else {
+ int namepos = (int)str.pointer_to_offset ( lpos );
+ this.paramname = str.ndup ( namepos ).strip ();
+ ((StringTaglet)tag).content = lpos.ndup ( lpos.size () ).chomp ();
+ }
+
+ bool tmp = this.check_exception_parameter_name ( (Valadoc.ExceptionHandler)me, this.paramname );
+ if ( tmp == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Unknown parameter.";
+ return false;
+ }
+
+ this.content = contentlst;
+ return true;
+ }
+
+ private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) {
+ if ( paramname[0] == '.' || paramname == "" )
+ return false;
+
+ foreach ( Valadoc.TypeReference param in me.get_error_domains() ) {
+ if ( param.type_name.has_suffix ( paramname ) )
+ return true;
+ }
+ return false;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<tr>\n" );
+ file.printf ( "\t\t<td class=\"%s\">%s:</td>\n", css_parameter_table_name, this.paramname );
+ file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
+ file.puts ( "\t\t\t" );
+
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( DocElement element in this.content ) {
+ element.write ( ptr, _max, _index );
+ _index++;
+ }
+
+ file.puts ( "\n" );
+ file.printf ( "\t\t</td>\n" );
+ file.printf ( "\t</tr>\n" );
+ return true;
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "<h2 class=\"%s\">Exceptions:</h2>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_exception_table );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "</table>\n" );
+ return true;
+ }
+
+
+}
+
+public class Valadoc.ParameterHtmlTaglet : MainTaglet {
+ public override int order { get { return 100; } }
+ private Gee.Collection<DocElement> content;
+ private string paramname;
+
+ private static bool check_parameter_name ( Valadoc.ParameterListHandler me, string name ) {
+ if ( name == "" )
+ return false;
+
+ foreach ( Valadoc.FormalParameter param in me.get_parameter_list ( ) ) {
+ if ( param.name == name )
+ return true;
+ }
+ return false;
+ }
+
+ public override bool write ( void* ptr, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+
+ file.printf ( "\t<tr>\n" );
+ file.printf ( "\t\t<td class=\"%s\">%s:</td>\n", css_parameter_table_name, this.paramname );
+ file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
+ file.puts ( "\t\t\t" );
+
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( DocElement tag in this.content ) {
+ tag.write ( ptr, _max, _index );
+ _index++;
+ }
+
+ file.puts ( "\n" );
+ file.printf ( "\t\t</td>\n" );
+ file.printf ( "\t</tr>\n" );
+ return true;
+ }
+
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "<h2 class=\"%s\">Parameters:</h2>\n", css_title );
+ file.printf ( "<table class=\"%s\">\n", css_parameter_table );
+ return true;
+ }
+
+ public override bool write_block_end ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "</table>\n" );
+ return true;
+ }
+
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ if ( me is Valadoc.ParameterListHandler == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Tag @param cannot be used in %s documentation. It can only be used in the following types of documentation: method, signal, delegate.".printf ( this.get_data_type ( me ) );
+ return false;
+ }
+
+ if ( content.size == 0 ) {
+ errmsg = new string[1];
+ errmsg[0] = "Parameter name was expected.";
+ return false;
+ }
+
+ Gee.ArrayList<DocElement> contentlst = new Gee.ArrayList<DocElement> ();
+ foreach ( DocElement element in content ) {
+ contentlst.add ( element );
+ }
+
+ DocElement tag = contentlst.get( 0 );
+ if ( tag is StringTaglet == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Parameter name was expected.";
+ return false;
+ }
+
+ string str = ((StringTaglet)tag).content;
+ weak string lposa = str.chr (-1, '\n');
+ weak string lposb = str.chr (-1, ' ');
+ weak string lpos;
+
+ long lposaoffset = (lposa == null)? long.MAX : str.pointer_to_offset ( lposa );
+ long lposboffset = (lposb == null)? long.MAX : str.pointer_to_offset ( lposb );
+
+ if ( lposaoffset < lposboffset )
+ lpos = lposa;
+ else
+ lpos = lposb;
+
+ if ( lpos == null ) {
+ this.paramname = str.strip ();
+ ((StringTaglet)tag).content = "";
+ }
+ else {
+ int namepos = (int)str.pointer_to_offset ( lpos );
+ this.paramname = str.ndup ( namepos ).strip ();
+ ((StringTaglet)tag).content = lpos.ndup ( lpos.size () ).chomp ();
+ }
+
+ bool tmp = this.check_parameter_name ( (Valadoc.ParameterListHandler)me, this.paramname );
+ if ( tmp == false ) {
+ errmsg = new string[1];
+ errmsg[0] = "Unknown parameter.";
+ return false;
+ }
+
+ this.content = contentlst;
+ return true;
+ }
+}
+
+public class Valadoc.ReturnHtmlTaglet : MainTaglet {
+ public override int order { get { return 300; } }
+ private Gee.Collection<DocElement> content;
+
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
+ errmsg = new string[1];
+ errmsg[0] = "Tag @return cannot be used in %s documentation. It can only be used in the following types of documentation: method, signal, delegate.".printf ( this.get_data_type ( me ) );
+ return false;
+ }
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( DocElement element in this.content ) {
+ element.write ( res, _max, _index );
+ _index++;
+ }
+ return true;
+ }
+
+ public override bool write_block_start ( void* res ) {
+ weak GLib.FileStream file = (GLib.FileStream)res;
+ file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
+ return true;
+ }
+
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
+}
+
+
+
+public class Valadoc.StringHtmlTaglet : StringTaglet {
+ public override bool parse ( Settings settings, Tree tree, Basic me, string content ) {
+ this.content = content;
+ return true;
+ }
+
+ public override bool write ( void* res, int max, int index ) {
+ weak GLib.FileStream file = (GLib.FileStream)res;
+ unichar chr = content[0];
+ long lpos = 0;
+ int i = 0;
+
+ for ( i = 0; chr != '\0' ; i++, chr = content[i] ) {
+ switch ( chr ) {
+ case '\n':
+ file.puts ( content.substring (lpos, i-lpos) );
+ file.puts ( "<br />" );
+ lpos = i+1;
+ break;
+ case '<':
+ file.puts ( content.substring (lpos, i-lpos) );
+ file.puts ( "<" );
+ lpos = i+1;
+ break;
+ case '>':
+ file.puts ( content.substring (lpos, i-lpos) );
+ file.puts ( ">" );
+ lpos = i+1;
+ break;
+ case '&':
+ file.puts ( content.substring (lpos, i-lpos) );
+ file.puts ( "&" );
+ lpos = i+1;
+ break;
+ }
+ }
+ file.puts ( content.substring (lpos, i-lpos) );
+ return true;
+ }
+}
+
+
+/* ---- **/
+
+
+
+
public abstract class Valadoc.BasicHtmlLanglet : Valadoc.Langlet {
public Valadoc.Settings settings {
construct set;
@@ -1406,6 +1865,41 @@
file.printf ( "\n\n<br />\n<b>Namespace:</b> %s\n\n", element.full_name() );
}
+ private void write_brief_description ( GLib.FileStream file, Valadoc.Basic element , Valadoc.Basic? pos ) {
+ DocumentationTree? doctree = element.documentation;
+ if ( doctree == null )
+ return ;
+
+ Gee.ReadOnlyCollection<DocElement> brief = doctree.get_brief ( );
+ if ( brief.size > 0 ) {
+ file.printf ( " <span class=\"%s\">- ", css_inline_navigation_brief_description );
+ int _max = brief.size;
+ int _index = 0;
+
+ foreach ( DocElement element in brief ) {
+ if ( element is InlineTaglet )
+ file.puts ( ((InlineTaglet)element).to_string() );
+ else
+ element.write ( file, _max, _index );
+
+ _index++;
+ }
+
+ file.printf ( " </span>\n" );
+ }
+ }
+
+ private void write_documentation ( GLib.FileStream file, Valadoc.Basic element , Valadoc.Basic? pos ) {
+ DocumentationTree? doctree = element.documentation;
+ if ( doctree == null )
+ return ;
+
+ Gee.ReadOnlyCollection<DocElement> brief = doctree.get_brief ( );
+ if ( brief.size > 0 ) {
+ doctree.write_brief ( file );
+ }
+ doctree.write_content ( file );
+ }
public void write_method_content ( GLib.FileStream file, Method m , Valadoc.MethodHandler parent ) {
string full_name = m.full_name ( );
@@ -1418,7 +1912,8 @@
this.langlet.write_method ( file, m, parent );
file.printf ( "\n\t\t\t\t</div>\n" );
- m.write_comment ( file );
+
+ this.write_documentation ( file, m, m );
if ( m.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
@@ -1439,7 +1934,7 @@
file.printf ( "\t<td class=\"%s\" id=\"%s\">%s</td>\n", css_errordomain_table_name, errcode.name, errcode.name );
file.printf ( "\t<td class=\"%s\">\n", css_errordomain_table_text );
- errcode.write_comment ( file );
+ this.write_documentation ( file, errcode, errcode );
file.puts ( "\t</td>\n" );
file.puts ( "</tr>\n" );
@@ -1457,7 +1952,7 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_signal ( sig, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- sig.write_comment ( file );
+ this.write_documentation ( file, sig, sig );
file.puts ( "\t\t\t</div>\n" );
}
@@ -1470,7 +1965,8 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_delegate ( del, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- del.write_comment ( file );
+
+ this.write_documentation ( file, del, del );
if ( del.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
@@ -1490,7 +1986,8 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_field ( field, parent, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- field.write_comment ( file );
+
+ this.write_documentation ( file, field, field );
if ( field.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
@@ -1510,7 +2007,8 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_constant ( constant, parent, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- constant.write_comment ( file );
+
+ this.write_documentation ( file, constant, constant );
if ( constant.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
@@ -1530,7 +2028,7 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_property ( prop, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- prop.write_comment ( file );
+ this.write_documentation ( file, prop, prop );
file.puts ( "\t\t\t</div>\n" );
}
@@ -1540,7 +2038,8 @@
file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
- en.write_comment ( file );
+
+ this.write_documentation ( file, en, en );
if ( en.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
@@ -1565,7 +2064,7 @@
file.printf ( "\t<td class=\"%s\" id=\"%s\">%s</td>\n", css_enum_table_name, enval.name, enval.name );
file.printf ( "\t<td class=\"%s\">\n", css_enum_table_text );
- enval.write_comment ( file );
+ this.write_documentation ( file, enval, en );
file.puts ( "\t</td>\n" );
file.puts ( "</tr>\n" );
@@ -1611,7 +2110,6 @@
protected void write_child_methods ( GLib.FileStream file, MethodHandler mh, Basic? mself ) {
Gee.ReadOnlyCollection<Method> methods = mh.get_method_list ();
-
Gee.ArrayList<Method> imethods = new Gee.ArrayList<Method> ( );
foreach ( Method m in methods ) {
if ( !m.is_static )
@@ -1622,7 +2120,9 @@
file.printf ( "<h3 class=\"%s\">Methods:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Method m in imethods ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
+ this.write_brief_description ( file, m , mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1669,7 +2169,9 @@
file.printf ( "<h3 class=\"%s\">Static Methods:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Method m in static_methods ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
+ this.write_brief_description ( file, m , mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1685,7 +2187,9 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_class ( cl, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- cl.write_comment ( file );
+
+ this.write_documentation ( file, cl, cl );
+
if ( cl.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
this.write_namespace_note ( file, cl );
@@ -1716,7 +2220,9 @@
file.printf ( "\t\t\t\t<div class=\"%s\">\n\t", css_code_definition );
this.langlet.write_interface ( iface, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- iface.write_comment ( file );
+
+ this.write_documentation ( file, iface, iface );
+
if ( iface.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
this.write_namespace_note ( file, iface );
@@ -1740,7 +2246,9 @@
file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, full_name );
file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_headline_hr );
file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
- errdom.write_comment ( file );
+
+ this.write_documentation ( file, errdom, errdom );
+
if ( errdom.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
this.write_namespace_note ( file, errdom );
@@ -1765,7 +2273,8 @@
this.langlet.write_struct ( stru, file );
file.printf ( "\n\t\t\t\t</div>\n" );
- stru.write_comment ( file );
+ this.write_documentation ( file, stru, stru );
+
if ( stru.parent is Namespace ) {
file.puts ( "\t\t\t\t<br />\n" );
this.write_namespace_note ( file, stru );
@@ -1792,7 +2301,9 @@
file.printf ( "<h3 class=\"%s\">Constants:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Constant c in constants ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (c), css_navi_link, this.get_link(c, mself), c.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (c), css_navi_link, this.get_link(c, mself), c.name );
+ this.write_brief_description ( file, c, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1805,6 +2316,8 @@
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Enum en in enums ) {
file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (en), css_navi_link, this.get_link(en, mself), en.name );
+ this.write_brief_description ( file, en, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1816,7 +2329,9 @@
file.printf ( "<h3 class=\"%s\">Errordomains:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( ErrorDomain err in errdoms ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (err), css_navi_link, this.get_link(err, mself), err.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (err), css_navi_link, this.get_link(err, mself), err.name );
+ this.write_brief_description ( file, err, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1828,7 +2343,9 @@
file.printf ( "<h3 class=\"%s\">Construction Methods:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Method m in methods ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (m), css_navi_link, this.get_link(m, mself), m.name );
+ this.write_brief_description ( file, m, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1858,7 +2375,9 @@
file.printf ( "<h3 class=\"%s\">Fields:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Field f in fields ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class(f), css_navi_link, this.get_link(f, mself), f.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class(f), css_navi_link, this.get_link(f, mself), f.name );
+ this.write_brief_description ( file, f, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1870,7 +2389,9 @@
file.printf ( "<h3 class=\"%s\">Properties:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Property prop in properties ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (prop), css_navi_link, this.get_link(prop, mself), prop.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (prop), css_navi_link, this.get_link(prop, mself), prop.name );
+ this.write_brief_description ( file, prop, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1882,7 +2403,9 @@
file.printf ( "<h3 class=\"%s\">Signals:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Signal sig in signals ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (sig), css_navi_link, this.get_link(sig, mself), sig.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (sig), css_navi_link, this.get_link(sig, mself), sig.name );
+ this.write_brief_description ( file, sig, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1902,7 +2425,9 @@
name = subcl.name;
}
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (subcl), css_navi_link, this.get_link(subcl, mself ), name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (subcl), css_navi_link, this.get_link(subcl, mself ), name );
+ this.write_brief_description ( file, subcl, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1914,7 +2439,9 @@
file.printf ( "<h3 class=\"%s\">Interfaces:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Interface iface in ifaces ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (iface), css_navi_link, this.get_link(iface, mself), iface.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (iface), css_navi_link, this.get_link(iface, mself), iface.name );
+ this.write_brief_description ( file, iface, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1926,7 +2453,9 @@
file.printf ( "<h3 class=\"%s\">Delegates:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Delegate d in delegates ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class (d), css_navi_link, this.get_link(d, mself), d.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class (d), css_navi_link, this.get_link(d, mself), d.name );
+ this.write_brief_description ( file, d, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1938,7 +2467,9 @@
file.printf ( "<h3 class=\"%s\">Structs:</h3>\n", css_title );
file.printf ( "<ul class=\"%s\">\n", css_inline_navigation );
foreach ( Struct stru in structs ) {
- file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a></li>\n", get_html_inline_navigation_link_css_class ( stru ), css_navi_link, this.get_link(stru, mself), stru.name );
+ file.printf ( "\t<li class=\"%s\"><a class=\"%s\" href=\"%s\">%s</a>", get_html_inline_navigation_link_css_class ( stru ), css_navi_link, this.get_link(stru, mself), stru.name );
+ this.write_brief_description ( file, stru, mself );
+ file.printf ( "</li>\n" );
}
file.puts ( "</ul>\n" );
}
@@ -1949,7 +2480,8 @@
file.printf ( "\t\t\t\t<h1 class=\"%s\">%s:</h1>\n", css_title, (ns.name == null)? "Global Namespace" : ns.full_name () );
file.printf ( "\t\t\t\t<hr class=\"%s\" />\n", css_hr );
file.printf ( "\t\t\t\t<h2 class=\"%s\">Description:</h2>\n", css_title );
- ns.write_comment ( file );
+
+ this.write_documentation ( file, ns, ns );
file.printf ( "\n\t\t\t\t<h2 class=\"%s\">Content:</h2>\n", css_title );
if ( ns.name == null )
Modified: trunk/src/doclets/valadoc.org/taglets/link/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/link/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/link/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,52 +23,30 @@
using Gee;
-
-public class LinkHtmlTaglet : InlineTaglet, LinkHelper {
- private string content;
- private string path;
- private string css;
-
- public Settings settings {
- construct set;
- get;
+public class Valadoc.LinkValadocOrgTaglet : Valadoc.LinkHtmlHelperTaglet, LinkHelper {
+ protected override string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos ) {
+ return this.get_html_link ( settings, element );
}
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, string content ) {
- string[] arr = content.split ( "\n" );
- string str = string.joinv ("", arr ).strip();
-
- Valadoc.Basic? element = tree.search_symbol_str ( me, str );
- if ( element == null ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+5, "Linked Type is not available.\n", error_start );
- return false;
- }
-
- this.settings = settings;
- this.css = get_html_content_link_css_class ( element );
- this.path = this.get_html_link ( settings, element );
- this.content = element.full_name ();
- return true;
+ public override string to_string () {
+ return to_string_imp ( );
}
-
public override bool write ( void* res, int max, int index ) {
- if ( this.path == null )
- ((GLib.FileStream)res).printf ( "<span class=\"%s\">%s</span>", this.css, this.content );
- else
- ((GLib.FileStream)res).printf ( "<a class=\"%s\" href=\"%s\">%s</a>", this.css, this.path, this.content );
+ return write_imp ( res, max, index );
+ }
- return true;
+ public override bool parse ( Settings settings, Tree tree, Basic me, string content, out string[] errmsg ) {
+ return this.parse_imp ( settings, tree, me, content, out errmsg );
}
}
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( LinkHtmlTaglet );
+ GLib.Type type = typeof ( LinkValadocOrgTaglet );
taglets.set ( "link", type );
return type;
}
+
Modified: trunk/src/doclets/valadoc.org/taglets/parameter/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/parameter/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/parameter/taglet.vala Sun Dec 7 03:33:02 2008
@@ -24,105 +24,6 @@
-
-public class ParameterHtmlTaglet : MainTaglet {
- private Gee.ArrayList<InlineTaglet> content = new Gee.ArrayList<InlineTaglet> ();
- private string paramname = "";
-
- public override int order {
- get { return 100; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Parameters:</h2>\n", css_title );
- file.printf ( "<table class=\"%s\">\n", css_parameter_table );
- return true;
- }
-
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "</table>\n" );
- return true;
- }
-
- private bool check_parameter_name ( Valadoc.ParameterListHandler me, string name ) {
- foreach ( Valadoc.FormalParameter param in me.get_parameter_list ( ) ) {
- if ( param.name == name )
- return true;
- }
- return false;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "@param is not allowed in this contex.\n", error_start );
- return false;
- }
-
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
-
- string strpos = ((StringTaglet)tag).content;
- string paramname;
-
- strpos = this.get_next_word ( strpos, out paramname );
- ((StringTaglet)tag).content = strpos;
- this.paramname = paramname;
-
- if ( this.paramname == "" ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Parameter name was expected.\n", error_start );
- return false;
- }
-
- if ( !check_parameter_name ( ((Valadoc.ParameterListHandler)me), this.paramname ) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<tr>\n" );
- file.printf ( "\t\t<td class=\"%s\">ptr:</td>\n", css_parameter_table_name );
- file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
- file.puts ( "\t\t\t" );
-
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
-
- file.puts ( "\n" );
- file.printf ( "\t\t</td>\n" );
- file.printf ( "\t</tr>\n" );
- return true;
- }
-}
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ParameterHtmlTaglet );
@@ -130,3 +31,5 @@
return type;
}
+
+
Modified: trunk/src/doclets/valadoc.org/taglets/return/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/return/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/return/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,51 +23,6 @@
using Gee;
-
-
-public class ReturnHtmlTaglet : MainTaglet {
- private Gee.ArrayList<InlineTaglet> content = new Gee.ArrayList<InlineTaglet> ();
-
- public override int order {
- get { return 300; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
- return true;
- }
-
- public override bool write_block_end ( void* res ) {
- return true;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "@return is not allowed in this contex.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ReturnHtmlTaglet );
@@ -75,3 +30,4 @@
return type;
}
+
Modified: trunk/src/doclets/valadoc.org/taglets/see/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/see/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/see/taglet.vala Sun Dec 7 03:33:02 2008
@@ -23,79 +23,37 @@
using Gee;
-public class SeeHtmlTaglet : MainTaglet, LinkHelper {
- private string name;
- private string path;
- private string css;
- public override int order {
- get { return 500; }
- }
- public Settings settings {
- construct set;
- get;
+public class Valadoc.SeeValadocOrgTaglet : SeeHtmlHelperTaglet, LinkHelper {
+// protected abstract string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos );
+ protected override string? get_link ( Settings settings, Tree tree, Basic element, Basic? pos ) {
+ return this.get_html_link ( settings, element );
}
public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">See:</h2>\n", css_title );
- file.printf ( "<ul class=\"%s\">", css_see_list );
- return true;
+ return this.write_block_start_imp ( ptr );
}
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.puts ( "</ul>" );
- return true;
+ public override bool write_block_end ( void* res ) {
+ return this.write_block_end_imp ( res );
}
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get ( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Expected a symbol name.\n", error_start );
- return false;
- }
-
- string[] arr = ((StringTaglet)tag).content.split ( "\n" );
- string str = string.joinv ("", arr ).strip();
-
- Valadoc.Basic? element = tree.search_symbol_str ( me, str );
- if ( element == null ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+4, "Linked type is not available.\n", error_start );
- return false;
- }
-
- this.settings = settings;
- this.css = get_html_inline_navigation_link_css_class ( element );
- this.path = this.get_html_link ( settings, element );
- this.name = element.full_name ();
- return true;
+ public override bool write ( void* res, int max, int index ) {
+ return this.write_imp ( res, max, index );
}
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<li class=\"%s\"><a href=\"%s\">%s</a></li>\n", this.css, this.path, this.name );
- return true;
+ public override bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ return this.parse_imp ( settings, tree, me, content, out errmsg );
}
}
+
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( SeeHtmlTaglet );
+ GLib.Type type = typeof ( SeeValadocOrgTaglet );
taglets.set ( "see", type );
return type;
}
Modified: trunk/src/doclets/valadoc.org/taglets/string/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/string/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/string/taglet.vala Sun Dec 7 03:33:02 2008
@@ -25,26 +25,6 @@
-public class StringHtmlTaglet : StringTaglet {
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content ) {
- this.content = content;
- return true;
- }
-
- public override bool write ( void* res, int max , int index ) {
- try {
- string str = new Regex ( Regex.escape_string ("\n")).replace_literal ( this.content, -1, 0, "\n<br>" );
- ((GLib.FileStream)res).puts ( str );
- }
- catch ( RegexError err ) {
- return false;
- }
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( StringHtmlTaglet );
@@ -52,3 +32,4 @@
return type;
}
+
Modified: trunk/src/doclets/valadoc.org/taglets/throws/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/throws/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/throws/taglet.vala Sun Dec 7 03:33:02 2008
@@ -25,108 +25,6 @@
-public class ExceptionHtmlTaglet : MainTaglet {
- private Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
- private string paramname = "";
-
- public override int order {
- get { return 200; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Exceptions:</h2>\n", css_title );
- file.printf ( "<table class=\"%s\">\n", css_exception_table );
- return true;
- }
-
- public override bool write_block_end ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "</table>\n" );
- return true;
- }
-
- private bool check_exception_parameter_name ( Valadoc.ExceptionHandler me, string paramname ) {
- if ( paramname[0] == '.' )
- return false;
-
- foreach ( Valadoc.TypeReference param in me.get_error_domains() ) {
- if ( param.type_name.has_suffix ( paramname ) )
- return true;
- }
- return false;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( !(me is Valadoc.Method || me is Valadoc.Signal || me is Valadoc.Delegate) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "@throws is not allowed in this contex.\n", error_start );
- return false;
- }
-
- if ( content.size == 0 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- string strpos = ((StringTaglet)tag).content;
- string paramname;
-
- strpos = this.get_next_word ( strpos, out paramname );
- ((StringTaglet)tag).content = strpos;
- this.paramname = paramname;
-
- if ( this.paramname == "" ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Errordomain was expected.\n", error_start );
- return false;
- }
-
- if ( !check_exception_parameter_name ( ((Valadoc.ExceptionHandler)me), this.paramname ) ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+6, "Unknown parameter.\n", error_start );
- return false;
- }
-
- this.content = content;
- return true;
- }
-
- public override bool write ( void* ptr, int max, int index ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "\t<tr>\n" );
- file.printf ( "\t\t<td class=\"%s\">ptr:</td>\n", css_parameter_table_name );
- file.printf ( "\t\t<td class=\"%s\">\n", css_parameter_table_text );
- file.puts ( "\t\t\t" );
-
- int _max = this.content.size;
- int _index = 0;
-
- foreach ( Taglet tag in this.content ) {
- tag.write ( ptr, _max, _index );
- _index++;
- }
-
- file.puts ( "\n" );
- file.printf ( "\t\t</td>\n" );
- file.printf ( "\t</tr>\n" );
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
GLib.Type type = typeof ( ExceptionHtmlTaglet );
@@ -134,3 +32,4 @@
return type;
}
+
Modified: trunk/src/doclets/valadoc.org/taglets/version/taglet.vala
==============================================================================
--- trunk/src/doclets/valadoc.org/taglets/version/taglet.vala (original)
+++ trunk/src/doclets/valadoc.org/taglets/version/taglet.vala Sun Dec 7 03:33:02 2008
@@ -24,59 +24,10 @@
-
-public class VersionHtmlTaglet : MainTaglet {
- private string version;
-
- public override int order {
- get { return 400; }
- }
-
- public override bool write_block_start ( void* ptr ) {
- weak GLib.FileStream file = (GLib.FileStream)ptr;
-
- file.printf ( "<h2 class=\"%s\">Version:</h2>\n", css_title );
- return true;
- }
-
- public override bool write_block_end ( void* res ) {
- return true;
- }
-
- public override bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string line_start, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content ) {
- if ( content.size != 1 ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
- return false;
- }
-
- Taglet tag = content.get ( 0 );
- if ( tag is StringTaglet == false ) {
- string error_start = this.extract_lines ( line_start, 0, 0 );
- reporter.add_error ( 0, pos, 0, pos+7, "Inline taglets are not allowed here.\n", error_start );
- return false;
- }
-
- string str = ((StringTaglet)tag).content;
- this.version = str.strip ( );
- return true;
- }
-
- public override bool write ( void* res, int max, int index ) {
- ((GLib.FileStream)res).printf ( "%s", this.version );
- if ( max != index+1 )
- ((GLib.FileStream)res).puts ( ", " );
-
- return true;
- }
-}
-
-
-
[ModuleInit]
public GLib.Type register_plugin ( Gee.HashMap<string, Type> taglets ) {
- GLib.Type type = typeof ( VersionHtmlTaglet );
- taglets.set ( "version", type );
+ GLib.Type type = typeof ( SinceHtmlTaglet );
+ taglets.set ( "since", type );
return type;
}
Modified: trunk/src/libvaladoc/doctree.vala
==============================================================================
--- trunk/src/libvaladoc/doctree.vala (original)
+++ trunk/src/libvaladoc/doctree.vala Sun Dec 7 03:33:02 2008
@@ -224,7 +224,6 @@
if ( tmp == false )
return ;
-
this.documentation = docparser.parse ( this.head, this, docu );
}
@@ -635,20 +634,21 @@
}
}
+// remove
public interface Valadoc.Writeable : Basic {
public abstract DocumentationTree? documentation {
protected set;
get;
}
- // rename to write_documentation
+ /* rename to write_documentation
public bool write_comment ( void* ptr ) {
if ( this.documentation == null )
return false;
this.documentation.write ( ptr );
return true;
- }
+ }*/
}
public interface Valadoc.NamespaceHandler : Basic {
@@ -2029,8 +2029,8 @@
var vformparam = this.vformalparam.parameter_type;
this.set_ret_type ( vformparam );
- var def = this.vformalparam.default_expression;
/*
+ var def = this.vformalparam.default_expression;
if ( def != null ) {
if ( def is Vala.StringLiteral )
this.default_value = def.to_string;
@@ -4410,16 +4410,6 @@
return this.vfiles.contains ( vfile );
}
-/*
-is_package || with_deps || ergebnis
-0 || 0 || 1
-0 || 1 || 1
-1 || 0 || 0
-1 || 1 || 1
-
-!(is_package == true && with_deps == false)
-*/
-
public bool is_visitor_accessible () {
return !( this.is_package && this.settings.with_deps == false );
}
Modified: trunk/src/libvaladoc/errorreporter.vala
==============================================================================
--- trunk/src/libvaladoc/errorreporter.vala (original)
+++ trunk/src/libvaladoc/errorreporter.vala Sun Dec 7 03:33:02 2008
@@ -1,151 +1,41 @@
-/*
- * Valadoc - a documentation tool for vala.
- * Copyright (C) 2008 Florian Brosch
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-using GLib;
-using Vala;
-using Gee;
-
-
-[ErrorDomain]
-public enum CommentParserError {
- UNKNOWN_SYMBOL,
- SUBPARSER,
- BRACKET_ERROR,
- UNKNOWN_OPTION,
- NO_COMMENT_STRING,
- NESTED_BRACKETS,
- SYNTAX_ERROR,
- CONTEXT_ERROR
-}
-
-public class Valadoc.Error : Object {
- public string cmnd {
- construct set;
- get;
- }
-
- public bool is_warning {
- construct set;
- get;
- }
-
- public Basic element {
- construct set;
- get;
- }
-
- public string description {
- construct set;
- get;
- }
-
-
- public CommentParserError err {
- construct set;
- get;
- }
-
- public Error ( Basic element,
- bool is_warning,
- string cmnd,
- CommentParserError err ) {
- this.element = element;
- this.is_warning = is_warning;
- this.cmnd = cmnd;
- this.err = err;
- }
-
- public Error.Message ( Basic element,
- bool is_warning,
- string cmnd,
- string description ) {
- this.element = element;
- this.is_warning = is_warning;
- this.cmnd = cmnd;
- this.description = description;
- }
-
- public void print ( ) {
- string file = this.element.file.name;
- string type = ( this.is_warning )? "warning" : "error";
- string element = this.element.name;
-
- string desc = null;
- if ( this.description == null ) {
- switch ( this.err ) {
- case CommentParserError.UNKNOWN_SYMBOL:
- desc = "unnown symbol"; break;
- case CommentParserError.SUBPARSER:
- desc = "subparser"; break;
- case CommentParserError.UNKNOWN_OPTION:
- desc = "unnown option \"" + this.cmnd + "\"" ; break;
- case CommentParserError.NO_COMMENT_STRING:
- desc = "no comment string"; break;
- case CommentParserError.NESTED_BRACKETS:
- desc = "nested brackets"; break;
- case CommentParserError.SYNTAX_ERROR:
- desc = "syntax error"; break;
- case CommentParserError.CONTEXT_ERROR:
- desc = "context error"; break;
- case CommentParserError.BRACKET_ERROR:
- desc = "open brackets"; break;
- default: desc = "unknown error"; break;
- }
- }
- else {
- desc = this.description;
- }
-///home/mog/Desktop/vendy/vendy/Vendy.Magtek.vala, read: error: linked type is not available.
- if ( this.element.line == 0 )
- stdout.printf ( "%s: %s: in %s: %s\n", file, type, element, desc );
- else
- stdout.printf ( "%s:%d: %s: in %s: %s\n", file, this.element.line, type, element, desc );
- }
-}
public class Valadoc.ErrorReporter : Object {
- Gee.ArrayList<Error> lst = new Gee.ArrayList<Error> ();
+ private int _warnings = 0;
+ private int _errors = 0;
- public int numbers {
+ public int errors {
get {
- return ((Gee.Collection)this.lst).size;
+ return this._errors;
}
}
- public void print_errors ( ) {
- foreach ( Error err in this.lst ) {
- err.print();
+ public int warnings {
+ get {
+ return this._warnings;
}
}
- public void add_with_message ( Basic element, bool is_warning, string? cmnd, string desc ) {
- var tmp = new Error.Message ( element, is_warning, cmnd, desc );
- this.lst.add ( tmp );
+ private enum ErrorType {
+ WARNING,
+ ERROR
}
- public void add ( Basic element, bool is_warning, string? cmnd, CommentParserError err ) {
- var tmp = new Error ( element, is_warning, cmnd,CommentParserError.UNKNOWN_OPTION );
- this.lst.add ( tmp );
+ private inline void msg ( ErrorType type, string file, int line, int startpos, int endpos, string errline, string msg ) {
+ stdout.printf ( "%s:%d.%d-%d.%d: %s: %s\n", file, line, startpos, line, endpos, (type == ErrorType.ERROR)? "error" : "warning", msg );
+ stdout.printf ( "\t%s\n", errline );
+ stdout.printf ( "\t%s%s\n", string.nfill ((uint)startpos, ' '), string.nfill( (uint)(endpos-startpos), '^' ) );
}
-}
+ public void error ( string file, int line, int startpos, int endpos, string errline, string msg ) {
+ this.msg ( ErrorType.ERROR, file, line, startpos, endpos, errline, msg );
+ this._errors++;
+ }
+ public void warning ( string file, int line, int startpos, int endpos, string errline, string msg ) {
+ this.msg ( ErrorType.WARNING, file, line, startpos, endpos, errline, msg );
+ this._warnings++;
+ }
+}
Modified: trunk/src/libvaladoc/parser.vala
==============================================================================
--- trunk/src/libvaladoc/parser.vala (original)
+++ trunk/src/libvaladoc/parser.vala Sun Dec 7 03:33:02 2008
@@ -29,281 +29,105 @@
public static delegate GLib.Type TagletRegisterFunction ( Gee.HashMap<string, Type> taglets );
-public abstract class Taglet : Object {
- public abstract bool write ( void* res, int max, int index );
-
- // => Regexp
- protected weak string get_next_word ( string str, out string param ) {
- GLib.StringBuilder buf = new GLib.StringBuilder ();
-
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- if ( !chr.isspace() )
- break;
- }
-
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- if ( chr.isspace() )
- break;
-
- buf.append_unichar ( chr );
- }
-
- param = buf.str.strip();
- return str;
- }
-
- // remove
- protected static string strip_string ( string str, out int start_line, out int start_pos, out int end_line, out int end_pos ) {
- int lpos = (int)str.length - 1;
- int pos = 0;
-
- while ( str[pos] != '\0' && str[pos].isspace () ) {
- if ( str[pos] == '\n' ) {
- start_line = start_line+2;
- start_pos = 0;
- }
- else {
- start_pos++;
- }
- pos++;
- }
-
- while ( lpos >= 0 && str[lpos].isspace () ) {
- if ( str[lpos] == '\n' ) {
- end_line = end_line+2;
- }
- lpos--;
- }
-
- while ( lpos != 0 && str[lpos] == '\n' ) {
- end_pos++;
- lpos--;
- }
-
- string striped = str.offset(pos).ndup ( lpos-pos+1 );
- end_line += start_line;
-
- for ( int i = 0; striped[i] != '\0'; i++ ) {
- if ( striped[i] == '\n' ) {
- end_line = end_line+2;
- }
- }
-
- if ( end_line == 0 ) {
- end_pos = lpos;
- }
- return striped;
- }
- protected static string? extract_lines ( string content, int line1, int line2 ) {
- if ( line1 > line2 )
- return null;
- string[] lines = content.split ( "\n" );
- int lines_len = 0; for ( ; lines[lines_len] != null; lines_len++ );
- if ( lines_len <= line2 )
- return null;
-
- GLib.StringBuilder str = new GLib.StringBuilder ();
+public abstract class DocElement : Object {
+ public abstract bool write ( void* res, int max, int index );
+}
- while ( line1 < line2+1 ) {
- str.append ( lines[line1] );
- line1++;
-
- if ( line1 < line2+1 )
- str.append_unichar ( '\n' );
- }
- return str.str;
- }
+public abstract class Taglet : DocElement {
+}
- // remove
- public void init ( ) {
- }
+public abstract class InlineTaglet : Taglet {
+ public abstract bool parse ( Settings settings, Tree tree, Basic me, string content, out string[] errmsg );
+ public abstract string to_string ( );
}
public abstract class MainTaglet : Taglet {
- public virtual int order {
- get { return 0; }
- }
+ protected string? get_data_type ( Basic me ) {
+ if ( me is Valadoc.Class )
+ return "class";
+ if ( me is Valadoc.Delegate )
+ return "delegate";
+ if ( me is Valadoc.Interface )
+ return "interface";
+ if ( me is Valadoc.Method )
+ return "method";
+ if ( me is Valadoc.Property )
+ return "property";
+ if ( me is Valadoc.Signal )
+ return "signal";
+ if ( me is Valadoc.Enum )
+ return "enum";
+ if ( me is Valadoc.EnumValue )
+ return "enum-value";
+ if ( me is Valadoc.ErrorDomain )
+ return "errordomain";
+ if ( me is Valadoc.ErrorCode )
+ return "error-code";
+ if ( me is Valadoc.Field )
+ return "field";
+ if ( me is Valadoc.Constant )
+ return "constant";
+ if ( me is Valadoc.Namespace )
+ return "namespace";
- public virtual bool compare_function ( MainTaglet x ) {
- return false;
+ return null;
}
+ public virtual int order { get { return 0; } }
+ public abstract bool parse ( Settings settings, Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg );
public abstract bool write_block_start ( void* res );
public abstract bool write_block_end ( void* res );
- public abstract bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string linestart, int line, int pos, Valadoc.Basic me, Gee.ArrayList<Taglet> content );
-}
-
-public abstract class InlineTaglet : Taglet {
- public abstract bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, Valadoc.Reporter reporter, string linestart, int line, int pos, Valadoc.Basic me, string content );
}
public abstract class StringTaglet : Taglet {
public string content {
- protected set;
- get;
+ set; get;
}
- public abstract bool parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content );
-
- // remove
- public string extract_first_word ( ) { return ""; }
-
- // remove
- // add counter-stuff!
- public string extract_first_word2 ( out int word_line, out int word_pos, ref int line, ref int pos ) {
- GLib.StringBuilder buf = new GLib.StringBuilder ( "" );
- string str = this.content;
-
- if ( str == null ) {
- return ""; // FIXME: str should never be null
- }
-
- for ( unichar chr = str.get_char(); chr != '\0'; str = str.next_char(), chr = str.get_char() ) {
- if ( !chr.isspace() )
- break;
-
- pos++;
-
- if ( chr == '\n' ) {
- line = line+2;
- pos = 0;
- }
- }
-
- word_line = line;
- word_pos = pos;
-
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- if ( chr.isspace() )
- break;
-
- pos++;
-
- buf.append_unichar ( chr );
- }
-
- this.content = str;
- return buf.str;
- }
+ public abstract bool parse ( Settings settings, Tree tree, Basic me, string content );
}
-
-private enum ReporterMessageType {
- WARNING,
- ERROR
-}
-
-
-public class Reporter : Object {
- private int __warnings;
- private int __errors;
-
- public int warnings {
- get {
- return this.__warnings;
- }
- }
-
- public int errors {
- get {
- return this.__errors;
- }
- }
-
- private bool new_message ( ReporterMessageType type, int startline, int startchr, int endline, int endchr, string errtxt, string lines ) {
- string filename = "filename.vala";
- string typestr = (type == ReporterMessageType.WARNING)?"warning":"error";
-
- stdout.printf ( "%s:%d.%d-%d.%d: %s: %s", filename, startline, startchr, endline, endchr, typestr, errtxt );
-
-
- string[] linev = lines.split ( "\n" );
- if ( linev == null ) {
- linev = new string[2];
- linev[0] = lines;
- linev[1] = null;
- }
-
- for ( int i = 0; linev[i] != null ; i++ ) {
- int rl = i + startline;
- stdout.printf ( "\t %s\n", linev[i] );
-
- if ( rl == startline ) {
- int len = (int)linev[i].len ( );
- int ulen;
-
-
- if ( startline == endline )
- ulen = ( endchr == startchr )? 1 : endchr - startchr;
- else
- ulen = len - startchr;
-
- string ustr = string.nfill ( ulen, '^' );
- string sstr = string.nfill ( startchr, ' ' );
- stdout.printf ( "\t%s%s\n", sstr, ustr );
- }
-/* else if ( rl == endline ) {
- string ustr = string.nfill ( endchr, '^' );
- stdout.printf ( "\t%s\n", ustr );
- }
- else {
- long len = linev[i].len ( );
- string ustr = string.nfill ( len, '^' );
- stdout.printf ( "\t%s\n", ustr );
- }
-*/
- }
- return true;
- }
-
- public bool add_warning (int startline, int startchr, int endline, int endchr, string errtxt, string lines ) {
- this.__warnings++;
-
- return this.new_message ( ReporterMessageType.WARNING, startline, startchr, endline,
- endchr, errtxt, lines );
- }
-
- public bool add_error (int startline, int startchr, int endline, int endchr, string errtxt, string lines ) {
- this.__errors++;
-
- return this.new_message ( ReporterMessageType.ERROR, startline, startchr, endline,
- endchr, errtxt, lines );
- }
-}
-
-
-
public class DocumentationTree : Object {
- private Gee.ArrayList<InlineTaglet> description = new Gee.ArrayList<InlineTaglet> ();
+ private Gee.ArrayList<DocElement> description = new Gee.ArrayList<DocElement> ();
+ private Gee.ArrayList<DocElement> brief = new Gee.ArrayList<DocElement> ();
private Gee.HashMap<string, Gee.ArrayList<MainTaglet> > taglets
= new Gee.HashMap<string, Gee.ArrayList<MainTaglet> > ( GLib.str_hash, GLib.str_equal );
- public bool add_taglet ( string tag, MainTaglet taglet ) {
+ public void add_taglet ( string tag, MainTaglet taglet ) {
if ( this.taglets.contains ( tag ) ) {
Gee.ArrayList<MainTaglet> lst = this.taglets.get ( tag );
lst.add ( taglet );
- return true;
}
else{
Gee.ArrayList<MainTaglet> nlst = new Gee.ArrayList<MainTaglet> ();
nlst.add ( taglet );
this.taglets.set ( tag, nlst );
- return true;
}
}
- public bool add_description ( Gee.ArrayList<Taglet> content ) {
+ public Gee.ReadOnlyCollection<DocElement> get_brief ( ) {
+ return new Gee.ReadOnlyCollection<DocElement> ( (this.brief == null)? new Gee.ArrayList<DocElement>() : this.brief );
+ }
+
+ public void add_brief ( Gee.ArrayList<DocElement> content ) {
+ this.brief = content;
+ }
+
+ public Gee.ReadOnlyCollection<DocElement> get_description ( ) {
+ return new Gee.ReadOnlyCollection<DocElement> ( (this.description == null)? new Gee.ArrayList<DocElement>() : this.description );
+ }
+
+ public void add_description ( Gee.ArrayList<DocElement> content ) {
this.description = content;
- return true;
}
private static Gee.ArrayList< Gee.ArrayList<MainTaglet> > sort_tag_collection ( Gee.Collection< Gee.ArrayList<MainTaglet> > lst ) {
@@ -336,13 +160,30 @@
return slst;
}
- public bool write ( void* res ) {
+ public bool write_brief ( void* res ) {
+ if ( this.brief == null )
+ return true;
+
+ int _max = this.brief.size;
+ int _index = 0;
+
+ foreach ( DocElement element in this.brief ) {
+ element.write ( res, _max, _index );
+ _index++;
+ }
+ return true;
+ }
+
+ public bool write_content ( void* res ) {
+ if ( this.description == null )
+ return true;
+
bool tmp;
int max = this.description.size;
int i = 0;
- foreach ( InlineTaglet tag in this.description ) {
+ foreach ( DocElement tag in this.description ) {
tmp = tag.write ( res, max, i );
if ( tmp == false )
return false;
@@ -381,494 +222,475 @@
-public class Parser : Object {
- private Gee.HashMap< string, GLib.Type > taglets;
- private GLib.Type stringtag;
- private Reporter reporter;
- private Settings settings;
-
- public void init ( Settings settings, Reporter reporter, GLib.Type strtag, Gee.HashMap< string, GLib.Type > taglets ) {
- this.reporter = reporter;
- this.stringtag = strtag;
- this.settings = settings;
- this.taglets = taglets;
- }
- private static inline string extract_line ( string str ) {
- str = str.next_char();
- weak string? pos = str.chr ( -1, '\n' );
- if ( pos == null )
- return str;
- string line = str.ndup ( (char*)pos - (char*)str );
- return line;
- }
- private inline bool skip_documentation_header ( ref string str, ref int linenr, ref int pos ) {
- string linestart = str;
- int borderpos = pos;
- if ( str[0] != '*' ) {
- string line = Parser.extract_line ( str );
- this.reporter.add_error ( linenr, 0, linenr, (int)line.len(), "Comment is not a documentation string.\n", string.nfill(borderpos, ' ')+"/*"+line );
- return false;
- }
- str = str.next_char();
- pos++;
+/** Start Testtaglets **
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- if ( chr == '\n' ) {
- linenr++;
- pos = 0;
- return true;
- }
+public class ReturnHtmlTaglet : MainTaglet {
+ public override int order { get { return 90000; } }
+ private Gee.Collection<DocElement> content;
- pos++;
-
- if ( !chr.isspace() ) {
- string line = Parser.extract_line ( linestart );
- this.reporter.add_error ( linenr, 0, linenr, (int)line.len() + 3, "Comment is not a documentation string.\n", string.nfill(borderpos, ' ')+"/*"+line );
- return false;
- }
- }
- string line = Parser.extract_line ( linestart );
- this.reporter.add_error ( linenr, 0, linenr, (int)line.len() + 3, "Incomplete Documentation header\n", string.nfill(borderpos, ' ')+"/*"+line );
- return false;
+ public override bool parse ( Tree tree, Basic me, Gee.Collection<DocElement> content, out string[] errmsg ) {
+ this.content = content;
+ return true;
}
- // rm linenr
- private bool skip_deadh_zone ( ref string str, ref unichar chr, int linenr, ref int pos ) {
- string linestart = str;
-
- str = str.next_char();
- pos = 0;
-
- for ( chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- pos++;
+ public override bool write_block_start ( void* ptr ) {
+ weak GLib.FileStream file = (GLib.FileStream)ptr;
+ file.printf ( "<h2 class=\"%s\">Returns:</h2>\n", css_title );
+ return true;
+ }
- if ( chr == '*' )
- return true;
+ public override bool write_block_end ( void* res ) {
+ return true;
+ }
- if ( !chr.isspace() ) {
- int endpos = 0;
+ public override bool write ( void* res, int max, int index ) {
+ int _max = this.content.size;
+ int _index = 0;
+
+ foreach ( DocElement tag in this.content ) {
+ tag.write ( res, _max, _index );
+ _index++;
+ }
+ return true;
+ }
+}
- string line = Parser.extract_line ( linestart );
- weak string? endposstr = str.chr( line.len(), '*' );
- if ( endposstr != null ) {
- endpos = (int)(linestart.len() - endposstr.len());
- }
+public class LinkHtmlInlineTaglet : InlineTaglet {
+ string content;
- this.reporter.add_error ( linenr, pos, linenr, endpos, "Invalid documentation body.\n", line );
- return false;
- }
- }
- // end of comment
+ public override bool parse ( Tree tree, Basic me, string content, out string[] errmsg ) {
+ this.content = content;
return true;
}
- private inline void set_prev_chr ( out unichar prev, out unichar prevprev, unichar push ) {
- prevprev = prev;
- prev = push;
+ public override bool write ( void* res, int max, int index ) {
+ stdout.printf ( "(%s)", content );
+ return true;
}
+}
+/** Ende Testtaglets **/
- private string? parse_taglet_name ( ref string str, out unichar prevchr, out unichar prevprevchr, ref string linestart, ref int linenr, ref int pos ) {
- GLib.StringBuilder buf = new GLib.StringBuilder ();
- str = str.next_char();
- int startpos = pos;
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- this.set_prev_chr ( out prevchr, out prevprevchr, chr );
- pos++;
+public class Parser {
+ private ErrorReporter err;
+ private Settings settings;
- if ( chr == '\n' ) {
- linestart = str;
- linenr++;
- pos = 0;
+ private int linestartpos;
- this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
-// this.set_prev_chr ( out prevchr, out prevprevchr, 'p' );
- return buf.str;
- }
+ private int line;
+ private int pos;
- if ( chr.isspace() ) {
- return buf.str;
- }
+ private weak string filename;
+ private int startline = 0;
+ private int startpos = 0;
- if ( !((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z')) ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "invalide taglet name.\n";
- int endpos = pos;
-
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- if ( chr.isspace() )
- break;
+ private bool run;
- endpos ++;
- }
+ private weak string str;
- this.reporter.add_error (linenr, startpos, linenr, endpos, reportmsg, line );
- return null;
- }
- buf.append_unichar ( chr );
- }
- string line = this.extract_line ( linestart );
- string reportmsg = "Incomplete Taglet.\n";
- this.reporter.add_error (linenr, startpos, linenr, (int)line.len(), reportmsg, line );
- return null;
- }
+ private bool errflag = false;
- public StringTaglet create_string_tag ( Valadoc.Tree tree, Valadoc.Basic me, string start_line, int linenr, int pos, string str ) {
- StringTaglet strt = (StringTaglet)GLib.Object.new ( this.stringtag );
- strt.init ( );
+ private Gee.HashMap< string, GLib.Type > taglets;
+ private GLib.Type strtag;
-// strt.parse ( Valadoc.Settings settings, Valadoc.Tree tree, string content );
- strt.parse ( this.settings, tree, str );
- return strt;
+ public Parser ( Settings settings, ErrorReporter reporter, GLib.Type strtag, Gee.HashMap< string, GLib.Type > taglets ) {
+ this.settings = settings;
+ this.taglets = taglets;
+ this.strtag = strtag;
+ this.err = reporter;
}
+ private inline string extract_line ( int starttag_linestartpos = -1 ) {
+ if ( starttag_linestartpos == -1 )
+ starttag_linestartpos = this.linestartpos;
- public bool append_new_tag ( Valadoc.Tree mtree, Valadoc.Basic me, DocumentationTree tree, string? name, Gee.ArrayList<Taglet> content, string linestart, int linenr, int pos ) {
- if ( name == null ) {
- tree.add_description ( content );
- return true;
- }
-
- if ( !this.taglets.contains( name ) ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "Taglet '%s' is not registered.\n".printf( name );
- this.reporter.add_error (linenr, pos, linenr, pos+(int)name.len()+1, reportmsg, line );
- return false;
- }
-
- GLib.Type type = this.taglets.get ( name );
- Taglet taglet = (Taglet)GLib.Object.new ( type );
- if ( taglet is MainTaglet == false ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "'%s' is an inline taglet.\n".printf( name );
- this.reporter.add_error (linenr, pos, linenr, pos+(int)name.len()+1, reportmsg, line );
- return false;
+ weak string startpos = this.str.offset(starttag_linestartpos+1);
+ weak string endpos = startpos.chr ( -1, '\n' );
+ if ( endpos == null ) {
+ for ( endpos = startpos; endpos.get_char() != '\0' ; endpos = endpos.next_char() );
}
- taglet.init ();
- ((MainTaglet)taglet).parse ( this.settings, mtree, this.reporter, linestart.offset(1), linenr, pos, me, content );
- tree.add_taglet ( name, (MainTaglet)taglet );
- return true;
- }
-
- private inline void skip_spaces ( ref string str, ref int pos ) {
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- pos++;
- if ( !chr.isspace() )
- return ;
- }
+ return startpos.ndup (startpos.pointer_to_offset ( endpos ));
}
+ private void error ( string desc, int len, int starttag_linestartpos = -1, int starttag_startpos = -1, int starttag_line = -1, int starttag_pos = -1 ) {
+ if ( starttag_linestartpos == -1 )
+ starttag_linestartpos = this.linestartpos;
+ if ( starttag_startpos == -1 )
+ starttag_startpos = this.startpos;
+ if ( starttag_line == -1 )
+ starttag_line = this.line;
+ if ( starttag_pos == -1 )
+ starttag_pos = this.pos;
- // add line counting
- private InlineTaglet? parse_bracket ( Valadoc.Tree tree, Valadoc.Basic me, ref string str, ref string linestart, ref int linestartnr, ref int linenr, ref int pos ) {
- int startpos = pos;
+ int startpos = starttag_pos - starttag_linestartpos - 1;
+ if ( starttag_line == 0 )
+ startpos += starttag_startpos;
- str = str.next_char();
- pos++;
+ int endpos = startpos+len;
- string tagline = linestart;
+ this.err.error ( this.filename, starttag_line+this.startline, int.min(startpos, endpos), int.max(startpos, endpos), this.extract_line(starttag_linestartpos), desc );
+ this.errflag == true;
+ }
- unichar prevprevchr = '\0';
- unichar prevchr = '\0';
+ private void next_char ( ) {
+ for ( pos++; (str[pos] == ' ' || str[pos] == '\t') && (str[pos+1] == ' ' || str[pos+1] == '\t' ); pos++ );
- GLib.StringBuilder buf = new GLib.StringBuilder ();
- this.skip_spaces ( ref str, ref pos );
+ if ( str[pos] == '\0' )
+ this.run = false;
+ }
- int taglinenr = linenr;
- int tagpos = pos-1;
+ private void skip_newline () {
+ this.linestartpos = pos;
+ this.line++;
- if ( str[0] != '@' ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "Bracket is not allowed in this context.\n";
- this.reporter.add_error ( linenr, startpos, linenr, startpos, reportmsg, line );
- return null;
- }
+ this.next_char ();
- string? tagname = this.parse_taglet_name ( ref str, out prevchr, out prevprevchr, ref linestart, ref linenr, ref pos );
- if ( tagname == null )
- return null;
+ unichar chr = str[pos];
- str = str.next_char();
-// pos++;
+ if ( chr == ' ' || chr == '\t' )
+ chr = str[++pos];
- if ( !this.taglets.contains( tagname ) ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "Taglet '%s' is not registered.\n".printf( tagname );
- this.reporter.add_error (linenr, startpos+1, linenr, startpos+(int)tagname.len()+2, reportmsg, line );
- return null;
+ if ( chr == '\0' ) {
+ this.run = false;
+ return ;
}
- GLib.Type tagtype = this.taglets.get ( tagname );
- GLib.Object tag = GLib.Object.new (tagtype );
- if ( tag is InlineTaglet == false ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "'%s' is not an inline taglet.\n".printf( tagname );
- this.reporter.add_error (linenr, tagpos, linenr, tagpos+(int)tagname.len()+1, reportmsg, line );
- return null;
+ if ( chr != '*' ) {
+ this.error ( "syntax error - invalid body.", 1 );
+ this.run = false;
}
+ chr = str[pos+1];
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- pos++;
-
- bool tmp = this.escaped_characters ( ref str, linestart, linenr, ref chr, ref prevchr, ref prevprevchr, ref pos );
- if ( tmp == true ) {
- buf.append_unichar ( chr );
- continue ;
- }
-
- tmp = this.newline_handler ( buf, ref linestart, ref str, ref linenr, ref pos, ref linestartnr, ref chr, ref prevchr, ref prevprevchr );
- if ( chr == '\0' ) {
- break;
- }
- else if ( tmp == true ) {
- continue;
- }
-
- tmp = this.skip_double_spaces ( ref str, buf, chr, ref prevchr, ref prevprevchr );
- if ( tmp == true )
- continue ;
-
-
- if ( chr == '}' ) {
- if ( prevchr.isspace() )
- buf.erase ( buf.len-1, -1);
-
- InlineTaglet rtag = ((InlineTaglet)tag);
- rtag.init ( );
-
- rtag.parse ( this.settings, tree, this.reporter, tagline.offset(1), taglinenr, tagpos, me, buf.str );
- return rtag;
- }
-
- if ( chr == '@' || chr == '{' ) {
- string line = this.extract_line ( linestart );
- string reportmsg = "Error: Character is not allowed in this context.\n";
- this.reporter.add_error (linenr, pos-1, linenr, pos-1, reportmsg, line );
- return null;
- }
-
+ if ( chr == ' ' || chr == '\t' )
+ this.next_char ();
+ }
+ private void parse_escape ( GLib.StringBuilder buf ) {
+ unichar chr = this.str[this.pos+1];
+ switch ( chr ) {
+ case '@':
+ case '}':
+ case '{':
+ case '\\':
buf.append_unichar ( chr );
- this.set_prev_chr ( out prevchr, out prevprevchr, chr );
+ break;
+ case '\0':
+ this.error ( "syntax error - invalid escape sequence.", 1 );
+ this.run = false;
+ break;
+ default:
+ this.error ( "syntax error - invalid escape sequence.", 2 );
+ break;
}
-
- string line = this.extract_line ( linestart );
- string reportmsg = "Warning: Bracket is not closed.\n";
- this.reporter.add_error (linenr, startpos, linenr, (int)linestart.len(), reportmsg, line );
- return null;
+ this.pos++;
}
- private inline bool skip_double_spaces ( ref string str, GLib.StringBuilder buf,unichar chr, ref unichar prevchr, ref unichar prevprevchr ) {
- if ( chr.isspace() ) {
- buf.append_unichar ( ' ' );
-
- if ( prevchr.isspace() )
- return true;
+ private string parse_name ( ) {
+ int startpos = ++this.pos;
- string tmpstr = str.next_char();
- unichar nextchr = tmpstr.get_char();
+ for ( unichar chr = this.str[this.pos]; !(chr == ' ' || chr == '\t' || chr == '\0'); chr = this.str[++this.pos] );
+ if ( this.str[this.pos] == '\0' )
+ this.run = false;
- if ( nextchr.isspace() )
- return true;
+ return this.str.offset(startpos).ndup ( (uint)(this.pos-startpos) );
+ }
- this.set_prev_chr ( out prevchr, out prevprevchr, ' ' );
- return true;
+ private InlineTaglet? create_inline_taglet ( string name ) {
+ if ( this.taglets.contains ( name ) == false ) {
+ this.error ( "error - taglet '%s' is not registered.\n".printf( name ), -(int)name.len()-1 );
+ return null;
}
- return false;
- }
- private inline bool escaped_characters ( ref string str, string linestart, int linenr, ref unichar curchr, ref unichar prevchr, ref unichar prevprevchr, ref int pos ) {
- if ( curchr == '\\' ) {
- str = str.next_char();
- curchr = str.get_char();
+ GLib.Type type = this.taglets.get ( name );
+ Taglet taglet = (Taglet)GLib.Object.new ( type );
+ if ( taglet is InlineTaglet == false ) {
+ this.error ( "context error - '%s' is not an inline taglet.\n".printf( name ), -(int)name.len()-1 );
+ return null;
+ }
+ return (InlineTaglet)taglet;
+ }
- prevprevchr = prevchr;
- prevchr = '\\';
+ private MainTaglet? create_main_taglet ( string name ) {
+ if ( this.taglets.contains ( name ) == false ) {
+ this.error ( "error - taglet '%s' is not registered.\n".printf( name ), -(int)name.len()-1 );
+ return null;
+ }
- if (!( curchr == '@' || curchr == '{' || curchr == '}' || curchr == '\\' )) {
- GLib.StringBuilder unichrstr = new GLib.StringBuilder ( "" );
- unichrstr.append_unichar( curchr );
+ GLib.Type type = this.taglets.get ( name );
+ Taglet taglet = (Taglet)GLib.Object.new ( type );
+ if ( taglet is MainTaglet == false ) {
+ this.error ( "context error - '%s' is an inline taglet.\n".printf( name ), -(int)name.len()-1 );
+ return null;
+ }
+ return (MainTaglet)taglet;
+ }
- string line = this.extract_line ( linestart );
- string reportmsg = "'\\%s' is not a valid character.\n".printf ( unichrstr.str );
- this.reporter.add_error (linenr, pos, linenr, pos+2, reportmsg, line );
- return false;
+ private void print_error_messages ( string[] errmsgs, int namelen, int starttag_linestartpos, int starttag_startpos, int starttag_line, int starttag_pos ) {
+ if ( errmsgs != null ) {
+ foreach ( string msg in errmsgs ) {
+ this.error ( msg, namelen+1, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
}
- return true;
}
- return false;
+ else {
+ this.error ( "unknown error", namelen+1, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
+ }
}
- private bool newline_handler ( GLib.StringBuilder buf, ref string linestart, ref string str, ref int linenr, ref int pos, ref int linestartnr, ref unichar chr, ref unichar prevchr, ref unichar prevprevchr ) {
- if ( chr == '\n' ) {
- linestartnr = linenr;
- linestart = str;
- linenr++;
- pos = 0;
-
- this.skip_deadh_zone ( ref str, ref chr, linenr, ref pos );
- if ( chr == '\0' )
- return false;
-
- if ( prevchr == '\n' ) {
- buf.append_unichar ( '\n' );
- }
+ private void parse_inline_taglet ( Tree tree, Basic me, string content, InlineTaglet taglet, int namelen, int starttag_linestartpos, int starttag_startpos, int starttag_line, int starttag_pos ) {
+ string[] errmsgs;
- this.set_prev_chr ( out prevchr, out prevprevchr, '\n' );
- return true;
+ bool tmp = taglet.parse ( settings, tree, me, content, out errmsgs );
+ if ( tmp == false ) {
+ this.print_error_messages ( errmsgs, namelen, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
}
- return false;
}
- public DocumentationTree? parse ( Valadoc.Tree tree, Valadoc.Basic me, string str2 ) {
- string str = str2;
+ private void parse_main_taglet ( Tree tree, Basic me, Gee.ArrayList<DocElement> content, MainTaglet taglet, int namelen, int starttag_linestartpos, int starttag_startpos, int starttag_line, int starttag_pos ) {
+ string[] errmsgs;
- GLib.StringBuilder buf = new GLib.StringBuilder ();
- DocumentationTree doctree = new DocumentationTree ();
-
- int linenr = 0;
- int pos = 0;
-
-
- bool tmp = this.skip_documentation_header ( ref str, ref linenr, ref pos );
+ bool tmp = taglet.parse ( settings, tree, me, content, out errmsgs );
if ( tmp == false ) {
- return null;
+ this.print_error_messages ( errmsgs, namelen, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
}
+ }
- Gee.ArrayList<Taglet> content = new Gee.ArrayList<Taglet> ();
- string? currtagname = null;
- string currtagline = str;
- int currtagstartpos = 0;
- int currtagstartlinenr = 0;
-
+ private void append_main_taglet ( Tree tree, DocumentationTree dtree, Basic me, MainTaglet? curtag, int paragraph, string? curtagname, Gee.ArrayList<DocElement> content, int starttag_linestartpos, int starttag_startpos, int starttag_line, int starttag_pos ) {
+ if ( curtag == null ) {
+ if ( paragraph == 0 )
+ dtree.add_brief ( content );
+ else
+ dtree.add_description ( content );
+ }
+ else {
+ this.parse_main_taglet ( tree, me, content, curtag, (int)curtagname.length, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
+ dtree.add_taglet ( curtagname, curtag );
+ }
+ }
- unichar prevprevchr = '\0';
- unichar prevchr = '\0';
+ private StringTaglet create_string_taglet ( Tree tree, Basic? me, GLib.StringBuilder buf ) {
+ StringTaglet strtag = (StringTaglet)GLib.Object.new ( strtag );
+ strtag.parse ( settings, tree, me, buf.str );
+ buf.erase ( 0, -1 );
+ return strtag;
+ }
- // weak
- string? linestart = str;
- int linestartnr = 0;
+ private void append_and_create_string_taglet ( Gee.ArrayList<DocElement> content, Tree tree, Basic? me, GLib.StringBuilder buf ) {
+ if ( buf.len == 0 )
+ return ;
- for ( unichar chr = str.get_char(); chr != '\0' ; str = str.next_char(), chr = str.get_char() ) {
- pos++;
+ StringTaglet strtag = this.create_string_taglet ( tree, me, buf );
+ content.add ( strtag );
+ }
- bool tmp = this.escaped_characters ( ref str, linestart, linenr, ref chr, ref prevchr, ref prevprevchr, ref pos );
- if ( tmp == true ) {
- buf.append_unichar ( chr );
- continue ;
- }
+ private void parse_inline_taglets ( Tree tree, Basic me, Gee.ArrayList<DocElement> elements ) {
+ this.pos++;
- tmp = this.newline_handler ( buf, ref linestart, ref str, ref linenr, ref pos, ref linestartnr, ref chr, ref prevchr, ref prevprevchr );
- if ( chr == '\0' ) {
- break;
- }
- else if ( tmp == true ) {
+ for ( unichar chr = this.str[this.pos]; ; chr = this.str[++this.pos] ) {
+ switch ( chr ) {
+ case '\t':
+ case ' ':
continue;
+ case '\n':
+ this.skip_newline ();
+ continue;
+ case '\0':
+ // error message
+ this.run = false;
+ return ;
+ default:
+ break;
}
+ break ;
+ }
- tmp = this.skip_double_spaces ( ref str, buf, chr, ref prevchr, ref prevprevchr );
- if ( tmp == true )
- continue ;
+ int starttag_linestartpos = this.linestartpos;
+ int starttag_startpos = this.startpos;
+ int starttag_line = this.line;
+ int starttag_pos = this.pos;
+ if ( this.str[this.pos] != '@' ) {
+ // fehlermeldung
+ this.run = false;
+ return ;
+ }
- if ( chr == '{' ) {
- // <
- if ( buf.len > 0 ) {
- StringTaglet strtag = this.create_string_tag ( tree, me, linestart, linenr, pos, buf.str );
- content.add ( strtag );
- prevchr = '}';
- buf.erase ( 0, -1 );
- }
- // >
+ GLib.StringBuilder buf = new GLib.StringBuilder ( );
+ string name = this.parse_name ( );
+ // if ( name == "" ) => fehlermeldung
+
+ InlineTaglet? taglet = this.create_inline_taglet ( name );
+ if ( taglet == null ) {
+ return ;
+ }
- InlineTaglet itag = this.parse_bracket ( tree, me, ref str, ref linestart, ref linestartnr, ref linenr, ref pos );
- if ( itag == null ) {
- return null;
+ for ( unichar chr = this.str[this.pos]; chr != '\0' ; chr = this.str[++this.pos] ) {
+ switch ( chr ) {
+ case '\t':
+ case ' ':
+ if ( buf.len > 0 && buf.str[buf.len-1] != ' ' ) {
+ buf.append_unichar ( ' ' );
}
- content.add ( itag );
- continue ;
- }
- else if ( chr == '}' ) {
- string line = this.extract_line ( linestart );
- this.reporter.add_error (linenr, pos, linenr, pos, "syntax error.\n", line );
- return null;
- }
- else if ( chr == '@' && prevchr.isspace() ) {
- // <
- if ( buf.len > 0 ) {
- StringTaglet strtag = this.create_string_tag ( tree, me, linestart, linenr, pos, buf.str );
- content.add ( strtag );
- buf.erase ( 0, -1 );
+ continue;
+ case '\n':
+ this.skip_newline ();
+ if ( buf.len > 0 && buf.str[buf.len-1] != ' ' ) {
+ buf.append_unichar ( ' ' );
+ }
+ continue;
+ case '}':
+ if ( buf.len > 0 && buf.str[buf.len-1] == ' ' ) {
+ buf.erase ( buf.len-1, -1 );
}
- this.append_new_tag ( tree, me, doctree, currtagname, content, currtagline, currtagstartlinenr, currtagstartpos );
- // >
- content = new Gee.ArrayList<InlineTaglet> ();
-
- currtagstartlinenr = linenr;
- currtagstartpos = pos;
- currtagline = linestart;
- currtagname = this.parse_taglet_name ( ref str, out prevchr, out prevprevchr, ref linestart, ref linenr, ref pos );
+ this.parse_inline_taglet ( tree, me, buf.str, taglet, (int)name.length, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
+ if ( this.run == true ) {
+ elements.add ( taglet );
+ }
+ return ;
+ default:
+ buf.append_unichar ( chr );
continue ;
}
-
- buf.append_unichar ( chr );
- this.set_prev_chr ( out prevchr, out prevprevchr, chr );
}
+ //error - Missing closing '}' character for inline tag.
+ this.run = false;
+ return ;
+ }
+
+ private bool skip_documentation_header () {
+ for ( this.pos = 0; str[this.pos] != '\0' && str[this.pos] == '*'; this.pos++ );
+ for ( ; str[this.pos] != '\0' && (str[this.pos] == ' ' || str[this.pos] == '\t'); this.pos++ );
+ return ( str[this.pos] == '\n' );
+ }
+
+ public DocumentationTree? parse ( Tree tree, Basic me, string str ) {
+ Gee.ArrayList<DocElement> content = new Gee.ArrayList<DocElement> ();
+ GLib.StringBuilder buf = new GLib.StringBuilder ( );
+ DocumentationTree dtree = new DocumentationTree ();
+ string curtagname = null;
+ MainTaglet curtag = null;
+
+ int starttag_linestartpos = 0;
+ int starttag_startpos = 0;
+ int starttag_line = 0;
+ int starttag_pos = 0;
+ int paragraph = 0;
+
+ this.linestartpos = 0;
+ this.startpos = 0;
+ this.line = 0;
+ this.pos = 0;
+
+ this.run = true;
+ this.str = str;
+ this.line = 0;
- if ( buf.len > 0 ) {
- StringTaglet strtag = this.create_string_tag ( tree, me, linestart, linenr, pos, buf.str );
- content.add ( strtag );
- }
+ this.filename = "fooo";
- this.append_new_tag ( tree, me, doctree, currtagname, content, currtagline, currtagstartlinenr, currtagstartpos );
- tmp = this.check_foother ( ref linestart, linenr );
- if ( tmp == false )
+ bool tmp = this.skip_documentation_header ();
+ if ( tmp == false ) {
+ this.error ( "syntax error - invalid documentation header.", 1 );
return null;
+ }
- return doctree;
- }
-
- private inline bool check_foother ( ref string lastline, int linenr ) {
- for ( unichar chr = lastline.get_char(); chr != '\0' ;
- lastline = lastline.next_char(), chr = lastline.get_char() )
- {
- if ( chr.isspace() )
- continue ;
+ for ( ; str[pos] != '\0'; this.next_char ( ) ) {
+ if ( this.run == false )
+ break;
- string line = this.extract_line ( lastline );
- string reportmsg = "syntax error - invalid body.\n";
- this.reporter.add_error (linenr, 0, linenr, (int)line.len()+1, reportmsg, line+"*/" );
- return false;
+ switch ( str[pos] ) {
+ case ' ':
+ case '\t':
+ if ( buf.str[buf.len-1] != '\n' && buf.len > 0 && buf.str[buf.len-1] != ' ') {
+ buf.append_unichar ( ' ' );
+ }
+ break;
+ case '\n':
+ this.skip_newline ();
+
+ if ( str[pos+1] == '\n' ) {
+ if ( paragraph == 0 ) {
+ this.append_and_create_string_taglet ( content, tree, me, buf );
+ this.append_main_taglet ( tree, dtree, me, curtag, paragraph, curtagname, content, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
+ content = new Gee.ArrayList<DocElement> ();
+ paragraph++;
+ break;
+ }
+ buf.append_unichar ( '\n' );
+ paragraph++;
+ break ;
+ }
+ else if ( str[pos+1] == '@' ) {
+ pos++;
+
+ int f_starttag_linestartpos = this.linestartpos;
+ int f_starttag_startpos = this.startpos;
+ int f_starttag_line = this.line;
+ int f_starttag_pos = this.pos;
+
+ string name = this.parse_name ( );
+ if ( name == "" ) {
+ buf.append_unichar ( '@' ); // Warning?
+ break;
+ }
+
+ this.append_and_create_string_taglet ( content, tree, me, buf );
+ this.append_main_taglet ( tree, dtree, me, curtag, paragraph, curtagname, content, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
+ paragraph++;
+
+ starttag_linestartpos = f_starttag_linestartpos;
+ starttag_startpos = f_starttag_startpos;
+ starttag_line = f_starttag_line;
+ starttag_pos = f_starttag_pos;
+
+ content = new Gee.ArrayList<DocElement> ();
+ curtag = create_main_taglet ( name );
+ curtagname = #name;
+ }
+ else if ( buf.str[buf.len-1] != '\n' && buf.len > 0 && buf.str[buf.len-1] != ' ') {
+ buf.append_unichar ( ' ' );
+ }
+
+ break;
+ case '{':
+ this.append_and_create_string_taglet ( content, tree, me, buf );
+ this.parse_inline_taglets ( tree, me, content );
+ break;
+ case '@':
+ // warning!
+ buf.append_unichar ( '@' );
+ break;
+ case '\\':
+ this.parse_escape ( buf );
+ break;
+ default:
+ buf.append_unichar ( str[pos] );
+ break;
+ }
}
- return true;
- }
-
- protected static bool is_documentation ( string cmnt ) {
- if ( cmnt[0] != '*' )
- return false;
- for ( int i = 1; !(cmnt[i] == '\n' || cmnt[i] == '\0') ; i++ ) {
- if ( cmnt[i].isspace() )
- continue;
+ if ( this.errflag == true )
+ return null;
- return false;
- }
+ this.append_and_create_string_taglet ( content, tree, me, buf );
+ this.append_main_taglet ( tree, dtree, me, curtag, paragraph, curtagname, content, starttag_linestartpos, starttag_startpos, starttag_line, starttag_pos );
+ return dtree;
+ }
- return true;
+ public static bool is_documentation ( string cmnt ) {
+ return cmnt[0] == '*';
}
- protected static bool is_inherit_doc ( string? cmnt ) {
+ public static bool is_inherit_doc ( string? cmnt ) {
if ( cmnt == null )
return false;
@@ -882,6 +704,4 @@
}
}
-
-
}
Modified: trunk/src/valadoc/valadoc.vala
==============================================================================
--- trunk/src/valadoc/valadoc.vala (original)
+++ trunk/src/valadoc/valadoc.vala Sun Dec 7 03:33:02 2008
@@ -393,7 +393,7 @@
settings.path = this.directory;
- Reporter reporter = new Reporter();
+ ErrorReporter reporter = new ErrorReporter();
string fulldirpath = (pluginpath == null)? Config.plugin_dir : pluginpath;
bool tmp = this.check_doclet_structure ( pluginpath );
@@ -419,8 +419,7 @@
return quit ();
}
- Valadoc.Parser docparser = new Valadoc.Parser ();
- docparser.init ( settings, reporter, strtag, taglets );
+ Valadoc.Parser docparser = new Valadoc.Parser ( settings, reporter, strtag, taglets );
Valadoc.Tree doctree = new Valadoc.Tree ( settings, non_null_experimental, disable_non_null, disable_checking, basedir, directory );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]