composite return types experiment
steve donovan
10 years ago
777 | 777 | end |
778 | 778 | |
779 | 779 | local function integer_keys(t) |
780 | if not t then return 0 end | |
780 | 781 | for k in pairs(t) do |
781 | 782 | local num = tonumber(k) |
782 | 783 | if num then return num end |
784 | 785 | return 0 |
785 | 786 | end |
786 | 787 | |
788 | function Item:return_type(r) | |
789 | if not r.type then return '' end | |
790 | return r.type, r.ctypes | |
791 | end | |
792 | ||
787 | 793 | function Item:build_return_groups() |
788 | local retmod = self.modifiers['return'] | |
794 | local modifiers = self.modifiers | |
795 | local retmod = modifiers['return'] | |
789 | 796 | local groups = List() |
790 | 797 | local lastg, group |
791 | 798 | for i,ret in ipairs(self.ret) do |
796 | 803 | groups:append(group) |
797 | 804 | lastg = g |
798 | 805 | end |
799 | group:append({text=ret, type = mods.type or ''}) | |
806 | group:append({text=ret, type = mods.type or '',mods = mods}) | |
800 | 807 | end |
801 | 808 | 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 | |
802 | 829 | end |
803 | 830 | |
804 | 831 | function Item:subparam(p) |
186 | 186 | <h3>Returns:</h3> |
187 | 187 | # for i,group in ldoc.ipairs(groups) do local li,il = use_li(group) |
188 | 188 | <ol> |
189 | # for r in group:iter() do | |
189 | # for r in group:iter() do local type, ctypes = item:return_type(r) | |
190 | 190 | $(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 | |
194 | 194 | $(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 | |
195 | 204 | # end -- for r |
196 | 205 | </ol> |
197 | 206 | # 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 |
0 | 0 | -------------------------------------------------------------------------------- |
1 | --- Queue of objects sorted by priority | |
1 | --- Queue of objects sorted by priority. | |
2 | 2 | -- @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. | |
4 | 7 | -- @copyright lua-nucleo authors (see file `COPYRIGHT` for the license) |
5 | 8 | -------------------------------------------------------------------------------- |
6 | 9 | |
33 | 36 | |
34 | 37 | local insert = function(self, priority, value) |
35 | 38 | method_arguments( |
36 | self, | |
39 | s | |
37 | 40 | "number", priority |
38 | 41 | ) |
39 | 42 | assert(value ~= nil, "value can't be nil") -- value may be of any type, except nil |