]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
added support for doc tags
authorChris Daley <chebizarro@gmail.com>
Fri, 24 Nov 2017 18:35:03 +0000 (10:35 -0800)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 29 Apr 2023 19:00:17 +0000 (21:00 +0200)
dbusgen/valadbusgen.vala
dbusgen/valadbusparser.vala

index ad65f8697794ea6db948c4455a0a16f770cee427..33205bb471c3fd6403be2949b304c4e819a57eaa 100644 (file)
@@ -98,6 +98,7 @@ public class Vala.DBusGen {
                CodeContext.push (context);
 
                context.set_target_profile (Profile.GOBJECT);
+               context.vapi_comments = true;
 
                if (packages != null) {
                        foreach (string package in packages) {
index 2872317e1eee3d93b47daca2a2cbf1493fd42239..9a1890dba8b75037fda5a51091ec781b79d4b126 100644 (file)
@@ -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");
        }