1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--   O C A R I N A . A N A L Y Z E R . A A D L . N A M I N G _ R U L E S    --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--                  Copyright (C) 2009 Telecom ParisTech,                   --
10
--                 2010-2019 ESA & ISAE, 2019-2020 OpenAADL                 --
11
--                                                                          --
12
-- Ocarina  is free software; you can redistribute it and/or modify under   --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
16
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
17
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
18
--                                                                          --
19
-- As a special exception under Section 7 of GPL version 3, you are granted --
20
-- additional permissions described in the GCC Runtime Library Exception,   --
21
-- version 3.1, as published by the Free Software Foundation.               --
22
--                                                                          --
23
-- You should have received a copy of the GNU General Public License and    --
24
-- a copy of the GCC Runtime Library Exception along with this program;     --
25
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26
-- <http://www.gnu.org/licenses/>.                                          --
27
--                                                                          --
28
--                    Ocarina is maintained by OpenAADL team                --
29
--                              (info@openaadl.org)                         --
30
--                                                                          --
31
------------------------------------------------------------------------------
32

33
with GNAT.Table;
34

35 1
package Ocarina.Analyzer.AADL.Naming_Rules is
36

37
   type Scope_Stack_Entry is record
38
      Node : Node_Id;
39
   end record;
40

41
   No_Scope_Depth : constant Int := -1;
42
   package Scope_Stack is new GNAT.Table
43
     (Scope_Stack_Entry,
44
      Int,
45
      No_Scope_Depth + 1,
46
      10,
47
      10);
48

49
   procedure Initialize;
50

51
   procedure Push_Scope (Scope : Node_Id);
52

53
   procedure Pop_Scope;
54

55
   function Current_Scope return Node_Id;
56
   --  Return current scope
57

58
   function Node_Explicitly_In_Scope
59
     (Identifier : Node_Id;
60
      Scope      : Node_Id) return Node_Id;
61
   --  Find whether there is a definition for identifier Identifier in
62
   --  scope Scope. Return the corresponding entity if the identifier
63
   --  exists in the scope, else No_Node.
64

65
   function Node_Explicitly_In_Scope
66
     (Name_Of_Identifier : Name_Id;
67
      Scope              : Node_Id) return Node_Id;
68

69
   function Node_In_Scope
70
     (Identifier : Node_Id;
71
      Scope      : Node_Id) return Node_Id;
72
   --  Find whether there is a definition for identifier Identifier in
73
   --  scope Scope or the above scopes. The Homonym field of the
74
   --  identifier of the returned node points to the next homonym of
75
   --  the node in the scopes, so that it is possible to get all the
76
   --  homonyms.
77

78
   function Node_In_Scope
79
     (Name_Of_Identifier : Name_Id;
80
      Scope              : Node_Id) return Node_Id;
81

82
   function Enter_Name_In_Scope (Identifier : Node_Id) return Boolean;
83
   --  Detect naming conflict with Identifier. Conflict happens when
84
   --  an identifier already exists in the scope, corresponding to an
85
   --  entity of the same kind (e.g. mode, subcomponent, feature,
86
   --  etc.), except if they are in different modes. In case of
87
   --  success, add Identifier to the current scope and return True;
88
   --  else False.
89

90
   function Enter_Name_In_Scope (Identifier : Node_Id) return Node_Id;
91

92
   function Remove_From_Homonyms
93
     (First_Homonym     : Node_Id;
94
      Homonym_To_Remove : Node_Id) return Node_Id;
95
   --  Remove Homonym_To_Remove from the homonym list whose first
96
   --  element is First_Homonym, and return the homonym after
97
   --  Homonym_To_Remove (which may be No_Node)
98

99
   procedure Remove_From_Scope (Identifier : Node_Id; Scope : Node_Id);
100
   --  Remove from Scope the first entity in Homonym chain
101

102
   D_Scopes : constant Boolean := False;
103
   --  Control the display of debug messages
104

105 1
end Ocarina.Analyzer.AADL.Naming_Rules;

Read our documentation on viewing source code .

Loading