aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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