Next: , Previous: External Values, Up: Project File Reference


5.9.7 Typed String Declaration

A `type declaration' introduces a discrete set of string literals. If a string variable is declared to have this type, its value is restricted to the given set of literals. These are the only named types in project files. A string type may only be declared at the project level, not inside a package.

    typed_string_declaration ::=
      *type* *<typed_string_>*_simple_name *is* ( string_literal {, string_literal} );

The string literals in the list are case sensitive and must all be different. They may include any graphic characters allowed in Ada, including spaces. Here is an example of a string type declaration:

    type OS is ("NT", "nt", "Unix", "GNU/Linux", "other OS");

Variables of a string type are called `typed variables'; all other variables are called `untyped variables'. Typed variables are particularly useful in case constructions, to support conditional attribute declarations. (See Case Constructions).

A string type may be referenced by its name if it has been declared in the same project file, or by an expanded name whose prefix is the name of the project in which it is declared.