aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/consolecolor.nom2
-rw-r--r--lib/file_hash.nom4
-rw-r--r--lib/object.nom2
-rw-r--r--lib/os.nom9
-rw-r--r--lib/things.nom4
5 files changed, 5 insertions, 16 deletions
diff --git a/lib/consolecolor.nom b/lib/consolecolor.nom
index db29b9f..d1da247 100644
--- a/lib/consolecolor.nom
+++ b/lib/consolecolor.nom
@@ -18,7 +18,7 @@ $colors = {
for $name = $colornum in $colors:
$colornum = "\$colornum"
- $compile.action.$name =
+ $(COMPILE RULES).$name =
for ($compile $text):
if $text:
return (Lua "('\\027[\($colornum)m'..\($text as lua expr)..'\\027[0m')")
diff --git a/lib/file_hash.nom b/lib/file_hash.nom
index ec39e29..70446ca 100644
--- a/lib/file_hash.nom
+++ b/lib/file_hash.nom
@@ -2,8 +2,8 @@
#
This file defines some actions for hashing files and looking up files by hash.
-use "lib/os.nom"
-use "lib/base64.nom"
+use "lib/os"
+use "lib/base64"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/lib/object.nom b/lib/object.nom
index 13a9ec5..a3a8d93 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -108,7 +108,7 @@ test:
return inst
end,
})
- _ENV[class.name:as_lua_id()] = class
+ \(nomsu environment name)[class.name:as_lua_id()] = class
class.__index = class
class.class = class
class.__tostring = function(inst)
diff --git a/lib/os.nom b/lib/os.nom
index 916f18c..87b3426 100644
--- a/lib/os.nom
+++ b/lib/os.nom
@@ -2,21 +2,12 @@
#
This file defines some actions that interact with the operating system and filesystem.
-test:
- assume (nomsu files for "core")
-
externally (files for $path) means:
$files = (=lua "Files.list(\$path)")
if $files:
$files = (List $files)
return $files
-externally (nomsu files for $path) means:
- for $nomsupath in ($package.nomsupath, all matches of "[^;]+"):
- $files = (files for "\($nomsupath)/\$path")
- if $files:
- return $files
-
externally (=sh $cmd) means:
lua> ("
local result = io.popen(\$cmd)
diff --git a/lib/things.nom b/lib/things.nom
index 32942d9..84682b3 100644
--- a/lib/things.nom
+++ b/lib/things.nom
@@ -5,7 +5,6 @@
test:
an (Empty) is a thing
a (Dog) is a thing:
- [$it, $its] = [Dog, Dog]
($its, set up) means:
$its.barks or= 0
@@ -37,7 +36,6 @@ test:
assume (($d, bark) == "Bark!")
a (Corgi) is a thing:
- [$it, $its] = [Corgi, Corgi]
$it [set up, gets pissed off] like a (Dog)
($it, as text) means "Dogloaf \{: for $k = $v in $it: add $k = $v}"
($its, sploot) means "sploooot"
@@ -61,7 +59,6 @@ test:
assume (($d, bark) == "Bark! Bark!")
a (Vec) is a thing with {.x, .y}:
- $its = (Vec)
($its, + $other) means (Vec {.x = ($its.x + $other.x), .y = ($its.y + $other.y)})
assume ((Vec {.x = 1, .y = 2}) + (Vec {.x = 10, .y = 10})) ==
@@ -145,6 +142,7 @@ externally (a class named $classname with $members $(initialize $)) means:
(
Lua ("
, function(\$class_id)
+ local it, its = \$class_id, \$class_id;
\$body_lua
end
")