Issue 95: strip leading stars in C block comments; improvements in identifying typenames within type expressions

This commit is contained in:
Steve Donovan 2013-09-26 16:05:45 +02:00
parent 531a7d34de
commit 7a7865f300
3 changed files with 24 additions and 19 deletions

View File

@ -663,22 +663,22 @@ function Item:finish()
self:warning("undocumented formal argument: "..quote(fargs[i]))
end end
end
-- formal arguments may come with types, inferred by the
-- appropriate code in ldoc.lang
if fargs.types then
self.modifiers[field] = List()
for t in fargs.types:iter() do
self:add_type(field,t)
end
if fargs.return_type then
if not self.ret then -- type, but no comment; no worries
self.ret = List{''}
end
self.modifiers['return'] = List()
self:add_type('return',fargs.return_type)
end
end
end -- #fargs > 0
-- formal arguments may come with types, inferred by the
-- appropriate code in ldoc.lang
if fargs.types then
self.modifiers[field] = List()
for t in fargs.types:iter() do
self:add_type(field,t)
end
if fargs.return_type then
if not self.ret then -- type, but no comment; no worries
self.ret = List{''}
end
self.modifiers['return'] = List()
self:add_type('return',fargs.return_type)
end
end
end -- fargs
-- the comments are associated with each parameter by

View File

@ -190,9 +190,14 @@ function html.generate_output(ldoc, args, project)
local types = {}
for name in tp:gmatch("[^|]+") do
local ref,err = markup.process_reference(name,true)
--local sym, rest = name:match('(%S+)%s*([%*%&])')
local sym = name:match '([%w%.%:]+)'
local ref,err = markup.process_reference(sym,true)
if ref then
types[#types+1] = ('<a class="type" href="%s">%s</a>'):format(ldoc.href(ref),ref.label or name)
if ref.label and sym == name then
name = ref.label
end
types[#types+1] = ('<a class="type" href="%s">%s</a>'):format(ldoc.href(ref),name)
else
types[#types+1] = '<span class="type">'..name..'</span>'
end

View File

@ -262,7 +262,7 @@ function CC.lexer(f)
end
function CC:grab_block_comment(v,tok)
v = v:gsub(self.block_comment,'')
v = v:gsub(self.block_comment,''):gsub('\n%s*%*','\n')
return 'comment',v:sub(1,-3)
end
@ -296,7 +296,7 @@ function CC:item_follows (t,v,tok)
name = v
t,v = tnext(tok)
end
print ('got',name,t,v,return_type)
--print ('got',name,t,v,return_type)
return function(tags,tok)
if not tags.name then
tags:add('name',name)