summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/txr/stdlib/awk.tl6
-rw-r--r--txr.125
2 files changed, 28 insertions, 3 deletions
diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl
index 5b19e706..b0f54aaf 100644
--- a/share/txr/stdlib/awk.tl
+++ b/share/txr/stdlib/awk.tl
@@ -172,9 +172,8 @@
(set aws.rec rec aws.orig-rec rec)
(inc aws.rec-num)
(inc aws.file-rec-num)
- aws.(rec-to-f)
- (block :awk-rec
- [func aws]))
+ (while* (eq :awk-again (block :awk-rec [func aws]))
+ aws.(rec-to-f)))
(when end-file-func
[end-file-func aws])))))))
@@ -294,6 +293,7 @@
(ofs (qref ,aws-sym ofs))
(ors (qref ,aws-sym ors)))
(macrolet ((next () '(return-from :awk-rec))
+ (again () '(return-from :awk-rec :awk-again))
(next-file () '(return-from :awk-file))
(sys:rng (form from-expr to-expr :env e)
(let ((style (car form))
diff --git a/txr.1 b/txr.1
index cff7cd87..6ac4422a 100644
--- a/txr.1
+++ b/txr.1
@@ -45022,6 +45022,31 @@ record,
.code awk
terminates.
+.coNP Macro @ again
+.synb
+.mets (again)
+.syne
+.desc
+The awk macro
+.code again
+may be invoked in a condition-pattern clause. It terminates the
+processing of that clause, and all subsequent clauses.
+Then, the current value of the record, namely the datum stored
+in the Awk variable
+.codn rec ,
+is delimited into fields, and all of the condition-pattern clauses
+are processed again.
+
+No other state is modified. In particular, the record number
+.code nr
+and the
+.code orec
+variable holding the original record both retain their current values.
+
+Note: this is an original feature in the \*(TL
+.code awk
+macro, which has no counterpart in POSIX or GNU Awk.
+
.coNP Macro @ next-file
.synb
.mets (next-file)