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

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

Drop Cursor and Visiter for up interpretation set.

Replace it with Any_Cursor and iterator.

File size: 5.5 KB
Line 
1with Ada.Iterator_Interfaces;
2
3with Gela.Elements.Defining_Names;
4with Gela.Lexical_Types;
5with Gela.Semantic_Types;
6
7package Gela.Plain_Int_Sets.Cursors is
8 pragma Preelaborate;
9
10 generic
11 type Cursor is interface;
12 with procedure Next (Self : in out Cursor) is abstract;
13 type Some_Cursor is new Cursor with private;
14 with package Iterators is new Ada.Iterator_Interfaces
15 (Cursor'Class, Has_Element => <>);
16 package Generic_Iterators is
17 type Iterator is new Iterators.Forward_Iterator with record
18 Cursor : Some_Cursor;
19 end record;
20
21 overriding function First (Self : Iterator) return Cursor'Class;
22
23 overriding function Next
24 (Self : Iterator;
25 Position : Cursor'Class) return Cursor'Class;
26
27 end Generic_Iterators;
28
29 type Category_Cursor is
30 new Gela.Interpretations.Category_Cursor with private;
31
32 not overriding procedure Initialize
33 (Self : out Category_Cursor;
34 Set : access Interpretation_Set;
35 Index : Gela.Interpretations.Interpretation_Set_Index);
36
37 overriding procedure Next (Self : in out Category_Cursor);
38
39 type Defining_Name_Cursor is
40 new Gela.Interpretations.Defining_Name_Cursor with private;
41
42 not overriding procedure Initialize
43 (Self : out Defining_Name_Cursor;
44 Set : access Interpretation_Set;
45 Index : Gela.Interpretations.Interpretation_Set_Index);
46
47 overriding procedure Next (Self : in out Defining_Name_Cursor);
48
49 overriding function Defining_Name
50 (Self : Defining_Name_Cursor)
51 return Gela.Elements.Defining_Names.Defining_Name_Access;
52
53 type Expression_Cursor is
54 new Gela.Interpretations.Expression_Cursor with private;
55
56 not overriding procedure Initialize
57 (Self : out Expression_Cursor;
58 Set : access Interpretation_Set;
59 Index : Gela.Interpretations.Interpretation_Set_Index);
60
61 overriding function Expression_Type
62 (Self : Expression_Cursor) return Gela.Semantic_Types.Type_Index;
63
64 overriding procedure Next (Self : in out Expression_Cursor);
65
66 type Symbol_Cursor is
67 new Gela.Interpretations.Symbol_Cursor with private;
68
69 not overriding procedure Initialize
70 (Self : out Symbol_Cursor;
71 Set : access Interpretation_Set;
72 Index : Gela.Interpretations.Interpretation_Set_Index);
73
74 overriding procedure Next (Self : in out Symbol_Cursor);
75
76 type Profile_Cursor is
77 new Gela.Interpretations.Profile_Cursor with private;
78
79 not overriding procedure Initialize
80 (Self : out Profile_Cursor;
81 Set : access Interpretation_Set;
82 Index : Gela.Interpretations.Interpretation_Set_Index);
83
84 overriding procedure Next (Self : in out Profile_Cursor);
85
86 type Any_Cursor is
87 new Gela.Interpretations.Any_Cursor with private;
88
89 not overriding procedure Initialize
90 (Self : out Any_Cursor;
91 Set : access Interpretation_Set;
92 Index : Gela.Interpretations.Interpretation_Set_Index);
93
94 overriding procedure Next (Self : in out Any_Cursor);
95
96private
97
98 type Base_Cursor is abstract new Gela.Interpretations.Abstract_Cursor
99 with record
100 Set : access Interpretation_Set;
101 Pos : Int_Lists.Cursor := Int_Lists.No_Element;
102 end record;
103
104 overriding function Has_Element (Self : Base_Cursor) return Boolean;
105
106 overriding function Get_Index
107 (Self : Base_Cursor) return Gela.Interpretations.Interpretation_Index;
108
109 type Category_Cursor is new Base_Cursor
110 and Gela.Interpretations.Category_Cursor with null record;
111
112 overriding function Matcher
113 (Self : Category_Cursor)
114 return Gela.Interpretations.Type_Matcher_Access;
115
116 type Defining_Name_Cursor is new Base_Cursor
117 and Gela.Interpretations.Defining_Name_Cursor with null record;
118
119 type Expression_Cursor is new Base_Cursor
120 and Gela.Interpretations.Expression_Cursor with null record;
121
122 type Symbol_Cursor is new Base_Cursor
123 and Gela.Interpretations.Symbol_Cursor with null record;
124
125 overriding function Symbol
126 (Self : Symbol_Cursor) return Gela.Lexical_Types.Symbol;
127
128 type Profile_Cursor is new Base_Cursor
129 and Gela.Interpretations.Profile_Cursor with null record;
130
131 overriding function Corresponding_Type
132 (Self : Profile_Cursor) return Gela.Semantic_Types.Type_Index;
133
134 overriding function Attribute_Kind
135 (Self : Profile_Cursor)
136 return Gela.Lexical_Types.Predefined_Symbols.Attribute;
137
138 type Any_Cursor is new Base_Cursor
139 and Gela.Interpretations.Any_Cursor with null record;
140
141 overriding function Is_Symbol (Self : Any_Cursor) return Boolean;
142
143 overriding function Is_Defining_Name (Self : Any_Cursor) return Boolean;
144
145 overriding function Is_Expression (Self : Any_Cursor) return Boolean;
146
147 overriding function Is_Expression_Category (Self : Any_Cursor)
148 return Boolean;
149
150 overriding function Is_Profile (Self : Any_Cursor) return Boolean;
151
152 overriding function Symbol
153 (Self : Any_Cursor) return Gela.Lexical_Types.Symbol;
154
155 overriding function Defining_Name (Self : Any_Cursor)
156 return Gela.Elements.Defining_Names.Defining_Name_Access;
157
158 overriding function Expression_Type (Self : Any_Cursor)
159 return Gela.Semantic_Types.Type_Index;
160
161 overriding function Matcher (Self : Any_Cursor)
162 return Gela.Interpretations.Type_Matcher_Access;
163
164 overriding function Corresponding_Type
165 (Self : Any_Cursor) return Gela.Semantic_Types.Type_Index;
166
167 overriding function Attribute_Kind (Self : Any_Cursor)
168 return Gela.Lexical_Types.Predefined_Symbols.Attribute;
169
170end Gela.Plain_Int_Sets.Cursors;
Note: See TracBrowser for help on using the repository browser.