aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/macro/syntax/common/reader.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/macro/syntax/common/reader.lux')
-rw-r--r--stdlib/source/lux/macro/syntax/common/reader.lux65
1 files changed, 1 insertions, 64 deletions
diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux
index 03fea57bc..7033069f6 100644
--- a/stdlib/source/lux/macro/syntax/common/reader.lux
+++ b/stdlib/source/lux/macro/syntax/common/reader.lux
@@ -12,9 +12,7 @@
[collection
["." list]]]
["." meta]]
- ["." //
- [///
- [syntax (#+ syntax:)]]])
+ ["." //])
(def: #export export
(Parser Bit)
@@ -37,30 +35,6 @@
(Parser //.Annotations)
(s.record (p.some (p.and s.tag s.any))))
-(def: check^
- (Parser [(Maybe Code) Code])
- (p.either (s.form (do p.monad
- [_ (s.text! "lux check")
- type s.any
- value s.any]
- (wrap [(#.Some type) value])))
- (p.and (p\wrap #.None)
- s.any)))
-
-(def: _definition-anns-tag^
- (Parser Name)
- (s.tuple (p.and s.text s.text)))
-
-(def: (_definition-anns^ _)
- (-> Any (Parser //.Annotations))
- (p.or (s.tag! (name-of #.Nil))
- (s.form (do p.monad
- [_ (s.tag! (name-of #.Cons))
- [head tail] (p.and (s.tuple (p.and _definition-anns-tag^ s.any))
- (_definition-anns^ []))]
- (wrap [head tail])))
- ))
-
(def: (flat-list^ _)
(-> Any (Parser (List Code)))
(p.either (do p.monad
@@ -101,43 +75,6 @@
_
#.None)))
-(def: #export (definition compiler)
- {#.doc "A reader that first macro-expands and then analyses the input Code, to ensure it's a definition."}
- (-> Lux (Parser //.Definition))
- (do {! p.monad}
- [definition-raw s.any
- me-definition-raw (|> definition-raw
- meta.expand-all
- (meta.run compiler)
- p.lift)]
- (s.local me-definition-raw
- (s.form (do !
- [_ (s.text! "lux def")
- definition-name s.local-identifier
- [?definition-type definition-value] check^
- definition-anns s.any
- definition-anns (s.local (list definition-anns)
- (_definition-anns^ []))
- #let [definition-args (find-definition-args definition-anns)]]
- (wrap {#//.definition-name definition-name
- #//.definition-type ?definition-type
- #//.definition-anns definition-anns
- #//.definition-value definition-value
- #//.definition-args definition-args}))))))
-
-(def: #export (typed-definition compiler)
- {#.doc "A reader for definitions that ensures the input syntax is typed."}
- (-> Lux (Parser //.Definition))
- (do p.monad
- [_definition (..definition compiler)
- _ (case (get@ #//.definition-type _definition)
- (#.Some _)
- (wrap [])
-
- #.None
- (p.fail "Typed definition must have a type!"))]
- (wrap _definition)))
-
(def: #export typed-input
{#.doc "Reader for the common typed-argument syntax used by many macros."}
(Parser //.Typed-Input)