Next: subint, Previous: bool, Up: Types and Expressions   [Contents][Index]
enumAn interface or component can specify a user defined enumerated type. Such a type has a name and a list of values.
enum   ::= "enum" identifier "{" fields "}" ";"
fields ::= identifier ("," identifier)* ","?
An example:
enum result {FALSE,TRUE,ERROR};
where enum is a keyword; this defines the enum type result
with three values.
In expressions the enum values are referred to with a dot notation:
result.FALSE.
Available enum operators are:
e1 == e2Equality of two enum expressions,
e1 != e2Inequality of two enum expressions,
v.ERRORA field-test: testing the value of an enum variable, denoted by
v.ERROR, which is shorthand for v == result.ERROR
where e1 and e2 denote enum expressions, and v an
enum variable of type result.