summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-12-27 06:36:20 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-12-27 06:36:20 -0800
commit8ccf4c0a9076c957a5ed58f6ccc6ede7f71644a3 (patch)
tree0ef77b6b799ca817f6e867dce88da8ee0fc5f09b /tests
parent4500f9d53feea9205c4c30743bb99e3a5f15703d (diff)
downloadtxr-8ccf4c0a9076c957a5ed58f6ccc6ede7f71644a3.tar.gz
txr-8ccf4c0a9076c957a5ed58f6ccc6ede7f71644a3.tar.bz2
txr-8ccf4c0a9076c957a5ed58f6ccc6ede7f71644a3.zip
txr: function span variable must match existing value.
* match.c (h_var_compat): New function; verbatim copy of existing h_var prior to this commit. (h_var): If a variable has an existing binding, but is a function spanning match, do not substitute it with text. Handle it with the ordinary case, in which we now use dest_bind instead of cons. (v_var): Similarly, here, we must also use dest_bind, rather than always freshly binding the variable. (match_compat_fixup): For 272 compatibility, substitute h_var_compat for h_var in the horizontal directive table. * tests/010/span-var.txr: New test cases. * txr.1: Documentation updated and also improved overall. The behavior when a variable has an existing value is clarified for the regex and fixed field case. Also update and condense compat notes for 272.
Diffstat (limited to 'tests')
-rw-r--r--tests/010/span-var.txr13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/010/span-var.txr b/tests/010/span-var.txr
index 5f5faa6c..b7142b79 100644
--- a/tests/010/span-var.txr
+++ b/tests/010/span-var.txr
@@ -13,3 +13,16 @@
@{w (fun2 x "a")}@y
@(require (equal w "a"))
@(require (equal y "b"))
+@(next :list '("a" "a" "a" "b" "c"))
+@(bind d ("d"))
+@(cases)
+@ {d (fun "x" "a")}
+@(or)
+@ (require "get here")
+@(end)
+@(next :string "ab")
+@(cases)
+@ {d (fun2 "x" "a")}
+@(or)
+@ (require "get here")
+@(end)