aboutsummaryrefslogtreecommitdiffstats
path: root/tokens.adb
blob: 5d27be8d93782b5f04fa302a3796a128221a655a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
105
106
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
--  Scanner token definitions.
--  Copyright (C) 2002, 2003, 2004, 2005 Tristan Gingold
--
--  GHDL is free software; you can redistribute it and/or modify it under
--  the terms of the GNU General Public License as published by the Free
--  Software Foundation; either version 2, or (at your option) any later
--  version.
--
--  GHDL 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
--  along with GHDL; see the file COPYING.  If not, write to the Free
--  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
--  02111-1307, USA.
package body Tokens is
   -- Return the name of the token.
   function Image (Token: Token_Type) return String is
   begin
      case Token is
         when Tok_Invalid =>
            return "<invalid>";
         when Tok_Left_Paren =>
            return "(";
         when Tok_Right_Paren =>
            return ")";
         when Tok_Left_Bracket =>
            return "[";
         when Tok_Right_Bracket =>
            return "]";
         when Tok_Colon =>
            return ":";
         when Tok_Semi_Colon =>
            return ";";
         when Tok_Comma =>
            return ",";
         when Tok_Tick =>
            return "'";
         when Tok_Double_Star =>
            return "**";
         when Tok_Double_Arrow =>
            return "=>";
         when Tok_Assign =>
            return ":=";
         when Tok_Bar =>
            return "|";
         when Tok_Box =>
            return "<>";
         when Tok_Dot =>
            return ".";

         when Tok_Eof =>
            return "<EOF>";
         when Tok_Newline =>
            return "<newline>";
         when Tok_Comment =>
            return "<comment>";
         when Tok_Character =>
            return "<character>";
         when Tok_Identifier =>
            return "<identifier>";
         when Tok_Integer =>
            return "<integer>";
         when Tok_Real =>
            return "<real>";
         when Tok_String =>
            return "<string>";
         when Tok_Bit_String =>
            return "<bit string>";

         when Tok_Equal_Equal =>
            return "==";

         -- relational_operator:
         when Tok_Equal =>
            return "=";
         when Tok_Not_Equal =>
            return "/=";
         when Tok_Less =>
            return "<";
         when Tok_Less_Equal =>
            return "<=";
         when Tok_Greater =>
            return ">";
         when Tok_Greater_Equal =>
            return ">=";

         when Tok_Match_Equal =>
            return "?=";
         when Tok_Match_Not_Equal =>
            return "?/=";
         when Tok_Match_Less =>
            return "?<";
         when Tok_Match_Less_Equal =>
            return "?<=";
         when Tok_Match_Greater =>
            return "?>";
         when Tok_Match_Greater_Equal =>
            return "?>=";

         -- sign token
         when Tok_Plus =>
            return "+";
         when Tok_Minus =>
            return "-";
         -- and adding_operator
         when Tok_Ampersand =>
            return "&";

         when Tok_Condition =>
            return "??";

         -- multiplying operator
         when Tok_Star =>
            return "*";
         when Tok_Slash =>
            return "/";
         when Tok_Mod =>
            return "mod";
         when Tok_Rem =>
            return "rem";

         -- relation token:
         when Tok_And =>
            return "and";
         when Tok_Or =>
            return "or";
         when Tok_Xor =>
            return "xor";
         when Tok_Nand =>
            return "nand";
         when Tok_Nor =>
            return "nor";
         when Tok_Xnor =>
            return "xnor";

         -- Reserved words.
         when Tok_Abs =>
            return "abs";
         when Tok_Access =>
            return "access";
         when Tok_After =>
            return "after";
         when Tok_Alias =>
            return "alias";
         when Tok_All =>
            return "all";
         when Tok_Architecture =>
            return "architecture";
         when Tok_Array =>
            return "array";
         when Tok_Assert =>
            return "assert";
         when Tok_Attribute =>
            return "attribute";

         when Tok_Begin =>
            return "begin";
         when Tok_Block =>
            return "block";
         when Tok_Body =>
            return "body";
         when Tok_Buffer =>
            return "buffer";
         when Tok_Bus =>
            return "bus";

         when Tok_Case =>
            return "case";
         when Tok_Component =>
            return "component";
         when Tok_Configuration =>
            return "configuration";
         when Tok_Constant =>
            return "constant";

         when Tok_Disconnect =>
            return "disconnect";
         when Tok_Downto =>
            return "downto";

         when Tok_Else =>
            return "else";
         when Tok_Elsif =>
            return "elsif";
         when Tok_End =>
            return "end";
         when Tok_Entity =>
            return "entity";
         when Tok_Exit =>
            return "exit";

         when Tok_File =>
            return "file";
         when Tok_For =>
            return "for";
         when Tok_Function =>
            return "function";

         when Tok_Generate =>
            return "generate";
         when Tok_Generic =>
            return "generic";
         when Tok_Group =>
            return "group";
         when Tok_Guarded =>
            return "guarded";

         when Tok_If =>
            return "if";
         when Tok_Impure =>
            return "impure";
         when Tok_In =>
            return "in";
         when Tok_Inertial =>
            return "inertial";
         when Tok_Inout =>
            return "inout";
         when Tok_Is =>
            return "is";

         when Tok_Label =>
            return "label";
         when Tok_Library =>
            return "library";
         when Tok_Linkage =>
            return "linkage";
         when Tok_Literal =>
            return "literal";
         when Tok_Loop =>
            return "loop";

         when Tok_Map =>
            return "map";

         when Tok_New =>
            return "new";
         when Tok_Next =>
            return "next";
         when Tok_Not =>
            return "not";
         when Tok_Null =>
            return "null";

         when Tok_Of =>
            return "of";
         when Tok_On =>
            return "on";
         when Tok_Open =>
            return "open";
         when Tok_Out =>
            return "out";
         when Tok_Others =>
            return "others";

         when Tok_Package =>
            return "package";
         when Tok_Port =>
            return "port";
         when Tok_Postponed =>
            return "postponed";
         when Tok_Procedure =>
            return "procedure";
         when Tok_Process =>
            return "process";
         when Tok_Pure =>
            return "pure";

         when Tok_Range =>
            return "range";
         when Tok_Record =>
            return "record";
         when Tok_Register =>
            return "register";
         when Tok_Reject =>
            return "reject";
         when Tok_Report =>
            return "report";
         when Tok_Return =>
            return "return";

         when Tok_Select =>
            return "select";
         when Tok_Severity =>
            return "severity";
         when Tok_Shared =>
            return "shared";
         when Tok_Signal =>
            return "signal";
         when Tok_Subtype =>
            return "subtype";

         when Tok_Then =>
            return "then";
         when Tok_To =>
            return "to";
         when Tok_Transport =>
            return "transport";
         when Tok_Type =>
            return "type";

         when Tok_Unaffected =>
            return "unaffected";
         when Tok_Units =>
            return "units";
         when Tok_Until =>
            return "until";
         when Tok_Use =>
            return "use";

         when Tok_Variable =>
            return "variable";

         when Tok_Wait =>
            return "wait";
         when Tok_When =>
            return "when";
         when Tok_While =>
            return "while";
         when Tok_With =>
            return "with";

         -- shift_operator
         when Tok_Sll =>
            return "sll";
         when Tok_Sla =>
            return "sla";
         when Tok_Sra =>
            return "sra";
         when Tok_Srl =>
            return "srl";
         when Tok_Rol =>
            return "rol";
         when Tok_Ror =>
            return "ror";

         --  VHDL 00
         when Tok_Protected =>
            return "protected";

         --  AMS-VHDL
         when Tok_Across =>
            return "across";
         when Tok_Break =>
            return "break";
         when Tok_Limit =>
            return "limit";
         when Tok_Nature =>
            return "nature";
         when Tok_Noise =>
            return "noise";
         when Tok_Procedural =>
            return "procedural";
         when Tok_Quantity =>
            return "quantity";
         when Tok_Reference =>
            return "reference";
         when Tok_Spectrum =>
            return "spectrum";
         when Tok_Subnature =>
            return "subnature";
         when Tok_Terminal =>
            return "terminal";
         when Tok_Through =>
            return "through";
         when Tok_Tolerance =>
            return "tolerance";

         when Tok_And_And =>
            return "&&";
         when Tok_Bar_Bar =>
            return "||";
         when Tok_Left_Curly =>
            return "{";
         when Tok_Right_Curly =>
            return "}";
         when Tok_Exclam_Mark =>
            return "!";
         when Tok_Brack_Star =>
            return "[*";
         when Tok_Brack_Plus_Brack =>
            return "[+]";
         when Tok_Brack_Arrow =>
            return "[->";
         when Tok_Brack_Equal =>
            return "[=";
         when Tok_Bar_Arrow =>
            return "|->";
         when Tok_Bar_Double_Arrow =>
            return "|=>";
         when Tok_Minus_Greater =>
            return "->";
         when Tok_Arobase =>
            return "@";

         when Tok_Psl_Default =>
            return "default";
         when Tok_Psl_Clock =>
            return "clock";
         when Tok_Psl_Property =>
            return "property";
         when Tok_Psl_Sequence =>
            return "sequence";
         when Tok_Psl_Endpoint =>
            return "endpoint";
         when Tok_Psl_Assert =>
            return "assert";
         when Tok_Psl_Cover =>
            return "cover";
         when Tok_Psl_Const =>
            return "const";
         when Tok_Psl_Boolean =>
            return "boolean";
         when Tok_Inf =>
            return "inf";
         when Tok_Within =>
            return "within";
         when Tok_Abort =>
            return "abort";
         when Tok_Before =>
            return "before";
         when Tok_Always =>
            return "always";
         when Tok_Never =>
            return "never";
         when Tok_Eventually =>
            return "eventually";
         when Tok_Next_A =>
            return "next_a";
         when Tok_Next_E =>
            return "next_e";
         when Tok_Next_Event =>
            return "next_event";
         when Tok_Next_Event_A =>
            return "next_event_a";
         when Tok_Next_Event_E =>
            return "next_event_e";
      end case;
   end Image;

end Tokens;