Aller au contenu principal

Appendix A. Collected Grammar (Grammaire collectée)

Cette annexe contient la grammaire BNF complète pour les règles de syntaxe de type de média définies dans RFC 2046.

Syntaxe du type de média

media-type = type "/" subtype *( ";" parameter )

type = discrete-type / composite-type

discrete-type = "text" / "image" / "audio" / "video" /
"application" / extension-token

composite-type = "message" / "multipart" / extension-token

extension-token = ietf-token / x-token

x-token = <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>

ietf-token = <An extension token defined by a
standards-track RFC and registered
with IANA.>

subtype = extension-token / iana-token

iana-token = <A publicly-defined extension token>

parameter = attribute "=" value

attribute = token

value = token / quoted-string

Syntaxe Multipart

boundary := 0*69<bchars> bcharsnospace

bchars := bcharsnospace / " "

bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
"+" / "_" / "," / "-" / "." /
"/" / ":" / "=" / "?"

dash-boundary := "--" boundary

close-delimiter := delimiter "--"

delimiter := CRLF dash-boundary

discard-text := *(*text CRLF)

preamble := discard-text

epilogue := discard-text

body-part := MIME-part-headers [CRLF *OCTET]

encapsulation := delimiter
body-part

multipart-body := [preamble]
dash-boundary CRLF
body-part
*encapsulation
close-delimiter
[epilogue]

Remarques :

  • Cette grammaire est utilisée conjointement avec RFC 2045 et RFC 822
  • La syntaxe complète nécessite une référence à tous les RFC connexes
  • L'IANA maintient une liste des types de médias enregistrés