@local tag to flag a function explicitly as local
This commit is contained in:
parent
c9e972c989
commit
c57c364335
8
ldoc.lua
8
ldoc.lua
|
@ -407,7 +407,7 @@ local function parse_file(fname,lang)
|
|||
lang:parse_extra(tags,tok,toks)
|
||||
end
|
||||
end
|
||||
if tags.class == 'function' and is_local then
|
||||
if tags.class == 'function' and (is_local or tags['local']) then
|
||||
tags.class = 'lfunction'
|
||||
end
|
||||
if tags.name then
|
||||
|
@ -450,7 +450,9 @@ local doc_path = ldoc_dir..'builtin/?.luadoc'
|
|||
|
||||
-- ldoc -m is expecting a Lua package; this converts this to a file path
|
||||
if args.module then
|
||||
if args.file:match '^%a+$' and globals[args.file] then
|
||||
-- first check if we've been given a global Lua lib function
|
||||
local glob = globals[args.file]
|
||||
if args.file:match '^%a+$' and glob and type(glob) ~= 'table' then
|
||||
args.file = 'global.'..args.file
|
||||
end
|
||||
local fullpath,mod = tools.lookup_existing_module_or_function (args.file, doc_path)
|
||||
|
@ -568,7 +570,7 @@ if args.module then
|
|||
F:dump(args.verbose)
|
||||
else
|
||||
local fun = module_list[1].items.by_name[args.module]
|
||||
if not fun then quit(args.module.." is not part of this module") end
|
||||
if not fun then quit(args.module.." is not part of "..args.file) end
|
||||
fun:dump(true)
|
||||
end
|
||||
return
|
||||
|
|
|
@ -20,6 +20,7 @@ local known_tags = {
|
|||
copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S';
|
||||
module = 'T', script = 'T',['function'] = 'T', lfunction = 'T',
|
||||
table = 'T', section = 'T', type = 'T';
|
||||
['local'] = 'N';
|
||||
}
|
||||
known_tags._alias = {}
|
||||
known_tags._project_level = {
|
||||
|
@ -27,8 +28,9 @@ known_tags._project_level = {
|
|||
script = true
|
||||
}
|
||||
|
||||
local TAG_MULTI,TAG_ID,TAG_SINGLE,TAG_TYPE = 'M','id','S','T'
|
||||
doc.TAG_MULTI,doc.TAG_ID,doc.TAG_SINGLE,doc.TAG_TYPE = TAG_MULTI,TAG_ID,TAG_SINGLE,TAG_TYPE
|
||||
local TAG_MULTI,TAG_ID,TAG_SINGLE,TAG_TYPE,TAG_FLAG = 'M','id','S','T','N'
|
||||
doc.TAG_MULTI,doc.TAG_ID,doc.TAG_SINGLE,doc.TAG_TYPE,doc.TAG_FLAG =
|
||||
TAG_MULTI,TAG_ID,TAG_SINGLE,TAG_TYPE,TAG_FLAG
|
||||
|
||||
-- add a new tag.
|
||||
function doc.add_tag(tag,type,project_level)
|
||||
|
@ -194,6 +196,8 @@ function Item:_init(tags,file,line)
|
|||
end
|
||||
elseif ttype == TAG_SINGLE then
|
||||
self.tags[tag] = value
|
||||
elseif ttype == TAG_FLAG then
|
||||
self.tags[tag] = true
|
||||
else
|
||||
self:warning ("unknown tag: '"..tag.."'")
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue