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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 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
106
yyparse PARAMS ((void));
107
 
108
static int
109
yylex PARAMS ((void));
110
 
111
void
112
yyerror PARAMS ((char *));
113
 
114
static struct type * java_type_from_name PARAMS ((struct stoken));
115
static void push_expression_name PARAMS ((struct stoken));
116
static void push_fieldnames PARAMS ((struct stoken));
117
 
118
static struct expression *copy_exp PARAMS ((struct expression *, int));
119
static void insert_exp PARAMS ((int, struct expression *));
120
 
121
 
122
#line 124 "jv-exp.y"
123
typedef union
124
  {
125
    LONGEST lval;
126
    struct {
127
      LONGEST val;
128
      struct type *type;
129
    } typed_val_int;
130
    struct {
131
      DOUBLEST dval;
132
      struct type *type;
133
    } typed_val_float;
134
    struct symbol *sym;
135
    struct type *tval;
136
    struct stoken sval;
137
    struct ttype tsym;
138
    struct symtoken ssym;
139
    struct block *bval;
140
    enum exp_opcode opcode;
141
    struct internalvar *ivar;
142
    int *ivec;
143
  } YYSTYPE;
144
#line 146 "jv-exp.y"
145
 
146
/* YYSTYPE gets defined by %union */
147
static int
148
parse_number PARAMS ((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,   398,   401,
264
   405,   408,   411,   414,   418,   420,   423,   427,   430,   434,
265
   436,   440,   443,   448,   451,   453,   457,   475,   477,   481,
266
   483,   485,   487,   488,   491,   496,   501,   503,   504,   505,
267
   507,   509,   512,   517,   522,   524,   526,   528,   531,   536,
268
   557,   564,   566,   568,   570,   574,   576,   578,   582,   584,
269
   586,   591,   593,   595,   597,   599,   604,   606,   608,   612,
270
   614,   618,   620,   623,   625,   629,   631,   635,   637,   641,
271
   643,   647,   649,   652,   655,   661,   664,   666,   667,   671
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
{ error ("FIXME - ClassInstanceCreationExpression"); ;
1165
    break;}
1166
case 49:
1167
#line 400 "jv-exp.y"
1168
{ arglist_len = 1; ;
1169
    break;}
1170
case 50:
1171
#line 402 "jv-exp.y"
1172
{ arglist_len++; ;
1173
    break;}
1174
case 51:
1175
#line 407 "jv-exp.y"
1176
{ arglist_len = 0; ;
1177
    break;}
1178
case 53:
1179
#line 413 "jv-exp.y"
1180
{ error ("FIXME - ArrayCreatiionExpression"); ;
1181
    break;}
1182
case 54:
1183
#line 415 "jv-exp.y"
1184
{ error ("FIXME - ArrayCreatiionExpression"); ;
1185
    break;}
1186
case 58:
1187
#line 429 "jv-exp.y"
1188
{ yyval.lval = 1; ;
1189
    break;}
1190
case 59:
1191
#line 431 "jv-exp.y"
1192
{ yyval.lval = yyvsp[-2].lval + 1; ;
1193
    break;}
1194
case 61:
1195
#line 437 "jv-exp.y"
1196
{ yyval.lval = 0; ;
1197
    break;}
1198
case 62:
1199
#line 442 "jv-exp.y"
1200
{ push_fieldnames (yyvsp[0].sval); ;
1201
    break;}
1202
case 63:
1203
#line 444 "jv-exp.y"
1204
{ push_fieldnames (yyvsp[0].sval); ;
1205
    break;}
1206
case 64:
1207
#line 450 "jv-exp.y"
1208
{ error ("method invocation not implemented"); ;
1209
    break;}
1210
case 65:
1211
#line 452 "jv-exp.y"
1212
{ error ("method invocation not implemented"); ;
1213
    break;}
1214
case 66:
1215
#line 454 "jv-exp.y"
1216
{ error ("method invocation not implemented"); ;
1217
    break;}
1218
case 67:
1219
#line 459 "jv-exp.y"
1220
{
1221
                  /* Emit code for the Name now, then exchange it in the
1222
                     expout array with the Expression's code.  We could
1223
                     introduce a OP_SWAP code or a reversed version of
1224
                     BINOP_SUBSCRIPT, but that makes the rest of GDB pay
1225
                     for our parsing kludges.  */
1226
                  struct expression *name_expr;
1227
 
1228
                  push_expression_name (yyvsp[-3].sval);
1229
                  name_expr = copy_exp (expout, expout_ptr);
1230
                  expout_ptr -= name_expr->nelts;
1231
                  insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr),
1232
                              name_expr);
1233
                  free (name_expr);
1234
                  write_exp_elt_opcode (BINOP_SUBSCRIPT);
1235
                ;
1236
    break;}
1237
case 68:
1238
#line 476 "jv-exp.y"
1239
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
1240
    break;}
1241
case 69:
1242
#line 478 "jv-exp.y"
1243
{ write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
1244
    break;}
1245
case 71:
1246
#line 484 "jv-exp.y"
1247
{ push_expression_name (yyvsp[0].sval); ;
1248
    break;}
1249
case 75:
1250
#line 493 "jv-exp.y"
1251
{ write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
1252
    break;}
1253
case 76:
1254
#line 498 "jv-exp.y"
1255
{ write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
1256
    break;}
1257
case 80:
1258
#line 506 "jv-exp.y"
1259
{ write_exp_elt_opcode (UNOP_NEG); ;
1260
    break;}
1261
case 81:
1262
#line 508 "jv-exp.y"
1263
{ write_exp_elt_opcode (UNOP_IND); ;
1264
    break;}
1265
case 83:
1266
#line 514 "jv-exp.y"
1267
{ write_exp_elt_opcode (UNOP_PREINCREMENT); ;
1268
    break;}
1269
case 84:
1270
#line 519 "jv-exp.y"
1271
{ write_exp_elt_opcode (UNOP_PREDECREMENT); ;
1272
    break;}
1273
case 86:
1274
#line 525 "jv-exp.y"
1275
{ write_exp_elt_opcode (UNOP_COMPLEMENT); ;
1276
    break;}
1277
case 87:
1278
#line 527 "jv-exp.y"
1279
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1280
    break;}
1281
case 89:
1282
#line 533 "jv-exp.y"
1283
{ write_exp_elt_opcode (UNOP_CAST);
1284
                  write_exp_elt_type (java_array_type (yyvsp[-3].tval, yyvsp[-2].lval));
1285
                  write_exp_elt_opcode (UNOP_CAST); ;
1286
    break;}
1287
case 90:
1288
#line 537 "jv-exp.y"
1289
{
1290
                  int exp_size = expout_ptr;
1291
                  int last_exp_size = length_of_subexp(expout, expout_ptr);
1292
                  struct type *type;
1293
                  int i;
1294
                  int base = expout_ptr - last_exp_size - 3;
1295
                  if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
1296
                    error ("invalid cast expression");
1297
                  type = expout->elts[base+1].type;
1298
                  /* Remove the 'Expression' and slide the
1299
                     UnaryExpressionNotPlusMinus down to replace it. */
1300
                  for (i = 0;  i < last_exp_size;  i++)
1301
                    expout->elts[base + i] = expout->elts[base + i + 3];
1302
                  expout_ptr -= 3;
1303
                  if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
1304
                    type = lookup_pointer_type (type);
1305
                  write_exp_elt_opcode (UNOP_CAST);
1306
                  write_exp_elt_type (type);
1307
                  write_exp_elt_opcode (UNOP_CAST);
1308
                ;
1309
    break;}
1310
case 91:
1311
#line 558 "jv-exp.y"
1312
{ write_exp_elt_opcode (UNOP_CAST);
1313
                  write_exp_elt_type (java_array_type (java_type_from_name (yyvsp[-3].sval), yyvsp[-2].lval));
1314
                  write_exp_elt_opcode (UNOP_CAST); ;
1315
    break;}
1316
case 93:
1317
#line 567 "jv-exp.y"
1318
{ write_exp_elt_opcode (BINOP_MUL); ;
1319
    break;}
1320
case 94:
1321
#line 569 "jv-exp.y"
1322
{ write_exp_elt_opcode (BINOP_DIV); ;
1323
    break;}
1324
case 95:
1325
#line 571 "jv-exp.y"
1326
{ write_exp_elt_opcode (BINOP_REM); ;
1327
    break;}
1328
case 97:
1329
#line 577 "jv-exp.y"
1330
{ write_exp_elt_opcode (BINOP_ADD); ;
1331
    break;}
1332
case 98:
1333
#line 579 "jv-exp.y"
1334
{ write_exp_elt_opcode (BINOP_SUB); ;
1335
    break;}
1336
case 100:
1337
#line 585 "jv-exp.y"
1338
{ write_exp_elt_opcode (BINOP_LSH); ;
1339
    break;}
1340
case 101:
1341
#line 587 "jv-exp.y"
1342
{ write_exp_elt_opcode (BINOP_RSH); ;
1343
    break;}
1344
case 103:
1345
#line 594 "jv-exp.y"
1346
{ write_exp_elt_opcode (BINOP_LESS); ;
1347
    break;}
1348
case 104:
1349
#line 596 "jv-exp.y"
1350
{ write_exp_elt_opcode (BINOP_GTR); ;
1351
    break;}
1352
case 105:
1353
#line 598 "jv-exp.y"
1354
{ write_exp_elt_opcode (BINOP_LEQ); ;
1355
    break;}
1356
case 106:
1357
#line 600 "jv-exp.y"
1358
{ write_exp_elt_opcode (BINOP_GEQ); ;
1359
    break;}
1360
case 108:
1361
#line 607 "jv-exp.y"
1362
{ write_exp_elt_opcode (BINOP_EQUAL); ;
1363
    break;}
1364
case 109:
1365
#line 609 "jv-exp.y"
1366
{ write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1367
    break;}
1368
case 111:
1369
#line 615 "jv-exp.y"
1370
{ write_exp_elt_opcode (BINOP_BITWISE_AND); ;
1371
    break;}
1372
case 113:
1373
#line 621 "jv-exp.y"
1374
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); ;
1375
    break;}
1376
case 115:
1377
#line 626 "jv-exp.y"
1378
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); ;
1379
    break;}
1380
case 117:
1381
#line 632 "jv-exp.y"
1382
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1383
    break;}
1384
case 119:
1385
#line 638 "jv-exp.y"
1386
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1387
    break;}
1388
case 121:
1389
#line 644 "jv-exp.y"
1390
{ write_exp_elt_opcode (TERNOP_COND); ;
1391
    break;}
1392
case 124:
1393
#line 654 "jv-exp.y"
1394
{ write_exp_elt_opcode (BINOP_ASSIGN); ;
1395
    break;}
1396
case 125:
1397
#line 656 "jv-exp.y"
1398
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1399
                  write_exp_elt_opcode (yyvsp[-1].opcode);
1400
                  write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
1401
    break;}
1402
case 126:
1403
#line 663 "jv-exp.y"
1404
{ push_expression_name (yyvsp[0].sval); ;
1405
    break;}
1406
}
1407
   /* the action file gets copied in in place of this dollarsign */
1408
#line 542 "/usr/lib/bison.simple"
1409
 
1410
  yyvsp -= yylen;
1411
  yyssp -= yylen;
1412
#ifdef YYLSP_NEEDED
1413
  yylsp -= yylen;
1414
#endif
1415
 
1416
#if YYDEBUG != 0
1417
  if (yydebug)
1418
    {
1419
      short *ssp1 = yyss - 1;
1420
      fprintf (stderr, "state stack now");
1421
      while (ssp1 != yyssp)
1422
        fprintf (stderr, " %d", *++ssp1);
1423
      fprintf (stderr, "\n");
1424
    }
1425
#endif
1426
 
1427
  *++yyvsp = yyval;
1428
 
1429
#ifdef YYLSP_NEEDED
1430
  yylsp++;
1431
  if (yylen == 0)
1432
    {
1433
      yylsp->first_line = yylloc.first_line;
1434
      yylsp->first_column = yylloc.first_column;
1435
      yylsp->last_line = (yylsp-1)->last_line;
1436
      yylsp->last_column = (yylsp-1)->last_column;
1437
      yylsp->text = 0;
1438
    }
1439
  else
1440
    {
1441
      yylsp->last_line = (yylsp+yylen-1)->last_line;
1442
      yylsp->last_column = (yylsp+yylen-1)->last_column;
1443
    }
1444
#endif
1445
 
1446
  /* Now "shift" the result of the reduction.
1447
     Determine what state that goes to,
1448
     based on the state we popped back to
1449
     and the rule number reduced by.  */
1450
 
1451
  yyn = yyr1[yyn];
1452
 
1453
  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1454
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1455
    yystate = yytable[yystate];
1456
  else
1457
    yystate = yydefgoto[yyn - YYNTBASE];
1458
 
1459
  goto yynewstate;
1460
 
1461
yyerrlab:   /* here on detecting error */
1462
 
1463
  if (! yyerrstatus)
1464
    /* If not already recovering from an error, report this error.  */
1465
    {
1466
      ++yynerrs;
1467
 
1468
#ifdef YYERROR_VERBOSE
1469
      yyn = yypact[yystate];
1470
 
1471
      if (yyn > YYFLAG && yyn < YYLAST)
1472
        {
1473
          int size = 0;
1474
          char *msg;
1475
          int x, count;
1476
 
1477
          count = 0;
1478
          /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1479
          for (x = (yyn < 0 ? -yyn : 0);
1480
               x < (sizeof(yytname) / sizeof(char *)); x++)
1481
            if (yycheck[x + yyn] == x)
1482
              size += strlen(yytname[x]) + 15, count++;
1483
          msg = (char *) xmalloc(size + 15);
1484
          if (msg != 0)
1485
            {
1486
              strcpy(msg, "parse error");
1487
 
1488
              if (count < 5)
1489
                {
1490
                  count = 0;
1491
                  for (x = (yyn < 0 ? -yyn : 0);
1492
                       x < (sizeof(yytname) / sizeof(char *)); x++)
1493
                    if (yycheck[x + yyn] == x)
1494
                      {
1495
                        strcat(msg, count == 0 ? ", expecting `" : " or `");
1496
                        strcat(msg, yytname[x]);
1497
                        strcat(msg, "'");
1498
                        count++;
1499
                      }
1500
                }
1501
              yyerror(msg);
1502
              free(msg);
1503
            }
1504
          else
1505
            yyerror ("parse error; also virtual memory exceeded");
1506
        }
1507
      else
1508
#endif /* YYERROR_VERBOSE */
1509
        yyerror("parse error");
1510
    }
1511
 
1512
  goto yyerrlab1;
1513
yyerrlab1:   /* here on error raised explicitly by an action */
1514
 
1515
  if (yyerrstatus == 3)
1516
    {
1517
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1518
 
1519
      /* return failure if at end of input */
1520
      if (yychar == YYEOF)
1521
        YYABORT;
1522
 
1523
#if YYDEBUG != 0
1524
      if (yydebug)
1525
        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1526
#endif
1527
 
1528
      yychar = YYEMPTY;
1529
    }
1530
 
1531
  /* Else will try to reuse lookahead token
1532
     after shifting the error token.  */
1533
 
1534
  yyerrstatus = 3;              /* Each real token shifted decrements this */
1535
 
1536
  goto yyerrhandle;
1537
 
1538
yyerrdefault:  /* current state does not do anything special for the error token. */
1539
 
1540
#if 0
1541
  /* This is wrong; only states that explicitly want error tokens
1542
     should shift them.  */
1543
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1544
  if (yyn) goto yydefault;
1545
#endif
1546
 
1547
yyerrpop:   /* pop the current state because it cannot handle the error token */
1548
 
1549
  if (yyssp == yyss) YYABORT;
1550
  yyvsp--;
1551
  yystate = *--yyssp;
1552
#ifdef YYLSP_NEEDED
1553
  yylsp--;
1554
#endif
1555
 
1556
#if YYDEBUG != 0
1557
  if (yydebug)
1558
    {
1559
      short *ssp1 = yyss - 1;
1560
      fprintf (stderr, "Error: state stack now");
1561
      while (ssp1 != yyssp)
1562
        fprintf (stderr, " %d", *++ssp1);
1563
      fprintf (stderr, "\n");
1564
    }
1565
#endif
1566
 
1567
yyerrhandle:
1568
 
1569
  yyn = yypact[yystate];
1570
  if (yyn == YYFLAG)
1571
    goto yyerrdefault;
1572
 
1573
  yyn += YYTERROR;
1574
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1575
    goto yyerrdefault;
1576
 
1577
  yyn = yytable[yyn];
1578
  if (yyn < 0)
1579
    {
1580
      if (yyn == YYFLAG)
1581
        goto yyerrpop;
1582
      yyn = -yyn;
1583
      goto yyreduce;
1584
    }
1585
  else if (yyn == 0)
1586
    goto yyerrpop;
1587
 
1588
  if (yyn == YYFINAL)
1589
    YYACCEPT;
1590
 
1591
#if YYDEBUG != 0
1592
  if (yydebug)
1593
    fprintf(stderr, "Shifting error token, ");
1594
#endif
1595
 
1596
  *++yyvsp = yylval;
1597
#ifdef YYLSP_NEEDED
1598
  *++yylsp = yylloc;
1599
#endif
1600
 
1601
  yystate = yyn;
1602
  goto yynewstate;
1603
 
1604
 yyacceptlab:
1605
  /* YYACCEPT comes here.  */
1606
  if (yyfree_stacks)
1607
    {
1608
      free (yyss);
1609
      free (yyvs);
1610
#ifdef YYLSP_NEEDED
1611
      free (yyls);
1612
#endif
1613
    }
1614
  return 0;
1615
 
1616
 yyabortlab:
1617
  /* YYABORT comes here.  */
1618
  if (yyfree_stacks)
1619
    {
1620
      free (yyss);
1621
      free (yyvs);
1622
#ifdef YYLSP_NEEDED
1623
      free (yyls);
1624
#endif
1625
    }
1626
  return 1;
1627
}
1628
#line 675 "jv-exp.y"
1629
 
1630
/* Take care of parsing a number (anything that starts with a digit).
1631
   Set yylval and return the token type; update lexptr.
1632
   LEN is the number of characters in it.  */
1633
 
1634
/*** Needs some error checking for the float case ***/
1635
 
1636
static int
1637
parse_number (p, len, parsed_float, putithere)
1638
     register char *p;
1639
     register int len;
1640
     int parsed_float;
1641
     YYSTYPE *putithere;
1642
{
1643
  register ULONGEST n = 0;
1644
  ULONGEST limit, limit_div_base;
1645
 
1646
  register int c;
1647
  register int base = input_radix;
1648
 
1649
  struct type *type;
1650
 
1651
  if (parsed_float)
1652
    {
1653
      /* It's a float since it contains a point or an exponent.  */
1654
      char c;
1655
      int num = 0;       /* number of tokens scanned by scanf */
1656
      char saved_char = p[len];
1657
 
1658
      p[len] = 0;        /* null-terminate the token */
1659
      if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
1660
        num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval, &c);
1661
      else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
1662
        num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c);
1663
      else
1664
        {
1665
#ifdef SCANF_HAS_LONG_DOUBLE
1666
          num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c);
1667
#else
1668
          /* Scan it into a double, then assign it to the long double.
1669
             This at least wins with values representable in the range
1670
             of doubles. */
1671
          double temp;
1672
          num = sscanf (p, "%lg%c", &temp, &c);
1673
          putithere->typed_val_float.dval = temp;
1674
#endif
1675
        }
1676
      p[len] = saved_char;      /* restore the input stream */
1677
      if (num != 1)             /* check scanf found ONLY a float ... */
1678
        return ERROR;
1679
      /* See if it has `f' or `d' suffix (float or double).  */
1680
 
1681
      c = tolower (p[len - 1]);
1682
 
1683
      if (c == 'f' || c == 'F')
1684
        putithere->typed_val_float.type = builtin_type_float;
1685
      else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
1686
        putithere->typed_val_float.type = builtin_type_double;
1687
      else
1688
        return ERROR;
1689
 
1690
      return FLOATING_POINT_LITERAL;
1691
    }
1692
 
1693
  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
1694
  if (p[0] == '0')
1695
    switch (p[1])
1696
      {
1697
      case 'x':
1698
      case 'X':
1699
        if (len >= 3)
1700
          {
1701
            p += 2;
1702
            base = 16;
1703
            len -= 2;
1704
          }
1705
        break;
1706
 
1707
      case 't':
1708
      case 'T':
1709
      case 'd':
1710
      case 'D':
1711
        if (len >= 3)
1712
          {
1713
            p += 2;
1714
            base = 10;
1715
            len -= 2;
1716
          }
1717
        break;
1718
 
1719
      default:
1720
        base = 8;
1721
        break;
1722
      }
1723
 
1724
  c = p[len-1];
1725
  limit = (ULONGEST)0xffffffff;
1726
  if (c == 'l' || c == 'L')
1727
    {
1728
      type = java_long_type;
1729
      len--;
1730
      /* A paranoid calculation of (1<<64)-1. */
1731
      limit = ((limit << 16) << 16) | limit;
1732
    }
1733
  else
1734
    {
1735
      type = java_int_type;
1736
    }
1737
  limit_div_base = limit / (ULONGEST) base;
1738
 
1739
  while (--len >= 0)
1740
    {
1741
      c = *p++;
1742
      if (c >= '0' && c <= '9')
1743
        c -= '0';
1744
      else if (c >= 'A' && c <= 'Z')
1745
        c -= 'A' - 10;
1746
      else if (c >= 'a' && c <= 'z')
1747
        c -= 'a' - 10;
1748
      else
1749
        return ERROR;   /* Char not a digit */
1750
      if (c >= base)
1751
        return ERROR;
1752
      if (n > limit_div_base
1753
          || (n *= base) > limit - c)
1754
        error ("Numeric constant too large.");
1755
      n += c;
1756
        }
1757
 
1758
   putithere->typed_val_int.val = n;
1759
   putithere->typed_val_int.type = type;
1760
   return INTEGER_LITERAL;
1761
}
1762
 
1763
struct token
1764
{
1765
  char *operator;
1766
  int token;
1767
  enum exp_opcode opcode;
1768
};
1769
 
1770
static const struct token tokentab3[] =
1771
  {
1772
    {">>=", ASSIGN_MODIFY, BINOP_RSH},
1773
    {"<<=", ASSIGN_MODIFY, BINOP_LSH}
1774
  };
1775
 
1776
static const struct token tokentab2[] =
1777
  {
1778
    {"+=", ASSIGN_MODIFY, BINOP_ADD},
1779
    {"-=", ASSIGN_MODIFY, BINOP_SUB},
1780
    {"*=", ASSIGN_MODIFY, BINOP_MUL},
1781
    {"/=", ASSIGN_MODIFY, BINOP_DIV},
1782
    {"%=", ASSIGN_MODIFY, BINOP_REM},
1783
    {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
1784
    {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
1785
    {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
1786
    {"++", INCREMENT, BINOP_END},
1787
    {"--", DECREMENT, BINOP_END},
1788
    {"&&", ANDAND, BINOP_END},
1789
    {"||", OROR, BINOP_END},
1790
    {"<<", LSH, BINOP_END},
1791
    {">>", RSH, BINOP_END},
1792
    {"==", EQUAL, BINOP_END},
1793
    {"!=", NOTEQUAL, BINOP_END},
1794
    {"<=", LEQ, BINOP_END},
1795
    {">=", GEQ, BINOP_END}
1796
  };
1797
 
1798
/* Read one token, getting characters through lexptr.  */
1799
 
1800
static int
1801
yylex ()
1802
{
1803
  int c;
1804
  int namelen;
1805
  unsigned int i;
1806
  char *tokstart;
1807
  char *tokptr;
1808
  int tempbufindex;
1809
  static char *tempbuf;
1810
  static int tempbufsize;
1811
 
1812
 retry:
1813
 
1814
  tokstart = lexptr;
1815
  /* See if it is a special token of length 3.  */
1816
  for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
1817
    if (STREQN (tokstart, tokentab3[i].operator, 3))
1818
      {
1819
        lexptr += 3;
1820
        yylval.opcode = tokentab3[i].opcode;
1821
        return tokentab3[i].token;
1822
      }
1823
 
1824
  /* See if it is a special token of length 2.  */
1825
  for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
1826
    if (STREQN (tokstart, tokentab2[i].operator, 2))
1827
      {
1828
        lexptr += 2;
1829
        yylval.opcode = tokentab2[i].opcode;
1830
        return tokentab2[i].token;
1831
      }
1832
 
1833
  switch (c = *tokstart)
1834
    {
1835
    case 0:
1836
      return 0;
1837
 
1838
    case ' ':
1839
    case '\t':
1840
    case '\n':
1841
      lexptr++;
1842
      goto retry;
1843
 
1844
    case '\'':
1845
      /* We either have a character constant ('0' or '\177' for example)
1846
         or we have a quoted symbol reference ('foo(int,int)' in C++
1847
         for example). */
1848
      lexptr++;
1849
      c = *lexptr++;
1850
      if (c == '\\')
1851
        c = parse_escape (&lexptr);
1852
      else if (c == '\'')
1853
        error ("Empty character constant.");
1854
 
1855
      yylval.typed_val_int.val = c;
1856
      yylval.typed_val_int.type = java_char_type;
1857
 
1858
      c = *lexptr++;
1859
      if (c != '\'')
1860
        {
1861
          namelen = skip_quoted (tokstart) - tokstart;
1862
          if (namelen > 2)
1863
            {
1864
              lexptr = tokstart + namelen;
1865
              if (lexptr[-1] != '\'')
1866
                error ("Unmatched single quote.");
1867
              namelen -= 2;
1868
              tokstart++;
1869
              goto tryname;
1870
            }
1871
          error ("Invalid character constant.");
1872
        }
1873
      return INTEGER_LITERAL;
1874
 
1875
    case '(':
1876
      paren_depth++;
1877
      lexptr++;
1878
      return c;
1879
 
1880
    case ')':
1881
      if (paren_depth == 0)
1882
        return 0;
1883
      paren_depth--;
1884
      lexptr++;
1885
      return c;
1886
 
1887
    case ',':
1888
      if (comma_terminates && paren_depth == 0)
1889
        return 0;
1890
      lexptr++;
1891
      return c;
1892
 
1893
    case '.':
1894
      /* Might be a floating point number.  */
1895
      if (lexptr[1] < '0' || lexptr[1] > '9')
1896
        goto symbol;            /* Nope, must be a symbol. */
1897
      /* FALL THRU into number case.  */
1898
 
1899
    case '0':
1900
    case '1':
1901
    case '2':
1902
    case '3':
1903
    case '4':
1904
    case '5':
1905
    case '6':
1906
    case '7':
1907
    case '8':
1908
    case '9':
1909
      {
1910
        /* It's a number.  */
1911
        int got_dot = 0, got_e = 0, toktype;
1912
        register char *p = tokstart;
1913
        int hex = input_radix > 10;
1914
 
1915
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
1916
          {
1917
            p += 2;
1918
            hex = 1;
1919
          }
1920
        else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
1921
          {
1922
            p += 2;
1923
            hex = 0;
1924
          }
1925
 
1926
        for (;; ++p)
1927
          {
1928
            /* This test includes !hex because 'e' is a valid hex digit
1929
               and thus does not indicate a floating point number when
1930
               the radix is hex.  */
1931
            if (!hex && !got_e && (*p == 'e' || *p == 'E'))
1932
              got_dot = got_e = 1;
1933
            /* This test does not include !hex, because a '.' always indicates
1934
               a decimal floating point number regardless of the radix.  */
1935
            else if (!got_dot && *p == '.')
1936
              got_dot = 1;
1937
            else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
1938
                     && (*p == '-' || *p == '+'))
1939
              /* This is the sign of the exponent, not the end of the
1940
                 number.  */
1941
              continue;
1942
            /* We will take any letters or digits.  parse_number will
1943
               complain if past the radix, or if L or U are not final.  */
1944
            else if ((*p < '0' || *p > '9')
1945
                     && ((*p < 'a' || *p > 'z')
1946
                                  && (*p < 'A' || *p > 'Z')))
1947
              break;
1948
          }
1949
        toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
1950
        if (toktype == ERROR)
1951
          {
1952
            char *err_copy = (char *) alloca (p - tokstart + 1);
1953
 
1954
            memcpy (err_copy, tokstart, p - tokstart);
1955
            err_copy[p - tokstart] = 0;
1956
            error ("Invalid number \"%s\".", err_copy);
1957
          }
1958
        lexptr = p;
1959
        return toktype;
1960
      }
1961
 
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
    case ':':
1978
    case '=':
1979
    case '{':
1980
    case '}':
1981
    symbol:
1982
      lexptr++;
1983
      return c;
1984
 
1985
    case '"':
1986
 
1987
      /* Build the gdb internal form of the input string in tempbuf,
1988
         translating any standard C escape forms seen.  Note that the
1989
         buffer is null byte terminated *only* for the convenience of
1990
         debugging gdb itself and printing the buffer contents when
1991
         the buffer contains no embedded nulls.  Gdb does not depend
1992
         upon the buffer being null byte terminated, it uses the length
1993
         string instead.  This allows gdb to handle C strings (as well
1994
         as strings in other languages) with embedded null bytes */
1995
 
1996
      tokptr = ++tokstart;
1997
      tempbufindex = 0;
1998
 
1999
      do {
2000
        /* Grow the static temp buffer if necessary, including allocating
2001
           the first one on demand. */
2002
        if (tempbufindex + 1 >= tempbufsize)
2003
          {
2004
            tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2005
          }
2006
        switch (*tokptr)
2007
          {
2008
          case '\0':
2009
          case '"':
2010
            /* Do nothing, loop will terminate. */
2011
            break;
2012
          case '\\':
2013
            tokptr++;
2014
            c = parse_escape (&tokptr);
2015
            if (c == -1)
2016
              {
2017
                continue;
2018
              }
2019
            tempbuf[tempbufindex++] = c;
2020
            break;
2021
          default:
2022
            tempbuf[tempbufindex++] = *tokptr++;
2023
            break;
2024
          }
2025
      } while ((*tokptr != '"') && (*tokptr != '\0'));
2026
      if (*tokptr++ != '"')
2027
        {
2028
          error ("Unterminated string in expression.");
2029
        }
2030
      tempbuf[tempbufindex] = '\0';     /* See note above */
2031
      yylval.sval.ptr = tempbuf;
2032
      yylval.sval.length = tempbufindex;
2033
      lexptr = tokptr;
2034
      return (STRING_LITERAL);
2035
    }
2036
 
2037
  if (!(c == '_' || c == '$'
2038
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2039
    /* We must have come across a bad character (e.g. ';').  */
2040
    error ("Invalid character '%c' in expression.", c);
2041
 
2042
  /* It's a name.  See how long it is.  */
2043
  namelen = 0;
2044
  for (c = tokstart[namelen];
2045
       (c == '_'
2046
        || c == '$'
2047
        || (c >= '0' && c <= '9')
2048
        || (c >= 'a' && c <= 'z')
2049
        || (c >= 'A' && c <= 'Z')
2050
        || c == '<');
2051
       )
2052
    {
2053
      if (c == '<')
2054
        {
2055
          int i = namelen;
2056
          while (tokstart[++i] && tokstart[i] != '>');
2057
          if (tokstart[i] == '>')
2058
            namelen = i;
2059
        }
2060
       c = tokstart[++namelen];
2061
     }
2062
 
2063
  /* The token "if" terminates the expression and is NOT
2064
     removed from the input stream.  */
2065
  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2066
    {
2067
      return 0;
2068
    }
2069
 
2070
  lexptr += namelen;
2071
 
2072
  tryname:
2073
 
2074
  /* Catch specific keywords.  Should be done with a data structure.  */
2075
  switch (namelen)
2076
    {
2077
    case 7:
2078
      if (STREQN (tokstart, "boolean", 7))
2079
        return BOOLEAN;
2080
      break;
2081
    case 6:
2082
      if (STREQN (tokstart, "double", 6))
2083
        return DOUBLE;
2084
      break;
2085
    case 5:
2086
      if (STREQN (tokstart, "short", 5))
2087
        return SHORT;
2088
      if (STREQN (tokstart, "false", 5))
2089
        {
2090
          yylval.lval = 0;
2091
          return BOOLEAN_LITERAL;
2092
        }
2093
      if (STREQN (tokstart, "super", 5))
2094
        return SUPER;
2095
      if (STREQN (tokstart, "float", 5))
2096
        return FLOAT;
2097
      break;
2098
    case 4:
2099
      if (STREQN (tokstart, "long", 4))
2100
        return LONG;
2101
      if (STREQN (tokstart, "byte", 4))
2102
        return BYTE;
2103
      if (STREQN (tokstart, "char", 4))
2104
        return CHAR;
2105
      if (STREQN (tokstart, "true", 4))
2106
        {
2107
          yylval.lval = 1;
2108
          return BOOLEAN_LITERAL;
2109
        }
2110
      if (current_language->la_language == language_cplus
2111
          && STREQN (tokstart, "this", 4))
2112
        {
2113
          static const char this_name[] =
2114
                                 { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
2115
 
2116
          if (lookup_symbol (this_name, expression_context_block,
2117
                             VAR_NAMESPACE, (int *) NULL,
2118
                             (struct symtab **) NULL))
2119
            return THIS;
2120
        }
2121
      break;
2122
    case 3:
2123
      if (STREQN (tokstart, "int", 3))
2124
        return INT;
2125
      if (STREQN (tokstart, "new", 3))
2126
        return NEW;
2127
      break;
2128
    default:
2129
      break;
2130
    }
2131
 
2132
  yylval.sval.ptr = tokstart;
2133
  yylval.sval.length = namelen;
2134
 
2135
  if (*tokstart == '$')
2136
    {
2137
      write_dollar_variable (yylval.sval);
2138
      return VARIABLE;
2139
    }
2140
 
2141
  /* Input names that aren't symbols but ARE valid hex numbers,
2142
     when the input radix permits them, can be names or numbers
2143
     depending on the parse.  Note we support radixes > 16 here.  */
2144
  if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2145
       (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2146
    {
2147
      YYSTYPE newlval;  /* Its value is ignored.  */
2148
      int hextype = parse_number (tokstart, namelen, 0, &newlval);
2149
      if (hextype == INTEGER_LITERAL)
2150
        return NAME_OR_INT;
2151
    }
2152
  return IDENTIFIER;
2153
}
2154
 
2155
void
2156
yyerror (msg)
2157
     char *msg;
2158
{
2159
  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2160
}
2161
 
2162
static struct type *
2163
java_type_from_name (name)
2164
     struct stoken name;
2165
 
2166
{
2167
  char *tmp = copy_name (name);
2168
  struct type *typ = java_lookup_class (tmp);
2169
  if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
2170
    error ("No class named %s.", tmp);
2171
  return typ;
2172
}
2173
 
2174
/* If NAME is a valid variable name in this scope, push it and return 1.
2175
   Otherwise, return 0. */
2176
 
2177
static int
2178
push_variable (name)
2179
     struct stoken name;
2180
 
2181
{
2182
  char *tmp = copy_name (name);
2183
  int is_a_field_of_this = 0;
2184
  struct symbol *sym;
2185
  sym = lookup_symbol (tmp, expression_context_block, VAR_NAMESPACE,
2186
                       &is_a_field_of_this, (struct symtab **) NULL);
2187
  if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
2188
    {
2189
      if (symbol_read_needs_frame (sym))
2190
        {
2191
          if (innermost_block == 0 ||
2192
              contained_in (block_found, innermost_block))
2193
            innermost_block = block_found;
2194
        }
2195
 
2196
      write_exp_elt_opcode (OP_VAR_VALUE);
2197
      /* We want to use the selected frame, not another more inner frame
2198
         which happens to be in the same block.  */
2199
      write_exp_elt_block (NULL);
2200
      write_exp_elt_sym (sym);
2201
      write_exp_elt_opcode (OP_VAR_VALUE);
2202
      return 1;
2203
    }
2204
  if (is_a_field_of_this)
2205
    {
2206
      /* it hangs off of `this'.  Must not inadvertently convert from a
2207
         method call to data ref.  */
2208
      if (innermost_block == 0 ||
2209
          contained_in (block_found, innermost_block))
2210
        innermost_block = block_found;
2211
      write_exp_elt_opcode (OP_THIS);
2212
      write_exp_elt_opcode (OP_THIS);
2213
      write_exp_elt_opcode (STRUCTOP_PTR);
2214
      write_exp_string (name);
2215
      write_exp_elt_opcode (STRUCTOP_PTR);
2216
      return 1;
2217
    }
2218
  return 0;
2219
}
2220
 
2221
/* Assuming a reference expression has been pushed, emit the
2222
   STRUCTOP_STRUCT ops to access the field named NAME.  If NAME is a
2223
   qualified name (has '.'), generate a field access for each part. */
2224
 
2225
static void
2226
push_fieldnames (name)
2227
     struct stoken name;
2228
{
2229
  int i;
2230
  struct stoken token;
2231
  token.ptr = name.ptr;
2232
  for (i = 0;  ;  i++)
2233
    {
2234
      if (i == name.length || name.ptr[i] == '.')
2235
        {
2236
          /* token.ptr is start of current field name. */
2237
          token.length = &name.ptr[i] - token.ptr;
2238
          write_exp_elt_opcode (STRUCTOP_STRUCT);
2239
          write_exp_string (token);
2240
          write_exp_elt_opcode (STRUCTOP_STRUCT);
2241
          token.ptr += token.length + 1;
2242
        }
2243
      if (i >= name.length)
2244
        break;
2245
    }
2246
}
2247
 
2248
/* Helper routine for push_expression_name.
2249
   Handle a qualified name, where DOT_INDEX is the index of the first '.' */
2250
 
2251
static void
2252
push_qualified_expression_name (name, dot_index)
2253
     struct stoken name;
2254
     int dot_index;
2255
{
2256
  struct stoken token;
2257
  char *tmp;
2258
  struct type *typ;
2259
 
2260
  token.ptr = name.ptr;
2261
  token.length = dot_index;
2262
 
2263
  if (push_variable (token))
2264
    {
2265
      token.ptr = name.ptr + dot_index + 1;
2266
      token.length = name.length - dot_index - 1;
2267
      push_fieldnames (token);
2268
      return;
2269
    }
2270
 
2271
  token.ptr = name.ptr;
2272
  for (;;)
2273
    {
2274
      token.length = dot_index;
2275
      tmp = copy_name (token);
2276
      typ = java_lookup_class (tmp);
2277
      if (typ != NULL)
2278
        {
2279
          if (dot_index == name.length)
2280
            {
2281
              write_exp_elt_opcode(OP_TYPE);
2282
              write_exp_elt_type(typ);
2283
              write_exp_elt_opcode(OP_TYPE);
2284
              return;
2285
            }
2286
          dot_index++;  /* Skip '.' */
2287
          name.ptr += dot_index;
2288
          name.length -= dot_index;
2289
          dot_index = 0;
2290
          while (dot_index < name.length && name.ptr[dot_index] != '.')
2291
            dot_index++;
2292
          token.ptr = name.ptr;
2293
          token.length = dot_index;
2294
          write_exp_elt_opcode (OP_SCOPE);
2295
          write_exp_elt_type (typ);
2296
          write_exp_string (token);
2297
          write_exp_elt_opcode (OP_SCOPE);
2298
          if (dot_index < name.length)
2299
            {
2300
              dot_index++;
2301
              name.ptr += dot_index;
2302
              name.length -= dot_index;
2303
              push_fieldnames (name);
2304
            }
2305
          return;
2306
        }
2307
      else if (dot_index >= name.length)
2308
        break;
2309
      dot_index++;  /* Skip '.' */
2310
      while (dot_index < name.length && name.ptr[dot_index] != '.')
2311
        dot_index++;
2312
    }
2313
  error ("unknown type `%.*s'", name.length, name.ptr);
2314
}
2315
 
2316
/* Handle Name in an expression (or LHS).
2317
   Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
2318
 
2319
static void
2320
push_expression_name (name)
2321
     struct stoken name;
2322
{
2323
  char *tmp;
2324
  struct type *typ;
2325
  char *ptr;
2326
  int i;
2327
 
2328
  for (i = 0;  i < name.length;  i++)
2329
    {
2330
      if (name.ptr[i] == '.')
2331
        {
2332
          /* It's a Qualified Expression Name. */
2333
          push_qualified_expression_name (name, i);
2334
          return;
2335
        }
2336
    }
2337
 
2338
  /* It's a Simple Expression Name. */
2339
 
2340
  if (push_variable (name))
2341
    return;
2342
  tmp = copy_name (name);
2343
  typ = java_lookup_class (tmp);
2344
  if (typ != NULL)
2345
    {
2346
      write_exp_elt_opcode(OP_TYPE);
2347
      write_exp_elt_type(typ);
2348
      write_exp_elt_opcode(OP_TYPE);
2349
    }
2350
  else
2351
    {
2352
      struct minimal_symbol *msymbol;
2353
 
2354
      msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
2355
      if (msymbol != NULL)
2356
        {
2357
          write_exp_msymbol (msymbol,
2358
                             lookup_function_type (builtin_type_int),
2359
                             builtin_type_int);
2360
        }
2361
      else if (!have_full_symbols () && !have_partial_symbols ())
2362
        error ("No symbol table is loaded.  Use the \"file\" command.");
2363
      else
2364
        error ("No symbol \"%s\" in current context.", tmp);
2365
    }
2366
 
2367
}
2368
 
2369
 
2370
/* The following two routines, copy_exp and insert_exp, aren't specific to
2371
   Java, so they could go in parse.c, but their only purpose is to support
2372
   the parsing kludges we use in this file, so maybe it's best to isolate
2373
   them here.  */
2374
 
2375
/* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
2376
   into a freshly xmalloc'ed struct expression.  Its language_defn is set
2377
   to null.  */
2378
static struct expression *
2379
copy_exp (expr, endpos)
2380
     struct expression *expr;
2381
     int endpos;
2382
{
2383
  int len = length_of_subexp (expr, endpos);
2384
  struct expression *new
2385
    = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
2386
  new->nelts = len;
2387
  memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
2388
  new->language_defn = 0;
2389
 
2390
  return new;
2391
}
2392
 
2393
/* Insert the expression NEW into the current expression (expout) at POS.  */
2394
static void
2395
insert_exp (pos, new)
2396
     int pos;
2397
     struct expression *new;
2398
{
2399
  int newlen = new->nelts;
2400
 
2401
  /* Grow expout if necessary.  In this function's only use at present,
2402
     this should never be necessary.  */
2403
  if (expout_ptr + newlen > expout_size)
2404
    {
2405
      expout_size = max (expout_size * 2, expout_ptr + newlen + 10);
2406
      expout = (struct expression *)
2407
        xrealloc ((char *) expout, (sizeof (struct expression)
2408
                                    + EXP_ELEM_TO_BYTES (expout_size)));
2409
    }
2410
 
2411
  {
2412
    int i;
2413
 
2414
    for (i = expout_ptr - 1; i >= pos; i--)
2415
      expout->elts[i + newlen] = expout->elts[i];
2416
  }
2417
 
2418
  memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen));
2419
  expout_ptr += newlen;
2420
}

powered by: WebSVN 2.1.0

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