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