2 /* A Bison parser, made from c-exp.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
13 #define NAME_OR_INT 263
20 #define COLONCOLON 270
23 #define SIGNED_KEYWORD 273
26 #define INT_KEYWORD 276
27 #define CONST_KEYWORD 277
28 #define VOLATILE_KEYWORD 278
29 #define DOUBLE_KEYWORD 279
31 #define ASSIGN_MODIFY 281
33 #define TRUEKEYWORD 283
34 #define FALSEKEYWORD 284
35 #define ABOVE_COMMA 285
55 #include "gdb_string.h"
57 #include "expression.h"
59 #include "parser-defs.h"
62 #include "bfd.h" /* Required by objfiles.h. */
63 #include "symfile.h" /* Required by objfiles.h. */
64 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
66 /* Flag indicating we're dealing with HP-compiled objects */
67 extern int hp_som_som_object_present
;
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. Note that 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 #define yymaxdepth c_maxdepth
77 #define yyparse c_parse
79 #define yyerror c_error
82 #define yydebug c_debug
91 #define yyerrflag c_errflag
92 #define yynerrs c_nerrs
97 #define yystate c_state
102 #define yylloc c_lloc
103 #define yyreds c_reds /* With YYDEBUG defined */
104 #define yytoks c_toks /* With YYDEBUG defined */
105 #define yylhs c_yylhs
106 #define yylen c_yylen
107 #define yydefred c_yydefred
108 #define yydgoto c_yydgoto
109 #define yysindex c_yysindex
110 #define yyrindex c_yyrindex
111 #define yygindex c_yygindex
112 #define yytable c_yytable
113 #define yycheck c_yycheck
116 #define YYDEBUG 0 /* Default to no yydebug support */
120 yyparse
PARAMS ((void));
123 yylex
PARAMS ((void));
126 yyerror
PARAMS ((char *));
145 struct symtoken ssym
;
148 enum exp_opcode opcode
;
149 struct internalvar
*ivar
;
156 /* YYSTYPE gets defined by %union */
158 parse_number
PARAMS ((char *, int, int, YYSTYPE
*));
170 #define YYFLAG -32768
173 #define YYTRANSLATE(x) ((unsigned)(x) <= 299 ? yytranslate[x] : 91)
175 static const char yytranslate
[] = { 0,
176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
179 2, 2, 62, 2, 2, 2, 52, 38, 2, 59,
180 65, 50, 48, 30, 49, 57, 51, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 68, 2, 41,
182 32, 42, 33, 47, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 58, 2, 64, 37, 2, 2, 2, 2, 2, 2,
186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 66, 36, 67, 63, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
192 2, 2, 2, 2, 2, 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, 2, 2, 2, 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, 2, 2, 2, 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, 1, 2, 3, 4, 5,
202 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
203 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
204 26, 27, 28, 29, 31, 34, 35, 39, 40, 43,
205 44, 45, 46, 53, 54, 55, 56, 60, 61
209 static const short yyprhs
[] = { 0,
210 0, 2, 4, 6, 8, 12, 15, 18, 21, 24,
211 27, 30, 33, 36, 39, 42, 46, 50, 55, 59,
212 63, 68, 73, 74, 80, 82, 83, 85, 89, 91,
213 95, 100, 105, 109, 113, 117, 121, 125, 129, 133,
214 137, 141, 145, 149, 153, 157, 161, 165, 169, 173,
215 177, 181, 185, 191, 195, 199, 201, 203, 205, 207,
216 209, 214, 216, 218, 220, 222, 224, 226, 230, 234,
217 238, 243, 245, 248, 250, 252, 255, 258, 261, 265,
218 269, 271, 274, 276, 279, 281, 285, 288, 290, 293,
219 295, 298, 302, 305, 309, 311, 315, 317, 319, 321,
220 323, 326, 330, 333, 337, 341, 346, 349, 353, 355,
221 358, 361, 364, 367, 370, 373, 375, 378, 380, 386,
222 389, 392, 394, 396, 398, 400, 402, 406, 408, 410,
226 static const short yyrhs
[] = { 71,
227 0, 70, 0, 85, 0, 72, 0, 71, 30, 72,
228 0, 50, 72, 0, 38, 72, 0, 49, 72, 0,
229 62, 72, 0, 63, 72, 0, 54, 72, 0, 55,
230 72, 0, 72, 54, 0, 72, 55, 0, 13, 72,
231 0, 72, 56, 89, 0, 72, 56, 79, 0, 72,
232 56, 50, 72, 0, 72, 57, 89, 0, 72, 57,
233 79, 0, 72, 57, 50, 72, 0, 72, 58, 71,
234 64, 0, 0, 72, 59, 73, 75, 65, 0, 66,
235 0, 0, 72, 0, 75, 30, 72, 0, 67, 0,
236 74, 75, 76, 0, 74, 85, 76, 72, 0, 59,
237 85, 65, 72, 0, 59, 71, 65, 0, 72, 47,
238 72, 0, 72, 50, 72, 0, 72, 51, 72, 0,
239 72, 52, 72, 0, 72, 48, 72, 0, 72, 49,
240 72, 0, 72, 45, 72, 0, 72, 46, 72, 0,
241 72, 39, 72, 0, 72, 40, 72, 0, 72, 43,
242 72, 0, 72, 44, 72, 0, 72, 41, 72, 0,
243 72, 42, 72, 0, 72, 38, 72, 0, 72, 37,
244 72, 0, 72, 36, 72, 0, 72, 35, 72, 0,
245 72, 34, 72, 0, 72, 33, 72, 68, 72, 0,
246 72, 32, 72, 0, 72, 26, 72, 0, 3, 0,
247 8, 0, 4, 0, 78, 0, 25, 0, 13, 59,
248 85, 65, 0, 5, 0, 27, 0, 28, 0, 29,
249 0, 60, 0, 61, 0, 77, 15, 89, 0, 77,
250 15, 89, 0, 86, 15, 89, 0, 86, 15, 63,
251 89, 0, 79, 0, 15, 89, 0, 90, 0, 86,
252 0, 86, 22, 0, 86, 23, 0, 86, 81, 0,
253 86, 22, 81, 0, 86, 23, 81, 0, 50, 0,
254 50, 81, 0, 38, 0, 38, 81, 0, 82, 0,
255 59, 81, 65, 0, 82, 83, 0, 83, 0, 82,
256 84, 0, 84, 0, 58, 64, 0, 58, 3, 64,
257 0, 59, 65, 0, 59, 88, 65, 0, 80, 0,
258 86, 15, 50, 0, 7, 0, 21, 0, 19, 0,
259 20, 0, 19, 21, 0, 14, 19, 21, 0, 19,
260 19, 0, 19, 19, 21, 0, 14, 19, 19, 0,
261 14, 19, 19, 21, 0, 20, 21, 0, 14, 20,
262 21, 0, 24, 0, 19, 24, 0, 9, 89, 0,
263 10, 89, 0, 11, 89, 0, 12, 89, 0, 14,
264 87, 0, 14, 0, 18, 87, 0, 18, 0, 16,
265 89, 41, 85, 42, 0, 22, 86, 0, 23, 86,
266 0, 7, 0, 21, 0, 19, 0, 20, 0, 85,
267 0, 88, 30, 85, 0, 6, 0, 60, 0, 7,
274 static const short yyrline
[] = { 0,
275 230, 231, 234, 241, 242, 247, 250, 253, 257, 261,
276 265, 269, 273, 277, 281, 285, 291, 299, 303, 309,
277 317, 321, 325, 329, 335, 339, 342, 346, 350, 353,
278 360, 366, 372, 378, 382, 386, 390, 394, 398, 402,
279 406, 410, 414, 418, 422, 426, 430, 434, 438, 442,
280 446, 450, 454, 458, 462, 468, 475, 486, 493, 496,
281 500, 508, 533, 538, 545, 554, 562, 568, 579, 595,
282 608, 632, 633, 667, 725, 731, 732, 733, 735, 737,
283 741, 743, 745, 747, 749, 752, 754, 759, 766, 768,
284 772, 774, 778, 780, 792, 793, 798, 800, 802, 804,
285 806, 808, 810, 812, 814, 816, 818, 820, 822, 824,
286 826, 829, 832, 835, 838, 840, 842, 844, 849, 856,
287 857, 860, 861, 867, 873, 882, 887, 894, 895, 896,
293 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
295 static const char * const yytname
[] = { "$","error","$undefined.","INT","FLOAT",
296 "STRING","NAME","TYPENAME","NAME_OR_INT","STRUCT","CLASS","UNION","ENUM","SIZEOF",
297 "UNSIGNED","COLONCOLON","TEMPLATE","ERROR","SIGNED_KEYWORD","LONG","SHORT","INT_KEYWORD",
298 "CONST_KEYWORD","VOLATILE_KEYWORD","DOUBLE_KEYWORD","VARIABLE","ASSIGN_MODIFY",
299 "THIS","TRUEKEYWORD","FALSEKEYWORD","','","ABOVE_COMMA","'='","'?'","OROR","ANDAND",
300 "'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'","'>'","LEQ","GEQ","LSH","RSH","'@'",
301 "'+'","'-'","'*'","'/'","'%'","UNARY","INCREMENT","DECREMENT","ARROW","'.'",
302 "'['","'('","BLOCKNAME","FILENAME","'!'","'~'","']'","')'","'{'","'}'","':'",
303 "start","type_exp","exp1","exp","@1","lcurly","arglist","rcurly","block","variable",
304 "qualified_name","ptype","abs_decl","direct_abs_decl","array_mod","func_mod",
305 "type","typebase","typename","nonempty_typelist","name","name_not_typename", NULL
309 static const short yyr1
[] = { 0,
310 69, 69, 70, 71, 71, 72, 72, 72, 72, 72,
311 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
312 72, 72, 73, 72, 74, 75, 75, 75, 76, 72,
313 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
314 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
315 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
316 72, 72, 72, 72, 72, 77, 77, 77, 78, 79,
317 79, 78, 78, 78, 80, 80, 80, 80, 80, 80,
318 81, 81, 81, 81, 81, 82, 82, 82, 82, 82,
319 83, 83, 84, 84, 85, 85, 86, 86, 86, 86,
320 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
321 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
322 86, 87, 87, 87, 87, 88, 88, 89, 89, 89,
326 static const short yyr2
[] = { 0,
327 1, 1, 1, 1, 3, 2, 2, 2, 2, 2,
328 2, 2, 2, 2, 2, 3, 3, 4, 3, 3,
329 4, 4, 0, 5, 1, 0, 1, 3, 1, 3,
330 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
331 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
332 3, 3, 5, 3, 3, 1, 1, 1, 1, 1,
333 4, 1, 1, 1, 1, 1, 1, 3, 3, 3,
334 4, 1, 2, 1, 1, 2, 2, 2, 3, 3,
335 1, 2, 1, 2, 1, 3, 2, 1, 2, 1,
336 2, 3, 2, 3, 1, 3, 1, 1, 1, 1,
337 2, 3, 2, 3, 3, 4, 2, 3, 1, 2,
338 2, 2, 2, 2, 2, 1, 2, 1, 5, 2,
339 2, 1, 1, 1, 1, 1, 3, 1, 1, 1,
343 static const short yydefact
[] = { 0,
344 56, 58, 62, 132, 97, 57, 0, 0, 0, 0,
345 0, 116, 0, 0, 118, 99, 100, 98, 0, 0,
346 109, 60, 63, 64, 65, 0, 0, 0, 0, 0,
347 0, 133, 67, 0, 0, 25, 2, 1, 4, 26,
348 0, 59, 72, 95, 3, 75, 74, 128, 130, 131,
349 129, 111, 112, 113, 114, 0, 15, 0, 122, 124,
350 125, 123, 115, 73, 0, 124, 125, 117, 103, 101,
351 110, 107, 120, 121, 7, 8, 6, 11, 12, 0,
352 0, 9, 10, 0, 0, 0, 0, 0, 0, 0,
353 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
354 0, 0, 0, 0, 0, 0, 13, 14, 0, 0,
355 0, 23, 27, 0, 0, 0, 0, 76, 77, 83,
356 81, 0, 0, 78, 85, 88, 90, 0, 0, 105,
357 102, 108, 0, 104, 33, 0, 5, 55, 54, 0,
358 52, 51, 50, 49, 48, 42, 43, 46, 47, 44,
359 45, 40, 41, 34, 38, 39, 35, 36, 37, 130,
360 0, 17, 16, 0, 20, 19, 0, 26, 0, 29,
361 30, 0, 69, 96, 0, 70, 79, 80, 84, 82,
362 0, 91, 93, 0, 126, 75, 0, 0, 87, 89,
363 61, 106, 0, 32, 0, 18, 21, 22, 0, 28,
364 31, 71, 92, 86, 0, 0, 94, 119, 53, 24,
368 static const short yydefgoto
[] = { 212,
369 37, 80, 39, 168, 40, 114, 171, 41, 42, 43,
370 44, 124, 125, 126, 127, 185, 58, 63, 187, 176,
374 static const short yypact
[] = { 205,
375 -32768,-32768,-32768,-32768,-32768,-32768, 46, 46, 46, 46,
376 269, 57, 46, 46, 100, 134, -14,-32768, 228, 228,
377 -32768,-32768,-32768,-32768,-32768, 205, 205, 205, 205, 205,
378 205, 21,-32768, 205, 205,-32768,-32768, -16, 504, 205,
379 22,-32768,-32768,-32768,-32768, 107,-32768,-32768,-32768,-32768,
380 -32768,-32768,-32768,-32768,-32768, 205, 14, 23,-32768, 7,
381 24,-32768,-32768,-32768, 10,-32768,-32768,-32768, 34,-32768,
382 -32768,-32768,-32768,-32768, 14, 14, 14, 14, 14, -26,
383 -21, 14, 14, 205, 205, 205, 205, 205, 205, 205,
384 205, 205, 205, 205, 205, 205, 205, 205, 205, 205,
385 205, 205, 205, 205, 205, 205,-32768,-32768, 419, 438,
386 205,-32768, 504, -25, -2, 46, 53, 8, 8, 8,
387 8, -1, 359,-32768, -41,-32768,-32768, 9, 42, 54,
388 -32768,-32768, 228,-32768,-32768, 205, 504, 504, 504, 467,
389 556, 580, 603, 625, 646, 665, 665, 254, 254, 254,
390 254, 124, 124, 356, 416, 416, 14, 14, 14, 89,
391 205,-32768,-32768, 205,-32768,-32768, -17, 205, 205,-32768,
392 -32768, 205, 93,-32768, 46,-32768,-32768,-32768,-32768,-32768,
393 45,-32768,-32768, 50,-32768, 146, -22, 128,-32768,-32768,
394 333,-32768, 68, 14, 205, 14, 14,-32768, -3, 504,
395 14,-32768,-32768,-32768, 67, 228,-32768,-32768, 531,-32768,
396 -32768, 125, 126,-32768
399 static const short yypgoto
[] = {-32768,
400 -32768, 3, -5,-32768,-32768, -44, 12,-32768,-32768, -76,
401 -32768, 79,-32768, 11, 16, 1, 0, 113,-32768, 2,
409 static const short yytable
[] = { 46,
410 45, 181, 38, 84, 169, 57, 72, 206, 52, 53,
411 54, 55, 84, 84, 64, 65, 122, 188, 73, 74,
412 75, 76, 77, 78, 79, 130, 169, 131, 82, 83,
413 46, 81, 162, 165, 113, -66, 116, 129, 135, 46,
414 115, 170, 207, 136, 132, 120, 198, 48, 49, 50,
415 133, 48, 49, 50, 134, 46, 128, 121, 48, 49,
416 50, 210, 182, 59, 170, 122, 123, 107, 108, 109,
417 110, 111, 112, 191, 192, 60, 61, 62, 137, 138,
418 139, 140, 141, 142, 143, 144, 145, 146, 147, 148,
419 149, 150, 151, 152, 153, 154, 155, 156, 157, 158,
420 159, 51, 174, -97, 175, 51, 59, -68, 203, 208,
421 163, 166, 51, 167, 204, 175, 174, 173, 66, 67,
422 62, 117, 186, 199, 213, 214, 172, 68, 118, 119,
423 194, 0, 186, 193, 5, 189, 7, 8, 9, 10,
424 190, 12, 0, 14, 120, 15, 16, 17, 18, 19,
425 20, 21, 69, 0, 70, 196, 121, 71, 197, 0,
426 205, 0, 113, 200, 122, 123, 201, 118, 119, 0,
427 101, 102, 103, 104, 105, 106, 202, 107, 108, 109,
428 110, 111, 112, 120, 0, 194, 0, 186, 0, 209,
429 0, 0, 183, 0, 0, 121, 177, 178, 179, 180,
430 0, 184, 0, 122, 123, 186, 211, 1, 2, 3,
431 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
432 14, 0, 15, 16, 17, 18, 19, 20, 21, 22,
433 0, 23, 24, 25, 5, 0, 7, 8, 9, 10,
434 0, 12, 26, 14, 0, 15, 16, 17, 18, 19,
435 20, 21, 0, 27, 28, 0, 0, 0, 29, 30,
436 0, 0, 0, 31, 32, 33, 34, 35, 0, 0,
437 36, 1, 2, 3, 4, 5, 6, 7, 8, 9,
438 10, 11, 12, 13, 14, 0, 15, 16, 17, 18,
439 19, 20, 21, 22, 0, 23, 24, 25, 99, 100,
440 101, 102, 103, 104, 105, 106, 26, 107, 108, 109,
441 110, 111, 112, 0, 0, 0, 0, 27, 28, 0,
442 0, 0, 29, 30, 0, 0, 0, 56, 32, 33,
443 34, 35, 0, 0, 36, 1, 2, 3, 4, 5,
444 6, 7, 8, 9, 10, 11, 12, 13, 14, 0,
445 15, 16, 17, 18, 19, 20, 21, 22, 0, 23,
446 24, 25, 0, 0, 0, 5, 0, 7, 8, 9,
447 10, 0, 12, 0, 14, 0, 15, 16, 17, 18,
448 19, 20, 21, 0, 0, 0, 29, 30, 0, 0,
449 0, 31, 32, 33, 34, 35, 120, 0, 36, 0,
450 0, 0, 0, 102, 103, 104, 105, 106, 121, 107,
451 108, 109, 110, 111, 112, 0, 122, 123, 0, 0,
452 0, 0, 0, 183, 48, 160, 50, 7, 8, 9,
453 10, 0, 12, 0, 14, 0, 15, 16, 17, 18,
454 19, 20, 21, 48, 160, 50, 7, 8, 9, 10,
455 0, 12, 0, 14, 0, 15, 16, 17, 18, 19,
456 20, 21, 0, 0, 0, 104, 105, 106, 161, 107,
457 108, 109, 110, 111, 112, 0, 0, 0, 51, 0,
458 0, 0, 0, 0, 0, 0, 0, 164, 0, 0,
459 0, 0, 85, 0, 0, 0, 0, 51, 86, 87,
460 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
461 98, 99, 100, 101, 102, 103, 104, 105, 106, 0,
462 107, 108, 109, 110, 111, 112, 0, 0, 0, 85,
463 0, 0, 0, 0, 195, 86, 87, 88, 89, 90,
464 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
465 101, 102, 103, 104, 105, 106, 0, 107, 108, 109,
466 110, 111, 112, 87, 88, 89, 90, 91, 92, 93,
467 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
468 104, 105, 106, 0, 107, 108, 109, 110, 111, 112,
469 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
470 99, 100, 101, 102, 103, 104, 105, 106, 0, 107,
471 108, 109, 110, 111, 112, 90, 91, 92, 93, 94,
472 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
473 105, 106, 0, 107, 108, 109, 110, 111, 112, 91,
474 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
475 102, 103, 104, 105, 106, 0, 107, 108, 109, 110,
476 111, 112, 92, 93, 94, 95, 96, 97, 98, 99,
477 100, 101, 102, 103, 104, 105, 106, 0, 107, 108,
478 109, 110, 111, 112, 93, 94, 95, 96, 97, 98,
479 99, 100, 101, 102, 103, 104, 105, 106, 0, 107,
480 108, 109, 110, 111, 112, 95, 96, 97, 98, 99,
481 100, 101, 102, 103, 104, 105, 106, 0, 107, 108,
485 static const short yycheck
[] = { 0,
486 0, 3, 0, 30, 30, 11, 21, 30, 7, 8,
487 9, 10, 30, 30, 13, 14, 58, 59, 19, 20,
488 26, 27, 28, 29, 30, 19, 30, 21, 34, 35,
489 31, 31, 109, 110, 40, 15, 15, 15, 65, 40,
490 40, 67, 65, 65, 21, 38, 64, 6, 7, 8,
491 41, 6, 7, 8, 21, 56, 56, 50, 6, 7,
492 8, 65, 64, 7, 67, 58, 59, 54, 55, 56,
493 57, 58, 59, 65, 21, 19, 20, 21, 84, 85,
494 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
495 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
496 106, 60, 50, 15, 63, 60, 7, 15, 64, 42,
497 109, 110, 60, 111, 65, 63, 50, 116, 19, 20,
498 21, 15, 123, 168, 0, 0, 115, 15, 22, 23,
499 136, -1, 133, 133, 7, 125, 9, 10, 11, 12,
500 125, 14, -1, 16, 38, 18, 19, 20, 21, 22,
501 23, 24, 19, -1, 21, 161, 50, 24, 164, -1,
502 15, -1, 168, 169, 58, 59, 172, 22, 23, -1,
503 47, 48, 49, 50, 51, 52, 175, 54, 55, 56,
504 57, 58, 59, 38, -1, 191, -1, 188, -1, 195,
505 -1, -1, 65, -1, -1, 50, 118, 119, 120, 121,
506 -1, 123, -1, 58, 59, 206, 206, 3, 4, 5,
507 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
508 16, -1, 18, 19, 20, 21, 22, 23, 24, 25,
509 -1, 27, 28, 29, 7, -1, 9, 10, 11, 12,
510 -1, 14, 38, 16, -1, 18, 19, 20, 21, 22,
511 23, 24, -1, 49, 50, -1, -1, -1, 54, 55,
512 -1, -1, -1, 59, 60, 61, 62, 63, -1, -1,
513 66, 3, 4, 5, 6, 7, 8, 9, 10, 11,
514 12, 13, 14, 15, 16, -1, 18, 19, 20, 21,
515 22, 23, 24, 25, -1, 27, 28, 29, 45, 46,
516 47, 48, 49, 50, 51, 52, 38, 54, 55, 56,
517 57, 58, 59, -1, -1, -1, -1, 49, 50, -1,
518 -1, -1, 54, 55, -1, -1, -1, 59, 60, 61,
519 62, 63, -1, -1, 66, 3, 4, 5, 6, 7,
520 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
521 18, 19, 20, 21, 22, 23, 24, 25, -1, 27,
522 28, 29, -1, -1, -1, 7, -1, 9, 10, 11,
523 12, -1, 14, -1, 16, -1, 18, 19, 20, 21,
524 22, 23, 24, -1, -1, -1, 54, 55, -1, -1,
525 -1, 59, 60, 61, 62, 63, 38, -1, 66, -1,
526 -1, -1, -1, 48, 49, 50, 51, 52, 50, 54,
527 55, 56, 57, 58, 59, -1, 58, 59, -1, -1,
528 -1, -1, -1, 65, 6, 7, 8, 9, 10, 11,
529 12, -1, 14, -1, 16, -1, 18, 19, 20, 21,
530 22, 23, 24, 6, 7, 8, 9, 10, 11, 12,
531 -1, 14, -1, 16, -1, 18, 19, 20, 21, 22,
532 23, 24, -1, -1, -1, 50, 51, 52, 50, 54,
533 55, 56, 57, 58, 59, -1, -1, -1, 60, -1,
534 -1, -1, -1, -1, -1, -1, -1, 50, -1, -1,
535 -1, -1, 26, -1, -1, -1, -1, 60, 32, 33,
536 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
537 44, 45, 46, 47, 48, 49, 50, 51, 52, -1,
538 54, 55, 56, 57, 58, 59, -1, -1, -1, 26,
539 -1, -1, -1, -1, 68, 32, 33, 34, 35, 36,
540 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
541 47, 48, 49, 50, 51, 52, -1, 54, 55, 56,
542 57, 58, 59, 33, 34, 35, 36, 37, 38, 39,
543 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
544 50, 51, 52, -1, 54, 55, 56, 57, 58, 59,
545 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
546 45, 46, 47, 48, 49, 50, 51, 52, -1, 54,
547 55, 56, 57, 58, 59, 36, 37, 38, 39, 40,
548 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
549 51, 52, -1, 54, 55, 56, 57, 58, 59, 37,
550 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
551 48, 49, 50, 51, 52, -1, 54, 55, 56, 57,
552 58, 59, 38, 39, 40, 41, 42, 43, 44, 45,
553 46, 47, 48, 49, 50, 51, 52, -1, 54, 55,
554 56, 57, 58, 59, 39, 40, 41, 42, 43, 44,
555 45, 46, 47, 48, 49, 50, 51, 52, -1, 54,
556 55, 56, 57, 58, 59, 41, 42, 43, 44, 45,
557 46, 47, 48, 49, 50, 51, 52, -1, 54, 55,
560 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
561 #line 3 "/stone/jimb/main-98r2/share/bison.simple"
563 /* Skeleton output parser for bison,
564 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
566 This program is free software; you can redistribute it and/or modify
567 it under the terms of the GNU General Public License as published by
568 the Free Software Foundation; either version 2, or (at your option)
571 This program is distributed in the hope that it will be useful,
572 but WITHOUT ANY WARRANTY; without even the implied warranty of
573 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
574 GNU General Public License for more details.
576 You should have received a copy of the GNU General Public License
577 along with this program; if not, write to the Free Software
578 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
580 /* As a special exception, when this file is copied by Bison into a
581 Bison output file, you may use that output file without restriction.
582 This special exception was added by the Free Software Foundation
583 in version 1.24 of Bison. */
587 #define alloca __builtin_alloca
588 #else /* not GNU C. */
589 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
591 #else /* not sparc */
592 #if defined (MSDOS) && !defined (__TURBOC__)
593 #else /* not MSDOS, or __TURBOC__ */
596 #else /* not MSDOS, __TURBOC__, or _AIX */
600 void *alloca (unsigned int);
602 #else /* not __cplusplus */
604 #endif /* not __cplusplus */
606 #endif /* not _AIX */
607 #endif /* not MSDOS, or __TURBOC__ */
608 #endif /* not sparc. */
609 #endif /* not GNU C. */
610 #endif /* alloca not defined. */
612 /* This is the parser code that is written into each bison parser
613 when the %semantic_parser declaration is not specified in the grammar.
614 It was written by Richard Stallman by simplifying the hairy parser
615 used when %semantic_parser is specified. */
617 /* Note: there must be only one dollar sign in this file.
618 It is replaced by the list of actions, each action
619 as one case of the switch. */
621 #define yyerrok (yyerrstatus = 0)
622 #define yyclearin (yychar = YYEMPTY)
625 #define YYACCEPT return(0)
626 #define YYABORT return(1)
627 #define YYERROR goto yyerrlab1
628 /* Like YYERROR except do call yyerror.
629 This remains here temporarily to ease the
630 transition to the new meaning of YYERROR, for GCC.
631 Once GCC version 2 has supplanted version 1, this can go. */
632 #define YYFAIL goto yyerrlab
633 #define YYRECOVERING() (!!yyerrstatus)
634 #define YYBACKUP(token, value) \
636 if (yychar == YYEMPTY && yylen == 1) \
637 { yychar = (token), yylval = (value); \
638 yychar1 = YYTRANSLATE (yychar); \
643 { yyerror ("syntax error: cannot back up"); YYERROR; } \
647 #define YYERRCODE 256
650 #define YYLEX yylex()
656 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
658 #define YYLEX yylex(&yylval, &yylloc)
660 #else /* not YYLSP_NEEDED */
662 #define YYLEX yylex(&yylval, YYLEX_PARAM)
664 #define YYLEX yylex(&yylval)
666 #endif /* not YYLSP_NEEDED */
669 /* If nonreentrant, generate the variables here */
673 int yychar
; /* the lookahead symbol */
674 YYSTYPE yylval
; /* the semantic value of the */
675 /* lookahead symbol */
678 YYLTYPE yylloc
; /* location data for the lookahead */
682 int yynerrs
; /* number of parse errors so far */
683 #endif /* not YYPURE */
686 int yydebug
; /* nonzero means print parse trace */
687 /* Since this is uninitialized, it does not stop multiple parsers
691 /* YYINITDEPTH indicates the initial size of the parser's stacks */
694 #define YYINITDEPTH 200
697 /* YYMAXDEPTH is the maximum size the stacks can grow to
698 (effective only if the built-in stack extension method is used). */
705 #define YYMAXDEPTH 10000
708 /* Prevent warning if -Wstrict-prototypes. */
713 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
714 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
715 #else /* not GNU C or C++ */
718 /* This is the most reliable way to avoid incompatibilities
719 in available built-in functions on various systems. */
721 __yy_memcpy (to
, from
, count
)
726 register char *f
= from
;
727 register char *t
= to
;
728 register int i
= count
;
734 #else /* __cplusplus */
736 /* This is the most reliable way to avoid incompatibilities
737 in available built-in functions on various systems. */
739 __yy_memcpy (char *to
, char *from
, int count
)
741 register char *f
= from
;
742 register char *t
= to
;
743 register int i
= count
;
752 #line 196 "/stone/jimb/main-98r2/share/bison.simple"
754 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
755 into yyparse. The argument should have type void *.
756 It should actually point to an object.
757 Grammar actions can access the variable by casting it
758 to the proper pointer type. */
762 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
763 #define YYPARSE_PARAM_DECL
764 #else /* not __cplusplus */
765 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
766 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
767 #endif /* not __cplusplus */
768 #else /* not YYPARSE_PARAM */
769 #define YYPARSE_PARAM_ARG
770 #define YYPARSE_PARAM_DECL
771 #endif /* not YYPARSE_PARAM */
774 yyparse(YYPARSE_PARAM_ARG
)
777 register int yystate
;
779 register short *yyssp
;
780 register YYSTYPE
*yyvsp
;
781 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
782 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
784 short yyssa
[YYINITDEPTH
]; /* the state stack */
785 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
787 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
788 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to xreallocate them elsewhere */
791 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
792 YYLTYPE
*yyls
= yylsa
;
795 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
797 #define YYPOPSTACK (yyvsp--, yyssp--)
800 int yystacksize
= YYINITDEPTH
;
811 YYSTYPE yyval
; /* the variable used to return */
812 /* semantic values from the action */
819 fprintf(stderr
, "Starting parse\n");
825 yychar
= YYEMPTY
; /* Cause a token to be read. */
827 /* Initialize stack pointers.
828 Waste one element of value and location stack
829 so that they stay on the same level as the state stack.
830 The wasted elements are never initialized. */
838 /* Push a new state, which is found in yystate . */
839 /* In all cases, when you get here, the value and location stacks
840 have just been pushed. so pushing a state here evens the stacks. */
845 if (yyssp
>= yyss
+ yystacksize
- 1)
847 /* Give user a chance to xreallocate the stack */
848 /* Use copies of these so that the &'s don't force the real ones into memory. */
849 YYSTYPE
*yyvs1
= yyvs
;
852 YYLTYPE
*yyls1
= yyls
;
855 /* Get the current used size of the three stacks, in elements. */
856 int size
= yyssp
- yyss
+ 1;
859 /* Each stack pointer address is followed by the size of
860 the data in use in that stack, in bytes. */
862 /* This used to be a conditional around just the two extra args,
863 but that might be undefined if yyoverflow is a macro. */
864 yyoverflow("parser stack overflow",
865 &yyss1
, size
* sizeof (*yyssp
),
866 &yyvs1
, size
* sizeof (*yyvsp
),
867 &yyls1
, size
* sizeof (*yylsp
),
870 yyoverflow("parser stack overflow",
871 &yyss1
, size
* sizeof (*yyssp
),
872 &yyvs1
, size
* sizeof (*yyvsp
),
876 yyss
= yyss1
; yyvs
= yyvs1
;
880 #else /* no yyoverflow */
881 /* Extend the stack our own way. */
882 if (yystacksize
>= YYMAXDEPTH
)
884 yyerror("parser stack overflow");
888 if (yystacksize
> YYMAXDEPTH
)
889 yystacksize
= YYMAXDEPTH
;
890 yyss
= (short *) alloca (yystacksize
* sizeof (*yyssp
));
891 __yy_memcpy ((char *)yyss
, (char *)yyss1
, size
* sizeof (*yyssp
));
892 yyvs
= (YYSTYPE
*) alloca (yystacksize
* sizeof (*yyvsp
));
893 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
, size
* sizeof (*yyvsp
));
895 yyls
= (YYLTYPE
*) alloca (yystacksize
* sizeof (*yylsp
));
896 __yy_memcpy ((char *)yyls
, (char *)yyls1
, size
* sizeof (*yylsp
));
898 #endif /* no yyoverflow */
900 yyssp
= yyss
+ size
- 1;
901 yyvsp
= yyvs
+ size
- 1;
903 yylsp
= yyls
+ size
- 1;
908 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
911 if (yyssp
>= yyss
+ yystacksize
- 1)
917 fprintf(stderr
, "Entering state %d\n", yystate
);
923 /* Do appropriate processing given the current state. */
924 /* Read a lookahead token if we need one and don't already have one. */
927 /* First try to decide what to do without reference to lookahead token. */
929 yyn
= yypact
[yystate
];
933 /* Not known => get a lookahead token if don't already have one. */
935 /* yychar is either YYEMPTY or YYEOF
936 or a valid token in external form. */
938 if (yychar
== YYEMPTY
)
942 fprintf(stderr
, "Reading a token: ");
947 /* Convert token to internal form (in yychar1) for indexing tables with */
949 if (yychar
<= 0) /* This means end of input. */
952 yychar
= YYEOF
; /* Don't call YYLEX any more */
956 fprintf(stderr
, "Now at end of input.\n");
961 yychar1
= YYTRANSLATE(yychar
);
966 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
967 /* Give the individual parser a way to print the precise meaning
968 of a token, for further debugging info. */
970 YYPRINT (stderr
, yychar
, yylval
);
972 fprintf (stderr
, ")\n");
978 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
983 /* yyn is what to do for this token type in this state.
984 Negative => reduce, -yyn is rule number.
985 Positive => shift, yyn is new state.
986 New state is final state => don't bother to shift,
988 0, or most negative number => error. */
1003 /* Shift the lookahead token. */
1007 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
1010 /* Discard the token being shifted unless it is eof. */
1011 if (yychar
!= YYEOF
)
1019 /* count tokens shifted since error; after three, turn off error status. */
1020 if (yyerrstatus
) yyerrstatus
--;
1025 /* Do the default action for the current state. */
1028 yyn
= yydefact
[yystate
];
1032 /* Do a reduction. yyn is the number of a rule to reduce with. */
1036 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
1043 fprintf (stderr
, "Reducing via rule %d (line %d), ",
1046 /* Print the symbols being reduced, and their result. */
1047 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
1048 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
1049 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
1058 { write_exp_elt_opcode(OP_TYPE
);
1059 write_exp_elt_type(yyvsp
[0].tval
);
1060 write_exp_elt_opcode(OP_TYPE
);;
1064 { write_exp_elt_opcode (BINOP_COMMA
); ;
1068 { write_exp_elt_opcode (UNOP_IND
); ;
1072 { write_exp_elt_opcode (UNOP_ADDR
); ;
1076 { write_exp_elt_opcode (UNOP_NEG
); ;
1080 { write_exp_elt_opcode (UNOP_LOGICAL_NOT
); ;
1084 { write_exp_elt_opcode (UNOP_COMPLEMENT
); ;
1088 { write_exp_elt_opcode (UNOP_PREINCREMENT
); ;
1092 { write_exp_elt_opcode (UNOP_PREDECREMENT
); ;
1096 { write_exp_elt_opcode (UNOP_POSTINCREMENT
); ;
1100 { write_exp_elt_opcode (UNOP_POSTDECREMENT
); ;
1104 { write_exp_elt_opcode (UNOP_SIZEOF
); ;
1108 { write_exp_elt_opcode (STRUCTOP_PTR
);
1109 write_exp_string (yyvsp
[0].sval
);
1110 write_exp_elt_opcode (STRUCTOP_PTR
); ;
1114 { /* exp->type::name becomes exp->*(&type::name) */
1115 /* Note: this doesn't work if name is a
1116 static member! FIXME */
1117 write_exp_elt_opcode (UNOP_ADDR
);
1118 write_exp_elt_opcode (STRUCTOP_MPTR
); ;
1122 { write_exp_elt_opcode (STRUCTOP_MPTR
); ;
1126 { write_exp_elt_opcode (STRUCTOP_STRUCT
);
1127 write_exp_string (yyvsp
[0].sval
);
1128 write_exp_elt_opcode (STRUCTOP_STRUCT
); ;
1132 { /* exp.type::name becomes exp.*(&type::name) */
1133 /* Note: this doesn't work if name is a
1134 static member! FIXME */
1135 write_exp_elt_opcode (UNOP_ADDR
);
1136 write_exp_elt_opcode (STRUCTOP_MEMBER
); ;
1140 { write_exp_elt_opcode (STRUCTOP_MEMBER
); ;
1144 { write_exp_elt_opcode (BINOP_SUBSCRIPT
); ;
1148 { start_arglist (); ;
1152 { write_exp_elt_opcode (OP_FUNCALL
);
1153 write_exp_elt_longcst ((LONGEST
) end_arglist ());
1154 write_exp_elt_opcode (OP_FUNCALL
); ;
1158 { start_arglist (); ;
1162 { arglist_len
= 1; ;
1170 { yyval
.lval
= end_arglist () - 1; ;
1174 { write_exp_elt_opcode (OP_ARRAY
);
1175 write_exp_elt_longcst ((LONGEST
) 0);
1176 write_exp_elt_longcst ((LONGEST
) yyvsp
[0].lval
);
1177 write_exp_elt_opcode (OP_ARRAY
); ;
1181 { write_exp_elt_opcode (UNOP_MEMVAL
);
1182 write_exp_elt_type (yyvsp
[-2].tval
);
1183 write_exp_elt_opcode (UNOP_MEMVAL
); ;
1187 { write_exp_elt_opcode (UNOP_CAST
);
1188 write_exp_elt_type (yyvsp
[-2].tval
);
1189 write_exp_elt_opcode (UNOP_CAST
); ;
1197 { write_exp_elt_opcode (BINOP_REPEAT
); ;
1201 { write_exp_elt_opcode (BINOP_MUL
); ;
1205 { write_exp_elt_opcode (BINOP_DIV
); ;
1209 { write_exp_elt_opcode (BINOP_REM
); ;
1213 { write_exp_elt_opcode (BINOP_ADD
); ;
1217 { write_exp_elt_opcode (BINOP_SUB
); ;
1221 { write_exp_elt_opcode (BINOP_LSH
); ;
1225 { write_exp_elt_opcode (BINOP_RSH
); ;
1229 { write_exp_elt_opcode (BINOP_EQUAL
); ;
1233 { write_exp_elt_opcode (BINOP_NOTEQUAL
); ;
1237 { write_exp_elt_opcode (BINOP_LEQ
); ;
1241 { write_exp_elt_opcode (BINOP_GEQ
); ;
1245 { write_exp_elt_opcode (BINOP_LESS
); ;
1249 { write_exp_elt_opcode (BINOP_GTR
); ;
1253 { write_exp_elt_opcode (BINOP_BITWISE_AND
); ;
1257 { write_exp_elt_opcode (BINOP_BITWISE_XOR
); ;
1261 { write_exp_elt_opcode (BINOP_BITWISE_IOR
); ;
1265 { write_exp_elt_opcode (BINOP_LOGICAL_AND
); ;
1269 { write_exp_elt_opcode (BINOP_LOGICAL_OR
); ;
1273 { write_exp_elt_opcode (TERNOP_COND
); ;
1277 { write_exp_elt_opcode (BINOP_ASSIGN
); ;
1281 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY
);
1282 write_exp_elt_opcode (yyvsp
[-1].opcode
);
1283 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY
); ;
1287 { write_exp_elt_opcode (OP_LONG
);
1288 write_exp_elt_type (yyvsp
[0].typed_val_int
.type
);
1289 write_exp_elt_longcst ((LONGEST
)(yyvsp
[0].typed_val_int
.val
));
1290 write_exp_elt_opcode (OP_LONG
); ;
1295 parse_number (yyvsp
[0].ssym
.stoken
.ptr
, yyvsp
[0].ssym
.stoken
.length
, 0, &val
);
1296 write_exp_elt_opcode (OP_LONG
);
1297 write_exp_elt_type (val
.typed_val_int
.type
);
1298 write_exp_elt_longcst ((LONGEST
)val
.typed_val_int
.val
);
1299 write_exp_elt_opcode (OP_LONG
);
1304 { write_exp_elt_opcode (OP_DOUBLE
);
1305 write_exp_elt_type (yyvsp
[0].typed_val_float
.type
);
1306 write_exp_elt_dblcst (yyvsp
[0].typed_val_float
.dval
);
1307 write_exp_elt_opcode (OP_DOUBLE
); ;
1311 { write_exp_elt_opcode (OP_LONG
);
1312 write_exp_elt_type (builtin_type_int
);
1313 CHECK_TYPEDEF (yyvsp
[-1].tval
);
1314 write_exp_elt_longcst ((LONGEST
) TYPE_LENGTH (yyvsp
[-1].tval
));
1315 write_exp_elt_opcode (OP_LONG
); ;
1319 { /* C strings are converted into array constants with
1320 an explicit null byte added at the end. Thus
1321 the array upper bound is the string length.
1322 There is no such thing in C as a completely empty
1324 char *sp
= yyvsp
[0].sval
.ptr
; int count
= yyvsp
[0].sval
.length
;
1327 write_exp_elt_opcode (OP_LONG
);
1328 write_exp_elt_type (builtin_type_char
);
1329 write_exp_elt_longcst ((LONGEST
)(*sp
++));
1330 write_exp_elt_opcode (OP_LONG
);
1332 write_exp_elt_opcode (OP_LONG
);
1333 write_exp_elt_type (builtin_type_char
);
1334 write_exp_elt_longcst ((LONGEST
)'\0');
1335 write_exp_elt_opcode (OP_LONG
);
1336 write_exp_elt_opcode (OP_ARRAY
);
1337 write_exp_elt_longcst ((LONGEST
) 0);
1338 write_exp_elt_longcst ((LONGEST
) (yyvsp
[0].sval
.length
));
1339 write_exp_elt_opcode (OP_ARRAY
); ;
1343 { write_exp_elt_opcode (OP_THIS
);
1344 write_exp_elt_opcode (OP_THIS
); ;
1348 { write_exp_elt_opcode (OP_LONG
);
1349 write_exp_elt_type (builtin_type_bool
);
1350 write_exp_elt_longcst ((LONGEST
) 1);
1351 write_exp_elt_opcode (OP_LONG
); ;
1355 { write_exp_elt_opcode (OP_LONG
);
1356 write_exp_elt_type (builtin_type_bool
);
1357 write_exp_elt_longcst ((LONGEST
) 0);
1358 write_exp_elt_opcode (OP_LONG
); ;
1363 if (yyvsp
[0].ssym
.sym
)
1364 yyval
.bval
= SYMBOL_BLOCK_VALUE (yyvsp
[0].ssym
.sym
);
1366 error ("No file or function \"%s\".",
1367 copy_name (yyvsp
[0].ssym
.stoken
));
1373 yyval
.bval
= yyvsp
[0].bval
;
1378 { struct symbol
*tem
1379 = lookup_symbol (copy_name (yyvsp
[0].sval
), yyvsp
[-2].bval
,
1380 VAR_NAMESPACE
, (int *) NULL
,
1381 (struct symtab
**) NULL
);
1382 if (!tem
|| SYMBOL_CLASS (tem
) != LOC_BLOCK
)
1383 error ("No function \"%s\" in specified context.",
1384 copy_name (yyvsp
[0].sval
));
1385 yyval
.bval
= SYMBOL_BLOCK_VALUE (tem
); ;
1389 { struct symbol
*sym
;
1390 sym
= lookup_symbol (copy_name (yyvsp
[0].sval
), yyvsp
[-2].bval
,
1391 VAR_NAMESPACE
, (int *) NULL
,
1392 (struct symtab
**) NULL
);
1394 error ("No symbol \"%s\" in specified context.",
1395 copy_name (yyvsp
[0].sval
));
1397 write_exp_elt_opcode (OP_VAR_VALUE
);
1398 /* block_found is set by lookup_symbol. */
1399 write_exp_elt_block (block_found
);
1400 write_exp_elt_sym (sym
);
1401 write_exp_elt_opcode (OP_VAR_VALUE
); ;
1406 struct type
*type
= yyvsp
[-2].tval
;
1407 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1408 && TYPE_CODE (type
) != TYPE_CODE_UNION
)
1409 error ("`%s' is not defined as an aggregate type.",
1412 write_exp_elt_opcode (OP_SCOPE
);
1413 write_exp_elt_type (type
);
1414 write_exp_string (yyvsp
[0].sval
);
1415 write_exp_elt_opcode (OP_SCOPE
);
1421 struct type
*type
= yyvsp
[-3].tval
;
1422 struct stoken tmp_token
;
1423 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1424 && TYPE_CODE (type
) != TYPE_CODE_UNION
)
1425 error ("`%s' is not defined as an aggregate type.",
1428 tmp_token
.ptr
= (char*) alloca (yyvsp
[0].sval
.length
+ 2);
1429 tmp_token
.length
= yyvsp
[0].sval
.length
+ 1;
1430 tmp_token
.ptr
[0] = '~';
1431 memcpy (tmp_token
.ptr
+1, yyvsp
[0].sval
.ptr
, yyvsp
[0].sval
.length
);
1432 tmp_token
.ptr
[tmp_token
.length
] = 0;
1434 /* Check for valid destructor name. */
1435 destructor_name_p (tmp_token
.ptr
, type
);
1436 write_exp_elt_opcode (OP_SCOPE
);
1437 write_exp_elt_type (type
);
1438 write_exp_string (tmp_token
);
1439 write_exp_elt_opcode (OP_SCOPE
);
1445 char *name
= copy_name (yyvsp
[0].sval
);
1447 struct minimal_symbol
*msymbol
;
1450 lookup_symbol (name
, (const struct block
*) NULL
,
1451 VAR_NAMESPACE
, (int *) NULL
,
1452 (struct symtab
**) NULL
);
1455 write_exp_elt_opcode (OP_VAR_VALUE
);
1456 write_exp_elt_block (NULL
);
1457 write_exp_elt_sym (sym
);
1458 write_exp_elt_opcode (OP_VAR_VALUE
);
1462 msymbol
= lookup_minimal_symbol (name
, NULL
, NULL
);
1463 if (msymbol
!= NULL
)
1465 write_exp_msymbol (msymbol
,
1466 lookup_function_type (builtin_type_int
),
1470 if (!have_full_symbols () && !have_partial_symbols ())
1471 error ("No symbol table is loaded. Use the \"file\" command.");
1473 error ("No symbol \"%s\" in current context.", name
);
1478 { struct symbol
*sym
= yyvsp
[0].ssym
.sym
;
1482 if (symbol_read_needs_frame (sym
))
1484 if (innermost_block
== 0 ||
1485 contained_in (block_found
,
1487 innermost_block
= block_found
;
1490 write_exp_elt_opcode (OP_VAR_VALUE
);
1491 /* We want to use the selected frame, not
1492 another more inner frame which happens to
1493 be in the same block. */
1494 write_exp_elt_block (NULL
);
1495 write_exp_elt_sym (sym
);
1496 write_exp_elt_opcode (OP_VAR_VALUE
);
1498 else if (yyvsp
[0].ssym
.is_a_field_of_this
)
1500 /* C++: it hangs off of `this'. Must
1501 not inadvertently convert from a method call
1503 if (innermost_block
== 0 ||
1504 contained_in (block_found
, innermost_block
))
1505 innermost_block
= block_found
;
1506 write_exp_elt_opcode (OP_THIS
);
1507 write_exp_elt_opcode (OP_THIS
);
1508 write_exp_elt_opcode (STRUCTOP_PTR
);
1509 write_exp_string (yyvsp
[0].ssym
.stoken
);
1510 write_exp_elt_opcode (STRUCTOP_PTR
);
1514 struct minimal_symbol
*msymbol
;
1515 register char *arg
= copy_name (yyvsp
[0].ssym
.stoken
);
1518 lookup_minimal_symbol (arg
, NULL
, NULL
);
1519 if (msymbol
!= NULL
)
1521 write_exp_msymbol (msymbol
,
1522 lookup_function_type (builtin_type_int
),
1525 else if (!have_full_symbols () && !have_partial_symbols ())
1526 error ("No symbol table is loaded. Use the \"file\" command.");
1528 error ("No symbol \"%s\" in current context.",
1529 copy_name (yyvsp
[0].ssym
.stoken
));
1535 { yyval
.tval
= follow_types (yyvsp
[-1].tval
); ;
1539 { yyval
.tval
= follow_types (yyvsp
[-2].tval
); ;
1543 { yyval
.tval
= follow_types (yyvsp
[-2].tval
); ;
1547 { push_type (tp_pointer
); yyval
.voidval
= 0; ;
1551 { push_type (tp_pointer
); yyval
.voidval
= yyvsp
[0].voidval
; ;
1555 { push_type (tp_reference
); yyval
.voidval
= 0; ;
1559 { push_type (tp_reference
); yyval
.voidval
= yyvsp
[0].voidval
; ;
1563 { yyval
.voidval
= yyvsp
[-1].voidval
; ;
1568 push_type_int (yyvsp
[0].lval
);
1569 push_type (tp_array
);
1575 push_type_int (yyvsp
[0].lval
);
1576 push_type (tp_array
);
1582 { push_type (tp_function
); ;
1586 { push_type (tp_function
); ;
1590 { yyval
.lval
= -1; ;
1594 { yyval
.lval
= yyvsp
[-1].typed_val_int
.val
; ;
1598 { yyval
.voidval
= 0; ;
1602 { free ((PTR
)yyvsp
[-1].tvec
); yyval
.voidval
= 0; ;
1606 { yyval
.tval
= lookup_member_type (builtin_type_int
, yyvsp
[-2].tval
); ;
1610 { yyval
.tval
= yyvsp
[0].tsym
.type
; ;
1614 { yyval
.tval
= builtin_type_int
; ;
1618 { yyval
.tval
= builtin_type_long
; ;
1622 { yyval
.tval
= builtin_type_short
; ;
1626 { yyval
.tval
= builtin_type_long
; ;
1630 { yyval
.tval
= builtin_type_unsigned_long
; ;
1634 { yyval
.tval
= builtin_type_long_long
; ;
1638 { yyval
.tval
= builtin_type_long_long
; ;
1642 { yyval
.tval
= builtin_type_unsigned_long_long
; ;
1646 { yyval
.tval
= builtin_type_unsigned_long_long
; ;
1650 { yyval
.tval
= builtin_type_short
; ;
1654 { yyval
.tval
= builtin_type_unsigned_short
; ;
1658 { yyval
.tval
= builtin_type_double
; ;
1662 { yyval
.tval
= builtin_type_long_double
; ;
1666 { yyval
.tval
= lookup_struct (copy_name (yyvsp
[0].sval
),
1667 expression_context_block
); ;
1671 { yyval
.tval
= lookup_struct (copy_name (yyvsp
[0].sval
),
1672 expression_context_block
); ;
1676 { yyval
.tval
= lookup_union (copy_name (yyvsp
[0].sval
),
1677 expression_context_block
); ;
1681 { yyval
.tval
= lookup_enum (copy_name (yyvsp
[0].sval
),
1682 expression_context_block
); ;
1686 { yyval
.tval
= lookup_unsigned_typename (TYPE_NAME(yyvsp
[0].tsym
.type
)); ;
1690 { yyval
.tval
= builtin_type_unsigned_int
; ;
1694 { yyval
.tval
= lookup_signed_typename (TYPE_NAME(yyvsp
[0].tsym
.type
)); ;
1698 { yyval
.tval
= builtin_type_int
; ;
1702 { yyval
.tval
= lookup_template_type(copy_name(yyvsp
[-3].sval
), yyvsp
[-1].tval
,
1703 expression_context_block
);
1708 { yyval
.tval
= yyvsp
[0].tval
; ;
1712 { yyval
.tval
= yyvsp
[0].tval
; ;
1717 yyval
.tsym
.stoken
.ptr
= "int";
1718 yyval
.tsym
.stoken
.length
= 3;
1719 yyval
.tsym
.type
= builtin_type_int
;
1725 yyval
.tsym
.stoken
.ptr
= "long";
1726 yyval
.tsym
.stoken
.length
= 4;
1727 yyval
.tsym
.type
= builtin_type_long
;
1733 yyval
.tsym
.stoken
.ptr
= "short";
1734 yyval
.tsym
.stoken
.length
= 5;
1735 yyval
.tsym
.type
= builtin_type_short
;
1740 { yyval
.tvec
= (struct type
**) xmalloc (sizeof (struct type
*) * 2);
1741 yyval
.ivec
[0] = 1; /* Number of types in vector */
1742 yyval
.tvec
[1] = yyvsp
[0].tval
;
1747 { int len
= sizeof (struct type
*) * (++(yyvsp
[-2].ivec
[0]) + 1);
1748 yyval
.tvec
= (struct type
**) xrealloc ((char *) yyvsp
[-2].tvec
, len
);
1749 yyval
.tvec
[yyval
.ivec
[0]] = yyvsp
[0].tval
;
1754 { yyval
.sval
= yyvsp
[0].ssym
.stoken
; ;
1758 { yyval
.sval
= yyvsp
[0].ssym
.stoken
; ;
1762 { yyval
.sval
= yyvsp
[0].tsym
.stoken
; ;
1766 { yyval
.sval
= yyvsp
[0].ssym
.stoken
; ;
1769 /* the action file gets copied in in place of this dollarsign */
1770 #line 498 "/stone/jimb/main-98r2/share/bison.simple"
1781 short *ssp1
= yyss
- 1;
1782 fprintf (stderr
, "state stack now");
1783 while (ssp1
!= yyssp
)
1784 fprintf (stderr
, " %d", *++ssp1
);
1785 fprintf (stderr
, "\n");
1795 yylsp
->first_line
= yylloc
.first_line
;
1796 yylsp
->first_column
= yylloc
.first_column
;
1797 yylsp
->last_line
= (yylsp
-1)->last_line
;
1798 yylsp
->last_column
= (yylsp
-1)->last_column
;
1803 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
1804 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
1808 /* Now "shift" the result of the reduction.
1809 Determine what state that goes to,
1810 based on the state we popped back to
1811 and the rule number reduced by. */
1815 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
1816 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
1817 yystate
= yytable
[yystate
];
1819 yystate
= yydefgoto
[yyn
- YYNTBASE
];
1823 yyerrlab
: /* here on detecting error */
1826 /* If not already recovering from an error, report this error. */
1830 #ifdef YYERROR_VERBOSE
1831 yyn
= yypact
[yystate
];
1833 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
1840 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1841 for (x
= (yyn
< 0 ? -yyn
: 0);
1842 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1843 if (yycheck
[x
+ yyn
] == x
)
1844 size
+= strlen(yytname
[x
]) + 15, count
++;
1845 msg
= (char *) xmalloc(size
+ 15);
1848 strcpy(msg
, "parse error");
1853 for (x
= (yyn
< 0 ? -yyn
: 0);
1854 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
1855 if (yycheck
[x
+ yyn
] == x
)
1857 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
1858 strcat(msg
, yytname
[x
]);
1867 yyerror ("parse error; also virtual memory exceeded");
1870 #endif /* YYERROR_VERBOSE */
1871 yyerror("parse error");
1875 yyerrlab1
: /* here on error raised explicitly by an action */
1877 if (yyerrstatus
== 3)
1879 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1881 /* return failure if at end of input */
1882 if (yychar
== YYEOF
)
1887 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
1893 /* Else will try to reuse lookahead token
1894 after shifting the error token. */
1896 yyerrstatus
= 3; /* Each real token shifted decrements this */
1900 yyerrdefault
: /* current state does not do anything special for the error token. */
1903 /* This is wrong; only states that explicitly want error tokens
1904 should shift them. */
1905 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1906 if (yyn
) goto yydefault
;
1909 yyerrpop
: /* pop the current state because it cannot handle the error token */
1911 if (yyssp
== yyss
) YYABORT
;
1921 short *ssp1
= yyss
- 1;
1922 fprintf (stderr
, "Error: state stack now");
1923 while (ssp1
!= yyssp
)
1924 fprintf (stderr
, " %d", *++ssp1
);
1925 fprintf (stderr
, "\n");
1931 yyn
= yypact
[yystate
];
1936 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1955 fprintf(stderr
, "Shifting error token, ");
1969 /* Take care of parsing a number (anything that starts with a digit).
1970 Set yylval and return the token type; update lexptr.
1971 LEN is the number of characters in it. */
1973 /*** Needs some error checking for the float case ***/
1976 parse_number (p
, len
, parsed_float
, putithere
)
1982 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
1983 here, and we do kind of silly things like cast to unsigned. */
1984 register LONGEST n
= 0;
1985 register LONGEST prevn
= 0;
1990 register int base
= input_radix
;
1993 /* Number of "L" suffixes encountered. */
1996 /* We have found a "L" or "U" suffix. */
1997 int found_suffix
= 0;
2000 struct type
*signed_type
;
2001 struct type
*unsigned_type
;
2005 /* It's a float since it contains a point or an exponent. */
2007 int num
= 0; /* number of tokens scanned by scanf */
2008 char saved_char
= p
[len
];
2010 p
[len
] = 0; /* null-terminate the token */
2011 if (sizeof (putithere
->typed_val_float
.dval
) <= sizeof (float))
2012 num
= sscanf (p
, "%g%c", (float *) &putithere
->typed_val_float
.dval
,&c
);
2013 else if (sizeof (putithere
->typed_val_float
.dval
) <= sizeof (double))
2014 num
= sscanf (p
, "%lg%c", (double *) &putithere
->typed_val_float
.dval
,&c
);
2017 #ifdef SCANF_HAS_LONG_DOUBLE
2018 num
= sscanf (p
, "%Lg%c", &putithere
->typed_val_float
.dval
,&c
);
2020 /* Scan it into a double, then assign it to the long double.
2021 This at least wins with values representable in the range
2024 num
= sscanf (p
, "%lg%c", &temp
,&c
);
2025 putithere
->typed_val_float
.dval
= temp
;
2028 p
[len
] = saved_char
; /* restore the input stream */
2029 if (num
!= 1) /* check scanf found ONLY a float ... */
2031 /* See if it has `f' or `l' suffix (float or long double). */
2033 c
= tolower (p
[len
- 1]);
2036 putithere
->typed_val_float
.type
= builtin_type_float
;
2038 putithere
->typed_val_float
.type
= builtin_type_long_double
;
2039 else if (isdigit (c
) || c
== '.')
2040 putithere
->typed_val_float
.type
= builtin_type_double
;
2047 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2081 if (c
>= 'A' && c
<= 'Z')
2083 if (c
!= 'l' && c
!= 'u')
2085 if (c
>= '0' && c
<= '9')
2093 if (base
> 10 && c
>= 'a' && c
<= 'f')
2097 n
+= i
= c
- 'a' + 10;
2110 return ERROR
; /* Char not a digit */
2113 return ERROR
; /* Invalid digit in this base */
2115 /* Portably test for overflow (only works for nonzero values, so make
2116 a second check for zero). FIXME: Can't we just make n and prevn
2117 unsigned and avoid this? */
2118 if (c
!= 'l' && c
!= 'u' && (prevn
>= n
) && n
!= 0)
2119 unsigned_p
= 1; /* Try something unsigned */
2121 /* Portably test for unsigned overflow.
2122 FIXME: This check is wrong; for example it doesn't find overflow
2123 on 0x123456789 when LONGEST is 32 bits. */
2124 if (c
!= 'l' && c
!= 'u' && n
!= 0)
2126 if ((unsigned_p
&& (ULONGEST
) prevn
>= (ULONGEST
) n
))
2127 error ("Numeric constant too large.");
2132 /* An integer constant is an int, a long, or a long long. An L
2133 suffix forces it to be long; an LL suffix forces it to be long
2134 long. If not forced to a larger size, it gets the first type of
2135 the above that it fits in. To figure out whether it fits, we
2136 shift it right and see whether anything remains. Note that we
2137 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2138 operation, because many compilers will warn about such a shift
2139 (which always produces a zero result). Sometimes TARGET_INT_BIT
2140 or TARGET_LONG_BIT will be that big, sometimes not. To deal with
2141 the case where it is we just always shift the value more than
2142 once, with fewer bits each time. */
2144 un
= (ULONGEST
)n
>> 2;
2146 && (un
>> (TARGET_INT_BIT
- 2)) == 0)
2148 high_bit
= ((ULONGEST
)1) << (TARGET_INT_BIT
-1);
2150 /* A large decimal (not hex or octal) constant (between INT_MAX
2151 and UINT_MAX) is a long or unsigned long, according to ANSI,
2152 never an unsigned int, but this code treats it as unsigned
2153 int. This probably should be fixed. GCC gives a warning on
2156 unsigned_type
= builtin_type_unsigned_int
;
2157 signed_type
= builtin_type_int
;
2159 else if (long_p
<= 1
2160 && (un
>> (TARGET_LONG_BIT
- 2)) == 0)
2162 high_bit
= ((ULONGEST
)1) << (TARGET_LONG_BIT
-1);
2163 unsigned_type
= builtin_type_unsigned_long
;
2164 signed_type
= builtin_type_long
;
2169 if (sizeof (ULONGEST
) * HOST_CHAR_BIT
< TARGET_LONG_LONG_BIT
)
2170 /* A long long does not fit in a LONGEST. */
2171 shift
= (sizeof (ULONGEST
) * HOST_CHAR_BIT
- 1);
2173 shift
= (TARGET_LONG_LONG_BIT
- 1);
2174 high_bit
= (ULONGEST
) 1 << shift
;
2175 unsigned_type
= builtin_type_unsigned_long_long
;
2176 signed_type
= builtin_type_long_long
;
2179 putithere
->typed_val_int
.val
= n
;
2181 /* If the high bit of the worked out type is set then this number
2182 has to be unsigned. */
2184 if (unsigned_p
|| (n
& high_bit
))
2186 putithere
->typed_val_int
.type
= unsigned_type
;
2190 putithere
->typed_val_int
.type
= signed_type
;
2200 enum exp_opcode opcode
;
2203 static const struct token tokentab3
[] =
2205 {">>=", ASSIGN_MODIFY
, BINOP_RSH
},
2206 {"<<=", ASSIGN_MODIFY
, BINOP_LSH
}
2209 static const struct token tokentab2
[] =
2211 {"+=", ASSIGN_MODIFY
, BINOP_ADD
},
2212 {"-=", ASSIGN_MODIFY
, BINOP_SUB
},
2213 {"*=", ASSIGN_MODIFY
, BINOP_MUL
},
2214 {"/=", ASSIGN_MODIFY
, BINOP_DIV
},
2215 {"%=", ASSIGN_MODIFY
, BINOP_REM
},
2216 {"|=", ASSIGN_MODIFY
, BINOP_BITWISE_IOR
},
2217 {"&=", ASSIGN_MODIFY
, BINOP_BITWISE_AND
},
2218 {"^=", ASSIGN_MODIFY
, BINOP_BITWISE_XOR
},
2219 {"++", INCREMENT
, BINOP_END
},
2220 {"--", DECREMENT
, BINOP_END
},
2221 {"->", ARROW
, BINOP_END
},
2222 {"&&", ANDAND
, BINOP_END
},
2223 {"||", OROR
, BINOP_END
},
2224 {"::", COLONCOLON
, BINOP_END
},
2225 {"<<", LSH
, BINOP_END
},
2226 {">>", RSH
, BINOP_END
},
2227 {"==", EQUAL
, BINOP_END
},
2228 {"!=", NOTEQUAL
, BINOP_END
},
2229 {"<=", LEQ
, BINOP_END
},
2230 {">=", GEQ
, BINOP_END
}
2233 /* Read one token, getting characters through lexptr. */
2244 static char *tempbuf
;
2245 static int tempbufsize
;
2246 struct symbol
* sym_class
= NULL
;
2247 char * token_string
= NULL
;
2248 int class_prefix
= 0;
2256 /* See if it is a special token of length 3. */
2257 for (i
= 0; i
< sizeof tokentab3
/ sizeof tokentab3
[0]; i
++)
2258 if (STREQN (tokstart
, tokentab3
[i
].operator, 3))
2261 yylval
.opcode
= tokentab3
[i
].opcode
;
2262 return tokentab3
[i
].token
;
2265 /* See if it is a special token of length 2. */
2266 for (i
= 0; i
< sizeof tokentab2
/ sizeof tokentab2
[0]; i
++)
2267 if (STREQN (tokstart
, tokentab2
[i
].operator, 2))
2270 yylval
.opcode
= tokentab2
[i
].opcode
;
2271 return tokentab2
[i
].token
;
2274 switch (c
= *tokstart
)
2286 /* We either have a character constant ('0' or '\177' for example)
2287 or we have a quoted symbol reference ('foo(int,int)' in C++
2292 c
= parse_escape (&lexptr
);
2294 error ("Empty character constant.");
2296 yylval
.typed_val_int
.val
= c
;
2297 yylval
.typed_val_int
.type
= builtin_type_char
;
2302 namelen
= skip_quoted (tokstart
) - tokstart
;
2305 lexptr
= tokstart
+ namelen
;
2307 if (lexptr
[-1] != '\'')
2308 error ("Unmatched single quote.");
2313 error ("Invalid character constant.");
2323 if (paren_depth
== 0)
2330 if (comma_terminates
&& paren_depth
== 0)
2336 /* Might be a floating point number. */
2337 if (lexptr
[1] < '0' || lexptr
[1] > '9')
2338 goto symbol
; /* Nope, must be a symbol. */
2339 /* FALL THRU into number case. */
2352 /* It's a number. */
2353 int got_dot
= 0, got_e
= 0, toktype
;
2354 register char *p
= tokstart
;
2355 int hex
= input_radix
> 10;
2357 if (c
== '0' && (p
[1] == 'x' || p
[1] == 'X'))
2362 else if (c
== '0' && (p
[1]=='t' || p
[1]=='T' || p
[1]=='d' || p
[1]=='D'))
2370 /* This test includes !hex because 'e' is a valid hex digit
2371 and thus does not indicate a floating point number when
2372 the radix is hex. */
2373 if (!hex
&& !got_e
&& (*p
== 'e' || *p
== 'E'))
2374 got_dot
= got_e
= 1;
2375 /* This test does not include !hex, because a '.' always indicates
2376 a decimal floating point number regardless of the radix. */
2377 else if (!got_dot
&& *p
== '.')
2379 else if (got_e
&& (p
[-1] == 'e' || p
[-1] == 'E')
2380 && (*p
== '-' || *p
== '+'))
2381 /* This is the sign of the exponent, not the end of the
2384 /* We will take any letters or digits. parse_number will
2385 complain if past the radix, or if L or U are not final. */
2386 else if ((*p
< '0' || *p
> '9')
2387 && ((*p
< 'a' || *p
> 'z')
2388 && (*p
< 'A' || *p
> 'Z')))
2391 toktype
= parse_number (tokstart
, p
- tokstart
, got_dot
|got_e
, &yylval
);
2392 if (toktype
== ERROR
)
2394 char *err_copy
= (char *) alloca (p
- tokstart
+ 1);
2396 memcpy (err_copy
, tokstart
, p
- tokstart
);
2397 err_copy
[p
- tokstart
] = 0;
2398 error ("Invalid number \"%s\".", err_copy
);
2430 /* Build the gdb internal form of the input string in tempbuf,
2431 translating any standard C escape forms seen. Note that the
2432 buffer is null byte terminated *only* for the convenience of
2433 debugging gdb itself and printing the buffer contents when
2434 the buffer contains no embedded nulls. Gdb does not depend
2435 upon the buffer being null byte terminated, it uses the length
2436 string instead. This allows gdb to handle C strings (as well
2437 as strings in other languages) with embedded null bytes */
2439 tokptr
= ++tokstart
;
2443 /* Grow the static temp buffer if necessary, including allocating
2444 the first one on demand. */
2445 if (tempbufindex
+ 1 >= tempbufsize
)
2447 tempbuf
= (char *) xrealloc (tempbuf
, tempbufsize
+= 64);
2453 /* Do nothing, loop will terminate. */
2457 c
= parse_escape (&tokptr
);
2462 tempbuf
[tempbufindex
++] = c
;
2465 tempbuf
[tempbufindex
++] = *tokptr
++;
2468 } while ((*tokptr
!= '"') && (*tokptr
!= '\0'));
2469 if (*tokptr
++ != '"')
2471 error ("Unterminated string in expression.");
2473 tempbuf
[tempbufindex
] = '\0'; /* See note above */
2474 yylval
.sval
.ptr
= tempbuf
;
2475 yylval
.sval
.length
= tempbufindex
;
2480 if (!(c
== '_' || c
== '$'
2481 || (c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z')))
2482 /* We must have come across a bad character (e.g. ';'). */
2483 error ("Invalid character '%c' in expression.", c
);
2485 /* It's a name. See how long it is. */
2487 for (c
= tokstart
[namelen
];
2488 (c
== '_' || c
== '$' || (c
>= '0' && c
<= '9')
2489 || (c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z') || c
== '<');)
2491 /* Template parameter lists are part of the name.
2492 FIXME: This mishandles `print $a<4&&$a>3'. */
2496 if (hp_som_som_object_present
)
2498 /* Scan ahead to get rest of the template specification. Note
2499 that we look ahead only when the '<' adjoins non-whitespace
2500 characters; for comparison expressions, e.g. "a < b > c",
2501 there must be spaces before the '<', etc. */
2503 char * p
= find_template_name_end (tokstart
+ namelen
);
2505 namelen
= p
- tokstart
;
2511 int nesting_level
= 1;
2512 while (tokstart
[++i
])
2514 if (tokstart
[i
] == '<')
2516 else if (tokstart
[i
] == '>')
2518 if (--nesting_level
== 0)
2522 if (tokstart
[i
] == '>')
2528 c
= tokstart
[++namelen
];
2531 /* The token "if" terminates the expression and is NOT
2532 removed from the input stream. */
2533 if (namelen
== 2 && tokstart
[0] == 'i' && tokstart
[1] == 'f')
2542 /* Catch specific keywords. Should be done with a data structure. */
2546 if (STREQN (tokstart
, "unsigned", 8))
2548 if (current_language
->la_language
== language_cplus
2549 && STREQN (tokstart
, "template", 8))
2551 if (STREQN (tokstart
, "volatile", 8))
2552 return VOLATILE_KEYWORD
;
2555 if (STREQN (tokstart
, "struct", 6))
2557 if (STREQN (tokstart
, "signed", 6))
2558 return SIGNED_KEYWORD
;
2559 if (STREQN (tokstart
, "sizeof", 6))
2561 if (STREQN (tokstart
, "double", 6))
2562 return DOUBLE_KEYWORD
;
2565 if (current_language
->la_language
== language_cplus
)
2567 if (STREQN (tokstart
, "false", 5))
2568 return FALSEKEYWORD
;
2569 if (STREQN (tokstart
, "class", 5))
2572 if (STREQN (tokstart
, "union", 5))
2574 if (STREQN (tokstart
, "short", 5))
2576 if (STREQN (tokstart
, "const", 5))
2577 return CONST_KEYWORD
;
2580 if (STREQN (tokstart
, "enum", 4))
2582 if (STREQN (tokstart
, "long", 4))
2584 if (current_language
->la_language
== language_cplus
)
2586 if (STREQN (tokstart
, "true", 4))
2589 if (STREQN (tokstart
, "this", 4))
2591 static const char this_name
[] =
2592 { CPLUS_MARKER
, 't', 'h', 'i', 's', '\0' };
2594 if (lookup_symbol (this_name
, expression_context_block
,
2595 VAR_NAMESPACE
, (int *) NULL
,
2596 (struct symtab
**) NULL
))
2602 if (STREQN (tokstart
, "int", 3))
2609 yylval
.sval
.ptr
= tokstart
;
2610 yylval
.sval
.length
= namelen
;
2612 if (*tokstart
== '$')
2614 write_dollar_variable (yylval
.sval
);
2618 /* Look ahead and see if we can consume more of the input
2619 string to get a reasonable class/namespace spec or a
2620 fully-qualified name. This is a kludge to get around the
2621 HP aCC compiler's generation of symbol names with embedded
2622 colons for namespace and nested classes. */
2625 /* Only do it if not inside single quotes */
2626 sym_class
= parse_nested_classes_for_hpacc (yylval
.sval
.ptr
, yylval
.sval
.length
,
2627 &token_string
, &class_prefix
, &lexptr
);
2630 /* Replace the current token with the bigger one we found */
2631 yylval
.sval
.ptr
= token_string
;
2632 yylval
.sval
.length
= strlen (token_string
);
2636 /* Use token-type BLOCKNAME for symbols that happen to be defined as
2637 functions or symtabs. If this is not so, then ...
2638 Use token-type TYPENAME for symbols that happen to be defined
2639 currently as names of types; NAME for other symbols.
2640 The caller is not constrained to care about the distinction. */
2642 char *tmp
= copy_name (yylval
.sval
);
2644 int is_a_field_of_this
= 0;
2647 sym
= lookup_symbol (tmp
, expression_context_block
,
2649 current_language
->la_language
== language_cplus
2650 ? &is_a_field_of_this
: (int *) NULL
,
2651 (struct symtab
**) NULL
);
2652 /* Call lookup_symtab, not lookup_partial_symtab, in case there are
2653 no psymtabs (coff, xcoff, or some future change to blow away the
2654 psymtabs once once symbols are read). */
2655 if (sym
&& SYMBOL_CLASS (sym
) == LOC_BLOCK
)
2657 yylval
.ssym
.sym
= sym
;
2658 yylval
.ssym
.is_a_field_of_this
= is_a_field_of_this
;
2662 { /* See if it's a file name. */
2663 struct symtab
*symtab
;
2665 symtab
= lookup_symtab (tmp
);
2669 yylval
.bval
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab
), STATIC_BLOCK
);
2674 if (sym
&& SYMBOL_CLASS (sym
) == LOC_TYPEDEF
)
2677 /* Despite the following flaw, we need to keep this code enabled.
2678 Because we can get called from check_stub_method, if we don't
2679 handle nested types then it screws many operations in any
2680 program which uses nested types. */
2681 /* In "A::x", if x is a member function of A and there happens
2682 to be a type (nested or not, since the stabs don't make that
2683 distinction) named x, then this code incorrectly thinks we
2684 are dealing with nested types rather than a member function. */
2688 struct symbol
*best_sym
;
2690 /* Look ahead to detect nested types. This probably should be
2691 done in the grammar, but trying seemed to introduce a lot
2692 of shift/reduce and reduce/reduce conflicts. It's possible
2693 that it could be done, though. Or perhaps a non-grammar, but
2694 less ad hoc, approach would work well. */
2696 /* Since we do not currently have any way of distinguishing
2697 a nested type from a non-nested one (the stabs don't tell
2698 us whether a type is nested), we just ignore the
2705 /* Skip whitespace. */
2706 while (*p
== ' ' || *p
== '\t' || *p
== '\n')
2708 if (*p
== ':' && p
[1] == ':')
2710 /* Skip the `::'. */
2712 /* Skip whitespace. */
2713 while (*p
== ' ' || *p
== '\t' || *p
== '\n')
2716 while (*p
== '_' || *p
== '$' || (*p
>= '0' && *p
<= '9')
2717 || (*p
>= 'a' && *p
<= 'z')
2718 || (*p
>= 'A' && *p
<= 'Z'))
2722 struct symbol
*cur_sym
;
2723 /* As big as the whole rest of the expression, which is
2724 at least big enough. */
2725 char *ncopy
= alloca (strlen (tmp
)+strlen (namestart
)+3);
2729 memcpy (tmp1
, tmp
, strlen (tmp
));
2730 tmp1
+= strlen (tmp
);
2731 memcpy (tmp1
, "::", 2);
2733 memcpy (tmp1
, namestart
, p
- namestart
);
2734 tmp1
[p
- namestart
] = '\0';
2735 cur_sym
= lookup_symbol (ncopy
, expression_context_block
,
2736 VAR_NAMESPACE
, (int *) NULL
,
2737 (struct symtab
**) NULL
);
2740 if (SYMBOL_CLASS (cur_sym
) == LOC_TYPEDEF
)
2758 yylval
.tsym
.type
= SYMBOL_TYPE (best_sym
);
2760 yylval
.tsym
.type
= SYMBOL_TYPE (sym
);
2764 if ((yylval
.tsym
.type
= lookup_primitive_typename (tmp
)) != 0)
2767 /* Input names that aren't symbols but ARE valid hex numbers,
2768 when the input radix permits them, can be names or numbers
2769 depending on the parse. Note we support radixes > 16 here. */
2771 ((tokstart
[0] >= 'a' && tokstart
[0] < 'a' + input_radix
- 10) ||
2772 (tokstart
[0] >= 'A' && tokstart
[0] < 'A' + input_radix
- 10)))
2774 YYSTYPE newlval
; /* Its value is ignored. */
2775 hextype
= parse_number (tokstart
, namelen
, 0, &newlval
);
2778 yylval
.ssym
.sym
= sym
;
2779 yylval
.ssym
.is_a_field_of_this
= is_a_field_of_this
;
2784 /* Any other kind of symbol */
2785 yylval
.ssym
.sym
= sym
;
2786 yylval
.ssym
.is_a_field_of_this
= is_a_field_of_this
;
2795 error ("A %s in expression, near `%s'.", (msg
? msg
: "error"), lexptr
);