Contents
Up
Previous
Next


Enumeration types


An object of an enumeration type may take on a small number of values with explicit names. The definition of an enumeration type is just a list of named values that an object of that type can have. The grammar rule for the enumeration type definition is:
literal : simple-name | character
enumeration-type-definition : "(" literal {"," literal} ")"

Characters are typed in single quotes. For example, '$' is a character. All of the literals in the definition must be unique. The literals are represented internally by numbers indicating their position in the list. There are attributes described later that allow you to retrieve the position number of an enumeration literal and the literal to the left or right of a particular literal. The boolean character and bit types are enumeration types. Their definitions are
type boolean is (false,true); 
type bit is ('0','1');
type character is (
  NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS, HT, LF, VT,
  FF, CR, SO, SI, DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, 
  CAN, EM, SUB, ESC, FSP, GSP, RSP, USP, ' ', '!', '"', '#',
  '$', '%', '&', ''', '(', ')', '*', '+', ',', '-', '.', '/',
  '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
  '<', '=', '>', '?', '@', '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', '[', '\', ']', '^', '_',
  '`', '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', '{', '|', '}', '~', DEL);