diff options
author | Eduardo Julian | 2017-12-02 12:49:25 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-12-02 12:49:25 -0400 |
commit | 1651d847ba70ee36171f3809a25bece325fd5715 (patch) | |
tree | 9cf19984d86d9adb336859b396ba3199c8d28890 /stdlib/source/lux/macro/syntax | |
parent | 46955edbe6cea9f367562b9fb17cef526109d9e0 (diff) |
- Added context-sensitive macro-expansion by means of "lux in-module", and removed all the (now unnecessary) #hidden tags.
- Fixed a bug when loading the imports from the cache.
- Added special notation for context-sensitive macro-expansion.
Diffstat (limited to 'stdlib/source/lux/macro/syntax')
-rw-r--r-- | stdlib/source/lux/macro/syntax/common.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/macro/syntax/common/reader.lux | 16 | ||||
-rw-r--r-- | stdlib/source/lux/macro/syntax/common/writer.lux | 18 |
3 files changed, 12 insertions, 26 deletions
diff --git a/stdlib/source/lux/macro/syntax/common.lux b/stdlib/source/lux/macro/syntax/common.lux index 8c684537e..9de36fe5d 100644 --- a/stdlib/source/lux/macro/syntax/common.lux +++ b/stdlib/source/lux/macro/syntax/common.lux @@ -3,10 +3,6 @@ The goal is to be able to reuse common syntax in macro definitions across libraries."} lux) -(type: #export Export - #Exported - #Hidden) - (type: #export Declaration {#declaration-name Text #declaration-args (List Text)}) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index ac6d876c3..0e8b5df9a 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Commons syntax readers."} lux (lux (control monad - ["p" parser]) + ["p" parser "p/" Monad<Parser>]) (data (coll [list]) [ident "ident/" Eq<Ident>] [product] @@ -12,13 +12,9 @@ ## Exports (def: #export export - {#.doc (doc "A reader for export levels." - "Such as:" - #export - #hidden)} - (Syntax (Maybe Export)) - (p.maybe (p.alt (s.this (' #export)) - (s.this (' #hidden))))) + (Syntax Bool) + (p.either (p.after (s.this (' #export)) (p/wrap true)) + (p/wrap false))) ## Declarations (def: #export declaration @@ -28,7 +24,7 @@ (foo bar baz))} (Syntax Declaration) (p.either (p.seq s.local-symbol - (:: p.Monad<Parser> wrap (list))) + (p/wrap (list))) (s.form (p.seq s.local-symbol (p.many s.local-symbol))))) @@ -46,7 +42,7 @@ type s.any value s.any] (wrap [(#.Some type) value]))) - (p.seq (:: p.Monad<Parser> wrap #.None) + (p.seq (p/wrap #.None) s.any))) (def: _definition-anns-tag^ diff --git a/stdlib/source/lux/macro/syntax/common/writer.lux b/stdlib/source/lux/macro/syntax/common/writer.lux index d5ad8cb61..5b5ab9ab5 100644 --- a/stdlib/source/lux/macro/syntax/common/writer.lux +++ b/stdlib/source/lux/macro/syntax/common/writer.lux @@ -1,24 +1,18 @@ (.module: {#.doc "Commons syntax writers."} lux - (lux (data (coll [list "L/" Functor<List>]) + (lux (data (coll [list "list/" Functor<List>]) [product]) (macro [code])) [// #*]) ## Exports -(def: #export (export ?el) - (-> (Maybe Export) (List Code)) - (case ?el - #.None - (list) - - (#.Some #//.Exported) +(def: #export (export exported?) + (-> Bool (List Code)) + (if exported? (list (' #export)) - - (#.Some #//.Hidden) - (list (' #hidden)))) + (list))) ## Annotations (def: #export (annotations anns) (-> Annotations Code) - (|> anns (L/map (product.both code.tag id)) code.record)) + (|> anns (list/map (product.both code.tag id)) code.record)) |