# subset

The keyword is only used in conjunction with template definition. It denotes the matching mechanism where the incoming field may contain only elements defined in the value list of subset, and may contain less. It is applicable to fields set of types only.

Related keyword:

- template

### subset(value_list)

- value_list is a comma separated list containing all the values that are permitted for the concerned field. The field must not contain elements not included in the list.

Example 1

type set of integer MySetOfType (0 .. 10);

template MySetOfType MyTemplate1 := subset (1, 2, 3);

matches any sequence of integers which contains zero or one occurrences of the numbers 1, 2 and 3 in any order and position

Example 2

template MySetOfType MyTemplate2 := subset (1, 2, ?);

matches any sequence of integers which contains zero or one occurrences of the numbers 1, 2 and a valid integer value (i.e. between 0 and 10, inclusive) in any order and position

Example 3

type record of integer RoI;

type set of integer SoI;

template RoI t_RoI1 := {1, 2, ?};

template SoI t_SoI1 := subset(all from t_RoI1);

Results in subset(1, 2, ?).

BNF definition of subset