rulelist ::= ( rule | (c_wsp* c_nl) )+ rule ::= rulename defined_as elements c_nl # continues if next line starts # with white space elements ::= alternation c_wsp* alternation ::= concatenation (c_wsp* "/" c_wsp* concatenation)* concatenation::= repetition (c_wsp+ repetition)* repetition ::= repeat? element repeat ::= (DIGIT* "*" DIGIT*) | DIGIT+ element ::= rulename | group | option | char_val | num_val | prose_val group ::= "(" c_wsp* alternation c_wsp* ")" option ::= "[" c_wsp* alternation c_wsp* "]" char_val ::= case_insensitive_string | case_sensitive_string case_insensitive_string ::= "%i"? quoted_string case_sensitive_string ::= "%s" quoted_string num_val ::= "%" (bin_val | dec_val | hex_val) @terminals # Terminals used in ABNF, itself rulename ::= ALPHA (ALPHA | DIGIT | "-")* defined_as ::= c_wsp* ("=" | "=/") c_wsp* # basic rules definition and # incremental alternatives c_wsp ::= WSP | (c_nl WSP) c_nl ::= COMMENT | CRLF # comment or newline comment ::= ";" (WSP | VCHAR)* CRLF quoted_string::= DQUOTE [#x20-#x21#x23-#x7E]* DQUOTE # quoted string of SP and VCHAR # without DQUOTE bin_val ::= "b" BIT+ (("." BIT+)+ | ("-" BIT+))? # series of concatenated bit values # or single ONEOF range dec_val ::= "d" DIGIT+ (("." DIGIT+)+ | ("-" DIGIT+))? hex_val ::= "x" HEXDIG+ (("." HEXDIG+)+ | ("-" HEXDIG+))? prose_val ::= "<" [#x20-#x3D#x3F-#x7E]* ">" # bracketed string of SP and VCHAR # without angles # prose description, to be used as # last resort # Core terminals available in uses of ABNF ALPHA ::= [#x41-#x5A#x61-#x7A] # A-Z | a-z BIT ::= '0' | '1' CHAR ::= [#x01-#x7F] # any 7-bit US-ASCII character, # excluding NUL CR ::= #x0D # carriage return CRLF ::= CR? LF # Internet standard newline CTL ::= [#x00-#x1F] | #x7F # controls DIGIT ::= [#x30-#x39] # 0-9 DQUOTE ::= #x22 # " (Double Quote) HEXDIG ::= DIGIT | "A" | "B" | "C" | "D" | "E" | "F" HTAB ::= #x09 # horizontal tab LF ::= #x0A # linefeed LWSP ::= (WSP | CRLF WSP)* # Use of this linear-white-space rule # permits lines containing only white # space that are no longer legal in # mail headers and have caused # interoperability problems in other # contexts. # Do not use when defining mail # headers and use with caution in # other contexts. OCTET ::= [#x00-#xFF] # 8 bits of data SP ::= #x20 VCHAR ::= [#x21-#x7E] # visible (printing) characters WSP ::= SP | HTAB # white space