From e71f7d89cad2cebac231c617a5c24ce82beb6897 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Sun, 28 Aug 2011 15:37:06 +0200 Subject: [PATCH] phoney error message when bad ref is in module summary sorted; no-doc-comment error now has line number --- html/ldoc_ltp.lua | 1 + ldoc/doc.lua | 3 ++- ldoc/parse.lua | 7 ++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/html/ldoc_ltp.lua b/html/ldoc_ltp.lua index 10b07f2..bb472d8 100644 --- a/html/ldoc_ltp.lua +++ b/html/ldoc_ltp.lua @@ -88,6 +88,7 @@ return [==[ # if ldoc.body then -- verbatim HTML as contents; 'non-code' entries $(ldoc.body) # elseif module then -- module documentation +# ldoc.item = module -- context for M()

$(M(module.summary))

$(M(module.description))

diff --git a/ldoc/doc.lua b/ldoc/doc.lua index 0299ebc..98e5804 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -307,6 +307,8 @@ function Item:error(msg) os.exit(1) end +Module.warning, Module.error = Item.warning, Item.error + function Module:hunt_for_reference (packmod, modules) local mod_ref local package = self.package or '' @@ -380,7 +382,6 @@ end -- and try to to resolve this. function Module:resolve_references(modules) local found = List() - for item in self.items:iter() do local see = item.tags.see if see then -- this guy has @see references diff --git a/ldoc/parse.lua b/ldoc/parse.lua index 4b2b0d9..50c3efb 100644 --- a/ldoc/parse.lua +++ b/ldoc/parse.lua @@ -88,9 +88,10 @@ local function parse_file(fname,lang, package) function filename () return fname end - function F:warning (msg,kind) + function F:warning (msg,kind,line) kind = kind or 'warning' - io.stderr:write(kind..' '..fname..':'..lineno()..': '..msg,'\n') + line = line or lineno() + io.stderr:write(kind..' '..fname..':'..line..': '..msg,'\n') end function F:error (msg) @@ -183,7 +184,7 @@ local function parse_file(fname,lang, package) add_module(tags,module_found,old_style) tags = nil if not t then - io.stderr:write('warning: ',fname,' contains no items\n') + F:warning(fname,' contains no items\n','warning',1) break; end -- run out of file! -- if we did bump into a doc comment, then we can continue parsing it