source: trunk/ada-2012/src/semantic/gela-name_list_managers.ads@ 552

Last change on this file since 552 was 426, checked in by Maxim Reznik, 7 years ago

Minor refactoring

Rename Count_Type to List in Gela.Peristent_Lists. Hide Index_Type

  • Property svn:keywords set to Author Date Revision
File size: 2.8 KB
Line 
1with Gela.Lexical_Types;
2with Gela.Elements.Defining_Names;
3with Gela.Peristent_Lists;
4with Gela.Defining_Name_Cursors;
5
6package Gela.Name_List_Managers is
7 pragma Preelaborate;
8
9 type Name_List_Manager is tagged private;
10
11 type List is private;
12 -- List contains (Symbol, Name) pairs
13 function Empty_List (Self : Name_List_Manager) return List;
14
15 procedure Append
16 (Self : in out Name_List_Manager;
17 Symbol : Gela.Lexical_Types.Symbol;
18 Name : Gela.Elements.Defining_Names.Defining_Name_Access;
19 Input : List;
20 Output : out List);
21 -- Add (Symbol, Name) to Input return result as Output
22
23 type Defining_Name_Cursor is
24 new Gela.Defining_Name_Cursors.Defining_Name_Cursor with private;
25 -- Cursor over names in a List with some Symbol
26
27 function Symbol
28 (Self : Defining_Name_Cursor) return Gela.Lexical_Types.Symbol;
29
30 function Find
31 (Self : access Name_List_Manager'Class;
32 Input : List;
33 Symbol : Gela.Lexical_Types.Symbol) return Defining_Name_Cursor;
34 -- Find names in a Input list with given Symbol
35
36 procedure For_Each
37 (Self : access Name_List_Manager;
38 Input : List;
39 Proc : access procedure
40 (Symbol : Gela.Lexical_Types.Symbol;
41 Name : Gela.Elements.Defining_Names.Defining_Name_Access));
42
43 type Map is private;
44 -- Map is mapping Name -> List
45 function Empty_Map (Self : Name_List_Manager) return Map;
46
47 procedure Append
48 (Self : in out Name_List_Manager;
49 Key : Gela.Elements.Defining_Names.Defining_Name_Access;
50 Value : List;
51 Input : Map;
52 Output : out Map);
53 -- Add (Key, Value) to Input return result as Output
54
55private
56
57 type Pair is record
58 Symbol : Gela.Lexical_Types.Symbol;
59 Name : Gela.Elements.Defining_Names.Defining_Name_Access;
60 end record;
61
62 package Pair_Peristent_Lists is new Gela.Peristent_Lists (Pair);
63
64 type List is record
65 Index : Pair_Peristent_Lists.List;
66 end record;
67
68 type Map is null record;
69
70 type Name_List_Manager is tagged record
71 Pair_List : Pair_Peristent_Lists.Container;
72 end record;
73
74 type Defining_Name_Cursor is
75 new Gela.Defining_Name_Cursors.Defining_Name_Cursor with
76 record
77 Set : access Name_List_Manager'Class;
78 Name : Pair_Peristent_Lists.List := Pair_Peristent_Lists.Empty;
79 end record;
80
81 overriding function Has_Element
82 (Self : Defining_Name_Cursor) return Boolean;
83
84 overriding function Element
85 (Self : Defining_Name_Cursor)
86 return Gela.Elements.Defining_Names.Defining_Name_Access;
87
88 overriding procedure Next
89 (Self : in out Defining_Name_Cursor);
90
91 procedure Internal_Next
92 (Self : in out Defining_Name_Cursor;
93 Symbol : Gela.Lexical_Types.Symbol);
94
95end Gela.Name_List_Managers;
Note: See TracBrowser for help on using the repository browser.