1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
56 INTEGER_LITERAL = 258,
57 FLOATING_POINT_LITERAL = 259,
60 BOOLEAN_LITERAL = 262,
88 #define INTEGER_LITERAL 258
89 #define FLOATING_POINT_LITERAL 259
90 #define IDENTIFIER 260
91 #define STRING_LITERAL 261
92 #define BOOLEAN_LITERAL 262
94 #define NAME_OR_INT 264
105 #define ASSIGN_MODIFY 275
116 #define DECREMENT 286
117 #define INCREMENT 287
122 /* Copy the first part of user declarations. */
127 #include "gdb_string.h"
129 #include "expression.h"
131 #include "parser-defs.h"
132 #include "language.h"
134 #include "bfd.h" /* Required by objfiles.h. */
135 #include "symfile.h" /* Required by objfiles.h. */
136 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
139 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
140 as well as gratuitiously global symbol names, so we can have multiple
141 yacc generated parsers in gdb. Note that these are only the variables
142 produced by yacc. If other parser generators (bison, byacc, etc) produce
143 additional global names that conflict at link time, then those parser
144 generators need to be fixed instead of adding those names to this list. */
146 #define yymaxdepth java_maxdepth
147 #define yyparse java_parse
148 #define yylex java_lex
149 #define yyerror java_error
150 #define yylval java_lval
151 #define yychar java_char
152 #define yydebug java_debug
153 #define yypact java_pact
156 #define yydef java_def
157 #define yychk java_chk
158 #define yypgo java_pgo
159 #define yyact java_act
160 #define yyexca java_exca
161 #define yyerrflag java_errflag
162 #define yynerrs java_nerrs
166 #define yy_yys java_yys
167 #define yystate java_state
168 #define yytmp java_tmp
170 #define yy_yyv java_yyv
171 #define yyval java_val
172 #define yylloc java_lloc
173 #define yyreds java_reds /* With YYDEBUG defined */
174 #define yytoks java_toks /* With YYDEBUG defined */
175 #define yyname java_name /* With YYDEBUG defined */
176 #define yyrule java_rule /* With YYDEBUG defined */
177 #define yylhs java_yylhs
178 #define yylen java_yylen
179 #define yydefred java_yydefred
180 #define yydgoto java_yydgoto
181 #define yysindex java_yysindex
182 #define yyrindex java_yyrindex
183 #define yygindex java_yygindex
184 #define yytable java_yytable
185 #define yycheck java_yycheck
188 #define YYDEBUG 1 /* Default to yydebug support */
191 #define YYFPRINTF parser_fprintf
195 static int yylex (void);
197 void yyerror (char *);
199 static struct type *java_type_from_name (struct stoken);
200 static void push_expression_name (struct stoken);
201 static void push_fieldnames (struct stoken);
203 static struct expression *copy_exp (struct expression *, int);
204 static void insert_exp (int, struct expression *);
208 /* Enabling traces. */
213 /* Enabling verbose error messages. */
214 #ifdef YYERROR_VERBOSE
215 # undef YYERROR_VERBOSE
216 # define YYERROR_VERBOSE 1
218 # define YYERROR_VERBOSE 0
221 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
223 typedef union YYSTYPE {
237 struct symtoken ssym;
239 enum exp_opcode opcode;
240 struct internalvar *ivar;
243 /* Line 191 of yacc.c. */
244 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
245 # define YYSTYPE_IS_DECLARED 1
246 # define YYSTYPE_IS_TRIVIAL 1
251 /* Copy the second part of user declarations. */
254 /* YYSTYPE gets defined by %union */
255 static int parse_number (char *, int, int, YYSTYPE *);
258 /* Line 214 of yacc.c. */
260 #if ! defined (yyoverflow) || YYERROR_VERBOSE
262 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
264 # if YYSTACK_USE_ALLOCA
265 # define YYSTACK_ALLOC alloca
267 # ifndef YYSTACK_USE_ALLOCA
268 # if defined (alloca) || defined (_ALLOCA_H)
269 # define YYSTACK_ALLOC alloca
272 # define YYSTACK_ALLOC __builtin_alloca
278 # ifdef YYSTACK_ALLOC
279 /* Pacify GCC's `empty if-body' warning. */
280 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
282 # if defined (__STDC__) || defined (__cplusplus)
283 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284 # define YYSIZE_T size_t
286 # define YYSTACK_ALLOC xmalloc
287 # define YYSTACK_FREE free
289 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
292 #if (! defined (yyoverflow) \
293 && (! defined (__cplusplus) \
294 || (YYSTYPE_IS_TRIVIAL)))
296 /* A type that is properly aligned for any stack member. */
303 /* The size of the maximum gap between one aligned stack and the next. */
304 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
306 /* The size of an array large to enough to hold all stacks, each with
308 # define YYSTACK_BYTES(N) \
309 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
310 + YYSTACK_GAP_MAXIMUM)
312 /* Copy COUNT objects from FROM to TO. The source and destination do
316 # define YYCOPY(To, From, Count) \
317 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
319 # define YYCOPY(To, From, Count) \
322 register YYSIZE_T yyi; \
323 for (yyi = 0; yyi < (Count); yyi++) \
324 (To)[yyi] = (From)[yyi]; \
330 /* Relocate STACK from its old location to the new one. The
331 local variables YYSIZE and YYSTACKSIZE give the old and new number of
332 elements in the stack, and YYPTR gives the new location of the
333 stack. Advance YYPTR to a properly aligned location for the next
335 # define YYSTACK_RELOCATE(Stack) \
338 YYSIZE_T yynewbytes; \
339 YYCOPY (&yyptr->Stack, Stack, yysize); \
340 Stack = &yyptr->Stack; \
341 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
342 yyptr += yynewbytes / sizeof (*yyptr); \
348 #if defined (__STDC__) || defined (__cplusplus)
349 typedef signed char yysigned_char;
351 typedef short yysigned_char;
354 /* YYFINAL -- State number of the termination state. */
356 /* YYLAST -- Last index in YYTABLE. */
359 /* YYNTOKENS -- Number of terminals. */
361 /* YYNNTS -- Number of nonterminals. */
363 /* YYNRULES -- Number of rules. */
365 /* YYNRULES -- Number of states. */
366 #define YYNSTATES 207
368 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
370 #define YYMAXUTOK 287
372 #define YYTRANSLATE(YYX) \
373 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
375 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
376 static const unsigned char yytranslate[] =
378 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 54, 2, 2, 2, 43, 30, 2,
382 48, 49, 41, 39, 23, 40, 46, 42, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 55, 2,
384 33, 24, 34, 25, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 47, 2, 52, 29, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 50, 28, 51, 53, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
404 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
405 15, 16, 17, 18, 19, 20, 21, 22, 26, 27,
406 31, 32, 35, 36, 37, 38, 44, 45
410 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
412 static const unsigned short yyprhs[] =
414 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
415 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
416 39, 41, 43, 45, 47, 49, 51, 54, 57, 59,
417 61, 63, 65, 67, 69, 73, 75, 79, 81, 83,
418 85, 89, 91, 93, 95, 97, 101, 103, 105, 111,
419 113, 117, 118, 120, 125, 130, 132, 135, 139, 142,
420 146, 148, 149, 153, 157, 162, 169, 176, 181, 186,
421 191, 193, 195, 197, 199, 201, 204, 207, 209, 211,
422 214, 217, 220, 222, 225, 228, 230, 233, 236, 238,
423 244, 249, 255, 257, 261, 265, 269, 271, 275, 279,
424 281, 285, 289, 291, 295, 299, 303, 307, 309, 313,
425 317, 319, 323, 325, 329, 331, 335, 337, 341, 343,
426 347, 349, 355, 357, 359, 363, 367, 369, 371, 373,
430 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
431 static const yysigned_char yyrhs[] =
433 57, 0, -1, 73, -1, 58, -1, 59, -1, 62,
434 -1, 68, -1, 6, -1, 3, -1, 9, -1, 4,
435 -1, 7, -1, 60, -1, 63, -1, 16, -1, 64,
436 -1, 65, -1, 13, -1, 12, -1, 14, -1, 11,
437 -1, 15, -1, 18, -1, 17, -1, 69, -1, 66,
438 -1, 62, 84, -1, 69, 84, -1, 5, -1, 72,
439 -1, 71, -1, 72, -1, 5, -1, 9, -1, 69,
440 46, 71, -1, 111, -1, 73, 23, 111, -1, 75,
441 -1, 81, -1, 61, -1, 48, 111, 49, -1, 78,
442 -1, 86, -1, 87, -1, 88, -1, 76, 79, 77,
443 -1, 50, -1, 51, -1, 22, 67, 48, 80, 49,
444 -1, 111, -1, 79, 23, 111, -1, -1, 79, -1,
445 22, 62, 82, 85, -1, 22, 66, 82, 85, -1,
446 83, -1, 82, 83, -1, 47, 111, 52, -1, 47,
447 52, -1, 84, 47, 52, -1, 84, -1, -1, 74,
448 46, 71, -1, 19, 46, 71, -1, 69, 48, 80,
449 49, -1, 74, 46, 71, 48, 80, 49, -1, 21,
450 46, 71, 48, 80, 49, -1, 69, 47, 111, 52,
451 -1, 19, 47, 111, 52, -1, 75, 47, 111, 52,
452 -1, 74, -1, 69, -1, 19, -1, 90, -1, 91,
453 -1, 89, 45, -1, 89, 44, -1, 93, -1, 94,
454 -1, 39, 92, -1, 40, 92, -1, 41, 92, -1,
455 95, -1, 45, 92, -1, 44, 92, -1, 89, -1,
456 53, 92, -1, 54, 92, -1, 96, -1, 48, 62,
457 85, 49, 92, -1, 48, 111, 49, 95, -1, 48,
458 69, 84, 49, 95, -1, 92, -1, 97, 41, 92,
459 -1, 97, 42, 92, -1, 97, 43, 92, -1, 97,
460 -1, 98, 39, 97, -1, 98, 40, 97, -1, 98,
461 -1, 99, 38, 98, -1, 99, 37, 98, -1, 99,
462 -1, 100, 33, 99, -1, 100, 34, 99, -1, 100,
463 36, 99, -1, 100, 35, 99, -1, 100, -1, 101,
464 32, 100, -1, 101, 31, 100, -1, 101, -1, 102,
465 30, 101, -1, 102, -1, 103, 29, 102, -1, 103,
466 -1, 104, 28, 103, -1, 104, -1, 105, 27, 104,
467 -1, 105, -1, 106, 26, 105, -1, 106, -1, 106,
468 25, 111, 55, 107, -1, 107, -1, 109, -1, 110,
469 24, 107, -1, 110, 20, 107, -1, 70, -1, 19,
470 -1, 86, -1, 88, -1, 108, -1
473 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
474 static const unsigned short yyrline[] =
476 0, 204, 204, 205, 208, 217, 218, 222, 231, 236,
477 244, 249, 254, 265, 266, 271, 272, 276, 278, 280,
478 282, 284, 289, 291, 303, 308, 312, 314, 319, 320,
479 324, 325, 329, 330, 334, 357, 358, 363, 364, 368,
480 369, 370, 371, 372, 373, 374, 382, 387, 392, 398,
481 400, 406, 407, 411, 414, 420, 421, 425, 429, 431,
482 436, 438, 442, 444, 450, 452, 454, 459, 476, 478,
483 483, 484, 486, 488, 489, 493, 498, 503, 504, 505,
484 506, 508, 510, 514, 519, 524, 525, 527, 529, 533,
485 537, 558, 566, 567, 569, 571, 576, 577, 579, 584,
486 585, 587, 593, 594, 596, 598, 600, 606, 607, 609,
487 614, 615, 620, 621, 625, 626, 631, 632, 637, 638,
488 643, 644, 649, 650, 654, 656, 663, 665, 667, 668,
493 #if YYDEBUG || YYERROR_VERBOSE
494 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
495 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
496 static const char *const yytname[] =
498 "$end", "error", "$undefined", "INTEGER_LITERAL",
499 "FLOATING_POINT_LITERAL", "IDENTIFIER", "STRING_LITERAL",
500 "BOOLEAN_LITERAL", "TYPENAME", "NAME_OR_INT", "ERROR", "LONG", "SHORT",
501 "BYTE", "INT", "CHAR", "BOOLEAN", "DOUBLE", "FLOAT", "VARIABLE",
502 "ASSIGN_MODIFY", "SUPER", "NEW", "','", "'='", "'?'", "OROR", "ANDAND",
503 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ",
504 "RSH", "LSH", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT",
505 "INCREMENT", "'.'", "'['", "'('", "')'", "'{'", "'}'", "']'", "'~'",
506 "'!'", "':'", "$accept", "start", "type_exp", "PrimitiveOrArrayType",
507 "StringLiteral", "Literal", "PrimitiveType", "NumericType",
508 "IntegralType", "FloatingPointType", "ClassOrInterfaceType",
509 "ClassType", "ArrayType", "Name", "ForcedName", "SimpleName",
510 "QualifiedName", "exp1", "Primary", "PrimaryNoNewArray", "lcurly",
511 "rcurly", "ClassInstanceCreationExpression", "ArgumentList",
512 "ArgumentList_opt", "ArrayCreationExpression", "DimExprs", "DimExpr",
513 "Dims", "Dims_opt", "FieldAccess", "MethodInvocation", "ArrayAccess",
514 "PostfixExpression", "PostIncrementExpression",
515 "PostDecrementExpression", "UnaryExpression", "PreIncrementExpression",
516 "PreDecrementExpression", "UnaryExpressionNotPlusMinus",
517 "CastExpression", "MultiplicativeExpression", "AdditiveExpression",
518 "ShiftExpression", "RelationalExpression", "EqualityExpression",
519 "AndExpression", "ExclusiveOrExpression", "InclusiveOrExpression",
520 "ConditionalAndExpression", "ConditionalOrExpression",
521 "ConditionalExpression", "AssignmentExpression", "Assignment",
522 "LeftHandSide", "Expression", 0
527 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
529 static const unsigned short yytoknum[] =
531 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
532 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
533 275, 276, 277, 44, 61, 63, 278, 279, 124, 94,
534 38, 280, 281, 60, 62, 282, 283, 284, 285, 43,
535 45, 42, 47, 37, 286, 287, 46, 91, 40, 41,
536 123, 125, 93, 126, 33, 58
540 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
541 static const unsigned char yyr1[] =
543 0, 56, 57, 57, 58, 59, 59, 60, 61, 61,
544 61, 61, 61, 62, 62, 63, 63, 64, 64, 64,
545 64, 64, 65, 65, 66, 67, 68, 68, 69, 69,
546 70, 70, 71, 71, 72, 73, 73, 74, 74, 75,
547 75, 75, 75, 75, 75, 75, 76, 77, 78, 79,
548 79, 80, 80, 81, 81, 82, 82, 83, 84, 84,
549 85, 85, 86, 86, 87, 87, 87, 88, 88, 88,
550 89, 89, 89, 89, 89, 90, 91, 92, 92, 92,
551 92, 92, 92, 93, 94, 95, 95, 95, 95, 96,
552 96, 96, 97, 97, 97, 97, 98, 98, 98, 99,
553 99, 99, 100, 100, 100, 100, 100, 101, 101, 101,
554 102, 102, 103, 103, 104, 104, 105, 105, 106, 106,
555 107, 107, 108, 108, 109, 109, 110, 110, 110, 110,
559 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
560 static const unsigned char yyr2[] =
562 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
563 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
564 1, 1, 1, 1, 1, 1, 2, 2, 1, 1,
565 1, 1, 1, 1, 3, 1, 3, 1, 1, 1,
566 3, 1, 1, 1, 1, 3, 1, 1, 5, 1,
567 3, 0, 1, 4, 4, 1, 2, 3, 2, 3,
568 1, 0, 3, 3, 4, 6, 6, 4, 4, 4,
569 1, 1, 1, 1, 1, 2, 2, 1, 1, 2,
570 2, 2, 1, 2, 2, 1, 2, 2, 1, 5,
571 4, 5, 1, 3, 3, 3, 1, 3, 3, 1,
572 3, 3, 1, 3, 3, 3, 3, 1, 3, 3,
573 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
574 1, 5, 1, 1, 3, 3, 1, 1, 1, 1,
578 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
579 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
580 means the default is an error. */
581 static const unsigned char yydefact[] =
583 0, 8, 10, 28, 7, 11, 9, 20, 18, 17,
584 19, 21, 14, 23, 22, 72, 0, 0, 0, 0,
585 0, 0, 0, 0, 46, 0, 0, 0, 3, 4,
586 12, 39, 5, 13, 15, 16, 6, 71, 126, 30,
587 29, 2, 70, 37, 0, 41, 38, 42, 43, 44,
588 85, 73, 74, 92, 77, 78, 82, 88, 96, 99,
589 102, 107, 110, 112, 114, 116, 118, 120, 122, 130,
590 123, 0, 35, 0, 0, 0, 28, 0, 25, 0,
591 24, 29, 9, 72, 71, 42, 44, 79, 80, 81,
592 84, 83, 61, 71, 0, 86, 87, 1, 0, 26,
593 0, 0, 51, 27, 0, 0, 0, 0, 49, 76,
594 75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
596 0, 0, 32, 33, 63, 0, 0, 0, 61, 55,
597 61, 51, 0, 60, 0, 0, 40, 58, 0, 34,
598 0, 52, 0, 36, 62, 0, 0, 47, 45, 93,
599 94, 95, 97, 98, 101, 100, 103, 104, 106, 105,
600 109, 108, 111, 113, 115, 117, 0, 119, 125, 124,
601 68, 51, 0, 0, 56, 53, 54, 0, 0, 0,
602 90, 59, 67, 64, 51, 69, 50, 0, 0, 57,
603 48, 89, 91, 0, 121, 66, 65
606 /* YYDEFGOTO[NTERM-NUM]. */
607 static const short yydefgoto[] =
609 -1, 27, 28, 29, 30, 31, 32, 33, 34, 35,
610 78, 79, 36, 84, 38, 39, 81, 41, 42, 43,
611 44, 158, 45, 151, 152, 46, 138, 139, 143, 144,
612 85, 48, 86, 50, 51, 52, 53, 54, 55, 56,
613 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
614 67, 68, 69, 70, 71, 108
617 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
619 #define YYPACT_NINF -135
620 static const short yypact[] =
622 204, -135, -135, 8, -135, -135, 14, -135, -135, -135,
623 -135, -135, -135, -135, -135, -4, 5, 50, 308, 308,
624 308, 308, 308, 204, -135, 308, 308, 40, -135, -135,
625 -135, -135, -1, -135, -135, -135, -135, 37, -135, -135,
626 28, 36, 45, 46, 360, -135, -135, 33, -135, 49,
627 -19, -135, -135, -135, -135, -135, -135, -135, 84, 31,
628 95, 54, 89, 75, 74, 81, 88, 110, -135, -135,
629 -135, 52, -135, 73, 360, 73, -135, 64, 64, 69,
630 77, -135, -135, 92, 83, -135, -135, -135, -135, -135,
631 -135, -135, -1, 37, 103, -135, -135, -135, 107, 114,
632 73, 256, 360, 114, 360, 73, 360, -6, -135, -135,
633 -135, 308, 308, 308, 308, 308, 308, 308, 308, 308,
634 308, 308, 308, 308, 308, 308, 308, 308, 360, 308,
635 308, 308, -135, -135, -135, 111, 116, 360, 118, -135,
636 118, 360, 360, 114, 117, -16, 367, -135, 115, -135,
637 120, 146, 121, -135, 125, 123, 360, -135, -135, -135,
638 -135, -135, 84, 84, 31, 31, 95, 95, 95, 95,
639 54, 54, 89, 75, 74, 81, 122, 88, -135, -135,
640 -135, 360, 124, 256, -135, -135, -135, 129, 308, 367,
641 -135, -135, -135, -135, 360, -135, -135, 308, 130, -135,
642 -135, -135, -135, 131, -135, -135, -135
645 /* YYPGOTO[NTERM-NUM]. */
646 static const short yypgoto[] =
648 -135, -135, -135, -135, -135, -135, 4, -135, -135, -135,
649 -135, -135, -135, 13, -135, -51, 0, -135, -135, -135,
650 -135, -135, -135, 138, -134, -135, 106, -101, -18, -59,
651 6, -135, 12, -135, -135, -135, -17, -135, -135, -131,
652 -135, 30, 34, -21, 35, 61, 63, 60, 65, 62,
653 -135, -120, -135, -135, -135, 18
656 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
657 positive, shift that token. If negative, reduce the rule which
658 number is the opposite. If zero, do what YYDEFACT says.
659 If YYTABLE_NINF, syntax error. */
660 #define YYTABLE_NINF -130
661 static const short yytable[] =
663 40, 87, 88, 89, 90, 91, 47, 187, 95, 96,
664 178, 179, 49, 37, 99, 190, -127, 156, 72, 103,
665 -127, 77, 134, 40, 136, 109, 110, 92, -32, 47,
666 80, 148, -32, 189, -33, 49, 93, 184, -33, 184,
667 97, 94, 73, 74, 40, 157, 98, 198, -31, 149,
668 47, 75, -31, -128, 154, 76, 49, -128, 202, 104,
669 203, 7, 8, 9, 10, 11, 12, 13, 14, -129,
670 114, 115, 130, -129, 40, 145, 131, 204, 132, 185,
671 47, 186, 133, 100, 101, 102, 49, 118, 119, 120,
672 121, 105, 135, 106, 159, 160, 161, 166, 167, 168,
673 169, 40, 40, 125, 40, 124, 40, 47, 47, 126,
674 47, 137, 47, 49, 49, 127, 49, 141, 49, 150,
675 122, 123, 153, 100, 155, 111, 112, 113, 40, 100,
676 142, 102, 116, 117, 47, 128, 129, 40, 73, 74,
677 49, 40, 40, 47, 162, 163, 176, 47, 47, 49,
678 164, 165, 146, 49, 49, 182, 40, 170, 171, 147,
679 150, 148, 47, 180, 181, 183, 188, 191, 49, 156,
680 193, 201, 192, 194, 196, 195, 199, 197, 200, 205,
681 206, 40, 107, 40, 140, 172, 174, 47, 173, 47,
682 0, 177, 175, 49, 40, 49, 0, 0, 0, 0,
683 47, 182, 0, 0, 0, 0, 49, 1, 2, 3,
684 4, 5, 0, 6, 0, 7, 8, 9, 10, 11,
685 12, 13, 14, 15, 0, 16, 17, 0, 0, 0,
686 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
687 0, 0, 0, 18, 19, 20, 0, 0, 21, 22,
688 0, 0, 23, 0, 24, 0, 0, 25, 26, 1,
689 2, 3, 4, 5, 0, 6, 0, 0, 0, 0,
690 0, 0, 0, 0, 0, 15, 0, 16, 17, 0,
691 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
692 0, 0, 0, 0, 0, 18, 19, 20, 0, 0,
693 21, 22, 0, 0, 23, 0, 24, 0, 147, 25,
694 26, 1, 2, 76, 4, 5, 0, 82, 0, 0,
695 0, 0, 0, 0, 0, 0, 0, 83, 0, 16,
696 17, 0, 0, 0, 0, 0, 0, 0, 0, 0,
697 0, 0, 0, 0, 0, 0, 0, 18, 19, 20,
698 0, 0, 21, 22, 0, 0, 23, 0, 24, 0,
699 0, 25, 26, 1, 2, 3, 4, 5, 0, 6,
700 1, 2, 76, 4, 5, 0, 82, 0, 0, 15,
701 0, 16, 17, 0, 0, 0, 83, 0, 16, 17,
702 0, 0, 0, 0, 0, 0, 0, 0, 0, 18,
703 19, 20, 0, 0, 21, 22, 0, 0, 23, 0,
704 24, 0, 0, 25, 26, 23, 0, 24, 0, 0,
708 static const short yycheck[] =
710 0, 18, 19, 20, 21, 22, 0, 141, 25, 26,
711 130, 131, 0, 0, 32, 146, 20, 23, 0, 37,
712 24, 17, 73, 23, 75, 44, 45, 23, 20, 23,
713 17, 47, 24, 49, 20, 23, 23, 138, 24, 140,
714 0, 23, 46, 47, 44, 51, 47, 181, 20, 100,
715 44, 46, 24, 20, 105, 5, 44, 24, 189, 23,
716 194, 11, 12, 13, 14, 15, 16, 17, 18, 20,
717 39, 40, 20, 24, 74, 93, 24, 197, 5, 138,
718 74, 140, 9, 46, 47, 48, 74, 33, 34, 35,
719 36, 46, 74, 47, 111, 112, 113, 118, 119, 120,
720 121, 101, 102, 29, 104, 30, 106, 101, 102, 28,
721 104, 47, 106, 101, 102, 27, 104, 48, 106, 101,
722 31, 32, 104, 46, 106, 41, 42, 43, 128, 46,
723 47, 48, 37, 38, 128, 25, 26, 137, 46, 47,
724 128, 141, 142, 137, 114, 115, 128, 141, 142, 137,
725 116, 117, 49, 141, 142, 137, 156, 122, 123, 52,
726 142, 47, 156, 52, 48, 47, 49, 52, 156, 23,
727 49, 188, 52, 48, 156, 52, 52, 55, 49, 49,
728 49, 181, 44, 183, 78, 124, 126, 181, 125, 183,
729 -1, 129, 127, 181, 194, 183, -1, -1, -1, -1,
730 194, 183, -1, -1, -1, -1, 194, 3, 4, 5,
731 6, 7, -1, 9, -1, 11, 12, 13, 14, 15,
732 16, 17, 18, 19, -1, 21, 22, -1, -1, -1,
733 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
734 -1, -1, -1, 39, 40, 41, -1, -1, 44, 45,
735 -1, -1, 48, -1, 50, -1, -1, 53, 54, 3,
736 4, 5, 6, 7, -1, 9, -1, -1, -1, -1,
737 -1, -1, -1, -1, -1, 19, -1, 21, 22, -1,
738 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
739 -1, -1, -1, -1, -1, 39, 40, 41, -1, -1,
740 44, 45, -1, -1, 48, -1, 50, -1, 52, 53,
741 54, 3, 4, 5, 6, 7, -1, 9, -1, -1,
742 -1, -1, -1, -1, -1, -1, -1, 19, -1, 21,
743 22, -1, -1, -1, -1, -1, -1, -1, -1, -1,
744 -1, -1, -1, -1, -1, -1, -1, 39, 40, 41,
745 -1, -1, 44, 45, -1, -1, 48, -1, 50, -1,
746 -1, 53, 54, 3, 4, 5, 6, 7, -1, 9,
747 3, 4, 5, 6, 7, -1, 9, -1, -1, 19,
748 -1, 21, 22, -1, -1, -1, 19, -1, 21, 22,
749 -1, -1, -1, -1, -1, -1, -1, -1, -1, 39,
750 40, 41, -1, -1, 44, 45, -1, -1, 48, -1,
751 50, -1, -1, 53, 54, 48, -1, 50, -1, -1,
755 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
756 symbol of state STATE-NUM. */
757 static const unsigned char yystos[] =
759 0, 3, 4, 5, 6, 7, 9, 11, 12, 13,
760 14, 15, 16, 17, 18, 19, 21, 22, 39, 40,
761 41, 44, 45, 48, 50, 53, 54, 57, 58, 59,
762 60, 61, 62, 63, 64, 65, 68, 69, 70, 71,
763 72, 73, 74, 75, 76, 78, 81, 86, 87, 88,
764 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
765 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
766 109, 110, 111, 46, 47, 46, 5, 62, 66, 67,
767 69, 72, 9, 19, 69, 86, 88, 92, 92, 92,
768 92, 92, 62, 69, 111, 92, 92, 0, 47, 84,
769 46, 47, 48, 84, 23, 46, 47, 79, 111, 44,
770 45, 41, 42, 43, 39, 40, 37, 38, 33, 34,
771 35, 36, 31, 32, 30, 29, 28, 27, 25, 26,
772 20, 24, 5, 9, 71, 111, 71, 47, 82, 83,
773 82, 48, 47, 84, 85, 84, 49, 52, 47, 71,
774 111, 79, 80, 111, 71, 111, 23, 51, 77, 92,
775 92, 92, 97, 97, 98, 98, 99, 99, 99, 99,
776 100, 100, 101, 102, 103, 104, 111, 105, 107, 107,
777 52, 48, 111, 47, 83, 85, 85, 80, 49, 49,
778 95, 52, 52, 49, 48, 52, 111, 55, 80, 52,
779 49, 92, 95, 80, 107, 49, 49
782 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
783 # define YYSIZE_T __SIZE_TYPE__
785 #if ! defined (YYSIZE_T) && defined (size_t)
786 # define YYSIZE_T size_t
788 #if ! defined (YYSIZE_T)
789 # if defined (__STDC__) || defined (__cplusplus)
790 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
791 # define YYSIZE_T size_t
794 #if ! defined (YYSIZE_T)
795 # define YYSIZE_T unsigned int
798 #define yyerrok (yyerrstatus = 0)
799 #define yyclearin (yychar = YYEMPTY)
803 #define YYACCEPT goto yyacceptlab
804 #define YYABORT goto yyabortlab
805 #define YYERROR goto yyerrlab1
807 /* Like YYERROR except do call yyerror. This remains here temporarily
808 to ease the transition to the new meaning of YYERROR, for GCC.
809 Once GCC version 2 has supplanted version 1, this can go. */
811 #define YYFAIL goto yyerrlab
813 #define YYRECOVERING() (!!yyerrstatus)
815 #define YYBACKUP(Token, Value) \
817 if (yychar == YYEMPTY && yylen == 1) \
821 yytoken = YYTRANSLATE (yychar); \
827 yyerror ("syntax error: cannot back up");\
833 #define YYERRCODE 256
835 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
838 #ifndef YYLLOC_DEFAULT
839 # define YYLLOC_DEFAULT(Current, Rhs, N) \
840 Current.first_line = Rhs[1].first_line; \
841 Current.first_column = Rhs[1].first_column; \
842 Current.last_line = Rhs[N].last_line; \
843 Current.last_column = Rhs[N].last_column;
846 /* YYLEX -- calling `yylex' with the right arguments. */
849 # define YYLEX yylex (YYLEX_PARAM)
851 # define YYLEX yylex ()
854 /* Enable debugging if requested. */
858 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
859 # define YYFPRINTF fprintf
862 # define YYDPRINTF(Args) \
868 # define YYDSYMPRINT(Args) \
874 # define YYDSYMPRINTF(Title, Token, Value, Location) \
878 YYFPRINTF (stderr, "%s ", Title); \
879 yysymprint (stderr, \
881 YYFPRINTF (stderr, "\n"); \
885 /*------------------------------------------------------------------.
886 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
888 `------------------------------------------------------------------*/
890 #if defined (__STDC__) || defined (__cplusplus)
892 yy_stack_print (short *bottom, short *top)
895 yy_stack_print (bottom, top)
900 YYFPRINTF (stderr, "Stack now");
901 for (/* Nothing. */; bottom <= top; ++bottom)
902 YYFPRINTF (stderr, " %d", *bottom);
903 YYFPRINTF (stderr, "\n");
906 # define YY_STACK_PRINT(Bottom, Top) \
909 yy_stack_print ((Bottom), (Top)); \
913 /*------------------------------------------------.
914 | Report that the YYRULE is going to be reduced. |
915 `------------------------------------------------*/
917 #if defined (__STDC__) || defined (__cplusplus)
919 yy_reduce_print (int yyrule)
922 yy_reduce_print (yyrule)
927 unsigned int yylineno = yyrline[yyrule];
928 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
929 yyrule - 1, yylineno);
930 /* Print the symbols being reduced, and their result. */
931 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
932 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
933 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
936 # define YY_REDUCE_PRINT(Rule) \
939 yy_reduce_print (Rule); \
942 /* Nonzero means print parse trace. It is left uninitialized so that
943 multiple parsers can coexist. */
946 # define YYDPRINTF(Args)
947 # define YYDSYMPRINT(Args)
948 # define YYDSYMPRINTF(Title, Token, Value, Location)
949 # define YY_STACK_PRINT(Bottom, Top)
950 # define YY_REDUCE_PRINT(Rule)
951 #endif /* !YYDEBUG */
954 /* YYINITDEPTH -- initial size of the parser's stacks. */
956 # define YYINITDEPTH 200
959 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
960 if the built-in stack extension method is used).
962 Do not make this value too large; the results are undefined if
963 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
964 evaluated with infinite-precision integer arithmetic. */
971 # define YYMAXDEPTH 10000
979 # if defined (__GLIBC__) && defined (_STRING_H)
980 # define yystrlen strlen
982 /* Return the length of YYSTR. */
984 # if defined (__STDC__) || defined (__cplusplus)
985 yystrlen (const char *yystr)
991 register const char *yys = yystr;
993 while (*yys++ != '\0')
996 return yys - yystr - 1;
1002 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1003 # define yystpcpy stpcpy
1005 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1008 # if defined (__STDC__) || defined (__cplusplus)
1009 yystpcpy (char *yydest, const char *yysrc)
1011 yystpcpy (yydest, yysrc)
1016 register char *yyd = yydest;
1017 register const char *yys = yysrc;
1019 while ((*yyd++ = *yys++) != '\0')
1027 #endif /* !YYERROR_VERBOSE */
1032 /*--------------------------------.
1033 | Print this symbol on YYOUTPUT. |
1034 `--------------------------------*/
1036 #if defined (__STDC__) || defined (__cplusplus)
1038 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1041 yysymprint (yyoutput, yytype, yyvaluep)
1047 /* Pacify ``unused variable'' warnings. */
1050 if (yytype < YYNTOKENS)
1052 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1054 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1058 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1065 YYFPRINTF (yyoutput, ")");
1068 #endif /* ! YYDEBUG */
1069 /*-----------------------------------------------.
1070 | Release the memory associated to this symbol. |
1071 `-----------------------------------------------*/
1073 #if defined (__STDC__) || defined (__cplusplus)
1075 yydestruct (int yytype, YYSTYPE *yyvaluep)
1078 yydestruct (yytype, yyvaluep)
1083 /* Pacify ``unused variable'' warnings. */
1095 /* Prevent warnings from -Wmissing-prototypes. */
1097 #ifdef YYPARSE_PARAM
1098 # if defined (__STDC__) || defined (__cplusplus)
1099 int yyparse (void *YYPARSE_PARAM);
1103 #else /* ! YYPARSE_PARAM */
1104 #if defined (__STDC__) || defined (__cplusplus)
1109 #endif /* ! YYPARSE_PARAM */
1113 /* The lookahead symbol. */
1116 /* The semantic value of the lookahead symbol. */
1119 /* Number of syntax errors so far. */
1128 #ifdef YYPARSE_PARAM
1129 # if defined (__STDC__) || defined (__cplusplus)
1130 int yyparse (void *YYPARSE_PARAM)
1132 int yyparse (YYPARSE_PARAM)
1133 void *YYPARSE_PARAM;
1135 #else /* ! YYPARSE_PARAM */
1136 #if defined (__STDC__) || defined (__cplusplus)
1147 register int yystate;
1150 /* Number of tokens to shift before error messages enabled. */
1152 /* Lookahead token as an internal (translated) token number. */
1155 /* Three stacks and their tools:
1156 `yyss': related to states,
1157 `yyvs': related to semantic values,
1158 `yyls': related to locations.
1160 Refer to the stacks thru separate pointers, to allow yyoverflow
1161 to xreallocate them elsewhere. */
1163 /* The state stack. */
1164 short yyssa[YYINITDEPTH];
1165 short *yyss = yyssa;
1166 register short *yyssp;
1168 /* The semantic value stack. */
1169 YYSTYPE yyvsa[YYINITDEPTH];
1170 YYSTYPE *yyvs = yyvsa;
1171 register YYSTYPE *yyvsp;
1175 #define YYPOPSTACK (yyvsp--, yyssp--)
1177 YYSIZE_T yystacksize = YYINITDEPTH;
1179 /* The variables used to return semantic value and location from the
1184 /* When reducing, the number of symbols on the RHS of the reduced
1188 YYDPRINTF ((stderr, "Starting parse\n"));
1193 yychar = YYEMPTY; /* Cause a token to be read. */
1195 /* Initialize stack pointers.
1196 Waste one element of value and location stack
1197 so that they stay on the same level as the state stack.
1198 The wasted elements are never initialized. */
1205 /*------------------------------------------------------------.
1206 | yynewstate -- Push a new state, which is found in yystate. |
1207 `------------------------------------------------------------*/
1209 /* In all cases, when you get here, the value and location stacks
1210 have just been pushed. so pushing a state here evens the stacks.
1217 if (yyss + yystacksize - 1 <= yyssp)
1219 /* Get the current used size of the three stacks, in elements. */
1220 YYSIZE_T yysize = yyssp - yyss + 1;
1224 /* Give user a chance to xreallocate the stack. Use copies of
1225 these so that the &'s don't force the real ones into
1227 YYSTYPE *yyvs1 = yyvs;
1228 short *yyss1 = yyss;
1231 /* Each stack pointer address is followed by the size of the
1232 data in use in that stack, in bytes. This used to be a
1233 conditional around just the two extra args, but that might
1234 be undefined if yyoverflow is a macro. */
1235 yyoverflow ("parser stack overflow",
1236 &yyss1, yysize * sizeof (*yyssp),
1237 &yyvs1, yysize * sizeof (*yyvsp),
1244 #else /* no yyoverflow */
1245 # ifndef YYSTACK_RELOCATE
1248 /* Extend the stack our own way. */
1249 if (YYMAXDEPTH <= yystacksize)
1252 if (YYMAXDEPTH < yystacksize)
1253 yystacksize = YYMAXDEPTH;
1256 short *yyss1 = yyss;
1257 union yyalloc *yyptr =
1258 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1261 YYSTACK_RELOCATE (yyss);
1262 YYSTACK_RELOCATE (yyvs);
1264 # undef YYSTACK_RELOCATE
1266 YYSTACK_FREE (yyss1);
1269 #endif /* no yyoverflow */
1271 yyssp = yyss + yysize - 1;
1272 yyvsp = yyvs + yysize - 1;
1275 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1276 (unsigned long int) yystacksize));
1278 if (yyss + yystacksize - 1 <= yyssp)
1282 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1291 /* Do appropriate processing given the current state. */
1292 /* Read a lookahead token if we need one and don't already have one. */
1295 /* First try to decide what to do without reference to lookahead token. */
1297 yyn = yypact[yystate];
1298 if (yyn == YYPACT_NINF)
1301 /* Not known => get a lookahead token if don't already have one. */
1303 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1304 if (yychar == YYEMPTY)
1306 YYDPRINTF ((stderr, "Reading a token: "));
1310 if (yychar <= YYEOF)
1312 yychar = yytoken = YYEOF;
1313 YYDPRINTF ((stderr, "Now at end of input.\n"));
1317 yytoken = YYTRANSLATE (yychar);
1318 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1321 /* If the proper action on seeing token YYTOKEN is to reduce or to
1322 detect an error, take that action. */
1324 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1329 if (yyn == 0 || yyn == YYTABLE_NINF)
1338 /* Shift the lookahead token. */
1339 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1341 /* Discard the token being shifted unless it is eof. */
1342 if (yychar != YYEOF)
1348 /* Count tokens shifted since error; after three, turn off error
1357 /*-----------------------------------------------------------.
1358 | yydefault -- do the default action for the current state. |
1359 `-----------------------------------------------------------*/
1361 yyn = yydefact[yystate];
1367 /*-----------------------------.
1368 | yyreduce -- Do a reduction. |
1369 `-----------------------------*/
1371 /* yyn is the number of a rule to reduce with. */
1374 /* If YYLEN is nonzero, implement the default value of the action:
1377 Otherwise, the following line sets YYVAL to garbage.
1378 This behavior is undocumented and Bison
1379 users should not rely upon it. Assigning to YYVAL
1380 unconditionally makes the parser a bit smaller, and it avoids a
1381 GCC warning that YYVAL may be used uninitialized. */
1382 yyval = yyvsp[1-yylen];
1385 YY_REDUCE_PRINT (yyn);
1389 #line 209 "jv-exp.y"
1391 write_exp_elt_opcode(OP_TYPE);
1392 write_exp_elt_type(yyvsp[0].tval);
1393 write_exp_elt_opcode(OP_TYPE);
1398 #line 223 "jv-exp.y"
1400 write_exp_elt_opcode (OP_STRING);
1401 write_exp_string (yyvsp[0].sval);
1402 write_exp_elt_opcode (OP_STRING);
1407 #line 232 "jv-exp.y"
1408 { write_exp_elt_opcode (OP_LONG);
1409 write_exp_elt_type (yyvsp[0].typed_val_int.type);
1410 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1411 write_exp_elt_opcode (OP_LONG); }
1415 #line 237 "jv-exp.y"
1417 parse_number (yyvsp[0].sval.ptr, yyvsp[0].sval.length, 0, &val);
1418 write_exp_elt_opcode (OP_LONG);
1419 write_exp_elt_type (val.typed_val_int.type);
1420 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1421 write_exp_elt_opcode (OP_LONG);
1426 #line 245 "jv-exp.y"
1427 { write_exp_elt_opcode (OP_DOUBLE);
1428 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1429 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1430 write_exp_elt_opcode (OP_DOUBLE); }
1434 #line 250 "jv-exp.y"
1435 { write_exp_elt_opcode (OP_LONG);
1436 write_exp_elt_type (java_boolean_type);
1437 write_exp_elt_longcst ((LONGEST)yyvsp[0].lval);
1438 write_exp_elt_opcode (OP_LONG); }
1442 #line 267 "jv-exp.y"
1443 { yyval.tval = java_boolean_type; }
1447 #line 277 "jv-exp.y"
1448 { yyval.tval = java_byte_type; }
1452 #line 279 "jv-exp.y"
1453 { yyval.tval = java_short_type; }
1457 #line 281 "jv-exp.y"
1458 { yyval.tval = java_int_type; }
1462 #line 283 "jv-exp.y"
1463 { yyval.tval = java_long_type; }
1467 #line 285 "jv-exp.y"
1468 { yyval.tval = java_char_type; }
1472 #line 290 "jv-exp.y"
1473 { yyval.tval = java_float_type; }
1477 #line 292 "jv-exp.y"
1478 { yyval.tval = java_double_type; }
1482 #line 304 "jv-exp.y"
1483 { yyval.tval = java_type_from_name (yyvsp[0].sval); }
1487 #line 313 "jv-exp.y"
1488 { yyval.tval = java_array_type (yyvsp[-1].tval, yyvsp[0].lval); }
1492 #line 315 "jv-exp.y"
1493 { yyval.tval = java_array_type (java_type_from_name (yyvsp[-1].sval), yyvsp[0].lval); }
1497 #line 335 "jv-exp.y"
1498 { yyval.sval.length = yyvsp[-2].sval.length + yyvsp[0].sval.length + 1;
1499 if (yyvsp[-2].sval.ptr + yyvsp[-2].sval.length + 1 == yyvsp[0].sval.ptr
1500 && yyvsp[-2].sval.ptr[yyvsp[-2].sval.length] == '.')
1501 yyval.sval.ptr = yyvsp[-2].sval.ptr; /* Optimization. */
1504 yyval.sval.ptr = (char *) xmalloc (yyval.sval.length + 1);
1505 make_cleanup (free, yyval.sval.ptr);
1506 sprintf (yyval.sval.ptr, "%.*s.%.*s",
1507 yyvsp[-2].sval.length, yyvsp[-2].sval.ptr, yyvsp[0].sval.length, yyvsp[0].sval.ptr);
1512 #line 359 "jv-exp.y"
1513 { write_exp_elt_opcode (BINOP_COMMA); }
1517 #line 375 "jv-exp.y"
1518 { write_exp_elt_opcode (OP_ARRAY);
1519 write_exp_elt_longcst ((LONGEST) 0);
1520 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1521 write_exp_elt_opcode (OP_ARRAY); }
1525 #line 383 "jv-exp.y"
1526 { start_arglist (); }
1530 #line 388 "jv-exp.y"
1531 { yyval.lval = end_arglist () - 1; }
1535 #line 393 "jv-exp.y"
1536 { internal_error (__FILE__, __LINE__,
1537 _("FIXME - ClassInstanceCreationExpression")); }
1541 #line 399 "jv-exp.y"
1542 { arglist_len = 1; }
1546 #line 401 "jv-exp.y"
1551 #line 406 "jv-exp.y"
1552 { arglist_len = 0; }
1556 #line 412 "jv-exp.y"
1557 { internal_error (__FILE__, __LINE__,
1558 _("FIXME - ArrayCreationExpression")); }
1562 #line 415 "jv-exp.y"
1563 { internal_error (__FILE__, __LINE__,
1564 _("FIXME - ArrayCreationExpression")); }
1568 #line 430 "jv-exp.y"
1573 #line 432 "jv-exp.y"
1574 { yyval.lval = yyvsp[-2].lval + 1; }
1578 #line 438 "jv-exp.y"
1583 #line 443 "jv-exp.y"
1584 { push_fieldnames (yyvsp[0].sval); }
1588 #line 445 "jv-exp.y"
1589 { push_fieldnames (yyvsp[0].sval); }
1593 #line 451 "jv-exp.y"
1594 { error (_("Method invocation not implemented")); }
1598 #line 453 "jv-exp.y"
1599 { error (_("Method invocation not implemented")); }
1603 #line 455 "jv-exp.y"
1604 { error (_("Method invocation not implemented")); }
1608 #line 460 "jv-exp.y"
1610 /* Emit code for the Name now, then exchange it in the
1611 expout array with the Expression's code. We could
1612 introduce a OP_SWAP code or a reversed version of
1613 BINOP_SUBSCRIPT, but that makes the rest of GDB pay
1614 for our parsing kludges. */
1615 struct expression *name_expr;
1617 push_expression_name (yyvsp[-3].sval);
1618 name_expr = copy_exp (expout, expout_ptr);
1619 expout_ptr -= name_expr->nelts;
1620 insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr),
1623 write_exp_elt_opcode (BINOP_SUBSCRIPT);
1628 #line 477 "jv-exp.y"
1629 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1633 #line 479 "jv-exp.y"
1634 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1638 #line 485 "jv-exp.y"
1639 { push_expression_name (yyvsp[0].sval); }
1643 #line 494 "jv-exp.y"
1644 { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1648 #line 499 "jv-exp.y"
1649 { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1653 #line 507 "jv-exp.y"
1654 { write_exp_elt_opcode (UNOP_NEG); }
1658 #line 509 "jv-exp.y"
1659 { write_exp_elt_opcode (UNOP_IND); }
1663 #line 515 "jv-exp.y"
1664 { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1668 #line 520 "jv-exp.y"
1669 { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1673 #line 526 "jv-exp.y"
1674 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1678 #line 528 "jv-exp.y"
1679 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1683 #line 534 "jv-exp.y"
1684 { write_exp_elt_opcode (UNOP_CAST);
1685 write_exp_elt_type (java_array_type (yyvsp[-3].tval, yyvsp[-2].lval));
1686 write_exp_elt_opcode (UNOP_CAST); }
1690 #line 538 "jv-exp.y"
1692 int exp_size = expout_ptr;
1693 int last_exp_size = length_of_subexp(expout, expout_ptr);
1696 int base = expout_ptr - last_exp_size - 3;
1697 if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
1698 error (_("Invalid cast expression"));
1699 type = expout->elts[base+1].type;
1700 /* Remove the 'Expression' and slide the
1701 UnaryExpressionNotPlusMinus down to replace it. */
1702 for (i = 0; i < last_exp_size; i++)
1703 expout->elts[base + i] = expout->elts[base + i + 3];
1705 if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
1706 type = lookup_pointer_type (type);
1707 write_exp_elt_opcode (UNOP_CAST);
1708 write_exp_elt_type (type);
1709 write_exp_elt_opcode (UNOP_CAST);
1714 #line 559 "jv-exp.y"
1715 { write_exp_elt_opcode (UNOP_CAST);
1716 write_exp_elt_type (java_array_type (java_type_from_name (yyvsp[-3].sval), yyvsp[-2].lval));
1717 write_exp_elt_opcode (UNOP_CAST); }
1721 #line 568 "jv-exp.y"
1722 { write_exp_elt_opcode (BINOP_MUL); }
1726 #line 570 "jv-exp.y"
1727 { write_exp_elt_opcode (BINOP_DIV); }
1731 #line 572 "jv-exp.y"
1732 { write_exp_elt_opcode (BINOP_REM); }
1736 #line 578 "jv-exp.y"
1737 { write_exp_elt_opcode (BINOP_ADD); }
1741 #line 580 "jv-exp.y"
1742 { write_exp_elt_opcode (BINOP_SUB); }
1746 #line 586 "jv-exp.y"
1747 { write_exp_elt_opcode (BINOP_LSH); }
1751 #line 588 "jv-exp.y"
1752 { write_exp_elt_opcode (BINOP_RSH); }
1756 #line 595 "jv-exp.y"
1757 { write_exp_elt_opcode (BINOP_LESS); }
1761 #line 597 "jv-exp.y"
1762 { write_exp_elt_opcode (BINOP_GTR); }
1766 #line 599 "jv-exp.y"
1767 { write_exp_elt_opcode (BINOP_LEQ); }
1771 #line 601 "jv-exp.y"
1772 { write_exp_elt_opcode (BINOP_GEQ); }
1776 #line 608 "jv-exp.y"
1777 { write_exp_elt_opcode (BINOP_EQUAL); }
1781 #line 610 "jv-exp.y"
1782 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1786 #line 616 "jv-exp.y"
1787 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1791 #line 622 "jv-exp.y"
1792 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1796 #line 627 "jv-exp.y"
1797 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1801 #line 633 "jv-exp.y"
1802 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1806 #line 639 "jv-exp.y"
1807 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1811 #line 645 "jv-exp.y"
1812 { write_exp_elt_opcode (TERNOP_COND); }
1816 #line 655 "jv-exp.y"
1817 { write_exp_elt_opcode (BINOP_ASSIGN); }
1821 #line 657 "jv-exp.y"
1822 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1823 write_exp_elt_opcode (yyvsp[-1].opcode);
1824 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1828 #line 664 "jv-exp.y"
1829 { push_expression_name (yyvsp[0].sval); }
1835 /* Line 991 of yacc.c. */
1841 YY_STACK_PRINT (yyss, yyssp);
1846 /* Now `shift' the result of the reduction. Determine what state
1847 that goes to, based on the state we popped back to and the rule
1848 number reduced by. */
1852 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1853 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1854 yystate = yytable[yystate];
1856 yystate = yydefgoto[yyn - YYNTOKENS];
1861 /*------------------------------------.
1862 | yyerrlab -- here on detecting error |
1863 `------------------------------------*/
1865 /* If not already recovering from an error, report this error. */
1870 yyn = yypact[yystate];
1872 if (YYPACT_NINF < yyn && yyn < YYLAST)
1874 YYSIZE_T yysize = 0;
1875 int yytype = YYTRANSLATE (yychar);
1880 /* Start YYX at -YYN if negative to avoid negative indexes in
1882 for (yyx = yyn < 0 ? -yyn : 0;
1883 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1884 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1885 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1886 yysize += yystrlen ("syntax error, unexpected ") + 1;
1887 yysize += yystrlen (yytname[yytype]);
1888 yymsg = (char *) YYSTACK_ALLOC (yysize);
1891 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1892 yyp = yystpcpy (yyp, yytname[yytype]);
1897 for (yyx = yyn < 0 ? -yyn : 0;
1898 yyx < (int) (sizeof (yytname) / sizeof (char *));
1900 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1902 const char *yyq = ! yycount ? ", expecting " : " or ";
1903 yyp = yystpcpy (yyp, yyq);
1904 yyp = yystpcpy (yyp, yytname[yyx]);
1909 YYSTACK_FREE (yymsg);
1912 yyerror ("syntax error; also virtual memory exhausted");
1915 #endif /* YYERROR_VERBOSE */
1916 yyerror ("syntax error");
1921 if (yyerrstatus == 3)
1923 /* If just tried and failed to reuse lookahead token after an
1924 error, discard it. */
1926 /* Return failure if at end of input. */
1927 if (yychar == YYEOF)
1929 /* Pop the error token. */
1931 /* Pop the rest of the stack. */
1932 while (yyss < yyssp)
1934 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1935 yydestruct (yystos[*yyssp], yyvsp);
1941 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1942 yydestruct (yytoken, &yylval);
1947 /* Else will try to reuse lookahead token after shifting the error
1952 /*----------------------------------------------------.
1953 | yyerrlab1 -- error raised explicitly by an action. |
1954 `----------------------------------------------------*/
1957 /* Suppress GCC warning that yyerrlab1 is unused when no action
1958 invokes YYERROR. MacOS 10.2.3's buggy "smart preprocessor"
1959 insists on the trailing semicolon. */
1960 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1961 __attribute__ ((__unused__));
1968 /*---------------------------------------------------------------.
1969 | yyerrlab2 -- pop states until the error token can be shifted. |
1970 `---------------------------------------------------------------*/
1972 yyerrstatus = 3; /* Each real token shifted decrements this. */
1976 yyn = yypact[yystate];
1977 if (yyn != YYPACT_NINF)
1980 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1988 /* Pop the current state because it cannot handle the error token. */
1992 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1993 yydestruct (yystos[yystate], yyvsp);
1997 YY_STACK_PRINT (yyss, yyssp);
2003 YYDPRINTF ((stderr, "Shifting error token, "));
2012 /*-------------------------------------.
2013 | yyacceptlab -- YYACCEPT comes here. |
2014 `-------------------------------------*/
2019 /*-----------------------------------.
2020 | yyabortlab -- YYABORT comes here. |
2021 `-----------------------------------*/
2027 /*----------------------------------------------.
2028 | yyoverflowlab -- parser overflow comes here. |
2029 `----------------------------------------------*/
2031 yyerror ("parser stack overflow");
2039 YYSTACK_FREE (yyss);
2045 #line 676 "jv-exp.y"
2047 /* Take care of parsing a number (anything that starts with a digit).
2048 Set yylval and return the token type; update lexptr.
2049 LEN is the number of characters in it. */
2051 /*** Needs some error checking for the float case ***/
2054 parse_number (p, len, parsed_float, putithere)
2061 ULONGEST limit, limit_div_base;
2064 int base = input_radix;
2070 /* It's a float since it contains a point or an exponent. */
2072 int num = 0; /* number of tokens scanned by scanf */
2073 char saved_char = p[len];
2075 p[len] = 0; /* null-terminate the token */
2076 if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
2077 num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval, &c);
2078 else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2079 num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c);
2082 #ifdef SCANF_HAS_LONG_DOUBLE
2083 num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c);
2085 /* Scan it into a double, then assign it to the long double.
2086 This at least wins with values representable in the range
2089 num = sscanf (p, "%lg%c", &temp, &c);
2090 putithere->typed_val_float.dval = temp;
2093 p[len] = saved_char; /* restore the input stream */
2094 if (num != 1) /* check scanf found ONLY a float ... */
2096 /* See if it has `f' or `d' suffix (float or double). */
2098 c = tolower (p[len - 1]);
2100 if (c == 'f' || c == 'F')
2101 putithere->typed_val_float.type = builtin_type_float;
2102 else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
2103 putithere->typed_val_float.type = builtin_type_double;
2107 return FLOATING_POINT_LITERAL;
2110 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2142 /* A paranoid calculation of (1<<64)-1. */
2143 limit = (ULONGEST)0xffffffff;
2144 limit = ((limit << 16) << 16) | limit;
2145 if (c == 'l' || c == 'L')
2147 type = java_long_type;
2152 type = java_int_type;
2154 limit_div_base = limit / (ULONGEST) base;
2159 if (c >= '0' && c <= '9')
2161 else if (c >= 'A' && c <= 'Z')
2163 else if (c >= 'a' && c <= 'z')
2166 return ERROR; /* Char not a digit */
2169 if (n > limit_div_base
2170 || (n *= base) > limit - c)
2171 error (_("Numeric constant too large"));
2175 /* If the type is bigger than a 32-bit signed integer can be, implicitly
2176 promote to long. Java does not do this, so mark it as builtin_type_uint64
2177 rather than java_long_type. 0x80000000 will become -0x80000000 instead
2178 of 0x80000000L, because we don't know the sign at this point.
2180 if (type == java_int_type && n > (ULONGEST)0x80000000)
2181 type = builtin_type_uint64;
2183 putithere->typed_val_int.val = n;
2184 putithere->typed_val_int.type = type;
2186 return INTEGER_LITERAL;
2193 enum exp_opcode opcode;
2196 static const struct token tokentab3[] =
2198 {">>=", ASSIGN_MODIFY, BINOP_RSH},
2199 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2202 static const struct token tokentab2[] =
2204 {"+=", ASSIGN_MODIFY, BINOP_ADD},
2205 {"-=", ASSIGN_MODIFY, BINOP_SUB},
2206 {"*=", ASSIGN_MODIFY, BINOP_MUL},
2207 {"/=", ASSIGN_MODIFY, BINOP_DIV},
2208 {"%=", ASSIGN_MODIFY, BINOP_REM},
2209 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2210 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2211 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2212 {"++", INCREMENT, BINOP_END},
2213 {"--", DECREMENT, BINOP_END},
2214 {"&&", ANDAND, BINOP_END},
2215 {"||", OROR, BINOP_END},
2216 {"<<", LSH, BINOP_END},
2217 {">>", RSH, BINOP_END},
2218 {"==", EQUAL, BINOP_END},
2219 {"!=", NOTEQUAL, BINOP_END},
2220 {"<=", LEQ, BINOP_END},
2221 {">=", GEQ, BINOP_END}
2224 /* Read one token, getting characters through lexptr. */
2235 static char *tempbuf;
2236 static int tempbufsize;
2240 prev_lexptr = lexptr;
2243 /* See if it is a special token of length 3. */
2244 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2245 if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2248 yylval.opcode = tokentab3[i].opcode;
2249 return tokentab3[i].token;
2252 /* See if it is a special token of length 2. */
2253 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2254 if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2257 yylval.opcode = tokentab2[i].opcode;
2258 return tokentab2[i].token;
2261 switch (c = *tokstart)
2273 /* We either have a character constant ('0' or '\177' for example)
2274 or we have a quoted symbol reference ('foo(int,int)' in C++
2279 c = parse_escape (&lexptr);
2281 error (_("Empty character constant"));
2283 yylval.typed_val_int.val = c;
2284 yylval.typed_val_int.type = java_char_type;
2289 namelen = skip_quoted (tokstart) - tokstart;
2292 lexptr = tokstart + namelen;
2293 if (lexptr[-1] != '\'')
2294 error (_("Unmatched single quote"));
2299 error (_("Invalid character constant"));
2301 return INTEGER_LITERAL;
2309 if (paren_depth == 0)
2316 if (comma_terminates && paren_depth == 0)
2322 /* Might be a floating point number. */
2323 if (lexptr[1] < '0' || lexptr[1] > '9')
2324 goto symbol; /* Nope, must be a symbol. */
2325 /* FALL THRU into number case. */
2338 /* It's a number. */
2339 int got_dot = 0, got_e = 0, toktype;
2341 int hex = input_radix > 10;
2343 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2348 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2356 /* This test includes !hex because 'e' is a valid hex digit
2357 and thus does not indicate a floating point number when
2358 the radix is hex. */
2359 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2360 got_dot = got_e = 1;
2361 /* This test does not include !hex, because a '.' always indicates
2362 a decimal floating point number regardless of the radix. */
2363 else if (!got_dot && *p == '.')
2365 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2366 && (*p == '-' || *p == '+'))
2367 /* This is the sign of the exponent, not the end of the
2370 /* We will take any letters or digits. parse_number will
2371 complain if past the radix, or if L or U are not final. */
2372 else if ((*p < '0' || *p > '9')
2373 && ((*p < 'a' || *p > 'z')
2374 && (*p < 'A' || *p > 'Z')))
2377 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2378 if (toktype == ERROR)
2380 char *err_copy = (char *) alloca (p - tokstart + 1);
2382 memcpy (err_copy, tokstart, p - tokstart);
2383 err_copy[p - tokstart] = 0;
2384 error (_("Invalid number \"%s\""), err_copy);
2415 /* Build the gdb internal form of the input string in tempbuf,
2416 translating any standard C escape forms seen. Note that the
2417 buffer is null byte terminated *only* for the convenience of
2418 debugging gdb itself and printing the buffer contents when
2419 the buffer contains no embedded nulls. Gdb does not depend
2420 upon the buffer being null byte terminated, it uses the length
2421 string instead. This allows gdb to handle C strings (as well
2422 as strings in other languages) with embedded null bytes */
2424 tokptr = ++tokstart;
2428 /* Grow the static temp buffer if necessary, including allocating
2429 the first one on demand. */
2430 if (tempbufindex + 1 >= tempbufsize)
2432 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2438 /* Do nothing, loop will terminate. */
2442 c = parse_escape (&tokptr);
2447 tempbuf[tempbufindex++] = c;
2450 tempbuf[tempbufindex++] = *tokptr++;
2453 } while ((*tokptr != '"') && (*tokptr != '\0'));
2454 if (*tokptr++ != '"')
2456 error (_("Unterminated string in expression"));
2458 tempbuf[tempbufindex] = '\0'; /* See note above */
2459 yylval.sval.ptr = tempbuf;
2460 yylval.sval.length = tempbufindex;
2462 return (STRING_LITERAL);
2465 if (!(c == '_' || c == '$'
2466 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2467 /* We must have come across a bad character (e.g. ';'). */
2468 error (_("Invalid character '%c' in expression"), c);
2470 /* It's a name. See how long it is. */
2472 for (c = tokstart[namelen];
2475 || (c >= '0' && c <= '9')
2476 || (c >= 'a' && c <= 'z')
2477 || (c >= 'A' && c <= 'Z')
2484 while (tokstart[++i] && tokstart[i] != '>');
2485 if (tokstart[i] == '>')
2488 c = tokstart[++namelen];
2491 /* The token "if" terminates the expression and is NOT
2492 removed from the input stream. */
2493 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2502 /* Catch specific keywords. Should be done with a data structure. */
2506 if (DEPRECATED_STREQN (tokstart, "boolean", 7))
2510 if (DEPRECATED_STREQN (tokstart, "double", 6))
2514 if (DEPRECATED_STREQN (tokstart, "short", 5))
2516 if (DEPRECATED_STREQN (tokstart, "false", 5))
2519 return BOOLEAN_LITERAL;
2521 if (DEPRECATED_STREQN (tokstart, "super", 5))
2523 if (DEPRECATED_STREQN (tokstart, "float", 5))
2527 if (DEPRECATED_STREQN (tokstart, "long", 4))
2529 if (DEPRECATED_STREQN (tokstart, "byte", 4))
2531 if (DEPRECATED_STREQN (tokstart, "char", 4))
2533 if (DEPRECATED_STREQN (tokstart, "true", 4))
2536 return BOOLEAN_LITERAL;
2540 if (strncmp (tokstart, "int", 3) == 0)
2542 if (strncmp (tokstart, "new", 3) == 0)
2549 yylval.sval.ptr = tokstart;
2550 yylval.sval.length = namelen;
2552 if (*tokstart == '$')
2554 write_dollar_variable (yylval.sval);
2558 /* Input names that aren't symbols but ARE valid hex numbers,
2559 when the input radix permits them, can be names or numbers
2560 depending on the parse. Note we support radixes > 16 here. */
2561 if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2562 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2564 YYSTYPE newlval; /* Its value is ignored. */
2565 int hextype = parse_number (tokstart, namelen, 0, &newlval);
2566 if (hextype == INTEGER_LITERAL)
2577 lexptr = prev_lexptr;
2580 error (_("%s: near `%s'"), msg, lexptr);
2582 error (_("error in expression, near `%s'"), lexptr);
2585 static struct type *
2586 java_type_from_name (name)
2590 char *tmp = copy_name (name);
2591 struct type *typ = java_lookup_class (tmp);
2592 if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
2593 error (_("No class named `%s'"), tmp);
2597 /* If NAME is a valid variable name in this scope, push it and return 1.
2598 Otherwise, return 0. */
2601 push_variable (struct stoken name)
2603 char *tmp = copy_name (name);
2604 int is_a_field_of_this = 0;
2606 sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
2607 &is_a_field_of_this, (struct symtab **) NULL);
2608 if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
2610 if (symbol_read_needs_frame (sym))
2612 if (innermost_block == 0 ||
2613 contained_in (block_found, innermost_block))
2614 innermost_block = block_found;
2617 write_exp_elt_opcode (OP_VAR_VALUE);
2618 /* We want to use the selected frame, not another more inner frame
2619 which happens to be in the same block. */
2620 write_exp_elt_block (NULL);
2621 write_exp_elt_sym (sym);
2622 write_exp_elt_opcode (OP_VAR_VALUE);
2625 if (is_a_field_of_this)
2627 /* it hangs off of `this'. Must not inadvertently convert from a
2628 method call to data ref. */
2629 if (innermost_block == 0 ||
2630 contained_in (block_found, innermost_block))
2631 innermost_block = block_found;
2632 write_exp_elt_opcode (OP_THIS);
2633 write_exp_elt_opcode (OP_THIS);
2634 write_exp_elt_opcode (STRUCTOP_PTR);
2635 write_exp_string (name);
2636 write_exp_elt_opcode (STRUCTOP_PTR);
2642 /* Assuming a reference expression has been pushed, emit the
2643 STRUCTOP_STRUCT ops to access the field named NAME. If NAME is a
2644 qualified name (has '.'), generate a field access for each part. */
2647 push_fieldnames (name)
2651 struct stoken token;
2652 token.ptr = name.ptr;
2655 if (i == name.length || name.ptr[i] == '.')
2657 /* token.ptr is start of current field name. */
2658 token.length = &name.ptr[i] - token.ptr;
2659 write_exp_elt_opcode (STRUCTOP_STRUCT);
2660 write_exp_string (token);
2661 write_exp_elt_opcode (STRUCTOP_STRUCT);
2662 token.ptr += token.length + 1;
2664 if (i >= name.length)
2669 /* Helper routine for push_expression_name.
2670 Handle a qualified name, where DOT_INDEX is the index of the first '.' */
2673 push_qualified_expression_name (struct stoken name, int dot_index)
2675 struct stoken token;
2679 token.ptr = name.ptr;
2680 token.length = dot_index;
2682 if (push_variable (token))
2684 token.ptr = name.ptr + dot_index + 1;
2685 token.length = name.length - dot_index - 1;
2686 push_fieldnames (token);
2690 token.ptr = name.ptr;
2693 token.length = dot_index;
2694 tmp = copy_name (token);
2695 typ = java_lookup_class (tmp);
2698 if (dot_index == name.length)
2700 write_exp_elt_opcode(OP_TYPE);
2701 write_exp_elt_type(typ);
2702 write_exp_elt_opcode(OP_TYPE);
2705 dot_index++; /* Skip '.' */
2706 name.ptr += dot_index;
2707 name.length -= dot_index;
2709 while (dot_index < name.length && name.ptr[dot_index] != '.')
2711 token.ptr = name.ptr;
2712 token.length = dot_index;
2713 write_exp_elt_opcode (OP_SCOPE);
2714 write_exp_elt_type (typ);
2715 write_exp_string (token);
2716 write_exp_elt_opcode (OP_SCOPE);
2717 if (dot_index < name.length)
2720 name.ptr += dot_index;
2721 name.length -= dot_index;
2722 push_fieldnames (name);
2726 else if (dot_index >= name.length)
2728 dot_index++; /* Skip '.' */
2729 while (dot_index < name.length && name.ptr[dot_index] != '.')
2732 error (_("unknown type `%.*s'"), name.length, name.ptr);
2735 /* Handle Name in an expression (or LHS).
2736 Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
2739 push_expression_name (name)
2747 for (i = 0; i < name.length; i++)
2749 if (name.ptr[i] == '.')
2751 /* It's a Qualified Expression Name. */
2752 push_qualified_expression_name (name, i);
2757 /* It's a Simple Expression Name. */
2759 if (push_variable (name))
2761 tmp = copy_name (name);
2762 typ = java_lookup_class (tmp);
2765 write_exp_elt_opcode(OP_TYPE);
2766 write_exp_elt_type(typ);
2767 write_exp_elt_opcode(OP_TYPE);
2771 struct minimal_symbol *msymbol;
2773 msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
2774 if (msymbol != NULL)
2776 write_exp_msymbol (msymbol,
2777 lookup_function_type (builtin_type_int),
2780 else if (!have_full_symbols () && !have_partial_symbols ())
2781 error (_("No symbol table is loaded. Use the \"file\" command"));
2783 error (_("No symbol \"%s\" in current context"), tmp);
2789 /* The following two routines, copy_exp and insert_exp, aren't specific to
2790 Java, so they could go in parse.c, but their only purpose is to support
2791 the parsing kludges we use in this file, so maybe it's best to isolate
2794 /* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
2795 into a freshly xmalloc'ed struct expression. Its language_defn is set
2797 static struct expression *
2798 copy_exp (expr, endpos)
2799 struct expression *expr;
2802 int len = length_of_subexp (expr, endpos);
2803 struct expression *new
2804 = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
2806 memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
2807 new->language_defn = 0;
2812 /* Insert the expression NEW into the current expression (expout) at POS. */
2814 insert_exp (pos, new)
2816 struct expression *new;
2818 int newlen = new->nelts;
2820 /* Grow expout if necessary. In this function's only use at present,
2821 this should never be necessary. */
2822 if (expout_ptr + newlen > expout_size)
2824 expout_size = max (expout_size * 2, expout_ptr + newlen + 10);
2825 expout = (struct expression *)
2826 xrealloc ((char *) expout, (sizeof (struct expression)
2827 + EXP_ELEM_TO_BYTES (expout_size)));
2833 for (i = expout_ptr - 1; i >= pos; i--)
2834 expout->elts[i + newlen] = expout->elts[i];
2837 memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen));
2838 expout_ptr += newlen;