* Represents a node in the api tree.
*/
public abstract class Valadoc.Api.Node : Item, Browsable, Documentation, Comparable<Node> {
- protected bool do_document { private set; get; default = false; }
+ protected bool do_document = false;
private SourceFile file;
/**
* The root of the code tree.
*/
public class Valadoc.Api.Tree {
- private Deque<Node> unbrowsable_documentation_dependencies = new LinkedList<Node>();
+ private Deque<InheritDocContainer> inheritdocs = new LinkedList<InheritDocContainer> ();
private ArrayList<string> external_c_files = new ArrayList<string>();
private ArrayList<Package> packages = new ArrayList<Package>();
private Package source_package = null;
private CTypeResolver _cresolver = null;
private Package _source_package;
+
+ private class InheritDocContainer {
+ public unowned Taglets.InheritDoc taglet;
+ public unowned Api.Node taglet_container;
+
+ public InheritDocContainer (Api.Node taglet_container, Taglets.InheritDoc taglet) {
+ this.taglet_container = taglet_container;
+ this.taglet = taglet;
+ }
+ }
+
+
public void add_package(Package package) {
this.packages.add (package);
}
return this.packages.read_only_view;
}
- internal bool push_unbrowsable_documentation_dependency (Api.Node node) {
- return unbrowsable_documentation_dependencies.offer_head (node);
- }
-
private void add_dependencies_to_source_package () {
if ( this.source_package != null ) {
ArrayList<Package> deplst = new ArrayList<Package> ();
return _source_package;
}
- public void process_comments (DocumentationParser docparser) {
- parse_comments (docparser);
- check_comments (docparser);
- }
-
private void parse_wiki (DocumentationParser docparser) {
this.wikitree = new WikiPageTree ();
var pkg = get_source_package ();
}
private void check_wiki (DocumentationParser docparser) {
- var pkg = get_source_package ();
+ Package pkg = get_source_package ();
if (pkg != null) {
wikitree.check (settings, docparser, pkg);
}
}
- private void parse_comments (DocumentationParser docparser) {
+ public void parse_comments (DocumentationParser docparser) {
parse_wiki (docparser);
foreach (Package pkg in this.packages) {
}
}
- private void check_comments (DocumentationParser docparser) {
+ public void check_comments (DocumentationParser docparser) {
check_wiki (docparser);
foreach (Package pkg in this.packages) {
if (pkg.is_browsable (settings)) {
pkg.check_comments (settings, docparser);
+ postprocess_inheritdoc (docparser);
}
}
+ }
+ internal void register_inheritdoc (Api.Node container, Taglets.InheritDoc taglet) {
+ inheritdocs.add (new InheritDocContainer (container, taglet));
+ }
+
+ private void postprocess_inheritdoc (DocumentationParser docparser) {
+ while (!this.inheritdocs.is_empty) {
+ InheritDocContainer container = this.inheritdocs.poll_head ();
- // Parse & check inherited non-public comments:
- while (!this.unbrowsable_documentation_dependencies.is_empty) {
- var node = this.unbrowsable_documentation_dependencies.poll_head ();
- node.parse_comments (settings, docparser);
- node.check_comments (settings, docparser);
+ docparser.transform_inheritdoc (container.taglet_container, container.taglet);
}
}
+
/**
* Import documentation from various sources
*
* @param packages sources
* @param import_directories List of directories where to find the files
*/
- public void import_documentation (DocumentationImporter[] importers, string[] packages,
+ public void import_comments (DocumentationImporter[] importers, string[] packages,
string[] import_directories)
{
HashSet<string> processed = new HashSet<string> ();
public class Valadoc.Content.Comment : BlockContent {
- private Gee.LinkedList<InheritDoc> inheritdocs = new Gee.LinkedList<InheritDoc> ();
-
public Gee.List<Taglet> taglets { get { return _taglets; } }
private Gee.List<Taglet> _taglets;
_taglets = new ArrayList<Taglet> ();
}
- internal void register_inheritdoc (InheritDoc taglet) {
- inheritdocs.add (taglet);
- }
-
public override void configure (Settings settings, ResourceLocator locator) {
}
element.parent = this;
element.check (api_root, container, file_path, reporter, settings);
}
-
- foreach (InheritDoc element in inheritdocs) {
- element.transform (api_root, container, file_path, reporter, settings);
- }
}
public override void accept (ContentVisitor visitor) {
comment.check (_tree, element, element.get_source_file ().get_name (), _reporter, _settings);
}
- public void check_wikipage (Api.Package package, Page page) {
- page.check (_tree, package, package.get_source_file ().get_name (), _reporter, _settings);
+ public void check_wikipage (Api.Package package, WikiPage page) {
+ page.documentation.check (_tree, package, page.get_filename (), _reporter, _settings);
+ }
+
+ public void transform_inheritdoc (Api.Node taglet_owner, Taglets.InheritDoc taglet) {
+ if (taglet.inherited == null) {
+ return ;
+ }
+
+
+ taglet.inherited.parse_comments (_settings, this);
+ if (taglet.inherited.documentation == null) {
+ return ;
+ }
+
+
+ taglet.inherited.check_comments (_settings, this);
+
+ taglet.transform (_tree, taglet_owner, taglet_owner.get_source_file ().get_name (), _reporter, _settings);
}
private GirMetaData get_metadata_for_comment (Api.GirSourceComment gir_comment) {
public void parse (DocumentationParser docparser, Api.Package pkg) {
documentation = docparser.parse_wikipage (pkg, this);
}
-
- public void check (DocumentationParser docparser, Api.Package pkg) {
- docparser.check_wikipage (pkg, documentation);
- }
}
}
foreach (WikiPage page in this.wikipages) {
- page.check (docparser, pkg);
+ docparser.check_wikipage (pkg, page);
}
}
}
public class Valadoc.Taglets.InheritDoc : InlineTaglet {
private Taglet? parent_taglet = null;
- private Api.Node? _inherited;
-
- private Comment root {
- get {
- ContentElement pos;
- for (pos = this; pos.parent != null; pos = pos.parent);
- // inheritDoc is only allowed in source comments
- assert (pos is Comment);
- return (Comment) pos;
- }
+
+ public Api.Node? inherited {
+ private set;
+ get;
}
+
public override Rule? get_parser_rule (Rule run_rule) {
return null;
}
_inherited = (Api.Node) ((Api.Struct) container).base_type.data_type;
}
- if (_inherited != null) {
- api_root.push_unbrowsable_documentation_dependency (_inherited);
- }
-
parent_taglet = find_parent_taglet ();
- if (parent_taglet == null && _inherited != null && _inherited.documentation != null) {
- root.register_inheritdoc (this);
+ if (parent_taglet == null && _inherited != null) {
+ api_root.register_inheritdoc (container, this);
}
link.locator = locator;
link.symbol_name = symbol_name;
+ link.c_accept_plural = c_accept_plural;
+ link.c_is_plural = c_is_plural;
link._context = _context;
link._symbol = _symbol;
/* valadoc.vala
*
- * Copyright (C) 2008-2009 Florian Brosch
- * Copyright (C) 2011 Florian Brosch
+ * Copyright (C) 2008-2014 Florian Brosch
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
return quit (reporter);
}
- doctree.process_comments (docparser);
- if (reporter.errors > 0) {
- return quit (reporter);
- }
-
DocumentationImporter[] importers = {
new ValadocDocumentationImporter (doctree, docparser, modules, settings, reporter),
new GirDocumentationImporter (doctree, docparser, modules, settings, reporter)
};
- doctree.import_documentation (importers, import_packages, import_directories);
+ doctree.parse_comments (docparser);
+ if (reporter.errors > 0) {
+ return quit (reporter);
+ }
+
+ doctree.import_comments (importers, import_packages, import_directories);
+ if (reporter.errors > 0) {
+ return quit (reporter);
+ }
+
+ doctree.check_comments (docparser);
if (reporter.errors > 0) {
return quit (reporter);
}