skip

HTAB:         /\x09/                             # ASCII Horizontal tab
LF:           /\x0A/                             # ASCII Linefeed
CR:           /\x0D/                             # ASCII Carriage return
SPACE:        ' '                                # ASCII space
AT:           '@'                                # ASCII AT

LWSP_char:    SPACE | HTAB                       # Semantics = SPACE
CHAR:         /[\x00-\x7F]/                      # Any ASCII character.
CTL:          /[\x00-\x1F\x7F]/                  # Any ASCII control character
                                                 # and DEL
special:      /[]()<>@,;:\\".[]/                 # Must be in quoted string
                                                 # to be use within word.
CRLF:         <skip: ""> CR LF

linear_white_space:                              # Semantics = SPACE
              <skip: "">                         # CRLF => folding
              (CRLF(?) LWSP_char)(s)


atom:         /[^]\x00-\x20 \x7F\x80-\xFF()<>@,;:\\".[]+/
                                                 # Any CHAR except specials,
                                                 # SPACE and CTLs
              # Added '+' to regex in [cdq]text
              # for efficiency reasons.
ctext:        /[^)\\\x0D\x80-\xFF(]+/            # Any CHAR, excepting [, ], \,
           |  linear_white_space                 # and CR, and including
                                                 # linear-white-space =>
                                                 # may be folded
dtext:        /[^]\\\x0D\x80-\xFF[]+/            # Any CHAR, excepting [, ], \,
           |  linear_white_space                 # and CR, and including
                                                 # linear-white-space =>
                                                 # may be folded
qtext:        /[^"\\\x0D\x80-\xFF]+/             # Any CHAR, excepting ", \,
           |  linear_white_space                 # and CR, and including
                                                 # linear-white-space =>
                                                 # may be folded
quoted_pair:  '\\' <skip: ""> CHAR               # May quote any char


quoted_string:                                   # Regular qtext or quoted chars
              '"' <skip: ""> (qtext | quoted_pair)(s?) '"'
domain_literal:
              '[' <skip: ""> (dtext | quoted_pair)(s?) ']'
comment:      '(' <skip: ""> (ctext | quoted_pair | comment)(s?) ')'
                                                 # May be folded.
ocms:         comment(s?)                        # To keep grammar more
                                                 # readable. Not in RFC.


word:         atom
           |  quoted_string
phrase:       <leftop: word ocms word>           # sequence of words


valid:        ocms address ocms /^\Z/ {1}

address:      mailbox                            # one addressee
           |  group                              # named list

group:        phrase ocms ':' ocms
              <leftop: mailbox (ocms ',' ocms) mailbox>(?)
              ocms ';'

mailbox:      addr_spec                          # simple address
           |  phrase ocms route_addr             # name & addr-spec

route_addr:   '<' ocms route(?) ocms addr_spec ocms '>'

route:        <leftop: (AT ocms domain)          # path-relative
                        (ocms ',' ocms)
                       (AT ocms domain)> ocms ':'

addr_spec:    local_part ocms '@' ocms domain    # global address

local_part:   <leftop: word (ocms '.' ocms) word>
                                                 # uninterpreted
                                                 # case-preserved

domain:       <leftop: sub_domain (ocms '.' ocms) sub_domain>

sub_domain:   domain_ref
           |  domain_literal

domain_ref:   atom                               # symbolic reference

[Prev] [Next] [Index]