aboutsummaryrefslogtreecommitdiff
path: root/files.moon
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-10-31 03:51:37 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-10-31 03:52:00 -0700
commit83219f8522271ae4f278abc5687921cc8267bb33 (patch)
tree17ad8aa28d94d5442fac990cf3a0fae204d90850 /files.moon
parentea3197aaffba00318920ed5e1e33ca5f2a5e6c5c (diff)
Bumped version number, fixed REPL, and simplified/fixed (use %).
Diffstat (limited to 'files.moon')
-rw-r--r--files.moon10
1 files changed, 3 insertions, 7 deletions
diff --git a/files.moon b/files.moon
index becc3fb..e0fe02b 100644
--- a/files.moon
+++ b/files.moon
@@ -33,7 +33,6 @@ Files.read = (filename)->
_FILE_CACHE[filename] = contents
return contents
--- `walk` returns an iterator over all files matching a path.
{:match, :gsub} = string
-- TODO: improve sanitization
@@ -108,12 +107,9 @@ Files.walk = (path, flush_cache=false)->
else
for nomsupath in package.nomsupath\gmatch("[^;]+")
if files = browse(nomsupath.."/"..path) then break
- iter = (files, i)->
- return unless files
- i += 1
- if f = files[i]
- return i, f
- return iter, files, 0
+ files or= {}
+ files = [gsub(f, "^%./", "") for f in *files]
+ return ipairs(files)
line_counter = re.compile([[
lines <- {| line (%nl line)* |}