diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 2eafe77..38b391c 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -1019,6 +1019,7 @@ local function reference (s, mod_ref, item_ref) end function Module:process_see_reference (s,modules,istype) + if s == nil then return nil end local mod_ref,fun_ref,name,packmod local ref = custom_see_references(s) if ref then return ref end diff --git a/ldoc/html.lua b/ldoc/html.lua index 3f10726..1d9fee4 100644 --- a/ldoc/html.lua +++ b/ldoc/html.lua @@ -190,7 +190,6 @@ function html.generate_output(ldoc, args, project) local types = {} for name in tp:gmatch("[^|]+") do - --local sym, rest = name:match('(%S+)%s*([%*%&])') local sym = name:match '([%w%.%:]+)' local ref,err = markup.process_reference(sym,true) if ref then diff --git a/ldoc/lang.lua b/ldoc/lang.lua index 756fef5..a0704d9 100644 --- a/ldoc/lang.lua +++ b/ldoc/lang.lua @@ -285,28 +285,26 @@ function CC:item_follows (t,v,tok) if v == self.extra.export then -- this is not part of the return type! t,v = tnext(tok) end - -- TBD collecting types which are not single tokens (may contain '*') - local return_type = v + -- types may have multiple tokens: example, const char *bonzo(...) + local return_type, name = v t,v = tnext(tok) - if t == 'iden' or t=='keyword' then - local name = v + name = v + t,v = tnext(tok) + while t ~= '(' do + return_type = return_type .. ' ' .. name + name = v t,v = tnext(tok) - if t ~= '(' then - return_type = return_type .. ' ' .. name - name = v - t,v = tnext(tok) + end + --print ('got',name,t,v,return_type) + return function(tags,tok) + if not tags.name then + tags:add('name',name) end - --print ('got',name,t,v,return_type) - return function(tags,tok) - if not tags.name then - tags:add('name',name) - end - tags:add('class','function') - if t == '(' then - tags.formal_args,t,v = tools.get_parameters(tok,')',',',self) - if return_type ~= 'void' then - tags.formal_args.return_type = return_type - end + tags:add('class','function') + if t == '(' then + tags.formal_args,t,v = tools.get_parameters(tok,')',',',self) + if return_type ~= 'void' then + tags.formal_args.return_type = return_type end end end diff --git a/ldoc/markup.lua b/ldoc/markup.lua index 43b6b91..060e707 100644 --- a/ldoc/markup.lua +++ b/ldoc/markup.lua @@ -57,7 +57,7 @@ end -- they can appear in the contents list as a ToC. function markup.add_sections(F, txt) local sections, L, first = {}, 1, true - local title_pat_end, title_pat = '[^#]%s*(.+)' + local title_pat for line in stringx.lines(txt) do if first then local level,header = line:match '^(#+)%s*(.+)' @@ -66,7 +66,8 @@ function markup.add_sections(F, txt) else level = '##' end - title_pat = '^'..level..title_pat_end + title_pat = '^'..level..'([^#]%s*.+)' + title_pat = stringx.lstrip(title_pat) first = false end local title = line:match (title_pat)