aboutsummaryrefslogtreecommitdiff
path: root/email
diff options
context:
space:
mode:
authorArun Isaac2020-12-05 20:10:26 +0530
committerArun Isaac2020-12-05 20:10:26 +0530
commit20e1c2e0059ed9ba366126c1d7637cef19dfd7ce (patch)
treeb468f3d15424c9e955a54b81e7f755dca5d8d383 /email
parent19d2b58465aa09c6ff0766b0accc2a94cc425415 (diff)
downloadguile-email-20e1c2e0059ed9ba366126c1d7637cef19dfd7ce.tar.gz
guile-email-20e1c2e0059ed9ba366126c1d7637cef19dfd7ce.tar.lz
guile-email-20e1c2e0059ed9ba366126c1d7637cef19dfd7ce.zip
email: Support remaining obsolete specification.
* email/email.scm (obs-phrase-list, obs-utext, obs-unstruct, obs-optional): New macros. (unstructured, in-reply-to, references, keywords, optional-field): Include obsolete patterns.
Diffstat (limited to 'email')
-rw-r--r--email/email.scm36
1 files changed, 29 insertions, 7 deletions
diff --git a/email/email.scm b/email/email.scm
index e624a98..da2abf9 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -229,13 +229,25 @@
(define-peg-pattern phrase body
obs-phrase)
+(define-peg-pattern obs-phrase-list body
+ (and (? (or phrase cfws))
+ (* (and "," (or phrase cfws)))))
+
+(define-peg-pattern obs-utext body
+ (or "\x00" obs-no-ws-ctl vchar))
+
+(define-peg-pattern obs-unstruct body
+ (* (or (and (* "\n") (* "\r")
+ (* (and obs-utext (* "\n") (* "\r"))))
+ fws)))
;; ABNF modified to ignore leading whitespace
;; ABNF modified to allow for blank lines in folded field
(define-peg-pattern unstructured body
- (and (ignore (? fws))
- (* (and (? fws) (? vchar)))
- (ignore (* wsp))))
+ (or (and (ignore (? fws))
+ (* (and (? fws) (? vchar)))
+ (ignore (* wsp)))
+ obs-unstruct))
;;; Date and time specification
@@ -511,14 +523,20 @@
(ignore ">") (ignore (? cfws))))
(define-field-pattern message-id "Message-ID" msg-id)
-(define-field-pattern in-reply-to "In-Reply-To" (+ msg-id))
-(define-field-pattern references "References" (+ msg-id))
+(define-field-pattern in-reply-to "In-Reply-To"
+ (+ msg-id)
+ (* (or phrase msg-id)))
+(define-field-pattern references "References"
+ (+ msg-id)
+ (* (or phrase msg-id)))
;;; Informational fields
(define-field-pattern subject "Subject" unstructured)
(define-field-pattern comments "Comments" unstructured)
-(define-field-pattern keywords "Keywords" (and phrase (* (and "," phrase))))
+(define-field-pattern keywords "Keywords"
+ (and phrase (* (and "," phrase)))
+ obs-phrase-list)
;;; Resent fields
@@ -563,8 +581,12 @@
(define-peg-pattern field-name all
(+ ftext))
+(define-peg-pattern obs-optional body
+ (and field-name (ignore (and (* wsp) ":")) unstructured crlf))
+
(define-peg-pattern optional-field all
- (and field-name (ignore ":") unstructured crlf))
+ (or (and field-name (ignore ":") unstructured crlf)
+ obs-optional))
;;; MIME version