diff --git a/ldoc.lua b/ldoc.lua index e39254e..1cd9f54 100644 --- a/ldoc.lua +++ b/ldoc.lua @@ -27,7 +27,6 @@ local tablex = require 'pl.tablex' -- Penlight compatibility utils.unpack = utils.unpack or unpack or table.unpack -local append = table.insert local lapp = require 'pl.lapp' local version = '1.4.6' @@ -176,7 +175,6 @@ local function setup_kinds () end -local add_language_extension -- hacky way for doc module to be passed options... doc.ldoc = ldoc @@ -277,7 +275,7 @@ local function read_ldoc_config (fname) if directory == '' then directory = '.' end - local chunk, err, ok + local chunk, err, _ if args.filter == 'none' then print('reading configuration from '..fname) end @@ -286,7 +284,7 @@ local function read_ldoc_config (fname) chunk, err = loadstr(ldoc,txt) if chunk then if args.define ~= 'none' then ldoc[args.define] = true end - ok,err = pcall(chunk) + _,err = pcall(chunk) end end if err then quit('error loading config file '..fname..': '..err) end @@ -301,7 +299,6 @@ end local quote = tools.quote --- processing command line and preparing for output --- -local F local file_list = List() File.list = file_list local config_dir @@ -316,7 +313,7 @@ if args.module then if args.file:match '^%a+$' and global.functions[args.file] then args.file = 'global.'..args.file end - local fullpath,mod,on_docpath = tools.lookup_existing_module_or_function (args.file, doc_path) + local fullpath,mod,_ = tools.lookup_existing_module_or_function (args.file, doc_path) if not fullpath then quit(mod) else @@ -337,7 +334,6 @@ if args.file == '.' then print('changing to directory',config_path) lfs.chdir(config_path) end - config_is_read = true args.file = ldoc.file or '.' if args.file == '.' then args.file = lfs.currentdir() diff --git a/ldoc/doc.lua b/ldoc/doc.lua index d5d4584..b272cd5 100644 --- a/ldoc/doc.lua +++ b/ldoc/doc.lua @@ -192,12 +192,6 @@ function File:export_item (name) self:warning('no docs '..tools.quote(name)) end - -local function has_prefix (name,prefix) - local i1,i2 = name:find(prefix) - return i1 == 1 and i2 == #prefix -end - local function mod_section_type (this_mod) return this_mod and this_mod.section and this_mod.section.type end @@ -543,17 +537,13 @@ function Item.check_tag(tags,tag, value, modifiers) if avalue then value = avalue..' '..value end if amod then modifiers = modifiers or {} - local value_tokens = utils.split(value) for m,v in pairs(amod) do local idx = tonumber(v:match('^%$(%d+)')) if idx then v, value = value:match('(%S+)(.*)') - -- v = value_tokens[idx] - -- value_tokens[idx] = '' end modifiers[m] = v end - -- value = table.concat(value_tokens, ' ') end else -- has to be a function that at least returns tag, value return alias(tags,value,modifiers) @@ -927,8 +917,6 @@ function Item:return_type(r) return r.type, r.ctypes end -local struct_return_type = '*' - function Item:build_return_groups() local quote = tools.quote local modifiers = self.modifiers diff --git a/ldoc/lang.lua b/ldoc/lang.lua index f42c1de..afec061 100644 --- a/ldoc/lang.lua +++ b/ldoc/lang.lua @@ -362,10 +362,7 @@ function Moon:item_follows (t,v,tok) end t,v = tnext(tok) tags:add('class','function') - if t == '>' then ---~ tags.formal_args:insert(1,'self') ---~ tags.formal_args.comments = {self=''} - else + if t ~= '>' then tags.static = true end end diff --git a/ldoc/markdown.lua b/ldoc/markdown.lua index 456b64e..cce10d1 100644 --- a/ldoc/markdown.lua +++ b/ldoc/markdown.lua @@ -149,9 +149,6 @@ local function map(t, f) return out end --- The identity function, useful as a placeholder. -local function identity(text) return text end - -- Functional style if statement. (NOTE: no short circuit evaluation) local function iff(t, a, b) if t then return a else return b end end @@ -766,14 +763,6 @@ function block_transform(text, sublist) return text end --- Debug function for printing a line array to see the result --- of partial transforms. -local function print_lines(lines) - for i, line in ipairs(lines) do - print(i, line.type, line.text or line.line) - end -end - ---------------------------------------------------------------------- -- Span transform ---------------------------------------------------------------------- diff --git a/ldoc/parse.lua b/ldoc/parse.lua index dc83a43..5c84be4 100644 --- a/ldoc/parse.lua +++ b/ldoc/parse.lua @@ -161,12 +161,6 @@ local function extract_tags (s,args) return tags --Map(tags) end -local _xpcall = xpcall -if true then - _xpcall = function(f) return true, f() end -end - - -- parses a Lua or C file, looking for ldoc comments. These are like LuaDoc comments; -- they start with multiple '-'. (Block commments are allowed) @@ -192,8 +186,6 @@ local function parse_file(fname, lang, package, args) return tok:lineno() end - local function filename () return fname end - function F:warning (msg,kind,line) kind = kind or 'warning' line = line or lineno()