diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-19 17:23:44 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-04-19 17:23:54 -0700 |
| commit | da33269c307c8a045e548cb1df2a3281a7a0f99e (patch) | |
| tree | 9451b857633b0869b4589a73107056815aa560c7 /nomsu.lua | |
| parent | dcb380f1f6ec67c52364b1246546f1f6b2c168d3 (diff) | |
All tests passing (except object)
Diffstat (limited to 'nomsu.lua')
| -rw-r--r-- | nomsu.lua | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -17,7 +17,7 @@ local colors = setmetatable({ }, { return "" end }) -local colored = setmetatable({ }, { +colored = setmetatable({ }, { __index = function(_, color) return (function(msg) return colors[color] .. tostring(msg or '') .. colors.reset @@ -170,6 +170,7 @@ do local line_no = 1 local text_loc = lpeg.userdata.source_code.source:sub(pos, pos) line_no = text_loc:get_line_number() + src = FILE_CACHE[text_loc.filename] local prev_line = src:sub(LINE_STARTS[src][line_no - 1] or 1, LINE_STARTS[src][line_no] - 1) local err_line = src:sub(LINE_STARTS[src][line_no], (LINE_STARTS[src][line_no + 1] or 0) - 1) local next_line = src:sub(LINE_STARTS[src][line_no + 1] or -1, (LINE_STARTS[src][line_no + 2] or 0) - 1) @@ -187,7 +188,7 @@ setmetatable(NOMSU_DEFS, { if type(value) == 'table' then error("Not a tuple: " .. tostring(repr(value))) end - local source = lpeg.userdata.source_code.source:sub(start, stop) + local source = lpeg.userdata.source_code.source:sub(start, stop - 1) local node = Types[key](value, source) return node end |
