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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [jv-exp.c] - Blame information for rev 365

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

Line No. Rev Author Line
1 330 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,   568,   576,   577,   579,   581,   586,   587,
499
     589,   594,   595,   597,   603,   604,   606,   608,   610,   616,
500
     617,   619,   624,   625,   630,   631,   635,   636,   641,   642,
501
     647,   648,   653,   654,   659,   660,   664,   666,   673,   675,
502
     677,   678,   683
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 last_exp_size = length_of_subexp(expout, expout_ptr);
1709
                  struct type *type;
1710
                  int i;
1711
                  int base = expout_ptr - last_exp_size - 3;
1712
                  if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
1713
                    error (_("Invalid cast expression"));
1714
                  type = expout->elts[base+1].type;
1715
                  /* Remove the 'Expression' and slide the
1716
                     UnaryExpressionNotPlusMinus down to replace it. */
1717
                  for (i = 0;  i < last_exp_size;  i++)
1718
                    expout->elts[base + i] = expout->elts[base + i + 3];
1719
                  expout_ptr -= 3;
1720
                  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
1721
                    type = lookup_pointer_type (type);
1722
                  write_exp_elt_opcode (UNOP_CAST);
1723
                  write_exp_elt_type (type);
1724
                  write_exp_elt_opcode (UNOP_CAST);
1725
                }
1726
    break;
1727
 
1728
  case 93:
1729
#line 569 "jv-exp.y"
1730
    { write_exp_elt_opcode (UNOP_CAST);
1731
                  write_exp_elt_type (java_array_type (java_type_from_name (yyvsp[-3].sval), yyvsp[-2].lval));
1732
                  write_exp_elt_opcode (UNOP_CAST); }
1733
    break;
1734
 
1735
  case 95:
1736
#line 578 "jv-exp.y"
1737
    { write_exp_elt_opcode (BINOP_MUL); }
1738
    break;
1739
 
1740
  case 96:
1741
#line 580 "jv-exp.y"
1742
    { write_exp_elt_opcode (BINOP_DIV); }
1743
    break;
1744
 
1745
  case 97:
1746
#line 582 "jv-exp.y"
1747
    { write_exp_elt_opcode (BINOP_REM); }
1748
    break;
1749
 
1750
  case 99:
1751
#line 588 "jv-exp.y"
1752
    { write_exp_elt_opcode (BINOP_ADD); }
1753
    break;
1754
 
1755
  case 100:
1756
#line 590 "jv-exp.y"
1757
    { write_exp_elt_opcode (BINOP_SUB); }
1758
    break;
1759
 
1760
  case 102:
1761
#line 596 "jv-exp.y"
1762
    { write_exp_elt_opcode (BINOP_LSH); }
1763
    break;
1764
 
1765
  case 103:
1766
#line 598 "jv-exp.y"
1767
    { write_exp_elt_opcode (BINOP_RSH); }
1768
    break;
1769
 
1770
  case 105:
1771
#line 605 "jv-exp.y"
1772
    { write_exp_elt_opcode (BINOP_LESS); }
1773
    break;
1774
 
1775
  case 106:
1776
#line 607 "jv-exp.y"
1777
    { write_exp_elt_opcode (BINOP_GTR); }
1778
    break;
1779
 
1780
  case 107:
1781
#line 609 "jv-exp.y"
1782
    { write_exp_elt_opcode (BINOP_LEQ); }
1783
    break;
1784
 
1785
  case 108:
1786
#line 611 "jv-exp.y"
1787
    { write_exp_elt_opcode (BINOP_GEQ); }
1788
    break;
1789
 
1790
  case 110:
1791
#line 618 "jv-exp.y"
1792
    { write_exp_elt_opcode (BINOP_EQUAL); }
1793
    break;
1794
 
1795
  case 111:
1796
#line 620 "jv-exp.y"
1797
    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1798
    break;
1799
 
1800
  case 113:
1801
#line 626 "jv-exp.y"
1802
    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1803
    break;
1804
 
1805
  case 115:
1806
#line 632 "jv-exp.y"
1807
    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1808
    break;
1809
 
1810
  case 117:
1811
#line 637 "jv-exp.y"
1812
    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1813
    break;
1814
 
1815
  case 119:
1816
#line 643 "jv-exp.y"
1817
    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1818
    break;
1819
 
1820
  case 121:
1821
#line 649 "jv-exp.y"
1822
    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1823
    break;
1824
 
1825
  case 123:
1826
#line 655 "jv-exp.y"
1827
    { write_exp_elt_opcode (TERNOP_COND); }
1828
    break;
1829
 
1830
  case 126:
1831
#line 665 "jv-exp.y"
1832
    { write_exp_elt_opcode (BINOP_ASSIGN); }
1833
    break;
1834
 
1835
  case 127:
1836
#line 667 "jv-exp.y"
1837
    { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1838
                  write_exp_elt_opcode (yyvsp[-1].opcode);
1839
                  write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1840
    break;
1841
 
1842
  case 128:
1843
#line 674 "jv-exp.y"
1844
    { push_expression_name (yyvsp[0].sval); }
1845
    break;
1846
 
1847
 
1848
    }
1849
 
1850
/* Line 1000 of yacc.c.  */
1851
#line 1852 "jv-exp.c.tmp"
1852
 
1853
  yyvsp -= yylen;
1854
  yyssp -= yylen;
1855
 
1856
 
1857
  YY_STACK_PRINT (yyss, yyssp);
1858
 
1859
  *++yyvsp = yyval;
1860
 
1861
 
1862
  /* Now `shift' the result of the reduction.  Determine what state
1863
     that goes to, based on the state we popped back to and the rule
1864
     number reduced by.  */
1865
 
1866
  yyn = yyr1[yyn];
1867
 
1868
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1869
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1870
    yystate = yytable[yystate];
1871
  else
1872
    yystate = yydefgoto[yyn - YYNTOKENS];
1873
 
1874
  goto yynewstate;
1875
 
1876
 
1877
/*------------------------------------.
1878
| yyerrlab -- here on detecting error |
1879
`------------------------------------*/
1880
yyerrlab:
1881
  /* If not already recovering from an error, report this error.  */
1882
  if (!yyerrstatus)
1883
    {
1884
      ++yynerrs;
1885
#if YYERROR_VERBOSE
1886
      yyn = yypact[yystate];
1887
 
1888
      if (YYPACT_NINF < yyn && yyn < YYLAST)
1889
        {
1890
          YYSIZE_T yysize = 0;
1891
          int yytype = YYTRANSLATE (yychar);
1892
          const char* yyprefix;
1893
          char *yymsg;
1894
          int yyx;
1895
 
1896
          /* Start YYX at -YYN if negative to avoid negative indexes in
1897
             YYCHECK.  */
1898
          int yyxbegin = yyn < 0 ? -yyn : 0;
1899
 
1900
          /* Stay within bounds of both yycheck and yytname.  */
1901
          int yychecklim = YYLAST - yyn;
1902
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1903
          int yycount = 0;
1904
 
1905
          yyprefix = ", expecting ";
1906
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1907
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1908
              {
1909
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1910
                yycount += 1;
1911
                if (yycount == 5)
1912
                  {
1913
                    yysize = 0;
1914
                    break;
1915
                  }
1916
              }
1917
          yysize += (sizeof ("syntax error, unexpected ")
1918
                     + yystrlen (yytname[yytype]));
1919
          yymsg = (char *) YYSTACK_ALLOC (yysize);
1920
          if (yymsg != 0)
1921
            {
1922
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1923
              yyp = yystpcpy (yyp, yytname[yytype]);
1924
 
1925
              if (yycount < 5)
1926
                {
1927
                  yyprefix = ", expecting ";
1928
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1929
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1930
                      {
1931
                        yyp = yystpcpy (yyp, yyprefix);
1932
                        yyp = yystpcpy (yyp, yytname[yyx]);
1933
                        yyprefix = " or ";
1934
                      }
1935
                }
1936
              yyerror (yymsg);
1937
              YYSTACK_FREE (yymsg);
1938
            }
1939
          else
1940
            yyerror ("syntax error; also virtual memory exhausted");
1941
        }
1942
      else
1943
#endif /* YYERROR_VERBOSE */
1944
        yyerror ("syntax error");
1945
    }
1946
 
1947
 
1948
 
1949
  if (yyerrstatus == 3)
1950
    {
1951
      /* If just tried and failed to reuse lookahead token after an
1952
         error, discard it.  */
1953
 
1954
      if (yychar <= YYEOF)
1955
        {
1956
          /* If at end of input, pop the error token,
1957
             then the rest of the stack, then return failure.  */
1958
          if (yychar == YYEOF)
1959
             for (;;)
1960
               {
1961
                 YYPOPSTACK;
1962
                 if (yyssp == yyss)
1963
                   YYABORT;
1964
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1965
                 yydestruct (yystos[*yyssp], yyvsp);
1966
               }
1967
        }
1968
      else
1969
        {
1970
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1971
          yydestruct (yytoken, &yylval);
1972
          yychar = YYEMPTY;
1973
 
1974
        }
1975
    }
1976
 
1977
  /* Else will try to reuse lookahead token after shifting the error
1978
     token.  */
1979
  goto yyerrlab1;
1980
 
1981
 
1982
/*---------------------------------------------------.
1983
| yyerrorlab -- error raised explicitly by YYERROR.  |
1984
`---------------------------------------------------*/
1985
yyerrorlab:
1986
 
1987
#ifdef __GNUC__
1988
  /* Pacify GCC when the user code never invokes YYERROR and the label
1989
     yyerrorlab therefore never appears in user code.  */
1990
  if (0)
1991
     goto yyerrorlab;
1992
#endif
1993
 
1994
  yyvsp -= yylen;
1995
  yyssp -= yylen;
1996
  yystate = *yyssp;
1997
  goto yyerrlab1;
1998
 
1999
 
2000
/*-------------------------------------------------------------.
2001
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2002
`-------------------------------------------------------------*/
2003
yyerrlab1:
2004
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2005
 
2006
  for (;;)
2007
    {
2008
      yyn = yypact[yystate];
2009
      if (yyn != YYPACT_NINF)
2010
        {
2011
          yyn += YYTERROR;
2012
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2013
            {
2014
              yyn = yytable[yyn];
2015
              if (0 < yyn)
2016
                break;
2017
            }
2018
        }
2019
 
2020
      /* Pop the current state because it cannot handle the error token.  */
2021
      if (yyssp == yyss)
2022
        YYABORT;
2023
 
2024
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2025
      yydestruct (yystos[yystate], yyvsp);
2026
      YYPOPSTACK;
2027
      yystate = *yyssp;
2028
      YY_STACK_PRINT (yyss, yyssp);
2029
    }
2030
 
2031
  if (yyn == YYFINAL)
2032
    YYACCEPT;
2033
 
2034
  YYDPRINTF ((stderr, "Shifting error token, "));
2035
 
2036
  *++yyvsp = yylval;
2037
 
2038
 
2039
  yystate = yyn;
2040
  goto yynewstate;
2041
 
2042
 
2043
/*-------------------------------------.
2044
| yyacceptlab -- YYACCEPT comes here.  |
2045
`-------------------------------------*/
2046
yyacceptlab:
2047
  yyresult = 0;
2048
  goto yyreturn;
2049
 
2050
/*-----------------------------------.
2051
| yyabortlab -- YYABORT comes here.  |
2052
`-----------------------------------*/
2053
yyabortlab:
2054
  yyresult = 1;
2055
  goto yyreturn;
2056
 
2057
#ifndef yyoverflow
2058
/*----------------------------------------------.
2059
| yyoverflowlab -- parser overflow comes here.  |
2060
`----------------------------------------------*/
2061
yyoverflowlab:
2062
  yyerror ("parser stack overflow");
2063
  yyresult = 2;
2064
  /* Fall through.  */
2065
#endif
2066
 
2067
yyreturn:
2068
#ifndef yyoverflow
2069
  if (yyss != yyssa)
2070
    YYSTACK_FREE (yyss);
2071
#endif
2072
  return yyresult;
2073
}
2074
 
2075
 
2076
#line 686 "jv-exp.y"
2077
 
2078
/* Take care of parsing a number (anything that starts with a digit).
2079
   Set yylval and return the token type; update lexptr.
2080
   LEN is the number of characters in it.  */
2081
 
2082
/*** Needs some error checking for the float case ***/
2083
 
2084
static int
2085
parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
2086
{
2087
  ULONGEST n = 0;
2088
  ULONGEST limit, limit_div_base;
2089
 
2090
  int c;
2091
  int base = input_radix;
2092
 
2093
  struct type *type;
2094
 
2095
  if (parsed_float)
2096
    {
2097
      /* It's a float since it contains a point or an exponent.  */
2098
      char c;
2099
      int num = 0;       /* number of tokens scanned by scanf */
2100
      char saved_char = p[len];
2101
 
2102
      p[len] = 0;        /* null-terminate the token */
2103
      num = sscanf (p, "%" DOUBLEST_SCAN_FORMAT "%c",
2104
                    &putithere->typed_val_float.dval, &c);
2105
      p[len] = saved_char;      /* restore the input stream */
2106
      if (num != 1)             /* check scanf found ONLY a float ... */
2107
        return ERROR;
2108
      /* See if it has `f' or `d' suffix (float or double).  */
2109
 
2110
      c = tolower (p[len - 1]);
2111
 
2112
      if (c == 'f' || c == 'F')
2113
        putithere->typed_val_float.type = parse_type->builtin_float;
2114
      else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
2115
        putithere->typed_val_float.type = parse_type->builtin_double;
2116
      else
2117
        return ERROR;
2118
 
2119
      return FLOATING_POINT_LITERAL;
2120
    }
2121
 
2122
  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2123
  if (p[0] == '0')
2124
    switch (p[1])
2125
      {
2126
      case 'x':
2127
      case 'X':
2128
        if (len >= 3)
2129
          {
2130
            p += 2;
2131
            base = 16;
2132
            len -= 2;
2133
          }
2134
        break;
2135
 
2136
      case 't':
2137
      case 'T':
2138
      case 'd':
2139
      case 'D':
2140
        if (len >= 3)
2141
          {
2142
            p += 2;
2143
            base = 10;
2144
            len -= 2;
2145
          }
2146
        break;
2147
 
2148
      default:
2149
        base = 8;
2150
        break;
2151
      }
2152
 
2153
  c = p[len-1];
2154
  /* A paranoid calculation of (1<<64)-1. */
2155
  limit = (ULONGEST)0xffffffff;
2156
  limit = ((limit << 16) << 16) | limit;
2157
  if (c == 'l' || c == 'L')
2158
    {
2159
      type = parse_java_type->builtin_long;
2160
      len--;
2161
    }
2162
  else
2163
    {
2164
      type = parse_java_type->builtin_int;
2165
    }
2166
  limit_div_base = limit / (ULONGEST) base;
2167
 
2168
  while (--len >= 0)
2169
    {
2170
      c = *p++;
2171
      if (c >= '0' && c <= '9')
2172
        c -= '0';
2173
      else if (c >= 'A' && c <= 'Z')
2174
        c -= 'A' - 10;
2175
      else if (c >= 'a' && c <= 'z')
2176
        c -= 'a' - 10;
2177
      else
2178
        return ERROR;   /* Char not a digit */
2179
      if (c >= base)
2180
        return ERROR;
2181
      if (n > limit_div_base
2182
          || (n *= base) > limit - c)
2183
        error (_("Numeric constant too large"));
2184
      n += c;
2185
        }
2186
 
2187
  /* If the type is bigger than a 32-bit signed integer can be, implicitly
2188
     promote to long.  Java does not do this, so mark it as
2189
     parse_type->builtin_uint64 rather than parse_java_type->builtin_long.
2190
     0x80000000 will become -0x80000000 instead of 0x80000000L, because we
2191
     don't know the sign at this point.  */
2192
  if (type == parse_java_type->builtin_int && n > (ULONGEST)0x80000000)
2193
    type = parse_type->builtin_uint64;
2194
 
2195
  putithere->typed_val_int.val = n;
2196
  putithere->typed_val_int.type = type;
2197
 
2198
  return INTEGER_LITERAL;
2199
}
2200
 
2201
struct token
2202
{
2203
  char *operator;
2204
  int token;
2205
  enum exp_opcode opcode;
2206
};
2207
 
2208
static const struct token tokentab3[] =
2209
  {
2210
    {">>=", ASSIGN_MODIFY, BINOP_RSH},
2211
    {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2212
  };
2213
 
2214
static const struct token tokentab2[] =
2215
  {
2216
    {"+=", ASSIGN_MODIFY, BINOP_ADD},
2217
    {"-=", ASSIGN_MODIFY, BINOP_SUB},
2218
    {"*=", ASSIGN_MODIFY, BINOP_MUL},
2219
    {"/=", ASSIGN_MODIFY, BINOP_DIV},
2220
    {"%=", ASSIGN_MODIFY, BINOP_REM},
2221
    {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2222
    {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2223
    {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2224
    {"++", INCREMENT, BINOP_END},
2225
    {"--", DECREMENT, BINOP_END},
2226
    {"&&", ANDAND, BINOP_END},
2227
    {"||", OROR, BINOP_END},
2228
    {"<<", LSH, BINOP_END},
2229
    {">>", RSH, BINOP_END},
2230
    {"==", EQUAL, BINOP_END},
2231
    {"!=", NOTEQUAL, BINOP_END},
2232
    {"<=", LEQ, BINOP_END},
2233
    {">=", GEQ, BINOP_END}
2234
  };
2235
 
2236
/* Read one token, getting characters through lexptr.  */
2237
 
2238
static int
2239
yylex (void)
2240
{
2241
  int c;
2242
  int namelen;
2243
  unsigned int i;
2244
  char *tokstart;
2245
  char *tokptr;
2246
  int tempbufindex;
2247
  static char *tempbuf;
2248
  static int tempbufsize;
2249
 
2250
 retry:
2251
 
2252
  prev_lexptr = lexptr;
2253
 
2254
  tokstart = lexptr;
2255
  /* See if it is a special token of length 3.  */
2256
  for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2257
    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2258
      {
2259
        lexptr += 3;
2260
        yylval.opcode = tokentab3[i].opcode;
2261
        return tokentab3[i].token;
2262
      }
2263
 
2264
  /* See if it is a special token of length 2.  */
2265
  for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2266
    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2267
      {
2268
        lexptr += 2;
2269
        yylval.opcode = tokentab2[i].opcode;
2270
        return tokentab2[i].token;
2271
      }
2272
 
2273
  switch (c = *tokstart)
2274
    {
2275
    case 0:
2276
      return 0;
2277
 
2278
    case ' ':
2279
    case '\t':
2280
    case '\n':
2281
      lexptr++;
2282
      goto retry;
2283
 
2284
    case '\'':
2285
      /* We either have a character constant ('0' or '\177' for example)
2286
         or we have a quoted symbol reference ('foo(int,int)' in C++
2287
         for example). */
2288
      lexptr++;
2289
      c = *lexptr++;
2290
      if (c == '\\')
2291
        c = parse_escape (parse_gdbarch, &lexptr);
2292
      else if (c == '\'')
2293
        error (_("Empty character constant"));
2294
 
2295
      yylval.typed_val_int.val = c;
2296
      yylval.typed_val_int.type = parse_java_type->builtin_char;
2297
 
2298
      c = *lexptr++;
2299
      if (c != '\'')
2300
        {
2301
          namelen = skip_quoted (tokstart) - tokstart;
2302
          if (namelen > 2)
2303
            {
2304
              lexptr = tokstart + namelen;
2305
              if (lexptr[-1] != '\'')
2306
                error (_("Unmatched single quote"));
2307
              namelen -= 2;
2308
              tokstart++;
2309
              goto tryname;
2310
            }
2311
          error (_("Invalid character constant"));
2312
        }
2313
      return INTEGER_LITERAL;
2314
 
2315
    case '(':
2316
      paren_depth++;
2317
      lexptr++;
2318
      return c;
2319
 
2320
    case ')':
2321
      if (paren_depth == 0)
2322
        return 0;
2323
      paren_depth--;
2324
      lexptr++;
2325
      return c;
2326
 
2327
    case ',':
2328
      if (comma_terminates && paren_depth == 0)
2329
        return 0;
2330
      lexptr++;
2331
      return c;
2332
 
2333
    case '.':
2334
      /* Might be a floating point number.  */
2335
      if (lexptr[1] < '0' || lexptr[1] > '9')
2336
        goto symbol;            /* Nope, must be a symbol. */
2337
      /* FALL THRU into number case.  */
2338
 
2339
    case '0':
2340
    case '1':
2341
    case '2':
2342
    case '3':
2343
    case '4':
2344
    case '5':
2345
    case '6':
2346
    case '7':
2347
    case '8':
2348
    case '9':
2349
      {
2350
        /* It's a number.  */
2351
        int got_dot = 0, got_e = 0, toktype;
2352
        char *p = tokstart;
2353
        int hex = input_radix > 10;
2354
 
2355
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2356
          {
2357
            p += 2;
2358
            hex = 1;
2359
          }
2360
        else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2361
          {
2362
            p += 2;
2363
            hex = 0;
2364
          }
2365
 
2366
        for (;; ++p)
2367
          {
2368
            /* This test includes !hex because 'e' is a valid hex digit
2369
               and thus does not indicate a floating point number when
2370
               the radix is hex.  */
2371
            if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2372
              got_dot = got_e = 1;
2373
            /* This test does not include !hex, because a '.' always indicates
2374
               a decimal floating point number regardless of the radix.  */
2375
            else if (!got_dot && *p == '.')
2376
              got_dot = 1;
2377
            else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2378
                     && (*p == '-' || *p == '+'))
2379
              /* This is the sign of the exponent, not the end of the
2380
                 number.  */
2381
              continue;
2382
            /* We will take any letters or digits.  parse_number will
2383
               complain if past the radix, or if L or U are not final.  */
2384
            else if ((*p < '0' || *p > '9')
2385
                     && ((*p < 'a' || *p > 'z')
2386
                                  && (*p < 'A' || *p > 'Z')))
2387
              break;
2388
          }
2389
        toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2390
        if (toktype == ERROR)
2391
          {
2392
            char *err_copy = (char *) alloca (p - tokstart + 1);
2393
 
2394
            memcpy (err_copy, tokstart, p - tokstart);
2395
            err_copy[p - tokstart] = 0;
2396
            error (_("Invalid number \"%s\""), err_copy);
2397
          }
2398
        lexptr = p;
2399
        return toktype;
2400
      }
2401
 
2402
    case '+':
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
    symbol:
2422
      lexptr++;
2423
      return c;
2424
 
2425
    case '"':
2426
 
2427
      /* Build the gdb internal form of the input string in tempbuf,
2428
         translating any standard C escape forms seen.  Note that the
2429
         buffer is null byte terminated *only* for the convenience of
2430
         debugging gdb itself and printing the buffer contents when
2431
         the buffer contains no embedded nulls.  Gdb does not depend
2432
         upon the buffer being null byte terminated, it uses the length
2433
         string instead.  This allows gdb to handle C strings (as well
2434
         as strings in other languages) with embedded null bytes */
2435
 
2436
      tokptr = ++tokstart;
2437
      tempbufindex = 0;
2438
 
2439
      do {
2440
        /* Grow the static temp buffer if necessary, including allocating
2441
           the first one on demand. */
2442
        if (tempbufindex + 1 >= tempbufsize)
2443
          {
2444
            tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2445
          }
2446
        switch (*tokptr)
2447
          {
2448
          case '\0':
2449
          case '"':
2450
            /* Do nothing, loop will terminate. */
2451
            break;
2452
          case '\\':
2453
            tokptr++;
2454
            c = parse_escape (parse_gdbarch, &tokptr);
2455
            if (c == -1)
2456
              {
2457
                continue;
2458
              }
2459
            tempbuf[tempbufindex++] = c;
2460
            break;
2461
          default:
2462
            tempbuf[tempbufindex++] = *tokptr++;
2463
            break;
2464
          }
2465
      } while ((*tokptr != '"') && (*tokptr != '\0'));
2466
      if (*tokptr++ != '"')
2467
        {
2468
          error (_("Unterminated string in expression"));
2469
        }
2470
      tempbuf[tempbufindex] = '\0';     /* See note above */
2471
      yylval.sval.ptr = tempbuf;
2472
      yylval.sval.length = tempbufindex;
2473
      lexptr = tokptr;
2474
      return (STRING_LITERAL);
2475
    }
2476
 
2477
  if (!(c == '_' || c == '$'
2478
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2479
    /* We must have come across a bad character (e.g. ';').  */
2480
    error (_("Invalid character '%c' in expression"), c);
2481
 
2482
  /* It's a name.  See how long it is.  */
2483
  namelen = 0;
2484
  for (c = tokstart[namelen];
2485
       (c == '_'
2486
        || c == '$'
2487
        || (c >= '0' && c <= '9')
2488
        || (c >= 'a' && c <= 'z')
2489
        || (c >= 'A' && c <= 'Z')
2490
        || c == '<');
2491
       )
2492
    {
2493
      if (c == '<')
2494
        {
2495
          int i = namelen;
2496
          while (tokstart[++i] && tokstart[i] != '>');
2497
          if (tokstart[i] == '>')
2498
            namelen = i;
2499
        }
2500
       c = tokstart[++namelen];
2501
     }
2502
 
2503
  /* The token "if" terminates the expression and is NOT
2504
     removed from the input stream.  */
2505
  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2506
    {
2507
      return 0;
2508
    }
2509
 
2510
  lexptr += namelen;
2511
 
2512
  tryname:
2513
 
2514
  /* Catch specific keywords.  Should be done with a data structure.  */
2515
  switch (namelen)
2516
    {
2517
    case 7:
2518
      if (strncmp (tokstart, "boolean", 7) == 0)
2519
        return BOOLEAN;
2520
      break;
2521
    case 6:
2522
      if (strncmp (tokstart, "double", 6) == 0)
2523
        return DOUBLE;
2524
      break;
2525
    case 5:
2526
      if (strncmp (tokstart, "short", 5) == 0)
2527
        return SHORT;
2528
      if (strncmp (tokstart, "false", 5) == 0)
2529
        {
2530
          yylval.lval = 0;
2531
          return BOOLEAN_LITERAL;
2532
        }
2533
      if (strncmp (tokstart, "super", 5) == 0)
2534
        return SUPER;
2535
      if (strncmp (tokstart, "float", 5) == 0)
2536
        return FLOAT;
2537
      break;
2538
    case 4:
2539
      if (strncmp (tokstart, "long", 4) == 0)
2540
        return LONG;
2541
      if (strncmp (tokstart, "byte", 4) == 0)
2542
        return BYTE;
2543
      if (strncmp (tokstart, "char", 4) == 0)
2544
        return CHAR;
2545
      if (strncmp (tokstart, "true", 4) == 0)
2546
        {
2547
          yylval.lval = 1;
2548
          return BOOLEAN_LITERAL;
2549
        }
2550
      break;
2551
    case 3:
2552
      if (strncmp (tokstart, "int", 3) == 0)
2553
        return INT;
2554
      if (strncmp (tokstart, "new", 3) == 0)
2555
        return NEW;
2556
      break;
2557
    default:
2558
      break;
2559
    }
2560
 
2561
  yylval.sval.ptr = tokstart;
2562
  yylval.sval.length = namelen;
2563
 
2564
  if (*tokstart == '$')
2565
    {
2566
      write_dollar_variable (yylval.sval);
2567
      return VARIABLE;
2568
    }
2569
 
2570
  /* Input names that aren't symbols but ARE valid hex numbers,
2571
     when the input radix permits them, can be names or numbers
2572
     depending on the parse.  Note we support radixes > 16 here.  */
2573
  if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2574
       (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2575
    {
2576
      YYSTYPE newlval;  /* Its value is ignored.  */
2577
      int hextype = parse_number (tokstart, namelen, 0, &newlval);
2578
      if (hextype == INTEGER_LITERAL)
2579
        return NAME_OR_INT;
2580
    }
2581
  return IDENTIFIER;
2582
}
2583
 
2584
void
2585
yyerror (char *msg)
2586
{
2587
  if (prev_lexptr)
2588
    lexptr = prev_lexptr;
2589
 
2590
  if (msg)
2591
    error (_("%s: near `%s'"), msg, lexptr);
2592
  else
2593
    error (_("error in expression, near `%s'"), lexptr);
2594
}
2595
 
2596
static struct type *
2597
java_type_from_name (struct stoken name)
2598
{
2599
  char *tmp = copy_name (name);
2600
  struct type *typ = java_lookup_class (tmp);
2601
  if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
2602
    error (_("No class named `%s'"), tmp);
2603
  return typ;
2604
}
2605
 
2606
/* If NAME is a valid variable name in this scope, push it and return 1.
2607
   Otherwise, return 0. */
2608
 
2609
static int
2610
push_variable (struct stoken name)
2611
{
2612
  char *tmp = copy_name (name);
2613
  int is_a_field_of_this = 0;
2614
  struct symbol *sym;
2615
  sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
2616
                       &is_a_field_of_this);
2617
  if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
2618
    {
2619
      if (symbol_read_needs_frame (sym))
2620
        {
2621
          if (innermost_block == 0 ||
2622
              contained_in (block_found, innermost_block))
2623
            innermost_block = block_found;
2624
        }
2625
 
2626
      write_exp_elt_opcode (OP_VAR_VALUE);
2627
      /* We want to use the selected frame, not another more inner frame
2628
         which happens to be in the same block.  */
2629
      write_exp_elt_block (NULL);
2630
      write_exp_elt_sym (sym);
2631
      write_exp_elt_opcode (OP_VAR_VALUE);
2632
      return 1;
2633
    }
2634
  if (is_a_field_of_this)
2635
    {
2636
      /* it hangs off of `this'.  Must not inadvertently convert from a
2637
         method call to data ref.  */
2638
      if (innermost_block == 0 ||
2639
          contained_in (block_found, innermost_block))
2640
        innermost_block = block_found;
2641
      write_exp_elt_opcode (OP_THIS);
2642
      write_exp_elt_opcode (OP_THIS);
2643
      write_exp_elt_opcode (STRUCTOP_PTR);
2644
      write_exp_string (name);
2645
      write_exp_elt_opcode (STRUCTOP_PTR);
2646
      return 1;
2647
    }
2648
  return 0;
2649
}
2650
 
2651
/* Assuming a reference expression has been pushed, emit the
2652
   STRUCTOP_PTR ops to access the field named NAME.  If NAME is a
2653
   qualified name (has '.'), generate a field access for each part. */
2654
 
2655
static void
2656
push_fieldnames (struct stoken name)
2657
{
2658
  int i;
2659
  struct stoken token;
2660
  token.ptr = name.ptr;
2661
  for (i = 0;  ;  i++)
2662
    {
2663
      if (i == name.length || name.ptr[i] == '.')
2664
        {
2665
          /* token.ptr is start of current field name. */
2666
          token.length = &name.ptr[i] - token.ptr;
2667
          write_exp_elt_opcode (STRUCTOP_PTR);
2668
          write_exp_string (token);
2669
          write_exp_elt_opcode (STRUCTOP_PTR);
2670
          token.ptr += token.length + 1;
2671
        }
2672
      if (i >= name.length)
2673
        break;
2674
    }
2675
}
2676
 
2677
/* Helper routine for push_expression_name.
2678
   Handle a qualified name, where DOT_INDEX is the index of the first '.' */
2679
 
2680
static void
2681
push_qualified_expression_name (struct stoken name, int dot_index)
2682
{
2683
  struct stoken token;
2684
  char *tmp;
2685
  struct type *typ;
2686
 
2687
  token.ptr = name.ptr;
2688
  token.length = dot_index;
2689
 
2690
  if (push_variable (token))
2691
    {
2692
      token.ptr = name.ptr + dot_index + 1;
2693
      token.length = name.length - dot_index - 1;
2694
      push_fieldnames (token);
2695
      return;
2696
    }
2697
 
2698
  token.ptr = name.ptr;
2699
  for (;;)
2700
    {
2701
      token.length = dot_index;
2702
      tmp = copy_name (token);
2703
      typ = java_lookup_class (tmp);
2704
      if (typ != NULL)
2705
        {
2706
          if (dot_index == name.length)
2707
            {
2708
              write_exp_elt_opcode(OP_TYPE);
2709
              write_exp_elt_type(typ);
2710
              write_exp_elt_opcode(OP_TYPE);
2711
              return;
2712
            }
2713
          dot_index++;  /* Skip '.' */
2714
          name.ptr += dot_index;
2715
          name.length -= dot_index;
2716
          dot_index = 0;
2717
          while (dot_index < name.length && name.ptr[dot_index] != '.')
2718
            dot_index++;
2719
          token.ptr = name.ptr;
2720
          token.length = dot_index;
2721
          write_exp_elt_opcode (OP_SCOPE);
2722
          write_exp_elt_type (typ);
2723
          write_exp_string (token);
2724
          write_exp_elt_opcode (OP_SCOPE);
2725
          if (dot_index < name.length)
2726
            {
2727
              dot_index++;
2728
              name.ptr += dot_index;
2729
              name.length -= dot_index;
2730
              push_fieldnames (name);
2731
            }
2732
          return;
2733
        }
2734
      else if (dot_index >= name.length)
2735
        break;
2736
      dot_index++;  /* Skip '.' */
2737
      while (dot_index < name.length && name.ptr[dot_index] != '.')
2738
        dot_index++;
2739
    }
2740
  error (_("unknown type `%.*s'"), name.length, name.ptr);
2741
}
2742
 
2743
/* Handle Name in an expression (or LHS).
2744
   Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
2745
 
2746
static void
2747
push_expression_name (struct stoken name)
2748
{
2749
  char *tmp;
2750
  struct type *typ;
2751
  int i;
2752
 
2753
  for (i = 0;  i < name.length;  i++)
2754
    {
2755
      if (name.ptr[i] == '.')
2756
        {
2757
          /* It's a Qualified Expression Name. */
2758
          push_qualified_expression_name (name, i);
2759
          return;
2760
        }
2761
    }
2762
 
2763
  /* It's a Simple Expression Name. */
2764
 
2765
  if (push_variable (name))
2766
    return;
2767
  tmp = copy_name (name);
2768
  typ = java_lookup_class (tmp);
2769
  if (typ != NULL)
2770
    {
2771
      write_exp_elt_opcode(OP_TYPE);
2772
      write_exp_elt_type(typ);
2773
      write_exp_elt_opcode(OP_TYPE);
2774
    }
2775
  else
2776
    {
2777
      struct minimal_symbol *msymbol;
2778
 
2779
      msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
2780
      if (msymbol != NULL)
2781
        write_exp_msymbol (msymbol);
2782
      else if (!have_full_symbols () && !have_partial_symbols ())
2783
        error (_("No symbol table is loaded.  Use the \"file\" command"));
2784
      else
2785
        error (_("No symbol \"%s\" in current context"), tmp);
2786
    }
2787
 
2788
}
2789
 
2790
 
2791
/* The following two routines, copy_exp and insert_exp, aren't specific to
2792
   Java, so they could go in parse.c, but their only purpose is to support
2793
   the parsing kludges we use in this file, so maybe it's best to isolate
2794
   them here.  */
2795
 
2796
/* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
2797
   into a freshly xmalloc'ed struct expression.  Its language_defn is set
2798
   to null.  */
2799
static struct expression *
2800
copy_exp (struct expression *expr, int endpos)
2801
{
2802
  int len = length_of_subexp (expr, endpos);
2803
  struct expression *new
2804
    = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
2805
  new->nelts = len;
2806
  memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
2807
  new->language_defn = 0;
2808
 
2809
  return new;
2810
}
2811
 
2812
/* Insert the expression NEW into the current expression (expout) at POS.  */
2813
static void
2814
insert_exp (int pos, struct expression *new)
2815
{
2816
  int newlen = new->nelts;
2817
 
2818
  /* Grow expout if necessary.  In this function's only use at present,
2819
     this should never be necessary.  */
2820
  if (expout_ptr + newlen > expout_size)
2821
    {
2822
      expout_size = max (expout_size * 2, expout_ptr + newlen + 10);
2823
      expout = (struct expression *)
2824
        xrealloc ((char *) expout, (sizeof (struct expression)
2825
                                    + EXP_ELEM_TO_BYTES (expout_size)));
2826
    }
2827
 
2828
  {
2829
    int i;
2830
 
2831
    for (i = expout_ptr - 1; i >= pos; i--)
2832
      expout->elts[i + newlen] = expout->elts[i];
2833
  }
2834
 
2835
  memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen));
2836
  expout_ptr += newlen;
2837
}
2838
 
2839
 

powered by: WebSVN 2.1.0

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