From fc112bb7f18f466cdd6178fb53dd77803548c885 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Christophe=20Beaupr=C3=A9?= Date: Mon, 1 Dec 2014 14:30:30 -0500 Subject: [PATCH] neo_doxygen: Read the `prot` attribute of the `innerclass` elements. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jean-Christophe Beaupré --- contrib/neo_doxygen/src/doxml/compounddef.nit | 17 +++++++++-------- contrib/neo_doxygen/src/model/graph.nit | 5 +++-- contrib/neo_doxygen/src/model/module_compound.nit | 2 +- .../src/tests/neo_doxygen_file_compound.nit | 6 +++--- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/contrib/neo_doxygen/src/doxml/compounddef.nit b/contrib/neo_doxygen/src/doxml/compounddef.nit index 64a301d..5f00313 100644 --- a/contrib/neo_doxygen/src/doxml/compounddef.nit +++ b/contrib/neo_doxygen/src/doxml/compounddef.nit @@ -94,16 +94,17 @@ class CompoundDefListener redef fun entity: Entity do return compound redef fun start_dox_element(local_name: String, atts: Attributes) do - if ["compoundname", "innerclass", "innernamespace"].has(local_name) then + if "compoundname" == local_name then text.listen_until(dox_uri, local_name) - if ["innerclass", "innernamespace"].has(local_name) then - refid = get_required(atts, "refid") - end - else if "basecompoundref" == local_name then - refid = get_optional(atts, "refid", "") + else if ["innerclass", "innernamespace", "basecompoundref"].has(local_name) then prot = get_optional(atts, "prot", "") - virt = get_optional(atts, "virt", "") text.listen_until(dox_uri, local_name) + if "basecompoundref" == local_name then + refid = get_optional(atts, "refid", "") + virt = get_optional(atts, "virt", "") + else + refid = get_required(atts, "refid") + end else if "memberdef" == local_name then read_member(atts) else if local_name == "sectiondef" then @@ -122,7 +123,7 @@ class CompoundDefListener if local_name == "compoundname" then compound.full_name = text.to_s else if local_name == "innerclass" then - compound.declare_class(refid, text.to_s) + compound.declare_class(refid, text.to_s, prot) else if local_name == "innernamespace" then compound.declare_namespace(refid, text.to_s) else if "memberdef" == local_name then diff --git a/contrib/neo_doxygen/src/model/graph.nit b/contrib/neo_doxygen/src/model/graph.nit index aad1644..0d8f511 100644 --- a/contrib/neo_doxygen/src/model/graph.nit +++ b/contrib/neo_doxygen/src/model/graph.nit @@ -273,9 +273,10 @@ abstract class Compound # # * `id`: `model_id` of the inner class. # * `full_name`: qualified name of the inner class. Ignored in practice. + # * `prot`: visibility (proctection). # # TODO: Handle cases where only the `full_name` is available. - fun declare_class(id: String, full_name: String) do end + fun declare_class(id: String, full_name: String, prot: String) do end # Declare a base compound (usually, a base class). # @@ -319,7 +320,7 @@ class Namespace inner_namespaces.add new NamespaceRef(id, full_name) end - redef fun declare_class(id: String, full_name: String) do + redef fun declare_class(id: String, full_name: String, prot: String) do graph.class_to_ns[id] = self end diff --git a/contrib/neo_doxygen/src/model/module_compound.nit b/contrib/neo_doxygen/src/model/module_compound.nit index 069b50b..404bcac 100644 --- a/contrib/neo_doxygen/src/model/module_compound.nit +++ b/contrib/neo_doxygen/src/model/module_compound.nit @@ -80,7 +80,7 @@ class FileCompound inner_namespaces.add m end - redef fun declare_class(id: String, full_name: String) do + redef fun declare_class(id, full_name, prot) do assert not id.is_empty else sys.stderr.write "Inner class declarations without ID are not yet supported.\n" end diff --git a/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit b/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit index 9a5c59c..c985035 100644 --- a/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit +++ b/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit @@ -28,8 +28,8 @@ var buffer = new RopeBuffer file.full_name = "Bar.java" file.model_id = "_Bar_8java" -file.declare_class("classa_b_bar", "a::b::Bar") -file.declare_class("classbaz", "Baz") +file.declare_class("classa_b_bar", "a::b::Bar", "package") +file.declare_class("classbaz", "Baz", "") file.declare_namespace("", "a::b") file.put_in_graph @@ -52,7 +52,7 @@ a_ns.declare_namespace("", "a::b") a_ns.put_in_graph b_ns.full_name = "a::b" -b_ns.declare_class("classa_b_bar", "") +b_ns.declare_class("classa_b_bar", "", "") b_ns.put_in_graph c_ns.model_id = "namespacec" -- 1.7.9.5