lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

It was thus said that the Great Russell Haley once stated:
> I'd like to find a way to generate the ldoc function headers from the file
> automagically so I could fill in the details afterwards. 

  I think it might be relatively easy (I'm saying this without even
bothering to try it) by using something like Luis' ltokenp (but perhaps
something else that preserves comments) to parse Lua code to at least
populate @function, @param, @local, and maybe even @raise (if it sees

  For example, this function:

	function encode(value,sref,stref)
	  local res = ""
	  if stref and not stref.SEEN then
	    res = TAG._stringref(nil,nil,stref)
	  return res .. __ENCODE_MAP[type(value)](value,sref,stref)

such a tool could return:

	--- Placeholder
	-- @function encode
	-- @param value
	-- @param sref
	-- @param stref
	-- @return
	function encode(value,sref,stref)

  -spc (I don't understand the full scope of this, so of course it must be
	trivial! 8-P