Enumerated constant blocks are declared at file scope.
Unlike other languages, which allow enumerated constant blocks to be limited in
scope to a particular namespace, enumerated constant blocks
always have global scope in BAR.
EnumConstantBlock ::= 'enum' S EnumeratedConstantBlockName S? ‘{‘ S?
EnumTypeAssignment (S? ‘,’ S? EnumTypeAssignment)* S? ‘}’ S? ';'
The name uniquely identifies the enumerated constant
block. The name is an identifier that has not appeared
earlier in the file as a construct name, an enumerated
constant block name, an enumerated constant name,
a global variable name, or a global function name.
EnumTypeAssignment ::= EnumeratedConstant (S? '=' S? Constant)?
Each enumerated constant name (EnumeratedConstant)
uniquely identifies an enumerated constant in the block.
The name is an identifier that has not appeared earlier in the
file as a construct name, an enumerated constant block
name, an enumerated constant name, a global
variable name, or a global function name.
For each enumerated constant name, one can optionally assign a
specific constant. If no equals symbol appears
for the first enumerated constant in the block, numbering
starts at zero and increases by one for
each subsequent constant without an assigned number. If
a number is assigned, numbering begins for this constant at the number
specified, and increases by one from this number
for each subsequent constant without an assigned number.
See also: [Global variable
declarations] [Global function declarations]
[Enumerated constant block declarations]
[Structure declarations] [Block
declarations] [List declarations]
|