From fb4b7819b0c4f63c0ed8248517d393236e187d85 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 23 May 2017 14:41:54 -1000 Subject: [PATCH] refac --- pitfall/pitfall/path.rkt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pitfall/pitfall/path.rkt b/pitfall/pitfall/path.rkt index 98ab0b95..a88c07b3 100644 --- a/pitfall/pitfall/path.rkt +++ b/pitfall/pitfall/path.rkt @@ -7,10 +7,11 @@ (define (parse path) (let* ([path (string-replace path "," " ")] ; no commas + [path (string-replace path "-" " -")] ; at least one space before negative signs [path (string-replace path #px"(?<=[A-Za-z])" " ")]) ; at least one space after letters (for/list ([str (in-list (string-split path #px"(?=[A-Za-z])"))] #:unless (zero? (string-length str))) - (read (open-input-string (format "(~a)" (string-replace str "-" " -"))))))) + (read (open-input-string (format "(~a)" str)))))) (module+ test (require rackunit) @@ -52,4 +53,4 @@ (values a2 a3 a0 a1 sx sy)] [(z) (send doc closePath . cmd-args) (values sx sy px py sx sy)] - [else (report cmd-name) (values cx cy px py sx sy)])))) \ No newline at end of file + [else (raise-argument-error 'apply-commands "valid command name" cmd-name)])))) \ No newline at end of file