diff --git a/src/GenericParser/EmailAddress.purs b/src/GenericParser/EmailAddress.purs index 220c0c5..9ff7eb0 100644 --- a/src/GenericParser/EmailAddress.purs +++ b/src/GenericParser/EmailAddress.purs @@ -540,18 +540,26 @@ qcontent = CU.singleton <$> qtext <|> quoted_pair -- | `quoted_string` -- | +-- | WARNING: this rule was changed in order to take into account the new `qtext` rule, +-- | which now accepts the space character. This new rule, as implemented, still allows +-- | for multiple line returns in the quoted string. +-- | +-- | +-- | Original RFC5322 rule: -- | quoted-string = `[CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS]` +-- | +-- | Implemented rule: +-- | quoted-string = `[CFWS] DQUOTE *([CRLF] qcontent) [FWS] DQUOTE [CFWS]` quoted_string :: forall e. Parser e String quoted_string = do s <- tryMaybe cfws _ <- char '"' - m <- A.many $ do xs <- tryMaybe fws - c <- qcontent - pure $ maybe "" id xs <> c + m <- A.many do l <- tryMaybe crlf + c <- qcontent + pure $ maybe "" id l <> c _ <- char '"' e <- tryMaybe cfws pure $ maybe "" id s <> "\"" <> A.fold m <> "\"" <> maybe "" id e - -- | TODO: For now, `local_part` only checks that -- | (a) the first character is a letter, -- | (b) the last character is either a letter or a digit.