2 /* A Bison parser, made from jv-exp.y
3 by GNU Bison version 1.25
6 #define YYBISON 1 /* Identify Bison output. */
8 #define INTEGER_LITERAL 258
9 #define FLOATING_POINT_LITERAL 259
10 #define IDENTIFIER 260
11 #define STRING_LITERAL 261
12 #define BOOLEAN_LITERAL 262
14 #define NAME_OR_INT 264
25 #define ASSIGN_MODIFY 275
44 #include "gdb_string.h"
46 #include "expression.h"
48 #include "parser-defs.h"
51 #include "bfd.h" /* Required by objfiles.h. */
52 #include "symfile.h" /* Required by objfiles.h. */
53 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
55 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
56 as well as gratuitiously global symbol names, so we can have multiple
57 yacc generated parsers in gdb. Note that these are only the variables
58 produced by yacc. If other parser generators (bison, byacc, etc) produce
59 additional global names that conflict at link time, then those parser
60 generators need to be fixed instead of adding those names to this list. */
62 #define yymaxdepth java_maxdepth
63 #define yyparse java_parse
64 #define yylex java_lex
65 #define yyerror java_error
66 #define yylval java_lval
67 #define yychar java_char
68 #define yydebug java_debug
69 #define yypact java_pact
72 #define yydef java_def
73 #define yychk java_chk
74 #define yypgo java_pgo
75 #define yyact java_act
76 #define yyexca java_exca
77 #define yyerrflag java_errflag
78 #define yynerrs java_nerrs
82 #define yy_yys java_yys
83 #define yystate java_state
84 #define yytmp java_tmp
86 #define yy_yyv java_yyv
87 #define yyval java_val
88 #define yylloc java_lloc
89 #define yyreds java_reds /* With YYDEBUG defined */
90 #define yytoks java_toks /* With YYDEBUG defined */
91 #define yylhs java_yylhs
92 #define yylen java_yylen
93 #define yydefred java_yydefred
94 #define yydgoto java_yydgoto
95 #define yysindex java_yysindex
96 #define yyrindex java_yyrindex
97 #define yygindex java_yygindex
98 #define yytable java_yytable
99 #define yycheck java_yycheck
102 #define YYDEBUG 0 /* Default to no yydebug support */
106 yyparse PARAMS ((void));
109 yylex PARAMS ((void));
112 yyerror PARAMS ((char *));
114 static struct type * java_type_from_name PARAMS ((struct stoken));
115 static void push_expression_name PARAMS ((struct stoken));
116 static void push_fieldnames PARAMS ((struct stoken));
118 static struct expression *copy_exp PARAMS ((struct expression *, int));
119 static void insert_exp PARAMS ((int, struct expression *));
138 struct symtoken ssym;
140 enum exp_opcode opcode;
141 struct internalvar *ivar;
146 /* YYSTYPE gets defined by %union */
148 parse_number PARAMS ((char *, int, int, YYSTYPE *));
160 #define YYFLAG -32768
163 #define YYTRANSLATE(x) ((unsigned)(x) <= 288 ? yytranslate[x] : 112)
165 static const char yytranslate[] = { 0,
166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
167 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
168 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
169 2, 2, 55, 2, 2, 2, 44, 31, 2, 49,
170 50, 42, 40, 24, 41, 47, 43, 2, 2, 2,
171 2, 2, 2, 2, 2, 2, 2, 56, 2, 34,
172 25, 35, 26, 2, 2, 2, 2, 2, 2, 2,
173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
174 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
175 48, 2, 53, 30, 2, 2, 2, 2, 2, 2,
176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
178 2, 2, 51, 29, 52, 54, 2, 2, 2, 2,
179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
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, 2, 2, 2, 2, 2, 2,
184 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
185 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
188 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
189 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
190 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
191 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
192 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
193 16, 17, 18, 19, 20, 21, 22, 23, 27, 28,
194 32, 33, 36, 37, 38, 39, 45, 46
198 static const short yyprhs[] = { 0,
199 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
200 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
201 40, 42, 44, 46, 48, 51, 54, 56, 58, 60,
202 62, 64, 66, 70, 72, 76, 78, 80, 82, 84,
203 88, 90, 92, 94, 96, 100, 102, 104, 110, 112,
204 116, 117, 119, 124, 129, 131, 134, 138, 141, 145,
205 147, 148, 152, 156, 161, 168, 175, 180, 185, 190,
206 192, 194, 196, 198, 200, 203, 206, 208, 210, 213,
207 216, 219, 221, 224, 227, 229, 232, 235, 237, 243,
208 248, 254, 256, 260, 264, 268, 270, 274, 278, 280,
209 284, 288, 290, 294, 298, 302, 306, 308, 312, 316,
210 318, 322, 324, 328, 330, 334, 336, 340, 342, 346,
211 348, 354, 356, 358, 362, 366, 368, 370, 372, 374
214 static const short yyrhs[] = { 73,
215 0, 58, 0, 59, 0, 62, 0, 68, 0, 6,
216 0, 3, 0, 9, 0, 4, 0, 7, 0, 60,
217 0, 63, 0, 16, 0, 64, 0, 65, 0, 13,
218 0, 12, 0, 14, 0, 11, 0, 15, 0, 18,
219 0, 17, 0, 69, 0, 66, 0, 62, 84, 0,
220 69, 84, 0, 5, 0, 72, 0, 71, 0, 72,
221 0, 5, 0, 9, 0, 69, 47, 71, 0, 111,
222 0, 73, 24, 111, 0, 75, 0, 81, 0, 61,
223 0, 21, 0, 49, 111, 50, 0, 78, 0, 86,
224 0, 87, 0, 88, 0, 76, 79, 77, 0, 51,
225 0, 52, 0, 23, 67, 49, 80, 50, 0, 111,
226 0, 79, 24, 111, 0, 0, 79, 0, 23, 62,
227 82, 85, 0, 23, 66, 82, 85, 0, 83, 0,
228 82, 83, 0, 48, 111, 53, 0, 48, 53, 0,
229 84, 48, 53, 0, 84, 0, 0, 74, 47, 71,
230 0, 19, 47, 71, 0, 69, 49, 80, 50, 0,
231 74, 47, 71, 49, 80, 50, 0, 22, 47, 71,
232 49, 80, 50, 0, 69, 48, 111, 53, 0, 19,
233 48, 111, 53, 0, 75, 48, 111, 53, 0, 74,
234 0, 69, 0, 19, 0, 90, 0, 91, 0, 89,
235 45, 0, 89, 46, 0, 93, 0, 94, 0, 40,
236 92, 0, 41, 92, 0, 42, 92, 0, 95, 0,
237 45, 92, 0, 46, 92, 0, 89, 0, 54, 92,
238 0, 55, 92, 0, 96, 0, 49, 62, 85, 50,
239 92, 0, 49, 111, 50, 95, 0, 49, 69, 84,
240 50, 95, 0, 92, 0, 97, 42, 92, 0, 97,
241 43, 92, 0, 97, 44, 92, 0, 97, 0, 98,
242 40, 97, 0, 98, 41, 97, 0, 98, 0, 99,
243 38, 98, 0, 99, 39, 98, 0, 99, 0, 100,
244 34, 99, 0, 100, 35, 99, 0, 100, 36, 99,
245 0, 100, 37, 99, 0, 100, 0, 101, 32, 100,
246 0, 101, 33, 100, 0, 101, 0, 102, 31, 101,
247 0, 102, 0, 103, 30, 102, 0, 103, 0, 104,
248 29, 103, 0, 104, 0, 105, 28, 104, 0, 105,
249 0, 106, 27, 105, 0, 106, 0, 106, 26, 111,
250 56, 107, 0, 107, 0, 109, 0, 110, 25, 107,
251 0, 110, 20, 107, 0, 70, 0, 19, 0, 86,
258 static const short yyrline[] = { 0,
259 203, 204, 207, 215, 217, 220, 229, 235, 243, 248,
260 253, 263, 265, 269, 271, 274, 277, 279, 281, 283,
261 287, 290, 301, 306, 310, 313, 317, 319, 322, 324,
262 327, 329, 332, 356, 357, 361, 363, 366, 368, 371,
263 372, 373, 374, 375, 376, 383, 388, 393, 398, 401,
264 405, 408, 411, 414, 418, 420, 423, 427, 430, 434,
265 436, 440, 443, 448, 451, 453, 457, 475, 477, 481,
266 483, 485, 487, 488, 491, 496, 501, 503, 504, 505,
267 507, 509, 512, 517, 522, 524, 526, 528, 531, 536,
268 557, 564, 566, 568, 570, 574, 576, 578, 582, 584,
269 586, 591, 593, 595, 597, 599, 604, 606, 608, 612,
270 614, 618, 620, 623, 625, 629, 631, 635, 637, 641,
271 643, 647, 649, 652, 655, 661, 664, 666, 667, 671
276 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
278 static const char * const yytname[] = { "$","error","$undefined.","INTEGER_LITERAL",
279 "FLOATING_POINT_LITERAL","IDENTIFIER","STRING_LITERAL","BOOLEAN_LITERAL","TYPENAME",
280 "NAME_OR_INT","ERROR","LONG","SHORT","BYTE","INT","CHAR","BOOLEAN","DOUBLE",
281 "FLOAT","VARIABLE","ASSIGN_MODIFY","THIS","SUPER","NEW","','","'='","'?'","OROR",
282 "ANDAND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'","'>'","LEQ","GEQ","LSH",
283 "RSH","'+'","'-'","'*'","'/'","'%'","INCREMENT","DECREMENT","'.'","'['","'('",
284 "')'","'{'","'}'","']'","'~'","'!'","':'","start","type_exp","PrimitiveOrArrayType",
285 "StringLiteral","Literal","PrimitiveType","NumericType","IntegralType","FloatingPointType",
286 "ClassOrInterfaceType","ClassType","ArrayType","Name","ForcedName","SimpleName",
287 "QualifiedName","exp1","Primary","PrimaryNoNewArray","lcurly","rcurly","ClassInstanceCreationExpression",
288 "ArgumentList","ArgumentList_opt","ArrayCreationExpression","DimExprs","DimExpr",
289 "Dims","Dims_opt","FieldAccess","MethodInvocation","ArrayAccess","PostfixExpression",
290 "PostIncrementExpression","PostDecrementExpression","UnaryExpression","PreIncrementExpression",
291 "PreDecrementExpression","UnaryExpressionNotPlusMinus","CastExpression","MultiplicativeExpression",
292 "AdditiveExpression","ShiftExpression","RelationalExpression","EqualityExpression",
293 "AndExpression","ExclusiveOrExpression","InclusiveOrExpression","ConditionalAndExpression",
294 "ConditionalOrExpression","ConditionalExpression","AssignmentExpression","Assignment",
295 "LeftHandSide","Expression", NULL
299 static const short yyr1[] = { 0,
300 57, 57, 58, 59, 59, 60, 61, 61, 61, 61,
301 61, 62, 62, 63, 63, 64, 64, 64, 64, 64,
302 65, 65, 66, 67, 68, 68, 69, 69, 70, 70,
303 71, 71, 72, 73, 73, 74, 74, 75, 75, 75,
304 75, 75, 75, 75, 75, 76, 77, 78, 79, 79,
305 80, 80, 81, 81, 82, 82, 83, 84, 84, 85,
306 85, 86, 86, 87, 87, 87, 88, 88, 88, 89,
307 89, 89, 89, 89, 90, 91, 92, 92, 92, 92,
308 92, 92, 93, 94, 95, 95, 95, 95, 96, 96,
309 96, 97, 97, 97, 97, 98, 98, 98, 99, 99,
310 99, 100, 100, 100, 100, 100, 101, 101, 101, 102,
311 102, 103, 103, 104, 104, 105, 105, 106, 106, 107,
312 107, 108, 108, 109, 109, 110, 110, 110, 110, 111
315 static const short yyr2[] = { 0,
316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
317 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
318 1, 1, 1, 1, 2, 2, 1, 1, 1, 1,
319 1, 1, 3, 1, 3, 1, 1, 1, 1, 3,
320 1, 1, 1, 1, 3, 1, 1, 5, 1, 3,
321 0, 1, 4, 4, 1, 2, 3, 2, 3, 1,
322 0, 3, 3, 4, 6, 6, 4, 4, 4, 1,
323 1, 1, 1, 1, 2, 2, 1, 1, 2, 2,
324 2, 1, 2, 2, 1, 2, 2, 1, 5, 4,
325 5, 1, 3, 3, 3, 1, 3, 3, 1, 3,
326 3, 1, 3, 3, 3, 3, 1, 3, 3, 1,
327 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
328 5, 1, 1, 3, 3, 1, 1, 1, 1, 1
331 static const short yydefact[] = { 0,
332 7, 9, 27, 6, 10, 8, 19, 17, 16, 18,
333 20, 13, 22, 21, 72, 39, 0, 0, 0, 0,
334 0, 0, 0, 0, 46, 0, 0, 2, 3, 11,
335 38, 4, 12, 14, 15, 5, 71, 126, 29, 28,
336 1, 70, 36, 0, 41, 37, 42, 43, 44, 85,
337 73, 74, 92, 77, 78, 82, 88, 96, 99, 102,
338 107, 110, 112, 114, 116, 118, 120, 122, 130, 123,
339 0, 34, 0, 0, 0, 27, 0, 24, 0, 23,
340 28, 8, 72, 71, 42, 44, 79, 80, 81, 83,
341 84, 61, 71, 0, 86, 87, 0, 25, 0, 0,
342 51, 26, 0, 0, 0, 0, 49, 75, 76, 0,
343 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
345 31, 32, 63, 0, 0, 0, 61, 55, 61, 51,
346 0, 60, 0, 0, 40, 58, 0, 33, 0, 52,
347 0, 35, 62, 0, 0, 47, 45, 93, 94, 95,
348 97, 98, 100, 101, 103, 104, 105, 106, 108, 109,
349 111, 113, 115, 117, 0, 119, 125, 124, 68, 51,
350 0, 0, 56, 53, 54, 0, 0, 0, 90, 59,
351 67, 64, 51, 69, 50, 0, 0, 57, 48, 89,
352 91, 0, 121, 66, 65, 0, 0, 0
355 static const short yydefgoto[] = { 206,
356 28, 29, 30, 31, 32, 33, 34, 35, 78, 79,
357 36, 84, 38, 39, 81, 41, 42, 43, 44, 157,
358 45, 150, 151, 46, 137, 138, 142, 143, 85, 48,
359 86, 50, 51, 52, 53, 54, 55, 56, 57, 58,
360 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
364 static const short yypact[] = { 206,
365 -32768,-32768, -5,-32768,-32768, -3,-32768,-32768,-32768,-32768,
366 -32768,-32768,-32768,-32768, 1,-32768, -34, 225, 312, 312,
367 312, 312, 312, 206,-32768, 312, 312,-32768,-32768,-32768,
368 -32768, -23,-32768,-32768,-32768,-32768, 34,-32768,-32768, 7,
369 4, -28, -17, 365,-32768,-32768, 15,-32768, 21, 74,
370 -32768,-32768,-32768,-32768,-32768,-32768,-32768, 45, 44, 86,
371 35, 96, 3, 23, 8, 51, 104,-32768,-32768,-32768,
372 32,-32768, 46, 365, 46,-32768, 25, 25, 14, 55,
373 -32768,-32768, 87, 47,-32768,-32768,-32768,-32768,-32768,-32768,
374 -32768, -23, 34, 40,-32768,-32768, 57, 50, 46, 259,
375 365, 50, 365, 46, 365, -13,-32768,-32768,-32768, 312,
376 312, 312, 312, 312, 312, 312, 312, 312, 312, 312,
377 312, 312, 312, 312, 312, 312, 365, 312, 312, 312,
378 -32768,-32768,-32768, 61, 59, 365, 56,-32768, 56, 365,
379 365, 50, 66, 43, 372,-32768, 69,-32768, 73, 108,
380 106,-32768, 111, 109, 365,-32768,-32768,-32768,-32768,-32768,
381 45, 45, 44, 44, 86, 86, 86, 86, 35, 35,
382 96, 3, 23, 8, 107, 51,-32768,-32768,-32768, 365,
383 112, 259,-32768,-32768,-32768, 114, 312, 372,-32768,-32768,
384 -32768,-32768, 365,-32768,-32768, 312, 116,-32768,-32768,-32768,
385 -32768, 118,-32768,-32768,-32768, 169, 170,-32768
388 static const short yypgoto[] = {-32768,
389 -32768,-32768,-32768,-32768, -8,-32768,-32768,-32768,-32768,-32768,
390 -32768, 5,-32768, -66, 0,-32768,-32768,-32768,-32768,-32768,
391 -32768, 127, -126,-32768, 94, -94, -29, -40, 6,-32768,
392 12,-32768,-32768,-32768, 39,-32768,-32768, -141,-32768, 24,
393 28, -42, 36, 52, 53, 49, 58, 48,-32768, -128,
394 -32768,-32768,-32768, 18
401 static const short yytable[] = { 40,
402 177, 178, 98, 189, 37, 47, 133, 102, 135, 77,
403 155, 49, 75, 186, -31, 92, -32, 72, 104, -31,
404 -127, -32, 80, 40, 97, -127, -30, 103, 93, 47,
405 105, -30, 148, 123, -128, 49, 125, 153, 156, -128,
406 -129, 94, 183, 40, 183, -129, 201, 73, 74, 47,
407 131, 129, 124, 197, 132, 49, 130, 87, 88, 89,
408 90, 91, 140, 144, 95, 96, 202, 203, 117, 118,
409 119, 120, 136, 40, 165, 166, 167, 168, 126, 47,
410 99, 100, 101, 113, 114, 49, 110, 111, 112, 145,
411 147, 134, 188, 99, 141, 101, 184, 147, 185, 40,
412 40, 99, 40, 182, 40, 47, 47, 180, 47, 146,
413 47, 49, 49, 179, 49, 187, 49, 149, 108, 109,
414 152, 190, 154, 115, 116, 191, 40, 121, 122, 127,
415 128, 155, 47, 73, 74, 40, 161, 162, 49, 40,
416 40, 47, 163, 164, 175, 47, 47, 49, 158, 159,
417 160, 49, 49, 181, 40, 192, 169, 170, 149, 193,
418 47, 194, 196, 199, 198, 204, 49, 205, 207, 208,
419 106, 139, 195, 173, 171, 176, 172, 0, 0, 40,
420 0, 40, 0, 174, 0, 47, 0, 47, 0, 0,
421 0, 49, 40, 49, 0, 0, 0, 0, 47, 181,
422 0, 0, 0, 0, 49, 0, 0, 0, 1, 2,
423 3, 4, 5, 0, 6, 0, 7, 8, 9, 10,
424 11, 12, 13, 14, 15, 200, 16, 17, 18, 76,
425 0, 0, 0, 0, 0, 7, 8, 9, 10, 11,
426 12, 13, 14, 0, 0, 19, 20, 21, 0, 0,
427 22, 23, 0, 0, 24, 0, 25, 0, 0, 26,
428 27, 1, 2, 3, 4, 5, 0, 6, 0, 0,
429 0, 0, 0, 0, 0, 0, 0, 15, 0, 16,
430 17, 18, 0, 0, 0, 0, 0, 0, 0, 0,
431 0, 0, 0, 0, 0, 0, 0, 0, 19, 20,
432 21, 0, 0, 22, 23, 0, 0, 24, 0, 25,
433 0, 146, 26, 27, 1, 2, 76, 4, 5, 0,
434 82, 0, 0, 0, 0, 0, 0, 0, 0, 0,
435 83, 0, 16, 17, 18, 0, 0, 0, 0, 0,
436 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
437 0, 19, 20, 21, 0, 0, 22, 23, 0, 0,
438 24, 0, 25, 0, 0, 26, 27, 1, 2, 3,
439 4, 5, 0, 6, 1, 2, 76, 4, 5, 0,
440 82, 0, 0, 15, 0, 16, 17, 18, 0, 0,
441 83, 0, 16, 17, 18, 0, 0, 0, 0, 0,
442 0, 0, 0, 0, 19, 20, 21, 0, 0, 22,
443 23, 0, 0, 24, 0, 25, 0, 0, 26, 27,
444 24, 0, 25, 0, 0, 26, 27
447 static const short yycheck[] = { 0,
448 129, 130, 32, 145, 0, 0, 73, 37, 75, 18,
449 24, 0, 47, 140, 20, 24, 20, 0, 47, 25,
450 20, 25, 18, 24, 48, 25, 20, 24, 24, 24,
451 48, 25, 99, 31, 20, 24, 29, 104, 52, 25,
452 20, 24, 137, 44, 139, 25, 188, 47, 48, 44,
453 5, 20, 30, 180, 9, 44, 25, 19, 20, 21,
454 22, 23, 49, 93, 26, 27, 193, 196, 34, 35,
455 36, 37, 48, 74, 117, 118, 119, 120, 28, 74,
456 47, 48, 49, 40, 41, 74, 42, 43, 44, 50,
457 48, 74, 50, 47, 48, 49, 137, 48, 139, 100,
458 101, 47, 103, 48, 105, 100, 101, 49, 103, 53,
459 105, 100, 101, 53, 103, 50, 105, 100, 45, 46,
460 103, 53, 105, 38, 39, 53, 127, 32, 33, 26,
461 27, 24, 127, 47, 48, 136, 113, 114, 127, 140,
462 141, 136, 115, 116, 127, 140, 141, 136, 110, 111,
463 112, 140, 141, 136, 155, 50, 121, 122, 141, 49,
464 155, 53, 56, 50, 53, 50, 155, 50, 0, 0,
465 44, 78, 155, 125, 123, 128, 124, -1, -1, 180,
466 -1, 182, -1, 126, -1, 180, -1, 182, -1, -1,
467 -1, 180, 193, 182, -1, -1, -1, -1, 193, 182,
468 -1, -1, -1, -1, 193, -1, -1, -1, 3, 4,
469 5, 6, 7, -1, 9, -1, 11, 12, 13, 14,
470 15, 16, 17, 18, 19, 187, 21, 22, 23, 5,
471 -1, -1, -1, -1, -1, 11, 12, 13, 14, 15,
472 16, 17, 18, -1, -1, 40, 41, 42, -1, -1,
473 45, 46, -1, -1, 49, -1, 51, -1, -1, 54,
474 55, 3, 4, 5, 6, 7, -1, 9, -1, -1,
475 -1, -1, -1, -1, -1, -1, -1, 19, -1, 21,
476 22, 23, -1, -1, -1, -1, -1, -1, -1, -1,
477 -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
478 42, -1, -1, 45, 46, -1, -1, 49, -1, 51,
479 -1, 53, 54, 55, 3, 4, 5, 6, 7, -1,
480 9, -1, -1, -1, -1, -1, -1, -1, -1, -1,
481 19, -1, 21, 22, 23, -1, -1, -1, -1, -1,
482 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
483 -1, 40, 41, 42, -1, -1, 45, 46, -1, -1,
484 49, -1, 51, -1, -1, 54, 55, 3, 4, 5,
485 6, 7, -1, 9, 3, 4, 5, 6, 7, -1,
486 9, -1, -1, 19, -1, 21, 22, 23, -1, -1,
487 19, -1, 21, 22, 23, -1, -1, -1, -1, -1,
488 -1, -1, -1, -1, 40, 41, 42, -1, -1, 45,
489 46, -1, -1, 49, -1, 51, -1, -1, 54, 55,
490 49, -1, 51, -1, -1, 54, 55
492 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
493 #line 3 "/stone/jimb/main-98r2/share/bison.simple"
495 /* Skeleton output parser for bison,
496 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
498 This program is free software; you can redistribute it and/or modify
499 it under the terms of the GNU General Public License as published by
500 the Free Software Foundation; either version 2, or (at your option)
503 This program is distributed in the hope that it will be useful,
504 but WITHOUT ANY WARRANTY; without even the implied warranty of
505 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
506 GNU General Public License for more details.
508 You should have received a copy of the GNU General Public License
509 along with this program; if not, write to the Free Software
510 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
512 /* As a special exception, when this file is copied by Bison into a
513 Bison output file, you may use that output file without restriction.
514 This special exception was added by the Free Software Foundation
515 in version 1.24 of Bison. */
519 #define alloca __builtin_alloca
520 #else /* not GNU C. */
521 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
523 #else /* not sparc */
524 #if defined (MSDOS) && !defined (__TURBOC__)
525 #else /* not MSDOS, or __TURBOC__ */
528 #else /* not MSDOS, __TURBOC__, or _AIX */
532 void *alloca (unsigned int);
534 #else /* not __cplusplus */
536 #endif /* not __cplusplus */
538 #endif /* not _AIX */
539 #endif /* not MSDOS, or __TURBOC__ */
540 #endif /* not sparc. */
541 #endif /* not GNU C. */
542 #endif /* alloca not defined. */
544 /* This is the parser code that is written into each bison parser
545 when the %semantic_parser declaration is not specified in the grammar.
546 It was written by Richard Stallman by simplifying the hairy parser
547 used when %semantic_parser is specified. */
549 /* Note: there must be only one dollar sign in this file.
550 It is replaced by the list of actions, each action
551 as one case of the switch. */
553 #define yyerrok (yyerrstatus = 0)
554 #define yyclearin (yychar = YYEMPTY)
557 #define YYACCEPT return(0)
558 #define YYABORT return(1)
559 #define YYERROR goto yyerrlab1
560 /* Like YYERROR except do call yyerror.
561 This remains here temporarily to ease the
562 transition to the new meaning of YYERROR, for GCC.
563 Once GCC version 2 has supplanted version 1, this can go. */
564 #define YYFAIL goto yyerrlab
565 #define YYRECOVERING() (!!yyerrstatus)
566 #define YYBACKUP(token, value) \
568 if (yychar == YYEMPTY && yylen == 1) \
569 { yychar = (token), yylval = (value); \
570 yychar1 = YYTRANSLATE (yychar); \
575 { yyerror ("syntax error: cannot back up"); YYERROR; } \
579 #define YYERRCODE 256
582 #define YYLEX yylex()
588 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
590 #define YYLEX yylex(&yylval, &yylloc)
592 #else /* not YYLSP_NEEDED */
594 #define YYLEX yylex(&yylval, YYLEX_PARAM)
596 #define YYLEX yylex(&yylval)
598 #endif /* not YYLSP_NEEDED */
601 /* If nonreentrant, generate the variables here */
605 int yychar; /* the lookahead symbol */
606 YYSTYPE yylval; /* the semantic value of the */
607 /* lookahead symbol */
610 YYLTYPE yylloc; /* location data for the lookahead */
614 int yynerrs; /* number of parse errors so far */
615 #endif /* not YYPURE */
618 int yydebug; /* nonzero means print parse trace */
619 /* Since this is uninitialized, it does not stop multiple parsers
623 /* YYINITDEPTH indicates the initial size of the parser's stacks */
626 #define YYINITDEPTH 200
629 /* YYMAXDEPTH is the maximum size the stacks can grow to
630 (effective only if the built-in stack extension method is used). */
637 #define YYMAXDEPTH 10000
640 /* Prevent warning if -Wstrict-prototypes. */
645 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
646 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
647 #else /* not GNU C or C++ */
650 /* This is the most reliable way to avoid incompatibilities
651 in available built-in functions on various systems. */
653 __yy_memcpy (to, from, count)
658 register char *f = from;
659 register char *t = to;
660 register int i = count;
666 #else /* __cplusplus */
668 /* This is the most reliable way to avoid incompatibilities
669 in available built-in functions on various systems. */
671 __yy_memcpy (char *to, char *from, int count)
673 register char *f = from;
674 register char *t = to;
675 register int i = count;
684 #line 196 "/stone/jimb/main-98r2/share/bison.simple"
686 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
687 into yyparse. The argument should have type void *.
688 It should actually point to an object.
689 Grammar actions can access the variable by casting it
690 to the proper pointer type. */
694 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
695 #define YYPARSE_PARAM_DECL
696 #else /* not __cplusplus */
697 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
698 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
699 #endif /* not __cplusplus */
700 #else /* not YYPARSE_PARAM */
701 #define YYPARSE_PARAM_ARG
702 #define YYPARSE_PARAM_DECL
703 #endif /* not YYPARSE_PARAM */
706 yyparse(YYPARSE_PARAM_ARG)
709 register int yystate;
711 register short *yyssp;
712 register YYSTYPE *yyvsp;
713 int yyerrstatus; /* number of tokens to shift before error messages enabled */
714 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
716 short yyssa[YYINITDEPTH]; /* the state stack */
717 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
719 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
720 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to xreallocate them elsewhere */
723 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
724 YYLTYPE *yyls = yylsa;
727 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
729 #define YYPOPSTACK (yyvsp--, yyssp--)
732 int yystacksize = YYINITDEPTH;
743 YYSTYPE yyval; /* the variable used to return */
744 /* semantic values from the action */
751 fprintf(stderr, "Starting parse\n");
757 yychar = YYEMPTY; /* Cause a token to be read. */
759 /* Initialize stack pointers.
760 Waste one element of value and location stack
761 so that they stay on the same level as the state stack.
762 The wasted elements are never initialized. */
770 /* Push a new state, which is found in yystate . */
771 /* In all cases, when you get here, the value and location stacks
772 have just been pushed. so pushing a state here evens the stacks. */
777 if (yyssp >= yyss + yystacksize - 1)
779 /* Give user a chance to xreallocate the stack */
780 /* Use copies of these so that the &'s don't force the real ones into memory. */
781 YYSTYPE *yyvs1 = yyvs;
784 YYLTYPE *yyls1 = yyls;
787 /* Get the current used size of the three stacks, in elements. */
788 int size = yyssp - yyss + 1;
791 /* Each stack pointer address is followed by the size of
792 the data in use in that stack, in bytes. */
794 /* This used to be a conditional around just the two extra args,
795 but that might be undefined if yyoverflow is a macro. */
796 yyoverflow("parser stack overflow",
797 &yyss1, size * sizeof (*yyssp),
798 &yyvs1, size * sizeof (*yyvsp),
799 &yyls1, size * sizeof (*yylsp),
802 yyoverflow("parser stack overflow",
803 &yyss1, size * sizeof (*yyssp),
804 &yyvs1, size * sizeof (*yyvsp),
808 yyss = yyss1; yyvs = yyvs1;
812 #else /* no yyoverflow */
813 /* Extend the stack our own way. */
814 if (yystacksize >= YYMAXDEPTH)
816 yyerror("parser stack overflow");
820 if (yystacksize > YYMAXDEPTH)
821 yystacksize = YYMAXDEPTH;
822 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
823 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
824 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
825 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
827 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
828 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
830 #endif /* no yyoverflow */
832 yyssp = yyss + size - 1;
833 yyvsp = yyvs + size - 1;
835 yylsp = yyls + size - 1;
840 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
843 if (yyssp >= yyss + yystacksize - 1)
849 fprintf(stderr, "Entering state %d\n", yystate);
855 /* Do appropriate processing given the current state. */
856 /* Read a lookahead token if we need one and don't already have one. */
859 /* First try to decide what to do without reference to lookahead token. */
861 yyn = yypact[yystate];
865 /* Not known => get a lookahead token if don't already have one. */
867 /* yychar is either YYEMPTY or YYEOF
868 or a valid token in external form. */
870 if (yychar == YYEMPTY)
874 fprintf(stderr, "Reading a token: ");
879 /* Convert token to internal form (in yychar1) for indexing tables with */
881 if (yychar <= 0) /* This means end of input. */
884 yychar = YYEOF; /* Don't call YYLEX any more */
888 fprintf(stderr, "Now at end of input.\n");
893 yychar1 = YYTRANSLATE(yychar);
898 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
899 /* Give the individual parser a way to print the precise meaning
900 of a token, for further debugging info. */
902 YYPRINT (stderr, yychar, yylval);
904 fprintf (stderr, ")\n");
910 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
915 /* yyn is what to do for this token type in this state.
916 Negative => reduce, -yyn is rule number.
917 Positive => shift, yyn is new state.
918 New state is final state => don't bother to shift,
920 0, or most negative number => error. */
935 /* Shift the lookahead token. */
939 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
942 /* Discard the token being shifted unless it is eof. */
951 /* count tokens shifted since error; after three, turn off error status. */
952 if (yyerrstatus) yyerrstatus--;
957 /* Do the default action for the current state. */
960 yyn = yydefact[yystate];
964 /* Do a reduction. yyn is the number of a rule to reduce with. */
968 yyval = yyvsp[1-yylen]; /* implement default value of the action */
975 fprintf (stderr, "Reducing via rule %d (line %d), ",
978 /* Print the symbols being reduced, and their result. */
979 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
980 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
981 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
991 write_exp_elt_opcode(OP_TYPE);
992 write_exp_elt_type(yyvsp[0].tval);
993 write_exp_elt_opcode(OP_TYPE);
999 write_exp_elt_opcode (OP_STRING);
1000 write_exp_string (yyvsp[0].sval);
1001 write_exp_elt_opcode (OP_STRING);
1005 #line 231 "jv-exp.y"
1006 { write_exp_elt_opcode (OP_LONG);
1007 write_exp_elt_type (yyvsp[0].typed_val_int.type);
1008 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1009 write_exp_elt_opcode (OP_LONG); ;
1012 #line 236 "jv-exp.y"
1014 parse_number (yyvsp[0].sval.ptr, yyvsp[0].sval.length, 0, &val);
1015 write_exp_elt_opcode (OP_LONG);
1016 write_exp_elt_type (val.typed_val_int.type);
1017 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1018 write_exp_elt_opcode (OP_LONG);
1022 #line 244 "jv-exp.y"
1023 { write_exp_elt_opcode (OP_DOUBLE);
1024 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1025 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1026 write_exp_elt_opcode (OP_DOUBLE); ;
1029 #line 249 "jv-exp.y"
1030 { write_exp_elt_opcode (OP_LONG);
1031 write_exp_elt_type (java_boolean_type);
1032 write_exp_elt_longcst ((LONGEST)yyvsp[0].lval);
1033 write_exp_elt_opcode (OP_LONG); ;
1036 #line 266 "jv-exp.y"
1037 { yyval.tval = java_boolean_type; ;
1040 #line 276 "jv-exp.y"
1041 { yyval.tval = java_byte_type; ;
1044 #line 278 "jv-exp.y"
1045 { yyval.tval = java_short_type; ;
1048 #line 280 "jv-exp.y"
1049 { yyval.tval = java_int_type; ;
1052 #line 282 "jv-exp.y"
1053 { yyval.tval = java_long_type; ;
1056 #line 284 "jv-exp.y"
1057 { yyval.tval = java_char_type; ;
1060 #line 289 "jv-exp.y"
1061 { yyval.tval = java_float_type; ;
1064 #line 291 "jv-exp.y"
1065 { yyval.tval = java_double_type; ;
1068 #line 303 "jv-exp.y"
1069 { yyval.tval = java_type_from_name (yyvsp[0].sval); ;
1072 #line 312 "jv-exp.y"
1073 { yyval.tval = java_array_type (yyvsp[-1].tval, yyvsp[0].lval); ;
1076 #line 314 "jv-exp.y"
1077 { yyval.tval = java_array_type (java_type_from_name (yyvsp[-1].sval), yyvsp[0].lval); ;
1080 #line 334 "jv-exp.y"
1081 { yyval.sval.length = yyvsp[-2].sval.length + yyvsp[0].sval.length + 1;
1082 if (yyvsp[-2].sval.ptr + yyvsp[-2].sval.length + 1 == yyvsp[0].sval.ptr
1083 && yyvsp[-2].sval.ptr[yyvsp[-2].sval.length] == '.')
1084 yyval.sval.ptr = yyvsp[-2].sval.ptr; /* Optimization. */
1087 yyval.sval.ptr = (char *) xmalloc (yyval.sval.length + 1);
1088 make_cleanup (free, yyval.sval.ptr);
1089 sprintf (yyval.sval.ptr, "%.*s.%.*s",
1090 yyvsp[-2].sval.length, yyvsp[-2].sval.ptr, yyvsp[0].sval.length, yyvsp[0].sval.ptr);
1094 #line 358 "jv-exp.y"
1095 { write_exp_elt_opcode (BINOP_COMMA); ;
1098 #line 369 "jv-exp.y"
1099 { write_exp_elt_opcode (OP_THIS);
1100 write_exp_elt_opcode (OP_THIS); ;
1103 #line 377 "jv-exp.y"
1104 { write_exp_elt_opcode (OP_ARRAY);
1105 write_exp_elt_longcst ((LONGEST) 0);
1106 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1107 write_exp_elt_opcode (OP_ARRAY); ;
1110 #line 385 "jv-exp.y"
1111 { start_arglist (); ;
1114 #line 390 "jv-exp.y"
1115 { yyval.lval = end_arglist () - 1; ;
1118 #line 395 "jv-exp.y"
1119 { error ("FIXME - ClassInstanceCreationExpression"); ;
1122 #line 400 "jv-exp.y"
1123 { arglist_len = 1; ;
1126 #line 402 "jv-exp.y"
1130 #line 407 "jv-exp.y"
1131 { arglist_len = 0; ;
1134 #line 413 "jv-exp.y"
1135 { error ("FIXME - ArrayCreatiionExpression"); ;
1138 #line 415 "jv-exp.y"
1139 { error ("FIXME - ArrayCreatiionExpression"); ;
1142 #line 429 "jv-exp.y"
1146 #line 431 "jv-exp.y"
1147 { yyval.lval = yyvsp[-2].lval + 1; ;
1150 #line 437 "jv-exp.y"
1154 #line 442 "jv-exp.y"
1155 { push_fieldnames (yyvsp[0].sval); ;
1158 #line 444 "jv-exp.y"
1159 { push_fieldnames (yyvsp[0].sval); ;
1162 #line 450 "jv-exp.y"
1163 { error ("method invocation not implemented"); ;
1166 #line 452 "jv-exp.y"
1167 { error ("method invocation not implemented"); ;
1170 #line 454 "jv-exp.y"
1171 { error ("method invocation not implemented"); ;
1174 #line 459 "jv-exp.y"
1176 /* Emit code for the Name now, then exchange it in the
1177 expout array with the Expression's code. We could
1178 introduce a OP_SWAP code or a reversed version of
1179 BINOP_SUBSCRIPT, but that makes the rest of GDB pay
1180 for our parsing kludges. */
1181 struct expression *name_expr;
1183 push_expression_name (yyvsp[-3].sval);
1184 name_expr = copy_exp (expout, expout_ptr);
1185 expout_ptr -= name_expr->nelts;
1186 insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr),
1189 write_exp_elt_opcode (BINOP_SUBSCRIPT);
1193 #line 476 "jv-exp.y"
1194 { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
1197 #line 478 "jv-exp.y"
1198 { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
1201 #line 484 "jv-exp.y"
1202 { push_expression_name (yyvsp[0].sval); ;
1205 #line 493 "jv-exp.y"
1206 { write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
1209 #line 498 "jv-exp.y"
1210 { write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
1213 #line 506 "jv-exp.y"
1214 { write_exp_elt_opcode (UNOP_NEG); ;
1217 #line 508 "jv-exp.y"
1218 { write_exp_elt_opcode (UNOP_IND); ;
1221 #line 514 "jv-exp.y"
1222 { write_exp_elt_opcode (UNOP_PREINCREMENT); ;
1225 #line 519 "jv-exp.y"
1226 { write_exp_elt_opcode (UNOP_PREDECREMENT); ;
1229 #line 525 "jv-exp.y"
1230 { write_exp_elt_opcode (UNOP_COMPLEMENT); ;
1233 #line 527 "jv-exp.y"
1234 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1237 #line 533 "jv-exp.y"
1238 { write_exp_elt_opcode (UNOP_CAST);
1239 write_exp_elt_type (java_array_type (yyvsp[-3].tval, yyvsp[-2].lval));
1240 write_exp_elt_opcode (UNOP_CAST); ;
1243 #line 537 "jv-exp.y"
1245 int exp_size = expout_ptr;
1246 int last_exp_size = length_of_subexp(expout, expout_ptr);
1249 int base = expout_ptr - last_exp_size - 3;
1250 if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
1251 error ("invalid cast expression");
1252 type = expout->elts[base+1].type;
1253 /* Remove the 'Expression' and slide the
1254 UnaryExpressionNotPlusMinus down to replace it. */
1255 for (i = 0; i < last_exp_size; i++)
1256 expout->elts[base + i] = expout->elts[base + i + 3];
1258 if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
1259 type = lookup_pointer_type (type);
1260 write_exp_elt_opcode (UNOP_CAST);
1261 write_exp_elt_type (type);
1262 write_exp_elt_opcode (UNOP_CAST);
1266 #line 558 "jv-exp.y"
1267 { write_exp_elt_opcode (UNOP_CAST);
1268 write_exp_elt_type (java_array_type (java_type_from_name (yyvsp[-3].sval), yyvsp[-2].lval));
1269 write_exp_elt_opcode (UNOP_CAST); ;
1272 #line 567 "jv-exp.y"
1273 { write_exp_elt_opcode (BINOP_MUL); ;
1276 #line 569 "jv-exp.y"
1277 { write_exp_elt_opcode (BINOP_DIV); ;
1280 #line 571 "jv-exp.y"
1281 { write_exp_elt_opcode (BINOP_REM); ;
1284 #line 577 "jv-exp.y"
1285 { write_exp_elt_opcode (BINOP_ADD); ;
1288 #line 579 "jv-exp.y"
1289 { write_exp_elt_opcode (BINOP_SUB); ;
1292 #line 585 "jv-exp.y"
1293 { write_exp_elt_opcode (BINOP_LSH); ;
1296 #line 587 "jv-exp.y"
1297 { write_exp_elt_opcode (BINOP_RSH); ;
1300 #line 594 "jv-exp.y"
1301 { write_exp_elt_opcode (BINOP_LESS); ;
1304 #line 596 "jv-exp.y"
1305 { write_exp_elt_opcode (BINOP_GTR); ;
1308 #line 598 "jv-exp.y"
1309 { write_exp_elt_opcode (BINOP_LEQ); ;
1312 #line 600 "jv-exp.y"
1313 { write_exp_elt_opcode (BINOP_GEQ); ;
1316 #line 607 "jv-exp.y"
1317 { write_exp_elt_opcode (BINOP_EQUAL); ;
1320 #line 609 "jv-exp.y"
1321 { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1324 #line 615 "jv-exp.y"
1325 { write_exp_elt_opcode (BINOP_BITWISE_AND); ;
1328 #line 621 "jv-exp.y"
1329 { write_exp_elt_opcode (BINOP_BITWISE_XOR); ;
1332 #line 626 "jv-exp.y"
1333 { write_exp_elt_opcode (BINOP_BITWISE_IOR); ;
1336 #line 632 "jv-exp.y"
1337 { write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1340 #line 638 "jv-exp.y"
1341 { write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1344 #line 644 "jv-exp.y"
1345 { write_exp_elt_opcode (TERNOP_COND); ;
1348 #line 654 "jv-exp.y"
1349 { write_exp_elt_opcode (BINOP_ASSIGN); ;
1352 #line 656 "jv-exp.y"
1353 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1354 write_exp_elt_opcode (yyvsp[-1].opcode);
1355 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
1358 #line 663 "jv-exp.y"
1359 { push_expression_name (yyvsp[0].sval); ;
1362 /* the action file gets copied in in place of this dollarsign */
1363 #line 498 "/stone/jimb/main-98r2/share/bison.simple"
1374 short *ssp1 = yyss - 1;
1375 fprintf (stderr, "state stack now");
1376 while (ssp1 != yyssp)
1377 fprintf (stderr, " %d", *++ssp1);
1378 fprintf (stderr, "\n");
1388 yylsp->first_line = yylloc.first_line;
1389 yylsp->first_column = yylloc.first_column;
1390 yylsp->last_line = (yylsp-1)->last_line;
1391 yylsp->last_column = (yylsp-1)->last_column;
1396 yylsp->last_line = (yylsp+yylen-1)->last_line;
1397 yylsp->last_column = (yylsp+yylen-1)->last_column;
1401 /* Now "shift" the result of the reduction.
1402 Determine what state that goes to,
1403 based on the state we popped back to
1404 and the rule number reduced by. */
1408 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1409 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1410 yystate = yytable[yystate];
1412 yystate = yydefgoto[yyn - YYNTBASE];
1416 yyerrlab: /* here on detecting error */
1419 /* If not already recovering from an error, report this error. */
1423 #ifdef YYERROR_VERBOSE
1424 yyn = yypact[yystate];
1426 if (yyn > YYFLAG && yyn < YYLAST)
1433 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1434 for (x = (yyn < 0 ? -yyn : 0);
1435 x < (sizeof(yytname) / sizeof(char *)); x++)
1436 if (yycheck[x + yyn] == x)
1437 size += strlen(yytname[x]) + 15, count++;
1438 msg = (char *) xmalloc(size + 15);
1441 strcpy(msg, "parse error");
1446 for (x = (yyn < 0 ? -yyn : 0);
1447 x < (sizeof(yytname) / sizeof(char *)); x++)
1448 if (yycheck[x + yyn] == x)
1450 strcat(msg, count == 0 ? ", expecting `" : " or `");
1451 strcat(msg, yytname[x]);
1460 yyerror ("parse error; also virtual memory exceeded");
1463 #endif /* YYERROR_VERBOSE */
1464 yyerror("parse error");
1468 yyerrlab1: /* here on error raised explicitly by an action */
1470 if (yyerrstatus == 3)
1472 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1474 /* return failure if at end of input */
1475 if (yychar == YYEOF)
1480 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1486 /* Else will try to reuse lookahead token
1487 after shifting the error token. */
1489 yyerrstatus = 3; /* Each real token shifted decrements this */
1493 yyerrdefault: /* current state does not do anything special for the error token. */
1496 /* This is wrong; only states that explicitly want error tokens
1497 should shift them. */
1498 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1499 if (yyn) goto yydefault;
1502 yyerrpop: /* pop the current state because it cannot handle the error token */
1504 if (yyssp == yyss) YYABORT;
1514 short *ssp1 = yyss - 1;
1515 fprintf (stderr, "Error: state stack now");
1516 while (ssp1 != yyssp)
1517 fprintf (stderr, " %d", *++ssp1);
1518 fprintf (stderr, "\n");
1524 yyn = yypact[yystate];
1529 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1548 fprintf(stderr, "Shifting error token, ");
1559 #line 675 "jv-exp.y"
1561 /* Take care of parsing a number (anything that starts with a digit).
1562 Set yylval and return the token type; update lexptr.
1563 LEN is the number of characters in it. */
1565 /*** Needs some error checking for the float case ***/
1568 parse_number (p, len, parsed_float, putithere)
1574 register ULONGEST n = 0;
1575 ULONGEST limit, limit_div_base;
1578 register int base = input_radix;
1584 /* It's a float since it contains a point or an exponent. */
1586 int num = 0; /* number of tokens scanned by scanf */
1587 char saved_char = p[len];
1589 p[len] = 0; /* null-terminate the token */
1590 if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
1591 num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval, &c);
1592 else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
1593 num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c);
1596 #ifdef SCANF_HAS_LONG_DOUBLE
1597 num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c);
1599 /* Scan it into a double, then assign it to the long double.
1600 This at least wins with values representable in the range
1603 num = sscanf (p, "%lg%c", &temp, &c);
1604 putithere->typed_val_float.dval = temp;
1607 p[len] = saved_char; /* restore the input stream */
1608 if (num != 1) /* check scanf found ONLY a float ... */
1610 /* See if it has `f' or `d' suffix (float or double). */
1612 c = tolower (p[len - 1]);
1614 if (c == 'f' || c == 'F')
1615 putithere->typed_val_float.type = builtin_type_float;
1616 else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
1617 putithere->typed_val_float.type = builtin_type_double;
1621 return FLOATING_POINT_LITERAL;
1624 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
1656 limit = (ULONGEST)0xffffffff;
1657 if (c == 'l' || c == 'L')
1659 type = java_long_type;
1661 /* A paranoid calculation of (1<<64)-1. */
1662 limit = ((limit << 16) << 16) | limit;
1666 type = java_int_type;
1668 limit_div_base = limit / (ULONGEST) base;
1673 if (c >= '0' && c <= '9')
1675 else if (c >= 'A' && c <= 'Z')
1677 else if (c >= 'a' && c <= 'z')
1680 return ERROR; /* Char not a digit */
1683 if (n > limit_div_base
1684 || (n *= base) > limit - c)
1685 error ("Numeric constant too large.");
1689 putithere->typed_val_int.val = n;
1690 putithere->typed_val_int.type = type;
1691 return INTEGER_LITERAL;
1698 enum exp_opcode opcode;
1701 static const struct token tokentab3[] =
1703 {">>=", ASSIGN_MODIFY, BINOP_RSH},
1704 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
1707 static const struct token tokentab2[] =
1709 {"+=", ASSIGN_MODIFY, BINOP_ADD},
1710 {"-=", ASSIGN_MODIFY, BINOP_SUB},
1711 {"*=", ASSIGN_MODIFY, BINOP_MUL},
1712 {"/=", ASSIGN_MODIFY, BINOP_DIV},
1713 {"%=", ASSIGN_MODIFY, BINOP_REM},
1714 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
1715 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
1716 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
1717 {"++", INCREMENT, BINOP_END},
1718 {"--", DECREMENT, BINOP_END},
1719 {"&&", ANDAND, BINOP_END},
1720 {"||", OROR, BINOP_END},
1721 {"<<", LSH, BINOP_END},
1722 {">>", RSH, BINOP_END},
1723 {"==", EQUAL, BINOP_END},
1724 {"!=", NOTEQUAL, BINOP_END},
1725 {"<=", LEQ, BINOP_END},
1726 {">=", GEQ, BINOP_END}
1729 /* Read one token, getting characters through lexptr. */
1740 static char *tempbuf;
1741 static int tempbufsize;
1746 /* See if it is a special token of length 3. */
1747 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
1748 if (STREQN (tokstart, tokentab3[i].operator, 3))
1751 yylval.opcode = tokentab3[i].opcode;
1752 return tokentab3[i].token;
1755 /* See if it is a special token of length 2. */
1756 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
1757 if (STREQN (tokstart, tokentab2[i].operator, 2))
1760 yylval.opcode = tokentab2[i].opcode;
1761 return tokentab2[i].token;
1764 switch (c = *tokstart)
1776 /* We either have a character constant ('0' or '\177' for example)
1777 or we have a quoted symbol reference ('foo(int,int)' in C++
1782 c = parse_escape (&lexptr);
1784 error ("Empty character constant.");
1786 yylval.typed_val_int.val = c;
1787 yylval.typed_val_int.type = builtin_type_char;
1792 namelen = skip_quoted (tokstart) - tokstart;
1795 lexptr = tokstart + namelen;
1796 if (lexptr[-1] != '\'')
1797 error ("Unmatched single quote.");
1802 error ("Invalid character constant.");
1804 return INTEGER_LITERAL;
1812 if (paren_depth == 0)
1819 if (comma_terminates && paren_depth == 0)
1825 /* Might be a floating point number. */
1826 if (lexptr[1] < '0' || lexptr[1] > '9')
1827 goto symbol; /* Nope, must be a symbol. */
1828 /* FALL THRU into number case. */
1841 /* It's a number. */
1842 int got_dot = 0, got_e = 0, toktype;
1843 register char *p = tokstart;
1844 int hex = input_radix > 10;
1846 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
1851 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
1859 /* This test includes !hex because 'e' is a valid hex digit
1860 and thus does not indicate a floating point number when
1861 the radix is hex. */
1862 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
1863 got_dot = got_e = 1;
1864 /* This test does not include !hex, because a '.' always indicates
1865 a decimal floating point number regardless of the radix. */
1866 else if (!got_dot && *p == '.')
1868 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
1869 && (*p == '-' || *p == '+'))
1870 /* This is the sign of the exponent, not the end of the
1873 /* We will take any letters or digits. parse_number will
1874 complain if past the radix, or if L or U are not final. */
1875 else if ((*p < '0' || *p > '9')
1876 && ((*p < 'a' || *p > 'z')
1877 && (*p < 'A' || *p > 'Z')))
1880 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
1881 if (toktype == ERROR)
1883 char *err_copy = (char *) alloca (p - tokstart + 1);
1885 memcpy (err_copy, tokstart, p - tokstart);
1886 err_copy[p - tokstart] = 0;
1887 error ("Invalid number \"%s\".", err_copy);
1918 /* Build the gdb internal form of the input string in tempbuf,
1919 translating any standard C escape forms seen. Note that the
1920 buffer is null byte terminated *only* for the convenience of
1921 debugging gdb itself and printing the buffer contents when
1922 the buffer contains no embedded nulls. Gdb does not depend
1923 upon the buffer being null byte terminated, it uses the length
1924 string instead. This allows gdb to handle C strings (as well
1925 as strings in other languages) with embedded null bytes */
1927 tokptr = ++tokstart;
1931 /* Grow the static temp buffer if necessary, including allocating
1932 the first one on demand. */
1933 if (tempbufindex + 1 >= tempbufsize)
1935 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
1941 /* Do nothing, loop will terminate. */
1945 c = parse_escape (&tokptr);
1950 tempbuf[tempbufindex++] = c;
1953 tempbuf[tempbufindex++] = *tokptr++;
1956 } while ((*tokptr != '"') && (*tokptr != '\0'));
1957 if (*tokptr++ != '"')
1959 error ("Unterminated string in expression.");
1961 tempbuf[tempbufindex] = '\0'; /* See note above */
1962 yylval.sval.ptr = tempbuf;
1963 yylval.sval.length = tempbufindex;
1965 return (STRING_LITERAL);
1968 if (!(c == '_' || c == '$'
1969 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
1970 /* We must have come across a bad character (e.g. ';'). */
1971 error ("Invalid character '%c' in expression.", c);
1973 /* It's a name. See how long it is. */
1975 for (c = tokstart[namelen];
1978 || (c >= '0' && c <= '9')
1979 || (c >= 'a' && c <= 'z')
1980 || (c >= 'A' && c <= 'Z')
1987 while (tokstart[++i] && tokstart[i] != '>');
1988 if (tokstart[i] == '>')
1991 c = tokstart[++namelen];
1994 /* The token "if" terminates the expression and is NOT
1995 removed from the input stream. */
1996 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2005 /* Catch specific keywords. Should be done with a data structure. */
2009 if (STREQN (tokstart, "boolean", 7))
2013 if (STREQN (tokstart, "double", 6))
2017 if (STREQN (tokstart, "short", 5))
2019 if (STREQN (tokstart, "false", 5))
2022 return BOOLEAN_LITERAL;
2024 if (STREQN (tokstart, "super", 5))
2026 if (STREQN (tokstart, "float", 5))
2030 if (STREQN (tokstart, "long", 4))
2032 if (STREQN (tokstart, "byte", 4))
2034 if (STREQN (tokstart, "char", 4))
2036 if (STREQN (tokstart, "true", 4))
2039 return BOOLEAN_LITERAL;
2041 if (current_language->la_language == language_cplus
2042 && STREQN (tokstart, "this", 4))
2044 static const char this_name[] =
2045 { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
2047 if (lookup_symbol (this_name, expression_context_block,
2048 VAR_NAMESPACE, (int *) NULL,
2049 (struct symtab **) NULL))
2054 if (STREQN (tokstart, "int", 3))
2056 if (STREQN (tokstart, "new", 3))
2063 yylval.sval.ptr = tokstart;
2064 yylval.sval.length = namelen;
2066 if (*tokstart == '$')
2068 write_dollar_variable (yylval.sval);
2072 /* Input names that aren't symbols but ARE valid hex numbers,
2073 when the input radix permits them, can be names or numbers
2074 depending on the parse. Note we support radixes > 16 here. */
2075 if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2076 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2078 YYSTYPE newlval; /* Its value is ignored. */
2079 int hextype = parse_number (tokstart, namelen, 0, &newlval);
2080 if (hextype == INTEGER_LITERAL)
2090 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2093 static struct type *
2094 java_type_from_name (name)
2098 char *tmp = copy_name (name);
2099 struct type *typ = java_lookup_class (tmp);
2100 if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
2101 error ("No class named %s.", tmp);
2105 /* If NAME is a valid variable name in this scope, push it and return 1.
2106 Otherwise, return 0. */
2109 push_variable (name)
2113 char *tmp = copy_name (name);
2114 int is_a_field_of_this = 0;
2116 sym = lookup_symbol (tmp, expression_context_block, VAR_NAMESPACE,
2117 &is_a_field_of_this, (struct symtab **) NULL);
2118 if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
2120 if (symbol_read_needs_frame (sym))
2122 if (innermost_block == 0 ||
2123 contained_in (block_found, innermost_block))
2124 innermost_block = block_found;
2127 write_exp_elt_opcode (OP_VAR_VALUE);
2128 /* We want to use the selected frame, not another more inner frame
2129 which happens to be in the same block. */
2130 write_exp_elt_block (NULL);
2131 write_exp_elt_sym (sym);
2132 write_exp_elt_opcode (OP_VAR_VALUE);
2135 if (is_a_field_of_this)
2137 /* it hangs off of `this'. Must not inadvertently convert from a
2138 method call to data ref. */
2139 if (innermost_block == 0 ||
2140 contained_in (block_found, innermost_block))
2141 innermost_block = block_found;
2142 write_exp_elt_opcode (OP_THIS);
2143 write_exp_elt_opcode (OP_THIS);
2144 write_exp_elt_opcode (STRUCTOP_PTR);
2145 write_exp_string (name);
2146 write_exp_elt_opcode (STRUCTOP_PTR);
2152 /* Assuming a reference expression has been pushed, emit the
2153 STRUCTOP_STRUCT ops to access the field named NAME. If NAME is a
2154 qualified name (has '.'), generate a field access for each part. */
2157 push_fieldnames (name)
2161 struct stoken token;
2162 token.ptr = name.ptr;
2165 if (i == name.length || name.ptr[i] == '.')
2167 /* token.ptr is start of current field name. */
2168 token.length = &name.ptr[i] - token.ptr;
2169 write_exp_elt_opcode (STRUCTOP_STRUCT);
2170 write_exp_string (token);
2171 write_exp_elt_opcode (STRUCTOP_STRUCT);
2172 token.ptr += token.length + 1;
2174 if (i >= name.length)
2179 /* Helper routine for push_expression_name.
2180 Handle a qualified name, where DOT_INDEX is the index of the first '.' */
2183 push_qualified_expression_name (name, dot_index)
2187 struct stoken token;
2191 token.ptr = name.ptr;
2192 token.length = dot_index;
2194 if (push_variable (token))
2196 token.ptr = name.ptr + dot_index + 1;
2197 token.length = name.length - dot_index - 1;
2198 push_fieldnames (token);
2202 token.ptr = name.ptr;
2205 token.length = dot_index;
2206 tmp = copy_name (token);
2207 typ = java_lookup_class (tmp);
2210 if (dot_index == name.length)
2212 write_exp_elt_opcode(OP_TYPE);
2213 write_exp_elt_type(typ);
2214 write_exp_elt_opcode(OP_TYPE);
2217 dot_index++; /* Skip '.' */
2218 name.ptr += dot_index;
2219 name.length -= dot_index;
2221 while (dot_index < name.length && name.ptr[dot_index] != '.')
2223 token.ptr = name.ptr;
2224 token.length = dot_index;
2225 write_exp_elt_opcode (OP_SCOPE);
2226 write_exp_elt_type (typ);
2227 write_exp_string (token);
2228 write_exp_elt_opcode (OP_SCOPE);
2229 if (dot_index < name.length)
2232 name.ptr += dot_index;
2233 name.length -= dot_index;
2234 push_fieldnames (name);
2238 else if (dot_index >= name.length)
2240 dot_index++; /* Skip '.' */
2241 while (dot_index < name.length && name.ptr[dot_index] != '.')
2244 error ("unknown type `%.*s'", name.length, name.ptr);
2247 /* Handle Name in an expression (or LHS).
2248 Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
2251 push_expression_name (name)
2259 for (i = 0; i < name.length; i++)
2261 if (name.ptr[i] == '.')
2263 /* It's a Qualified Expression Name. */
2264 push_qualified_expression_name (name, i);
2269 /* It's a Simple Expression Name. */
2271 if (push_variable (name))
2273 tmp = copy_name (name);
2274 typ = java_lookup_class (tmp);
2277 write_exp_elt_opcode(OP_TYPE);
2278 write_exp_elt_type(typ);
2279 write_exp_elt_opcode(OP_TYPE);
2283 struct minimal_symbol *msymbol;
2285 msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
2286 if (msymbol != NULL)
2288 write_exp_msymbol (msymbol,
2289 lookup_function_type (builtin_type_int),
2292 else if (!have_full_symbols () && !have_partial_symbols ())
2293 error ("No symbol table is loaded. Use the \"file\" command.");
2295 error ("No symbol \"%s\" in current context.", tmp);
2301 /* The following two routines, copy_exp and insert_exp, aren't specific to
2302 Java, so they could go in parse.c, but their only purpose is to support
2303 the parsing kludges we use in this file, so maybe it's best to isolate
2306 /* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
2307 into a freshly xmalloc'ed struct expression. Its language_defn is set
2309 static struct expression *
2310 copy_exp (expr, endpos)
2311 struct expression *expr;
2314 int len = length_of_subexp (expr, endpos);
2315 struct expression *new
2316 = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
2318 memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
2319 new->language_defn = 0;
2324 /* Insert the expression NEW into the current expression (expout) at POS. */
2326 insert_exp (pos, new)
2328 struct expression *new;
2330 int newlen = new->nelts;
2332 /* Grow expout if necessary. In this function's only use at present,
2333 this should never be necessary. */
2334 if (expout_ptr + newlen > expout_size)
2336 expout_size = max (expout_size * 2, expout_ptr + newlen + 10);
2337 expout = (struct expression *)
2338 xrealloc ((char *) expout, (sizeof (struct expression)
2339 + EXP_ELEM_TO_BYTES (expout_size)));
2345 for (i = expout_ptr - 1; i >= pos; i--)
2346 expout->elts[i + newlen] = expout->elts[i];
2349 memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen));
2350 expout_ptr += newlen;