diff options
Diffstat (limited to 'stdlib/source/lux/macro/syntax/common/reader.lux')
-rw-r--r-- | stdlib/source/lux/macro/syntax/common/reader.lux | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 7f66a3879..069bf1cf0 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -3,7 +3,8 @@ [abstract monad] [control - ["p" parser ("#@." monad)]] + ["p" parser ("#@." monad) + ["s" code (#+ Parser)]]] [data ["." name ("#@." equivalence)] ["." product] @@ -12,35 +13,31 @@ ["." list]]]] ["." // ["#//" /// - ["s" syntax (#+ syntax: Syntax)]]]) + [syntax (#+ syntax:)]]]) -## Exports (def: #export export - (Syntax Bit) + (Parser Bit) (p.either (p.after (s.this (' #export)) (p@wrap #1)) (p@wrap #0))) -## Declarations (def: #export declaration {#.doc (doc "A reader for declaration syntax." "Such as:" quux (foo bar baz))} - (Syntax //.Declaration) + (Parser //.Declaration) (p.either (p.and s.local-identifier (p@wrap (list))) (s.form (p.and s.local-identifier (p.some s.local-identifier))))) -## Annotations (def: #export annotations {#.doc "Reader for the common annotations syntax used by def: statements."} - (Syntax //.Annotations) + (Parser //.Annotations) (s.record (p.some (p.and s.tag s.any)))) -## Definitions (def: check^ - (Syntax [(Maybe Code) Code]) + (Parser [(Maybe Code) Code]) (p.either (s.form (do p.monad [_ (s.this (' "lux check")) type s.any @@ -50,11 +47,11 @@ s.any))) (def: _definition-anns-tag^ - (Syntax Name) + (Parser Name) (s.tuple (p.and s.text s.text))) (def: (_definition-anns^ _) - (-> Any (Syntax //.Annotations)) + (-> Any (Parser //.Annotations)) (p.or (s.this (' #.Nil)) (s.form (do p.monad [_ (s.this (' #.Cons)) @@ -64,7 +61,7 @@ )) (def: (flat-list^ _) - (-> Any (Syntax (List Code))) + (-> Any (Parser (List Code))) (p.either (do p.monad [_ (s.this (' #.Nil))] (wrap (list))) @@ -76,7 +73,7 @@ (template [<name> <type> <tag> <then>] [(def: <name> - (Syntax <type>) + (Parser <type>) (<| s.tuple (p.after s.any) s.form @@ -105,7 +102,7 @@ (def: #export (definition compiler) {#.doc "A reader that first macro-expands and then analyses the input Code, to ensure it's a definition."} - (-> Lux (Syntax //.Definition)) + (-> Lux (Parser //.Definition)) (do p.monad [definition-raw s.any me-definition-raw (|> definition-raw @@ -129,7 +126,7 @@ (def: #export (typed-definition compiler) {#.doc "A reader for definitions that ensures the input syntax is typed."} - (-> Lux (Syntax //.Definition)) + (-> Lux (Parser //.Definition)) (do p.monad [_definition (definition compiler) _ (case (get@ #//.definition-type _definition) @@ -142,10 +139,10 @@ (def: #export typed-input {#.doc "Reader for the common typed-argument syntax used by many macros."} - (Syntax //.Typed-Input) + (Parser //.Typed-Input) (s.record (p.and s.any s.any))) (def: #export type-variables {#.doc "Reader for the common type var/param used by many macros."} - (Syntax (List Text)) + (Parser (List Text)) (s.tuple (p.some s.local-identifier))) |