diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-09-21 00:30:28 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-09-21 00:30:44 -0700 |
| commit | f2048235f5cc7ff02db39a0e2fe5c79c7f390e0b (patch) | |
| tree | 738faa0d4692e53d0fe2deb61399b6d7a9eedc9f /containers.moon | |
| parent | 79d4bd5125de7ff220fbf8a8a5493d437ed16963 (diff) | |
Incremental checkin, currently not working, just saving progress.
Diffstat (limited to 'containers.moon')
| -rw-r--r-- | containers.moon | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/containers.moon b/containers.moon index 70a9f70..039a4ea 100644 --- a/containers.moon +++ b/containers.moon @@ -133,9 +133,11 @@ for i,entry in ipairs(Dict({x:99})) do {:reverse, :upper, :lower, :find, :byte, :match, :gmatch, :gsub, :sub, :format, :rep} = string string2 = require 'string2' - {:lines, :line, :line_at, :as_lua_id} = string2 + {:lines, :line, :line_at, :as_lua_id, :is_lua_id} = string2 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: (start, stop)=> List{byte(tostring(@), start, stop)} [as_lua_id "with 1 -> 2"]: gsub bytes: => List{byte(tostring(@), 1, -1)}, @@ -157,8 +159,10 @@ do line_number_of_1: (i)=> select(2, line_at(@, i)) line_position_of_1: (i)=> select(3, line_at(@, i)) matches_1: (patt)=> match(@, patt) and true or false + matching_1: (patt)=> (match(@, patt)) + matching_groups_1: (patt)=> {match(@, patt)} [as_lua_id "* 1"]: (n)=> rep(@, n) - matching_1: (patt)=> + all_matches_of_1: (patt)=> result = {} stepper,x,i = gmatch(@, patt) while true @@ -176,4 +180,6 @@ do elseif type(i) == 'table' then return sub(@, i[1], i[2]) else return text_methods[i] + getmetatable("").__add = (x)=> tostring(@)..tostring(x) + return {:List, :Dict} |
