Codebase list lua-ldoc / 65723a9
issue #57: [opt=default] support - see tests/styles/four.lua steve donovan 11 years ago
3 changed file(s) with 10 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
664664 local function acc(x) table.insert(buffer, x) end
665665 for i = 1, #names do
666666 local m = pmods and pmods[i]
667 local opt
667668 if m then
668669 if not m.optchain then
669670 acc ((']'):rep(npending))
670671 npending=0
671672 end
672 if m.opt or m.optchain then acc(' ['); npending=npending+1 end
673 opt = m.opt or m.optchain
674 if opt then
675 acc(' [')
676 npending=npending+1
677 end
673678 end
674679 if i>1 then acc (', ') end
675680 acc(names[i])
681 if opt and opt ~= true then acc('='..opt) end
676682 end
677683 acc ((']'):rep(npending))
678684 return '('..table.concat(buffer)..')'
3535 modifiers = { }
3636 for x in mod_string :gmatch "[^,]+" do
3737 local k, v = x :match "^([^=]+)=(.*)$"
38 if not k then k, v = x, x end
38 if not k then k, v = x, true end -- wuz x, x
3939 modifiers[k] = v
4040 end
4141 end
1212 -- you may document an indefinite number of extra arguments!
1313 -- @string name person's name
1414 -- @int age
15 -- @string[opt] calender optional calendar
16 -- @int[optchain] offset optional offset
15 -- @string[opt='gregorian'] calender optional calendar
16 -- @int[optchain=0] offset optional offset
1717 -- @treturn string
1818 function one (name,age,...)
1919 end