diff options
author | W. Kosior <koszko@koszko.org> | 2025-05-06 22:35:44 +0200 |
---|---|---|
committer | W. Kosior <koszko@koszko.org> | 2025-05-06 22:35:44 +0200 |
commit | 11965c8525635e9fcfb8925dbde6f3f5cff7d0db (patch) | |
tree | 86f7dd93d38caca5153fb0d2abf8126c9b17c21c | |
parent | d659fbe71a8f0ae94ee865b0c2f2c32081265ec2 (diff) | |
download | cantius-11965c8525635e9fcfb8925dbde6f3f5cff7d0db.tar.gz cantius-11965c8525635e9fcfb8925dbde6f3f5cff7d0db.zip |
Import `(ice-9 regex)' with `reg:' prefix.
-rw-r--r-- | src/guile/cantius.scm | 17 | ||||
-rw-r--r-- | tests/guile/cantius-test.scm | 4 |
2 files changed, 10 insertions, 11 deletions
diff --git a/src/guile/cantius.scm b/src/guile/cantius.scm index a913e1b..c292924 100644 --- a/src/guile/cantius.scm +++ b/src/guile/cantius.scm @@ -16,8 +16,7 @@ #:use-module ((ice-9 format) #:select (format)) #:use-module ((ice-9 exceptions) #:select (exception-with-message? exception-message)) - #:use-module ((ice-9 regex) #:select - (match:substring match:end regexp-substitute/global)) + #:use-module ((ice-9 regex) #:prefix reg:) #:use-module ((system repl debug) #:select (terminal-width)) #:use-module ((web http) #:select (read-headers)) @@ -164,8 +163,8 @@ ;; A backslash is theoretically legal in boundary, let's make sure it's also ;; escaped. (format #f "--~a" - (regexp-substitute/global #f %backslash-regex boundary - 'pre "\\x5c" 'post))) + (reg:regexp-substitute/global #f %backslash-regex boundary + 'pre "\\x5c" 'post))) (define data* (hex-escape data)) @@ -194,8 +193,8 @@ (cons part parts))))))) (map (lambda (part) - (match-let* (((and (= (cut match:substring <> 1) headers-string) - (= (cut match:substring <> 3) data)) + (match-let* (((and (= (cut reg:match:substring <> 1) headers-string) + (= (cut reg:match:substring <> 3) data)) (regexp-exec %part-regex part)) (headers @@ -340,9 +339,9 @@ (message "Unparseable cookie"))))) (reverse cookies-alist)) - ((and (= (cut match:substring <> 1) name) - (= (cut match:substring <> 3) value) - (= match:end idx*)) + ((and (= (cut reg:match:substring <> 1) name) + (= (cut reg:match:substring <> 3) value) + (= reg:match:end idx*)) (loop idx* `((,name . ,value) . ,cookies-alist)))))) (export cookies) diff --git a/tests/guile/cantius-test.scm b/tests/guile/cantius-test.scm index 0f06daf..5285a54 100644 --- a/tests/guile/cantius-test.scm +++ b/tests/guile/cantius-test.scm @@ -13,7 +13,7 @@ ((ice-9 safe-r5rs) #:select (null-environment)) ((ice-9 format) #:select (format)) ((ice-9 match) #:select (match-lambda)) - ((ice-9 regex) #:select (regexp-substitute/global)) + ((ice-9 regex) #:prefix reg:) ((web client) #:select (open-socket-for-uri http-get)) ((web request) #:prefix req:) ((web response) #:prefix rsp:) @@ -22,7 +22,7 @@ ((cantius) #:prefix cant:)) (define (use-crlf text) - (regexp-substitute/global #f "\n" text 'pre "\r\n" 'post)) + (reg:regexp-substitute/global #f "\n" text 'pre "\r\n" 'post)) (define (form-data-good boundary) (use-crlf (format #f "\ |