annotations have reference to main parent item
This commit is contained in:
parent
f5c11dcdf5
commit
dd881ddcf2
7
ldoc.lua
7
ldoc.lua
|
@ -421,9 +421,12 @@ if args.dump then
|
|||
os.exit()
|
||||
end
|
||||
if args.tags ~= 'none' then
|
||||
local taglist = {[args.tags] = true}
|
||||
local tagset = {}
|
||||
for t in stringx.split(args.tags,','):iter() do
|
||||
tagset[t] = true
|
||||
end
|
||||
for mod in module_list:iter() do
|
||||
mod:dump_tags(taglist)
|
||||
mod:dump_tags(tagset)
|
||||
end
|
||||
os.exit()
|
||||
end
|
||||
|
|
21
ldoc/doc.lua
21
ldoc/doc.lua
|
@ -31,9 +31,6 @@ known_tags._project_level = {
|
|||
example = true,
|
||||
topic = true
|
||||
}
|
||||
known_tags._annotation_tags = {
|
||||
fixme = true, todo = true, warning = true
|
||||
}
|
||||
|
||||
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 =
|
||||
|
@ -67,20 +64,22 @@ function doc.section_tag (tag)
|
|||
return tag == 'section' or tag == 'type'
|
||||
end
|
||||
|
||||
-- is it an annotation tag, like fixme or todo?
|
||||
function doc.annotation_tag (tag)
|
||||
return known_tags._annotation_tags[tag]
|
||||
end
|
||||
|
||||
-- annotation tags can appear anywhere in the code and may contain of these tags:
|
||||
known_tags._annotation_tags = {
|
||||
fixme = true, todo = true, warning = true
|
||||
}
|
||||
|
||||
local acount = 1
|
||||
|
||||
function doc.expand_annotation_item (tags)
|
||||
function doc.expand_annotation_item (tags, last_item)
|
||||
local tag, value = next(tags)
|
||||
if doc.annotation_tag(tag) then
|
||||
if known_tags._annotation_tags[tag] then
|
||||
tags.class = 'annotation'
|
||||
tags.summary = value
|
||||
tags.name = tag..acount
|
||||
acount = acount+1
|
||||
local item_name = last_item and last_item.tags.name or '?'
|
||||
tags.name = item_name..'-'..tag..acount
|
||||
acount = acount + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ local function parse_file(fname,lang, package)
|
|||
local line,f = 1
|
||||
local F = File(fname)
|
||||
local module_found, first_comment = false,true
|
||||
local current_item
|
||||
|
||||
local tok,f = lang.lexer(fname)
|
||||
|
||||
|
@ -165,7 +166,7 @@ local function parse_file(fname,lang, package)
|
|||
if doc.project_level(tags.class) then
|
||||
module_found = tags.name
|
||||
end
|
||||
doc.expand_annotation_item(tags)
|
||||
doc.expand_annotation_item(tags,current_item)
|
||||
-- if the item has an explicit name or defined meaning
|
||||
-- then don't continue to do any code analysis!
|
||||
if tags.name then
|
||||
|
@ -208,7 +209,8 @@ local function parse_file(fname,lang, package)
|
|||
tags.class = 'lfunction'
|
||||
end
|
||||
if tags.name then
|
||||
F:new_item(tags,line).inferred = item_follows ~= nil
|
||||
current_item = F:new_item(tags,line)
|
||||
current_item.inferred = item_follows ~= nil
|
||||
end
|
||||
if not t then break end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue