Added Geoff commit by hand: The table parser didn't handle tables with a trailing comment { a=1,

This commit is contained in:
steve donovan 2012-12-10 09:39:12 +02:00
parent 7f6835d253
commit ac29c8e9c6
2 changed files with 7 additions and 5 deletions

View File

@ -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
if next(t1) then
append(parm_values,tl)
end
break
elseif token == '(' then
level = level + 1

View File

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