From 89e1929a51f5f8f150e105936603429c88edeb94 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 4 Feb 2017 20:03:00 -0800 Subject: 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. --- txr.1 | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 9c76f945..65c6c940 100644 --- a/txr.1 +++ b/txr.1 @@ -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 ) -- cgit v1.2.3