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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [jv-exp.tab.c] - Blame information for rev 1777

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

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

powered by: WebSVN 2.1.0

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