Skip to main content

Formal Syntax

The notational conventions used here are identical to those used in STD 11, RFC 822 [RFC822]. The * (asterisk) convention is as follows: l*m something

   meaning at least l and at most m somethings, with l and m taking
   default values of 0 and infinity, respectively.
   message             = headers 1*(CRLF text)
                                          ; see also [MIME1] "body-part"
                                          ; note: must end in ASCII
   text                = *(single-byte-char /
                           g2-desig-seq /
                           single-shift-char)
                          [*segment
                           reset-seq
                           *(single-byte-char /
                             g2-desig-seq /
                             single-shift-char ) ]
                                          ; note: g2-desig-seq must
                                          ; precede single-shift-char
   headers             = <see [RFC822] "fields" and [MIME1] "body-part">
   segment             = single-byte-segment / double-byte-segment
   single-byte-segment = single-byte-seq
                         *(single-byte-char /
                           g2-desig-seq /
                           single-shift-char )
   double-byte-segment = double-byte-seq
                         *((one-of-94 one-of-94) /
                           g2-desig-seq /
                           single-shift-char )
   reset-seq           = ESC "(" ( "B" / "J" )
   single-byte-seq     = ESC "(" ( "B" / "J" )
   double-byte-seq     = (ESC "$" ( "@" / "A" / "B" )) /
                         (ESC "$" "(" ( "C" / "D" ))
   g2-desig-seq        = ESC "." ( "A" / "F" )
   single-shift-seq    = ESC "N"
   single-shift-char   = single-shift-seq one-of-96
   CRLF                = CR LF
                                                    ; ( Octal, Decimal.)
   ESC                 = <ISO 2022 ESC, escape>     ; (    33,      27.)
   SI                  = <ISO 2022 SI, shift-in>    ; (    17,      15.)
   SO                  = <ISO 2022 SO, shift-out>   ; (    16,      14.)
   CR                  = <ASCII CR, carriage return>; (    15,      13.)
   LF                  = <ASCII LF, linefeed>       ; (    12,      10.)
   one-of-94           = <any one of 94 values>     ; (41-176, 33.-126.)
   one-of-96           = <any one of 96 values>     ; (40-177, 32.-127.)
   7BIT                = <any 7-bit value>          ; ( 0-177,  0.-127.)
   single-byte-char    = <any 7BIT, including bare CR & bare LF, but NOT
                          including CRLF, and not including ESC, SI, SO>