diff options
author | Eduardo Julian | 2021-09-08 17:52:13 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-09-08 17:52:13 -0400 |
commit | 9ae7272d50b64dc9c8651e7a684abc007d4f2caf (patch) | |
tree | 3313492704935d230a88d17b621e84bd09a6451c /stdlib | |
parent | 18e4294819f5d4adafad091bdc5a30c25959ad2f (diff) |
Post annotations clean-up.
Diffstat (limited to 'stdlib')
14 files changed, 28 insertions, 210 deletions
diff --git a/stdlib/source/documentation/lux/macro/syntax.lux b/stdlib/source/documentation/lux/macro/syntax.lux index 3926086b6..8efdf8a93 100644 --- a/stdlib/source/documentation/lux/macro/syntax.lux +++ b/stdlib/source/documentation/lux/macro/syntax.lux @@ -8,7 +8,6 @@ [collection ["[0]" list]]]]] ["[0]" / "_" - ["[1][0]" annotations] ["[1][0]" check] ["[1][0]" declaration] ["[1][0]" definition] @@ -42,8 +41,7 @@ ($.module /._ "" [..syntax:] - [/annotations.documentation - /check.documentation + [/check.documentation /declaration.documentation /definition.documentation /export.documentation diff --git a/stdlib/source/documentation/lux/macro/syntax/annotations.lux b/stdlib/source/documentation/lux/macro/syntax/annotations.lux deleted file mode 100644 index 62d2abdc2..000000000 --- a/stdlib/source/documentation/lux/macro/syntax/annotations.lux +++ /dev/null @@ -1,25 +0,0 @@ -(.module: - [library - [lux {"-" [char]} - ["$" documentation {"+" [documentation:]}] - [data - [text - ["%" format {"+" [format]}]] - [collection - ["[0]" list]]]]] - [\\library - ["[0]" /]]) - -(documentation: /.Annotations - "Definition/module annotations.") - -(.def: .public documentation - (.List $.Module) - ($.module /._ - "" - [..Annotations - ($.default /.equivalence) - ($.default /.empty) - ($.default /.format) - ($.default /.parser)] - [])) diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 4b1204bc7..93e5c00cc 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -796,11 +796,6 @@ export_policy) #End)) - (#Item export_policy (#Item [_ (#Form (#Item name args))] (#Item body #End))) - (in_meta (#Item (as_def name (as_macro (as_function name args body)) - export_policy) - #End)) - _ (failure "Wrong syntax for macro:'")} tokens))) diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 5d7ff9ebb..4bdab69c1 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -21,8 +21,7 @@ ["[0]" code] [syntax {"+" [syntax:]} ["|[0]|" export] - ["|[0]|" declaration] - ["|[0]|" annotations]]]]]) + ["|[0]|" declaration]]]]]) (abstract: .public (Capability brand input output) (-> input output) @@ -40,11 +39,10 @@ output)) ((:representation capability) input)) - (syntax: .public (capability: [[export_policy declaration annotations [forger input output]] + (syntax: .public (capability: [[export_policy declaration [forger input output]] (|export|.parser ($_ <>.and |declaration|.parser - (<>.maybe |annotations|.parser) (<c>.form ($_ <>.and <c>.local_identifier <c>.any <c>.any))))]) (macro.with_identifiers [g!_] (do [! meta.monad] diff --git a/stdlib/source/library/lux/macro/syntax/annotations.lux b/stdlib/source/library/lux/macro/syntax/annotations.lux deleted file mode 100644 index 6366f725f..000000000 --- a/stdlib/source/library/lux/macro/syntax/annotations.lux +++ /dev/null @@ -1,42 +0,0 @@ -(.module: - [library - [lux "*" - [abstract - [equivalence {"+" [Equivalence]}]] - [control - ["[0]" function] - ["<>" parser - ["<[0]>" code {"+" [Parser]}]]] - [data - ["[0]" product] - ["[0]" name] - [collection - ["[0]" list ("[1]\[0]" functor)]]] - [macro - ["[0]" code]]]]) - -(type: .public Annotations - (List [Name Code])) - -(def: .public equivalence - (Equivalence Annotations) - (list.equivalence - (product.equivalence name.equivalence - code.equivalence))) - -(def: .public empty - Annotations - (list)) - -(def: .public format - (-> Annotations Code) - (let [entry (product.then code.tag function.identity)] - (|>> (list\each entry) - code.record))) - -(def: .public parser - (Parser Annotations) - (<code>.record - (<>.some - (<>.and <code>.tag - <code>.any)))) diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux index ac65e7357..3f92e3118 100644 --- a/stdlib/source/library/lux/macro/syntax/definition.lux +++ b/stdlib/source/library/lux/macro/syntax/definition.lux @@ -22,7 +22,6 @@ ["[0]" meta ["[0]" location]]]] ["[0]" // - ["[1][0]" annotations {"+" [Annotations]}] ["[1][0]" check {"+" [Check]}]]) (type: .public Definition @@ -30,7 +29,6 @@ [#name Text #value (Either Check Code) - #anns Annotations #export? Bit])) (def: .public equivalence @@ -41,36 +39,19 @@ //check.equivalence code.equivalence ) - //annotations.equivalence bit.equivalence )) (def: extension "lux def") -(def: (tag_format [module short]) - (-> Name Code) - (` [(~ (code.text module)) - (~ (code.text short))])) - -(def: (annotations_format value) - (-> Annotations Code) - (case value - #.End - (` #.End) - - (#.Item [name value] tail) - (` (#.Item [(~ (..tag_format name)) - (~ value)] - (~ (annotations_format tail)))))) - (def: dummy Code (` [#.module (~ (code.text (value@ #.module location.dummy))) #.line (~ (code.nat (value@ #.line location.dummy))) #.column (~ (code.nat (value@ #.column location.dummy)))])) -(def: .public (format (^slots [#name #value #anns #export?])) +(def: .public (format (^slots [#name #value #export?])) (-> Definition Code) (` ((~ (code.text ..extension)) (~ (code.local_identifier name)) @@ -80,26 +61,8 @@ (#.Right value) value)) - [(~ ..dummy) (#.Record (~ (..annotations_format anns)))] (~ (code.bit export?))))) -(def: tag_parser - (Parser Name) - (<code>.tuple (<>.and <code>.text <code>.text))) - -(def: annotations_parser - (Parser Annotations) - (<>.rec - (function (_ recur) - ($_ <>.or - (<code>.tag! (name_of #.End)) - (<code>.form (do <>.monad - [_ (<code>.tag! (name_of #.Item)) - [head tail] (<>.and (<code>.tuple (<>.and tag_parser <code>.any)) - recur)] - (in [head tail]))) - )))) - (def: .public (parser compiler) (-> Lux (Parser Definition)) (do [! <>.monad] @@ -115,11 +78,6 @@ <code>.local_identifier (<>.or //check.parser <code>.any) - (<| <code>.tuple - (<>.after <code>.any) - <code>.form - (<>.after (<code>.this! (` #.Record))) - ..annotations_parser) <code>.bit )))) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux.lux index 37ccff163..251a543a3 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux.lux @@ -23,7 +23,7 @@ (def: .public writer (Writer .Module) (let [definition (: (Writer Definition) - ($_ _.and _.bit _.type _.code _.any)) + ($_ _.and _.bit _.type _.any)) labels (: (Writer [Text (List Text)]) (_.and _.text (_.list _.text))) global_type (: (Writer [Bit Type (Either [Text (List Text)] @@ -57,7 +57,7 @@ (def: .public parser (Parser .Module) (let [definition (: (Parser Definition) - ($_ <>.and <b>.bit <b>.type <b>.code <b>.any)) + ($_ <>.and <b>.bit <b>.type <b>.any)) labels (: (Parser [Text (List Text)]) (<>.and <b>.text (<b>.list <b>.text))) global_type (: (Parser [Bit Type (Either [Text (List Text)] diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux index b38712c22..33b1c7e32 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/reference.lux @@ -42,7 +42,7 @@ (#.Alias real_def_name) (definition real_def_name) - (#.Definition [exported? actualT def_anns _]) + (#.Definition [exported? actualT _]) (do ! [_ (//type.infer actualT) (^@ def_name [::module ::name]) (///extension.lifted (meta.normal def_name)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux index bf517b526..a8e9ae29f 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/lux.lux @@ -214,7 +214,7 @@ (do ! [input_type (///.lifted (meta.definition (name_of .Macro')))] (case input_type - (^or (#.Definition [exported? def_type def_data def_value]) + (^or (#.Definition [exported? def_type def_value]) (#.Type [exported? def_value labels])) (in (:as Type def_value)) diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux index c9a050c6d..1da688392 100644 --- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux +++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/lux.lux @@ -219,16 +219,15 @@ (-> Expander /////analysis.Bundle Handler) (function (_ extension_name phase archive inputsC+) (case inputsC+ - (^ (list [_ (#.Identifier ["" short_name])] valueC annotationsC exported?C)) + (^ (list [_ (#.Identifier ["" short_name])] valueC exported?C)) (do phase.monad [current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [type valueT value] (..definition archive full_name #.None valueC) [_ _ exported?] (evaluate! archive Bit exported?C) - [_ _ annotations] (evaluate! archive Code annotationsC) _ (/////directive.lifted_analysis - (module.define short_name (#.Definition [(:as Bit exported?) type (:as Code annotations) value]))) + (module.define short_name (#.Definition [(:as Bit exported?) type value]))) _ (..refresh expander host_analysis) _ (..announce_definition! short_name type)] (in /////directive.no_requirements)) @@ -248,19 +247,17 @@ (def: (def::type_tagged expander host_analysis) (-> Expander /////analysis.Bundle Handler) (..custom - [($_ <>.and <code>.local_identifier <code>.any <code>.any + [($_ <>.and <code>.local_identifier <code>.any (<>.or (<code>.form (<>.some <code>.text)) (<code>.tuple (<>.some <code>.text))) <code>.any) - (function (_ extension_name phase archive [short_name valueC annotationsC labels exported?C]) + (function (_ extension_name phase archive [short_name valueC labels exported?C]) (do phase.monad [current_module (/////directive.lifted_analysis (///.lifted meta.current_module_name)) .let [full_name [current_module short_name]] [_ _ exported?] (evaluate! archive Bit exported?C) - [_ _ annotations] (evaluate! archive Code annotationsC) - .let [exported? (:as Bit exported?) - annotations (:as Code annotations)] + .let [exported? (:as Bit exported?)] [type valueT value] (..definition archive full_name (#.Some .Type) valueC) labels (/////directive.lifted_analysis (do phase.monad @@ -272,7 +269,7 @@ [true slots])] _ (case labels #.End - (module.define short_name (#.Definition [exported? type annotations value])) + (module.define short_name (#.Definition [exported? type value])) (#.Item labels) (module.define short_name (#.Type [exported? (:as .Type value) (if record? @@ -294,21 +291,17 @@ (def: def::module Handler (..custom - [($_ <>.and <code>.any ..imports) - (function (_ extension_name phase archive [annotationsC imports]) + [..imports + (function (_ extension_name phase archive imports) (do [! phase.monad] - [[_ _ annotationsV] (evaluate! archive Code annotationsC) - .let [annotationsV (:as Code annotationsV)] - _ (/////directive.lifted_analysis - (do ! - [_ (monad.each ! (function (_ [module alias]) - (do ! - [_ (module.import module)] - (case alias - "" (in []) - _ (module.alias alias module)))) - imports)] - (module.set_annotations annotationsV)))] + [_ (/////directive.lifted_analysis + (monad.each ! (function (_ [module alias]) + (do ! + [_ (module.import module)] + (case alias + "" (in []) + _ (module.alias alias module)))) + imports))] (in [#/////directive.imports imports #/////directive.referrals (list)])))])) diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux index cdd999306..d6a427d0b 100644 --- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux +++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux @@ -330,11 +330,11 @@ [#.Label] [#.Slot]) - (#.Definition [exported? type annotations _]) + (#.Definition [exported? type _]) (|> definitions (dictionary.value def_name) try.of_maybe - (\ ! each (|>> [exported? type annotations] + (\ ! each (|>> [exported? type] #.Definition [def_name]))) diff --git a/stdlib/source/test/lux/macro/syntax.lux b/stdlib/source/test/lux/macro/syntax.lux index 236a6106f..5ba0701b9 100644 --- a/stdlib/source/test/lux/macro/syntax.lux +++ b/stdlib/source/test/lux/macro/syntax.lux @@ -14,7 +14,6 @@ [\\library ["[0]" /]] ["[0]" / "_" - ["[1][0]" annotations] ["[1][0]" check] ["[1][0]" declaration] ["[1][0]" definition] @@ -40,7 +39,6 @@ (n.= ($_ n.+ x y z) (+/3 x y z)))) - /annotations.test /check.test /declaration.test /definition.test diff --git a/stdlib/source/test/lux/macro/syntax/annotations.lux b/stdlib/source/test/lux/macro/syntax/annotations.lux deleted file mode 100644 index 0fe02da13..000000000 --- a/stdlib/source/test/lux/macro/syntax/annotations.lux +++ /dev/null @@ -1,53 +0,0 @@ -(.module: - [library - [lux "*" - ["_" test {"+" [Test]}] - [abstract - [monad {"+" [do]}] - [\\specification - ["$[0]" equivalence]]] - [control - ["[0]" try] - [parser - ["<[0]>" code]]] - [data - [collection - ["[0]" list]]] - [math - ["[0]" random {"+" [Random]}] - [number - ["n" nat]]]]] - [\\library - ["[0]" /]] - ["$[0]" /// "_" - ["[1][0]" code]]) - -(def: .public random - (Random /.Annotations) - (let [word (random.ascii/alpha 10) - tag (random.and word word)] - (do [! random.monad] - [size (\ ! each (n.% 10) random.nat)] - (random.list size (random.and tag $///code.random))))) - -(def: .public test - Test - (<| (_.covering /._) - (_.for [/.Annotations]) - ($_ _.and - (_.for [/.equivalence] - ($equivalence.spec /.equivalence ..random)) - - (_.cover [/.empty] - (list.empty? /.empty)) - (do random.monad - [expected ..random] - (_.cover [/.format /.parser] - (case (|> (list (/.format expected)) - (<code>.result /.parser)) - (#try.Failure _) - false - - (#try.Success actual) - (\ /.equivalence = expected actual)))) - ))) diff --git a/stdlib/source/test/lux/macro/syntax/definition.lux b/stdlib/source/test/lux/macro/syntax/definition.lux index d3a480dc2..cb5867a2a 100644 --- a/stdlib/source/test/lux/macro/syntax/definition.lux +++ b/stdlib/source/test/lux/macro/syntax/definition.lux @@ -11,17 +11,16 @@ ["[0]" exception] ["<>" parser ["<[0]>" code]]] - [math - ["[0]" random {"+" [Random]}]] [macro ["[0]" code ("[1]\[0]" equivalence)]] + [math + ["[0]" random {"+" [Random]}]] [meta ["[0]" location]]]] [\\library ["[0]" /]] ["$[0]"// "_" ["[1][0]" check] - ["[1][0]" annotations] ["[1]/" // "_" ["[1][0]" code]]]) @@ -31,7 +30,6 @@ (random.ascii/alpha 5) (random.or $//check.random $///code.random) - $//annotations.random random.bit )) |