provision for looking up class method names; only explicit modules have their names adjusted for package.mod

This commit is contained in:
steve donovan 2011-07-08 15:59:56 +02:00
parent 7ae455c006
commit 684b5f350e
1 changed files with 19 additions and 11 deletions

View File

@ -18,14 +18,15 @@ local known_tags = {
param = 'M', see = 'M', usage = 'M', ['return'] = 'M', field = 'M', author='M'; param = 'M', see = 'M', usage = 'M', ['return'] = 'M', field = 'M', author='M';
class = 'id', name = 'id', pragma = 'id', alias = 'id'; class = 'id', name = 'id', pragma = 'id', alias = 'id';
copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S'; copyright = 'S', summary = 'S', description = 'S', release = 'S', license = 'S';
module = 'T', script = 'T',['function'] = 'T', lfunction = 'T', module = 'T', script = 'T', example = 'T',
table = 'T', section = 'T', type = 'T'; ['function'] = 'T', lfunction = 'T', table = 'T', section = 'T', type = 'T';
['local'] = 'N'; ['local'] = 'N';
} }
known_tags._alias = {} known_tags._alias = {}
known_tags._project_level = { known_tags._project_level = {
module = true, module = true,
script = true script = true,
example = 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'
@ -93,15 +94,17 @@ function File:finish()
item:finish() item:finish()
if doc.project_level(item.type) then if doc.project_level(item.type) then
this_mod = item this_mod = item
local package,mname
if item.type == 'module' then
-- if name is 'package.mod', then mod_name is 'mod' -- if name is 'package.mod', then mod_name is 'mod'
local package,mname = split_dotted_name(this_mod.name) package,mname = split_dotted_name(this_mod.name)
if not package then if not package then
mname = this_mod.name mname = this_mod.name
package = '' package = ''
else else
package = package package = package
end end
end
self.modules:append(this_mod) self.modules:append(this_mod)
this_mod.package = package this_mod.package = package
this_mod.mod_name = mname this_mod.mod_name = mname
@ -230,6 +233,7 @@ function Item:finish()
if tags.see then if tags.see then
tags.see = tools.expand_comma_list(tags.see) tags.see = tools.expand_comma_list(tags.see)
end end
--if self.type ~= 'function' then print(self.name,self.type) end
if doc.project_level(self.type) then if doc.project_level(self.type) then
-- we are a module, so become one! -- we are a module, so become one!
self.items = List() self.items = List()
@ -314,6 +318,10 @@ function Module:process_see_reference (s,modules)
-- module reference? -- module reference?
mod_ref = self:hunt_for_reference(s, modules) mod_ref = self:hunt_for_reference(s, modules)
if mod_ref then return mod_ref end if mod_ref then return mod_ref end
-- method reference? (These are of form CLASS.NAME)
fun_ref = self.items.by_name[s]
if fun_ref then return reference(s,self,fun_ref) end
-- otherwise, start splitting!
local packmod,name = split_dotted_name(s) -- e.g. 'pl.utils','split' local packmod,name = split_dotted_name(s) -- e.g. 'pl.utils','split'
if packmod then -- qualified name if packmod then -- qualified name
mod_ref = modules.by_name[packmod] -- fully qualified mod name? mod_ref = modules.by_name[packmod] -- fully qualified mod name?