aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-06-30 22:53:23 -0400
committerEduardo Julian2022-06-30 22:53:23 -0400
commita8d76e48df01d0f5326faa8456797f91cb2cbeba (patch)
tree7a7a3d1e934a694e1cc4e3246dc21c2fe3093cf3 /stdlib/source/library/lux.lux
parent565fe5a2e60ff3c6b612031d1c3bb89f330751da (diff)
Alternative names for (un)quoting macros.
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux.lux52
1 files changed, 33 insertions, 19 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 439fb69e3..d142387b3 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1326,9 +1326,9 @@
(p x))}
xs))
-(def' .private (with_location location content)
- (-> Location Code Code)
- (let' [[module line column] location]
+(def' .private (with_location content)
+ (-> Code Code)
+ (let' [[module line column] ..dummy_location]
(tuple$ (list (tuple$ (list (text$ module) (nat$ line) (nat$ column)))
content))))
@@ -1587,9 +1587,9 @@
(symbol$ [..prelude "List"])))]
(form$ (list (text$ "lux type check") type expression))))
-(def' .private (untemplated_text location value)
- (-> Location Text Code)
- (with_location location (variant$ (list (symbol$ [..prelude "#Text"]) (text$ value)))))
+(def' .private (untemplated_text value)
+ (-> Text Code)
+ (with_location (variant$ (list (symbol$ [..prelude "#Text"]) (text$ value)))))
(def' .public UnQuote
Type
@@ -1902,7 +1902,7 @@
(do meta#monad
[=elements (monad#each meta#monad (untemplated replace? subst) elements)]
(in (untemplated_list =elements))))
- .let' [[_ output'] (with_location @composite (variant$ (list (symbol$ [..prelude tag]) output)))]]
+ .let' [[_ output'] (with_location (variant$ (list (symbol$ [..prelude tag]) output)))]]
(in [@composite output'])))
(def' .private untemplated_form
@@ -1923,22 +1923,22 @@
(def' .private (untemplated replace? subst token)
(-> Bit Text Code ($' Meta Code))
({[_ [@token {#Bit value}]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Bit"]) (bit$ value)))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Bit"]) (bit$ value)))))
[_ [@token {#Nat value}]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Nat"]) (nat$ value)))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Nat"]) (nat$ value)))))
[_ [@token {#Int value}]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Int"]) (int$ value)))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Int"]) (int$ value)))))
[_ [@token {#Rev value}]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Rev"]) (rev$ value)))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Rev"]) (rev$ value)))))
[_ [@token {#Frac value}]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Frac"]) (frac$ value)))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Frac"]) (frac$ value)))))
[_ [@token {#Text value}]]
- (meta#in (untemplated_text @token value))
+ (meta#in (untemplated_text value))
[#1 [@token {#Symbol [module name]}]]
(do meta#monad
@@ -1951,10 +1951,10 @@
(in [module name])}
module)
.let' [[module name] real_name]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name))))))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name))))))))
[#0 [@token {#Symbol [module name]}]]
- (meta#in (with_location @token (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))
+ (meta#in (with_location (variant$ (list (symbol$ [..prelude "#Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))
[#1 [@composite {#Form {#Item [@symbol {#Symbol global}] parameters}}]]
(do meta#monad
@@ -2011,6 +2011,8 @@
(failure (wrong_syntax_error [..prelude "`"]))}
tokens)))
+(def' .public syntax_quote Macro `)
+
(def' .public `'
Macro
(macro (_ tokens)
@@ -2023,6 +2025,8 @@
(failure (wrong_syntax_error [..prelude "`'"]))}
tokens)))
+(def' .public partial_quote Macro `')
+
(def' .public '
Macro
(macro (_ tokens)
@@ -2035,6 +2039,8 @@
(failure (wrong_syntax_error [..prelude "'"]))}
tokens)))
+(def' .public literal_quote Macro ')
+
(def' .public ~
UnQuote
(..unquote
@@ -2048,6 +2054,8 @@
(failure (wrong_syntax_error [..prelude "~"]))}
tokens))))
+(def' .public but UnQuote ~)
+
(def' .public ~!
UnQuote
(..unquote
@@ -2056,15 +2064,17 @@
(do meta#monad
[current_module ..current_module_name
independent (untemplated #1 current_module [@token dependent])]
- (in (list (with_location @token (variant$ (list (symbol$ [..prelude "#Form"])
- (untemplated_list (list (untemplated_text dummy_location "lux in-module")
- (untemplated_text dummy_location current_module)
- independent))))))))
+ (in (list (with_location (variant$ (list (symbol$ [..prelude "#Form"])
+ (untemplated_list (list (untemplated_text "lux in-module")
+ (untemplated_text current_module)
+ independent))))))))
_
(failure (wrong_syntax_error [..prelude "~!"]))}
tokens))))
+(def' .public specifically UnQuote ~!)
+
(def' .public ~'
UnQuote
(..unquote
@@ -2079,6 +2089,8 @@
(failure (wrong_syntax_error [..prelude "~'"]))}
tokens))))
+(def' .public literally UnQuote ~')
+
(def' .public ~+
Spliced_UnQuote
(let' [g!list#composite (form$ (list (text$ "lux in-module")
@@ -2093,6 +2105,8 @@
(failure (wrong_syntax_error [..prelude "~+"]))}
tokens)))))
+(def' .public also Spliced_UnQuote ~+)
+
(def' .public |>
Macro
(macro (_ tokens)