diff --git a/src/GenericParser/EmailAddress.purs b/src/GenericParser/EmailAddress.purs index 42705d9..05d9230 100644 --- a/src/GenericParser/EmailAddress.purs +++ b/src/GenericParser/EmailAddress.purs @@ -43,7 +43,7 @@ fws = do _ <- tryMaybe do _ <- A.many wsp void $ many1 wsp <|> obs_fws --- | ctext: printable US-ASCII characters. +-- | ctext: comment text, meaning printable US-ASCII characters excluding '(', ')' and '\'. -- | -- | ctext = %d33-39 / ; Printable US-ASCII -- | %d42-91 / ; characters not including @@ -79,9 +79,13 @@ comment = do _ <- char '(' void ccontent) void $ char ')' --- CFWS = (1*([FWS] comment) [FWS]) / FWS ---cfws :: forall e. Parser e String ---cfws = do +-- | CFWS: comment folding white space. +-- | +-- | CFWS = (1*([FWS] comment) [FWS]) / FWS +cfws :: forall e. Parser e Unit +cfws = do void $ many1 $ do _ <- tryMaybe fws + comment + <|> fws -- address = mailbox / group --address :: forall e. Parser e String @@ -112,10 +116,12 @@ comment = do _ <- char '(' -- domain = dot-atom / domain-literal / obs-domain -- -- domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS] --- --- dtext = %d33-90 / ; Printable US-ASCII --- %d94-126 / ; characters not including --- obs-dtext ; "[", "]", or "\" + +-- | dtext: characters in domains. +-- | +-- | dtext = %d33-90 / ; Printable US-ASCII +-- | %d94-126 / ; characters not including +-- | obs-dtext ; "[", "]", or "\" dtext :: forall e. Parser e Char dtext = sat cond <|> obs_dtext where cond x = let charcode = C.toCharCode x @@ -144,11 +150,14 @@ dtext = sat cond <|> obs_dtext obs_dtext :: forall e. Parser e Char obs_dtext = obs_no_ws_ctl <|> quoted_pair ---obs-NO-WS-CTL = %d1-8 / ; US-ASCII control --- %d11 / ; characters that do not --- %d12 / ; include the carriage --- %d14-31 / ; return, line feed, and --- %d127 ; white space characters +-- | obs-NO-WS-CTL: US-ASCII control characters without carriage return, +-- | line feed and white space characters. +-- | +-- | obs-NO-WS-CTL = %d1-8 / ; US-ASCII control +-- | %d11 / ; characters that do not +-- | %d12 / ; include the carriage +-- | %d14-31 / ; return, line feed, and +-- | %d127 ; white space characters obs_no_ws_ctl :: forall e. Parser e Char obs_no_ws_ctl = sat cond where cond x = let charcode = C.toCharCode x @@ -157,6 +166,8 @@ obs_no_ws_ctl = sat cond || between 14 31 charcode || charcode == 127 +-- | obs-ctext: obsolete comment text. +-- | -- | obs-ctext = obs-NO-WS-CTL obs_ctext :: forall e. Parser e Char obs_ctext = obs_no_ws_ctl