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