Module MrMime_msgID

module MrMime_msgID: sig .. end
Module Message ID

type word = [ `Atom of string | `String of string ] 
word is a combinations of atoms and/or quoted-strings:

    word         =   atom / quoted-string
    

    atext        =   ALPHA / DIGIT /    ; Printable US-ASCII
                     "!" / "#" /        ;  characters not including
                     "$" / "%" /        ;  specials.  Used for atoms.
                     "&" / "'" /
                     "*" / "+" /
                     "-" / "/" /
                     "=" / "?" /
                     "^" / "_" /
                     "`" / "{" /
                     "|" / "}" /
                     "~"

    atom         =   [CFWS] 1*atext [CFWS]
    

    qtext           =   %d33 /             ; Printable US-ASCII
                        %d35-91 /          ;  characters not including
                        %d93-126 /         ;  "\\" or the quote character
                        obs-qtext
    obs-qp          =   "\\" (%d0 / obs-NO-WS-CTL / LF / CR)
    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

    quoted-pair     =   ("\\" (VCHAR / WSP)) / obs-qp
    qcontent        =   qtext / quoted-pair

    quoted-string   =   [CFWS]
                        DQUOTE *([FWS] qcontent) [FWSDQUOTE
                        [CFWS]
    

A quoted-string is treated as a unit. That is, quoted-string is identical to atom, semantically. Since a quoted-string is allowed to contain FWS, fold is permitted. Also note that since quoted-pair is allowed in a quoted-string, the quote and backslash characters may appear in a quoted-string so long as they appear as a quoted-pair. MrMime interprets directly a quoted-pair to its value.

Semantically, neither the optional CFWS outside of the quote characters nor the quote characters themselves are part of the quoted-string; the quoted-string is what is contained beteen the two quote characters. As stated ealier, the "\\" in any quoted-pair and the CRLF in any FWS/CFWS that appears within the quoted-string are semantically invisible and therefore not part of the quoted-string either.
See also

type local = word list 
Left-hand side of the "@".
type domain = [ `Domain of string list | `Literal of string ] 
Right-hand side of the "@".
type msg_id = local * domain 
The message identifier msg-id syntax is a limited version of the addr-spec construct enclosed in the angle bracket characters, "<" and ">". Unlike æddr-spec, this syntax only permits the dot-atom-text form on the left-hand side of the "@" and does not have internal CFWS anywhere in the message identifier.
See also RFC5322 § Identification Fields
val pp_local : Format.formatter -> local -> unit
pp_local fmt local prints an human readable representation of the left-hand side of the "@".
val pp_domain : Format.formatter -> domain -> unit
pp_domain fmt local prints an human readable representation of the right-hand side of the "@".
val pp : Format.formatter -> msg_id -> unit
pp fmt msg_id prints an human readable representation of msg_id.
module Encoder: sig .. end
module Decoder: sig .. end
val of_string : ?chunk:int -> string -> msg_id option
of_string ~chunk:1024 buf parses an RFC5322 message ID starting at 0 in buf.

This function allocates a internal buffer with chunk size (default to 1024).

val of_string_raw : ?chunk:int -> string -> int -> int -> (msg_id * int) option
of_string_raw ~chunk:1024 buf off len parses an RFC5322 message ID starting at off in buf to a tuple (msg_id, count) with;

This function allocates a internal buffer with chunk size (default to 1024).