aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation/lux/meta/macro.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-11-07 18:52:46 -0400
committerEduardo Julian2022-11-07 18:52:46 -0400
commitcb572295c9a73330531e07f3f6a92b3bb2434514 (patch)
treeae14be0a53235971d897c033879e3d4512ffde68 /stdlib/source/documentation/lux/meta/macro.lux
parent13c594758482bac0a7550bcb89cfeda8c5f0a1f3 (diff)
Can now mark definitions as deprecated in their documentation.
Diffstat (limited to 'stdlib/source/documentation/lux/meta/macro.lux')
-rw-r--r--stdlib/source/documentation/lux/meta/macro.lux78
1 files changed, 40 insertions, 38 deletions
diff --git a/stdlib/source/documentation/lux/meta/macro.lux b/stdlib/source/documentation/lux/meta/macro.lux
index bde4fd2f4..648fa6a6b 100644
--- a/stdlib/source/documentation/lux/meta/macro.lux
+++ b/stdlib/source/documentation/lux/meta/macro.lux
@@ -22,79 +22,81 @@
... ($.definition /.single_expansion
... (format "Given code that requires applying a macro, does it once and returns the result."
... \n "Otherwise, returns the code as-is.")
- ... [(single_expansion syntax)])
+ ... ($.example (single_expansion syntax)))
... ($.definition /.expansion
... (format "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
... \n "Otherwise, returns the code as-is.")
- ... [(expansion syntax)])
+ ... ($.example (expansion syntax)))
... ($.definition /.full_expansion
... "Expands all macro-calls everywhere recursively, until only primitive/base code remains."
- ... [(full_expansion syntax)])
+ ... ($.example (full_expansion syntax)))
($.definition /.symbol
(format "Generates a unique name as a Code node (ready to be used in code templates)."
\n "A prefix can be given (or just be empty text) to better identify the code for debugging purposes.")
- [(symbol prefix)])
+ ($.example (symbol prefix)))
($.definition /.wrong_syntax_error
"A generic error message for macro syntax failures.")
($.definition /.with_symbols
"Creates new symbols and offers them to the body expression."
- [(def synchronized
- (syntax (_ [lock any
- body any])
- (with_symbols [g!lock g!body g!_]
- (in (list (` (let [(, g!lock) (, lock)
- (, g!_) ("jvm monitorenter" (, g!lock))
- (, g!body) (, body)
- (, g!_) ("jvm monitorexit" (, g!lock))]
- (, g!body))))))))])
+ ($.example (def synchronized
+ (syntax (_ [lock any
+ body any])
+ (with_symbols [g!lock g!body g!_]
+ (in (list (` (let [(, g!lock) (, lock)
+ (, g!_) ("jvm monitorenter" (, g!lock))
+ (, g!body) (, body)
+ (, g!_) ("jvm monitorexit" (, g!lock))]
+ (, g!body))))))))))
... ($.definition /.one_expansion
... "Works just like expand, except that it ensures that the output is a single Code token."
- ... [(one_expansion token)])
+ ... ($.example (one_expansion token)))
... ($.definition /.log_single_expansion!
... (format "Performs a macro-expansion and logs the resulting code."
... \n "You can either use the resulting code, or omit them."
... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- ... [(log_single_expansion!
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))
- ... (log_single_expansion! "omit"
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))])
+ ... ($.example (log_single_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz))))
+ ... ($.example (log_single_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))))
... ($.definition /.log_expansion!
... (format "Performs a macro-expansion and logs the resulting code."
... \n "You can either use the resulting code, or omit them."
... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- ... [(log_expansion!
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))
- ... (log_expansion! "omit"
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))])
+
+ ... ($.example (log_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz))))
+ ... ($.example (log_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))))
... ($.definition /.log_full_expansion!
... (format "Performs a macro-expansion and logs the resulting code."
... \n "You can either use the resulting code, or omit them."
... \n "By omitting them, this macro produces nothing (just like the lux.comment macro).")
- ... [(log_full_expansion!
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))
- ... (log_full_expansion! "omit"
- ... (def (foo bar baz)
- ... (-> Int Int Int)
- ... (int.+ bar baz)))])
+
+ ... ($.example (log_full_expansion!
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz))))
+ ... ($.example (log_full_expansion! "omit"
+ ... (def (foo bar baz)
+ ... (-> Int Int Int)
+ ... (int.+ bar baz)))))
(all list#composite
/local.documentation