1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--            O C A R I N A . M E _ A A D L _ B A . T O K E N 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 Ocarina.Types; use Ocarina.Types;
34

35 1
package Ocarina.ME_AADL_BA.Tokens is
36

37
   pragma Elaborate_Body (Tokens);
38

39
   type BA_Token_Type is
40
     (T_Error,
41
      T_Identifier,
42

43
      --  Special_Characters
44

45
      T_Quotation_Mark,        --  "    (for T_String_Literal)
46
      T_Number_Sign,           --  #
47
      T_Underline,             --  _
48

49
      T_Comma,                 --  ,     First Delimiter
50

51
      T_Dot,                   --  .
52
      T_Colon,                 --  :
53
      T_Semicolon,             --  ;
54
      T_Colon_Colon,           --  ::
55
      T_Assignment,            --  :=
56
      T_Interval,              --  ..
57

58
      T_Greater_Greater_Than,  --  >>
59
      T_Tick,                  --  '
60

61
      T_Left_Parenthesis,      --  (     First Opening Delimiter
62
      T_Left_Square_Bracket,   --  [
63
      T_Left_Curly_Bracket,    --  {
64
      T_Begin_Annex,           --  {**
65
      T_Left_Step_Bracket,     --  -[
66

67
      T_Right_Parenthesis,     --  )     First Closing Delimiter
68
      T_Right_Square_Bracket,  --  ]
69
      T_Right_Curly_Bracket,   --  }
70
      T_End_Annex,             --  **}
71
      T_Right_Step_Bracket,    --  ]->
72

73
      T_Interrogative,         --  ?
74
      T_Exclamation,           --  !
75
      T_Exclamation_Greater,   --  !>
76
      T_Exclamation_Lesser,    --  !<
77

78
      --  Relational operator
79

80
      T_Less_Than_Sign,        --  <
81
      T_Equals_Sign,           --  =
82
      T_Greater_Than_Sign,     --  >
83
      T_Greater_Or_Equal,      --  >=
84
      T_Less_Or_Equal,         --  <=
85
      T_Non_Equal,             --  !=
86

87
      --  Unary and binary adding operator
88

89
      T_Plus,                  --  +
90
      T_Minus,                 --  -
91

92
      T_Concat,                --  &
93

94
      --  Multiplying operator
95

96
      T_Multiply,              --  *
97
      T_Divide,                --  /
98
      T_Mod,                   --  mod
99
      T_Rem,                   --  rem
100

101
      --  Highest precedence operator
102

103
      T_Exponent,              --  **
104
      T_Abs,                   --  abs
105
      T_Not,                   --  not
106

107
      --  Logical operator
108

109
      T_And,                   --  and
110
      T_Or,                    --  or
111
      T_Xor,                   --  xor
112

113
      --  Structure
114

115
      T_If,                    --  if
116
      T_Elsif,                 --  elsif
117
      T_Else,                  --  else
118
      T_End,                   --  end
119
      T_For,                   --  for
120
      T_While,                 --  while
121
      T_Do,                    --  do
122
      T_Until,                 --  until
123
      T_Forall,                --  forall
124

125
      --  Boolean
126

127
      T_True,                  --  true
128
      T_False,                 --  false
129

130
      --  Reserved Words
131

132
      T_Abort,                 --  abort
133
      T_Any,                   --  any
134
      T_Binding,               --  binding
135
      T_Complete,              --  complete
136
      T_Computation,           --  computation
137
      T_Count,                 --  count
138
      T_Delay,                 --  delay
139
      T_Dispatch,              --  dispatch
140
      T_Final,                 --  final
141
      T_Fixed,                 --  fixed
142
      T_Fresh,                 --  fresh
143
      T_Frozen,                --  frozen
144
      T_In,                    --  in
145
      T_Initial,               --  initial
146
      T_Lower_Bound,           --  lower_bound
147
      T_Mode,                  --  mode
148
      T_Normal,                --  normal
149
      T_On,                    --  on
150
      T_Ormore,                --  ormore
151
      T_Orless,                --  orless
152
      T_Others,                --  others
153
      T_Otherwise,             --  otherwise
154
      T_Poisson,               --  poisson
155
      T_Random,                --  random
156
      T_Self,                  --  self
157
      T_State,                 --  state
158
      T_States,                --  states
159
      T_Stop,                  --  stop
160
      T_Then,                  --  then
161
      T_Timeout,               --  timeout
162
      T_Transition,            --  transition
163
      T_Transitions,           --  transitions
164
      T_Updated,               --  updated
165
      T_Upper_Bound,           --  upper_bound
166
      T_Variables,             --  variables
167

168
      T_None,                  --  none, not in BA draft
169

170
      --  Numeric Literals
171

172
      T_Real_Literal,          --  real number
173
      T_Integer_Literal,       --  integer number
174

175
      --  Others
176

177
      T_String_Literal,        --  string
178
      T_Comment,               --  comment      (ignored)
179
      T_Raw_Text,              --  raw text (used for annex parsing
180
                                 --  / printing)
181

182
      T_EOF                    --  end of file
183
     );
184

185
   type BA_Token_List_Type is array (Positive range <>) of BA_Token_Type;
186

187
   --  Sybtype definitions
188

189
   subtype BA_Logical_Operator_Type is BA_Token_Type
190
     range T_And .. T_Xor;
191

192
   subtype BA_Relational_Operator is BA_Token_Type
193
     range T_Less_Than_Sign .. T_Non_Equal;
194

195
   subtype BA_Unary_Adding_Operator is BA_Token_Type
196
     range T_Minus .. T_Minus;
197

198
   subtype BA_Binary_Adding_Operator is BA_Token_Type
199
     range T_Plus .. T_Minus;
200

201
   subtype BA_Multiplying_Operator is BA_Token_Type
202
     range T_Multiply .. T_Rem;
203

204
   subtype BA_Highest_Precedence_Operator is BA_Token_Type
205
     range T_Exponent .. T_Not;
206

207
   subtype BA_Boolean_Type is BA_Token_Type
208
     range T_True .. T_False;
209

210
   subtype BA_Opening_Delimiter is BA_Token_Type
211
     range T_Left_Parenthesis .. T_Left_Step_Bracket;
212

213
   subtype BA_Closing_Delimiter is BA_Token_Type
214
     range T_Right_Parenthesis .. T_Right_Step_Bracket;
215

216
   subtype BA_Delimiter_Type is BA_Token_Type
217
     range T_Comma ..  T_Exclamation;
218

219
   subtype BA_Numeric_Type is BA_Token_Type
220
     range T_Real_Literal .. T_Integer_Literal;
221

222
   subtype BA_Reserved_Word_Type is BA_Token_Type
223
     range  T_Mod .. T_None;
224

225
   BA_First_Reserved_Word_Pos : constant :=
226
     BA_Reserved_Word_Type'Pos (BA_Reserved_Word_Type'First);
227
   BA_Last_Reserved_Word_Pos  : constant :=
228
     BA_Reserved_Word_Type'Pos (BA_Reserved_Word_Type'Last);
229

230 1
   BA_Token_Image    : array (BA_Token_Type) of Name_Id;
231

232
   Language       : constant String := "behavior_specification";
233
   BA_Language  : Name_Id;
234

235
   Max_Number_Of_Digits : constant Integer := 20;
236
   --  Number of digits of the biggest allowed integer, 2**64 have 20
237
   --  digits
238

239 1
   Integer_Literal_Value : Unsigned_Long_Long;
240
   --  for Tokens : T_Integer_Literal
241

242 1
   Float_Literal_Value   : Long_Long_Float;
243
   --  for Tokens : T_Real_Literal
244

245 1
   Numeric_Literal_Base  : Unsigned_Short_Short;
246
   --  for Tokens : T_Integer_Literal, T_Real_Literal
247

248 1
   Numeric_Literal_Exp   : Integer;
249
   --  for Tokens : T_Integer_Literal, T_Real_Literal
250

251
   function Image (T : BA_Token_Type) return String;
252
   --  Return an image of token T
253

254
   procedure Init_Tokens;
255
   --  Set all the token strings into the name table.
256

257
   function Quoted_Image (T : BA_Token_Type) return String;
258
   --  Return the quoted image of token T
259

260 1
end Ocarina.ME_AADL_BA.Tokens;

Read our documentation on viewing source code .

Loading