Copyright | This file is part of the package addy. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at: https://code.devalot.com/open/addy No part of this package including this file may be copied modified propagated or distributed except according to the terms contained in the LICENSE file. |
---|---|
License | BSD-2-Clause |
Safe Haskell | None |
Language | Haskell2010 |
Internal parsing functions.
Synopsis
- data Mode
- data Atom = Atom (Maybe CommentContent) Text (Maybe CommentContent)
- parse :: Mode -> Parser EmailAddr
- parseWithMode :: Mode -> Text -> Either (NonEmpty Error) EmailAddr
- nameAddr :: Mode -> Parser EmailAddr
- addrSpec :: Mode -> Parser EmailAddr
- localPartP :: Mode -> Parser (Maybe CommentContent, LocalPart)
- domainP :: Mode -> Parser (Domain, Maybe CommentContent)
- displayNameP :: Mode -> Parser Atom
- word :: Mode -> Parser Atom
- atom :: Mode -> Parser Atom
- dotAtom :: Mode -> Parser Atom
- dotAtomLh :: Parser Atom
- dotAtomRh :: Parser Atom
- quoted :: Mode -> Parser Atom
- quotedLh :: Parser Atom
- cfws :: Mode -> Parser CommentContent
Documentation
Parsing mode.
Since: 0.1.0.0
RFC 5322 atom
.
Since: 0.1.0.0
parseWithMode :: Mode -> Text -> Either (NonEmpty Error) EmailAddr Source #
Run the parser and then validate the resulting address.
Since: 0.1.0.0
nameAddr :: Mode -> Parser EmailAddr Source #
Parse email addresses in the name-addr
format.
Since: 0.1.0.0
addrSpec :: Mode -> Parser EmailAddr Source #
Parse email addresses in the addr-spec
format.
Since: 0.1.0.0
localPartP :: Mode -> Parser (Maybe CommentContent, LocalPart) Source #
Parse the local-part
of an email address.
RFC 5322 §3.4.1
local-part = dot-atom / quoted-string / obs-local-part
Since: 0.1.0.0
word :: Mode -> Parser Atom Source #
An atom or quoted string.
word = atom / quoted-string
Since: 0.1.0.0
atom :: Mode -> Parser Atom Source #
Parse an unquoted atom.
atom = [CFWS] 1*atext [CFWS]
Since: 0.1.0.0
dotAtomLh :: Parser Atom Source #
Strict dot-atom-lh
from RFC 5322 errata.
dot-atom-lh = [CFWS] dot-atom-text [FWS]
Since: 0.1.0.0
dotAtomRh :: Parser Atom Source #
Strict dot-atom-rh
from RFC 5322 errata.
dot-atom-rh = [FWS] dot-atom-text [CFWS]
Since: 0.1.0.0
quoted :: Mode -> Parser Atom Source #
A quoted string.
RFC5322 §3.2.4
qtext = %d33 / ; Printable US-ASCII %d35-91 / ; characters not including %d93-126 / ; "\" or the quote character obs-qtext qcontent = qtext / quoted-pair quoted-string = [CFWS] DQUOTE *([FWS] qcontent) [FWS] DQUOTE [CFWS] obs-qtext = obs-NO-WS-CTL
RFC 6532 §3.2
qtext =/ UTF8-non-ascii
RFC 5322 errata item 3135 https://www.rfc-editor.org/errata/eid3135
quoted-string = [CFWS] DQUOTE ((1*([FWS] qcontent) [FWS]) / FWS) DQUOTE [CFWS]
This is the rule we use since it's consistent with the text of the RFC.
Since: 0.1.0.0
cfws :: Mode -> Parser CommentContent Source #
Comments and folding white space.
ctext = %d33-39 / ; Printable US-ASCII %d42-91 / ; characters not including %d93-126 / ; "(", ")", or "\" obs-ctext obs-ctext = obs-NO-WS-CTL ccontent = ctext / quoted-pair / comment comment = "(" *([FWS] ccontent) [FWS] ")" CFWS = (1*([FWS] comment) [FWS]) / FWS
Since: 0.1.0.0