2 /* A Bison parser, made from m2-exp.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
29 #define FLOAT_FUNC 279
38 #define COLONCOLON 288
39 #define INTERNAL_VAR 289
40 #define ABOVE_COMMA 290
47 #define LOGICAL_AND 297
59 #include "gdb_string.h"
60 #include "expression.h"
63 #include "parser-defs.h"
65 #include "bfd.h" /* Required by objfiles.h. */
66 #include "symfile.h" /* Required by objfiles.h. */
67 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
69 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
70 as well as gratuitiously global symbol names, so we can have multiple
71 yacc generated parsers in gdb. 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 m2_maxdepth
77 #define yyparse m2_parse
79 #define yyerror m2_error
80 #define yylval m2_lval
81 #define yychar m2_char
82 #define yydebug m2_debug
83 #define yypact m2_pact
90 #define yyexca m2_exca
91 #define yyerrflag m2_errflag
92 #define yynerrs m2_nerrs
97 #define yystate m2_state
100 #define yy_yyv m2_yyv
102 #define yylloc m2_lloc
103 #define yyreds m2_reds /* With YYDEBUG defined */
104 #define yytoks m2_toks /* With YYDEBUG defined */
105 #define yylhs m2_yylhs
106 #define yylen m2_yylen
107 #define yydefred m2_yydefred
108 #define yydgoto m2_yydgoto
109 #define yysindex m2_yysindex
110 #define yyrindex m2_yyrindex
111 #define yygindex m2_yygindex
112 #define yytable m2_yytable
113 #define yycheck m2_yycheck
116 #define YYDEBUG 0 /* Default to no yydebug support */
120 yyparse PARAMS ((void));
123 yylex PARAMS ((void));
126 yyerror PARAMS ((char *));
130 make_qualname PARAMS ((char *, char *));
134 parse_number PARAMS ((int));
136 /* The sign of the number being parsed. */
137 static int number_sign = 1;
139 /* The block that the module specified by the qualifer on an identifer is
142 static struct block *modblock=0;
157 enum exp_opcode opcode;
158 struct internalvar *ivar;
174 #define YYFLAG -32768
177 #define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 82)
179 static const char yytranslate[] = { 0,
180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
183 2, 2, 2, 2, 44, 2, 2, 48, 2, 60,
184 64, 52, 50, 35, 51, 2, 53, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 38,
186 42, 39, 2, 49, 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 59, 2, 67, 57, 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, 65, 2, 66, 62, 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, 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, 1, 2, 3, 4, 5,
206 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
207 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
208 26, 27, 28, 29, 30, 31, 32, 33, 34, 36,
209 37, 40, 41, 43, 45, 46, 47, 54, 55, 56,
214 static const short yyprhs[] = { 0,
215 0, 2, 4, 6, 9, 10, 14, 17, 20, 22,
216 24, 29, 34, 39, 44, 49, 54, 59, 66, 71,
217 76, 81, 84, 89, 96, 101, 108, 112, 114, 118,
218 125, 132, 136, 141, 142, 148, 149, 155, 156, 158,
219 162, 164, 168, 173, 178, 182, 186, 190, 194, 198,
220 202, 206, 210, 214, 218, 222, 226, 230, 234, 238,
221 242, 246, 250, 252, 254, 256, 258, 260, 262, 264,
222 269, 271, 273, 275, 279, 281, 283, 287, 289
225 static const short yyrhs[] = { 70,
226 0, 69, 0, 81, 0, 70, 57, 0, 0, 51,
227 71, 70, 0, 50, 70, 0, 72, 70, 0, 61,
228 0, 62, 0, 18, 60, 70, 64, 0, 19, 60,
229 70, 64, 0, 21, 60, 70, 64, 0, 20, 60,
230 70, 64, 0, 22, 60, 81, 64, 0, 23, 60,
231 81, 64, 0, 24, 60, 70, 64, 0, 25, 60,
232 81, 35, 70, 64, 0, 26, 60, 70, 64, 0,
233 27, 60, 70, 64, 0, 28, 60, 70, 64, 0,
234 17, 70, 0, 29, 60, 70, 64, 0, 29, 60,
235 70, 35, 70, 64, 0, 30, 60, 70, 64, 0,
236 30, 60, 70, 35, 70, 64, 0, 70, 58, 12,
237 0, 73, 0, 70, 45, 73, 0, 31, 60, 70,
238 35, 70, 64, 0, 32, 60, 70, 35, 70, 64,
239 0, 65, 76, 66, 0, 81, 65, 76, 66, 0,
240 0, 70, 59, 74, 77, 67, 0, 0, 70, 60,
241 75, 76, 64, 0, 0, 70, 0, 76, 35, 70,
242 0, 70, 0, 77, 35, 70, 0, 65, 81, 66,
243 70, 0, 81, 60, 70, 64, 0, 60, 70, 64,
244 0, 70, 49, 70, 0, 70, 52, 70, 0, 70,
245 53, 70, 0, 70, 54, 70, 0, 70, 55, 70,
246 0, 70, 50, 70, 0, 70, 51, 70, 0, 70,
247 42, 70, 0, 70, 43, 70, 0, 70, 44, 70,
248 0, 70, 40, 70, 0, 70, 41, 70, 0, 70,
249 38, 70, 0, 70, 39, 70, 0, 70, 47, 70,
250 0, 70, 46, 70, 0, 70, 37, 70, 0, 7,
251 0, 8, 0, 3, 0, 6, 0, 9, 0, 10,
252 0, 80, 0, 17, 60, 81, 64, 0, 11, 0,
253 79, 0, 13, 0, 78, 33, 13, 0, 79, 0,
254 34, 0, 78, 33, 12, 0, 12, 0, 16, 0
260 static const short yyrline[] = { 0,
261 204, 205, 208, 217, 220, 222, 227, 231, 235, 236,
262 239, 243, 247, 251, 255, 261, 267, 271, 277, 281,
263 285, 289, 294, 298, 304, 308, 314, 320, 323, 327,
264 331, 334, 336, 342, 347, 353, 357, 363, 366, 370,
265 375, 380, 385, 391, 397, 405, 409, 413, 417, 421,
266 425, 429, 433, 437, 439, 443, 447, 451, 455, 459,
267 463, 467, 474, 480, 486, 493, 502, 510, 517, 520,
268 527, 534, 538, 547, 559, 567, 571, 587, 638
273 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
275 static const char * const yytname[] = { "$","error","$undefined.","INT","HEX",
276 "ERROR","UINT","M2_TRUE","M2_FALSE","CHAR","FLOAT","STRING","NAME","BLOCKNAME",
277 "IDENT","VARNAME","TYPENAME","SIZE","CAP","ORD","HIGH","ABS","MIN_FUNC","MAX_FUNC",
278 "FLOAT_FUNC","VAL","CHR","ODD","TRUNC","INC","DEC","INCL","EXCL","COLONCOLON",
279 "INTERNAL_VAR","','","ABOVE_COMMA","ASSIGN","'<'","'>'","LEQ","GEQ","'='","NOTEQUAL",
280 "'#'","IN","OROR","LOGICAL_AND","'&'","'@'","'+'","'-'","'*'","'/'","DIV","MOD",
281 "UNARY","'^'","DOT","'['","'('","NOT","'~'","QID","')'","'{'","'}'","']'","start",
282 "type_exp","exp","@1","not_exp","set","@2","@3","arglist","non_empty_arglist",
283 "block","fblock","variable","type", NULL
287 static const short yyr1[] = { 0,
288 68, 68, 69, 70, 71, 70, 70, 70, 72, 72,
289 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
290 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
291 70, 73, 73, 74, 70, 75, 70, 76, 76, 76,
292 77, 77, 70, 70, 70, 70, 70, 70, 70, 70,
293 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
294 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
295 70, 78, 79, 79, 80, 80, 80, 80, 81
298 static const short yyr2[] = { 0,
299 1, 1, 1, 2, 0, 3, 2, 2, 1, 1,
300 4, 4, 4, 4, 4, 4, 4, 6, 4, 4,
301 4, 2, 4, 6, 4, 6, 3, 1, 3, 6,
302 6, 3, 4, 0, 5, 0, 5, 0, 1, 3,
303 1, 3, 4, 4, 3, 3, 3, 3, 3, 3,
304 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
305 3, 3, 1, 1, 1, 1, 1, 1, 1, 4,
306 1, 1, 1, 3, 1, 1, 3, 1, 1
309 static const short yydefact[] = { 0,
310 65, 66, 63, 64, 67, 68, 71, 78, 73, 79,
311 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
312 0, 0, 0, 0, 0, 0, 76, 0, 5, 0,
313 9, 10, 38, 2, 1, 0, 28, 0, 75, 69,
314 3, 0, 22, 0, 0, 0, 0, 0, 0, 0,
315 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,
316 0, 0, 39, 0, 0, 0, 0, 0, 0, 0,
317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
318 0, 0, 0, 4, 0, 34, 36, 8, 0, 0,
319 38, 0, 0, 0, 0, 0, 0, 0, 0, 0,
320 0, 0, 0, 0, 0, 0, 0, 6, 45, 0,
321 32, 0, 62, 58, 59, 56, 57, 53, 54, 55,
322 38, 29, 0, 61, 60, 46, 51, 52, 47, 48,
323 49, 50, 27, 0, 38, 77, 74, 0, 0, 70,
324 11, 12, 14, 13, 15, 16, 17, 0, 19, 20,
325 21, 0, 23, 0, 25, 0, 0, 40, 43, 41,
326 0, 0, 44, 33, 0, 0, 0, 0, 0, 0,
327 35, 37, 18, 24, 26, 30, 31, 42, 0, 0,
331 static const short yydefgoto[] = { 179,
332 34, 63, 61, 36, 37, 134, 135, 64, 161, 38,
336 static const short yypact[] = { 155,
337 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
338 215, -27, -22, -20, -19, 14, 24, 26, 27, 28,
339 29, 31, 32, 33, 35, 36,-32768, 155,-32768, 155,
340 -32768,-32768, 155,-32768, 742, 155,-32768, -6, -4,-32768,
341 -34, 155, 5, -34, 155, 155, 155, 155, 44, 44,
342 155, 44, 155, 155, 155, 155, 155, 155, 155, 5,
343 155, 272, 742, -31, -41, 155, 155, 155, 155, 155,
344 155, 155, 155, -15, 155, 155, 155, 155, 155, 155,
345 155, 155, 155,-32768, 85,-32768,-32768, 5, -5, 155,
346 155, -21, 300, 328, 356, 384, 34, 39, 412, 64,
347 440, 468, 496, 78, 244, 692, 718, 5,-32768, 155,
348 -32768, 155, 766, -37, -37, -37, -37, -37, -37, -37,
349 155,-32768, 40, 141, 201, 777, 786, 786, 5, 5,
350 5, 5,-32768, 155, 155,-32768,-32768, 524, -29,-32768,
351 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 155,-32768,-32768,
352 -32768, 155,-32768, 155,-32768, 155, 155, 742, 5, 742,
353 -33, -32,-32768,-32768, 552, 580, 608, 636, 664, 155,
354 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 742, 100, 106,
358 static const short yypgoto[] = {-32768,
359 -32768, 0,-32768,-32768, 37,-32768,-32768, -86,-32768,-32768,
367 static const short yytable[] = { 35,
368 10, 170, 110, 110, 139, 110, 136, 137, 75, 76,
369 43, 77, 78, 79, 80, 81, 82, 83, 90, 84,
370 85, 86, 87, 91, 112, 90, 89, 60, -72, 62,
371 91, 172, 45, 171, 111, 88, 164, 46, 90, 47,
372 48, 62, 140, 91, 93, 94, 95, 96, 162, 121,
373 99, 41, 101, 102, 103, 104, 105, 106, 107, 10,
374 108, 84, 85, 86, 87, 113, 114, 115, 116, 117,
375 118, 119, 120, 49, 124, 125, 126, 127, 128, 129,
376 130, 131, 132, 50, 65, 51, 52, 53, 54, 138,
377 55, 56, 57, 92, 58, 59, 133, 145, 148, 180,
378 97, 98, 146, 100, 91, 181, 0, 0, 0, 158,
379 122, 159, 152, 0, 66, 67, 68, 69, 70, 71,
380 72, 73, 74, 75, 76, 123, 77, 78, 79, 80,
381 81, 82, 83, 160, 84, 85, 86, 87, 0, 0,
382 0, 153, 0, 0, 0, 0, 0, 165, 0, 0,
383 0, 166, 0, 167, 0, 168, 169, 1, 0, 0,
384 2, 3, 4, 5, 6, 7, 8, 9, 0, 178,
385 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
386 20, 21, 22, 23, 24, 25, 26, 76, 27, 77,
387 78, 79, 80, 81, 82, 83, 0, 84, 85, 86,
388 87, 0, 0, 0, 28, 29, 0, 0, 0, 0,
389 0, 0, 0, 0, 30, 31, 32, 1, 0, 33,
390 2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
391 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
392 20, 21, 22, 23, 24, 25, 26, 0, 27, 77,
393 78, 79, 80, 81, 82, 83, 0, 84, 85, 86,
394 87, 0, 0, 0, 28, 29, 0, 0, 0, 0,
395 0, 0, 0, 0, 42, 31, 32, 0, 154, 33,
396 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
397 76, 0, 77, 78, 79, 80, 81, 82, 83, 0,
398 84, 85, 86, 87, 0, 0, 0, 155, 66, 67,
399 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
400 77, 78, 79, 80, 81, 82, 83, 0, 84, 85,
401 86, 87, 0, 0, 0, 109, 66, 67, 68, 69,
402 70, 71, 72, 73, 74, 75, 76, 0, 77, 78,
403 79, 80, 81, 82, 83, 0, 84, 85, 86, 87,
404 0, 0, 0, 141, 66, 67, 68, 69, 70, 71,
405 72, 73, 74, 75, 76, 0, 77, 78, 79, 80,
406 81, 82, 83, 0, 84, 85, 86, 87, 0, 0,
407 0, 142, 66, 67, 68, 69, 70, 71, 72, 73,
408 74, 75, 76, 0, 77, 78, 79, 80, 81, 82,
409 83, 0, 84, 85, 86, 87, 0, 0, 0, 143,
410 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
411 76, 0, 77, 78, 79, 80, 81, 82, 83, 0,
412 84, 85, 86, 87, 0, 0, 0, 144, 66, 67,
413 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
414 77, 78, 79, 80, 81, 82, 83, 0, 84, 85,
415 86, 87, 0, 0, 0, 147, 66, 67, 68, 69,
416 70, 71, 72, 73, 74, 75, 76, 0, 77, 78,
417 79, 80, 81, 82, 83, 0, 84, 85, 86, 87,
418 0, 0, 0, 149, 66, 67, 68, 69, 70, 71,
419 72, 73, 74, 75, 76, 0, 77, 78, 79, 80,
420 81, 82, 83, 0, 84, 85, 86, 87, 0, 0,
421 0, 150, 66, 67, 68, 69, 70, 71, 72, 73,
422 74, 75, 76, 0, 77, 78, 79, 80, 81, 82,
423 83, 0, 84, 85, 86, 87, 0, 0, 0, 151,
424 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
425 76, 0, 77, 78, 79, 80, 81, 82, 83, 0,
426 84, 85, 86, 87, 0, 0, 0, 163, 66, 67,
427 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
428 77, 78, 79, 80, 81, 82, 83, 0, 84, 85,
429 86, 87, 0, 0, 0, 173, 66, 67, 68, 69,
430 70, 71, 72, 73, 74, 75, 76, 0, 77, 78,
431 79, 80, 81, 82, 83, 0, 84, 85, 86, 87,
432 0, 0, 0, 174, 66, 67, 68, 69, 70, 71,
433 72, 73, 74, 75, 76, 0, 77, 78, 79, 80,
434 81, 82, 83, 0, 84, 85, 86, 87, 0, 0,
435 0, 175, 66, 67, 68, 69, 70, 71, 72, 73,
436 74, 75, 76, 0, 77, 78, 79, 80, 81, 82,
437 83, 0, 84, 85, 86, 87, 0, 0, 0, 176,
438 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
439 76, 0, 77, 78, 79, 80, 81, 82, 83, 0,
440 84, 85, 86, 87, 0, 0, 156, 177, 66, 67,
441 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
442 77, 78, 79, 80, 81, 82, 83, 0, 84, 85,
443 86, 87, 157, 0, 66, 67, 68, 69, 70, 71,
444 72, 73, 74, 75, 76, 0, 77, 78, 79, 80,
445 81, 82, 83, 0, 84, 85, 86, 87, 66, 67,
446 68, 69, 70, 71, 72, 73, 74, 75, 76, 0,
447 77, 78, 79, 80, 81, 82, 83, 0, 84, 85,
448 86, 87,-32768, 67, 68, 69, 70, 71, 72, 73,
449 74, 75, 76, 0, 77, 78, 79, 80, 81, 82,
450 83, 0, 84, 85, 86, 87, 78, 79, 80, 81,
451 82, 83, 0, 84, 85, 86, 87, 80, 81, 82,
452 83, 0, 84, 85, 86, 87
455 static const short yycheck[] = { 0,
456 16, 35, 35, 35, 91, 35, 12, 13, 46, 47,
457 11, 49, 50, 51, 52, 53, 54, 55, 60, 57,
458 58, 59, 60, 65, 66, 60, 33, 28, 33, 30,
459 65, 64, 60, 67, 66, 36, 66, 60, 60, 60,
460 60, 42, 64, 65, 45, 46, 47, 48, 135, 65,
461 51, 0, 53, 54, 55, 56, 57, 58, 59, 16,
462 61, 57, 58, 59, 60, 66, 67, 68, 69, 70,
463 71, 72, 73, 60, 75, 76, 77, 78, 79, 80,
464 81, 82, 83, 60, 33, 60, 60, 60, 60, 90,
465 60, 60, 60, 42, 60, 60, 12, 64, 35, 0,
466 49, 50, 64, 52, 65, 0, -1, -1, -1, 110,
467 74, 112, 35, -1, 37, 38, 39, 40, 41, 42,
468 43, 44, 45, 46, 47, 74, 49, 50, 51, 52,
469 53, 54, 55, 134, 57, 58, 59, 60, -1, -1,
470 -1, 64, -1, -1, -1, -1, -1, 148, -1, -1,
471 -1, 152, -1, 154, -1, 156, 157, 3, -1, -1,
472 6, 7, 8, 9, 10, 11, 12, 13, -1, 170,
473 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
474 26, 27, 28, 29, 30, 31, 32, 47, 34, 49,
475 50, 51, 52, 53, 54, 55, -1, 57, 58, 59,
476 60, -1, -1, -1, 50, 51, -1, -1, -1, -1,
477 -1, -1, -1, -1, 60, 61, 62, 3, -1, 65,
478 6, 7, 8, 9, 10, 11, 12, 13, -1, -1,
479 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
480 26, 27, 28, 29, 30, 31, 32, -1, 34, 49,
481 50, 51, 52, 53, 54, 55, -1, 57, 58, 59,
482 60, -1, -1, -1, 50, 51, -1, -1, -1, -1,
483 -1, -1, -1, -1, 60, 61, 62, -1, 35, 65,
484 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
485 47, -1, 49, 50, 51, 52, 53, 54, 55, -1,
486 57, 58, 59, 60, -1, -1, -1, 64, 37, 38,
487 39, 40, 41, 42, 43, 44, 45, 46, 47, -1,
488 49, 50, 51, 52, 53, 54, 55, -1, 57, 58,
489 59, 60, -1, -1, -1, 64, 37, 38, 39, 40,
490 41, 42, 43, 44, 45, 46, 47, -1, 49, 50,
491 51, 52, 53, 54, 55, -1, 57, 58, 59, 60,
492 -1, -1, -1, 64, 37, 38, 39, 40, 41, 42,
493 43, 44, 45, 46, 47, -1, 49, 50, 51, 52,
494 53, 54, 55, -1, 57, 58, 59, 60, -1, -1,
495 -1, 64, 37, 38, 39, 40, 41, 42, 43, 44,
496 45, 46, 47, -1, 49, 50, 51, 52, 53, 54,
497 55, -1, 57, 58, 59, 60, -1, -1, -1, 64,
498 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
499 47, -1, 49, 50, 51, 52, 53, 54, 55, -1,
500 57, 58, 59, 60, -1, -1, -1, 64, 37, 38,
501 39, 40, 41, 42, 43, 44, 45, 46, 47, -1,
502 49, 50, 51, 52, 53, 54, 55, -1, 57, 58,
503 59, 60, -1, -1, -1, 64, 37, 38, 39, 40,
504 41, 42, 43, 44, 45, 46, 47, -1, 49, 50,
505 51, 52, 53, 54, 55, -1, 57, 58, 59, 60,
506 -1, -1, -1, 64, 37, 38, 39, 40, 41, 42,
507 43, 44, 45, 46, 47, -1, 49, 50, 51, 52,
508 53, 54, 55, -1, 57, 58, 59, 60, -1, -1,
509 -1, 64, 37, 38, 39, 40, 41, 42, 43, 44,
510 45, 46, 47, -1, 49, 50, 51, 52, 53, 54,
511 55, -1, 57, 58, 59, 60, -1, -1, -1, 64,
512 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
513 47, -1, 49, 50, 51, 52, 53, 54, 55, -1,
514 57, 58, 59, 60, -1, -1, -1, 64, 37, 38,
515 39, 40, 41, 42, 43, 44, 45, 46, 47, -1,
516 49, 50, 51, 52, 53, 54, 55, -1, 57, 58,
517 59, 60, -1, -1, -1, 64, 37, 38, 39, 40,
518 41, 42, 43, 44, 45, 46, 47, -1, 49, 50,
519 51, 52, 53, 54, 55, -1, 57, 58, 59, 60,
520 -1, -1, -1, 64, 37, 38, 39, 40, 41, 42,
521 43, 44, 45, 46, 47, -1, 49, 50, 51, 52,
522 53, 54, 55, -1, 57, 58, 59, 60, -1, -1,
523 -1, 64, 37, 38, 39, 40, 41, 42, 43, 44,
524 45, 46, 47, -1, 49, 50, 51, 52, 53, 54,
525 55, -1, 57, 58, 59, 60, -1, -1, -1, 64,
526 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
527 47, -1, 49, 50, 51, 52, 53, 54, 55, -1,
528 57, 58, 59, 60, -1, -1, 35, 64, 37, 38,
529 39, 40, 41, 42, 43, 44, 45, 46, 47, -1,
530 49, 50, 51, 52, 53, 54, 55, -1, 57, 58,
531 59, 60, 35, -1, 37, 38, 39, 40, 41, 42,
532 43, 44, 45, 46, 47, -1, 49, 50, 51, 52,
533 53, 54, 55, -1, 57, 58, 59, 60, 37, 38,
534 39, 40, 41, 42, 43, 44, 45, 46, 47, -1,
535 49, 50, 51, 52, 53, 54, 55, -1, 57, 58,
536 59, 60, 37, 38, 39, 40, 41, 42, 43, 44,
537 45, 46, 47, -1, 49, 50, 51, 52, 53, 54,
538 55, -1, 57, 58, 59, 60, 50, 51, 52, 53,
539 54, 55, -1, 57, 58, 59, 60, 52, 53, 54,
540 55, -1, 57, 58, 59, 60
542 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
543 #line 3 "/stone/jimb/main-98r2/share/bison.simple"
545 /* Skeleton output parser for bison,
546 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
548 This program is free software; you can redistribute it and/or modify
549 it under the terms of the GNU General Public License as published by
550 the Free Software Foundation; either version 2, or (at your option)
553 This program is distributed in the hope that it will be useful,
554 but WITHOUT ANY WARRANTY; without even the implied warranty of
555 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
556 GNU General Public License for more details.
558 You should have received a copy of the GNU General Public License
559 along with this program; if not, write to the Free Software
560 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
562 /* As a special exception, when this file is copied by Bison into a
563 Bison output file, you may use that output file without restriction.
564 This special exception was added by the Free Software Foundation
565 in version 1.24 of Bison. */
569 #define alloca __builtin_alloca
570 #else /* not GNU C. */
571 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
573 #else /* not sparc */
574 #if defined (MSDOS) && !defined (__TURBOC__)
575 #else /* not MSDOS, or __TURBOC__ */
578 #else /* not MSDOS, __TURBOC__, or _AIX */
582 void *alloca (unsigned int);
584 #else /* not __cplusplus */
586 #endif /* not __cplusplus */
588 #endif /* not _AIX */
589 #endif /* not MSDOS, or __TURBOC__ */
590 #endif /* not sparc. */
591 #endif /* not GNU C. */
592 #endif /* alloca not defined. */
594 /* This is the parser code that is written into each bison parser
595 when the %semantic_parser declaration is not specified in the grammar.
596 It was written by Richard Stallman by simplifying the hairy parser
597 used when %semantic_parser is specified. */
599 /* Note: there must be only one dollar sign in this file.
600 It is replaced by the list of actions, each action
601 as one case of the switch. */
603 #define yyerrok (yyerrstatus = 0)
604 #define yyclearin (yychar = YYEMPTY)
607 #define YYACCEPT return(0)
608 #define YYABORT return(1)
609 #define YYERROR goto yyerrlab1
610 /* Like YYERROR except do call yyerror.
611 This remains here temporarily to ease the
612 transition to the new meaning of YYERROR, for GCC.
613 Once GCC version 2 has supplanted version 1, this can go. */
614 #define YYFAIL goto yyerrlab
615 #define YYRECOVERING() (!!yyerrstatus)
616 #define YYBACKUP(token, value) \
618 if (yychar == YYEMPTY && yylen == 1) \
619 { yychar = (token), yylval = (value); \
620 yychar1 = YYTRANSLATE (yychar); \
625 { yyerror ("syntax error: cannot back up"); YYERROR; } \
629 #define YYERRCODE 256
632 #define YYLEX yylex()
638 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
640 #define YYLEX yylex(&yylval, &yylloc)
642 #else /* not YYLSP_NEEDED */
644 #define YYLEX yylex(&yylval, YYLEX_PARAM)
646 #define YYLEX yylex(&yylval)
648 #endif /* not YYLSP_NEEDED */
651 /* If nonreentrant, generate the variables here */
655 int yychar; /* the lookahead symbol */
656 YYSTYPE yylval; /* the semantic value of the */
657 /* lookahead symbol */
660 YYLTYPE yylloc; /* location data for the lookahead */
664 int yynerrs; /* number of parse errors so far */
665 #endif /* not YYPURE */
668 int yydebug; /* nonzero means print parse trace */
669 /* Since this is uninitialized, it does not stop multiple parsers
673 /* YYINITDEPTH indicates the initial size of the parser's stacks */
676 #define YYINITDEPTH 200
679 /* YYMAXDEPTH is the maximum size the stacks can grow to
680 (effective only if the built-in stack extension method is used). */
687 #define YYMAXDEPTH 10000
690 /* Prevent warning if -Wstrict-prototypes. */
695 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
696 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
697 #else /* not GNU C or C++ */
700 /* This is the most reliable way to avoid incompatibilities
701 in available built-in functions on various systems. */
703 __yy_memcpy (to, from, count)
708 register char *f = from;
709 register char *t = to;
710 register int i = count;
716 #else /* __cplusplus */
718 /* This is the most reliable way to avoid incompatibilities
719 in available built-in functions on various systems. */
721 __yy_memcpy (char *to, char *from, int count)
723 register char *f = from;
724 register char *t = to;
725 register int i = count;
734 #line 196 "/stone/jimb/main-98r2/share/bison.simple"
736 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
737 into yyparse. The argument should have type void *.
738 It should actually point to an object.
739 Grammar actions can access the variable by casting it
740 to the proper pointer type. */
744 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
745 #define YYPARSE_PARAM_DECL
746 #else /* not __cplusplus */
747 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
748 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
749 #endif /* not __cplusplus */
750 #else /* not YYPARSE_PARAM */
751 #define YYPARSE_PARAM_ARG
752 #define YYPARSE_PARAM_DECL
753 #endif /* not YYPARSE_PARAM */
756 yyparse(YYPARSE_PARAM_ARG)
759 register int yystate;
761 register short *yyssp;
762 register YYSTYPE *yyvsp;
763 int yyerrstatus; /* number of tokens to shift before error messages enabled */
764 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
766 short yyssa[YYINITDEPTH]; /* the state stack */
767 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
769 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
770 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to xreallocate them elsewhere */
773 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
774 YYLTYPE *yyls = yylsa;
777 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
779 #define YYPOPSTACK (yyvsp--, yyssp--)
782 int yystacksize = YYINITDEPTH;
793 YYSTYPE yyval; /* the variable used to return */
794 /* semantic values from the action */
801 fprintf(stderr, "Starting parse\n");
807 yychar = YYEMPTY; /* Cause a token to be read. */
809 /* Initialize stack pointers.
810 Waste one element of value and location stack
811 so that they stay on the same level as the state stack.
812 The wasted elements are never initialized. */
820 /* Push a new state, which is found in yystate . */
821 /* In all cases, when you get here, the value and location stacks
822 have just been pushed. so pushing a state here evens the stacks. */
827 if (yyssp >= yyss + yystacksize - 1)
829 /* Give user a chance to xreallocate the stack */
830 /* Use copies of these so that the &'s don't force the real ones into memory. */
831 YYSTYPE *yyvs1 = yyvs;
834 YYLTYPE *yyls1 = yyls;
837 /* Get the current used size of the three stacks, in elements. */
838 int size = yyssp - yyss + 1;
841 /* Each stack pointer address is followed by the size of
842 the data in use in that stack, in bytes. */
844 /* This used to be a conditional around just the two extra args,
845 but that might be undefined if yyoverflow is a macro. */
846 yyoverflow("parser stack overflow",
847 &yyss1, size * sizeof (*yyssp),
848 &yyvs1, size * sizeof (*yyvsp),
849 &yyls1, size * sizeof (*yylsp),
852 yyoverflow("parser stack overflow",
853 &yyss1, size * sizeof (*yyssp),
854 &yyvs1, size * sizeof (*yyvsp),
858 yyss = yyss1; yyvs = yyvs1;
862 #else /* no yyoverflow */
863 /* Extend the stack our own way. */
864 if (yystacksize >= YYMAXDEPTH)
866 yyerror("parser stack overflow");
870 if (yystacksize > YYMAXDEPTH)
871 yystacksize = YYMAXDEPTH;
872 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
873 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
874 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
875 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
877 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
878 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
880 #endif /* no yyoverflow */
882 yyssp = yyss + size - 1;
883 yyvsp = yyvs + size - 1;
885 yylsp = yyls + size - 1;
890 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
893 if (yyssp >= yyss + yystacksize - 1)
899 fprintf(stderr, "Entering state %d\n", yystate);
905 /* Do appropriate processing given the current state. */
906 /* Read a lookahead token if we need one and don't already have one. */
909 /* First try to decide what to do without reference to lookahead token. */
911 yyn = yypact[yystate];
915 /* Not known => get a lookahead token if don't already have one. */
917 /* yychar is either YYEMPTY or YYEOF
918 or a valid token in external form. */
920 if (yychar == YYEMPTY)
924 fprintf(stderr, "Reading a token: ");
929 /* Convert token to internal form (in yychar1) for indexing tables with */
931 if (yychar <= 0) /* This means end of input. */
934 yychar = YYEOF; /* Don't call YYLEX any more */
938 fprintf(stderr, "Now at end of input.\n");
943 yychar1 = YYTRANSLATE(yychar);
948 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
949 /* Give the individual parser a way to print the precise meaning
950 of a token, for further debugging info. */
952 YYPRINT (stderr, yychar, yylval);
954 fprintf (stderr, ")\n");
960 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
965 /* yyn is what to do for this token type in this state.
966 Negative => reduce, -yyn is rule number.
967 Positive => shift, yyn is new state.
968 New state is final state => don't bother to shift,
970 0, or most negative number => error. */
985 /* Shift the lookahead token. */
989 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
992 /* Discard the token being shifted unless it is eof. */
1001 /* count tokens shifted since error; after three, turn off error status. */
1002 if (yyerrstatus) yyerrstatus--;
1007 /* Do the default action for the current state. */
1010 yyn = yydefact[yystate];
1014 /* Do a reduction. yyn is the number of a rule to reduce with. */
1018 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1025 fprintf (stderr, "Reducing via rule %d (line %d), ",
1028 /* Print the symbols being reduced, and their result. */
1029 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1030 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1031 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1039 #line 209 "m2-exp.y"
1040 { write_exp_elt_opcode(OP_TYPE);
1041 write_exp_elt_type(yyvsp[0].tval);
1042 write_exp_elt_opcode(OP_TYPE);
1046 #line 218 "m2-exp.y"
1047 { write_exp_elt_opcode (UNOP_IND); ;
1050 #line 221 "m2-exp.y"
1051 { number_sign = -1; ;
1054 #line 223 "m2-exp.y"
1056 write_exp_elt_opcode (UNOP_NEG); ;
1059 #line 228 "m2-exp.y"
1060 { write_exp_elt_opcode(UNOP_PLUS); ;
1063 #line 232 "m2-exp.y"
1064 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1067 #line 240 "m2-exp.y"
1068 { write_exp_elt_opcode (UNOP_CAP); ;
1071 #line 244 "m2-exp.y"
1072 { write_exp_elt_opcode (UNOP_ORD); ;
1075 #line 248 "m2-exp.y"
1076 { write_exp_elt_opcode (UNOP_ABS); ;
1079 #line 252 "m2-exp.y"
1080 { write_exp_elt_opcode (UNOP_HIGH); ;
1083 #line 256 "m2-exp.y"
1084 { write_exp_elt_opcode (UNOP_MIN);
1085 write_exp_elt_type (yyvsp[-1].tval);
1086 write_exp_elt_opcode (UNOP_MIN); ;
1089 #line 262 "m2-exp.y"
1090 { write_exp_elt_opcode (UNOP_MAX);
1091 write_exp_elt_type (yyvsp[-1].tval);
1092 write_exp_elt_opcode (UNOP_MIN); ;
1095 #line 268 "m2-exp.y"
1096 { write_exp_elt_opcode (UNOP_FLOAT); ;
1099 #line 272 "m2-exp.y"
1100 { write_exp_elt_opcode (BINOP_VAL);
1101 write_exp_elt_type (yyvsp[-3].tval);
1102 write_exp_elt_opcode (BINOP_VAL); ;
1105 #line 278 "m2-exp.y"
1106 { write_exp_elt_opcode (UNOP_CHR); ;
1109 #line 282 "m2-exp.y"
1110 { write_exp_elt_opcode (UNOP_ODD); ;
1113 #line 286 "m2-exp.y"
1114 { write_exp_elt_opcode (UNOP_TRUNC); ;
1117 #line 290 "m2-exp.y"
1118 { write_exp_elt_opcode (UNOP_SIZEOF); ;
1121 #line 295 "m2-exp.y"
1122 { write_exp_elt_opcode(UNOP_PREINCREMENT); ;
1125 #line 299 "m2-exp.y"
1126 { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
1127 write_exp_elt_opcode(BINOP_ADD);
1128 write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
1131 #line 305 "m2-exp.y"
1132 { write_exp_elt_opcode(UNOP_PREDECREMENT);;
1135 #line 309 "m2-exp.y"
1136 { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
1137 write_exp_elt_opcode(BINOP_SUB);
1138 write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
1141 #line 315 "m2-exp.y"
1142 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1143 write_exp_string (yyvsp[0].sval);
1144 write_exp_elt_opcode (STRUCTOP_STRUCT); ;
1147 #line 324 "m2-exp.y"
1148 { error("Sets are not implemented.");;
1151 #line 328 "m2-exp.y"
1152 { error("Sets are not implemented.");;
1155 #line 332 "m2-exp.y"
1156 { error("Sets are not implemented.");;
1159 #line 335 "m2-exp.y"
1160 { error("Sets are not implemented.");;
1163 #line 337 "m2-exp.y"
1164 { error("Sets are not implemented.");;
1167 #line 346 "m2-exp.y"
1168 { start_arglist(); ;
1171 #line 348 "m2-exp.y"
1172 { write_exp_elt_opcode (MULTI_SUBSCRIPT);
1173 write_exp_elt_longcst ((LONGEST) end_arglist());
1174 write_exp_elt_opcode (MULTI_SUBSCRIPT); ;
1177 #line 356 "m2-exp.y"
1178 { start_arglist (); ;
1181 #line 358 "m2-exp.y"
1182 { write_exp_elt_opcode (OP_FUNCALL);
1183 write_exp_elt_longcst ((LONGEST) end_arglist ());
1184 write_exp_elt_opcode (OP_FUNCALL); ;
1187 #line 367 "m2-exp.y"
1188 { arglist_len = 1; ;
1191 #line 371 "m2-exp.y"
1195 #line 376 "m2-exp.y"
1196 { arglist_len = 1; ;
1199 #line 381 "m2-exp.y"
1203 #line 386 "m2-exp.y"
1204 { write_exp_elt_opcode (UNOP_MEMVAL);
1205 write_exp_elt_type (yyvsp[-2].tval);
1206 write_exp_elt_opcode (UNOP_MEMVAL); ;
1209 #line 392 "m2-exp.y"
1210 { write_exp_elt_opcode (UNOP_CAST);
1211 write_exp_elt_type (yyvsp[-3].tval);
1212 write_exp_elt_opcode (UNOP_CAST); ;
1215 #line 398 "m2-exp.y"
1219 #line 406 "m2-exp.y"
1220 { write_exp_elt_opcode (BINOP_REPEAT); ;
1223 #line 410 "m2-exp.y"
1224 { write_exp_elt_opcode (BINOP_MUL); ;
1227 #line 414 "m2-exp.y"
1228 { write_exp_elt_opcode (BINOP_DIV); ;
1231 #line 418 "m2-exp.y"
1232 { write_exp_elt_opcode (BINOP_INTDIV); ;
1235 #line 422 "m2-exp.y"
1236 { write_exp_elt_opcode (BINOP_REM); ;
1239 #line 426 "m2-exp.y"
1240 { write_exp_elt_opcode (BINOP_ADD); ;
1243 #line 430 "m2-exp.y"
1244 { write_exp_elt_opcode (BINOP_SUB); ;
1247 #line 434 "m2-exp.y"
1248 { write_exp_elt_opcode (BINOP_EQUAL); ;
1251 #line 438 "m2-exp.y"
1252 { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1255 #line 440 "m2-exp.y"
1256 { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1259 #line 444 "m2-exp.y"
1260 { write_exp_elt_opcode (BINOP_LEQ); ;
1263 #line 448 "m2-exp.y"
1264 { write_exp_elt_opcode (BINOP_GEQ); ;
1267 #line 452 "m2-exp.y"
1268 { write_exp_elt_opcode (BINOP_LESS); ;
1271 #line 456 "m2-exp.y"
1272 { write_exp_elt_opcode (BINOP_GTR); ;
1275 #line 460 "m2-exp.y"
1276 { write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1279 #line 464 "m2-exp.y"
1280 { write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1283 #line 468 "m2-exp.y"
1284 { write_exp_elt_opcode (BINOP_ASSIGN); ;
1287 #line 475 "m2-exp.y"
1288 { write_exp_elt_opcode (OP_BOOL);
1289 write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1290 write_exp_elt_opcode (OP_BOOL); ;
1293 #line 481 "m2-exp.y"
1294 { write_exp_elt_opcode (OP_BOOL);
1295 write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1296 write_exp_elt_opcode (OP_BOOL); ;
1299 #line 487 "m2-exp.y"
1300 { write_exp_elt_opcode (OP_LONG);
1301 write_exp_elt_type (builtin_type_m2_int);
1302 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1303 write_exp_elt_opcode (OP_LONG); ;
1306 #line 494 "m2-exp.y"
1308 write_exp_elt_opcode (OP_LONG);
1309 write_exp_elt_type (builtin_type_m2_card);
1310 write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1311 write_exp_elt_opcode (OP_LONG);
1315 #line 503 "m2-exp.y"
1316 { write_exp_elt_opcode (OP_LONG);
1317 write_exp_elt_type (builtin_type_m2_char);
1318 write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1319 write_exp_elt_opcode (OP_LONG); ;
1322 #line 511 "m2-exp.y"
1323 { write_exp_elt_opcode (OP_DOUBLE);
1324 write_exp_elt_type (builtin_type_m2_real);
1325 write_exp_elt_dblcst (yyvsp[0].dval);
1326 write_exp_elt_opcode (OP_DOUBLE); ;
1329 #line 521 "m2-exp.y"
1330 { write_exp_elt_opcode (OP_LONG);
1331 write_exp_elt_type (builtin_type_int);
1332 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1333 write_exp_elt_opcode (OP_LONG); ;
1336 #line 528 "m2-exp.y"
1337 { write_exp_elt_opcode (OP_M2_STRING);
1338 write_exp_string (yyvsp[0].sval);
1339 write_exp_elt_opcode (OP_M2_STRING); ;
1342 #line 535 "m2-exp.y"
1343 { yyval.bval = SYMBOL_BLOCK_VALUE(yyvsp[0].sym); ;
1346 #line 539 "m2-exp.y"
1347 { struct symbol *sym
1348 = lookup_symbol (copy_name (yyvsp[0].sval), expression_context_block,
1349 VAR_NAMESPACE, 0, NULL);
1353 #line 548 "m2-exp.y"
1354 { struct symbol *tem
1355 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1356 VAR_NAMESPACE, 0, NULL);
1357 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1358 error ("No function \"%s\" in specified context.",
1359 copy_name (yyvsp[0].sval));
1364 #line 560 "m2-exp.y"
1365 { write_exp_elt_opcode(OP_VAR_VALUE);
1366 write_exp_elt_block (NULL);
1367 write_exp_elt_sym (yyvsp[0].sym);
1368 write_exp_elt_opcode (OP_VAR_VALUE); ;
1371 #line 572 "m2-exp.y"
1372 { struct symbol *sym;
1373 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1374 VAR_NAMESPACE, 0, NULL);
1376 error ("No symbol \"%s\" in specified context.",
1377 copy_name (yyvsp[0].sval));
1379 write_exp_elt_opcode (OP_VAR_VALUE);
1380 /* block_found is set by lookup_symbol. */
1381 write_exp_elt_block (block_found);
1382 write_exp_elt_sym (sym);
1383 write_exp_elt_opcode (OP_VAR_VALUE); ;
1386 #line 588 "m2-exp.y"
1387 { struct symbol *sym;
1388 int is_a_field_of_this;
1390 sym = lookup_symbol (copy_name (yyvsp[0].sval),
1391 expression_context_block,
1393 &is_a_field_of_this,
1397 if (symbol_read_needs_frame (sym))
1399 if (innermost_block == 0 ||
1400 contained_in (block_found,
1402 innermost_block = block_found;
1405 write_exp_elt_opcode (OP_VAR_VALUE);
1406 /* We want to use the selected frame, not
1407 another more inner frame which happens to
1408 be in the same block. */
1409 write_exp_elt_block (NULL);
1410 write_exp_elt_sym (sym);
1411 write_exp_elt_opcode (OP_VAR_VALUE);
1415 struct minimal_symbol *msymbol;
1416 register char *arg = copy_name (yyvsp[0].sval);
1419 lookup_minimal_symbol (arg, NULL, NULL);
1420 if (msymbol != NULL)
1424 lookup_function_type (builtin_type_int),
1427 else if (!have_full_symbols () && !have_partial_symbols ())
1428 error ("No symbol table is loaded. Use the \"symbol-file\" command.");
1430 error ("No symbol \"%s\" in current context.",
1431 copy_name (yyvsp[0].sval));
1436 #line 639 "m2-exp.y"
1437 { yyval.tval = lookup_typename (copy_name (yyvsp[0].sval),
1438 expression_context_block, 0); ;
1441 /* the action file gets copied in in place of this dollarsign */
1442 #line 498 "/stone/jimb/main-98r2/share/bison.simple"
1453 short *ssp1 = yyss - 1;
1454 fprintf (stderr, "state stack now");
1455 while (ssp1 != yyssp)
1456 fprintf (stderr, " %d", *++ssp1);
1457 fprintf (stderr, "\n");
1467 yylsp->first_line = yylloc.first_line;
1468 yylsp->first_column = yylloc.first_column;
1469 yylsp->last_line = (yylsp-1)->last_line;
1470 yylsp->last_column = (yylsp-1)->last_column;
1475 yylsp->last_line = (yylsp+yylen-1)->last_line;
1476 yylsp->last_column = (yylsp+yylen-1)->last_column;
1480 /* Now "shift" the result of the reduction.
1481 Determine what state that goes to,
1482 based on the state we popped back to
1483 and the rule number reduced by. */
1487 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1488 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1489 yystate = yytable[yystate];
1491 yystate = yydefgoto[yyn - YYNTBASE];
1495 yyerrlab: /* here on detecting error */
1498 /* If not already recovering from an error, report this error. */
1502 #ifdef YYERROR_VERBOSE
1503 yyn = yypact[yystate];
1505 if (yyn > YYFLAG && yyn < YYLAST)
1512 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1513 for (x = (yyn < 0 ? -yyn : 0);
1514 x < (sizeof(yytname) / sizeof(char *)); x++)
1515 if (yycheck[x + yyn] == x)
1516 size += strlen(yytname[x]) + 15, count++;
1517 msg = (char *) xmalloc(size + 15);
1520 strcpy(msg, "parse error");
1525 for (x = (yyn < 0 ? -yyn : 0);
1526 x < (sizeof(yytname) / sizeof(char *)); x++)
1527 if (yycheck[x + yyn] == x)
1529 strcat(msg, count == 0 ? ", expecting `" : " or `");
1530 strcat(msg, yytname[x]);
1539 yyerror ("parse error; also virtual memory exceeded");
1542 #endif /* YYERROR_VERBOSE */
1543 yyerror("parse error");
1547 yyerrlab1: /* here on error raised explicitly by an action */
1549 if (yyerrstatus == 3)
1551 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1553 /* return failure if at end of input */
1554 if (yychar == YYEOF)
1559 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1565 /* Else will try to reuse lookahead token
1566 after shifting the error token. */
1568 yyerrstatus = 3; /* Each real token shifted decrements this */
1572 yyerrdefault: /* current state does not do anything special for the error token. */
1575 /* This is wrong; only states that explicitly want error tokens
1576 should shift them. */
1577 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1578 if (yyn) goto yydefault;
1581 yyerrpop: /* pop the current state because it cannot handle the error token */
1583 if (yyssp == yyss) YYABORT;
1593 short *ssp1 = yyss - 1;
1594 fprintf (stderr, "Error: state stack now");
1595 while (ssp1 != yyssp)
1596 fprintf (stderr, " %d", *++ssp1);
1597 fprintf (stderr, "\n");
1603 yyn = yypact[yystate];
1608 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1627 fprintf(stderr, "Shifting error token, ");
1638 #line 644 "m2-exp.y"
1646 return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
1653 return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
1657 /* Take care of parsing a number (anything that starts with a digit).
1658 Set yylval and return the token type; update lexptr.
1659 LEN is the number of characters in it. */
1661 /*** Needs some error checking for the float case ***/
1667 register char *p = lexptr;
1668 register LONGEST n = 0;
1669 register LONGEST prevn = 0;
1670 register int c,i,ischar=0;
1671 register int base = input_radix;
1672 register int len = olen;
1673 int unsigned_p = number_sign == 1 ? 1 : 0;
1680 else if(p[len-1] == 'C' || p[len-1] == 'B')
1683 ischar = p[len-1] == 'C';
1687 /* Scan the number */
1688 for (c = 0; c < len; c++)
1690 if (p[c] == '.' && base == 10)
1692 /* It's a float since it contains a point. */
1693 yylval.dval = atof (p);
1697 if (p[c] == '.' && base != 10)
1698 error("Floating point numbers must be base 10.");
1699 if (base == 10 && (p[c] < '0' || p[c] > '9'))
1700 error("Invalid digit \'%c\' in number.",p[c]);
1707 if( base == 8 && (c == '8' || c == '9'))
1708 error("Invalid digit \'%c\' in octal number.",c);
1709 if (c >= '0' && c <= '9')
1713 if (base == 16 && c >= 'A' && c <= 'F')
1721 if(!unsigned_p && number_sign == 1 && (prevn >= n))
1722 unsigned_p=1; /* Try something unsigned */
1723 /* Don't do the range check if n==i and i==0, since that special
1724 case will give an overflow error. */
1725 if(RANGE_CHECK && n!=i && i)
1727 if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
1728 ((!unsigned_p && number_sign==-1) && -prevn <= -n))
1729 range_error("Overflow on numeric constant.");
1735 if(*p == 'B' || *p == 'C' || *p == 'H')
1736 lexptr++; /* Advance past B,C or H */
1743 else if ( unsigned_p && number_sign == 1)
1748 else if((unsigned_p && (n<0))) {
1749 range_error("Overflow on numeric constant -- number too large.");
1750 /* But, this can return if range_check == range_warn. */
1765 { {'<', '>'}, NOTEQUAL },
1766 { {':', '='}, ASSIGN },
1767 { {'<', '='}, LEQ },
1768 { {'>', '='}, GEQ },
1769 { {':', ':'}, COLONCOLON },
1773 /* Some specific keywords */
1780 static struct keyword keytab[] =
1783 {"IN", IN },/* Note space after IN */
1784 {"AND", LOGICAL_AND},
1802 {"FLOAT", FLOAT_FUNC },
1807 /* Read one token, getting characters through lexptr. */
1809 /* This is where we will check to make sure that the language and the operators used are
1816 register int namelen;
1818 register char *tokstart;
1819 register char quote;
1826 /* See if it is a special token of length 2 */
1827 for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++)
1828 if(STREQN(tokentab2[i].name, tokstart, 2))
1831 return tokentab2[i].token;
1834 switch (c = *tokstart)
1851 if (paren_depth == 0)
1858 if (comma_terminates && paren_depth == 0)
1864 /* Might be a floating point number. */
1865 if (lexptr[1] >= '0' && lexptr[1] <= '9')
1866 break; /* Falls into number code. */
1873 /* These are character tokens that appear as-is in the YACC grammar */
1896 for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
1899 c = tokstart[++namelen];
1900 if (c >= '0' && c <= '9')
1902 c = tokstart[++namelen];
1903 if (c >= '0' && c <= '9')
1904 c = tokstart[++namelen];
1908 error("Unterminated string or character constant.");
1909 yylval.sval.ptr = tokstart + 1;
1910 yylval.sval.length = namelen - 1;
1911 lexptr += namelen + 1;
1913 if(namelen == 2) /* Single character */
1915 yylval.ulval = tokstart[1];
1922 /* Is it a number? */
1923 /* Note: We have already dealt with the case of the token '.'.
1924 See case '.' above. */
1925 if ((c >= '0' && c <= '9'))
1927 /* It's a number. */
1928 int got_dot = 0, got_e = 0;
1929 register char *p = tokstart;
1934 if (!got_e && (*p == 'e' || *p == 'E'))
1935 got_dot = got_e = 1;
1936 else if (!got_dot && *p == '.')
1938 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
1939 && (*p == '-' || *p == '+'))
1940 /* This is the sign of the exponent, not the end of the
1943 else if ((*p < '0' || *p > '9') &&
1944 (*p < 'A' || *p > 'F') &&
1945 (*p != 'H')) /* Modula-2 hexadecimal number */
1948 toktype = parse_number (p - tokstart);
1949 if (toktype == ERROR)
1951 char *err_copy = (char *) alloca (p - tokstart + 1);
1953 memcpy (err_copy, tokstart, p - tokstart);
1954 err_copy[p - tokstart] = 0;
1955 error ("Invalid number \"%s\".", err_copy);
1961 if (!(c == '_' || c == '$'
1962 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
1963 /* We must have come across a bad character (e.g. ';'). */
1964 error ("Invalid character '%c' in expression.", c);
1966 /* It's a name. See how long it is. */
1968 for (c = tokstart[namelen];
1969 (c == '_' || c == '$' || (c >= '0' && c <= '9')
1970 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
1971 c = tokstart[++namelen])
1974 /* The token "if" terminates the expression and is NOT
1975 removed from the input stream. */
1976 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
1983 /* Lookup special keywords */
1984 for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++)
1985 if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
1986 return keytab[i].token;
1988 yylval.sval.ptr = tokstart;
1989 yylval.sval.length = namelen;
1991 if (*tokstart == '$')
1993 write_dollar_variable (yylval.sval);
1994 return INTERNAL_VAR;
1997 /* Use token-type BLOCKNAME for symbols that happen to be defined as
1998 functions. If this is not so, then ...
1999 Use token-type TYPENAME for symbols that happen to be defined
2000 currently as names of types; NAME for other symbols.
2001 The caller is not constrained to care about the distinction. */
2005 char *tmp = copy_name (yylval.sval);
2008 if (lookup_partial_symtab (tmp))
2010 sym = lookup_symbol (tmp, expression_context_block,
2011 VAR_NAMESPACE, 0, NULL);
2012 if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
2014 if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
2026 case LOC_REGPARM_ADDR:
2030 case LOC_BASEREG_ARG:
2032 case LOC_CONST_BYTES:
2033 case LOC_OPTIMIZED_OUT:
2043 error("internal: Undefined class in m2lex()");
2046 case LOC_UNRESOLVED:
2047 error("internal: Unforseen case in m2lex()");
2052 /* Built-in BOOLEAN type. This is sort of a hack. */
2053 if(STREQN(tokstart,"TRUE",4))
2058 else if(STREQN(tokstart,"FALSE",5))
2065 /* Must be another type of name... */
2072 make_qualname(mod,ident)
2075 char *new = xmalloc(strlen(mod)+strlen(ident)+2);
2088 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);