Added Geoff commit by hand: The table parser didn't handle tables with a trailing comment { a=1,
This commit is contained in:
parent
7f6835d253
commit
ac29c8e9c6
|
@ -377,9 +377,6 @@ end
|
||||||
function lexer.get_separated_list(tok,endtoken,delim)
|
function lexer.get_separated_list(tok,endtoken,delim)
|
||||||
endtoken = endtoken or ')'
|
endtoken = endtoken or ')'
|
||||||
delim = delim or ','
|
delim = delim or ','
|
||||||
local parm_values = {}
|
|
||||||
local level = 1 -- used to count ( and )
|
|
||||||
local tl = {}
|
|
||||||
local function tappend (tl,t,val)
|
local function tappend (tl,t,val)
|
||||||
val = val or t
|
val = val or t
|
||||||
append(tl,{t,val})
|
append(tl,{t,val})
|
||||||
|
@ -402,12 +399,17 @@ function lexer.get_separated_list(tok,endtoken,delim)
|
||||||
return t == delim
|
return t == delim
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local parm_values = {}
|
||||||
|
local level = 1 -- used to count ( and )
|
||||||
|
local tl = {}
|
||||||
local token,value
|
local token,value
|
||||||
while true do
|
while true do
|
||||||
token,value=tok()
|
token,value=tok()
|
||||||
if not token then return nil,'EOS' end -- end of stream is an error!
|
if not token then return nil,'EOS' end -- end of stream is an error!
|
||||||
if is_end(token,value) and level == 1 then
|
if is_end(token,value) and level == 1 then
|
||||||
append(parm_values,tl)
|
if next(t1) then
|
||||||
|
append(parm_values,tl)
|
||||||
|
end
|
||||||
break
|
break
|
||||||
elseif token == '(' then
|
elseif token == '(' then
|
||||||
level = level + 1
|
level = level + 1
|
||||||
|
|
|
@ -278,7 +278,7 @@ function M.get_parameters (tok,endtoken,delim)
|
||||||
args.comments = {}
|
args.comments = {}
|
||||||
local ltl = lexer.get_separated_list(tok,endtoken,delim)
|
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 function set_comment (idx,tok)
|
||||||
local text = stringx.rstrip(value_of(tok)) --
|
local text = stringx.rstrip(value_of(tok)) --
|
||||||
|
|
Loading…
Reference in New Issue