aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/macro/syntax/input.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/macro/syntax/input.lux38
1 files changed, 38 insertions, 0 deletions
diff --git a/stdlib/source/library/lux/macro/syntax/input.lux b/stdlib/source/library/lux/macro/syntax/input.lux
new file mode 100644
index 000000000..9307322d9
--- /dev/null
+++ b/stdlib/source/library/lux/macro/syntax/input.lux
@@ -0,0 +1,38 @@
+(.module:
+ [library
+ [lux #*
+ [abstract
+ [equivalence (#+ Equivalence)]]
+ [control
+ ["<>" parser
+ ["<.>" code (#+ Parser)]]]
+ [data
+ ["." product]]
+ [macro
+ ["." code]]]])
+
+(type: #export Input
+ {#binding Code
+ #type Code})
+
+(def: #export equivalence
+ (Equivalence Input)
+ ($_ product.equivalence
+ code.equivalence
+ code.equivalence
+ ))
+
+(def: #export (format value)
+ (-> Input Code)
+ (code.record
+ (list [(get@ #binding value)
+ (get@ #type value)])))
+
+(def: #export parser
+ {#.doc "Parser for the common typed-argument syntax used by many macros."}
+ (Parser Input)
+ (<code>.record
+ ($_ <>.and
+ <code>.any
+ <code>.any
+ )))