diff options
Diffstat (limited to 'stdlib/source/lux/tool/compiler/phase/extension.lux')
-rw-r--r-- | stdlib/source/lux/tool/compiler/phase/extension.lux | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/extension.lux b/stdlib/source/lux/tool/compiler/phase/extension.lux index 43df97b9e..3b247eda9 100644 --- a/stdlib/source/lux/tool/compiler/phase/extension.lux +++ b/stdlib/source/lux/tool/compiler/phase/extension.lux @@ -4,7 +4,7 @@ [monad (#+ do)]] [control ["." function] - ["ex" exception (#+ exception:)]] + ["." exception (#+ exception:)]] [data ["." error (#+ Error)] ["." text ("#@." order) @@ -38,29 +38,35 @@ (type: #export (Phase s i o) (//.Phase (State s i o) i o)) -(template [<name>] - [(exception: #export (<name> {name Name}) - (ex.report ["Extension" (%t name)]))] +(exception: #export (cannot-overwrite {name Name}) + (exception.report + ["Extension" (%t name)])) - [cannot-overwrite] - [invalid-syntax] - ) +(exception: #export (invalid-syntax {name Name} {inputs (List Code)}) + (exception.report + ["Extension" (%t name)] + ["Inputs" (|> inputs + (list@map %code) + (text.join-with text.new-line))])) (exception: #export [s i o] (unknown {name Name} {bundle (Bundle s i o)}) - (ex.report ["Extension" (%t name)] - ["Available" (|> bundle - dictionary.keys - (list.sort text@<) - (list@map (|>> %t (format text.new-line text.tab))) - (text.join-with ""))])) + (exception.report + ["Extension" (%t name)] + ["Available" (|> bundle + dictionary.keys + (list.sort text@<) + (list@map %t) + (text.join-with text.new-line))])) (exception: #export (incorrect-arity {name Name} {arity Nat} {args Nat}) - (ex.report ["Extension" (%t name)] - ["Expected" (%n arity)] - ["Actual" (%n args)])) + (exception.report + ["Extension" (%t name)] + ["Expected" (%n arity)] + ["Actual" (%n args)])) (exception: #export (incorrect-syntax {name Name}) - (ex.report ["Extension" (%t name)])) + (exception.report + ["Extension" (%t name)])) (def: #export (install name handler) (All [s i o] @@ -72,7 +78,7 @@ []]) _ - (ex.throw cannot-overwrite name)))) + (exception.throw cannot-overwrite name)))) (def: #export (apply phase [name parameters]) (All [s i o] @@ -84,7 +90,7 @@ stateE) #.None - (ex.throw unknown [name bundle])))) + (exception.throw unknown [name bundle])))) (def: #export (localized get set transform) (All [s s' i o v] |