diff options
Diffstat (limited to 'email/utils.scm')
-rw-r--r-- | email/utils.scm | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/email/utils.scm b/email/utils.scm index 7d51ebb..e942fc2 100644 --- a/email/utils.scm +++ b/email/utils.scm @@ -23,18 +23,18 @@ #:use-module (ice-9 textual-ports) #:use-module (rnrs io simple) #:export (get-line-with-delimiter - read-objects - read-while - acons* - alist-delete*)) + read-objects + read-while + acons* + alist-delete*)) (define (read-objects read-proc port) "Read all objects using READ-PROC from PORT and return them as a list." (let ((x (read-proc port))) (if (eof-object? x) - (list) - (cons x (read-objects read-proc port))))) + (list) + (cons x (read-objects read-proc port))))) (define* (read-while port read-proc pred) "Read from PORT using READ-PROC while PRED returns #t. READ-PROC is @@ -45,8 +45,8 @@ string returned by READ-PROC as argument." (cond ((eof-object? x) x) ((pred x) - (put-string output x) - (read-while-loop output)) + (put-string output x) + (read-while-loop output)) (#t (unget-string port x))))) (let ((str (call-with-output-string read-while-loop))) @@ -57,8 +57,8 @@ string returned by READ-PROC as argument." delimiting linefeed character." (let ((line (get-line port))) (if (eof-object? line) - line - (string-append line "\n")))) + line + (string-append line "\n")))) (define acons* (match-lambda* @@ -72,24 +72,24 @@ delimiting linefeed character." "Return a list containing all elements of ALIST whose keys are not a member of KEYS." (filter (match-lambda - ((key . _) - (not (member key keys)))) - alist)) + ((key . _) + (not (member key keys)))) + alist)) (define (cg-string-ci pat accum) (syntax-case pat () ((pat-str-syntax) (string? (syntax->datum #'pat-str-syntax)) (let ((pat-str (syntax->datum #'pat-str-syntax))) (let ((plen (string-length pat-str))) - #`(lambda (str len pos) - (let ((end (+ pos #,plen))) - (and (<= end len) - (string-ci= str #,pat-str pos end) - #,(case accum - ((all) #`(list end (list 'cg-string #,pat-str))) - ((name) #`(list end 'cg-string)) - ((body) #`(list end #,pat-str)) - ((none) #`(list end '())) - (else (error "bad accum" accum))))))))))) + #`(lambda (str len pos) + (let ((end (+ pos #,plen))) + (and (<= end len) + (string-ci= str #,pat-str pos end) + #,(case accum + ((all) #`(list end (list 'cg-string #,pat-str))) + ((name) #`(list end 'cg-string)) + ((body) #`(list end #,pat-str)) + ((none) #`(list end '())) + (else (error "bad accum" accum))))))))))) (add-peg-compiler! 'string-ci cg-string-ci) |