module(...) resolution wuz broke; parser needed args.package

This commit is contained in:
steve donovan 2011-07-18 12:07:40 +02:00
parent 0b181d3b66
commit 88dbcd0d85
2 changed files with 8 additions and 7 deletions

View File

@ -232,7 +232,7 @@ local function process_file (f, file_list)
local ftype = file_types[ext]
if ftype then
if args.verbose then print(path.basename(f)) end
local F,err = parse.file(f,ftype)
local F,err = parse.file(f,ftype,args)
if err then quit(err) end
file_list:append(F)
end
@ -240,6 +240,9 @@ end
local process_file_list = tools.process_file_list
setup_package_base()
if type(args.file) == 'table' then
-- this can only be set from config file so we can assume it's already read
process_file_list(args.file,'*.*',process_file, file_list)
@ -280,8 +283,6 @@ else
quit ("file or directory does not exist: "..quote(args.file))
end
setup_package_base()
local multiple_files = #file_list > 1
local first_module

View File

@ -68,7 +68,7 @@ end
-- encountered, then ldoc looks for a call to module() to find the name of the
-- module if there isn't an explicit module name specified.
local function parse_file(fname,lang)
local function parse_file(fname,lang, package)
local line,f = 1
local F = File(fname)
local module_found, first_comment = false,true
@ -157,7 +157,7 @@ local function parse_file(fname,lang)
if not module_found or module_found == '...' then
if not t then return nil, fname..": end of file" end -- run out of file!
-- we have to guess the module name
module_found = tools.this_module_name(args.package,fname)
module_found = tools.this_module_name(package,fname)
end
if not tags then tags = extract_tags(comment) end
add_module(tags,module_found,old_style)
@ -191,8 +191,8 @@ local function parse_file(fname,lang)
return F
end
function parse.file(name,lang)
local F,err = parse_file(name,lang)
function parse.file(name,lang, args)
local F,err = parse_file(name,lang, args.package)
if err then return nil,err end
F:finish()
return F