From 27da5511a0c0b12fcabe29cf38c3f8a0f0b444b9 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Sat, 1 May 2021 05:19:48 -0700 Subject: docs: Treesitter (#13260) * doc & fixes: Generate treesitter docs * fixup to treesitter-core * docs(treesitter): fix docs for most functions Co-authored-by: Thomas Vigouroux --- scripts/lua2dox.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'scripts/lua2dox.lua') diff --git a/scripts/lua2dox.lua b/scripts/lua2dox.lua index 1dc4c0a5a0..0b36a1e061 100644 --- a/scripts/lua2dox.lua +++ b/scripts/lua2dox.lua @@ -491,6 +491,27 @@ function TLua2DoX_filter.readfile(this,AppStamp,Filename) end end + -- Big hax + if string.find(fn, ":") then + -- TODO: We need to add a first parameter of "SELF" here + -- local colon_place = string.find(fn, ":") + -- local name = string.sub(fn, 1, colon_place) + fn = fn:gsub(":", ".", 1) + outStream:writeln("/// @param self") + + local paren_start = string.find(fn, "(", 1, true) + local paren_finish = string.find(fn, ")", 1, true) + + -- Nothing in between the parens + local comma + if paren_finish == paren_start + 1 then + comma = "" + else + comma = ", " + end + fn = string.sub(fn, 1, paren_start) .. "self" .. comma .. string.sub(fn, paren_start + 1) + end + -- add vanilla function outStream:writeln(fn_type .. 'function ' .. fn .. '{}') end -- cgit