Merge: neo_doxygen: Introduce a tool to import a Doxygen model.
authorJean Privat <jean@pryen.org>
Tue, 4 Nov 2014 20:11:20 +0000 (15:11 -0500)
committerJean Privat <jean@pryen.org>
Tue, 4 Nov 2014 20:11:20 +0000 (15:11 -0500)
This tool converts the XML output generated by Doxygen to a Neo4j graph suitable for `neo.nit`.

In summary, the following is imported:
* Namespaces
* Files, generating one module for each file-namespace pair
* Classes, with inheritances
* Members, with signatures and redefinition relationships (when Doxygen provide them)
* Documentation (without formatting for the moment)

Concerning language-specific support, only some Java keywords are correctly interpreted at this point.

Note: `/contrib/neo_doxygen/gen-all.sh` and `/contrib/neo_doxygen/gen-once.sh` call `nx`, so they require PR #744.

Note2: the merge commit updates `neo.nit` to correctly merge with #872

Pull-Request: #867
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

1  2 
src/neo.nit

diff --cc src/neo.nit
@@@ -742,8 -821,27 +793,27 @@@ class NeoMode
                                return_mtype = to_mtype(model, ret_nodes.first)
                        end
                        var mtype = new MSignature(mparameters, return_mtype)
 -                      mentities[node] = mtype
 +                      mentities[node.id.as(Int)] = mtype
                        return mtype
+               else if node.labels.has("MRawType") then
+                       var mtype = new MRawType(model)
+                       var parts = node["text"]
+                       if parts isa JsonArray then
+                               for p in parts do
+                                       mtype.parts.add(new MTypePart(model, p.to_s, null))
+                               end
+                               for pnode in node.out_nodes("LINK") do
+                                       assert pnode.labels.has("MTypePart")
+                                       if not pnode.out_nodes("TARGET").is_empty then
+                                               var rank = pnode["rank"]
+                                               var target = to_mentity(model, pnode.out_nodes("TARGET").first)
+                                               assert rank isa Int
+                                               mtype.parts[rank] = mtype.parts[rank].link_to(target)
+                                       end
+                               end
+                       end
 -                      mentities[node] = mtype
++                      mentities[node.id.as(Int)] = mtype
+                       return mtype
                end
                print "not yet implemented to_mtype for {node.labels.join(",")}"
                abort