ocarina-me_real-tokens.ads 7.31 KB
Newer Older
1
2
3
4
5
6
7
8
------------------------------------------------------------------------------
--                                                                          --
--                           OCARINA COMPONENTS                             --
--                                                                          --
--               O C A R I N A . M E _ R E A L . T O K E N S                --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
jhugues's avatar
jhugues committed
9
--       Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE.        --
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--                                                                          --
-- Ocarina  is free software;  you  can  redistribute  it and/or  modify    --
-- it under terms of the GNU General Public License as published by the     --
-- Free Software Foundation; either version 2, or (at your option) any      --
-- later version. Ocarina is distributed  in  the  hope  that it will be    --
-- useful, but WITHOUT ANY WARRANTY;  without even the implied warranty of  --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received  a copy of the --
-- GNU General Public License distributed with Ocarina; see file COPYING.   --
-- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth --
-- Floor, Boston, MA 02111-1301, USA.                                       --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable to be   --
-- covered  by the  GNU  General  Public  License. This exception does not  --
-- however invalidate  any other reasons why the executable file might be   --
-- covered by the GNU Public License.                                       --
--                                                                          --
jhugues's avatar
jhugues committed
29
30
--                 Ocarina is maintained by the TASTE project               --
--                      (taste-users@lists.tuxfamily.org)                   --
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
--                                                                          --
------------------------------------------------------------------------------

--  Description of REAL tokens

with Types;
with Locations;
with Ocarina.Files;

package Ocarina.ME_REAL.Tokens is
   use Locations;
   use Types;
   use Ocarina.Files;

   type Token_Type is
     (T_Error,
      T_Identifier,
      T_Pragma,

      --  About template types

      T_Sequence,
      T_String,
      T_Wstring,
      T_Fixed,

      --  Graphic characters

      T_Colon,
      T_Colon_Colon,
      T_Comma,
      T_Left_Brace,
      T_Left_Bracket,
      T_Left_Paren,
      T_Right_Brace,
      T_Right_Bracket,
      T_Right_Paren,
      T_Semi_Colon,

      T_Equal,
      T_Not,
      T_And,
      T_Or,
      T_Less_Equal,
      T_Greater_Equal,
      T_Greater,
      T_Less,
      T_Different,
      T_Minus,
      T_Plus,
      T_Star,
      T_Modulo,
      T_Slash,
      T_Power,
      T_Affect,

      --  pre-defined sets

      T_Processor_Set,
      T_Virtual_Processor_Set,
      T_Virtual_Bus_Set,
      T_Process_Set,
      T_Thread_Set,
      T_Threadgroup_Set,
      T_Subprogram_Call_Set,
      T_Sequence_Call_Set,
      T_Subprogram_Set,
      T_Data_Set,
      T_Memory_Set,
      T_Bus_Set,
      T_Connection_Set,
      T_Device_Set,
      T_End_To_End_Flows_Set,
      T_System_Set,
105
      T_Abstract_Set,
106
      T_Root_System_Set,
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
      T_Unknown_Set,
      T_Local_Set,

      --  Selection function

      T_Is_Subcomponent_Of,
      T_Is_Bound_To,
      T_Is_Connected_To,
      T_Is_Called_By,
      T_Is_Accessed_By,
      T_Is_Accessing_To,
      T_Is_Passing_Through,
      T_Is_Calling,
      T_Is_Provided_Class,
      T_Is_Predecessor_Of,
      T_Is_Connecting_To,

      --  Verification function

      T_Get_Property_Value,
      T_Get_System_Property_Value,
      T_Cardinal,
      T_First,
      T_Property_Exists,
      T_Last,
      T_Expr,
      T_Size,       --  Size of a list
      T_Float,
      T_List,       --  Build a list from set or enumeration
      T_Head,       --  Return the first node of a list
      T_Queue,      --  Return the list minus  the first node
      T_Integer,
139
140
      T_Ceil,
      T_Floor,
141
142
      T_Max,
      T_Min,
143
144
145
146
147
148
149
150
151
152
      T_Cos,
      T_Sin,
      T_Tan,
      T_Cosh,
      T_Sinh,
      T_Tanh,
      T_Ln,
      T_Exp,
      T_Sqrt,

153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
      T_Is_In,      --  Checks weither list_1 is included into list_2
      T_LCM,        --  Lowest Common Multiple
      T_GCD,        --  Greatest Common Divisor
      T_Non_Null,   --  N -> [0, 1]
      T_All_Equals,
      T_Product,
      T_Sum,

      --  Ranges set-level functions

      T_MMax,
      T_MProduct,
      T_MMin,
      T_MAll_Equals,
      T_MSum,

      --  Literals

      T_False,
      T_True,
      T_Boolean_Literal,
      T_Integer_Literal,
      T_Fixed_Point_Literal,
      T_Floating_Point_Literal,
      T_Character_Literal,
      T_Wide_Character_Literal,
      T_String_Literal,
      T_Wide_String_Literal,

      --  keywords

      T_Check,
      T_End,
      T_Foreach,
      T_In,
      T_Do,
      T_Sothat,
      T_Requires,
      T_Return,
      T_Var,
      T_Compute,
      T_If,
      T_Then,
      T_Else,
      T_Global,
      T_Theorem,

      T_Anonymous_Set,
      T_EOF);

   First_Token_Pos : constant := Token_Type'Pos (Token_Type'First);
   Last_Token_Pos  : constant := Token_Type'Pos (Token_Type'Last);
   Prefix : constant String := "%real%";

   subtype Literal_Type is Token_Type
     range T_False .. T_Wide_String_Literal;

   subtype Operator_Type is Token_Type
     range T_Equal .. T_Affect;

   subtype Predefined_Sets is Token_Type
     range T_Processor_Set .. T_Local_Set;

   subtype Selection_Function_Type is Token_Type
     range T_Processor_Set .. T_Is_Connecting_To;

   subtype Verification_Function_Type is Token_Type
     range T_Get_Property_Value .. T_Sum;

   subtype Higher_Level_Function_Type is Token_Type
     range T_MMax .. T_MSum;

   subtype Boolean_Operator_Type is Token_Type
     range T_Not .. T_Or;

   subtype Keyword_Type is Token_Type
     range T_Check .. T_Theorem;

   Token_Image : array (Token_Type) of Name_Id;

   ---------------------------------------------------
   -- Global variables updated by the token scanner --
   ---------------------------------------------------

   Token          : Token_Type;
   Token_Name     : Name_Id;
   Token_Location : Location renames Ocarina.Files.Buffer_Location;

   Language       : constant String := "real_specification";
   REAL_Language  : Name_Id;

   procedure Init_Tokens;

   function Image (T : Token_Type) return String;

   function Quoted_Image (T : Token_Type) return String;

   function Is_Literal (T : Token_Type) return Boolean;

   function Is_Operator (T : Token_Type) return Boolean;

   function Is_Set_Operator (T : Token_Type) return Boolean;

   function Is_Predefined_Set (T : Token_Type) return Boolean;

   function Is_Boolean_Operator (T : Token_Type) return Boolean;

   function Is_Scoped_Name (T : Token_Type) return Boolean;

end Ocarina.ME_REAL.Tokens;