refactor: Remove what seems to be unused debug cruft
This commit is contained in:
parent
f70542c626
commit
f1b3f76aca
10
ldoc.lua
10
ldoc.lua
|
@ -27,7 +27,6 @@ local tablex = require 'pl.tablex'
|
||||||
|
|
||||||
-- Penlight compatibility
|
-- Penlight compatibility
|
||||||
utils.unpack = utils.unpack or unpack or table.unpack
|
utils.unpack = utils.unpack or unpack or table.unpack
|
||||||
local append = table.insert
|
|
||||||
local lapp = require 'pl.lapp'
|
local lapp = require 'pl.lapp'
|
||||||
|
|
||||||
local version = '1.4.6'
|
local version = '1.4.6'
|
||||||
|
@ -176,7 +175,6 @@ local function setup_kinds ()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local add_language_extension
|
|
||||||
-- hacky way for doc module to be passed options...
|
-- hacky way for doc module to be passed options...
|
||||||
doc.ldoc = ldoc
|
doc.ldoc = ldoc
|
||||||
|
|
||||||
|
@ -277,7 +275,7 @@ local function read_ldoc_config (fname)
|
||||||
if directory == '' then
|
if directory == '' then
|
||||||
directory = '.'
|
directory = '.'
|
||||||
end
|
end
|
||||||
local chunk, err, ok
|
local chunk, err, _
|
||||||
if args.filter == 'none' then
|
if args.filter == 'none' then
|
||||||
print('reading configuration from '..fname)
|
print('reading configuration from '..fname)
|
||||||
end
|
end
|
||||||
|
@ -286,7 +284,7 @@ local function read_ldoc_config (fname)
|
||||||
chunk, err = loadstr(ldoc,txt)
|
chunk, err = loadstr(ldoc,txt)
|
||||||
if chunk then
|
if chunk then
|
||||||
if args.define ~= 'none' then ldoc[args.define] = true end
|
if args.define ~= 'none' then ldoc[args.define] = true end
|
||||||
ok,err = pcall(chunk)
|
_,err = pcall(chunk)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if err then quit('error loading config file '..fname..': '..err) end
|
if err then quit('error loading config file '..fname..': '..err) end
|
||||||
|
@ -301,7 +299,6 @@ end
|
||||||
local quote = tools.quote
|
local quote = tools.quote
|
||||||
--- processing command line and preparing for output ---
|
--- processing command line and preparing for output ---
|
||||||
|
|
||||||
local F
|
|
||||||
local file_list = List()
|
local file_list = List()
|
||||||
File.list = file_list
|
File.list = file_list
|
||||||
local config_dir
|
local config_dir
|
||||||
|
@ -316,7 +313,7 @@ if args.module then
|
||||||
if args.file:match '^%a+$' and global.functions[args.file] then
|
if args.file:match '^%a+$' and global.functions[args.file] then
|
||||||
args.file = 'global.'..args.file
|
args.file = 'global.'..args.file
|
||||||
end
|
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
|
if not fullpath then
|
||||||
quit(mod)
|
quit(mod)
|
||||||
else
|
else
|
||||||
|
@ -337,7 +334,6 @@ if args.file == '.' then
|
||||||
print('changing to directory',config_path)
|
print('changing to directory',config_path)
|
||||||
lfs.chdir(config_path)
|
lfs.chdir(config_path)
|
||||||
end
|
end
|
||||||
config_is_read = true
|
|
||||||
args.file = ldoc.file or '.'
|
args.file = ldoc.file or '.'
|
||||||
if args.file == '.' then
|
if args.file == '.' then
|
||||||
args.file = lfs.currentdir()
|
args.file = lfs.currentdir()
|
||||||
|
|
12
ldoc/doc.lua
12
ldoc/doc.lua
|
@ -192,12 +192,6 @@ function File:export_item (name)
|
||||||
self:warning('no docs '..tools.quote(name))
|
self:warning('no docs '..tools.quote(name))
|
||||||
end
|
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)
|
local function mod_section_type (this_mod)
|
||||||
return this_mod and this_mod.section and this_mod.section.type
|
return this_mod and this_mod.section and this_mod.section.type
|
||||||
end
|
end
|
||||||
|
@ -543,17 +537,13 @@ function Item.check_tag(tags,tag, value, modifiers)
|
||||||
if avalue then value = avalue..' '..value end
|
if avalue then value = avalue..' '..value end
|
||||||
if amod then
|
if amod then
|
||||||
modifiers = modifiers or {}
|
modifiers = modifiers or {}
|
||||||
local value_tokens = utils.split(value)
|
|
||||||
for m,v in pairs(amod) do
|
for m,v in pairs(amod) do
|
||||||
local idx = tonumber(v:match('^%$(%d+)'))
|
local idx = tonumber(v:match('^%$(%d+)'))
|
||||||
if idx then
|
if idx then
|
||||||
v, value = value:match('(%S+)(.*)')
|
v, value = value:match('(%S+)(.*)')
|
||||||
-- v = value_tokens[idx]
|
|
||||||
-- value_tokens[idx] = ''
|
|
||||||
end
|
end
|
||||||
modifiers[m] = v
|
modifiers[m] = v
|
||||||
end
|
end
|
||||||
-- value = table.concat(value_tokens, ' ')
|
|
||||||
end
|
end
|
||||||
else -- has to be a function that at least returns tag, value
|
else -- has to be a function that at least returns tag, value
|
||||||
return alias(tags,value,modifiers)
|
return alias(tags,value,modifiers)
|
||||||
|
@ -927,8 +917,6 @@ function Item:return_type(r)
|
||||||
return r.type, r.ctypes
|
return r.type, r.ctypes
|
||||||
end
|
end
|
||||||
|
|
||||||
local struct_return_type = '*'
|
|
||||||
|
|
||||||
function Item:build_return_groups()
|
function Item:build_return_groups()
|
||||||
local quote = tools.quote
|
local quote = tools.quote
|
||||||
local modifiers = self.modifiers
|
local modifiers = self.modifiers
|
||||||
|
|
|
@ -362,10 +362,7 @@ function Moon:item_follows (t,v,tok)
|
||||||
end
|
end
|
||||||
t,v = tnext(tok)
|
t,v = tnext(tok)
|
||||||
tags:add('class','function')
|
tags:add('class','function')
|
||||||
if t == '>' then
|
if t ~= '>' then
|
||||||
--~ tags.formal_args:insert(1,'self')
|
|
||||||
--~ tags.formal_args.comments = {self=''}
|
|
||||||
else
|
|
||||||
tags.static = true
|
tags.static = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -149,9 +149,6 @@ local function map(t, f)
|
||||||
return out
|
return out
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The identity function, useful as a placeholder.
|
|
||||||
local function identity(text) return text end
|
|
||||||
|
|
||||||
-- Functional style if statement. (NOTE: no short circuit evaluation)
|
-- 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
|
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
|
return text
|
||||||
end
|
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
|
-- Span transform
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
|
@ -161,12 +161,6 @@ local function extract_tags (s,args)
|
||||||
return tags --Map(tags)
|
return tags --Map(tags)
|
||||||
end
|
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;
|
-- parses a Lua or C file, looking for ldoc comments. These are like LuaDoc comments;
|
||||||
-- they start with multiple '-'. (Block commments are allowed)
|
-- they start with multiple '-'. (Block commments are allowed)
|
||||||
|
@ -192,8 +186,6 @@ local function parse_file(fname, lang, package, args)
|
||||||
return tok:lineno()
|
return tok:lineno()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function filename () return fname end
|
|
||||||
|
|
||||||
function F:warning (msg,kind,line)
|
function F:warning (msg,kind,line)
|
||||||
kind = kind or 'warning'
|
kind = kind or 'warning'
|
||||||
line = line or lineno()
|
line = line or lineno()
|
||||||
|
|
Loading…
Reference in New Issue