aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/macro.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/macro.lux')
-rw-r--r--stdlib/source/library/lux/macro.lux40
1 files changed, 20 insertions, 20 deletions
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index 3f1d04553..1fa269e8c 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux "*"
+ [lux {"-" symbol}
[abstract
["[0]" monad {"+" do}]]
[data
@@ -21,7 +21,7 @@
(def: .public (single_expansion syntax)
(-> Code (Meta (List Code)))
(case syntax
- [_ {.#Form {.#Item [[_ {.#Identifier name}] args]}}]
+ [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
(do //.monad
[?macro (//.macro name)]
(case ?macro
@@ -37,7 +37,7 @@
(def: .public (expansion syntax)
(-> Code (Meta (List Code)))
(case syntax
- [_ {.#Form {.#Item [[_ {.#Identifier name}] args]}}]
+ [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
(do //.monad
[?macro (//.macro name)]
(case ?macro
@@ -57,7 +57,7 @@
(def: .public (full_expansion syntax)
(-> Code (Meta (List Code)))
(case syntax
- [_ {.#Form {.#Item [[_ {.#Identifier name}] args]}}]
+ [_ {.#Form {.#Item [[_ {.#Symbol name}] args]}}]
(do //.monad
[?macro (//.macro name)]
(case ?macro
@@ -69,7 +69,7 @@
{.#None}
(do //.monad
- [parts' (monad.each //.monad full_expansion (list& (code.identifier name) args))]
+ [parts' (monad.each //.monad full_expansion (list& (code.symbol name) args))]
(in (list (code.form (list#conjoint parts')))))))
[_ {.#Form {.#Item [harg targs]}}]
@@ -91,23 +91,23 @@
_
(# //.monad in (list syntax))))
-(def: .public (identifier prefix)
+(def: .public (symbol prefix)
(-> Text (Meta Code))
(do //.monad
[id //.seed]
(in (|> id
(# nat.decimal encoded)
($_ text#composite "__gensym__" prefix)
- [""] code.identifier))))
+ [""] code.symbol))))
-(def: (local_identifier ast)
+(def: (local_symbol ast)
(-> Code (Meta Text))
(case ast
- [_ {.#Identifier [_ name]}]
+ [_ {.#Symbol [_ name]}]
(# //.monad in name)
_
- (//.failure (text#composite "Code is not a local identifier: " (code.format ast)))))
+ (//.failure (text#composite "Code is not a local symbol: " (code.format ast)))))
(def: .public wrong_syntax_error
(-> Symbol Text)
@@ -115,20 +115,20 @@
(text.prefix (text#composite "Wrong syntax for " text.\''))
(text.suffix (text#composite text.\'' "."))))
-(macro: .public (with_identifiers tokens)
+(macro: .public (with_symbols tokens)
(case tokens
- (^ (list [_ {.#Tuple identifiers}] body))
+ (^ (list [_ {.#Tuple symbols}] body))
(do [! //.monad]
- [identifier_names (monad.each ! ..local_identifier identifiers)
- .let [identifier_defs (list#conjoint (list#each (: (-> Text (List Code))
- (function (_ name) (list (code.identifier ["" name]) (` (..identifier (~ (code.text name)))))))
- identifier_names))]]
+ [symbol_names (monad.each ! ..local_symbol symbols)
+ .let [symbol_defs (list#conjoint (list#each (: (-> Text (List Code))
+ (function (_ name) (list (code.symbol ["" name]) (` (..symbol (~ (code.text name)))))))
+ symbol_names))]]
(in (list (` ((~! do) (~! //.monad)
- [(~+ identifier_defs)]
+ [(~+ symbol_defs)]
(~ body))))))
_
- (//.failure (..wrong_syntax_error (symbol ..with_identifiers)))))
+ (//.failure (..wrong_syntax_error (.symbol ..with_symbols)))))
(def: .public (one_expansion token)
(-> Code (Meta Code))
@@ -143,8 +143,8 @@
(template [<macro> <func>]
[(macro: .public (<macro> tokens)
- (let [[module _] (symbol .._)
- [_ short] (symbol <macro>)
+ (let [[module _] (.symbol .._)
+ [_ short] (.symbol <macro>)
macro_name [module short]]
(case (: (Maybe [Bit Code])
(case tokens