From: Chris Daley Date: Fri, 24 Nov 2017 18:35:03 +0000 (-0800) Subject: added support for doc tags X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74fd7b769d5ce6dd031ee1e64e11564e568b9112;p=thirdparty%2Fvala.git added support for doc tags --- diff --git a/dbusgen/valadbusgen.vala b/dbusgen/valadbusgen.vala index ad65f8697..33205bb47 100644 --- a/dbusgen/valadbusgen.vala +++ b/dbusgen/valadbusgen.vala @@ -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) { 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"); }