Enum Symbols (CC Mode Manual)

Next: , Previous: , Up: Syntactic Symbols [Contents][Index]


10.2.6 Enum Symbols

There is a set of syntactic symbols that characterize the components of enum constructs. These are very like the brace list symbols41 (see Brace List Symbols).

 1: enum test
 2: {
 3: GOOD,
 4: BETTER,
 5: BEST
 6: };

Line 2 is assigned enum-open syntax, and line 6 enum-close. The first enum element on line 3 is assigned enum-intro syntax, and the remaining elements, on lines 4 and 5 are assigned enum-entry.

When the first enum element follows the ‘{’ of the enum, all on the opening line of the construct, the parsing is a little more involved.

 1: enum test { GOOD,
 2: BETTER,
 3: BEST
 4: };

Here, line 2 is assigned a syntactic context with two elements: enum-intro anchored on the beginning of indentation of line 1, and enum-entry anchored on the first element GOOD on line 1. Line 3 is enum-entry and line 4 enum-close as you’d expect.


Footnotes

(41)

Indeed an enum used to be parsed with these other symbols. The two types of construct were separated in 2024-09 to make it easier to give an enum indentation like that of a class.

AltStyle によって変換されたページ (->オリジナル) /