diff options
| -rw-r--r-- | containers.lua | 21 | ||||
| -rw-r--r-- | nomsu_compiler.lua | 2 |
2 files changed, 19 insertions, 4 deletions
diff --git a/containers.lua b/containers.lua index a7819ec..d31c786 100644 --- a/containers.lua +++ b/containers.lua @@ -353,13 +353,17 @@ do reverse, upper, lower, find, byte, match, gmatch, gsub, sub, format, rep = _obj_0.reverse, _obj_0.upper, _obj_0.lower, _obj_0.find, _obj_0.byte, _obj_0.match, _obj_0.gmatch, _obj_0.gsub, _obj_0.sub, _obj_0.format, _obj_0.rep end local string2 = require('string2') - local lines, line, line_at, as_lua_id - lines, line, line_at, as_lua_id = string2.lines, string2.line, string2.line_at, string2.as_lua_id + local lines, line, line_at, as_lua_id, is_lua_id + lines, line, line_at, as_lua_id, is_lua_id = string2.lines, string2.line, string2.line_at, string2.as_lua_id, string2.is_lua_id local text_methods = { formatted_with_1 = format, byte_1 = byte, position_of_1 = find, position_of_1_after_2 = find, + as_a_lua_identifier = as_lua_id, + is_a_lua_identifier = is_lua_id, + as_a_lua_id = as_lua_id, + is_a_lua_id = is_lua_id, bytes_1_to_2 = function(self, start, stop) return List({ byte(tostring(self), start, stop) @@ -403,10 +407,18 @@ do matches_1 = function(self, patt) return match(self, patt) and true or false end, + matching_1 = function(self, patt) + return (match(self, patt)) + end, + matching_groups_1 = function(self, patt) + return { + match(self, patt) + } + end, [as_lua_id("* 1")] = function(self, n) return rep(self, n) end, - matching_1 = function(self, patt) + all_matches_of_1 = function(self, patt) local result = { } local stepper, x, i = gmatch(self, patt) while true do @@ -434,6 +446,9 @@ do return text_methods[i] end end + getmetatable("").__add = function(self, x) + return tostring(self) .. tostring(x) + end end return { List = List, diff --git a/nomsu_compiler.lua b/nomsu_compiler.lua index 89d247a..870be9a 100644 --- a/nomsu_compiler.lua +++ b/nomsu_compiler.lua @@ -184,7 +184,7 @@ do assert = assert, dofile = dofile, loadstring = loadstring, - type = type, + lua_type_of_1 = type, select = select, math = math, io = io, |
