From 38b710b262d96a004092b618f508b2e97f5b2977 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 7 Apr 2021 07:06:41 -0700 Subject: awk: bugfix: string rs must not compile as regex. * share/txr/stdlib/awk.tl (awk-state loop): When rs contains a string, do not pass it directly to regex-compile, because that function calls regex-parse when the argument is a string. Wrap it it a (compound ...) tree node to get it to be treated as sequence of characters to match. --- share/txr/stdlib/awk.tl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/share/txr/stdlib/awk.tl b/share/txr/stdlib/awk.tl index 6c85cb77..f94d6b9a 100644 --- a/share/txr/stdlib/awk.tl +++ b/share/txr/stdlib/awk.tl @@ -162,11 +162,11 @@ (t r)))))) (t (set aws.par-mode nil) - (let ((rin (record-adapter (if (regexp aws.rs) - aws.rs - (regex-compile aws.rs)) - *stdin* - aws.krs))) + (let ((rin (record-adapter + (if (regexp aws.rs) aws.rs + (regex-compile ^(compound, aws.rs))) + *stdin* + aws.krs))) (lambda () (get-line rin)))))))))) (set aws.file-rec-num 0) (unwind-protect -- cgit v1.2.3