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