summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-03-01 15:48:34 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2018-03-01 15:48:34 -0300
commit89d9c7f60b66d247c8a7384d6ec576b7a45fa8a0 (patch)
tree81e94252212e2bf028542017a2edf1fb07f8d8cd
parentbdcd942c551d3f30366c8e3598fba6f4cc81dfe6 (diff)
gendoc-mono: Fix type name generation for typedecldevs/felipealmeida/gendoc-mono
-rw-r--r--src/scripts/elua/apps/docgen/mono.lua43
1 files changed, 37 insertions, 6 deletions
diff --git a/src/scripts/elua/apps/docgen/mono.lua b/src/scripts/elua/apps/docgen/mono.lua
index 9398bbd800..430a9ebebd 100644
--- a/src/scripts/elua/apps/docgen/mono.lua
+++ b/src/scripts/elua/apps/docgen/mono.lua
@@ -85,15 +85,45 @@ local not_verbs = {
85 "end" 85 "end"
86} 86}
87 87
88local get_mono_type = function(tp) 88local get_class_name = function(cls)
89 local words = {}
90 local klass = cls:full_name_get()
91 for word in string.gmatch(klass, "%a+") do
92 words[#words+1] = word
93 end
94 for i = 1, #words -1 do
95 words[i] = string.lower(words[i])
96 end
97 return table.concat(words, '.')
98end
99
100local get_mono_type
101get_mono_type = function(tp)
89 if not tp then 102 if not tp then
90 return "void " 103 return "void "
91 end 104 end
92 105
93 tpt = tp:type_get() 106 tpt = tp:type_get()
94 107 tpdecl = tp:typedecl_get()
95 if tpt == tp.REGULAR or tpt == tp.CLASS then 108
96 return tp:full_name_get() 109 if tpt == tp.REGULAR then
110 if tp:full_name_get() == "string" then
111 return "System.String"
112 elseif tp:full_name_get() == "list" then
113 ntp = tp:base_type_get()
114 --assert(btp ~= nil)
115 --ntp = btp:next_type_get()
116 return "eina.List<" .. get_mono_type(ntp) .. ">"
117 elseif tpdecl then
118 --print("typedecl type is ", tp:full_name_get())
119 tpt = tpdecl:type_get()
120 return get_class_name(tp) --tp:full_name_get()
121 else
122 --print("regular type is ", tp:full_name_get())
123 return tp:full_name_get()
124 end
125 elseif tpt == tp.CLASS then
126 return get_class_name(tp)
97 else 127 else
98 return "unknown" 128 return "unknown"
99 end 129 end
@@ -160,6 +190,7 @@ find_parent_impl = function(fulln, cl)
160 for i, pcl in ipairs(cl:inherits_get()) do 190 for i, pcl in ipairs(cl:inherits_get()) do
161 for j, impl in ipairs(pcl:implements_get()) do 191 for j, impl in ipairs(pcl:implements_get()) do
162 if impl:full_name_get() == fulln then 192 if impl:full_name_get() == fulln then
193 --if get_class_name(impl) == fulln then
163 return impl, pcl 194 return impl, pcl
164 end 195 end
165 end 196 end
@@ -403,7 +434,7 @@ M.build_inherits = function(cl, t, lvl)
403 cln[#cln] = cln[#cln] .. "_mono" 434 cln[#cln] = cln[#cln] .. "_mono"
404 cln = ":" .. 'develop:api' .. ":" 435 cln = ":" .. 'develop:api' .. ":"
405 .. table.concat(cln, ":") 436 .. table.concat(cln, ":")
406 lbuf:write_raw("[[", cln, "|", cl:full_name_get(), "]]") 437 lbuf:write_raw("[[", cln, "|", get_class_name(cl), "]]")
407 --lbuf:write_link(cl:nspaces_get(true), cl:full_name_get()) 438 --lbuf:write_link(cl:nspaces_get(true), cl:full_name_get())
408 lbuf:write_raw(" ") 439 lbuf:write_raw(" ")
409 lbuf:write_i("(" .. cl:type_str_get() .. ")") 440 lbuf:write_i("(" .. cl:type_str_get() .. ")")
@@ -426,7 +457,7 @@ M.build_inherit_summary = function(cl, buf)
426 cln[#cln] = cln[#cln] .. "_mono" 457 cln[#cln] = cln[#cln] .. "_mono"
427 cln = ":" .. 'develop:api' .. ":" 458 cln = ":" .. 'develop:api' .. ":"
428 .. table.concat(cln, ":") 459 .. table.concat(cln, ":")
429 buf:write_raw("[[", cln, "|", cl:full_name_get(), "]]") 460 buf:write_raw("[[", cln, "|", get_class_name(cl), "]]")
430 buf:write_raw(" ") 461 buf:write_raw(" ")
431 buf:write_i("(" .. cl:type_str_get() .. ")") 462 buf:write_i("(" .. cl:type_str_get() .. ")")
432 463