aboutsummaryrefslogtreecommitdiff
path: root/lua_obj.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua_obj.lua')
-rw-r--r--lua_obj.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/lua_obj.lua b/lua_obj.lua
index c4bbb32..4585d58 100644
--- a/lua_obj.lua
+++ b/lua_obj.lua
@@ -19,9 +19,9 @@ Source = immutable({
end,
__tostring = function(self)
if self.stop then
- return "Source(\"" .. tostring(self.filename) .. "\", " .. tostring(self.start) .. ", " .. tostring(self.stop) .. ")"
+ return "\"" .. tostring(self.filename) .. "[" .. tostring(self.start) .. ":" .. tostring(self.stop) .. "]\""
else
- return "Source(\"" .. tostring(self.filename) .. "\", " .. tostring(self.start) .. ")"
+ return "\"" .. tostring(self.filename) .. "[" .. tostring(self.start) .. "]\""
end
end,
__lt = function(self, other)
@@ -148,11 +148,14 @@ do
...
}
if type(self.source) == 'string' then
- local filename, start, stop = self.source:match("^(.-)[(%d+):(%d+)]$")
+ local filename, start, stop = self.source:match("^(.-)%[(%d+):(%d+)%]$")
+ if not (filename) then
+ filename, start = self.source:match("^(.-)%[(%d+)%]$")
+ end
if start or stop then
self.source = Source(filename, tonumber(start), tonumber(stop))
else
- self.source = Source(self.source, 1, #self)
+ self.source = Source(self.source, 1, #self + 1)
end
end
end,