Small Docs test

This commit is contained in:
Robert Jelic
2025-09-13 09:54:09 +02:00
parent 7c5d735a51
commit 72f9ac2a1e
25 changed files with 894 additions and 799 deletions

View File

@@ -0,0 +1,48 @@
local helper = require("utils.helper")
local functionParser = {}
function functionParser.parse(annotations, line)
local name = line:match("^function%s+([%w_%.]+[:.]?[%w_]+)") or line:match("^function%s+([%w_]+)")
if not name then
print("Warning: Could not extract function name from line: " .. line)
return nil
end
local f = {
type = "function",
name = name,
description = nil,
shortDescription = nil,
params = {},
returns = {},
visibility = "public"
}
if functionParser.handlers then
helper.applyAnnotations(annotations, f, functionParser.handlers)
end
local funcName = line:match("function ([%w_%.]+)")
if funcName then
if funcName:find(":") then
f.name = funcName:match(":([%w_]+)")
elseif funcName:find("%.") then
f.name = funcName:match("%.([%w_]+)")
else
f.name = funcName
end
end
if line:match("function [%w_%.]+:") then
f.static = false
else
f.static = true
end
return f
end
function functionParser.setHandlers(handlers)
functionParser.handlers = handlers
end
return functionParser