aboutsummaryrefslogtreecommitdiff
path: root/lib/os.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-11 15:50:46 -0800
commit4efe44ed271aeed8e25e909344788d92a0d9f82b (patch)
tree73766440b53031d4fc8210dbe3b0aece47e6b852 /lib/os.nom
parentba03cb67c3c8ba53451eba25dd2186f095cd1db2 (diff)
Fully upgraded to 4.10.12.7, including deprecating the old list/dict
comprehension methods, in favor of the new native support.
Diffstat (limited to 'lib/os.nom')
-rw-r--r--lib/os.nom19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/os.nom b/lib/os.nom
index fb705dc..c165e5a 100644
--- a/lib/os.nom
+++ b/lib/os.nom
@@ -1,9 +1,10 @@
-#!/usr/bin/env nomsu -V4.8.10
+#!/usr/bin/env nomsu -V4.10.12.7
#
This file defines some actions that interact with the operating system and filesystem.
-
+
test:
path of Nomsu file "lib/os.nom"
+
externally (path of Nomsu file %filename) means:
lua> "for i,f in Files.walk(\%filename) do return f end"
barf "Could not find file: \%filename"
@@ -17,10 +18,11 @@ externally (sh> %cmd) means:
test:
read file "lib/os.nom"
-externally (read file %filename) means (=lua "Files.read(\%filename)")
+externally (read file %filename) means (=lua "Files.read(\%filename)")
test:
for file %f in "core": do nothing
+
(for file %f in %path %body) compiles to "\
..for i,\(%f as lua expr) in Files.walk(\(%path as lua expr)) do
\(%body as lua)
@@ -49,23 +51,28 @@ externally [..]
test:
assume (line number of 3 in "x\ny") == 2
+
externally (line number of %pos in %str) means (..)
=lua "Files.get_line_number(\%str, \%pos)"
test:
assume (line 2 in "one\ntwo\nthree") == "two"
+
externally (line %line_num in %str) means (..)
=lua "Files.get_line(\%str, \%line_num)"
test:
assume (source lines of \(this))
+
externally (source lines of %tree) means:
%source = (%tree.source if (%tree is syntax tree) else %tree)
%file = (read file %source.filename)
return (..)
- (..)
- (line % in %file) for % in (line number of %source.start in %file) to (..)
- line number of %source.stop in %file
+ [..]
+ :
+ for % in (line number of %source.start in %file) to (..)
+ line number of %source.stop in %file
+ ..: add (line % in %file)
..::joined with "\n"
externally (spoof file %text) means (%Files.spoof %text)