diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-09-10 15:55:34 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-09-10 15:56:00 -0700 |
| commit | 43e6523fd42f736acfcd0c32d82246c262e07a1d (patch) | |
| tree | 5a2d6b5250528dc42ce7433374cac6c0c65859a9 /core/errors.nom | |
| parent | 603c5b12451d6c68b1e41906e10117da4d99e362 (diff) | |
Shifting towards more text methods instead of text global functions.
Also fixed a bug with method call parenthesizing.
Diffstat (limited to 'core/errors.nom')
| -rw-r--r-- | core/errors.nom | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/errors.nom b/core/errors.nom index 874f2fe..638b487 100644 --- a/core/errors.nom +++ b/core/errors.nom @@ -18,6 +18,19 @@ compile [assume %condition] to: error(\(quote "\%assumption"), 0) end +compile [assume %a == %b] to: + lua> ".." + local \%assumption = 'Assumption failed: '..tostring(nomsu:tree_to_nomsu(\(\(%a == %b)))) + define mangler + return (..) + Lua ".." + do + local \(mangle "a"), \(mangle "b") = \(%a as lua expr), \(%b as lua expr) + if \(mangle "a") ~= \(mangle "b") then + error(\(quote "\%assumption").."\\n"..tostring(\(mangle "a")).." != "..tostring(\(mangle "b")), 0) + end + end + compile [assume %condition or barf %message] to (..) Lua ".." if not \(%condition as lua expr) then |
