1------------------------------------------------------------------------------
2--                                                                          --
3--                   ASIS-for-GNAT INTERFACE COMPONENTS                     --
4--                                                                          --
5--                                 A S I S                                  --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--            Copyright (C) 1995-2014, Free Software Foundation, Inc.       --
10--                                                                          --
11-- This   specification  is  derived   from  the  Ada   Semantic  Interface --
12-- Specification Standard (ISO/IEC 15291) for use with GNAT.                --
13--                                                                          --
14-- This  specification  also  contains  suggestions  and  discussion  items --
15-- related to revising the  ASIS Standard according to the changes proposed --
16-- for  the  new  revision of the Ada standard.                             --
17--                                                                          --
18-- The copyright notice above, and the license provisions that follow apply --
19-- solely  to  these suggestions and discussion items that are separated by --
20-- the  corresponding  comment sentinels,  and to the contents of the  part --
21-- following the private keyword.                                           --
22--                                                                          --
23-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
24-- under terms of the  GNU General Public License  as published by the Free --
25-- Software Foundation;  either version 3,  or  (at your option)  any later --
26-- version. ASIS-for-GNAT is distributed  in the hope  that it will be use- --
27-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
28-- CHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.                       --
29--                                                                          --
30--                                                                          --
31--                                                                          --
32--                                                                          --
33--                                                                          --
34-- You should have received a copy of the GNU General Public License and    --
35-- a copy of the GCC Runtime Library Exception along with this program;     --
36-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
37-- <http://www.gnu.org/licenses/>.                                          --
38--                                                                          --
39-- ASIS-for-GNAT was originally developed  by the ASIS-for-GNAT team at the --
40-- Software  Engineering  Laboratory  of  the Swiss  Federal  Institute  of --
41-- Technology (LGL-EPFL) in Lausanne,  Switzerland, in cooperation with the --
42-- Scientific  Research  Computer  Center of  Moscow State University (SRCC --
43-- MSU), Russia,  with funding partially provided  by grants from the Swiss --
44-- National  Science  Foundation  and  the  Swiss  Academy  of  Engineering --
45-- Sciences.  ASIS-for-GNAT is now maintained by  AdaCore                   --
46-- (http://www.adacore.com).                                                --
47--                                                                          --
48------------------------------------------------------------------------------
49
50------------------------------------------------------------------------------
51--  3  package Asis
52
53--  Suggestions related to changing this specification to accept new Ada
54--  features as defined in latest revision of the Ada Standard (ISO 8652)
55--  are marked by following comment sentinels:
56--
57--  --|A2005 start
58--   ... the suggestion goes here ...
59--  --|A2005 end
60--
61--  and the discussion items are marked by the comment sentinels of the form:
62--
63--  --|D2005 start
64--   ... the discussion item goes here ...
65--  --|D2005 end
66
67--  Suggestions related to changing this specification to accept new Ada
68--  features as suggested by ARG for next revision of the Ada Standard
69--  (ISO 8652) are marked by following comment sentinels:
70--
71--  --|A2015 start
72--   ... the suggestion goes here ...
73--  --|A2015 end
74--
75--  and the discussion items are marked by the comment sentinels of the form:
76--
77--  --|D2015 start
78--   ... the discussion item goes here ...
79--  --|D2015 end
80
81------------------------------------------------------------------------------
82------------------------------------------------------------------------------
83
84------------------------------------------------------------------------------
85--  The following context clauses are  specific for the ASIS
86--  implementation for GNAT
87with A4G.A_Types;  use A4G.A_Types;
88with A4G.Int_Knds; use A4G.Int_Knds;
89with Types;    use Types;
90
91package Asis is
92------------------------------------------------------------------------------
93--  Package Asis encapsulates implementation-specific declarations, which are
94--  made available to ASIS and its client applications in an
95--  implementation-independent manner.
96--
97--  Package ASIS is the root of the ASIS interface.
98--
99------------------------------------------------------------------------------
100--  Abstract
101--
102--  The Ada Semantic Interface Specification (ASIS) is an interface between an
103--  Ada environment as defined by ISO/IEC 8652:1995 (the Ada Reference Manual)
104--  and any tool requiring information from this environment. An Ada
105--  environment includes valuable semantic and syntactic information. ASIS is
106--  an open and published callable interface which gives CASE tool and
107--  application developers access to this information. ASIS has been designed
108--  to be independent of underlying Ada environment implementations, thus
109--  supporting portability of software engineering tools while relieving tool
110--  developers from having to understand the complexities of an Ada
111--  environment's proprietary internal representation.
112--
113------------------------------------------------------------------------------
114--  Package ASIS Types:
115--
116--  The following types are made visible directly through package Asis:
117--       type ASIS_Integer
118--       type ASIS_Natural
119--       type ASIS_Positive
120--       type List_Index
121--       type Context
122--       type Element
123--       type Element_List
124--       Element subtypes
125--       Element Kinds (set of enumeration types)
126--       type Compilation_Unit
127--       type Compilation_Unit_List
128--       Unit Kinds (set of enumeration types)
129--       type Traverse_Control
130--       subtype Program_Text
131--
132--  The ASIS interface uses string parameters for many procedure and function
133--  calls. Wide_String is used to convey ASIS environment information.
134--  Program_Text, a subtype of Wide_String, is used to convey program text.
135--  The Ada type String is not used in the ASIS interface. Neither the Ada
136--  types Character nor Wide_Character are used in the ASIS interface.
137--
138--  Implementation_Defined types and values
139--
140--  A number of implementation-defined types and constants are used. To make
141--  the ASIS specification compile, the following types and constants are
142--  provided:
143
144   subtype Implementation_Defined_Integer_Type is Integer;
145   Implementation_Defined_Integer_Constant : constant := 2**31 - 1;
146
147--  In addition, there are several implementation-defined private types.
148--  For compilation convenience these types have been represented as
149--  enumeration types with the single value of "Implementation_Defined".
150--  An implementation may define reasonable types and constants.
151--  Please refer to commentary where each is used.
152--
153
154------------------------------------------------------------------------------
155--  3.1 type ASIS_Integer
156------------------------------------------------------------------------------
157
158   subtype ASIS_Integer is Implementation_Defined_Integer_Type;
159
160------------------------------------------------------------------------------
161--  ASIS_Integer
162--
163--  A numeric subtype that allows each ASIS implementation to place constraints
164--  on the lower and upper bounds.  Whenever possible, the range of this type
165--  should meet or exceed -(2**31-1) .. 2**31-1.
166--
167------------------------------------------------------------------------------
168--  3.2   type ASIS_Natural
169------------------------------------------------------------------------------
170
171   subtype ASIS_Natural is ASIS_Integer range 0 .. ASIS_Integer'Last;
172
173------------------------------------------------------------------------------
174--  3.3   type ASIS_Positive
175------------------------------------------------------------------------------
176
177   subtype ASIS_Positive is ASIS_Integer range 1 .. ASIS_Integer'Last;
178
179------------------------------------------------------------------------------
180--  3.4   type List_Index
181------------------------------------------------------------------------------
182
183   List_Index_Implementation_Upper :
184       constant ASIS_Positive := Implementation_Defined_Integer_Constant;
185   subtype List_Index is ASIS_Positive
186       range 1 .. List_Index_Implementation_Upper;
187
188------------------------------------------------------------------------------
189--  List_Index
190--
191--  List_Index is a numeric subtype used to establish the upper bound for list
192--  size.
193------------------------------------------------------------------------------
194--  3.5   type Context
195------------------------------------------------------------------------------
196--  The ASIS Context is a view of a particular implementation of an Ada
197--  environment.  ASIS requires an application to identify that view of
198--  the Ada environment.  An ASIS Context identifies an Ada environment
199--  as defined by ISO/IEC 8652:1995.  The Ada environment is well
200--  defined for Ada implementations.  ISO/IEC 8652:1995 provides for an
201--  implementation-defined method to enter compilation units into the
202--  Ada environment.  Implementation permissions allow for illegal and
203--  inconsistent units to be in the environment.  The use of ASIS may
204--  result in the exception ASIS_Failed being raised if the Ada
205--  environment includes such units.
206--
207--  Defined by the implementation, an ASIS context is a way to identify
208--  a set of Compilation Units to be processed by an ASIS application.
209--  This may include things such as the pathname, search rules, etc.,
210--  which are attributes of the Ada environment and consequently
211--  becomes part of the ASIS Context only because it is a "view" of
212--  the Ada environment.
213--
214--  Because the contents of the Ada environment are (Ada-)implementation
215--  defined, the ASIS context may contain illegal compilation units.
216--  An ASIS Context is a handle to a set of compilation units accessible
217--  by an ASIS application.  The set of compilation units available
218--  from an ASIS context may be inconsistent, and may contain illegal
219--  compilation units.  The contents are selected from the Ada
220--  environment as defined by the corresponding Ada Implementation.
221--  ASIS should allow multiple open contexts.
222--
223--  In the Context abstraction, a logical handle is associated with Name and
224--  Parameters values that are used by the implementation to identify and
225--  connect to the information in the Ada environment.
226--
227--  An ASIS Context is associated with some set of Ada compilation units
228--  maintained by an underlying Ada implementation or a stand-alone ASIS
229--  implementation.  After this association has been made, this set of units
230--  is considered to be part of the compile-time Ada environment, which forms
231--  the outermost context of any compilation, as specified in section 10.1.4 of
232--  the Ada Reference Manual.  This same environment context provides the
233--  implicit outermost anonymous task during program execution.
234--
235--  Some implementations might not need explicit Name and/or Parameters values
236--  to identify their Ada environment.  Other implementations might choose to
237--  implement the Ada environment as a single external file in which case the
238--  name and parameters values might simply supply the Name, Form, and any
239--  other values needed to open such a file.
240--
241------------------------------------------------------------------------------
242--  Context shall be an undiscriminated limited private.
243------------------------------------------------------------------------------
244
245   type Context is limited private;
246   Nil_Context : constant Context;
247
248   function "=" (Left  : Context; Right : Context) return Boolean
249      is abstract;
250
251------------------------------------------------------------------------------
252--
253--  --|IR Implementation Requirement
254--  --|IR
255--  --|IR The concrete mechanism of this association is
256--  --|IR implementation-specific:
257--  --|IR
258--  --|IR Each ASIS implementation provides the means to construct an ASIS
259--  --|IR Context value that defines the environment declarative_part or
260--  --|IR "context" from which ASIS can obtain library units.
261--
262------------------------------------------------------------------------------
263--  3.6   type Element
264------------------------------------------------------------------------------
265--  The Ada lexical element abstraction (a private type).
266--
267--  The Element type is a distinct abstract type representing handles for the
268--  lexical elements that form the text of compilation units.  Elements deal
269--  with the internal or "textual" view of compilation units.
270--
271--  Operations are provided that split a Compilation_Unit object into one
272--  Element and two Element lists:
273--   a) A context clause represented by an Element_List containing
274--      with clauses, use clauses, and pragmas.
275--   b) An Element associated with the declaration.
276--   c) A list of pragmas, that are not part of the context clause but which
277--      nonetheless affect the compilation of the unit.
278--
279------------------------------------------------------------------------------
280--  ASIS Elements are representations of the syntactic and semantic information
281--  available from most Ada environments.
282--
283--  The ASIS Element type shall be an undiscriminated private type.
284------------------------------------------------------------------------------
285
286   type Element is private;
287   Nil_Element : constant Element;
288
289   function "=" (Left  : Element; Right : Element) return Boolean
290      is abstract;
291
292------------------------------------------------------------------------------
293--  3.7   type Element_List
294------------------------------------------------------------------------------
295
296   type Element_List is array (List_Index range <>) of Element;
297
298   Nil_Element_List : constant Element_List;
299
300------------------------------------------------------------------------------
301--  3.8   subtypes of Element and Element_List
302------------------------------------------------------------------------------
303
304   subtype Access_Type_Definition          is Element;
305   subtype Association                     is Element;
306   subtype Association_List                is Element_List;
307   subtype Case_Statement_Alternative      is Element;
308   subtype Clause                          is Element;
309   subtype Component_Clause                is Element;
310   subtype Component_Clause_List           is Element_List;
311   subtype Component_Declaration           is Element;
312   subtype Component_Definition            is Element;
313   subtype Constraint                      is Element;
314   subtype Context_Clause                  is Element;
315   subtype Context_Clause_List             is Element_List;
316   subtype Declaration                     is Element;
317   subtype Declaration_List                is Element_List;
318   subtype Declarative_Item_List           is Element_List;
319   subtype Definition                      is Element;
320   subtype Definition_List                 is Element_List;
321   subtype Discrete_Range                  is Element;
322   subtype Discrete_Range_List             is Element_List;
323   subtype Discrete_Subtype_Definition     is Element;
324   subtype Discriminant_Association        is Element;
325   subtype Discriminant_Association_List   is Element_List;
326   subtype Discriminant_Specification_List is Element_List;
327   subtype Defining_Name                   is Element;
328   subtype Defining_Name_List              is Element_List;
329   subtype Exception_Handler               is Element;
330   subtype Exception_Handler_List          is Element_List;
331   subtype Expression                      is Element;
332   subtype Expression_List                 is Element_List;
333   subtype Formal_Type_Definition          is Element;
334   subtype Generic_Formal_Parameter        is Element;
335   subtype Generic_Formal_Parameter_List   is Element_List;
336   subtype Identifier                      is Element;
337   subtype Identifier_List                 is Element_List;
338   subtype Name                            is Element;
339   subtype Name_List                       is Element_List;
340   subtype Parameter_Specification         is Element;
341   subtype Parameter_Specification_List    is Element_List;
342   subtype Path                            is Element;
343   subtype Path_List                       is Element_List;
344   subtype Pragma_Element                  is Element;
345   subtype Pragma_Element_List             is Element_List;
346   subtype Range_Constraint                is Element;
347   subtype Record_Component                is Element;
348   subtype Record_Component_List           is Element_List;
349   subtype Record_Definition               is Element;
350   subtype Representation_Clause           is Element;
351   subtype Representation_Clause_List      is Element_List;
352   subtype Root_Type_Definition            is Element;
353   subtype Select_Alternative              is Element;
354   subtype Statement                       is Element;
355   subtype Statement_List                  is Element_List;
356   subtype Subtype_Indication              is Element;
357   subtype Subtype_Mark                    is Element;
358   subtype Type_Definition                 is Element;
359   subtype Variant                         is Element;
360   subtype Variant_Component_List          is Element_List;
361   subtype Variant_List                    is Element_List;
362
363--
364------------------------------------------------------------------------------
365------------------------------------------------------------------------------
366--  3.9   Element Kinds
367------------------------------------------------------------------------------
368--  Element Kinds are enumeration types describing various kinds of elements.
369--  These element kinds are only used by package Asis.Elements.
370------------------------------------------------------------------------------
371--  3.9.1 type Element_Kinds
372------------------------------------------------------------------------------
373--  Element_Kinds Hierarchy
374--
375--  ASIS offers hierarchical classification of elements.  At the highest
376--  level, the Element_Kinds type provides literals that define "kinds" or
377--  classes listed below into which all non-nil elements are grouped.  Elements
378--  in each of the Element_Kinds classes, with the exception of
379--  An_Exception_Handler, can be further classified by a subordinate kind at
380--  the next level in the hierarchy.  Several subordinate kinds also have
381--  additional subordinate kinds.
382--
383--  For example, Element_Kinds'A_Declaration might be classified into
384--  Declaration_Kinds'A_Parameter_Specification which might be further
385--  classified into Trait_Kinds'An_Access_Definition_Trait.
386--  This fully identifies the syntax of an element such as:
387--
388--        (Who : access Person)
389--
390--  All Element_Kinds and subordinate kinds Queries are in Asis.Elements.
391--
392--  It is not necessary to strictly follow the hierarchy; any element can be
393--  classified by any subordinate kind from any level.  However, meaningful
394--  results will only be obtained from subordinate kinds that are appropriate.
395--  These are designated within the hierarchy shown below:
396--
397--        Element_Kinds         -> Subordinate Kinds
398------------------------------------------------------------------------------
399--   Key: Read "->" as "is further classified by its"
400--
401--        A_Pragma              -> Pragma_Kinds
402--
403--        A_Defining_Name       -> Defining_Name_Kinds
404--                                         -> Operator_Kinds
405--
406--        A_Declaration         -> Declaration_Kinds
407--                                         -> Trait_Kinds
408--                                         -> Declaration_Origins
409--                                         -> Mode_Kinds
410--                                         -> Subprogram_Default_Kinds
411--
412--        A_Definition          -> Definition_Kinds
413--                                         -> Trait_Kinds
414--                                         -> Type_Kinds
415--                                                    -> Trait_Kinds
416--                                         -> Formal_Type_Kinds
417--                                                    -> Trait_Kinds
418--                                         -> Access_Type_Kinds
419--                                         -> Root_Type_Kinds
420--                                         -> Constraint_Kinds
421--                                         -> Discrete_Range_Kinds
422--
423--        An_Expression         -> Expression_Kinds
424--                                         -> Operator_Kinds
425--                                         -> Attribute_Kinds
426--
427--        An_Association        -> Association_Kinds
428--
429--        A_Statement           -> Statement_Kinds
430--
431--        A_Path                -> Path_Kinds
432--
433--        A_Clause              -> Clause_Kinds
434--                                         -> Representation_Clause_Kinds
435--
436--        An_Exception_Handler
437--
438------------------------------------------------------------------------------
439--  Element_Kinds - general element classifications
440--   Literals                   -- ASIS package with queries for these kinds
441------------------------------------------------------------------------------
442
443   type Element_Kinds is (
444
445    Not_An_Element,            -- Nil_Element
446
447    A_Pragma,                  -- Asis.Elements
448
449    A_Defining_Name,           -- Asis.Declarations
450
451    A_Declaration,             -- Asis.Declarations
452
453    A_Definition,              -- Asis.Definitions
454
455    An_Expression,             -- Asis.Expressions
456
457    An_Association,            -- Asis.Expressions
458
459    A_Statement,               -- Asis.Statements
460
461    A_Path,                    -- Asis.Statements
462
463    A_Clause,                  -- Asis.Clauses
464
465    An_Exception_Handler);     -- Asis.Statements
466
467------------------------------------------------------------------------------
468--  3.9.2 type Pragma_Kinds
469------------------------------------------------------------------------------
470--  Pragma_Kinds - classifications for pragmas
471--   Literals                          -- Reference Manual
472------------------------------------------------------------------------------
473
474   type Pragma_Kinds is (
475
476    Not_A_Pragma,                           -- An unexpected element
477    An_All_Calls_Remote_Pragma,             -- E.2.3(5)
478    An_Assert_Pragma,                       -- 11.4.2, Ada 2005
479    An_Assertion_Policy_Pragma,             -- 11.4.2, Ada 2005
480    An_Asynchronous_Pragma,                 -- E.4.1(3)
481    An_Atomic_Pragma,                       -- C.6(3)
482    An_Atomic_Components_Pragma,            -- C.6(5)
483    An_Attach_Handler_Pragma,               -- C.3.1(4)
484    A_Controlled_Pragma,                    -- 13.11.3(3)
485    A_Convention_Pragma,                    -- B.1(7), M.1(5)
486    A_CPU_Pragma,                           -- J.15.9, Ada 2012
487    A_Default_Storage_Pool_Pragma,          -- 13.11.3, Ada 2012
488    A_Detect_Blocking_Pragma,               -- H.5, Ada 2005
489    A_Discard_Names_Pragma,                 -- C.5(3)
490    A_Dispatching_Domain_Pragma,            -- J.15.10 Ada 2012
491    An_Elaborate_Pragma,                    -- 10.2.1(20)
492    An_Elaborate_All_Pragma,                -- 10.2.1(21)
493    An_Elaborate_Body_Pragma,               -- 10.2.1(22)
494    An_Export_Pragma,                       -- B.1(5), M.1(5)
495    An_Independent_Pragma,                  -- J.15.8, Ada 2012
496    A_Independent_Components_Pragma,        -- J.15.8, Ada 2012
497    An_Import_Pragma,                       -- B.1(6), M.1(5)
498    An_Inline_Pragma,                       -- 6.3.2(3)
499    An_Inspection_Point_Pragma,             -- H.3.2(3)
500    An_Interrupt_Handler_Pragma,            -- C.3.1(2)
501    An_Interrupt_Priority_Pragma,           -- D.1(5)
502    A_Linker_Options_Pragma,                -- B.1(8)
503    A_List_Pragma,                          -- 2.8(21)
504    A_Locking_Policy_Pragma,                -- D.3(3)
505    A_No_Return_Pragma,                     -- J.15.2, Ada 2005
506    A_Normalize_Scalars_Pragma,             -- H.1(3)
507    An_Optimize_Pragma,                     -- 2.8(23)
508    A_Pack_Pragma,                          -- 13.2(3)
509    A_Page_Pragma,                          -- 2.8(22)
510    A_Partition_Elaboration_Policy_Pragma,  -- H.6, Ada 2005
511    A_Preelaborable_Initialization_Pragma,  -- 10.2.1, Ada 2005
512    A_Preelaborate_Pragma,                  -- 10.2.1(3)
513    A_Priority_Pragma,                      -- D.1(3)
514    A_Priority_Specific_Dispatching_Pragma, -- D.2.2, Ada 2005
515    A_Profile_Pragma,                       --  13.12, Ada 2005
516    A_Pure_Pragma,                          -- 10.2.1(14)
517    A_Queuing_Policy_Pragma,                -- D.4(3)
518    A_Relative_Deadline_Pragma,             -- J.15.12, Ada 2005
519    A_Remote_Call_Interface_Pragma,         -- E.2.3(3)
520    A_Remote_Types_Pragma,                  -- E.2.2(3)
521    A_Restrictions_Pragma,                  -- 13.12(3)
522    A_Reviewable_Pragma,                    -- H.3.1(3)
523    A_Shared_Passive_Pragma,                -- E.2.1(3)
524    A_Storage_Size_Pragma,                  -- 13.3(63)
525    A_Suppress_Pragma,                      -- 11.5(4)
526    A_Task_Dispatching_Policy_Pragma,       -- D.2.2(2)
527    An_Unchecked_Union_Pragma,              -- J.15.6, Ada 2005
528    An_Unsuppress_Pragma,                   -- 11.5, Ada 2005
529    A_Volatile_Pragma,                      -- C.6(4)
530    A_Volatile_Components_Pragma,           -- C.6(6)
531
532    An_Implementation_Defined_Pragma, -- 2.8(14)
533    An_Unknown_Pragma);               -- Unknown to ASIS
534
535------------------------------------------------------------------------------
536--  3.9.3 type Defining_Name_Kinds
537------------------------------------------------------------------------------
538--  Defining_Name_Kinds - names defined by declarations and specifications.
539--   Literals                                   -- Reference Manual
540------------------------------------------------------------------------------
541
542   type Defining_Name_Kinds is (
543
544    Not_A_Defining_Name,                       -- An unexpected element
545
546    A_Defining_Identifier,                     -- 3.1(4)
547    A_Defining_Character_Literal,              -- 3.5.1(4)
548    A_Defining_Enumeration_Literal,            -- 3.5.1(3)
549    A_Defining_Operator_Symbol,                -- 6.1(9)
550    A_Defining_Expanded_Name);                 -- 6.1(7)
551      --  program unit name defining_identifier
552
553------------------------------------------------------------------------------
554--  3.9.4 type Declaration_Kinds
555------------------------------------------------------------------------------
556--  Declaration_Kinds - declarations and specifications having
557--                      defining name literals.
558--  Reference Manual -> Subordinate Kinds
559------------------------------------------------------------------------------
560
561   type Declaration_Kinds is (
562
563    Not_A_Declaration,                       -- An unexpected element
564
565    An_Ordinary_Type_Declaration,            -- 3.2.1(3)
566      --  a full_type_declaration of the form:
567      --  type defining_identifier [known_discriminant_part] is
568      --     type_definition;
569
570    A_Task_Type_Declaration,                  -- 9.1(2)
571    A_Protected_Type_Declaration,             -- 9.4(2)
572    An_Incomplete_Type_Declaration,           -- 3.2.1(2),3.10(2)
573--  --|A2005 start
574    A_Tagged_Incomplete_Type_Declaration,     --  3.10.1(2)
575--  --|A2005 end
576    A_Private_Type_Declaration,               -- 3.2.1(2),7.3(2) -> Trait_Kinds
577    A_Private_Extension_Declaration,          -- 3.2.1(2),7.3(3) -> Trait_Kinds
578
579    A_Subtype_Declaration,                    -- 3.2.2(2)
580
581    A_Variable_Declaration,                   -- 3.3.1(2) -> Trait_Kinds
582    A_Constant_Declaration,                   -- 3.3.1(4) -> Trait_Kinds
583    A_Deferred_Constant_Declaration,          -- 3.3.1(6),7.4(2) -> Trait_Kinds
584    A_Single_Task_Declaration,                -- 3.3.1(2),9.1(3)
585    A_Single_Protected_Declaration,           -- 3.3.1(2),9.4(2)
586
587    An_Integer_Number_Declaration,            -- 3.3.2(2)
588    A_Real_Number_Declaration,                -- 3.5.6(2)
589
590    An_Enumeration_Literal_Specification,     -- 3.5.1(3)
591
592    A_Discriminant_Specification,             -- 3.7(5)   -> Trait_Kinds
593    A_Component_Declaration,                  -- 3.8(6)
594
595    A_Loop_Parameter_Specification,           -- 5.5(4)   -> Trait_Kinds
596--  --|A2012 start
597    A_Generalized_Iterator_Specification,     -- 5.5.2    -> Trait_Kinds
598    An_Element_Iterator_Specification,        -- 5.5.2    -> Trait_Kinds
599--  --|A2012 end
600
601    A_Procedure_Declaration,                  -- 6.1(4)   -> Trait_Kinds
602    A_Function_Declaration,                   -- 6.1(4)   -> Trait_Kinds
603
604    A_Parameter_Specification,                -- 6.1(15)  -> Trait_Kinds
605      --                                                  -> Mode_Kinds
606    A_Procedure_Body_Declaration,             -- 6.3(2)
607    A_Function_Body_Declaration,              -- 6.3(2)
608
609--  --|A2005 start
610    A_Return_Variable_Specification,          -- 6.5
611    A_Return_Constant_Specification,          -- 6.5
612    A_Null_Procedure_Declaration,             -- 6.7
613--  --|A2005 end
614
615--  --|A2012 start
616    An_Expression_Function_Declaration,       -- 6.8
617--  --|A2012 end
618
619    A_Package_Declaration,                    -- 7.1(2)
620    A_Package_Body_Declaration,               -- 7.2(2)
621
622    An_Object_Renaming_Declaration,           -- 8.5.1(2)
623    An_Exception_Renaming_Declaration,        -- 8.5.2(2)
624    A_Package_Renaming_Declaration,           -- 8.5.3(2)
625    A_Procedure_Renaming_Declaration,         -- 8.5.4(2)
626    A_Function_Renaming_Declaration,          -- 8.5.4(2)
627    A_Generic_Package_Renaming_Declaration,   -- 8.5.5(2)
628    A_Generic_Procedure_Renaming_Declaration, -- 8.5.5(2)
629    A_Generic_Function_Renaming_Declaration,  -- 8.5.5(2)
630
631    A_Task_Body_Declaration,                  -- 9.1(6)
632    A_Protected_Body_Declaration,             -- 9.4(7)
633    An_Entry_Declaration,                     -- 9.5.2(2)
634    An_Entry_Body_Declaration,                -- 9.5.2(5)
635    An_Entry_Index_Specification,             -- 9.5.2(2)
636
637    A_Procedure_Body_Stub,                    -- 10.1.3(3)
638    A_Function_Body_Stub,                     -- 10.1.3(3)
639    A_Package_Body_Stub,                      -- 10.1.3(4)
640    A_Task_Body_Stub,                         -- 10.1.3(5)
641    A_Protected_Body_Stub,                    -- 10.1.3(6)
642
643    An_Exception_Declaration,                 -- 11.1(2)
644    A_Choice_Parameter_Specification,         -- 11.2(4)
645
646    A_Generic_Procedure_Declaration,          -- 12.1(2)
647    A_Generic_Function_Declaration,           -- 12.1(2)
648    A_Generic_Package_Declaration,            -- 12.1(2)
649
650    A_Package_Instantiation,                  -- 12.3(2)
651    A_Procedure_Instantiation,                -- 12.3(2)
652    A_Function_Instantiation,                 -- 12.3(2)
653
654    A_Formal_Object_Declaration,              -- 12.4(2)  -> Mode_Kinds
655    A_Formal_Type_Declaration,                -- 12.5(2)
656--  --|A2012 start
657    A_Formal_Incomplete_Type_Declaration,
658--  --|A2012 end
659    A_Formal_Procedure_Declaration,           -- 12.6(2)
660      --                                           -> Subprogram_Default_Kinds
661    A_Formal_Function_Declaration,            -- 12.6(2)
662      --                                           -> Subprogram_Default_Kinds
663    A_Formal_Package_Declaration,             -- 12.7(2)
664    A_Formal_Package_Declaration_With_Box);   -- 12.7(3)
665
666--  --|D2005 start
667--  In Ada/ASIS 2005 A_Formal_Package_Declaration_With_Box does not make
668--  any sense, because
669--
670--     with package P is Q (<>);
671--
672--  is exactly the same as
673--
674--
675--     with package P is Q (others => <>);
676--
677--  So we need some Application Note saying that
678--  A_Formal_Package_Declaration_With_Box is an obsolescent position in the
679--  Element classification hierarchy and that it should be used very carefully
680--  in ASIS 2005 applications because it does not represent anything special,
681--  but just a special case of a A_Formal_Package_Declaration. Probably we
682--  should recommend to use only
683--  A_Formal_Package_Declaration .. A_Formal_Package_Declaration in ASIS 2005
684--  applications. Do we need a special subtype like
685--
686--  subtype Formal_Package_Declarations is Declaration_Kinds range
687--     A_Formal_Package_Declaration .. A_Formal_Package_Declaration;
688--  --|D2005 end
689
690--  The following Declaration_Kinds subtypes are not used by ASIS but are
691--  provided for the convenience of the ASIS implementor:
692
693   subtype A_Type_Declaration is Declaration_Kinds range
694      An_Ordinary_Type_Declaration .. A_Private_Extension_Declaration;
695
696   subtype A_Full_Type_Declaration is Declaration_Kinds range
697      An_Ordinary_Type_Declaration .. A_Protected_Type_Declaration;
698
699   subtype An_Object_Declaration is Declaration_Kinds range
700      A_Variable_Declaration .. A_Single_Protected_Declaration;
701
702   subtype A_Number_Declaration is Declaration_Kinds range
703      An_Integer_Number_Declaration .. A_Real_Number_Declaration;
704
705   subtype A_Renaming_Declaration is Declaration_Kinds range
706      An_Object_Renaming_Declaration ..
707         A_Generic_Function_Renaming_Declaration;
708
709   subtype A_Body_Stub is Declaration_Kinds range
710      A_Procedure_Body_Stub .. A_Protected_Body_Stub;
711
712   subtype A_Generic_Declaration is Declaration_Kinds range
713      A_Generic_Procedure_Declaration .. A_Generic_Package_Declaration;
714
715   subtype A_Generic_Instantiation is Declaration_Kinds range
716      A_Package_Instantiation .. A_Function_Instantiation;
717
718   subtype A_Formal_Declaration is Declaration_Kinds range
719      A_Formal_Object_Declaration .. A_Formal_Package_Declaration_With_Box;
720
721------------------------------------------------------------------------------
722--  3.9.5 type Trait_Kinds
723------------------------------------------------------------------------------
724--  Trait_Kinds
725--
726--  Trait_Kinds provide a means of further classifying the syntactic structure
727--  or "trait" of certain A_Declaration and A_Definition elements.
728--  Trait_Kinds are determined only by the presence (or absence) of certain
729--  reserved words.  The semantics of an element are not considered.
730--  The reserved words of interest here are "abstract", "aliased", "limited",
731--  "private", "reverse", and "access" when it appears in an access_definition.
732--  Trait_Kinds enumerates all combinations useful in this classification.
733--
734--  For example, A_Variable_Declaration element that is semantically a
735--  limited type because its components are of a limited type is
736--  An_Ordinary_Trait, not A_Limited_Trait, since the reserved word "limited"
737--  does not appear in its declaration or definition.
738--
739--  The subordinate Trait_Kinds allow Declaration_Kinds and Definition_Kinds
740--  to enumerate fewer higher level elements, and be less cluttered by all
741--  possible permutations of syntactic possibilities. For example, in the case
742--  of a record_type_definition, Definition_Kinds can provide just two literals
743--  that differentiate between ordinary record types and tagged record types:
744--
745--     A_Record_Type_Definition,              -- 3.8(2)    -> Trait_Kinds
746--     A_Tagged_Record_Type_Definition,       -- 3.8(2)    -> Trait_Kinds
747--
748--  The remaining classification can be accomplished, if desired, using
749--  Trait_Kinds to determine if the definition is abstract, or limited, or
750--  both. Without Trait_Kinds, Definition_Kinds needs six literals to identify
751--  all the syntactic combinations for a record_type_definition.
752--
753--  Elements expected by the Trait_Kind query are any Declaration_Kinds or
754--  Definition_Kinds for which Trait_Kinds is a subordinate kind: the literal
755--  definition has "-> Trait_Kinds" following it.  For example, the
756--  definitions of:
757--
758--     A_Discriminant_Specification,              -- 3.7(5)   -> Trait_Kinds
759--     A_Component_Declaration,                   -- 3.8(6)
760--
761--  indicate A_Discriminant_Specification is an expected kind while
762--  A_Component_Declaration is unexpected.
763--
764--  All Declaration_Kinds and Definition_Kinds for which Trait_Kinds is not a
765--  subordinate kind, and all other Element_Kinds, are unexpected and are
766--  Not_A_Trait.
767--
768--  An_Ordinary_Trait is any expected element whose syntax does not explicitly
769--  contain any of the reserved words listed above.
770--
771------------------------------------------------------------------------------
772--  Trait_Kinds
773--   Literals
774------------------------------------------------------------------------------
775
776   type Trait_Kinds is (
777
778      Not_A_Trait,                         -- An unexpected element
779
780      An_Ordinary_Trait,
781      --  The declaration or definition does not contain the reserved words
782      --  "aliased", "reverse", "private", "limited", "abstract", or "access"
783      --  in an access_definition
784
785      An_Aliased_Trait,
786      --  "aliased" is present
787
788      An_Access_Definition_Trait,
789      --  "access" in an access_definition is present
790--  --|A2005 start
791      A_Null_Exclusion_Trait,
792      --  "not null" is present
793--  --|A2005 end
794      A_Reverse_Trait,
795      --  "reverse" is present
796      A_Private_Trait,
797      --  Only "private" is present
798      A_Limited_Trait,
799      --  Only "limited" is present
800      A_Limited_Private_Trait,
801      --  "limited" and "private" are present
802      An_Abstract_Trait,
803      --  Only "abstract" is present
804      An_Abstract_Private_Trait,
805      --  "abstract" and "private" are present
806      An_Abstract_Limited_Trait,
807      --  "abstract" and "limited" are present
808      An_Abstract_Limited_Private_Trait);
809      --  "abstract", "limited", and "private" are present
810
811--  --|D2005 start
812--  We need a note saying that An_Access_Definition_Trait is an obsolescent
813--  value kept only because of upward compatibility reasons. Now an
814--  access_definition that defines an anonymous access kind is represented as
815--  a first-class citizen in the ASIS Element classification hierarchy
816--  (An_Access_Definition value in Definition_Kinds and the subordinate
817--  Access_Definition_Kinds type).
818--  --|D2005 end
819
820------------------------------------------------------------------------------
821--  3.9.6 type Declaration_Origins
822------------------------------------------------------------------------------
823--  Declaration_Origins
824--   Literals                             -- Reference Manual
825------------------------------------------------------------------------------
826
827   type Declaration_Origins is (
828
829      Not_A_Declaration_Origin,
830      --  An unexpected element
831
832      An_Explicit_Declaration,
833      --  3.1(5) explicitly declared in the text of a program, or within
834      --  an expanded generic template
835
836      An_Implicit_Predefined_Declaration,
837      --  3.1(5), 3.2.3(1), A.1(2)
838
839      An_Implicit_Inherited_Declaration);
840      --  3.1(5), 3.4(6-35)
841
842------------------------------------------------------------------------------
843--  3.9.7 type Mode_Kinds
844------------------------------------------------------------------------------
845--  Mode_Kinds
846--   Literals                 -- Reference Manual
847------------------------------------------------------------------------------
848
849   type Mode_Kinds is (       -- 6.1
850
851      Not_A_Mode,              -- An unexpected element
852
853      A_Default_In_Mode,       -- procedure A(B :        C);
854      An_In_Mode,              -- procedure A(B : IN     C);
855      An_Out_Mode,             -- procedure A(B :    OUT C);
856      An_In_Out_Mode);         -- procedure A(B : IN OUT C);
857
858------------------------------------------------------------------------------
859--  3.9.8 type Subprogram_Default_Kinds
860------------------------------------------------------------------------------
861--  Subprogram_Default_Kinds
862--   Literals                 -- Reference Manual
863------------------------------------------------------------------------------
864
865   type Subprogram_Default_Kinds is (    -- 12.6
866
867      Not_A_Default,         -- An unexpected element
868
869      A_Name_Default,        -- with subprogram_specification is default_name;
870      A_Box_Default,         -- with subprogram_specification is <>;
871--  --|A2005 start
872      A_Null_Default,        -- with subprogram_specification is null;
873--  --|A2005 end
874      A_Nil_Default);        -- with subprogram_specification;
875
876------------------------------------------------------------------------------
877--  3.9.9 type Definition_Kinds
878------------------------------------------------------------------------------
879--  Definition_Kinds
880--   Literals                      -- Reference Manual   -> Subordinate Kinds
881------------------------------------------------------------------------------
882
883   type Definition_Kinds is (
884
885    Not_A_Definition,                 -- An unexpected element
886
887    A_Type_Definition,                -- 3.2.1(4)    -> Type_Kinds
888
889    A_Subtype_Indication,             -- 3.2.2(3)
890    A_Constraint,                     -- 3.2.2(5)    -> Constraint_Kinds
891
892    A_Component_Definition,           -- 3.6(7)      -> Trait_Kinds
893
894    A_Discrete_Subtype_Definition,    -- 3.6(6)      -> Discrete_Range_Kinds
895    A_Discrete_Range,                 -- 3.6.1(3)    -> Discrete_Range_Kinds
896
897    An_Unknown_Discriminant_Part,     -- 3.7(3)
898    A_Known_Discriminant_Part,        -- 3.7(2)
899
900    A_Record_Definition,              -- 3.8(3)
901    A_Null_Record_Definition,         -- 3.8(3)
902
903    A_Null_Component,                 -- 3.8(4)
904    A_Variant_Part,                   -- 3.8.1(2)
905    A_Variant,                        -- 3.8.1(3)
906
907    An_Others_Choice,                 -- 3.8.1(5), 4.3.1(5), 4.3.3(5), 11.2(5)
908
909--  --|A2005 start
910    An_Access_Definition,             -- 3.10(6/2)   -> Access_Definition_Kinds
911--  --|A2005 end
912
913    A_Private_Type_Definition,        -- 7.3(2)      -> Trait_Kinds
914    A_Tagged_Private_Type_Definition, -- 7.3(2)      -> Trait_Kinds
915    A_Private_Extension_Definition,   -- 7.3(3)      -> Trait_Kinds
916
917    A_Task_Definition,                -- 9.1(4)
918    A_Protected_Definition,           -- 9.4(4)
919
920    A_Formal_Type_Definition,         -- 12.5(3)     -> Formal_Type_Kinds
921
922--  --|A2012 start
923    An_Aspect_Specification);         -- 13.3.1
924--  --|A2012 end
925
926------------------------------------------------------------------------------
927--  3.9.10   type Type_Kinds
928------------------------------------------------------------------------------
929--  Type_Kinds
930--   Literals                       -- Reference Manual  -> Subordinate Kinds
931------------------------------------------------------------------------------
932
933   type Type_Kinds is (
934
935      Not_A_Type_Definition,                 -- An unexpected element
936
937      A_Derived_Type_Definition,             -- 3.4(2)     -> Trait_Kinds
938      A_Derived_Record_Extension_Definition, -- 3.4(2)     -> Trait_Kinds
939
940      An_Enumeration_Type_Definition,        -- 3.5.1(2)
941
942      A_Signed_Integer_Type_Definition,      -- 3.5.4(3)
943      A_Modular_Type_Definition,             -- 3.5.4(4)
944
945      A_Root_Type_Definition,                -- 3.5.4(14), 3.5.6(3)
946      --                                               -> Root_Type_Kinds
947      A_Floating_Point_Definition,           -- 3.5.7(2)
948
949      An_Ordinary_Fixed_Point_Definition,    -- 3.5.9(3)
950      A_Decimal_Fixed_Point_Definition,      -- 3.5.9(6)
951
952      An_Unconstrained_Array_Definition,     -- 3.6(2)
953      A_Constrained_Array_Definition,        -- 3.6(2)
954
955      A_Record_Type_Definition,              -- 3.8(2)     -> Trait_Kinds
956      A_Tagged_Record_Type_Definition,       -- 3.8(2)     -> Trait_Kinds
957
958--  --|A2005 start
959      An_Interface_Type_Definition,          -- 3.9.4      -> Interface_Kinds
960--  --|A2005 end
961      An_Access_Type_Definition);            -- 3.10(2)    -> Access_Type_Kinds
962
963------------------------------------------------------------------------------
964--  3.9.11   type Formal_Type_Kinds
965------------------------------------------------------------------------------
966--  Formal_Type_Kinds
967--   Literals                       -- Reference Manual  -> Subordinate Kinds
968------------------------------------------------------------------------------
969
970   type Formal_Type_Kinds is (
971
972      Not_A_Formal_Type_Definition,             -- An unexpected element
973
974      A_Formal_Private_Type_Definition,         -- 12.5.1(2)   -> Trait_Kinds
975      A_Formal_Tagged_Private_Type_Definition,  -- 12.5.1(2)   -> Trait_Kinds
976
977      A_Formal_Derived_Type_Definition,         -- 12.5.1(3)   -> Trait_Kinds
978
979      A_Formal_Discrete_Type_Definition,        -- 12.5.2(2)
980
981      A_Formal_Signed_Integer_Type_Definition,  -- 12.5.2(3)
982      A_Formal_Modular_Type_Definition,         -- 12.5.2(4)
983
984      A_Formal_Floating_Point_Definition,       -- 12.5.2(5)
985
986      A_Formal_Ordinary_Fixed_Point_Definition, -- 12.5.2(6)
987      A_Formal_Decimal_Fixed_Point_Definition,  -- 12.5.2(7)
988
989--  --|A2005 start
990      A_Formal_Interface_Type_Definition,       -- 12.5.5(2) -> Interface_Kinds
991
992--  --|D2005 start
993      --  Do we really need this value in Formal_Type_Kinds? There is no
994      --  difference between it and An_Interface_Type_Definition. The only
995      --  reason to have it is not to break the ASIS 95 idea tp have separate
996      --  values representing definitions of formal kinds
997--  --|D2005 end
998
999--  --|A2005 end
1000
1001      A_Formal_Unconstrained_Array_Definition,  -- 3.6(3)
1002      A_Formal_Constrained_Array_Definition,    -- 3.6(5)
1003
1004      A_Formal_Access_Type_Definition);         -- 3.10(3),3.10(5)
1005      --                                                 -> Access_Type_Kinds
1006
1007------------------------------------------------------------------------------
1008--  3.9.12   type Access_Type_Kinds
1009------------------------------------------------------------------------------
1010--  Access_Type_Kinds
1011--   Literals                             -- Reference Manual
1012------------------------------------------------------------------------------
1013
1014   type Access_Type_Kinds is ( -- 3.10
1015
1016    Not_An_Access_Type_Definition,       -- An unexpected element
1017
1018    A_Pool_Specific_Access_To_Variable,  -- access subtype_indication
1019    An_Access_To_Variable,               -- access all subtype_indication
1020    An_Access_To_Constant,               -- access constant subtype_indication
1021
1022    An_Access_To_Procedure,              -- access procedure
1023    An_Access_To_Protected_Procedure,    -- access protected procedure
1024    An_Access_To_Function,               -- access function
1025    An_Access_To_Protected_Function);    -- access protected function
1026
1027--  The following Access_Type_Kinds subtypes are not used by ASIS but are
1028--  provided for the convenience of the ASIS implementor:
1029
1030   subtype Access_To_Object_Definition is Access_Type_Kinds range
1031      A_Pool_Specific_Access_To_Variable .. An_Access_To_Constant;
1032
1033   subtype Access_To_Subprogram_Definition is Access_Type_Kinds range
1034      An_Access_To_Procedure ..  An_Access_To_Protected_Function;
1035
1036-------------------------------------------------------------------------------
1037--  --|A2005 start
1038--  3.9.#??? type Interface_Kinds
1039------------------------------------------------------------------------------
1040--  Interface_Kinds
1041--   Literals                               -- Reference Manual
1042------------------------------------------------------------------------------
1043
1044   type Interface_Kinds is (  -- 3.9.4
1045
1046      Not_An_Interface,                 -- An unexpected element
1047      An_Ordinary_Interface,            -- interface ...
1048      A_Limited_Interface,              -- limited interface ...
1049      A_Task_Interface,                 -- task interface ...
1050      A_Protected_Interface,            -- protected interface ...
1051      A_Synchronized_Interface);        -- synchronized interface ...
1052
1053------------------------------------------------------------------------------
1054--  3.9.#??? type Access_Definition_Kinds
1055------------------------------------------------------------------------------
1056--   Access_Definition_Kinds
1057--   Literals                               -- Reference Manual
1058------------------------------------------------------------------------------
1059
1060   type Access_Definition_Kinds is ( -- 3.10
1061
1062      Not_An_Access_Definition,       -- An unexpected element
1063
1064      An_Anonymous_Access_To_Variable,  -- [...] access subtype_mark
1065      An_Anonymous_Access_To_Constant,  -- [...] access constant subtype_mark
1066      An_Anonymous_Access_To_Procedure,           -- access procedure
1067      An_Anonymous_Access_To_Protected_Procedure, -- access protected procedure
1068      An_Anonymous_Access_To_Function,            -- access function
1069      An_Anonymous_Access_To_Protected_Function); -- access protected function
1070
1071--  --|A2005 end
1072-------------------------------------------------------------------------------
1073--  3.9.13   type Root_Type_Kinds
1074------------------------------------------------------------------------------
1075--  Root_Type_Kinds
1076--   Literals                               -- Reference Manual
1077------------------------------------------------------------------------------
1078
1079   type Root_Type_Kinds is (
1080
1081    Not_A_Root_Type_Definition,            -- An unexpected element
1082
1083    A_Root_Integer_Definition,             -- 3.4.1(8)
1084    A_Root_Real_Definition,                -- 3.4.1(8)
1085
1086    A_Universal_Integer_Definition,        -- 3.4.1(6)
1087    A_Universal_Real_Definition,           -- 3.4.1(6)
1088    A_Universal_Fixed_Definition);         -- 3.4.1(6)
1089
1090------------------------------------------------------------------------------
1091--  3.9.14   type Constraint_Kinds
1092------------------------------------------------------------------------------
1093--  Constraint_Kinds
1094--   Literals                               -- Reference Manual
1095------------------------------------------------------------------------------
1096
1097   type Constraint_Kinds is (
1098
1099      Not_A_Constraint,                      -- An unexpected element
1100
1101      A_Range_Attribute_Reference,           -- 3.5(2)
1102      A_Simple_Expression_Range,             -- 3.2.2, 3.5(3)
1103      A_Digits_Constraint,                   -- 3.2.2, 3.5.9
1104      A_Delta_Constraint,                    -- 3.2.2, J.3
1105      An_Index_Constraint,                   -- 3.2.2, 3.6.1
1106      A_Discriminant_Constraint);            -- 3.2.2
1107
1108------------------------------------------------------------------------------
1109--  3.9.15   type Discrete_Range_Kinds
1110------------------------------------------------------------------------------
1111--  Discrete_Range_Kinds
1112--   Literals                               -- Reference Manual
1113------------------------------------------------------------------------------
1114
1115   type Discrete_Range_Kinds is (
1116
1117      Not_A_Discrete_Range,                  -- An unexpected element
1118
1119      A_Discrete_Subtype_Indication,         -- 3.6.1(6), 3.2.2
1120      A_Discrete_Range_Attribute_Reference,  -- 3.6.1, 3.5
1121      A_Discrete_Simple_Expression_Range);   -- 3.6.1, 3.5
1122
1123------------------------------------------------------------------------------
1124--  3.9.16   type Association_Kinds
1125------------------------------------------------------------------------------
1126--  Association_Kinds
1127--   Literals                               -- Reference Manual
1128------------------------------------------------------------------------------
1129
1130   type Association_Kinds is (
1131
1132      Not_An_Association,                    -- An unexpected element
1133
1134      A_Pragma_Argument_Association,         -- 2.8
1135      A_Discriminant_Association,            -- 3.7.1
1136      A_Record_Component_Association,        -- 4.3.1
1137      An_Array_Component_Association,        -- 4.3.3
1138      A_Parameter_Association,               -- 6.4
1139      A_Generic_Association);                -- 12.3
1140
1141------------------------------------------------------------------------------
1142--  3.9.17   type Expression_Kinds
1143------------------------------------------------------------------------------
1144------------------------------------------------------------------------------
1145--  Expression_Kinds - general expression classifications
1146--   Literals                         -- Reference Manual -> Subordinate Kinds
1147------------------------------------------------------------------------------
1148
1149   type Expression_Kinds is (
1150
1151      Not_An_Expression,                         -- An unexpected element
1152
1153      A_Box_Expression,                          --  Ada 2005
1154                              --  4.3.1(4), 4.3.3(3,6)
1155
1156      An_Integer_Literal,                        -- 2.4
1157      A_Real_Literal,                            -- 2.4.1
1158      A_String_Literal,                          -- 2.6
1159
1160      An_Identifier,                             -- 4.1
1161      An_Operator_Symbol,                        -- 4.1
1162      A_Character_Literal,                       -- 4.1
1163      An_Enumeration_Literal,                    -- 4.1
1164      An_Explicit_Dereference,                   -- 4.1
1165      A_Function_Call,                           -- 4.1
1166
1167      An_Indexed_Component,                      -- 4.1.1
1168      A_Slice,                                   -- 4.1.2
1169      A_Selected_Component,                      -- 4.1.3
1170      An_Attribute_Reference,                    -- 4.1.4  -> Attribute_Kinds
1171
1172      A_Record_Aggregate,                        -- 4.3
1173      An_Extension_Aggregate,                    -- 4.3
1174      A_Positional_Array_Aggregate,              -- 4.3
1175      A_Named_Array_Aggregate,                   -- 4.3
1176
1177      An_And_Then_Short_Circuit,                 -- 4.4
1178      An_Or_Else_Short_Circuit,                  -- 4.4
1179
1180      An_In_Membership_Test,                     -- 4.4  Ada 2012
1181      A_Not_In_Membership_Test,                  -- 4.4  Ada 2012
1182
1183      A_Null_Literal,                            -- 4.4
1184      A_Parenthesized_Expression,                -- 4.4
1185      A_Raise_Expression,                        -- 4.4 Ada 2012 (AI12-0022-1)
1186
1187      A_Type_Conversion,                         -- 4.6
1188      A_Qualified_Expression,                    -- 4.7
1189
1190      An_Allocation_From_Subtype,                -- 4.8
1191      An_Allocation_From_Qualified_Expression,   -- 4.8
1192      A_Case_Expression,                         -- Ada 2012
1193      An_If_Expression,                          -- Ada 2012
1194      A_For_All_Quantified_Expression,           -- Ada 2012
1195      A_For_Some_Quantified_Expression);         -- Ada 2012
1196
1197------------------------------------------------------------------------------
1198--  3.9.18   type Operator_Kinds
1199------------------------------------------------------------------------------
1200--  Operator_Kinds - classification of the various Ada predefined operators
1201--   Literals                           -- Reference Manual
1202------------------------------------------------------------------------------
1203
1204   type Operator_Kinds is (             -- 4.5
1205
1206    Not_An_Operator,                   -- An unexpected element
1207
1208    An_And_Operator,                   -- and
1209    An_Or_Operator,                    -- or
1210    An_Xor_Operator,                   -- xor
1211    An_Equal_Operator,                 -- =
1212    A_Not_Equal_Operator,              -- /=
1213    A_Less_Than_Operator,              -- <
1214    A_Less_Than_Or_Equal_Operator,     -- <=
1215    A_Greater_Than_Operator,           -- >
1216    A_Greater_Than_Or_Equal_Operator,  -- >=
1217    A_Plus_Operator,                   -- +
1218    A_Minus_Operator,                  -- -
1219    A_Concatenate_Operator,            -- &
1220    A_Unary_Plus_Operator,             -- +
1221    A_Unary_Minus_Operator,            -- -
1222    A_Multiply_Operator,               -- *
1223    A_Divide_Operator,                 -- /
1224    A_Mod_Operator,                    -- mod
1225    A_Rem_Operator,                    -- rem
1226    An_Exponentiate_Operator,          -- **
1227    An_Abs_Operator,                   -- abs
1228    A_Not_Operator);                   -- not
1229
1230------------------------------------------------------------------------------
1231--  3.9.19   type Attribute_Kinds
1232------------------------------------------------------------------------------
1233--  Attribute_Kinds - classifications for all known Ada attributes
1234--   Literals                       -- Reference Manual
1235------------------------------------------------------------------------------
1236
1237   type Attribute_Kinds is (
1238
1239    Not_An_Attribute,              -- An unexpected element
1240
1241    An_Access_Attribute,           -- 3.10.2(24), 3.10.2(32), K(2), K(4)
1242    An_Address_Attribute,          -- 13.3(11), J.7.1(5), K(6)
1243    An_Adjacent_Attribute,         -- A.5.3(48), K(8)
1244    An_Aft_Attribute,              -- 3.5.10(5), K(12)
1245    An_Alignment_Attribute,        -- 13.3(23), K(14)
1246    A_Base_Attribute,              -- 3.5(15), K(17)
1247    A_Bit_Order_Attribute,         -- 13.5.3(4), K(19)
1248    A_Body_Version_Attribute,      -- E.3(4), K(21)
1249    A_Callable_Attribute,          -- 9.9(2), K(23)
1250    A_Caller_Attribute,            -- C.7.1(14), K(25)
1251    A_Ceiling_Attribute,           -- A.5.3(33), K(27)
1252    A_Class_Attribute,             -- 3.9(14), 7.3.1(9), K(31), K(34)
1253    A_Component_Size_Attribute,    -- 13.3(69), K(36)
1254    A_Compose_Attribute,           -- A.5.3(24), K(38)
1255    A_Constrained_Attribute,       -- 3.7.2(3), J.4(2), K(42)
1256    A_Copy_Sign_Attribute,         -- A.5.3(51), K(44)
1257    A_Count_Attribute,             -- 9.9(5), K(48)
1258    A_Definite_Attribute,          -- 12.5.1(23), K(50)
1259    A_Delta_Attribute,             -- 3.5.10(3), K(52)
1260    A_Denorm_Attribute,            -- A.5.3(9), K(54)
1261    A_Digits_Attribute,            -- 3.5.8(2), 3.5.10(7), K(56), K(58)
1262    An_Exponent_Attribute,         -- A.5.3(18), K(60)
1263    An_External_Tag_Attribute,     -- 13.3(75), K(64)
1264    A_First_Attribute,             -- 3.5(12), 3.6.2(3), K(68), K(70)
1265    A_First_Bit_Attribute,         -- 13.5.2(3), K(72)
1266    A_Floor_Attribute,             -- A.5.3(30), K(74)
1267    A_Fore_Attribute,              -- 3.5.10(4), K(78)
1268    A_Fraction_Attribute,          -- A.5.3(21), K(80)
1269    An_Identity_Attribute,         -- 11.4.1(9), C.7.1(12), K(84), K(86)
1270    An_Image_Attribute,            -- 3.5(35), K(88)
1271    An_Input_Attribute,            -- 13.13.2(22), 13.13.2(32), K(92), K(96)
1272    A_Last_Attribute,              -- 3.5(13), 3.6.2(5), K(102), K(104)
1273    A_Last_Bit_Attribute,          -- 13.5.2(4), K(106)
1274    A_Leading_Part_Attribute,      -- A.5.3(54), K(108)
1275    A_Length_Attribute,            -- 3.6.2(9), K(117)
1276    A_Machine_Attribute,           -- A.5.3(60), K(119)
1277    A_Machine_Emax_Attribute,      -- A.5.3(8), K(123)
1278    A_Machine_Emin_Attribute,      -- A.5.3(7), K(125)
1279    A_Machine_Mantissa_Attribute,  -- A.5.3(6), K(127)
1280    A_Machine_Overflows_Attribute, -- A.5.3(12), A.5.4(4), K(129), K(131)
1281    A_Machine_Radix_Attribute,     -- A.5.3(2), A.5.4(2), K(133), K(135)
1282    A_Machine_Rounds_Attribute,    -- A.5.3(11), A.5.4(3), K(137), K(139)
1283    A_Max_Attribute,               -- 3.5(19), K(141)
1284    A_Max_Size_In_Storage_Elements_Attribute, --   13.11.1(3), K(145)
1285    A_Min_Attribute,               -- 3.5(16), K(147)
1286    A_Model_Attribute,             -- A.5.3(68), G.2.2(7), K(151)
1287    A_Model_Emin_Attribute,        -- A.5.3(65), G.2.2(4), K(155)
1288    A_Model_Epsilon_Attribute,     -- A.5.3(66), K(157)
1289    A_Model_Mantissa_Attribute,    -- A.5.3(64), G.2.2(3), K(159)
1290    A_Model_Small_Attribute,       -- A.5.3(67), K(161)
1291    A_Modulus_Attribute,           -- 3.5.4(17), K(163)
1292    An_Output_Attribute,           -- 13.13.2(19), 13.13.2(29), K(165), K(169)
1293    A_Partition_ID_Attribute,      -- E.1(9), K(173)
1294    A_Pos_Attribute,               -- 3.5.5(2), K(175)
1295    A_Position_Attribute,          -- 13.5.2(2), K(179)
1296    A_Pred_Attribute,              -- 3.5(25), K(181)
1297    A_Range_Attribute,             -- 3.5(14), 3.6.2(7), K(187), �(189)
1298    A_Read_Attribute,              -- 13.13.2(6), 13.13.2(14), K(191), K(195)
1299    A_Remainder_Attribute,         -- A.5.3(45), K(199)
1300    A_Round_Attribute,             -- 3.5.10(12), K(203)
1301    A_Rounding_Attribute,          -- A.5.3(36), K(207)
1302    A_Safe_First_Attribute,        -- A.5.3(71), G.2.2(5), K(211)
1303    A_Safe_Last_Attribute,         -- A.5.3(72), G.2.2(6), K(213)
1304    A_Scale_Attribute,             -- 3.5.10(11), K(215)
1305    A_Scaling_Attribute,           -- A.5.3(27), K(217)
1306    A_Signed_Zeros_Attribute,      -- A.5.3(13), K(221)
1307    A_Size_Attribute,              -- 13.3(40), 13.3(45), K(223), K(228)
1308    A_Small_Attribute,             -- 3.5.10(2), K(230)
1309    A_Storage_Pool_Attribute,      -- 13.11(13), K(232)
1310    A_Storage_Size_Attribute,      -- 13.3(60), 13.11(14), J.9(2), K(234),
1311      --                                 K(236)
1312    A_Succ_Attribute,              -- 3.5(22), K(238)
1313    A_Tag_Attribute,               -- 3.9(16), 3.9(18), K(242), K(244)
1314    A_Terminated_Attribute,        -- 9.9(3), K(246)
1315    A_Truncation_Attribute,        -- A.5.3(42), K(248)
1316    An_Unbiased_Rounding_Attribute, -- A.5.3(39), K(252)
1317    An_Unchecked_Access_Attribute,  -- 13.10(3), H.4(18), K(256)
1318    A_Val_Attribute,                -- 3.5.5(5), K(258)
1319    A_Valid_Attribute,              -- 13.9.2(3), H(6), K(262)
1320    A_Value_Attribute,              -- 3.5(52), K(264)
1321    A_Version_Attribute,            -- E.3(3), K(268)
1322    A_Wide_Image_Attribute,         -- 3.5(28), K(270)
1323    A_Wide_Value_Attribute,         -- 3.5(40), K(274)
1324    A_Wide_Width_Attribute,         -- 3.5(38), K(278)
1325    A_Width_Attribute,              -- 3.5(39), K(280)
1326    A_Write_Attribute,              -- 13.13.2(3), 13.13.2(11), K(282), K(286)
1327
1328--  |A2005 start
1329--  New Ada 2005 attributes. To be alphabetically ordered later
1330    A_Machine_Rounding_Attribute,
1331    A_Mod_Attribute,
1332    A_Priority_Attribute,
1333    A_Stream_Size_Attribute,
1334    A_Wide_Wide_Image_Attribute,
1335    A_Wide_Wide_Value_Attribute,
1336    A_Wide_Wide_Width_Attribute,
1337--  |A2005 end
1338
1339--  |A2012 start
1340--  New Ada 2012 attributes. To be alphabetically ordered later
1341    A_Max_Alignment_For_Allocation_Attribute,
1342    An_Overlaps_Storage_Attribute,
1343--  |A2012 end
1344
1345    An_Implementation_Defined_Attribute,  -- Reference Manual, Annex M
1346    An_Unknown_Attribute);         -- Unknown to ASIS
1347
1348------------------------------------------------------------------------------
1349--  3.9.20   type Statement_Kinds
1350------------------------------------------------------------------------------
1351--  Statement_Kinds - classifications of Ada statements
1352--   Literals                             -- Reference Manual
1353------------------------------------------------------------------------------
1354
1355   type Statement_Kinds is (
1356
1357      Not_A_Statement,                     -- An unexpected element
1358
1359      A_Null_Statement,                    -- 5.1
1360      An_Assignment_Statement,             -- 5.2
1361      An_If_Statement,                     -- 5.3
1362      A_Case_Statement,                    -- 5.4
1363
1364      A_Loop_Statement,                    -- 5.5
1365      A_While_Loop_Statement,              -- 5.5
1366      A_For_Loop_Statement,                -- 5.5
1367      A_Block_Statement,                   -- 5.6
1368      An_Exit_Statement,                   -- 5.7
1369      A_Goto_Statement,                    -- 5.8
1370
1371      A_Procedure_Call_Statement,          -- 6.4
1372      A_Return_Statement,                  -- 6.5
1373--  --|A2005 start
1374      An_Extended_Return_Statement,        -- 6.5
1375--  --|A2005 end
1376
1377      An_Accept_Statement,                 -- 9.5.2
1378      An_Entry_Call_Statement,             -- 9.5.3
1379
1380      A_Requeue_Statement,                 -- 9.5.4
1381      A_Requeue_Statement_With_Abort,      -- 9.5.4
1382
1383      A_Delay_Until_Statement,             -- 9.6
1384      A_Delay_Relative_Statement,          -- 9.6
1385
1386      A_Terminate_Alternative_Statement,   -- 9.7.1
1387      A_Selective_Accept_Statement,        -- 9.7.1
1388      A_Timed_Entry_Call_Statement,        -- 9.7.2
1389      A_Conditional_Entry_Call_Statement,  -- 9.7.3
1390      An_Asynchronous_Select_Statement,    -- 9.7.4
1391
1392      An_Abort_Statement,                  -- 9.8
1393      A_Raise_Statement,                   -- 11.3
1394      A_Code_Statement);                   -- 13.8
1395
1396------------------------------------------------------------------------------
1397--  3.9.21   type Path_Kinds
1398------------------------------------------------------------------------------
1399--  Path_Kinds
1400--
1401--  A_Path elements represent execution path alternatives presented by the
1402--  if_statement, case_statement, and the four forms of select_statement.
1403--  Each statement path alternative encloses component elements that
1404--  represent a sequence_of_statements.  Some forms of A_Path elements also
1405--  have as a component elements that represent a condition, an optional
1406--  guard, or a discrete_choice_list.
1407--
1408--  --|A2012 start
1409--  For ASIS 2012 this paragraph should be rewritten, here is some proposal to
1410--  be replaced with the wording to be provided by ARG:
1411
1412--  A_Path elements represent execution path alternatives presented by the
1413--  if_statement, case_statement, and the four forms of select_statement,
1414--  and alternative ways of computing the conditional expressions. Each path
1415--  alternative encloses component elements that represent a
1416--  sequence_of_statements for statement paths or an expression for conditional
1417--  expression paths. Some forms of A_Path elements also have as a component
1418--  elements that represent a condition, an optional guard, or a
1419--  discrete_choice_list.
1420--  --|A2012 end
1421--
1422--  ASIS treats the select_alternative, entry_call_alternative, and
1423--  triggering_alternative, as the syntactic equivalent of a
1424--  sequence_of_statements.  Specifically, the terminate_alternative
1425--  (terminate;) is treated as the syntactical equivalent of a single statement
1426--  and are represented as Statement_Kinds'A_Terminate_Alternative_Statement.
1427--  This allows queries to directly provide the sequence_of_statements enclosed
1428--  by A_Path elements, avoiding the extra step of returning an element
1429--  representing such an alternative.
1430--
1431--  For example,
1432--
1433--    select   -- A_Select_Path enclosing a sequence of two statements
1434--
1435--      accept Next_Work_Item(WI : in Work_Item) do
1436--        Current_Work_Item := WI;
1437--      end;
1438--      Process_Work_Item(Current_Work_Item);
1439--
1440--    or       -- An_Or_Path enclosing a guard and a sequence of two statements
1441--
1442--      when Done_Early =>
1443--        accept Shut_Down;
1444--        exit;
1445--
1446--    or       -- An_Or_Path enclosing a sequence with only a single statement
1447--
1448--      terminate;
1449--
1450--    end select;
1451--
1452------------------------------------------------------------------------------
1453--  Path_Kinds
1454--   Literals                      -- Reference Manual
1455------------------------------------------------------------------------------
1456
1457   type Path_Kinds is (
1458
1459      Not_A_Path,
1460      --  An unexpected element
1461
1462      --  Statement paths:
1463      An_If_Path,
1464      --  5.3:
1465      --  if condition then
1466      --    sequence_of_statements
1467
1468      An_Elsif_Path,
1469      --  5.3:
1470      --  elsif condition then
1471      --    sequence_of_statements
1472
1473      An_Else_Path,
1474      --  5.3, 9.7.1, 9.7.3:
1475      --  else sequence_of_statements
1476
1477      A_Case_Path,
1478      --  5.4:
1479      --  when discrete_choice_list =>
1480      --    sequence_of_statements
1481
1482      A_Select_Path,
1483      --  9.7.1:
1484      --     select [guard] select_alternative
1485      --  9.7.2, 9.7.3:
1486      --     select entry_call_alternative
1487      --  9.7.4:
1488      --     select triggering_alternative
1489
1490      An_Or_Path,
1491      --  9.7.1:
1492      --     or [guard] select_alternative
1493      --  9.7.2:
1494      --     or delay_alternative
1495
1496      A_Then_Abort_Path,
1497      --  9.7.4
1498      --     then abort sequence_of_statements
1499
1500--  --|A2012 start
1501      --  Expression paths:
1502      A_Case_Expression_Path,
1503      --  ??? (RM 2012)
1504      --  when expression => expression
1505
1506      An_If_Expression_Path,
1507      --  ??? (RM 2012)
1508      --  if condition then expression
1509
1510      An_Elsif_Expression_Path,
1511      --  ??? (RM 2012)
1512      --  elsif condition then expression
1513
1514      An_Else_Expression_Path);
1515      --  ??? (RM 2012)
1516      --  else expression
1517
1518   subtype A_Statement_Path is
1519     Path_Kinds range An_If_Path .. A_Then_Abort_Path;
1520
1521   subtype An_Expression_Path is
1522     Path_Kinds range A_Case_Expression_Path .. An_Else_Expression_Path;
1523
1524--  --|A2012 end
1525
1526------------------------------------------------------------------------------
1527--  3.9.22   type Clause_Kinds
1528------------------------------------------------------------------------------
1529--  Clause_Kinds
1530--   Literals                      -- Reference Manual    -> Subordinate Kinds
1531------------------------------------------------------------------------------
1532
1533   type Clause_Kinds is (
1534
1535      Not_A_Clause,                 -- An unexpected element
1536
1537      A_Use_Package_Clause,         -- 8.4
1538      A_Use_Type_Clause,            -- 8.4
1539      A_Use_All_Type_Clause,        -- 8.4, Ada 2012
1540
1541      A_With_Clause,                -- 10.1.2
1542
1543      A_Representation_Clause,      -- 13.1     -> Representation_Clause_Kinds
1544      A_Component_Clause);          -- 13.5.1
1545
1546------------------------------------------------------------------------------
1547--  3.9.23   type Representation_Clause_Kinds
1548------------------------------------------------------------------------------
1549--  Representation_Clause_Kinds - varieties of representation clauses
1550--   Literals                                  -- Reference Manual
1551------------------------------------------------------------------------------
1552
1553   type Representation_Clause_Kinds is (
1554
1555      Not_A_Representation_Clause,              -- An unexpected element
1556
1557      An_Attribute_Definition_Clause,           -- 13.3
1558      An_Enumeration_Representation_Clause,     -- 13.4
1559      A_Record_Representation_Clause,           -- 13.5.1
1560      An_At_Clause);                            -- J.7
1561
1562------------------------------------------------------------------------------
1563--  3.10  type Compilation_Unit
1564------------------------------------------------------------------------------
1565--  The Ada Compilation Unit abstraction:
1566--
1567--  The text of a program is submitted to the compiler in one or more
1568--  compilations.  Each compilation is a succession of compilation units.
1569--
1570--  Compilation units are composed of three distinct parts:
1571--   a) A context clause.
1572--   b) The declaration of a library_item or unit.
1573--   c) Pragmas that apply to the compilation, of which the unit is a
1574--      part.
1575--
1576--  The context clause contains zero or more with clauses, use clauses,
1577--  pragma elaborates, and possibly other pragmas.
1578--
1579--  ASIS treats Pragmas that appear immediately after the context clause
1580--  and before the subsequent declaration part as belonging to the context
1581--  clause part.
1582--
1583--  The declaration associated with a compilation unit is one of: a
1584--  package, a procedure, a function, a generic, or a subunit for normal units.
1585--  The associated declaration is a Nil_Element for An_Unknown_Unit and
1586--  Nonexistent units.
1587--
1588--  The abstract type Compilation_Unit is a handle for compilation units as a
1589--  whole.  An object of the type Compilation_Unit deals with the external view
1590--  of compilation units such as their relationships with other units or their
1591--  compilation attributes.
1592--
1593--  Compilation_Unit shall be an undiscriminated private type.
1594------------------------------------------------------------------------------
1595
1596   type Compilation_Unit is private;
1597   Nil_Compilation_Unit : constant Compilation_Unit;
1598
1599   function "="
1600     (Left  : Compilation_Unit;
1601      Right : Compilation_Unit)
1602      return Boolean is abstract;
1603
1604------------------------------------------------------------------------------
1605--  3.11  type Compilation_Unit_List
1606------------------------------------------------------------------------------
1607
1608   type Compilation_Unit_List is
1609      array (List_Index range <>) of Compilation_Unit;
1610
1611   Nil_Compilation_Unit_List : constant Compilation_Unit_List;
1612
1613------------------------------------------------------------------------------
1614--  3.12  Unit Kinds
1615------------------------------------------------------------------------------
1616--  Unit Kinds are enumeration types describing the various kinds of units.
1617--  These element kinds are only used by package Asis.Compilation_Units.
1618------------------------------------------------------------------------------
1619--  3.12.1   type Unit_Kinds
1620------------------------------------------------------------------------------
1621--  Unit_Kinds - the varieties of compilation units of compilations,
1622--  including compilations having no compilation units but consisting of
1623--  configuration pragmas or comments.
1624------------------------------------------------------------------------------
1625
1626   type Unit_Kinds is (
1627
1628      Not_A_Unit,
1629      --  A Nil_Compilation_Unit
1630
1631      A_Procedure,
1632      A_Function,
1633      A_Package,
1634
1635      A_Generic_Procedure,
1636      A_Generic_Function,
1637      A_Generic_Package,
1638
1639      A_Procedure_Instance,
1640      A_Function_Instance,
1641      A_Package_Instance,
1642
1643      A_Procedure_Renaming,
1644      A_Function_Renaming,
1645      A_Package_Renaming,
1646
1647      A_Generic_Procedure_Renaming,
1648      A_Generic_Function_Renaming,
1649      A_Generic_Package_Renaming,
1650
1651      A_Procedure_Body,
1652      --  A unit interpreted only as the completion of a procedure, or a unit
1653      --  interpreted as both the declaration and body of a library
1654      --  procedure. Reference Manual 10.1.4(4)
1655
1656      A_Function_Body,
1657      --  A unit interpreted only as the completion of a function, or a unit
1658      --  interpreted as both the declaration and body of a library
1659      --  function. Reference Manual 10.1.4(4)
1660
1661      A_Package_Body,
1662
1663      A_Procedure_Body_Subunit,
1664      A_Function_Body_Subunit,
1665      A_Package_Body_Subunit,
1666      A_Task_Body_Subunit,
1667      A_Protected_Body_Subunit,
1668
1669      A_Nonexistent_Declaration,
1670      --  A unit that does not exist but is:
1671      --    1) mentioned in a with clause of another unit or,
1672      --    2) a required corresponding library_unit_declaration
1673
1674      A_Nonexistent_Body,
1675      --  A unit that does not exist but is:
1676      --     1) known to be a corresponding subunit or,
1677      --     2) a required corresponding library_unit_body
1678
1679      A_Configuration_Compilation,
1680      --  Corresponds to the whole content of a compilation with no
1681      --  compilation_unit, but possibly containing comments, configuration
1682      --  pragmas, or both. Any Context can have at most one unit of
1683      --  A_Configuration_Compilation kind. A unit of
1684      --  A_Configuration_Compilation does not have a name. This unit
1685      --  represents configuration pragmas that are "in effect".
1686      --
1687      --  GNAT-specific note: In case of GNAT the requirement to have at most
1688      --  one unit of A_Configuration_Compilation kind does not make sense: in
1689      --  GNAT compilation model configuration pragmas are contained in
1690      --  configuration files, and a compilation may use an arbitrary number
1691      --  of configuration files. That is, (Elements representing) different
1692      --  configuration pragmas may have different enclosing compilation units
1693      --  with different text names. So in the ASIS implementation for GNAT a
1694      --  Context may contain any number of units of
1695      --  A_Configuration_Compilation kind
1696
1697      An_Unknown_Unit);
1698      --  An indeterminable or proprietary unit
1699
1700   subtype A_Subprogram_Declaration is Unit_Kinds range
1701      A_Procedure .. A_Function;
1702
1703   subtype A_Subprogram_Renaming is Unit_Kinds range
1704      A_Procedure_Renaming .. A_Function_Renaming;
1705
1706   subtype A_Generic_Unit_Declaration is Unit_Kinds range
1707      A_Generic_Procedure ..  A_Generic_Package;
1708
1709   subtype A_Generic_Unit_Instance is Unit_Kinds range
1710      A_Procedure_Instance .. A_Package_Instance;
1711
1712   subtype A_Subprogram_Body is Unit_Kinds range
1713      A_Procedure_Body .. A_Function_Body;
1714
1715   subtype A_Library_Unit_Body is Unit_Kinds range
1716      A_Procedure_Body .. A_Package_Body;
1717
1718   subtype A_Generic_Renaming is Unit_Kinds range
1719      A_Generic_Procedure_Renaming .. A_Generic_Package_Renaming;
1720
1721   subtype A_Renaming is Unit_Kinds range
1722      A_Procedure_Renaming .. A_Generic_Package_Renaming;
1723
1724   subtype A_Subunit is Unit_Kinds range
1725      A_Procedure_Body_Subunit .. A_Protected_Body_Subunit;
1726
1727------------------------------------------------------------------------------
1728--  3.12.2   type Unit_Classes
1729------------------------------------------------------------------------------
1730--  Unit_Classes - classification of public, private, body, and subunit.
1731------------------------------------------------------------------------------
1732
1733   type Unit_Classes is (  -- Reference Manual 10.1.1(12), 10.1.3
1734
1735      Not_A_Class,
1736      --  A nil, nonexistent, unknown, or configuration compilation unit class.
1737
1738      A_Public_Declaration,
1739      --  library_unit_declaration or library_unit_renaming_declaration.
1740
1741      A_Public_Body,
1742      --  library_unit_body interpreted only as a completion. Its declaration
1743      --  is public.
1744
1745      A_Public_Declaration_And_Body,
1746      --  subprogram_body interpreted as both a declaration and body of a
1747      --  library subprogram - Reference Manual 10.1.4(4).
1748
1749      A_Private_Declaration,
1750      --  private library_unit_declaration or private
1751      --  library_unit_renaming_declaration.
1752
1753      A_Private_Body,
1754      --  library_unit_body interpreted only as a completion. Its declaration
1755      --  is private.
1756
1757      A_Separate_Body);
1758      --  separate (parent_unit_name) proper_body.
1759
1760------------------------------------------------------------------------------
1761--  3.12.3   type Unit_Origins
1762------------------------------------------------------------------------------
1763--  Unit_Origins - classification of possible unit origination
1764------------------------------------------------------------------------------
1765
1766   type Unit_Origins is (
1767
1768      Not_An_Origin,
1769      --  A nil or nonexistent unit origin. An_Unknown_Unit can be any origin
1770
1771      A_Predefined_Unit,
1772      --  Ada predefined language environment units listed in Annex A(2).
1773      --  These include Standard and the three root library units: Ada,
1774      --  Interfaces, and System, and their descendants.  i.e., Ada.Text_Io,
1775      --  Ada.Calendar, Interfaces.C, etc.
1776
1777      An_Implementation_Unit,
1778      --  Implementation specific library units, e.g., runtime support
1779      --  packages, utility libraries, etc. It is not required that any
1780      --  implementation supplied units have this origin. This is a suggestion.
1781      --  Implementations might provide, for example, precompiled versions of
1782      --  public domain software that could have An_Application_Unit origin.
1783
1784      An_Application_Unit);
1785      --  Neither A_Predefined_Unit or An_Implementation_Unit
1786
1787------------------------------------------------------------------------------
1788--  3.12.4   type Relation_Kinds
1789------------------------------------------------------------------------------
1790--  Relation_Kinds - classification of unit relationships
1791
1792   type Relation_Kinds is (
1793
1794    Ancestors,
1795
1796    Descendants,
1797
1798-------------------------------------------------------------------------------
1799--  Definition:  ANCESTORS of a unit; DESCENDANTS of a unit
1800--
1801--  Ancestors of a library unit are itself, its parent, its parent's
1802--  parent, and so on.  (Standard is an ancestor of every library unit).
1803--
1804--  The Descendants relation is the inverse of the ancestor relation.
1805--  Reference Manual 10.1.1(11).
1806-------------------------------------------------------------------------------
1807
1808    Supporters,
1809
1810-------------------------------------------------------------------------------
1811--  Definition:  SUPPORTERS of a unit
1812--
1813--  Supporters of a compilation unit are units on which it semantically
1814--  depends.  Reference Manual 10.1.1(26).
1815--
1816--  The Supporters relation is transitive; units that are supporters of library
1817--  units mentioned in a with clause of a compilation unit are also supporters
1818--  of that compilation unit.
1819--
1820--  A parent declaration is a Supporter of its descendant units.
1821--
1822--  Each library unit mentioned in the with clauses of a compilation unit
1823--  is a Supporter of that compilation unit and (recursively) any
1824--  completion, child units, or subunits that are included in the declarative
1825--  region of that compilation unit.  Reference Manual 8.1(7-10).
1826--
1827--  A library_unit_body has as a Supporter, its corresponding
1828--  library_unit_declaration, if any.
1829--
1830--  The parent body of a subunit is a Supporter of the subunit.
1831--
1832-------------------------------------------------------------------------------
1833
1834    Dependents,
1835
1836-------------------------------------------------------------------------------
1837--  Definition:  DEPENDENTS of a unit
1838--
1839--  Dependents of a compilation unit are all the compilation units that
1840--  depend semantically on it.
1841--
1842--  The Dependents relation is transitive; Dependents of a unit include the
1843--  unit's Dependents, each dependent unit's Dependents, and so on.  A unit
1844--  that is a dependent of a compilation unit also is a dependent
1845--  of the compilation unit's Supporters.
1846--
1847--  Child units are Dependents of their ancestor units.
1848--
1849--  A compilation unit that mentions other library units in its with
1850--  clauses is one of the Dependents of those library units.
1851--
1852--  A library_unit_body is a Dependent of its corresponding
1853--  library_unit_declaration, if any.
1854--
1855--  A subunit is a Dependent of its parent body.
1856--
1857--  A compilation unit that contains an attribute_reference of a type defined
1858--  in another compilation unit is a Dependent of the other unit.
1859--
1860--  For example:
1861--       If A withs B and B withs C
1862--       then A directly depends on A, B directly depends on C,
1863--            A indirectly depends on C, and
1864--            both A and B are dependents of C.
1865--
1866--  Dependencies between compilation units may also be introduced by
1867--  inline inclusions (Reference Manual 10.1.4(7)) and for certain other
1868--  compiler optimizations. These relations are intended to reflect all of
1869--  these considerations.
1870--
1871-------------------------------------------------------------------------------
1872
1873    Family,
1874
1875-------------------------------------------------------------------------------
1876--  Definition:  FAMILY of a unit
1877--
1878--  The family of a given unit is defined as the set of compilation
1879--  units that comprise the given unit's declaration, body, descendants,
1880--  and subunits (and subunits of subunits and descendants, etc.).
1881-------------------------------------------------------------------------------
1882
1883    Needed_Units);
1884
1885-------------------------------------------------------------------------------
1886--  Definition:  NEEDED UNITS of a unit; CLOSURE of a unit
1887--
1888--  The needed units of a given unit is defined as the set of all
1889--  the Ada units ultimately needed by that unit to form a partition.
1890--  Reference Manual 10.2(2-7).
1891--
1892--  The term closure is commonly used with similar meaning.
1893--
1894--  For example:
1895--   Assume the body of C has a subunit C.S and the declaration of C has
1896--   child units C.Y and C.Z.
1897--       If A withs B, B withs C, B withs C.Y, and C does not with a library
1898--       unit.  Then the needed units of A are:
1899--         library unit declaration C
1900--         child library unit declaration C.Y
1901--         child library unit body C.Y, if any
1902--         library unit body C
1903--         subunit C.S
1904--         library unit declaration B
1905--         library unit body B, if any
1906--         library unit declaration A
1907--         library unit body A, if any
1908--
1909--       Child unit C.Z is only part of the Needed_Units if it is needed.
1910--
1911
1912------------------------------------------------------------------------------
1913--  3.13  type Traverse_Control
1914------------------------------------------------------------------------------
1915--  Traverse_Control - controls for the traversal generic provided in package
1916--  Asis.Iterator. It is defined in package Asis to facilitate automatic
1917--  translation to IDL (See Annex C for details).
1918------------------------------------------------------------------------------
1919
1920   type Traverse_Control is (
1921
1922      Continue,
1923      --  Continues the normal depth-first traversal.
1924
1925      Abandon_Children,
1926      --  Prevents traversal of the current element's children.
1927
1928      Abandon_Siblings,
1929      --  Prevents traversal of the current element's children and remaining
1930      --  siblings.
1931
1932      Terminate_Immediately);
1933      --  Does exactly that.
1934
1935------------------------------------------------------------------------------
1936--  3.14  type Program_Text
1937------------------------------------------------------------------------------
1938
1939   subtype Program_Text is Wide_String;
1940
1941------------------------------------------------------------------------------
1942
1943private
1944
1945   --  The content of this private part is specific for the ASIS
1946   --  implementation for GNAT
1947
1948   --  We use the procedural interface to the main ASIS abstractions even
1949   --  in the Asis child packages to simplify the maintenance. This
1950   --  interface is defined in the Asis.Set_Get package
1951
1952   -------------
1953   -- Context --
1954   -------------
1955
1956   type Context is record
1957      Id : Context_Id := Non_Associated;
1958   end record;
1959
1960   Nil_Context : constant Context := (Id => Non_Associated);
1961
1962   -------------
1963   -- Element --
1964   -------------
1965
1966   type Element is record
1967      Node                 : Node_Id    := Empty;
1968      R_Node               : Node_Id    := Empty;
1969      Node_Field_1         : Node_Id    := Empty;
1970      Node_Field_2         : Node_Id    := Empty;
1971
1972      Enclosing_Unit       : Unit_Id    := Nil_Unit;
1973      Enclosing_Context    : Context_Id := Non_Associated;
1974
1975      Internal_Kind        : Internal_Element_Kinds := Not_An_Element;
1976
1977      Is_Part_Of_Implicit  : Boolean    := False;
1978      Is_Part_Of_Inherited : Boolean    := False;
1979      Is_Part_Of_Instance  : Boolean    := False;
1980
1981      Special_Case         : Special_Cases       := Not_A_Special_Case;
1982      Normalization_Case   : Normalization_Cases := Is_Not_Normalized;
1983      Parenth_Count        : Nat                 := 0;
1984
1985      Enclosing_Tree       : Tree_Id       := Nil_Tree;
1986
1987      Rel_Sloc             : Source_Ptr    := No_Location;
1988
1989      Character_Code       : Char_Code     := 0;
1990
1991      Obtained             : ASIS_OS_Time  := Nil_ASIS_OS_Time;
1992   end record;
1993
1994   ------------------------------
1995   -- Node and  R_Node fields: --
1996   ------------------------------
1997   --  The field Node corresponds to the tree node which has been initially
1998   --  created by the parser, and the field R_Node (= Rewritten Node)
1999   --  corresponds to the result of the rewriting of the Node during the
2000   --  semantic analysis, if any, otherwise R_Node has just the same value
2001   --  as Node.
2002   --
2003   --  For every Asis Element Elem the following is always true:
2004   --
2005   --  (a) Atree.Original_Node(Elem.R_Node) = Elem.Node;
2006   --
2007   --  (b) Elem.R_Node = Elem.Node means that
2008   --           Atree.Is_Rewrite_Substitution ( Elem ) = False
2009   --      and vice versa
2010   --
2011   --  All structural properties of an Element and the position of the Element
2012   --  in Asis Element Kinds hierarchy should be determined on the base
2013   --  of the Node field, R_Node field is to be used to define the position
2014   --  of the Element "prototype" in the tree.
2015   --
2016   --  The function Atree.Parent should be applied to the R_Node field only!
2017   --  Its applying to the Node field is erroneous if the Element has been
2018   --  constructed on the base of rewritten tree node!!!
2019   --
2020   --  See also Node_To_Element constructors in the
2021   --  Asis_Vendor_Primitives.Gnat_To_Asis_Mapping package.
2022
2023   --------------------
2024   --  Node_Field_1  --
2025   --------------------
2026
2027   --  The use and the semantic of this field depend on the kind and on
2028   --  the special case of the corresponding  Element. It is to be used
2029   --  when Node and R_Node are not enough to keep all the needed
2030   --  information about this Element. Empty when unused.
2031   --
2032   --  This field has the following meaning:
2033   --
2034   --  A_Generic_Association (normalized):
2035   --     Node_Field_1 represents the corresponding actual parameter
2036   --
2037   --  A_Procedure_Declaration, A_Function_Declaration (representing an
2038   --  implicit inherited user-defined subprogram) and its subcomponents:
2039   --     Node_Field_1 represents the defining name of the given inherited
2040   --     subprogram, and Node and R_Node fields point to the explicit
2041   --     declaration of the subprogram of the ancestor type which is
2042   --     ultimately inherited (or to the corresponding subcomponent of
2043   --     this subprogram)
2044   --
2045   --  A_Discriminant_Specification, A_Component_Declaration (representing an
2046   --  implicit inherited component of a derived type) and its subcomponents:
2047   --     Node_Field_1 represents the declaration of the type (which is either
2048   --     a derived type or a type extension) to which the component belongs.
2049
2050   --------------------
2051   --  Node_Field_2  --
2052   --------------------
2053
2054   --  The use and the semantic of this field depend on the kind and on
2055   --  the special case of the corresponding  Element. It is to be used
2056   --  when Node and R_Node are not enough to keep all the needed
2057   --  information about this Element. Empty when unused.
2058   --
2059   --  This field has the following meaning:
2060   --
2061   --  A_Discriminant_Specification, A_Component_Declaration (representing an
2062   --  implicit inherited component of a derived type) and its subcomponents:
2063   --     Node_Field_2 represents the defining identifier of the component
2064   --     (the problem with implicit components and discriminants is that
2065   --     several N_Defining_Identifier nodes may have the came
2066   --     component/discriminant specification node as its parent
2067
2068   --------------------------
2069   -- Character_Code field --
2070   --------------------------
2071
2072   --  We need it to process character literals from the definition
2073   --  of the predefined Standard package. This field is set only
2074   --  for defining occurrences of character literals defined in
2075   --  Standard.
2076
2077   Nil_Element : constant Element :=
2078     (Node                 => Empty,
2079      R_Node               => Empty,
2080      Node_Field_1         => Empty,
2081      Node_Field_2         => Empty,
2082      Enclosing_Unit       => Nil_Unit,
2083      Enclosing_Context    => Non_Associated,
2084      Internal_Kind        => Not_An_Element,
2085      Is_Part_Of_Implicit  => False,
2086      Is_Part_Of_Inherited => False,
2087      Is_Part_Of_Instance  => False,
2088      Special_Case         => Not_A_Special_Case,
2089      Normalization_Case   => Is_Not_Normalized,
2090      Parenth_Count        => 0,
2091      Enclosing_Tree       => Nil_Tree,
2092      Rel_Sloc             => No_Location,
2093      Character_Code       => 0,
2094      Obtained             => Nil_ASIS_OS_Time);
2095
2096   Nil_Element_List : constant Element_List (1 .. 0) :=
2097     (1 .. 0 => Nil_Element);
2098
2099   ----------------------
2100   -- Compilation_Unit --
2101   ----------------------
2102
2103   type Compilation_Unit is record
2104      Id       : Unit_Id      := Nil_Unit;
2105      Cont_Id  : Context_Id   := Non_Associated;
2106      Obtained : ASIS_OS_Time := Nil_ASIS_OS_Time;
2107   end record;
2108
2109   Nil_Compilation_Unit : constant Compilation_Unit :=
2110     (Id       => Nil_Unit,
2111      Cont_Id  => Non_Associated,
2112      Obtained => Nil_ASIS_OS_Time);
2113
2114   Nil_Compilation_Unit_List : constant Compilation_Unit_List (1 .. 0) :=
2115     (1 .. 0 => Nil_Compilation_Unit);
2116
2117   -------------------------------------------------
2118   --  Pragmas Ordered for ASIS enumeration types --
2119   -------------------------------------------------
2120
2121   --  All the enumeration types defined in the ASIS Standard interface
2122   --  packages should be considered as ordered for '-gnatw.u' warning option
2123
2124   pragma Ordered (Element_Kinds);
2125   pragma Ordered (Pragma_Kinds);
2126   pragma Ordered (Defining_Name_Kinds);
2127   pragma Ordered (Declaration_Kinds);
2128   pragma Ordered (Trait_Kinds);
2129   pragma Ordered (Declaration_Origins);
2130   pragma Ordered (Mode_Kinds);
2131   pragma Ordered (Subprogram_Default_Kinds);
2132   pragma Ordered (Definition_Kinds);
2133   pragma Ordered (Type_Kinds);
2134   pragma Ordered (Formal_Type_Kinds);
2135   pragma Ordered (Access_Type_Kinds);
2136   pragma Ordered (Interface_Kinds);
2137   pragma Ordered (Access_Definition_Kinds);
2138   pragma Ordered (Root_Type_Kinds);
2139   pragma Ordered (Constraint_Kinds);
2140   pragma Ordered (Discrete_Range_Kinds);
2141   pragma Ordered (Association_Kinds);
2142   pragma Ordered (Expression_Kinds);
2143   pragma Ordered (Operator_Kinds);
2144   pragma Ordered (Attribute_Kinds);
2145   pragma Ordered (Statement_Kinds);
2146   pragma Ordered (Path_Kinds);
2147   pragma Ordered (Clause_Kinds);
2148   pragma Ordered (Representation_Clause_Kinds);
2149   pragma Ordered (Unit_Kinds);
2150   pragma Ordered (Unit_Classes);
2151   pragma Ordered (Unit_Origins);
2152   pragma Ordered (Relation_Kinds);
2153   pragma Ordered (Traverse_Control);
2154
2155end Asis;
2156