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
|
||||||
|
|
|
@ -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