Codebase list lua-ldoc / 5dd69b9
support for Moonscript fat vs thin arrows; tools.get_parameters also returns last token found; lang.method_call generalization Steve Donovan 10 years ago
4 changed file(s) with 21 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
306306 if doc.class_tag(stype) then
307307 if not item.name:match '[:%.]' then -- not qualified
308308 local class = this_section.name
309 local lang = this_mod.file.lang
309310 local static = item.tags.constructor or item.tags.static or item.type ~= 'function'
310 item.name = class..(not static and ':' or '.')..item.name
311 item.name = class..(not static and lang.method_call or '.')..item.name
311312 end
312313 if stype == 'factory' then
313314 if item.tags.private then to_be_removed = true
7474 self.start_comment_ = '^%-%-%-+' -- used for doc comment line start
7575 self.block_comment = '^%-%-%[=*%[%-+' -- used for block doc comments
7676 self.end_comment_ = '[^%-]%-%-+\n$' ---- exclude --- this kind of comment ---
77 self.method_call = ':'
7778 self:finalize()
7879 end
7980
239240
240241
241242 -- note a difference here: we scan C/C++ code in full-text mode, not line by line.
242 -- This is because we can't detect multiline comments in line mode
243 -- This is because we can't detect multiline comments in line mode.
244 -- Note: this applies to C/C++ code used to generate _Lua_ documentation!
243245
244246 local CC = class(Lang)
245247
247249 self.line_comment = '^//+'
248250 self.start_comment_ = '^///+'
249251 self.block_comment = '^/%*%*+'
252 self.method_call = ':'
250253 self:finalize()
251254 end
252255
269272 self.start_comment_ = '^%s*%-%-%-+' -- used for doc comment line start
270273 self.block_comment = '^%-%-%[=*%[%-+' -- used for block doc comments
271274 self.end_comment_ = '[^%-]%-%-+\n$' ---- exclude --- this kind of comment ---
275 self.method_call = '.'
272276 self:finalize()
273277 end
274278
292296 tags:add('name',name)
293297 end
294298 if t == '(' then
295 tags.formal_args = tools.get_parameters(tok)
299 tags.formal_args,t,v = tools.get_parameters(tok)
296300 else
297301 tags.formal_args = List()
298302 end
299303 tags:add('class','function')
304 if t == '=' then
305 tags.formal_args:insert(1,'self')
306 tags.formal_args.comments = {self=''}
307 end
300308 end
301309 else
302310 return nil
153153 local current_item, module_item
154154
155155 F.args = args
156
156 F.lang = lang
157157 F.base = package
158158
159159 local tok,f = lang.lexer(fname)
160160 if not tok then return nil end
161161
162 local function lineno ()
162 local function lineno ()
163163 return tok:lineno()
164 end
164 end
165165
166166 local function filename () return fname end
167167
274274 tok = M.space_skip_getter(tok)
275275 local args = List()
276276 args.comments = {}
277 local ltl = lexer.get_separated_list(tok,endtoken,delim)
277 local ltl,tt = lexer.get_separated_list(tok,endtoken,delim)
278278
279279 if not ltl or not ltl[1] or #ltl[1] == 0 then return args end -- no arguments
280280
329329 end
330330 end
331331
332 ----[[
333332 -- we had argument comments
334333 -- but the last one may be outside the parens! (Geoff style)
335334 -- (only try this stunt if it's a function parameter list!)
338337 local last_arg = args[n]
339338 if not args.comments[last_arg] then
340339 while true do
341 local t = {tok()}
342 if type_of(t) == 'comment' then
343 set_comment(n,t)
340 tt = {tok()}
341 if type_of(tt) == 'comment' then
342 set_comment(n,tt)
344343 else
345344 break
346345 end
347346 end
348347 end
349348 end
350 --]]
351 return args
349 -- return what token we ended on as well - can be token _past_ ')'
350 return args,tt[1],tt[2]
352351 end
353352
354353 -- parse a Lua identifier - contains names separated by . and (optionally) :.