aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Julian2022-07-08 19:15:02 -0400
committerEduardo Julian2022-07-08 19:15:02 -0400
commitfc2737b5226eda69c12bc593e83e22ed54e4d3af (patch)
treecc3c8bfd5b96a235ebc37f3b3a17d37533f8ded2
parent6a052144968df9b441df53f6aa08cbb515ff2654 (diff)
Extracted macro-expansion machinery into its own module.
-rw-r--r--stdlib/source/library/lux/meta/macro.lux133
-rw-r--r--stdlib/source/library/lux/meta/macro/expansion.lux140
-rw-r--r--stdlib/source/library/lux/meta/macro/syntax/definition.lux5
-rw-r--r--stdlib/source/library/lux/meta/type.lux5
-rw-r--r--stdlib/source/test/lux/control/remember.lux13
-rw-r--r--stdlib/source/test/lux/data/text/regex.lux5
-rw-r--r--stdlib/source/test/lux/debug.lux7
-rw-r--r--stdlib/source/test/lux/documentation.lux7
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux9
-rw-r--r--stdlib/source/test/lux/meta/configuration.lux7
-rw-r--r--stdlib/source/test/lux/meta/macro.lux72
-rw-r--r--stdlib/source/test/lux/meta/macro/local.lux7
-rw-r--r--stdlib/source/test/lux/meta/macro/template.lux7
-rw-r--r--stdlib/source/test/lux/meta/type/resource.lux7
-rw-r--r--stdlib/source/test/lux/meta/version.lux7
15 files changed, 231 insertions, 200 deletions
diff --git a/stdlib/source/library/lux/meta/macro.lux b/stdlib/source/library/lux/meta/macro.lux
index 464329a25..c8c3a26fb 100644
--- a/stdlib/source/library/lux/meta/macro.lux
+++ b/stdlib/source/library/lux/meta/macro.lux
@@ -6,89 +6,16 @@
[data
["[0]" text (.use "[1]#[0]" monoid)]
[collection
- ["[0]" list (.use "[1]#[0]" monoid monad)]]]
+ ["[0]" list (.use "[1]#[0]" monad)]]]
[math
[number
- ["[0]" nat]
- ["[0]" int]]]]]
+ ["[0]" nat]]]]]
+ ["[0]" /
+ ["[1][0]" expansion]]
["[0]" // (.only)
["[0]" code]
- ["[0]" location]
["[0]" symbol (.use "[1]#[0]" codec)]])
-(def .public (single_expansion syntax)
- (-> Code (Meta (List Code)))
- (case syntax
- [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
- (do //.monad
- [?macro (//.macro name)]
- (case ?macro
- {.#Some macro}
- ((as Macro' macro) args)
-
- {.#None}
- (at //.monad in (list syntax))))
-
- _
- (at //.monad in (list syntax))))
-
-(def .public (expansion syntax)
- (-> Code (Meta (List Code)))
- (case syntax
- [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
- (do //.monad
- [?macro (//.macro name)]
- (case ?macro
- {.#Some macro}
- (do [! //.monad]
- [top_level_expansion ((as Macro' macro) args)]
- (|> top_level_expansion
- (monad.each //.monad expansion)
- (at ! each list#conjoint)))
-
- {.#None}
- (at //.monad in (list syntax))))
-
- _
- (at //.monad in (list syntax))))
-
-(def .public (full_expansion syntax)
- (-> Code (Meta (List Code)))
- (case syntax
- [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
- (do //.monad
- [?macro (//.macro name)]
- (case ?macro
- {.#Some macro}
- (do //.monad
- [expansion ((as Macro' macro) args)
- expansion' (monad.each //.monad full_expansion expansion)]
- (in (list#conjoint expansion')))
-
- {.#None}
- (do //.monad
- [parts' (monad.each //.monad full_expansion (list.partial (code.symbol name) args))]
- (in (list (code.form (list#conjoint parts')))))))
-
- [_ {.#Form {.#Item [harg targs]}}]
- (do //.monad
- [harg+ (full_expansion harg)
- targs+ (monad.each //.monad full_expansion targs)]
- (in (list (code.form (list#composite harg+ (list#conjoint (is (List (List Code)) targs+)))))))
-
- [_ {.#Variant members}]
- (do //.monad
- [members' (monad.each //.monad full_expansion members)]
- (in (list (code.variant (list#conjoint members')))))
-
- [_ {.#Tuple members}]
- (do //.monad
- [members' (monad.each //.monad full_expansion members)]
- (in (list (code.tuple (list#conjoint members')))))
-
- _
- (at //.monad in (list syntax))))
-
(def .public (symbol prefix)
(-> Text (Meta Code))
(do //.monad
@@ -129,54 +56,6 @@
_
(//.failure (..wrong_syntax_error (.symbol ..with_symbols))))))
-(def .public (one_expansion token)
- (-> Code (Meta Code))
- (do //.monad
- [token+ (..expansion token)]
- (case token+
- (list token')
- (in token')
-
- _
- (//.failure "Macro expanded to more than 1 element."))))
-
-(with_template [<macro> <func>]
- [(def .public <macro>
- (.macro (_ tokens)
- (let [[module _] (.symbol .._)
- [_ short] (.symbol <macro>)
- macro_name [module short]]
- (case (is (Maybe [Bit Code])
- (case tokens
- (list [_ {.#Text "omit"}]
- token)
- {.#Some [#1 token]}
-
- (list token)
- {.#Some [#0 token]}
-
- _
- {.#None}))
- {.#Some [omit? token]}
- (do //.monad
- [location //.location
- output (<func> token)
- .let [_ ("lux io log" (all text#composite (symbol#encoded macro_name) " " (location.format location)))
- _ (list#each (|>> code.format "lux io log")
- output)
- _ ("lux io log" "")]]
- (in (if omit?
- (list)
- output)))
-
- {.#None}
- (//.failure (..wrong_syntax_error macro_name))))))]
-
- [log_single_expansion! ..single_expansion]
- [log_expansion! ..expansion]
- [log_full_expansion! ..full_expansion]
- )
-
(def .public times
(.macro (_ tokens)
(case tokens
@@ -190,7 +69,7 @@
_
(do [! //.monad]
[after (|> before
- (monad.each ! ..single_expansion)
+ (monad.each ! /expansion.single)
(at ! each list#conjoint))]
(again (-- times) after))))
@@ -201,7 +80,7 @@
(.macro (_ it)
(let [! //.monad]
(|> it
- (monad.each ! ..expansion)
+ (monad.each ! /expansion.complete)
(at ! each list#conjoint)))))
(def .public function
diff --git a/stdlib/source/library/lux/meta/macro/expansion.lux b/stdlib/source/library/lux/meta/macro/expansion.lux
new file mode 100644
index 000000000..781eb141b
--- /dev/null
+++ b/stdlib/source/library/lux/meta/macro/expansion.lux
@@ -0,0 +1,140 @@
+(.require
+ [library
+ [lux (.except local symbol function macro)
+ [abstract
+ ["[0]" monad (.only do)]]
+ [data
+ ["[0]" text (.use "[1]#[0]" monoid)]
+ [collection
+ ["[0]" list (.use "[1]#[0]" monoid monad)]]]]]
+ ["[0]" /// (.only)
+ ["[0]" code]
+ ["[0]" location]
+ ["[0]" symbol (.use "[1]#[0]" codec)]])
+
+(def wrong_syntax_error
+ (-> Symbol Text)
+ (|>> symbol#encoded
+ (text.prefix (text#composite "Wrong syntax for " text.\''))
+ (text.suffix (text#composite text.\'' "."))))
+
+(def .public (single syntax)
+ (-> Code (Meta (List Code)))
+ (case syntax
+ [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
+ (do ///.monad
+ [?macro (///.macro name)]
+ (case ?macro
+ {.#Some macro}
+ ((as Macro' macro) args)
+
+ {.#None}
+ (at ///.monad in (list syntax))))
+
+ _
+ (at ///.monad in (list syntax))))
+
+(def .public (complete syntax)
+ (-> Code (Meta (List Code)))
+ (case syntax
+ [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
+ (do ///.monad
+ [?macro (///.macro name)]
+ (case ?macro
+ {.#Some macro}
+ (do [! ///.monad]
+ [top_level_complete ((as Macro' macro) args)]
+ (|> top_level_complete
+ (monad.each ///.monad complete)
+ (at ! each list#conjoint)))
+
+ {.#None}
+ (at ///.monad in (list syntax))))
+
+ _
+ (at ///.monad in (list syntax))))
+
+(def .public (total syntax)
+ (-> Code (Meta (List Code)))
+ (case syntax
+ [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
+ (do ///.monad
+ [?macro (///.macro name)]
+ (case ?macro
+ {.#Some macro}
+ (do ///.monad
+ [complete ((as Macro' macro) args)
+ complete' (monad.each ///.monad total complete)]
+ (in (list#conjoint complete')))
+
+ {.#None}
+ (do ///.monad
+ [parts' (monad.each ///.monad total (list.partial (code.symbol name) args))]
+ (in (list (code.form (list#conjoint parts')))))))
+
+ [_ {.#Form {.#Item [harg targs]}}]
+ (do ///.monad
+ [harg+ (total harg)
+ targs+ (monad.each ///.monad total targs)]
+ (in (list (code.form (list#composite harg+ (list#conjoint (is (List (List Code)) targs+)))))))
+
+ [_ {.#Variant members}]
+ (do ///.monad
+ [members' (monad.each ///.monad total members)]
+ (in (list (code.variant (list#conjoint members')))))
+
+ [_ {.#Tuple members}]
+ (do ///.monad
+ [members' (monad.each ///.monad total members)]
+ (in (list (code.tuple (list#conjoint members')))))
+
+ _
+ (at ///.monad in (list syntax))))
+
+(def .public (one token)
+ (-> Code (Meta Code))
+ (do ///.monad
+ [token+ (..complete token)]
+ (case token+
+ (list token')
+ (in token')
+
+ _
+ (///.failure "Macro expanded to more than 1 element."))))
+
+(with_template [<macro> <func>]
+ [(def .public <macro>
+ (.macro (_ tokens)
+ (let [[module _] (.symbol .._)
+ [_ short] (.symbol <macro>)
+ macro_name [module short]]
+ (case (is (Maybe [Bit Code])
+ (case tokens
+ (list [_ {.#Text "omit"}]
+ token)
+ {.#Some [#1 token]}
+
+ (list token)
+ {.#Some [#0 token]}
+
+ _
+ {.#None}))
+ {.#Some [omit? token]}
+ (do ///.monad
+ [location ///.location
+ output (<func> token)
+ .let [_ ("lux io log" (all text#composite (symbol#encoded macro_name) " " (location.format location)))
+ _ (list#each (|>> code.format "lux io log")
+ output)
+ _ ("lux io log" "")]]
+ (in (if omit?
+ (list)
+ output)))
+
+ {.#None}
+ (///.failure (..wrong_syntax_error macro_name))))))]
+
+ [log_single! ..single]
+ [log_complete! ..complete]
+ [log_total! ..total]
+ )
diff --git a/stdlib/source/library/lux/meta/macro/syntax/definition.lux b/stdlib/source/library/lux/meta/macro/syntax/definition.lux
index 44030c108..445068226 100644
--- a/stdlib/source/library/lux/meta/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/meta/macro/syntax/definition.lux
@@ -17,7 +17,8 @@
["[0]" list]]]
["[0]" meta (.only)
["[0]" location]
- ["[0]" macro]
+ [macro
+ ["[0]" expansion]]
["[0]" code (.only)
["<[1]>" \\parser (.only Parser)]]]]]
["[0]" // (.only)
@@ -67,7 +68,7 @@
(do [! <>.monad]
[raw <code>.any
me_raw (|> raw
- macro.full_expansion
+ expansion.total
(meta.result compiler)
<>.lifted)]
(<| (<code>.locally me_raw)
diff --git a/stdlib/source/library/lux/meta/type.lux b/stdlib/source/library/lux/meta/type.lux
index 9af406098..42f9f2961 100644
--- a/stdlib/source/library/lux/meta/type.lux
+++ b/stdlib/source/library/lux/meta/type.lux
@@ -24,7 +24,8 @@
["[0]" code (.only)
["<[1]>" \\parser (.only Parser)]]
["[0]" macro (.only)
- [syntax (.only syntax)]]]]])
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]])
(with_template [<name> <tag>]
[(def .public (<name> type)
@@ -474,7 +475,7 @@
(-> Lux (Parser Typed))
(do <>.monad
[it <code>.any
- type_check (<>.lifted (meta.result lux (macro.expansion it)))]
+ type_check (<>.lifted (meta.result lux (expansion.complete it)))]
(<| (<code>.locally type_check)
<code>.form
(<>.after (<code>.this (` "lux type check")))
diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux
index 5f4fae4ac..5ad579363 100644
--- a/stdlib/source/test/lux/control/remember.lux
+++ b/stdlib/source/test/lux/control/remember.lux
@@ -18,8 +18,9 @@
["[0]" meta (.only)
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
- ["[0]" syntax (.only syntax)]]]
+ [macro
+ ["[0]" syntax (.only syntax)]
+ ["[0]" expansion]]]
[world
[time
["[0]" date (.only Date)]
@@ -74,10 +75,10 @@
message (product.right (random.result prng ..message))
expected (product.right (random.result prng ..focus))]
(do meta.monad
- [should_fail0 (..attempt (macro.expansion (..memory macro yesterday message {.#None})))
- should_fail1 (..attempt (macro.expansion (..memory macro yesterday message {.#Some expected})))
- should_succeed0 (..attempt (macro.expansion (..memory macro tomorrow message {.#None})))
- should_succeed1 (..attempt (macro.expansion (..memory macro tomorrow message {.#Some expected})))]
+ [should_fail0 (..attempt (expansion.complete (..memory macro yesterday message {.#None})))
+ should_fail1 (..attempt (expansion.complete (..memory macro yesterday message {.#Some expected})))
+ should_succeed0 (..attempt (expansion.complete (..memory macro tomorrow message {.#None})))
+ should_succeed1 (..attempt (expansion.complete (..memory macro tomorrow message {.#Some expected})))]
(in (list (code.bit (and (case should_fail0
{try.#Failure error}
(and (test_failure yesterday message {.#None} error)
diff --git a/stdlib/source/test/lux/data/text/regex.lux b/stdlib/source/test/lux/data/text/regex.lux
index 48b376358..c057aeaf0 100644
--- a/stdlib/source/test/lux/data/text/regex.lux
+++ b/stdlib/source/test/lux/data/text/regex.lux
@@ -18,7 +18,8 @@
["[0]" code (.only)
["<[1]>" \\parser]]
["[0]" macro (.only)
- [syntax (.only syntax)]]]]]
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]]
[\\library
["[0]" /]])
@@ -280,7 +281,7 @@
(def expands?
(syntax (_ [form <code>.any])
(function (_ lux)
- {try.#Success [lux (list (code.bit (case (macro.single_expansion form lux)
+ {try.#Success [lux (list (code.bit (case (expansion.single form lux)
{try.#Success _}
true
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index 8dae4a18e..a503b00cd 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -23,8 +23,9 @@
["@" target]
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
- [syntax (.only syntax)]]]
+ [macro
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]
[world
[time (.only Time)
[instant (.only Instant)]
@@ -219,7 +220,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- (case ((macro.expansion macro) compiler)
+ (case ((expansion.complete macro) compiler)
{try.#Failure error}
{try.#Success [compiler (list (code.text error))]}
diff --git a/stdlib/source/test/lux/documentation.lux b/stdlib/source/test/lux/documentation.lux
index 4196ab09d..53296522c 100644
--- a/stdlib/source/test/lux/documentation.lux
+++ b/stdlib/source/test/lux/documentation.lux
@@ -13,16 +13,17 @@
["[0]" meta (.only)
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
+ [macro
[syntax (.only syntax)]
- ["[0]" template]]]]]
+ ["[0]" template]
+ ["[0]" expansion]]]]]
[\\library
["[0]" /]])
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- {try.#Success [compiler (list (code.bit (case ((macro.expansion macro) compiler)
+ {try.#Success [compiler (list (code.bit (case ((expansion.complete macro) compiler)
{try.#Failure error}
true
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 91b97276f..b03264c22 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -28,9 +28,10 @@
["[0]" type (.use "[1]#[0]" equivalence)]
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
+ [macro
[syntax (.only syntax)]
- ["[0]" template]]
+ ["[0]" template]
+ ["[0]" expansion]]
[target
["[0]" jvm
["[1]" type (.use "[1]#[0]" equivalence)]]]]]]
@@ -74,7 +75,7 @@
(def macro_error
(syntax (_ [expression <code>.any])
(function (_ lux)
- (|> (macro.single_expansion expression)
+ (|> (expansion.single expression)
(meta.result lux)
(pipe.case
{try.#Success expansion}
@@ -670,7 +671,7 @@
(def expands?
(syntax (_ [expression <code>.any])
(function (_ lux)
- (|> (macro.single_expansion expression)
+ (|> (expansion.single expression)
(meta.result lux)
(pipe.case
{try.#Success expansion}
diff --git a/stdlib/source/test/lux/meta/configuration.lux b/stdlib/source/test/lux/meta/configuration.lux
index 0630f5186..ed0998646 100644
--- a/stdlib/source/test/lux/meta/configuration.lux
+++ b/stdlib/source/test/lux/meta/configuration.lux
@@ -21,8 +21,9 @@
["[0]" meta (.only)
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
- [syntax (.only syntax)]]]]]
+ [macro
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]]
[\\library
["[0]" /]])
@@ -39,7 +40,7 @@
(def failure
(syntax (_ [it <code>.any])
(function (_ lux)
- (case (macro.expansion it lux)
+ (case (expansion.complete it lux)
{try.#Failure error}
{try.#Success [lux (list (code.text error))]}
diff --git a/stdlib/source/test/lux/meta/macro.lux b/stdlib/source/test/lux/meta/macro.lux
index 80faef121..59dbf995f 100644
--- a/stdlib/source/test/lux/meta/macro.lux
+++ b/stdlib/source/test/lux/meta/macro.lux
@@ -21,13 +21,13 @@
["[0]" location]
["[0]" symbol]
["[0]" code (.use "[1]#[0]" equivalence)
- ["<[1]>" \\parser]]
- [macro
- ["^" pattern]]]]]
+ ["<[1]>" \\parser]]]]]
[\\library
["[0]" / (.only)
+ ["^" pattern]
[syntax (.only syntax)]
- ["[0]" template]]]
+ ["[0]" template]
+ ["[0]" expansion]]]
["[0]" /
["[1][0]" local]
["[1][0]" syntax]
@@ -85,9 +85,9 @@
[.#module_hash 0
.#module_aliases (list)
.#definitions (is (List [Text .Global])
- (list (!global /.log_single_expansion!)
- (!global /.log_expansion!)
- (!global /.log_full_expansion!)))
+ (list (!global expansion.log_single!)
+ (!global expansion.log_complete!)
+ (!global expansion.log_total!)))
.#imports (list)
.#module_state {.#Active}]]
[current_module
@@ -131,33 +131,33 @@
full_expansion (` (n.* (n.* (, pow/1) (, pow/1))
(n.* (, pow/1) (, pow/1))))]]
(`` (all _.and
- (,, (with_template [<expander> <logger> <expansion>]
- [(_.coverage [<expander>]
- (|> (<expander> (` (..pow/4 (, pow/1))))
- (meta.result lux)
- (try#each (at (list.equivalence code.equivalence) =
- (list <expansion>)))
- (try.else false)))
-
- (_.coverage [<logger>]
- (and (|> (/.single_expansion (` (<logger> "omit" (..pow/4 (, pow/1)))))
- (meta.result lux)
- (try#each (at (list.equivalence code.equivalence) = (list)))
- (try.else false))
- (|> (/.single_expansion (` (<logger> (..pow/4 (, pow/1)))))
- (meta.result lux)
- (try#each (at (list.equivalence code.equivalence) = (list <expansion>)))
- (try.else false))))]
-
- [/.single_expansion /.log_single_expansion! single_expansion]
- [/.expansion /.log_expansion! expansion]
- [/.full_expansion /.log_full_expansion! full_expansion]
- ))
- (_.coverage [/.one_expansion]
- (bit#= (not (n.= 1 repetitions))
- (|> (/.one_expansion (` (..repeated (, (code.nat repetitions)) (, pow/1))))
- (meta.result lux)
- (!expect {try.#Failure _}))))
+ ... (,, (with_template [<expander> <logger> <expansion>]
+ ... [(_.coverage [<expander>]
+ ... (|> (<expander> (` (..pow/4 (, pow/1))))
+ ... (meta.result lux)
+ ... (try#each (at (list.equivalence code.equivalence) =
+ ... (list <expansion>)))
+ ... (try.else false)))
+
+ ... (_.coverage [<logger>]
+ ... (and (|> (expansion.single (` (<logger> "omit" (..pow/4 (, pow/1)))))
+ ... (meta.result lux)
+ ... (try#each (at (list.equivalence code.equivalence) = (list)))
+ ... (try.else false))
+ ... (|> (expansion.single (` (<logger> (..pow/4 (, pow/1)))))
+ ... (meta.result lux)
+ ... (try#each (at (list.equivalence code.equivalence) = (list <expansion>)))
+ ... (try.else false))))]
+
+ ... [expansion.single expansion.log_single! single_expansion]
+ ... [expansion.complete expansion.log_complete! expansion]
+ ... [expansion.total expansion.log_total! full_expansion]
+ ... ))
+ ... (_.coverage [expansion.one]
+ ... (bit#= (not (n.= 1 repetitions))
+ ... (|> (expansion.one (` (..repeated (, (code.nat repetitions)) (, pow/1))))
+ ... (meta.result lux)
+ ... (!expect {try.#Failure _}))))
(_.coverage [/.final]
(with_expansions [<expected> (static.random_nat)
<cycles> (static.random code.nat
@@ -219,10 +219,10 @@
(and (text.contains? symbol_prefix actual_symbol)
(text.contains? (%.nat seed) actual_symbol))))))
(_.coverage [/.wrong_syntax_error]
- (|> (/.single_expansion (` (/.log_single_expansion!)))
+ (|> (expansion.single (` (expansion.log_single!)))
(meta.result lux)
(!expect (^.multi {try.#Failure error}
- (text.contains? (/.wrong_syntax_error (symbol /.log_single_expansion!))
+ (text.contains? (/.wrong_syntax_error (symbol expansion.log_single!))
error)))))
(_.coverage [/.with_symbols]
(with_expansions [<expected> (fresh_symbol)]
diff --git a/stdlib/source/test/lux/meta/macro/local.lux b/stdlib/source/test/lux/meta/macro/local.lux
index 1aa793639..19398b395 100644
--- a/stdlib/source/test/lux/meta/macro/local.lux
+++ b/stdlib/source/test/lux/meta/macro/local.lux
@@ -22,7 +22,8 @@
["[0]" code (.only)
["<[1]>" \\parser]]
["[0]" macro (.only)
- [syntax (.only syntax)]]]]]
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]]
[\\library
["[0]" /]])
@@ -35,7 +36,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- (case ((macro.expansion macro) compiler)
+ (case ((expansion.complete macro) compiler)
{try.#Failure error}
{try.#Success [compiler (list (code.text error))]}
@@ -69,7 +70,7 @@
(, pop!)
(, g!output))))]
(if pre_remove
- (macro.full_expansion pre_expansion)
+ (expansion.total pre_expansion)
(in (list pre_expansion))))))))
(def .public test
diff --git a/stdlib/source/test/lux/meta/macro/template.lux b/stdlib/source/test/lux/meta/macro/template.lux
index d2952d268..c239d6821 100644
--- a/stdlib/source/test/lux/meta/macro/template.lux
+++ b/stdlib/source/test/lux/meta/macro/template.lux
@@ -17,8 +17,9 @@
[meta
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
- [syntax (.only syntax)]]]]]
+ [macro
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]]
[\\library
["[0]" /]])
@@ -31,7 +32,7 @@
(def macro_error
(syntax (_ [macro <code>.any])
(function (_ compiler)
- (case ((macro.expansion macro) compiler)
+ (case ((expansion.complete macro) compiler)
{try.#Failure error}
{try.#Success [compiler (list (code.text error))]}
diff --git a/stdlib/source/test/lux/meta/type/resource.lux b/stdlib/source/test/lux/meta/type/resource.lux
index 34a3bc422..65618e66a 100644
--- a/stdlib/source/test/lux/meta/type/resource.lux
+++ b/stdlib/source/test/lux/meta/type/resource.lux
@@ -20,8 +20,9 @@
["[0]" meta (.only)
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
- [syntax (.only syntax)]]]]]
+ [macro
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]]
[\\library
["[0]" / (.only Res)]])
@@ -161,7 +162,7 @@
[[_ _ exception] (meta.export exception)]
(function (_ compiler)
{.#Right [compiler
- (list (code.bit (case ((macro.single_expansion to_expand) compiler)
+ (list (code.bit (case ((expansion.single to_expand) compiler)
{try.#Success _}
false
diff --git a/stdlib/source/test/lux/meta/version.lux b/stdlib/source/test/lux/meta/version.lux
index 1df94e003..6df9bf4e5 100644
--- a/stdlib/source/test/lux/meta/version.lux
+++ b/stdlib/source/test/lux/meta/version.lux
@@ -17,15 +17,16 @@
["[0]" static]
["[0]" code (.only)
["<[1]>" \\parser]]
- ["[0]" macro (.only)
- [syntax (.only syntax)]]]]]
+ [macro
+ [syntax (.only syntax)]
+ ["[0]" expansion]]]]]
[\\library
["[0]" /]])
(def failure
(syntax (_ [it <code>.any])
(function (_ lux)
- (case (macro.expansion it lux)
+ (case (expansion.complete it lux)
{try.#Failure error}
{try.#Success [lux (list (code.text error))]}