Set constructors

Description

Set constructors are used in expressions to create values of set types, and contain comma-delimited lists of zero or more member designators. Member designators specify set elements which are present, and contain a single ordinal expression, or a pair of ordinal expressions. If the member designator contains a single ordinal expression, them the value of this expression is the set element that is present. If the member designator contains a pair of ordinal expressions, then the member designator specifies a range of set elements that are present, and the value of the first ordinal expression is the first set element in the range, and the value of the second ordinal expression is the last set element in the range.

A set constructor with no member designators is valid and denotes the empty set (i.e. no set elements are present).

Example

Here are some examples of set constructors:

   [] - the empty set
   [true] - set of boolean with only true present
   ['a'..'z','A'..'Z'] - set of char with all the lowercase and uppercase letters present

Syntax

(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

   set-constructor = '[' [ member-designator { ',' member-designator } ] ']'

   member-designator = ordinal-expression [ '..' ordinal-expression ]

   ordinal-expression = expression