support for Moonscript fat vs thin arrows; tools.get_parameters also returns last token found; lang.method_call generalization
This commit is contained in:
parent
b87180996d
commit
5dd69b90bf
|
@ -307,8 +307,9 @@ function File:finish()
|
|||
if doc.class_tag(stype) then
|
||||
if not item.name:match '[:%.]' then -- not qualified
|
||||
local class = this_section.name
|
||||
local lang = this_mod.file.lang
|
||||
local static = item.tags.constructor or item.tags.static or item.type ~= 'function'
|
||||
item.name = class..(not static and ':' or '.')..item.name
|
||||
item.name = class..(not static and lang.method_call or '.')..item.name
|
||||
end
|
||||
if stype == 'factory' then
|
||||
if item.tags.private then to_be_removed = true
|
||||
|
|
|
@ -75,6 +75,7 @@ function Lua:_init()
|
|||
self.start_comment_ = '^%-%-%-+' -- used for doc comment line start
|
||||
self.block_comment = '^%-%-%[=*%[%-+' -- used for block doc comments
|
||||
self.end_comment_ = '[^%-]%-%-+\n$' ---- exclude --- this kind of comment ---
|
||||
self.method_call = ':'
|
||||
self:finalize()
|
||||
end
|
||||
|
||||
|
@ -240,7 +241,8 @@ end
|
|||
|
||||
|
||||
-- note a difference here: we scan C/C++ code in full-text mode, not line by line.
|
||||
-- This is because we can't detect multiline comments in line mode
|
||||
-- This is because we can't detect multiline comments in line mode.
|
||||
-- Note: this applies to C/C++ code used to generate _Lua_ documentation!
|
||||
|
||||
local CC = class(Lang)
|
||||
|
||||
|
@ -248,6 +250,7 @@ function CC:_init()
|
|||
self.line_comment = '^//+'
|
||||
self.start_comment_ = '^///+'
|
||||
self.block_comment = '^/%*%*+'
|
||||
self.method_call = ':'
|
||||
self:finalize()
|
||||
end
|
||||
|
||||
|
@ -270,6 +273,7 @@ function Moon:_init()
|
|||
self.start_comment_ = '^%s*%-%-%-+' -- used for doc comment line start
|
||||
self.block_comment = '^%-%-%[=*%[%-+' -- used for block doc comments
|
||||
self.end_comment_ = '[^%-]%-%-+\n$' ---- exclude --- this kind of comment ---
|
||||
self.method_call = '.'
|
||||
self:finalize()
|
||||
end
|
||||
|
||||
|
@ -293,11 +297,15 @@ function Moon:item_follows (t,v,tok)
|
|||
tags:add('name',name)
|
||||
end
|
||||
if t == '(' then
|
||||
tags.formal_args = tools.get_parameters(tok)
|
||||
tags.formal_args,t,v = tools.get_parameters(tok)
|
||||
else
|
||||
tags.formal_args = List()
|
||||
end
|
||||
tags:add('class','function')
|
||||
if t == '=' then
|
||||
tags.formal_args:insert(1,'self')
|
||||
tags.formal_args.comments = {self=''}
|
||||
end
|
||||
end
|
||||
else
|
||||
return nil
|
||||
|
|
|
@ -154,15 +154,15 @@ local function parse_file(fname, lang, package, args)
|
|||
local current_item, module_item
|
||||
|
||||
F.args = args
|
||||
|
||||
F.lang = lang
|
||||
F.base = package
|
||||
|
||||
local tok,f = lang.lexer(fname)
|
||||
if not tok then return nil end
|
||||
|
||||
local function lineno ()
|
||||
local function lineno ()
|
||||
return tok:lineno()
|
||||
end
|
||||
end
|
||||
|
||||
local function filename () return fname end
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ function M.get_parameters (tok,endtoken,delim)
|
|||
tok = M.space_skip_getter(tok)
|
||||
local args = List()
|
||||
args.comments = {}
|
||||
local ltl = lexer.get_separated_list(tok,endtoken,delim)
|
||||
local ltl,tt = lexer.get_separated_list(tok,endtoken,delim)
|
||||
|
||||
if not ltl or not ltl[1] or #ltl[1] == 0 then return args end -- no arguments
|
||||
|
||||
|
@ -330,7 +330,6 @@ function M.get_parameters (tok,endtoken,delim)
|
|||
end
|
||||
end
|
||||
|
||||
----[[
|
||||
-- we had argument comments
|
||||
-- but the last one may be outside the parens! (Geoff style)
|
||||
-- (only try this stunt if it's a function parameter list!)
|
||||
|
@ -339,17 +338,17 @@ function M.get_parameters (tok,endtoken,delim)
|
|||
local last_arg = args[n]
|
||||
if not args.comments[last_arg] then
|
||||
while true do
|
||||
local t = {tok()}
|
||||
if type_of(t) == 'comment' then
|
||||
set_comment(n,t)
|
||||
tt = {tok()}
|
||||
if type_of(tt) == 'comment' then
|
||||
set_comment(n,tt)
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--]]
|
||||
return args
|
||||
-- return what token we ended on as well - can be token _past_ ')'
|
||||
return args,tt[1],tt[2]
|
||||
end
|
||||
|
||||
-- parse a Lua identifier - contains names separated by . and (optionally) :.
|
||||
|
|
Loading…
Reference in New Issue