diff options
-rw-r--r-- | lib.c | 3 | ||||
-rw-r--r-- | tests/006/freeform-4.expected | 26 | ||||
-rw-r--r-- | tests/006/freeform-4.txr | 20 |
3 files changed, 48 insertions, 1 deletions
@@ -4589,9 +4589,10 @@ static val lazy_sub_str(val lstr, val from, val to) if (to != t) { return pfxsub; } else { + val pfxcopy = copy_str(pfxsub); val lsub = make_obj(); lsub->ls.type = LSTR; - lsub->ls.prefix = pfxsub; + lsub->ls.prefix = pfxcopy; lsub->ls.list = lstr->ls.list; lsub->ls.props = coerce(struct lazy_string_props *, chk_copy_obj(coerce(mem_t *, lstr->ls.props), diff --git a/tests/006/freeform-4.expected b/tests/006/freeform-4.expected new file mode 100644 index 00000000..62857f54 --- /dev/null +++ b/tests/006/freeform-4.expected @@ -0,0 +1,26 @@ +### +FF: +1 +2 + /FF + +X, Y : 1 2 + +### +FF: +3 +4 + /FF + +X, Y : 3 4 + +X[0]="1" +X[1]="3" +Y[0]="2" +Y[1]="4" +FF[0]="1\ +2\ +" +FF[1]="3\ +4\ +" diff --git a/tests/006/freeform-4.txr b/tests/006/freeform-4.txr new file mode 100644 index 00000000..328626eb --- /dev/null +++ b/tests/006/freeform-4.txr @@ -0,0 +1,20 @@ +@(next :list '("1" "2" "3" "4")) +@(collect) +@ (all) +@X +@Y +@ (and) +@ (freeform 2) +@FF +@ (end) +@(end) +@(output) +@ (repeat) +### +FF: +@FF /FF + +X, Y : @X @Y + +@ (end) +@(end) |