Add :loc method to the lexer
The parser will need it.
@@ -255,7 +255,7 @@ end
--
function Lexer:next()
while true do
- local loc = Location.new(self.file_name, self.line, self.col, self.pos)
+ local loc = self:loc()
local name, val = self:_next()
if not name then
return false, val
@@ -266,4 +266,8 @@ function Lexer:next()
end
end
+function Lexer:loc()
+ return Location.new(self.file_name, self.line, self.col, self.pos)
+end
+
return Lexer
