Ada Reference Manual (Ada 2022) — Legal Information

# F.3.1 Picture String Formation

1/3
A well-formed picture String, or simply picture String, is a String value that conforms to the syntactic rules, composition constraints, and character replication conventions specified in this subclause.

#### Dynamic Semantics

2/1
This paragraph was deleted.
3
picture_string ::=
fixed_$_picture_string
| fixed_#_picture_string
| floating_currency_picture_string
| non_currency_picture_string
4
fixed_$_picture_string ::=
[fixed_LHS_sign] fixed_$_char {direct_insertion} [zero_suppression]
number [RHS_sign]
| [fixed_LHS_sign {direct_insertion}] [zero_suppression]
number fixed_$_char {direct_insertion} [RHS_sign]
| floating_LHS_sign number fixed_$_char {direct_insertion} [RHS_sign]
| [fixed_LHS_sign] fixed_$_char {direct_insertion}
all_zero_suppression_number {direct_insertion} [RHS_sign]
| [fixed_LHS_sign {direct_insertion}] all_zero_suppression_number {direct_insertion}
fixed_$_char {direct_insertion} [RHS_sign]
| all_sign_number {direct_insertion} fixed_$_char {direct_insertion} [RHS_sign]
5
fixed_#_picture_string ::=
[fixed_LHS_sign] single_#_currency {direct_insertion}
[zero_suppression] number [RHS_sign]
| [fixed_LHS_sign] multiple_#_currency {direct_insertion}
zero_suppression number [RHS_sign]
| [fixed_LHS_sign {direct_insertion}] [zero_suppression]
number fixed_#_currency {direct_insertion} [RHS_sign]
| floating_LHS_sign number fixed_#_currency {direct_insertion} [RHS_sign]
| [fixed_LHS_sign] single_#_currency {direct_insertion}
all_zero_suppression_number {direct_insertion} [RHS_sign]
| [fixed_LHS_sign] multiple_#_currency {direct_insertion}
all_zero_suppression_number {direct_insertion} [RHS_sign]
| [fixed_LHS_sign {direct_insertion}] all_zero_suppression_number {direct_insertion}
fixed_#_currency {direct_insertion} [RHS_sign]
| all_sign_number {direct_insertion} fixed_#_currency {direct_insertion} [RHS_sign]
6
floating_currency_picture_string ::=
[fixed_LHS_sign] {direct_insertion} floating_$_currency number [RHS_sign]
| [fixed_LHS_sign] {direct_insertion} floating_#_currency number [RHS_sign]
| [fixed_LHS_sign] {direct_insertion} all_currency_number {direct_insertion} [RHS_sign]
7
non_currency_picture_string ::=
[fixed_LHS_sign {direct_insertion}] zero_suppression number [RHS_sign]
| [floating_LHS_sign] number [RHS_sign]
| [fixed_LHS_sign {direct_insertion}] all_zero_suppression_number {direct_insertion}
[RHS_sign]
| all_sign_number {direct_insertion}
| fixed_LHS_sign direct_insertion {direct_insertion} number [RHS_sign]
8
fixed_LHS_sign ::= LHS_Sign
9
LHS_Sign ::= + | – | <
10
fixed_$_char ::= $
11
direct_insertion ::= simple_insertion
12
simple_insertion ::= _ | B | 0 | /
13
zero_suppression ::= Z {Z | context_sensitive_insertion} | fill_string
14
context_sensitive_insertion ::= simple_insertion
15
fill_string ::= * {* | context_sensitive_insertion}
16
number ::=
fore_digits [radix [aft_digits] {direct_insertion}]
| radix aft_digits {direct_insertion}
17
fore_digits ::= 9 {9 | direct_insertion}
18
aft_digits ::= {9 | direct_insertion} 9
19
radix ::= . | V
20
RHS_sign ::= + | – | > | CR | DB
21
floating_LHS_sign ::=
LHS_Sign {context_sensitive_insertion} LHS_Sign {LHS_Sign | context_sensitive_insertion}
22
single_#_currency ::= #
23
multiple_#_currency ::= ## {#}
24
fixed_#_currency ::= single_#_currency | multiple_#_currency
25
floating_$_currency ::=
$ {context_sensitive_insertion} $ {$ | context_sensitive_insertion}
26
floating_#_currency ::=
# {context_sensitive_insertion} # {# | context_sensitive_insertion}
27
all_sign_number ::= all_sign_fore [radix [all_sign_aft]] [>]
28
all_sign_fore ::=
sign_char {context_sensitive_insertion} sign_char {sign_char | context_sensitive_insertion}
29
all_sign_aft ::= {all_sign_aft_char} sign_char
all_sign_aft_char ::= sign_char | context_sensitive_insertion
30
sign_char ::= + | – | <
31
all_currency_number ::= all_currency_fore [radix [all_currency_aft]]
32
all_currency_fore ::=
currency_char {context_sensitive_insertion}
currency_char {currency_char | context_sensitive_insertion}
33
all_currency_aft ::= {all_currency_aft_char} currency_char
all_currency_aft_char ::= currency_char | context_sensitive_insertion
34
currency_char ::= $ | #
35
all_zero_suppression_number ::= all_zero_suppression_fore [ radix [all_zero_suppression_aft]]
36
all_zero_suppression_fore ::=
zero_suppression_char {zero_suppression_char | context_sensitive_insertion}
37
all_zero_suppression_aft ::= {all_zero_suppression_aft_char} zero_suppression_char
all_zero_suppression_aft_char ::= zero_suppression_char | context_sensitive_insertion
38
zero_suppression_char ::= Z | *
39
The following composition constraints apply to a picture String:
40
A floating_LHS_sign does not have occurrences of different LHS_Sign Character values.
41
If a picture String has '<' as fixed_LHS_sign, then it has '>' as RHS_sign.
42
If a picture String has '<' in a floating_LHS_sign or in an all_sign_number, then it has an occurrence of '>'.
43/1
If a picture String has '+' or '–' as fixed_LHS_sign, in a floating_LHS_sign, or in an all_sign_number, then it has no RHS_sign or '>' character.
44
An instance of all_sign_number does not have occurrences of different sign_char Character values.
45
An instance of all_currency_number does not have occurrences of different currency_char Character values.
46
An instance of all_zero_suppression_number does not have occurrences of different zero_suppression_char Character values, except for possible case differences between 'Z' and 'z'.
47
A replicable Character is a Character that, by the above rules, can occur in two consecutive positions in a picture String.
48
A Character replication is a String
49
char & '(' & spaces & count_string & ')'
50
where char is a replicable Character, spaces is a String (possibly empty) comprising only space Character values, and count_string is a String of one or more decimal digit Character values. A Character replication in a picture String has the same effect as (and is said to be equivalent to) a String comprising n consecutive occurrences of char, where n=Integer'Value(count_string).
51
An expanded picture String is a picture String containing no Character replications.
52
NOTE Although a sign to the left of the number can float, a sign to the right of the number is in a fixed position.

Ada 2005 and 2012 Editions sponsored in part by Ada-Europe