Issue #137 boilerplate Lua block comment
This commit is contained in:
parent
94975bcb8c
commit
60c6e79dd9
|
@ -87,6 +87,7 @@ end
|
||||||
|
|
||||||
function Lua:grab_block_comment(v,tok)
|
function Lua:grab_block_comment(v,tok)
|
||||||
local equals = v:match('^%-%-%[(=*)%[')
|
local equals = v:match('^%-%-%[(=*)%[')
|
||||||
|
if not equals then return v end
|
||||||
v = v:gsub(self.block_comment,'')
|
v = v:gsub(self.block_comment,'')
|
||||||
return tools.grab_block_comment(v,tok,'%]'..equals..'%]')
|
return tools.grab_block_comment(v,tok,'%]'..equals..'%]')
|
||||||
end
|
end
|
||||||
|
@ -286,11 +287,11 @@ function CC:item_follows (t,v,tok)
|
||||||
t,v = tnext(tok)
|
t,v = tnext(tok)
|
||||||
end
|
end
|
||||||
-- types may have multiple tokens: example, const char *bonzo(...)
|
-- types may have multiple tokens: example, const char *bonzo(...)
|
||||||
local return_type, name = v
|
local return_type, name = v
|
||||||
t,v = tnext(tok)
|
t,v = tnext(tok)
|
||||||
name = v
|
name = v
|
||||||
t,v = tnext(tok)
|
t,v = tnext(tok)
|
||||||
while t ~= '(' do
|
while t ~= '(' do
|
||||||
return_type = return_type .. ' ' .. name
|
return_type = return_type .. ' ' .. name
|
||||||
name = v
|
name = v
|
||||||
t,v = tnext(tok)
|
t,v = tnext(tok)
|
||||||
|
|
|
@ -214,6 +214,8 @@ local function parse_file(fname, lang, package, args)
|
||||||
local t,v = tnext(tok)
|
local t,v = tnext(tok)
|
||||||
-- with some coding styles first comment is standard boilerplate; option to ignore this.
|
-- with some coding styles first comment is standard boilerplate; option to ignore this.
|
||||||
if args.boilerplate and t == 'comment' then
|
if args.boilerplate and t == 'comment' then
|
||||||
|
-- hack to deal with boilerplate inside Lua block comments
|
||||||
|
if v:match '%s*%-%-%[%[' then lang:grab_block_comment(v,tok) end
|
||||||
t,v = tnext(tok)
|
t,v = tnext(tok)
|
||||||
end
|
end
|
||||||
if t == '#' then -- skip Lua shebang line, if present
|
if t == '#' then -- skip Lua shebang line, if present
|
||||||
|
|
Loading…
Reference in New Issue