Appendix A. Collected Grammar (语法汇总)
本附录包含RFC 2045中定义的所有MIME语法规则的完整BNF语法.
MIME头部字段
MIME-message-headers := entity-headers
fields
version CRLF
entity-headers := [ content CRLF ]
[ encoding CRLF ]
[ id CRLF ]
[ description CRLF ]
*( MIME-extension-field CRLF )
version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT
Content-Type
content := "Content-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
ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>
x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>
subtype := extension-token / iana-token
iana-token := <A publicly-defined extension token.>
parameter := attribute "=" value
attribute := token
value := token / quoted-string
token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>
tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "\" / <">
"/" / "[" / "]" / "?" / "="
Content-Transfer-Encoding
encoding := "Content-Transfer-Encoding" ":" mechanism
mechanism := "7bit" / "8bit" / "binary" /
"quoted-printable" / "base64" /
ietf-token / x-token
Content-ID
id := "Content-ID" ":" msg-id
Content-Description
description := "Content-Description" ":" *text
注释:
- 此语法与RFC 822的BNF结合使用
- 某些规则引用了RFC 822中定义的术语
- 完整的语法需要参考RFC 822和RFC 1123