2 /* A Bison parser, made from ./c-exp.y with Bison version GNU Bison version 1.24
5 #define YYBISON 1 /* Identify Bison output. */
12 #define NAME_OR_INT 263
19 #define COLONCOLON 270
22 #define SIGNED_KEYWORD 273
25 #define INT_KEYWORD 276
26 #define CONST_KEYWORD 277
27 #define VOLATILE_KEYWORD 278
28 #define DOUBLE_KEYWORD 279
30 #define ASSIGN_MODIFY 281
32 #define ABOVE_COMMA 283
51 #include "gdb_string.h"
53 #include "expression.h"
55 #include "parser-defs.h"
58 #include "bfd.h" /* Required by objfiles.h. */
59 #include "symfile.h" /* Required by objfiles.h. */
60 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
62 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
63 as well as gratuitiously global symbol names, so we can have multiple
64 yacc generated parsers in gdb. Note that these are only the variables
65 produced by yacc. If other parser generators (bison, byacc, etc) produce
66 additional global names that conflict at link time, then those parser
67 generators need to be fixed instead of adding those names to this list. */
69 #define yymaxdepth c_maxdepth
70 #define yyparse c_parse
72 #define yyerror c_error
75 #define yydebug c_debug
84 #define yyerrflag c_errflag
85 #define yynerrs c_nerrs
90 #define yystate c_state
96 #define yyreds c_reds /* With YYDEBUG defined */
97 #define yytoks c_toks /* With YYDEBUG defined */
100 #define yydefred c_yydefred
101 #define yydgoto c_yydgoto
102 #define yysindex c_yysindex
103 #define yyrindex c_yyrindex
104 #define yygindex c_yygindex
105 #define yytable c_yytable
106 #define yycheck c_yycheck
109 #define YYDEBUG 0 /* Default to no yydebug support */
113 yyparse PARAMS ((void));
116 yylex PARAMS ((void));
119 yyerror PARAMS ((char *));
122 #line 117 "./c-exp.y"
138 struct symtoken ssym;
141 enum exp_opcode opcode;
142 struct internalvar *ivar;
147 #line 142 "./c-exp.y"
149 /* YYSTYPE gets defined by %union */
151 parse_number PARAMS ((char *, int, int, YYSTYPE *));
166 #define YYLTYPE yyltype
180 #define YYFLAG -32768
183 #define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 88)
185 static const char yytranslate[] = { 0,
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, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 59, 2, 2, 2, 50, 36, 2, 57,
190 62, 48, 46, 28, 47, 55, 49, 2, 2, 2,
191 2, 2, 2, 2, 2, 2, 2, 65, 2, 39,
192 30, 40, 31, 45, 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 56, 2, 61, 35, 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, 63, 34, 64, 60, 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, 1, 2, 3, 4, 5,
212 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
213 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
214 26, 27, 29, 32, 33, 37, 38, 41, 42, 43,
215 44, 51, 52, 53, 54, 58
219 static const short yyprhs[] = { 0,
220 0, 2, 4, 6, 8, 12, 15, 18, 21, 24,
221 27, 30, 33, 36, 39, 42, 46, 50, 55, 59,
222 63, 68, 73, 74, 80, 82, 83, 85, 89, 91,
223 95, 100, 105, 109, 113, 117, 121, 125, 129, 133,
224 137, 141, 145, 149, 153, 157, 161, 165, 169, 173,
225 177, 181, 185, 191, 195, 199, 201, 203, 205, 207,
226 209, 214, 216, 218, 220, 224, 228, 232, 237, 239,
227 242, 244, 246, 249, 252, 255, 259, 263, 265, 268,
228 270, 273, 275, 279, 282, 284, 287, 289, 292, 296,
229 299, 303, 305, 309, 311, 313, 315, 317, 320, 324,
230 327, 331, 335, 340, 343, 347, 349, 352, 355, 358,
231 361, 364, 367, 369, 372, 374, 380, 383, 386, 388,
232 390, 392, 394, 396, 400, 402, 404, 406, 408, 410
235 static const short yyrhs[] = { 68,
236 0, 67, 0, 82, 0, 69, 0, 68, 28, 69,
237 0, 48, 69, 0, 36, 69, 0, 47, 69, 0,
238 59, 69, 0, 60, 69, 0, 52, 69, 0, 53,
239 69, 0, 69, 52, 0, 69, 53, 0, 13, 69,
240 0, 69, 54, 86, 0, 69, 54, 76, 0, 69,
241 54, 48, 69, 0, 69, 55, 86, 0, 69, 55,
242 76, 0, 69, 55, 48, 69, 0, 69, 56, 68,
243 61, 0, 0, 69, 57, 70, 72, 62, 0, 63,
244 0, 0, 69, 0, 72, 28, 69, 0, 64, 0,
245 71, 72, 73, 0, 71, 82, 73, 69, 0, 57,
246 82, 62, 69, 0, 57, 68, 62, 0, 69, 45,
247 69, 0, 69, 48, 69, 0, 69, 49, 69, 0,
248 69, 50, 69, 0, 69, 46, 69, 0, 69, 47,
249 69, 0, 69, 43, 69, 0, 69, 44, 69, 0,
250 69, 37, 69, 0, 69, 38, 69, 0, 69, 41,
251 69, 0, 69, 42, 69, 0, 69, 39, 69, 0,
252 69, 40, 69, 0, 69, 36, 69, 0, 69, 35,
253 69, 0, 69, 34, 69, 0, 69, 33, 69, 0,
254 69, 32, 69, 0, 69, 31, 69, 65, 69, 0,
255 69, 30, 69, 0, 69, 26, 69, 0, 3, 0,
256 8, 0, 4, 0, 75, 0, 25, 0, 13, 57,
257 82, 62, 0, 5, 0, 27, 0, 58, 0, 74,
258 15, 86, 0, 74, 15, 86, 0, 83, 15, 86,
259 0, 83, 15, 60, 86, 0, 76, 0, 15, 86,
260 0, 87, 0, 83, 0, 83, 22, 0, 83, 23,
261 0, 83, 78, 0, 83, 22, 78, 0, 83, 23,
262 78, 0, 48, 0, 48, 78, 0, 36, 0, 36,
263 78, 0, 79, 0, 57, 78, 62, 0, 79, 80,
264 0, 80, 0, 79, 81, 0, 81, 0, 56, 61,
265 0, 56, 3, 61, 0, 57, 62, 0, 57, 85,
266 62, 0, 77, 0, 83, 15, 48, 0, 7, 0,
267 21, 0, 19, 0, 20, 0, 19, 21, 0, 14,
268 19, 21, 0, 19, 19, 0, 19, 19, 21, 0,
269 14, 19, 19, 0, 14, 19, 19, 21, 0, 20,
270 21, 0, 14, 20, 21, 0, 24, 0, 19, 24,
271 0, 9, 86, 0, 10, 86, 0, 11, 86, 0,
272 12, 86, 0, 14, 84, 0, 14, 0, 18, 84,
273 0, 18, 0, 16, 86, 39, 82, 40, 0, 22,
274 83, 0, 23, 83, 0, 7, 0, 21, 0, 19,
275 0, 20, 0, 82, 0, 85, 28, 82, 0, 6,
276 0, 58, 0, 7, 0, 8, 0, 6, 0, 58,
283 static const short yyrline[] = { 0,
284 223, 224, 227, 234, 235, 240, 243, 246, 250, 254,
285 258, 262, 266, 270, 274, 278, 284, 291, 295, 302,
286 310, 314, 318, 322, 328, 332, 335, 339, 343, 346,
287 353, 359, 365, 371, 375, 379, 383, 387, 391, 395,
288 399, 403, 407, 411, 415, 419, 423, 427, 431, 435,
289 439, 443, 447, 451, 455, 461, 468, 479, 486, 489,
290 493, 501, 526, 533, 550, 561, 577, 590, 615, 616,
291 650, 708, 714, 715, 716, 718, 720, 724, 726, 728,
292 730, 732, 735, 737, 742, 749, 751, 755, 757, 761,
293 763, 775, 776, 781, 783, 785, 787, 789, 791, 793,
294 795, 797, 799, 801, 803, 805, 807, 809, 812, 815,
295 818, 821, 823, 825, 827, 829, 836, 837, 840, 841,
296 847, 853, 862, 867, 874, 875, 876, 877, 880, 881
299 static const char * const yytname[] = { "$","error","$undefined.","INT","FLOAT",
300 "STRING","NAME","TYPENAME","NAME_OR_INT","STRUCT","CLASS","UNION","ENUM","SIZEOF",
301 "UNSIGNED","COLONCOLON","TEMPLATE","ERROR","SIGNED_KEYWORD","LONG","SHORT","INT_KEYWORD",
302 "CONST_KEYWORD","VOLATILE_KEYWORD","DOUBLE_KEYWORD","VARIABLE","ASSIGN_MODIFY",
303 "THIS","','","ABOVE_COMMA","'='","'?'","OROR","ANDAND","'|'","'^'","'&'","EQUAL",
304 "NOTEQUAL","'<'","'>'","LEQ","GEQ","LSH","RSH","'@'","'+'","'-'","'*'","'/'",
305 "'%'","UNARY","INCREMENT","DECREMENT","ARROW","'.'","'['","'('","BLOCKNAME",
306 "'!'","'~'","']'","')'","'{'","'}'","':'","start","type_exp","exp1","exp","@1",
307 "lcurly","arglist","rcurly","block","variable","qualified_name","ptype","abs_decl",
308 "direct_abs_decl","array_mod","func_mod","type","typebase","typename","nonempty_typelist",
309 "name","name_not_typename",""
313 static const short yyr1[] = { 0,
314 66, 66, 67, 68, 68, 69, 69, 69, 69, 69,
315 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
316 69, 69, 70, 69, 71, 72, 72, 72, 73, 69,
317 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
318 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
319 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
320 69, 69, 69, 74, 74, 75, 76, 76, 75, 75,
321 75, 77, 77, 77, 77, 77, 77, 78, 78, 78,
322 78, 78, 79, 79, 79, 79, 79, 80, 80, 81,
323 81, 82, 82, 83, 83, 83, 83, 83, 83, 83,
324 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
325 83, 83, 83, 83, 83, 83, 83, 83, 84, 84,
326 84, 84, 85, 85, 86, 86, 86, 86, 87, 87
329 static const short yyr2[] = { 0,
330 1, 1, 1, 1, 3, 2, 2, 2, 2, 2,
331 2, 2, 2, 2, 2, 3, 3, 4, 3, 3,
332 4, 4, 0, 5, 1, 0, 1, 3, 1, 3,
333 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
334 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
335 3, 3, 5, 3, 3, 1, 1, 1, 1, 1,
336 4, 1, 1, 1, 3, 3, 3, 4, 1, 2,
337 1, 1, 2, 2, 2, 3, 3, 1, 2, 1,
338 2, 1, 3, 2, 1, 2, 1, 2, 3, 2,
339 3, 1, 3, 1, 1, 1, 1, 2, 3, 2,
340 3, 3, 4, 2, 3, 1, 2, 2, 2, 2,
341 2, 2, 1, 2, 1, 5, 2, 2, 1, 1,
342 1, 1, 1, 3, 1, 1, 1, 1, 1, 1
345 static const short yydefact[] = { 0,
346 56, 58, 62, 129, 94, 57, 0, 0, 0, 0,
347 0, 113, 0, 0, 115, 96, 97, 95, 0, 0,
348 106, 60, 63, 0, 0, 0, 0, 0, 0, 130,
349 0, 0, 25, 2, 1, 4, 26, 0, 59, 69,
350 92, 3, 72, 71, 125, 127, 128, 126, 108, 109,
351 110, 111, 0, 15, 0, 119, 121, 122, 120, 112,
352 70, 0, 121, 122, 114, 100, 98, 107, 104, 117,
353 118, 7, 8, 6, 11, 12, 0, 0, 9, 10,
354 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
355 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
356 0, 0, 0, 13, 14, 0, 0, 0, 23, 27,
357 0, 0, 0, 0, 73, 74, 80, 78, 0, 0,
358 75, 82, 85, 87, 0, 0, 102, 99, 105, 0,
359 101, 33, 0, 5, 55, 54, 0, 52, 51, 50,
360 49, 48, 42, 43, 46, 47, 44, 45, 40, 41,
361 34, 38, 39, 35, 36, 37, 127, 0, 17, 16,
362 0, 20, 19, 0, 26, 0, 29, 30, 0, 66,
363 93, 0, 67, 76, 77, 81, 79, 0, 88, 90,
364 0, 123, 72, 0, 0, 84, 86, 61, 103, 0,
365 32, 0, 18, 21, 22, 0, 28, 31, 68, 89,
366 83, 0, 0, 91, 116, 53, 24, 124, 0, 0,
370 static const short yydefgoto[] = { 209,
371 34, 77, 36, 165, 37, 111, 168, 38, 39, 40,
372 41, 121, 122, 123, 124, 182, 55, 60, 184, 173,
376 static const short yypact[] = { 241,
377 -32768,-32768,-32768,-32768,-32768,-32768, 5, 5, 5, 5,
378 302, 24, 5, 5, 73, 66, 27,-32768, 212, 212,
379 -32768,-32768,-32768, 241, 241, 241, 241, 241, 241, 32,
380 241, 241,-32768,-32768, -1, 523, 241, 42,-32768,-32768,
381 -32768,-32768, 3,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
382 -32768,-32768, 241, 43, 52,-32768, 70, 50,-32768,-32768,
383 -32768, 64,-32768,-32768,-32768, 60,-32768,-32768,-32768,-32768,
384 -32768, 43, 43, 43, 43, 43, -7, 44, 43, 43,
385 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
386 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
387 241, 241, 241,-32768,-32768, 439, 458, 241,-32768, 523,
388 -18, 41, 5, 8, 16, 16, 16, 16, 4, 382,
389 -32768, -34,-32768,-32768, 45, 26, 83,-32768,-32768, 212,
390 -32768,-32768, 241, 523, 523, 523, 487, 575, 599, 622,
391 644, 665, 684, 684, 143, 143, 143, 143, 226, 226,
392 69, 287, 287, 43, 43, 43, 94, 241,-32768,-32768,
393 241,-32768,-32768, -11, 241, 241,-32768,-32768, 241, 95,
394 -32768, 5,-32768,-32768,-32768,-32768,-32768, 67,-32768,-32768,
395 49,-32768, 13, -4, 152,-32768,-32768, 363,-32768, 72,
396 43, 241, 43, 43,-32768, 12, 523, 43,-32768,-32768,
397 -32768, 65, 212,-32768,-32768, 550,-32768,-32768, 127, 129,
401 static const short yypgoto[] = {-32768,
402 -32768, 6, 51,-32768,-32768, 14, 53,-32768,-32768, -65,
403 -32768, 40,-32768, 47, 55, 1, 0, 163,-32768, -5,
411 static const short yytable[] = { 43,
412 42, 49, 50, 51, 52, 35, 178, 61, 62, 166,
413 45, 46, 47, 45, 46, 47, 81, 114, 70, 71,
414 81, 119, 185, 203, 115, 116, 81, 202, 43, 78,
415 56, 45, 46, 47, 115, 116, 43, 112, 117, 166,
416 159, 162, 57, 58, 59, 167, -64, 69, 117, 195,
417 118, 117, 43, 125, 132, 171, 113, 204, 119, 120,
418 118, 54, 48, 118, 179, 48, 126, 172, 119, 120,
419 129, 119, 120, 207, 72, 73, 74, 75, 76, 56,
420 131, 79, 80, 48, 66, 172, 67, 110, 127, 68,
421 128, 63, 64, 59, 104, 105, 106, 107, 108, 109,
422 160, 163, 130, 189, 167, 133, 188, 170, -94, -65,
423 201, 205, 171, 164, 99, 100, 101, 102, 103, 183,
424 104, 105, 106, 107, 108, 109, 210, 200, 211, 183,
425 190, 134, 135, 136, 137, 138, 139, 140, 141, 142,
426 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
427 153, 154, 155, 156, 174, 175, 176, 177, 5, 181,
428 7, 8, 9, 10, 169, 12, 199, 14, 186, 15,
429 16, 17, 18, 19, 20, 21, 187, 65, 196, 0,
430 0, 0, 0, 191, 183, 96, 97, 98, 99, 100,
431 101, 102, 103, 0, 104, 105, 106, 107, 108, 109,
432 0, 0, 183, 208, 0, 0, 0, 0, 193, 0,
433 0, 194, 0, 180, 0, 110, 197, 0, 5, 198,
434 7, 8, 9, 10, 0, 12, 0, 14, 0, 15,
435 16, 17, 18, 19, 20, 21, 0, 0, 191, 0,
436 0, 0, 206, 1, 2, 3, 4, 5, 6, 7,
437 8, 9, 10, 11, 12, 13, 14, 0, 15, 16,
438 17, 18, 19, 20, 21, 22, 0, 23, 0, 0,
439 98, 99, 100, 101, 102, 103, 24, 104, 105, 106,
440 107, 108, 109, 0, 0, 0, 0, 25, 26, 0,
441 0, 0, 27, 28, 0, 0, 0, 29, 30, 31,
442 32, 0, 0, 33, 1, 2, 3, 4, 5, 6,
443 7, 8, 9, 10, 11, 12, 13, 14, 0, 15,
444 16, 17, 18, 19, 20, 21, 22, 0, 23, 0,
445 0, 0, 0, 0, 101, 102, 103, 24, 104, 105,
446 106, 107, 108, 109, 0, 0, 0, 0, 25, 26,
447 0, 0, 0, 27, 28, 0, 0, 0, 53, 30,
448 31, 32, 0, 0, 33, 1, 2, 3, 4, 5,
449 6, 7, 8, 9, 10, 11, 12, 13, 14, 0,
450 15, 16, 17, 18, 19, 20, 21, 22, 5, 23,
451 7, 8, 9, 10, 0, 12, 0, 14, 0, 15,
452 16, 17, 18, 19, 20, 21, 0, 0, 0, 0,
453 0, 0, 0, 0, 27, 28, 0, 117, 0, 29,
454 30, 31, 32, 0, 0, 33, 0, 0, 0, 118,
455 0, 0, 0, 0, 0, 0, 0, 119, 120, 0,
456 0, 0, 0, 180, 45, 157, 47, 7, 8, 9,
457 10, 0, 12, 0, 14, 0, 15, 16, 17, 18,
458 19, 20, 21, 45, 157, 47, 7, 8, 9, 10,
459 0, 12, 0, 14, 0, 15, 16, 17, 18, 19,
460 20, 21, 0, 0, 0, 0, 158, 0, 0, 0,
461 0, 0, 0, 0, 0, 0, 48, 0, 0, 0,
462 0, 0, 0, 0, 0, 161, 0, 0, 0, 0,
463 0, 0, 82, 0, 0, 48, 83, 84, 85, 86,
464 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
465 97, 98, 99, 100, 101, 102, 103, 0, 104, 105,
466 106, 107, 108, 109, 0, 0, 0, 0, 82, 0,
467 0, 192, 83, 84, 85, 86, 87, 88, 89, 90,
468 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
469 101, 102, 103, 0, 104, 105, 106, 107, 108, 109,
470 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
471 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
472 0, 104, 105, 106, 107, 108, 109, 86, 87, 88,
473 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
474 99, 100, 101, 102, 103, 0, 104, 105, 106, 107,
475 108, 109, 87, 88, 89, 90, 91, 92, 93, 94,
476 95, 96, 97, 98, 99, 100, 101, 102, 103, 0,
477 104, 105, 106, 107, 108, 109, 88, 89, 90, 91,
478 92, 93, 94, 95, 96, 97, 98, 99, 100, 101,
479 102, 103, 0, 104, 105, 106, 107, 108, 109, 89,
480 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
481 100, 101, 102, 103, 0, 104, 105, 106, 107, 108,
482 109, 90, 91, 92, 93, 94, 95, 96, 97, 98,
483 99, 100, 101, 102, 103, 0, 104, 105, 106, 107,
484 108, 109, 92, 93, 94, 95, 96, 97, 98, 99,
485 100, 101, 102, 103, 0, 104, 105, 106, 107, 108,
489 static const short yycheck[] = { 0,
490 0, 7, 8, 9, 10, 0, 3, 13, 14, 28,
491 6, 7, 8, 6, 7, 8, 28, 15, 19, 20,
492 28, 56, 57, 28, 22, 23, 28, 15, 29, 29,
493 7, 6, 7, 8, 22, 23, 37, 37, 36, 28,
494 106, 107, 19, 20, 21, 64, 15, 21, 36, 61,
495 48, 36, 53, 53, 62, 48, 15, 62, 56, 57,
496 48, 11, 58, 48, 61, 58, 15, 60, 56, 57,
497 21, 56, 57, 62, 24, 25, 26, 27, 28, 7,
498 21, 31, 32, 58, 19, 60, 21, 37, 19, 24,
499 21, 19, 20, 21, 52, 53, 54, 55, 56, 57,
500 106, 107, 39, 21, 64, 62, 62, 113, 15, 15,
501 62, 40, 48, 108, 46, 47, 48, 49, 50, 120,
502 52, 53, 54, 55, 56, 57, 0, 61, 0, 130,
503 130, 81, 82, 83, 84, 85, 86, 87, 88, 89,
504 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
505 100, 101, 102, 103, 115, 116, 117, 118, 7, 120,
506 9, 10, 11, 12, 112, 14, 172, 16, 122, 18,
507 19, 20, 21, 22, 23, 24, 122, 15, 165, -1,
508 -1, -1, -1, 133, 185, 43, 44, 45, 46, 47,
509 48, 49, 50, -1, 52, 53, 54, 55, 56, 57,
510 -1, -1, 203, 203, -1, -1, -1, -1, 158, -1,
511 -1, 161, -1, 62, -1, 165, 166, -1, 7, 169,
512 9, 10, 11, 12, -1, 14, -1, 16, -1, 18,
513 19, 20, 21, 22, 23, 24, -1, -1, 188, -1,
514 -1, -1, 192, 3, 4, 5, 6, 7, 8, 9,
515 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
516 20, 21, 22, 23, 24, 25, -1, 27, -1, -1,
517 45, 46, 47, 48, 49, 50, 36, 52, 53, 54,
518 55, 56, 57, -1, -1, -1, -1, 47, 48, -1,
519 -1, -1, 52, 53, -1, -1, -1, 57, 58, 59,
520 60, -1, -1, 63, 3, 4, 5, 6, 7, 8,
521 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
522 19, 20, 21, 22, 23, 24, 25, -1, 27, -1,
523 -1, -1, -1, -1, 48, 49, 50, 36, 52, 53,
524 54, 55, 56, 57, -1, -1, -1, -1, 47, 48,
525 -1, -1, -1, 52, 53, -1, -1, -1, 57, 58,
526 59, 60, -1, -1, 63, 3, 4, 5, 6, 7,
527 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
528 18, 19, 20, 21, 22, 23, 24, 25, 7, 27,
529 9, 10, 11, 12, -1, 14, -1, 16, -1, 18,
530 19, 20, 21, 22, 23, 24, -1, -1, -1, -1,
531 -1, -1, -1, -1, 52, 53, -1, 36, -1, 57,
532 58, 59, 60, -1, -1, 63, -1, -1, -1, 48,
533 -1, -1, -1, -1, -1, -1, -1, 56, 57, -1,
534 -1, -1, -1, 62, 6, 7, 8, 9, 10, 11,
535 12, -1, 14, -1, 16, -1, 18, 19, 20, 21,
536 22, 23, 24, 6, 7, 8, 9, 10, 11, 12,
537 -1, 14, -1, 16, -1, 18, 19, 20, 21, 22,
538 23, 24, -1, -1, -1, -1, 48, -1, -1, -1,
539 -1, -1, -1, -1, -1, -1, 58, -1, -1, -1,
540 -1, -1, -1, -1, -1, 48, -1, -1, -1, -1,
541 -1, -1, 26, -1, -1, 58, 30, 31, 32, 33,
542 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
543 44, 45, 46, 47, 48, 49, 50, -1, 52, 53,
544 54, 55, 56, 57, -1, -1, -1, -1, 26, -1,
545 -1, 65, 30, 31, 32, 33, 34, 35, 36, 37,
546 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
547 48, 49, 50, -1, 52, 53, 54, 55, 56, 57,
548 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
549 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
550 -1, 52, 53, 54, 55, 56, 57, 33, 34, 35,
551 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
552 46, 47, 48, 49, 50, -1, 52, 53, 54, 55,
553 56, 57, 34, 35, 36, 37, 38, 39, 40, 41,
554 42, 43, 44, 45, 46, 47, 48, 49, 50, -1,
555 52, 53, 54, 55, 56, 57, 35, 36, 37, 38,
556 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
557 49, 50, -1, 52, 53, 54, 55, 56, 57, 36,
558 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
559 47, 48, 49, 50, -1, 52, 53, 54, 55, 56,
560 57, 37, 38, 39, 40, 41, 42, 43, 44, 45,
561 46, 47, 48, 49, 50, -1, 52, 53, 54, 55,
562 56, 57, 39, 40, 41, 42, 43, 44, 45, 46,
563 47, 48, 49, 50, -1, 52, 53, 54, 55, 56,
566 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
567 #line 3 "/usr/unsupported/share/bison.simple"
569 /* Skeleton output parser for bison,
570 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
572 This program is free software; you can redistribute it and/or modify
573 it under the terms of the GNU General Public License as published by
574 the Free Software Foundation; either version 2, or (at your option)
577 This program is distributed in the hope that it will be useful,
578 but WITHOUT ANY WARRANTY; without even the implied warranty of
579 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
580 GNU General Public License for more details.
582 You should have received a copy of the GNU General Public License
583 along with this program; if not, write to the Free Software
584 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
586 /* As a special exception, when this file is copied by Bison into a
587 Bison output file, you may use that output file without restriction.
588 This special exception was added by the Free Software Foundation
589 in version 1.24 of Bison. */
593 #define alloca __builtin_alloca
594 #else /* not GNU C. */
595 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
597 #else /* not sparc */
598 #if defined (MSDOS) && !defined (__TURBOC__)
599 #else /* not MSDOS, or __TURBOC__ */
602 #else /* not MSDOS, __TURBOC__, or _AIX */
606 void *alloca (unsigned int);
608 #else /* not __cplusplus */
610 #endif /* not __cplusplus */
612 #endif /* not _AIX */
613 #endif /* not MSDOS, or __TURBOC__ */
614 #endif /* not sparc. */
615 #endif /* not GNU C. */
616 #endif /* alloca not defined. */
618 /* This is the parser code that is written into each bison parser
619 when the %semantic_parser declaration is not specified in the grammar.
620 It was written by Richard Stallman by simplifying the hairy parser
621 used when %semantic_parser is specified. */
623 /* Note: there must be only one dollar sign in this file.
624 It is replaced by the list of actions, each action
625 as one case of the switch. */
627 #define yyerrok (yyerrstatus = 0)
628 #define yyclearin (yychar = YYEMPTY)
631 #define YYACCEPT return(0)
632 #define YYABORT return(1)
633 #define YYERROR goto yyerrlab1
634 /* Like YYERROR except do call yyerror.
635 This remains here temporarily to ease the
636 transition to the new meaning of YYERROR, for GCC.
637 Once GCC version 2 has supplanted version 1, this can go. */
638 #define YYFAIL goto yyerrlab
639 #define YYRECOVERING() (!!yyerrstatus)
640 #define YYBACKUP(token, value) \
642 if (yychar == YYEMPTY && yylen == 1) \
643 { yychar = (token), yylval = (value); \
644 yychar1 = YYTRANSLATE (yychar); \
649 { yyerror ("syntax error: cannot back up"); YYERROR; } \
653 #define YYERRCODE 256
656 #define YYLEX yylex()
662 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
664 #define YYLEX yylex(&yylval, &yylloc)
666 #else /* not YYLSP_NEEDED */
668 #define YYLEX yylex(&yylval, YYLEX_PARAM)
670 #define YYLEX yylex(&yylval)
672 #endif /* not YYLSP_NEEDED */
675 /* If nonreentrant, generate the variables here */
679 int yychar; /* the lookahead symbol */
680 YYSTYPE yylval; /* the semantic value of the */
681 /* lookahead symbol */
684 YYLTYPE yylloc; /* location data for the lookahead */
688 int yynerrs; /* number of parse errors so far */
689 #endif /* not YYPURE */
692 int yydebug; /* nonzero means print parse trace */
693 /* Since this is uninitialized, it does not stop multiple parsers
697 /* YYINITDEPTH indicates the initial size of the parser's stacks */
700 #define YYINITDEPTH 200
703 /* YYMAXDEPTH is the maximum size the stacks can grow to
704 (effective only if the built-in stack extension method is used). */
711 #define YYMAXDEPTH 10000
714 /* Prevent warning if -Wstrict-prototypes. */
719 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
720 #define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
721 #else /* not GNU C or C++ */
724 /* This is the most reliable way to avoid incompatibilities
725 in available built-in functions on various systems. */
727 __yy_memcpy (from, to, count)
732 register char *f = from;
733 register char *t = to;
734 register int i = count;
740 #else /* __cplusplus */
742 /* This is the most reliable way to avoid incompatibilities
743 in available built-in functions on various systems. */
745 __yy_memcpy (char *from, char *to, int count)
747 register char *f = from;
748 register char *t = to;
749 register int i = count;
758 #line 192 "/usr/unsupported/share/bison.simple"
760 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
761 into yyparse. The argument should have type void *.
762 It should actually point to an object.
763 Grammar actions can access the variable by casting it
764 to the proper pointer type. */
767 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
769 #define YYPARSE_PARAM
770 #define YYPARSE_PARAM_DECL
774 yyparse(YYPARSE_PARAM)
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 *)yyss1, (char *)yyss, size * sizeof (*yyssp));
892 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
893 __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
895 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
896 __yy_memcpy ((char *)yyls1, (char *)yyls, 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]]);
1057 #line 228 "./c-exp.y"
1058 { write_exp_elt_opcode(OP_TYPE);
1059 write_exp_elt_type(yyvsp[0].tval);
1060 write_exp_elt_opcode(OP_TYPE);;
1063 #line 236 "./c-exp.y"
1064 { write_exp_elt_opcode (BINOP_COMMA); ;
1067 #line 241 "./c-exp.y"
1068 { write_exp_elt_opcode (UNOP_IND); ;
1071 #line 244 "./c-exp.y"
1072 { write_exp_elt_opcode (UNOP_ADDR); ;
1075 #line 247 "./c-exp.y"
1076 { write_exp_elt_opcode (UNOP_NEG); ;
1079 #line 251 "./c-exp.y"
1080 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1083 #line 255 "./c-exp.y"
1084 { write_exp_elt_opcode (UNOP_COMPLEMENT); ;
1087 #line 259 "./c-exp.y"
1088 { write_exp_elt_opcode (UNOP_PREINCREMENT); ;
1091 #line 263 "./c-exp.y"
1092 { write_exp_elt_opcode (UNOP_PREDECREMENT); ;
1095 #line 267 "./c-exp.y"
1096 { write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
1099 #line 271 "./c-exp.y"
1100 { write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
1103 #line 275 "./c-exp.y"
1104 { write_exp_elt_opcode (UNOP_SIZEOF); ;
1107 #line 279 "./c-exp.y"
1108 { write_exp_elt_opcode (STRUCTOP_PTR);
1109 write_exp_string (yyvsp[0].sval);
1110 write_exp_elt_opcode (STRUCTOP_PTR); ;
1113 #line 285 "./c-exp.y"
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); ;
1121 #line 292 "./c-exp.y"
1122 { write_exp_elt_opcode (STRUCTOP_MPTR); ;
1125 #line 296 "./c-exp.y"
1126 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1127 write_exp_string (yyvsp[0].sval);
1128 write_exp_elt_opcode (STRUCTOP_STRUCT); ;
1131 #line 303 "./c-exp.y"
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); ;
1139 #line 311 "./c-exp.y"
1140 { write_exp_elt_opcode (STRUCTOP_MEMBER); ;
1143 #line 315 "./c-exp.y"
1144 { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
1147 #line 321 "./c-exp.y"
1148 { start_arglist (); ;
1151 #line 323 "./c-exp.y"
1152 { write_exp_elt_opcode (OP_FUNCALL);
1153 write_exp_elt_longcst ((LONGEST) end_arglist ());
1154 write_exp_elt_opcode (OP_FUNCALL); ;
1157 #line 329 "./c-exp.y"
1158 { start_arglist (); ;
1161 #line 336 "./c-exp.y"
1162 { arglist_len = 1; ;
1165 #line 340 "./c-exp.y"
1169 #line 344 "./c-exp.y"
1170 { yyval.lval = end_arglist () - 1; ;
1173 #line 347 "./c-exp.y"
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); ;
1180 #line 354 "./c-exp.y"
1181 { write_exp_elt_opcode (UNOP_MEMVAL);
1182 write_exp_elt_type (yyvsp[-2].tval);
1183 write_exp_elt_opcode (UNOP_MEMVAL); ;
1186 #line 360 "./c-exp.y"
1187 { write_exp_elt_opcode (UNOP_CAST);
1188 write_exp_elt_type (yyvsp[-2].tval);
1189 write_exp_elt_opcode (UNOP_CAST); ;
1192 #line 366 "./c-exp.y"
1196 #line 372 "./c-exp.y"
1197 { write_exp_elt_opcode (BINOP_REPEAT); ;
1200 #line 376 "./c-exp.y"
1201 { write_exp_elt_opcode (BINOP_MUL); ;
1204 #line 380 "./c-exp.y"
1205 { write_exp_elt_opcode (BINOP_DIV); ;
1208 #line 384 "./c-exp.y"
1209 { write_exp_elt_opcode (BINOP_REM); ;
1212 #line 388 "./c-exp.y"
1213 { write_exp_elt_opcode (BINOP_ADD); ;
1216 #line 392 "./c-exp.y"
1217 { write_exp_elt_opcode (BINOP_SUB); ;
1220 #line 396 "./c-exp.y"
1221 { write_exp_elt_opcode (BINOP_LSH); ;
1224 #line 400 "./c-exp.y"
1225 { write_exp_elt_opcode (BINOP_RSH); ;
1228 #line 404 "./c-exp.y"
1229 { write_exp_elt_opcode (BINOP_EQUAL); ;
1232 #line 408 "./c-exp.y"
1233 { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1236 #line 412 "./c-exp.y"
1237 { write_exp_elt_opcode (BINOP_LEQ); ;
1240 #line 416 "./c-exp.y"
1241 { write_exp_elt_opcode (BINOP_GEQ); ;
1244 #line 420 "./c-exp.y"
1245 { write_exp_elt_opcode (BINOP_LESS); ;
1248 #line 424 "./c-exp.y"
1249 { write_exp_elt_opcode (BINOP_GTR); ;
1252 #line 428 "./c-exp.y"
1253 { write_exp_elt_opcode (BINOP_BITWISE_AND); ;
1256 #line 432 "./c-exp.y"
1257 { write_exp_elt_opcode (BINOP_BITWISE_XOR); ;
1260 #line 436 "./c-exp.y"
1261 { write_exp_elt_opcode (BINOP_BITWISE_IOR); ;
1264 #line 440 "./c-exp.y"
1265 { write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1268 #line 444 "./c-exp.y"
1269 { write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1272 #line 448 "./c-exp.y"
1273 { write_exp_elt_opcode (TERNOP_COND); ;
1276 #line 452 "./c-exp.y"
1277 { write_exp_elt_opcode (BINOP_ASSIGN); ;
1280 #line 456 "./c-exp.y"
1281 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1282 write_exp_elt_opcode (yyvsp[-1].opcode);
1283 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
1286 #line 462 "./c-exp.y"
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); ;
1293 #line 469 "./c-exp.y"
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);
1303 #line 480 "./c-exp.y"
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); ;
1310 #line 494 "./c-exp.y"
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); ;
1318 #line 502 "./c-exp.y"
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); ;
1342 #line 527 "./c-exp.y"
1343 { write_exp_elt_opcode (OP_THIS);
1344 write_exp_elt_opcode (OP_THIS); ;
1347 #line 534 "./c-exp.y"
1349 if (yyvsp[0].ssym.sym != 0)
1350 yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1353 struct symtab *tem =
1354 lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
1356 yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
1358 error ("No file or function \"%s\".",
1359 copy_name (yyvsp[0].ssym.stoken));
1364 #line 551 "./c-exp.y"
1365 { struct symbol *tem
1366 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1367 VAR_NAMESPACE, (int *) NULL,
1368 (struct symtab **) NULL);
1369 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1370 error ("No function \"%s\" in specified context.",
1371 copy_name (yyvsp[0].sval));
1372 yyval.bval = SYMBOL_BLOCK_VALUE (tem); ;
1375 #line 562 "./c-exp.y"
1376 { struct symbol *sym;
1377 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1378 VAR_NAMESPACE, (int *) NULL,
1379 (struct symtab **) NULL);
1381 error ("No symbol \"%s\" in specified context.",
1382 copy_name (yyvsp[0].sval));
1384 write_exp_elt_opcode (OP_VAR_VALUE);
1385 /* block_found is set by lookup_symbol. */
1386 write_exp_elt_block (block_found);
1387 write_exp_elt_sym (sym);
1388 write_exp_elt_opcode (OP_VAR_VALUE); ;
1391 #line 578 "./c-exp.y"
1393 struct type *type = yyvsp[-2].tval;
1394 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1395 && TYPE_CODE (type) != TYPE_CODE_UNION)
1396 error ("`%s' is not defined as an aggregate type.",
1399 write_exp_elt_opcode (OP_SCOPE);
1400 write_exp_elt_type (type);
1401 write_exp_string (yyvsp[0].sval);
1402 write_exp_elt_opcode (OP_SCOPE);
1406 #line 591 "./c-exp.y"
1408 struct type *type = yyvsp[-3].tval;
1409 struct stoken tmp_token;
1410 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1411 && TYPE_CODE (type) != TYPE_CODE_UNION)
1412 error ("`%s' is not defined as an aggregate type.",
1415 if (!STREQ (type_name_no_tag (type), yyvsp[0].sval.ptr))
1416 error ("invalid destructor `%s::~%s'",
1417 type_name_no_tag (type), yyvsp[0].sval.ptr);
1419 tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
1420 tmp_token.length = yyvsp[0].sval.length + 1;
1421 tmp_token.ptr[0] = '~';
1422 memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
1423 tmp_token.ptr[tmp_token.length] = 0;
1424 write_exp_elt_opcode (OP_SCOPE);
1425 write_exp_elt_type (type);
1426 write_exp_string (tmp_token);
1427 write_exp_elt_opcode (OP_SCOPE);
1431 #line 617 "./c-exp.y"
1433 char *name = copy_name (yyvsp[0].sval);
1435 struct minimal_symbol *msymbol;
1438 lookup_symbol (name, (const struct block *) NULL,
1439 VAR_NAMESPACE, (int *) NULL,
1440 (struct symtab **) NULL);
1443 write_exp_elt_opcode (OP_VAR_VALUE);
1444 write_exp_elt_block (NULL);
1445 write_exp_elt_sym (sym);
1446 write_exp_elt_opcode (OP_VAR_VALUE);
1450 msymbol = lookup_minimal_symbol (name, NULL, NULL);
1451 if (msymbol != NULL)
1453 write_exp_msymbol (msymbol,
1454 lookup_function_type (builtin_type_int),
1458 if (!have_full_symbols () && !have_partial_symbols ())
1459 error ("No symbol table is loaded. Use the \"file\" command.");
1461 error ("No symbol \"%s\" in current context.", name);
1465 #line 651 "./c-exp.y"
1466 { struct symbol *sym = yyvsp[0].ssym.sym;
1470 if (symbol_read_needs_frame (sym))
1472 if (innermost_block == 0 ||
1473 contained_in (block_found,
1475 innermost_block = block_found;
1478 write_exp_elt_opcode (OP_VAR_VALUE);
1479 /* We want to use the selected frame, not
1480 another more inner frame which happens to
1481 be in the same block. */
1482 write_exp_elt_block (NULL);
1483 write_exp_elt_sym (sym);
1484 write_exp_elt_opcode (OP_VAR_VALUE);
1486 else if (yyvsp[0].ssym.is_a_field_of_this)
1488 /* C++: it hangs off of `this'. Must
1489 not inadvertently convert from a method call
1491 if (innermost_block == 0 ||
1492 contained_in (block_found, innermost_block))
1493 innermost_block = block_found;
1494 write_exp_elt_opcode (OP_THIS);
1495 write_exp_elt_opcode (OP_THIS);
1496 write_exp_elt_opcode (STRUCTOP_PTR);
1497 write_exp_string (yyvsp[0].ssym.stoken);
1498 write_exp_elt_opcode (STRUCTOP_PTR);
1502 struct minimal_symbol *msymbol;
1503 register char *arg = copy_name (yyvsp[0].ssym.stoken);
1506 lookup_minimal_symbol (arg, NULL, NULL);
1507 if (msymbol != NULL)
1509 write_exp_msymbol (msymbol,
1510 lookup_function_type (builtin_type_int),
1513 else if (!have_full_symbols () && !have_partial_symbols ())
1514 error ("No symbol table is loaded. Use the \"file\" command.");
1516 error ("No symbol \"%s\" in current context.",
1517 copy_name (yyvsp[0].ssym.stoken));
1522 #line 717 "./c-exp.y"
1523 { yyval.tval = follow_types (yyvsp[-1].tval); ;
1526 #line 719 "./c-exp.y"
1527 { yyval.tval = follow_types (yyvsp[-2].tval); ;
1530 #line 721 "./c-exp.y"
1531 { yyval.tval = follow_types (yyvsp[-2].tval); ;
1534 #line 725 "./c-exp.y"
1535 { push_type (tp_pointer); yyval.voidval = 0; ;
1538 #line 727 "./c-exp.y"
1539 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ;
1542 #line 729 "./c-exp.y"
1543 { push_type (tp_reference); yyval.voidval = 0; ;
1546 #line 731 "./c-exp.y"
1547 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ;
1550 #line 736 "./c-exp.y"
1551 { yyval.voidval = yyvsp[-1].voidval; ;
1554 #line 738 "./c-exp.y"
1556 push_type_int (yyvsp[0].lval);
1557 push_type (tp_array);
1561 #line 743 "./c-exp.y"
1563 push_type_int (yyvsp[0].lval);
1564 push_type (tp_array);
1569 #line 750 "./c-exp.y"
1570 { push_type (tp_function); ;
1573 #line 752 "./c-exp.y"
1574 { push_type (tp_function); ;
1577 #line 756 "./c-exp.y"
1578 { yyval.lval = -1; ;
1581 #line 758 "./c-exp.y"
1582 { yyval.lval = yyvsp[-1].typed_val_int.val; ;
1585 #line 762 "./c-exp.y"
1586 { yyval.voidval = 0; ;
1589 #line 764 "./c-exp.y"
1590 { free ((PTR)yyvsp[-1].tvec); yyval.voidval = 0; ;
1593 #line 777 "./c-exp.y"
1594 { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); ;
1597 #line 782 "./c-exp.y"
1598 { yyval.tval = yyvsp[0].tsym.type; ;
1601 #line 784 "./c-exp.y"
1602 { yyval.tval = builtin_type_int; ;
1605 #line 786 "./c-exp.y"
1606 { yyval.tval = builtin_type_long; ;
1609 #line 788 "./c-exp.y"
1610 { yyval.tval = builtin_type_short; ;
1613 #line 790 "./c-exp.y"
1614 { yyval.tval = builtin_type_long; ;
1617 #line 792 "./c-exp.y"
1618 { yyval.tval = builtin_type_unsigned_long; ;
1621 #line 794 "./c-exp.y"
1622 { yyval.tval = builtin_type_long_long; ;
1625 #line 796 "./c-exp.y"
1626 { yyval.tval = builtin_type_long_long; ;
1629 #line 798 "./c-exp.y"
1630 { yyval.tval = builtin_type_unsigned_long_long; ;
1633 #line 800 "./c-exp.y"
1634 { yyval.tval = builtin_type_unsigned_long_long; ;
1637 #line 802 "./c-exp.y"
1638 { yyval.tval = builtin_type_short; ;
1641 #line 804 "./c-exp.y"
1642 { yyval.tval = builtin_type_unsigned_short; ;
1645 #line 806 "./c-exp.y"
1646 { yyval.tval = builtin_type_double; ;
1649 #line 808 "./c-exp.y"
1650 { yyval.tval = builtin_type_long_double; ;
1653 #line 810 "./c-exp.y"
1654 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1655 expression_context_block); ;
1658 #line 813 "./c-exp.y"
1659 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1660 expression_context_block); ;
1663 #line 816 "./c-exp.y"
1664 { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
1665 expression_context_block); ;
1668 #line 819 "./c-exp.y"
1669 { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
1670 expression_context_block); ;
1673 #line 822 "./c-exp.y"
1674 { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
1677 #line 824 "./c-exp.y"
1678 { yyval.tval = builtin_type_unsigned_int; ;
1681 #line 826 "./c-exp.y"
1682 { yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
1685 #line 828 "./c-exp.y"
1686 { yyval.tval = builtin_type_int; ;
1689 #line 830 "./c-exp.y"
1690 { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
1691 expression_context_block);
1695 #line 836 "./c-exp.y"
1696 { yyval.tval = yyvsp[0].tval; ;
1699 #line 837 "./c-exp.y"
1700 { yyval.tval = yyvsp[0].tval; ;
1703 #line 842 "./c-exp.y"
1705 yyval.tsym.stoken.ptr = "int";
1706 yyval.tsym.stoken.length = 3;
1707 yyval.tsym.type = builtin_type_int;
1711 #line 848 "./c-exp.y"
1713 yyval.tsym.stoken.ptr = "long";
1714 yyval.tsym.stoken.length = 4;
1715 yyval.tsym.type = builtin_type_long;
1719 #line 854 "./c-exp.y"
1721 yyval.tsym.stoken.ptr = "short";
1722 yyval.tsym.stoken.length = 5;
1723 yyval.tsym.type = builtin_type_short;
1727 #line 863 "./c-exp.y"
1728 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1729 yyval.ivec[0] = 1; /* Number of types in vector */
1730 yyval.tvec[1] = yyvsp[0].tval;
1734 #line 868 "./c-exp.y"
1735 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1736 yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1737 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1741 #line 874 "./c-exp.y"
1742 { yyval.sval = yyvsp[0].ssym.stoken; ;
1745 #line 875 "./c-exp.y"
1746 { yyval.sval = yyvsp[0].ssym.stoken; ;
1749 #line 876 "./c-exp.y"
1750 { yyval.sval = yyvsp[0].tsym.stoken; ;
1753 #line 877 "./c-exp.y"
1754 { yyval.sval = yyvsp[0].ssym.stoken; ;
1757 /* the action file gets copied in in place of this dollarsign */
1758 #line 487 "/usr/unsupported/share/bison.simple"
1769 short *ssp1 = yyss - 1;
1770 fprintf (stderr, "state stack now");
1771 while (ssp1 != yyssp)
1772 fprintf (stderr, " %d", *++ssp1);
1773 fprintf (stderr, "\n");
1783 yylsp->first_line = yylloc.first_line;
1784 yylsp->first_column = yylloc.first_column;
1785 yylsp->last_line = (yylsp-1)->last_line;
1786 yylsp->last_column = (yylsp-1)->last_column;
1791 yylsp->last_line = (yylsp+yylen-1)->last_line;
1792 yylsp->last_column = (yylsp+yylen-1)->last_column;
1796 /* Now "shift" the result of the reduction.
1797 Determine what state that goes to,
1798 based on the state we popped back to
1799 and the rule number reduced by. */
1803 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1804 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1805 yystate = yytable[yystate];
1807 yystate = yydefgoto[yyn - YYNTBASE];
1811 yyerrlab: /* here on detecting error */
1814 /* If not already recovering from an error, report this error. */
1818 #ifdef YYERROR_VERBOSE
1819 yyn = yypact[yystate];
1821 if (yyn > YYFLAG && yyn < YYLAST)
1828 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1829 for (x = (yyn < 0 ? -yyn : 0);
1830 x < (sizeof(yytname) / sizeof(char *)); x++)
1831 if (yycheck[x + yyn] == x)
1832 size += strlen(yytname[x]) + 15, count++;
1833 msg = (char *) xmalloc(size + 15);
1836 strcpy(msg, "parse error");
1841 for (x = (yyn < 0 ? -yyn : 0);
1842 x < (sizeof(yytname) / sizeof(char *)); x++)
1843 if (yycheck[x + yyn] == x)
1845 strcat(msg, count == 0 ? ", expecting `" : " or `");
1846 strcat(msg, yytname[x]);
1855 yyerror ("parse error; also virtual memory exceeded");
1858 #endif /* YYERROR_VERBOSE */
1859 yyerror("parse error");
1863 yyerrlab1: /* here on error raised explicitly by an action */
1865 if (yyerrstatus == 3)
1867 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1869 /* return failure if at end of input */
1870 if (yychar == YYEOF)
1875 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1881 /* Else will try to reuse lookahead token
1882 after shifting the error token. */
1884 yyerrstatus = 3; /* Each real token shifted decrements this */
1888 yyerrdefault: /* current state does not do anything special for the error token. */
1891 /* This is wrong; only states that explicitly want error tokens
1892 should shift them. */
1893 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1894 if (yyn) goto yydefault;
1897 yyerrpop: /* pop the current state because it cannot handle the error token */
1899 if (yyssp == yyss) YYABORT;
1909 short *ssp1 = yyss - 1;
1910 fprintf (stderr, "Error: state stack now");
1911 while (ssp1 != yyssp)
1912 fprintf (stderr, " %d", *++ssp1);
1913 fprintf (stderr, "\n");
1919 yyn = yypact[yystate];
1924 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1943 fprintf(stderr, "Shifting error token, ");
1954 #line 891 "./c-exp.y"
1957 /* Take care of parsing a number (anything that starts with a digit).
1958 Set yylval and return the token type; update lexptr.
1959 LEN is the number of characters in it. */
1961 /*** Needs some error checking for the float case ***/
1964 parse_number (p, len, parsed_float, putithere)
1970 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
1971 here, and we do kind of silly things like cast to unsigned. */
1972 register LONGEST n = 0;
1973 register LONGEST prevn = 0;
1974 unsigned LONGEST un;
1978 register int base = input_radix;
1981 /* Number of "L" suffixes encountered. */
1984 /* We have found a "L" or "U" suffix. */
1985 int found_suffix = 0;
1987 unsigned LONGEST high_bit;
1988 struct type *signed_type;
1989 struct type *unsigned_type;
1995 /* It's a float since it contains a point or an exponent. */
1997 if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
1998 sscanf (p, "%g", &putithere->typed_val_float.dval);
1999 else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2000 sscanf (p, "%lg", &putithere->typed_val_float.dval);
2003 #ifdef PRINTF_HAS_LONG_DOUBLE
2004 sscanf (p, "%Lg", &putithere->typed_val_float.dval);
2006 /* Scan it into a double, then assign it to the long double.
2007 This at least wins with values representable in the range
2010 sscanf (p, "%lg", &temp);
2011 putithere->typed_val_float.dval = temp;
2015 /* See if it has `f' or `l' suffix (float or long double). */
2017 c = tolower (p[len - 1]);
2020 putithere->typed_val_float.type = builtin_type_float;
2022 putithere->typed_val_float.type = builtin_type_long_double;
2023 else if (isdigit (c) || c == '.')
2024 putithere->typed_val_float.type = builtin_type_double;
2031 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2065 if (c >= 'A' && c <= 'Z')
2067 if (c != 'l' && c != 'u')
2069 if (c >= '0' && c <= '9')
2077 if (base > 10 && c >= 'a' && c <= 'f')
2081 n += i = c - 'a' + 10;
2094 return ERROR; /* Char not a digit */
2097 return ERROR; /* Invalid digit in this base */
2099 /* Portably test for overflow (only works for nonzero values, so make
2100 a second check for zero). FIXME: Can't we just make n and prevn
2101 unsigned and avoid this? */
2102 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2103 unsigned_p = 1; /* Try something unsigned */
2105 /* Portably test for unsigned overflow.
2106 FIXME: This check is wrong; for example it doesn't find overflow
2107 on 0x123456789 when LONGEST is 32 bits. */
2108 if (c != 'l' && c != 'u' && n != 0)
2110 if ((unsigned_p && (unsigned LONGEST) prevn >= (unsigned LONGEST) n))
2111 error ("Numeric constant too large.");
2116 /* An integer constant is an int, a long, or a long long. An L
2117 suffix forces it to be long; an LL suffix forces it to be long
2118 long. If not forced to a larger size, it gets the first type of
2119 the above that it fits in. To figure out whether it fits, we
2120 shift it right and see whether anything remains. Note that we
2121 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2122 operation, because many compilers will warn about such a shift
2123 (which always produces a zero result). Sometimes TARGET_INT_BIT
2124 or TARGET_LONG_BIT will be that big, sometimes not. To deal with
2125 the case where it is we just always shift the value more than
2126 once, with fewer bits each time. */
2128 un = (unsigned LONGEST)n >> 2;
2130 && (un >> (TARGET_INT_BIT - 2)) == 0)
2132 high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
2134 /* A large decimal (not hex or octal) constant (between INT_MAX
2135 and UINT_MAX) is a long or unsigned long, according to ANSI,
2136 never an unsigned int, but this code treats it as unsigned
2137 int. This probably should be fixed. GCC gives a warning on
2140 unsigned_type = builtin_type_unsigned_int;
2141 signed_type = builtin_type_int;
2143 else if (long_p <= 1
2144 && (un >> (TARGET_LONG_BIT - 2)) == 0)
2146 high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
2147 unsigned_type = builtin_type_unsigned_long;
2148 signed_type = builtin_type_long;
2152 high_bit = (((unsigned LONGEST)1)
2153 << (TARGET_LONG_LONG_BIT - 32 - 1)
2157 /* A long long does not fit in a LONGEST. */
2159 (unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
2160 unsigned_type = builtin_type_unsigned_long_long;
2161 signed_type = builtin_type_long_long;
2164 putithere->typed_val_int.val = n;
2166 /* If the high bit of the worked out type is set then this number
2167 has to be unsigned. */
2169 if (unsigned_p || (n & high_bit))
2171 putithere->typed_val_int.type = unsigned_type;
2175 putithere->typed_val_int.type = signed_type;
2185 enum exp_opcode opcode;
2188 static const struct token tokentab3[] =
2190 {">>=", ASSIGN_MODIFY, BINOP_RSH},
2191 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2194 static const struct token tokentab2[] =
2196 {"+=", ASSIGN_MODIFY, BINOP_ADD},
2197 {"-=", ASSIGN_MODIFY, BINOP_SUB},
2198 {"*=", ASSIGN_MODIFY, BINOP_MUL},
2199 {"/=", ASSIGN_MODIFY, BINOP_DIV},
2200 {"%=", ASSIGN_MODIFY, BINOP_REM},
2201 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2202 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2203 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2204 {"++", INCREMENT, BINOP_END},
2205 {"--", DECREMENT, BINOP_END},
2206 {"->", ARROW, BINOP_END},
2207 {"&&", ANDAND, BINOP_END},
2208 {"||", OROR, BINOP_END},
2209 {"::", COLONCOLON, BINOP_END},
2210 {"<<", LSH, BINOP_END},
2211 {">>", RSH, BINOP_END},
2212 {"==", EQUAL, BINOP_END},
2213 {"!=", NOTEQUAL, BINOP_END},
2214 {"<=", LEQ, BINOP_END},
2215 {">=", GEQ, BINOP_END}
2218 /* Read one token, getting characters through lexptr. */
2229 static char *tempbuf;
2230 static int tempbufsize;
2235 /* See if it is a special token of length 3. */
2236 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2237 if (STREQN (tokstart, tokentab3[i].operator, 3))
2240 yylval.opcode = tokentab3[i].opcode;
2241 return tokentab3[i].token;
2244 /* See if it is a special token of length 2. */
2245 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2246 if (STREQN (tokstart, tokentab2[i].operator, 2))
2249 yylval.opcode = tokentab2[i].opcode;
2250 return tokentab2[i].token;
2253 switch (c = *tokstart)
2265 /* We either have a character constant ('0' or '\177' for example)
2266 or we have a quoted symbol reference ('foo(int,int)' in C++
2271 c = parse_escape (&lexptr);
2273 error ("Empty character constant.");
2275 yylval.typed_val_int.val = c;
2276 yylval.typed_val_int.type = builtin_type_char;
2281 namelen = skip_quoted (tokstart) - tokstart;
2284 lexptr = tokstart + namelen;
2285 if (lexptr[-1] != '\'')
2286 error ("Unmatched single quote.");
2291 error ("Invalid character constant.");
2301 if (paren_depth == 0)
2308 if (comma_terminates && paren_depth == 0)
2314 /* Might be a floating point number. */
2315 if (lexptr[1] < '0' || lexptr[1] > '9')
2316 goto symbol; /* Nope, must be a symbol. */
2317 /* FALL THRU into number case. */
2330 /* It's a number. */
2331 int got_dot = 0, got_e = 0, toktype;
2332 register char *p = tokstart;
2333 int hex = input_radix > 10;
2335 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2340 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2348 /* This test includes !hex because 'e' is a valid hex digit
2349 and thus does not indicate a floating point number when
2350 the radix is hex. */
2351 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2352 got_dot = got_e = 1;
2353 /* This test does not include !hex, because a '.' always indicates
2354 a decimal floating point number regardless of the radix. */
2355 else if (!got_dot && *p == '.')
2357 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2358 && (*p == '-' || *p == '+'))
2359 /* This is the sign of the exponent, not the end of the
2362 /* We will take any letters or digits. parse_number will
2363 complain if past the radix, or if L or U are not final. */
2364 else if ((*p < '0' || *p > '9')
2365 && ((*p < 'a' || *p > 'z')
2366 && (*p < 'A' || *p > 'Z')))
2369 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2370 if (toktype == ERROR)
2372 char *err_copy = (char *) alloca (p - tokstart + 1);
2374 memcpy (err_copy, tokstart, p - tokstart);
2375 err_copy[p - tokstart] = 0;
2376 error ("Invalid number \"%s\".", err_copy);
2408 /* Build the gdb internal form of the input string in tempbuf,
2409 translating any standard C escape forms seen. Note that the
2410 buffer is null byte terminated *only* for the convenience of
2411 debugging gdb itself and printing the buffer contents when
2412 the buffer contains no embedded nulls. Gdb does not depend
2413 upon the buffer being null byte terminated, it uses the length
2414 string instead. This allows gdb to handle C strings (as well
2415 as strings in other languages) with embedded null bytes */
2417 tokptr = ++tokstart;
2421 /* Grow the static temp buffer if necessary, including allocating
2422 the first one on demand. */
2423 if (tempbufindex + 1 >= tempbufsize)
2425 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2431 /* Do nothing, loop will terminate. */
2435 c = parse_escape (&tokptr);
2440 tempbuf[tempbufindex++] = c;
2443 tempbuf[tempbufindex++] = *tokptr++;
2446 } while ((*tokptr != '"') && (*tokptr != '\0'));
2447 if (*tokptr++ != '"')
2449 error ("Unterminated string in expression.");
2451 tempbuf[tempbufindex] = '\0'; /* See note above */
2452 yylval.sval.ptr = tempbuf;
2453 yylval.sval.length = tempbufindex;
2458 if (!(c == '_' || c == '$'
2459 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2460 /* We must have come across a bad character (e.g. ';'). */
2461 error ("Invalid character '%c' in expression.", c);
2463 /* It's a name. See how long it is. */
2465 for (c = tokstart[namelen];
2466 (c == '_' || c == '$' || (c >= '0' && c <= '9')
2467 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
2472 while (tokstart[++i] && tokstart[i] != '>');
2473 if (tokstart[i] == '>')
2476 c = tokstart[++namelen];
2479 /* The token "if" terminates the expression and is NOT
2480 removed from the input stream. */
2481 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2490 /* Catch specific keywords. Should be done with a data structure. */
2494 if (STREQN (tokstart, "unsigned", 8))
2496 if (current_language->la_language == language_cplus
2497 && STREQN (tokstart, "template", 8))
2499 if (STREQN (tokstart, "volatile", 8))
2500 return VOLATILE_KEYWORD;
2503 if (STREQN (tokstart, "struct", 6))
2505 if (STREQN (tokstart, "signed", 6))
2506 return SIGNED_KEYWORD;
2507 if (STREQN (tokstart, "sizeof", 6))
2509 if (STREQN (tokstart, "double", 6))
2510 return DOUBLE_KEYWORD;
2513 if (current_language->la_language == language_cplus
2514 && STREQN (tokstart, "class", 5))
2516 if (STREQN (tokstart, "union", 5))
2518 if (STREQN (tokstart, "short", 5))
2520 if (STREQN (tokstart, "const", 5))
2521 return CONST_KEYWORD;
2524 if (STREQN (tokstart, "enum", 4))
2526 if (STREQN (tokstart, "long", 4))
2528 if (current_language->la_language == language_cplus
2529 && STREQN (tokstart, "this", 4))
2531 static const char this_name[] =
2532 { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
2534 if (lookup_symbol (this_name, expression_context_block,
2535 VAR_NAMESPACE, (int *) NULL,
2536 (struct symtab **) NULL))
2541 if (STREQN (tokstart, "int", 3))
2548 yylval.sval.ptr = tokstart;
2549 yylval.sval.length = namelen;
2551 if (*tokstart == '$')
2553 write_dollar_variable (yylval.sval);
2557 /* Use token-type BLOCKNAME for symbols that happen to be defined as
2558 functions or symtabs. If this is not so, then ...
2559 Use token-type TYPENAME for symbols that happen to be defined
2560 currently as names of types; NAME for other symbols.
2561 The caller is not constrained to care about the distinction. */
2563 char *tmp = copy_name (yylval.sval);
2565 int is_a_field_of_this = 0;
2568 sym = lookup_symbol (tmp, expression_context_block,
2570 current_language->la_language == language_cplus
2571 ? &is_a_field_of_this : (int *) NULL,
2572 (struct symtab **) NULL);
2573 /* Call lookup_symtab, not lookup_partial_symtab, in case there are
2574 no psymtabs (coff, xcoff, or some future change to blow away the
2575 psymtabs once once symbols are read). */
2576 if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
2577 lookup_symtab (tmp))
2579 yylval.ssym.sym = sym;
2580 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2583 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2586 /* Despite the following flaw, we need to keep this code enabled.
2587 Because we can get called from check_stub_method, if we don't
2588 handle nested types then it screws many operations in any
2589 program which uses nested types. */
2590 /* In "A::x", if x is a member function of A and there happens
2591 to be a type (nested or not, since the stabs don't make that
2592 distinction) named x, then this code incorrectly thinks we
2593 are dealing with nested types rather than a member function. */
2597 struct symbol *best_sym;
2599 /* Look ahead to detect nested types. This probably should be
2600 done in the grammar, but trying seemed to introduce a lot
2601 of shift/reduce and reduce/reduce conflicts. It's possible
2602 that it could be done, though. Or perhaps a non-grammar, but
2603 less ad hoc, approach would work well. */
2605 /* Since we do not currently have any way of distinguishing
2606 a nested type from a non-nested one (the stabs don't tell
2607 us whether a type is nested), we just ignore the
2614 /* Skip whitespace. */
2615 while (*p == ' ' || *p == '\t' || *p == '\n')
2617 if (*p == ':' && p[1] == ':')
2619 /* Skip the `::'. */
2621 /* Skip whitespace. */
2622 while (*p == ' ' || *p == '\t' || *p == '\n')
2625 while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
2626 || (*p >= 'a' && *p <= 'z')
2627 || (*p >= 'A' && *p <= 'Z'))
2631 struct symbol *cur_sym;
2632 /* As big as the whole rest of the expression, which is
2633 at least big enough. */
2634 char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
2638 memcpy (tmp1, tmp, strlen (tmp));
2639 tmp1 += strlen (tmp);
2640 memcpy (tmp1, "::", 2);
2642 memcpy (tmp1, namestart, p - namestart);
2643 tmp1[p - namestart] = '\0';
2644 cur_sym = lookup_symbol (ncopy, expression_context_block,
2645 VAR_NAMESPACE, (int *) NULL,
2646 (struct symtab **) NULL);
2649 if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
2667 yylval.tsym.type = SYMBOL_TYPE (best_sym);
2669 yylval.tsym.type = SYMBOL_TYPE (sym);
2673 if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2676 /* Input names that aren't symbols but ARE valid hex numbers,
2677 when the input radix permits them, can be names or numbers
2678 depending on the parse. Note we support radixes > 16 here. */
2680 ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2681 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2683 YYSTYPE newlval; /* Its value is ignored. */
2684 hextype = parse_number (tokstart, namelen, 0, &newlval);
2687 yylval.ssym.sym = sym;
2688 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2693 /* Any other kind of symbol */
2694 yylval.ssym.sym = sym;
2695 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2704 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);