该行为<NID> ::= <let-num> [ 1,31<let-num-hyp> ]
。我认为这意味着<NID>
是字符串的符号,受两个规则的约束:
<let-num>
个字符的任何一个出现。<let-num-hyp>
字符的0-31次出现*。我是否正确阅读?因为,如果是的话,其中一些含义会让人感到困惑。
* 相当于“可选,1-31次出现
RFC2141中<NID>
(命名空间标识符)的完整BNF语法为:
<NID> ::= <let-num> [ 1,31<let-num-hyp> ]
<let-num-hyp> ::= <upper> | <lower> | <number> | "-"
<let-num> ::= <upper> | <lower> | <number>
<upper> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" |
"I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" |
"Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" |
"Y" | "Z"
<lower> ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" |
"i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" |
"q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" |
"y" | "z"
<number> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
"8" | "9"
答案 0 :(得分:2)
你已经正确地解释了它。有什么令人困惑的含义?
<NID> ::= <let-num> [ 1,31<let-num-hyp> ]
表示出现<let-num>
一次,最多可出现31次出现<let-num-hyp>
。
考虑到其他定义,这意味着一个至少包含一个字符且最多32个字符的字符串,由大小写,数字和连字符组成,第一个字符不允许是连字符。