~ubuntu-branches/ubuntu/karmic/asis/karmic

« back to all changes in this revision

Viewing changes to asis/asis-expressions.ads

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Quinot
  • Date: 2002-03-03 19:55:58 UTC
  • Revision ID: james.westby@ubuntu.com-20020303195558-g7dp4vaq1zdkf814
Tags: upstream-3.14p
ImportĀ upstreamĀ versionĀ 3.14p

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
------------------------------------------------------------------------------
 
2
--                                                                          --
 
3
--                 ASIS-for-GNAT IMPLEMENTATION COMPONENTS                  --
 
4
--                                                                          --
 
5
--                                                                          --
 
6
--                      A S I S . E X P R E S S I O N S                     --
 
7
--                                                                          --
 
8
--                                 S p e c                                  --
 
9
--                                                                          --
 
10
--                                                                          --
 
11
-- This   specification   is   adapted  from  the  Ada  Semantic  Interface --
 
12
-- Specification  (ASIS)  definition,  ISO/IEC  15291,  Working Draft.  In  --
 
13
-- accordance with the (expected) copyright of the ASIS definition, you can --
 
14
-- freely  copy  and  modify  this  specification,  provided  that  if  you --
 
15
-- redistribute  a  modified  version,  any  changes that you have made are --
 
16
-- clearly indicated.                                                       --
 
17
--                                                                          --
 
18
------------------------------------------------------------------------------
 
19
 
 
20
--  The content of this  specification is taken "as is" from ASIS 2.0.R.
 
21
--  The code is reformatted to follow the GNAT coding style rules
 
22
 
 
23
--  Currently Is_Dispatching_Operation function (section 17.40) is commented
 
24
--  out, because it looks like Asis.Expression is not the right location
 
25
--  for this function, and it should be moved into Asis.Declarations
 
26
 
 
27
------------------------------------------------------------------------------
 
28
--  17 package Asis.Expressions
 
29
------------------------------------------------------------------------------
 
30
------------------------------------------------------------------------------
 
31
package Asis.Expressions is
 
32
------------------------------------------------------------------------------
 
33
------------------------------------------------------------------------------
 
34
--  Asis.Expressions encapsulates a set of queries that operate on
 
35
--  An_Expression and An_Association elements.
 
36
------------------------------------------------------------------------------
 
37
------------------------------------------------------------------------------
 
38
--  17.1  function Corresponding_Expression_Type
 
39
------------------------------------------------------------------------------
 
40
 
 
41
   function Corresponding_Expression_Type
 
42
     (Expression : in Asis.Expression)
 
43
      return Asis.Declaration;
 
44
 
 
45
------------------------------------------------------------------------------
 
46
--  Expression  - Specifies the expression to query
 
47
--
 
48
--  Returns the type declaration for the type or subtype of the expression.
 
49
--  This query does not "unwind" subtypes or derived types to get to the
 
50
--  Corresponding_First_Subtype or Corresponding_Parent_Subtype declarations.
 
51
--  For example, for the following program text:
 
52
--
 
53
--      type Int is range -5_000 .. 5_000;
 
54
--      type My_Int is new Int;
 
55
--      type Good_Int is new My_Int;
 
56
--      Var: Good_Int;
 
57
--
 
58
--  The type declaration for Good_Int should be returned. The "unwinding"
 
59
--  should not occur. The type declaration for either My_Int or Int should not
 
60
--  be returned.
 
61
--
 
62
--  Returns a Nil_Element if the argument Expression does not represent an Ada
 
63
--  expression having an Ada type, including the following classes:
 
64
--
 
65
--   - Naming expressions that name packages, subprograms, tasks, etc.  These
 
66
--     expressions do have a Corresponding_Name_Definition and a
 
67
--     Corresponding_Name_Declaration. Although task objects do have
 
68
--     a type, this query is limited, on purpose.  Thus, when a naming
 
69
--     expression is given to this query (for packages, subprograms,
 
70
--     tasks, etc.), this query will return Nil_Element.  As the
 
71
--     Application Note below indicates, if any further information
 
72
--     is needed, the element should be queried by
 
73
--     Corresponding_Name_Definition or Corresponding_Name_Declaration,
 
74
--     which should eventually return an A_Task_Type_Declaration element.
 
75
--
 
76
--   - When An_Identifier Element representing an attribute designator is
 
77
--     passed as the actual to this query.
 
78
--
 
79
--   - The Actual_Parameter Expression from A_Pragma_Argument_Association for a
 
80
--     Pragma may or may not have a Corresponding_Expression_Type.
 
81
--
 
82
--   - An_Attribute_Reference Element also may or may not have a
 
83
--     Corresponding_Expression_Type;
 
84
--
 
85
--   - An enumeration_aggregate which is a part of
 
86
--     enumeration_representation_clause.
 
87
--
 
88
--  Returns a Nil_Element, if statically determinable type of Expression is a
 
89
--  class-wide type.
 
90
--
 
91
--  --|AN Application Note:
 
92
--  --|AN
 
93
--  --|AN If the returned declaration is Nil, an application should make its
 
94
--  --|AN own analysis based on Corresponding_Name_Definition or
 
95
--  --|AN Corresponding_Name_Declaration to get more information about the
 
96
--  --|AN argument, including the static type resolution for class-wide
 
97
--  --|AN expressions, if needed. Use Enclosing_Element to determine if
 
98
--  --|AN Expression is from pragma argument association. If for such an
 
99
--  --|AN expression, Corresponding_Name_Definition raises ASIS_Failed (with a
 
100
--  --|AN Status of Value_Error), this An_Expression element does not represent
 
101
--  --|AN a normal Ada expression at all and does not follow normal Ada
 
102
--  --|AN semantic rules.
 
103
--  --|AN For example, "pragma Private_Part (Open => Yes);", the "Yes"
 
104
--  --|AN expression may simply be a "keyword" that is specially recognized by
 
105
--  --|AN the implementor's compilation system and may not refer to any
 
106
--  --|AN declared object.
 
107
--
 
108
--  Appropriate Element_Kinds:
 
109
--       An_Expression
 
110
--
 
111
--  Returns Element_Kinds:
 
112
--       Not_An_Element
 
113
--       A_Declaration
 
114
--
 
115
--  --|ER An_Integer_Literal - 2.4 - No child elements
 
116
--  --|ER A_Real_Literal     - 2.4 - No child elements
 
117
--  --|ER A_String_Literal   - 2.6 - No child elements
 
118
--  --|ER
 
119
--  --|ER A string image returned by:
 
120
--  --|ER    function Value_Image
 
121
--
 
122
------------------------------------------------------------------------------
 
123
--  17.2  function Value_Image
 
124
------------------------------------------------------------------------------
 
125
 
 
126
   function Value_Image
 
127
     (Expression : in Asis.Expression)
 
128
      return Wide_String;
 
129
 
 
130
------------------------------------------------------------------------------
 
131
--  Expression  - Specifies the expression to query
 
132
--
 
133
--  Returns the string image of the value of the string, integer, or real
 
134
--  literal.
 
135
--
 
136
--  For string literals, Value will return the quotes around the string
 
137
--  literal, these quotes are doubled, just as any quote appearing embedded in
 
138
--  the string literal in the program text.
 
139
--
 
140
--  The form of numbers returned by this query may vary between implementors.
 
141
--  Implementors are encouraged, but not required, to return numeric literals
 
142
--  using the same based or exponent form used in the original compilation
 
143
--  text.
 
144
--
 
145
--  Appropriate Expression_Kinds:
 
146
--       An_Integer_Literal
 
147
--       A_Real_Literal
 
148
--       A_String_Literal
 
149
--
 
150
------------------------------------------------------------------------------
 
151
--  --|ER An_Identifier          - 4.1 - No child elements
 
152
--  --|ER An_Operator_Symbol     - 4.1 - No child elements
 
153
--  --|ER A_Character_Literal    - 4.1 - No child elements
 
154
--  --|ER An_Enumeration_Literal - 4.1 - No child elements
 
155
--  --|ER
 
156
--  --|ER A string image returned by:
 
157
--  --|ER    function Name
 
158
--  --|ER
 
159
--  --|ER Semantic elements returned by:
 
160
--  --|ER    function Corresponding_Name_Definition
 
161
--  --|ER    function Corresponding_Name_Definition_List
 
162
--  --|ER    function Corresponding_Name_Declaration
 
163
--
 
164
------------------------------------------------------------------------------
 
165
--  17.3  function Name_Image
 
166
------------------------------------------------------------------------------
 
167
 
 
168
   function Name_Image
 
169
     (Expression : in Asis.Expression)
 
170
      return Program_Text;
 
171
 
 
172
------------------------------------------------------------------------------
 
173
--  Name  - Specifies the name to query
 
174
--
 
175
--  Returns the program text image of the name.
 
176
--
 
177
--  An_Operator_Symbol elements have names with embedded quotes """abs"""
 
178
--    (function "abs").
 
179
--
 
180
--  A_Character_Literal elements have names with embedded apostrophes "'x'"
 
181
--    (literal 'x').
 
182
--
 
183
--  An_Enumeration_Literal and An_Identifier elements have identifier names
 
184
--    "Blue" (literal Blue) "Abc" (identifier Abc).
 
185
--
 
186
--  Note: Implicit subtypes that can be encountered while traversing the
 
187
--  semantic information embedded in implicit inherited subprogram declarations
 
188
--  (Reference Manual 3.4 (17-22)) could have names that are unique in a
 
189
--  particular scope.  This is because these subtypes are Is_Part_Of_Implicit
 
190
--  declarations that do not form part of the physical text of the original
 
191
--  compilation units. Some applications may wish to carefully separate the
 
192
--  names of declarations from the names of Is_Part_Of_Implicit declaration
 
193
--  when creating symbol tables and other name-specific lookup mechanisms.
 
194
--
 
195
--  The case of names returned by this query may vary between implementors.
 
196
--  Implementors are encouraged, but not required, to return names in the
 
197
--  same case as was used in the original compilation text.
 
198
--
 
199
--  Appropriate Expression_Kinds:
 
200
--       An_Identifier
 
201
--       An_Operator_Symbol
 
202
--       A_Character_Literal
 
203
--       An_Enumeration_Literal
 
204
--
 
205
------------------------------------------------------------------------------
 
206
--  17.4  function References
 
207
------------------------------------------------------------------------------
 
208
 
 
209
   function References
 
210
     (Name           : in Asis.Element;
 
211
      Within_Element : in Asis.Element;
 
212
      Implicitly     : in Boolean := False)
 
213
      return Asis.Name_List;
 
214
 
 
215
------------------------------------------------------------------------------
 
216
--  Name    - Specifies the entity to query
 
217
--  Within_Element - Specifies the limits for the query which is limited
 
218
--                   to the Element and its children.
 
219
--
 
220
--  If the Implicitly argument is True:
 
221
--    Returns all usage references of the given entity made by both explicit
 
222
--    and implicit elements within the given limits.
 
223
--
 
224
--  If the Implicitly argument is False:
 
225
--    Returns all usage references of the given entity made only by explicit
 
226
--    elements within the given limits.
 
227
--
 
228
--  Returned references are in their order of appearance.
 
229
--
 
230
--  Appropriate Element_Kinds:
 
231
--       A_Defining_Name
 
232
--  Returns Element_Kinds:
 
233
--       An_Expression
 
234
--
 
235
--  May raise ASIS_Failed with a Status of Obsolete_Reference_Error if the
 
236
--  argument is part of an inconsistent compilation unit.
 
237
--
 
238
------------------------------------------------------------------------------
 
239
--  17.5  function Is_Referenced
 
240
------------------------------------------------------------------------------
 
241
 
 
242
   function Is_Referenced
 
243
     (Name           : in Asis.Element;
 
244
      Within_Element : in Asis.Element;
 
245
      Implicitly     : in Boolean := False)
 
246
      return Boolean;
 
247
 
 
248
------------------------------------------------------------------------------
 
249
--  Name    - Specifies the entity to query
 
250
--  Within_Element - Specifies the limits for the query which is limited
 
251
--                   to the Element and its children.
 
252
--
 
253
 
 
254
--  If the Implicitly argument is True:
 
255
--    Returns True if the Name is referenced by either implicit or explicit
 
256
--    elements within the given limits.
 
257
--
 
258
--  If the Implicitly argument is False:
 
259
--    Returns True only if the Name is referenced by explicit elements.
 
260
--
 
261
--  Returns False for any unexpected Element.
 
262
--
 
263
--  Expected Element_Kinds:
 
264
--       A_Defining_Name
 
265
--
 
266
--  May raise ASIS_Failed with a Status of Obsolete_Reference_Error if the
 
267
--  argument is part of an inconsistent compilation unit.
 
268
--
 
269
------------------------------------------------------------------------------
 
270
--  17.6  function Corresponding_Name_Definition
 
271
------------------------------------------------------------------------------
 
272
 
 
273
   function Corresponding_Name_Definition
 
274
     (Reference : in Asis.Expression)
 
275
      return Asis.Defining_Name;
 
276
 
 
277
------------------------------------------------------------------------------
 
278
--  Reference   - Specifies an expression to query
 
279
--
 
280
--  Returns the defining_identifier, defining_character_literal,
 
281
--  defining_operator_symbol, or defining_program_unit_name from the
 
282
--  declaration of the referenced entity.
 
283
--
 
284
--   - Record component references return the defining name of the
 
285
--     record discriminant or component_declaration.  For references to
 
286
--     inherited declarations of derived types, the
 
287
--     Corresponding_Name_Definition returns
 
288
--     the defining name of the implicit inherited declaration.
 
289
--
 
290
--   - References to implicit operators and inherited subprograms will return
 
291
--     an Is_Part_Of_Implicit defining name for the operation.  The
 
292
--     Enclosing_Element of the name is an implicit declaration for the
 
293
--     operation.  The Enclosing_Element of the declaration is the associated
 
294
--     derived_type_definition.
 
295
--
 
296
--   - References to formal parameters given in calls to inherited subprograms
 
297
--     will return an Is_Part_Of_Implicit defining name for the
 
298
--     Parameter_Specification from the inherited subprogram specification.
 
299
--
 
300
--   - References to visible components of instantiated generic packages will
 
301
--     return a name from the expanded generic specification instance.
 
302
--
 
303
--   - References, within expanded generic instances, that refer to other
 
304
--     components of the same, or an enclosing, expanded generic instance,
 
305
--     return a name from the appropriate expanded specification or body
 
306
--     instance.
 
307
--
 
308
--  In case of renaming, the function returns the new name for the entity.
 
309
--
 
310
--  Returns a Nil_Element if the reference is to an implicitly declared
 
311
--  element for which the implementation does not provide declarations and
 
312
--  defining name elements.
 
313
--
 
314
--  Returns a Nil_Element if the argument is a dispatching call.
 
315
--
 
316
--  The Enclosing_Element of a non-Nil result is either a Declaration or a
 
317
--  Statement.
 
318
--
 
319
--  Appropriate Expression_Kinds:
 
320
--       An_Identifier
 
321
--       An_Operator_Symbol
 
322
--       A_Character_Literal
 
323
--       An_Enumeration_Literal
 
324
--
 
325
--  Returns Element_Kinds:
 
326
--       Not_An_Element
 
327
--       A_Defining_Name
 
328
--
 
329
--  --|IP Implementation Permissions:
 
330
--  --|IP
 
331
--  --|IP An implementation may choose to return any part of multi-part
 
332
--  --|IP declarations and definitions. Multi-part declaration/definitions
 
333
--  --|IP can occur for:
 
334
--  --|IP
 
335
--  --|IP    - Subprogram specification in package specification, package body,
 
336
--  --|IP      and subunits (is separate);
 
337
--  --|IP    - Entries in package specification, package body, and subunits
 
338
--  --|IP      (is separate);
 
339
--  --|IP    - Private type and full type declarations;
 
340
--  --|IP    - Incomplete type and full type declarations; and
 
341
--  --|IP    - Deferred constant and full constant declarations.
 
342
--  --|IP
 
343
--  --|IP No guarantee is made that the element will be the first part or
 
344
--  --|IP that the determination will be made due to any visibility rules.
 
345
--  --|IP An application should make its own analysis for each case based
 
346
--  --|IP on which part is returned.
 
347
--  --|IP
 
348
--  --|IP Some implementations do not represent all forms of implicit
 
349
--  --|IP declarations such that elements representing them can be easily
 
350
--  --|IP provided.  An implementation can choose whether or not to construct
 
351
--  --|IP and provide artificial declarations for implicitly declared elements.
 
352
--  --|IP
 
353
--  --|IR Implementation Requirements:
 
354
--  --|IR
 
355
--  Raises ASIS_Inappropriate_Element, with a Status of Value_Error, if passed
 
356
--  a reference that does not have a declaration:
 
357
--
 
358
--  - a reference to an attribute_designator.  Attributes are defined, but
 
359
--    have no implicit or explicit declarations;
 
360
--
 
361
--  - an identifier which syntactically is placed before "=>" in a
 
362
--    pragma_argument_association which has the form of a named association;
 
363
--    such an identifier can never have a declaration;
 
364
--
 
365
--  - an identifier specific to a pragma (Reference Manual, 2.8(10));
 
366
--
 
367
--       pragma Should_I_Check ( Really => Yes );
 
368
--
 
369
--    In this example, both the names Really and Yes have no declaration.
 
370
--
 
371
--  Raises ASIS_Inappropriate_Element, with a Status of Value_Error, if passed
 
372
--  a portion of a pragma that was "ignored" by the compiler and which does
 
373
--  not have (sufficient) semantic information for a proper return result
 
374
--  to be computed.  For example,
 
375
--
 
376
--       pragma I_Am_Ignored (Foof);
 
377
--
 
378
--  The "Foof" expression is An_Identifier but raises this exception
 
379
--  if passed to Corresponding_Name_Definition if the pragma was ignored
 
380
--  or unprocessed.
 
381
--
 
382
--  Raises ASIS_Inappropriate_Element, with a Status of Value_Error, if passed
 
383
--  a portion of a pragma that is an ambiguous reference to more than one
 
384
--  entity.  For example,
 
385
--
 
386
--       pragma Inline ("+");        -- Inlines all "+" operators
 
387
--
 
388
--  The "+" expression is An_Operator_Symbol but raises this
 
389
--  exception if it referenced more than one "+" operator.  In this
 
390
--  case, the Corresponding_Name_Definition_List query can be used to obtain a
 
391
--  list of referenced entities.
 
392
--
 
393
------------------------------------------------------------------------------
 
394
--  17.7  function Corresponding_Name_Definition_List
 
395
------------------------------------------------------------------------------
 
396
 
 
397
   function Corresponding_Name_Definition_List
 
398
     (Reference : in Asis.Element)
 
399
      return Asis.Defining_Name_List;
 
400
 
 
401
------------------------------------------------------------------------------
 
402
--  Reference   - Specifies an entity reference to query
 
403
--
 
404
--  Exactly like Corresponding_Name_Definition except it returns a list.
 
405
--  The list will almost always have a length of one.  The exception to this
 
406
--  is the case where an expression in a pragma is ambiguous and reference
 
407
--  more than one entity.  For example,
 
408
--
 
409
--       pragma Inline ("+");        -- Inlines all "+" operators
 
410
--
 
411
--  The "+" expression is An_Operator_Symbol but could reference more
 
412
--  than one "+" operator.  In this case, the resulting list includes all
 
413
--  referenced entities.
 
414
--
 
415
--  Appropriate Expression_Kinds:
 
416
--       An_Identifier
 
417
--       An_Operator_Symbol
 
418
--       A_Character_Literal
 
419
--       An_Enumeration_Literal
 
420
--
 
421
--  Returns Element_Kinds:
 
422
--       A_Defining_Name
 
423
--
 
424
------------------------------------------------------------------------------
 
425
--  17.8  function Corresponding_Name_Declaration
 
426
------------------------------------------------------------------------------
 
427
 
 
428
   function Corresponding_Name_Declaration
 
429
     (Reference : in Asis.Expression)
 
430
      return Asis.Element;
 
431
 
 
432
------------------------------------------------------------------------------
 
433
--  Reference   - Specifies the entity reference to query
 
434
--
 
435
--  Returns the declaration that declared the entity named by the given
 
436
--  reference.  The result is exactly the same as:
 
437
--
 
438
--       Result := Corresponding_Name_Definition (Reference);
 
439
--       if not Is_Nil (Result) then
 
440
--           Result := Enclosing_Element (Result);
 
441
--       end if;
 
442
--       return Result;
 
443
--
 
444
--  See the comments for Corresponding_Name_Definition for details.
 
445
--  The result is either a Declaration or a Statement.  Statements result
 
446
--  from references to statement labels, loop identifiers, and block
 
447
--  identifiers.
 
448
--
 
449
--  Appropriate Element_Kinds:
 
450
--       An_Expression
 
451
--
 
452
--  Appropriate Expression_Kinds:
 
453
--       An_Identifier
 
454
--       An_Operator_Symbol
 
455
--       A_Character_Literal
 
456
--       An_Enumeration_Literal
 
457
--
 
458
--  Returns Element_Kinds:
 
459
--       A_Declaration
 
460
--       A_Statement
 
461
--
 
462
--  Predefined types, exceptions, operators in package Standard can be
 
463
--  checked by testing that the enclosing Compilation_Unit is standard.
 
464
--  --|ER---------------------------------------------------------------------
 
465
--  --|ER An_Explicit_Dereference - 4.1
 
466
--  --|CR
 
467
--  --|CR Child elements returned by:
 
468
--  --|CR    function Prefix
 
469
--  --|CR
 
470
--
 
471
 
 
472
------------------------------------------------------------------------------
 
473
--  17.9  function Prefix
 
474
------------------------------------------------------------------------------
 
475
 
 
476
   function Prefix (Expression : in Asis.Expression) return Asis.Expression;
 
477
 
 
478
------------------------------------------------------------------------------
 
479
--  Expression  - Specifies the name expression to query
 
480
--
 
481
--  Returns the prefix (the construct to the left of: the rightmost unnested
 
482
--  left parenthesis in function_call elements and indexed_component elements
 
483
--  or slice elements, the rightmost 'dot' for selected_component elements, or
 
484
--  the rightmost tick for attribute_reference elements).
 
485
--
 
486
--  Returns the operator_symbol for infix operator function calls.  The infix
 
487
--  form A + B is equivalent to the prefix form "+"(A, B).
 
488
--
 
489
--  Appropriate Expression_Kinds:
 
490
--       An_Explicit_Dereference       P.ALL
 
491
--       An_Attribute_Reference        Priv'Base'First
 
492
--       A_Function_Call               Abc(...) or Integer'Image(...)
 
493
--       An_Indexed_Component          An_Array(3)
 
494
--       A_Selected_Component          A.B.C
 
495
--       A_Slice                       An_Array(3 .. 5)
 
496
--
 
497
--  Returns Expression_Kinds:
 
498
--       An_Expression
 
499
--
 
500
--  --|ER---------------------------------------------------------------------
 
501
--  --|ER An_Indexed_Component - 4.1.1
 
502
--  --|ER
 
503
--  --|CR
 
504
--  --|CR Child elements returned by:
 
505
--  --|CR    function Prefix
 
506
--  --|CR    function Index_Expressions
 
507
--  --|CR
 
508
--
 
509
------------------------------------------------------------------------------
 
510
--  17.10 function Index_Expressions
 
511
------------------------------------------------------------------------------
 
512
 
 
513
   function Index_Expressions
 
514
     (Expression : in Asis.Expression)
 
515
      return Asis.Expression_List;
 
516
 
 
517
------------------------------------------------------------------------------
 
518
--  Expression  - Specifies an indexed_component to query
 
519
--
 
520
--  Returns the list of expressions (possibly only one) within the parenthesis,
 
521
--  in their order of appearance.
 
522
--
 
523
--  Appropriate Expression_Kinds:
 
524
--       An_Indexed_Component
 
525
--
 
526
--  Returns Element_Kinds:
 
527
--       An_Expression
 
528
--
 
529
--  --|ER---------------------------------------------------------------------
 
530
--  --|ER A_Slice - 4.1.2
 
531
--  --|CR
 
532
--  --|CR Child elements returned by:
 
533
--  --|CR    function Prefix
 
534
--  --|CR    function Slice_Range
 
535
--  --|CR
 
536
--
 
537
 
 
538
------------------------------------------------------------------------------
 
539
--  17.11 function Slice_Range
 
540
------------------------------------------------------------------------------
 
541
 
 
542
   function Slice_Range
 
543
     (Expression : in Asis.Expression)
 
544
      return Asis.Discrete_Range;
 
545
 
 
546
------------------------------------------------------------------------------
 
547
--  Expression  - Specifies the slice to query
 
548
--
 
549
--  Returns the discrete range of the slice.
 
550
--
 
551
--  Appropriate Expression_Kinds:
 
552
--       A_Slice
 
553
--
 
554
--  Returns Definition_Kinds:
 
555
--       A_Discrete_Range
 
556
--
 
557
------------------------------------------------------------------------------
 
558
--  17.12 function Selector
 
559
------------------------------------------------------------------------------
 
560
 
 
561
   function Selector (Expression : in Asis.Expression) return Asis.Expression;
 
562
 
 
563
------------------------------------------------------------------------------
 
564
--  Expression  - Specifies the selected_component to query
 
565
--
 
566
--  Returns the selector (the construct to the right of the rightmost 'dot' in
 
567
--  the selected_component).
 
568
--
 
569
--  Appropriate Expression_Kinds:
 
570
--       A_Selected_Component
 
571
--
 
572
--  Returns Expression_Kinds:
 
573
--       An_Identifier
 
574
--       An_Operator_Symbol
 
575
--       A_Character_Literal
 
576
--       An_Enumeration_Literal
 
577
--
 
578
------------------------------------------------------------------------------
 
579
--  17.13 function Attribute_Designator_Identifier
 
580
------------------------------------------------------------------------------
 
581
 
 
582
   function Attribute_Designator_Identifier
 
583
     (Expression : in Asis.Expression)
 
584
      return Asis.Expression;
 
585
 
 
586
------------------------------------------------------------------------------
 
587
--  Expression  - Specifies an attribute_reference expression to query
 
588
--
 
589
--  Returns the identifier of the attribute_designator (the construct to the
 
590
--  right of the rightmost tick of the attribute_reference).  The Prefix of
 
591
--  the attribute_reference can itself be an attribute_reference as in
 
592
--  T'BASE'FIRST where the prefix is T'BASE and the attribute_designator name
 
593
--  is FIRST.
 
594
--
 
595
--  Attribute_designator reserved words "access", "delta", and "digits" are
 
596
--  treated as An_Identifier.
 
597
--
 
598
--  Appropriate Expression_Kinds:
 
599
--       An_Attribute_Reference
 
600
--
 
601
--  Returns Expression_Kinds:
 
602
--       An_Identifier
 
603
--
 
604
 
 
605
------------------------------------------------------------------------------
 
606
--  17.14 function Attribute_Designator_Expressions
 
607
------------------------------------------------------------------------------
 
608
 
 
609
   function Attribute_Designator_Expressions
 
610
     (Expression : in Asis.Expression)
 
611
      return Asis.Expression_List;
 
612
 
 
613
------------------------------------------------------------------------------
 
614
--  Expression  - Specifies an attribute expression to query
 
615
--
 
616
--  Returns the static expressions associated with the optional argument of the
 
617
--  attribute_designator.  Expected predefined attributes are A'First(N),
 
618
--  A'Last(N), A'Length(N), and A'Range(N).
 
619
--
 
620
--  Returns a Nil_Element_List if there are no arguments.
 
621
--
 
622
--  Appropriate Expression_Kinds:
 
623
--       An_Attribute_Reference
 
624
--           Appropriate Attribute_Kinds:
 
625
--                A_First_Attribute
 
626
--                A_Last_Attribute
 
627
--                A_Length_Attribute
 
628
--                A_Range_Attribute
 
629
--                An_Implementation_Defined_Attribute
 
630
--                An_Unknown_Attribute
 
631
--
 
632
--  Returns Element_Kinds:
 
633
--       An_Expression
 
634
--
 
635
--  --|IP Implementation Permissions:
 
636
--  --|IP
 
637
--  --|IP This query returns a list to support implementation-defined
 
638
--  --|IP attributes that may have more than one static_expression.
 
639
--
 
640
------------------------------------------------------------------------------
 
641
--  17.15 function Record_Component_Associations
 
642
------------------------------------------------------------------------------
 
643
 
 
644
   function Record_Component_Associations
 
645
     (Expression : in Asis.Expression;
 
646
      Normalized : in Boolean := False)
 
647
      return Asis.Association_List;
 
648
 
 
649
------------------------------------------------------------------------------
 
650
--  Expression  - Specifies an aggregate expression to query
 
651
--  Normalized  - Specifies whether the normalized form is desired
 
652
--
 
653
--  Returns a list of the record_component_association elements of a
 
654
--  record_aggregate or an extension_aggregate.
 
655
--
 
656
--  Returns a Nil_Element_List if the aggregate is of the form (null record).
 
657
--
 
658
--  An unnormalized list contains all needed associations ordered as they
 
659
--  appear in the program text.  Each unnormalized association has an optional
 
660
--  list of discriminant_selector_name elements, and an explicit expression.
 
661
--
 
662
--  A normalized list contains artificial associations representing all
 
663
--  needed components in an order matching the declaration order of the
 
664
--  needed components.
 
665
--
 
666
--  Each normalized association represents a one on one mapping of a
 
667
--  component to the explicit expression.  A normalized association has one
 
668
--  A_Defining_Name component that denotes the discriminant_specification or
 
669
--  component_declaration, and one An_Expression component that is the
 
670
--  expression.
 
671
--
 
672
--  Appropriate Expression_Kinds:
 
673
--       A_Record_Aggregate
 
674
--       An_Extension_Aggregate
 
675
--
 
676
--  Returns Association_Kinds:
 
677
--       A_Record_Component_Association
 
678
--
 
679
--  --|IR Implementation Requirements:
 
680
--  --|IR
 
681
--  --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit.
 
682
--  --|IR Normalized associations are never Is_Equal to unnormalized
 
683
--  --|IR associations.
 
684
--  --|IR
 
685
--  --|IP Implementation Permissions:
 
686
--  --|IP
 
687
--  --|IP An implementation may choose to normalize its internal representation
 
688
--  --|IP to use the defining_identifier element instead of the
 
689
--  --|IP component_selector_name  element.
 
690
--  --|IP
 
691
--  --|IP If so, this query will return Is_Normalized associations even if
 
692
--  --|IP Normalized is False, and the query
 
693
--  --|IP Record_Component_Associations_Normalized will return True.
 
694
--
 
695
------------------------------------------------------------------------------
 
696
--  17.16 function Extension_Aggregate_Expression
 
697
------------------------------------------------------------------------------
 
698
 
 
699
   function Extension_Aggregate_Expression
 
700
     (Expression : in Asis.Expression)
 
701
      return Asis.Expression;
 
702
 
 
703
------------------------------------------------------------------------------
 
704
--  Expression  - Specifies an extension_aggregate expression to query
 
705
--
 
706
--  Returns the ancestor_part expression preceding the reserved word with in
 
707
--  the extension_aggregate.
 
708
--
 
709
--  Appropriate Expression_Kinds:
 
710
--       An_Extension_Aggregate
 
711
--
 
712
--  Returns Element_Kinds:
 
713
--       An_Expression
 
714
--
 
715
------------------------------------------------------------------------------
 
716
--  17.17 function Array_Component_Associations
 
717
------------------------------------------------------------------------------
 
718
 
 
719
   function Array_Component_Associations
 
720
     (Expression : in Asis.Expression)
 
721
      return Asis.Association_List;
 
722
 
 
723
------------------------------------------------------------------------------
 
724
--  Expression  - Specifies an array aggregate expression to query
 
725
--
 
726
--  Returns a list of the Array_Component_Associations in an array aggregate.
 
727
--
 
728
--  Appropriate Expression_Kinds:
 
729
--       A_Positional_Array_Aggregate
 
730
--       A_Named_Array_Aggregate
 
731
--
 
732
--  Returns Association_Kinds:
 
733
--       An_Array_Component_Association
 
734
--
 
735
--  --|AN Application Note:
 
736
--  --|AN
 
737
--  --|AN While positional_array_aggregate elements do not have
 
738
--  --|AN array_component_association elements defined by Ada syntax, ASIS
 
739
--  --|AN treats A_Positional_Array_Aggregate as if it were
 
740
--  --|AN A_Named_Array_Aggregate. The An_Array_Component_Association elements
 
741
--  --|AN returned will have Array_Component_Choices that are a
 
742
--  --|AN Nil_Element_List for all positional expressions except an others
 
743
--  --|AN choice.
 
744
--
 
745
 
 
746
------------------------------------------------------------------------------
 
747
--  17.18 function Array_Component_Choices
 
748
------------------------------------------------------------------------------
 
749
 
 
750
   function Array_Component_Choices
 
751
     (Association : in Asis.Association)
 
752
      return Asis.Expression_List;
 
753
 
 
754
------------------------------------------------------------------------------
 
755
--  Association - Specifies the component association to query
 
756
--
 
757
--  If the Association is from a named_array_aggregate:
 
758
--
 
759
--    Returns the discrete_choice_list order of appearance.  The choices are
 
760
--    either An_Expression or A_Discrete_Range elements, or a single
 
761
--    An_Others_Choice element.
 
762
--
 
763
--  If the Association is from a positional_array_aggregate:
 
764
--
 
765
--    Returns a single An_Others_Choice if the association is an others
 
766
--    choice (others => expression).
 
767
--
 
768
--    Returns a Nil_Element_List otherwise.
 
769
--
 
770
--  Appropriate Association_Kinds:
 
771
--       An_Array_Component_Association
 
772
--
 
773
--  Returns Element_Kinds:
 
774
--       A_Definition
 
775
--       An_Expression
 
776
--
 
777
--  Returns Definition_Kinds:
 
778
--       A_Discrete_Range
 
779
--       An_Others_Choice
 
780
--
 
781
------------------------------------------------------------------------------
 
782
--  17.19 function Record_Component_Choices
 
783
------------------------------------------------------------------------------
 
784
 
 
785
   function Record_Component_Choices
 
786
     (Association : in Asis.Association)
 
787
      return Asis.Expression_List;
 
788
 
 
789
------------------------------------------------------------------------------
 
790
--  Association - Specifies the component association to query
 
791
--
 
792
--  If the Association argument is from an unnormalized list:
 
793
--
 
794
--  - If the Association is a named component association:
 
795
--
 
796
--    Returns the component_choice_list order of appearance.  The choices are
 
797
--    either An_Identifier elements representing component_selector_name
 
798
--    elements, or a single An_Others_Choice element.
 
799
--
 
800
--    The Enclosing_Element of the choices is the Association argument.
 
801
--
 
802
--  - If the Association is a positional component association:
 
803
--
 
804
--    Returns a Nil_Element_List.
 
805
--
 
806
--  If the Association argument is from a Normalized list:
 
807
--
 
808
--    Returns a list containing a single choice:
 
809
--
 
810
--    - A_Defining_Name element representing the defining_identifier of
 
811
--      the component_declaration.
 
812
--
 
813
--    The Enclosing_Element of the A_Defining_Name is the
 
814
--    component_declaration.
 
815
--
 
816
--   Normalized lists contain artificial ASIS An_Association elements that
 
817
--   provide one formal A_Defining_Name => An_Expression pair per
 
818
--   association.  These artificial associations are Is_Normalized.  Their
 
819
--   component A_Defining_Name is not Is_Normalized.
 
820
--
 
821
--  Appropriate Association_Kinds:
 
822
--       A_Record_Component_Association
 
823
--
 
824
--  Returns Element_Kinds:
 
825
--       A_Defining_Name             -- Is_Normalized(Association)
 
826
--       An_Expression               -- not Is_Normalized(Association)
 
827
--            Returns Expression_Kinds:
 
828
--                 An_Identifier
 
829
--       A_Definition
 
830
--            Returns Definition_Kinds:
 
831
--                 An_Others_Choice
 
832
--
 
833
------------------------------------------------------------------------------
 
834
--  17.20 function Component_Expression
 
835
------------------------------------------------------------------------------
 
836
 
 
837
   function Component_Expression
 
838
     (Association : in Asis.Association)
 
839
      return Asis.Expression;
 
840
 
 
841
------------------------------------------------------------------------------
 
842
--  Association - Specifies the component association to query
 
843
--
 
844
--  Returns the expression of the record_component_association or
 
845
--  array_component_association.
 
846
--
 
847
--  The Enclosing_Element of the expression is the Association argument.
 
848
--
 
849
--  Normalized lists contain artificial ASIS An_Association elements that
 
850
--  provide one formal A_Defining_Name => An_Expression pair per
 
851
--  association.  These artificial associations are Is_Normalized.  Their
 
852
--  component An_Expression elements are not Is_Normalized.
 
853
--
 
854
--  Appropriate Association_Kinds:
 
855
--       A_Record_Component_Association
 
856
--       An_Array_Component_Association
 
857
--
 
858
--  Returns Element_Kinds:
 
859
--       An_Expression
 
860
--
 
861
------------------------------------------------------------------------------
 
862
--  17.21 function Formal_Parameter
 
863
------------------------------------------------------------------------------
 
864
 
 
865
   function Formal_Parameter
 
866
     (Association : in Asis.Association)
 
867
      return Asis.Element;
 
868
 
 
869
------------------------------------------------------------------------------
 
870
--  Association - Specifies the association to query
 
871
--
 
872
--  If the Association argument is from an unnormalized list:
 
873
--
 
874
--  - If the Association is given in named notation:
 
875
--
 
876
--    Returns An_Identifier representing the formal_parameter_selector_name,
 
877
--    generic_formal_parameter_selector_name, or pragma_argument_identifier.
 
878
--
 
879
--    The Enclosing_Element of the An_Identifier element is the Association
 
880
--    argument.
 
881
--
 
882
--  - If the Association is given in positional notation:
 
883
--
 
884
--    Returns a Nil_Element.
 
885
--
 
886
--  If the Association argument is from a Normalized list:
 
887
--
 
888
--   - Returns A_Defining_Name representing the defining_identifier of the
 
889
--     parameter_specification or generic_formal_parameter_declaration.
 
890
--     Pragma_argument_association elements are not available in normalized
 
891
--     form.
 
892
--
 
893
--   - The Enclosing_Element of the A_Defining_Name is the
 
894
--     parameter_specification or generic_formal_parameter_declaration element.
 
895
--
 
896
--  Normalized lists contain artificial ASIS An_Association elements that
 
897
--  provide one formal A_Defining_Name => An_Expression pair per
 
898
--  association.  These artificial associations are Is_Normalized.  Their
 
899
--  component A_Defining_Name elements are not Is_Normalized.
 
900
--
 
901
--  Appropriate Association_Kinds:
 
902
--       A_Parameter_Association
 
903
--       A_Generic_Association
 
904
--       A_Pragma_Argument_Association
 
905
--
 
906
--  Returns Element_Kinds:
 
907
--       Not_An_Element
 
908
--       An_Operator_Symbol
 
909
--       A_Defining_Name             -- Is_Normalized(Association)
 
910
--       An_Expression               -- not Is_Normalized(Association)
 
911
--            Returns Expression_Kinds:
 
912
--                  An_Identifier
 
913
--
 
914
------------------------------------------------------------------------------
 
915
--  17.22 function Actual_Parameter
 
916
------------------------------------------------------------------------------
 
917
 
 
918
   function Actual_Parameter
 
919
     (Association : in Asis.Association)
 
920
      return Asis.Expression;
 
921
 
 
922
------------------------------------------------------------------------------
 
923
--  Association   - Specifies the association to query
 
924
--
 
925
--  If the Association argument is from an unnormalized list:
 
926
--
 
927
--    Returns An_Expression representing:
 
928
--
 
929
--    - the explicit_actual_parameter of a parameter_association.
 
930
--
 
931
--    - the explicit_generic_actual_parameter of a generic_association.
 
932
--
 
933
--    - the name or expression of a pragma_argument_association.
 
934
--
 
935
--    The Enclosing_Element of An_Expression is the Association argument.
 
936
--
 
937
--  If the Association argument is from a Normalized list:
 
938
--
 
939
--  - If the Association is given explicitly:
 
940
--
 
941
--    Returns An_Expression representing:
 
942
--
 
943
--    - the explicit_actual_parameter of a parameter_association.
 
944
--
 
945
--    - the explicit_generic_actual_parameter of a generic_association.
 
946
--
 
947
--    The Enclosing_Element of An_Expression is the Association argument.
 
948
--
 
949
--  - If the Association is given by default:
 
950
--
 
951
--    Returns An_Expression representing:
 
952
--
 
953
--    - the corresponding default_expression of the Is_Normalized
 
954
--      A_Parameter_Association.
 
955
--
 
956
--   - the corresponding default_expression or default_name of the
 
957
--     Is_Normalized A_Generic_Association.
 
958
--
 
959
--   - The Enclosing_Element of the An_Expression element is the
 
960
--     parameter_specification or generic_formal_parameter_declaration that
 
961
--     contains the default_expression or default_name, except for the case
 
962
--     when this An_Expression element is an implicit naming expression
 
963
--     representing the actual subprogram selected at the place of the
 
964
--     instantiation for A_Box_Default.  In the latter case, the
 
965
--     Enclosing_Element for such An_Expression is the instantiation.
 
966
--
 
967
--  Normalized lists contain artificial ASIS An_Association elements that
 
968
--  provide one formal A_Defining_Name => An_Expression pair per
 
969
--  association.  These artificial associations are Is_Normalized.
 
970
--  Artificial associations of default associations are
 
971
--  Is_Defaulted_Association.  Their component An_Expression elements are
 
972
--  not Is_Normalized and are not Is_Defaulted_Association.
 
973
--
 
974
--  If the argument is A_Pragma_Argument_Association, then this function may
 
975
--  return any expression to support implementation-defined pragmas.
 
976
--
 
977
--  Appropriate Association_Kinds:
 
978
--       A_Parameter_Association
 
979
--       A_Generic_Association
 
980
--       A_Pragma_Argument_Association
 
981
--
 
982
--  Returns Element_Kinds:
 
983
--       An_Expression
 
984
--
 
985
------------------------------------------------------------------------------
 
986
--  17.23 function Discriminant_Selector_Names
 
987
------------------------------------------------------------------------------
 
988
 
 
989
   function Discriminant_Selector_Names
 
990
     (Association : in Asis.Discriminant_Association)
 
991
      return Asis.Expression_List;
 
992
 
 
993
------------------------------------------------------------------------------
 
994
--  Association - Specifies the discriminant association to query
 
995
--
 
996
--  If the Association argument is from an unnormalized list:
 
997
--
 
998
--  - If the Association is a named discriminant_association:
 
999
--
 
1000
--    Returns a list of the An_Identifier discriminant_selector_name elements
 
1001
--    in order of appearance.
 
1002
--
 
1003
--    The Enclosing_Element of the names is the Association argument.
 
1004
--
 
1005
--  - If the Association is a positional discriminant_association:
 
1006
--
 
1007
--    Returns a Nil_Element_List.
 
1008
--
 
1009
--  If the Association argument is from a Normalized list:
 
1010
--
 
1011
--    Returns a list containing a single A_Defining_Name element representing
 
1012
--    the defining_identifier of the discriminant_specification.
 
1013
--
 
1014
--    The Enclosing_Element of the A_Defining_Name is the
 
1015
--    discriminant_specification.
 
1016
--
 
1017
--   Normalized lists contain artificial ASIS An_Association elements that
 
1018
--   provide one formal A_Defining_Name => An_Expression pair per
 
1019
--   association.  These artificial associations are Is_Normalized.  Their
 
1020
--   component A_Defining_Name elements are not Is_Normalized.
 
1021
--
 
1022
--  Appropriate Association_Kinds:
 
1023
--       A_Discriminant_Association
 
1024
--
 
1025
--  Returns Element_Kinds:
 
1026
--       A_Defining_Name             -- Is_Normalized(Association)
 
1027
--       An_Expression               -- not Is_Normalized(Association)
 
1028
--            Returns Expression_Kinds:
 
1029
--                 An_Identifier
 
1030
--
 
1031
 
 
1032
------------------------------------------------------------------------------
 
1033
--  17.24 function Discriminant_Expression
 
1034
------------------------------------------------------------------------------
 
1035
 
 
1036
   function Discriminant_Expression
 
1037
     (Association : in Asis.Discriminant_Association)
 
1038
      return Asis.Expression;
 
1039
 
 
1040
------------------------------------------------------------------------------
 
1041
--  Association - Specifies the discriminant_association to query
 
1042
--
 
1043
--  If the Association argument is from an unnormalized list:
 
1044
--
 
1045
--    Returns An_Expression representing the expression of the
 
1046
--    discriminant_association.
 
1047
--
 
1048
--    The Enclosing_Element of An_Expression is the Association argument.
 
1049
--
 
1050
--  If the Association argument is from a Normalized list:
 
1051
--
 
1052
--  - If the Association is given explicitly:
 
1053
--
 
1054
--    Returns An_Expression representing the expression of the
 
1055
--    discriminant_association.
 
1056
--
 
1057
--    The Enclosing_Element of An_Expression is the Association argument.
 
1058
--
 
1059
--  - If the Association is given by default:
 
1060
--
 
1061
--    Returns An_Expression representing:
 
1062
--
 
1063
--    - the corresponding default_expression of the Is_Normalized
 
1064
--      A_Discriminant_Association.
 
1065
--
 
1066
--    - The Enclosing_Element of the An_Expression element is the
 
1067
--      discriminant_specification that contains the default_expression.
 
1068
--
 
1069
--   Normalized lists contain artificial ASIS An_Association elements that
 
1070
--   provide one formal A_Defining_Name => An_Expression pair per
 
1071
--   association.  These artificial associations are Is_Normalized.
 
1072
--   Artificial associations of default associations are
 
1073
--   Is_Defaulted_Association.  Their component An_Expression elements are
 
1074
--   not Is_Normalized and are not Is_Defaulted_Association.
 
1075
--
 
1076
--   Appropriate Association_Kinds:
 
1077
--       A_Discriminant_Association
 
1078
--
 
1079
--  Returns Element_Kinds:
 
1080
--       An_Expression
 
1081
--
 
1082
------------------------------------------------------------------------------
 
1083
--  17.25 function Is_Normalized
 
1084
------------------------------------------------------------------------------
 
1085
 
 
1086
   function Is_Normalized (Association : in Asis.Association) return Boolean;
 
1087
 
 
1088
------------------------------------------------------------------------------
 
1089
--  Association - Specifies the association to query
 
1090
--
 
1091
--  Returns True if the association is a normalized, artificially created
 
1092
--  association returned by the queries Discriminant_Associations,
 
1093
--  Generic_Actual_Part, Call_Statement_Parameters,
 
1094
--  Record_Component_Associations, or Function_Call_Parameters where
 
1095
--  Normalized => True (or the operation returns Is_Normalized associations
 
1096
--  even if Normalized => False).  See the Implementation Permissions for
 
1097
--  these queries.
 
1098
--
 
1099
--  Returns False for any unexpected Element.
 
1100
--
 
1101
 
 
1102
--  Expected Association_Kinds:
 
1103
--       A_Discriminant_Association
 
1104
--       A_Record_Component_Association
 
1105
--       A_Parameter_Association
 
1106
--       A_Generic_Association
 
1107
--
 
1108
------------------------------------------------------------------------------
 
1109
--  17.26 function Is_Defaulted_Association
 
1110
------------------------------------------------------------------------------
 
1111
 
 
1112
   function Is_Defaulted_Association
 
1113
     (Association : in Asis.Association)
 
1114
      return Boolean;
 
1115
 
 
1116
------------------------------------------------------------------------------
 
1117
--   Association - Specifies the association to query
 
1118
--
 
1119
--  Returns True if the association is a normalized, artificially created
 
1120
--  association returned by the queries Discriminant_Associations,
 
1121
--  Generic_Actual_Part, Record_Component_Associations,
 
1122
--  Call_Statement_Parameters, or Function_Call_Parameters where
 
1123
--  Normalized => True (or the operation returns default associations even if
 
1124
--  Normalized => False) and the association contains a default expression.
 
1125
--  A default expression is one that is implicitly supplied by the language
 
1126
--  semantics and that was not explicitly supplied (typed) by the user.
 
1127
--
 
1128
--  Returns False for any unexpected Element.
 
1129
--
 
1130
--  Expected Association_Kinds:
 
1131
--       A_Parameter_Association
 
1132
--       A_Generic_Association
 
1133
--
 
1134
--  --|AN Note: Always returns False for discriminant associations.  Defaulted
 
1135
--  --|AN discriminant associations occur only when the discriminant constraint
 
1136
--  --|AN is completely missing from a subtype indication.  Consequently, it is
 
1137
--  --|AN not possible to obtain a (normalized) discriminant constraint list
 
1138
--  --|AN for such subtype indications. Always returns False for component
 
1139
--  --|AN associations. Aggregates cannot have defaulted components.
 
1140
--
 
1141
------------------------------------------------------------------------------
 
1142
--  17.27 function Expression_Parenthesized
 
1143
------------------------------------------------------------------------------
 
1144
 
 
1145
   function Expression_Parenthesized
 
1146
     (Expression : in Asis.Expression)
 
1147
      return Asis.Expression;
 
1148
 
 
1149
------------------------------------------------------------------------------
 
1150
--  Expression  - Specifies the parenthesized expression to query
 
1151
--
 
1152
--  Returns the expression within the parenthesis.  This operation unwinds only
 
1153
--  one set of parenthesis at a time, so the result may itself be
 
1154
--  A_Parenthesized_Expression.
 
1155
--
 
1156
--  A_Parenthesized_Expression kind corresponds only to the (expression)
 
1157
--  alternative in the syntax notion of primary in Reference Manual 4.4.  For
 
1158
--  example, an expression of a type_conversion is A_Parenthesized_Expression
 
1159
--  only if it is similar to the form subtype_mark((expression)) where it has
 
1160
--  at least one set of its own parenthesis.
 
1161
--
 
1162
--  Appropriate Expression_Kinds:
 
1163
--       A_Parenthesized_Expression
 
1164
--
 
1165
--  Returns Element_Kinds:
 
1166
--       An_Expression
 
1167
--
 
1168
 
 
1169
------------------------------------------------------------------------------
 
1170
--  17.28 function Is_Prefix_Call
 
1171
------------------------------------------------------------------------------
 
1172
 
 
1173
   function Is_Prefix_Call (Expression : in Asis.Expression) return Boolean;
 
1174
 
 
1175
------------------------------------------------------------------------------
 
1176
--  Expression  - Specifies the function call expression to query
 
1177
--
 
1178
--  Returns True if the function call is in prefix form.
 
1179
--
 
1180
--  Returns False for any unexpected Element.
 
1181
--
 
1182
--  For example, - Foo (A, B);   -- Returns TRUE
 
1183
--                 "<" (A, B);   -- Returns TRUE
 
1184
--                 ... A < B ... -- Returns FALSE
 
1185
--
 
1186
--  Expected Expression_Kinds:
 
1187
--       A_Function_Call
 
1188
--
 
1189
------------------------------------------------------------------------------
 
1190
--  17.29 function Corresponding_Called_Function
 
1191
------------------------------------------------------------------------------
 
1192
 
 
1193
   function Corresponding_Called_Function
 
1194
     (Expression : in Asis.Expression)
 
1195
      return Asis.Declaration;
 
1196
 
 
1197
------------------------------------------------------------------------------
 
1198
--  Expression  - Specifies the function_call to query
 
1199
--
 
1200
--  Returns the declaration of the called function.
 
1201
--
 
1202
--  Returns a Nil_Element if the:
 
1203
--
 
1204
--   - function_prefix denotes a predefined operator for which the
 
1205
--     implementation does not provide an artificial function declaration,
 
1206
--
 
1207
--   - prefix of the call denotes an access to a function implicit or explicit
 
1208
--     dereference,
 
1209
--
 
1210
--   - argument is a dispatching call.
 
1211
--
 
1212
--  If function_prefix denotes an attribute_reference, and if the corresponding
 
1213
--  attribute is (re)defined by an attribute definition clause, an
 
1214
--  implementation is encouraged, but not required, to return the definition
 
1215
--  of the corresponding subprogram whose name is used after "use" in this
 
1216
--  attribute definition clause. If an implementation cannot return such a
 
1217
--  subprogram definition, a Nil_Element should be returned. For an attribute
 
1218
--  reference which is not (re)defined by an attribute definition clause, a
 
1219
--  Nil_Element should be returned.
 
1220
--
 
1221
--  Appropriate Expression_Kinds:
 
1222
--       A_Function_Call
 
1223
--
 
1224
--  Returns Declaration_Kinds:
 
1225
--       Not_A_Declaration
 
1226
--       A_Function_Declaration
 
1227
--       A_Function_Body_Declaration
 
1228
--       A_Function_Body_Stub
 
1229
--       A_Function_Renaming_Declaration
 
1230
--       A_Function_Instantiation
 
1231
--       A_Formal_Function_Declaration
 
1232
--       A_Generic_Function_Declaration
 
1233
--
 
1234
--  --|IP Implementation Permissions:
 
1235
--  --|IP
 
1236
--  --|IP An implementation may choose to return any part of multi-part
 
1237
--  --|IP declarations and definitions. Multi-part declaration/definitions
 
1238
--  --|IP can occur for:
 
1239
--  --|IP
 
1240
--  --|IP    - Subprogram specification in package specification, package body,
 
1241
--  --|IP      and subunits (is separate);
 
1242
--  --|IP    - Entries in package specification, package body, and subunits
 
1243
--  --|IP      (is separate);
 
1244
--  --|IP    - Private type and full type declarations;
 
1245
--  --|IP    - Incomplete type and full type declarations; and
 
1246
--  --|IP    - Deferred constant and full constant declarations.
 
1247
--  --|IP
 
1248
--  --|IP No guarantee is made that the element will be the first part or
 
1249
--  --|IP that the determination will be made due to any visibility rules.
 
1250
--  --|IP An application should make its own analysis for each case based
 
1251
--  --|IP on which part is returned.
 
1252
--  --|IP
 
1253
--  --|IP An implementation can choose whether or not to construct and provide
 
1254
--  --|IP artificial implicit declarations for predefined operators.
 
1255
--
 
1256
------------------------------------------------------------------------------
 
1257
--  17.30 function Function_Call_Parameters
 
1258
------------------------------------------------------------------------------
 
1259
 
 
1260
   function Function_Call_Parameters
 
1261
     (Expression : in Asis.Expression;
 
1262
      Normalized : in Boolean := False)
 
1263
      return Asis.Association_List;
 
1264
 
 
1265
------------------------------------------------------------------------------
 
1266
--  Expression  - Specifies the function call expression to query
 
1267
--  Normalized  - Specifies whether the normalized form is desired
 
1268
--
 
1269
--  Returns a list of parameter_association elements of the call.
 
1270
--
 
1271
--  Returns a Nil_Element_List if there are no parameter_association elements.
 
1272
--
 
1273
--  An unnormalized list contains only explicit associations ordered as they
 
1274
--  appear in the program text.  Each unnormalized association has an optional
 
1275
--  formal_parameter_selector_name and an explicit_actual_parameter component.
 
1276
--
 
1277
--  A normalized list contains artificial associations representing all
 
1278
--  explicit and default associations.  It has a length equal to the number of
 
1279
--  parameter_specification elements of the formal_part of the
 
1280
--  parameter_and_result_profile.  The order of normalized associations matches
 
1281
--  the order of parameter_specification elements.
 
1282
--
 
1283
--  Each normalized association represents a one on one mapping of a
 
1284
--  parameter_specification elements to the explicit or default expression.
 
1285
--  A normalized association has one A_Defining_Name component that denotes the
 
1286
--  parameter_specification, and one An_Expression component that is either the
 
1287
--  explicit_actual_parameter or a default_expression.
 
1288
--
 
1289
--  If the prefix of the call denotes an access to a function implicit or
 
1290
--  explicit deference, normalized associations are constructed on the basis
 
1291
--  of the formal_part of the parameter_and_result_profile from the
 
1292
--  corresponding access_to_subprogram definition.
 
1293
 
 
1294
--  Returns Nil_Element for normalized associations in the case where
 
1295
--  the called function can be determined only dynamically (dispatching
 
1296
--  calls). ASIS cannot produce any meaningful result in this case.
 
1297
 
 
1298
--  The exception ASIS_Inappropriate_Element is raised when the function
 
1299
--  call is an attribute reference and Is_Normalized is True.
 
1300
--
 
1301
--  Appropriate Expression_Kinds:
 
1302
--       A_Function_Call
 
1303
--
 
1304
--  Returns Element_Kinds:
 
1305
--       A_Parameter_Association
 
1306
--
 
1307
--  --|IR Implementation Requirements:
 
1308
--  --|IR
 
1309
--  --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit.
 
1310
--  --|IR Normalized associations provided by default are
 
1311
--  --|AN Is_Defaulted_Association. Normalized associations are never Is_Equal
 
1312
--  --|AN to unnormalized associations.
 
1313
--  --|IR
 
1314
--  --|IP Implementation Permissions:
 
1315
--  --|IP
 
1316
--  --|IP An implementation may choose to always include default parameters in
 
1317
--  --|IP its internal representation.
 
1318
--  --|IP
 
1319
--  --|IP An implementation may also choose to normalize its representation
 
1320
--  --|IP to use defining_identifier elements rather than
 
1321
--  --|IP formal_parameter_selector_name elements.
 
1322
--  --|IP
 
1323
--  --|IP In either case, this query will return Is_Normalized associations
 
1324
--  --|IP even if Normalized is False, and the query
 
1325
--  --|IP Function_Call_Parameters_Normalized will return True.
 
1326
--
 
1327
------------------------------------------------------------------------------
 
1328
--  17.31 function Short_Circuit_Operation_Left_Expression
 
1329
------------------------------------------------------------------------------
 
1330
 
 
1331
   function Short_Circuit_Operation_Left_Expression
 
1332
     (Expression : in Asis.Expression)
 
1333
      return Asis.Expression;
 
1334
 
 
1335
------------------------------------------------------------------------------
 
1336
--  Expression  - Specifies the short circuit operation to query
 
1337
--
 
1338
--  Returns the expression preceding the reserved words "and then" or "or else"
 
1339
--  in the short circuit expression.
 
1340
--
 
1341
--  Appropriate Expression_Kinds:
 
1342
--       An_And_Then_Short_Circuit
 
1343
--       An_Or_Else_Short_Circuit
 
1344
--
 
1345
--  Returns Element_Kinds:
 
1346
--       An_Expression
 
1347
--
 
1348
------------------------------------------------------------------------------
 
1349
--  17.32 function Short_Circuit_Operation_Right_Expression
 
1350
------------------------------------------------------------------------------
 
1351
 
 
1352
   function Short_Circuit_Operation_Right_Expression
 
1353
     (Expression : in Asis.Expression)
 
1354
      return Asis.Expression;
 
1355
 
 
1356
------------------------------------------------------------------------------
 
1357
--  Expression  - Specifies the short circuit operation to query
 
1358
--
 
1359
--  Returns the expression following the reserved words "or else" or "and then"
 
1360
--  in the short circuit expression.
 
1361
--
 
1362
--  Appropriate Expression_Kinds:
 
1363
--       An_And_Then_Short_Circuit
 
1364
--       An_Or_Else_Short_Circuit
 
1365
--
 
1366
--  Returns Element_Kinds:
 
1367
--       An_Expression
 
1368
--
 
1369
------------------------------------------------------------------------------
 
1370
--  17.33 function Membership_Test_Expression
 
1371
------------------------------------------------------------------------------
 
1372
 
 
1373
   function Membership_Test_Expression
 
1374
     (Expression : in Asis.Expression)
 
1375
      return Asis.Expression;
 
1376
 
 
1377
------------------------------------------------------------------------------
 
1378
--  Expression  - Specifies the membership test operation to query
 
1379
--
 
1380
--  Returns the expression on the left hand side of the membership test.
 
1381
--
 
1382
--  Appropriate Expression_Kinds:
 
1383
--       An_In_Range_Membership_Test
 
1384
--       A_Not_In_Range_Membership_Test
 
1385
--       An_In_Type_Membership_Test
 
1386
--       A_Not_In_Type_Membership_Test
 
1387
--
 
1388
--  Returns Element_Kinds:
 
1389
--       An_Expression
 
1390
--
 
1391
------------------------------------------------------------------------------
 
1392
--  17.34 function Membership_Test_Range
 
1393
------------------------------------------------------------------------------
 
1394
 
 
1395
   function Membership_Test_Range
 
1396
     (Expression : in Asis.Expression)
 
1397
      return Asis.Range_Constraint;
 
1398
 
 
1399
------------------------------------------------------------------------------
 
1400
--  Expression  - Specifies the membership test operation to query
 
1401
--
 
1402
--  Returns the range following the reserved words "in" or "not in" from the
 
1403
--  membership test.
 
1404
--
 
1405
--  Appropriate Expression_Kinds:
 
1406
--       An_In_Range_Membership_Test
 
1407
--       A_Not_In_Range_Membership_Test
 
1408
--
 
1409
--  Returns Constraint_Kinds:
 
1410
--       A_Range_Attribute_Reference
 
1411
--       A_Simple_Expression_Range
 
1412
--
 
1413
------------------------------------------------------------------------------
 
1414
--  17.35 function Membership_Test_Subtype_Mark
 
1415
------------------------------------------------------------------------------
 
1416
 
 
1417
   function Membership_Test_Subtype_Mark
 
1418
     (Expression : in Asis.Expression)
 
1419
      return Asis.Expression;
 
1420
 
 
1421
------------------------------------------------------------------------------
 
1422
--  Expression  - Specifies the membership test operation to query
 
1423
--
 
1424
--  Returns the subtype_mark expression following the reserved words "in" or
 
1425
--  "not in" from the membership test.
 
1426
--
 
1427
--  Appropriate Expression_Kinds:
 
1428
--       An_In_Type_Membership_Test
 
1429
--       A_Not_In_Type_Membership_Test
 
1430
--
 
1431
--  Returns Expression_Kinds:
 
1432
--       An_Identifier
 
1433
--       A_Selected_Component
 
1434
--       An_Attribute_Reference
 
1435
--
 
1436
------------------------------------------------------------------------------
 
1437
--  17.36 function Converted_Or_Qualified_Subtype_Mark
 
1438
------------------------------------------------------------------------------
 
1439
 
 
1440
   function Converted_Or_Qualified_Subtype_Mark
 
1441
     (Expression : in Asis.Expression)
 
1442
      return Asis.Expression;
 
1443
 
 
1444
------------------------------------------------------------------------------
 
1445
--  Expression  - Specifies the type conversion or qualified expression to
 
1446
--                query.
 
1447
--
 
1448
--  Returns the subtype_mark expression that converts or qualifies the
 
1449
--  expression.
 
1450
--
 
1451
--  Appropriate Expression_Kinds:
 
1452
--       A_Type_Conversion
 
1453
--       A_Qualified_Expression
 
1454
--
 
1455
--  Returns Expression_Kinds:
 
1456
--       An_Identifier
 
1457
--       A_Selected_Component
 
1458
--       An_Attribute_Reference
 
1459
--
 
1460
 
 
1461
------------------------------------------------------------------------------
 
1462
--  17.37 function Converted_Or_Qualified_Expression
 
1463
------------------------------------------------------------------------------
 
1464
 
 
1465
   function Converted_Or_Qualified_Expression
 
1466
     (Expression : in Asis.Expression)
 
1467
      return Asis.Expression;
 
1468
 
 
1469
------------------------------------------------------------------------------
 
1470
--  Expression  - Specifies the type conversion or qualified expression to
 
1471
--                query
 
1472
--
 
1473
--  Returns the expression being converted or qualified.
 
1474
--
 
1475
--  Appropriate Expression_Kinds:
 
1476
--       A_Type_Conversion
 
1477
--       A_Qualified_Expression
 
1478
--
 
1479
--  Returns Element_Kinds:
 
1480
--       An_Expression
 
1481
--
 
1482
------------------------------------------------------------------------------
 
1483
--  17.38 function Allocator_Subtype_Indication
 
1484
------------------------------------------------------------------------------
 
1485
 
 
1486
   function Allocator_Subtype_Indication
 
1487
     (Expression : in Asis.Expression)
 
1488
      return Asis.Subtype_Indication;
 
1489
 
 
1490
------------------------------------------------------------------------------
 
1491
--  Expression  - Specifies the allocator expression to query
 
1492
--
 
1493
--  Returns the subtype indication for the object being allocated.
 
1494
--
 
1495
--  Appropriate Expression_Kinds:
 
1496
--       An_Allocation_From_Subtype
 
1497
--
 
1498
--  Returns Definition_Kinds:
 
1499
--       A_Subtype_Indication
 
1500
--
 
1501
------------------------------------------------------------------------------
 
1502
--  17.39 function Allocator_Qualified_Expression
 
1503
------------------------------------------------------------------------------
 
1504
 
 
1505
   function Allocator_Qualified_Expression
 
1506
     (Expression : in Asis.Expression)
 
1507
      return Asis.Expression;
 
1508
 
 
1509
------------------------------------------------------------------------------
 
1510
--  Expression  - Specifies the allocator expression to query
 
1511
--
 
1512
--  Returns the qualified expression for the object being allocated.
 
1513
--
 
1514
--  Appropriate Expression_Kinds:
 
1515
--       An_Allocation_From_Qualified_Expression
 
1516
--
 
1517
--  Returns Expression_Kinds:
 
1518
--       A_Qualified_Expression
 
1519
--
 
1520
 
 
1521
------------------------------------------------------------------------------
 
1522
--  17.40        function Is_Dispatching_Operation
 
1523
------------------------------------------------------------------------------
 
1524
 
 
1525
--   function Is_Dispatching_Operation
 
1526
--     (Declaration : in Asis.Element)
 
1527
--      return Boolean;
 
1528
 
 
1529
------------------------------------------------------------------------------
 
1530
--  Declaration   -  Specifies the declaration to query.
 
1531
--
 
1532
--  Returns True if the declaration is a primitive subprogram of a tagged type.
 
1533
--
 
1534
--  Returns False for any unexpected argument.
 
1535
--
 
1536
--  Expected Element_Kinds:
 
1537
--       A_Procedure_Declaration
 
1538
--       A_Function_Declaration
 
1539
--       A_Procedure_Renaming_Declaration
 
1540
--       A_Function_Renaming_Declaration
 
1541
--
 
1542
------------------------------------------------------------------------------
 
1543
 
 
1544
end Asis.Expressions;
 
 
b'\\ No newline at end of file'