aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/syntax/common/annotations.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/macro/syntax/common/annotations.lux41
1 files changed, 41 insertions, 0 deletions
diff --git a/stdlib/source/lux/macro/syntax/common/annotations.lux b/stdlib/source/lux/macro/syntax/common/annotations.lux
new file mode 100644
index 000000000..e1ee52274
--- /dev/null
+++ b/stdlib/source/lux/macro/syntax/common/annotations.lux
@@ -0,0 +1,41 @@
+(.module:
+ [lux #*
+ [abstract
+ [equivalence (#+ Equivalence)]]
+ [control
+ ["." function]
+ ["<>" parser
+ ["<.>" code (#+ Parser)]]]
+ [data
+ ["." product]
+ ["." name]
+ [collection
+ ["." list ("#\." functor)]]]
+ [macro
+ ["." code]]])
+
+(type: #export Annotations
+ (List [Name Code]))
+
+(def: #export equivalence
+ (Equivalence Annotations)
+ (list.equivalence
+ (product.equivalence name.equivalence
+ code.equivalence)))
+
+(def: #export empty
+ Annotations
+ (list))
+
+(def: #export write
+ (-> Annotations Code)
+ (let [entry (product.both code.tag function.identity)]
+ (|>> (list\map entry)
+ code.record)))
+
+(def: #export parser
+ (Parser Annotations)
+ (<code>.record
+ (<>.some
+ (<>.and <code>.tag
+ <code>.any))))