aboutsummaryrefslogtreecommitdiff
path: root/scripts/lua2dox.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:23:01 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-01-25 18:23:01 +0000
commit142d9041391780ac15b89886a54015fdc5c73995 (patch)
tree0f6b5cac1a60810a03f52826c9e67c9e2780b033 /scripts/lua2dox.lua
parentad86b5db74922285699ab2a1dbb2ff20e6268a33 (diff)
parent3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff)
downloadrneovim-142d9041391780ac15b89886a54015fdc5c73995.tar.gz
rneovim-142d9041391780ac15b89886a54015fdc5c73995.tar.bz2
rneovim-142d9041391780ac15b89886a54015fdc5c73995.zip
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'scripts/lua2dox.lua')
-rw-r--r--scripts/lua2dox.lua36
1 files changed, 7 insertions, 29 deletions
diff --git a/scripts/lua2dox.lua b/scripts/lua2dox.lua
index 86afe97a7e..19f8f8141d 100644
--- a/scripts/lua2dox.lua
+++ b/scripts/lua2dox.lua
@@ -27,14 +27,13 @@ http://search.cpan.org/~alec/Doxygen-Lua-0.02/lib/Doxygen/Lua.pm
Running
-------
-This file "lua2dox.lua" gets called by "lua2dox_filter" (bash).
+This script "lua2dox.lua" gets called by "gen_vimdoc.py".
Doxygen must be on your system. You can experiment like so:
- Run "doxygen -g" to create a default Doxyfile.
-- Then alter it to let it recognise lua. Add the two following lines:
+- Then alter it to let it recognise lua. Add the following line:
FILE_PATTERNS = *.lua
- FILTER_PATTERNS = *.lua=lua2dox_filter
- Then run "doxygen".
The core function reads the input file (filename or stdin) and outputs some pseudo C-ish language.
@@ -117,26 +116,6 @@ local function string_split(Str, Pattern)
return splitStr
end
---! \class TCore_Commandline
---! \brief reads/parses commandline
-local TCore_Commandline = class()
-
---! \brief constructor
-function TCore_Commandline.init(this)
- this.argv = arg
- this.parsed = {}
- this.params = {}
-end
-
---! \brief get value
-function TCore_Commandline.getRaw(this, Key, Default)
- local val = this.argv[Key]
- if not val then
- val = Default
- end
- return val
-end
-
-------------------------------
--! \brief file buffer
--!
@@ -147,7 +126,7 @@ local TStream_Read = class()
--!
--! \param Filename name of file to read (or nil == stdin)
function TStream_Read.getContents(this, Filename)
- assert(Filename)
+ assert(Filename, ('invalid file: %s'):format(Filename))
-- get lines from file
-- syphon lines to our table
local filecontents = {}
@@ -497,14 +476,14 @@ function TLua2DoX_filter.readfile(this, AppStamp, Filename)
else
this:warning(inStream:getLineNo(), 'something weird here')
end
- fn_magic = nil -- mustn't indavertently use it again
+ fn_magic = nil -- mustn't inadvertently use it again
-- TODO: If we can make this learn how to generate these, that would be helpful.
-- elseif string.find(line, "^M%['.*'%] = function") then
-- state = 'in_function' -- it's a function
-- outStream:writeln("function textDocument/publishDiagnostics(...){}")
- -- fn_magic = nil -- mustn't indavertently use it again
+ -- fn_magic = nil -- mustn't inadvertently use it again
else
state = '' -- unknown
if #line > 0 then -- we don't know what this line means, so just comment it out
@@ -548,15 +527,14 @@ end
local This_app = TApp()
--main
-local cl = TCore_Commandline()
-local argv1 = cl:getRaw(2)
+local argv1 = arg[1]
if argv1 == '--help' then
TCore_IO_writeln(This_app:getVersion())
TCore_IO_writeln(This_app:getCopyright())
TCore_IO_writeln([[
run as:
- lua2dox_filter <param>
+ nvim -l scripts/lua2dox.lua <param>
--------------
Param:
<filename> : interprets filename