0c93d29bec72060e824f9c5592b72baa5ec37a16
[platform/upstream/gdb.git] / gdb / jv-exp.c
1 /* A Bison parser, made by GNU Bison 3.0.2.  */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
42
43 /* Identify Bison output.  */
44 #define YYBISON 1
45
46 /* Bison version.  */
47 #define YYBISON_VERSION "3.0.2"
48
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers.  */
53 #define YYPURE 0
54
55 /* Push parsers.  */
56 #define YYPUSH 0
57
58 /* Pull parsers.  */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations.  */
65 #line 36 "jv-exp.y" /* yacc.c:339  */
66
67
68 #include "defs.h"
69 #include <ctype.h>
70 #include "expression.h"
71 #include "value.h"
72 #include "parser-defs.h"
73 #include "language.h"
74 #include "jv-lang.h"
75 #include "bfd.h" /* Required by objfiles.h.  */
76 #include "symfile.h" /* Required by objfiles.h.  */
77 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
78 #include "block.h"
79 #include "completer.h"
80
81 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
82 #define parse_java_type(ps) builtin_java_type (parse_gdbarch (ps))
83
84 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
85    as well as gratuitiously global symbol names, so we can have multiple
86    yacc generated parsers in gdb.  Note that these are only the variables
87    produced by yacc.  If other parser generators (bison, byacc, etc) produce
88    additional global names that conflict at link time, then those parser
89    generators need to be fixed instead of adding those names to this list.  */
90
91 #define yymaxdepth java_maxdepth
92 #define yyparse java_parse_internal
93 #define yylex   java_lex
94 #define yyerror java_error
95 #define yylval  java_lval
96 #define yychar  java_char
97 #define yydebug java_debug
98 #define yypact  java_pact       
99 #define yyr1    java_r1                 
100 #define yyr2    java_r2                 
101 #define yydef   java_def                
102 #define yychk   java_chk                
103 #define yypgo   java_pgo                
104 #define yyact   java_act                
105 #define yyexca  java_exca
106 #define yyerrflag java_errflag
107 #define yynerrs java_nerrs
108 #define yyps    java_ps
109 #define yypv    java_pv
110 #define yys     java_s
111 #define yy_yys  java_yys
112 #define yystate java_state
113 #define yytmp   java_tmp
114 #define yyv     java_v
115 #define yy_yyv  java_yyv
116 #define yyval   java_val
117 #define yylloc  java_lloc
118 #define yyreds  java_reds               /* With YYDEBUG defined */
119 #define yytoks  java_toks               /* With YYDEBUG defined */
120 #define yyname  java_name               /* With YYDEBUG defined */
121 #define yyrule  java_rule               /* With YYDEBUG defined */
122 #define yylhs   java_yylhs
123 #define yylen   java_yylen
124 #define yydefred java_yydefred
125 #define yydgoto java_yydgoto
126 #define yysindex java_yysindex
127 #define yyrindex java_yyrindex
128 #define yygindex java_yygindex
129 #define yytable  java_yytable
130 #define yycheck  java_yycheck
131 #define yyss    java_yyss
132 #define yysslim java_yysslim
133 #define yyssp   java_yyssp
134 #define yystacksize java_yystacksize
135 #define yyvs    java_yyvs
136 #define yyvsp   java_yyvsp
137
138 #ifndef YYDEBUG
139 #define YYDEBUG 1               /* Default to yydebug support */
140 #endif
141
142 #define YYFPRINTF parser_fprintf
143
144 /* The state of the parser, used internally when we are parsing the
145    expression.  */
146
147 static struct parser_state *pstate = NULL;
148
149 int yyparse (void);
150
151 static int yylex (void);
152
153 void yyerror (char *);
154
155 static struct type *java_type_from_name (struct stoken);
156 static void push_expression_name (struct parser_state *, struct stoken);
157 static void push_fieldnames (struct parser_state *, struct stoken);
158
159 static struct expression *copy_exp (struct expression *, int);
160 static void insert_exp (struct parser_state *, int, struct expression *);
161
162
163 #line 164 "jv-exp.c" /* yacc.c:339  */
164
165 # ifndef YY_NULLPTR
166 #  if defined __cplusplus && 201103L <= __cplusplus
167 #   define YY_NULLPTR nullptr
168 #  else
169 #   define YY_NULLPTR 0
170 #  endif
171 # endif
172
173 /* Enabling verbose error messages.  */
174 #ifdef YYERROR_VERBOSE
175 # undef YYERROR_VERBOSE
176 # define YYERROR_VERBOSE 1
177 #else
178 # define YYERROR_VERBOSE 0
179 #endif
180
181
182 /* Debug traces.  */
183 #ifndef YYDEBUG
184 # define YYDEBUG 0
185 #endif
186 #if YYDEBUG
187 extern int yydebug;
188 #endif
189
190 /* Token type.  */
191 #ifndef YYTOKENTYPE
192 # define YYTOKENTYPE
193   enum yytokentype
194   {
195     INTEGER_LITERAL = 258,
196     FLOATING_POINT_LITERAL = 259,
197     IDENTIFIER = 260,
198     STRING_LITERAL = 261,
199     BOOLEAN_LITERAL = 262,
200     TYPENAME = 263,
201     NAME_OR_INT = 264,
202     ERROR = 265,
203     LONG = 266,
204     SHORT = 267,
205     BYTE = 268,
206     INT = 269,
207     CHAR = 270,
208     BOOLEAN = 271,
209     DOUBLE = 272,
210     FLOAT = 273,
211     VARIABLE = 274,
212     ASSIGN_MODIFY = 275,
213     SUPER = 276,
214     NEW = 277,
215     OROR = 278,
216     ANDAND = 279,
217     EQUAL = 280,
218     NOTEQUAL = 281,
219     LEQ = 282,
220     GEQ = 283,
221     LSH = 284,
222     RSH = 285,
223     INCREMENT = 286,
224     DECREMENT = 287
225   };
226 #endif
227 /* Tokens.  */
228 #define INTEGER_LITERAL 258
229 #define FLOATING_POINT_LITERAL 259
230 #define IDENTIFIER 260
231 #define STRING_LITERAL 261
232 #define BOOLEAN_LITERAL 262
233 #define TYPENAME 263
234 #define NAME_OR_INT 264
235 #define ERROR 265
236 #define LONG 266
237 #define SHORT 267
238 #define BYTE 268
239 #define INT 269
240 #define CHAR 270
241 #define BOOLEAN 271
242 #define DOUBLE 272
243 #define FLOAT 273
244 #define VARIABLE 274
245 #define ASSIGN_MODIFY 275
246 #define SUPER 276
247 #define NEW 277
248 #define OROR 278
249 #define ANDAND 279
250 #define EQUAL 280
251 #define NOTEQUAL 281
252 #define LEQ 282
253 #define GEQ 283
254 #define LSH 284
255 #define RSH 285
256 #define INCREMENT 286
257 #define DECREMENT 287
258
259 /* Value type.  */
260 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
261 typedef union YYSTYPE YYSTYPE;
262 union YYSTYPE
263 {
264 #line 139 "jv-exp.y" /* yacc.c:355  */
265
266     LONGEST lval;
267     struct {
268       LONGEST val;
269       struct type *type;
270     } typed_val_int;
271     struct {
272       DOUBLEST dval;
273       struct type *type;
274     } typed_val_float;
275     struct symbol *sym;
276     struct type *tval;
277     struct stoken sval;
278     struct ttype tsym;
279     struct symtoken ssym;
280     struct block *bval;
281     enum exp_opcode opcode;
282     struct internalvar *ivar;
283     int *ivec;
284   
285
286 #line 287 "jv-exp.c" /* yacc.c:355  */
287 };
288 # define YYSTYPE_IS_TRIVIAL 1
289 # define YYSTYPE_IS_DECLARED 1
290 #endif
291
292
293 extern YYSTYPE yylval;
294
295 int yyparse (void);
296
297
298
299 /* Copy the second part of user declarations.  */
300 #line 160 "jv-exp.y" /* yacc.c:358  */
301
302 /* YYSTYPE gets defined by %union */
303 static int parse_number (struct parser_state *, const char *, int,
304                          int, YYSTYPE *);
305
306 #line 307 "jv-exp.c" /* yacc.c:358  */
307
308 #ifdef short
309 # undef short
310 #endif
311
312 #ifdef YYTYPE_UINT8
313 typedef YYTYPE_UINT8 yytype_uint8;
314 #else
315 typedef unsigned char yytype_uint8;
316 #endif
317
318 #ifdef YYTYPE_INT8
319 typedef YYTYPE_INT8 yytype_int8;
320 #else
321 typedef signed char yytype_int8;
322 #endif
323
324 #ifdef YYTYPE_UINT16
325 typedef YYTYPE_UINT16 yytype_uint16;
326 #else
327 typedef unsigned short int yytype_uint16;
328 #endif
329
330 #ifdef YYTYPE_INT16
331 typedef YYTYPE_INT16 yytype_int16;
332 #else
333 typedef short int yytype_int16;
334 #endif
335
336 #ifndef YYSIZE_T
337 # ifdef __SIZE_TYPE__
338 #  define YYSIZE_T __SIZE_TYPE__
339 # elif defined size_t
340 #  define YYSIZE_T size_t
341 # elif ! defined YYSIZE_T
342 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
343 #  define YYSIZE_T size_t
344 # else
345 #  define YYSIZE_T unsigned int
346 # endif
347 #endif
348
349 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
350
351 #ifndef YY_
352 # if defined YYENABLE_NLS && YYENABLE_NLS
353 #  if ENABLE_NLS
354 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
355 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
356 #  endif
357 # endif
358 # ifndef YY_
359 #  define YY_(Msgid) Msgid
360 # endif
361 #endif
362
363 #ifndef YY_ATTRIBUTE
364 # if (defined __GNUC__                                               \
365       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
366      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
367 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
368 # else
369 #  define YY_ATTRIBUTE(Spec) /* empty */
370 # endif
371 #endif
372
373 #ifndef YY_ATTRIBUTE_PURE
374 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
375 #endif
376
377 #ifndef YY_ATTRIBUTE_UNUSED
378 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
379 #endif
380
381 #if !defined _Noreturn \
382      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
383 # if defined _MSC_VER && 1200 <= _MSC_VER
384 #  define _Noreturn __declspec (noreturn)
385 # else
386 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
387 # endif
388 #endif
389
390 /* Suppress unused-variable warnings by "using" E.  */
391 #if ! defined lint || defined __GNUC__
392 # define YYUSE(E) ((void) (E))
393 #else
394 # define YYUSE(E) /* empty */
395 #endif
396
397 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
398 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
399 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
400     _Pragma ("GCC diagnostic push") \
401     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
402     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
403 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
404     _Pragma ("GCC diagnostic pop")
405 #else
406 # define YY_INITIAL_VALUE(Value) Value
407 #endif
408 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
409 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
410 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
411 #endif
412 #ifndef YY_INITIAL_VALUE
413 # define YY_INITIAL_VALUE(Value) /* Nothing. */
414 #endif
415
416
417 #if ! defined yyoverflow || YYERROR_VERBOSE
418
419 /* The parser invokes alloca or xmalloc; define the necessary symbols.  */
420
421 # ifdef YYSTACK_USE_ALLOCA
422 #  if YYSTACK_USE_ALLOCA
423 #   ifdef __GNUC__
424 #    define YYSTACK_ALLOC __builtin_alloca
425 #   elif defined __BUILTIN_VA_ARG_INCR
426 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
427 #   elif defined _AIX
428 #    define YYSTACK_ALLOC __alloca
429 #   elif defined _MSC_VER
430 #    define alloca _alloca
431 #   else
432 #    define YYSTACK_ALLOC alloca
433 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
434 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
435       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
436 #     ifndef EXIT_SUCCESS
437 #      define EXIT_SUCCESS 0
438 #     endif
439 #    endif
440 #   endif
441 #  endif
442 # endif
443
444 # ifdef YYSTACK_ALLOC
445    /* Pacify GCC's 'empty if-body' warning.  */
446 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
447 #  ifndef YYSTACK_ALLOC_MAXIMUM
448     /* The OS might guarantee only one guard page at the bottom of the stack,
449        and a page size can be as small as 4096 bytes.  So we cannot safely
450        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
451        to allow for a few compiler-allocated temporary stack slots.  */
452 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
453 #  endif
454 # else
455 #  define YYSTACK_ALLOC YYMALLOC
456 #  define YYSTACK_FREE YYFREE
457 #  ifndef YYSTACK_ALLOC_MAXIMUM
458 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
459 #  endif
460 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
461        && ! ((defined YYMALLOC || defined xmalloc) \
462              && (defined YYFREE || defined xfree)))
463 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
464 #   ifndef EXIT_SUCCESS
465 #    define EXIT_SUCCESS 0
466 #   endif
467 #  endif
468 #  ifndef YYMALLOC
469 #   define YYMALLOC xmalloc
470 #   if ! defined xmalloc && ! defined EXIT_SUCCESS
471 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
472 #   endif
473 #  endif
474 #  ifndef YYFREE
475 #   define YYFREE xfree
476 #   if ! defined xfree && ! defined EXIT_SUCCESS
477 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
478 #   endif
479 #  endif
480 # endif
481 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
482
483
484 #if (! defined yyoverflow \
485      && (! defined __cplusplus \
486          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
487
488 /* A type that is properly aligned for any stack member.  */
489 union yyalloc
490 {
491   yytype_int16 yyss_alloc;
492   YYSTYPE yyvs_alloc;
493 };
494
495 /* The size of the maximum gap between one aligned stack and the next.  */
496 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
497
498 /* The size of an array large to enough to hold all stacks, each with
499    N elements.  */
500 # define YYSTACK_BYTES(N) \
501      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
502       + YYSTACK_GAP_MAXIMUM)
503
504 # define YYCOPY_NEEDED 1
505
506 /* Relocate STACK from its old location to the new one.  The
507    local variables YYSIZE and YYSTACKSIZE give the old and new number of
508    elements in the stack, and YYPTR gives the new location of the
509    stack.  Advance YYPTR to a properly aligned location for the next
510    stack.  */
511 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
512     do                                                                  \
513       {                                                                 \
514         YYSIZE_T yynewbytes;                                            \
515         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
516         Stack = &yyptr->Stack_alloc;                                    \
517         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
518         yyptr += yynewbytes / sizeof (*yyptr);                          \
519       }                                                                 \
520     while (0)
521
522 #endif
523
524 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
525 /* Copy COUNT objects from SRC to DST.  The source and destination do
526    not overlap.  */
527 # ifndef YYCOPY
528 #  if defined __GNUC__ && 1 < __GNUC__
529 #   define YYCOPY(Dst, Src, Count) \
530       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
531 #  else
532 #   define YYCOPY(Dst, Src, Count)              \
533       do                                        \
534         {                                       \
535           YYSIZE_T yyi;                         \
536           for (yyi = 0; yyi < (Count); yyi++)   \
537             (Dst)[yyi] = (Src)[yyi];            \
538         }                                       \
539       while (0)
540 #  endif
541 # endif
542 #endif /* !YYCOPY_NEEDED */
543
544 /* YYFINAL -- State number of the termination state.  */
545 #define YYFINAL  98
546 /* YYLAST -- Last index in YYTABLE.  */
547 #define YYLAST   373
548
549 /* YYNTOKENS -- Number of terminals.  */
550 #define YYNTOKENS  56
551 /* YYNNTS -- Number of nonterminals.  */
552 #define YYNNTS  58
553 /* YYNRULES -- Number of rules.  */
554 #define YYNRULES  132
555 /* YYNSTATES -- Number of states.  */
556 #define YYNSTATES  209
557
558 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
559    by yylex, with out-of-bounds checking.  */
560 #define YYUNDEFTOK  2
561 #define YYMAXUTOK   287
562
563 #define YYTRANSLATE(YYX)                                                \
564   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
565
566 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
567    as returned by yylex, without out-of-bounds checking.  */
568 static const yytype_uint8 yytranslate[] =
569 {
570        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
571        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
572        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
573        2,     2,     2,    54,     2,     2,     2,    43,    30,     2,
574       48,    49,    41,    39,    23,    40,    46,    42,     2,     2,
575        2,     2,     2,     2,     2,     2,     2,     2,    55,     2,
576       33,    24,    34,    25,     2,     2,     2,     2,     2,     2,
577        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
578        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
579        2,    47,     2,    52,    29,     2,     2,     2,     2,     2,
580        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
581        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
582        2,     2,     2,    50,    28,    51,    53,     2,     2,     2,
583        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
584        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
585        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
586        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
587        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
588        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
589        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
590        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
591        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
592        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
593        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
594        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
595        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
596        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
597       15,    16,    17,    18,    19,    20,    21,    22,    26,    27,
598       31,    32,    35,    36,    37,    38,    44,    45
599 };
600
601 #if YYDEBUG
602   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
603 static const yytype_uint16 yyrline[] =
604 {
605        0,   217,   217,   218,   221,   230,   231,   235,   244,   249,
606      258,   263,   269,   280,   281,   286,   287,   291,   293,   295,
607      297,   299,   304,   306,   318,   323,   327,   329,   334,   335,
608      339,   340,   344,   345,   349,   375,   376,   381,   382,   386,
609      387,   388,   389,   390,   391,   392,   400,   405,   410,   416,
610      418,   424,   425,   429,   432,   438,   439,   443,   447,   449,
611      454,   456,   460,   462,   468,   474,   473,   479,   481,   486,
612      506,   508,   513,   514,   516,   518,   519,   523,   528,   533,
613      534,   535,   536,   538,   541,   545,   550,   555,   556,   558,
614      560,   564,   568,   592,   602,   603,   605,   607,   612,   613,
615      615,   620,   621,   623,   629,   630,   632,   634,   636,   642,
616      643,   645,   650,   651,   656,   657,   661,   662,   667,   668,
617      673,   674,   679,   680,   685,   686,   690,   692,   699,   701,
618      703,   704,   709
619 };
620 #endif
621
622 #if YYDEBUG || YYERROR_VERBOSE || 0
623 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
624    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
625 static const char *const yytname[] =
626 {
627   "$end", "error", "$undefined", "INTEGER_LITERAL",
628   "FLOATING_POINT_LITERAL", "IDENTIFIER", "STRING_LITERAL",
629   "BOOLEAN_LITERAL", "TYPENAME", "NAME_OR_INT", "ERROR", "LONG", "SHORT",
630   "BYTE", "INT", "CHAR", "BOOLEAN", "DOUBLE", "FLOAT", "VARIABLE",
631   "ASSIGN_MODIFY", "SUPER", "NEW", "','", "'='", "'?'", "OROR", "ANDAND",
632   "'|'", "'^'", "'&'", "EQUAL", "NOTEQUAL", "'<'", "'>'", "LEQ", "GEQ",
633   "LSH", "RSH", "'+'", "'-'", "'*'", "'/'", "'%'", "INCREMENT",
634   "DECREMENT", "'.'", "'['", "'('", "')'", "'{'", "'}'", "']'", "'~'",
635   "'!'", "':'", "$accept", "start", "type_exp", "PrimitiveOrArrayType",
636   "StringLiteral", "Literal", "PrimitiveType", "NumericType",
637   "IntegralType", "FloatingPointType", "ClassOrInterfaceType", "ClassType",
638   "ArrayType", "Name", "ForcedName", "SimpleName", "QualifiedName", "exp1",
639   "Primary", "PrimaryNoNewArray", "lcurly", "rcurly",
640   "ClassInstanceCreationExpression", "ArgumentList", "ArgumentList_opt",
641   "ArrayCreationExpression", "DimExprs", "DimExpr", "Dims", "Dims_opt",
642   "FieldAccess", "FuncStart", "MethodInvocation", "$@1", "ArrayAccess",
643   "PostfixExpression", "PostIncrementExpression",
644   "PostDecrementExpression", "UnaryExpression", "PreIncrementExpression",
645   "PreDecrementExpression", "UnaryExpressionNotPlusMinus",
646   "CastExpression", "MultiplicativeExpression", "AdditiveExpression",
647   "ShiftExpression", "RelationalExpression", "EqualityExpression",
648   "AndExpression", "ExclusiveOrExpression", "InclusiveOrExpression",
649   "ConditionalAndExpression", "ConditionalOrExpression",
650   "ConditionalExpression", "AssignmentExpression", "Assignment",
651   "LeftHandSide", "Expression", YY_NULLPTR
652 };
653 #endif
654
655 # ifdef YYPRINT
656 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
657    (internal) symbol number NUM (which must be that of a token).  */
658 static const yytype_uint16 yytoknum[] =
659 {
660        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
661      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
662      275,   276,   277,    44,    61,    63,   278,   279,   124,    94,
663       38,   280,   281,    60,    62,   282,   283,   284,   285,    43,
664       45,    42,    47,    37,   286,   287,    46,    91,    40,    41,
665      123,   125,    93,   126,    33,    58
666 };
667 # endif
668
669 #define YYPACT_NINF -145
670
671 #define yypact_value_is_default(Yystate) \
672   (!!((Yystate) == (-145)))
673
674 #define YYTABLE_NINF -132
675
676 #define yytable_value_is_error(Yytable_value) \
677   0
678
679   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
680      STATE-NUM.  */
681 static const yytype_int16 yypact[] =
682 {
683      215,  -145,  -145,    -5,  -145,  -145,     1,  -145,  -145,  -145,
684     -145,  -145,  -145,  -145,  -145,    -7,   -19,   279,    50,    50,
685       50,    50,    50,   215,  -145,    50,    50,    46,  -145,  -145,
686     -145,  -145,    -9,  -145,  -145,  -145,  -145,    87,  -145,  -145,
687       12,    44,     5,    16,   319,  -145,  -145,    28,  -145,  -145,
688       38,    29,  -145,  -145,  -145,  -145,  -145,  -145,  -145,    99,
689       53,    85,    52,    94,    66,    41,    71,    74,   122,  -145,
690     -145,  -145,    40,  -145,    26,   319,    26,  -145,    59,    59,
691       67,    82,  -145,  -145,   111,   107,  -145,  -145,  -145,  -145,
692     -145,  -145,  -145,    -9,    87,    68,  -145,  -145,  -145,    79,
693       91,    26,   267,  -145,    91,   319,    26,   319,   -18,  -145,
694      319,  -145,  -145,    50,    50,    50,    50,    50,    50,    50,
695       50,    50,    50,    50,    50,    50,    50,    50,    50,    50,
696      319,    50,    50,    50,  -145,  -145,  -145,   112,   126,   319,
697      128,  -145,   128,   319,   319,    91,   127,   -31,   193,  -145,
698      125,  -145,   129,  -145,   131,   130,   319,  -145,  -145,   157,
699      135,  -145,  -145,  -145,    99,    99,    53,    53,    85,    85,
700       85,    85,    52,    52,    94,    66,    41,    71,   132,    74,
701     -145,  -145,  -145,   319,   134,   267,  -145,  -145,  -145,   139,
702       50,   193,  -145,  -145,  -145,   319,  -145,  -145,  -145,    50,
703      141,  -145,  -145,  -145,  -145,   144,  -145,  -145,  -145
704 };
705
706   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
707      Performed when YYTABLE does not specify something else to do.  Zero
708      means the default is an error.  */
709 static const yytype_uint8 yydefact[] =
710 {
711        0,     8,    10,    28,     7,    11,     9,    20,    18,    17,
712       19,    21,    14,    23,    22,    74,     0,     0,     0,     0,
713        0,     0,     0,     0,    46,     0,     0,     0,     3,     4,
714       12,    39,     5,    13,    15,    16,     6,    73,   128,    30,
715       29,     2,    72,    37,     0,    41,    38,    42,    65,    43,
716       44,    87,    75,    76,    94,    79,    80,    84,    90,    98,
717      101,   104,   109,   112,   114,   116,   118,   120,   122,   124,
718      132,   125,     0,    35,     0,     0,     0,    28,     0,    25,
719        0,    24,    29,     9,    74,    73,    42,    44,    81,    82,
720       83,    85,    86,    61,    73,     0,    88,    89,     1,     0,
721       26,     0,     0,    64,    27,     0,     0,     0,     0,    49,
722       51,    77,    78,     0,     0,     0,     0,     0,     0,     0,
723        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
724        0,     0,     0,     0,    32,    33,    63,     0,     0,     0,
725       61,    55,    61,    51,     0,    60,     0,     0,    40,    58,
726        0,    34,     0,    36,    62,     0,     0,    47,    45,    52,
727        0,    95,    96,    97,    99,   100,   102,   103,   105,   106,
728      107,   108,   110,   111,   113,   115,   117,   119,     0,   121,
729      127,   126,    70,    51,     0,     0,    56,    53,    54,     0,
730        0,     0,    92,    59,    69,    51,    71,    50,    66,     0,
731        0,    57,    48,    91,    93,     0,   123,    68,    67
732 };
733
734   /* YYPGOTO[NTERM-NUM].  */
735 static const yytype_int16 yypgoto[] =
736 {
737     -145,  -145,  -145,  -145,  -145,  -145,    -3,  -145,  -145,  -145,
738     -145,  -145,  -145,    11,  -145,   -64,     0,  -145,  -145,  -145,
739     -145,  -145,  -145,   150,  -134,  -145,   124,  -116,   -29,   -99,
740        6,  -145,  -145,  -145,    22,  -145,  -145,  -145,    58,  -145,
741     -145,  -144,  -145,    43,    49,    -2,    45,    78,    81,    83,
742       77,    92,  -145,  -131,  -145,  -145,  -145,     7
743 };
744
745   /* YYDEFGOTO[NTERM-NUM].  */
746 static const yytype_int16 yydefgoto[] =
747 {
748       -1,    27,    28,    29,    30,    31,    32,    33,    34,    35,
749       79,    80,    36,    85,    38,    39,    82,    41,    42,    43,
750       44,   158,    45,   159,   160,    46,   140,   141,   145,   146,
751       86,    48,    49,   110,    87,    51,    52,    53,    54,    55,
752       56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
753       66,    67,    68,    69,    70,    71,    72,   109
754 };
755
756   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
757      positive, shift that token.  If negative, reduce the rule whose
758      number is the opposite.  If YYTABLE_NINF, syntax error.  */
759 static const yytype_int16 yytable[] =
760 {
761       40,   180,   181,   100,   192,   156,    47,    73,   104,   189,
762      136,    37,   138,  -129,    78,   -32,   150,  -129,   191,   -32,
763       93,   -33,    50,    40,   186,   -33,   186,    76,    81,    47,
764       95,   134,   -31,   157,    94,   135,   -31,   151,    99,    74,
765       75,   187,   154,   188,    40,    50,    98,   204,  -130,   200,
766       47,   106,  -130,     1,     2,    77,     4,     5,  -131,    83,
767      132,   205,  -131,   107,   133,   147,    50,   105,   206,    84,
768      127,    16,    17,   111,   112,    40,    88,    89,    90,    91,
769       92,    47,   137,    96,    97,   120,   121,   122,   123,    18,
770       19,    20,   116,   117,    21,    22,   126,    50,    23,   128,
771       24,   129,    40,    25,    26,    40,   139,    40,    47,   152,
772       40,    47,   153,    47,   155,   143,    47,   148,   168,   169,
773      170,   171,   118,   119,    50,   124,   125,    50,   101,    50,
774       40,   149,    50,   101,   102,   103,    47,   178,   150,    40,
775      113,   114,   115,    40,    40,    47,   184,   130,   131,    47,
776       47,   152,    50,   101,   144,   103,    40,    74,    75,   164,
777      165,    50,    47,   197,   182,    50,    50,   166,   167,   172,
778      173,   161,   162,   163,   183,   185,   190,   193,    50,   195,
779      156,   194,   196,    40,   198,    40,   201,   199,   202,    47,
780      207,    47,   184,   208,   108,    40,     1,     2,    77,     4,
781        5,    47,    83,   142,   174,    50,   177,    50,   175,     0,
782        0,   176,    84,     0,    16,    17,     0,    50,     1,     2,
783        3,     4,     5,   179,     6,     0,     7,     8,     9,    10,
784       11,    12,    13,    14,    15,     0,    16,    17,     0,     0,
785        0,    23,     0,    24,     0,     0,    25,    26,   203,     0,
786        0,     0,     0,     0,    18,    19,    20,     0,     0,    21,
787       22,     0,     0,    23,     0,    24,     0,     0,    25,    26,
788        1,     2,     3,     4,     5,     0,     6,     0,     0,     0,
789        0,     0,     0,     0,    77,     0,    15,     0,    16,    17,
790        7,     8,     9,    10,    11,    12,    13,    14,     0,     0,
791        0,     0,     0,     0,     0,     0,    18,    19,    20,     0,
792        0,    21,    22,     0,     0,    23,     0,    24,     0,   149,
793       25,    26,     1,     2,     3,     4,     5,     0,     6,     0,
794        0,     0,     0,     0,     0,     0,     0,     0,    15,     0,
795       16,    17,     0,     0,     0,     0,     0,     0,     0,     0,
796        0,     0,     0,     0,     0,     0,     0,     0,    18,    19,
797       20,     0,     0,    21,    22,     0,     0,    23,     0,    24,
798        0,     0,    25,    26
799 };
800
801 static const yytype_int16 yycheck[] =
802 {
803        0,   132,   133,    32,   148,    23,     0,     0,    37,   143,
804       74,     0,    76,    20,    17,    20,    47,    24,    49,    24,
805       23,    20,     0,    23,   140,    24,   142,    46,    17,    23,
806       23,     5,    20,    51,    23,     9,    24,   101,    47,    46,
807       47,   140,   106,   142,    44,    23,     0,   191,    20,   183,
808       44,    46,    24,     3,     4,     5,     6,     7,    20,     9,
809       20,   195,    24,    47,    24,    94,    44,    23,   199,    19,
810       29,    21,    22,    44,    45,    75,    18,    19,    20,    21,
811       22,    75,    75,    25,    26,    33,    34,    35,    36,    39,
812       40,    41,    39,    40,    44,    45,    30,    75,    48,    28,
813       50,    27,   102,    53,    54,   105,    47,   107,   102,   102,
814      110,   105,   105,   107,   107,    48,   110,    49,   120,   121,
815      122,   123,    37,    38,   102,    31,    32,   105,    46,   107,
816      130,    52,   110,    46,    47,    48,   130,   130,    47,   139,
817       41,    42,    43,   143,   144,   139,   139,    25,    26,   143,
818      144,   144,   130,    46,    47,    48,   156,    46,    47,   116,
819      117,   139,   156,   156,    52,   143,   144,   118,   119,   124,
820      125,   113,   114,   115,    48,    47,    49,    52,   156,    48,
821       23,    52,    52,   183,    49,   185,    52,    55,    49,   183,
822       49,   185,   185,    49,    44,   195,     3,     4,     5,     6,
823        7,   195,     9,    79,   126,   183,   129,   185,   127,    -1,
824       -1,   128,    19,    -1,    21,    22,    -1,   195,     3,     4,
825        5,     6,     7,   131,     9,    -1,    11,    12,    13,    14,
826       15,    16,    17,    18,    19,    -1,    21,    22,    -1,    -1,
827       -1,    48,    -1,    50,    -1,    -1,    53,    54,   190,    -1,
828       -1,    -1,    -1,    -1,    39,    40,    41,    -1,    -1,    44,
829       45,    -1,    -1,    48,    -1,    50,    -1,    -1,    53,    54,
830        3,     4,     5,     6,     7,    -1,     9,    -1,    -1,    -1,
831       -1,    -1,    -1,    -1,     5,    -1,    19,    -1,    21,    22,
832       11,    12,    13,    14,    15,    16,    17,    18,    -1,    -1,
833       -1,    -1,    -1,    -1,    -1,    -1,    39,    40,    41,    -1,
834       -1,    44,    45,    -1,    -1,    48,    -1,    50,    -1,    52,
835       53,    54,     3,     4,     5,     6,     7,    -1,     9,    -1,
836       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    19,    -1,
837       21,    22,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
838       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    39,    40,
839       41,    -1,    -1,    44,    45,    -1,    -1,    48,    -1,    50,
840       -1,    -1,    53,    54
841 };
842
843   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
844      symbol of state STATE-NUM.  */
845 static const yytype_uint8 yystos[] =
846 {
847        0,     3,     4,     5,     6,     7,     9,    11,    12,    13,
848       14,    15,    16,    17,    18,    19,    21,    22,    39,    40,
849       41,    44,    45,    48,    50,    53,    54,    57,    58,    59,
850       60,    61,    62,    63,    64,    65,    68,    69,    70,    71,
851       72,    73,    74,    75,    76,    78,    81,    86,    87,    88,
852       90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
853      100,   101,   102,   103,   104,   105,   106,   107,   108,   109,
854      110,   111,   112,   113,    46,    47,    46,     5,    62,    66,
855       67,    69,    72,     9,    19,    69,    86,    90,    94,    94,
856       94,    94,    94,    62,    69,   113,    94,    94,     0,    47,
857       84,    46,    47,    48,    84,    23,    46,    47,    79,   113,
858       89,    44,    45,    41,    42,    43,    39,    40,    37,    38,
859       33,    34,    35,    36,    31,    32,    30,    29,    28,    27,
860       25,    26,    20,    24,     5,     9,    71,   113,    71,    47,
861       82,    83,    82,    48,    47,    84,    85,    84,    49,    52,
862       47,    71,   113,   113,    71,   113,    23,    51,    77,    79,
863       80,    94,    94,    94,    99,    99,   100,   100,   101,   101,
864      101,   101,   102,   102,   103,   104,   105,   106,   113,   107,
865      109,   109,    52,    48,   113,    47,    83,    85,    85,    80,
866       49,    49,    97,    52,    52,    48,    52,   113,    49,    55,
867       80,    52,    49,    94,    97,    80,   109,    49,    49
868 };
869
870   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
871 static const yytype_uint8 yyr1[] =
872 {
873        0,    56,    57,    57,    58,    59,    59,    60,    61,    61,
874       61,    61,    61,    62,    62,    63,    63,    64,    64,    64,
875       64,    64,    65,    65,    66,    67,    68,    68,    69,    69,
876       70,    70,    71,    71,    72,    73,    73,    74,    74,    75,
877       75,    75,    75,    75,    75,    75,    76,    77,    78,    79,
878       79,    80,    80,    81,    81,    82,    82,    83,    84,    84,
879       85,    85,    86,    86,    87,    89,    88,    88,    88,    90,
880       90,    90,    91,    91,    91,    91,    91,    92,    93,    94,
881       94,    94,    94,    94,    94,    95,    96,    97,    97,    97,
882       97,    98,    98,    98,    99,    99,    99,    99,   100,   100,
883      100,   101,   101,   101,   102,   102,   102,   102,   102,   103,
884      103,   103,   104,   104,   105,   105,   106,   106,   107,   107,
885      108,   108,   109,   109,   110,   110,   111,   111,   112,   112,
886      112,   112,   113
887 };
888
889   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
890 static const yytype_uint8 yyr2[] =
891 {
892        0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
893        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
894        1,     1,     1,     1,     1,     1,     2,     2,     1,     1,
895        1,     1,     1,     1,     3,     1,     3,     1,     1,     1,
896        3,     1,     1,     1,     1,     3,     1,     1,     5,     1,
897        3,     0,     1,     4,     4,     1,     2,     3,     2,     3,
898        1,     0,     3,     3,     2,     0,     4,     6,     6,     4,
899        4,     4,     1,     1,     1,     1,     1,     2,     2,     1,
900        1,     2,     2,     2,     1,     2,     2,     1,     2,     2,
901        1,     5,     4,     5,     1,     3,     3,     3,     1,     3,
902        3,     1,     3,     3,     1,     3,     3,     3,     3,     1,
903        3,     3,     1,     3,     1,     3,     1,     3,     1,     3,
904        1,     3,     1,     5,     1,     1,     3,     3,     1,     1,
905        1,     1,     1
906 };
907
908
909 #define yyerrok         (yyerrstatus = 0)
910 #define yyclearin       (yychar = YYEMPTY)
911 #define YYEMPTY         (-2)
912 #define YYEOF           0
913
914 #define YYACCEPT        goto yyacceptlab
915 #define YYABORT         goto yyabortlab
916 #define YYERROR         goto yyerrorlab
917
918
919 #define YYRECOVERING()  (!!yyerrstatus)
920
921 #define YYBACKUP(Token, Value)                                  \
922 do                                                              \
923   if (yychar == YYEMPTY)                                        \
924     {                                                           \
925       yychar = (Token);                                         \
926       yylval = (Value);                                         \
927       YYPOPSTACK (yylen);                                       \
928       yystate = *yyssp;                                         \
929       goto yybackup;                                            \
930     }                                                           \
931   else                                                          \
932     {                                                           \
933       yyerror (YY_("syntax error: cannot back up")); \
934       YYERROR;                                                  \
935     }                                                           \
936 while (0)
937
938 /* Error token number */
939 #define YYTERROR        1
940 #define YYERRCODE       256
941
942
943
944 /* Enable debugging if requested.  */
945 #if YYDEBUG
946
947 # ifndef YYFPRINTF
948 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
949 #  define YYFPRINTF fprintf
950 # endif
951
952 # define YYDPRINTF(Args)                        \
953 do {                                            \
954   if (yydebug)                                  \
955     YYFPRINTF Args;                             \
956 } while (0)
957
958 /* This macro is provided for backward compatibility. */
959 #ifndef YY_LOCATION_PRINT
960 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
961 #endif
962
963
964 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
965 do {                                                                      \
966   if (yydebug)                                                            \
967     {                                                                     \
968       YYFPRINTF (stderr, "%s ", Title);                                   \
969       yy_symbol_print (stderr,                                            \
970                   Type, Value); \
971       YYFPRINTF (stderr, "\n");                                           \
972     }                                                                     \
973 } while (0)
974
975
976 /*----------------------------------------.
977 | Print this symbol's value on YYOUTPUT.  |
978 `----------------------------------------*/
979
980 static void
981 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
982 {
983   FILE *yyo = yyoutput;
984   YYUSE (yyo);
985   if (!yyvaluep)
986     return;
987 # ifdef YYPRINT
988   if (yytype < YYNTOKENS)
989     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
990 # endif
991   YYUSE (yytype);
992 }
993
994
995 /*--------------------------------.
996 | Print this symbol on YYOUTPUT.  |
997 `--------------------------------*/
998
999 static void
1000 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1001 {
1002   YYFPRINTF (yyoutput, "%s %s (",
1003              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1004
1005   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1006   YYFPRINTF (yyoutput, ")");
1007 }
1008
1009 /*------------------------------------------------------------------.
1010 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1011 | TOP (included).                                                   |
1012 `------------------------------------------------------------------*/
1013
1014 static void
1015 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1016 {
1017   YYFPRINTF (stderr, "Stack now");
1018   for (; yybottom <= yytop; yybottom++)
1019     {
1020       int yybot = *yybottom;
1021       YYFPRINTF (stderr, " %d", yybot);
1022     }
1023   YYFPRINTF (stderr, "\n");
1024 }
1025
1026 # define YY_STACK_PRINT(Bottom, Top)                            \
1027 do {                                                            \
1028   if (yydebug)                                                  \
1029     yy_stack_print ((Bottom), (Top));                           \
1030 } while (0)
1031
1032
1033 /*------------------------------------------------.
1034 | Report that the YYRULE is going to be reduced.  |
1035 `------------------------------------------------*/
1036
1037 static void
1038 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
1039 {
1040   unsigned long int yylno = yyrline[yyrule];
1041   int yynrhs = yyr2[yyrule];
1042   int yyi;
1043   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1044              yyrule - 1, yylno);
1045   /* The symbols being reduced.  */
1046   for (yyi = 0; yyi < yynrhs; yyi++)
1047     {
1048       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1049       yy_symbol_print (stderr,
1050                        yystos[yyssp[yyi + 1 - yynrhs]],
1051                        &(yyvsp[(yyi + 1) - (yynrhs)])
1052                                               );
1053       YYFPRINTF (stderr, "\n");
1054     }
1055 }
1056
1057 # define YY_REDUCE_PRINT(Rule)          \
1058 do {                                    \
1059   if (yydebug)                          \
1060     yy_reduce_print (yyssp, yyvsp, Rule); \
1061 } while (0)
1062
1063 /* Nonzero means print parse trace.  It is left uninitialized so that
1064    multiple parsers can coexist.  */
1065 int yydebug;
1066 #else /* !YYDEBUG */
1067 # define YYDPRINTF(Args)
1068 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1069 # define YY_STACK_PRINT(Bottom, Top)
1070 # define YY_REDUCE_PRINT(Rule)
1071 #endif /* !YYDEBUG */
1072
1073
1074 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1075 #ifndef YYINITDEPTH
1076 # define YYINITDEPTH 200
1077 #endif
1078
1079 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1080    if the built-in stack extension method is used).
1081
1082    Do not make this value too large; the results are undefined if
1083    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1084    evaluated with infinite-precision integer arithmetic.  */
1085
1086 #ifndef YYMAXDEPTH
1087 # define YYMAXDEPTH 10000
1088 #endif
1089
1090
1091 #if YYERROR_VERBOSE
1092
1093 # ifndef yystrlen
1094 #  if defined __GLIBC__ && defined _STRING_H
1095 #   define yystrlen strlen
1096 #  else
1097 /* Return the length of YYSTR.  */
1098 static YYSIZE_T
1099 yystrlen (const char *yystr)
1100 {
1101   YYSIZE_T yylen;
1102   for (yylen = 0; yystr[yylen]; yylen++)
1103     continue;
1104   return yylen;
1105 }
1106 #  endif
1107 # endif
1108
1109 # ifndef yystpcpy
1110 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1111 #   define yystpcpy stpcpy
1112 #  else
1113 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1114    YYDEST.  */
1115 static char *
1116 yystpcpy (char *yydest, const char *yysrc)
1117 {
1118   char *yyd = yydest;
1119   const char *yys = yysrc;
1120
1121   while ((*yyd++ = *yys++) != '\0')
1122     continue;
1123
1124   return yyd - 1;
1125 }
1126 #  endif
1127 # endif
1128
1129 # ifndef yytnamerr
1130 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1131    quotes and backslashes, so that it's suitable for yyerror.  The
1132    heuristic is that double-quoting is unnecessary unless the string
1133    contains an apostrophe, a comma, or backslash (other than
1134    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1135    null, do not copy; instead, return the length of what the result
1136    would have been.  */
1137 static YYSIZE_T
1138 yytnamerr (char *yyres, const char *yystr)
1139 {
1140   if (*yystr == '"')
1141     {
1142       YYSIZE_T yyn = 0;
1143       char const *yyp = yystr;
1144
1145       for (;;)
1146         switch (*++yyp)
1147           {
1148           case '\'':
1149           case ',':
1150             goto do_not_strip_quotes;
1151
1152           case '\\':
1153             if (*++yyp != '\\')
1154               goto do_not_strip_quotes;
1155             /* Fall through.  */
1156           default:
1157             if (yyres)
1158               yyres[yyn] = *yyp;
1159             yyn++;
1160             break;
1161
1162           case '"':
1163             if (yyres)
1164               yyres[yyn] = '\0';
1165             return yyn;
1166           }
1167     do_not_strip_quotes: ;
1168     }
1169
1170   if (! yyres)
1171     return yystrlen (yystr);
1172
1173   return yystpcpy (yyres, yystr) - yyres;
1174 }
1175 # endif
1176
1177 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1178    about the unexpected token YYTOKEN for the state stack whose top is
1179    YYSSP.
1180
1181    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1182    not large enough to hold the message.  In that case, also set
1183    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1184    required number of bytes is too large to store.  */
1185 static int
1186 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1187                 yytype_int16 *yyssp, int yytoken)
1188 {
1189   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1190   YYSIZE_T yysize = yysize0;
1191   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1192   /* Internationalized format string. */
1193   const char *yyformat = YY_NULLPTR;
1194   /* Arguments of yyformat. */
1195   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1196   /* Number of reported tokens (one for the "unexpected", one per
1197      "expected"). */
1198   int yycount = 0;
1199
1200   /* There are many possibilities here to consider:
1201      - If this state is a consistent state with a default action, then
1202        the only way this function was invoked is if the default action
1203        is an error action.  In that case, don't check for expected
1204        tokens because there are none.
1205      - The only way there can be no lookahead present (in yychar) is if
1206        this state is a consistent state with a default action.  Thus,
1207        detecting the absence of a lookahead is sufficient to determine
1208        that there is no unexpected or expected token to report.  In that
1209        case, just report a simple "syntax error".
1210      - Don't assume there isn't a lookahead just because this state is a
1211        consistent state with a default action.  There might have been a
1212        previous inconsistent state, consistent state with a non-default
1213        action, or user semantic action that manipulated yychar.
1214      - Of course, the expected token list depends on states to have
1215        correct lookahead information, and it depends on the parser not
1216        to perform extra reductions after fetching a lookahead from the
1217        scanner and before detecting a syntax error.  Thus, state merging
1218        (from LALR or IELR) and default reductions corrupt the expected
1219        token list.  However, the list is correct for canonical LR with
1220        one exception: it will still contain any token that will not be
1221        accepted due to an error action in a later state.
1222   */
1223   if (yytoken != YYEMPTY)
1224     {
1225       int yyn = yypact[*yyssp];
1226       yyarg[yycount++] = yytname[yytoken];
1227       if (!yypact_value_is_default (yyn))
1228         {
1229           /* Start YYX at -YYN if negative to avoid negative indexes in
1230              YYCHECK.  In other words, skip the first -YYN actions for
1231              this state because they are default actions.  */
1232           int yyxbegin = yyn < 0 ? -yyn : 0;
1233           /* Stay within bounds of both yycheck and yytname.  */
1234           int yychecklim = YYLAST - yyn + 1;
1235           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1236           int yyx;
1237
1238           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1239             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1240                 && !yytable_value_is_error (yytable[yyx + yyn]))
1241               {
1242                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1243                   {
1244                     yycount = 1;
1245                     yysize = yysize0;
1246                     break;
1247                   }
1248                 yyarg[yycount++] = yytname[yyx];
1249                 {
1250                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1251                   if (! (yysize <= yysize1
1252                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1253                     return 2;
1254                   yysize = yysize1;
1255                 }
1256               }
1257         }
1258     }
1259
1260   switch (yycount)
1261     {
1262 # define YYCASE_(N, S)                      \
1263       case N:                               \
1264         yyformat = S;                       \
1265       break
1266       YYCASE_(0, YY_("syntax error"));
1267       YYCASE_(1, YY_("syntax error, unexpected %s"));
1268       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1269       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1270       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1271       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1272 # undef YYCASE_
1273     }
1274
1275   {
1276     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1277     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1278       return 2;
1279     yysize = yysize1;
1280   }
1281
1282   if (*yymsg_alloc < yysize)
1283     {
1284       *yymsg_alloc = 2 * yysize;
1285       if (! (yysize <= *yymsg_alloc
1286              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1287         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1288       return 1;
1289     }
1290
1291   /* Avoid sprintf, as that infringes on the user's name space.
1292      Don't have undefined behavior even if the translation
1293      produced a string with the wrong number of "%s"s.  */
1294   {
1295     char *yyp = *yymsg;
1296     int yyi = 0;
1297     while ((*yyp = *yyformat) != '\0')
1298       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1299         {
1300           yyp += yytnamerr (yyp, yyarg[yyi++]);
1301           yyformat += 2;
1302         }
1303       else
1304         {
1305           yyp++;
1306           yyformat++;
1307         }
1308   }
1309   return 0;
1310 }
1311 #endif /* YYERROR_VERBOSE */
1312
1313 /*-----------------------------------------------.
1314 | Release the memory associated to this symbol.  |
1315 `-----------------------------------------------*/
1316
1317 static void
1318 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1319 {
1320   YYUSE (yyvaluep);
1321   if (!yymsg)
1322     yymsg = "Deleting";
1323   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1324
1325   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1326   YYUSE (yytype);
1327   YY_IGNORE_MAYBE_UNINITIALIZED_END
1328 }
1329
1330
1331
1332
1333 /* The lookahead symbol.  */
1334 int yychar;
1335
1336 /* The semantic value of the lookahead symbol.  */
1337 YYSTYPE yylval;
1338 /* Number of syntax errors so far.  */
1339 int yynerrs;
1340
1341
1342 /*----------.
1343 | yyparse.  |
1344 `----------*/
1345
1346 int
1347 yyparse (void)
1348 {
1349     int yystate;
1350     /* Number of tokens to shift before error messages enabled.  */
1351     int yyerrstatus;
1352
1353     /* The stacks and their tools:
1354        'yyss': related to states.
1355        'yyvs': related to semantic values.
1356
1357        Refer to the stacks through separate pointers, to allow yyoverflow
1358        to xreallocate them elsewhere.  */
1359
1360     /* The state stack.  */
1361     yytype_int16 yyssa[YYINITDEPTH];
1362     yytype_int16 *yyss;
1363     yytype_int16 *yyssp;
1364
1365     /* The semantic value stack.  */
1366     YYSTYPE yyvsa[YYINITDEPTH];
1367     YYSTYPE *yyvs;
1368     YYSTYPE *yyvsp;
1369
1370     YYSIZE_T yystacksize;
1371
1372   int yyn;
1373   int yyresult;
1374   /* Lookahead token as an internal (translated) token number.  */
1375   int yytoken = 0;
1376   /* The variables used to return semantic value and location from the
1377      action routines.  */
1378   YYSTYPE yyval;
1379
1380 #if YYERROR_VERBOSE
1381   /* Buffer for error messages, and its allocated size.  */
1382   char yymsgbuf[128];
1383   char *yymsg = yymsgbuf;
1384   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1385 #endif
1386
1387 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1388
1389   /* The number of symbols on the RHS of the reduced rule.
1390      Keep to zero when no symbol should be popped.  */
1391   int yylen = 0;
1392
1393   yyssp = yyss = yyssa;
1394   yyvsp = yyvs = yyvsa;
1395   yystacksize = YYINITDEPTH;
1396
1397   YYDPRINTF ((stderr, "Starting parse\n"));
1398
1399   yystate = 0;
1400   yyerrstatus = 0;
1401   yynerrs = 0;
1402   yychar = YYEMPTY; /* Cause a token to be read.  */
1403   goto yysetstate;
1404
1405 /*------------------------------------------------------------.
1406 | yynewstate -- Push a new state, which is found in yystate.  |
1407 `------------------------------------------------------------*/
1408  yynewstate:
1409   /* In all cases, when you get here, the value and location stacks
1410      have just been pushed.  So pushing a state here evens the stacks.  */
1411   yyssp++;
1412
1413  yysetstate:
1414   *yyssp = yystate;
1415
1416   if (yyss + yystacksize - 1 <= yyssp)
1417     {
1418       /* Get the current used size of the three stacks, in elements.  */
1419       YYSIZE_T yysize = yyssp - yyss + 1;
1420
1421 #ifdef yyoverflow
1422       {
1423         /* Give user a chance to xreallocate the stack.  Use copies of
1424            these so that the &'s don't force the real ones into
1425            memory.  */
1426         YYSTYPE *yyvs1 = yyvs;
1427         yytype_int16 *yyss1 = yyss;
1428
1429         /* Each stack pointer address is followed by the size of the
1430            data in use in that stack, in bytes.  This used to be a
1431            conditional around just the two extra args, but that might
1432            be undefined if yyoverflow is a macro.  */
1433         yyoverflow (YY_("memory exhausted"),
1434                     &yyss1, yysize * sizeof (*yyssp),
1435                     &yyvs1, yysize * sizeof (*yyvsp),
1436                     &yystacksize);
1437
1438         yyss = yyss1;
1439         yyvs = yyvs1;
1440       }
1441 #else /* no yyoverflow */
1442 # ifndef YYSTACK_RELOCATE
1443       goto yyexhaustedlab;
1444 # else
1445       /* Extend the stack our own way.  */
1446       if (YYMAXDEPTH <= yystacksize)
1447         goto yyexhaustedlab;
1448       yystacksize *= 2;
1449       if (YYMAXDEPTH < yystacksize)
1450         yystacksize = YYMAXDEPTH;
1451
1452       {
1453         yytype_int16 *yyss1 = yyss;
1454         union yyalloc *yyptr =
1455           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1456         if (! yyptr)
1457           goto yyexhaustedlab;
1458         YYSTACK_RELOCATE (yyss_alloc, yyss);
1459         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1460 #  undef YYSTACK_RELOCATE
1461         if (yyss1 != yyssa)
1462           YYSTACK_FREE (yyss1);
1463       }
1464 # endif
1465 #endif /* no yyoverflow */
1466
1467       yyssp = yyss + yysize - 1;
1468       yyvsp = yyvs + yysize - 1;
1469
1470       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1471                   (unsigned long int) yystacksize));
1472
1473       if (yyss + yystacksize - 1 <= yyssp)
1474         YYABORT;
1475     }
1476
1477   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1478
1479   if (yystate == YYFINAL)
1480     YYACCEPT;
1481
1482   goto yybackup;
1483
1484 /*-----------.
1485 | yybackup.  |
1486 `-----------*/
1487 yybackup:
1488
1489   /* Do appropriate processing given the current state.  Read a
1490      lookahead token if we need one and don't already have one.  */
1491
1492   /* First try to decide what to do without reference to lookahead token.  */
1493   yyn = yypact[yystate];
1494   if (yypact_value_is_default (yyn))
1495     goto yydefault;
1496
1497   /* Not known => get a lookahead token if don't already have one.  */
1498
1499   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1500   if (yychar == YYEMPTY)
1501     {
1502       YYDPRINTF ((stderr, "Reading a token: "));
1503       yychar = yylex ();
1504     }
1505
1506   if (yychar <= YYEOF)
1507     {
1508       yychar = yytoken = YYEOF;
1509       YYDPRINTF ((stderr, "Now at end of input.\n"));
1510     }
1511   else
1512     {
1513       yytoken = YYTRANSLATE (yychar);
1514       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1515     }
1516
1517   /* If the proper action on seeing token YYTOKEN is to reduce or to
1518      detect an error, take that action.  */
1519   yyn += yytoken;
1520   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1521     goto yydefault;
1522   yyn = yytable[yyn];
1523   if (yyn <= 0)
1524     {
1525       if (yytable_value_is_error (yyn))
1526         goto yyerrlab;
1527       yyn = -yyn;
1528       goto yyreduce;
1529     }
1530
1531   /* Count tokens shifted since error; after three, turn off error
1532      status.  */
1533   if (yyerrstatus)
1534     yyerrstatus--;
1535
1536   /* Shift the lookahead token.  */
1537   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1538
1539   /* Discard the shifted token.  */
1540   yychar = YYEMPTY;
1541
1542   yystate = yyn;
1543   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1544   *++yyvsp = yylval;
1545   YY_IGNORE_MAYBE_UNINITIALIZED_END
1546
1547   goto yynewstate;
1548
1549
1550 /*-----------------------------------------------------------.
1551 | yydefault -- do the default action for the current state.  |
1552 `-----------------------------------------------------------*/
1553 yydefault:
1554   yyn = yydefact[yystate];
1555   if (yyn == 0)
1556     goto yyerrlab;
1557   goto yyreduce;
1558
1559
1560 /*-----------------------------.
1561 | yyreduce -- Do a reduction.  |
1562 `-----------------------------*/
1563 yyreduce:
1564   /* yyn is the number of a rule to reduce with.  */
1565   yylen = yyr2[yyn];
1566
1567   /* If YYLEN is nonzero, implement the default value of the action:
1568      '$$ = $1'.
1569
1570      Otherwise, the following line sets YYVAL to garbage.
1571      This behavior is undocumented and Bison
1572      users should not rely upon it.  Assigning to YYVAL
1573      unconditionally makes the parser a bit smaller, and it avoids a
1574      GCC warning that YYVAL may be used uninitialized.  */
1575   yyval = yyvsp[1-yylen];
1576
1577
1578   YY_REDUCE_PRINT (yyn);
1579   switch (yyn)
1580     {
1581         case 4:
1582 #line 222 "jv-exp.y" /* yacc.c:1646  */
1583     {
1584                   write_exp_elt_opcode (pstate, OP_TYPE);
1585                   write_exp_elt_type (pstate, (yyvsp[0].tval));
1586                   write_exp_elt_opcode (pstate, OP_TYPE);
1587                 }
1588 #line 1590 "jv-exp.c" /* yacc.c:1646  */
1589     break;
1590
1591   case 7:
1592 #line 236 "jv-exp.y" /* yacc.c:1646  */
1593     {
1594                   write_exp_elt_opcode (pstate, OP_STRING);
1595                   write_exp_string (pstate, (yyvsp[0].sval));
1596                   write_exp_elt_opcode (pstate, OP_STRING);
1597                 }
1598 #line 1600 "jv-exp.c" /* yacc.c:1646  */
1599     break;
1600
1601   case 8:
1602 #line 245 "jv-exp.y" /* yacc.c:1646  */
1603     { write_exp_elt_opcode (pstate, OP_LONG);
1604                   write_exp_elt_type (pstate, (yyvsp[0].typed_val_int).type);
1605                   write_exp_elt_longcst (pstate, (LONGEST)((yyvsp[0].typed_val_int).val));
1606                   write_exp_elt_opcode (pstate, OP_LONG); }
1607 #line 1609 "jv-exp.c" /* yacc.c:1646  */
1608     break;
1609
1610   case 9:
1611 #line 250 "jv-exp.y" /* yacc.c:1646  */
1612     { YYSTYPE val;
1613                   parse_number (pstate, (yyvsp[0].sval).ptr, (yyvsp[0].sval).length, 0, &val);
1614                   write_exp_elt_opcode (pstate, OP_LONG);
1615                   write_exp_elt_type (pstate, val.typed_val_int.type);
1616                   write_exp_elt_longcst (pstate,
1617                                          (LONGEST) val.typed_val_int.val);
1618                   write_exp_elt_opcode (pstate, OP_LONG);
1619                 }
1620 #line 1622 "jv-exp.c" /* yacc.c:1646  */
1621     break;
1622
1623   case 10:
1624 #line 259 "jv-exp.y" /* yacc.c:1646  */
1625     { write_exp_elt_opcode (pstate, OP_DOUBLE);
1626                   write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type);
1627                   write_exp_elt_dblcst (pstate, (yyvsp[0].typed_val_float).dval);
1628                   write_exp_elt_opcode (pstate, OP_DOUBLE); }
1629 #line 1631 "jv-exp.c" /* yacc.c:1646  */
1630     break;
1631
1632   case 11:
1633 #line 264 "jv-exp.y" /* yacc.c:1646  */
1634     { write_exp_elt_opcode (pstate, OP_LONG);
1635                   write_exp_elt_type (pstate,
1636                                   parse_java_type (pstate)->builtin_boolean);
1637                   write_exp_elt_longcst (pstate, (LONGEST)(yyvsp[0].lval));
1638                   write_exp_elt_opcode (pstate, OP_LONG); }
1639 #line 1641 "jv-exp.c" /* yacc.c:1646  */
1640     break;
1641
1642   case 14:
1643 #line 282 "jv-exp.y" /* yacc.c:1646  */
1644     { (yyval.tval) = parse_java_type (pstate)->builtin_boolean; }
1645 #line 1647 "jv-exp.c" /* yacc.c:1646  */
1646     break;
1647
1648   case 17:
1649 #line 292 "jv-exp.y" /* yacc.c:1646  */
1650     { (yyval.tval) = parse_java_type (pstate)->builtin_byte; }
1651 #line 1653 "jv-exp.c" /* yacc.c:1646  */
1652     break;
1653
1654   case 18:
1655 #line 294 "jv-exp.y" /* yacc.c:1646  */
1656     { (yyval.tval) = parse_java_type (pstate)->builtin_short; }
1657 #line 1659 "jv-exp.c" /* yacc.c:1646  */
1658     break;
1659
1660   case 19:
1661 #line 296 "jv-exp.y" /* yacc.c:1646  */
1662     { (yyval.tval) = parse_java_type (pstate)->builtin_int; }
1663 #line 1665 "jv-exp.c" /* yacc.c:1646  */
1664     break;
1665
1666   case 20:
1667 #line 298 "jv-exp.y" /* yacc.c:1646  */
1668     { (yyval.tval) = parse_java_type (pstate)->builtin_long; }
1669 #line 1671 "jv-exp.c" /* yacc.c:1646  */
1670     break;
1671
1672   case 21:
1673 #line 300 "jv-exp.y" /* yacc.c:1646  */
1674     { (yyval.tval) = parse_java_type (pstate)->builtin_char; }
1675 #line 1677 "jv-exp.c" /* yacc.c:1646  */
1676     break;
1677
1678   case 22:
1679 #line 305 "jv-exp.y" /* yacc.c:1646  */
1680     { (yyval.tval) = parse_java_type (pstate)->builtin_float; }
1681 #line 1683 "jv-exp.c" /* yacc.c:1646  */
1682     break;
1683
1684   case 23:
1685 #line 307 "jv-exp.y" /* yacc.c:1646  */
1686     { (yyval.tval) = parse_java_type (pstate)->builtin_double; }
1687 #line 1689 "jv-exp.c" /* yacc.c:1646  */
1688     break;
1689
1690   case 24:
1691 #line 319 "jv-exp.y" /* yacc.c:1646  */
1692     { (yyval.tval) = java_type_from_name ((yyvsp[0].sval)); }
1693 #line 1695 "jv-exp.c" /* yacc.c:1646  */
1694     break;
1695
1696   case 26:
1697 #line 328 "jv-exp.y" /* yacc.c:1646  */
1698     { (yyval.tval) = java_array_type ((yyvsp[-1].tval), (yyvsp[0].lval)); }
1699 #line 1701 "jv-exp.c" /* yacc.c:1646  */
1700     break;
1701
1702   case 27:
1703 #line 330 "jv-exp.y" /* yacc.c:1646  */
1704     { (yyval.tval) = java_array_type (java_type_from_name ((yyvsp[-1].sval)), (yyvsp[0].lval)); }
1705 #line 1707 "jv-exp.c" /* yacc.c:1646  */
1706     break;
1707
1708   case 34:
1709 #line 350 "jv-exp.y" /* yacc.c:1646  */
1710     { (yyval.sval).length = (yyvsp[-2].sval).length + (yyvsp[0].sval).length + 1;
1711                   if ((yyvsp[-2].sval).ptr + (yyvsp[-2].sval).length + 1 == (yyvsp[0].sval).ptr
1712                       && (yyvsp[-2].sval).ptr[(yyvsp[-2].sval).length] == '.')
1713                     (yyval.sval).ptr = (yyvsp[-2].sval).ptr;  /* Optimization.  */
1714                   else
1715                     {
1716                       char *buf;
1717
1718                       buf = xmalloc ((yyval.sval).length + 1);
1719                       make_cleanup (xfree, buf);
1720                       sprintf (buf, "%.*s.%.*s",
1721                                (yyvsp[-2].sval).length, (yyvsp[-2].sval).ptr, (yyvsp[0].sval).length, (yyvsp[0].sval).ptr);
1722                       (yyval.sval).ptr = buf;
1723                 } }
1724 #line 1726 "jv-exp.c" /* yacc.c:1646  */
1725     break;
1726
1727   case 36:
1728 #line 377 "jv-exp.y" /* yacc.c:1646  */
1729     { write_exp_elt_opcode (pstate, BINOP_COMMA); }
1730 #line 1732 "jv-exp.c" /* yacc.c:1646  */
1731     break;
1732
1733   case 45:
1734 #line 393 "jv-exp.y" /* yacc.c:1646  */
1735     { write_exp_elt_opcode (pstate, OP_ARRAY);
1736                   write_exp_elt_longcst (pstate, (LONGEST) 0);
1737                   write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval));
1738                   write_exp_elt_opcode (pstate, OP_ARRAY); }
1739 #line 1741 "jv-exp.c" /* yacc.c:1646  */
1740     break;
1741
1742   case 46:
1743 #line 401 "jv-exp.y" /* yacc.c:1646  */
1744     { start_arglist (); }
1745 #line 1747 "jv-exp.c" /* yacc.c:1646  */
1746     break;
1747
1748   case 47:
1749 #line 406 "jv-exp.y" /* yacc.c:1646  */
1750     { (yyval.lval) = end_arglist () - 1; }
1751 #line 1753 "jv-exp.c" /* yacc.c:1646  */
1752     break;
1753
1754   case 48:
1755 #line 411 "jv-exp.y" /* yacc.c:1646  */
1756     { internal_error (__FILE__, __LINE__,
1757                                   _("FIXME - ClassInstanceCreationExpression")); }
1758 #line 1760 "jv-exp.c" /* yacc.c:1646  */
1759     break;
1760
1761   case 49:
1762 #line 417 "jv-exp.y" /* yacc.c:1646  */
1763     { arglist_len = 1; }
1764 #line 1766 "jv-exp.c" /* yacc.c:1646  */
1765     break;
1766
1767   case 50:
1768 #line 419 "jv-exp.y" /* yacc.c:1646  */
1769     { arglist_len++; }
1770 #line 1772 "jv-exp.c" /* yacc.c:1646  */
1771     break;
1772
1773   case 51:
1774 #line 424 "jv-exp.y" /* yacc.c:1646  */
1775     { arglist_len = 0; }
1776 #line 1778 "jv-exp.c" /* yacc.c:1646  */
1777     break;
1778
1779   case 53:
1780 #line 430 "jv-exp.y" /* yacc.c:1646  */
1781     { internal_error (__FILE__, __LINE__,
1782                                   _("FIXME - ArrayCreationExpression")); }
1783 #line 1785 "jv-exp.c" /* yacc.c:1646  */
1784     break;
1785
1786   case 54:
1787 #line 433 "jv-exp.y" /* yacc.c:1646  */
1788     { internal_error (__FILE__, __LINE__,
1789                                   _("FIXME - ArrayCreationExpression")); }
1790 #line 1792 "jv-exp.c" /* yacc.c:1646  */
1791     break;
1792
1793   case 58:
1794 #line 448 "jv-exp.y" /* yacc.c:1646  */
1795     { (yyval.lval) = 1; }
1796 #line 1798 "jv-exp.c" /* yacc.c:1646  */
1797     break;
1798
1799   case 59:
1800 #line 450 "jv-exp.y" /* yacc.c:1646  */
1801     { (yyval.lval) = (yyvsp[-2].lval) + 1; }
1802 #line 1804 "jv-exp.c" /* yacc.c:1646  */
1803     break;
1804
1805   case 61:
1806 #line 456 "jv-exp.y" /* yacc.c:1646  */
1807     { (yyval.lval) = 0; }
1808 #line 1810 "jv-exp.c" /* yacc.c:1646  */
1809     break;
1810
1811   case 62:
1812 #line 461 "jv-exp.y" /* yacc.c:1646  */
1813     { push_fieldnames (pstate, (yyvsp[0].sval)); }
1814 #line 1816 "jv-exp.c" /* yacc.c:1646  */
1815     break;
1816
1817   case 63:
1818 #line 463 "jv-exp.y" /* yacc.c:1646  */
1819     { push_fieldnames (pstate, (yyvsp[0].sval)); }
1820 #line 1822 "jv-exp.c" /* yacc.c:1646  */
1821     break;
1822
1823   case 64:
1824 #line 469 "jv-exp.y" /* yacc.c:1646  */
1825     { push_expression_name (pstate, (yyvsp[-1].sval)); }
1826 #line 1828 "jv-exp.c" /* yacc.c:1646  */
1827     break;
1828
1829   case 65:
1830 #line 474 "jv-exp.y" /* yacc.c:1646  */
1831     { start_arglist(); }
1832 #line 1834 "jv-exp.c" /* yacc.c:1646  */
1833     break;
1834
1835   case 66:
1836 #line 476 "jv-exp.y" /* yacc.c:1646  */
1837     { write_exp_elt_opcode (pstate, OP_FUNCALL);
1838                   write_exp_elt_longcst (pstate, (LONGEST) end_arglist ());
1839                   write_exp_elt_opcode (pstate, OP_FUNCALL); }
1840 #line 1842 "jv-exp.c" /* yacc.c:1646  */
1841     break;
1842
1843   case 67:
1844 #line 480 "jv-exp.y" /* yacc.c:1646  */
1845     { error (_("Form of method invocation not implemented")); }
1846 #line 1848 "jv-exp.c" /* yacc.c:1646  */
1847     break;
1848
1849   case 68:
1850 #line 482 "jv-exp.y" /* yacc.c:1646  */
1851     { error (_("Form of method invocation not implemented")); }
1852 #line 1854 "jv-exp.c" /* yacc.c:1646  */
1853     break;
1854
1855   case 69:
1856 #line 487 "jv-exp.y" /* yacc.c:1646  */
1857     {
1858                   /* Emit code for the Name now, then exchange it in the
1859                      expout array with the Expression's code.  We could
1860                      introduce a OP_SWAP code or a reversed version of
1861                      BINOP_SUBSCRIPT, but that makes the rest of GDB pay
1862                      for our parsing kludges.  */
1863                   struct expression *name_expr;
1864
1865                   push_expression_name (pstate, (yyvsp[-3].sval));
1866                   name_expr = copy_exp (pstate->expout, pstate->expout_ptr);
1867                   pstate->expout_ptr -= name_expr->nelts;
1868                   insert_exp (pstate,
1869                               pstate->expout_ptr
1870                               - length_of_subexp (pstate->expout,
1871                                                   pstate->expout_ptr),
1872                               name_expr);
1873                   xfree (name_expr);
1874                   write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT);
1875                 }
1876 #line 1878 "jv-exp.c" /* yacc.c:1646  */
1877     break;
1878
1879   case 70:
1880 #line 507 "jv-exp.y" /* yacc.c:1646  */
1881     { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
1882 #line 1884 "jv-exp.c" /* yacc.c:1646  */
1883     break;
1884
1885   case 71:
1886 #line 509 "jv-exp.y" /* yacc.c:1646  */
1887     { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
1888 #line 1890 "jv-exp.c" /* yacc.c:1646  */
1889     break;
1890
1891   case 73:
1892 #line 515 "jv-exp.y" /* yacc.c:1646  */
1893     { push_expression_name (pstate, (yyvsp[0].sval)); }
1894 #line 1896 "jv-exp.c" /* yacc.c:1646  */
1895     break;
1896
1897   case 77:
1898 #line 524 "jv-exp.y" /* yacc.c:1646  */
1899     { write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); }
1900 #line 1902 "jv-exp.c" /* yacc.c:1646  */
1901     break;
1902
1903   case 78:
1904 #line 529 "jv-exp.y" /* yacc.c:1646  */
1905     { write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); }
1906 #line 1908 "jv-exp.c" /* yacc.c:1646  */
1907     break;
1908
1909   case 82:
1910 #line 537 "jv-exp.y" /* yacc.c:1646  */
1911     { write_exp_elt_opcode (pstate, UNOP_NEG); }
1912 #line 1914 "jv-exp.c" /* yacc.c:1646  */
1913     break;
1914
1915   case 83:
1916 #line 539 "jv-exp.y" /* yacc.c:1646  */
1917     { write_exp_elt_opcode (pstate,
1918                                         UNOP_IND); }
1919 #line 1921 "jv-exp.c" /* yacc.c:1646  */
1920     break;
1921
1922   case 85:
1923 #line 546 "jv-exp.y" /* yacc.c:1646  */
1924     { write_exp_elt_opcode (pstate, UNOP_PREINCREMENT); }
1925 #line 1927 "jv-exp.c" /* yacc.c:1646  */
1926     break;
1927
1928   case 86:
1929 #line 551 "jv-exp.y" /* yacc.c:1646  */
1930     { write_exp_elt_opcode (pstate, UNOP_PREDECREMENT); }
1931 #line 1933 "jv-exp.c" /* yacc.c:1646  */
1932     break;
1933
1934   case 88:
1935 #line 557 "jv-exp.y" /* yacc.c:1646  */
1936     { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
1937 #line 1939 "jv-exp.c" /* yacc.c:1646  */
1938     break;
1939
1940   case 89:
1941 #line 559 "jv-exp.y" /* yacc.c:1646  */
1942     { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
1943 #line 1945 "jv-exp.c" /* yacc.c:1646  */
1944     break;
1945
1946   case 91:
1947 #line 565 "jv-exp.y" /* yacc.c:1646  */
1948     { write_exp_elt_opcode (pstate, UNOP_CAST);
1949                   write_exp_elt_type (pstate, java_array_type ((yyvsp[-3].tval), (yyvsp[-2].lval)));
1950                   write_exp_elt_opcode (pstate, UNOP_CAST); }
1951 #line 1953 "jv-exp.c" /* yacc.c:1646  */
1952     break;
1953
1954   case 92:
1955 #line 569 "jv-exp.y" /* yacc.c:1646  */
1956     {
1957                   int last_exp_size = length_of_subexp (pstate->expout,
1958                                                         pstate->expout_ptr);
1959                   struct type *type;
1960                   int i;
1961                   int base = pstate->expout_ptr - last_exp_size - 3;
1962
1963                   if (base < 0
1964                       || pstate->expout->elts[base+2].opcode != OP_TYPE)
1965                     error (_("Invalid cast expression"));
1966                   type = pstate->expout->elts[base+1].type;
1967                   /* Remove the 'Expression' and slide the
1968                      UnaryExpressionNotPlusMinus down to replace it.  */
1969                   for (i = 0;  i < last_exp_size;  i++)
1970                     pstate->expout->elts[base + i]
1971                       = pstate->expout->elts[base + i + 3];
1972                   pstate->expout_ptr -= 3;
1973                   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
1974                     type = lookup_pointer_type (type);
1975                   write_exp_elt_opcode (pstate, UNOP_CAST);
1976                   write_exp_elt_type (pstate, type);
1977                   write_exp_elt_opcode (pstate, UNOP_CAST);
1978                 }
1979 #line 1981 "jv-exp.c" /* yacc.c:1646  */
1980     break;
1981
1982   case 93:
1983 #line 593 "jv-exp.y" /* yacc.c:1646  */
1984     { write_exp_elt_opcode (pstate, UNOP_CAST);
1985                   write_exp_elt_type (pstate,
1986                                       java_array_type (java_type_from_name
1987                                                        ((yyvsp[-3].sval)), (yyvsp[-2].lval)));
1988                   write_exp_elt_opcode (pstate, UNOP_CAST); }
1989 #line 1991 "jv-exp.c" /* yacc.c:1646  */
1990     break;
1991
1992   case 95:
1993 #line 604 "jv-exp.y" /* yacc.c:1646  */
1994     { write_exp_elt_opcode (pstate, BINOP_MUL); }
1995 #line 1997 "jv-exp.c" /* yacc.c:1646  */
1996     break;
1997
1998   case 96:
1999 #line 606 "jv-exp.y" /* yacc.c:1646  */
2000     { write_exp_elt_opcode (pstate, BINOP_DIV); }
2001 #line 2003 "jv-exp.c" /* yacc.c:1646  */
2002     break;
2003
2004   case 97:
2005 #line 608 "jv-exp.y" /* yacc.c:1646  */
2006     { write_exp_elt_opcode (pstate, BINOP_REM); }
2007 #line 2009 "jv-exp.c" /* yacc.c:1646  */
2008     break;
2009
2010   case 99:
2011 #line 614 "jv-exp.y" /* yacc.c:1646  */
2012     { write_exp_elt_opcode (pstate, BINOP_ADD); }
2013 #line 2015 "jv-exp.c" /* yacc.c:1646  */
2014     break;
2015
2016   case 100:
2017 #line 616 "jv-exp.y" /* yacc.c:1646  */
2018     { write_exp_elt_opcode (pstate, BINOP_SUB); }
2019 #line 2021 "jv-exp.c" /* yacc.c:1646  */
2020     break;
2021
2022   case 102:
2023 #line 622 "jv-exp.y" /* yacc.c:1646  */
2024     { write_exp_elt_opcode (pstate, BINOP_LSH); }
2025 #line 2027 "jv-exp.c" /* yacc.c:1646  */
2026     break;
2027
2028   case 103:
2029 #line 624 "jv-exp.y" /* yacc.c:1646  */
2030     { write_exp_elt_opcode (pstate, BINOP_RSH); }
2031 #line 2033 "jv-exp.c" /* yacc.c:1646  */
2032     break;
2033
2034   case 105:
2035 #line 631 "jv-exp.y" /* yacc.c:1646  */
2036     { write_exp_elt_opcode (pstate, BINOP_LESS); }
2037 #line 2039 "jv-exp.c" /* yacc.c:1646  */
2038     break;
2039
2040   case 106:
2041 #line 633 "jv-exp.y" /* yacc.c:1646  */
2042     { write_exp_elt_opcode (pstate, BINOP_GTR); }
2043 #line 2045 "jv-exp.c" /* yacc.c:1646  */
2044     break;
2045
2046   case 107:
2047 #line 635 "jv-exp.y" /* yacc.c:1646  */
2048     { write_exp_elt_opcode (pstate, BINOP_LEQ); }
2049 #line 2051 "jv-exp.c" /* yacc.c:1646  */
2050     break;
2051
2052   case 108:
2053 #line 637 "jv-exp.y" /* yacc.c:1646  */
2054     { write_exp_elt_opcode (pstate, BINOP_GEQ); }
2055 #line 2057 "jv-exp.c" /* yacc.c:1646  */
2056     break;
2057
2058   case 110:
2059 #line 644 "jv-exp.y" /* yacc.c:1646  */
2060     { write_exp_elt_opcode (pstate, BINOP_EQUAL); }
2061 #line 2063 "jv-exp.c" /* yacc.c:1646  */
2062     break;
2063
2064   case 111:
2065 #line 646 "jv-exp.y" /* yacc.c:1646  */
2066     { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
2067 #line 2069 "jv-exp.c" /* yacc.c:1646  */
2068     break;
2069
2070   case 113:
2071 #line 652 "jv-exp.y" /* yacc.c:1646  */
2072     { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
2073 #line 2075 "jv-exp.c" /* yacc.c:1646  */
2074     break;
2075
2076   case 115:
2077 #line 658 "jv-exp.y" /* yacc.c:1646  */
2078     { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
2079 #line 2081 "jv-exp.c" /* yacc.c:1646  */
2080     break;
2081
2082   case 117:
2083 #line 663 "jv-exp.y" /* yacc.c:1646  */
2084     { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
2085 #line 2087 "jv-exp.c" /* yacc.c:1646  */
2086     break;
2087
2088   case 119:
2089 #line 669 "jv-exp.y" /* yacc.c:1646  */
2090     { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
2091 #line 2093 "jv-exp.c" /* yacc.c:1646  */
2092     break;
2093
2094   case 121:
2095 #line 675 "jv-exp.y" /* yacc.c:1646  */
2096     { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
2097 #line 2099 "jv-exp.c" /* yacc.c:1646  */
2098     break;
2099
2100   case 123:
2101 #line 681 "jv-exp.y" /* yacc.c:1646  */
2102     { write_exp_elt_opcode (pstate, TERNOP_COND); }
2103 #line 2105 "jv-exp.c" /* yacc.c:1646  */
2104     break;
2105
2106   case 126:
2107 #line 691 "jv-exp.y" /* yacc.c:1646  */
2108     { write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
2109 #line 2111 "jv-exp.c" /* yacc.c:1646  */
2110     break;
2111
2112   case 127:
2113 #line 693 "jv-exp.y" /* yacc.c:1646  */
2114     { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
2115                   write_exp_elt_opcode (pstate, (yyvsp[-1].opcode));
2116                   write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
2117 #line 2119 "jv-exp.c" /* yacc.c:1646  */
2118     break;
2119
2120   case 128:
2121 #line 700 "jv-exp.y" /* yacc.c:1646  */
2122     { push_expression_name (pstate, (yyvsp[0].sval)); }
2123 #line 2125 "jv-exp.c" /* yacc.c:1646  */
2124     break;
2125
2126
2127 #line 2129 "jv-exp.c" /* yacc.c:1646  */
2128       default: break;
2129     }
2130   /* User semantic actions sometimes alter yychar, and that requires
2131      that yytoken be updated with the new translation.  We take the
2132      approach of translating immediately before every use of yytoken.
2133      One alternative is translating here after every semantic action,
2134      but that translation would be missed if the semantic action invokes
2135      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2136      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2137      incorrect destructor might then be invoked immediately.  In the
2138      case of YYERROR or YYBACKUP, subsequent parser actions might lead
2139      to an incorrect destructor call or verbose syntax error message
2140      before the lookahead is translated.  */
2141   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2142
2143   YYPOPSTACK (yylen);
2144   yylen = 0;
2145   YY_STACK_PRINT (yyss, yyssp);
2146
2147   *++yyvsp = yyval;
2148
2149   /* Now 'shift' the result of the reduction.  Determine what state
2150      that goes to, based on the state we popped back to and the rule
2151      number reduced by.  */
2152
2153   yyn = yyr1[yyn];
2154
2155   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2156   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2157     yystate = yytable[yystate];
2158   else
2159     yystate = yydefgoto[yyn - YYNTOKENS];
2160
2161   goto yynewstate;
2162
2163
2164 /*--------------------------------------.
2165 | yyerrlab -- here on detecting error.  |
2166 `--------------------------------------*/
2167 yyerrlab:
2168   /* Make sure we have latest lookahead translation.  See comments at
2169      user semantic actions for why this is necessary.  */
2170   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2171
2172   /* If not already recovering from an error, report this error.  */
2173   if (!yyerrstatus)
2174     {
2175       ++yynerrs;
2176 #if ! YYERROR_VERBOSE
2177       yyerror (YY_("syntax error"));
2178 #else
2179 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2180                                         yyssp, yytoken)
2181       {
2182         char const *yymsgp = YY_("syntax error");
2183         int yysyntax_error_status;
2184         yysyntax_error_status = YYSYNTAX_ERROR;
2185         if (yysyntax_error_status == 0)
2186           yymsgp = yymsg;
2187         else if (yysyntax_error_status == 1)
2188           {
2189             if (yymsg != yymsgbuf)
2190               YYSTACK_FREE (yymsg);
2191             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2192             if (!yymsg)
2193               {
2194                 yymsg = yymsgbuf;
2195                 yymsg_alloc = sizeof yymsgbuf;
2196                 yysyntax_error_status = 2;
2197               }
2198             else
2199               {
2200                 yysyntax_error_status = YYSYNTAX_ERROR;
2201                 yymsgp = yymsg;
2202               }
2203           }
2204         yyerror (yymsgp);
2205         if (yysyntax_error_status == 2)
2206           goto yyexhaustedlab;
2207       }
2208 # undef YYSYNTAX_ERROR
2209 #endif
2210     }
2211
2212
2213
2214   if (yyerrstatus == 3)
2215     {
2216       /* If just tried and failed to reuse lookahead token after an
2217          error, discard it.  */
2218
2219       if (yychar <= YYEOF)
2220         {
2221           /* Return failure if at end of input.  */
2222           if (yychar == YYEOF)
2223             YYABORT;
2224         }
2225       else
2226         {
2227           yydestruct ("Error: discarding",
2228                       yytoken, &yylval);
2229           yychar = YYEMPTY;
2230         }
2231     }
2232
2233   /* Else will try to reuse lookahead token after shifting the error
2234      token.  */
2235   goto yyerrlab1;
2236
2237
2238 /*---------------------------------------------------.
2239 | yyerrorlab -- error raised explicitly by YYERROR.  |
2240 `---------------------------------------------------*/
2241 yyerrorlab:
2242
2243   /* Pacify compilers like GCC when the user code never invokes
2244      YYERROR and the label yyerrorlab therefore never appears in user
2245      code.  */
2246   if (/*CONSTCOND*/ 0)
2247      goto yyerrorlab;
2248
2249   /* Do not reclaim the symbols of the rule whose action triggered
2250      this YYERROR.  */
2251   YYPOPSTACK (yylen);
2252   yylen = 0;
2253   YY_STACK_PRINT (yyss, yyssp);
2254   yystate = *yyssp;
2255   goto yyerrlab1;
2256
2257
2258 /*-------------------------------------------------------------.
2259 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2260 `-------------------------------------------------------------*/
2261 yyerrlab1:
2262   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2263
2264   for (;;)
2265     {
2266       yyn = yypact[yystate];
2267       if (!yypact_value_is_default (yyn))
2268         {
2269           yyn += YYTERROR;
2270           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2271             {
2272               yyn = yytable[yyn];
2273               if (0 < yyn)
2274                 break;
2275             }
2276         }
2277
2278       /* Pop the current state because it cannot handle the error token.  */
2279       if (yyssp == yyss)
2280         YYABORT;
2281
2282
2283       yydestruct ("Error: popping",
2284                   yystos[yystate], yyvsp);
2285       YYPOPSTACK (1);
2286       yystate = *yyssp;
2287       YY_STACK_PRINT (yyss, yyssp);
2288     }
2289
2290   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2291   *++yyvsp = yylval;
2292   YY_IGNORE_MAYBE_UNINITIALIZED_END
2293
2294
2295   /* Shift the error token.  */
2296   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2297
2298   yystate = yyn;
2299   goto yynewstate;
2300
2301
2302 /*-------------------------------------.
2303 | yyacceptlab -- YYACCEPT comes here.  |
2304 `-------------------------------------*/
2305 yyacceptlab:
2306   yyresult = 0;
2307   goto yyreturn;
2308
2309 /*-----------------------------------.
2310 | yyabortlab -- YYABORT comes here.  |
2311 `-----------------------------------*/
2312 yyabortlab:
2313   yyresult = 1;
2314   goto yyreturn;
2315
2316 #if !defined yyoverflow || YYERROR_VERBOSE
2317 /*-------------------------------------------------.
2318 | yyexhaustedlab -- memory exhaustion comes here.  |
2319 `-------------------------------------------------*/
2320 yyexhaustedlab:
2321   yyerror (YY_("memory exhausted"));
2322   yyresult = 2;
2323   /* Fall through.  */
2324 #endif
2325
2326 yyreturn:
2327   if (yychar != YYEMPTY)
2328     {
2329       /* Make sure we have latest lookahead translation.  See comments at
2330          user semantic actions for why this is necessary.  */
2331       yytoken = YYTRANSLATE (yychar);
2332       yydestruct ("Cleanup: discarding lookahead",
2333                   yytoken, &yylval);
2334     }
2335   /* Do not reclaim the symbols of the rule whose action triggered
2336      this YYABORT or YYACCEPT.  */
2337   YYPOPSTACK (yylen);
2338   YY_STACK_PRINT (yyss, yyssp);
2339   while (yyssp != yyss)
2340     {
2341       yydestruct ("Cleanup: popping",
2342                   yystos[*yyssp], yyvsp);
2343       YYPOPSTACK (1);
2344     }
2345 #ifndef yyoverflow
2346   if (yyss != yyssa)
2347     YYSTACK_FREE (yyss);
2348 #endif
2349 #if YYERROR_VERBOSE
2350   if (yymsg != yymsgbuf)
2351     YYSTACK_FREE (yymsg);
2352 #endif
2353   return yyresult;
2354 }
2355 #line 712 "jv-exp.y" /* yacc.c:1906  */
2356
2357 /* Take care of parsing a number (anything that starts with a digit).
2358    Set yylval and return the token type; update lexptr.
2359    LEN is the number of characters in it.  */
2360
2361 /*** Needs some error checking for the float case ***/
2362
2363 static int
2364 parse_number (struct parser_state *par_state,
2365               const char *p, int len, int parsed_float, YYSTYPE *putithere)
2366 {
2367   ULONGEST n = 0;
2368   ULONGEST limit, limit_div_base;
2369
2370   int c;
2371   int base = input_radix;
2372
2373   struct type *type;
2374
2375   if (parsed_float)
2376     {
2377       const char *suffix;
2378       int suffix_len;
2379
2380       if (! parse_float (p, len, &putithere->typed_val_float.dval, &suffix))
2381         return ERROR;
2382
2383       suffix_len = p + len - suffix;
2384
2385       if (suffix_len == 0)
2386         putithere->typed_val_float.type
2387           = parse_type (par_state)->builtin_double;
2388       else if (suffix_len == 1)
2389         {
2390           /* See if it has `f' or `d' suffix (float or double).  */
2391           if (tolower (*suffix) == 'f')
2392             putithere->typed_val_float.type =
2393               parse_type (par_state)->builtin_float;
2394           else if (tolower (*suffix) == 'd')
2395             putithere->typed_val_float.type =
2396               parse_type (par_state)->builtin_double;
2397           else
2398             return ERROR;
2399         }
2400       else
2401         return ERROR;
2402
2403       return FLOATING_POINT_LITERAL;
2404     }
2405
2406   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2407   if (p[0] == '0')
2408     switch (p[1])
2409       {
2410       case 'x':
2411       case 'X':
2412         if (len >= 3)
2413           {
2414             p += 2;
2415             base = 16;
2416             len -= 2;
2417           }
2418         break;
2419
2420       case 't':
2421       case 'T':
2422       case 'd':
2423       case 'D':
2424         if (len >= 3)
2425           {
2426             p += 2;
2427             base = 10;
2428             len -= 2;
2429           }
2430         break;
2431
2432       default:
2433         base = 8;
2434         break;
2435       }
2436
2437   c = p[len-1];
2438   /* A paranoid calculation of (1<<64)-1.  */
2439   limit = (ULONGEST)0xffffffff;
2440   limit = ((limit << 16) << 16) | limit;
2441   if (c == 'l' || c == 'L')
2442     {
2443       type = parse_java_type (par_state)->builtin_long;
2444       len--;
2445     }
2446   else
2447     {
2448       type = parse_java_type (par_state)->builtin_int;
2449     }
2450   limit_div_base = limit / (ULONGEST) base;
2451
2452   while (--len >= 0)
2453     {
2454       c = *p++;
2455       if (c >= '0' && c <= '9')
2456         c -= '0';
2457       else if (c >= 'A' && c <= 'Z')
2458         c -= 'A' - 10;
2459       else if (c >= 'a' && c <= 'z')
2460         c -= 'a' - 10;
2461       else
2462         return ERROR;   /* Char not a digit */
2463       if (c >= base)
2464         return ERROR;
2465       if (n > limit_div_base
2466           || (n *= base) > limit - c)
2467         error (_("Numeric constant too large"));
2468       n += c;
2469         }
2470
2471   /* If the type is bigger than a 32-bit signed integer can be, implicitly
2472      promote to long.  Java does not do this, so mark it as
2473      parse_type (par_state)->builtin_uint64 rather than
2474      parse_java_type (par_state)->builtin_long.
2475      0x80000000 will become -0x80000000 instead of 0x80000000L, because we
2476      don't know the sign at this point.  */
2477   if (type == parse_java_type (par_state)->builtin_int
2478       && n > (ULONGEST)0x80000000)
2479     type = parse_type (par_state)->builtin_uint64;
2480
2481   putithere->typed_val_int.val = n;
2482   putithere->typed_val_int.type = type;
2483
2484   return INTEGER_LITERAL;
2485 }
2486
2487 struct token
2488 {
2489   char *operator;
2490   int token;
2491   enum exp_opcode opcode;
2492 };
2493
2494 static const struct token tokentab3[] =
2495   {
2496     {">>=", ASSIGN_MODIFY, BINOP_RSH},
2497     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2498   };
2499
2500 static const struct token tokentab2[] =
2501   {
2502     {"+=", ASSIGN_MODIFY, BINOP_ADD},
2503     {"-=", ASSIGN_MODIFY, BINOP_SUB},
2504     {"*=", ASSIGN_MODIFY, BINOP_MUL},
2505     {"/=", ASSIGN_MODIFY, BINOP_DIV},
2506     {"%=", ASSIGN_MODIFY, BINOP_REM},
2507     {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2508     {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2509     {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2510     {"++", INCREMENT, BINOP_END},
2511     {"--", DECREMENT, BINOP_END},
2512     {"&&", ANDAND, BINOP_END},
2513     {"||", OROR, BINOP_END},
2514     {"<<", LSH, BINOP_END},
2515     {">>", RSH, BINOP_END},
2516     {"==", EQUAL, BINOP_END},
2517     {"!=", NOTEQUAL, BINOP_END},
2518     {"<=", LEQ, BINOP_END},
2519     {">=", GEQ, BINOP_END}
2520   };
2521
2522 /* Read one token, getting characters through lexptr.  */
2523
2524 static int
2525 yylex (void)
2526 {
2527   int c;
2528   int namelen;
2529   unsigned int i;
2530   const char *tokstart;
2531   const char *tokptr;
2532   int tempbufindex;
2533   static char *tempbuf;
2534   static int tempbufsize;
2535   
2536  retry:
2537
2538   prev_lexptr = lexptr;
2539
2540   tokstart = lexptr;
2541   /* See if it is a special token of length 3.  */
2542   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2543     if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2544       {
2545         lexptr += 3;
2546         yylval.opcode = tokentab3[i].opcode;
2547         return tokentab3[i].token;
2548       }
2549
2550   /* See if it is a special token of length 2.  */
2551   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2552     if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2553       {
2554         lexptr += 2;
2555         yylval.opcode = tokentab2[i].opcode;
2556         return tokentab2[i].token;
2557       }
2558
2559   switch (c = *tokstart)
2560     {
2561     case 0:
2562       return 0;
2563
2564     case ' ':
2565     case '\t':
2566     case '\n':
2567       lexptr++;
2568       goto retry;
2569
2570     case '\'':
2571       /* We either have a character constant ('0' or '\177' for example)
2572          or we have a quoted symbol reference ('foo(int,int)' in C++
2573          for example).  */
2574       lexptr++;
2575       c = *lexptr++;
2576       if (c == '\\')
2577         c = parse_escape (parse_gdbarch (pstate), &lexptr);
2578       else if (c == '\'')
2579         error (_("Empty character constant"));
2580
2581       yylval.typed_val_int.val = c;
2582       yylval.typed_val_int.type = parse_java_type (pstate)->builtin_char;
2583
2584       c = *lexptr++;
2585       if (c != '\'')
2586         {
2587           namelen = skip_quoted (tokstart) - tokstart;
2588           if (namelen > 2)
2589             {
2590               lexptr = tokstart + namelen;
2591               if (lexptr[-1] != '\'')
2592                 error (_("Unmatched single quote"));
2593               namelen -= 2;
2594               tokstart++;
2595               goto tryname;
2596             }
2597           error (_("Invalid character constant"));
2598         }
2599       return INTEGER_LITERAL;
2600
2601     case '(':
2602       paren_depth++;
2603       lexptr++;
2604       return c;
2605
2606     case ')':
2607       if (paren_depth == 0)
2608         return 0;
2609       paren_depth--;
2610       lexptr++;
2611       return c;
2612
2613     case ',':
2614       if (comma_terminates && paren_depth == 0)
2615         return 0;
2616       lexptr++;
2617       return c;
2618
2619     case '.':
2620       /* Might be a floating point number.  */
2621       if (lexptr[1] < '0' || lexptr[1] > '9')
2622         goto symbol;            /* Nope, must be a symbol.  */
2623       /* FALL THRU into number case.  */
2624
2625     case '0':
2626     case '1':
2627     case '2':
2628     case '3':
2629     case '4':
2630     case '5':
2631     case '6':
2632     case '7':
2633     case '8':
2634     case '9':
2635       {
2636         /* It's a number.  */
2637         int got_dot = 0, got_e = 0, toktype;
2638         const char *p = tokstart;
2639         int hex = input_radix > 10;
2640
2641         if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2642           {
2643             p += 2;
2644             hex = 1;
2645           }
2646         else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2647           {
2648             p += 2;
2649             hex = 0;
2650           }
2651
2652         for (;; ++p)
2653           {
2654             /* This test includes !hex because 'e' is a valid hex digit
2655                and thus does not indicate a floating point number when
2656                the radix is hex.  */
2657             if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2658               got_dot = got_e = 1;
2659             /* This test does not include !hex, because a '.' always indicates
2660                a decimal floating point number regardless of the radix.  */
2661             else if (!got_dot && *p == '.')
2662               got_dot = 1;
2663             else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2664                      && (*p == '-' || *p == '+'))
2665               /* This is the sign of the exponent, not the end of the
2666                  number.  */
2667               continue;
2668             /* We will take any letters or digits.  parse_number will
2669                complain if past the radix, or if L or U are not final.  */
2670             else if ((*p < '0' || *p > '9')
2671                      && ((*p < 'a' || *p > 'z')
2672                                   && (*p < 'A' || *p > 'Z')))
2673               break;
2674           }
2675         toktype = parse_number (pstate, tokstart, p - tokstart,
2676                                 got_dot|got_e, &yylval);
2677         if (toktype == ERROR)
2678           {
2679             char *err_copy = (char *) alloca (p - tokstart + 1);
2680
2681             memcpy (err_copy, tokstart, p - tokstart);
2682             err_copy[p - tokstart] = 0;
2683             error (_("Invalid number \"%s\""), err_copy);
2684           }
2685         lexptr = p;
2686         return toktype;
2687       }
2688
2689     case '+':
2690     case '-':
2691     case '*':
2692     case '/':
2693     case '%':
2694     case '|':
2695     case '&':
2696     case '^':
2697     case '~':
2698     case '!':
2699     case '<':
2700     case '>':
2701     case '[':
2702     case ']':
2703     case '?':
2704     case ':':
2705     case '=':
2706     case '{':
2707     case '}':
2708     symbol:
2709       lexptr++;
2710       return c;
2711
2712     case '"':
2713
2714       /* Build the gdb internal form of the input string in tempbuf,
2715          translating any standard C escape forms seen.  Note that the
2716          buffer is null byte terminated *only* for the convenience of
2717          debugging gdb itself and printing the buffer contents when
2718          the buffer contains no embedded nulls.  Gdb does not depend
2719          upon the buffer being null byte terminated, it uses the length
2720          string instead.  This allows gdb to handle C strings (as well
2721          as strings in other languages) with embedded null bytes */
2722
2723       tokptr = ++tokstart;
2724       tempbufindex = 0;
2725
2726       do {
2727         /* Grow the static temp buffer if necessary, including allocating
2728            the first one on demand.  */
2729         if (tempbufindex + 1 >= tempbufsize)
2730           {
2731             tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2732           }
2733         switch (*tokptr)
2734           {
2735           case '\0':
2736           case '"':
2737             /* Do nothing, loop will terminate.  */
2738             break;
2739           case '\\':
2740             tokptr++;
2741             c = parse_escape (parse_gdbarch (pstate), &tokptr);
2742             if (c == -1)
2743               {
2744                 continue;
2745               }
2746             tempbuf[tempbufindex++] = c;
2747             break;
2748           default:
2749             tempbuf[tempbufindex++] = *tokptr++;
2750             break;
2751           }
2752       } while ((*tokptr != '"') && (*tokptr != '\0'));
2753       if (*tokptr++ != '"')
2754         {
2755           error (_("Unterminated string in expression"));
2756         }
2757       tempbuf[tempbufindex] = '\0';     /* See note above */
2758       yylval.sval.ptr = tempbuf;
2759       yylval.sval.length = tempbufindex;
2760       lexptr = tokptr;
2761       return (STRING_LITERAL);
2762     }
2763
2764   if (!(c == '_' || c == '$'
2765         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2766     /* We must have come across a bad character (e.g. ';').  */
2767     error (_("Invalid character '%c' in expression"), c);
2768
2769   /* It's a name.  See how long it is.  */
2770   namelen = 0;
2771   for (c = tokstart[namelen];
2772        (c == '_'
2773         || c == '$'
2774         || (c >= '0' && c <= '9')
2775         || (c >= 'a' && c <= 'z')
2776         || (c >= 'A' && c <= 'Z')
2777         || c == '<');
2778        )
2779     {
2780       if (c == '<')
2781         {
2782           int i = namelen;
2783           while (tokstart[++i] && tokstart[i] != '>');
2784           if (tokstart[i] == '>')
2785             namelen = i;
2786         }
2787        c = tokstart[++namelen];
2788      }
2789
2790   /* The token "if" terminates the expression and is NOT 
2791      removed from the input stream.  */
2792   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2793     {
2794       return 0;
2795     }
2796
2797   lexptr += namelen;
2798
2799   tryname:
2800
2801   /* Catch specific keywords.  Should be done with a data structure.  */
2802   switch (namelen)
2803     {
2804     case 7:
2805       if (strncmp (tokstart, "boolean", 7) == 0)
2806         return BOOLEAN;
2807       break;
2808     case 6:
2809       if (strncmp (tokstart, "double", 6) == 0)      
2810         return DOUBLE;
2811       break;
2812     case 5:
2813       if (strncmp (tokstart, "short", 5) == 0)
2814         return SHORT;
2815       if (strncmp (tokstart, "false", 5) == 0)
2816         {
2817           yylval.lval = 0;
2818           return BOOLEAN_LITERAL;
2819         }
2820       if (strncmp (tokstart, "super", 5) == 0)
2821         return SUPER;
2822       if (strncmp (tokstart, "float", 5) == 0)
2823         return FLOAT;
2824       break;
2825     case 4:
2826       if (strncmp (tokstart, "long", 4) == 0)
2827         return LONG;
2828       if (strncmp (tokstart, "byte", 4) == 0)
2829         return BYTE;
2830       if (strncmp (tokstart, "char", 4) == 0)
2831         return CHAR;
2832       if (strncmp (tokstart, "true", 4) == 0)
2833         {
2834           yylval.lval = 1;
2835           return BOOLEAN_LITERAL;
2836         }
2837       break;
2838     case 3:
2839       if (strncmp (tokstart, "int", 3) == 0)
2840         return INT;
2841       if (strncmp (tokstart, "new", 3) == 0)
2842         return NEW;
2843       break;
2844     default:
2845       break;
2846     }
2847
2848   yylval.sval.ptr = tokstart;
2849   yylval.sval.length = namelen;
2850
2851   if (*tokstart == '$')
2852     {
2853       write_dollar_variable (pstate, yylval.sval);
2854       return VARIABLE;
2855     }
2856
2857   /* Input names that aren't symbols but ARE valid hex numbers,
2858      when the input radix permits them, can be names or numbers
2859      depending on the parse.  Note we support radixes > 16 here.  */
2860   if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2861        (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2862     {
2863       YYSTYPE newlval;  /* Its value is ignored.  */
2864       int hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
2865       if (hextype == INTEGER_LITERAL)
2866         return NAME_OR_INT;
2867     }
2868   return IDENTIFIER;
2869 }
2870
2871 int
2872 java_parse (struct parser_state *par_state)
2873 {
2874   int result;
2875   struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
2876
2877   /* Setting up the parser state.  */
2878   gdb_assert (par_state != NULL);
2879   pstate = par_state;
2880
2881   result = yyparse ();
2882   do_cleanups (c);
2883
2884   return result;
2885 }
2886
2887 void
2888 yyerror (char *msg)
2889 {
2890   if (prev_lexptr)
2891     lexptr = prev_lexptr;
2892
2893   if (msg)
2894     error (_("%s: near `%s'"), msg, lexptr);
2895   else
2896     error (_("error in expression, near `%s'"), lexptr);
2897 }
2898
2899 static struct type *
2900 java_type_from_name (struct stoken name)
2901 {
2902   char *tmp = copy_name (name);
2903   struct type *typ = java_lookup_class (tmp);
2904   if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
2905     error (_("No class named `%s'"), tmp);
2906   return typ;
2907 }
2908
2909 /* If NAME is a valid variable name in this scope, push it and return 1.
2910    Otherwise, return 0.  */
2911
2912 static int
2913 push_variable (struct parser_state *par_state, struct stoken name)
2914 {
2915   char *tmp = copy_name (name);
2916   struct field_of_this_result is_a_field_of_this;
2917   struct symbol *sym;
2918
2919   sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
2920                        &is_a_field_of_this);
2921   if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
2922     {
2923       if (symbol_read_needs_frame (sym))
2924         {
2925           if (innermost_block == 0 ||
2926               contained_in (block_found, innermost_block))
2927             innermost_block = block_found;
2928         }
2929
2930       write_exp_elt_opcode (par_state, OP_VAR_VALUE);
2931       /* We want to use the selected frame, not another more inner frame
2932          which happens to be in the same block.  */
2933       write_exp_elt_block (par_state, NULL);
2934       write_exp_elt_sym (par_state, sym);
2935       write_exp_elt_opcode (par_state, OP_VAR_VALUE);
2936       return 1;
2937     }
2938   if (is_a_field_of_this.type != NULL)
2939     {
2940       /* it hangs off of `this'.  Must not inadvertently convert from a
2941          method call to data ref.  */
2942       if (innermost_block == 0 || 
2943           contained_in (block_found, innermost_block))
2944         innermost_block = block_found;
2945       write_exp_elt_opcode (par_state, OP_THIS);
2946       write_exp_elt_opcode (par_state, OP_THIS);
2947       write_exp_elt_opcode (par_state, STRUCTOP_PTR);
2948       write_exp_string (par_state, name);
2949       write_exp_elt_opcode (par_state, STRUCTOP_PTR);
2950       return 1;
2951     }
2952   return 0;
2953 }
2954
2955 /* Assuming a reference expression has been pushed, emit the
2956    STRUCTOP_PTR ops to access the field named NAME.  If NAME is a
2957    qualified name (has '.'), generate a field access for each part.  */
2958
2959 static void
2960 push_fieldnames (struct parser_state *par_state, struct stoken name)
2961 {
2962   int i;
2963   struct stoken token;
2964   token.ptr = name.ptr;
2965   for (i = 0;  ;  i++)
2966     {
2967       if (i == name.length || name.ptr[i] == '.')
2968         {
2969           /* token.ptr is start of current field name.  */
2970           token.length = &name.ptr[i] - token.ptr;
2971           write_exp_elt_opcode (par_state, STRUCTOP_PTR);
2972           write_exp_string (par_state, token);
2973           write_exp_elt_opcode (par_state, STRUCTOP_PTR);
2974           token.ptr += token.length + 1;
2975         }
2976       if (i >= name.length)
2977         break;
2978     }
2979 }
2980
2981 /* Helper routine for push_expression_name.
2982    Handle a qualified name, where DOT_INDEX is the index of the first '.' */
2983
2984 static void
2985 push_qualified_expression_name (struct parser_state *par_state,
2986                                 struct stoken name, int dot_index)
2987 {
2988   struct stoken token;
2989   char *tmp;
2990   struct type *typ;
2991
2992   token.ptr = name.ptr;
2993   token.length = dot_index;
2994
2995   if (push_variable (par_state, token))
2996     {
2997       token.ptr = name.ptr + dot_index + 1;
2998       token.length = name.length - dot_index - 1;
2999       push_fieldnames (par_state, token);
3000       return;
3001     }
3002
3003   token.ptr = name.ptr;
3004   for (;;)
3005     {
3006       token.length = dot_index;
3007       tmp = copy_name (token);
3008       typ = java_lookup_class (tmp);
3009       if (typ != NULL)
3010         {
3011           if (dot_index == name.length)
3012             {
3013               write_exp_elt_opcode (par_state, OP_TYPE);
3014               write_exp_elt_type (par_state, typ);
3015               write_exp_elt_opcode (par_state, OP_TYPE);
3016               return;
3017             }
3018           dot_index++;  /* Skip '.' */
3019           name.ptr += dot_index;
3020           name.length -= dot_index;
3021           dot_index = 0;
3022           while (dot_index < name.length && name.ptr[dot_index] != '.') 
3023             dot_index++;
3024           token.ptr = name.ptr;
3025           token.length = dot_index;
3026           write_exp_elt_opcode (par_state, OP_SCOPE);
3027           write_exp_elt_type (par_state, typ);
3028           write_exp_string (par_state, token);
3029           write_exp_elt_opcode (par_state, OP_SCOPE); 
3030           if (dot_index < name.length)
3031             {
3032               dot_index++;
3033               name.ptr += dot_index;
3034               name.length -= dot_index;
3035               push_fieldnames (par_state, name);
3036             }
3037           return;
3038         }
3039       else if (dot_index >= name.length)
3040         break;
3041       dot_index++;  /* Skip '.' */
3042       while (dot_index < name.length && name.ptr[dot_index] != '.')
3043         dot_index++;
3044     }
3045   error (_("unknown type `%.*s'"), name.length, name.ptr);
3046 }
3047
3048 /* Handle Name in an expression (or LHS).
3049    Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN.  */
3050
3051 static void
3052 push_expression_name (struct parser_state *par_state, struct stoken name)
3053 {
3054   char *tmp;
3055   struct type *typ;
3056   int i;
3057
3058   for (i = 0;  i < name.length;  i++)
3059     {
3060       if (name.ptr[i] == '.')
3061         {
3062           /* It's a Qualified Expression Name.  */
3063           push_qualified_expression_name (par_state, name, i);
3064           return;
3065         }
3066     }
3067
3068   /* It's a Simple Expression Name.  */
3069   
3070   if (push_variable (par_state, name))
3071     return;
3072   tmp = copy_name (name);
3073   typ = java_lookup_class (tmp);
3074   if (typ != NULL)
3075     {
3076       write_exp_elt_opcode (par_state, OP_TYPE);
3077       write_exp_elt_type (par_state, typ);
3078       write_exp_elt_opcode (par_state, OP_TYPE);
3079     }
3080   else
3081     {
3082       struct bound_minimal_symbol msymbol;
3083
3084       msymbol = lookup_bound_minimal_symbol (tmp);
3085       if (msymbol.minsym != NULL)
3086         write_exp_msymbol (par_state, msymbol);
3087       else if (!have_full_symbols () && !have_partial_symbols ())
3088         error (_("No symbol table is loaded.  Use the \"file\" command"));
3089       else
3090         error (_("No symbol \"%s\" in current context."), tmp);
3091     }
3092
3093 }
3094
3095
3096 /* The following two routines, copy_exp and insert_exp, aren't specific to
3097    Java, so they could go in parse.c, but their only purpose is to support
3098    the parsing kludges we use in this file, so maybe it's best to isolate
3099    them here.  */
3100
3101 /* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
3102    into a freshly xmalloc'ed struct expression.  Its language_defn is set
3103    to null.  */
3104 static struct expression *
3105 copy_exp (struct expression *expr, int endpos)
3106 {
3107   int len = length_of_subexp (expr, endpos);
3108   struct expression *new
3109     = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
3110
3111   new->nelts = len;
3112   memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
3113   new->language_defn = 0;
3114
3115   return new;
3116 }
3117
3118 /* Insert the expression NEW into the current expression (expout) at POS.  */
3119 static void
3120 insert_exp (struct parser_state *par_state, int pos, struct expression *new)
3121 {
3122   int newlen = new->nelts;
3123   int i;
3124
3125   /* Grow expout if necessary.  In this function's only use at present,
3126      this should never be necessary.  */
3127   increase_expout_size (par_state, newlen);
3128
3129   for (i = par_state->expout_ptr - 1; i >= pos; i--)
3130     par_state->expout->elts[i + newlen] = par_state->expout->elts[i];
3131   
3132   memcpy (par_state->expout->elts + pos, new->elts,
3133           EXP_ELEM_TO_BYTES (newlen));
3134   par_state->expout_ptr += newlen;
3135 }