| 1 |
@Part(02, Root="ada.mss") |
| 2 |
|
| 3 |
@Comment{$Date: 2012/11/28 23:53:02 $} |
| 4 |
@LabeledSection{Lexical Elements} |
| 5 |
|
| 6 |
@Comment{$Source: e:\\cvsroot/ARM/Source/02.mss,v $} |
| 7 |
@Comment{$Revision: 1.85 $} |
| 8 |
|
| 9 |
@begin{Intro} |
| 10 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 11 |
@redundant[The text of a program consists of the texts of one or more |
| 12 |
@nt<compilation>s. The text of a @nt<compilation> is a sequence of |
| 13 |
lexical elements, each composed of characters; the rules of |
| 14 |
composition are given in this @Chg{Version=[3],New=[clause],Old=[section]}. |
| 15 |
@nt{Pragma}s, which provide certain information for the compiler, are also |
| 16 |
described in this @Chg{Version=[3],New=[clause],Old=[section]}.] |
| 17 |
@end{Intro} |
| 18 |
|
| 19 |
@LabeledClause{Character Set} |
| 20 |
|
| 21 |
@begin{Intro} |
| 22 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 23 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0266-1]} |
| 24 |
@Defn{character set} |
| 25 |
The @Chg{Version=[2],New=[character repertoire for the text of an Ada |
| 26 |
program consists of the |
| 27 |
entire coding space described by the ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]} |
| 28 |
Universal |
| 29 |
Multiple-Octet Coded Character Set. This coding space is organized in |
| 30 |
@i<planes>, each plane comprising 65536 characters.@Defn2{Term=[plane],Sec=[character]} |
| 31 |
@Defn{character plane}],Old=[only characters |
| 32 |
allowed outside of @nt{comment}s are the @nt{graphic_character}s and |
| 33 |
@ntf{format_effector}s.]} |
| 34 |
|
| 35 |
@begin{Ramification} |
| 36 |
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]} |
| 37 |
@ChgDeleted{Version=[2],Text=[Any character, including an |
| 38 |
@ntf<other_control_function>, is allowed in a comment.]} |
| 39 |
|
| 40 |
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]}@ChgNote{Moved below} |
| 41 |
@ChgDeleted{Version=[2],Text=[Note that this rule doesn't really have much |
| 42 |
force, since the implementation can represent characters in the source in any |
| 43 |
way it sees fit. |
| 44 |
For example, an implementation could simply define that what seems to be |
| 45 |
a nongraphic, non-format-effector character is actually a |
| 46 |
representation of the space character.]} |
| 47 |
@end{Ramification} |
| 48 |
@begin(Discussion) |
| 49 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 50 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0266-1]} |
| 51 |
It is our intent to follow the terminology of |
| 52 |
@Chg{Version=[2],New=[ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]}],Old=[ISO 10646 BMP]} where |
| 53 |
appropriate, and to remain compatible with the character |
| 54 |
classifications defined in @RefSec{Character Handling}.@Chg{Version=[2], |
| 55 |
New=[],Old=[Note that our definition for |
| 56 |
@nt<graphic_character> is more inclusive than that of ISO 10646-1.]} |
| 57 |
@end(Discussion) |
| 58 |
@end{Intro} |
| 59 |
|
| 60 |
@begin{Syntax} |
| 61 |
@begin{NotIso} |
| 62 |
@ChgAdded{Version=[2],Noparanum=[T],Text=[@Shrink{@i<Paragraphs 2 and 3 |
| 63 |
were deleted.>}]}@Comment{This message should be |
| 64 |
deleted if the paragraphs are ever renumbered.} |
| 65 |
@end{NotIso} |
| 66 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg],ARef=[AI95-00285-01]} |
| 67 |
@DeletedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<>,Old=<character>}>, |
| 68 |
rhs="@Chg{Version=[2],New=<>,Old=<@Syn2{graphic_character} | @Synf{format_effector} | @Synf{other_control_function}>}"} |
| 69 |
|
| 70 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg],ARef=[AI95-00285-01]} |
| 71 |
@DeletedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<>,Old=<graphic_character>}>, |
| 72 |
rhs="@Chg{Version=[2],New=<>,Old=<@Synf{identifier_letter} | @Synf{digit} | @Synf{space_character} | @Synf{special_character}>}"} |
| 73 |
|
| 74 |
@begin{SyntaxText} |
| 75 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 76 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0266-1]} |
| 77 |
@ChgAdded{Version=[2],Text=[A @ntf{character} is defined by this International |
| 78 |
Standard for each cell in the coding space described by ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]}, |
| 79 |
regardless of whether or not ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]} allocates a character to that |
| 80 |
cell.]} |
| 81 |
@end{SyntaxText} |
| 82 |
@end{Syntax} |
| 83 |
|
| 84 |
@begin{StaticSem} |
| 85 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 86 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0079-1],ARef=[AI05-0262-1],ARef=[AI05-0266-1]} |
| 87 |
The@Chg{Version=[2],New=[],Old=[ character repertoire for the text of |
| 88 |
an Ada program consists of the |
| 89 |
collection of characters |
| 90 |
@Chg{Version=[2],New=[described by the ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]}], |
| 91 |
Old=[called the Basic Multilingual Plane (BMP) of the |
| 92 |
ISO 10646]} Universal Multiple-Octet Coded Character Set, plus a set |
| 93 |
of @ntf<format_effector>s and, in comments only, |
| 94 |
a set of @ntf<other_control_function>s; the]} coded representation for |
| 95 |
@Chg{Version=[2],New=[],Old=[these ]}characters is implementation defined |
| 96 |
@Redundant[(it need not be a |
| 97 |
representation defined within @Chg{Version=[2],New=[ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]}], |
| 98 |
Old=[ISO-10646-1]})].@Chg{Version=[2],New=[ A character whose relative |
| 99 |
code @Chg{Version=[3],New=[point],Old=[position]} in its plane |
| 100 |
is 16#FFFE# or 16#FFFF# is not allowed anywhere |
| 101 |
in the text of a program.],Old=[]}@Chg{Version=[3],New=[ The only |
| 102 |
characters allowed outside of comments are those in categories |
| 103 |
@ntf{other_format}, @ntf{format_effector}, and @ntf{graphic_character}.],Old=[]} |
| 104 |
@ImplDef{The coded representation for the text of an Ada program.} |
| 105 |
|
| 106 |
@begin{Ramification}@ChgNote{Moved from above} |
| 107 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 108 |
@ChgAdded{Version=[2],Text=[Note that this rule doesn't really have |
| 109 |
much force, since the implementation can represent characters in the |
| 110 |
source in any way it sees fit. |
| 111 |
For example, an implementation could simply define that what seems to be |
| 112 |
an @ntf{other_private_use} character is actually a |
| 113 |
representation of the space character.]} |
| 114 |
@end{Ramification} |
| 115 |
|
| 116 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 117 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0266-1],ARef=[AI05-0299-1]} |
| 118 |
@ChgAdded{Version=[2],Text=[The semantics of an Ada program whose text is not |
| 119 |
in Normalization Form KC (as defined by @Chg{Version=[3],New=[Clause 21],Old=[section 24]} |
| 120 |
of ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]}) |
| 121 |
is implementation defined.]} |
| 122 |
@ChgImplDef{Version=[2],Kind=[AddedNormal],Text=[@ChgAdded{Version=[2],Text=[The |
| 123 |
semantics of an Ada program whose text is not in Normalization Form KC.]}]} |
| 124 |
|
| 125 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 126 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0266-1],ARef=[AI05-0299-1]} |
| 127 |
The description of the |
| 128 |
language definition in this International Standard uses the @Chg{Version=[2], |
| 129 |
New=[character properties General Category, Simple Uppercase Mapping, |
| 130 |
Uppercase Mapping, and Special Case Condition of the documents referenced by |
| 131 |
the note in @Chg{Version=[3],New=[Clause],Old=[section]} 1 of ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]}],Old=[graphic symbols |
| 132 |
defined for Row 00: Basic Latin and Row 00: Latin-1 Supplement |
| 133 |
of the ISO 10646 BMP; these correspond to the graphic symbols of |
| 134 |
ISO 8859-1 (Latin-1); no graphic symbols are used in this International Standard for |
| 135 |
characters outside of Row 00 of the BMP]}. |
| 136 |
The actual set of graphic symbols used by an implementation |
| 137 |
for the visual representation of |
| 138 |
the text of an Ada program is not specified. |
| 139 |
@PDefn{unspecified} |
| 140 |
|
| 141 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 142 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0266-1]} |
| 143 |
@Leading@keepnext@;@Chg{Version=[2],New=[Characters],Old=[The categories of |
| 144 |
characters]} are @Chg{Version=[2],New=[categorized],Old=[defined]} as follows: |
| 145 |
@begin{Discussion} |
| 146 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 147 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0005-1],ARef=[AI05-0262-1],ARef=[AI05-0266-1]} |
| 148 |
@ChgAdded{Version=[2],Text=[Our character classification considers that the |
| 149 |
cells not allocated in ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]} are graphic characters, except for |
| 150 |
those whose relative code @Chg{Version=[3],New=[point],Old=[position]} |
| 151 |
in their plane is 16#FFFE# or 16#FFFF#. This |
| 152 |
seems to provide the best compatibility with future versions of ISO/IEC 10646, |
| 153 |
as future characters can @Chg{Version=[3],New=[],Old=[be ]}already be |
| 154 |
used in Ada character and string literals.]} |
| 155 |
@end{Discussion} |
| 156 |
@begin{Description} |
| 157 |
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]} |
| 158 |
@ChgDeleted{Version=[2],Text=[@Defn{identifier_letter}@ntf<identifier_letter>@\@ntf{upper_case_identifier_letter} | @ntf{lower_case_identifier_letter}]} |
| 159 |
@begin{Discussion} |
| 160 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg]} |
| 161 |
@ChgDeleted{Version=[2],Text=[We use @ntf<identifier_letter> |
| 162 |
instead of simply @ntf<letter> because |
| 163 |
ISO 10646 BMP includes many other characters that would generally |
| 164 |
be considered "letters."]} |
| 165 |
@end{Discussion} |
| 166 |
|
| 167 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 168 |
@Chg{Version=[2],New=[@Defn{letter_uppercase}@ntf{letter_uppercase}], |
| 169 |
Old=[@Defn{upper_case_identifier_letter}@ntf<upper_case_identifier_letter>]}@\Any |
| 170 |
character @Chg{Version=[2],New=[whose General Category is defined |
| 171 |
to be @lquotes@;Letter, Uppercase@rquotes@;], |
| 172 |
Old=[of Row 00 of ISO 10646 BMP whose name begins |
| 173 |
@lquotes@;Latin Capital Letter@rquotes@;]}. |
| 174 |
|
| 175 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 176 |
@Chg{Version=[2],New=[@Defn{letter_lowercase}@ntf{letter_lowercase}], |
| 177 |
Old=[@Defn{lower_case_identifier_letter}@ntf<lower_case_identifier_letter>]}@\Any |
| 178 |
character @Chg{Version=[2],New=[whose General Category is defined |
| 179 |
to be @lquotes@;Letter, Lowercase@rquotes@;], |
| 180 |
Old=[of Row 00 of ISO 10646 BMP whose name begins |
| 181 |
@lquotes@;Latin Small Letter@rquotes@;]}. |
| 182 |
@begin{Honest} |
| 183 |
@ChgRef{Version=[1],Kind=[Deleted],Ref=[8652/0001],ARef=[AI95-00124-01]} |
| 184 |
@Comment{The change in subclause 1.3 for 8652/0001 handles this problem.} |
| 185 |
@ChgDeleted{Version=[1],Text=[The above rules do not include the ligatures |
| 186 |
@latin1(198) and @latin1(230). |
| 187 |
However, the intent is to include these characters as identifier letters. |
| 188 |
This problem was pointed out by a comment from the Netherlands.]} |
| 189 |
@end{Honest} |
| 190 |
|
| 191 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 192 |
@ChgAdded{Version=[2],Text=[@Defn{letter_titlecase}@ntf{letter_titlecase}@\Any |
| 193 |
character whose General Category is defined to be @lquotes@;Letter, Titlecase@rquotes@;.]} |
| 194 |
|
| 195 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 196 |
@ChgAdded{Version=[2],Text=[@Defn{letter_modifier}@ntf{letter_modifier}@\Any |
| 197 |
character whose General Category is defined to be @lquotes@;Letter, Modifier@rquotes@;.]} |
| 198 |
|
| 199 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 200 |
@ChgAdded{Version=[2],Text=[@Defn{letter_other}@ntf{letter_other}@\Any |
| 201 |
character whose General Category is defined to be @lquotes@;Letter, Other@rquotes@;.]} |
| 202 |
|
| 203 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 204 |
@ChgAdded{Version=[2],Text=[@Defn{mark_non_spacing}@ntf{mark_non_spacing}@\Any |
| 205 |
character whose General Category is defined to be @lquotes@;Mark, Non-Spacing@rquotes@;.]} |
| 206 |
|
| 207 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 208 |
@ChgAdded{Version=[2],Text=[@Defn{mark_non_spacing}@ntf{mark_spacing_combining}@\Any |
| 209 |
character whose General Category is defined to be @lquotes@;Mark, Spacing Combining@rquotes@;.]} |
| 210 |
|
| 211 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 212 |
@Chg{Version=[2],New=[@Defn{number_decimal}@ntf{number_decimal}], |
| 213 |
Old=[@Defn{digit}@nt{digit}]}@\@Chg{Version=[2],New=[Any |
| 214 |
character whose General Category is defined |
| 215 |
to be @lquotes@;Number, Decimal@rquotes@;], |
| 216 |
Old=[One of the characters 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9]}. |
| 217 |
|
| 218 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 219 |
@ChgAdded{Version=[2],Text=[@Defn{number_letter}@ntf{number_letter}@\Any |
| 220 |
character whose General Category is defined to be @lquotes@;Number, Letter@rquotes@;.]} |
| 221 |
|
| 222 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 223 |
@ChgAdded{Version=[2],Text=[@Defn{punctuation_connector}@ntf{punctuation_connector}@\Any |
| 224 |
character whose General Category is defined to be @lquotes@;Punctuation, Connector@rquotes@;.]} |
| 225 |
|
| 226 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 227 |
@ChgAdded{Version=[2],Text=[@Defn{other_format}@ntf{other_format}@\Any |
| 228 |
character whose General Category is defined to be @lquotes@;Other, Format@rquotes@;.]} |
| 229 |
|
| 230 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 231 |
@Chg{Version=[2],New=[@Defn{separator_space}@ntf<separator_space>], |
| 232 |
Old=[@Defn{space_character}@ntf{space_character}]}@\@Chg{Version=[2],New=[Any |
| 233 |
character whose General Category is defined to be @lquotes@;Separator, |
| 234 |
Space@rquotes@;.],Old=[The character of ISO 10646 BMP named |
| 235 |
@lquotes@;Space@rquotes@;.]} |
| 236 |
|
| 237 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 238 |
@Chg{Version=[2],New=[@Defn{separator_line}@ntf{separator_line}], |
| 239 |
Old=[@Defn{special_character}@ntf{special_character}]}@\Any character |
| 240 |
@Chg{Version=[2],New=[whose General Category is defined to be |
| 241 |
@lquotes@;Separator, Line@rquotes@;.], |
| 242 |
Old=[of the ISO 10646 BMP that is not reserved for a control function, and |
| 243 |
is not the @ntf<space_character>, an @ntf<identifier_letter>, or a @ntf<digit>.]} |
| 244 |
@begin{Ramification} |
| 245 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg]} |
| 246 |
@ChgDeleted{Version=[2],Text=[Note that the no break space and soft hyphen |
| 247 |
are @ntf<special_character>s, |
| 248 |
and therefore @nt<graphic_character>s. |
| 249 |
They are not the same characters as space and hyphen-minus.]} |
| 250 |
@end{Ramification} |
| 251 |
|
| 252 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 253 |
@ChgAdded{Version=[2],Text=[@Defn{separator_paragraph}@ntf{separator_paragraph}@\Any |
| 254 |
character whose General Category is defined to be @lquotes@;Separator, Paragraph@rquotes@;.]} |
| 255 |
|
| 256 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 257 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0262-1]} |
| 258 |
@Defn{format_effector}@ntf<format_effector>@\The |
| 259 |
@Chg{Version=[2],New=[characters whose code @Chg{Version=[3],New=[points],Old=[positions]} are |
| 260 |
16#09# (CHARACTER TABULATION), 16#0A# (LINE FEED), 16#0B# (LINE TABULATION), |
| 261 |
16#0C# (FORM FEED), 16#0D# (CARRIAGE RETURN), 16#85# (NEXT LINE), |
| 262 |
and the characters in categories @ntf{separator_line} and |
| 263 |
@ntf{separator_paragraph}], |
| 264 |
Old=[control functions of ISO 6429 called |
| 265 |
character tabulation (HT), line tabulation (VT), carriage return (CR), |
| 266 |
line feed (LF), and form feed (FF)]}. |
| 267 |
@IndexSeeAlso{Term=[control character],See=(format_effector)} |
| 268 |
|
| 269 |
@begin{Discussion} |
| 270 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 271 |
@ChgAdded{Version=[2],Text=[ISO/IEC 10646:2003 does not define the names |
| 272 |
of control characters, but rather refers to the names defined by |
| 273 |
ISO/IEC 6429:1992. These are the names that we use |
| 274 |
here.@Comment{10646:2011 gives a list of the long names from 6429:1992, |
| 275 |
so I'm not sure the above is true anymore. Best leave the old reference.}]} |
| 276 |
@end{Discussion} |
| 277 |
|
| 278 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 279 |
@ChgAdded{Version=[2],Text=[@Defn{other_control}@ntf{other_control}@\Any |
| 280 |
character whose General Category is defined |
| 281 |
to be @lquotes@;Other, Control@rquotes@;, and which is not defined to be a |
| 282 |
@ntf<format_effector>.]} |
| 283 |
|
| 284 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 285 |
@ChgAdded{Version=[2],Text=[@Defn{other_private_use}@ntf{other_private_use}@\Any |
| 286 |
character whose General Category is defined to be @lquotes@;Other, Private Use@rquotes@;.]} |
| 287 |
|
| 288 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 289 |
@ChgAdded{Version=[2],Text=[@Defn{other_surrogate}@ntf{other_surrogate}@\Any |
| 290 |
character whose General Category is defined to be @lquotes@;Other, Surrogate@rquotes@;.]} |
| 291 |
|
| 292 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 293 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0262-1]} |
| 294 |
@Chg{Version=[2],New=[@Defn{graphic_character}@ntf{graphic_character}], |
| 295 |
Old=[@Defn{other_control_function}@ntf<other_control_function>]}@\@Chg{Version=[2], |
| 296 |
New=[Any character that is not in the categories @ntf{other_control}, |
| 297 |
@ntf{other_private_use}, @ntf{other_surrogate}, |
| 298 |
@ntf{format_effector}, and whose relative code |
| 299 |
@Chg{Version=[3],New=[point],Old=[position]} in its plane is neither |
| 300 |
16#FFFE# nor 16#FFFF#.], |
| 301 |
Old=[Any control function, |
| 302 |
other than a @ntf<format_effector>, that is allowed in a comment; the set of |
| 303 |
@ntf<other_control_function>s allowed in comments is implementation defined. |
| 304 |
@IndexSeeAlso{Term=[control character],See=(other_control_function)}]} |
| 305 |
@ChgImplDef{Version=[2],Kind=[Deleted],InitialVersion=[0], |
| 306 |
Text=[@ChgDeleted{Version=[2],Text=[The control functions allowed in comments.]}]} |
| 307 |
|
| 308 |
@begin{Discussion} |
| 309 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 310 |
@ChgAdded{Version=[2],Text=`We considered basing the definition of |
| 311 |
lexical elements on Annex A of ISO/IEC |
| 312 |
TR 10176 (4th edition), which lists the characters which should be supported in |
| 313 |
identifiers for all programming languages, but we finally decided against this |
| 314 |
option. Note that it is not our intent to diverge from ISO/IEC TR 10176, |
| 315 |
except to the extent that ISO/IEC TR 10176 itself diverges from ISO/IEC |
| 316 |
10646:2003 (which is the case at the time of this writing [January 2005]).'} |
| 317 |
|
| 318 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 319 |
@ChgAdded{Version=[2],Type=[Leading],Text=[More precisely, we intend to align |
| 320 |
strictly with ISO/IEC 10646:2003. It must be |
| 321 |
noted that ISO/IEC TR 10176 is a Technical Report while ISO/IEC 10646:2003 is a |
| 322 |
Standard. If one has to make a choice, one should conform with the Standard |
| 323 |
rather than with the Technical Report. And, it turns out that one @i<must> |
| 324 |
make a choice because there are important differences between the two:]} |
| 325 |
|
| 326 |
@begin{Itemize} |
| 327 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 328 |
@ChgAdded{Version=[2],Text=[ISO/IEC TR 10176 is still based on |
| 329 |
ISO/IEC 10646:2000 while ISO/IEC 10646:2003 has already been published |
| 330 |
for a year. We cannot afford to delay |
| 331 |
the adoption of our amendment until ISO/IEC TR 10176 has been revised.]} |
| 332 |
|
| 333 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 334 |
@ChgAdded{Version=[2],Text=[There are considerable differences between the |
| 335 |
two editions of ISO/IEC 10646, |
| 336 |
notably in supporting characters beyond the BMP (this might be significant for |
| 337 |
some languages, e.g. Korean).]} |
| 338 |
|
| 339 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 340 |
@ChgAdded{Version=[2],Text=[ISO/IEC TR 10176 does not define case conversion |
| 341 |
tables, which are essential |
| 342 |
for a case-insensitive language like Ada. To get case conversion tables, we |
| 343 |
would have to reference either ISO/IEC 10646:2003 or Unicode, or we would have |
| 344 |
to invent our own.]} |
| 345 |
@end{Itemize} |
| 346 |
|
| 347 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 348 |
@ChgAdded{Version=[2],Type=[Leading],Text=[For the purpose of defining the |
| 349 |
lexical elements of the language, we need |
| 350 |
character properties like categorization, as well as case conversion tables. |
| 351 |
These are mentioned in ISO/IEC 10646:2003 as useful for implementations, with a |
| 352 |
reference to Unicode. Machine-readable tables are available on the web at URLs:]} |
| 353 |
@begin{Example} |
| 354 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 355 |
@ChgAdded{Version=[2],Text=[@URLLink{URL=[http://www.unicode.org/Public/4.0-Update/UnicodeData-4.0.0.txt], |
| 356 |
Text=[http://www.unicode.org/Public/4.0-Update/UnicodeData-4.0.0.txt]} |
| 357 |
@URLLink{URL=[http://www.unicode.org/Public/4.0-Update/CaseFolding-4.0.0.txt], |
| 358 |
Text=[http://www.unicode.org/Public/4.0-Update/CaseFolding-4.0.0.txt]}]} |
| 359 |
@end{Example} |
| 360 |
|
| 361 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 362 |
@ChgAdded{Version=[2],Type=[Leading],Text=[with an explanatory document found at URL:]} |
| 363 |
@begin{Example} |
| 364 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 365 |
@ChgAdded{Version=[2],Text=[@URLLink{URL=[http://www.unicode.org/Public/4.0-Update/UCD-4.0.0.html], |
| 366 |
Text=[http://www.unicode.org/Public/4.0-Update/UCD-4.0.0.html]}]} |
| 367 |
@end{Example} |
| 368 |
|
| 369 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 370 |
@ChgAdded{Version=[2],Text=[The actual text of the standard only makes |
| 371 |
specific references to the |
| 372 |
corresponding clauses of ISO/IEC 10646:2003, not to Unicode.]} |
| 373 |
|
| 374 |
@end{Discussion} |
| 375 |
@end{Description} |
| 376 |
|
| 377 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 378 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0266-1]} |
| 379 |
@Leading@Chg{Version=[2],New=[],Old=[@Defn{names of @ntf{special_character}s} |
| 380 |
@Defn2{Term=[special_character],Sec=(names)}]}The |
| 381 |
following names are used when referring to certain |
| 382 |
@Chg{Version=[2],New=[characters (the first name is that given in |
| 383 |
ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]})],Old=[@ntf{special_character}s]}: |
| 384 |
@Defn{quotation mark} |
| 385 |
@Defn{number sign} |
| 386 |
@Defn{ampersand} |
| 387 |
@Defn{apostrophe} |
| 388 |
@Defn{tick} |
| 389 |
@Defn{left parenthesis} |
| 390 |
@Defn{right parenthesis} |
| 391 |
@Defn{asterisk} |
| 392 |
@Defn{multiply} |
| 393 |
@Defn{plus sign} |
| 394 |
@Defn{comma} |
| 395 |
@Defn{hyphen-minus} |
| 396 |
@Defn{minus} |
| 397 |
@Defn{full stop} |
| 398 |
@Defn{dot} |
| 399 |
@Defn{point} |
| 400 |
@Defn{solidus} |
| 401 |
@Defn{divide} |
| 402 |
@Defn{colon} |
| 403 |
@Defn{semicolon} |
| 404 |
@Defn{less-than sign} |
| 405 |
@Defn{equals sign} |
| 406 |
@Defn{greater-than sign} |
| 407 |
@Defn{low line} |
| 408 |
@Defn{underline} |
| 409 |
@Defn{vertical line} |
| 410 |
@Chg{Version=[2],New=[@Defn{exclamation point} |
| 411 |
@Defn{percent sign}], |
| 412 |
Old=[@Defn{left square bracket} |
| 413 |
@Defn{right square bracket} |
| 414 |
@Defn{left curly bracket} |
| 415 |
@Defn{right curly bracket}]} |
| 416 |
@begin{Discussion} |
| 417 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 418 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0266-1]} |
| 419 |
@Chg{Version=[2],New=[@Defn{graphic symbols}@Defn{glyphs}This table |
| 420 |
serves to show the correspondence between |
| 421 |
ISO/IEC 10646:@Chg{Version=[3],New=[2011],Old=[2003]} names and the graphic symbols (glyphs) used in this |
| 422 |
International Standard. These are the characters], |
| 423 |
Old=[These are the ones]} |
| 424 |
that play a special role in the syntax of Ada@Chg{Version=[2],New=[], |
| 425 |
Old=[ 95, or in the syntax rules; |
| 426 |
we don't bother to define names for all characters. |
| 427 |
The first name given is the name from ISO 10646-1; the subsequent |
| 428 |
names, if any, are those used within the |
| 429 |
standard, depending on context]}. |
| 430 |
@end{Discussion} |
| 431 |
@Comment{The original version follows here (commented out) |
| 432 |
@begin{Display} |
| 433 |
@TabClear()@TabSet(P9) |
| 434 |
@begin(TwoCol) |
| 435 |
@NoParanum@;symbol @\name |
| 436 |
|
| 437 |
@NoParanum@; " @\quotation mark |
| 438 |
# @\number sign |
| 439 |
& @\ampersand |
| 440 |
' @\apostrophe, tick |
| 441 |
( @\left parenthesis |
| 442 |
) @\right parenthesis |
| 443 |
* @\asterisk, multiply |
| 444 |
+ @\plus sign |
| 445 |
, @\comma |
| 446 |
@en@; @\hyphen-minus, minus |
| 447 |
. @\full stop, dot, point |
| 448 |
/ @\solidus, divide |
| 449 |
@NewColumn |
| 450 |
@NoParanum@;symbol @\name |
| 451 |
|
| 452 |
@NoParanum@; : @\colon |
| 453 |
; @\semicolon |
| 454 |
< @\less-than sign |
| 455 |
= @\equals sign |
| 456 |
> @\greater-than sign |
| 457 |
_ @\low line, underline |
| 458 |
| @\vertical line |
| 459 |
[ @\left square bracket |
| 460 |
] @\right square bracket |
| 461 |
{ @\left curly bracket |
| 462 |
} @\right curly bracket |
| 463 |
@end(TwoCol) |
| 464 |
@end{Display}} |
| 465 |
@Comment{We use this (weird) four column version to make the HTML look much better. |
| 466 |
WARNING: The items that go together are in separate columns!!} |
| 467 |
@begin(FourCol) |
| 468 |
@NoParanum@;@ @ @Chg{Version=[2],New=[graphic ],Old=[@ @ @ @ ]}symbol |
| 469 |
|
| 470 |
@NoParanum@;@ @ @ @ @ @ @ @ @ "@* |
| 471 |
@ @ @ @ @ @ @ @ @ #@* |
| 472 |
@ @ @ @ @ @ @ @ @ &@* |
| 473 |
@ @ @ @ @ @ @ @ @ '@* |
| 474 |
@ @ @ @ @ @ @ @ @ (@* |
| 475 |
@ @ @ @ @ @ @ @ @ )@* |
| 476 |
@ @ @ @ @ @ @ @ @ *@* |
| 477 |
@ @ @ @ @ @ @ @ @ +@* |
| 478 |
@ @ @ @ @ @ @ @ @ ,@* |
| 479 |
@ @ @ @ @ @ @ @ @ @en@;@* |
| 480 |
@ @ @ @ @ @ @ @ @ .@Chg{Version=[2],New=[],Old=[@*]}@Chg{Version=[2],New=[],Old=[@ @ @ @ @ @ @ @ @ /]}@ChgNote{Funny layout so HTML and RTF look right} |
| 481 |
@NewColumn |
| 482 |
@NoParanum@;name |
| 483 |
|
| 484 |
@NoParanum@;quotation mark@* |
| 485 |
number sign@* |
| 486 |
ampersand@* |
| 487 |
apostrophe, tick@* |
| 488 |
left parenthesis@* |
| 489 |
right parenthesis@* |
| 490 |
asterisk, multiply@* |
| 491 |
plus sign@* |
| 492 |
comma@* |
| 493 |
hyphen-minus, minus@* |
| 494 |
full stop, dot, point@Chg{Version=[2],New=[],Old=[@*]}@Chg{Version=[2],New=[],Old=[solidus, divide]}@ChgNote{Funny layout so HTML and RTF look right} |
| 495 |
|
| 496 |
@NewColumn |
| 497 |
@NoParanum@;@ @ @Chg{Version=[2],New=[graphic ],Old=[@ @ @ @ ]}symbol |
| 498 |
|
| 499 |
@NoParanum@;@ @ @ @ @ @ @ @ @ :@* |
| 500 |
@ @ @ @ @ @ @ @ @ ;@* |
| 501 |
@ @ @ @ @ @ @ @ @ <@* |
| 502 |
@ @ @ @ @ @ @ @ @ =@* |
| 503 |
@ @ @ @ @ @ @ @ @ >@* |
| 504 |
@ @ @ @ @ @ @ @ @ _@* |
| 505 |
@ @ @ @ @ @ @ @ @ |@* |
| 506 |
@ @ @ @ @ @ @ @ @ @Chg{Version=[2],New=[/],Old=<[>}@* |
| 507 |
@ @ @ @ @ @ @ @ @ @Chg{Version=[2],New=[!],Old=<]>}@* |
| 508 |
@ @ @ @ @ @ @ @ @ @Chg<Version=[2],New=[%],Old=<{>>@* |
| 509 |
@Chg<Version=[2],New=[],Old=<@ @ @ @ @ @ @ @ @ }>> |
| 510 |
@NewColumn |
| 511 |
@NoParanum@;name |
| 512 |
|
| 513 |
@NoParanum@;colon@* |
| 514 |
semicolon@* |
| 515 |
less-than sign@* |
| 516 |
equals sign@* |
| 517 |
greater-than sign@* |
| 518 |
low line, underline@* |
| 519 |
vertical line@* |
| 520 |
@Chg{Version=[2],New=[solidus, divide],Old=[left square bracket]}@* |
| 521 |
@Chg{Version=[2],New=[exclamation point],Old=[right square bracket]}@* |
| 522 |
@Chg{Version=[2],New=[percent sign],Old=[left curly bracket]}@* |
| 523 |
@Chg{Version=[2],New=[],Old=[right curly bracket]} |
| 524 |
@end(FourCol) |
| 525 |
@end{StaticSem} |
| 526 |
|
| 527 |
@begin{ImplReq} |
| 528 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0286-1]} |
| 529 |
@ChgAdded{Version=[3],Text=[An Ada implementation shall accept Ada source code |
| 530 |
in UTF-8 encoding, with or without a BOM (see @RefSecNum{String Encoding}), |
| 531 |
where every character is represented by its code point. The character pair |
| 532 |
CARRIAGE RETURN/LINE FEED (code points 16#0D# 16#0A#) signifies a single end of |
| 533 |
line (see @RefSecNum{Lexical Elements, Separators, and Delimiters}); every other |
| 534 |
occurrence of a @ntf{format_effector} other than the character whose code point |
| 535 |
position is 16#09# (CHARACTER TABULATION) also signifies a single end of line.]} |
| 536 |
|
| 537 |
@begin{Reason} |
| 538 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0079-1],ARef=[AI05-0286-1]} |
| 539 |
@ChgAdded{Version=[3],Text=[This is simply requiring that an Ada implementation |
| 540 |
be able to directly process the ACATS, which is provided in the described |
| 541 |
format. Note that files that only contain characters with code points in the |
| 542 |
first 128 (which is the majority of the ACATS) are represented in the same way |
| 543 |
in both UTF-8 and in "plain" string format. The ACATS includes a BOM in files |
| 544 |
that have any characters with code points greater than 127. Note that the BOM |
| 545 |
contains characters not legal in Ada source code, so an implementation can use |
| 546 |
that to automatically distinguish between files formatted as plain Latin-1 |
| 547 |
strings and UTF-8 with BOM.]} |
| 548 |
|
| 549 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 550 |
@ChgAdded{Version=[3],Text=[We allow line endings to be both represented as the |
| 551 |
pair CR LF (as in Windows and the ACATS), and as single @ntf{format_effector} |
| 552 |
characters (usually LF, as in Linux), in order that files created by standard |
| 553 |
tools on most operating systems will meet the standard format. We specify how |
| 554 |
many line endings each represent so that compilers use the same line numbering |
| 555 |
for standard source files.]} |
| 556 |
|
| 557 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 558 |
@ChgAdded{Version=[3],Text=[This requirement increases portability by having a |
| 559 |
format that is accepted by all Ada compilers. Note that implementations can |
| 560 |
support other source representations, including structured representations like |
| 561 |
a parse tree.]} |
| 562 |
|
| 563 |
@end{Reason} |
| 564 |
@end{ImplReq} |
| 565 |
|
| 566 |
@begin{ImplPerm} |
| 567 |
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]} |
| 568 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0266-1]} |
| 569 |
@Chg{Version=[3],New=[The categories defined above, as well as case mapping and |
| 570 |
folding, may be based on an implementation-defined version of ISO/IEC 10646 |
| 571 |
(2003 edition or later).],Old=[@Chg{Version=[2],New=[],Old=[In a nonstandard |
| 572 |
mode, the implementation may support a different character |
| 573 |
repertoire@Redundant[; in particular, |
| 574 |
the set of characters that are considered @ntf<identifier_letter>s |
| 575 |
can be extended |
| 576 |
or changed to conform to local conventions].]}]} |
| 577 |
@begin{Ramification} |
| 578 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg]} |
| 579 |
@ChgDeleted{Version=[2],Text=[If an implementation supports |
| 580 |
other character sets, |
| 581 |
it defines which characters fall into each category, |
| 582 |
such as @lquotes@;@ntf{identifier_letter},@rquotes@; |
| 583 |
and what the corresponding rules of this section are, |
| 584 |
such as which characters are allowed in the text of a program.]} |
| 585 |
|
| 586 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 587 |
@ChgAdded{Version=[3],Text=<The exact categories, case mapping, and case folding chosen |
| 588 |
affects identifiers, the result of '[[Wide_]Wide_]Image, and packages |
| 589 |
Wide_Characters.Handling and Wide_Wide_Characters.Handling.>} |
| 590 |
@end{Ramification} |
| 591 |
@begin{Discussion} |
| 592 |
@ChgRef{Version=[3],Kind=[AddedNormal]} |
| 593 |
@ChgAdded{Version=[3],Text=[This permission allows implementations to upgrade |
| 594 |
to using a newer character set standard whenever that makes sense, rather |
| 595 |
than having to wait for the next Ada Standard. |
| 596 |
But the character set standard used cannot be older than ISO/IEC 10646:2003 |
| 597 |
(which is essentially similar to Unicode 4.0).]} |
| 598 |
@end{Discussion} |
| 599 |
@end{ImplPerm} |
| 600 |
|
| 601 |
@begin{Notes} |
| 602 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 603 |
@Chg{Version=[2],New=[The characters in categories @ntf{other_control}, |
| 604 |
@ntf{other_private_use}, and @ntf{other_surrogate} are only allowed in comments], |
| 605 |
Old=[Every code position of ISO 10646 BMP that is not reserved for a control |
| 606 |
function is defined to be a @nt<graphic_character> by this International Standard. |
| 607 |
This includes all code positions other than 0000 - 001F, 007F - 009F, |
| 608 |
and FFFE - FFFF]}. |
| 609 |
|
| 610 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg],ARef=[AI05-0286-1]} |
| 611 |
@ChgDeleted{Version=[3],Text=[The language does not specify the source |
| 612 |
representation of programs.]} |
| 613 |
@begin(Discussion) |
| 614 |
@ChgRef{Version=[2],Kind=[Revised]} |
| 615 |
@ChgRef{Version=[3],Kind=[Deleted],ARef=[AI05-0286-1]} |
| 616 |
@ChgDeleted{Version=[3],Text=[Any source representation is valid so long |
| 617 |
as the implementer can produce an (information-preserving) |
| 618 |
algorithm for translating both directions |
| 619 |
between the representation and the standard character set. |
| 620 |
(For example, every character in the standard character set has to be |
| 621 |
representable, even if the output devices attached to a given computer |
| 622 |
cannot print all of those characters properly.) |
| 623 |
From a practical point of view, every implementer will have to provide |
| 624 |
some way to process the @Chg{Version=[2],New=[ACATS],Old=[ACVC]}. |
| 625 |
It is the intent to allow source representations, such as parse trees, |
| 626 |
that are not even linear sequences of characters. |
| 627 |
It is also the intent to allow different fonts: |
| 628 |
reserved words might be in bold face, |
| 629 |
and that should be irrelevant to the semantics.]} |
| 630 |
@end(Discussion) |
| 631 |
@end{Notes} |
| 632 |
|
| 633 |
@begin{Extend83} |
| 634 |
@Defn{extensions to Ada 83} |
| 635 |
Ada 95 allows 8-bit and 16-bit characters, |
| 636 |
as well as implementation-specified character sets. |
| 637 |
@end{Extend83} |
| 638 |
|
| 639 |
@begin{DiffWord83} |
| 640 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 641 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 642 |
The syntax rules in this @Chg{Version=[3],New=[subclause],Old=[clause]} are |
| 643 |
modified to remove the emphasis on basic characters vs. others. |
| 644 |
(In this day and age, there is no need to point out that you can write |
| 645 |
programs without using (for example) lower case letters.) |
| 646 |
In particular, @ntf{character} (representing all characters usable outside |
| 647 |
comments) is added, and @ntf{basic_graphic_character}, |
| 648 |
@ntf{other_special_character}, |
| 649 |
and @ntf{basic_character} are removed. |
| 650 |
@ntf{Special_character} is expanded to include Ada 83's |
| 651 |
@ntf{other_special_character}, as well as new 8-bit characters not |
| 652 |
present in Ada 83.@Chg{Version=[2],New=[ Ada 2005 removes |
| 653 |
@ntf{special_character} altogether; we want to stick to ISO/IEC 10646:2003 |
| 654 |
character classifications.],Old=[]} |
| 655 |
Note that the term @lquotes@;basic letter@rquotes@; is used |
| 656 |
in @RefSec{Character Handling} |
| 657 |
to refer to letters without diacritical marks. |
| 658 |
|
| 659 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 660 |
Character names now come from |
| 661 |
@Chg{Version=[2],New=[ISO/IEC 10646:2003],Old=[ISO 10646]}. |
| 662 |
|
| 663 |
@ChgRef{Version=[2],Kind=[Deleted],ARef=[AI95-00285-01]} |
| 664 |
@ChgDeleted{Version=[2],Text=[We use @ntf<identifier_letter> rather than |
| 665 |
@ntf<letter> since ISO 10646 BMP includes many "letters' that are not |
| 666 |
permitted in identifiers (in the standard mode).]} |
| 667 |
@end{DiffWord83} |
| 668 |
|
| 669 |
@begin{Extend95} |
| 670 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 671 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 672 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 673 |
Program text can use most characters defined by ISO-10646:2003. This |
| 674 |
@Chg{Version=[3],New=[subclause],Old=[clause]} has been rewritten to use the categories defined in that Standard. |
| 675 |
This should ease programming in languages other than English.]} |
| 676 |
@end{Extend95} |
| 677 |
|
| 678 |
@begin{Inconsistent2005} |
| 679 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0266-1]} |
| 680 |
@ChgAdded{Version=[3],Text=<@Defn{inconsistencies with Ada 2005}An |
| 681 |
implementation is allowed (but not required) to use a newer character |
| 682 |
set standard to determine the categories, case mapping, and case folding. |
| 683 |
Doing so will change the results of attributes '[[Wide_]Wide_]Image and the |
| 684 |
packages [Wide_]Wide_Characters.Handling in the case of a few rarely used |
| 685 |
characters. (This also could make some identifiers illegal, for characters |
| 686 |
that are no longer classified as letters.) This is unlikely to be a problem |
| 687 |
in practice. Moreover, truly portable Ada 2012 programs should avoid using |
| 688 |
in these contexts any characters that would have different classifications in |
| 689 |
any character set standards issued since 10646:2003 (since the compiler can |
| 690 |
use any such standard as the basis for its classifications).>} |
| 691 |
@end{Inconsistent2005} |
| 692 |
|
| 693 |
@begin{Diffword2005} |
| 694 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0079-1]} |
| 695 |
@ChgAdded{Version=[3],Text=[@b<Correction:> Clarified that only |
| 696 |
characters in the categories defined here are allowed in the source |
| 697 |
of an Ada program. This was clear in Ada 95, but Amendment 1 dropped |
| 698 |
the wording instead of correcting it.]} |
| 699 |
|
| 700 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0286-1]} |
| 701 |
@ChgAdded{Version=[3],Text=[A standard source representation is defined |
| 702 |
that all compilers are expected to process. Since this is the same format |
| 703 |
as the ACATS, it seems unlikely that there are any implementations that |
| 704 |
don't meet this requirement. Moreover, other representations are still |
| 705 |
permitted, and the "impossible or impractical" loophole (see |
| 706 |
@RefSecnum{Conformity of an Implementation with the Standard}) can be |
| 707 |
invoked for any implementations that cannot directly process the ACATS.]} |
| 708 |
@end{Diffword2005} |
| 709 |
|
| 710 |
|
| 711 |
@LabeledClause{Lexical Elements, Separators, and Delimiters} |
| 712 |
|
| 713 |
@begin{StaticSem} |
| 714 |
@Defn{text of a program} |
| 715 |
The text of a program consists of the texts of one or more |
| 716 |
@nt<compilation>s. |
| 717 |
@Defn{lexical element} |
| 718 |
@IndexSee{Term=[token],See=(lexical element)} |
| 719 |
The text of each @nt<compilation> is a sequence |
| 720 |
of separate @i(lexical elements). |
| 721 |
Each lexical element is formed from a |
| 722 |
sequence of characters, and is |
| 723 |
either a delimiter, an @nt<identifier>, a reserved word, |
| 724 |
a @nt<numeric_literal>, a @nt<character_literal>, a @nt<string_literal>, |
| 725 |
or a comment. |
| 726 |
The meaning of a program depends only on the particular sequences of |
| 727 |
lexical elements that form its @nt{compilation}s, excluding |
| 728 |
@nt{comment}s. |
| 729 |
|
| 730 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 731 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0262-1]} |
| 732 |
The text of a @nt<compilation> is divided into @Defn{line}@i{lines}. |
| 733 |
@Defn{end of a line} |
| 734 |
In general, the representation for an end of line is implementation defined. |
| 735 |
However, a sequence of one or more @ntf<format_effector>s other |
| 736 |
than @Chg{Version=[2],New=[the character whose code |
| 737 |
@Chg{Version=[3],New=[point],Old=[position]} |
| 738 |
is 16#09# (CHARACTER TABULATION)],Old=[character tabulation (HT)]} |
| 739 |
signifies at least one end of line. |
| 740 |
@ImplDef{The representation for an end of line.} |
| 741 |
|
| 742 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 743 |
@Leading@Defn{separator} |
| 744 |
@Redundant[In some cases an explicit @i(separator) is required |
| 745 |
to separate adjacent lexical elements.] |
| 746 |
A separator is |
| 747 |
any of a @Chg{Version=[2],New=[@ntf{separator_space}],Old=[space character]}, |
| 748 |
a @Chg{Version=[2],New=[@ntf{format_effector}],Old=[format effector]}, |
| 749 |
or the end of a line, as follows: |
| 750 |
@begin(Discussion) |
| 751 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg]} |
| 752 |
@ChgDeleted{Version=[2],Text=[It might be useful to define @lquotes@;white space@rquotes@; |
| 753 |
and use it here.]}@ChgNote{No one can figure out why, and it wouldn't match the |
| 754 |
Unicode def of whitespace.} |
| 755 |
@end(Discussion) |
| 756 |
@begin{Itemize} |
| 757 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 758 |
A @Chg{Version=[2],New=[@ntf{separator_space}],Old=[space character]} is |
| 759 |
a separator except within a @nt{comment}, a @nt{string_literal}, |
| 760 |
or a @nt{character_literal}. |
| 761 |
|
| 762 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 763 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0262-1]} |
| 764 |
@Chg{Version=[2],New=[The character whose code @Chg{Version=[3],New=[point],Old=[position]} |
| 765 |
is 16#09# (CHARACTER TABULATION)],Old=[Character tabulation (HT)]} is a |
| 766 |
separator except within a @nt{comment}. |
| 767 |
|
| 768 |
The end of a line is always a separator. |
| 769 |
@end{Itemize} |
| 770 |
|
| 771 |
One or more separators are allowed between any two adjacent lexical |
| 772 |
elements, before the first of each @nt{compilation}, or after the |
| 773 |
last. |
| 774 |
At least one separator is required between an @nt{identifier}, |
| 775 |
a reserved word, or a @nt{numeric_literal} and an adjacent |
| 776 |
@nt{identifier}, reserved word, or @nt{numeric_literal}. |
| 777 |
|
| 778 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0079-1]} |
| 779 |
@ChgAdded{Version=[3],Text=[One or more @ntf{other_format} characters |
| 780 |
are allowed anywhere that a separator is@Redundant[; any such characters |
| 781 |
have no effect on the meaning of an Ada program].]} |
| 782 |
|
| 783 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 784 |
@Defn{delimiter} |
| 785 |
A @i{delimiter} is either one of the following@Chg{Version=[2],New=[],Old=[ special]} |
| 786 |
characters@Chg{Version=[2],New=[:],Old=[]} |
| 787 |
@begin{Display} |
| 788 |
&@ @ @ @ '@ @ @ @ (@ @ @ @ )@ @ @ @ *@ @ @ @ +@ @ @ @ ,@ @ @ @ @en@ @ @ @ .@ @ @ @ /@ @ @ @ :@ @ @ @ ;@ @ @ @ <@ @ @ @ =@ @ @ @ >@ @ @ @ | |
| 789 |
@end{Display} |
| 790 |
|
| 791 |
@Defn{compound delimiter} |
| 792 |
or one of the following @i{compound delimiters} each composed of two |
| 793 |
adjacent special characters |
| 794 |
@begin{Display} |
| 795 |
=>@ @ @ @ ..@ @ @ @ **@ @ @ @ :=@ @ @ @ /=@ @ @ @ >=@ @ @ @ <=@ @ @ @ <<@ @ @ @ >>@ @ @ @ <> |
| 796 |
@end{Display} |
| 797 |
|
| 798 |
Each of the special characters listed for single character delimiters |
| 799 |
is a single delimiter except if this character is used as a character |
| 800 |
of a compound delimiter, or as a character of a @nt{comment}, |
| 801 |
@nt{string_literal}, @nt{character_literal}, or |
| 802 |
@nt{numeric_literal}. |
| 803 |
|
| 804 |
@RMNewPageVer{Version=[2]}@Comment{For printed version of Ada 2005 RM} |
| 805 |
|
| 806 |
@Leading@keepnext@;The following names are used when referring to compound |
| 807 |
delimiters:@table{Columns=[2], |
| 808 |
Alignment=[Allleft],FirstColWidth=[1],LastColWidth=[4], |
| 809 |
NoBreak=[F],Border=[F],SmallSize=[F],Caption=[], |
| 810 |
Headers=[delimiter@ @\name], |
| 811 |
Body=[=>@\arrow |
| 812 |
..@\double dot |
| 813 |
**@\double star, exponentiate |
| 814 |
:=@\assignment (pronounced: @lquotes@;becomes@rquotes@;) |
| 815 |
/=@\inequality (pronounced: @lquotes@;not equal@rquotes@;) |
| 816 |
>=@\greater than or equal |
| 817 |
<=@\less than or equal |
| 818 |
<<@\left label bracket |
| 819 |
>>@\right label bracket |
| 820 |
<>@\box]} |
| 821 |
@end{StaticSem} |
| 822 |
|
| 823 |
@begin{ImplReq} |
| 824 |
An implementation shall support lines of |
| 825 |
at least 200 characters in length, not counting any characters used to signify |
| 826 |
the end of a line. |
| 827 |
An implementation shall support lexical elements of at least |
| 828 |
200 characters in length. |
| 829 |
The maximum supported line length and lexical element length are |
| 830 |
implementation defined. |
| 831 |
@ImplDef{Maximum supported line length and lexical element length.} |
| 832 |
@begin{Discussion} |
| 833 |
From URG recommendation. |
| 834 |
@end{Discussion} |
| 835 |
@end{ImplReq} |
| 836 |
|
| 837 |
@begin{Diffword95} |
| 838 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 839 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 840 |
@ChgAdded{Version=[2],Text=[The wording was updated to use the new character |
| 841 |
categories defined in the preceding @Chg{Version=[3],New=[subclause],Old=[clause]}.]} |
| 842 |
@end{Diffword95} |
| 843 |
|
| 844 |
@begin{Extend2005} |
| 845 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0079-1]} |
| 846 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}@b<Correction:> |
| 847 |
Clarified that |
| 848 |
@ntf{other_format} characters are allowed anywhere that separators |
| 849 |
are allowed. This was intended in Ada 2005, but didn't actually |
| 850 |
make it into the wording.]} |
| 851 |
@end{Extend2005} |
| 852 |
|
| 853 |
|
| 854 |
|
| 855 |
@LabeledClause{Identifiers} |
| 856 |
|
| 857 |
@begin{Intro} |
| 858 |
@nt<Identifier>s are used as names. |
| 859 |
@end{Intro} |
| 860 |
|
| 861 |
@begin{Syntax} |
| 862 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 863 |
@Syn{lhs=<identifier>,rhs=" |
| 864 |
@Chg{Version=[2],New=<@Syn2{identifier_start} {@Syn2{identifier_start} | @Syn2{identifier_extend}}>, |
| 865 |
Old=<@Synf{identifier_letter} {[@Synf{underline}] @Syn2{letter_or_digit}}>}"} |
| 866 |
|
| 867 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 868 |
@Syn{lhs=<@Chg{Version=[2],New=<identifier_start>,Old=<letter_or_digit>}>, |
| 869 |
rhs="@Chg{Version=[2],New=< |
| 870 |
@Synf{letter_uppercase} |
| 871 |
| @Synf{letter_lowercase} |
| 872 |
| @Synf{letter_titlecase} |
| 873 |
| @Synf{letter_modifier} |
| 874 |
| @Synf{letter_other} |
| 875 |
| @Synf{number_letter}>,Old=<@Synf{identifier_letter} | @Synf{digit}>}"} |
| 876 |
|
| 877 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 878 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0091-1]} |
| 879 |
@AddedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<identifier_extend>,Old=<>}>, |
| 880 |
rhs="@Chg{Version=[2],New=< |
| 881 |
@Synf{mark_non_spacing} |
| 882 |
| @Synf{mark_spacing_combining} |
| 883 |
| @Synf{number_decimal} |
| 884 |
| @Synf{punctuation_connector}@Chg{Version=[3],New=<>,Old=< |
| 885 |
| @Synf{other_format}>}>,Old=<>}"} |
| 886 |
|
| 887 |
@begin{SyntaxText} |
| 888 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00395-01]} |
| 889 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0091-1]} |
| 890 |
@Chg{Version=[2],New=[@Chg{Version=[3],New=[An],Old=[After eliminating the |
| 891 |
characters in category @ntf{other_format}, an]} @nt{identifier} shall not |
| 892 |
contain two consecutive characters in category |
| 893 |
@Chg{Version=[3],New=[@ntf{punctuation_connector}],Old=[punctuation_connector]}, |
| 894 |
or end with a character in that category.],Old=[An @nt{identifier} shall not be |
| 895 |
a reserved word.]} |
| 896 |
@begin{Reason} |
| 897 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 898 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 899 |
@ChgAdded{Version=[2],Text=[This rule was stated in the syntax in Ada 95, |
| 900 |
but that has gotten too complex in Ada 2005.@Chg{Version=[3],New=[], |
| 901 |
Old=[ Since @ntf{other_format} |
| 902 |
characters usually do not display, we do not want to count them as separating |
| 903 |
two underscores.]}]} |
| 904 |
@end{Reason} |
| 905 |
@end{SyntaxText} |
| 906 |
@end{Syntax} |
| 907 |
|
| 908 |
@begin{StaticSem} |
| 909 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00285-01]} |
| 910 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0091-1],ARef=[AI05-0227-1],ARef=[AI05-0266-1],ARef=[AI05-0299-1]} |
| 911 |
@Comment{Removed the "Type=[Leading]" along with the bullets. Don't have |
| 912 |
a way to make it doubly conditional (only in Version=[2]), and since it is |
| 913 |
mainly for spacing, we just forget it.} |
| 914 |
@ChgAdded{Version=[2],Text=[Two @nt{identifier}s are ]}@Chg{Version=[2], |
| 915 |
New=[considered the same if they consist of the same sequence of characters |
| 916 |
after applying @Chg{Version=[3],New=[locale-independent simple case folding, |
| 917 |
as defined by documents referenced in the note in Clause 1 of |
| 918 |
ISO/IEC 10646:2011.@Defn{case insensitive}],Old=[the following transformations |
| 919 |
(in this order):]}],Old=[All characters of an @nt{identifier} are significant, |
| 920 |
including any underline character. |
| 921 |
@Defn{case insensitive} |
| 922 |
@nt{Identifier}s differing only in the use of |
| 923 |
corresponding upper and lower case letters are considered the same.]} |
| 924 |
@begin{Itemize} |
| 925 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 926 |
@ChgRef{Version=[3],Kind=[DeletedAddedNoDelMsg],ARef=[AI05-0091-1]} |
| 927 |
@ChgAdded{Version=[2],Text=[@Chg{Version=[3],New=[],Old=[The characters |
| 928 |
in category @ntf{other_format} are eliminated.]}]} |
| 929 |
|
| 930 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01],ARef=[AI95-00395-01]} |
| 931 |
@ChgRef{Version=[3],Kind=[DeletedAddedNoDelMsg],ARef=[AI05-0091-1]} |
| 932 |
@ChgAdded{Version=[2],Text=[@Chg{Version=[3],New=[],Old=[The remaining sequence of |
| 933 |
characters is converted to upper case. |
| 934 |
@Defn{case insensitive}]}]} |
| 935 |
@end{Itemize} |
| 936 |
@begin(Discussion) |
| 937 |
@ChgRef{Version=[2],Kind=[DeletedNoDelMsg]} |
| 938 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0227-1]} |
| 939 |
@Chg{Version=[3],New=[Simple case folding is a mapping to lower case, so this |
| 940 |
is matching the defining (lower case) version of a reserved word. We could |
| 941 |
have mentioned case folding of the reserved words, but as that is an identity |
| 942 |
function, it would have no effect.],Old=[@Chg{Version=[2],New=[],Old=[Two of |
| 943 |
the letters of ISO 8859-1 appear only as lower case, |
| 944 |
"sharp s" and "y with diaeresis." These two letters have |
| 945 |
no corresponding upper case letter (in particular, they |
| 946 |
are not considered equivalent to one another).]}]} |
| 947 |
|
| 948 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0227-1]} |
| 949 |
@ChgAdded{Version=[3],Text=[The @ldquote@;documents referenced@rdquote means |
| 950 |
Unicode. Note that simple case folding is supposed to be compatible between |
| 951 |
Unicode versions, so the Unicode version used doesn't |
| 952 |
matter.]} |
| 953 |
@end(Discussion) |
| 954 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00395-01]} |
| 955 |
@ChgRef{Version=[3],Kind=[RevisedAdded],ARef=[AI05-0091-1],ARef=[AI05-0227-1]} |
| 956 |
@ChgAdded{Version=[2],Text=[After applying @Chg{Version=[3],New=[simple |
| 957 |
case folding],Old=[these transformations]}, an |
| 958 |
@nt{identifier} shall not be identical to a reserved |
| 959 |
word@Chg{Version=[3],New=[],Old=[ (in upper case)]}.]} |
| 960 |
@begin(ImplNote) |
| 961 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 962 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 963 |
@ChgAdded{Version=[2],Text=[We match the reserved words after |
| 964 |
@Chg{Version=[3],New=[applying case folding],Old=[doing these |
| 965 |
transformations]} so that the rules for @nt{identifier}s and reserved words are |
| 966 |
the same. @Chg{Version=[3],New=[],Old=[(This allows @ntf{other_format} |
| 967 |
characters, which usually don't display, in a reserved word |
| 968 |
without changing it to an @nt{identifier}.) ]}Since |
| 969 |
a compiler usually will lexically process @nt{identifier}s and reserved words the |
| 970 |
same way (often with the same code), this will prevent a lot of headaches.]} |
| 971 |
@end(ImplNote) |
| 972 |
@begin(Ramification) |
| 973 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 974 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0227-1]} |
| 975 |
@ChgAdded{Version=[2],Text=[The rules for reserved words differ in one way: |
| 976 |
they define case conversion on letters rather than sequences. This means that |
| 977 |
@Chg{Version=[3],New=[it is possible that there exist ],Old=[]}some |
| 978 |
unusual sequences @Chg{Version=[3],New=[that ],Old=[]}are neither |
| 979 |
@nt{identifier}s nor reserved words. |
| 980 |
@Chg{Version=[3],New=[We are not aware of any such sequences so long as we use |
| 981 |
simple case folding (as opposed to full case folding), but we have defined the |
| 982 |
rules in case any are introduced in future character set standards. This |
| 983 |
originally was a problem when converting to upper case:],Old=[For instance,]} |
| 984 |
@lquotes@;@smldotlessi@;f@rquotes@; and |
| 985 |
@lquotes@;acce@latin1(223)@rquotes@; have upper case conversions of |
| 986 |
@lquotes@;IF@rquotes@; and @lquotes@;ACCESS@rquotes@; respectively. |
| 987 |
@Chg{Version=[3],New=[We would not want these to be treated as reserved words. |
| 988 |
But neither of these cases exist when using simple case folding.], Old=[These |
| 989 |
are not @nt{identifier}s, because the transformed values are |
| 990 |
identical to a reserved word. But they are not reserved words, either, because |
| 991 |
the original values do not match any reserved word as defined or with any number |
| 992 |
of characters of the reserved word in upper case. Thus, these odd |
| 993 |
constructions are just illegal, and should not appear in the source of |
| 994 |
a program.]}]} |
| 995 |
@end(Ramification) |
| 996 |
@end{StaticSem} |
| 997 |
|
| 998 |
@begin{ImplPerm} |
| 999 |
In a nonstandard mode, |
| 1000 |
an implementation may support other upper/lower case equivalence |
| 1001 |
rules for @nt<identifier>s@Redundant[, |
| 1002 |
to accommodate local conventions]. |
| 1003 |
@end{ImplPerm} |
| 1004 |
|
| 1005 |
@begin(Discussion) |
| 1006 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 1007 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0227-1]} |
| 1008 |
@ChgAdded{Version=[2],Type=[Leading],Text=[For instance, in most languages, |
| 1009 |
the @Chg{Version=[3],New=[simple case folded],Old=[uppercase]} |
| 1010 |
equivalent of LATIN @Chg{Version=[3],New=[CAPITAL],Old=[SMALL]} LETTER I |
| 1011 |
(@Chg{Version=[3],New=[an upper],Old=[a lower]} case letter |
| 1012 |
@Chg{Version=[3],New=[without],Old=[with]} a dot above) is |
| 1013 |
LATIN @Chg{Version=[3],New=[SMALL],Old=[CAPITAL]} LETTER I |
| 1014 |
(@Chg{Version=[3],New=[a lower],Old=[an upper]} case letter |
| 1015 |
@Chg{Version=[3],New=[with],Old=[without]} a dot above). In |
| 1016 |
Turkish, though, LATIN @Chg{Version=[3],New=[CAPITAL],Old=[SMALL]} LETTER I |
| 1017 |
and LATIN @Chg{Version=[3],New=[CAPITAL],Old=[SMALL]} LETTER |
| 1018 |
@Chg{Version=[3],New=[],Old=[DOTLESS ]}I@Chg{Version=[3],New=[ WITH DOT |
| 1019 |
ABOVE],Old=[]} are two distinct letters, so the @Chg{Version=[3],New=[case |
| 1020 |
folded],Old=[upper case]} equivalent of LATIN |
| 1021 |
@Chg{Version=[3],New=[CAPITAL],Old=[SMALL]} LETTER I is LATIN |
| 1022 |
@Chg{Version=[3],New=[SMALL],Old=[CAPITAL]} LETTER |
| 1023 |
@Chg{Version=[3],New=[DOTLESS ],Old=[]}I@Chg{Version=[3],New=[],Old=[ WITH DOT |
| 1024 |
ABOVE]}, and the @Chg{Version=[3],New=[case folded],Old=[upper case]} |
| 1025 |
equivalent of LATIN @Chg{Version=[3],New=[CAPITAL],Old=[SMALL]} LETTER |
| 1026 |
@Chg{Version=[3],New=[],Old=[DOTLESS ]}I@Chg{Version=[3],New=[ WITH DOT |
| 1027 |
ABOVE],Old=[]} is LATIN @Chg{Version=[3],New=[SMALL],Old=[CAPITAL]} LETTER I. |
| 1028 |
Take for instance the following identifier (which is the name of a city on the |
| 1029 |
Tigris river in Eastern Anatolia):]} |
| 1030 |
|
| 1031 |
@begin{Example} |
| 1032 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1033 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 1034 |
@ChgAdded{Version=[2],Text=[@Chg{Version=[3],New=[D@capdottedi@;YARBAKIR],Old=[diyarbak@smldotlessi@;r]} -- @RI[The first i is dotted, the second isn't.]]} |
| 1035 |
@end{Example} |
| 1036 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1037 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 1038 |
@ChgAdded{Version=[2],Type=[Leading],Text=[@Chg{Version=[3],New=[A Turkish |
| 1039 |
reader would expect that the above identifier is equivalent to],Old=[Locale-independent conversion to |
| 1040 |
upper case results in]}:]} |
| 1041 |
@begin{Example} |
| 1042 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1043 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 1044 |
@ChgAdded{Version=[2],Text=[@Chg{Version=[3],New=[diyarbak@smldotlessi@;r],Old=[DIYARBAKIR -- @RI[Both Is are dotless.]]}]} |
| 1045 |
@end{Example} |
| 1046 |
@ChgRef{Version=[3],Kind=[Added]} |
| 1047 |
@ChgAdded{Version=[3],Type=[Leading],Text=[However, locale-independent simple case folding (and thus Ada) |
| 1048 |
maps this to:]} |
| 1049 |
@begin{Example} |
| 1050 |
@ChgRef{Version=[3],Kind=[Added]} |
| 1051 |
@ChgAdded{Version=[3],Text=[d@capdottedi@;yarbakir]} |
| 1052 |
@end{Example} |
| 1053 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1054 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 1055 |
@ChgAdded{Version=[2],Type=[Leading],Text=[@Chg{Version=[3],New=[which is |
| 1056 |
different from any of the following identifiers],Old=[This means that the four |
| 1057 |
following sequences of characters represent the same identifier, even though |
| 1058 |
for a locutor of Turkish they would probably be considered distinct words]}:]} |
| 1059 |
@begin{Example} |
| 1060 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1061 |
@ChgAdded{Version=[2],Text=[diyarbakir |
| 1062 |
diyarbak@smldotlessi@;r |
| 1063 |
d@smldotlessi@;yarbakir |
| 1064 |
d@smldotlessi@;yarbak@smldotlessi@;r]} |
| 1065 |
@end{Example} |
| 1066 |
@ChgRef{Version=[3],Kind=[Added]} |
| 1067 |
@ChgAdded{Version=[3],Text=<including the @ldquote@;correct@rdquote matching |
| 1068 |
identifier for Turkish. Upper case conversion (used in '[Wide_]Wide_Image) |
| 1069 |
introduces additional problems.>} |
| 1070 |
|
| 1071 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1072 |
@ChgRef{Version=[3],Kind=[Revised]} |
| 1073 |
@Comment{Removed the "Type=[Leading]" along with the example. Don't have |
| 1074 |
a way to make it doubly conditional (only in Version=[2]), and since it is |
| 1075 |
mainly for spacing, we just forget it.} |
| 1076 |
@ChgAdded{Version=[2],Text=[An implementation targeting the |
| 1077 |
Turkish market is allowed (in fact, expected) to provide a nonstandard mode |
| 1078 |
where case folding is appropriate for Turkish.@Chg{Version=[3],New=[],Old=[ This |
| 1079 |
would cause the original identifier to be converted to:]}]} |
| 1080 |
@begin{Example} |
| 1081 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1082 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg]} |
| 1083 |
@ChgAdded{Version=[2],Text=[@Chg{Version=[3],New=[],Old=[D@capdottedi@;YARBAKIR -- @RI[The first I is dotted, the second isn't.]]}]} |
| 1084 |
@end{Example} |
| 1085 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1086 |
@ChgRef{Version=[3],Kind=[DeletedNoDelMsg]} |
| 1087 |
@ChgAdded{Version=[2],Text=[@Chg{Version=[3],New=[],Old=[and the four |
| 1088 |
sequences of characters shown above would represent four distinct |
| 1089 |
identifiers.]}]} |
| 1090 |
|
| 1091 |
@ChgRef{Version=[2],Kind=[AddedNormal]} |
| 1092 |
@ChgAdded{Version=[2],Text=[Lithuanian and Azeri are two other languages that |
| 1093 |
present similar idiosyncrasies.]} |
| 1094 |
@end{Discussion} |
| 1095 |
|
| 1096 |
@begin{Notes} |
| 1097 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 1098 |
@ChgAdded{Version=[2],Text=[@nt{Identifier}s differing only in the use of |
| 1099 |
corresponding upper and lower case letters are considered the same.]} |
| 1100 |
@end{Notes} |
| 1101 |
|
| 1102 |
@begin{Examples} |
| 1103 |
@Leading@keepnext@i{Examples of identifiers:} |
| 1104 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]} |
| 1105 |
@ChgNote{Old version:@begin{Display} |
| 1106 |
Count X Get_Symbol Ethelyn Marion |
| 1107 |
@Comment{Blank line} |
| 1108 |
Snobol_4 X1 Page_Count Store_Next_Item |
| 1109 |
@end{Display}} |
| 1110 |
@begin{Example} |
| 1111 |
Count X Get_Symbol Ethelyn Marion |
| 1112 |
Snobol_4 X1 Page_Count Store_Next_Item@Chg{Version=[2],New=[ |
| 1113 |
@unicode(928)@unicode(955)@unicode(940)@unicode(964)@unicode(969)@unicode(957) --@RI[ Plato] |
| 1114 |
@unicode(1063)@unicode(1072)@unicode(1081)@unicode(1082)@unicode(1086)@unicode(1074)@unicode(1089)@unicode(1082)@unicode(1080)@unicode(1081) --@RI[ Tchaikovsky] |
| 1115 |
@unicode(952) @unicode(966) --@RI[ Angles]],Old=[]} |
| 1116 |
@end{Example} |
| 1117 |
@end{Examples} |
| 1118 |
|
| 1119 |
@begin{DiffWord83} |
| 1120 |
We no longer include reserved words as @nt<identifier>s. |
| 1121 |
This is not a language change. |
| 1122 |
In Ada 83, @nt{identifier} included reserved words. |
| 1123 |
However, this complicated several other |
| 1124 |
rules (for example, regarding implementation-defined |
| 1125 |
attributes and pragmas, etc.). |
| 1126 |
We now explicitly allow certain reserved words for attribute designators, |
| 1127 |
to make up for the loss. |
| 1128 |
@begin{Ramification} |
| 1129 |
Because syntax rules are relevant to overload resolution, |
| 1130 |
it means that if it looks like a reserved word, |
| 1131 |
it is not an @nt<identifier>. |
| 1132 |
As a side effect, implementations cannot use reserved words as |
| 1133 |
implementation-defined attributes or pragma names. |
| 1134 |
@end{Ramification} |
| 1135 |
@end{DiffWord83} |
| 1136 |
|
| 1137 |
@begin{Extend95} |
| 1138 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 1139 |
@ChgAdded{Version=[2],Text=[@Defn{extensions to Ada 95} |
| 1140 |
An @nt{identifier} can use any letter defined by ISO-10646:2003, along |
| 1141 |
with several other categories. This should ease programming in languages |
| 1142 |
other than English.]} |
| 1143 |
@end{Extend95} |
| 1144 |
|
| 1145 |
@begin{Incompatible2005} |
| 1146 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0091-1]} |
| 1147 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005}@B<Correction:> |
| 1148 |
@ntf{other_format} characters were removed from identifiers as the Unicode |
| 1149 |
recommendations have changed. This change can only affect programs |
| 1150 |
written for the original Ada 2005, so there should be few such programs.]} |
| 1151 |
|
| 1152 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0227-1]} |
| 1153 |
@ChgAdded{Version=[3],Text=[@B<Correction:> We now specify simple case |
| 1154 |
folding rather than full case folding. That potentially could change |
| 1155 |
identifier equivalence, although it is more likely that identifiers that |
| 1156 |
are considered the same in original Ada 2005 will now be considered different. |
| 1157 |
This change was made because the original Ada 2005 definition was incompatible |
| 1158 |
(and even inconsistent in unusual cases) with the Ada 95 identifier |
| 1159 |
equivalence rules. As such, the Ada 2005 rules were rarely fully implemented, |
| 1160 |
and in any case, only Ada 2005 identifiers containing wide characters could |
| 1161 |
be affected.]} |
| 1162 |
@end{Incompatible2005} |
| 1163 |
|
| 1164 |
|
| 1165 |
@LabeledClause{Numeric Literals} |
| 1166 |
|
| 1167 |
@begin{Intro} |
| 1168 |
@Defn2{Term=[literal], Sec=(numeric)} |
| 1169 |
There are two kinds of @nt<numeric_literal>s, @i(real literals) and @i(integer |
| 1170 |
literals). |
| 1171 |
@Defn{real literal} |
| 1172 |
A real literal is a @nt{numeric_literal} that includes a point; |
| 1173 |
@Defn{integer literal} |
| 1174 |
an integer literal is a @nt{numeric_literal} without a point. |
| 1175 |
@end{Intro} |
| 1176 |
|
| 1177 |
@begin{Syntax} |
| 1178 |
@Syn{lhs=<numeric_literal>,rhs="@Syn2{decimal_literal} | @Syn2{based_literal}"} |
| 1179 |
@end{Syntax} |
| 1180 |
|
| 1181 |
@begin{Notes} |
| 1182 |
The type of an integer literal is @i{universal_integer}. |
| 1183 |
The type of a real literal is @i{universal_real}. |
| 1184 |
@end{Notes} |
| 1185 |
|
| 1186 |
@LabeledSubClause{Decimal Literals} |
| 1187 |
|
| 1188 |
@begin{Intro} |
| 1189 |
@Defn2{Term=[literal], Sec=(decimal)} |
| 1190 |
A @nt<decimal_literal> is a @nt<numeric_literal> in the conventional |
| 1191 |
decimal notation (that is, the base is ten). |
| 1192 |
@end{Intro} |
| 1193 |
|
| 1194 |
@begin{Syntax} |
| 1195 |
@Syn{lhs=<decimal_literal>,rhs="@Syn2{numeral} [.@Syn2{numeral}] [@Syn2{exponent}]"} |
| 1196 |
|
| 1197 |
|
| 1198 |
@Syn{lhs=<numeral>,rhs="@Syn2{digit} {[@Synf{underline}] @Syn2{digit}}"} |
| 1199 |
|
| 1200 |
@Syn{lhs=<exponent>,rhs="E [+] @Syn2{numeral} | E @en@; @Syn2{numeral}"} |
| 1201 |
|
| 1202 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 1203 |
@AddedSyn{Version=[2],lhs=<@Chg{Version=[2],New=<digit>,Old=<>}>, |
| 1204 |
rhs="@Chg{Version=[2],New=<0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9>,Old=<>}"} |
| 1205 |
|
| 1206 |
@begin{SyntaxText} |
| 1207 |
An @nt{exponent} for an integer literal shall not have a minus sign. |
| 1208 |
@begin{Ramification} |
| 1209 |
Although |
| 1210 |
this rule is in this subclause, it applies also to the next subclause. |
| 1211 |
@end{Ramification} |
| 1212 |
@end{SyntaxText} |
| 1213 |
@end{Syntax} |
| 1214 |
|
| 1215 |
@begin{StaticSem} |
| 1216 |
An underline character in a |
| 1217 |
@nt{numeric_literal} does not affect its meaning. |
| 1218 |
The letter E of an @nt{exponent} can be written either in lower |
| 1219 |
case or in upper case, with the same meaning. |
| 1220 |
@begin{Ramification} |
| 1221 |
Although these rules are in this subclause, |
| 1222 |
they apply also to the next subclause. |
| 1223 |
@end{Ramification} |
| 1224 |
|
| 1225 |
An @nt{exponent} indicates the power of ten by which the value of the |
| 1226 |
@nt{decimal_literal} without the @nt{exponent} is to be multiplied to |
| 1227 |
obtain the value of the @nt{decimal_literal} with the @nt{exponent}. |
| 1228 |
@end{StaticSem} |
| 1229 |
|
| 1230 |
@begin{Examples} |
| 1231 |
@Leading@keepnext@i{Examples of decimal literals:} |
| 1232 |
@ChgNote{ Old version: @begin{Display} |
| 1233 |
@tabclear()@tabset(P31) |
| 1234 |
12 0 1E6 123_456 @\--@i{ integer literals} |
| 1235 |
@Comment{Blank line} |
| 1236 |
12.0 0.0 0.456 3.14159_26 @\--@i{ real literals} |
| 1237 |
@end{Display}} |
| 1238 |
@begin{Example} |
| 1239 |
12 0 1E6 123_456 --@RI{ integer literals} |
| 1240 |
@Comment{Blank line} |
| 1241 |
12.0 0.0 0.456 3.14159_26 --@RI{ real literals} |
| 1242 |
@end{Example} |
| 1243 |
@end{Examples} |
| 1244 |
|
| 1245 |
@begin{DiffWord83} |
| 1246 |
We have changed the syntactic category name @ntf{integer} to be @nt{numeral}. |
| 1247 |
We got this idea from ACID. |
| 1248 |
It avoids the confusion between this and integers. |
| 1249 |
(Other places don't offer similar confusions. |
| 1250 |
For example, a @nt{string_literal} is different from a string.) |
| 1251 |
@end{DiffWord83} |
| 1252 |
|
| 1253 |
@LabeledSubClause{Based Literals} |
| 1254 |
|
| 1255 |
@begin{Intro} |
| 1256 |
@Redundant[ |
| 1257 |
@Defn2{Term=[literal], Sec=(based)} |
| 1258 |
@Defn{binary literal} |
| 1259 |
@Defn{base 2 literal} |
| 1260 |
@Defn2{Term=[binary], Sec=(literal)} |
| 1261 |
@Defn{octal literal} |
| 1262 |
@Defn{base 8 literal} |
| 1263 |
@Defn2{Term=[octal], Sec=(literal)} |
| 1264 |
@Defn{hexadecimal literal} |
| 1265 |
@Defn{base 16 literal} |
| 1266 |
@Defn2{Term=[hexadecimal], Sec=(literal)} |
| 1267 |
A @nt<based_literal> is a @nt<numeric_literal> expressed in a form |
| 1268 |
that specifies the base explicitly.] |
| 1269 |
@end{Intro} |
| 1270 |
|
| 1271 |
@begin{Syntax} |
| 1272 |
@Syn{lhs=<based_literal>,rhs=" |
| 1273 |
@Syn2{base} # @Syn2{based_numeral} [.@Syn2{based_numeral}] # [@Syn2{exponent}]"} |
| 1274 |
|
| 1275 |
|
| 1276 |
@Syn{lhs=<base>,rhs="@Syn2{numeral}"} |
| 1277 |
|
| 1278 |
@Syn{lhs=<based_numeral>,rhs=" |
| 1279 |
@Syn2{extended_digit} {[@Synf{underline}] @Syn2{extended_digit}}"} |
| 1280 |
|
| 1281 |
@Syn{lhs=<extended_digit>,rhs="@Syn2{digit} | A | B | C | D | E | F"} |
| 1282 |
|
| 1283 |
@end{Syntax} |
| 1284 |
|
| 1285 |
@begin{Legality} |
| 1286 |
@Defn{base} |
| 1287 |
The @i(base) (the numeric value of the decimal @nt<numeral> preceding |
| 1288 |
the first #) shall be at least two and at most sixteen. |
| 1289 |
The @nt{extended_digit}s A through F represent the digits ten through |
| 1290 |
fifteen, respectively. |
| 1291 |
The value of each @nt{extended_digit} of a @nt{based_literal} |
| 1292 |
shall be less than the base. |
| 1293 |
@end{Legality} |
| 1294 |
|
| 1295 |
@begin{StaticSem} |
| 1296 |
The conventional meaning of based notation is assumed. |
| 1297 |
An @nt{exponent} indicates the |
| 1298 |
power of the base by which the value of the @nt{based_literal} |
| 1299 |
without the @nt{exponent} is to be multiplied to obtain the value of |
| 1300 |
the @nt{based_literal} with the @nt{exponent}. |
| 1301 |
The @nt{base} and the @nt{exponent}, if any, are in decimal notation. |
| 1302 |
|
| 1303 |
The @nt{extended_digit}s A through F can be written either in |
| 1304 |
lower case or in upper case, with the same meaning. |
| 1305 |
@end{StaticSem} |
| 1306 |
|
| 1307 |
@begin{Examples} |
| 1308 |
@Leading@keepnext@i{Examples of based literals:} |
| 1309 |
@ChgNote{ Old version: @begin{Display} |
| 1310 |
@tabclear()@tabset(P16, P45) |
| 1311 |
2#1111_1111# @\16#FF# 016#0ff# @\--@i{ integer literals of value 255} |
| 1312 |
16#E#E1 @\2#1110_0000# @\--@i{ integer literals of value 224} |
| 1313 |
16#F.FF#E+2 @\2#1.1111_1111_1110#E11 @\--@i{ real literals of value 4095.0} |
| 1314 |
@end{Display}} |
| 1315 |
@begin{Example} |
| 1316 |
2#1111_1111# 16#FF# 016#0ff# --@RI{ integer literals of value 255} |
| 1317 |
16#E#E1 2#1110_0000# --@RI{ integer literals of value 224} |
| 1318 |
16#F.FF#E+2 2#1.1111_1111_1110#E11 --@RI{ real literals of value 4095.0} |
| 1319 |
@end{Example} |
| 1320 |
@end{Examples} |
| 1321 |
|
| 1322 |
@begin{DiffWord83} |
| 1323 |
The rule about which letters are allowed is now encoded in BNF, |
| 1324 |
as suggested by Mike Woodger. |
| 1325 |
This is clearly more readable. |
| 1326 |
@end{DiffWord83} |
| 1327 |
|
| 1328 |
@LabeledClause{Character Literals} |
| 1329 |
|
| 1330 |
@begin{Intro} |
| 1331 |
@Redundant[A @nt<character_literal> is formed by enclosing a graphic |
| 1332 |
character between two apostrophe characters.] |
| 1333 |
@end{Intro} |
| 1334 |
|
| 1335 |
@begin{Syntax} |
| 1336 |
@Syn{lhs=<character_literal>,rhs="@SingleQuote@Synf{graphic_character}@SingleQuote"} |
| 1337 |
@end{Syntax}@Comment{graphic_character is defined syntactically in Ada 95, but not in Ada 2007} |
| 1338 |
|
| 1339 |
@begin{Notes} |
| 1340 |
A @nt{character_literal} is an enumeration literal |
| 1341 |
of a character type. See @RefSecNum(Character Types). |
| 1342 |
@end{Notes} |
| 1343 |
|
| 1344 |
@begin{Examples} |
| 1345 |
@Leading@keepnext@i{Examples of character literals:} |
| 1346 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]} |
| 1347 |
@ChgNote{ Orginal version: @begin{Display} |
| 1348 |
'A'@ @ @ @ @ '*'@ @ @ @ @ '''@ @ @ @ @ '@ ' |
| 1349 |
@end{Display}} |
| 1350 |
@begin{Example} |
| 1351 |
'A' '*' ''' ' '@Chg{Version=[2],New=[ |
| 1352 |
'L' '@Unicode(1051)' '@Unicode(923)' --@RI[ Various els.] |
| 1353 |
'@Unicode(8734)' '@Unicode(1488)' --@RI[ Big numbers - infinity and aleph.]],Old=[]} |
| 1354 |
@end{Example} |
| 1355 |
@end{Examples} |
| 1356 |
|
| 1357 |
@begin{DiffWord83} |
| 1358 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 1359 |
The definitions of the values of literals are in |
| 1360 |
@Chg{Version=[3],New=[Clauses],Old=[Sections]} 3 and 4, rather than here, |
| 1361 |
since it requires knowledge of types. |
| 1362 |
@end{DiffWord83} |
| 1363 |
|
| 1364 |
@LabeledClause{String Literals} |
| 1365 |
|
| 1366 |
@begin{Intro} |
| 1367 |
@redundant[A @nt<string_literal> is formed by a sequence of graphic characters |
| 1368 |
(possibly none) enclosed between two quotation marks used as |
| 1369 |
string brackets. They are used to represent @nt<operator_symbol>s |
| 1370 |
(see @RefSecNum(Subprogram Declarations)), values of a string type |
| 1371 |
(see @RefSecNum(Literals)), and array subaggregates |
| 1372 |
(see @RefSecNum(Array Aggregates)). |
| 1373 |
@IndexSee{Term=[quoted string],See=(string_literal)}] |
| 1374 |
@end{Intro} |
| 1375 |
|
| 1376 |
@begin{Syntax} |
| 1377 |
@Syn{lhs=<string_literal>,rhs=<"{@Syn2{string_element}}">} |
| 1378 |
|
| 1379 |
@Syn{lhs=<string_element>, |
| 1380 |
rhs=<"" | @SynI{non_quotation_mark_}@Synf{graphic_character}>} |
| 1381 |
|
| 1382 |
@begin{SyntaxText} |
| 1383 |
A @nt{string_element} is either a pair of quotation marks (""), |
| 1384 |
or a single @ntf{graphic_character} other than a quotation mark. |
| 1385 |
@end{SyntaxText} |
| 1386 |
@end{Syntax} |
| 1387 |
|
| 1388 |
@begin{StaticSem} |
| 1389 |
@Defn2{Term=[sequence of characters], Sec=(of a @nt<string_literal>)} |
| 1390 |
The @i(sequence of characters) of a @nt<string_literal> is formed |
| 1391 |
from the sequence of @nt<string_element>s between the bracketing |
| 1392 |
quotation marks, in the given order, |
| 1393 |
with a @nt<string_element> that is "" becoming a single quotation |
| 1394 |
mark in the sequence of characters, |
| 1395 |
and any other @nt<string_element> being reproduced |
| 1396 |
in the sequence. |
| 1397 |
|
| 1398 |
@Defn{null string literal} |
| 1399 |
A @i(null string literal) is a @nt<string_literal> with no |
| 1400 |
@nt<string_element>s between the quotation marks. |
| 1401 |
|
| 1402 |
@end{StaticSem} |
| 1403 |
|
| 1404 |
@begin{Notes} |
| 1405 |
An end of line cannot appear in a @nt{string_literal}. |
| 1406 |
|
| 1407 |
@ChgRef{Version=[2],Kind=[Added],ARef=[AI95-00285-01]} |
| 1408 |
@ChgAdded{Version=[2],Text=[No transformation is performed on the |
| 1409 |
sequence of characters of a @nt{string_literal}.]} |
| 1410 |
@end{Notes} |
| 1411 |
|
| 1412 |
@begin{Examples} |
| 1413 |
@Leading@keepnext@i{Examples of string literals:} |
| 1414 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]} |
| 1415 |
@ChgNote< Original version: @begin{Display} |
| 1416 |
@tabclear()@tabset(P16) |
| 1417 |
"Message of the day:" |
| 1418 |
@comment{Blank line} |
| 1419 |
"" @\--@i{ a null string literal} |
| 1420 |
"@ " "A" """" @\--@i{ three string literals of length 1} |
| 1421 |
@comment{Blank line} |
| 1422 |
"Characters such as $, %, and } are allowed in string literals" |
| 1423 |
@end{Display}> |
| 1424 |
@begin{Example} |
| 1425 |
"Message of the day:" |
| 1426 |
@comment{Blank line} |
| 1427 |
"" --@RI{ a null string literal} |
| 1428 |
" " "A" """" --@RI{ three string literals of length 1} |
| 1429 |
@comment{Blank line} |
| 1430 |
"Characters such as $, %, and } are allowed in string literals" |
| 1431 |
@Chg{Version=[2],New=["Archimedes said ""@unicode(917)@unicode(973)@unicode(961)@unicode(951)@unicode(954)@unicode(945)""" |
| 1432 |
"Volume of cylinder (@pi@;r@latin1(178)h) = "],Old=[]} |
| 1433 |
@end{Example} |
| 1434 |
@end{Examples} |
| 1435 |
|
| 1436 |
@begin{DiffWord83} |
| 1437 |
The wording has been changed to be strictly lexical. |
| 1438 |
No mention is made of string or character values, since |
| 1439 |
@nt<string_literal>s are also used to represent @nt<operator_symbol>s, |
| 1440 |
which don't have a defined value. |
| 1441 |
|
| 1442 |
The syntax is described differently. |
| 1443 |
@end{DiffWord83} |
| 1444 |
|
| 1445 |
@begin{DiffWord95} |
| 1446 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00285-01]} |
| 1447 |
@ChgAdded{Version=[2],Text=[We explicitly say that the characters of a |
| 1448 |
@nt{string_literal} should be used as is. In particular, no normalization |
| 1449 |
or folding should be performed on a @nt{string_literal}.]} |
| 1450 |
@end{DiffWord95} |
| 1451 |
|
| 1452 |
|
| 1453 |
@LabeledClause{Comments} |
| 1454 |
|
| 1455 |
@begin{Intro} |
| 1456 |
A @nt{comment} starts with two adjacent hyphens and extends up to the end |
| 1457 |
of the line. |
| 1458 |
@end{Intro} |
| 1459 |
|
| 1460 |
@begin{Syntax} |
| 1461 |
@Syn{lhs=<comment>, |
| 1462 |
rhs=<--{@SynI{non_end_of_line_}@Synf{character}}>}@Comment{character is defined syntactically in Ada 95, |
| 1463 |
but not in Ada 2007. We assume the worst here.} |
| 1464 |
|
| 1465 |
@begin{SyntaxText} |
| 1466 |
A @nt{comment} may appear on any line of a program. |
| 1467 |
@end{SyntaxText} |
| 1468 |
@end{Syntax} |
| 1469 |
|
| 1470 |
@begin{StaticSem} |
| 1471 |
The presence or absence of @nt{comment}s has no influence on whether a program |
| 1472 |
is legal or illegal. Furthermore, @nt{comment}s do not influence the meaning |
| 1473 |
of a program; their sole purpose is the enlightenment of the human reader. |
| 1474 |
@end{StaticSem} |
| 1475 |
|
| 1476 |
@begin{Examples} |
| 1477 |
@Leading@keepnext@i{Examples of comments:} |
| 1478 |
@ChgNote{Original version: @begin{Display} |
| 1479 |
--@i{ the last sentence above echoes the Algol 68 report } |
| 1480 |
@comment{Blank line} |
| 1481 |
@key[end]; --@i{ processing of Line is complete } |
| 1482 |
@comment{Blank line} |
| 1483 |
--@i{ a long comment may be split onto} |
| 1484 |
--@i{ two or more consecutive lines } |
| 1485 |
@comment{Blank line} |
| 1486 |
----------------@i{ the first two hyphens start the comment } |
| 1487 |
@end{Display}} |
| 1488 |
@begin{Example} |
| 1489 |
--@RI[ the last sentence above echoes the Algol 68 report ] |
| 1490 |
@comment{Blank line} |
| 1491 |
@key[end]; --@RI[ processing of Line is complete ] |
| 1492 |
@comment{Blank line} |
| 1493 |
--@RI[ a long comment may be split onto] |
| 1494 |
--@RI[ two or more consecutive lines ] |
| 1495 |
@comment{Blank line} |
| 1496 |
----------------@RI[ the first two hyphens start the comment ] |
| 1497 |
@end{Example} |
| 1498 |
@end{Examples} |
| 1499 |
|
| 1500 |
|
| 1501 |
@LabeledClause{Pragmas} |
| 1502 |
|
| 1503 |
@begin{Intro} |
| 1504 |
@ToGlossaryAlso{Term=<Pragma>, |
| 1505 |
Text=<A pragma is a compiler directive. |
| 1506 |
There are language-defined pragmas that give instructions |
| 1507 |
for optimization, listing control, etc. |
| 1508 |
An implementation may support additional |
| 1509 |
(implementation-defined) pragmas.>} |
| 1510 |
@end{Intro} |
| 1511 |
|
| 1512 |
@begin{MetaRules} |
| 1513 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0100-1],ARef=[AI05-0163-1]} |
| 1514 |
@ChgAdded{Version=[3],Text=[In general, if all @nt{pragma}s are treated as |
| 1515 |
unrecognized @nt{pragma}s, the program should remain both syntactically and |
| 1516 |
semantically legal. There are a few exceptions to this general principle (for |
| 1517 |
example, @nt{pragma} Import can eliminate the need for a completion), but the |
| 1518 |
principle remains, and is strictly true at the syntactic level. Certainly any |
| 1519 |
implementation-defined @nt{pragma}s should obey this principle both |
| 1520 |
syntactically and semantically, so that if the @nt{pragma}s are not recognized |
| 1521 |
by some other implementation, the program will remain legal.]} |
| 1522 |
@end{MetaRules} |
| 1523 |
|
| 1524 |
@begin{Syntax} |
| 1525 |
@Syn{lhs=<pragma>,rhs=" |
| 1526 |
@key{pragma} @Syn2{identifier} [(@Syn2{pragma_argument_association} {, @Syn2{pragma_argument_association}})];"} |
| 1527 |
|
| 1528 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0290-1]} |
| 1529 |
@Syn{lhs=<pragma_argument_association>,rhs=" |
| 1530 |
[@SynI{pragma_argument_}@Syn2{identifier} =>] @Syn2{name} |
| 1531 |
| [@SynI{pragma_argument_}@Syn2{identifier} =>] @Syn2{expression}@Chg{Version=[3],New=[ |
| 1532 |
| @SynI{pragma_argument_}@Syn2{aspect_mark} => @Syn2{name} |
| 1533 |
| @SynI{pragma_argument_}@Syn2{aspect_mark} => @Syn2{expression}],Old=[]}"} |
| 1534 |
|
| 1535 |
@begin{SyntaxText} |
| 1536 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0290-1]} |
| 1537 |
In a @nt<pragma>, any @nt<pragma_argument_association>s without a |
| 1538 |
@SynI{pragma_argument_}@nt<identifier> @Chg{Version=[3],New=[or |
| 1539 |
@SynI{pragma_argument_}@nt<aspect_mark> ],Old=[]}shall |
| 1540 |
precede any associations with a |
| 1541 |
@i{pragma_argument_}@nt<identifier>@Chg{Version=[3],New=[ or |
| 1542 |
@SynI{pragma_argument_}@nt<aspect_mark>],Old=[]}. |
| 1543 |
|
| 1544 |
@Leading@keepnext@nt{Pragma}s are only allowed at the following places in a program: |
| 1545 |
@begin{Itemize} |
| 1546 |
After a semicolon delimiter, but not within a @nt{formal_part} |
| 1547 |
or @nt{discriminant_part}. |
| 1548 |
|
| 1549 |
|
| 1550 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0100-1],ARef=[AI05-0163-1]} |
| 1551 |
At any place where the syntax rules allow a construct defined by a |
| 1552 |
syntactic category whose name ends with @ldquote@ntf{declaration}@rdquote, |
| 1553 |
@Chg{Version=[3],New=[@ldquote@ntf{item}@rdquote, ],Old=[]}@ldquote@ntf{statement}@rdquote, |
| 1554 |
@ldquote@ntf{clause}@rdquote, or |
| 1555 |
@ldquote@ntf{alternative}@rdquote, or one of the syntactic categories |
| 1556 |
@nt{variant} or @nt{exception_handler}; |
| 1557 |
but not in place of such a construct@Chg{Version=[3],New=[ if the construct |
| 1558 |
is required, or is part of a list that is required to have at least one such |
| 1559 |
construct],Old=[. Also at any place where a @nt{compilation_unit} would be |
| 1560 |
allowed]}. |
| 1561 |
|
| 1562 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0163-1]} |
| 1563 |
@ChgAdded{Version=[3],Text=[In place of a @nt{statement} in a |
| 1564 |
@nt{sequence_of_statements}.]} |
| 1565 |
|
| 1566 |
@ChgRef{Version=[3],Kind=[Added],ARef=[AI05-0100-1]} |
| 1567 |
@ChgAdded{Version=[3],Text=[At any place where a @nt{compilation_unit} |
| 1568 |
is allowed.]} |
| 1569 |
@end{Itemize} |
| 1570 |
|
| 1571 |
Additional syntax rules and placement restrictions |
| 1572 |
exist for specific pragmas. |
| 1573 |
@end{SyntaxText} |
| 1574 |
@begin{Discussion} |
| 1575 |
The above rule is written in text, |
| 1576 |
rather than in BNF; |
| 1577 |
the syntactic category @nt{pragma} is not used in any BNF syntax rule. |
| 1578 |
@end{Discussion} |
| 1579 |
@begin{Ramification} |
| 1580 |
A @nt{pragma} is allowed where a |
| 1581 |
@nt<generic_formal_parameter_declaration> is allowed. |
| 1582 |
@end{Ramification} |
| 1583 |
@end{Syntax} |
| 1584 |
|
| 1585 |
@begin{Intro} |
| 1586 |
@Defn2{Term=[name], Sec=(of a @nt{pragma})} |
| 1587 |
@Defn{pragma name} |
| 1588 |
The @i{name} of a @nt{pragma} is |
| 1589 |
the identifier following the reserved word @key{pragma}. |
| 1590 |
@Defn{pragma argument} |
| 1591 |
@Defn{argument of a pragma} |
| 1592 |
The @nt{name} or @nt{expression} of a @nt{pragma_argument_association} |
| 1593 |
is a @i{pragma argument}. |
| 1594 |
|
| 1595 |
@begin{Honest} |
| 1596 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00284-02]} |
| 1597 |
@ChgAdded{Version=[2],Text=[For compatibility with Ada 83, the name of a |
| 1598 |
@nt{pragma} may also be @lquotes@key{interface}@rquotes@;, which is not an |
| 1599 |
identifier (because it is a reserved word). |
| 1600 |
See @RefSecNum{Pragma Interface}.]} |
| 1601 |
@end{Honest} |
| 1602 |
|
| 1603 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0272-1]} |
| 1604 |
@Defn{identifier specific to a pragma} |
| 1605 |
@Defn{pragma, identifier specific to} |
| 1606 |
An @i{identifier specific to a pragma} is |
| 1607 |
an identifier @Chg{Version=[3],New=[or reserved word ],Old=[]}that is |
| 1608 |
used in a pragma argument with special meaning |
| 1609 |
for that pragma. |
| 1610 |
@begin{Honest} |
| 1611 |
Whenever the syntax rules for a given pragma allow |
| 1612 |
"@nt{identifier}" as an argument of the @nt{pragma}, |
| 1613 |
that @nt{identifier} is an identifier specific to that |
| 1614 |
pragma. |
| 1615 |
|
| 1616 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0272-1]} |
| 1617 |
@ChgAdded{Version=[3],Text=[In a few cases, a reserved word is |
| 1618 |
allowed as "an identifier specific to a pragma". Even in these cases, |
| 1619 |
the syntax still is written as @nt{identifier} (the reserved word(s) |
| 1620 |
are not shown). For example, the restriction No_Use_Of_Attribute |
| 1621 |
(see @RefSecNum{Language-Defined Restrictions and Profiles}) allows the |
| 1622 |
reserved words which can be attribute designators, but the syntax for |
| 1623 |
a restriction does not include these reserved words.]} |
| 1624 |
@end{Honest} |
| 1625 |
@end{Intro} |
| 1626 |
|
| 1627 |
@begin{StaticSem} |
| 1628 |
If an implementation does not recognize the name of a |
| 1629 |
@nt{pragma}, then it has no effect on the semantics |
| 1630 |
of the program. |
| 1631 |
Inside such a @nt{pragma}, the only rules that apply are the |
| 1632 |
@SyntaxName@;s. |
| 1633 |
@begin{Honest} |
| 1634 |
This rule takes precedence over any other rules that imply otherwise. |
| 1635 |
@end{Honest} |
| 1636 |
@begin{Ramification} |
| 1637 |
Note well: this rule applies only to @nt{pragma}s whose name is not |
| 1638 |
recognized. |
| 1639 |
If anything else is wrong with a @nt{pragma} (at compile time), |
| 1640 |
the @nt{pragma} is illegal. |
| 1641 |
This is true whether the @nt{pragma} is |
| 1642 |
language defined or implementation defined. |
| 1643 |
|
| 1644 |
For example, an expression in an unrecognized @nt{pragma} does |
| 1645 |
not cause freezing, even though the rules in |
| 1646 |
@RefSec{Freezing Rules} say it does; |
| 1647 |
the above rule overrules those other rules. |
| 1648 |
On the other hand, an expression in a recognized @nt{pragma} causes |
| 1649 |
freezing, even if this makes something illegal. |
| 1650 |
|
| 1651 |
For another example, an expression that would be ambiguous is not |
| 1652 |
illegal if it is inside an unrecognized @nt{pragma}. |
| 1653 |
|
| 1654 |
Note, however, that implementations have to recognize @key[pragma] |
| 1655 |
Inline(Foo) and freeze things accordingly, even if they choose to never |
| 1656 |
do inlining. |
| 1657 |
|
| 1658 |
Obviously, the contradiction needs to be resolved one way or the |
| 1659 |
other. The reasons for resolving it this way are: The |
| 1660 |
implementation is simple @em the compiler can just ignore the |
| 1661 |
@nt{pragma} altogether. |
| 1662 |
The interpretation of constructs appearing inside |
| 1663 |
implementation-defined @nt{pragma}s is implementation defined. For |
| 1664 |
example: @lquotes@;@key[pragma] Mumble(X);@rquotes@;. If the current implementation has |
| 1665 |
never heard of Mumble, then it doesn't know whether X is a name, |
| 1666 |
an expression, or an identifier specific to the pragma Mumble. |
| 1667 |
@end{Ramification} |
| 1668 |
@begin{Honest} |
| 1669 |
The syntax of individual pragmas overrides the general |
| 1670 |
syntax for @nt{pragma}. |
| 1671 |
@end{Honest} |
| 1672 |
@begin{Ramification} |
| 1673 |
Thus, an identifier specific to a @nt{pragma} is not a @nt{name}, |
| 1674 |
syntactically; if it were, the visibility rules would be invoked, |
| 1675 |
which is not what we want. |
| 1676 |
|
| 1677 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1678 |
This also implies that named associations do not allow one to give the |
| 1679 |
arguments in an arbitrary order @em the order given in the syntax rule |
| 1680 |
for each individual pragma must be obeyed. |
| 1681 |
However, it is generally possible to leave out earlier arguments when |
| 1682 |
later ones are given; for example, this is allowed by the syntax rule |
| 1683 |
for pragma Import (see @Chg{Version=[3],New=[@RefSec{Interfacing Pragmas}], |
| 1684 |
Old=[@RefSec{Interfacing Aspects}]}). |
| 1685 |
As for subprogram calls, positional notation precedes named |
| 1686 |
notation. |
| 1687 |
|
| 1688 |
Note that Ada 83 had no pragmas for which the order of named |
| 1689 |
associations mattered, since there was never more than one argument |
| 1690 |
that allowed named associations. |
| 1691 |
@end{Ramification} |
| 1692 |
@begin{Honest} |
| 1693 |
The interpretation of the arguments of implementation-defined pragmas |
| 1694 |
is implementation defined. |
| 1695 |
However, the syntax rules have to be obeyed. |
| 1696 |
@end{Honest} |
| 1697 |
@end{StaticSem} |
| 1698 |
|
| 1699 |
@begin{RunTime} |
| 1700 |
@PDefn2{Term=[execution], Sec=(pragma)} |
| 1701 |
@PDefn2{Term=[elaboration], Sec=(pragma)} |
| 1702 |
Any @nt{pragma} that appears at the place of an executable construct is |
| 1703 |
executed. |
| 1704 |
Unless otherwise specified for a particular pragma, |
| 1705 |
this execution consists of the evaluation of each evaluable pragma |
| 1706 |
argument in an arbitrary order.@PDefn2{Term=[arbitrary order],Sec=[allowed]} |
| 1707 |
@begin{Ramification} |
| 1708 |
For a @nt{pragma} that appears at the place of an elaborable |
| 1709 |
construct, execution is elaboration. |
| 1710 |
|
| 1711 |
An identifier specific to a pragma is neither a @nt{name} nor an |
| 1712 |
@nt{expression} @em such identifiers are not evaluated (unless an |
| 1713 |
implementation defines them to be evaluated in the case of an |
| 1714 |
implementation-defined @nt{pragma}). |
| 1715 |
|
| 1716 |
The @lquotes@;unless otherwise specified@rquotes@; part allows us (and |
| 1717 |
implementations) to make exceptions, so a @nt{pragma} can contain an |
| 1718 |
expression that is not evaluated. |
| 1719 |
Note that @nt{pragma}s in @nt{type_definition}s may contain expressions |
| 1720 |
that depend on discriminants. |
| 1721 |
|
| 1722 |
When we wish to define a pragma with some run-time effect, |
| 1723 |
we usually make sure that it appears in an executable context; |
| 1724 |
otherwise, special rules are needed to define the run-time effect |
| 1725 |
and when it happens. |
| 1726 |
@end{Ramification} |
| 1727 |
@end{RunTime} |
| 1728 |
|
| 1729 |
@begin{ImplReq} |
| 1730 |
The implementation shall give a warning message for |
| 1731 |
an unrecognized pragma name. |
| 1732 |
@begin{Ramification} |
| 1733 |
An implementation is also allowed to have modes in which a warning |
| 1734 |
message is suppressed, or in which the presence of an unrecognized |
| 1735 |
@nt{pragma} is a compile-time error. |
| 1736 |
@end{Ramification} |
| 1737 |
@end{ImplReq} |
| 1738 |
|
| 1739 |
@begin{ImplPerm} |
| 1740 |
An implementation may provide implementation-defined pragmas; |
| 1741 |
the name of an implementation-defined pragma shall differ |
| 1742 |
from those of the language-defined pragmas. |
| 1743 |
@ImplDef{Implementation-defined pragmas.} |
| 1744 |
@begin{Ramification} |
| 1745 |
The semantics of implementation-defined pragmas, and any associated |
| 1746 |
rules (such as restrictions on their placement or arguments), |
| 1747 |
are, of course, implementation defined. |
| 1748 |
Implementation-defined pragmas may have run-time effects. |
| 1749 |
@end{Ramification} |
| 1750 |
|
| 1751 |
An implementation may ignore an unrecognized pragma even if |
| 1752 |
it violates some of the @SyntaxName@;s, if detecting the |
| 1753 |
syntax error is too complex. |
| 1754 |
@begin{Reason} |
| 1755 |
Many compilers use extra post-parsing checks to enforce the syntax |
| 1756 |
rules, since the Ada syntax rules are not LR(k) (for any k). |
| 1757 |
(The grammar is ambiguous, in fact.) |
| 1758 |
This paragraph allows them to ignore an unrecognized pragma, without |
| 1759 |
having to perform such post-parsing checks. |
| 1760 |
@end{Reason} |
| 1761 |
@end{ImplPerm} |
| 1762 |
|
| 1763 |
@begin{ImplAdvice} |
| 1764 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0163-1]} |
| 1765 |
Normally, |
| 1766 |
implementation-defined pragmas should have no semantic effect |
| 1767 |
for error-free programs; |
| 1768 |
that is, if the implementation-defined pragmas |
| 1769 |
@Chg{Version=[3],New=[in a working program are replaced |
| 1770 |
with unrecognized pragmas],Old=[are removed from a working program]}, |
| 1771 |
the program should still be legal, and should still have the same |
| 1772 |
semantics. |
| 1773 |
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 1774 |
Text=[Implementation-defined pragmas should have no semantic effect |
| 1775 |
for error-free programs.]}]} |
| 1776 |
@begin{Ramification} |
| 1777 |
Note that @lquotes@;semantics@rquotes@; is not the same as @lquotes@;effect;@rquotes@; |
| 1778 |
as explained in |
| 1779 |
@RefSecNum{Conformity of an Implementation With the Standard}, |
| 1780 |
the semantics defines a set of possible effects. |
| 1781 |
|
| 1782 |
Note that adding a @nt{pragma} to a program might cause an error |
| 1783 |
(either at compile time or at run time). |
| 1784 |
On the other hand, if the language-specified semantics for a |
| 1785 |
feature are in part implementation defined, |
| 1786 |
it makes sense to support pragmas that control the feature, |
| 1787 |
and that have real semantics; thus, |
| 1788 |
this paragraph is merely a recommendation. |
| 1789 |
@end{Ramification} |
| 1790 |
|
| 1791 |
@Leading@;Normally, |
| 1792 |
an implementation should not define pragmas that can make an illegal |
| 1793 |
program legal, except as follows: |
| 1794 |
@begin(Itemize) |
| 1795 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1796 |
A @nt<pragma> used to complete a |
| 1797 |
declaration@Chg{Version=[3],New=[],Old=[, such as a @nt{pragma} Import]}; |
| 1798 |
|
| 1799 |
@begin{Discussion} |
| 1800 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0229-1]} |
| 1801 |
@ChgAdded{Version=[3],Text=[There are no language-defined pragmas which |
| 1802 |
can be completions; @nt{pragma} Import was defined this way in Ada 95 |
| 1803 |
and Ada 2005, but in Ada 2012 @nt{pragma} Import just sets aspect Import |
| 1804 |
which disallows having any completion.]} |
| 1805 |
@end{Discussion} |
| 1806 |
|
| 1807 |
A @nt<pragma> used to configure the environment |
| 1808 |
by adding, removing, or replacing @nt{library_item}s. |
| 1809 |
@end(Itemize) |
| 1810 |
@ChgImplAdvice{Version=[2],Kind=[Added],Text=[@ChgAdded{Version=[2], |
| 1811 |
Text=[Implementation-defined pragmas should not make an illegal program |
| 1812 |
legal, unless they complete a declaration or configure the @nt{library_item}s |
| 1813 |
in an environment.]}]} |
| 1814 |
@begin(Ramification) |
| 1815 |
For example, it is OK to support Interface, |
| 1816 |
System_Name, Storage_Unit, and Memory_Size @nt{pragma}s |
| 1817 |
for upward compatibility reasons, |
| 1818 |
even though all of these @nt{pragma}s can make an illegal program legal. |
| 1819 |
(The latter three can affect legality in a rather subtle way: |
| 1820 |
They affect the value of named numbers in System, |
| 1821 |
and can therefore affect the legality in cases where |
| 1822 |
static expressions are required.) |
| 1823 |
|
| 1824 |
On the other hand, |
| 1825 |
adding implementation-defined pragmas to a legal program can make it illegal. |
| 1826 |
For example, a common kind of implementation-defined pragma is one that |
| 1827 |
promises some property that allows more efficient code to be generated. |
| 1828 |
If the promise is a lie, |
| 1829 |
it is best if the user gets an error message. |
| 1830 |
@end(Ramification) |
| 1831 |
@end{ImplAdvice} |
| 1832 |
|
| 1833 |
@begin{Incompatible83} |
| 1834 |
@Defn{incompatibilities with Ada 83} |
| 1835 |
In Ada 83, @lquotes@;bad@rquotes@; @nt{pragma}s are ignored. |
| 1836 |
In Ada 95, they are illegal, |
| 1837 |
except in the case where the name of the @nt{pragma} itself |
| 1838 |
is not recognized by the implementation. |
| 1839 |
@end{Incompatible83} |
| 1840 |
|
| 1841 |
@begin{Extend83} |
| 1842 |
@Defn{extensions to Ada 83} |
| 1843 |
Implementation-defined @nt{pragma}s may affect the legality of a program. |
| 1844 |
@end{Extend83} |
| 1845 |
|
| 1846 |
@begin{DiffWord83} |
| 1847 |
Implementation-defined @nt{pragma}s may affect the run-time semantics of |
| 1848 |
the program. |
| 1849 |
This was always true in Ada 83 (since it was not explicitly forbidden by |
| 1850 |
RM83), but it was not clear, because there was no definition of |
| 1851 |
@lquotes@;executing@rquotes@; or @lquotes@;elaborating@rquotes@; a @nt{pragma}. |
| 1852 |
@end{DiffWord83} |
| 1853 |
|
| 1854 |
@begin{Extend2005} |
| 1855 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0163-1]} |
| 1856 |
@ChgAdded{Version=[3],Text=[@Defn{extensions to Ada 2005}@b<Correction:> |
| 1857 |
Allow @nt{pragma}s in place of a @nt{statement}, even if there are no |
| 1858 |
other @nt{statement}s in a @nt{sequence_of_statements}.]} |
| 1859 |
|
| 1860 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0272-1]} |
| 1861 |
@ChgAdded{Version=[3],Text=[Identifiers specific to a pragma can be |
| 1862 |
reserved words.]} |
| 1863 |
|
| 1864 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0290-1]} |
| 1865 |
@ChgAdded{Version=[3],Text=[Pragma arguments can be identified with |
| 1866 |
@nt{aspect_mark}s; this allows @nt{identifier}'Class in this context. |
| 1867 |
As usual, this is only allowed if specifically allowed by a particular |
| 1868 |
pragma.]} |
| 1869 |
@end{Extend2005} |
| 1870 |
|
| 1871 |
@begin{DiffWord2005} |
| 1872 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0100-1]} |
| 1873 |
@ChgAdded{Version=[3],Text=[@b{Correction:} Clarified where @nt{pragma}s |
| 1874 |
are (and are not) allowed.]} |
| 1875 |
@end{DiffWord2005} |
| 1876 |
|
| 1877 |
|
| 1878 |
@begin{Syntax} |
| 1879 |
@Leading@keepnext@;The forms of List, Page, and Optimize @nt{pragma}s are as follows: |
| 1880 |
|
| 1881 |
@PragmaSyn`@key{pragma} @prag(List)(@Syn2{identifier});' |
| 1882 |
|
| 1883 |
@PragmaSyn`@key{pragma} @prag(Page);' |
| 1884 |
|
| 1885 |
@PragmaSyn`@key{pragma} @prag(Optimize)(@Syn2{identifier});' |
| 1886 |
|
| 1887 |
@begin{SyntaxText} |
| 1888 |
@Redundant[Other pragmas are defined throughout this International Standard, |
| 1889 |
and are summarized in |
| 1890 |
@RefSecNum{Language-Defined Pragmas}.] |
| 1891 |
@begin{Ramification} |
| 1892 |
The language-defined pragmas |
| 1893 |
are supported by every implementation, |
| 1894 |
although @lquotes@;supporting@rquotes@; some of |
| 1895 |
them (for example, Inline) requires nothing more than checking the |
| 1896 |
arguments, since they act only as advice to the implementation. |
| 1897 |
@end{Ramification} |
| 1898 |
|
| 1899 |
@end{SyntaxText} |
| 1900 |
@end{Syntax} |
| 1901 |
|
| 1902 |
@begin{StaticSem} |
| 1903 |
A @nt{pragma} List |
| 1904 |
takes one of the @nt{identifier}s On or Off as the single |
| 1905 |
argument. This pragma is allowed anywhere a |
| 1906 |
@nt{pragma} is allowed. It specifies that listing of the |
| 1907 |
compilation is to be continued or suspended until a List |
| 1908 |
@nt{pragma} with the opposite argument is given within the |
| 1909 |
same compilation. The @nt{pragma} itself is always listed if |
| 1910 |
the compiler is producing a listing. |
| 1911 |
|
| 1912 |
A @nt{pragma} Page |
| 1913 |
is allowed anywhere a |
| 1914 |
@nt{pragma} is allowed. It specifies that the program text |
| 1915 |
which follows the @nt{pragma} should start on a new page (if |
| 1916 |
the compiler is currently producing a listing). |
| 1917 |
|
| 1918 |
A @nt{pragma} Optimize |
| 1919 |
takes one of the @nt{identifier}s Time, Space, or Off as the |
| 1920 |
single argument. This @nt{pragma} is allowed anywhere a @nt<pragma> |
| 1921 |
is allowed, and it applies until the end of the immediately enclosing |
| 1922 |
declarative region, |
| 1923 |
or for a @nt{pragma} at the place of a @nt{compilation_unit}, |
| 1924 |
to the end of the @nt<compilation>. |
| 1925 |
It gives advice to the implementation as to |
| 1926 |
whether time or space is the primary optimization criterion, or |
| 1927 |
that optional optimizations should be turned off. |
| 1928 |
@Redundant[It is implementation defined how this advice is followed.] |
| 1929 |
@ImplDef{Effect of pragma Optimize.} |
| 1930 |
@begin{Discussion} |
| 1931 |
|
| 1932 |
For example, a compiler might use Time vs. Space to control whether |
| 1933 |
generic instantiations are implemented with a macro-expansion model, |
| 1934 |
versus a shared-generic-body model. |
| 1935 |
|
| 1936 |
|
| 1937 |
We don't define what constitutes an @lquotes@;optimization@rquotes@; |
| 1938 |
@em in fact, it cannot be formally defined in the context of Ada. |
| 1939 |
One compiler might call something an optional optimization, |
| 1940 |
whereas another compiler might consider that same thing |
| 1941 |
to be a normal part of code generation. |
| 1942 |
Thus, the programmer cannot rely on this pragma having any |
| 1943 |
particular portable effect on the generated code. |
| 1944 |
Some compilers might even ignore the pragma altogether. |
| 1945 |
@end{Discussion} |
| 1946 |
@end{StaticSem} |
| 1947 |
|
| 1948 |
@begin{Examples} |
| 1949 |
@Leading@keepnext@i{Examples of pragmas:} |
| 1950 |
@begin{Example} |
| 1951 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00433-01]} |
| 1952 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0229-1]} |
| 1953 |
@key[pragma] List(Off); -- @Examcom{turn off listing generation} |
| 1954 |
@key[pragma] Optimize(Off); -- @Examcom{turn off optional optimizations} |
| 1955 |
@Chg{Version=[3],New=[@key[pragma] Pure(Rational_Numbers); -- @Examcom{set categorization for package} |
| 1956 |
@key[pragma] Assert(Exists(File_Name), |
| 1957 |
Message => "Nonexistent file"); -- @Examcom{assert file exists}], |
| 1958 |
Old=[@key[pragma] Inline(Set_Mask); --@Examcom{ generate code for Set_Mask inline} |
| 1959 |
@Chg{Version=[2],New=[@key[pragma] Import(C, Put_Char, External_Name => "putchar"); --@Examcom{ import C putchar function}], |
| 1960 |
Old=[@key[pragma] Suppress(Range_Check, On => Index); -- @Examcom{turn off range checking on Index}]}]} |
| 1961 |
@end{Example} |
| 1962 |
@end{Examples} |
| 1963 |
|
| 1964 |
@begin{Extend83} |
| 1965 |
@Defn{extensions to Ada 83} |
| 1966 |
The Optimize @nt<pragma> now allows the identifier Off |
| 1967 |
to request that normal optimization be turned off. |
| 1968 |
|
| 1969 |
An Optimize @nt<pragma> may appear anywhere pragmas are allowed. |
| 1970 |
@end{Extend83} |
| 1971 |
|
| 1972 |
@begin{DiffWord83} |
| 1973 |
We now describe the pragmas Page, List, and Optimize here, |
| 1974 |
to act as examples, and to remove the normative material from |
| 1975 |
@RefSec{Language-Defined Pragmas}, so it can be entirely an |
| 1976 |
informative annex. |
| 1977 |
@end{DiffWord83} |
| 1978 |
|
| 1979 |
@begin{DiffWord95} |
| 1980 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00433-01]} |
| 1981 |
@ChgAdded{Version=[2],Text=[Updated the example of named pragma parameters, |
| 1982 |
because the second parameter of @nt{pragma} Suppress is obsolescent.]} |
| 1983 |
@end{DiffWord95} |
| 1984 |
|
| 1985 |
@begin{DiffWord2005} |
| 1986 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0229-1]} |
| 1987 |
@ChgAdded{Version=[3],Text=[Updated the example of pragmas, because both |
| 1988 |
@nt{pragma}s Inline and Import are obsolescent.]} |
| 1989 |
@end{DiffWord2005} |
| 1990 |
|
| 1991 |
|
| 1992 |
@LabeledClause{Reserved Words} |
| 1993 |
|
| 1994 |
@begin{Syntax} |
| 1995 |
@begin{Bundle} |
| 1996 |
@ChgRef{Version=[1], Kind=[Deleted]} |
| 1997 |
@ChgDeleted[Version=[1],Type=[Leading],Text=<@ @;@comment{Empty paragraph to hang junk paragraph number from original RM}>] |
| 1998 |
|
| 1999 |
@ChgRef{Version=[2],Kind=[Revised],ARef=[AI95-00284-02],ARef=[AI95-00395-01]} |
| 2000 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0091-1]} |
| 2001 |
@ChgNote{The table of words has no paragraph number, so we need to put the |
| 2002 |
change here} |
| 2003 |
@Leading |
| 2004 |
@Defn{reserved word} |
| 2005 |
The following are the @i{reserved words}@Chg{Version=[2],New=[. Within a program, |
| 2006 |
some or all of the letters of a reserved word may be in |
| 2007 |
upper case@Chg{Version=[3],New=[],Old=[, and one or |
| 2008 |
more characters in category @ntf{other_format} may be inserted within or at the |
| 2009 |
end of the reserved word]}.],Old=[ (ignoring upper/lower case distinctions):]} |
| 2010 |
@begin{Discussion} |
| 2011 |
Reserved words have special meaning in the syntax. |
| 2012 |
In addition, certain reserved words are used as attribute names. |
| 2013 |
|
| 2014 |
The syntactic category @nt{identifier} |
| 2015 |
no longer allows reserved words. We have added the few reserved |
| 2016 |
words that are legal explicitly to the syntax for @nt{attribute_reference}. |
| 2017 |
Allowing identifier to include reserved words has been a source |
| 2018 |
of confusion for some users, and differs from the way they |
| 2019 |
are treated in the C and Pascal language definitions. |
| 2020 |
@end{Discussion} |
| 2021 |
@* |
| 2022 |
|
| 2023 |
@begin{Display} |
| 2024 |
@begin{FourCol} |
| 2025 |
@noparanum@key{abort} |
| 2026 |
@key{abs} |
| 2027 |
@key{abstract} |
| 2028 |
@key{accept} |
| 2029 |
@key{access} |
| 2030 |
@key{aliased} |
| 2031 |
@key{all} |
| 2032 |
@key{and} |
| 2033 |
@key{array} |
| 2034 |
@key{at} |
| 2035 |
|
| 2036 |
@noparanum@key{begin} |
| 2037 |
@key{body} |
| 2038 |
|
| 2039 |
@noparanum@key{case} |
| 2040 |
@key{constant} |
| 2041 |
|
| 2042 |
@noparanum@key{declare} |
| 2043 |
@key{delay} |
| 2044 |
@key{delta} |
| 2045 |
@key{digits} |
| 2046 |
@key{do} |
| 2047 |
@NewColumn |
| 2048 |
|
| 2049 |
@noparanum@key{else} |
| 2050 |
@key{elsif} |
| 2051 |
@key{end} |
| 2052 |
@key{entry} |
| 2053 |
@key{exception} |
| 2054 |
@key{exit} |
| 2055 |
|
| 2056 |
@noparanum@key{for} |
| 2057 |
@key{function} |
| 2058 |
|
| 2059 |
@noparanum@key{generic} |
| 2060 |
@key{goto} |
| 2061 |
|
| 2062 |
@noparanum@key{if} |
| 2063 |
@key{in} |
| 2064 |
@Chg{Version=[2],New=[@key{interface}],Old=[]} |
| 2065 |
@key{is} |
| 2066 |
|
| 2067 |
|
| 2068 |
@noparanum@key{limited} |
| 2069 |
@key{loop} |
| 2070 |
|
| 2071 |
@noparanum@key{mod} |
| 2072 |
@NewColumn |
| 2073 |
|
| 2074 |
@noparanum@key{new} |
| 2075 |
@key{not} |
| 2076 |
@key{null} |
| 2077 |
|
| 2078 |
|
| 2079 |
@noparanum@key{of} |
| 2080 |
@key{or} |
| 2081 |
@key{others} |
| 2082 |
@key{out} |
| 2083 |
@Chg{Version=[2],New=[@key{overriding}],Old=[]} |
| 2084 |
|
| 2085 |
@noparanum@key{package} |
| 2086 |
@key{pragma} |
| 2087 |
@key{private} |
| 2088 |
@key{procedure} |
| 2089 |
@key{protected} |
| 2090 |
|
| 2091 |
@noparanum@key{raise} |
| 2092 |
@key{range} |
| 2093 |
@key{record} |
| 2094 |
@key{rem} |
| 2095 |
@key{renames} |
| 2096 |
@key{requeue} |
| 2097 |
@NewColumn |
| 2098 |
|
| 2099 |
@noparanum@key{return} |
| 2100 |
@key{reverse} |
| 2101 |
|
| 2102 |
@noparanum@key{select} |
| 2103 |
@key{separate} |
| 2104 |
@Chg{Version=[3],New=[@key{some}],Old=[]} |
| 2105 |
@key{subtype} |
| 2106 |
@Chg{Version=[2],New=[@key{synchronized}],Old=[]} |
| 2107 |
|
| 2108 |
@noparanum@key{tagged} |
| 2109 |
@key{task} |
| 2110 |
@key{terminate} |
| 2111 |
@key{then} |
| 2112 |
@key{type} |
| 2113 |
|
| 2114 |
@noparanum@key{until} |
| 2115 |
@key{use} |
| 2116 |
|
| 2117 |
@noparanum@key{when} |
| 2118 |
@key{while} |
| 2119 |
@key{with} |
| 2120 |
|
| 2121 |
@noparanum@key{xor} |
| 2122 |
@end{FourCol} |
| 2123 |
@end{Display} |
| 2124 |
@end{Bundle} |
| 2125 |
@end{Syntax} |
| 2126 |
|
| 2127 |
@begin{Notes} |
| 2128 |
The reserved words appear in @key{lower case boldface} |
| 2129 |
in this International Standard, |
| 2130 |
except when used in the @nt{designator} of an attribute |
| 2131 |
(see @RefSecNum(Attributes)). |
| 2132 |
Lower case boldface is also used |
| 2133 |
for a reserved word in a |
| 2134 |
@nt{string_literal} used as an @nt{operator_symbol}. |
| 2135 |
This is merely a convention @em programs may be written in whatever |
| 2136 |
typeface is desired and available. |
| 2137 |
@end{Notes} |
| 2138 |
|
| 2139 |
@begin{Incompatible83} |
| 2140 |
@Defn{incompatibilities with Ada 83} |
| 2141 |
The following words are not reserved in Ada 83, but are reserved in Ada |
| 2142 |
95: @key{abstract}, @key{aliased}, @key{protected}, @key{requeue}, |
| 2143 |
@key{tagged}, @key{until}. |
| 2144 |
@end{Incompatible83} |
| 2145 |
|
| 2146 |
@begin{DiffWord83} |
| 2147 |
@ChgRef{Version=[3],Kind=[Revised],ARef=[AI05-0299-1]} |
| 2148 |
The @Chg{Version=[3],New=[subclause],Old=[clause]} entitled @lquotes@;Allowed |
| 2149 |
Replacements of Characters@rquotes@; has been moved to |
| 2150 |
@RefSec(Obsolescent Features). |
| 2151 |
@end{DiffWord83} |
| 2152 |
|
| 2153 |
@begin{Incompatible95} |
| 2154 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00284-02]} |
| 2155 |
@ChgAdded{Version=[2],Text=[@Defn{incompatibilities with Ada 95} |
| 2156 |
The following words are not reserved in Ada 95, but are reserved in Ada |
| 2157 |
2005: @key{interface}, @key{overriding}, @key{synchronized}. A special |
| 2158 |
allowance is made for @key{pragma} Interface (see @RefSecNum{Pragma Interface}). |
| 2159 |
Uses of these words as identifiers will need to be changed, but we do not |
| 2160 |
expect them to be common.]} |
| 2161 |
@end{Incompatible95} |
| 2162 |
|
| 2163 |
@begin{DiffWord95} |
| 2164 |
@ChgRef{Version=[2],Kind=[AddedNormal],ARef=[AI95-00395-01]} |
| 2165 |
@ChgAdded{Version=[2],Text=[The definition of upper case equivalence has |
| 2166 |
been modified to allow identifiers using all of the characters of ISO 10646. |
| 2167 |
This change has no effect on the character sequences that are reserved |
| 2168 |
words, but does make some unusual sequences of characters illegal.]} |
| 2169 |
@end{DiffWord95} |
| 2170 |
|
| 2171 |
@begin{Incompatible2005} |
| 2172 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0091-1]} |
| 2173 |
@ChgAdded{Version=[3],Text=[@Defn{incompatibilities with Ada 2005}@b<Correction:> |
| 2174 |
Removed @ntf{other_format} |
| 2175 |
characters from reserved words in order to be compatible with the latest |
| 2176 |
Unicode recommendations. This change can only affect programs |
| 2177 |
written for original Ada 2005, and there is little reason to put |
| 2178 |
@ntf{other_format} characters into reserved words in the first place, |
| 2179 |
so there should be very few such programs.]} |
| 2180 |
|
| 2181 |
@ChgRef{Version=[3],Kind=[AddedNormal],ARef=[AI05-0176-1]} |
| 2182 |
@ChgAdded{Version=[3],Text=[The following word is not reserved in Ada 2005, but is |
| 2183 |
reserved in Ada 2012: @key{some}. Uses of this word as an identifier will need |
| 2184 |
to be changed, but we do not expect them to be common.]} |
| 2185 |
@end{Incompatible2005} |
| 2186 |
|