OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [jv-exp.c] - Blame information for rev 855

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.