about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2026-06-24 22:07:54 +0100
committerArun Isaac2026-06-24 22:08:52 +0100
commitcefbe4d5e164cd0caf70a4df5a2bb6f4c12db641 (patch)
tree6333e35910c965b78de245b3ffdf9e99477146f5
parent596e868c145d8c0c3f5ad3893e32d5dc73151bc4 (diff)
downloadccwl-cefbe4d5e164cd0caf70a4df5a2bb6f4c12db641.tar.gz
ccwl-cefbe4d5e164cd0caf70a4df5a2bb6f4c12db641.tar.lz
ccwl-cefbe4d5e164cd0caf70a4df5a2bb6f4c12db641.zip
ccwl: Replace invalid #:separate? flags with #f.
When the exception is continued, we don't want invalid #:separate?
flags leaking in; replace them with #f.
-rw-r--r--ccwl/ccwl.scm23
1 files changed, 13 insertions, 10 deletions
diff --git a/ccwl/ccwl.scm b/ccwl/ccwl.scm
index d14cdad..cafc3c5 100644
--- a/ccwl/ccwl.scm
+++ b/ccwl/ccwl.scm
@@ -387,12 +387,17 @@ input, return #f."
     (_ #f)))
 
 (define (validate-separate? separate?)
-  "Validate @var{separate?} and raise an exception if it is not valid."
-  (unless (boolean? separate?)
-    (raise-continuable
-     (condition (ccwl-violation separate?)
-                (formatted-message "Invalid #:separate? flag ~a. #:separate? flag must be a boolean."
-                                   (syntax->datum separate?))))))
+  "Validate @var{separate?} and raise a continuable exception if it is
+not valid. Return validated @var{separate?}---either @code{#'#t} or
+@code{#'#f}."
+  (if (boolean? (syntax->datum separate?))
+      separate?
+      (begin
+        (raise-continuable
+         (condition (ccwl-violation separate?)
+                    (formatted-message "Invalid #:separate? flag ~a. #:separate? flag must be a boolean."
+                                       (syntax->datum separate?))))
+        #'#f)))
 
 (define (run-arg-separate? run-arg)
   "Return the separate? specified in @var{run-arg} syntax. If not a
@@ -400,8 +405,7 @@ prefixed input, return #f."
   (syntax-case run-arg (array)
     ((prefix _ args ...) (string? (syntax->datum #'prefix))
      (apply (syntax-lambda** (#:key (separate? #'#t))
-              (validate-separate? (syntax->datum separate?))
-              separate?)
+              (validate-separate? separate?))
             #'(args ...)))
     (_ #f)))
 
@@ -453,8 +457,7 @@ identifiers defined in the commands."
       ((prefix string-arg args ...) (and (string? (syntax->datum #'prefix))
                                          (string? (syntax->datum #'string-arg)))
        (apply (syntax-lambda** (#:key (separate? #'#t))
-                (validate-separate? (syntax->datum separate?))
-                (if (syntax->datum separate?)
+                (if (syntax->datum (validate-separate? separate?))
                     (list #'prefix #'string-arg)
                     (list #`#,(string-append (syntax->datum #'prefix)
                                              (syntax->datum #'string-arg)))))