mirror of
https://github.com/CorsixTH/CorsixTH.git
synced 2025-07-23 12:23:05 +02:00
Add support for documenting vararg parameters to LDocGen.
This commit is contained in:
@@ -147,6 +147,11 @@ end
|
|||||||
|
|
||||||
function LuaFunction:setIsVararg(is)
|
function LuaFunction:setIsVararg(is)
|
||||||
self.is_vararg = is
|
self.is_vararg = is
|
||||||
|
if is then
|
||||||
|
self.vararg_parameter = LuaVariable():setName("...")
|
||||||
|
else
|
||||||
|
self.vararg_parameter = nil
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -177,6 +182,9 @@ function LuaFunction:getParameter(name)
|
|||||||
return param
|
return param
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if name == "..." then
|
||||||
|
return self.vararg_parameter
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function LuaTable:LuaTable()
|
function LuaTable:LuaTable()
|
||||||
|
@@ -58,6 +58,9 @@ local function ParseComments(tokens, i, object)
|
|||||||
if operation == "" then
|
if operation == "" then
|
||||||
if operand ~= "" then
|
if operand ~= "" then
|
||||||
if object:getShortDesc() then
|
if object:getShortDesc() then
|
||||||
|
if object:getLongDesc() then
|
||||||
|
object:setShortDesc(object:getLongDesc())
|
||||||
|
end
|
||||||
object:setLongDesc(operand)
|
object:setLongDesc(operand)
|
||||||
else
|
else
|
||||||
object:setShortDesc(operand)
|
object:setShortDesc(operand)
|
||||||
@@ -66,7 +69,7 @@ local function ParseComments(tokens, i, object)
|
|||||||
elseif operation == "dummy" then
|
elseif operation == "dummy" then
|
||||||
object:setIsDummy(true)
|
object:setIsDummy(true)
|
||||||
elseif operation == "param" then
|
elseif operation == "param" then
|
||||||
local pname, pdesc = operand:match"^%s*([a-zA-Z_][a-zA-Z0-9_]*)%s*(.*)$"
|
local pname, pdesc = operand:match"^%s*([a-zA-Z_.]%.?%.?[a-zA-Z0-9_]*)%s*(.*)$"
|
||||||
local param = object:getParameter(pname)
|
local param = object:getParameter(pname)
|
||||||
if not param then
|
if not param then
|
||||||
error("Unknown parameter: ".. pname .." (".. tokens.__file
|
error("Unknown parameter: ".. pname .." (".. tokens.__file
|
||||||
|
Reference in New Issue
Block a user