diff options
author | Eduardo Julian | 2022-06-12 00:38:20 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-12 00:38:20 -0400 |
commit | b48ea68a83d01903554c7696c77eedaaf1035680 (patch) | |
tree | c342d8094c3158de16526f874ca9624418cd2dd2 /stdlib/source/library/lux.lux | |
parent | 7abf2d0ac55c229a8793bbff31f132596ffcb275 (diff) |
De-sigil-ification: suffix : [Part 3]
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r-- | stdlib/source/library/lux.lux | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux index 0b45af385..1a35551fa 100644 --- a/stdlib/source/library/lux.lux +++ b/stdlib/source/library/lux.lux @@ -1940,7 +1940,7 @@ (-> ($' List ($' List a)) ($' List a))) (list#mix list#composite {#End} (list#reversed xs))) -(def:'' .public template +(def:'' .public with_template Macro (macro (_ tokens) ({{#Item [[_ {#Tuple bindings}] {#Item [[_ {#Tuple templates}] data]}]} @@ -1954,15 +1954,15 @@ (list#each (function#composite apply (replacement_environment bindings'))) list#conjoint meta#in) - (failure "Irregular arguments tuples for template."))) + (failure (..wrong_syntax_error [..prelude_module "with_template"])))) _ - (failure "Wrong syntax for template")} + (failure (..wrong_syntax_error [..prelude_module "with_template"]))} [(monad#each maybe_monad symbol_short bindings) (monad#each maybe_monad tuple_list data)]) _ - (failure "Wrong syntax for template")} + (failure (..wrong_syntax_error [..prelude_module "with_template"]))} tokens))) (def:''' .private (n// param subject) @@ -2415,7 +2415,7 @@ _ #0} xs)) -(template [<name> <type> <value>] +(with_template [<name> <type> <value>] [(def:''' .private (<name> xy) (All (_ a b) (-> (Tuple a b) <type>)) @@ -2809,7 +2809,7 @@ _ {#None})) -(template [<parser> <item_type> <item_parser>] +(with_template [<parser> <item_type> <item_parser>] [(def:' .private (<parser> tokens) (-> (List Code) (Maybe (List <item_type>))) (case tokens @@ -2827,7 +2827,7 @@ [enhanced_parametersP Code anyP] ) -(template [<parser> <parameter_type> <parameters_parser>] +(with_template [<parser> <parameter_type> <parameters_parser>] [(def:' .private (<parser> tokens) (Parser [Text (List <parameter_type>)]) (case tokens @@ -2868,7 +2868,7 @@ _ [tokens (` .private)])) -(template [<parser> <parameter_type> <local>] +(with_template [<parser> <parameter_type> <local>] [(def:' .private (<parser> tokens) (-> (List Code) (Maybe [(List Code) [Code Text (List <parameter_type>)]])) (do maybe_monad @@ -2956,7 +2956,7 @@ {#Some y} {#Some y}))) -(template [<name> <form> <message>] +(with_template [<name> <form> <message>] [(def: .public <name> (macro (_ tokens) (case (list#reversed tokens) @@ -3090,7 +3090,7 @@ _ {#None})) -(template [<name> <tag>] +(with_template [<name> <tag>] [(def: (<name> type) (-> Type (List Type)) (case type @@ -4543,7 +4543,7 @@ _ (failure "Wrong syntax for pattern#template")))) -(template [<name> <extension>] +(with_template [<name> <extension>] [(def: .public <name> (All (_ s) (-> (I64 s) (I64 s))) @@ -4897,19 +4897,19 @@ (failure (..wrong_syntax_error (symbol ..type_of)))))) (def: (templateP tokens) - (-> (List Code) (Maybe [Code Text (List Text) (List Code)])) + (-> (List Code) (Maybe [Text (List Text) (List Code)])) (do maybe_monad - [% (declarationP tokens) - .let' [[tokens [export_policy name parameters]] %] + [% (local_declarationP tokens) + .let' [[tokens [name parameters]] %] % (tupleP (someP anyP) tokens) .let' [[tokens templates] %] _ (endP tokens)] - (in [export_policy name parameters templates]))) + (in [name parameters templates]))) -(def: .public template: +(def: .public template (macro (_ tokens) (case (templateP tokens) - {#Some [export_policy name args input_templates]} + {#Some [name args input_templates]} (do meta_monad [g!tokens (..generated_symbol "tokens") g!compiler (..generated_symbol "compiler") @@ -4918,25 +4918,25 @@ [arg (` ((~' ~) (~ (local$ arg))))]) args)] this_module current_module_name] - (in (list (` (..def: (~ export_policy) (~ (local$ name)) - (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler)) - (case (~ g!tokens) - (pattern (list (~+ (list#each local$ args)))) - {.#Right [(~ g!compiler) - (list (~+ (list#each (function (_ template) - (` (`' (~ (with_replacements rep_env - template))))) - input_templates)))]} - - (~ g!_) - {.#Left (~ (text$ (..wrong_syntax_error [this_module name])))}))))))) + (in (list (` (..macro ((~ (local$ name)) (~ g!tokens) (~ g!compiler)) + (case (~ g!tokens) + (pattern (list (~+ (list#each local$ args)))) + {.#Right [(~ g!compiler) + (list (~+ (list#each (function (_ template) + (` (`' (~ (with_replacements rep_env + template))))) + input_templates)))]} + + (~ g!_) + {.#Left "Invalid syntax."})))))) {#None} - (failure (..wrong_syntax_error (symbol ..template:)))))) + (failure (..wrong_syntax_error (symbol ..template)))))) -(template [<name> <to>] - [(template: .public (<name> it) - [(..|> it (..is (..I64 ..Any)) (..as <to>))])] +(with_template [<name> <to>] + [(def: .public <name> + (template (<name> it) + [(..|> it (..is (..I64 ..Any)) (..as <to>))]))] [i64 ..I64] [nat ..Nat] |