1

Compare commits

..

No commits in common. "5de6deae99c705148aa1537bb6839ae3d316a0c8" and "9d241775a9eb49a3fece4b4333b11dbc5fd804ba" have entirely different histories.

View File

@ -234,9 +234,6 @@ function Param.new(pair, opt)
text = '', text = '',
literals = {}, literals = {},
offset = nil, offset = nil,
start = nil,
stop = nil,
terminator = nil,
} }
return setmetatable(param, Param) return setmetatable(param, Param)
@ -251,19 +248,6 @@ function Param:append(char, cursor)
if cursor == Cursor.get_current() then if cursor == Cursor.get_current() then
self.offset = #self.text self.offset = #self.text
end end
if not self.start then
self.start = cursor
end
self.stop = cursor
end
function Param:terminate(cursor)
self.terminator = cursor
if self.terminator == Cursor.get_current() then
self.offset = #self.text
end
end end
function Param:is_active() function Param:is_active()
@ -296,7 +280,7 @@ function Param:trim()
self:slice(1, #self.text - #self.text:match('%s*$')) self:slice(1, #self.text - #self.text:match('%s*$'))
self:slice(1 + #self.text:match('^%s*'), #self.text) self:slice(1 + #self.text:match('^%s*'), #self.text)
if self.text:match('^' .. self.opt.line_prefix) then if #self.opt.line_prefix > 0 and self.text:match('^' .. self.opt.line_prefix) then
self:slice(1 + #self.opt.line_prefix, #self.text) self:slice(1 + #self.opt.line_prefix, #self.text)
end end
@ -342,16 +326,11 @@ function ParamList.new(range, opt)
return setmetatable(params, ParamList) return setmetatable(params, ParamList)
end end
function ParamList:flush(cursor) function ParamList:flush()
if self.current then if self.current then
if cursor then
self.current:terminate(cursor)
end
if self.current:trim() then if self.current:trim() then
table.insert(self.parsed, self.current) table.insert(self.parsed, self.current)
end end
self.current = nil self.current = nil
end end
end end
@ -360,7 +339,7 @@ function ParamList:update(char, brace_stack, cursor)
if not cursor:is_literal() then if not cursor:is_literal() then
brace_stack:update(char) brace_stack:update(char)
if brace_stack:empty() and char == ',' then if brace_stack:empty() and char == ',' then
self:flush(cursor) self:flush()
return return
end end
end end