summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-07 07:06:41 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-07 07:06:41 -0700
commit38b710b262d96a004092b618f508b2e97f5b2977 (patch)
tree8e07063dba288cfd2890f02dc1ff2bff8cea9d17
parent174182a29c785493ed41231caff36f35c56819cf (diff)
downloadtxr-38b710b262d96a004092b618f508b2e97f5b2977.tar.gz
txr-38b710b262d96a004092b618f508b2e97f5b2977.tar.bz2
txr-38b710b262d96a004092b618f508b2e97f5b2977.zip
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.
-rw-r--r--share/txr/stdlib/awk.tl10
1 files 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