[vala/wip/dbusgen: 59/78] added support for doc tags



commit 016e53041a1074018943d7e40bb65f0922eba9ba
Author: Chris Daley <chebizarro gmail com>
Date:   Fri Nov 24 10:35:03 2017 -0800

    added support for doc tags

 dbusgen/valadbusgen.vala    |  1 +
 dbusgen/valadbusparser.vala | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
---
diff --git a/dbusgen/valadbusgen.vala b/dbusgen/valadbusgen.vala
index 4b49db7a2..8beaf329d 100644
--- a/dbusgen/valadbusgen.vala
+++ b/dbusgen/valadbusgen.vala
@@ -99,6 +99,7 @@ public class Vala.DBusGen {
 
                context.profile = Profile.GOBJECT;
                context.add_define ("GOBJECT");
+               context.vapi_comments = true;
 
                context.add_external_package ("glib-2.0");
                context.add_external_package ("gobject-2.0");
diff --git a/dbusgen/valadbusparser.vala b/dbusgen/valadbusparser.vala
index 2872317e1..9a1890dba 100644
--- a/dbusgen/valadbusparser.vala
+++ b/dbusgen/valadbusparser.vala
@@ -355,13 +355,31 @@ public class Vala.DBusParser : CodeVisitor {
        private void parse_doc () {
                start_element ("doc:doc");
 
+               string comment = "";
+               SourceReference start_loc = get_current_src ();
+
                while (true) {
                        next ();
+
+                       if (current_token == MarkupTokenType.TEXT) {
+                               SourceReference source = get_current_src ();
+                               comment += source.file.get_source_line (source.begin.line).strip ();
+                       }
+
                        if (current_token == MarkupTokenType.END_ELEMENT && reader.name == "doc:doc") {
                                break;
                        }
                }
 
+               if (comment.length > 0) {
+                       comment = "*\n * %s\n*".printf (comment);
+                       Comment doc = new Comment (comment, start_loc);
+                       Symbol node = current_node as Symbol;
+                       if (node != null) {
+                               node.comment = doc;
+                       }
+               }
+
                end_element ("doc:doc");
        }
 


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