diff options
author | Eduardo Julian | 2021-03-10 10:32:30 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-03-10 10:32:30 -0400 |
commit | 0c75fd67e3fcfbfb09d8c11b6cf396084ce40a15 (patch) | |
tree | aa95b07ad0a18e0b1dd92657330c7ccaa6202245 /stdlib/source/lux.lux | |
parent | cbc41f10fb3e0e776767d2266b22068172b0f69a (diff) |
Wrestling with JPHP.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux.lux | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 1bb7efa07..b2deead45 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -1559,7 +1559,7 @@ ({(#Left msg) (#Left msg) - (#Right state' a) + (#Right [state' a]) (f a state')} (ma state))))}) @@ -2205,7 +2205,7 @@ 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8" 9 "9" - _ ("lux io error" "undefined")} + _ ("lux io error" "@digit::format Undefined behavior.")} digit)) (def:''' (nat\encode value) @@ -2700,7 +2700,7 @@ (int\encode value) [_ (#Rev value)] - ("lux io error" "Undefined behavior.") + ("lux io error" "@code\encode Undefined behavior.") [_ (#Frac value)] (frac\encode value) @@ -4943,7 +4943,7 @@ [#Record "{" "}" rejoin_all_pairs]) [new_location (#Rev value)] - ("lux io error" "Undefined behavior.") + ("lux io error" "@doc_example->Text Undefined behavior.") )) (def: (with_baseline baseline [file line column]) @@ -5510,6 +5510,12 @@ _ (fail (..wrong_syntax_error (name_of ..:assume))))) +(def: location + {#.doc "The location of the current expression being analyzed."} + (Meta Location) + (function (_ compiler) + (#Right [compiler (get@ #location compiler)]))) + (macro: #export (undefined tokens) {#.doc (doc "Meant to be used as a stand-in for functions with undefined implementations." "Undefined expressions will type-check against everything, so they make good dummy implementations." @@ -5519,7 +5525,12 @@ (undefined)))} (case tokens #Nil - (return (list (` (..error! "Undefined behavior.")))) + (do meta_monad + [location ..location + #let [[module line column] location + location ($_ "lux text concat" (text\encode module) "," (nat\encode line) "," (nat\encode column)) + message ($_ "lux text concat" "Undefined behavior @ " location)]] + (wrap (list (` (..error! (~ (text$ message))))))) _ (fail (..wrong_syntax_error (name_of ..undefined))))) |