aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2019-04-16 20:54:53 -0400
committerEduardo Julian2019-04-16 20:54:53 -0400
commit195ffc9a9de68259a5fb54cdee065efeb703c388 (patch)
treed9ac22cec2ddb78d9e5b3bf38336d1e71cef1681
parent697707d8560a5735be38fd9b1ff91a02c289d48f (diff)
The "invalid-syntax" can now be parameterized with the formatter for the inputs.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension.lux20
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux2
-rw-r--r--stdlib/source/lux/tool/compiler/phase/extension/statement.lux12
3 files changed, 15 insertions, 19 deletions
diff --git a/stdlib/source/lux/tool/compiler/phase/extension.lux b/stdlib/source/lux/tool/compiler/phase/extension.lux
index 3b247eda9..d9cf0d701 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension.lux
@@ -42,11 +42,17 @@
(exception.report
["Extension" (%t name)]))
-(exception: #export (invalid-syntax {name Name} {inputs (List Code)})
+(exception: #export (incorrect-arity {name Name} {arity Nat} {args Nat})
+ (exception.report
+ ["Extension" (%t name)]
+ ["Expected" (%n arity)]
+ ["Actual" (%n args)]))
+
+(exception: #export [a] (invalid-syntax {name Name} {%format (Format a)} {inputs (List a)})
(exception.report
["Extension" (%t name)]
["Inputs" (|> inputs
- (list@map %code)
+ (list@map %format)
(text.join-with text.new-line))]))
(exception: #export [s i o] (unknown {name Name} {bundle (Bundle s i o)})
@@ -58,16 +64,6 @@
(list@map %t)
(text.join-with text.new-line))]))
-(exception: #export (incorrect-arity {name Name} {arity Nat} {args Nat})
- (exception.report
- ["Extension" (%t name)]
- ["Expected" (%n arity)]
- ["Actual" (%n args)]))
-
-(exception: #export (incorrect-syntax {name Name})
- (exception.report
- ["Extension" (%t name)]))
-
(def: #export (install name handler)
(All [s i o]
(-> Text (Handler s i o) (Operation s i o Any)))
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux
index 4f11e47fb..20061db55 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension/analysis/common.lux
@@ -92,7 +92,7 @@
(analyse exprC))
_
- (/////analysis.throw ///.invalid-syntax [extension-name argsC+]))))
+ (/////analysis.throw ///.invalid-syntax [extension-name %code argsC+]))))
(template [<name> <type>]
[(def: (<name> eval)
diff --git a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
index 030bc5a2b..10a3b4985 100644
--- a/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
+++ b/stdlib/source/lux/tool/compiler/phase/extension/statement.lux
@@ -146,7 +146,7 @@
(wrap ////statement.no-requirements))
_
- (///.throw //.invalid-syntax [extension-name inputsC+]))))
+ (///.throw //.invalid-syntax [extension-name %code inputsC+]))))
(def: imports
(Syntax (List Import))
@@ -170,7 +170,7 @@
(wrap imports)
(#error.Failure error)
- (///.throw //.invalid-syntax [extension-name (list annotationsV)]))
+ (///.throw //.invalid-syntax [extension-name %code (list annotationsV)]))
_ (////statement.lift-analysis
(do @
[_ (monad.map @ (function (_ [module alias])
@@ -185,7 +185,7 @@
#////statement.referrals (list)}))
_
- (///.throw //.invalid-syntax [extension-name inputsC+]))))
+ (///.throw //.invalid-syntax [extension-name %code inputsC+]))))
## TODO: Reify aliasing as a feature of the compiler, instead of
## manifesting it implicitly through definition annotations.
@@ -215,7 +215,7 @@
(wrap ////statement.no-requirements))
_
- (///.throw //.invalid-syntax [extension-name inputsC+]))))
+ (///.throw //.invalid-syntax [extension-name %code inputsC+]))))
(template [<mame> <type> <scope>]
[(def: <mame>
@@ -240,7 +240,7 @@
(wrap ////statement.no-requirements))
_
- (///.throw //.invalid-syntax [extension-name inputsC+]))))]
+ (///.throw //.invalid-syntax [extension-name %code inputsC+]))))]
[def::analysis ////analysis.Handler ////statement.lift-analysis]
[def::synthesis ////synthesis.Handler ////statement.lift-synthesis]
@@ -293,7 +293,7 @@
(wrap ////statement.no-requirements))
_
- (///.throw //.invalid-syntax [extension-name inputsC+]))))
+ (///.throw //.invalid-syntax [extension-name %code inputsC+]))))
(def: (bundle::def program)
(All [anchor expression statement]