#?SuikaWiki/0.9

[1] [[RFC819]] 附属書 A は次の様な [[BNF]] で mailbox と domain を定義してる。

-   <mailbox> ::= <local-part> "@" <domain>
-   <local-part> ::= <string> | <quoted-string>
-   <string> ::= <char> | <char> <string>
-   <quoted-string> ::=  """ <qtext> """
-   <qtext> ::=  "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>
-   <char> ::= <c> | "\" <x>
-   <domain> ::= <naming-domain> | <naming-domain> "." <domain>
-   <naming-domain> ::=  <simple-name> | <address>
-   <simple-name> ::= <a> <ldh-str> <let-dig>
-   <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
-   <let-dig> ::= <a> | <d>
-   <let-dig-hyp> ::= <a> | <d> | "-"
-   <address> :: =  "#" <number> | "[" <dotnum> "]"
-   <number> ::= <d> | <d> <number>
-   <dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
-   <snum> ::= one, two, or three digits representing a decimal integer value in the range 0 through 255
-   <a> ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case
-   <c> ::= any one of the 128 ASCII characters except <s> or <SP>
-   <d> ::= any one of the ten digits 0 through 9
-   <q> ::= any one of the 128 ASCII characters except CR, LF, quote ("), or backslash (\)
-   <x> ::= any one of the 128 ASCII characters (no exceptions)
-   <s> ::= "<", ">", "(", ")", "[", "]", "\", ".", ",", ";", ":", "@", """, and the control characters (ASCII codes 0 through 31 inclusive and 127)

[2] 分かりにくいので現代風に
[[ABNF]] に書き直してみる。

-mailbox = local-part "@" domain
-local-part = string / quoted-string
-string = 1*char
-quoted-string = <"> qcontent <">
-qcontent = 1*( quoted-pair / qtext )
-quoted-pair = "\" %x00-%x7F
-char = atext / quoted-pair
-domain = naming-domain *("." naming-domain) ;; 大文字・小文字を区別しない
-naming-domain = simple-name / address
-simple-name = [[ALPHA]] 1*( ALPHA / [[DIGIT]] / "-" ) ( ALPHA / DIGIT )
-address = "#" 1*DIGIT / "[" [[IPv4address]] "]"
-atext = %x21 / %x23-27 / %x2A-2B / %x2D / %x2F / %x30-39 / %x3D / %x3F / %x41-5A / %x5E-7F
-qtext = %x00-09 / %x0B-0C / %x0E-21 / %x23-5B / %x5D-7F


