diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-02-04 20:03:00 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-02-04 20:03:00 -0800 |
commit | 89e1929a51f5f8f150e105936603429c88edeb94 (patch) | |
tree | cd02aa765bba2ca5015b361e1001e426b93bac9a | |
parent | 1b73f78249070e277f9fb29bb2853b0c38c3df9e (diff) | |
download | txr-89e1929a51f5f8f150e105936603429c88edeb94.tar.gz txr-89e1929a51f5f8f150e105936603429c88edeb94.tar.bz2 txr-89e1929a51f5f8f150e105936603429c88edeb94.zip |
Expose rlcp_tree function.
* eval.c (eval_init): Register rlcp-tree intrinsic.
* txr.1: Documented rlcp-tree. Also documented that rlcp
doesn't overwrite location info.
-rw-r--r-- | eval.c | 1 | ||||
-rw-r--r-- | txr.1 | 30 |
2 files changed, 29 insertions, 2 deletions
@@ -5979,6 +5979,7 @@ void eval_init(void) reg_fun(intern(lit("macro-ancestor"), user_package), func_n1(lookup_origin)); reg_fun(intern(lit("set-macro-ancestor"), system_package), func_n2(set_origin)); reg_fun(intern(lit("rlcp"), user_package), func_n2(rlcp)); + reg_fun(intern(lit("rlcp-tree"), user_package), func_n2(rlcp_tree)); eval_error_s = intern(lit("eval-error"), user_package); uw_register_subtype(eval_error_s, error_s); @@ -49952,9 +49952,10 @@ available. If the .meta alternative argument is present, it is returned. -.coNP Function @ rlcp +.coNP Functions @ rlcp and @ rlcp-tree .synb .mets (rlcp < dest-form << source-form ) +.mets (rlcp < dest-tree << source-form ) .syne .desc The @@ -49966,8 +49967,28 @@ object to the .meta dest-form object. These objects are pieces of list-based syntax. +If +.meta dest-form +already has source code location info, then no copying +takes place. + +The +.code rlcp-tree +function copies the source code location info from +.code rlcp +into every cons cell in the +.meta dest-tree +tree structure which doesn't already have location info. +It may be regarded as a recursive application of +.code rlcp +via +.cod3 car / cdr +recursion on the tree structure. However, the traversal performed by +.code rlcp-tree +gracefully handles circular structures. -Note: the function is intended to be used in macros. If a macro transforms +Note: these functions are intended to be used in certain kinds of macros. If a +macro transforms .meta source-form to .metn dest-form , @@ -49976,6 +49997,11 @@ source code location info also, so that when the \*(TL evaluator encounters errors in transformed code, it can give diagnostics which refer to the original untransformed source code. +The macro expander already performs this transfer. If a macro call form +has location info, the expander propagates that info to that form's +expansion. In some situations, it is useful for a macro or other code +transformer to perform this action explicitly. + .coNP Function @ macro-ancestor .synb .mets (macro-ancestor << form ) |