summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-10-29 19:58:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-10-29 19:58:52 -0700
commit78a77b00d40befdacd4f5044f504ed132755609e (patch)
tree1f8b89a8f005d299ddd6d850d9b43f0a0ba16e6f /tests
parentd7a93957e27bbfe6eaebc25b9d539f82dd9e4df3 (diff)
downloadtxr-78a77b00d40befdacd4f5044f504ed132755609e.tar.gz
txr-78a77b00d40befdacd4f5044f504ed132755609e.tar.bz2
txr-78a77b00d40befdacd4f5044f504ed132755609e.zip
awk: implement ranges right using functions.
* share/txr/stdlib/awk.tl (sys:awk%--rng, sys:awk%--rng-, sys:awk%rng+, sys:awk%-rng+, sys:awk%--rng+): New functions. (sys:awk-mac-let): Rewritten range expander. The four basic ranges rng, rng-, -rng and -rng- are handled with in-line expansion, because by doing that we avoid unnecessarily evaluating the from-expression. The remaining cases expand to function calls to the new functions, which receive the flag vector, the index position in that vector and the values of the from and to expressions. The behavior change is that that the -- forms now do the right thing: they hide all leading records that satisfy the from-expression, right to the last record of the range if necessary. * tests/015/awk-rng.expected: Updated. * txr.1: Revise semantic description the -- range types, plus minor fixes.
Diffstat (limited to 'tests')
-rw-r--r--tests/015/awk-rng.expected26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/015/awk-rng.expected b/tests/015/awk-rng.expected
index aa79a932..25c4626b 100644
--- a/tests/015/awk-rng.expected
+++ b/tests/015/awk-rng.expected
@@ -8,22 +8,22 @@ X2 t t t t t t
1 t t t t t t t t t
2 t t t t t t t t t
3 t t t t t t t t t
-Y1 t t t end t t t
-r end end t t
-s end end t t
-Y2 end end t t
+Y1 t t t t t t t
+r t t t t
+s t t t t
+Y2 t t t t
t
Y2
X1X2 t t t
-Y1Y2 t t t end t t t
+Y1Y2 t t t t t t t
X1X2 t t t
-Y1 t t t end t t t
-a end end t t
-Y2 end end t t
-X1X2Y1Y2 t t end end t t
+Y1 t t t t t t t
+a t t t t
+Y2 t t t t
+X1X2Y1Y2 t t t t t
a
-X1X2Y1Y2 t t end t t
-X1X2Y1Y2 t t end end t t
+X1X2Y1Y2 t t t
+X1X2Y1Y2 t t t t
X1 t t t
-b t t t t t t
-X2 t t t t t t
+b t t t t t t t
+X2 t t t t t t t