From ac29c8e9c6005db68cb027f34dbc8947e8a96e28 Mon Sep 17 00:00:00 2001 From: steve donovan Date: Mon, 10 Dec 2012 09:39:12 +0200 Subject: [PATCH] Added Geoff commit by hand: The table parser didn't handle tables with a trailing comment { a=1, --- ldoc/lexer.lua | 10 ++++++---- ldoc/tools.lua | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ldoc/lexer.lua b/ldoc/lexer.lua index 1b5e2f9..13251db 100644 --- a/ldoc/lexer.lua +++ b/ldoc/lexer.lua @@ -377,9 +377,6 @@ end function lexer.get_separated_list(tok,endtoken,delim) endtoken = endtoken or ')' delim = delim or ',' - local parm_values = {} - local level = 1 -- used to count ( and ) - local tl = {} local function tappend (tl,t,val) val = val or t append(tl,{t,val}) @@ -402,12 +399,17 @@ function lexer.get_separated_list(tok,endtoken,delim) return t == delim end end + local parm_values = {} + local level = 1 -- used to count ( and ) + local tl = {} local token,value while true do token,value=tok() if not token then return nil,'EOS' end -- end of stream is an error! if is_end(token,value) and level == 1 then - append(parm_values,tl) + if next(t1) then + append(parm_values,tl) + end break elseif token == '(' then level = level + 1 diff --git a/ldoc/tools.lua b/ldoc/tools.lua index 42006ca..57042c7 100644 --- a/ldoc/tools.lua +++ b/ldoc/tools.lua @@ -278,7 +278,7 @@ function M.get_parameters (tok,endtoken,delim) args.comments = {} local ltl = lexer.get_separated_list(tok,endtoken,delim) - if not ltl or #ltl[1] == 0 then return args end -- no arguments + if not ltl or not ltl[1] or #ltl[1] == 0 then return args end -- no arguments local function set_comment (idx,tok) local text = stringx.rstrip(value_of(tok)) --