Codebase list lua-ldoc / 149ded8
composite return types experiment steve donovan 10 years ago
5 changed file(s) with 120 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
777777 end
778778
779779 local function integer_keys(t)
780 if not t then return 0 end
780781 for k in pairs(t) do
781782 local num = tonumber(k)
782783 if num then return num end
784785 return 0
785786 end
786787
788 function Item:return_type(r)
789 if not r.type then return '' end
790 return r.type, r.ctypes
791 end
792
787793 function Item:build_return_groups()
788 local retmod = self.modifiers['return']
794 local modifiers = self.modifiers
795 local retmod = modifiers['return']
789796 local groups = List()
790797 local lastg, group
791798 for i,ret in ipairs(self.ret) do
796803 groups:append(group)
797804 lastg = g
798805 end
799 group:append({text=ret, type = mods.type or ''})
806 group:append({text=ret, type = mods.type or '',mods = mods})
800807 end
801808 self.retgroups = groups
809 -- cool, now see if there are any treturns that have tfields to associate with
810 local fields = self.tags.field
811 if fields then
812 local fcomments = List()
813 for i,f in ipairs(fields) do
814 local name, comment = f:match('%s*([%w_%.:]+)(.*)')
815 fields[i] = name
816 fcomments[i] = coment
817 end
818 local fmods = modifiers.field
819 for group in groups:iter() do for r in group:iter() do
820 if r.mods and r.mods.type == '*' then
821 local ctypes = List()
822 for i,f in ipairs(fields) do
823 ctypes:append {name=f,type=fmods[i].type,comment=fcomments[i]}
824 end
825 r.ctypes = ctypes
826 end
827 end end
828 end
802829 end
803830
804831 function Item:subparam(p)
186186 <h3>Returns:</h3>
187187 # for i,group in ldoc.ipairs(groups) do local li,il = use_li(group)
188188 <ol>
189 # for r in group:iter() do
189 # for r in group:iter() do local type, ctypes = item:return_type(r)
190190 $(li)
191 # local tp = ldoc.typename(r.type); if tp ~= '' then
192 <span class="types">$(tp)</span>
193 # end
191 # if type ~= '' then
192 <span class="types">$(ldoc.typename(type))</span>
193 # end
194194 $(M(r.text,item))$(il)
195 # if ctypes then
196 <ul>
197 # for c in ctypes:iter() do
198 <li><span class="parameter">$(c.name)</span>
199 <span class="types">$(ldoc.typename(c.type))</span>
200 $(M(c.comment,item))</li>
201 # end
202 </ul>
203 # end -- if ctypes
195204 # end -- for r
196205 </ol>
197206 # if i < #groups then
0 package = "ldoc"
1 version = "scm-2"
2
3 source = {
4 dir="LDoc",
5 url = "git://github.com/stevedonovan/LDoc.git"
6 }
7
8 description = {
9 summary = "A Lua Documentation Tool",
10 detailed = [[
11 LDoc is a LuaDoc-compatible documentation generator which can also
12 process C extension source. Markdown may be optionally used to
13 render comments, as well as integrated readme documentation and
14 pretty-printed example files
15 ]],
16 homepage='http://stevedonovan.github.com/ldoc',
17 maintainer='steve.j.donovan@gmail.com',
18 license = "MIT/X11",
19 }
20
21 dependencies = {
22 "penlight","markdown"
23 }
24
25 build = {
26 type = "builtin",
27 modules = {
28 ["ldoc.tools"] = "ldoc/tools.lua",
29 ["ldoc.lang"] = "ldoc/lang.lua",
30 ["ldoc.parse"] = "ldoc/parse.lua",
31 ["ldoc.html"] = "ldoc/html.lua",
32 ["ldoc.lexer"] = "ldoc/lexer.lua",
33 ["ldoc.markup"] = "ldoc/markup.lua",
34 ["ldoc.prettify"] = "ldoc/prettify.lua",
35 ["ldoc.doc"] = "ldoc/doc.lua",
36 ["ldoc.html.ldoc_css"] = "ldoc/html/ldoc_css.lua",
37 ["ldoc.html.ldoc_ltp"] = "ldoc/html/ldoc_ltp.lua",
38 ["ldoc.html.ldoc_one_css"] = "ldoc/html/ldoc_one_css.lua",
39 ["ldoc.builtin.globals"] = "ldoc/builtin/globals.lua",
40 ["ldoc.builtin.coroutine"] = "ldoc/builtin/coroutine.lua",
41 ["ldoc.builtin.global"] = "ldoc/builtin/global.lua",
42 ["ldoc.builtin.debug"] = "ldoc/builtin/debug.lua",
43 ["ldoc.builtin.io"] = "ldoc/builtin/io.lua",
44 ["ldoc.builtin.lfs"] = "ldoc/builtin/lfs.lua",
45 ["ldoc.builtin.lpeg"] = "ldoc/builtin/lpeg.lua",
46 ["ldoc.builtin.math"] = "ldoc/builtin/math.lua",
47 ["ldoc.builtin.os"] = "ldoc/builtin/os.lua",
48 ["ldoc.builtin.package"] = "ldoc/builtin/package.lua",
49 ["ldoc.builtin.string"] = "ldoc/builtin/string.lua",
50 ["ldoc.builtin.table"] = "ldoc/builtin/table.lua",
51 },
52 copy_directories = {'doc','tests'},
53 install = {
54 bin = {
55 ldoc = "ldoc.lua"
56 }
57 }
58 }
59
00 --------------------------------------------------------------------------------
1 --- Queue of objects sorted by priority
1 --- Queue of objects sorted by priority.
22 -- @module lua-nucleo.priority_queue
3 -- This file is a part of lua-nucleo library
3 -- This file is a part of lua-nucleo library. Note that if you wish to spread
4 -- the description after tags, then invoke with `not_luadoc=true`.
5 -- The flags here are `ldoc -X -f backtick priority_queue.lua`, which
6 -- also expands backticks.
47 -- @copyright lua-nucleo authors (see file `COPYRIGHT` for the license)
58 --------------------------------------------------------------------------------
69
3336
3437 local insert = function(self, priority, value)
3538 method_arguments(
36 self,
39 s
3740 "number", priority
3841 )
3942 assert(value ~= nil, "value can't be nil") -- value may be of any type, except nil
0 ------
1 -- functions returning compound types
2 -- @module struct
3
4 -----
5 -- returns a 'struct'.
6 -- @string name your name dammit
7 -- @treturn * details of person
8 -- @tfield string name of person
9 -- @tfield int age of person
10 function struct(name) end
11