aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-21 14:43:49 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-21 14:44:26 -0700
commitae4670bd8e0e45985e43402f246e4219cd29fcaa (patch)
tree0c043c6b8aed0ebb7acf77b0817fe4ffd193cb38 /core
parent6728587dfc6a5f4090f2673113ffedb2be924daf (diff)
Improvements working towards better inline tests. Improved handling of
file spoofing and adding -e command line flag for executing a string.
Diffstat (limited to 'core')
-rw-r--r--core/operators.nom5
-rw-r--r--core/text.nom6
2 files changed, 8 insertions, 3 deletions
diff --git a/core/operators.nom b/core/operators.nom
index d0e3915..9a836bf 100644
--- a/core/operators.nom
+++ b/core/operators.nom
@@ -209,7 +209,8 @@ compile [not %] to (Lua value "(not \(% as lua expr))")
test:
assume ((length of [1, 2, 3]) == 3)
-compile [length of %list, || %list ||] to (Lua value "(#\(%list as lua expr))")
+compile [length of %list, len %list, || %list ||] to (Lua value "(#\(%list as lua expr))")
+compile [%list is empty] to (Lua value "(#\(%list as lua expr) == 0)")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -221,4 +222,4 @@ parse [%var /= %] as (%var = (%var / %))
parse [%var ^= %] as (%var = (%var ^ %))
parse [%var and= %] as (%var = (%var and %))
parse [%var or= %] as (%var = (%var or %))
-parse [wrap %var around %] as (%var = (%var wrapped around %)) \ No newline at end of file
+parse [wrap %var around %] as (%var = (%var wrapped around %))
diff --git a/core/text.nom b/core/text.nom
index 641db14..40e0451 100644
--- a/core/text.nom
+++ b/core/text.nom
@@ -53,6 +53,10 @@ compile [%text matches %pattern] to (..)
Lua value ".."
(\(%text as lua expr):match(\(%pattern as lua expr)) and true or false)
+compile [%text matching %pattern] to (..)
+ Lua value ".."
+ \(%text as lua expr):match(\(%pattern as lua expr))
+
# Text literals
lua> ".."
@@ -68,4 +72,4 @@ lua> ".."
return LuaCode.Value(tree.source, lua)
end
end
- end \ No newline at end of file
+ end