Issue #137 boilerplate Lua block comment

This commit is contained in:
steve donovan 2014-01-06 13:35:12 +02:00
parent 94975bcb8c
commit 60c6e79dd9
2 changed files with 6 additions and 3 deletions

View File

@ -87,6 +87,7 @@ end
function Lua:grab_block_comment(v,tok)
local equals = v:match('^%-%-%[(=*)%[')
if not equals then return v end
v = v:gsub(self.block_comment,'')
return tools.grab_block_comment(v,tok,'%]'..equals..'%]')
end
@ -286,11 +287,11 @@ function CC:item_follows (t,v,tok)
t,v = tnext(tok)
end
-- types may have multiple tokens: example, const char *bonzo(...)
local return_type, name = v
local return_type, name = v
t,v = tnext(tok)
name = v
name = v
t,v = tnext(tok)
while t ~= '(' do
while t ~= '(' do
return_type = return_type .. ' ' .. name
name = v
t,v = tnext(tok)

View File

@ -214,6 +214,8 @@ local function parse_file(fname, lang, package, args)
local t,v = tnext(tok)
-- with some coding styles first comment is standard boilerplate; option to ignore this.
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)
end
if t == '#' then -- skip Lua shebang line, if present