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

Subversion Repositories or1k

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

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

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

powered by: WebSVN 2.1.0

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