1 /* A Bison parser, made from ./ada-exp.y
4 #define YYBISON 1 /* Identify Bison output. */
11 # define BLOCKNAME 262
15 # define OBJECT_RENAMING 266
19 # define INTERNAL_VARIABLE 270
37 # define TICK_ACCESS 288
38 # define TICK_ADDRESS 289
39 # define TICK_FIRST 290
40 # define TICK_LAST 291
41 # define TICK_LENGTH 292
44 # define TICK_MODULUS 295
46 # define TICK_RANGE 297
47 # define TICK_SIZE 298
53 #line 38 "./ada-exp.y"
59 #include "expression.h"
61 #include "parser-defs.h"
64 #include "bfd.h" /* Required by objfiles.h. */
65 #include "symfile.h" /* Required by objfiles.h. */
66 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
69 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
70 as well as gratuitiously global symbol names, so we can have multiple
71 yacc generated parsers in gdb. These are only the variables
72 produced by yacc. If other parser generators (bison, byacc, etc) produce
73 additional global names that conflict at link time, then those parser
74 generators need to be fixed instead of adding those names to this list. */
76 /* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
77 options. I presume we are maintaining it to accommodate systems
78 without BISON? (PNH) */
80 #define yymaxdepth ada_maxdepth
81 #define yyparse _ada_parse /* ada_parse calls this after initialization */
83 #define yyerror ada_error
84 #define yylval ada_lval
85 #define yychar ada_char
86 #define yydebug ada_debug
87 #define yypact ada_pact
94 #define yyexca ada_exca
95 #define yyerrflag ada_errflag
96 #define yynerrs ada_nerrs
100 #define yy_yys ada_yys
101 #define yystate ada_state
102 #define yytmp ada_tmp
104 #define yy_yyv ada_yyv
105 #define yyval ada_val
106 #define yylloc ada_lloc
107 #define yyreds ada_reds /* With YYDEBUG defined */
108 #define yytoks ada_toks /* With YYDEBUG defined */
111 #define YYDEBUG 0 /* Default to no yydebug support */
116 struct minimal_symbol* msym;
118 struct stoken stoken;
121 /* If expression is in the context of TYPE'(...), then TYPE, else
123 static struct type* type_qualifier;
127 static int yylex (void);
129 void yyerror (char *);
131 static struct stoken string_to_operator (struct stoken);
133 static void write_attribute_call0 (enum ada_attribute);
135 static void write_attribute_call1 (enum ada_attribute, LONGEST);
137 static void write_attribute_calln (enum ada_attribute, int);
139 static void write_object_renaming (struct block*, struct symbol*);
141 static void write_var_from_name (struct block*, struct name_info);
144 convert_char_literal (struct type*, LONGEST);
146 #line 131 "./ada-exp.y"
161 struct name_info ssym;
164 struct internalvar *ivar;
167 # define YYSTYPE yystype
168 # define YYSTYPE_IS_TRIVIAL 1
177 #define YYFLAG -32768
180 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
181 #define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 82)
183 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
184 static const char yytranslate[] =
186 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 34, 63,
190 57, 62, 36, 32, 64, 33, 56, 37, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 61,
192 25, 23, 26, 2, 31, 2, 2, 2, 2, 2,
193 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
195 2, 58, 2, 67, 2, 2, 2, 2, 2, 2,
196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
197 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
198 2, 2, 2, 65, 2, 66, 2, 2, 2, 2,
199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
212 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
213 16, 17, 18, 19, 20, 21, 22, 24, 27, 28,
214 29, 30, 35, 38, 39, 40, 41, 42, 43, 44,
215 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
220 static const short yyprhs[] =
222 0, 0, 2, 4, 6, 10, 13, 16, 21, 26,
223 27, 35, 36, 43, 47, 49, 51, 53, 55, 57,
224 61, 64, 67, 70, 73, 74, 76, 80, 84, 90,
225 95, 99, 103, 107, 111, 115, 119, 123, 127, 131,
226 135, 139, 143, 149, 155, 159, 166, 173, 178, 182,
227 186, 190, 194, 199, 203, 208, 212, 215, 218, 222,
228 226, 230, 233, 236, 244, 252, 258, 262, 266, 270,
229 276, 279, 280, 284, 286, 288, 289, 291, 293, 295,
230 297, 299, 302, 304, 307, 309, 312, 314, 316, 318,
231 320, 323, 325, 328, 331, 335, 338, 341
233 static const short yyrhs[] =
235 69, 0, 81, 0, 73, 0, 69, 61, 73, 0,
236 70, 13, 0, 70, 11, 0, 70, 57, 74, 62,
237 0, 81, 57, 73, 62, 0, 0, 81, 63, 72,
238 71, 57, 73, 62, 0, 0, 70, 57, 73, 30,
239 73, 62, 0, 57, 69, 62, 0, 78, 0, 15,
240 0, 16, 0, 70, 0, 14, 0, 73, 17, 73,
241 0, 33, 73, 0, 32, 73, 0, 42, 73, 0,
242 41, 73, 0, 0, 73, 0, 79, 59, 73, 0,
243 74, 64, 73, 0, 74, 64, 79, 59, 73, 0,
244 65, 81, 66, 73, 0, 73, 40, 73, 0, 73,
245 36, 73, 0, 73, 37, 73, 0, 73, 39, 73,
246 0, 73, 38, 73, 0, 73, 31, 73, 0, 73,
247 32, 73, 0, 73, 34, 73, 0, 73, 33, 73,
248 0, 73, 23, 73, 0, 73, 24, 73, 0, 73,
249 27, 73, 0, 73, 29, 73, 30, 73, 0, 73,
250 29, 73, 52, 75, 0, 73, 29, 7, 0, 73,
251 42, 29, 73, 30, 73, 0, 73, 42, 29, 73,
252 52, 75, 0, 73, 42, 29, 7, 0, 73, 28,
253 73, 0, 73, 25, 73, 0, 73, 26, 73, 0,
254 73, 18, 73, 0, 73, 18, 21, 73, 0, 73,
255 19, 73, 0, 73, 19, 22, 73, 0, 73, 20,
256 73, 0, 70, 43, 0, 70, 44, 0, 70, 45,
257 75, 0, 70, 46, 75, 0, 70, 47, 75, 0,
258 70, 53, 0, 70, 54, 0, 77, 49, 57, 73,
259 64, 73, 62, 0, 77, 48, 57, 73, 64, 73,
260 62, 0, 77, 51, 57, 73, 62, 0, 76, 45,
261 75, 0, 76, 46, 75, 0, 76, 47, 75, 0,
262 76, 55, 57, 73, 62, 0, 76, 50, 0, 0,
263 57, 3, 62, 0, 7, 0, 76, 0, 0, 3,
264 0, 5, 0, 6, 0, 4, 0, 9, 0, 60,
265 7, 0, 10, 0, 80, 10, 0, 12, 0, 80,
266 12, 0, 10, 0, 7, 0, 12, 0, 8, 0,
267 80, 8, 0, 7, 0, 80, 7, 0, 7, 43,
268 0, 80, 7, 43, 0, 36, 73, 0, 34, 73,
275 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
276 static const short yyrline[] =
278 0, 203, 204, 210, 211, 216, 220, 227, 235, 243,
279 243, 254, 256, 261, 264, 267, 274, 282, 285, 292,
280 296, 300, 304, 308, 312, 315, 317, 319, 321, 325,
281 335, 339, 343, 347, 351, 355, 359, 363, 367, 371,
282 375, 379, 383, 387, 393, 400, 405, 413, 423, 427,
283 431, 435, 439, 443, 447, 451, 455, 457, 463, 465,
284 467, 469, 471, 473, 475, 477, 479, 481, 483, 485,
285 487, 491, 493, 497, 504, 506, 513, 521, 533, 541,
286 548, 575, 579, 580, 582, 583, 587, 588, 589, 592,
287 594, 599, 600, 601, 603, 610, 612, 614
292 #if (YYDEBUG) || defined YYERROR_VERBOSE
294 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
295 static const char *const yytname[] =
297 "$", "error", "$undefined.", "INT", "NULL_PTR", "CHARLIT", "FLOAT",
298 "TYPENAME", "BLOCKNAME", "STRING", "NAME", "DOT_ID", "OBJECT_RENAMING",
299 "DOT_ALL", "LAST", "REGNAME", "INTERNAL_VARIABLE", "ASSIGN", "_AND_",
300 "OR", "XOR", "THEN", "ELSE", "'='", "NOTEQUAL", "'<'", "'>'", "LEQ",
301 "GEQ", "IN", "DOTDOT", "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'",
302 "'/'", "MOD", "REM", "STARSTAR", "ABS", "NOT", "TICK_ACCESS",
303 "TICK_ADDRESS", "TICK_FIRST", "TICK_LAST", "TICK_LENGTH", "TICK_MAX",
304 "TICK_MIN", "TICK_MODULUS", "TICK_POS", "TICK_RANGE", "TICK_SIZE",
305 "TICK_TAG", "TICK_VAL", "'.'", "'('", "'['", "ARROW", "NEW", "';'",
306 "')'", "'\\''", "','", "'{'", "'}'", "']'", "start", "exp1",
307 "simple_exp", "@1", "save_qualifier", "exp", "arglist", "tick_arglist",
308 "type_prefix", "opt_type_prefix", "variable", "any_name", "block",
313 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
314 static const short yyr1[] =
316 0, 68, 68, 69, 69, 70, 70, 70, 70, 71,
317 70, 72, 70, 70, 70, 70, 70, 73, 70, 73,
318 73, 73, 73, 73, 74, 74, 74, 74, 74, 73,
319 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
320 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
321 73, 73, 73, 73, 73, 73, 70, 70, 70, 70,
322 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
323 70, 75, 75, 76, 77, 77, 73, 73, 73, 73,
324 73, 73, 78, 78, 78, 78, 79, 79, 79, 80,
325 80, 81, 81, 81, 81, 73, 73, 73
328 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
329 static const short yyr2[] =
331 0, 1, 1, 1, 3, 2, 2, 4, 4, 0,
332 7, 0, 6, 3, 1, 1, 1, 1, 1, 3,
333 2, 2, 2, 2, 0, 1, 3, 3, 5, 4,
334 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
335 3, 3, 5, 5, 3, 6, 6, 4, 3, 3,
336 3, 3, 4, 3, 4, 3, 2, 2, 3, 3,
337 3, 2, 2, 7, 7, 5, 3, 3, 3, 5,
338 2, 0, 3, 1, 1, 0, 1, 1, 1, 1,
339 1, 2, 1, 2, 1, 2, 1, 1, 1, 1,
340 2, 1, 2, 2, 3, 2, 2, 4
343 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
344 doesn't specify something else to do. Zero means the default is an
346 static const short yydefact[] =
348 75, 76, 79, 77, 78, 73, 89, 80, 82, 84,
349 18, 15, 16, 75, 75, 75, 75, 75, 75, 75,
350 0, 0, 1, 17, 3, 74, 0, 14, 0, 2,
351 93, 21, 0, 20, 96, 95, 23, 22, 0, 81,
352 91, 0, 0, 75, 6, 5, 56, 57, 71, 71,
353 71, 61, 62, 75, 75, 75, 75, 75, 75, 75,
354 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
355 75, 75, 75, 75, 0, 75, 71, 71, 71, 70,
356 0, 0, 0, 0, 92, 90, 83, 85, 75, 11,
357 13, 75, 4, 0, 58, 59, 60, 73, 82, 84,
358 25, 0, 0, 19, 75, 51, 75, 53, 55, 39,
359 40, 49, 50, 41, 48, 44, 0, 35, 36, 38,
360 37, 31, 32, 34, 33, 30, 75, 0, 66, 67,
361 68, 75, 75, 75, 75, 94, 0, 9, 29, 0,
362 75, 7, 75, 75, 52, 54, 75, 71, 47, 0,
363 97, 0, 0, 0, 0, 8, 0, 72, 0, 27,
364 0, 26, 42, 43, 75, 71, 69, 75, 75, 65,
365 75, 12, 75, 45, 46, 0, 0, 0, 28, 64,
369 static const short yydefgoto[] =
371 182, 22, 23, 156, 137, 24, 101, 94, 25, 26,
375 static const short yypact[] =
377 251,-32768,-32768,-32768,-32768, 20,-32768,-32768,-32768,-32768,
378 -32768,-32768,-32768, 251, 251, 251, 251, 251, 251, 251,
379 2, 79, -47, 53, 958, -23, 54,-32768, 104, -32,
380 -32768, 31, -32, 31, -22, -22, 31, 31, 33,-32768,
381 -5, 101, -27, 251,-32768,-32768,-32768,-32768, 4, 4,
382 4,-32768,-32768, 131, 251, 171, 211, 251, 251, 251,
383 251, 251, 251, 251, 291, 251, 251, 251, 251, 251,
384 251, 251, 251, 251, 47, 251, 4, 4, 4,-32768,
385 23, 25, 27, 35, 45,-32768,-32768,-32768, 251,-32768,
386 -32768, 251, 958, 98,-32768,-32768,-32768, 22, 56, 58,
387 930, -36, 64, 986, 251, 1009, 251, 1009, 1009, -21,
388 -21, -21, -21, -21, -21, 534, 858, 387, 31, 31,
389 31, 32, 32, 32, 32, 32, 331, 415,-32768,-32768,
390 -32768, 251, 251, 251, 251,-32768, 536,-32768, -22, 62,
391 251,-32768, 371, 251, 1009, 1009, 251, 4, 534, 894,
392 -32768, 582, 452, 494, 628,-32768, 68,-32768, 674, 958,
393 67, 958, -21,-32768, 251, 4,-32768, 251, 251,-32768,
394 251,-32768, 251, -21,-32768, 720, 766, 812, 958,-32768,
395 -32768,-32768, 128, 132,-32768
398 static const short yypgoto[] =
400 -32768, 112,-32768,-32768,-32768, -13,-32768, -43,-32768,-32768,
408 static const short yytable[] =
410 31, 33, 34, 35, 36, 37, 95, 96, 29, 39,
411 65, 66, 67, 68, 43, 69, 70, 71, 72, 73,
412 -91, 74, 76, 77, 78, 88, 141, 79, 142, 42,
413 92, 89, 80, 128, 129, 130, 75, 75, 30, 91,
414 100, 103, 105, 107, 108, 109, 110, 111, 112, 113,
415 114, 116, 117, 118, 119, 120, 121, 122, 123, 124,
416 125, 93, 127, 30, 44, 30, 45, 69, 70, 71,
417 72, 73, 73, 74, 74, 136, 126, -91, 138, -91,
418 131, -87, 132, -91, 133, -91, 40, 6, 135, 75,
419 75, 144, 134, 145, 43, 90, 46, 47, 48, 49,
420 50, 139, 81, 82, 163, 83, 51, 52, 84, 85,
421 53, 84, 85, 149, 86, -86, 87, -88, 151, 152,
422 153, 154, 174, 143, 157, 170, 172, 158, 183, 159,
423 161, 38, 184, 162, 1, 2, 3, 4, 97, 6,
424 7, 98, 160, 99, 41, 10, 11, 12, 0, 0,
425 0, 173, 0, 0, 175, 176, 0, 177, 0, 178,
426 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
427 0, 0, 17, 18, 1, 2, 3, 4, 5, 6,
428 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
429 0, 20, 104, -24, 0, -24, 21, 0, 0, 0,
430 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
431 0, 0, 17, 18, 1, 2, 3, 4, 5, 6,
432 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
433 0, 20, 0, 106, 0, 0, 21, 0, 0, 0,
434 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
435 0, 0, 17, 18, 1, 2, 3, 4, 5, 6,
436 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
437 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
438 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
439 0, 0, 17, 18, 1, 2, 3, 4, 115, 6,
440 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
441 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
442 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
443 0, 0, 17, 18, 1, 2, 3, 4, 148, 6,
444 7, 8, 0, 9, 0, 10, 11, 12, 19, 0,
445 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
446 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
447 0, 0, 17, 18, 1, 2, 3, 4, 97, 6,
448 7, 98, 0, 99, 0, 10, 11, 12, 19, 0,
449 0, 20, 0, 0, 0, 0, 21, 0, 0, 0,
450 0, 0, 0, 13, 14, 15, 0, 16, 0, 0,
451 0, 0, 17, 18, 0, 0, 0, 0, 0, 66,
452 67, 68, 0, 69, 70, 71, 72, 73, 19, 74,
453 0, 20, 54, 55, 56, 57, 21, 0, 58, 59,
454 60, 61, 62, 63, 64, 75, 65, 66, 67, 68,
455 0, 69, 70, 71, 72, 73, 0, 74, 0, 0,
456 0, 0, 0, 0, 0, 0, 0, 0, 0, 54,
457 55, 56, 57, 75, 0, 58, 59, 60, 61, 62,
458 63, 64, 150, 65, 66, 67, 68, 0, 69, 70,
459 71, 72, 73, 0, 74, 0, 0, 0, 0, 0,
460 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
461 75, 54, 55, 56, 57, 0, 167, 58, 59, 60,
462 61, 62, 63, 64, 0, 65, 66, 67, 68, 0,
463 69, 70, 71, 72, 73, 0, 74, 0, 0, 0,
464 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
465 0, 0, 75, 54, 55, 56, 57, 0, 168, 58,
466 59, 60, 61, 62, 63, 64, 0, 65, 66, 67,
467 68, 0, 69, 70, 71, 72, 73, 30, 74, -73,
468 -73, -73, -73, -73, -73, -73, 0, 0, 0, -73,
469 0, -91, 0, 0, 75, 0, 0, -91, 155, 54,
470 55, 56, 57, 0, 0, 58, 59, 60, 61, 62,
471 63, 64, 0, 65, 66, 67, 68, 0, 69, 70,
472 71, 72, 73, 0, 74, 0, 0, 0, 0, 0,
473 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
474 75, 0, 0, 0, 166, 54, 55, 56, 57, 0,
475 0, 58, 59, 60, 61, 62, 63, 64, 0, 65,
476 66, 67, 68, 0, 69, 70, 71, 72, 73, 0,
477 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
478 0, 0, 0, 0, 0, 0, 75, 0, 0, 0,
479 169, 54, 55, 56, 57, 0, 0, 58, 59, 60,
480 61, 62, 63, 64, 0, 65, 66, 67, 68, 0,
481 69, 70, 71, 72, 73, 0, 74, 0, 0, 0,
482 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
483 0, 0, 75, 0, 0, 0, 171, 54, 55, 56,
484 57, 0, 0, 58, 59, 60, 61, 62, 63, 64,
485 0, 65, 66, 67, 68, 0, 69, 70, 71, 72,
486 73, 0, 74, 0, 0, 0, 0, 0, 0, 0,
487 0, 0, 0, 0, 0, 0, 0, 0, 75, 0,
488 0, 0, 179, 54, 55, 56, 57, 0, 0, 58,
489 59, 60, 61, 62, 63, 64, 0, 65, 66, 67,
490 68, 0, 69, 70, 71, 72, 73, 0, 74, 0,
491 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
492 0, 0, 0, 0, 75, 0, 0, 0, 180, 54,
493 55, 56, 57, 0, 0, 58, 59, 60, 61, 62,
494 63, 64, 0, 65, 66, 67, 68, 0, 69, 70,
495 71, 72, 73, 0, 74, 0, 0, 0, 0, 0,
496 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
497 75, 0, 0, 0, 181, 54, 55, 56, 57, 0,
498 0, 58, 59, 60, 61, 62, 63, 64, 146, 65,
499 66, 67, 68, 0, 69, 70, 71, 72, 73, 0,
500 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
501 147, 54, 55, 56, 57, 0, 75, 58, 59, 60,
502 61, 62, 63, 64, 164, 65, 66, 67, 68, 0,
503 69, 70, 71, 72, 73, 0, 74, 0, 0, 0,
504 0, 0, 0, 0, 0, 0, 165, 54, 55, 56,
505 57, 0, 75, 58, 59, 60, 61, 62, 63, 64,
506 140, 65, 66, 67, 68, 0, 69, 70, 71, 72,
507 73, 0, 74, 0, 0, 54, 55, 56, 57, 0,
508 0, 58, 59, 60, 61, 62, 63, 64, 75, 65,
509 66, 67, 68, 0, 69, 70, 71, 72, 73, 0,
510 74, 0, 0,-32768, 55, 56, 57, 0, 0, 58,
511 59, 60, 61, 62, 63, 64, 75, 65, 66, 67,
512 68, 0, 69, 70, 71, 72, 73, 0, 74, 0,
513 0, 0, 58, 59, 60, 61, 62, 63, 64, 0,
514 65, 66, 67, 68, 75, 69, 70, 71, 72, 73,
515 0, 74, 0, 0, 0, 0, 0, 0, 0, 0,
516 0, 0, 0, 0, 0, 0, 0, 75
519 static const short yycheck[] =
521 13, 14, 15, 16, 17, 18, 49, 50, 0, 7,
522 31, 32, 33, 34, 61, 36, 37, 38, 39, 40,
523 0, 42, 45, 46, 47, 57, 62, 50, 64, 21,
524 43, 63, 55, 76, 77, 78, 58, 58, 43, 66,
525 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
526 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
527 73, 57, 75, 43, 11, 43, 13, 36, 37, 38,
528 39, 40, 40, 42, 42, 88, 29, 57, 91, 57,
529 57, 59, 57, 63, 57, 63, 7, 8, 43, 58,
530 58, 104, 57, 106, 61, 62, 43, 44, 45, 46,
531 47, 3, 48, 49, 147, 51, 53, 54, 7, 8,
532 57, 7, 8, 126, 10, 59, 12, 59, 131, 132,
533 133, 134, 165, 59, 62, 57, 59, 140, 0, 142,
534 143, 19, 0, 146, 3, 4, 5, 6, 7, 8,
535 9, 10, 142, 12, 21, 14, 15, 16, -1, -1,
536 -1, 164, -1, -1, 167, 168, -1, 170, -1, 172,
537 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
538 -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
539 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
540 -1, 60, 21, 62, -1, 64, 65, -1, -1, -1,
541 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
542 -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
543 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
544 -1, 60, -1, 22, -1, -1, 65, -1, -1, -1,
545 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
546 -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
547 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
548 -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
549 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
550 -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
551 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
552 -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
553 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
554 -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
555 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
556 -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
557 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
558 -1, -1, 41, 42, 3, 4, 5, 6, 7, 8,
559 9, 10, -1, 12, -1, 14, 15, 16, 57, -1,
560 -1, 60, -1, -1, -1, -1, 65, -1, -1, -1,
561 -1, -1, -1, 32, 33, 34, -1, 36, -1, -1,
562 -1, -1, 41, 42, -1, -1, -1, -1, -1, 32,
563 33, 34, -1, 36, 37, 38, 39, 40, 57, 42,
564 -1, 60, 17, 18, 19, 20, 65, -1, 23, 24,
565 25, 26, 27, 28, 29, 58, 31, 32, 33, 34,
566 -1, 36, 37, 38, 39, 40, -1, 42, -1, -1,
567 -1, -1, -1, -1, -1, -1, -1, -1, -1, 17,
568 18, 19, 20, 58, -1, 23, 24, 25, 26, 27,
569 28, 29, 67, 31, 32, 33, 34, -1, 36, 37,
570 38, 39, 40, -1, 42, -1, -1, -1, -1, -1,
571 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
572 58, 17, 18, 19, 20, -1, 64, 23, 24, 25,
573 26, 27, 28, 29, -1, 31, 32, 33, 34, -1,
574 36, 37, 38, 39, 40, -1, 42, -1, -1, -1,
575 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
576 -1, -1, 58, 17, 18, 19, 20, -1, 64, 23,
577 24, 25, 26, 27, 28, 29, -1, 31, 32, 33,
578 34, -1, 36, 37, 38, 39, 40, 43, 42, 45,
579 46, 47, 48, 49, 50, 51, -1, -1, -1, 55,
580 -1, 57, -1, -1, 58, -1, -1, 63, 62, 17,
581 18, 19, 20, -1, -1, 23, 24, 25, 26, 27,
582 28, 29, -1, 31, 32, 33, 34, -1, 36, 37,
583 38, 39, 40, -1, 42, -1, -1, -1, -1, -1,
584 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
585 58, -1, -1, -1, 62, 17, 18, 19, 20, -1,
586 -1, 23, 24, 25, 26, 27, 28, 29, -1, 31,
587 32, 33, 34, -1, 36, 37, 38, 39, 40, -1,
588 42, -1, -1, -1, -1, -1, -1, -1, -1, -1,
589 -1, -1, -1, -1, -1, -1, 58, -1, -1, -1,
590 62, 17, 18, 19, 20, -1, -1, 23, 24, 25,
591 26, 27, 28, 29, -1, 31, 32, 33, 34, -1,
592 36, 37, 38, 39, 40, -1, 42, -1, -1, -1,
593 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
594 -1, -1, 58, -1, -1, -1, 62, 17, 18, 19,
595 20, -1, -1, 23, 24, 25, 26, 27, 28, 29,
596 -1, 31, 32, 33, 34, -1, 36, 37, 38, 39,
597 40, -1, 42, -1, -1, -1, -1, -1, -1, -1,
598 -1, -1, -1, -1, -1, -1, -1, -1, 58, -1,
599 -1, -1, 62, 17, 18, 19, 20, -1, -1, 23,
600 24, 25, 26, 27, 28, 29, -1, 31, 32, 33,
601 34, -1, 36, 37, 38, 39, 40, -1, 42, -1,
602 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
603 -1, -1, -1, -1, 58, -1, -1, -1, 62, 17,
604 18, 19, 20, -1, -1, 23, 24, 25, 26, 27,
605 28, 29, -1, 31, 32, 33, 34, -1, 36, 37,
606 38, 39, 40, -1, 42, -1, -1, -1, -1, -1,
607 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
608 58, -1, -1, -1, 62, 17, 18, 19, 20, -1,
609 -1, 23, 24, 25, 26, 27, 28, 29, 30, 31,
610 32, 33, 34, -1, 36, 37, 38, 39, 40, -1,
611 42, -1, -1, -1, -1, -1, -1, -1, -1, -1,
612 52, 17, 18, 19, 20, -1, 58, 23, 24, 25,
613 26, 27, 28, 29, 30, 31, 32, 33, 34, -1,
614 36, 37, 38, 39, 40, -1, 42, -1, -1, -1,
615 -1, -1, -1, -1, -1, -1, 52, 17, 18, 19,
616 20, -1, 58, 23, 24, 25, 26, 27, 28, 29,
617 30, 31, 32, 33, 34, -1, 36, 37, 38, 39,
618 40, -1, 42, -1, -1, 17, 18, 19, 20, -1,
619 -1, 23, 24, 25, 26, 27, 28, 29, 58, 31,
620 32, 33, 34, -1, 36, 37, 38, 39, 40, -1,
621 42, -1, -1, 17, 18, 19, 20, -1, -1, 23,
622 24, 25, 26, 27, 28, 29, 58, 31, 32, 33,
623 34, -1, 36, 37, 38, 39, 40, -1, 42, -1,
624 -1, -1, 23, 24, 25, 26, 27, 28, 29, -1,
625 31, 32, 33, 34, 58, 36, 37, 38, 39, 40,
626 -1, 42, -1, -1, -1, -1, -1, -1, -1, -1,
627 -1, -1, -1, -1, -1, -1, -1, 58
629 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
630 #line 3 "/usr/local/share/bison/bison.simple"
632 /* Skeleton output parser for bison,
634 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
637 This program is free software; you can redistribute it and/or modify
638 it under the terms of the GNU General Public License as published by
639 the Free Software Foundation; either version 2, or (at your option)
642 This program is distributed in the hope that it will be useful,
643 but WITHOUT ANY WARRANTY; without even the implied warranty of
644 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 GNU General Public License for more details.
647 You should have received a copy of the GNU General Public License
648 along with this program; if not, write to the Free Software
649 Foundation, Inc., 59 Temple Place - Suite 330,
650 Boston, MA 02111-1307, USA. */
652 /* As a special exception, when this file is copied by Bison into a
653 Bison output file, you may use that output file without restriction.
654 This special exception was added by the Free Software Foundation
655 in version 1.24 of Bison. */
657 /* This is the parser code that is written into each bison parser when
658 the %semantic_parser declaration is not specified in the grammar.
659 It was written by Richard Stallman by simplifying the hairy parser
660 used when %semantic_parser is specified. */
662 /* All symbols defined below should begin with yy or YY, to avoid
663 infringing on user name space. This should be done even for local
664 variables, as they might otherwise be expanded by user macros.
665 There are some unavoidable exceptions within include files to
666 define necessary library symbols; they are noted "INFRINGES ON
667 USER NAME SPACE" below. */
669 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
671 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
673 # if YYSTACK_USE_ALLOCA
674 # define YYSTACK_ALLOC alloca
676 # ifndef YYSTACK_USE_ALLOCA
677 # if defined (alloca) || defined (_ALLOCA_H)
678 # define YYSTACK_ALLOC alloca
681 # define YYSTACK_ALLOC __builtin_alloca
687 # ifdef YYSTACK_ALLOC
688 /* Pacify GCC's `empty if-body' warning. */
689 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
691 # if defined (__STDC__) || defined (__cplusplus)
692 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
693 # define YYSIZE_T size_t
695 # define YYSTACK_ALLOC xmalloc
696 # define YYSTACK_FREE free
698 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
701 #if (! defined (yyoverflow) \
702 && (! defined (__cplusplus) \
703 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
705 /* A type that is properly aligned for any stack member. */
715 /* The size of the maximum gap between one aligned stack and the next. */
716 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
718 /* The size of an array large to enough to hold all stacks, each with
721 # define YYSTACK_BYTES(N) \
722 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
723 + 2 * YYSTACK_GAP_MAX)
725 # define YYSTACK_BYTES(N) \
726 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
730 /* Copy COUNT objects from FROM to TO. The source and destination do
734 # define YYCOPY(To, From, Count) \
735 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
737 # define YYCOPY(To, From, Count) \
740 register YYSIZE_T yyi; \
741 for (yyi = 0; yyi < (Count); yyi++) \
742 (To)[yyi] = (From)[yyi]; \
748 /* Relocate STACK from its old location to the new one. The
749 local variables YYSIZE and YYSTACKSIZE give the old and new number of
750 elements in the stack, and YYPTR gives the new location of the
751 stack. Advance YYPTR to a properly aligned location for the next
753 # define YYSTACK_RELOCATE(Stack) \
756 YYSIZE_T yynewbytes; \
757 YYCOPY (&yyptr->Stack, Stack, yysize); \
758 Stack = &yyptr->Stack; \
759 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
760 yyptr += yynewbytes / sizeof (*yyptr); \
767 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
768 # define YYSIZE_T __SIZE_TYPE__
770 #if ! defined (YYSIZE_T) && defined (size_t)
771 # define YYSIZE_T size_t
773 #if ! defined (YYSIZE_T)
774 # if defined (__STDC__) || defined (__cplusplus)
775 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
776 # define YYSIZE_T size_t
779 #if ! defined (YYSIZE_T)
780 # define YYSIZE_T unsigned int
783 #define yyerrok (yyerrstatus = 0)
784 #define yyclearin (yychar = YYEMPTY)
787 #define YYACCEPT goto yyacceptlab
788 #define YYABORT goto yyabortlab
789 #define YYERROR goto yyerrlab1
790 /* Like YYERROR except do call yyerror. This remains here temporarily
791 to ease the transition to the new meaning of YYERROR, for GCC.
792 Once GCC version 2 has supplanted version 1, this can go. */
793 #define YYFAIL goto yyerrlab
794 #define YYRECOVERING() (!!yyerrstatus)
795 #define YYBACKUP(Token, Value) \
797 if (yychar == YYEMPTY && yylen == 1) \
801 yychar1 = YYTRANSLATE (yychar); \
807 yyerror ("syntax error: cannot back up"); \
813 #define YYERRCODE 256
816 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
819 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
820 first token. By default, to implement support for ranges, extend
821 its range to the last symbol. */
823 #ifndef YYLLOC_DEFAULT
824 # define YYLLOC_DEFAULT(Current, Rhs, N) \
825 Current.last_line = Rhs[N].last_line; \
826 Current.last_column = Rhs[N].last_column;
830 /* YYLEX -- calling `yylex' with the right arguments. */
835 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
837 # define YYLEX yylex (&yylval, &yylloc)
839 # else /* !YYLSP_NEEDED */
841 # define YYLEX yylex (&yylval, YYLEX_PARAM)
843 # define YYLEX yylex (&yylval)
845 # endif /* !YYLSP_NEEDED */
847 # define YYLEX yylex ()
851 /* Enable debugging if requested. */
855 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
856 # define YYFPRINTF fprintf
859 # define YYDPRINTF(Args) \
864 /* Nonzero means print parse trace. It is left uninitialized so that
865 multiple parsers can coexist. */
868 # define YYDPRINTF(Args)
869 #endif /* !YYDEBUG */
871 /* YYINITDEPTH -- initial size of the parser's stacks. */
873 # define YYINITDEPTH 200
876 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
877 if the built-in stack extension method is used).
879 Do not make this value too large; the results are undefined if
880 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
881 evaluated with infinite-precision integer arithmetic. */
888 # define YYMAXDEPTH 10000
891 #ifdef YYERROR_VERBOSE
894 # if defined (__GLIBC__) && defined (_STRING_H)
895 # define yystrlen strlen
897 /* Return the length of YYSTR. */
899 # if defined (__STDC__) || defined (__cplusplus)
900 yystrlen (const char *yystr)
906 register const char *yys = yystr;
908 while (*yys++ != '\0')
911 return yys - yystr - 1;
917 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
918 # define yystpcpy stpcpy
920 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
923 # if defined (__STDC__) || defined (__cplusplus)
924 yystpcpy (char *yydest, const char *yysrc)
926 yystpcpy (yydest, yysrc)
931 register char *yyd = yydest;
932 register const char *yys = yysrc;
934 while ((*yyd++ = *yys++) != '\0')
943 #line 315 "/usr/local/share/bison/bison.simple"
946 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
947 into yyparse. The argument should have type void *.
948 It should actually point to an object.
949 Grammar actions can access the variable by casting it
950 to the proper pointer type. */
953 # if defined (__STDC__) || defined (__cplusplus)
954 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
955 # define YYPARSE_PARAM_DECL
957 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
958 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
960 #else /* !YYPARSE_PARAM */
961 # define YYPARSE_PARAM_ARG
962 # define YYPARSE_PARAM_DECL
963 #endif /* !YYPARSE_PARAM */
965 /* Prevent warning if -Wstrict-prototypes. */
967 # ifdef YYPARSE_PARAM
968 int yyparse (void *);
974 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
975 variables are global, or local to YYPARSE. */
977 #define YY_DECL_NON_LSP_VARIABLES \
978 /* The lookahead symbol. */ \
981 /* The semantic value of the lookahead symbol. */ \
984 /* Number of parse errors so far. */ \
988 # define YY_DECL_VARIABLES \
989 YY_DECL_NON_LSP_VARIABLES \
991 /* Location data for the lookahead symbol. */ \
994 # define YY_DECL_VARIABLES \
995 YY_DECL_NON_LSP_VARIABLES
999 /* If nonreentrant, generate the variables here. */
1003 #endif /* !YYPURE */
1006 yyparse (YYPARSE_PARAM_ARG)
1009 /* If reentrant, generate the variables here. */
1012 #endif /* !YYPURE */
1014 register int yystate;
1017 /* Number of tokens to shift before error messages enabled. */
1019 /* Lookahead token as an internal (translated) token number. */
1022 /* Three stacks and their tools:
1023 `yyss': related to states,
1024 `yyvs': related to semantic values,
1025 `yyls': related to locations.
1027 Refer to the stacks thru separate pointers, to allow yyoverflow
1028 to xreallocate them elsewhere. */
1030 /* The state stack. */
1031 short yyssa[YYINITDEPTH];
1032 short *yyss = yyssa;
1033 register short *yyssp;
1035 /* The semantic value stack. */
1036 YYSTYPE yyvsa[YYINITDEPTH];
1037 YYSTYPE *yyvs = yyvsa;
1038 register YYSTYPE *yyvsp;
1041 /* The location stack. */
1042 YYLTYPE yylsa[YYINITDEPTH];
1043 YYLTYPE *yyls = yylsa;
1048 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1050 # define YYPOPSTACK (yyvsp--, yyssp--)
1053 YYSIZE_T yystacksize = YYINITDEPTH;
1056 /* The variables used to return semantic value and location from the
1063 /* When reducing, the number of symbols on the RHS of the reduced
1067 YYDPRINTF ((stderr, "Starting parse\n"));
1072 yychar = YYEMPTY; /* Cause a token to be read. */
1074 /* Initialize stack pointers.
1075 Waste one element of value and location stack
1076 so that they stay on the same level as the state stack.
1077 The wasted elements are never initialized. */
1086 /*------------------------------------------------------------.
1087 | yynewstate -- Push a new state, which is found in yystate. |
1088 `------------------------------------------------------------*/
1090 /* In all cases, when you get here, the value and location stacks
1091 have just been pushed. so pushing a state here evens the stacks.
1098 if (yyssp >= yyss + yystacksize - 1)
1100 /* Get the current used size of the three stacks, in elements. */
1101 YYSIZE_T yysize = yyssp - yyss + 1;
1105 /* Give user a chance to xreallocate the stack. Use copies of
1106 these so that the &'s don't force the real ones into
1108 YYSTYPE *yyvs1 = yyvs;
1109 short *yyss1 = yyss;
1111 /* Each stack pointer address is followed by the size of the
1112 data in use in that stack, in bytes. */
1114 YYLTYPE *yyls1 = yyls;
1115 /* This used to be a conditional around just the two extra args,
1116 but that might be undefined if yyoverflow is a macro. */
1117 yyoverflow ("parser stack overflow",
1118 &yyss1, yysize * sizeof (*yyssp),
1119 &yyvs1, yysize * sizeof (*yyvsp),
1120 &yyls1, yysize * sizeof (*yylsp),
1124 yyoverflow ("parser stack overflow",
1125 &yyss1, yysize * sizeof (*yyssp),
1126 &yyvs1, yysize * sizeof (*yyvsp),
1132 #else /* no yyoverflow */
1133 # ifndef YYSTACK_RELOCATE
1136 /* Extend the stack our own way. */
1137 if (yystacksize >= YYMAXDEPTH)
1140 if (yystacksize > YYMAXDEPTH)
1141 yystacksize = YYMAXDEPTH;
1144 short *yyss1 = yyss;
1145 union yyalloc *yyptr =
1146 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1149 YYSTACK_RELOCATE (yyss);
1150 YYSTACK_RELOCATE (yyvs);
1152 YYSTACK_RELOCATE (yyls);
1154 # undef YYSTACK_RELOCATE
1156 YYSTACK_FREE (yyss1);
1159 #endif /* no yyoverflow */
1161 yyssp = yyss + yysize - 1;
1162 yyvsp = yyvs + yysize - 1;
1164 yylsp = yyls + yysize - 1;
1167 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1168 (unsigned long int) yystacksize));
1170 if (yyssp >= yyss + yystacksize - 1)
1174 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1184 /* Do appropriate processing given the current state. */
1185 /* Read a lookahead token if we need one and don't already have one. */
1188 /* First try to decide what to do without reference to lookahead token. */
1190 yyn = yypact[yystate];
1194 /* Not known => get a lookahead token if don't already have one. */
1196 /* yychar is either YYEMPTY or YYEOF
1197 or a valid token in external form. */
1199 if (yychar == YYEMPTY)
1201 YYDPRINTF ((stderr, "Reading a token: "));
1205 /* Convert token to internal form (in yychar1) for indexing tables with */
1207 if (yychar <= 0) /* This means end of input. */
1210 yychar = YYEOF; /* Don't call YYLEX any more */
1212 YYDPRINTF ((stderr, "Now at end of input.\n"));
1216 yychar1 = YYTRANSLATE (yychar);
1219 /* We have to keep this `#if YYDEBUG', since we use variables
1220 which are defined only if `YYDEBUG' is set. */
1223 YYFPRINTF (stderr, "Next token is %d (%s",
1224 yychar, yytname[yychar1]);
1225 /* Give the individual parser a way to print the precise
1226 meaning of a token, for further debugging info. */
1228 YYPRINT (stderr, yychar, yylval);
1230 YYFPRINTF (stderr, ")\n");
1236 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1241 /* yyn is what to do for this token type in this state.
1242 Negative => reduce, -yyn is rule number.
1243 Positive => shift, yyn is new state.
1244 New state is final state => don't bother to shift,
1245 just return success.
1246 0, or most negative number => error. */
1261 /* Shift the lookahead token. */
1262 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
1263 yychar, yytname[yychar1]));
1265 /* Discard the token being shifted unless it is eof. */
1266 if (yychar != YYEOF)
1274 /* Count tokens shifted since error; after three, turn off error
1283 /*-----------------------------------------------------------.
1284 | yydefault -- do the default action for the current state. |
1285 `-----------------------------------------------------------*/
1287 yyn = yydefact[yystate];
1293 /*-----------------------------.
1294 | yyreduce -- Do a reduction. |
1295 `-----------------------------*/
1297 /* yyn is the number of a rule to reduce with. */
1300 /* If YYLEN is nonzero, implement the default value of the action:
1303 Otherwise, the following line sets YYVAL to the semantic value of
1304 the lookahead token. This behavior is undocumented and Bison
1305 users should not rely upon it. Assigning to YYVAL
1306 unconditionally makes the parser a bit smaller, and it avoids a
1307 GCC warning that YYVAL may be used uninitialized. */
1308 yyval = yyvsp[1-yylen];
1311 /* Similarly for the default location. Let the user run additional
1312 commands if for instance locations are ranges. */
1313 yyloc = yylsp[1-yylen];
1314 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1318 /* We have to keep this `#if YYDEBUG', since we use variables which
1319 are defined only if `YYDEBUG' is set. */
1324 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
1327 /* Print the symbols being reduced, and their result. */
1328 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
1329 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
1330 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1337 #line 204 "./ada-exp.y"
1338 { write_exp_elt_opcode (OP_TYPE);
1339 write_exp_elt_type (yyvsp[0].tval);
1340 write_exp_elt_opcode (OP_TYPE); }
1343 #line 212 "./ada-exp.y"
1344 { write_exp_elt_opcode (BINOP_COMMA); }
1347 #line 217 "./ada-exp.y"
1348 { write_exp_elt_opcode (UNOP_IND); }
1351 #line 221 "./ada-exp.y"
1352 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1353 write_exp_string (yyvsp[0].ssym.stoken);
1354 write_exp_elt_opcode (STRUCTOP_STRUCT);
1358 #line 228 "./ada-exp.y"
1360 write_exp_elt_opcode (OP_FUNCALL);
1361 write_exp_elt_longcst (yyvsp[-1].lval);
1362 write_exp_elt_opcode (OP_FUNCALL);
1366 #line 236 "./ada-exp.y"
1368 write_exp_elt_opcode (UNOP_CAST);
1369 write_exp_elt_type (yyvsp[-3].tval);
1370 write_exp_elt_opcode (UNOP_CAST);
1374 #line 243 "./ada-exp.y"
1375 { type_qualifier = yyvsp[-2].tval; }
1378 #line 244 "./ada-exp.y"
1380 /* write_exp_elt_opcode (UNOP_QUAL); */
1381 /* FIXME: UNOP_QUAL should be defined in expression.h */
1382 write_exp_elt_type (yyvsp[-6].tval);
1383 /* write_exp_elt_opcode (UNOP_QUAL); */
1384 /* FIXME: UNOP_QUAL should be defined in expression.h */
1385 type_qualifier = yyvsp[-4].tval;
1389 #line 254 "./ada-exp.y"
1390 { yyval.tval = type_qualifier; }
1393 #line 258 "./ada-exp.y"
1394 { write_exp_elt_opcode (TERNOP_SLICE); }
1397 #line 261 "./ada-exp.y"
1401 #line 268 "./ada-exp.y"
1402 { write_exp_elt_opcode (OP_REGISTER);
1403 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1404 write_exp_elt_opcode (OP_REGISTER);
1408 #line 275 "./ada-exp.y"
1409 { write_exp_elt_opcode (OP_INTERNALVAR);
1410 write_exp_elt_intern (yyvsp[0].ivar);
1411 write_exp_elt_opcode (OP_INTERNALVAR);
1415 #line 286 "./ada-exp.y"
1416 { write_exp_elt_opcode (OP_LAST);
1417 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1418 write_exp_elt_opcode (OP_LAST);
1422 #line 293 "./ada-exp.y"
1423 { write_exp_elt_opcode (BINOP_ASSIGN); }
1426 #line 297 "./ada-exp.y"
1427 { write_exp_elt_opcode (UNOP_NEG); }
1430 #line 301 "./ada-exp.y"
1431 { write_exp_elt_opcode (UNOP_PLUS); }
1434 #line 305 "./ada-exp.y"
1435 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1438 #line 309 "./ada-exp.y"
1439 { write_exp_elt_opcode (UNOP_ABS); }
1442 #line 312 "./ada-exp.y"
1446 #line 316 "./ada-exp.y"
1450 #line 318 "./ada-exp.y"
1454 #line 320 "./ada-exp.y"
1455 { yyval.lval = yyvsp[-2].lval + 1; }
1458 #line 322 "./ada-exp.y"
1459 { yyval.lval = yyvsp[-4].lval + 1; }
1462 #line 327 "./ada-exp.y"
1463 { write_exp_elt_opcode (UNOP_MEMVAL);
1464 write_exp_elt_type (yyvsp[-2].tval);
1465 write_exp_elt_opcode (UNOP_MEMVAL);
1469 #line 336 "./ada-exp.y"
1470 { write_exp_elt_opcode (BINOP_EXP); }
1473 #line 340 "./ada-exp.y"
1474 { write_exp_elt_opcode (BINOP_MUL); }
1477 #line 344 "./ada-exp.y"
1478 { write_exp_elt_opcode (BINOP_DIV); }
1481 #line 348 "./ada-exp.y"
1482 { write_exp_elt_opcode (BINOP_REM); }
1485 #line 352 "./ada-exp.y"
1486 { write_exp_elt_opcode (BINOP_MOD); }
1489 #line 356 "./ada-exp.y"
1490 { write_exp_elt_opcode (BINOP_REPEAT); }
1493 #line 360 "./ada-exp.y"
1494 { write_exp_elt_opcode (BINOP_ADD); }
1497 #line 364 "./ada-exp.y"
1498 { write_exp_elt_opcode (BINOP_CONCAT); }
1501 #line 368 "./ada-exp.y"
1502 { write_exp_elt_opcode (BINOP_SUB); }
1505 #line 372 "./ada-exp.y"
1506 { write_exp_elt_opcode (BINOP_EQUAL); }
1509 #line 376 "./ada-exp.y"
1510 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1513 #line 380 "./ada-exp.y"
1514 { write_exp_elt_opcode (BINOP_LEQ); }
1517 #line 384 "./ada-exp.y"
1518 { /*write_exp_elt_opcode (TERNOP_MBR); */ }
1521 #line 388 "./ada-exp.y"
1522 { /*write_exp_elt_opcode (BINOP_MBR); */
1523 /* FIXME: BINOP_MBR should be defined in expression.h */
1524 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1525 /*write_exp_elt_opcode (BINOP_MBR); */
1529 #line 394 "./ada-exp.y"
1530 { /*write_exp_elt_opcode (UNOP_MBR); */
1531 /* FIXME: UNOP_QUAL should be defined in expression.h */
1532 write_exp_elt_type (yyvsp[0].tval);
1533 /* write_exp_elt_opcode (UNOP_MBR); */
1534 /* FIXME: UNOP_MBR should be defined in expression.h */
1538 #line 401 "./ada-exp.y"
1539 { /*write_exp_elt_opcode (TERNOP_MBR); */
1540 /* FIXME: TERNOP_MBR should be defined in expression.h */
1541 write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1545 #line 406 "./ada-exp.y"
1546 { /* write_exp_elt_opcode (BINOP_MBR); */
1547 /* FIXME: BINOP_MBR should be defined in expression.h */
1548 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1549 /*write_exp_elt_opcode (BINOP_MBR);*/
1550 /* FIXME: BINOP_MBR should be defined in expression.h */
1551 write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1555 #line 414 "./ada-exp.y"
1556 { /*write_exp_elt_opcode (UNOP_MBR);*/
1557 /* FIXME: UNOP_MBR should be defined in expression.h */
1558 write_exp_elt_type (yyvsp[0].tval);
1559 /* write_exp_elt_opcode (UNOP_MBR);*/
1560 /* FIXME: UNOP_MBR should be defined in expression.h */
1561 write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1565 #line 424 "./ada-exp.y"
1566 { write_exp_elt_opcode (BINOP_GEQ); }
1569 #line 428 "./ada-exp.y"
1570 { write_exp_elt_opcode (BINOP_LESS); }
1573 #line 432 "./ada-exp.y"
1574 { write_exp_elt_opcode (BINOP_GTR); }
1577 #line 436 "./ada-exp.y"
1578 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1581 #line 440 "./ada-exp.y"
1582 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1585 #line 444 "./ada-exp.y"
1586 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1589 #line 448 "./ada-exp.y"
1590 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1593 #line 452 "./ada-exp.y"
1594 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1597 #line 456 "./ada-exp.y"
1598 { write_exp_elt_opcode (UNOP_ADDR); }
1601 #line 458 "./ada-exp.y"
1602 { write_exp_elt_opcode (UNOP_ADDR);
1603 write_exp_elt_opcode (UNOP_CAST);
1604 write_exp_elt_type (builtin_type_ada_system_address);
1605 write_exp_elt_opcode (UNOP_CAST);
1609 #line 464 "./ada-exp.y"
1610 { write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); }
1613 #line 466 "./ada-exp.y"
1614 { write_attribute_call1 (ATR_LAST, yyvsp[0].lval); }
1617 #line 468 "./ada-exp.y"
1618 { write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); }
1621 #line 470 "./ada-exp.y"
1622 { write_attribute_call0 (ATR_SIZE); }
1625 #line 472 "./ada-exp.y"
1626 { write_attribute_call0 (ATR_TAG); }
1629 #line 474 "./ada-exp.y"
1630 { write_attribute_calln (ATR_MIN, 2); }
1633 #line 476 "./ada-exp.y"
1634 { write_attribute_calln (ATR_MAX, 2); }
1637 #line 478 "./ada-exp.y"
1638 { write_attribute_calln (ATR_POS, 1); }
1641 #line 480 "./ada-exp.y"
1642 { write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); }
1645 #line 482 "./ada-exp.y"
1646 { write_attribute_call1 (ATR_LAST, yyvsp[0].lval); }
1649 #line 484 "./ada-exp.y"
1650 { write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); }
1653 #line 486 "./ada-exp.y"
1654 { write_attribute_calln (ATR_VAL, 1); }
1657 #line 488 "./ada-exp.y"
1658 { write_attribute_call0 (ATR_MODULUS); }
1661 #line 492 "./ada-exp.y"
1665 #line 494 "./ada-exp.y"
1666 { yyval.lval = yyvsp[-1].typed_val.val; }
1669 #line 499 "./ada-exp.y"
1670 { write_exp_elt_opcode (OP_TYPE);
1671 write_exp_elt_type (yyvsp[0].tval);
1672 write_exp_elt_opcode (OP_TYPE); }
1675 #line 507 "./ada-exp.y"
1676 { write_exp_elt_opcode (OP_TYPE);
1677 write_exp_elt_type (builtin_type_void);
1678 write_exp_elt_opcode (OP_TYPE); }
1681 #line 514 "./ada-exp.y"
1682 { write_exp_elt_opcode (OP_LONG);
1683 write_exp_elt_type (yyvsp[0].typed_val.type);
1684 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1685 write_exp_elt_opcode (OP_LONG);
1689 #line 522 "./ada-exp.y"
1690 { write_exp_elt_opcode (OP_LONG);
1691 if (type_qualifier == NULL)
1692 write_exp_elt_type (yyvsp[0].typed_val.type);
1694 write_exp_elt_type (type_qualifier);
1695 write_exp_elt_longcst
1696 (convert_char_literal (type_qualifier, yyvsp[0].typed_val.val));
1697 write_exp_elt_opcode (OP_LONG);
1701 #line 534 "./ada-exp.y"
1702 { write_exp_elt_opcode (OP_DOUBLE);
1703 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1704 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1705 write_exp_elt_opcode (OP_DOUBLE);
1709 #line 542 "./ada-exp.y"
1710 { write_exp_elt_opcode (OP_LONG);
1711 write_exp_elt_type (builtin_type_int);
1712 write_exp_elt_longcst ((LONGEST)(0));
1713 write_exp_elt_opcode (OP_LONG);
1717 #line 549 "./ada-exp.y"
1718 { /* Ada strings are converted into array constants
1719 a lower bound of 1. Thus, the array upper bound
1720 is the string length. */
1721 char *sp = yyvsp[0].sval.ptr; int count;
1722 if (yyvsp[0].sval.length == 0)
1723 { /* One dummy character for the type */
1724 write_exp_elt_opcode (OP_LONG);
1725 write_exp_elt_type (builtin_type_ada_char);
1726 write_exp_elt_longcst ((LONGEST)(0));
1727 write_exp_elt_opcode (OP_LONG);
1729 for (count = yyvsp[0].sval.length; count > 0; count -= 1)
1731 write_exp_elt_opcode (OP_LONG);
1732 write_exp_elt_type (builtin_type_ada_char);
1733 write_exp_elt_longcst ((LONGEST)(*sp));
1735 write_exp_elt_opcode (OP_LONG);
1737 write_exp_elt_opcode (OP_ARRAY);
1738 write_exp_elt_longcst ((LONGEST) 1);
1739 write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1740 write_exp_elt_opcode (OP_ARRAY);
1744 #line 576 "./ada-exp.y"
1745 { error ("NEW not implemented."); }
1748 #line 579 "./ada-exp.y"
1749 { write_var_from_name (NULL, yyvsp[0].ssym); }
1752 #line 581 "./ada-exp.y"
1753 { write_var_from_name (yyvsp[-1].bval, yyvsp[0].ssym); }
1756 #line 582 "./ada-exp.y"
1757 { write_object_renaming (NULL, yyvsp[0].ssym.sym); }
1760 #line 584 "./ada-exp.y"
1761 { write_object_renaming (yyvsp[-1].bval, yyvsp[0].ssym.sym); }
1764 #line 587 "./ada-exp.y"
1768 #line 588 "./ada-exp.y"
1772 #line 589 "./ada-exp.y"
1776 #line 593 "./ada-exp.y"
1777 { yyval.bval = yyvsp[0].bval; }
1780 #line 595 "./ada-exp.y"
1781 { yyval.bval = yyvsp[0].bval; }
1784 #line 599 "./ada-exp.y"
1785 { yyval.tval = yyvsp[0].tval; }
1788 #line 600 "./ada-exp.y"
1789 { yyval.tval = yyvsp[0].tval; }
1792 #line 602 "./ada-exp.y"
1793 { yyval.tval = lookup_pointer_type (yyvsp[-1].tval); }
1796 #line 604 "./ada-exp.y"
1797 { yyval.tval = lookup_pointer_type (yyvsp[-1].tval); }
1800 #line 611 "./ada-exp.y"
1801 { write_exp_elt_opcode (UNOP_IND); }
1804 #line 613 "./ada-exp.y"
1805 { write_exp_elt_opcode (UNOP_ADDR); }
1808 #line 615 "./ada-exp.y"
1809 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1813 #line 705 "/usr/local/share/bison/bison.simple"
1825 short *yyssp1 = yyss - 1;
1826 YYFPRINTF (stderr, "state stack now");
1827 while (yyssp1 != yyssp)
1828 YYFPRINTF (stderr, " %d", *++yyssp1);
1829 YYFPRINTF (stderr, "\n");
1838 /* Now `shift' the result of the reduction. Determine what state
1839 that goes to, based on the state we popped back to and the rule
1840 number reduced by. */
1844 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1845 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1846 yystate = yytable[yystate];
1848 yystate = yydefgoto[yyn - YYNTBASE];
1853 /*------------------------------------.
1854 | yyerrlab -- here on detecting error |
1855 `------------------------------------*/
1857 /* If not already recovering from an error, report this error. */
1862 #ifdef YYERROR_VERBOSE
1863 yyn = yypact[yystate];
1865 if (yyn > YYFLAG && yyn < YYLAST)
1867 YYSIZE_T yysize = 0;
1872 /* Start YYX at -YYN if negative to avoid negative indexes in
1874 for (yyx = yyn < 0 ? -yyn : 0;
1875 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1876 if (yycheck[yyx + yyn] == yyx)
1877 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1878 yysize += yystrlen ("parse error, unexpected ") + 1;
1879 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1880 yymsg = (char *) YYSTACK_ALLOC (yysize);
1883 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1884 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1889 for (yyx = yyn < 0 ? -yyn : 0;
1890 yyx < (int) (sizeof (yytname) / sizeof (char *));
1892 if (yycheck[yyx + yyn] == yyx)
1894 const char *yyq = ! yycount ? ", expecting " : " or ";
1895 yyp = yystpcpy (yyp, yyq);
1896 yyp = yystpcpy (yyp, yytname[yyx]);
1901 YYSTACK_FREE (yymsg);
1904 yyerror ("parse error; also virtual memory exhausted");
1907 #endif /* defined (YYERROR_VERBOSE) */
1908 yyerror ("parse error");
1913 /*--------------------------------------------------.
1914 | yyerrlab1 -- error raised explicitly by an action |
1915 `--------------------------------------------------*/
1917 if (yyerrstatus == 3)
1919 /* If just tried and failed to reuse lookahead token after an
1920 error, discard it. */
1922 /* return failure if at end of input */
1923 if (yychar == YYEOF)
1925 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1926 yychar, yytname[yychar1]));
1930 /* Else will try to reuse lookahead token after shifting the error
1933 yyerrstatus = 3; /* Each real token shifted decrements this */
1938 /*-------------------------------------------------------------------.
1939 | yyerrdefault -- current state does not do anything special for the |
1941 `-------------------------------------------------------------------*/
1944 /* This is wrong; only states that explicitly want error tokens
1945 should shift them. */
1947 /* If its default is to accept any token, ok. Otherwise pop it. */
1948 yyn = yydefact[yystate];
1954 /*---------------------------------------------------------------.
1955 | yyerrpop -- pop the current state because it cannot handle the |
1957 `---------------------------------------------------------------*/
1970 short *yyssp1 = yyss - 1;
1971 YYFPRINTF (stderr, "Error: state stack now");
1972 while (yyssp1 != yyssp)
1973 YYFPRINTF (stderr, " %d", *++yyssp1);
1974 YYFPRINTF (stderr, "\n");
1982 yyn = yypact[yystate];
1987 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
2004 YYDPRINTF ((stderr, "Shifting error token, "));
2015 /*-------------------------------------.
2016 | yyacceptlab -- YYACCEPT comes here. |
2017 `-------------------------------------*/
2022 /*-----------------------------------.
2023 | yyabortlab -- YYABORT comes here. |
2024 `-----------------------------------*/
2029 /*---------------------------------------------.
2030 | yyoverflowab -- parser overflow comes here. |
2031 `---------------------------------------------*/
2033 yyerror ("parser stack overflow");
2040 YYSTACK_FREE (yyss);
2044 #line 618 "./ada-exp.y"
2047 /* yylex defined in ada-lex.c: Reads one token, getting characters */
2048 /* through lexptr. */
2050 /* Remap normal flex interface names (yylex) as well as gratuitiously */
2051 /* global symbol names, so we can have multiple flex-generated parsers */
2054 /* (See note above on previous definitions for YACC.) */
2056 #define yy_create_buffer ada_yy_create_buffer
2057 #define yy_delete_buffer ada_yy_delete_buffer
2058 #define yy_init_buffer ada_yy_init_buffer
2059 #define yy_load_buffer_state ada_yy_load_buffer_state
2060 #define yy_switch_to_buffer ada_yy_switch_to_buffer
2061 #define yyrestart ada_yyrestart
2062 #define yytext ada_yytext
2063 #define yywrap ada_yywrap
2065 /* The following kludge was found necessary to prevent conflicts between */
2066 /* defs.h and non-standard stdlib.h files. */
2067 #define qsort __qsort__dummy
2068 #include "ada-lex.c"
2073 lexer_init (yyin); /* (Re-)initialize lexer. */
2074 left_block_context = NULL;
2075 type_qualifier = NULL;
2077 return _ada_parse ();
2084 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2087 /* The operator name corresponding to operator symbol STRING (adds
2088 quotes and maps to lower-case). Destroys the previous contents of
2089 the array pointed to by STRING.ptr. Error if STRING does not match
2090 a valid Ada operator. Assumes that STRING.ptr points to a
2091 null-terminated string and that, if STRING is a valid operator
2092 symbol, the array pointed to by STRING.ptr contains at least
2093 STRING.length+3 characters. */
2095 static struct stoken
2096 string_to_operator (string)
2097 struct stoken string;
2101 for (i = 0; ada_opname_table[i].mangled != NULL; i += 1)
2103 if (string.length == strlen (ada_opname_table[i].demangled)-2
2104 && strncasecmp (string.ptr, ada_opname_table[i].demangled+1,
2105 string.length) == 0)
2107 strncpy (string.ptr, ada_opname_table[i].demangled,
2113 error ("Invalid operator symbol `%s'", string.ptr);
2116 /* Emit expression to access an instance of SYM, in block BLOCK (if
2117 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
2119 write_var_from_sym (orig_left_context, block, sym)
2120 struct block* orig_left_context;
2121 struct block* block;
2124 if (orig_left_context == NULL && symbol_read_needs_frame (sym))
2126 if (innermost_block == 0 ||
2127 contained_in (block, innermost_block))
2128 innermost_block = block;
2131 write_exp_elt_opcode (OP_VAR_VALUE);
2132 /* We want to use the selected frame, not another more inner frame
2133 which happens to be in the same block */
2134 write_exp_elt_block (NULL);
2135 write_exp_elt_sym (sym);
2136 write_exp_elt_opcode (OP_VAR_VALUE);
2139 /* Emit expression to access an instance of NAME. */
2141 write_var_from_name (orig_left_context, name)
2142 struct block* orig_left_context;
2143 struct name_info name;
2145 if (name.msym != NULL)
2147 write_exp_msymbol (name.msym,
2148 lookup_function_type (builtin_type_int),
2151 else if (name.sym == NULL)
2153 /* Multiple matches: record name and starting block for later
2154 resolution by ada_resolve. */
2155 /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
2156 /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
2157 write_exp_elt_block (name.block);
2158 /* write_exp_elt_name (name.stoken.ptr); */
2159 /* FIXME: write_exp_elt_name should be defined in defs.h, located in parse.c */
2160 /* write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
2161 /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
2164 write_var_from_sym (orig_left_context, name.block, name.sym);
2167 /* Write a call on parameterless attribute ATR. */
2170 write_attribute_call0 (atr)
2171 enum ada_attribute atr;
2173 /* write_exp_elt_opcode (OP_ATTRIBUTE); */
2174 /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2175 write_exp_elt_longcst ((LONGEST) 0);
2176 write_exp_elt_longcst ((LONGEST) atr);
2177 /* write_exp_elt_opcode (OP_ATTRIBUTE); */
2178 /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2181 /* Write a call on an attribute ATR with one constant integer
2185 write_attribute_call1 (atr, arg)
2186 enum ada_attribute atr;
2189 write_exp_elt_opcode (OP_LONG);
2190 write_exp_elt_type (builtin_type_int);
2191 write_exp_elt_longcst (arg);
2192 write_exp_elt_opcode (OP_LONG);
2193 /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
2194 /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2195 write_exp_elt_longcst ((LONGEST) 1);
2196 write_exp_elt_longcst ((LONGEST) atr);
2197 /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
2198 /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2201 /* Write a call on an attribute ATR with N parameters, whose code must have
2202 * been generated previously. */
2205 write_attribute_calln (atr, n)
2206 enum ada_attribute atr;
2209 /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
2210 /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2211 write_exp_elt_longcst ((LONGEST) n);
2212 write_exp_elt_longcst ((LONGEST) atr);
2213 /* write_exp_elt_opcode (OP_ATTRIBUTE);*/
2214 /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2217 /* Emit expression corresponding to the renamed object designated by
2218 * the type RENAMING, which must be the referent of an object renaming
2219 * type, in the context of ORIG_LEFT_CONTEXT (?). */
2221 write_object_renaming (orig_left_context, renaming)
2222 struct block* orig_left_context;
2223 struct symbol* renaming;
2225 const char* qualification = SYMBOL_NAME (renaming);
2226 const char* simple_tail;
2227 const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0);
2231 enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
2233 /* if orig_left_context is null, then use the currently selected
2234 block, otherwise we might fail our symbol lookup below */
2235 if (orig_left_context == NULL)
2236 orig_left_context = get_selected_block (NULL);
2238 for (simple_tail = qualification + strlen (qualification);
2239 simple_tail != qualification; simple_tail -= 1)
2241 if (*simple_tail == '.')
2246 else if (STREQN (simple_tail, "__", 2))
2253 suffix = strstr (expr, "___XE");
2257 name = (char*) xmalloc (suffix - expr + 1);
2258 /* add_name_string_cleanup (name); */
2259 /* FIXME: add_name_string_cleanup should be defined in
2260 parser-defs.h, implemented in parse.c */
2261 strncpy (name, expr, suffix-expr);
2262 name[suffix-expr] = '\000';
2263 sym = lookup_symbol (name, orig_left_context, VAR_NAMESPACE, 0, NULL);
2265 error ("Could not find renamed variable: %s", ada_demangle (name));
2267 /* FIXME: ada_demangle should be defined in defs.h, implemented in ada-lang.c */
2268 write_var_from_sym (orig_left_context, block_found, sym);
2271 slice_state = SIMPLE_INDEX;
2272 while (*suffix == 'X')
2278 slice_state = LOWER_BOUND;
2281 if (isdigit (*suffix))
2284 long val = strtol (suffix, &next, 10);
2288 write_exp_elt_opcode (OP_LONG);
2289 write_exp_elt_type (builtin_type_ada_int);
2290 write_exp_elt_longcst ((LONGEST) val);
2291 write_exp_elt_opcode (OP_LONG);
2298 struct symbol* index_sym;
2300 end = strchr (suffix, 'X');
2302 end = suffix + strlen (suffix);
2304 index_len = simple_tail - qualification + 2 + (suffix - end) + 1;
2305 index_name = (char*) xmalloc (index_len);
2306 memset (index_name, '\000', index_len);
2307 /* add_name_string_cleanup (index_name);*/
2308 /* FIXME: add_name_string_cleanup should be defined in
2309 parser-defs.h, implemented in parse.c */
2310 strncpy (index_name, qualification, simple_tail - qualification);
2311 index_name[simple_tail - qualification] = '\000';
2312 strncat (index_name, suffix, suffix-end);
2316 lookup_symbol (index_name, NULL, VAR_NAMESPACE, 0, NULL);
2317 if (index_sym == NULL)
2318 error ("Could not find %s", index_name);
2319 write_var_from_sym (NULL, block_found, sym);
2321 if (slice_state == SIMPLE_INDEX)
2323 write_exp_elt_opcode (OP_FUNCALL);
2324 write_exp_elt_longcst ((LONGEST) 1);
2325 write_exp_elt_opcode (OP_FUNCALL);
2327 else if (slice_state == LOWER_BOUND)
2328 slice_state = UPPER_BOUND;
2329 else if (slice_state == UPPER_BOUND)
2331 write_exp_elt_opcode (TERNOP_SLICE);
2332 slice_state = SIMPLE_INDEX;
2338 struct stoken field_name;
2342 if (slice_state != SIMPLE_INDEX)
2344 end = strchr (suffix, 'X');
2346 end = suffix + strlen (suffix);
2347 field_name.length = end - suffix;
2348 field_name.ptr = (char*) xmalloc (end - suffix + 1);
2349 strncpy (field_name.ptr, suffix, end - suffix);
2350 field_name.ptr[end - suffix] = '\000';
2352 write_exp_elt_opcode (STRUCTOP_STRUCT);
2353 write_exp_string (field_name);
2354 write_exp_elt_opcode (STRUCTOP_STRUCT);
2362 if (slice_state == SIMPLE_INDEX)
2366 error ("Internal error in encoding of renaming declaration: %s",
2367 SYMBOL_NAME (renaming));
2370 /* Convert the character literal whose ASCII value would be VAL to the
2371 appropriate value of type TYPE, if there is a translation.
2372 Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
2373 the literal 'A' (VAL == 65), returns 0. */
2375 convert_char_literal (struct type* type, LONGEST val)
2380 if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM)
2382 sprintf (name, "QU%02x", (int) val);
2383 for (f = 0; f < TYPE_NFIELDS (type); f += 1)
2385 if (STREQ (name, TYPE_FIELD_NAME (type, f)))
2386 return TYPE_FIELD_BITPOS (type, f);