diff --git a/src/GenericParser/EmailAddress.purs b/src/GenericParser/EmailAddress.purs index f0909f3..76b32e6 100644 --- a/src/GenericParser/EmailAddress.purs +++ b/src/GenericParser/EmailAddress.purs @@ -155,7 +155,15 @@ mailbox_list = do mb <- mailbox pure $ mb <> A.fold xs <|> obs_mbox_list ---address-list = (address *("," address)) / obs-addr-list +-- | `address_list` +-- | +-- | address-list = (address *("," address)) / obs-addr-list +address_list :: forall e. Parser e String +address_list = do a <- address + xs <- A.many do _ <- char ',' + address + pure $ A.fold $ A.intersperse "," $ [a] <> xs + <|> obs_addr_list -- | `group_list` -- | @@ -192,7 +200,7 @@ atext = alphanum <|> char '~' --- | `atom` = [CFWS] 1*atext [CFWS] +-- | `atom` -- | -- | atom = [CFWS] 1*atext [CFWS] atom :: forall e. Parser e String @@ -210,7 +218,7 @@ dot_atom_text = do xs0 <- many1 atext str1 = A.fold xs1 pure $ str0 <> str1 --- | dot-atom = [CFWS] dot-atom-text [CFWS] +-- | `dot_atom` -- | -- | dot-atom = [CFWS] dot-atom-text [CFWS] dot_atom :: forall e. Parser e String @@ -285,7 +293,7 @@ dtext = CU.singleton <$> sat cond <|> obs_dtext in between 33 90 charcode || between 94 126 charcode --- | TODO: `obs_angle_addr`: obsolete address specification between '<' and '>' characters. +-- | `obs_angle_addr`: obsolete address specification between '<' and '>' characters. -- | -- | obs-angle-addr = [CFWS] "<" obs-route addr-spec ">" [CFWS] obs_angle_addr :: forall e. Parser e String @@ -329,7 +337,18 @@ obs_mbox_list = do _ <- A.many $ do _ <- cfws pure x pure $ mb <> A.fold xs ---obs-addr-list = *([CFWS] ",") address *("," [address / CFWS]) +-- | `obs_addr_list` +-- | +-- | obs-addr-list = *([CFWS] ",") address *("," [address / CFWS]) +obs_addr_list :: forall e. Parser e String +obs_addr_list = do _ <- A.many do _ <- tryMaybe cfws + char ',' + a <- address + xs <- A.many do _ <- char ',' + address <|> do _ <- cfws + pure "" + let res = A.fold $ A.intersperse "," $ [a] <> xs + pure res -- | `obs_group_list` -- | @@ -406,7 +425,7 @@ obs_qp = do _ <- char '\\' v <- char_num 0 <|> obs_no_ws_ctl <|> lf <|> cr pure $ "\\" <> CU.singleton v --- | TODO: `obs_body`: obsolete body. +-- | `obs_body`: obsolete body. -- | -- | Note: the simpler version found in the errata is implemented, which basically accept everything. -- | @@ -422,12 +441,12 @@ obs_qp = do _ <- char '\\' -- | obs-body = *(d0 /text / LF / CR) -- Errata v1 --obs_body :: forall e. Parser e String ---obs_body = A.fold <$> A.many item +--obs_body = CU.fromCharArray <$> A.many item -- -- Errata v2 ---obs_body :: forall e. Parser e String ---obs_body = A.fold <$> do A.many (char_num 0 <|> vchar <|> lf <|> cr) --- +obs_body :: forall e. Parser e String +obs_body = CU.fromCharArray <$> do A.many (char_num 0 <|> vchar <|> lf <|> cr) + --obs_body original --obs_body :: forall e. Parser e String --obs_body = do A.many $ do _ <- A.many lf