4.2 Literals
Name Resolution Rules
This paragraph was
deleted.
For a
name
that consists of a
character_literal,
either its expected type shall be a single character type, in which case
it is interpreted as a parameterless
function_call
that yields the corresponding value of the character type, or its expected
profile shall correspond to a parameterless function with a character
result type, in which case it is interpreted as the name of the corresponding
parameterless function declared as part of the character type's definition
(see
3.5.1). In either case, the
character_literal
denotes the
enumeration_literal_specification.
Legality Rules
This paragraph was
deleted.
Static Semantics
An integer literal is of type universal_integer.
A real literal is of type universal_real. The literal null
is of type universal_access.
Dynamic Semantics
The
evaluation of a numeric literal, or the literal
null, yields the
represented value.
The evaluation of a
string_literal
that is a
primary
yields an array value containing the value of each character of the sequence
of characters of the
string_literal,
as defined in
2.6. The bounds of this array
value are determined according to the rules for
positional_array_aggregates
(see
4.3.3), except that for a null string
literal, the upper bound is the predecessor of the lower bound.
For the evaluation
of a
string_literal
of type
T, a check is made that the value of each character of
the
string_literal
belongs to the component subtype of
T. For the evaluation of a
null string literal, a check is made that its lower bound is greater
than the lower bound of the base range of the index type.
The
exception Constraint_Error is raised if either of these checks fails.
Examples
Examples of literals:
3.14159_26536 -- a real literal
1_345 -- an integer literal
'A' -- a character literal
"Some Text" -- a string literal