C++标准中(opt)的解释
Interpretation of (opt) in C++standard
如何解读(opt)?它是应用于整个 "compound" 词还是仅应用于它所附加的词?
在下面的示例中,很明显它应用于整个 "compound" 单词。但如果在所有情况下都是如此呢?我在哪里可以找到它的规则?
statement:
labeled-statement
attribute-specifier-seq(opt) expression-statement
attribute-specifier-seq(opt) compound-statement
attribute-specifier-seq(opt) selection-statement
attribute-specifier-seq(opt) iteration-statement
attribute-specifier-seq(opt) jump-statement
declaration-statement
attribute-specifier-seq(opt) try-block
它适用于整个单词。例如,
foo-baropt baz
相当于
baz
foo-bar baz
而不是
foo baz
foo-bar baz
每 [syntax]/1:
In the syntax notation used in this document, syntactic categories are
indicated by italic type, and literal words and characters in
constant width
type. Alternatives are listed on separate lines
except in a few cases where a long set of alternatives is marked by
the phrase “one of”. If the text of an alternative is too long to fit
on a line, the text is continued on subsequent lines indented from the
first one. An optional terminal or non-terminal symbol is indicated by
the subscript “opt”, so
{
expressionopt }
表示用大括号括起来的可选表达式。
整个复合词是一个非终结符。 seq 之类的东西既不是终端也不是非终端。
如何解读(opt)?它是应用于整个 "compound" 词还是仅应用于它所附加的词?
在下面的示例中,很明显它应用于整个 "compound" 单词。但如果在所有情况下都是如此呢?我在哪里可以找到它的规则?
statement:
labeled-statement
attribute-specifier-seq(opt) expression-statement
attribute-specifier-seq(opt) compound-statement
attribute-specifier-seq(opt) selection-statement
attribute-specifier-seq(opt) iteration-statement
attribute-specifier-seq(opt) jump-statement
declaration-statement
attribute-specifier-seq(opt) try-block
它适用于整个单词。例如,
foo-baropt baz
相当于
baz
foo-bar baz
而不是
foo baz
foo-bar baz
每 [syntax]/1:
In the syntax notation used in this document, syntactic categories are indicated by italic type, and literal words and characters in
constant width
type. Alternatives are listed on separate lines except in a few cases where a long set of alternatives is marked by the phrase “one of”. If the text of an alternative is too long to fit on a line, the text is continued on subsequent lines indented from the first one. An optional terminal or non-terminal symbol is indicated by the subscript “opt”, so
{
expressionopt}
表示用大括号括起来的可选表达式。
整个复合词是一个非终结符。 seq 之类的东西既不是终端也不是非终端。