lua-users home
lua-l archive

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


On Sun, Jun 11, 2017 at 4:15 PM, Sean Conner <sean@conman.org> wrote:
> 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
> error()).
>
>   For example, this function:
>
>         function encode(value,sref,stref)
>           local res = ""
>
>           if stref and not stref.SEEN then
>             res = TAG._stringref(nil,nil,stref)
>           end
>
>           return res .. __ENCODE_MAP[type(value)](value,sref,stref)
>         end
>
> 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

When I was first pined for an easier way to document things a few
months back, I thought of finding if ldoc could generate it. ltokenp
is a very attractive candidate. Alas, I have no time for such things.

Russ