From b48ea68a83d01903554c7696c77eedaaf1035680 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 12 Jun 2022 00:38:20 -0400 Subject: De-sigil-ification: suffix : [Part 3] --- stdlib/source/library/lux.lux | 66 +++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'stdlib/source/library/lux.lux') 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 [ ] +(with_template [ ] [(def:''' .private ( xy) (All (_ a b) (-> (Tuple a b) )) @@ -2809,7 +2809,7 @@ _ {#None})) -(template [ ] +(with_template [ ] [(def:' .private ( tokens) (-> (List Code) (Maybe (List ))) (case tokens @@ -2827,7 +2827,7 @@ [enhanced_parametersP Code anyP] ) -(template [ ] +(with_template [ ] [(def:' .private ( tokens) (Parser [Text (List )]) (case tokens @@ -2868,7 +2868,7 @@ _ [tokens (` .private)])) -(template [ ] +(with_template [ ] [(def:' .private ( tokens) (-> (List Code) (Maybe [(List Code) [Code Text (List )]])) (do maybe_monad @@ -2956,7 +2956,7 @@ {#Some y} {#Some y}))) -(template [
] +(with_template [ ] [(def: .public (macro (_ tokens) (case (list#reversed tokens) @@ -3090,7 +3090,7 @@ _ {#None})) -(template [ ] +(with_template [ ] [(def: ( type) (-> Type (List Type)) (case type @@ -4543,7 +4543,7 @@ _ (failure "Wrong syntax for pattern#template")))) -(template [ ] +(with_template [ ] [(def: .public (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 [ ] - [(template: .public ( it) - [(..|> it (..is (..I64 ..Any)) (..as ))])] +(with_template [ ] + [(def: .public + (template ( it) + [(..|> it (..is (..I64 ..Any)) (..as ))]))] [i64 ..I64] [nat ..Nat] -- cgit v1.2.3