Titan



length


The keyword is used for sub-typing, i.e., to create user defined types by constraining the range of possible values of the basic type. Its usage is twofold :

The length boundaries are based on different units depending on the string type with which they are used. (Bits for bitstrings, characters for characterstrings etc.) 
When a single integer value is given, it constraints the length of the type in question. 
When two integer values are given (separated by two dots), both the minimal and the maximal lengths are constrained.
The keyword infinity may be used to indicate that the upper limit is not given.

Related keywords:


length()


Example 1:

type charstring Pulnoc length (8);
var Pulnoc c_pulnoc;

The number of characters c_pulnoc can hold is exactly eight.


Example 2:

type bitstring Amari length (2..5);

The value domain of type Amari is restricted to bitstring values with length not less than two and not more than five bits.


Example 3:

type record length(7) of integer Egeeszek;

Type Egeeszek is capable of holding exactly seven integers ordered lists.



BNF definition of length