Association of properties to definitions
This module associates a boolean property NAMEUnique
to object keys. It has the value 1 if the object occurs
only once in the SYMBOL context NAMEUnique .
It has the value 0 if it occurs more than once in the NAMEUnique
context; otherwise the property is not set.
The final value of the property is
obtained by the attribute NAMEUnique.NAMEUnique , e.g.
used to issue a message indicating multiple occurrences.
(The same task can be solved using the more general module,
See Count Occurrences of Objects.)
The module is instantiated by
$/Prop/Unique.gnrc+instance=NAME +referto=KEY :inst
The role NAMERangeUnique is automatically associated to
the grammar root (see Common Aspects of Property Modules).
The multiply defined check for our running example, as explained for
the OccCnt module (see Count Occurrences of Objects), can be also achieved by:
SYMBOL MultDefChk INHERITS Unique COMPUTE
IF (NOT (THIS.Unique),
message (ERROR,
CatStrInd ("identifier is multiply defined: ",
THIS.Sym),
0, COORDREF));
END;
|