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

Subversion Repositories openrisc_me

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

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

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

powered by: WebSVN 2.1.0

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