diff options
Diffstat (limited to 'lib/os.nom')
| -rw-r--r-- | lib/os.nom | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -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) |
