diff options
author | Eduardo Julian | 2021-08-16 01:12:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-08-16 01:12:01 -0400 |
commit | 3289b9dcf9d5d1c1e5c380e3185065c8fd32535f (patch) | |
tree | fc2f67581dd7b1d72c20217a95e031187a375bc5 /stdlib/source/test/lux/documentation.lux | |
parent | 6fd22846f21b8b70b7867e989109d14a366c0a3e (diff) |
Made extension-definition macros specify their bindings the same way as syntax:.
Diffstat (limited to 'stdlib/source/test/lux/documentation.lux')
-rw-r--r-- | stdlib/source/test/lux/documentation.lux | 131 |
1 files changed, 73 insertions, 58 deletions
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux index b8a34a752..72417f5c5 100644 --- a/stdlib/source/test/lux/documentation.lux +++ b/stdlib/source/test/lux/documentation.lux @@ -2,13 +2,15 @@ [library [lux #* ["_" test (#+ Test)] + ["." meta] [control ["." try] ["." exception] [parser ["<.>" code]]] [data - ["." text ("#\." equivalence)] + ["." text ("#\." equivalence) + ["%" format]] [format ["md" markdown]]] ["." macro @@ -27,67 +29,80 @@ (#try.Success _) (#try.Failure "OOPS!")))) -(template.with_locals [g!default - g!description] - (as_is (def: g!default - Nat - 123) +(syntax: (description []) + (\ meta.monad map + (|>> %.nat code.text list) + meta.seed)) - (`` (/.documentation: /.documentation: - (~~ (template.text [g!description])))) +(template.with_locals [g!default] + (with_expansions ['definition_description' (..description) + 'sub_description' (..description) + 'super_description' (..description)] + (as_is (def: g!default + Nat + 123) - (def: .public test - Test - (<| (_.covering /._) - ($_ _.and - (_.for [/.Definition] - ($_ _.and - (_.cover [/.default] - (let [definition (`` (/.default (~~ (template.identifier [.._] [g!default]))))] - (and (|> definition + (/.documentation: /.documentation: + 'definition_description') + + (def: .public test + Test + (<| (_.covering /._) + ($_ _.and + (_.for [/.Definition] + ($_ _.and + (_.cover [/.default] + (let [definition (`` (/.default (~~ (template.identifier [.._] [g!default]))))] + (and (|> definition + (get@ #/.definition) + (text\= (template.text [g!default]))) + (|> definition + (get@ #/.documentation) + md.markdown + (text\= "") + not)))) + (_.cover [/.documentation:] + (and (|> ..documentation: (get@ #/.definition) - (text\= (template.text [g!default]))) - (|> definition + (text\= (template.text [/.documentation:]))) + (|> ..documentation: (get@ #/.documentation) md.markdown - (text\= "") - not)))) - (_.cover [/.documentation:] - (and (|> ..documentation: - (get@ #/.definition) - (text\= (template.text [/.documentation:]))) - (|> ..documentation: - (get@ #/.documentation) - md.markdown - (text.contains? (template.text [g!description])) - not))) - )) - (_.for [/.Module] - ($_ _.and - (_.cover [/.module /.documentation] - (let [sub (/.module /._ - [] - []) - super (/.module .._ - [..documentation:] - [sub])] - (and (text.contains? (/.documentation sub) - (/.documentation super)) - (text.contains? (md.markdown (get@ #/.documentation ..documentation:)) - (/.documentation super))))) - )) - (_.cover [/.unqualified_identifier] - (`` (and (~~ (template [<example>] - [(<| (text.contains? (get@ #exception.label /.unqualified_identifier)) - macro_error - <example>)] + (text.contains? 'definition_description')))) + )) + (_.for [/.Module] + ($_ _.and + (_.cover [/.module /.documentation] + (let [sub (`` (/.module /._ + (~~ (template.text ['sub_description'])) + [] + [])) + super (`` (/.module .._ + (~~ (template.text ['super_description'])) + [..documentation:] + [sub]))] + (and (text.contains? (template.text ['sub_description']) + (/.documentation sub)) + (text.contains? (/.documentation sub) + (/.documentation super)) + (text.contains? (template.text ['super_description']) + (/.documentation super)) + (text.contains? (md.markdown (get@ #/.documentation ..documentation:)) + (/.documentation super))))) + )) + (_.cover [/.unqualified_identifier] + (`` (and (~~ (template [<example>] + [(<| (text.contains? (get@ #exception.label /.unqualified_identifier)) + macro_error + <example>)] - [(/.default g!default)] - [(/.documentation: g!default - (~~ (template.text [g!description])))] - [(/.module g!default - [..documentation:] - [sub])] - ))))) - )))) + [(/.default g!default)] + [(/.documentation: g!default + (~~ (template.text ['definition_description'])))] + [(/.module g!default + "" + [..documentation:] + [sub])] + ))))) + ))))) ) |