aboutsummaryrefslogtreecommitdiff
path: root/core/errors.nom
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-02 14:38:24 -0700
committerBruce Hill <bruce@bruce-hill.com>2018-11-02 14:39:23 -0700
commit307dea18815ba4a06a3098edb170d7ad90708815 (patch)
treebce78eb28fa03c9939a92e08e47564afc984c988 /core/errors.nom
parentd0c3c57f7b25c8d912c426e48cb5ab09cd738f65 (diff)
Changed stub convention to (foo 1 baz 2) -> foo_1_baz instead of
foo_1_baz_2, removed "smext", made some cleanup changes.
Diffstat (limited to 'core/errors.nom')
-rw-r--r--core/errors.nom22
1 files changed, 11 insertions, 11 deletions
diff --git a/core/errors.nom b/core/errors.nom
index 70dea0c..0b0a6a3 100644
--- a/core/errors.nom
+++ b/core/errors.nom
@@ -4,8 +4,7 @@
use "core/metaprogramming.nom"
-(barf) compiles to (Lua "error(nil, 0);")
-(barf %msg) compiles to (Lua "error(\(%msg as lua expr), 0);")
+(barf %msg) compiles to (Lua "error(\(=lua "\%msg and \(%msg as lua expr) or 'nil'"), 0);")
(compile error at %tree %msg) compiles to (..)
Lua "nomsu:compile_error(\(%tree as lua expr), \(%msg as lua expr))"
(compile error at %tree %msg hint %hint) compiles to (..)
@@ -66,9 +65,9 @@ test:
local ok, ret = xpcall(function()
\(%action as lua statements)
fell_through = true
- end, function(\(%msg as lua expr))
+ end, function(\(=lua "\%fallback and \(%msg as lua expr) or ''"))
local ok, ret = pcall(function()
- \(%fallback as lua statements)
+ \((=lua "\%fallback or \%msg") as lua statements)
end)
if not ok then err, erred = ret, true end
end)
@@ -84,18 +83,19 @@ test:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-[..]
- try %action and if it succeeds %success or if it barfs %fallback
- try %action and if it barfs %fallback or if it succeeds %success
-..all parse as (..)
- try %action and if it succeeds %success or if it barfs (=lua "") %fallback
+#
+ [..]
+ try %action and if it succeeds %success or if it barfs %fallback
+ try %action and if it barfs %fallback or if it succeeds %success
+ ..all parse as (..)
+ try %action and if it succeeds %success or if it barfs (=lua "") %fallback
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(try %action) parses as (..)
try %action and if it succeeds (do nothing) or if it barfs (do nothing)
-(try %action and if it barfs %fallback) parses as (..)
+#(try %action and if it barfs %fallback) parses as (..)
try %action and if it succeeds (do nothing) or if it barfs %fallback
(try %action and if it barfs %msg %fallback) parses as (..)