OSDN Git Service

2000-03-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
[pf3gnuchains/gcc-fork.git] / gcc / java / parse.c
1
2 /*  A Bison parser, made from ./parse.y
3     by GNU Bison version 1.28  */
4
5 #define YYBISON 1  /* Identify Bison output.  */
6
7 #define yyparse java_parse
8 #define yylex java_lex
9 #define yyerror java_error
10 #define yylval java_lval
11 #define yychar java_char
12 #define yydebug java_debug
13 #define yynerrs java_nerrs
14 #define PLUS_TK 257
15 #define MINUS_TK        258
16 #define MULT_TK 259
17 #define DIV_TK  260
18 #define REM_TK  261
19 #define LS_TK   262
20 #define SRS_TK  263
21 #define ZRS_TK  264
22 #define AND_TK  265
23 #define XOR_TK  266
24 #define OR_TK   267
25 #define BOOL_AND_TK     268
26 #define BOOL_OR_TK      269
27 #define EQ_TK   270
28 #define NEQ_TK  271
29 #define GT_TK   272
30 #define GTE_TK  273
31 #define LT_TK   274
32 #define LTE_TK  275
33 #define PLUS_ASSIGN_TK  276
34 #define MINUS_ASSIGN_TK 277
35 #define MULT_ASSIGN_TK  278
36 #define DIV_ASSIGN_TK   279
37 #define REM_ASSIGN_TK   280
38 #define LS_ASSIGN_TK    281
39 #define SRS_ASSIGN_TK   282
40 #define ZRS_ASSIGN_TK   283
41 #define AND_ASSIGN_TK   284
42 #define XOR_ASSIGN_TK   285
43 #define OR_ASSIGN_TK    286
44 #define PUBLIC_TK       287
45 #define PRIVATE_TK      288
46 #define PROTECTED_TK    289
47 #define STATIC_TK       290
48 #define FINAL_TK        291
49 #define SYNCHRONIZED_TK 292
50 #define VOLATILE_TK     293
51 #define TRANSIENT_TK    294
52 #define NATIVE_TK       295
53 #define PAD_TK  296
54 #define ABSTRACT_TK     297
55 #define MODIFIER_TK     298
56 #define DECR_TK 299
57 #define INCR_TK 300
58 #define DEFAULT_TK      301
59 #define IF_TK   302
60 #define THROW_TK        303
61 #define BOOLEAN_TK      304
62 #define DO_TK   305
63 #define IMPLEMENTS_TK   306
64 #define THROWS_TK       307
65 #define BREAK_TK        308
66 #define IMPORT_TK       309
67 #define ELSE_TK 310
68 #define INSTANCEOF_TK   311
69 #define RETURN_TK       312
70 #define VOID_TK 313
71 #define CATCH_TK        314
72 #define INTERFACE_TK    315
73 #define CASE_TK 316
74 #define EXTENDS_TK      317
75 #define FINALLY_TK      318
76 #define SUPER_TK        319
77 #define WHILE_TK        320
78 #define CLASS_TK        321
79 #define SWITCH_TK       322
80 #define CONST_TK        323
81 #define TRY_TK  324
82 #define FOR_TK  325
83 #define NEW_TK  326
84 #define CONTINUE_TK     327
85 #define GOTO_TK 328
86 #define PACKAGE_TK      329
87 #define THIS_TK 330
88 #define BYTE_TK 331
89 #define SHORT_TK        332
90 #define INT_TK  333
91 #define LONG_TK 334
92 #define CHAR_TK 335
93 #define INTEGRAL_TK     336
94 #define FLOAT_TK        337
95 #define DOUBLE_TK       338
96 #define FP_TK   339
97 #define ID_TK   340
98 #define REL_QM_TK       341
99 #define REL_CL_TK       342
100 #define NOT_TK  343
101 #define NEG_TK  344
102 #define ASSIGN_ANY_TK   345
103 #define ASSIGN_TK       346
104 #define OP_TK   347
105 #define CP_TK   348
106 #define OCB_TK  349
107 #define CCB_TK  350
108 #define OSB_TK  351
109 #define CSB_TK  352
110 #define SC_TK   353
111 #define C_TK    354
112 #define DOT_TK  355
113 #define STRING_LIT_TK   356
114 #define CHAR_LIT_TK     357
115 #define INT_LIT_TK      358
116 #define FP_LIT_TK       359
117 #define TRUE_TK 360
118 #define FALSE_TK        361
119 #define BOOL_LIT_TK     362
120 #define NULL_TK 363
121
122 #line 48 "./parse.y"
123
124 #include "config.h"
125 #include "system.h"
126 #include <dirent.h>
127 #include "tree.h"
128 #include "rtl.h"
129 #include "obstack.h"
130 #include "toplev.h"
131 #include "flags.h"
132 #include "java-tree.h"
133 #include "jcf.h"
134 #include "lex.h"
135 #include "parse.h"
136 #include "zipfile.h"
137 #include "convert.h"
138 #include "buffer.h"
139 #include "xref.h"
140 #include "function.h"
141 #include "except.h"
142 #include "defaults.h"
143
144 /* Local function prototypes */
145 static char *java_accstring_lookup PARAMS ((int));
146 static void  classitf_redefinition_error PARAMS ((const char *,tree, tree, tree));
147 static void  variable_redefinition_error PARAMS ((tree, tree, tree, int));
148 static tree  create_class PARAMS ((int, tree, tree, tree));
149 static tree  create_interface PARAMS ((int, tree, tree));
150 static tree  find_field PARAMS ((tree, tree));
151 static tree lookup_field_wrapper PARAMS ((tree, tree));
152 static int   duplicate_declaration_error_p PARAMS ((tree, tree, tree));
153 static void  register_fields PARAMS ((int, tree, tree));
154 static tree parser_qualified_classname PARAMS ((tree));
155 static int  parser_check_super PARAMS ((tree, tree, tree));
156 static int  parser_check_super_interface PARAMS ((tree, tree, tree));
157 static void check_modifiers_consistency PARAMS ((int));
158 static tree lookup_cl PARAMS ((tree));
159 static tree lookup_java_method2 PARAMS ((tree, tree, int));
160 static tree method_header PARAMS ((int, tree, tree, tree));
161 static void fix_method_argument_names PARAMS ((tree ,tree));
162 static tree method_declarator PARAMS ((tree, tree));
163 static void parse_warning_context PARAMS ((tree cl, const char *msg, ...))
164   ATTRIBUTE_PRINTF_2;
165 static void issue_warning_error_from_context PARAMS ((tree, const char *msg, va_list));
166 static void parse_ctor_invocation_error PARAMS ((void));
167 static tree parse_jdk1_1_error PARAMS ((const char *));
168 static void complete_class_report_errors PARAMS ((jdep *));
169 static int process_imports PARAMS ((void));
170 static void read_import_dir PARAMS ((tree));
171 static int find_in_imports_on_demand PARAMS ((tree));
172 static int find_in_imports PARAMS ((tree));
173 static int check_pkg_class_access PARAMS ((tree, tree));
174 static tree resolve_package PARAMS ((tree, tree *));
175 static tree lookup_package_type PARAMS ((const char *, int));
176 static tree lookup_package_type_and_set_next PARAMS ((const char *, int, tree *));
177 static tree resolve_class PARAMS ((tree, tree, tree));
178 static void declare_local_variables PARAMS ((int, tree, tree));
179 static void source_start_java_method PARAMS ((tree));
180 static void source_end_java_method PARAMS ((void));
181 static void expand_start_java_method PARAMS ((tree));
182 static tree find_name_in_single_imports PARAMS ((tree));
183 static void check_abstract_method_header PARAMS ((tree));
184 static tree lookup_java_interface_method2 PARAMS ((tree, tree));
185 static tree resolve_expression_name PARAMS ((tree, tree *));
186 static tree maybe_create_class_interface_decl PARAMS ((tree, tree, tree));
187 static int check_class_interface_creation PARAMS ((int, int, tree, 
188                                                   tree, tree, tree));
189 static tree patch_method_invocation PARAMS ((tree, tree, tree, 
190                                             int *, tree *));
191 static int breakdown_qualified PARAMS ((tree *, tree *, tree));
192 static tree resolve_and_layout PARAMS ((tree, tree));
193 static tree resolve_no_layout PARAMS ((tree, tree));
194 static int invocation_mode PARAMS ((tree, int));
195 static tree find_applicable_accessible_methods_list PARAMS ((int, tree, 
196                                                             tree, tree));
197 static void search_applicable_methods_list PARAMS ((int, tree, tree, tree, 
198                                                    tree *, tree *));
199 static tree find_most_specific_methods_list PARAMS ((tree));
200 static int argument_types_convertible PARAMS ((tree, tree));
201 static tree patch_invoke PARAMS ((tree, tree, tree));
202 static tree lookup_method_invoke PARAMS ((int, tree, tree, tree, tree));
203 static tree register_incomplete_type PARAMS ((int, tree, tree, tree));
204 static tree obtain_incomplete_type PARAMS ((tree));
205 static tree java_complete_lhs PARAMS ((tree));
206 static tree java_complete_tree PARAMS ((tree));
207 static int java_pre_expand_clinit PARAMS ((tree));
208 static void java_complete_expand_method PARAMS ((tree));
209 static int  unresolved_type_p PARAMS ((tree, tree *));
210 static void create_jdep_list PARAMS ((struct parser_ctxt *));
211 static tree build_expr_block PARAMS ((tree, tree));
212 static tree enter_block PARAMS ((void));
213 static tree enter_a_block PARAMS ((tree));
214 static tree exit_block PARAMS ((void));
215 static tree lookup_name_in_blocks PARAMS ((tree));
216 static void maybe_absorb_scoping_blocks PARAMS ((void));
217 static tree build_method_invocation PARAMS ((tree, tree));
218 static tree build_new_invocation PARAMS ((tree, tree));
219 static tree build_assignment PARAMS ((int, int, tree, tree));
220 static tree build_binop PARAMS ((enum tree_code, int, tree, tree));
221 static int check_final_assignment PARAMS ((tree ,tree));
222 static tree patch_assignment PARAMS ((tree, tree, tree ));
223 static tree patch_binop PARAMS ((tree, tree, tree));
224 static tree build_unaryop PARAMS ((int, int, tree));
225 static tree build_incdec PARAMS ((int, int, tree, int));
226 static tree patch_unaryop PARAMS ((tree, tree));
227 static tree build_cast PARAMS ((int, tree, tree));
228 static tree build_null_of_type PARAMS ((tree));
229 static tree patch_cast PARAMS ((tree, tree));
230 static int valid_ref_assignconv_cast_p PARAMS ((tree, tree, int));
231 static int valid_builtin_assignconv_identity_widening_p PARAMS ((tree, tree));
232 static int valid_cast_to_p PARAMS ((tree, tree));
233 static int valid_method_invocation_conversion_p PARAMS ((tree, tree));
234 static tree try_builtin_assignconv PARAMS ((tree, tree, tree));
235 static tree try_reference_assignconv PARAMS ((tree, tree));
236 static tree build_unresolved_array_type PARAMS ((tree));
237 static tree build_array_from_name PARAMS ((tree, tree, tree, tree *));
238 static tree build_array_ref PARAMS ((int, tree, tree));
239 static tree patch_array_ref PARAMS ((tree));
240 static tree make_qualified_name PARAMS ((tree, tree, int));
241 static tree merge_qualified_name PARAMS ((tree, tree));
242 static tree make_qualified_primary PARAMS ((tree, tree, int));
243 static int resolve_qualified_expression_name PARAMS ((tree, tree *, 
244                                                      tree *, tree *));
245 static void qualify_ambiguous_name PARAMS ((tree));
246 static void maybe_generate_clinit PARAMS ((void));
247 static tree resolve_field_access PARAMS ((tree, tree *, tree *));
248 static tree build_newarray_node PARAMS ((tree, tree, int));
249 static tree patch_newarray PARAMS ((tree));
250 static tree resolve_type_during_patch PARAMS ((tree));
251 static tree build_this PARAMS ((int));
252 static tree build_return PARAMS ((int, tree));
253 static tree patch_return PARAMS ((tree));
254 static tree maybe_access_field PARAMS ((tree, tree, tree));
255 static int complete_function_arguments PARAMS ((tree));
256 static int check_for_static_method_reference PARAMS ((tree, tree, tree, tree, tree));
257 static int not_accessible_p PARAMS ((tree, tree, int));
258 static void check_deprecation PARAMS ((tree, tree));
259 static int class_in_current_package PARAMS ((tree));
260 static tree build_if_else_statement PARAMS ((int, tree, tree, tree));
261 static tree patch_if_else_statement PARAMS ((tree));
262 static tree add_stmt_to_compound PARAMS ((tree, tree, tree));
263 static tree add_stmt_to_block PARAMS ((tree, tree, tree));
264 static tree patch_exit_expr PARAMS ((tree));
265 static tree build_labeled_block PARAMS ((int, tree));
266 static tree finish_labeled_statement PARAMS ((tree, tree));
267 static tree build_bc_statement PARAMS ((int, int, tree));
268 static tree patch_bc_statement PARAMS ((tree));
269 static tree patch_loop_statement PARAMS ((tree));
270 static tree build_new_loop PARAMS ((tree));
271 static tree build_loop_body PARAMS ((int, tree, int));
272 static tree finish_loop_body PARAMS ((int, tree, tree, int));
273 static tree build_debugable_stmt PARAMS ((int, tree));
274 static tree finish_for_loop PARAMS ((int, tree, tree, tree));
275 static tree patch_switch_statement PARAMS ((tree));
276 static tree string_constant_concatenation PARAMS ((tree, tree));
277 static tree build_string_concatenation PARAMS ((tree, tree));
278 static tree patch_string_cst PARAMS ((tree));
279 static tree patch_string PARAMS ((tree));
280 static tree build_try_statement PARAMS ((int, tree, tree));
281 static tree build_try_finally_statement PARAMS ((int, tree, tree));
282 static tree patch_try_statement PARAMS ((tree));
283 static tree patch_synchronized_statement PARAMS ((tree, tree));
284 static tree patch_throw_statement PARAMS ((tree, tree));
285 static void check_thrown_exceptions PARAMS ((int, tree));
286 static int check_thrown_exceptions_do PARAMS ((tree));
287 static void purge_unchecked_exceptions PARAMS ((tree));
288 static void check_throws_clauses PARAMS ((tree, tree, tree));
289 static void finish_method_declaration PARAMS ((tree));
290 static tree build_super_invocation PARAMS ((tree));
291 static int verify_constructor_circularity PARAMS ((tree, tree));
292 static char *constructor_circularity_msg PARAMS ((tree, tree));
293 static tree build_this_super_qualified_invocation PARAMS ((int, tree, tree,
294                                                           int, int));
295 static const char *get_printable_method_name PARAMS ((tree));
296 static tree patch_conditional_expr PARAMS ((tree, tree, tree));
297 static void maybe_generate_finit PARAMS ((void));
298 static void fix_constructors PARAMS ((tree));
299 static int verify_constructor_super PARAMS ((void));
300 static tree create_artificial_method PARAMS ((tree, int, tree, tree, tree));
301 static void start_artificial_method_body PARAMS ((tree));
302 static void end_artificial_method_body PARAMS ((tree));
303 static int check_method_redefinition PARAMS ((tree, tree));
304 static int reset_method_name PARAMS ((tree));
305 static void java_check_regular_methods PARAMS ((tree));
306 static void java_check_abstract_methods PARAMS ((tree));
307 static tree maybe_build_primttype_type_ref PARAMS ((tree, tree));
308 static void unreachable_stmt_error PARAMS ((tree));
309 static tree find_expr_with_wfl PARAMS ((tree));
310 static void missing_return_error PARAMS ((tree));
311 static tree build_new_array_init PARAMS ((int, tree));
312 static tree patch_new_array_init PARAMS ((tree, tree));
313 static tree maybe_build_array_element_wfl PARAMS ((tree));
314 static int array_constructor_check_entry PARAMS ((tree, tree));
315 static const char *purify_type_name PARAMS ((const char *));
316 static tree fold_constant_for_init PARAMS ((tree, tree));
317 static tree strip_out_static_field_access_decl PARAMS ((tree));
318 static jdeplist *reverse_jdep_list PARAMS ((struct parser_ctxt *));
319 static void static_ref_err PARAMS ((tree, tree, tree));
320 static void parser_add_interface PARAMS ((tree, tree, tree));
321 static void add_superinterfaces PARAMS ((tree, tree));
322 static tree jdep_resolve_class PARAMS ((jdep *));
323 static int note_possible_classname PARAMS ((const char *, int));
324 static void java_complete_expand_methods PARAMS ((void));
325 static void java_expand_finals PARAMS ((void));
326 static tree cut_identifier_in_qualified PARAMS ((tree));
327 static tree java_stabilize_reference PARAMS ((tree));
328 static tree do_unary_numeric_promotion PARAMS ((tree));
329 static char * operator_string PARAMS ((tree));
330 static tree do_merge_string_cste PARAMS ((tree, const char *, int, int));
331 static tree merge_string_cste PARAMS ((tree, tree, int));
332 static tree java_refold PARAMS ((tree));
333 static int java_decl_equiv PARAMS ((tree, tree));
334 static int binop_compound_p PARAMS ((enum tree_code));
335 static tree search_loop PARAMS ((tree));
336 static int labeled_block_contains_loop_p PARAMS ((tree, tree));
337 static void check_abstract_method_definitions PARAMS ((int, tree, tree));
338 static void java_check_abstract_method_definitions PARAMS ((tree));
339 static void java_debug_context_do PARAMS ((int));
340
341 /* Number of error found so far. */
342 int java_error_count; 
343 /* Number of warning found so far. */
344 int java_warning_count;
345 /* Tell when not to fold, when doing xrefs */
346 int do_not_fold;
347
348 /* The current parser context */
349 struct parser_ctxt *ctxp;
350
351 /* List of things that were analyzed for which code will be generated */
352 static struct parser_ctxt *ctxp_for_generation = NULL;
353
354 /* binop_lookup maps token to tree_code. It is used where binary
355    operations are involved and required by the parser. RDIV_EXPR
356    covers both integral/floating point division. The code is changed
357    once the type of both operator is worked out.  */
358
359 static enum tree_code binop_lookup[19] = 
360   { 
361     PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
362     LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR, 
363     BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
364     TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
365     EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
366    };
367 #define BINOP_LOOKUP(VALUE)                                             \
368   binop_lookup [((VALUE) - PLUS_TK)%                                    \
369                 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
370
371 /* This is the end index for binary operators that can also be used
372    in compound assignements. */
373 #define BINOP_COMPOUND_CANDIDATES 11
374
375 /* Fake WFL used to report error message. It is initialized once if
376    needed and reused with it's location information is overriden.  */
377 tree wfl_operator = NULL_TREE;
378
379 /* The "$L" identifier we use to create labels.  */
380 static tree label_id = NULL_TREE;
381
382 /* The "StringBuffer" identifier used for the String `+' operator. */
383 static tree wfl_string_buffer = NULL_TREE; 
384
385 /* The "append" identifier used for String `+' operator.  */
386 static tree wfl_append = NULL_TREE;
387
388 /* The "toString" identifier used for String `+' operator. */
389 static tree wfl_to_string = NULL_TREE;
390
391 /* The "java.lang" import qualified name.  */
392 static tree java_lang_id = NULL_TREE;
393
394 /* The "java.lang.Cloneable" qualified name.  */
395 static tree java_lang_cloneable = NULL_TREE;
396
397 /* Context and flag for static blocks */
398 static tree current_static_block = NULL_TREE;
399
400 /* The list of all packages we've seen so far */
401 static tree package_list = NULL_TREE;
402  
403 /* Check modifiers. If one doesn't fit, retrieve it in its declaration
404    line and point it out.  */
405 /* Should point out the one that don't fit. ASCII/unicode, going
406    backward. FIXME */
407
408 #define check_modifiers(__message, __value, __mask) do {        \
409   if ((__value) & ~(__mask))                                    \
410     {                                                           \
411       int i, remainder = (__value) & ~(__mask);                 \
412       for (i = 0; i <= 10; i++)                                 \
413         if ((1 << i) & remainder)                               \
414           parse_error_context (ctxp->modifier_ctx [i], (__message), \
415                                java_accstring_lookup (1 << i)); \
416     }                                                           \
417 } while (0)
418
419
420 #line 346 "./parse.y"
421 typedef union {
422   tree node;
423   int sub_token;
424   struct {
425     int token;
426     int location;
427   } operator;
428   int value;
429 } YYSTYPE;
430 #line 356 "./parse.y"
431
432 #include "lex.c"
433 #ifndef YYDEBUG
434 #define YYDEBUG 1
435 #endif
436
437 #include <stdio.h>
438
439 #ifndef __cplusplus
440 #ifndef __STDC__
441 #define const
442 #endif
443 #endif
444
445
446
447 #define YYFINAL         777
448 #define YYFLAG          -32768
449 #define YYNTBASE        110
450
451 #define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 267)
452
453 static const char yytranslate[] = {     0,
454      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
455      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
457      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
458      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
464      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
465      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
466      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
467      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
468      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
469      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
470      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
471      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
472      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
473      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
474      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
475      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
476      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
477      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
478      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
479      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
480      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
481     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
482     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
483     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
484     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
485     57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
486     67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
487     77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
488     87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
489     97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
490    107,   108,   109
491 };
492
493 #if YYDEBUG != 0
494 static const short yyprhs[] = {     0,
495      0,     2,     4,     6,     8,    10,    12,    14,    16,    18,
496     20,    22,    24,    26,    28,    30,    32,    34,    38,    42,
497     46,    50,    54,    56,    58,    60,    64,    66,    67,    69,
498     71,    73,    76,    79,    82,    86,    88,    91,    93,    96,
499    100,   103,   107,   109,   111,   115,   118,   122,   128,   133,
500    139,   141,   143,   145,   147,   149,   152,   153,   161,   162,
501    169,   173,   176,   180,   185,   186,   189,   193,   196,   197,
502    200,   203,   205,   209,   213,   216,   220,   222,   225,   227,
503    229,   231,   233,   235,   238,   240,   242,   244,   248,   253,
504    255,   259,   263,   265,   269,   273,   278,   280,   284,   287,
505    291,   295,   297,   299,   300,   304,   307,   311,   315,   320,
506    325,   328,   332,   335,   339,   342,   346,   351,   355,   359,
507    363,   365,   369,   373,   376,   380,   383,   387,   389,   390,
508    393,   396,   398,   402,   406,   408,   411,   413,   416,   420,
509    422,   423,   427,   430,   434,   438,   443,   446,   450,   454,
510    459,   461,   464,   469,   475,   483,   490,   492,   494,   495,
511    500,   501,   507,   508,   514,   515,   522,   526,   531,   534,
512    538,   541,   545,   548,   552,   554,   557,   559,   561,   563,
513    565,   567,   570,   573,   576,   580,   585,   587,   591,   595,
514    598,   602,   604,   606,   608,   611,   613,   615,   617,   620,
515    623,   627,   629,   631,   633,   635,   637,   639,   641,   643,
516    645,   647,   649,   651,   653,   655,   657,   659,   661,   663,
517    665,   667,   669,   671,   673,   676,   679,   682,   685,   688,
518    691,   694,   697,   701,   706,   711,   717,   722,   728,   735,
519    743,   750,   752,   754,   756,   758,   760,   762,   764,   770,
520    773,   777,   782,   790,   798,   799,   803,   808,   811,   815,
521    821,   824,   828,   832,   837,   839,   842,   845,   847,   850,
522    854,   857,   860,   864,   867,   872,   875,   878,   882,   887,
523    890,   892,   900,   908,   915,   919,   925,   930,   938,   945,
524    948,   951,   955,   958,   959,   961,   963,   966,   967,   969,
525    971,   975,   979,   982,   986,   989,   993,   996,  1000,  1003,
526   1007,  1010,  1014,  1017,  1021,  1025,  1028,  1032,  1038,  1044,
527   1047,  1052,  1056,  1058,  1062,  1066,  1071,  1074,  1076,  1079,
528   1082,  1087,  1090,  1094,  1099,  1102,  1105,  1107,  1109,  1111,
529   1113,  1117,  1119,  1121,  1123,  1125,  1129,  1133,  1137,  1141,
530   1145,  1149,  1153,  1157,  1163,  1168,  1175,  1181,  1186,  1192,
531   1198,  1205,  1209,  1213,  1218,  1224,  1227,  1231,  1235,  1239,
532   1241,  1245,  1249,  1253,  1257,  1262,  1267,  1272,  1277,  1281,
533   1285,  1287,  1290,  1294,  1298,  1301,  1304,  1308,  1312,  1316,
534   1320,  1323,  1327,  1332,  1338,  1345,  1351,  1358,  1363,  1368,
535   1373,  1378,  1382,  1387,  1391,  1396,  1398,  1400,  1402,  1404,
536   1407,  1410,  1412,  1414,  1417,  1420,  1422,  1425,  1428,  1431,
537   1434,  1437,  1440,  1442,  1445,  1448,  1450,  1453,  1456,  1462,
538   1467,  1472,  1478,  1483,  1486,  1492,  1497,  1503,  1505,  1509,
539   1513,  1517,  1521,  1525,  1529,  1531,  1535,  1539,  1543,  1547,
540   1549,  1553,  1557,  1561,  1565,  1569,  1573,  1575,  1579,  1583,
541   1587,  1591,  1595,  1599,  1603,  1607,  1611,  1615,  1617,  1621,
542   1625,  1629,  1633,  1635,  1639,  1643,  1645,  1649,  1653,  1655,
543   1659,  1663,  1665,  1669,  1673,  1675,  1679,  1683,  1685,  1691,
544   1696,  1700,  1706,  1708,  1710,  1714,  1718,  1720,  1722,  1724,
545   1726,  1728,  1730
546 };
547
548 static const short yyrhs[] = {   123,
549      0,   104,     0,   105,     0,   108,     0,   103,     0,   102,
550      0,   109,     0,   113,     0,   114,     0,    82,     0,    85,
551      0,    50,     0,   115,     0,   118,     0,   119,     0,   115,
552      0,   115,     0,   113,    97,    98,     0,   119,    97,    98,
553      0,   118,    97,    98,     0,   113,    97,     1,     0,   118,
554     97,     1,     0,   120,     0,   121,     0,   122,     0,   119,
555    101,   122,     0,    86,     0,     0,   126,     0,   124,     0,
556    125,     0,   126,   124,     0,   126,   125,     0,   124,   125,
557      0,   126,   124,   125,     0,   127,     0,   124,   127,     0,
558    130,     0,   125,   130,     0,    75,   119,    99,     0,    75,
559      1,     0,    75,   119,     1,     0,   128,     0,   129,     0,
560     55,   119,    99,     0,    55,     1,     0,    55,   119,     1,
561      0,    55,   119,   101,     5,    99,     0,    55,   119,   101,
562      1,     0,    55,   119,   101,     5,     1,     0,   132,     0,
563    167,     0,    99,     0,     1,     0,    44,     0,   131,    44,
564      0,     0,   131,    67,   122,   135,   136,   133,   138,     0,
565      0,    67,   122,   135,   136,   134,   138,     0,   131,    67,
566      1,     0,    67,     1,     0,    67,   122,     1,     0,   131,
567     67,   122,     1,     0,     0,    63,   116,     0,    63,   116,
568      1,     0,    63,     1,     0,     0,    52,   137,     0,    52,
569      1,     0,   117,     0,   137,   100,   117,     0,   137,   100,
570      1,     0,    95,    96,     0,    95,   139,    96,     0,   140,
571      0,   139,   140,     0,   141,     0,   157,     0,   159,     0,
572    180,     0,   142,     0,   142,    99,     0,   147,     0,   132,
573      0,   167,     0,   112,   143,    99,     0,   131,   112,   143,
574     99,     0,   144,     0,   143,   100,   144,     0,   143,   100,
575      1,     0,   145,     0,   145,    92,   146,     0,   145,    92,
576      1,     0,   145,    92,   146,     1,     0,   122,     0,   145,
577     97,    98,     0,   122,     1,     0,   145,    97,     1,     0,
578    145,    98,     1,     0,   265,     0,   178,     0,     0,   149,
579    148,   156,     0,   149,     1,     0,   112,   150,   154,     0,
580     59,   150,   154,     0,   131,   112,   150,   154,     0,   131,
581     59,   150,   154,     0,   112,     1,     0,   131,   112,     1,
582      0,    59,     1,     0,   131,    59,     1,     0,   131,     1,
583      0,   122,    93,    94,     0,   122,    93,   151,    94,     0,
584    150,    97,    98,     0,   122,    93,     1,     0,   150,    97,
585      1,     0,   152,     0,   151,   100,   152,     0,   151,   100,
586      1,     0,   112,   145,     0,   153,   112,   145,     0,   112,
587      1,     0,   153,   112,     1,     0,   131,     0,     0,    53,
588    155,     0,    53,     1,     0,   116,     0,   155,   100,   116,
589      0,   155,   100,     1,     0,   180,     0,   180,    99,     0,
590     99,     0,   158,   180,     0,   158,   180,    99,     0,    44,
591      0,     0,   161,   160,   163,     0,   162,   154,     0,   131,
592    162,   154,     0,   120,    93,    94,     0,   120,    93,   151,
593     94,     0,   181,   164,     0,   181,   165,   164,     0,   181,
594    183,   164,     0,   181,   165,   183,   164,     0,   182,     0,
595    182,    99,     0,   166,    93,    94,    99,     0,   166,    93,
596    234,    94,    99,     0,   119,   101,    65,    93,   234,    94,
597     99,     0,   119,   101,    65,    93,    94,    99,     0,    76,
598      0,    65,     0,     0,    61,   122,   168,   173,     0,     0,
599    131,    61,   122,   169,   173,     0,     0,    61,   122,   172,
600    170,   173,     0,     0,   131,    61,   122,   172,   171,   173,
601      0,    61,   122,     1,     0,   131,    61,   122,     1,     0,
602     63,   117,     0,   172,   100,   117,     0,    63,     1,     0,
603    172,   100,     1,     0,    95,    96,     0,    95,   174,    96,
604      0,   175,     0,   174,   175,     0,   176,     0,   177,     0,
605    132,     0,   167,     0,   142,     0,   149,    99,     0,   149,
606      1,     0,    95,    96,     0,    95,   179,    96,     0,    95,
607    179,   100,    96,     0,   146,     0,   179,   100,   146,     0,
608    179,   100,     1,     0,    95,    96,     0,   181,   183,   182,
609      0,    95,     0,    96,     0,   184,     0,   183,   184,     0,
610    185,     0,   187,     0,   132,     0,   186,    99,     0,   112,
611    143,     0,   153,   112,   143,     0,   189,     0,   192,     0,
612    196,     0,   197,     0,   208,     0,   212,     0,   189,     0,
613    193,     0,   198,     0,   209,     0,   213,     0,   180,     0,
614    190,     0,   194,     0,   199,     0,   211,     0,   219,     0,
615    220,     0,   221,     0,   223,     0,   222,     0,   225,     0,
616     99,     0,   122,    88,     0,   191,   187,     0,   122,     1,
617      0,   191,   188,     0,   195,    99,     0,     1,    99,     0,
618      1,    95,     0,     1,    96,     0,   166,    93,     1,     0,
619    166,    93,    94,     1,     0,   166,    93,   234,     1,     0,
620    166,    93,   234,    94,     1,     0,   119,   101,    65,     1,
621      0,   119,   101,    65,    93,     1,     0,   119,   101,    65,
622     93,   234,     1,     0,   119,   101,    65,    93,   234,    94,
623      1,     0,   119,   101,    65,    93,    94,     1,     0,   262,
624      0,   246,     0,   247,     0,   243,     0,   244,     0,   240,
625      0,   232,     0,    48,    93,   265,    94,   187,     0,    48,
626      1,     0,    48,    93,     1,     0,    48,    93,   265,     1,
627      0,    48,    93,   265,    94,   188,    56,   187,     0,    48,
628     93,   265,    94,   188,    56,   188,     0,     0,   201,   200,
629    202,     0,    68,    93,   265,    94,     0,    68,     1,     0,
630     68,    93,     1,     0,    68,    93,   265,    94,     1,     0,
631     95,    96,     0,    95,   205,    96,     0,    95,   203,    96,
632      0,    95,   203,   205,    96,     0,   204,     0,   203,   204,
633      0,   205,   183,     0,   206,     0,   205,   206,     0,    62,
634    266,    88,     0,    47,    88,     0,    62,     1,     0,    62,
635    266,     1,     0,    47,     1,     0,    66,    93,   265,    94,
636      0,   207,   187,     0,    66,     1,     0,    66,    93,     1,
637      0,    66,    93,   265,     1,     0,   207,   188,     0,    51,
638      0,   210,   187,    66,    93,   265,    94,    99,     0,   215,
639     99,   265,    99,   217,    94,   187,     0,   215,    99,    99,
640    217,    94,   187,     0,   215,    99,     1,     0,   215,    99,
641    265,    99,     1,     0,   215,    99,    99,     1,     0,   215,
642     99,   265,    99,   217,    94,   188,     0,   215,    99,    99,
643    217,    94,   188,     0,    71,    93,     0,    71,     1,     0,
644     71,    93,     1,     0,   214,   216,     0,     0,   218,     0,
645    186,     0,   218,     1,     0,     0,   218,     0,   195,     0,
646    218,   100,   195,     0,   218,   100,     1,     0,    54,    99,
647      0,    54,   122,    99,     0,    54,     1,     0,    54,   122,
648      1,     0,    73,    99,     0,    73,   122,    99,     0,    73,
649      1,     0,    73,   122,     1,     0,    58,    99,     0,    58,
650    265,    99,     0,    58,     1,     0,    58,   265,     1,     0,
651     49,   265,    99,     0,    49,     1,     0,    49,   265,     1,
652      0,   224,    93,   265,    94,   180,     0,   224,    93,   265,
653     94,     1,     0,   224,     1,     0,   224,    93,     1,    94,
654      0,   224,    93,     1,     0,   131,     0,    70,   180,   226,
655      0,    70,   180,   229,     0,    70,   180,   226,   229,     0,
656     70,     1,     0,   227,     0,   226,   227,     0,   228,   180,
657      0,    60,    93,   152,    94,     0,    60,     1,     0,    60,
658     93,     1,     0,    60,    93,     1,    94,     0,    64,   180,
659      0,    64,     1,     0,   231,     0,   235,     0,   111,     0,
660     76,     0,    93,   265,    94,     0,   232,     0,   239,     0,
661    240,     0,   241,     0,   119,   101,    67,     0,   113,   101,
662     67,     0,    59,   101,    67,     0,   119,   101,    76,     0,
663     93,   265,     1,     0,   119,   101,     1,     0,   113,   101,
664      1,     0,    59,   101,     1,     0,    72,   116,    93,   234,
665     94,     0,    72,   116,    93,    94,     0,    72,   116,    93,
666    234,    94,   138,     0,    72,   116,    93,    94,   138,     0,
667    233,   122,    93,    94,     0,   233,   122,    93,    94,   138,
668      0,   233,   122,    93,   234,    94,     0,   233,   122,    93,
669    234,    94,   138,     0,    72,     1,    99,     0,    72,   116,
670      1,     0,    72,   116,    93,     1,     0,    72,   116,    93,
671    234,     1,     0,   233,     1,     0,   233,   122,     1,     0,
672    119,   101,    72,     0,   230,   101,    72,     0,   265,     0,
673    234,   100,   265,     0,   234,   100,     1,     0,    72,   113,
674    236,     0,    72,   115,   236,     0,    72,   113,   236,   238,
675      0,    72,   115,   236,   238,     0,    72,   115,   238,   178,
676      0,    72,   113,   238,   178,     0,    72,     1,    98,     0,
677     72,     1,    97,     0,   237,     0,   236,   237,     0,    97,
678    265,    98,     0,    97,   265,     1,     0,    97,     1,     0,
679     97,    98,     0,   238,    97,    98,     0,   238,    97,     1,
680      0,   230,   101,   122,     0,    65,   101,   122,     0,    65,
681      1,     0,   119,    93,    94,     0,   119,    93,   234,    94,
682      0,   230,   101,   122,    93,    94,     0,   230,   101,   122,
683     93,   234,    94,     0,    65,   101,   122,    93,    94,     0,
684     65,   101,   122,    93,   234,    94,     0,    65,   101,     1,
685     94,     0,    65,   101,     1,   101,     0,   119,    97,   265,
686     98,     0,   231,    97,   265,    98,     0,   119,    97,     1,
687      0,   119,    97,   265,     1,     0,   231,    97,     1,     0,
688    231,    97,   265,     1,     0,   230,     0,   119,     0,   243,
689      0,   244,     0,   242,    46,     0,   242,    45,     0,   246,
690      0,   247,     0,     3,   245,     0,     4,   245,     0,   248,
691      0,     3,     1,     0,     4,     1,     0,    46,   245,     0,
692     46,     1,     0,    45,   245,     0,    45,     1,     0,   242,
693      0,    89,   245,     0,    90,   245,     0,   249,     0,    89,
694      1,     0,    90,     1,     0,    93,   113,   238,    94,   245,
695      0,    93,   113,    94,   245,     0,    93,   265,    94,   248,
696      0,    93,   119,   238,    94,   248,     0,    93,   113,    97,
697      1,     0,    93,     1,     0,    93,   113,   238,    94,     1,
698      0,    93,   113,    94,     1,     0,    93,   119,   238,    94,
699      1,     0,   245,     0,   250,     5,   245,     0,   250,     6,
700    245,     0,   250,     7,   245,     0,   250,     5,     1,     0,
701    250,     6,     1,     0,   250,     7,     1,     0,   250,     0,
702    251,     3,   250,     0,   251,     4,   250,     0,   251,     3,
703      1,     0,   251,     4,     1,     0,   251,     0,   252,     8,
704    251,     0,   252,     9,   251,     0,   252,    10,   251,     0,
705    252,     8,     1,     0,   252,     9,     1,     0,   252,    10,
706      1,     0,   252,     0,   253,    20,   252,     0,   253,    18,
707    252,     0,   253,    21,   252,     0,   253,    19,   252,     0,
708    253,    57,   114,     0,   253,    20,     1,     0,   253,    18,
709      1,     0,   253,    21,     1,     0,   253,    19,     1,     0,
710    253,    57,     1,     0,   253,     0,   254,    16,   253,     0,
711    254,    17,   253,     0,   254,    16,     1,     0,   254,    17,
712      1,     0,   254,     0,   255,    11,   254,     0,   255,    11,
713      1,     0,   255,     0,   256,    12,   255,     0,   256,    12,
714      1,     0,   256,     0,   257,    13,   256,     0,   257,    13,
715      1,     0,   257,     0,   258,    14,   257,     0,   258,    14,
716      1,     0,   258,     0,   259,    15,   258,     0,   259,    15,
717      1,     0,   259,     0,   259,    87,   265,    88,   260,     0,
718    259,    87,    88,     1,     0,   259,    87,     1,     0,   259,
719     87,   265,    88,     1,     0,   260,     0,   262,     0,   263,
720    264,   261,     0,   263,   264,     1,     0,   119,     0,   239,
721      0,   241,     0,    91,     0,    92,     0,   261,     0,   265,
722      0
723 };
724
725 #endif
726
727 #if YYDEBUG != 0
728 static const short yyrline[] = { 0,
729    500,   506,   508,   509,   510,   511,   512,   516,   518,   521,
730    523,   524,   527,   529,   532,   536,   540,   544,   550,   552,
731    554,   556,   561,   563,   566,   570,   575,   580,   582,   583,
732    584,   585,   586,   587,   588,   591,   596,   602,   604,   607,
733    613,   615,   619,   621,   624,   651,   653,   657,   670,   672,
734    676,   683,   688,   690,   700,   705,   720,   724,   727,   730,
735    733,   735,   737,   742,   746,   748,   750,   752,   756,   758,
736    760,   767,   773,   778,   782,   791,   801,   803,   806,   808,
737    809,   810,   814,   816,   818,   819,   821,   826,   829,   839,
738    842,   844,   848,   851,   858,   864,   872,   874,   876,   878,
739    880,   884,   886,   890,   897,   898,   902,   905,   907,   909,
740    911,   916,   918,   920,   922,   929,   932,   934,   943,   945,
741    949,   954,   959,   963,   968,   973,   978,   985,   995,   997,
742    999,  1003,  1006,  1008,  1012,  1014,  1015,  1020,  1026,  1033,
743   1041,  1048,  1051,  1054,  1058,  1061,  1065,  1074,  1076,  1078,
744   1082,  1084,  1087,  1094,  1102,  1104,  1108,  1115,  1125,  1129,
745   1132,  1135,  1138,  1141,  1144,  1147,  1150,  1152,  1156,  1162,
746   1167,  1169,  1173,  1176,  1180,  1182,  1185,  1187,  1188,  1190,
747   1194,  1198,  1204,  1209,  1212,  1214,  1218,  1224,  1228,  1233,
748   1242,  1246,  1251,  1263,  1265,  1268,  1270,  1272,  1276,  1280,
749   1283,  1287,  1289,  1290,  1291,  1292,  1293,  1297,  1299,  1300,
750   1301,  1302,  1306,  1308,  1309,  1310,  1311,  1312,  1313,  1314,
751   1315,  1316,  1317,  1320,  1325,  1336,  1339,  1343,  1350,  1360,
752   1366,  1372,  1378,  1380,  1385,  1387,  1392,  1394,  1396,  1398,
753   1400,  1404,  1406,  1407,  1408,  1409,  1410,  1411,  1414,  1420,
754   1422,  1424,  1428,  1433,  1438,  1444,  1454,  1460,  1462,  1464,
755   1471,  1474,  1476,  1478,  1482,  1484,  1487,  1491,  1493,  1496,
756   1503,  1509,  1511,  1513,  1517,  1525,  1528,  1530,  1532,  1536,
757   1541,  1550,  1555,  1558,  1565,  1567,  1569,  1573,  1576,  1585,
758   1592,  1594,  1598,  1611,  1613,  1619,  1625,  1629,  1631,  1635,
759   1638,  1640,  1644,  1647,  1649,  1651,  1655,  1658,  1660,  1662,
760   1666,  1669,  1671,  1673,  1677,  1683,  1685,  1689,  1696,  1698,
761   1700,  1702,  1706,  1718,  1721,  1723,  1728,  1732,  1734,  1741,
762   1749,  1766,  1768,  1773,  1777,  1780,  1785,  1787,  1790,  1792,
763   1794,  1796,  1797,  1798,  1799,  1803,  1805,  1807,  1812,  1814,
764   1816,  1818,  1820,  1824,  1827,  1832,  1834,  1839,  1840,  1841,
765   1842,  1843,  1845,  1847,  1849,  1851,  1853,  1857,  1859,  1862,
766   1868,  1873,  1877,  1880,  1882,  1884,  1888,  1890,  1892,  1894,
767   1898,  1901,  1905,  1911,  1913,  1921,  1948,  1950,  1954,  1959,
768   1966,  1970,  1973,  1975,  1986,  1997,  2002,  2011,  2013,  2017,
769   2020,  2022,  2027,  2032,  2037,  2044,  2046,  2047,  2048,  2051,
770   2056,  2061,  2063,  2064,  2066,  2068,  2069,  2071,  2075,  2078,
771   2082,  2085,  2089,  2091,  2093,  2095,  2096,  2098,  2102,  2111,
772   2113,  2115,  2128,  2130,  2136,  2138,  2140,  2144,  2146,  2151,
773   2156,  2161,  2163,  2165,  2169,  2171,  2176,  2181,  2183,  2187,
774   2189,  2194,  2199,  2204,  2206,  2208,  2212,  2214,  2219,  2224,
775   2229,  2234,  2236,  2238,  2240,  2242,  2244,  2248,  2250,  2255,
776   2260,  2262,  2266,  2268,  2273,  2277,  2279,  2284,  2288,  2290,
777   2295,  2299,  2301,  2306,  2310,  2312,  2317,  2321,  2323,  2328,
778   2334,  2336,  2340,  2342,  2345,  2348,  2356,  2358,  2359,  2362,
779   2364,  2367,  2371
780 };
781 #endif
782
783
784 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
785
786 static const char * const yytname[] = {   "$","error","$undefined.","PLUS_TK",
787 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
788 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
789 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
790 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
791 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
792 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
793 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
794 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
795 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
796 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
797 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
798 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
799 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
800 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
801 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
802 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
803 "class_type","interface_type","array_type","name","simple_name","qualified_name",
804 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
805 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
806 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
807 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
808 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
809 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
810 "method_declarator","formal_parameter_list","formal_parameter","final","throws",
811 "class_type_list","method_body","static_initializer","static","constructor_declaration",
812 "@4","constructor_header","constructor_declarator","constructor_body","constructor_block_end",
813 "explicit_constructor_invocation","this_or_super","interface_declaration","@5",
814 "@6","@7","@8","extends_interfaces","interface_body","interface_member_declarations",
815 "interface_member_declaration","constant_declaration","abstract_method_declaration",
816 "array_initializer","variable_initializers","block","block_begin","block_end",
817 "block_statements","block_statement","local_variable_declaration_statement",
818 "local_variable_declaration","statement","statement_nsi","statement_without_trailing_substatement",
819 "empty_statement","label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
820 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
821 "switch_statement","@9","switch_expression","switch_block","switch_block_statement_groups",
822 "switch_block_statement_group","switch_labels","switch_label","while_expression",
823 "while_statement","while_statement_nsi","do_statement_begin","do_statement",
824 "for_statement","for_statement_nsi","for_header","for_begin","for_init","for_update",
825 "statement_expression_list","break_statement","continue_statement","return_statement",
826 "throw_statement","synchronized_statement","synchronized","try_statement","catches",
827 "catch_clause","catch_clause_parameter","finally","primary","primary_no_new_array",
828 "class_instance_creation_expression","something_dot_new","argument_list","array_creation_expression",
829 "dim_exprs","dim_expr","dims","field_access","method_invocation","array_access",
830 "postfix_expression","post_increment_expression","post_decrement_expression",
831 "unary_expression","pre_increment_expression","pre_decrement_expression","unary_expression_not_plus_minus",
832 "cast_expression","multiplicative_expression","additive_expression","shift_expression",
833 "relational_expression","equality_expression","and_expression","exclusive_or_expression",
834 "inclusive_or_expression","conditional_and_expression","conditional_or_expression",
835 "conditional_expression","assignment_expression","assignment","left_hand_side",
836 "assignment_operator","expression","constant_expression", NULL
837 };
838 #endif
839
840 static const short yyr1[] = {     0,
841    110,   111,   111,   111,   111,   111,   111,   112,   112,   113,
842    113,   113,   114,   114,   115,   116,   117,   118,   118,   118,
843    118,   118,   119,   119,   120,   121,   122,   123,   123,   123,
844    123,   123,   123,   123,   123,   124,   124,   125,   125,   126,
845    126,   126,   127,   127,   128,   128,   128,   129,   129,   129,
846    130,   130,   130,   130,   131,   131,   133,   132,   134,   132,
847    132,   132,   132,   132,   135,   135,   135,   135,   136,   136,
848    136,   137,   137,   137,   138,   138,   139,   139,   140,   140,
849    140,   140,   141,   141,   141,   141,   141,   142,   142,   143,
850    143,   143,   144,   144,   144,   144,   145,   145,   145,   145,
851    145,   146,   146,   148,   147,   147,   149,   149,   149,   149,
852    149,   149,   149,   149,   149,   150,   150,   150,   150,   150,
853    151,   151,   151,   152,   152,   152,   152,   153,   154,   154,
854    154,   155,   155,   155,   156,   156,   156,   157,   157,   158,
855    160,   159,   161,   161,   162,   162,   163,   163,   163,   163,
856    164,   164,   165,   165,   165,   165,   166,   166,   168,   167,
857    169,   167,   170,   167,   171,   167,   167,   167,   172,   172,
858    172,   172,   173,   173,   174,   174,   175,   175,   175,   175,
859    176,   177,   177,   178,   178,   178,   179,   179,   179,   180,
860    180,   181,   182,   183,   183,   184,   184,   184,   185,   186,
861    186,   187,   187,   187,   187,   187,   187,   188,   188,   188,
862    188,   188,   189,   189,   189,   189,   189,   189,   189,   189,
863    189,   189,   189,   190,   191,   192,   192,   193,   194,   194,
864    194,   194,   194,   194,   194,   194,   194,   194,   194,   194,
865    194,   195,   195,   195,   195,   195,   195,   195,   196,   196,
866    196,   196,   197,   198,   200,   199,   201,   201,   201,   201,
867    202,   202,   202,   202,   203,   203,   204,   205,   205,   206,
868    206,   206,   206,   206,   207,   208,   208,   208,   208,   209,
869    210,   211,   212,   212,   212,   212,   212,   213,   213,   214,
870    214,   214,   215,   216,   216,   216,   216,   217,   217,   218,
871    218,   218,   219,   219,   219,   219,   220,   220,   220,   220,
872    221,   221,   221,   221,   222,   222,   222,   223,   223,   223,
873    223,   223,   224,   225,   225,   225,   225,   226,   226,   227,
874    228,   228,   228,   228,   229,   229,   230,   230,   231,   231,
875    231,   231,   231,   231,   231,   231,   231,   231,   231,   231,
876    231,   231,   231,   232,   232,   232,   232,   232,   232,   232,
877    232,   232,   232,   232,   232,   232,   232,   233,   233,   234,
878    234,   234,   235,   235,   235,   235,   235,   235,   235,   235,
879    236,   236,   237,   237,   237,   238,   238,   238,   239,   239,
880    239,   240,   240,   240,   240,   240,   240,   240,   240,   241,
881    241,   241,   241,   241,   241,   242,   242,   242,   242,   243,
882    244,   245,   245,   245,   245,   245,   245,   245,   246,   246,
883    247,   247,   248,   248,   248,   248,   248,   248,   249,   249,
884    249,   249,   249,   249,   249,   249,   249,   250,   250,   250,
885    250,   250,   250,   250,   251,   251,   251,   251,   251,   252,
886    252,   252,   252,   252,   252,   252,   253,   253,   253,   253,
887    253,   253,   253,   253,   253,   253,   253,   254,   254,   254,
888    254,   254,   255,   255,   255,   256,   256,   256,   257,   257,
889    257,   258,   258,   258,   259,   259,   259,   260,   260,   260,
890    260,   260,   261,   261,   262,   262,   263,   263,   263,   264,
891    264,   265,   266
892 };
893
894 static const short yyr2[] = {     0,
895      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
896      1,     1,     1,     1,     1,     1,     1,     3,     3,     3,
897      3,     3,     1,     1,     1,     3,     1,     0,     1,     1,
898      1,     2,     2,     2,     3,     1,     2,     1,     2,     3,
899      2,     3,     1,     1,     3,     2,     3,     5,     4,     5,
900      1,     1,     1,     1,     1,     2,     0,     7,     0,     6,
901      3,     2,     3,     4,     0,     2,     3,     2,     0,     2,
902      2,     1,     3,     3,     2,     3,     1,     2,     1,     1,
903      1,     1,     1,     2,     1,     1,     1,     3,     4,     1,
904      3,     3,     1,     3,     3,     4,     1,     3,     2,     3,
905      3,     1,     1,     0,     3,     2,     3,     3,     4,     4,
906      2,     3,     2,     3,     2,     3,     4,     3,     3,     3,
907      1,     3,     3,     2,     3,     2,     3,     1,     0,     2,
908      2,     1,     3,     3,     1,     2,     1,     2,     3,     1,
909      0,     3,     2,     3,     3,     4,     2,     3,     3,     4,
910      1,     2,     4,     5,     7,     6,     1,     1,     0,     4,
911      0,     5,     0,     5,     0,     6,     3,     4,     2,     3,
912      2,     3,     2,     3,     1,     2,     1,     1,     1,     1,
913      1,     2,     2,     2,     3,     4,     1,     3,     3,     2,
914      3,     1,     1,     1,     2,     1,     1,     1,     2,     2,
915      3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
916      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
917      1,     1,     1,     1,     2,     2,     2,     2,     2,     2,
918      2,     2,     3,     4,     4,     5,     4,     5,     6,     7,
919      6,     1,     1,     1,     1,     1,     1,     1,     5,     2,
920      3,     4,     7,     7,     0,     3,     4,     2,     3,     5,
921      2,     3,     3,     4,     1,     2,     2,     1,     2,     3,
922      2,     2,     3,     2,     4,     2,     2,     3,     4,     2,
923      1,     7,     7,     6,     3,     5,     4,     7,     6,     2,
924      2,     3,     2,     0,     1,     1,     2,     0,     1,     1,
925      3,     3,     2,     3,     2,     3,     2,     3,     2,     3,
926      2,     3,     2,     3,     3,     2,     3,     5,     5,     2,
927      4,     3,     1,     3,     3,     4,     2,     1,     2,     2,
928      4,     2,     3,     4,     2,     2,     1,     1,     1,     1,
929      3,     1,     1,     1,     1,     3,     3,     3,     3,     3,
930      3,     3,     3,     5,     4,     6,     5,     4,     5,     5,
931      6,     3,     3,     4,     5,     2,     3,     3,     3,     1,
932      3,     3,     3,     3,     4,     4,     4,     4,     3,     3,
933      1,     2,     3,     3,     2,     2,     3,     3,     3,     3,
934      2,     3,     4,     5,     6,     5,     6,     4,     4,     4,
935      4,     3,     4,     3,     4,     1,     1,     1,     1,     2,
936      2,     1,     1,     2,     2,     1,     2,     2,     2,     2,
937      2,     2,     1,     2,     2,     1,     2,     2,     5,     4,
938      4,     5,     4,     2,     5,     4,     5,     1,     3,     3,
939      3,     3,     3,     3,     1,     3,     3,     3,     3,     1,
940      3,     3,     3,     3,     3,     3,     1,     3,     3,     3,
941      3,     3,     3,     3,     3,     3,     3,     1,     3,     3,
942      3,     3,     1,     3,     3,     1,     3,     3,     1,     3,
943      3,     1,     3,     3,     1,     3,     3,     1,     5,     4,
944      3,     5,     1,     1,     3,     3,     1,     1,     1,     1,
945      1,     1,     1
946 };
947
948 static const short yydefact[] = {     0,
949     54,    55,     0,     0,     0,     0,    53,     1,     0,     0,
950      0,    36,    43,    44,    38,     0,    51,    52,    46,    27,
951      0,    23,    24,    25,     0,    62,     0,    41,     0,     0,
952     37,    39,     0,     0,    56,     0,     0,    47,    45,     0,
953    167,     0,     0,   163,    63,     0,    69,    42,    40,     0,
954      0,     0,    61,     0,    49,     0,    26,   171,    17,   169,
955     15,     0,   160,     0,     0,    68,    16,     0,     0,    59,
956    168,     0,   165,    64,    69,    50,    48,    12,     0,    10,
957     11,   173,     0,     8,     9,    13,    14,    15,     0,   179,
958    181,     0,   180,     0,   175,   177,   178,   172,   170,   164,
959     67,    71,    72,    70,     0,   162,     0,    57,   113,     0,
960    129,   111,     0,     0,    90,    93,   129,     0,     0,     0,
961    115,     0,     0,   183,   182,   174,   176,     0,     0,    60,
962    166,     0,     0,     0,     0,   108,    99,    88,     0,     0,
963      0,     0,   107,    21,    18,    22,    20,    19,   114,   129,
964    112,     0,   129,    74,    73,    55,   192,    75,    23,     0,
965     86,     0,    77,    79,    83,    85,     0,    80,     0,    81,
966    141,   129,    87,    82,     0,    58,   119,   116,     0,   128,
967      0,   121,     0,   131,   132,   130,   120,   118,    92,     0,
968     91,    95,     0,     0,     0,     0,     0,     0,     0,   340,
969      0,     0,     0,     0,     6,     5,     2,     3,     4,     7,
970    339,     0,   407,     0,   103,   406,   337,   342,     0,   338,
971    343,   344,   345,   423,   408,   409,   438,   412,   413,   416,
972    426,   445,   450,   457,   468,   473,   476,   479,   482,   485,
973    488,   493,   502,   494,     0,   102,   100,    98,   101,   110,
974     89,   109,   190,     0,   129,    76,    78,    84,   106,     0,
975    138,     0,   143,     0,     0,     0,   281,     0,     0,     0,
976      0,     0,     0,     0,     0,   340,     0,   224,     0,     8,
977    407,     0,   128,   198,     0,     0,   213,     0,   194,   196,
978      0,   197,   202,   214,     0,   203,   215,     0,   204,   205,
979    216,   255,     0,   206,     0,   217,   207,   294,     0,   218,
980    219,   220,   222,   221,     0,   223,   248,   247,     0,   245,
981    246,   243,   244,   242,   126,   124,   117,     0,     0,     0,
982    417,   407,   343,   345,   414,   418,   415,   422,   421,   420,
983    419,     0,   391,     0,     0,     0,    16,     0,   427,   424,
984    428,   425,   434,     0,   407,     0,   184,   187,     0,     0,
985      0,     0,     0,    96,     0,     0,   366,     0,   411,   410,
986      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
987      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
988      0,   500,   501,     0,   145,     0,   144,   137,   105,   135,
989    139,   192,   142,     0,   231,   232,   230,   250,     0,   316,
990      0,   305,   303,     0,   313,   311,     0,   277,     0,   258,
991      0,   327,     0,   291,     0,   309,   307,     0,     0,   200,
992      0,     0,   227,   225,     0,     0,   193,   191,   195,   199,
993    407,   323,   226,   229,     0,   276,     0,   407,   296,   300,
994    293,     0,     0,   320,     0,   123,   122,   127,   125,   134,
995    133,   353,   348,     0,   390,   380,   379,   362,     0,   373,
996    381,     0,   374,     0,   363,     0,     0,     0,     0,     0,
997      0,   350,   341,   185,     0,   352,   347,   392,     0,   370,
998    402,     0,   351,   346,   368,   349,   369,   389,   404,     0,
999    367,     0,   442,   439,   443,   440,   444,   441,   448,   446,
1000    449,   447,   454,   451,   455,   452,   456,   453,   464,   459,
1001    466,   461,   463,   458,   465,   460,   467,     0,   462,   471,
1002    469,   472,   470,   475,   474,   478,   477,   481,   480,   484,
1003    483,   487,   486,   491,     0,     0,   496,   495,   146,   136,
1004    407,   147,     0,     0,   151,     0,   251,     0,   317,   315,
1005    306,   304,   314,   312,   278,     0,   259,     0,     0,     0,
1006    324,   328,     0,   325,   292,   310,   308,   341,     0,   201,
1007    233,     0,     0,     0,   256,     0,   297,     0,   285,     0,
1008      0,   322,     0,   398,   399,     0,   385,   386,     0,   382,
1009    375,     0,   378,   376,   377,   364,   355,     0,   436,   430,
1010    433,     0,     0,   431,   189,   186,   188,   393,     0,   403,
1011    400,     0,   405,   401,   358,     0,   490,     0,     0,   148,
1012      0,     0,   152,   149,   252,     0,   279,   275,     0,   332,
1013      0,   336,   335,   329,   326,   330,   237,     0,   234,   235,
1014      0,     0,     0,   261,     0,   265,     0,   268,     0,   302,
1015    301,   287,     0,   299,     0,   321,     0,   396,     0,   384,
1016    383,   388,   387,   357,   365,   354,   435,   429,   437,   432,
1017    372,   371,   394,     0,   359,   360,   492,   489,     0,   150,
1018      0,     0,     0,   249,     0,   202,     0,   209,   210,     0,
1019    211,   212,     0,   260,   333,     0,   238,     0,     0,   236,
1020    274,   271,   272,   503,     0,   263,   266,     0,   262,     0,
1021    269,     0,     0,   286,     0,   319,   318,   397,   356,   395,
1022    361,     0,   153,     0,     0,     0,   228,   280,     0,   334,
1023    331,   241,   239,     0,   273,   270,   264,     0,   284,     0,
1024      0,     0,   154,     0,   253,     0,     0,   240,   282,   283,
1025    156,     0,     0,     0,     0,   155,     0,     0,     0,     0,
1026    289,     0,   254,   288,     0,     0,     0
1027 };
1028
1029 static const short yydefgoto[] = {   775,
1030    211,   279,   212,    85,    86,    68,    60,    87,   213,    22,
1031     23,    24,     8,     9,    10,    11,    12,    13,    14,    15,
1032    442,   284,   132,   105,    47,    70,   104,   130,   162,   163,
1033    164,    91,   114,   115,   116,   214,   166,   260,    92,   111,
1034    181,   182,   285,   136,   186,   399,   168,   169,   170,   262,
1035    171,   172,   403,   552,   553,   286,    18,    43,    72,    65,
1036    107,    44,    63,    94,    95,    96,    97,   215,   359,   287,
1037    175,   555,   720,   289,   290,   291,   292,   695,   293,   294,
1038    295,   296,   698,   297,   298,   299,   300,   699,   301,   445,
1039    302,   585,   655,   656,   657,   658,   303,   304,   701,   305,
1040    306,   307,   702,   308,   309,   451,   663,   664,   310,   311,
1041    312,   313,   314,   315,   316,   571,   572,   573,   574,   216,
1042    217,   218,   219,   489,   220,   470,   471,   472,   221,   222,
1043    223,   224,   225,   226,   227,   228,   229,   230,   231,   232,
1044    233,   234,   235,   236,   237,   238,   239,   240,   241,   242,
1045    243,   244,   245,   394,   490,   715
1046 };
1047
1048 static const short yypact[] = {   262,
1049 -32768,-32768,   332,   -48,   389,   476,-32768,-32768,   490,   782,
1050    645,-32768,-32768,-32768,-32768,   735,-32768,-32768,-32768,-32768,
1051     16,-32768,-32768,-32768,   183,-32768,   343,-32768,    21,   797,
1052 -32768,-32768,   777,   823,-32768,   -48,   508,-32768,-32768,   569,
1053 -32768,   518,   -47,   -25,-32768,   529,    33,-32768,-32768,   -48,
1054    830,   256,-32768,   486,-32768,    25,-32768,-32768,-32768,-32768,
1055    112,  1261,-32768,   597,   -47,-32768,-32768,   246,   618,-32768,
1056 -32768,   -47,   -25,-32768,    33,-32768,-32768,-32768,   622,-32768,
1057 -32768,-32768,   635,   126,-32768,-32768,   176,   494,   864,-32768,
1058 -32768,    55,-32768,  1403,-32768,-32768,-32768,-32768,-32768,-32768,
1059 -32768,-32768,-32768,   186,   259,-32768,   -47,-32768,-32768,   253,
1060     -1,-32768,   429,   204,-32768,   785,    -1,    63,   106,   269,
1061 -32768,   638,   643,-32768,-32768,-32768,-32768,   651,   943,-32768,
1062 -32768,   259,   426,   667,   128,-32768,-32768,-32768,   672,  1447,
1063    154,   390,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    -1,
1064 -32768,   478,    -1,-32768,-32768,   315,   319,-32768,   335,   864,
1065 -32768,  1076,-32768,-32768,   336,-32768,    17,-32768,   346,-32768,
1066 -32768,   397,-32768,-32768,  1944,-32768,-32768,-32768,   686,   427,
1067    -26,-32768,   904,-32768,-32768,   385,-32768,-32768,-32768,   300,
1068 -32768,-32768,  2848,  2899,  2964,  3015,   415,    26,   616,-32768,
1069   3080,  3131,  3196,  5179,-32768,-32768,-32768,-32768,-32768,-32768,
1070 -32768,   424,   940,    40,-32768,   443,   463,-32768,   698,-32768,
1071    761,-32768,   826,   843,-32768,-32768,-32768,-32768,-32768,-32768,
1072 -32768,   887,   923,   893,  1041,   922,   582,   596,   603,   639,
1073      6,-32768,-32768,-32768,   860,-32768,-32768,-32768,-32768,-32768,
1074 -32768,-32768,-32768,   932,   397,-32768,-32768,-32768,-32768,   535,
1075    568,   593,-32768,   491,   341,  3247,-32768,   120,  2152,     7,
1076    344,   351,   231,   402,   149,   602,  5476,-32768,   -48,   633,
1077    972,   718,   466,-32768,   904,   610,-32768,  1876,-32768,-32768,
1078    644,-32768,-32768,-32768,  2012,-32768,-32768,   663,-32768,-32768,
1079 -32768,-32768,  2012,-32768,  2012,-32768,-32768,  5527,   676,-32768,
1080 -32768,-32768,-32768,-32768,   412,-32768,   867,   874,   843,   917,
1081    933,-32768,-32768,-32768,-32768,   899,-32768,   884,   706,   713,
1082 -32768,   187,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
1083 -32768,    22,-32768,   726,   886,   648,   648,   420,-32768,-32768,
1084 -32768,-32768,-32768,   719,  1031,    94,-32768,-32768,   674,    35,
1085   5244,  3312,   685,-32768,   -39,  3363,-32768,   421,-32768,-32768,
1086   3428,  3479,  3544,  3595,  3660,  3711,  3776,  3827,  3892,  3943,
1087   4008,  4059,   813,  4124,  4175,  4240,  4291,  4356,  4407,  4472,
1088   2203,-32768,-32768,  4523,-32768,   121,-32768,-32768,-32768,   694,
1089 -32768,-32768,-32768,  1876,-32768,-32768,-32768,-32768,  4588,-32768,
1090     57,-32768,-32768,    77,-32768,-32768,    86,-32768,  4639,-32768,
1091   4704,-32768,   725,-32768,  1129,-32768,-32768,    87,   217,   700,
1092   2268,   546,-32768,-32768,   -48,  2319,-32768,-32768,-32768,-32768,
1093   1059,   427,-32768,-32768,   712,-32768,   752,   990,-32768,-32768,
1094 -32768,    48,  2384,-32768,  4755,-32768,-32768,-32768,   899,-32768,
1095 -32768,-32768,-32768,   -34,   729,-32768,-32768,-32768,  2435,   648,
1096 -32768,   584,   648,   584,-32768,  2500,  4820,   168,   367,  2551,
1097    662,-32768,  5552,-32768,   646,-32768,-32768,-32768,   134,-32768,
1098 -32768,   209,-32768,-32768,-32768,-32768,-32768,   732,-32768,   211,
1099 -32768,  5295,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   887,
1100 -32768,   887,-32768,   923,-32768,   923,-32768,   923,-32768,   893,
1101 -32768,   893,-32768,   893,-32768,   893,-32768,   126,-32768,-32768,
1102   1041,-32768,  1041,-32768,   922,-32768,   582,-32768,   596,-32768,
1103    603,-32768,   639,-32768,   828,   739,-32768,-32768,-32768,-32768,
1104   1024,-32768,  1876,   742,   746,  1876,-32768,   295,-32768,-32768,
1105 -32768,-32768,-32768,-32768,-32768,   323,-32768,   754,   430,   254,
1106    725,-32768,   346,-32768,-32768,-32768,-32768,-32768,   438,   700,
1107 -32768,   849,    68,   361,-32768,   778,-32768,   555,-32768,  5103,
1108    776,   792,   812,-32768,-32768,  5360,-32768,-32768,   236,-32768,
1109    818,   240,-32768,   818,-32768,-32768,   259,    89,-32768,-32768,
1110 -32768,  4871,  1702,-32768,-32768,-32768,-32768,-32768,  4936,-32768,
1111 -32768,  5411,-32768,-32768,   259,   171,-32768,  4987,   775,-32768,
1112   1876,  2616,-32768,-32768,-32768,  2078,-32768,-32768,   255,-32768,
1113    909,-32768,-32768,-32768,-32768,-32768,-32768,  2667,-32768,-32768,
1114    920,    13,  5052,-32768,   470,-32768,  1597,-32768,  5476,-32768,
1115 -32768,-32768,   838,   824,  5128,-32768,   260,-32768,   360,-32768,
1116 -32768,-32768,-32768,-32768,-32768,   259,-32768,-32768,-32768,-32768,
1117 -32768,-32768,-32768,   378,-32768,   259,-32768,-32768,   446,-32768,
1118    108,   103,   468,-32768,   880,   891,  2078,-32768,-32768,  2078,
1119 -32768,-32768,   844,-32768,   863,   866,-32768,   973,   131,-32768,
1120 -32768,-32768,-32768,-32768,   244,-32768,-32768,  1677,-32768,  1808,
1121 -32768,   878,  2012,-32768,   894,-32768,-32768,-32768,-32768,-32768,
1122 -32768,  2732,-32768,   151,  4588,  2012,-32768,-32768,  2783,-32768,
1123 -32768,-32768,-32768,  1005,-32768,-32768,-32768,   912,-32768,  2012,
1124    159,   170,-32768,   339,-32768,  5103,   916,-32768,-32768,-32768,
1125 -32768,   178,  2078,   925,  5128,-32768,   979,  2078,   946,  2078,
1126 -32768,  2078,-32768,-32768,  1027,  1044,-32768
1127 };
1128
1129 static const short yypgoto[] = {-32768,
1130 -32768,   -49,   160,   664,    30,  -122,   515,-32768,    -3,   291,
1131 -32768,   137,-32768,  1035,   588,-32768,   235,-32768,-32768,   971,
1132     20,   473,-32768,-32768,   995,   976,-32768,  -121,-32768,   892,
1133 -32768,   -83,  -114,   931,  -163,  -198,-32768,-32768,   -64,   587,
1134    801,  -323,  -126,   -80,-32768,-32768,-32768,-32768,-32768,-32768,
1135 -32768,   911,-32768,  -528,-32768,   668,   -11,-32768,-32768,-32768,
1136 -32768,  1023,   391,-32768,   984,-32768,-32768,   251,-32768,  -127,
1137    817,   796,  -165,  -284,-32768,   772,  -271,   172,  -530,-32768,
1138   -473,-32768,-32768,-32768,  -307,-32768,-32768,-32768,-32768,-32768,
1139 -32768,-32768,-32768,   434,   437,  -613,  -406,-32768,-32768,-32768,
1140 -32768,-32768,-32768,-32768,  -361,-32768,  -646,   786,-32768,-32768,
1141 -32768,-32768,-32768,-32768,-32768,-32768,   514,-32768,   525,-32768,
1142 -32768,   -94,-32768,  -379,-32768,   755,   317,  -292,  1204,   280,
1143   1237,   377,   500,   551,   -58,   653,   704,  -468,-32768,   649,
1144    690,   787,   636,   723,   724,   711,   716,   722,-32768,   501,
1145    720,   798,-32768,-32768,   127,-32768
1146 };
1147
1148
1149 #define YYLAST          5661
1150
1151
1152 static const short yytable[] = {    21,
1153    450,   174,    29,   439,   457,   358,   183,   343,   152,   288,
1154    176,   185,    83,   711,   614,   326,    38,   259,   725,    16,
1155    390,    48,   462,   443,   630,    76,   343,   634,    16,    16,
1156     16,   446,   497,   447,   174,   486,   143,    20,    61,   123,
1157    364,   261,    61,   721,    83,   165,    20,    62,   587,    16,
1158     93,   134,    16,    16,   474,   124,   583,   559,    88,   594,
1159     61,   479,   481,   144,   167,    61,   595,   327,   650,   250,
1160     16,    59,   252,   328,    64,    67,   348,   561,   165,    83,
1161    317,    89,    93,   179,    69,    88,   563,   576,   463,   675,
1162     88,   263,   391,    59,   482,   135,   608,   167,    59,  -158,
1163    712,   487,   690,   650,   721,   696,   146,   344,   649,   764,
1164    123,  -104,    83,    89,    39,  -104,    40,   173,   769,    49,
1165    412,    50,   626,    77,    61,    88,   344,   183,   187,    88,
1166     61,   743,   400,   329,   335,   337,   339,   341,   -94,   -94,
1167     25,    27,   350,   352,   680,   423,  -295,   588,   160,   426,
1168    173,   710,   180,   125,   247,   560,    88,    59,    88,   742,
1169    145,   651,   697,    67,   430,   459,   696,   619,   611,   696,
1170    743,   281,    52,    54,   397,   562,    57,   601,   758,    88,
1171    604,   160,   676,    41,   564,   577,    57,   483,   619,   332,
1172    332,   332,   332,   317,   283,    61,   734,   332,   332,   355,
1173    317,   183,   619,   147,   179,    20,   733,   461,   317,   620,
1174    317,   623,    50,   317,   549,   110,   669,   482,   413,   113,
1175    328,    84,   118,   697,   744,   188,   697,   618,   347,   700,
1176    619,   422,   696,   619,    20,   435,   670,   696,   556,   696,
1177    672,   696,   684,    31,   745,    42,   101,   427,    84,   753,
1178     88,   248,   692,    84,   642,   704,    71,   761,   110,   113,
1179    726,   -28,     1,   762,   686,   598,   246,    31,   709,   619,
1180    619,   439,   119,   180,   703,   190,   766,  -159,   179,   361,
1181    661,    88,   450,   362,   281,   128,   617,   363,    84,   697,
1182    700,   441,    84,   700,   697,   635,   697,   -66,   697,   441,
1183    137,   441,   138,   139,   448,     2,   621,   283,   624,   317,
1184    578,   282,   504,   506,   508,   190,     3,   706,    42,    84,
1185    580,    84,     4,   637,    88,   157,    61,   180,     5,   356,
1186    246,   746,    19,   671,   280,   703,     6,   673,   703,   635,
1187    -66,   408,    84,    45,   418,   133,   439,   180,   157,  -257,
1188   -161,   420,   752,   129,   157,   368,   700,   450,   346,    67,
1189      7,   700,   354,   700,   694,   700,   148,   332,   332,   332,
1190    332,   332,   332,   332,   332,   332,   332,   332,   332,    88,
1191    332,   332,   332,   332,   332,   332,   332,   631,   636,    26,
1192    249,   -97,   411,   -97,   -65,   417,   -97,   -97,   -97,   -97,
1193    551,   703,   424,   429,   414,    46,   703,   652,   703,  -140,
1194    703,   428,   454,    84,   253,   190,   638,    20,   610,   159,
1195    475,   501,   653,   283,   282,   443,   177,   254,   446,   137,
1196    640,   282,   763,   409,   258,   439,   419,   -65,   647,   282,
1197    157,   282,   643,   421,    84,   646,   647,   280,   450,   134,
1198    159,   749,   159,   728,   318,   100,   654,   450,   317,   619,
1199    612,   317,   106,   602,   755,   190,  -323,   280,   408,     2,
1200     35,   730,    17,   332,    20,    78,    28,   619,   760,   332,
1201    465,    17,    17,    17,   330,   674,    74,    84,   492,   -30,
1202      1,   694,   500,   317,   425,   317,   749,   131,   755,    57,
1203    760,   498,    17,   685,   455,    17,    17,    80,    53,    35,
1204     81,    20,   476,   502,   183,   342,   652,   546,    58,   178,
1205    -97,   133,   641,    17,   360,   -97,   -97,   -97,   -97,    66,
1206    648,   653,    37,     2,    90,   558,   317,   -65,   732,   727,
1207    282,   317,   528,   365,     3,   566,   493,   568,    46,   281,
1208      4,   319,   281,   678,   729,   660,     5,   492,  -323,   366,
1209    735,    20,   317,   280,   731,   716,    90,   318,    57,    55,
1210    317,   190,   283,    56,   318,   283,   251,   139,    99,   591,
1211    -65,   593,   318,   103,   318,   405,   406,   318,     7,   407,
1212    120,   179,   386,    20,    50,   599,    30,    98,    34,   195,
1213    196,   161,   317,    20,    78,   317,   492,   387,   332,   332,
1214    579,   246,   494,   197,    20,   388,   345,   495,   102,   198,
1215     51,   496,   109,   317,   332,   317,   199,   281,   317,   157,
1216    200,    20,   441,   398,   161,   112,    80,    88,   149,    81,
1217     20,   317,   155,   151,   -29,     1,   615,   277,   193,   194,
1218    283,   154,   389,   281,    20,   317,   205,   206,   207,   208,
1219    180,   317,   209,   210,   319,    78,   401,   184,   317,   117,
1220    317,   319,   189,   317,   320,   317,   283,   317,   204,   319,
1221    602,   319,    20,   318,   319,   493,   325,   402,     2,   282,
1222    195,   196,   282,   441,  -157,    78,   441,    80,   367,     3,
1223     81,    20,   436,    20,   197,     4,   458,    20,   150,   153,
1224    198,     5,   280,   460,   281,   280,   281,   199,   433,   441,
1225     20,   200,   603,    20,   605,   321,   464,    80,    20,   118,
1226     81,    20,   441,   360,   201,   202,    20,   283,   203,   283,
1227    204,   616,   440,     7,   469,   682,   441,   205,   206,   207,
1228    208,   494,    20,   209,   210,   613,   495,    20,   602,   441,
1229    496,   444,   -25,   -25,   441,    57,   441,   282,   441,   484,
1230     20,    20,   282,   485,   453,   493,   -32,     1,    35,   714,
1231    319,   -31,     1,    20,   569,   722,   600,   320,   570,   600,
1232    280,    20,   550,   282,   320,    36,   -34,     1,    20,   139,
1233     84,    37,   320,   -25,   320,   434,   584,   320,   -25,   -25,
1234    -25,    20,   477,   527,   -25,   478,   280,   586,   -25,   360,
1235      2,   596,   -33,     1,   622,     2,   628,   322,   627,   -35,
1236      1,     3,   318,   282,   632,   318,   282,     4,   321,   689,
1237      2,   494,     4,     5,   633,   321,   495,   639,     5,   649,
1238    496,  -498,  -498,   321,   282,   321,   282,     4,   321,   282,
1239     20,   754,    78,     5,   121,   757,     2,   318,   737,   318,
1240    659,   738,   282,     2,   665,     7,   140,   280,   323,   280,
1241      7,   141,   142,     4,   456,   666,   282,   369,   370,     5,
1242      4,   371,   372,   373,    80,     7,     5,    81,    20,   282,
1243    376,   377,   378,   320,   282,   667,   282,    35,   282,   705,
1244    318,  -342,  -342,    78,   602,   318,  -499,  -499,  -344,  -344,
1245    710,     7,   122,   588,    36,   374,   375,     2,     7,   319,
1246     37,   723,   319,    78,   767,   736,   318,   384,   385,   771,
1247    322,   773,   739,   774,   318,    80,  -208,   322,    81,    20,
1248    392,   393,     2,    78,   321,   322,   740,   322,    78,   741,
1249    322,  -408,  -408,  -342,   319,    80,   319,  -342,    81,    20,
1250   -344,   748,   324,   742,  -344,     2,   318,  -409,  -409,   318,
1251     32,    78,   466,   467,   468,    80,   156,   750,    81,    20,
1252     80,   323,    78,    81,    20,   141,   142,   318,   323,   318,
1253     32,    79,   318,     4,    32,   758,   323,   319,   323,     5,
1254    759,   323,   319,    80,   765,   318,    81,    20,   768,   531,
1255    533,    32,   510,   512,    80,   395,   776,    81,    20,   318,
1256   -497,  -497,   361,   319,   770,   318,   362,   157,   158,   772,
1257    363,   319,   318,   777,   318,    33,   529,   318,    75,   318,
1258    108,   318,   320,   257,   396,   320,   322,   -15,   379,   380,
1259    381,   382,  -497,  -497,   361,   514,   516,   518,   431,   191,
1260    255,   554,   432,   319,    73,   -15,   319,   127,   404,   449,
1261   -497,  -497,   361,   438,   644,   324,   431,   320,   717,   320,
1262    363,   718,   324,   452,   319,   645,   319,   383,   539,   319,
1263    324,   473,   324,   321,   541,   324,   321,   323,   535,   -15,
1264    537,   543,   319,   548,  -497,  -497,   361,     0,     0,   156,
1265    431,  -497,  -497,   361,   629,    78,   319,   480,   688,   575,
1266    320,   363,   319,     0,    79,   320,     4,     0,   321,   319,
1267    321,   319,     5,     0,   319,     0,   319,     0,   319,  -497,
1268   -497,   361,     0,     0,     0,   362,   320,    80,     0,   432,
1269     81,    20,     0,     0,   320,   520,   522,   524,   526,     0,
1270    157,   256,  -290,  -290,  -290,     0,     0,     0,  -290,     0,
1271      0,   321,     0,     0,     0,     0,   321,  -290,     0,     0,
1272      0,     0,     0,  -290,     0,     0,   320,     0,     0,   320,
1273   -290,   324,     0,     0,  -290,   322,     0,   321,   322,     0,
1274   -290,     0,     0,  -290,  -290,   321,     0,   320,     0,   320,
1275      0,  -290,   320,     0,     0,     0,     0,  -290,     0,     0,
1276   -290,  -290,  -290,  -290,     0,   320,  -290,  -290,     0,     0,
1277    322,     0,   322,     0,     0,     0,     0,   321,     0,   320,
1278    321,     0,     0,     0,     0,   320,   323,     0,     0,   323,
1279      0,     0,   320,     0,   320,     0,     0,   320,   321,   320,
1280    321,   320,     0,   321,     0,     0,     0,     0,     0,     0,
1281      0,     0,     0,   322,     0,     0,   321,     0,   322,     0,
1282      0,   323,     0,   323,     0,     0,     0,     0,     0,     0,
1283    321,     0,     0,     0,     2,     0,   321,     0,     0,   322,
1284     78,     0,     0,   321,     0,   321,     0,   322,   321,    79,
1285    321,     4,   321,     0,     0,     0,     0,     5,     0,     0,
1286      0,     0,     0,     0,   323,     0,     0,     0,     0,   323,
1287      0,     0,    80,     0,     0,    81,    20,     0,     0,   322,
1288    324,     0,   322,   324,     0,     0,    82,     0,     0,     0,
1289    323,     0,     0,     0,     0,     0,     0,     0,   323,     0,
1290    322,     0,   322,     0,     0,   322,     0,     0,     0,     0,
1291      0,     0,     0,     0,     0,   324,     0,   324,   322,     0,
1292      0,     0,     0,     0,     0,     0,   333,   333,   333,   333,
1293    323,     0,   322,   323,   333,   333,     0,     0,   322,     0,
1294      0,     0,     0,     0,     0,   322,     0,   322,     0,     0,
1295    322,   323,   322,   323,   322,     0,   323,     0,   324,   334,
1296    334,   334,   334,   324,     0,     0,     0,   334,   334,   323,
1297      0,     0,     0,     0,     0,     0,     2,   192,     0,   193,
1298    194,     0,    78,   323,   324,     0,     0,     0,     0,   323,
1299      0,    79,   324,     4,     0,     0,   323,     0,   323,     5,
1300      0,   323,     0,   323,     0,   323,     0,     0,     0,     0,
1301      0,     0,     0,     0,    80,     0,     0,    81,    20,     0,
1302      0,   195,   196,     0,   324,     0,    78,   324,   126,     0,
1303      0,     0,     0,     0,     0,   197,     0,     0,     0,     0,
1304      0,   198,     0,     0,     0,   324,     0,   324,   199,     0,
1305    324,     0,   200,     0,     0,     0,     0,     0,    80,     0,
1306      0,    81,    20,   324,     0,   201,   202,     0,     0,   203,
1307      0,   204,     0,     0,     0,     0,     0,   324,   205,   206,
1308    207,   208,     0,   324,   209,   210,     0,     0,     0,     0,
1309    324,     0,   324,     0,     0,   324,     0,   324,     0,   324,
1310      0,     0,     0,     0,   333,   333,   333,   333,   333,   333,
1311    333,   333,   333,   333,   333,   333,     0,   333,   333,   333,
1312    333,   333,   333,   333,     0,     0,     0,   264,     0,     0,
1313      0,     0,     0,     0,     0,     0,     0,   334,   334,   334,
1314    334,   334,   334,   334,   334,   334,   334,   334,   334,     0,
1315    334,   334,   334,   334,   334,   334,   334,     0,     0,     0,
1316      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1317      2,   195,   196,   652,   265,   266,    78,   267,     0,     0,
1318    268,     0,     0,     0,   269,   197,     0,     0,   653,     0,
1319      0,   270,   271,     5,   272,     0,   273,   274,   199,   275,
1320      0,     0,   276,     0,     0,     0,     0,   264,    80,     0,
1321    333,    81,    20,     0,     0,     0,   333,     0,     0,   277,
1322      0,   157,   719,     0,     0,   278,     0,     0,   205,   206,
1323    207,   208,   679,     0,   209,   210,     0,     0,     0,     0,
1324      0,     0,     0,   334,     0,     0,     0,     0,     0,   334,
1325      2,   195,   196,   652,   265,   266,    78,   267,     0,     0,
1326    268,     0,     0,     0,   269,   197,     0,     0,   653,     0,
1327      0,   270,   271,     5,   272,     0,   273,   274,   199,   275,
1328      0,    78,   276,     0,     0,     0,     0,     0,    80,     0,
1329    197,    81,    20,     0,     0,     0,   198,     0,     0,   277,
1330      0,   157,   747,   199,     0,   278,     0,   200,   205,   206,
1331    207,   208,     0,    80,   209,   210,    81,    20,     0,     0,
1332    201,   202,     0,     0,   203,     0,     0,     0,     0,     0,
1333      0,     0,     0,   205,   206,   207,   208,     0,   264,   209,
1334    210,     0,     0,     0,     0,   333,   333,     0,     0,     0,
1335      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1336      0,   333,     0,     0,     0,     0,     0,     0,     0,     0,
1337      0,     0,     0,     0,     0,     0,     0,     0,   334,   334,
1338      0,     2,   195,   196,  -267,   265,   266,    78,   267,     0,
1339      0,   268,     0,     0,   334,   269,   197,     0,     0,  -267,
1340      0,     0,   270,   271,     5,   272,   264,   273,   274,   199,
1341    275,     0,     0,   276,     0,     0,     0,     0,     0,    80,
1342      0,     0,    81,    20,     0,     0,     0,     0,     0,     0,
1343    277,     0,   157,  -267,     0,     0,   278,     0,     0,   205,
1344    206,   207,   208,     0,     0,   209,   210,     0,     0,     2,
1345    195,   196,     0,   265,   266,    78,   267,     0,     0,   268,
1346      0,     0,     0,   269,   197,     0,     0,     0,     0,     0,
1347    270,   271,     5,   272,   264,   273,   274,   199,   275,     0,
1348      0,   276,     0,     0,     0,     0,     0,    80,     0,     0,
1349     81,    20,     0,     0,     0,     0,     0,     0,   277,     0,
1350    157,   437,     0,     0,   278,     0,     0,   205,   206,   207,
1351    208,     0,     0,   209,   210,     0,     0,     2,   195,   196,
1352      0,   265,   266,    78,   267,     0,     0,   268,     0,     0,
1353      0,   269,   197,     0,     0,     0,     0,     0,   270,   271,
1354      5,   272,   264,   273,   274,   199,   275,     0,     0,   276,
1355      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1356      0,     0,     0,     0,     0,     0,   277,     0,   157,     0,
1357      0,     0,   278,     0,     0,   205,   206,   207,   208,     0,
1358      0,   209,   210,     0,     0,     2,   195,   196,     0,   265,
1359    266,    78,   267,     0,     0,   268,     0,     0,     0,   269,
1360    197,     0,     0,     0,     0,     0,   270,   271,   264,   272,
1361      0,   273,   274,   199,   275,     0,     0,   276,     0,     0,
1362      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1363      0,     0,     0,     0,   277,     0,   157,     0,     0,     0,
1364    278,     0,     0,   205,   206,   207,   208,     0,     0,   209,
1365    210,     2,   195,   196,     0,   693,   266,    78,   267,     0,
1366      0,   268,     0,     0,     0,   269,   197,     0,     0,     0,
1367      0,     0,   270,   271,     0,   272,     0,   273,   274,   199,
1368    275,     0,   415,   276,   193,   194,     0,     0,     0,    80,
1369      0,     0,    81,    20,     0,     0,     0,     0,     0,     0,
1370    277,     0,   157,     0,     0,     0,   278,     0,     0,   205,
1371    206,   207,   208,     0,     0,   209,   210,     0,     0,     0,
1372      0,     0,     0,     0,     0,     0,   195,   196,     0,     0,
1373      0,    78,     0,   544,     0,   193,   194,     0,     0,     0,
1374    197,     0,     0,     0,     0,     0,   198,     0,     0,     0,
1375      0,     0,     0,   199,     0,     0,     0,   200,     0,     0,
1376      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1377    201,   202,     0,     0,   203,     0,     0,   195,   196,     0,
1378    416,     0,    78,   205,   206,   207,   208,     0,     0,   209,
1379    210,   197,     0,     0,     0,     0,     0,   198,   491,     0,
1380    193,   194,     0,     0,   199,     0,     0,     0,   200,     0,
1381      0,     0,     0,     0,    80,     0,     0,    81,    20,     0,
1382    545,   201,   202,     0,     0,   203,     0,     0,     0,     0,
1383      0,     0,     0,     0,   205,   206,   207,   208,     0,     0,
1384    209,   210,   195,   196,     0,     0,     0,    78,     0,   581,
1385      0,   193,   194,     0,     0,     0,   197,     0,     0,     0,
1386      0,     0,   198,     0,     0,     0,     0,     0,     0,   199,
1387      0,     0,     0,   200,     0,     0,     0,     0,     0,    80,
1388      0,     0,    81,    20,     0,     0,   201,   202,     0,     0,
1389    203,     0,     0,   195,   196,   148,     0,     0,    78,   205,
1390    206,   207,   208,     0,     0,   209,   210,   197,     0,     0,
1391      0,     0,     0,   198,   589,     0,   193,   194,     0,     0,
1392    199,     0,     0,     0,   200,     0,     0,     0,     0,     0,
1393     80,     0,     0,    81,    20,     0,     0,   201,   202,     0,
1394      0,   203,   582,     0,     0,     0,     0,     0,     0,     0,
1395    205,   206,   207,   208,     0,     0,   209,   210,   195,   196,
1396      0,     0,     0,    78,     0,   597,     0,   193,   194,     0,
1397      0,     0,   197,     0,     0,     0,     0,     0,   198,     0,
1398      0,     0,     0,     0,     0,   199,     0,     0,     0,   200,
1399      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1400      0,     0,   201,   202,     0,     0,   203,     0,     0,   195,
1401    196,     0,   590,     0,    78,   205,   206,   207,   208,     0,
1402      0,   209,   210,   197,     0,     0,     0,     0,     0,   198,
1403    606,     0,   193,   194,     0,     0,   199,     0,     0,     0,
1404    200,     0,     0,     0,     0,     0,    80,     0,     0,    81,
1405     20,     0,     0,   201,   202,     0,     0,   203,     0,     0,
1406      0,     0,   598,     0,     0,     0,   205,   206,   207,   208,
1407      0,     0,   209,   210,   195,   196,     0,     0,     0,    78,
1408      0,   491,     0,   193,   194,     0,     0,     0,   197,     0,
1409      0,     0,     0,     0,   198,     0,     0,     0,     0,     0,
1410      0,   199,     0,     0,     0,   200,     0,     0,     0,     0,
1411      0,    80,     0,     0,    81,    20,     0,     0,   201,   202,
1412      0,     0,   203,   607,     0,   195,   196,     0,     0,     0,
1413     78,   205,   206,   207,   208,     0,     0,   209,   210,   197,
1414      0,     0,     0,     0,     0,   198,   581,     0,   193,   194,
1415      0,     0,   199,     0,     0,     0,   200,     0,     0,     0,
1416      0,     0,    80,     0,     0,    81,    20,     0,     0,   201,
1417    202,     0,     0,   203,     0,     0,     0,     0,   598,     0,
1418      0,     0,   205,   206,   207,   208,     0,     0,   209,   210,
1419    195,   196,     0,     0,     0,    78,     0,   707,     0,   193,
1420    194,     0,     0,     0,   197,     0,     0,     0,     0,     0,
1421    198,     0,     0,     0,     0,     0,     0,   199,     0,     0,
1422      0,   200,     0,     0,     0,     0,     0,    80,     0,     0,
1423     81,    20,     0,     0,   201,   202,     0,     0,   203,   691,
1424      0,   195,   196,     0,     0,     0,    78,   205,   206,   207,
1425    208,     0,     0,   209,   210,   197,     0,     0,     0,     0,
1426      0,   198,   707,     0,   193,   194,     0,     0,   199,     0,
1427      0,     0,   200,     0,     0,     0,     0,     0,    80,     0,
1428      0,    81,    20,     0,     0,   201,   202,     0,     0,   203,
1429    708,     0,     0,     0,     0,     0,     0,     0,   205,   206,
1430    207,   208,     0,     0,   209,   210,   195,   196,     0,     0,
1431      0,    78,     0,   589,     0,   193,   194,     0,     0,     0,
1432    197,     0,     0,     0,     0,     0,   198,     0,     0,     0,
1433      0,     0,     0,   199,     0,     0,     0,   200,     0,     0,
1434      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1435    201,   202,     0,     0,   203,   751,     0,   195,   196,     0,
1436      0,     0,    78,   205,   206,   207,   208,     0,     0,   209,
1437    210,   197,     0,     0,     0,     0,     0,   198,   331,     0,
1438    193,   194,     0,     0,   199,     0,     0,     0,   200,     0,
1439      0,     0,     0,     0,    80,     0,     0,    81,    20,     0,
1440      0,   201,   202,     0,     0,   203,     0,     0,     0,     0,
1441      0,   756,     0,     0,   205,   206,   207,   208,     0,     0,
1442    209,   210,   195,   196,     0,     0,     0,    78,     0,   336,
1443      0,   193,   194,     0,     0,     0,   197,     0,     0,     0,
1444      0,     0,   198,     0,     0,     0,     0,     0,     0,   199,
1445      0,     0,     0,   200,     0,     0,     0,     0,     0,    80,
1446      0,     0,    81,    20,     0,     0,   201,   202,     0,     0,
1447    203,     0,     0,   195,   196,     0,     0,     0,    78,   205,
1448    206,   207,   208,     0,     0,   209,   210,   197,     0,     0,
1449      0,     0,     0,   198,   338,     0,   193,   194,     0,     0,
1450    199,     0,     0,     0,   200,     0,     0,     0,     0,     0,
1451     80,     0,     0,    81,    20,     0,     0,   201,   202,     0,
1452      0,   203,     0,     0,     0,     0,     0,     0,     0,     0,
1453    205,   206,   207,   208,     0,     0,   209,   210,   195,   196,
1454      0,     0,     0,    78,     0,   340,     0,   193,   194,     0,
1455      0,     0,   197,     0,     0,     0,     0,     0,   198,     0,
1456      0,     0,     0,     0,     0,   199,     0,     0,     0,   200,
1457      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1458      0,     0,   201,   202,     0,     0,   203,     0,     0,   195,
1459    196,     0,     0,     0,    78,   205,   206,   207,   208,     0,
1460      0,   209,   210,   197,     0,     0,     0,     0,     0,   198,
1461    349,     0,   193,   194,     0,     0,   199,     0,     0,     0,
1462    200,     0,     0,     0,     0,     0,    80,     0,     0,    81,
1463     20,     0,     0,   201,   202,     0,     0,   203,     0,     0,
1464      0,     0,     0,     0,     0,     0,   205,   206,   207,   208,
1465      0,     0,   209,   210,   195,   196,     0,     0,     0,    78,
1466      0,   351,     0,   193,   194,     0,     0,     0,   197,     0,
1467      0,     0,     0,     0,   198,     0,     0,     0,     0,     0,
1468      0,   199,     0,     0,     0,   200,     0,     0,     0,     0,
1469      0,    80,     0,     0,    81,    20,     0,     0,   201,   202,
1470      0,     0,   203,     0,     0,   195,   196,     0,     0,     0,
1471     78,   205,   206,   207,   208,     0,     0,   209,   210,   197,
1472      0,     0,     0,     0,     0,   198,   353,     0,   193,   194,
1473      0,     0,   199,     0,     0,     0,   200,     0,     0,     0,
1474      0,     0,    80,     0,     0,    81,    20,     0,     0,   201,
1475    202,     0,     0,   203,     0,     0,     0,     0,     0,     0,
1476      0,     0,   205,   206,   207,   208,     0,     0,   209,   210,
1477    195,   196,     0,     0,     0,    78,     0,   410,     0,   193,
1478    194,     0,     0,     0,   197,     0,     0,     0,     0,     0,
1479    198,     0,     0,     0,     0,     0,     0,   199,     0,     0,
1480      0,   200,     0,     0,     0,     0,     0,    80,     0,     0,
1481     81,    20,     0,     0,   201,   202,     0,     0,   203,     0,
1482      0,   195,   196,     0,     0,     0,    78,   205,   206,   207,
1483    208,     0,     0,   209,   210,   197,     0,     0,     0,     0,
1484      0,   198,   491,     0,   193,   194,     0,     0,   199,     0,
1485      0,     0,   200,     0,     0,     0,     0,     0,    80,     0,
1486      0,    81,    20,     0,     0,   201,   202,     0,     0,   203,
1487      0,     0,     0,     0,     0,     0,     0,     0,   205,   206,
1488    207,   208,     0,     0,   209,   210,   195,   196,     0,     0,
1489      0,    78,     0,   499,     0,   193,   194,     0,     0,     0,
1490    197,     0,     0,     0,     0,     0,   198,     0,     0,     0,
1491      0,     0,     0,   199,     0,     0,     0,   200,     0,     0,
1492      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1493    201,   202,     0,     0,   203,     0,     0,   195,   196,     0,
1494      0,     0,    78,   205,   206,   207,   208,     0,     0,   209,
1495    210,   197,     0,     0,     0,     0,     0,   198,   503,     0,
1496    193,   194,     0,     0,   199,     0,     0,     0,   200,     0,
1497      0,     0,     0,     0,    80,     0,     0,    81,    20,     0,
1498      0,   201,   202,     0,     0,   203,     0,     0,     0,     0,
1499      0,     0,     0,     0,   205,   206,   207,   208,     0,     0,
1500    209,   210,   195,   196,     0,     0,     0,    78,     0,   505,
1501      0,   193,   194,     0,     0,     0,   197,     0,     0,     0,
1502      0,     0,   198,     0,     0,     0,     0,     0,     0,   199,
1503      0,     0,     0,   200,     0,     0,     0,     0,     0,    80,
1504      0,     0,    81,    20,     0,     0,   201,   202,     0,     0,
1505    203,     0,     0,   195,   196,     0,     0,     0,    78,   205,
1506    206,   207,   208,     0,     0,   209,   210,   197,     0,     0,
1507      0,     0,     0,   198,   507,     0,   193,   194,     0,     0,
1508    199,     0,     0,     0,   200,     0,     0,     0,     0,     0,
1509     80,     0,     0,    81,    20,     0,     0,   201,   202,     0,
1510      0,   203,     0,     0,     0,     0,     0,     0,     0,     0,
1511    205,   206,   207,   208,     0,     0,   209,   210,   195,   196,
1512      0,     0,     0,    78,     0,   509,     0,   193,   194,     0,
1513      0,     0,   197,     0,     0,     0,     0,     0,   198,     0,
1514      0,     0,     0,     0,     0,   199,     0,     0,     0,   200,
1515      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1516      0,     0,   201,   202,     0,     0,   203,     0,     0,   195,
1517    196,     0,     0,     0,    78,   205,   206,   207,   208,     0,
1518      0,   209,   210,   197,     0,     0,     0,     0,     0,   198,
1519    511,     0,   193,   194,     0,     0,   199,     0,     0,     0,
1520    200,     0,     0,     0,     0,     0,    80,     0,     0,    81,
1521     20,     0,     0,   201,   202,     0,     0,   203,     0,     0,
1522      0,     0,     0,     0,     0,     0,   205,   206,   207,   208,
1523      0,     0,   209,   210,   195,   196,     0,     0,     0,    78,
1524      0,   513,     0,   193,   194,     0,     0,     0,   197,     0,
1525      0,     0,     0,     0,   198,     0,     0,     0,     0,     0,
1526      0,   199,     0,     0,     0,   200,     0,     0,     0,     0,
1527      0,    80,     0,     0,    81,    20,     0,     0,   201,   202,
1528      0,     0,   203,     0,     0,   195,   196,     0,     0,     0,
1529     78,   205,   206,   207,   208,     0,     0,   209,   210,   197,
1530      0,     0,     0,     0,     0,   198,   515,     0,   193,   194,
1531      0,     0,   199,     0,     0,     0,   200,     0,     0,     0,
1532      0,     0,    80,     0,     0,    81,    20,     0,     0,   201,
1533    202,     0,     0,   203,     0,     0,     0,     0,     0,     0,
1534      0,     0,   205,   206,   207,   208,     0,     0,   209,   210,
1535    195,   196,     0,     0,     0,    78,     0,   517,     0,   193,
1536    194,     0,     0,     0,   197,     0,     0,     0,     0,     0,
1537    198,     0,     0,     0,     0,     0,     0,   199,     0,     0,
1538      0,   200,     0,     0,     0,     0,     0,    80,     0,     0,
1539     81,    20,     0,     0,   201,   202,     0,     0,   203,     0,
1540      0,   195,   196,     0,     0,     0,    78,   205,   206,   207,
1541    208,     0,     0,   209,   210,   197,     0,     0,     0,     0,
1542      0,   198,   519,     0,   193,   194,     0,     0,   199,     0,
1543      0,     0,   200,     0,     0,     0,     0,     0,    80,     0,
1544      0,    81,    20,     0,     0,   201,   202,     0,     0,   203,
1545      0,     0,     0,     0,     0,     0,     0,     0,   205,   206,
1546    207,   208,     0,     0,   209,   210,   195,   196,     0,     0,
1547      0,    78,     0,   521,     0,   193,   194,     0,     0,     0,
1548    197,     0,     0,     0,     0,     0,   198,     0,     0,     0,
1549      0,     0,     0,   199,     0,     0,     0,   200,     0,     0,
1550      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1551    201,   202,     0,     0,   203,     0,     0,   195,   196,     0,
1552      0,     0,    78,   205,   206,   207,   208,     0,     0,   209,
1553    210,   197,     0,     0,     0,     0,     0,   198,   523,     0,
1554    193,   194,     0,     0,   199,     0,     0,     0,   200,     0,
1555      0,     0,     0,     0,    80,     0,     0,    81,    20,     0,
1556      0,   201,   202,     0,     0,   203,     0,     0,     0,     0,
1557      0,     0,     0,     0,   205,   206,   207,   208,     0,     0,
1558    209,   210,   195,   196,     0,     0,     0,    78,     0,   525,
1559      0,   193,   194,     0,     0,     0,   197,     0,     0,     0,
1560      0,     0,   198,     0,     0,     0,     0,     0,     0,   199,
1561      0,     0,     0,   200,     0,     0,     0,     0,     0,    80,
1562      0,     0,    81,    20,     0,     0,   201,   202,     0,     0,
1563    203,     0,     0,   195,   196,     0,     0,     0,    78,   205,
1564    206,   207,   208,     0,     0,   209,   210,   197,     0,     0,
1565      0,     0,     0,   198,   530,     0,   193,   194,     0,     0,
1566    199,     0,     0,     0,   200,     0,     0,     0,     0,     0,
1567     80,     0,     0,    81,    20,     0,     0,   201,   202,     0,
1568      0,   203,     0,     0,     0,     0,     0,     0,     0,     0,
1569    205,   206,   207,   208,     0,     0,   209,   210,   195,   196,
1570      0,     0,     0,    78,     0,   532,     0,   193,   194,     0,
1571      0,     0,   197,     0,     0,     0,     0,     0,   198,     0,
1572      0,     0,     0,     0,     0,   199,     0,     0,     0,   200,
1573      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1574      0,     0,   201,   202,     0,     0,   203,     0,     0,   195,
1575    196,     0,     0,     0,    78,   205,   206,   207,   208,     0,
1576      0,   209,   210,   197,     0,     0,     0,     0,     0,   198,
1577    534,     0,   193,   194,     0,     0,   199,     0,     0,     0,
1578    200,     0,     0,     0,     0,     0,    80,     0,     0,    81,
1579     20,     0,     0,   201,   202,     0,     0,   203,     0,     0,
1580      0,     0,     0,     0,     0,     0,   205,   206,   207,   208,
1581      0,     0,   209,   210,   195,   196,     0,     0,     0,    78,
1582      0,   536,     0,   193,   194,     0,     0,     0,   197,     0,
1583      0,     0,     0,     0,   198,     0,     0,     0,     0,     0,
1584      0,   199,     0,     0,     0,   200,     0,     0,     0,     0,
1585      0,    80,     0,     0,    81,    20,     0,     0,   201,   202,
1586      0,     0,   203,     0,     0,   195,   196,     0,     0,     0,
1587     78,   205,   206,   207,   208,     0,     0,   209,   210,   197,
1588      0,     0,     0,     0,     0,   198,   538,     0,   193,   194,
1589      0,     0,   199,     0,     0,     0,   200,     0,     0,     0,
1590      0,     0,    80,     0,     0,    81,    20,     0,     0,   201,
1591    202,     0,     0,   203,     0,     0,     0,     0,     0,     0,
1592      0,     0,   205,   206,   207,   208,     0,     0,   209,   210,
1593    195,   196,     0,     0,     0,    78,     0,   540,     0,   193,
1594    194,     0,     0,     0,   197,     0,     0,     0,     0,     0,
1595    198,     0,     0,     0,     0,     0,     0,   199,     0,     0,
1596      0,   200,     0,     0,     0,     0,     0,    80,     0,     0,
1597     81,    20,     0,     0,   201,   202,     0,     0,   203,     0,
1598      0,   195,   196,     0,     0,     0,    78,   205,   206,   207,
1599    208,     0,     0,   209,   210,   197,     0,     0,     0,     0,
1600      0,   198,   542,     0,   193,   194,     0,     0,   199,     0,
1601      0,     0,   200,     0,     0,     0,     0,     0,    80,     0,
1602      0,    81,    20,     0,     0,   201,   202,     0,     0,   203,
1603      0,     0,     0,     0,     0,     0,     0,     0,   205,   206,
1604    207,   208,     0,     0,   209,   210,   195,   196,     0,     0,
1605      0,    78,     0,   547,     0,   193,   194,     0,     0,     0,
1606    197,     0,     0,     0,     0,     0,   198,     0,     0,     0,
1607      0,     0,     0,   199,     0,     0,     0,   200,     0,     0,
1608      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1609    201,   202,     0,     0,   203,     0,     0,   195,   196,     0,
1610      0,     0,    78,   205,   206,   207,   208,     0,     0,   209,
1611    210,   197,     0,     0,     0,     0,     0,   198,   557,     0,
1612    193,   194,     0,     0,   199,     0,     0,     0,   200,     0,
1613      0,     0,     0,     0,    80,     0,     0,    81,    20,     0,
1614      0,   201,   202,     0,     0,   203,     0,     0,     0,     0,
1615      0,     0,     0,     0,   205,   206,   207,   208,     0,     0,
1616    209,   210,   195,   196,     0,     0,     0,    78,     0,   565,
1617      0,   193,   194,     0,     0,     0,   197,     0,     0,     0,
1618      0,     0,   198,     0,     0,     0,     0,     0,     0,   199,
1619      0,     0,     0,   200,     0,     0,     0,     0,     0,    80,
1620      0,     0,    81,    20,     0,     0,   201,   202,     0,     0,
1621    203,     0,     0,   195,   196,     0,     0,     0,    78,   205,
1622    206,   207,   208,     0,     0,   209,   210,   197,     0,     0,
1623      0,     0,     0,   198,   567,     0,   193,   194,     0,     0,
1624    199,     0,     0,     0,   200,     0,     0,     0,     0,     0,
1625     80,     0,     0,    81,    20,     0,     0,   201,   202,     0,
1626      0,   203,     0,     0,     0,     0,     0,     0,     0,     0,
1627    205,   206,   207,   208,     0,     0,   209,   210,   195,   196,
1628      0,     0,     0,    78,     0,   592,     0,   193,   194,     0,
1629      0,     0,   197,     0,     0,     0,     0,     0,   198,     0,
1630      0,     0,     0,     0,     0,   199,     0,     0,     0,   200,
1631      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1632      0,     0,   201,   202,     0,     0,   203,     0,     0,   195,
1633    196,     0,     0,     0,    78,   205,   206,   207,   208,     0,
1634      0,   209,   210,   197,     0,     0,     0,     0,     0,   198,
1635    609,     0,   193,   194,     0,     0,   199,     0,     0,     0,
1636    200,     0,     0,     0,     0,     0,    80,     0,     0,    81,
1637     20,     0,     0,   201,   202,     0,     0,   203,     0,     0,
1638      0,     0,     0,     0,     0,     0,   205,   206,   207,   208,
1639      0,     0,   209,   210,   195,   196,     0,     0,     0,    78,
1640      0,   677,     0,   193,   194,     0,     0,     0,   197,     0,
1641      0,     0,     0,     0,   198,     0,     0,     0,     0,     0,
1642      0,   199,     0,     0,     0,   200,     0,     0,     0,     0,
1643      0,    80,     0,     0,    81,    20,     0,     0,   201,   202,
1644      0,     0,   203,     0,     0,   195,   196,     0,     0,     0,
1645     78,   205,   206,   207,   208,     0,     0,   209,   210,   197,
1646      0,     0,     0,     0,     0,   198,   681,     0,   193,   194,
1647      0,     0,   199,     0,     0,     0,   200,     0,     0,     0,
1648      0,     0,    80,     0,     0,    81,    20,     0,     0,   201,
1649    202,     0,     0,   203,     0,     0,     0,     0,     0,     0,
1650      0,     0,   205,   206,   207,   208,     0,     0,   209,   210,
1651    195,   196,     0,     0,     0,    78,     0,   687,     0,   193,
1652    194,     0,     0,     0,   197,     0,     0,     0,     0,     0,
1653    198,     0,     0,     0,     0,     0,     0,   199,     0,     0,
1654      0,   200,     0,     0,     0,     0,     0,    80,     0,     0,
1655     81,    20,     0,     0,   201,   202,     0,     0,   203,     0,
1656      0,   195,   196,     0,     0,     0,    78,   205,   206,   207,
1657    208,     0,     0,   209,   210,   197,     0,     0,     0,     0,
1658      0,   198,   713,     0,   193,   194,     0,     0,   199,     0,
1659      0,     0,   200,     0,     0,     0,     0,     0,    80,     0,
1660      0,    81,    20,     0,     0,   201,   202,     0,     0,   203,
1661      0,     0,     0,     0,     0,     0,     0,     0,   205,   206,
1662    207,   208,     0,     0,   209,   210,   195,   196,     0,     0,
1663      0,    78,     0,   662,     0,     0,     0,     0,     0,     0,
1664    197,     0,     0,     0,     0,     0,   198,     0,     0,     0,
1665      0,     0,     0,   199,     0,     0,     0,   200,   724,     0,
1666      0,     0,     0,    80,     0,     0,    81,    20,     0,     0,
1667    201,   202,     0,     0,   203,     0,     0,   195,   196,     0,
1668      0,     0,    78,   205,   206,   207,   208,     0,     0,   209,
1669    210,   197,     0,     0,     0,     0,     0,   198,     0,     0,
1670      0,     0,   195,   196,   199,     0,     0,    78,   200,     0,
1671      0,   193,   194,     0,    80,     0,   197,    81,    20,     0,
1672      0,     0,   198,     0,     0,   277,  -298,     0,     0,   199,
1673      0,     0,     0,   200,   205,   206,   207,   208,     0,    80,
1674    209,   210,    81,    20,     0,     0,     0,     0,     0,     0,
1675    277,  -298,     0,   195,   196,     0,     0,     0,    78,   205,
1676    206,   207,   208,     0,     0,   209,   210,   197,     0,     0,
1677      0,     0,     0,   198,     0,     0,   193,   194,     0,     0,
1678    199,     0,     0,     0,   200,     0,     0,     0,     0,     0,
1679     80,     0,     0,    81,    20,     0,     0,   201,   202,     0,
1680      0,   203,     0,   204,   357,     0,     0,     0,     0,     0,
1681    205,   206,   207,   208,     0,     0,   209,   210,   195,   196,
1682      0,     0,     0,    78,     0,     0,     0,   193,   194,     0,
1683      0,     0,   197,     0,     0,     0,     0,     0,   198,     0,
1684      0,     0,     0,     0,     0,   199,     0,     0,     0,   200,
1685      0,     0,     0,     0,     0,    80,     0,     0,    81,    20,
1686      0,     0,   201,   202,     0,     0,   203,   488,     0,   195,
1687    196,     0,     0,     0,    78,   205,   206,   207,   208,     0,
1688      0,   209,   210,   197,     0,     0,     0,     0,     0,   198,
1689      0,     0,   193,   194,     0,     0,   199,     0,     0,     0,
1690    200,     0,     0,     0,     0,     0,    80,     0,     0,    81,
1691     20,     0,     0,   201,   202,     0,     0,   203,   625,     0,
1692      0,     0,     0,     0,     0,     0,   205,   206,   207,   208,
1693      0,     0,   209,   210,   195,   196,     0,     0,     0,    78,
1694      0,     0,     0,   193,   194,     0,     0,     0,   197,     0,
1695      0,     0,     0,     0,   198,     0,     0,     0,     0,     0,
1696      0,   199,     0,     0,     0,   200,     0,     0,     0,     0,
1697      0,    80,     0,     0,    81,    20,     0,     0,   201,   202,
1698      0,     0,   203,   668,     0,   195,   196,     0,     0,     0,
1699     78,   205,   206,   207,   208,     0,     0,   209,   210,   197,
1700      0,     0,     0,     0,     0,   198,     0,     0,   193,   194,
1701      0,     0,   199,     0,     0,     0,   200,     0,     0,     0,
1702      0,     0,    80,     0,     0,    81,    20,     0,     0,   201,
1703    202,     0,     0,   203,   683,     0,     0,     0,     0,     0,
1704      0,     0,   205,   206,   207,   208,     0,     0,   209,   210,
1705    195,   196,     0,     0,     0,    78,     0,     0,     0,     0,
1706      0,     0,     0,     0,   197,     0,     0,     0,     0,     0,
1707    198,     0,     0,     0,     0,     0,     0,   199,     0,     0,
1708      0,   200,     0,     0,     0,     0,     0,    80,     0,     0,
1709     81,    20,     0,     0,   201,   202,     0,     0,   203,     0,
1710      2,   195,   196,     0,     0,     0,    78,   205,   206,   207,
1711    208,     0,     0,   209,   210,   197,     0,     0,     0,     0,
1712      0,   198,     0,     0,     0,     0,     0,     0,   199,     0,
1713      0,    78,   200,     0,     0,     0,     0,     0,    80,     0,
1714    197,    81,    20,     0,     0,     0,   198,     0,     0,   277,
1715      0,     0,     0,   199,     0,     0,     0,   200,   205,   206,
1716    207,   208,     0,    80,   209,   210,    81,    20,     0,     0,
1717    201,   202,     0,     0,   203,     0,     0,     0,     0,     0,
1718      0,     0,     0,   205,   206,   207,   208,     0,     0,   209,
1719    210
1720 };
1721
1722 static const short yycheck[] = {     3,
1723    308,   129,     6,   288,   328,   204,   133,     1,   123,   175,
1724    132,   134,    62,     1,   483,   179,     1,     1,   665,     0,
1725     15,     1,     1,   295,   553,     1,     1,   556,     9,    10,
1726     11,   303,    72,   305,   162,     1,   117,    86,    42,    89,
1727      1,   169,    46,   657,    94,   129,    86,    95,     1,    30,
1728     62,    53,    33,    34,   347,     1,   436,     1,    62,    94,
1729     64,   354,   355,     1,   129,    69,   101,    94,     1,   150,
1730     51,    42,   153,   100,   100,    46,   199,     1,   162,   129,
1731    175,    62,    94,   133,    52,    89,     1,     1,    67,     1,
1732     94,   172,    87,    64,     1,    97,   476,   162,    69,    93,
1733     88,    67,   631,     1,   718,   636,     1,   101,     1,   756,
1734    160,    95,   162,    94,    99,    99,   101,   129,   765,    99,
1735      1,   101,   502,    99,   128,   129,   101,   254,     1,   133,
1736    134,     1,   260,   183,   193,   194,   195,   196,    99,   100,
1737      4,     5,   201,   202,   613,   273,    99,   100,   129,     1,
1738    162,     1,   133,    99,     1,    99,   160,   128,   162,     1,
1739     98,    94,   636,   134,   279,   329,   697,   100,     1,   700,
1740      1,   175,    36,    37,   255,    99,    40,   470,     1,   183,
1741    473,   162,    94,     1,    99,    99,    50,    94,   100,   193,
1742    194,   195,   196,   288,   175,   199,    94,   201,   202,   203,
1743    295,   328,   100,    98,   254,    86,    99,   330,   303,     1,
1744    305,     1,   101,   308,    94,    79,   596,     1,    99,    83,
1745    100,    62,    97,   697,    94,    98,   700,    94,   199,   636,
1746    100,     1,   763,   100,    86,   285,     1,   768,   404,   770,
1747      1,   772,   622,     9,     1,    63,     1,    99,    89,    99,
1748    254,    98,   632,    94,     1,     1,     1,    99,   122,   123,
1749      1,     0,     1,    94,    94,    98,   140,    33,   648,   100,
1750    100,   556,    97,   254,   636,   139,    99,    95,   328,    93,
1751    588,   285,   590,    97,   288,   100,   485,   101,   129,   763,
1752    697,   295,   133,   700,   768,     1,   770,    52,   772,   303,
1753      1,   305,    99,   100,   308,    44,    98,   288,    98,   404,
1754     94,   175,   371,   372,   373,   179,    55,   641,    63,   160,
1755    435,   162,    61,     1,   328,    95,   330,   308,    67,   203,
1756    204,    88,     1,    98,   175,   697,    75,    98,   700,     1,
1757     95,     1,   183,     1,     1,    93,   631,   328,    95,    95,
1758     95,     1,   732,    95,    95,   219,   763,   665,   199,   330,
1759     99,   768,   203,   770,   636,   772,    98,   371,   372,   373,
1760    374,   375,   376,   377,   378,   379,   380,   381,   382,   383,
1761    384,   385,   386,   387,   388,   389,   390,   553,    94,     1,
1762      1,    92,   266,    94,    52,   269,    97,    98,    99,   100,
1763    404,   763,     1,   277,   268,    63,   768,    47,   770,    95,
1764    772,   275,     1,   254,    96,   279,    94,    86,   477,   129,
1765      1,     1,    62,   404,   288,   697,     1,    93,   700,     1,
1766      1,   295,    94,    93,    99,   720,    93,    95,     1,   303,
1767     95,   305,   570,    93,   285,   573,     1,   288,   756,    53,
1768    160,   723,   162,    94,   175,    65,    96,   765,   553,   100,
1769     94,   556,    72,    97,   736,   329,     1,   308,     1,    44,
1770     44,    94,     0,   477,    86,    50,     1,   100,   750,   483,
1771    344,     9,    10,    11,   100,   607,     1,   328,   362,     0,
1772      1,   763,   366,   588,    93,   590,   768,   107,   770,   363,
1773    772,   365,    30,   625,    93,    33,    34,    82,     1,    44,
1774     85,    86,    93,    93,   641,   101,    47,   391,     1,    94,
1775     92,    93,    93,    51,   101,    97,    98,    99,   100,     1,
1776     93,    62,    67,    44,    62,   409,   631,    52,    93,   667,
1777    404,   636,   383,   101,    55,   419,     1,   421,    63,   553,
1778     61,   175,   556,   612,   676,     1,    67,   431,    93,    97,
1779     93,    86,   657,   404,   686,    96,    94,   288,   432,     1,
1780    665,   435,   553,     5,   295,   556,    99,   100,    64,   453,
1781     95,   455,   303,    69,   305,    95,    96,   308,    99,    99,
1782     97,   641,    11,    86,   101,   469,     9,     1,    11,    45,
1783     46,   129,   697,    86,    50,   700,   480,    12,   612,   613,
1784     65,   485,    67,    59,    86,    13,     1,    72,     1,    65,
1785     33,    76,     1,   718,   628,   720,    72,   631,   723,    95,
1786     76,    86,   636,    99,   162,     1,    82,   641,     1,    85,
1787     86,   736,   128,     1,     0,     1,     1,    93,     3,     4,
1788    631,     1,    14,   657,    86,   750,   102,   103,   104,   105,
1789    641,   756,   108,   109,   288,    50,    99,     1,   763,    83,
1790    765,   295,     1,   768,   175,   770,   657,   772,    95,   303,
1791     97,   305,    86,   404,   308,     1,     1,    95,    44,   553,
1792     45,    46,   556,   697,    93,    50,   700,    82,     1,    55,
1793     85,    86,    93,    86,    59,    61,     1,    86,   122,   123,
1794     65,    67,   553,     1,   718,   556,   720,    72,     1,   723,
1795     86,    76,   472,    86,   474,   175,     1,    82,    86,    97,
1796     85,    86,   736,   101,    89,    90,    86,   718,    93,   720,
1797     95,    96,    99,    99,    97,   619,   750,   102,   103,   104,
1798    105,    67,    86,   108,   109,    94,    72,    86,    97,   763,
1799     76,    99,    45,    46,   768,   629,   770,   631,   772,    96,
1800     86,    86,   636,   100,    99,     1,     0,     1,    44,   653,
1801    404,     0,     1,    86,    60,   659,   470,   288,    64,   473,
1802    631,    86,    99,   657,   295,    61,     0,     1,    86,   100,
1803    641,    67,   303,    86,   305,    88,    95,   308,    91,    92,
1804     93,    86,    94,     1,    97,    97,   657,    66,   101,   101,
1805     44,    93,     0,     1,    93,    44,    88,   175,     1,     0,
1806      1,    55,   553,   697,    93,   556,   700,    61,   288,    65,
1807     44,    67,    61,    67,    99,   295,    72,    94,    67,     1,
1808     76,    91,    92,   303,   718,   305,   720,    61,   308,   723,
1809     86,   735,    50,    67,     1,   739,    44,   588,   697,   590,
1810     93,   700,   736,    44,    99,    99,    92,   718,   175,   720,
1811     99,    97,    98,    61,     1,    94,   750,    45,    46,    67,
1812     61,     5,     6,     7,    82,    99,    67,    85,    86,   763,
1813      8,     9,    10,   404,   768,    94,   770,    44,   772,     1,
1814    631,    45,    46,    50,    97,   636,    91,    92,    45,    46,
1815      1,    99,    59,   100,    61,     3,     4,    44,    99,   553,
1816     67,    94,   556,    50,   763,    56,   657,    16,    17,   768,
1817    288,   770,    99,   772,   665,    82,    56,   295,    85,    86,
1818     91,    92,    44,    50,   404,   303,    94,   305,    50,    94,
1819    308,    45,    46,    97,   588,    82,   590,   101,    85,    86,
1820     97,    94,   175,     1,   101,    44,   697,    45,    46,   700,
1821     10,    50,    97,    98,    99,    82,    44,    94,    85,    86,
1822     82,   288,    50,    85,    86,    97,    98,   718,   295,   720,
1823     30,    59,   723,    61,    34,     1,   303,   631,   305,    67,
1824     99,   308,   636,    82,    99,   736,    85,    86,    94,   384,
1825    385,    51,   374,   375,    82,    94,     0,    85,    86,   750,
1826     91,    92,    93,   657,    56,   756,    97,    95,    96,    94,
1827    101,   665,   763,     0,   765,    11,   383,   768,    54,   770,
1828     75,   772,   553,   162,   254,   556,   404,    86,    18,    19,
1829     20,    21,    91,    92,    93,   376,   377,   378,    97,   139,
1830    160,   404,   101,   697,    52,    86,   700,    94,   262,   308,
1831     91,    92,    93,   288,   571,   288,    97,   588,   655,   590,
1832    101,   655,   295,   308,   718,   571,   720,    57,   388,   723,
1833    303,   347,   305,   553,   389,   308,   556,   404,   386,    86,
1834    387,   390,   736,   394,    91,    92,    93,    -1,    -1,    44,
1835     97,    91,    92,    93,   101,    50,   750,    97,   628,     1,
1836    631,   101,   756,    -1,    59,   636,    61,    -1,   588,   763,
1837    590,   765,    67,    -1,   768,    -1,   770,    -1,   772,    91,
1838     92,    93,    -1,    -1,    -1,    97,   657,    82,    -1,   101,
1839     85,    86,    -1,    -1,   665,   379,   380,   381,   382,    -1,
1840     95,    96,    44,    45,    46,    -1,    -1,    -1,    50,    -1,
1841     -1,   631,    -1,    -1,    -1,    -1,   636,    59,    -1,    -1,
1842     -1,    -1,    -1,    65,    -1,    -1,   697,    -1,    -1,   700,
1843     72,   404,    -1,    -1,    76,   553,    -1,   657,   556,    -1,
1844     82,    -1,    -1,    85,    86,   665,    -1,   718,    -1,   720,
1845     -1,    93,   723,    -1,    -1,    -1,    -1,    99,    -1,    -1,
1846    102,   103,   104,   105,    -1,   736,   108,   109,    -1,    -1,
1847    588,    -1,   590,    -1,    -1,    -1,    -1,   697,    -1,   750,
1848    700,    -1,    -1,    -1,    -1,   756,   553,    -1,    -1,   556,
1849     -1,    -1,   763,    -1,   765,    -1,    -1,   768,   718,   770,
1850    720,   772,    -1,   723,    -1,    -1,    -1,    -1,    -1,    -1,
1851     -1,    -1,    -1,   631,    -1,    -1,   736,    -1,   636,    -1,
1852     -1,   588,    -1,   590,    -1,    -1,    -1,    -1,    -1,    -1,
1853    750,    -1,    -1,    -1,    44,    -1,   756,    -1,    -1,   657,
1854     50,    -1,    -1,   763,    -1,   765,    -1,   665,   768,    59,
1855    770,    61,   772,    -1,    -1,    -1,    -1,    67,    -1,    -1,
1856     -1,    -1,    -1,    -1,   631,    -1,    -1,    -1,    -1,   636,
1857     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,   697,
1858    553,    -1,   700,   556,    -1,    -1,    96,    -1,    -1,    -1,
1859    657,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   665,    -1,
1860    718,    -1,   720,    -1,    -1,   723,    -1,    -1,    -1,    -1,
1861     -1,    -1,    -1,    -1,    -1,   588,    -1,   590,   736,    -1,
1862     -1,    -1,    -1,    -1,    -1,    -1,   193,   194,   195,   196,
1863    697,    -1,   750,   700,   201,   202,    -1,    -1,   756,    -1,
1864     -1,    -1,    -1,    -1,    -1,   763,    -1,   765,    -1,    -1,
1865    768,   718,   770,   720,   772,    -1,   723,    -1,   631,   193,
1866    194,   195,   196,   636,    -1,    -1,    -1,   201,   202,   736,
1867     -1,    -1,    -1,    -1,    -1,    -1,    44,     1,    -1,     3,
1868      4,    -1,    50,   750,   657,    -1,    -1,    -1,    -1,   756,
1869     -1,    59,   665,    61,    -1,    -1,   763,    -1,   765,    67,
1870     -1,   768,    -1,   770,    -1,   772,    -1,    -1,    -1,    -1,
1871     -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,
1872     -1,    45,    46,    -1,   697,    -1,    50,   700,    96,    -1,
1873     -1,    -1,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,
1874     -1,    65,    -1,    -1,    -1,   718,    -1,   720,    72,    -1,
1875    723,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
1876     -1,    85,    86,   736,    -1,    89,    90,    -1,    -1,    93,
1877     -1,    95,    -1,    -1,    -1,    -1,    -1,   750,   102,   103,
1878    104,   105,    -1,   756,   108,   109,    -1,    -1,    -1,    -1,
1879    763,    -1,   765,    -1,    -1,   768,    -1,   770,    -1,   772,
1880     -1,    -1,    -1,    -1,   371,   372,   373,   374,   375,   376,
1881    377,   378,   379,   380,   381,   382,    -1,   384,   385,   386,
1882    387,   388,   389,   390,    -1,    -1,    -1,     1,    -1,    -1,
1883     -1,    -1,    -1,    -1,    -1,    -1,    -1,   371,   372,   373,
1884    374,   375,   376,   377,   378,   379,   380,   381,   382,    -1,
1885    384,   385,   386,   387,   388,   389,   390,    -1,    -1,    -1,
1886     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1887     44,    45,    46,    47,    48,    49,    50,    51,    -1,    -1,
1888     54,    -1,    -1,    -1,    58,    59,    -1,    -1,    62,    -1,
1889     -1,    65,    66,    67,    68,    -1,    70,    71,    72,    73,
1890     -1,    -1,    76,    -1,    -1,    -1,    -1,     1,    82,    -1,
1891    477,    85,    86,    -1,    -1,    -1,   483,    -1,    -1,    93,
1892     -1,    95,    96,    -1,    -1,    99,    -1,    -1,   102,   103,
1893    104,   105,     1,    -1,   108,   109,    -1,    -1,    -1,    -1,
1894     -1,    -1,    -1,   477,    -1,    -1,    -1,    -1,    -1,   483,
1895     44,    45,    46,    47,    48,    49,    50,    51,    -1,    -1,
1896     54,    -1,    -1,    -1,    58,    59,    -1,    -1,    62,    -1,
1897     -1,    65,    66,    67,    68,    -1,    70,    71,    72,    73,
1898     -1,    50,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
1899     59,    85,    86,    -1,    -1,    -1,    65,    -1,    -1,    93,
1900     -1,    95,    96,    72,    -1,    99,    -1,    76,   102,   103,
1901    104,   105,    -1,    82,   108,   109,    85,    86,    -1,    -1,
1902     89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    -1,
1903     -1,    -1,    -1,   102,   103,   104,   105,    -1,     1,   108,
1904    109,    -1,    -1,    -1,    -1,   612,   613,    -1,    -1,    -1,
1905     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1906     -1,   628,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1907     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   612,   613,
1908     -1,    44,    45,    46,    47,    48,    49,    50,    51,    -1,
1909     -1,    54,    -1,    -1,   628,    58,    59,    -1,    -1,    62,
1910     -1,    -1,    65,    66,    67,    68,     1,    70,    71,    72,
1911     73,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,
1912     -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,
1913     93,    -1,    95,    96,    -1,    -1,    99,    -1,    -1,   102,
1914    103,   104,   105,    -1,    -1,   108,   109,    -1,    -1,    44,
1915     45,    46,    -1,    48,    49,    50,    51,    -1,    -1,    54,
1916     -1,    -1,    -1,    58,    59,    -1,    -1,    -1,    -1,    -1,
1917     65,    66,    67,    68,     1,    70,    71,    72,    73,    -1,
1918     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
1919     85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    93,    -1,
1920     95,    96,    -1,    -1,    99,    -1,    -1,   102,   103,   104,
1921    105,    -1,    -1,   108,   109,    -1,    -1,    44,    45,    46,
1922     -1,    48,    49,    50,    51,    -1,    -1,    54,    -1,    -1,
1923     -1,    58,    59,    -1,    -1,    -1,    -1,    -1,    65,    66,
1924     67,    68,     1,    70,    71,    72,    73,    -1,    -1,    76,
1925     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
1926     -1,    -1,    -1,    -1,    -1,    -1,    93,    -1,    95,    -1,
1927     -1,    -1,    99,    -1,    -1,   102,   103,   104,   105,    -1,
1928     -1,   108,   109,    -1,    -1,    44,    45,    46,    -1,    48,
1929     49,    50,    51,    -1,    -1,    54,    -1,    -1,    -1,    58,
1930     59,    -1,    -1,    -1,    -1,    -1,    65,    66,     1,    68,
1931     -1,    70,    71,    72,    73,    -1,    -1,    76,    -1,    -1,
1932     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
1933     -1,    -1,    -1,    -1,    93,    -1,    95,    -1,    -1,    -1,
1934     99,    -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,
1935    109,    44,    45,    46,    -1,    48,    49,    50,    51,    -1,
1936     -1,    54,    -1,    -1,    -1,    58,    59,    -1,    -1,    -1,
1937     -1,    -1,    65,    66,    -1,    68,    -1,    70,    71,    72,
1938     73,    -1,     1,    76,     3,     4,    -1,    -1,    -1,    82,
1939     -1,    -1,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,
1940     93,    -1,    95,    -1,    -1,    -1,    99,    -1,    -1,   102,
1941    103,   104,   105,    -1,    -1,   108,   109,    -1,    -1,    -1,
1942     -1,    -1,    -1,    -1,    -1,    -1,    45,    46,    -1,    -1,
1943     -1,    50,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,
1944     59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
1945     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,
1946     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
1947     89,    90,    -1,    -1,    93,    -1,    -1,    45,    46,    -1,
1948     99,    -1,    50,   102,   103,   104,   105,    -1,    -1,   108,
1949    109,    59,    -1,    -1,    -1,    -1,    -1,    65,     1,    -1,
1950      3,     4,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,
1951     -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,
1952     88,    89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,
1953     -1,    -1,    -1,    -1,   102,   103,   104,   105,    -1,    -1,
1954    108,   109,    45,    46,    -1,    -1,    -1,    50,    -1,     1,
1955     -1,     3,     4,    -1,    -1,    -1,    59,    -1,    -1,    -1,
1956     -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,    -1,    72,
1957     -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,
1958     -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,
1959     93,    -1,    -1,    45,    46,    98,    -1,    -1,    50,   102,
1960    103,   104,   105,    -1,    -1,   108,   109,    59,    -1,    -1,
1961     -1,    -1,    -1,    65,     1,    -1,     3,     4,    -1,    -1,
1962     72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
1963     82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,
1964     -1,    93,    94,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1965    102,   103,   104,   105,    -1,    -1,   108,   109,    45,    46,
1966     -1,    -1,    -1,    50,    -1,     1,    -1,     3,     4,    -1,
1967     -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,
1968     -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,
1969     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
1970     -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,    45,
1971     46,    -1,    99,    -1,    50,   102,   103,   104,   105,    -1,
1972     -1,   108,   109,    59,    -1,    -1,    -1,    -1,    -1,    65,
1973      1,    -1,     3,     4,    -1,    -1,    72,    -1,    -1,    -1,
1974     76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,
1975     86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,
1976     -1,    -1,    98,    -1,    -1,    -1,   102,   103,   104,   105,
1977     -1,    -1,   108,   109,    45,    46,    -1,    -1,    -1,    50,
1978     -1,     1,    -1,     3,     4,    -1,    -1,    -1,    59,    -1,
1979     -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
1980     -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
1981     -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,
1982     -1,    -1,    93,    94,    -1,    45,    46,    -1,    -1,    -1,
1983     50,   102,   103,   104,   105,    -1,    -1,   108,   109,    59,
1984     -1,    -1,    -1,    -1,    -1,    65,     1,    -1,     3,     4,
1985     -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,
1986     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,
1987     90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    98,    -1,
1988     -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,   109,
1989     45,    46,    -1,    -1,    -1,    50,    -1,     1,    -1,     3,
1990      4,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,
1991     65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
1992     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
1993     85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,    94,
1994     -1,    45,    46,    -1,    -1,    -1,    50,   102,   103,   104,
1995    105,    -1,    -1,   108,   109,    59,    -1,    -1,    -1,    -1,
1996     -1,    65,     1,    -1,     3,     4,    -1,    -1,    72,    -1,
1997     -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
1998     -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,
1999     94,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   102,   103,
2000    104,   105,    -1,    -1,   108,   109,    45,    46,    -1,    -1,
2001     -1,    50,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,
2002     59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
2003     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,
2004     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
2005     89,    90,    -1,    -1,    93,    94,    -1,    45,    46,    -1,
2006     -1,    -1,    50,   102,   103,   104,   105,    -1,    -1,   108,
2007    109,    59,    -1,    -1,    -1,    -1,    -1,    65,     1,    -1,
2008      3,     4,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,
2009     -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,
2010     -1,    89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,
2011     -1,    99,    -1,    -1,   102,   103,   104,   105,    -1,    -1,
2012    108,   109,    45,    46,    -1,    -1,    -1,    50,    -1,     1,
2013     -1,     3,     4,    -1,    -1,    -1,    59,    -1,    -1,    -1,
2014     -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,    -1,    72,
2015     -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,
2016     -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,
2017     93,    -1,    -1,    45,    46,    -1,    -1,    -1,    50,   102,
2018    103,   104,   105,    -1,    -1,   108,   109,    59,    -1,    -1,
2019     -1,    -1,    -1,    65,     1,    -1,     3,     4,    -1,    -1,
2020     72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
2021     82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,
2022     -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2023    102,   103,   104,   105,    -1,    -1,   108,   109,    45,    46,
2024     -1,    -1,    -1,    50,    -1,     1,    -1,     3,     4,    -1,
2025     -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,
2026     -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,
2027     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
2028     -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,    45,
2029     46,    -1,    -1,    -1,    50,   102,   103,   104,   105,    -1,
2030     -1,   108,   109,    59,    -1,    -1,    -1,    -1,    -1,    65,
2031      1,    -1,     3,     4,    -1,    -1,    72,    -1,    -1,    -1,
2032     76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,
2033     86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,
2034     -1,    -1,    -1,    -1,    -1,    -1,   102,   103,   104,   105,
2035     -1,    -1,   108,   109,    45,    46,    -1,    -1,    -1,    50,
2036     -1,     1,    -1,     3,     4,    -1,    -1,    -1,    59,    -1,
2037     -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
2038     -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
2039     -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,
2040     -1,    -1,    93,    -1,    -1,    45,    46,    -1,    -1,    -1,
2041     50,   102,   103,   104,   105,    -1,    -1,   108,   109,    59,
2042     -1,    -1,    -1,    -1,    -1,    65,     1,    -1,     3,     4,
2043     -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,
2044     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,
2045     90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,
2046     -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,   109,
2047     45,    46,    -1,    -1,    -1,    50,    -1,     1,    -1,     3,
2048      4,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,
2049     65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
2050     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
2051     85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,
2052     -1,    45,    46,    -1,    -1,    -1,    50,   102,   103,   104,
2053    105,    -1,    -1,   108,   109,    59,    -1,    -1,    -1,    -1,
2054     -1,    65,     1,    -1,     3,     4,    -1,    -1,    72,    -1,
2055     -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
2056     -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,
2057     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   102,   103,
2058    104,   105,    -1,    -1,   108,   109,    45,    46,    -1,    -1,
2059     -1,    50,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,
2060     59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
2061     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,
2062     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
2063     89,    90,    -1,    -1,    93,    -1,    -1,    45,    46,    -1,
2064     -1,    -1,    50,   102,   103,   104,   105,    -1,    -1,   108,
2065    109,    59,    -1,    -1,    -1,    -1,    -1,    65,     1,    -1,
2066      3,     4,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,
2067     -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,
2068     -1,    89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,
2069     -1,    -1,    -1,    -1,   102,   103,   104,   105,    -1,    -1,
2070    108,   109,    45,    46,    -1,    -1,    -1,    50,    -1,     1,
2071     -1,     3,     4,    -1,    -1,    -1,    59,    -1,    -1,    -1,
2072     -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,    -1,    72,
2073     -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,
2074     -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,
2075     93,    -1,    -1,    45,    46,    -1,    -1,    -1,    50,   102,
2076    103,   104,   105,    -1,    -1,   108,   109,    59,    -1,    -1,
2077     -1,    -1,    -1,    65,     1,    -1,     3,     4,    -1,    -1,
2078     72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
2079     82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,
2080     -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2081    102,   103,   104,   105,    -1,    -1,   108,   109,    45,    46,
2082     -1,    -1,    -1,    50,    -1,     1,    -1,     3,     4,    -1,
2083     -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,
2084     -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,
2085     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
2086     -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,    45,
2087     46,    -1,    -1,    -1,    50,   102,   103,   104,   105,    -1,
2088     -1,   108,   109,    59,    -1,    -1,    -1,    -1,    -1,    65,
2089      1,    -1,     3,     4,    -1,    -1,    72,    -1,    -1,    -1,
2090     76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,
2091     86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,
2092     -1,    -1,    -1,    -1,    -1,    -1,   102,   103,   104,   105,
2093     -1,    -1,   108,   109,    45,    46,    -1,    -1,    -1,    50,
2094     -1,     1,    -1,     3,     4,    -1,    -1,    -1,    59,    -1,
2095     -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
2096     -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
2097     -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,
2098     -1,    -1,    93,    -1,    -1,    45,    46,    -1,    -1,    -1,
2099     50,   102,   103,   104,   105,    -1,    -1,   108,   109,    59,
2100     -1,    -1,    -1,    -1,    -1,    65,     1,    -1,     3,     4,
2101     -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,
2102     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,
2103     90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,
2104     -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,   109,
2105     45,    46,    -1,    -1,    -1,    50,    -1,     1,    -1,     3,
2106      4,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,
2107     65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
2108     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
2109     85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,
2110     -1,    45,    46,    -1,    -1,    -1,    50,   102,   103,   104,
2111    105,    -1,    -1,   108,   109,    59,    -1,    -1,    -1,    -1,
2112     -1,    65,     1,    -1,     3,     4,    -1,    -1,    72,    -1,
2113     -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
2114     -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,
2115     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   102,   103,
2116    104,   105,    -1,    -1,   108,   109,    45,    46,    -1,    -1,
2117     -1,    50,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,
2118     59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
2119     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,
2120     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
2121     89,    90,    -1,    -1,    93,    -1,    -1,    45,    46,    -1,
2122     -1,    -1,    50,   102,   103,   104,   105,    -1,    -1,   108,
2123    109,    59,    -1,    -1,    -1,    -1,    -1,    65,     1,    -1,
2124      3,     4,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,
2125     -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,
2126     -1,    89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,
2127     -1,    -1,    -1,    -1,   102,   103,   104,   105,    -1,    -1,
2128    108,   109,    45,    46,    -1,    -1,    -1,    50,    -1,     1,
2129     -1,     3,     4,    -1,    -1,    -1,    59,    -1,    -1,    -1,
2130     -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,    -1,    72,
2131     -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,
2132     -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,
2133     93,    -1,    -1,    45,    46,    -1,    -1,    -1,    50,   102,
2134    103,   104,   105,    -1,    -1,   108,   109,    59,    -1,    -1,
2135     -1,    -1,    -1,    65,     1,    -1,     3,     4,    -1,    -1,
2136     72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
2137     82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,
2138     -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2139    102,   103,   104,   105,    -1,    -1,   108,   109,    45,    46,
2140     -1,    -1,    -1,    50,    -1,     1,    -1,     3,     4,    -1,
2141     -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,
2142     -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,
2143     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
2144     -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,    45,
2145     46,    -1,    -1,    -1,    50,   102,   103,   104,   105,    -1,
2146     -1,   108,   109,    59,    -1,    -1,    -1,    -1,    -1,    65,
2147      1,    -1,     3,     4,    -1,    -1,    72,    -1,    -1,    -1,
2148     76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,
2149     86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,
2150     -1,    -1,    -1,    -1,    -1,    -1,   102,   103,   104,   105,
2151     -1,    -1,   108,   109,    45,    46,    -1,    -1,    -1,    50,
2152     -1,     1,    -1,     3,     4,    -1,    -1,    -1,    59,    -1,
2153     -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
2154     -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
2155     -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,
2156     -1,    -1,    93,    -1,    -1,    45,    46,    -1,    -1,    -1,
2157     50,   102,   103,   104,   105,    -1,    -1,   108,   109,    59,
2158     -1,    -1,    -1,    -1,    -1,    65,     1,    -1,     3,     4,
2159     -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,
2160     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,
2161     90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,
2162     -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,   109,
2163     45,    46,    -1,    -1,    -1,    50,    -1,     1,    -1,     3,
2164      4,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,
2165     65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
2166     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
2167     85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,
2168     -1,    45,    46,    -1,    -1,    -1,    50,   102,   103,   104,
2169    105,    -1,    -1,   108,   109,    59,    -1,    -1,    -1,    -1,
2170     -1,    65,     1,    -1,     3,     4,    -1,    -1,    72,    -1,
2171     -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
2172     -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,
2173     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   102,   103,
2174    104,   105,    -1,    -1,   108,   109,    45,    46,    -1,    -1,
2175     -1,    50,    -1,     1,    -1,     3,     4,    -1,    -1,    -1,
2176     59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
2177     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,
2178     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
2179     89,    90,    -1,    -1,    93,    -1,    -1,    45,    46,    -1,
2180     -1,    -1,    50,   102,   103,   104,   105,    -1,    -1,   108,
2181    109,    59,    -1,    -1,    -1,    -1,    -1,    65,     1,    -1,
2182      3,     4,    -1,    -1,    72,    -1,    -1,    -1,    76,    -1,
2183     -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,
2184     -1,    89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,
2185     -1,    -1,    -1,    -1,   102,   103,   104,   105,    -1,    -1,
2186    108,   109,    45,    46,    -1,    -1,    -1,    50,    -1,     1,
2187     -1,     3,     4,    -1,    -1,    -1,    59,    -1,    -1,    -1,
2188     -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,    -1,    72,
2189     -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,
2190     -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,
2191     93,    -1,    -1,    45,    46,    -1,    -1,    -1,    50,   102,
2192    103,   104,   105,    -1,    -1,   108,   109,    59,    -1,    -1,
2193     -1,    -1,    -1,    65,     1,    -1,     3,     4,    -1,    -1,
2194     72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
2195     82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,
2196     -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
2197    102,   103,   104,   105,    -1,    -1,   108,   109,    45,    46,
2198     -1,    -1,    -1,    50,    -1,     1,    -1,     3,     4,    -1,
2199     -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,
2200     -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,
2201     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
2202     -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,    45,
2203     46,    -1,    -1,    -1,    50,   102,   103,   104,   105,    -1,
2204     -1,   108,   109,    59,    -1,    -1,    -1,    -1,    -1,    65,
2205      1,    -1,     3,     4,    -1,    -1,    72,    -1,    -1,    -1,
2206     76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,
2207     86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,    -1,
2208     -1,    -1,    -1,    -1,    -1,    -1,   102,   103,   104,   105,
2209     -1,    -1,   108,   109,    45,    46,    -1,    -1,    -1,    50,
2210     -1,     1,    -1,     3,     4,    -1,    -1,    -1,    59,    -1,
2211     -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
2212     -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
2213     -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,
2214     -1,    -1,    93,    -1,    -1,    45,    46,    -1,    -1,    -1,
2215     50,   102,   103,   104,   105,    -1,    -1,   108,   109,    59,
2216     -1,    -1,    -1,    -1,    -1,    65,     1,    -1,     3,     4,
2217     -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,
2218     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,
2219     90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    -1,    -1,
2220     -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,   109,
2221     45,    46,    -1,    -1,    -1,    50,    -1,     1,    -1,     3,
2222      4,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,
2223     65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
2224     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
2225     85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,
2226     -1,    45,    46,    -1,    -1,    -1,    50,   102,   103,   104,
2227    105,    -1,    -1,   108,   109,    59,    -1,    -1,    -1,    -1,
2228     -1,    65,     1,    -1,     3,     4,    -1,    -1,    72,    -1,
2229     -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
2230     -1,    85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,
2231     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   102,   103,
2232    104,   105,    -1,    -1,   108,   109,    45,    46,    -1,    -1,
2233     -1,    50,    -1,     1,    -1,    -1,    -1,    -1,    -1,    -1,
2234     59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
2235     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,     1,    -1,
2236     -1,    -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,
2237     89,    90,    -1,    -1,    93,    -1,    -1,    45,    46,    -1,
2238     -1,    -1,    50,   102,   103,   104,   105,    -1,    -1,   108,
2239    109,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,
2240     -1,    -1,    45,    46,    72,    -1,    -1,    50,    76,    -1,
2241     -1,     3,     4,    -1,    82,    -1,    59,    85,    86,    -1,
2242     -1,    -1,    65,    -1,    -1,    93,    94,    -1,    -1,    72,
2243     -1,    -1,    -1,    76,   102,   103,   104,   105,    -1,    82,
2244    108,   109,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,
2245     93,    94,    -1,    45,    46,    -1,    -1,    -1,    50,   102,
2246    103,   104,   105,    -1,    -1,   108,   109,    59,    -1,    -1,
2247     -1,    -1,    -1,    65,    -1,    -1,     3,     4,    -1,    -1,
2248     72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,    -1,
2249     82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,    -1,
2250     -1,    93,    -1,    95,    96,    -1,    -1,    -1,    -1,    -1,
2251    102,   103,   104,   105,    -1,    -1,   108,   109,    45,    46,
2252     -1,    -1,    -1,    50,    -1,    -1,    -1,     3,     4,    -1,
2253     -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    65,    -1,
2254     -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,    -1,    76,
2255     -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,    86,
2256     -1,    -1,    89,    90,    -1,    -1,    93,    94,    -1,    45,
2257     46,    -1,    -1,    -1,    50,   102,   103,   104,   105,    -1,
2258     -1,   108,   109,    59,    -1,    -1,    -1,    -1,    -1,    65,
2259     -1,    -1,     3,     4,    -1,    -1,    72,    -1,    -1,    -1,
2260     76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,    85,
2261     86,    -1,    -1,    89,    90,    -1,    -1,    93,    94,    -1,
2262     -1,    -1,    -1,    -1,    -1,    -1,   102,   103,   104,   105,
2263     -1,    -1,   108,   109,    45,    46,    -1,    -1,    -1,    50,
2264     -1,    -1,    -1,     3,     4,    -1,    -1,    -1,    59,    -1,
2265     -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
2266     -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,    -1,
2267     -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,    90,
2268     -1,    -1,    93,    94,    -1,    45,    46,    -1,    -1,    -1,
2269     50,   102,   103,   104,   105,    -1,    -1,   108,   109,    59,
2270     -1,    -1,    -1,    -1,    -1,    65,    -1,    -1,     3,     4,
2271     -1,    -1,    72,    -1,    -1,    -1,    76,    -1,    -1,    -1,
2272     -1,    -1,    82,    -1,    -1,    85,    86,    -1,    -1,    89,
2273     90,    -1,    -1,    93,    94,    -1,    -1,    -1,    -1,    -1,
2274     -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,   109,
2275     45,    46,    -1,    -1,    -1,    50,    -1,    -1,    -1,    -1,
2276     -1,    -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,
2277     65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
2278     -1,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,    -1,
2279     85,    86,    -1,    -1,    89,    90,    -1,    -1,    93,    -1,
2280     44,    45,    46,    -1,    -1,    -1,    50,   102,   103,   104,
2281    105,    -1,    -1,   108,   109,    59,    -1,    -1,    -1,    -1,
2282     -1,    65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,
2283     -1,    50,    76,    -1,    -1,    -1,    -1,    -1,    82,    -1,
2284     59,    85,    86,    -1,    -1,    -1,    65,    -1,    -1,    93,
2285     -1,    -1,    -1,    72,    -1,    -1,    -1,    76,   102,   103,
2286    104,   105,    -1,    82,   108,   109,    85,    86,    -1,    -1,
2287     89,    90,    -1,    -1,    93,    -1,    -1,    -1,    -1,    -1,
2288     -1,    -1,    -1,   102,   103,   104,   105,    -1,    -1,   108,
2289    109
2290 };
2291 #define YYPURE 1
2292
2293 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
2294 #line 3 "/usr/lib/bison.simple"
2295 /* This file comes from bison-1.28.  */
2296
2297 /* Skeleton output parser for bison,
2298    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2299
2300    This program is free software; you can redistribute it and/or modify
2301    it under the terms of the GNU General Public License as published by
2302    the Free Software Foundation; either version 2, or (at your option)
2303    any later version.
2304
2305    This program is distributed in the hope that it will be useful,
2306    but WITHOUT ANY WARRANTY; without even the implied warranty of
2307    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2308    GNU General Public License for more details.
2309
2310    You should have received a copy of the GNU General Public License
2311    along with this program; if not, write to the Free Software
2312    Foundation, Inc., 59 Temple Place - Suite 330,
2313    Boston, MA 02111-1307, USA.  */
2314
2315 /* As a special exception, when this file is copied by Bison into a
2316    Bison output file, you may use that output file without restriction.
2317    This special exception was added by the Free Software Foundation
2318    in version 1.24 of Bison.  */
2319
2320 /* This is the parser code that is written into each bison parser
2321   when the %semantic_parser declaration is not specified in the grammar.
2322   It was written by Richard Stallman by simplifying the hairy parser
2323   used when %semantic_parser is specified.  */
2324
2325 #ifndef YYSTACK_USE_ALLOCA
2326 #ifdef alloca
2327 #define YYSTACK_USE_ALLOCA
2328 #else /* alloca not defined */
2329 #ifdef __GNUC__
2330 #define YYSTACK_USE_ALLOCA
2331 #define alloca __builtin_alloca
2332 #else /* not GNU C.  */
2333 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
2334 #define YYSTACK_USE_ALLOCA
2335 #include <alloca.h>
2336 #else /* not sparc */
2337 /* We think this test detects Watcom and Microsoft C.  */
2338 /* This used to test MSDOS, but that is a bad idea
2339    since that symbol is in the user namespace.  */
2340 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
2341 #if 0 /* No need for malloc.h, which pollutes the namespace;
2342          instead, just don't use alloca.  */
2343 #include <malloc.h>
2344 #endif
2345 #else /* not MSDOS, or __TURBOC__ */
2346 #if defined(_AIX)
2347 /* I don't know what this was needed for, but it pollutes the namespace.
2348    So I turned it off.   rms, 2 May 1997.  */
2349 /* #include <malloc.h>  */
2350  #pragma alloca
2351 #define YYSTACK_USE_ALLOCA
2352 #else /* not MSDOS, or __TURBOC__, or _AIX */
2353 #if 0
2354 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
2355                  and on HPUX 10.  Eventually we can turn this on.  */
2356 #define YYSTACK_USE_ALLOCA
2357 #define alloca __builtin_alloca
2358 #endif /* __hpux */
2359 #endif
2360 #endif /* not _AIX */
2361 #endif /* not MSDOS, or __TURBOC__ */
2362 #endif /* not sparc */
2363 #endif /* not GNU C */
2364 #endif /* alloca not defined */
2365 #endif /* YYSTACK_USE_ALLOCA not defined */
2366
2367 #ifdef YYSTACK_USE_ALLOCA
2368 #define YYSTACK_ALLOC alloca
2369 #else
2370 #define YYSTACK_ALLOC malloc
2371 #endif
2372
2373 /* Note: there must be only one dollar sign in this file.
2374    It is replaced by the list of actions, each action
2375    as one case of the switch.  */
2376
2377 #define yyerrok         (yyerrstatus = 0)
2378 #define yyclearin       (yychar = YYEMPTY)
2379 #define YYEMPTY         -2
2380 #define YYEOF           0
2381 #define YYACCEPT        goto yyacceptlab
2382 #define YYABORT         goto yyabortlab
2383 #define YYERROR         goto yyerrlab1
2384 /* Like YYERROR except do call yyerror.
2385    This remains here temporarily to ease the
2386    transition to the new meaning of YYERROR, for GCC.
2387    Once GCC version 2 has supplanted version 1, this can go.  */
2388 #define YYFAIL          goto yyerrlab
2389 #define YYRECOVERING()  (!!yyerrstatus)
2390 #define YYBACKUP(token, value) \
2391 do                                                              \
2392   if (yychar == YYEMPTY && yylen == 1)                          \
2393     { yychar = (token), yylval = (value);                       \
2394       yychar1 = YYTRANSLATE (yychar);                           \
2395       YYPOPSTACK;                                               \
2396       goto yybackup;                                            \
2397     }                                                           \
2398   else                                                          \
2399     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
2400 while (0)
2401
2402 #define YYTERROR        1
2403 #define YYERRCODE       256
2404
2405 #ifndef YYPURE
2406 #define YYLEX           yylex()
2407 #endif
2408
2409 #ifdef YYPURE
2410 #ifdef YYLSP_NEEDED
2411 #ifdef YYLEX_PARAM
2412 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
2413 #else
2414 #define YYLEX           yylex(&yylval, &yylloc)
2415 #endif
2416 #else /* not YYLSP_NEEDED */
2417 #ifdef YYLEX_PARAM
2418 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
2419 #else
2420 #define YYLEX           yylex(&yylval)
2421 #endif
2422 #endif /* not YYLSP_NEEDED */
2423 #endif
2424
2425 /* If nonreentrant, generate the variables here */
2426
2427 #ifndef YYPURE
2428
2429 int     yychar;                 /*  the lookahead symbol                */
2430 YYSTYPE yylval;                 /*  the semantic value of the           */
2431                                 /*  lookahead symbol                    */
2432
2433 #ifdef YYLSP_NEEDED
2434 YYLTYPE yylloc;                 /*  location data for the lookahead     */
2435                                 /*  symbol                              */
2436 #endif
2437
2438 int yynerrs;                    /*  number of parse errors so far       */
2439 #endif  /* not YYPURE */
2440
2441 #if YYDEBUG != 0
2442 int yydebug;                    /*  nonzero means print parse trace     */
2443 /* Since this is uninitialized, it does not stop multiple parsers
2444    from coexisting.  */
2445 #endif
2446
2447 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
2448
2449 #ifndef YYINITDEPTH
2450 #define YYINITDEPTH 200
2451 #endif
2452
2453 /*  YYMAXDEPTH is the maximum size the stacks can grow to
2454     (effective only if the built-in stack extension method is used).  */
2455
2456 #if YYMAXDEPTH == 0
2457 #undef YYMAXDEPTH
2458 #endif
2459
2460 #ifndef YYMAXDEPTH
2461 #define YYMAXDEPTH 10000
2462 #endif
2463 \f
2464 /* Define __yy_memcpy.  Note that the size argument
2465    should be passed with type unsigned int, because that is what the non-GCC
2466    definitions require.  With GCC, __builtin_memcpy takes an arg
2467    of type size_t, but it can handle unsigned int.  */
2468
2469 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
2470 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
2471 #else                           /* not GNU C or C++ */
2472 #ifndef __cplusplus
2473
2474 /* This is the most reliable way to avoid incompatibilities
2475    in available built-in functions on various systems.  */
2476 static void
2477 __yy_memcpy (to, from, count)
2478      char *to;
2479      char *from;
2480      unsigned int count;
2481 {
2482   register char *f = from;
2483   register char *t = to;
2484   register int i = count;
2485
2486   while (i-- > 0)
2487     *t++ = *f++;
2488 }
2489
2490 #else /* __cplusplus */
2491
2492 /* This is the most reliable way to avoid incompatibilities
2493    in available built-in functions on various systems.  */
2494 static void
2495 __yy_memcpy (char *to, char *from, unsigned int count)
2496 {
2497   register char *t = to;
2498   register char *f = from;
2499   register int i = count;
2500
2501   while (i-- > 0)
2502     *t++ = *f++;
2503 }
2504
2505 #endif
2506 #endif
2507 \f
2508 #line 217 "/usr/lib/bison.simple"
2509
2510 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2511    into yyparse.  The argument should have type void *.
2512    It should actually point to an object.
2513    Grammar actions can access the variable by casting it
2514    to the proper pointer type.  */
2515
2516 #ifdef YYPARSE_PARAM
2517 #ifdef __cplusplus
2518 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2519 #define YYPARSE_PARAM_DECL
2520 #else /* not __cplusplus */
2521 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2522 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2523 #endif /* not __cplusplus */
2524 #else /* not YYPARSE_PARAM */
2525 #define YYPARSE_PARAM_ARG
2526 #define YYPARSE_PARAM_DECL
2527 #endif /* not YYPARSE_PARAM */
2528
2529 /* Prevent warning if -Wstrict-prototypes.  */
2530 #ifdef __GNUC__
2531 #ifdef YYPARSE_PARAM
2532 int yyparse (void *);
2533 #else
2534 int yyparse (void);
2535 #endif
2536 #endif
2537
2538 int
2539 yyparse(YYPARSE_PARAM_ARG)
2540      YYPARSE_PARAM_DECL
2541 {
2542   register int yystate;
2543   register int yyn;
2544   register short *yyssp;
2545   register YYSTYPE *yyvsp;
2546   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
2547   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
2548
2549   short yyssa[YYINITDEPTH];     /*  the state stack                     */
2550   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
2551
2552   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
2553   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
2554
2555 #ifdef YYLSP_NEEDED
2556   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
2557   YYLTYPE *yyls = yylsa;
2558   YYLTYPE *yylsp;
2559
2560 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
2561 #else
2562 #define YYPOPSTACK   (yyvsp--, yyssp--)
2563 #endif
2564
2565   int yystacksize = YYINITDEPTH;
2566   int yyfree_stacks = 0;
2567
2568 #ifdef YYPURE
2569   int yychar;
2570   YYSTYPE yylval;
2571   int yynerrs;
2572 #ifdef YYLSP_NEEDED
2573   YYLTYPE yylloc;
2574 #endif
2575 #endif
2576
2577   YYSTYPE yyval;                /*  the variable used to return         */
2578                                 /*  semantic values from the action     */
2579                                 /*  routines                            */
2580
2581   int yylen;
2582
2583 #if YYDEBUG != 0
2584   if (yydebug)
2585     fprintf(stderr, "Starting parse\n");
2586 #endif
2587
2588   yystate = 0;
2589   yyerrstatus = 0;
2590   yynerrs = 0;
2591   yychar = YYEMPTY;             /* Cause a token to be read.  */
2592
2593   /* Initialize stack pointers.
2594      Waste one element of value and location stack
2595      so that they stay on the same level as the state stack.
2596      The wasted elements are never initialized.  */
2597
2598   yyssp = yyss - 1;
2599   yyvsp = yyvs;
2600 #ifdef YYLSP_NEEDED
2601   yylsp = yyls;
2602 #endif
2603
2604 /* Push a new state, which is found in  yystate  .  */
2605 /* In all cases, when you get here, the value and location stacks
2606    have just been pushed. so pushing a state here evens the stacks.  */
2607 yynewstate:
2608
2609   *++yyssp = yystate;
2610
2611   if (yyssp >= yyss + yystacksize - 1)
2612     {
2613       /* Give user a chance to reallocate the stack */
2614       /* Use copies of these so that the &'s don't force the real ones into memory. */
2615       YYSTYPE *yyvs1 = yyvs;
2616       short *yyss1 = yyss;
2617 #ifdef YYLSP_NEEDED
2618       YYLTYPE *yyls1 = yyls;
2619 #endif
2620
2621       /* Get the current used size of the three stacks, in elements.  */
2622       int size = yyssp - yyss + 1;
2623
2624 #ifdef yyoverflow
2625       /* Each stack pointer address is followed by the size of
2626          the data in use in that stack, in bytes.  */
2627 #ifdef YYLSP_NEEDED
2628       /* This used to be a conditional around just the two extra args,
2629          but that might be undefined if yyoverflow is a macro.  */
2630       yyoverflow("parser stack overflow",
2631                  &yyss1, size * sizeof (*yyssp),
2632                  &yyvs1, size * sizeof (*yyvsp),
2633                  &yyls1, size * sizeof (*yylsp),
2634                  &yystacksize);
2635 #else
2636       yyoverflow("parser stack overflow",
2637                  &yyss1, size * sizeof (*yyssp),
2638                  &yyvs1, size * sizeof (*yyvsp),
2639                  &yystacksize);
2640 #endif
2641
2642       yyss = yyss1; yyvs = yyvs1;
2643 #ifdef YYLSP_NEEDED
2644       yyls = yyls1;
2645 #endif
2646 #else /* no yyoverflow */
2647       /* Extend the stack our own way.  */
2648       if (yystacksize >= YYMAXDEPTH)
2649         {
2650           yyerror("parser stack overflow");
2651           if (yyfree_stacks)
2652             {
2653               free (yyss);
2654               free (yyvs);
2655 #ifdef YYLSP_NEEDED
2656               free (yyls);
2657 #endif
2658             }
2659           return 2;
2660         }
2661       yystacksize *= 2;
2662       if (yystacksize > YYMAXDEPTH)
2663         yystacksize = YYMAXDEPTH;
2664 #ifndef YYSTACK_USE_ALLOCA
2665       yyfree_stacks = 1;
2666 #endif
2667       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
2668       __yy_memcpy ((char *)yyss, (char *)yyss1,
2669                    size * (unsigned int) sizeof (*yyssp));
2670       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
2671       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
2672                    size * (unsigned int) sizeof (*yyvsp));
2673 #ifdef YYLSP_NEEDED
2674       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
2675       __yy_memcpy ((char *)yyls, (char *)yyls1,
2676                    size * (unsigned int) sizeof (*yylsp));
2677 #endif
2678 #endif /* no yyoverflow */
2679
2680       yyssp = yyss + size - 1;
2681       yyvsp = yyvs + size - 1;
2682 #ifdef YYLSP_NEEDED
2683       yylsp = yyls + size - 1;
2684 #endif
2685
2686 #if YYDEBUG != 0
2687       if (yydebug)
2688         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2689 #endif
2690
2691       if (yyssp >= yyss + yystacksize - 1)
2692         YYABORT;
2693     }
2694
2695 #if YYDEBUG != 0
2696   if (yydebug)
2697     fprintf(stderr, "Entering state %d\n", yystate);
2698 #endif
2699
2700   goto yybackup;
2701  yybackup:
2702
2703 /* Do appropriate processing given the current state.  */
2704 /* Read a lookahead token if we need one and don't already have one.  */
2705 /* yyresume: */
2706
2707   /* First try to decide what to do without reference to lookahead token.  */
2708
2709   yyn = yypact[yystate];
2710   if (yyn == YYFLAG)
2711     goto yydefault;
2712
2713   /* Not known => get a lookahead token if don't already have one.  */
2714
2715   /* yychar is either YYEMPTY or YYEOF
2716      or a valid token in external form.  */
2717
2718   if (yychar == YYEMPTY)
2719     {
2720 #if YYDEBUG != 0
2721       if (yydebug)
2722         fprintf(stderr, "Reading a token: ");
2723 #endif
2724       yychar = YYLEX;
2725     }
2726
2727   /* Convert token to internal form (in yychar1) for indexing tables with */
2728
2729   if (yychar <= 0)              /* This means end of input. */
2730     {
2731       yychar1 = 0;
2732       yychar = YYEOF;           /* Don't call YYLEX any more */
2733
2734 #if YYDEBUG != 0
2735       if (yydebug)
2736         fprintf(stderr, "Now at end of input.\n");
2737 #endif
2738     }
2739   else
2740     {
2741       yychar1 = YYTRANSLATE(yychar);
2742
2743 #if YYDEBUG != 0
2744       if (yydebug)
2745         {
2746           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2747           /* Give the individual parser a way to print the precise meaning
2748              of a token, for further debugging info.  */
2749 #ifdef YYPRINT
2750           YYPRINT (stderr, yychar, yylval);
2751 #endif
2752           fprintf (stderr, ")\n");
2753         }
2754 #endif
2755     }
2756
2757   yyn += yychar1;
2758   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2759     goto yydefault;
2760
2761   yyn = yytable[yyn];
2762
2763   /* yyn is what to do for this token type in this state.
2764      Negative => reduce, -yyn is rule number.
2765      Positive => shift, yyn is new state.
2766        New state is final state => don't bother to shift,
2767        just return success.
2768      0, or most negative number => error.  */
2769
2770   if (yyn < 0)
2771     {
2772       if (yyn == YYFLAG)
2773         goto yyerrlab;
2774       yyn = -yyn;
2775       goto yyreduce;
2776     }
2777   else if (yyn == 0)
2778     goto yyerrlab;
2779
2780   if (yyn == YYFINAL)
2781     YYACCEPT;
2782
2783   /* Shift the lookahead token.  */
2784
2785 #if YYDEBUG != 0
2786   if (yydebug)
2787     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2788 #endif
2789
2790   /* Discard the token being shifted unless it is eof.  */
2791   if (yychar != YYEOF)
2792     yychar = YYEMPTY;
2793
2794   *++yyvsp = yylval;
2795 #ifdef YYLSP_NEEDED
2796   *++yylsp = yylloc;
2797 #endif
2798
2799   /* count tokens shifted since error; after three, turn off error status.  */
2800   if (yyerrstatus) yyerrstatus--;
2801
2802   yystate = yyn;
2803   goto yynewstate;
2804
2805 /* Do the default action for the current state.  */
2806 yydefault:
2807
2808   yyn = yydefact[yystate];
2809   if (yyn == 0)
2810     goto yyerrlab;
2811
2812 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
2813 yyreduce:
2814   yylen = yyr2[yyn];
2815   if (yylen > 0)
2816     yyval = yyvsp[1-yylen]; /* implement default value of the action */
2817
2818 #if YYDEBUG != 0
2819   if (yydebug)
2820     {
2821       int i;
2822
2823       fprintf (stderr, "Reducing via rule %d (line %d), ",
2824                yyn, yyrline[yyn]);
2825
2826       /* Print the symbols being reduced, and their result.  */
2827       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2828         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2829       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2830     }
2831 #endif
2832
2833
2834   switch (yyn) {
2835
2836 case 1:
2837 #line 502 "./parse.y"
2838 {;
2839     break;}
2840 case 18:
2841 #line 546 "./parse.y"
2842
2843                   yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2844                   CLASS_LOADED_P (yyval.node) = 1;
2845                 ;
2846     break;}
2847 case 19:
2848 #line 551 "./parse.y"
2849 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2850     break;}
2851 case 20:
2852 #line 553 "./parse.y"
2853 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2854     break;}
2855 case 21:
2856 #line 555 "./parse.y"
2857 {RULE ("']' expected"); RECOVER;;
2858     break;}
2859 case 22:
2860 #line 557 "./parse.y"
2861 {RULE ("']' expected"); RECOVER;;
2862     break;}
2863 case 26:
2864 #line 572 "./parse.y"
2865 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2866     break;}
2867 case 28:
2868 #line 581 "./parse.y"
2869 {yyval.node = NULL;;
2870     break;}
2871 case 36:
2872 #line 593 "./parse.y"
2873 {
2874                   yyval.node = NULL;
2875                 ;
2876     break;}
2877 case 37:
2878 #line 597 "./parse.y"
2879 {
2880                   yyval.node = NULL;
2881                 ;
2882     break;}
2883 case 40:
2884 #line 609 "./parse.y"
2885
2886                   ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node);
2887                   package_list = tree_cons (ctxp->package, NULL, package_list);
2888                 ;
2889     break;}
2890 case 41:
2891 #line 614 "./parse.y"
2892 {yyerror ("Missing name"); RECOVER;;
2893     break;}
2894 case 42:
2895 #line 616 "./parse.y"
2896 {yyerror ("';' expected"); RECOVER;;
2897     break;}
2898 case 45:
2899 #line 626 "./parse.y"
2900 {
2901                   tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2902                   int   i = IDENTIFIER_LENGTH (name)-1;
2903                   const char *last = &IDENTIFIER_POINTER (name)[i];
2904                   while (last != IDENTIFIER_POINTER (name))
2905                     {
2906                       if (last [0] == '.')
2907                         break;
2908                       last--;
2909                     }
2910                   last_name = get_identifier (++last);
2911                   if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
2912                     {
2913                       tree err = find_name_in_single_imports (last_name);
2914                       if (err && err != name)
2915                         parse_error_context
2916                           (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
2917                            IDENTIFIER_POINTER (name), 
2918                            IDENTIFIER_POINTER (err));
2919                       else
2920                         REGISTER_IMPORT (yyvsp[-1].node, last_name)
2921                     }
2922                   else
2923                     REGISTER_IMPORT (yyvsp[-1].node, last_name);
2924                 ;
2925     break;}
2926 case 46:
2927 #line 652 "./parse.y"
2928 {yyerror ("Missing name"); RECOVER;;
2929     break;}
2930 case 47:
2931 #line 654 "./parse.y"
2932 {yyerror ("';' expected"); RECOVER;;
2933     break;}
2934 case 48:
2935 #line 659 "./parse.y"
2936 {
2937                   tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2938                   /* Don't import java.lang.* twice. */
2939                   if (name != java_lang_id)
2940                     {
2941                       tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2942                       read_import_dir (yyvsp[-3].node);
2943                       TREE_CHAIN (node) = ctxp->import_demand_list;
2944                       ctxp->import_demand_list = node;
2945                     }
2946                 ;
2947     break;}
2948 case 49:
2949 #line 671 "./parse.y"
2950 {yyerror ("'*' expected"); RECOVER;;
2951     break;}
2952 case 50:
2953 #line 673 "./parse.y"
2954 {yyerror ("';' expected"); RECOVER;;
2955     break;}
2956 case 51:
2957 #line 678 "./parse.y"
2958 {
2959                   maybe_generate_finit ();
2960                   maybe_generate_clinit ();
2961                   yyval.node = yyvsp[0].node;
2962                 ;
2963     break;}
2964 case 52:
2965 #line 684 "./parse.y"
2966 {
2967                   maybe_generate_clinit ();
2968                   yyval.node = yyvsp[0].node;
2969                 ;
2970     break;}
2971 case 53:
2972 #line 689 "./parse.y"
2973 { yyval.node = NULL; ;
2974     break;}
2975 case 54:
2976 #line 691 "./parse.y"
2977 {
2978                   YYERROR_NOW;
2979                   yyerror ("Class or interface declaration expected");
2980                 ;
2981     break;}
2982 case 55:
2983 #line 702 "./parse.y"
2984 {
2985                   yyval.value = (1 << yyvsp[0].value);
2986                 ;
2987     break;}
2988 case 56:
2989 #line 706 "./parse.y"
2990 {
2991                   int acc = (1 << yyvsp[0].value);
2992                   if (yyval.value & acc)
2993                     parse_error_context 
2994                       (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
2995                        java_accstring_lookup (acc));
2996                   else
2997                     {
2998                       yyval.value |= acc;
2999                     }
3000                 ;
3001     break;}
3002 case 57:
3003 #line 722 "./parse.y"
3004 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3005     break;}
3006 case 58:
3007 #line 724 "./parse.y"
3008
3009                   yyval.node = yyvsp[0].node;
3010                 ;
3011     break;}
3012 case 59:
3013 #line 728 "./parse.y"
3014 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3015     break;}
3016 case 60:
3017 #line 730 "./parse.y"
3018 {       
3019                   yyval.node = yyvsp[0].node;
3020                 ;
3021     break;}
3022 case 61:
3023 #line 734 "./parse.y"
3024 {yyerror ("Missing class name"); RECOVER;;
3025     break;}
3026 case 62:
3027 #line 736 "./parse.y"
3028 {yyerror ("Missing class name"); RECOVER;;
3029     break;}
3030 case 63:
3031 #line 738 "./parse.y"
3032 {
3033                   if (!ctxp->class_err) yyerror ("'{' expected"); 
3034                   DRECOVER(class1);
3035                 ;
3036     break;}
3037 case 64:
3038 #line 743 "./parse.y"
3039 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
3040     break;}
3041 case 65:
3042 #line 747 "./parse.y"
3043 { yyval.node = NULL; ;
3044     break;}
3045 case 66:
3046 #line 749 "./parse.y"
3047 { yyval.node = yyvsp[0].node; ;
3048     break;}
3049 case 67:
3050 #line 751 "./parse.y"
3051 {yyerror ("'{' expected"); ctxp->class_err=1;;
3052     break;}
3053 case 68:
3054 #line 753 "./parse.y"
3055 {yyerror ("Missing super class name"); ctxp->class_err=1;;
3056     break;}
3057 case 69:
3058 #line 757 "./parse.y"
3059 { yyval.node = NULL_TREE; ;
3060     break;}
3061 case 70:
3062 #line 759 "./parse.y"
3063 { yyval.node = yyvsp[0].node; ;
3064     break;}
3065 case 71:
3066 #line 761 "./parse.y"
3067 {
3068                   ctxp->class_err=1;
3069                   yyerror ("Missing interface name"); 
3070                 ;
3071     break;}
3072 case 72:
3073 #line 769 "./parse.y"
3074
3075                   ctxp->interface_number = 1;
3076                   yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3077                 ;
3078     break;}
3079 case 73:
3080 #line 774 "./parse.y"
3081
3082                   ctxp->interface_number++;
3083                   yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3084                 ;
3085     break;}
3086 case 74:
3087 #line 779 "./parse.y"
3088 {yyerror ("Missing interface name"); RECOVER;;
3089     break;}
3090 case 75:
3091 #line 784 "./parse.y"
3092
3093                   /* Store the location of the `}' when doing xrefs */
3094                   if (flag_emit_xref)
3095                     DECL_END_SOURCE_LINE (ctxp->current_parsed_class) = 
3096                       EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3097                   yyval.node = ctxp->current_parsed_class;
3098                 ;
3099     break;}
3100 case 76:
3101 #line 792 "./parse.y"
3102
3103                   /* Store the location of the `}' when doing xrefs */
3104                   if (flag_emit_xref)
3105                     DECL_END_SOURCE_LINE (ctxp->current_parsed_class) = 
3106                       EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3107                   yyval.node = ctxp->current_parsed_class;
3108                 ;
3109     break;}
3110 case 82:
3111 #line 811 "./parse.y"
3112 { yyval.node = parse_jdk1_1_error ("instance initializer"); ;
3113     break;}
3114 case 84:
3115 #line 817 "./parse.y"
3116 { yyval.node = yyvsp[-1].node; ;
3117     break;}
3118 case 86:
3119 #line 820 "./parse.y"
3120 { yyval.node = parse_jdk1_1_error ("inner classe declaration"); ;
3121     break;}
3122 case 87:
3123 #line 822 "./parse.y"
3124 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3125     break;}
3126 case 88:
3127 #line 828 "./parse.y"
3128 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
3129     break;}
3130 case 89:
3131 #line 830 "./parse.y"
3132 {
3133                   check_modifiers 
3134                     ("Illegal modifier `%s' for field declaration",
3135                      yyvsp[-3].value, FIELD_MODIFIERS);
3136                   check_modifiers_consistency (yyvsp[-3].value);
3137                   register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
3138                 ;
3139     break;}
3140 case 91:
3141 #line 843 "./parse.y"
3142 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
3143     break;}
3144 case 92:
3145 #line 845 "./parse.y"
3146 {yyerror ("Missing term"); RECOVER;;
3147     break;}
3148 case 93:
3149 #line 850 "./parse.y"
3150 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
3151     break;}
3152 case 94:
3153 #line 852 "./parse.y"
3154
3155                   if (java_error_count)
3156                     yyvsp[0].node = NULL_TREE;
3157                   yyval.node = build_tree_list 
3158                     (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
3159                 ;
3160     break;}
3161 case 95:
3162 #line 859 "./parse.y"
3163 {
3164                   yyerror ("Missing variable initializer");
3165                   yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
3166                   RECOVER;
3167                 ;
3168     break;}
3169 case 96:
3170 #line 865 "./parse.y"
3171 {
3172                   yyerror ("';' expected");
3173                   yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
3174                   RECOVER;
3175                 ;
3176     break;}
3177 case 98:
3178 #line 875 "./parse.y"
3179 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
3180     break;}
3181 case 99:
3182 #line 877 "./parse.y"
3183 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
3184     break;}
3185 case 100:
3186 #line 879 "./parse.y"
3187 {yyerror ("']' expected"); DRECOVER(vdi);;
3188     break;}
3189 case 101:
3190 #line 881 "./parse.y"
3191 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
3192     break;}
3193 case 104:
3194 #line 892 "./parse.y"
3195 {
3196                   current_function_decl = yyvsp[0].node;
3197                   source_start_java_method (current_function_decl);
3198                 ;
3199     break;}
3200 case 105:
3201 #line 897 "./parse.y"
3202 { finish_method_declaration (yyvsp[0].node); ;
3203     break;}
3204 case 106:
3205 #line 899 "./parse.y"
3206 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
3207     break;}
3208 case 107:
3209 #line 904 "./parse.y"
3210 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3211     break;}
3212 case 108:
3213 #line 906 "./parse.y"
3214 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3215     break;}
3216 case 109:
3217 #line 908 "./parse.y"
3218 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
3219     break;}
3220 case 110:
3221 #line 910 "./parse.y"
3222 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, yyvsp[0].node); ;
3223     break;}
3224 case 111:
3225 #line 912 "./parse.y"
3226 {
3227                   yyerror ("Invalid method declaration, method name required");
3228                   RECOVER;
3229                 ;
3230     break;}
3231 case 112:
3232 #line 917 "./parse.y"
3233 {RECOVER;;
3234     break;}
3235 case 113:
3236 #line 919 "./parse.y"
3237 {yyerror ("Identifier expected"); RECOVER;;
3238     break;}
3239 case 114:
3240 #line 921 "./parse.y"
3241 {yyerror ("Identifier expected"); RECOVER;;
3242     break;}
3243 case 115:
3244 #line 923 "./parse.y"
3245 {
3246                   yyerror ("Invalid method declaration, return type required");
3247                   RECOVER;
3248                 ;
3249     break;}
3250 case 116:
3251 #line 931 "./parse.y"
3252 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3253     break;}
3254 case 117:
3255 #line 933 "./parse.y"
3256 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3257     break;}
3258 case 118:
3259 #line 935 "./parse.y"
3260 {
3261                   EXPR_WFL_LINECOL (wfl_operator) = yyvsp[-1].operator.location;
3262                   TREE_PURPOSE (yyvsp[-2].node) = 
3263                     build_unresolved_array_type (TREE_PURPOSE (yyvsp[-2].node));
3264                   parse_warning_context 
3265                     (wfl_operator, 
3266                      "Discouraged form of returned type specification");
3267                 ;
3268     break;}
3269 case 119:
3270 #line 944 "./parse.y"
3271 {yyerror ("')' expected"); DRECOVER(method_declarator);;
3272     break;}
3273 case 120:
3274 #line 946 "./parse.y"
3275 {yyerror ("']' expected"); RECOVER;;
3276     break;}
3277 case 121:
3278 #line 951 "./parse.y"
3279 {
3280                   ctxp->formal_parameter_number = 1;
3281                 ;
3282     break;}
3283 case 122:
3284 #line 955 "./parse.y"
3285 {
3286                   ctxp->formal_parameter_number += 1;
3287                   yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
3288                 ;
3289     break;}
3290 case 123:
3291 #line 960 "./parse.y"
3292 {yyerror ("Missing formal parameter term"); RECOVER;;
3293     break;}
3294 case 124:
3295 #line 965 "./parse.y"
3296 {
3297                   yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3298                 ;
3299     break;}
3300 case 125:
3301 #line 969 "./parse.y"
3302
3303                   parse_jdk1_1_error ("final parameters");
3304                   yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3305                 ;
3306     break;}
3307 case 126:
3308 #line 974 "./parse.y"
3309 {
3310                   yyerror ("Missing identifier"); RECOVER;
3311                   yyval.node = NULL_TREE;
3312                 ;
3313     break;}
3314 case 127:
3315 #line 979 "./parse.y"
3316 {
3317                   yyerror ("Missing identifier"); RECOVER;
3318                   yyval.node = NULL_TREE;
3319                 ;
3320     break;}
3321 case 128:
3322 #line 987 "./parse.y"
3323 {
3324                   check_modifiers ("Illegal modifier `%s'. Only `final' was expected here",
3325                                    yyvsp[0].value, ACC_FINAL);
3326                   if (yyvsp[0].value != ACC_FINAL)
3327                     MODIFIER_WFL (FINAL_TK) = build_wfl_node (NULL_TREE);
3328                 ;
3329     break;}
3330 case 129:
3331 #line 996 "./parse.y"
3332 { yyval.node = NULL_TREE; ;
3333     break;}
3334 case 130:
3335 #line 998 "./parse.y"
3336 { yyval.node = yyvsp[0].node; ;
3337     break;}
3338 case 131:
3339 #line 1000 "./parse.y"
3340 {yyerror ("Missing class type term"); RECOVER;;
3341     break;}
3342 case 132:
3343 #line 1005 "./parse.y"
3344 { yyval.node = build_tree_list (yyvsp[0].node, yyvsp[0].node); ;
3345     break;}
3346 case 133:
3347 #line 1007 "./parse.y"
3348 { yyval.node = tree_cons (yyvsp[0].node, yyvsp[0].node, yyvsp[-2].node); ;
3349     break;}
3350 case 134:
3351 #line 1009 "./parse.y"
3352 {yyerror ("Missing class type term"); RECOVER;;
3353     break;}
3354 case 137:
3355 #line 1016 "./parse.y"
3356 { yyval.node = NULL_TREE; ;
3357     break;}
3358 case 138:
3359 #line 1022 "./parse.y"
3360 {
3361                   TREE_CHAIN (yyvsp[0].node) = ctxp->static_initialized;
3362                   ctxp->static_initialized = yyvsp[0].node;
3363                 ;
3364     break;}
3365 case 139:
3366 #line 1027 "./parse.y"
3367 {
3368                   TREE_CHAIN (yyvsp[-1].node) = ctxp->static_initialized;
3369                   ctxp->static_initialized = yyvsp[-1].node;
3370                 ;
3371     break;}
3372 case 140:
3373 #line 1035 "./parse.y"
3374 {
3375                   SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3376                 ;
3377     break;}
3378 case 141:
3379 #line 1043 "./parse.y"
3380 {
3381                   current_function_decl = yyvsp[0].node;
3382                   source_start_java_method (current_function_decl);
3383                 ;
3384     break;}
3385 case 142:
3386 #line 1048 "./parse.y"
3387 { finish_method_declaration (yyvsp[0].node); ;
3388     break;}
3389 case 143:
3390 #line 1053 "./parse.y"
3391 { yyval.node = method_header (0, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3392     break;}
3393 case 144:
3394 #line 1055 "./parse.y"
3395 { yyval.node = method_header (yyvsp[-2].value, NULL_TREE, yyvsp[-1].node, yyvsp[0].node); ;
3396     break;}
3397 case 145:
3398 #line 1060 "./parse.y"
3399 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
3400     break;}
3401 case 146:
3402 #line 1062 "./parse.y"
3403 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
3404     break;}
3405 case 147:
3406 #line 1070 "./parse.y"
3407
3408                   BLOCK_EXPR_BODY (yyvsp[0].node) = empty_stmt_node;
3409                   yyval.node = yyvsp[0].node;
3410                 ;
3411     break;}
3412 case 148:
3413 #line 1075 "./parse.y"
3414 { yyval.node = yyvsp[0].node; ;
3415     break;}
3416 case 149:
3417 #line 1077 "./parse.y"
3418 { yyval.node = yyvsp[0].node; ;
3419     break;}
3420 case 150:
3421 #line 1079 "./parse.y"
3422 { yyval.node = yyvsp[0].node; ;
3423     break;}
3424 case 153:
3425 #line 1089 "./parse.y"
3426
3427                   yyval.node = build_method_invocation (yyvsp[-3].node, NULL_TREE); 
3428                   yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-3].node), yyval.node);
3429                   yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3430                 ;
3431     break;}
3432 case 154:
3433 #line 1095 "./parse.y"
3434
3435                   yyval.node = build_method_invocation (yyvsp[-4].node, yyvsp[-2].node); 
3436                   yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-4].node), yyval.node);
3437                   yyval.node = java_method_add_stmt (current_function_decl, yyval.node);
3438                 ;
3439     break;}
3440 case 155:
3441 #line 1103 "./parse.y"
3442 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3443     break;}
3444 case 156:
3445 #line 1105 "./parse.y"
3446 {yyval.node = parse_jdk1_1_error ("explicit constructor invocation"); ;
3447     break;}
3448 case 157:
3449 #line 1110 "./parse.y"
3450 {
3451                   tree wfl = build_wfl_node (this_identifier_node);
3452                   EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3453                   yyval.node = wfl;
3454                 ;
3455     break;}
3456 case 158:
3457 #line 1116 "./parse.y"
3458 {
3459                   tree wfl = build_wfl_node (super_identifier_node);
3460                   EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3461                   yyval.node = wfl;
3462                 ;
3463     break;}
3464 case 159:
3465 #line 1127 "./parse.y"
3466 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3467     break;}
3468 case 160:
3469 #line 1129 "./parse.y"
3470 {
3471                   yyval.node = yyvsp[0].node;
3472                 ;
3473     break;}
3474 case 161:
3475 #line 1133 "./parse.y"
3476 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3477     break;}
3478 case 162:
3479 #line 1135 "./parse.y"
3480 {
3481                   yyval.node = yyvsp[0].node;
3482                 ;
3483     break;}
3484 case 163:
3485 #line 1139 "./parse.y"
3486 { create_interface (0, yyvsp[-1].node, yyvsp[0].node);  ;
3487     break;}
3488 case 164:
3489 #line 1141 "./parse.y"
3490 {
3491                   yyval.node = yyvsp[0].node;
3492                 ;
3493     break;}
3494 case 165:
3495 #line 1145 "./parse.y"
3496 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3497     break;}
3498 case 166:
3499 #line 1147 "./parse.y"
3500 {
3501                   yyval.node = yyvsp[0].node;
3502                 ;
3503     break;}
3504 case 167:
3505 #line 1151 "./parse.y"
3506 {yyerror ("'{' expected"); RECOVER;;
3507     break;}
3508 case 168:
3509 #line 1153 "./parse.y"
3510 {yyerror ("'{' expected"); RECOVER;;
3511     break;}
3512 case 169:
3513 #line 1158 "./parse.y"
3514
3515                   ctxp->interface_number = 1;
3516                   yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3517                 ;
3518     break;}
3519 case 170:
3520 #line 1163 "./parse.y"
3521
3522                   ctxp->interface_number++;
3523                   yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3524                 ;
3525     break;}
3526 case 171:
3527 #line 1168 "./parse.y"
3528 {yyerror ("Invalid interface type"); RECOVER;;
3529     break;}
3530 case 172:
3531 #line 1170 "./parse.y"
3532 {yyerror ("Missing term"); RECOVER;;
3533     break;}
3534 case 173:
3535 #line 1175 "./parse.y"
3536 { yyval.node = NULL_TREE; ;
3537     break;}
3538 case 174:
3539 #line 1177 "./parse.y"
3540 { yyval.node = NULL_TREE; ;
3541     break;}
3542 case 179:
3543 #line 1189 "./parse.y"
3544 { yyval.node = parse_jdk1_1_error ("inner class declaration"); ;
3545     break;}
3546 case 180:
3547 #line 1191 "./parse.y"
3548 { yyval.node = parse_jdk1_1_error ("inner interface declaration"); ;
3549     break;}
3550 case 182:
3551 #line 1200 "./parse.y"
3552
3553                   check_abstract_method_header (yyvsp[-1].node);
3554                   current_function_decl = NULL_TREE; /* FIXME ? */
3555                 ;
3556     break;}
3557 case 183:
3558 #line 1205 "./parse.y"
3559 {yyerror ("';' expected"); RECOVER;;
3560     break;}
3561 case 184:
3562 #line 1211 "./parse.y"
3563 { yyval.node = build_new_array_init (yyvsp[-1].operator.location, NULL_TREE); ;
3564     break;}
3565 case 185:
3566 #line 1213 "./parse.y"
3567 { yyval.node = build_new_array_init (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3568     break;}
3569 case 186:
3570 #line 1215 "./parse.y"
3571 { yyval.node = build_new_array_init (yyvsp[-3].operator.location, yyvsp[-2].node); ;
3572     break;}
3573 case 187:
3574 #line 1220 "./parse.y"
3575
3576                   yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), 
3577                                   yyvsp[0].node, NULL_TREE);
3578                 ;
3579     break;}
3580 case 188:
3581 #line 1225 "./parse.y"
3582 {
3583                   yyval.node = tree_cons (maybe_build_array_element_wfl (yyvsp[0].node), yyvsp[0].node, yyvsp[-2].node);
3584                 ;
3585     break;}
3586 case 189:
3587 #line 1229 "./parse.y"
3588 {yyerror ("Missing term"); RECOVER;;
3589     break;}
3590 case 190:
3591 #line 1235 "./parse.y"
3592
3593                   /* Store the location of the `}' when doing xrefs */
3594                   if (current_function_decl && flag_emit_xref)
3595                     DECL_END_SOURCE_LINE (current_function_decl) = 
3596                       EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);
3597                   yyval.node = empty_stmt_node; 
3598                 ;
3599     break;}
3600 case 191:
3601 #line 1243 "./parse.y"
3602 { yyval.node = yyvsp[0].node; ;
3603     break;}
3604 case 192:
3605 #line 1248 "./parse.y"
3606 { enter_block (); ;
3607     break;}
3608 case 193:
3609 #line 1253 "./parse.y"
3610
3611                   maybe_absorb_scoping_blocks ();
3612                   /* Store the location of the `}' when doing xrefs */
3613                   if (current_function_decl && flag_emit_xref)
3614                     DECL_END_SOURCE_LINE (current_function_decl) = 
3615                       EXPR_WFL_ADD_COL (yyvsp[0].operator.location, 1);           
3616                   yyval.node = exit_block ();
3617                 ;
3618     break;}
3619 case 197:
3620 #line 1271 "./parse.y"
3621 { java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3622     break;}
3623 case 198:
3624 #line 1273 "./parse.y"
3625 { parse_jdk1_1_error ("inner class declaration"); ;
3626     break;}
3627 case 200:
3628 #line 1282 "./parse.y"
3629 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3630     break;}
3631 case 201:
3632 #line 1284 "./parse.y"
3633 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3634     break;}
3635 case 207:
3636 #line 1294 "./parse.y"
3637 { yyval.node = exit_block (); ;
3638     break;}
3639 case 212:
3640 #line 1303 "./parse.y"
3641 { yyval.node = exit_block (); ;
3642     break;}
3643 case 224:
3644 #line 1322 "./parse.y"
3645 { yyval.node = empty_stmt_node; ;
3646     break;}
3647 case 225:
3648 #line 1327 "./parse.y"
3649 {
3650                   yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node), 
3651                                             EXPR_WFL_NODE (yyvsp[-1].node));
3652                   pushlevel (2);
3653                   push_labeled_block (yyval.node);
3654                   PUSH_LABELED_BLOCK (yyval.node);
3655                 ;
3656     break;}
3657 case 226:
3658 #line 1338 "./parse.y"
3659 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3660     break;}
3661 case 227:
3662 #line 1340 "./parse.y"
3663 {yyerror ("':' expected"); RECOVER;;
3664     break;}
3665 case 228:
3666 #line 1345 "./parse.y"
3667 { yyval.node = finish_labeled_statement (yyvsp[-1].node, yyvsp[0].node); ;
3668     break;}
3669 case 229:
3670 #line 1352 "./parse.y"
3671 {
3672                   /* We have a statement. Generate a WFL around it so
3673                      we can debug it */
3674                   yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
3675                   /* We know we have a statement, so set the debug
3676                      info to be eventually generate here. */
3677                   yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
3678                 ;
3679     break;}
3680 case 230:
3681 #line 1361 "./parse.y"
3682 {
3683                   if (ctxp->prevent_ese != lineno)
3684                     yyerror ("Invalid expression statement");
3685                   DRECOVER (expr_stmt);
3686                 ;
3687     break;}
3688 case 231:
3689 #line 1367 "./parse.y"
3690 {
3691                   if (ctxp->prevent_ese != lineno)
3692                     yyerror ("Invalid expression statement");
3693                   DRECOVER (expr_stmt);
3694                 ;
3695     break;}
3696 case 232:
3697 #line 1373 "./parse.y"
3698 {
3699                   if (ctxp->prevent_ese != lineno)
3700                     yyerror ("Invalid expression statement");
3701                   DRECOVER (expr_stmt);
3702                 ;
3703     break;}
3704 case 233:
3705 #line 1379 "./parse.y"
3706 {yyerror ("')' expected"); RECOVER;;
3707     break;}
3708 case 234:
3709 #line 1381 "./parse.y"
3710 {
3711                   parse_ctor_invocation_error ();
3712                   RECOVER;
3713                 ;
3714     break;}
3715 case 235:
3716 #line 1386 "./parse.y"
3717 {yyerror ("')' expected"); RECOVER;;
3718     break;}
3719 case 236:
3720 #line 1388 "./parse.y"
3721 {
3722                   parse_ctor_invocation_error ();
3723                   RECOVER;
3724                 ;
3725     break;}
3726 case 237:
3727 #line 1393 "./parse.y"
3728 {yyerror ("'(' expected"); RECOVER;;
3729     break;}
3730 case 238:
3731 #line 1395 "./parse.y"
3732 {yyerror ("')' expected"); RECOVER;;
3733     break;}
3734 case 239:
3735 #line 1397 "./parse.y"
3736 {yyerror ("')' expected"); RECOVER;;
3737     break;}
3738 case 240:
3739 #line 1399 "./parse.y"
3740 {yyerror ("';' expected"); RECOVER;;
3741     break;}
3742 case 241:
3743 #line 1401 "./parse.y"
3744 {yyerror ("';' expected"); RECOVER;;
3745     break;}
3746 case 249:
3747 #line 1416 "./parse.y"
3748
3749                   yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, 
3750                                                 yyvsp[0].node, NULL_TREE);
3751                 ;
3752     break;}
3753 case 250:
3754 #line 1421 "./parse.y"
3755 {yyerror ("'(' expected"); RECOVER;;
3756     break;}
3757 case 251:
3758 #line 1423 "./parse.y"
3759 {yyerror ("Missing term"); RECOVER;;
3760     break;}
3761 case 252:
3762 #line 1425 "./parse.y"
3763 {yyerror ("')' expected"); RECOVER;;
3764     break;}
3765 case 253:
3766 #line 1430 "./parse.y"
3767 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3768     break;}
3769 case 254:
3770 #line 1435 "./parse.y"
3771 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3772     break;}
3773 case 255:
3774 #line 1440 "./parse.y"
3775 {
3776                   enter_block ();
3777                 ;
3778     break;}
3779 case 256:
3780 #line 1444 "./parse.y"
3781
3782                   /* Make into "proper list" of COMPOUND_EXPRs.
3783                      I.e. make the last statment also have its own
3784                      COMPOUND_EXPR. */
3785                   maybe_absorb_scoping_blocks ();
3786                   TREE_OPERAND (yyvsp[-2].node, 1) = exit_block ();
3787                   yyval.node = build_debugable_stmt (EXPR_WFL_LINECOL (yyvsp[-2].node), yyvsp[-2].node);
3788                 ;
3789     break;}
3790 case 257:
3791 #line 1456 "./parse.y"
3792
3793                   yyval.node = build (SWITCH_EXPR, NULL_TREE, yyvsp[-1].node, NULL_TREE);
3794                   EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
3795                 ;
3796     break;}
3797 case 258:
3798 #line 1461 "./parse.y"
3799 {yyerror ("'(' expected"); RECOVER;;
3800     break;}
3801 case 259:
3802 #line 1463 "./parse.y"
3803 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3804     break;}
3805 case 260:
3806 #line 1465 "./parse.y"
3807 {yyerror ("'{' expected"); RECOVER;;
3808     break;}
3809 case 261:
3810 #line 1473 "./parse.y"
3811 { yyval.node = NULL_TREE; ;
3812     break;}
3813 case 262:
3814 #line 1475 "./parse.y"
3815 { yyval.node = NULL_TREE; ;
3816     break;}
3817 case 263:
3818 #line 1477 "./parse.y"
3819 { yyval.node = NULL_TREE; ;
3820     break;}
3821 case 264:
3822 #line 1479 "./parse.y"
3823 { yyval.node = NULL_TREE; ;
3824     break;}
3825 case 270:
3826 #line 1498 "./parse.y"
3827
3828                   tree lab = build1 (CASE_EXPR, NULL_TREE, yyvsp[-1].node);
3829                   EXPR_WFL_LINECOL (lab) = yyvsp[-2].operator.location;
3830                   java_method_add_stmt (current_function_decl, lab);
3831                 ;
3832     break;}
3833 case 271:
3834 #line 1504 "./parse.y"
3835
3836                   tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);
3837                   EXPR_WFL_LINECOL (lab) = yyvsp[-1].operator.location;
3838                   java_method_add_stmt (current_function_decl, lab);
3839                 ;
3840     break;}
3841 case 272:
3842 #line 1510 "./parse.y"
3843 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3844     break;}
3845 case 273:
3846 #line 1512 "./parse.y"
3847 {yyerror ("':' expected"); RECOVER;;
3848     break;}
3849 case 274:
3850 #line 1514 "./parse.y"
3851 {yyerror ("':' expected"); RECOVER;;
3852     break;}
3853 case 275:
3854 #line 1519 "./parse.y"
3855
3856                   tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3857                   yyval.node = build_new_loop (body);
3858                 ;
3859     break;}
3860 case 276:
3861 #line 1527 "./parse.y"
3862 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3863     break;}
3864 case 277:
3865 #line 1529 "./parse.y"
3866 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3867     break;}
3868 case 278:
3869 #line 1531 "./parse.y"
3870 {yyerror ("Missing term and ')' expected"); RECOVER;;
3871     break;}
3872 case 279:
3873 #line 1533 "./parse.y"
3874 {yyerror ("')' expected"); RECOVER;;
3875     break;}
3876 case 280:
3877 #line 1538 "./parse.y"
3878 { yyval.node = finish_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3879     break;}
3880 case 281:
3881 #line 1543 "./parse.y"
3882
3883                   tree body = build_loop_body (0, NULL_TREE, 1);
3884                   yyval.node = build_new_loop (body);
3885                 ;
3886     break;}
3887 case 282:
3888 #line 1552 "./parse.y"
3889 { yyval.node = finish_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3890     break;}
3891 case 283:
3892 #line 1557 "./parse.y"
3893 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3894     break;}
3895 case 284:
3896 #line 1559 "./parse.y"
3897
3898                   yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3899                   /* We have not condition, so we get rid of the EXIT_EXPR */
3900                   LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = 
3901                     empty_stmt_node;
3902                 ;
3903     break;}
3904 case 285:
3905 #line 1566 "./parse.y"
3906 {yyerror ("Invalid control expression"); RECOVER;;
3907     break;}
3908 case 286:
3909 #line 1568 "./parse.y"
3910 {yyerror ("Invalid update expression"); RECOVER;;
3911     break;}
3912 case 287:
3913 #line 1570 "./parse.y"
3914 {yyerror ("Invalid update expression"); RECOVER;;
3915     break;}
3916 case 288:
3917 #line 1575 "./parse.y"
3918 { yyval.node = finish_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3919     break;}
3920 case 289:
3921 #line 1577 "./parse.y"
3922
3923                   yyval.node = finish_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3924                   /* We have not condition, so we get rid of the EXIT_EXPR */
3925                   LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) = 
3926                     empty_stmt_node;
3927                 ;
3928     break;}
3929 case 290:
3930 #line 1587 "./parse.y"
3931
3932                   /* This scope defined for local variable that may be
3933                      defined within the scope of the for loop */
3934                   enter_block (); 
3935                 ;
3936     break;}
3937 case 291:
3938 #line 1593 "./parse.y"
3939 {yyerror ("'(' expected"); DRECOVER(for_1);;
3940     break;}
3941 case 292:
3942 #line 1595 "./parse.y"
3943 {yyerror ("Invalid init statement"); RECOVER;;
3944     break;}
3945 case 293:
3946 #line 1600 "./parse.y"
3947
3948                   /* We now declare the loop body. The loop is
3949                      declared as a for loop. */
3950                   tree body = build_loop_body (0, NULL_TREE, 0);
3951                   yyval.node =  build_new_loop (body);
3952                   IS_FOR_LOOP_P (yyval.node) = 1;
3953                   /* The loop is added to the current block the for
3954                      statement is defined within */
3955                   java_method_add_stmt (current_function_decl, yyval.node);
3956                 ;
3957     break;}
3958 case 294:
3959 #line 1612 "./parse.y"
3960 { yyval.node = empty_stmt_node; ;
3961     break;}
3962 case 295:
3963 #line 1614 "./parse.y"
3964
3965                   /* Init statement recorded within the previously
3966                      defined block scope */
3967                   yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
3968                 ;
3969     break;}
3970 case 296:
3971 #line 1620 "./parse.y"
3972
3973                   /* Local variable are recorded within the previously
3974                      defined block scope */
3975                   yyval.node = NULL_TREE;
3976                 ;
3977     break;}
3978 case 297:
3979 #line 1626 "./parse.y"
3980 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3981     break;}
3982 case 298:
3983 #line 1630 "./parse.y"
3984 {yyval.node = empty_stmt_node;;
3985     break;}
3986 case 299:
3987 #line 1632 "./parse.y"
3988 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3989     break;}
3990 case 300:
3991 #line 1637 "./parse.y"
3992 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3993     break;}
3994 case 301:
3995 #line 1639 "./parse.y"
3996 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3997     break;}
3998 case 302:
3999 #line 1641 "./parse.y"
4000 {yyerror ("Missing term"); RECOVER;;
4001     break;}
4002 case 303:
4003 #line 1646 "./parse.y"
4004 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
4005     break;}
4006 case 304:
4007 #line 1648 "./parse.y"
4008 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
4009     break;}
4010 case 305:
4011 #line 1650 "./parse.y"
4012 {yyerror ("Missing term"); RECOVER;;
4013     break;}
4014 case 306:
4015 #line 1652 "./parse.y"
4016 {yyerror ("';' expected"); RECOVER;;
4017     break;}
4018 case 307:
4019 #line 1657 "./parse.y"
4020 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
4021     break;}
4022 case 308:
4023 #line 1659 "./parse.y"
4024 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
4025     break;}
4026 case 309:
4027 #line 1661 "./parse.y"
4028 {yyerror ("Missing term"); RECOVER;;
4029     break;}
4030 case 310:
4031 #line 1663 "./parse.y"
4032 {yyerror ("';' expected"); RECOVER;;
4033     break;}
4034 case 311:
4035 #line 1668 "./parse.y"
4036 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
4037     break;}
4038 case 312:
4039 #line 1670 "./parse.y"
4040 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
4041     break;}
4042 case 313:
4043 #line 1672 "./parse.y"
4044 {yyerror ("Missing term"); RECOVER;;
4045     break;}
4046 case 314:
4047 #line 1674 "./parse.y"
4048 {yyerror ("';' expected"); RECOVER;;
4049     break;}
4050 case 315:
4051 #line 1679 "./parse.y"
4052
4053                   yyval.node = build1 (THROW_EXPR, NULL_TREE, yyvsp[-1].node);
4054                   EXPR_WFL_LINECOL (yyval.node) = yyvsp[-2].operator.location;
4055                 ;
4056     break;}
4057 case 316:
4058 #line 1684 "./parse.y"
4059 {yyerror ("Missing term"); RECOVER;;
4060     break;}
4061 case 317:
4062 #line 1686 "./parse.y"
4063 {yyerror ("';' expected"); RECOVER;;
4064     break;}
4065 case 318:
4066 #line 1691 "./parse.y"
4067
4068                   yyval.node = build (SYNCHRONIZED_EXPR, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
4069                   EXPR_WFL_LINECOL (yyval.node) = 
4070                     EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));
4071                 ;
4072     break;}
4073 case 319:
4074 #line 1697 "./parse.y"
4075 {yyerror ("'{' expected"); RECOVER;;
4076     break;}
4077 case 320:
4078 #line 1699 "./parse.y"
4079 {yyerror ("'(' expected"); RECOVER;;
4080     break;}
4081 case 321:
4082 #line 1701 "./parse.y"
4083 {yyerror ("Missing term"); RECOVER;;
4084     break;}
4085 case 322:
4086 #line 1703 "./parse.y"
4087 {yyerror ("Missing term"); RECOVER;;
4088     break;}
4089 case 323:
4090 #line 1708 "./parse.y"
4091 {
4092                   check_modifiers (
4093              "Illegal modifier `%s'. Only `synchronized' was expected here",
4094                                    yyvsp[0].value, ACC_SYNCHRONIZED);
4095                   if (yyvsp[0].value != ACC_SYNCHRONIZED)
4096                     MODIFIER_WFL (SYNCHRONIZED_TK) = 
4097                       build_wfl_node (NULL_TREE);
4098                 ;
4099     break;}
4100 case 324:
4101 #line 1720 "./parse.y"
4102 { yyval.node = build_try_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
4103     break;}
4104 case 325:
4105 #line 1722 "./parse.y"
4106 { yyval.node = build_try_finally_statement (yyvsp[-2].operator.location, yyvsp[-1].node, yyvsp[0].node); ;
4107     break;}
4108 case 326:
4109 #line 1724 "./parse.y"
4110 { yyval.node = build_try_finally_statement 
4111                     (yyvsp[-3].operator.location, build_try_statement (yyvsp[-3].operator.location,
4112                                                        yyvsp[-2].node, yyvsp[-1].node), yyvsp[0].node);
4113                 ;
4114     break;}
4115 case 327:
4116 #line 1729 "./parse.y"
4117 {yyerror ("'{' expected"); DRECOVER (try_statement);;
4118     break;}
4119 case 329:
4120 #line 1735 "./parse.y"
4121
4122                   TREE_CHAIN (yyvsp[0].node) = yyvsp[-1].node;
4123                   yyval.node = yyvsp[0].node;
4124                 ;
4125     break;}
4126 case 330:
4127 #line 1743 "./parse.y"
4128
4129                   java_method_add_stmt (current_function_decl, yyvsp[0].node);
4130                   exit_block ();
4131                   yyval.node = yyvsp[-1].node;
4132                 ;
4133     break;}
4134 case 331:
4135 #line 1751 "./parse.y"
4136
4137                   /* We add a block to define a scope for
4138                      formal_parameter (CCBP). The formal parameter is
4139                      declared initialized by the appropriate function
4140                      call */
4141                   tree ccpb = enter_block ();
4142                   tree init = build_assignment (ASSIGN_TK, yyvsp[-2].operator.location, 
4143                                                 TREE_PURPOSE (yyvsp[-1].node), 
4144                                                 soft_exceptioninfo_call_node);
4145                   declare_local_variables (0, TREE_VALUE (yyvsp[-1].node),
4146                                            build_tree_list (TREE_PURPOSE (yyvsp[-1].node),
4147                                                             init));
4148                   yyval.node = build1 (CATCH_EXPR, NULL_TREE, ccpb);
4149                   EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4150                 ;
4151     break;}
4152 case 332:
4153 #line 1767 "./parse.y"
4154 {yyerror ("'(' expected"); RECOVER; yyval.node = NULL_TREE;;
4155     break;}
4156 case 333:
4157 #line 1769 "./parse.y"
4158 {
4159                   yyerror ("Missing term or ')' expected"); 
4160                   RECOVER; yyval.node = NULL_TREE;
4161                 ;
4162     break;}
4163 case 334:
4164 #line 1774 "./parse.y"
4165 {yyerror ("Missing term"); RECOVER; yyval.node = NULL_TREE;;
4166     break;}
4167 case 335:
4168 #line 1779 "./parse.y"
4169 { yyval.node = yyvsp[0].node; ;
4170     break;}
4171 case 336:
4172 #line 1781 "./parse.y"
4173 {yyerror ("'{' expected"); RECOVER; ;
4174     break;}
4175 case 340:
4176 #line 1793 "./parse.y"
4177 { yyval.node = build_this (yyvsp[0].operator.location); ;
4178     break;}
4179 case 341:
4180 #line 1795 "./parse.y"
4181 {yyval.node = yyvsp[-1].node;;
4182     break;}
4183 case 346:
4184 #line 1804 "./parse.y"
4185 { yyval.node = parse_jdk1_1_error ("named class literals"); ;
4186     break;}
4187 case 347:
4188 #line 1806 "./parse.y"
4189 { yyval.node = build_class_ref (yyvsp[-2].node); ;
4190     break;}
4191 case 348:
4192 #line 1808 "./parse.y"
4193 { yyval.node = build_class_ref (void_type_node); ;
4194     break;}
4195 case 349:
4196 #line 1813 "./parse.y"
4197 { yyval.node = parse_jdk1_1_error ("class literals"); ;
4198     break;}
4199 case 350:
4200 #line 1815 "./parse.y"
4201 {yyerror ("')' expected"); RECOVER;;
4202     break;}
4203 case 351:
4204 #line 1817 "./parse.y"
4205 {yyerror ("'class' or 'this' expected" ); RECOVER;;
4206     break;}
4207 case 352:
4208 #line 1819 "./parse.y"
4209 {yyerror ("'class' expected" ); RECOVER;;
4210     break;}
4211 case 353:
4212 #line 1821 "./parse.y"
4213 {yyerror ("'class' expected" ); RECOVER;;
4214     break;}
4215 case 354:
4216 #line 1826 "./parse.y"
4217 { yyval.node = build_new_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4218     break;}
4219 case 355:
4220 #line 1828 "./parse.y"
4221 { yyval.node = build_new_invocation (yyvsp[-2].node, NULL_TREE); ;
4222     break;}
4223 case 356:
4224 #line 1833 "./parse.y"
4225 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4226     break;}
4227 case 357:
4228 #line 1835 "./parse.y"
4229 { yyval.node = parse_jdk1_1_error ("inner class instance creation"); ;
4230     break;}
4231 case 362:
4232 #line 1844 "./parse.y"
4233 {yyerror ("'(' expected"); DRECOVER(new_1);;
4234     break;}
4235 case 363:
4236 #line 1846 "./parse.y"
4237 {yyerror ("'(' expected"); RECOVER;;
4238     break;}
4239 case 364:
4240 #line 1848 "./parse.y"
4241 {yyerror ("')' or term expected"); RECOVER;;
4242     break;}
4243 case 365:
4244 #line 1850 "./parse.y"
4245 {yyerror ("')' expected"); RECOVER;;
4246     break;}
4247 case 366:
4248 #line 1852 "./parse.y"
4249 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
4250     break;}
4251 case 367:
4252 #line 1854 "./parse.y"
4253 {yyerror ("'(' expected"); RECOVER;;
4254     break;}
4255 case 370:
4256 #line 1864 "./parse.y"
4257
4258                   yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
4259                   ctxp->formal_parameter_number = 1; 
4260                 ;
4261     break;}
4262 case 371:
4263 #line 1869 "./parse.y"
4264 {
4265                   ctxp->formal_parameter_number += 1;
4266                   yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
4267                 ;
4268     break;}
4269 case 372:
4270 #line 1874 "./parse.y"
4271 {yyerror ("Missing term"); RECOVER;;
4272     break;}
4273 case 373:
4274 #line 1879 "./parse.y"
4275 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4276     break;}
4277 case 374:
4278 #line 1881 "./parse.y"
4279 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
4280     break;}
4281 case 375:
4282 #line 1883 "./parse.y"
4283 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4284     break;}
4285 case 376:
4286 #line 1885 "./parse.y"
4287 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, CURRENT_OSB (ctxp));;
4288     break;}
4289 case 377:
4290 #line 1889 "./parse.y"
4291 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4292     break;}
4293 case 378:
4294 #line 1891 "./parse.y"
4295 { yyval.node = parse_jdk1_1_error ("anonymous array"); ;
4296     break;}
4297 case 379:
4298 #line 1893 "./parse.y"
4299 {yyerror ("'[' expected"); DRECOVER ("]");;
4300     break;}
4301 case 380:
4302 #line 1895 "./parse.y"
4303 {yyerror ("']' expected"); RECOVER;;
4304     break;}
4305 case 381:
4306 #line 1900 "./parse.y"
4307 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
4308     break;}
4309 case 382:
4310 #line 1902 "./parse.y"
4311 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
4312     break;}
4313 case 383:
4314 #line 1907 "./parse.y"
4315
4316                   EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
4317                   yyval.node = yyvsp[-1].node;
4318                 ;
4319     break;}
4320 case 384:
4321 #line 1912 "./parse.y"
4322 {yyerror ("']' expected"); RECOVER;;
4323     break;}
4324 case 385:
4325 #line 1914 "./parse.y"
4326 {
4327                   yyerror ("Missing term");
4328                   yyerror ("']' expected");
4329                   RECOVER;
4330                 ;
4331     break;}
4332 case 386:
4333 #line 1923 "./parse.y"
4334
4335                   int allocate = 0;
4336                   /* If not initialized, allocate memory for the osb
4337                      numbers stack */
4338                   if (!ctxp->osb_limit)
4339                     {
4340                       allocate = ctxp->osb_limit = 32;
4341                       ctxp->osb_depth = -1;
4342                     }
4343                   /* If capacity overflown, reallocate a bigger chuck */
4344                   else if (ctxp->osb_depth+1 == ctxp->osb_limit)
4345                     allocate = ctxp->osb_limit << 1;
4346                   
4347                   if (allocate)
4348                     {
4349                       allocate *= sizeof (int);
4350                       if (ctxp->osb_number)
4351                         ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,
4352                                                             allocate);
4353                       else
4354                         ctxp->osb_number = (int *)xmalloc (allocate);
4355                     }
4356                   ctxp->osb_depth++;
4357                   CURRENT_OSB (ctxp) = 1;
4358                 ;
4359     break;}
4360 case 387:
4361 #line 1949 "./parse.y"
4362 { CURRENT_OSB (ctxp)++; ;
4363     break;}
4364 case 388:
4365 #line 1951 "./parse.y"
4366 { yyerror ("']' expected"); RECOVER;;
4367     break;}
4368 case 389:
4369 #line 1956 "./parse.y"
4370 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
4371     break;}
4372 case 390:
4373 #line 1960 "./parse.y"
4374 {
4375                   tree super_wfl = 
4376                     build_wfl_node (super_identifier_node);
4377                   EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
4378                   yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
4379                 ;
4380     break;}
4381 case 391:
4382 #line 1967 "./parse.y"
4383 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
4384     break;}
4385 case 392:
4386 #line 1972 "./parse.y"
4387 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
4388     break;}
4389 case 393:
4390 #line 1974 "./parse.y"
4391 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
4392     break;}
4393 case 394:
4394 #line 1976 "./parse.y"
4395
4396                   if (TREE_CODE (yyvsp[-4].node) == THIS_EXPR)
4397                     yyval.node = build_this_super_qualified_invocation 
4398                       (1, yyvsp[-2].node, NULL_TREE, 0, yyvsp[-3].operator.location);
4399                   else
4400                     {
4401                       tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
4402                       yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
4403                     }
4404                 ;
4405     break;}
4406 case 395:
4407 #line 1987 "./parse.y"
4408
4409                   if (TREE_CODE (yyvsp[-5].node) == THIS_EXPR)
4410                     yyval.node = build_this_super_qualified_invocation 
4411                       (1, yyvsp[-3].node, yyvsp[-1].node, 0, yyvsp[-4].operator.location);
4412                   else
4413                     {
4414                       tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
4415                       yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
4416                     }
4417                 ;
4418     break;}
4419 case 396:
4420 #line 1998 "./parse.y"
4421
4422                   yyval.node = build_this_super_qualified_invocation 
4423                     (0, yyvsp[-2].node, NULL_TREE, yyvsp[-4].operator.location, yyvsp[-3].operator.location);
4424                 ;
4425     break;}
4426 case 397:
4427 #line 2003 "./parse.y"
4428 {
4429                   yyval.node = build_this_super_qualified_invocation 
4430                     (0, yyvsp[-3].node, yyvsp[-1].node, yyvsp[-5].operator.location, yyvsp[-4].operator.location);
4431                 ;
4432     break;}
4433 case 398:
4434 #line 2012 "./parse.y"
4435 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4436     break;}
4437 case 399:
4438 #line 2014 "./parse.y"
4439 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
4440     break;}
4441 case 400:
4442 #line 2019 "./parse.y"
4443 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4444     break;}
4445 case 401:
4446 #line 2021 "./parse.y"
4447 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4448     break;}
4449 case 402:
4450 #line 2023 "./parse.y"
4451 {
4452                   yyerror ("Missing term and ']' expected");
4453                   DRECOVER(array_access);
4454                 ;
4455     break;}
4456 case 403:
4457 #line 2028 "./parse.y"
4458 {
4459                   yyerror ("']' expected");
4460                   DRECOVER(array_access);
4461                 ;
4462     break;}
4463 case 404:
4464 #line 2033 "./parse.y"
4465 {
4466                   yyerror ("Missing term and ']' expected");
4467                   DRECOVER(array_access);
4468                 ;
4469     break;}
4470 case 405:
4471 #line 2038 "./parse.y"
4472 {
4473                   yyerror ("']' expected");
4474                   DRECOVER(array_access);
4475                 ;
4476     break;}
4477 case 410:
4478 #line 2053 "./parse.y"
4479 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4480     break;}
4481 case 411:
4482 #line 2058 "./parse.y"
4483 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4484     break;}
4485 case 414:
4486 #line 2065 "./parse.y"
4487 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4488     break;}
4489 case 415:
4490 #line 2067 "./parse.y"
4491 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4492     break;}
4493 case 417:
4494 #line 2070 "./parse.y"
4495 {yyerror ("Missing term"); RECOVER;
4496     break;}
4497 case 418:
4498 #line 2072 "./parse.y"
4499 {yyerror ("Missing term"); RECOVER;
4500     break;}
4501 case 419:
4502 #line 2077 "./parse.y"
4503 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4504     break;}
4505 case 420:
4506 #line 2079 "./parse.y"
4507 {yyerror ("Missing term"); RECOVER;
4508     break;}
4509 case 421:
4510 #line 2084 "./parse.y"
4511 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4512     break;}
4513 case 422:
4514 #line 2086 "./parse.y"
4515 {yyerror ("Missing term"); RECOVER;
4516     break;}
4517 case 424:
4518 #line 2092 "./parse.y"
4519 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4520     break;}
4521 case 425:
4522 #line 2094 "./parse.y"
4523 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4524     break;}
4525 case 427:
4526 #line 2097 "./parse.y"
4527 {yyerror ("Missing term"); RECOVER;
4528     break;}
4529 case 428:
4530 #line 2099 "./parse.y"
4531 {yyerror ("Missing term"); RECOVER;
4532     break;}
4533 case 429:
4534 #line 2104 "./parse.y"
4535
4536                   tree type = yyvsp[-3].node;
4537                   while (CURRENT_OSB (ctxp)--)
4538                     type = build_java_array_type (type, -1);
4539                   ctxp->osb_depth--;
4540                   yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node); 
4541                 ;
4542     break;}
4543 case 430:
4544 #line 2112 "./parse.y"
4545 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4546     break;}
4547 case 431:
4548 #line 2114 "./parse.y"
4549 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4550     break;}
4551 case 432:
4552 #line 2116 "./parse.y"
4553
4554                   const char *ptr;
4555                   while (CURRENT_OSB (ctxp)--)
4556                     obstack_1grow (&temporary_obstack, '[');
4557                   ctxp->osb_depth--;
4558                   obstack_grow0 (&temporary_obstack, 
4559                                  IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
4560                                  IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
4561                   ptr = obstack_finish (&temporary_obstack);
4562                   EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
4563                   yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
4564                 ;
4565     break;}
4566 case 433:
4567 #line 2129 "./parse.y"
4568 {yyerror ("']' expected, invalid type expression");;
4569     break;}
4570 case 434:
4571 #line 2131 "./parse.y"
4572 {
4573                   if (ctxp->prevent_ese != lineno)
4574                     yyerror ("Invalid type expression"); RECOVER;
4575                   RECOVER;
4576                 ;
4577     break;}
4578 case 435:
4579 #line 2137 "./parse.y"
4580 {yyerror ("Missing term"); RECOVER;;
4581     break;}
4582 case 436:
4583 #line 2139 "./parse.y"
4584 {yyerror ("Missing term"); RECOVER;;
4585     break;}
4586 case 437:
4587 #line 2141 "./parse.y"
4588 {yyerror ("Missing term"); RECOVER;;
4589     break;}
4590 case 439:
4591 #line 2147 "./parse.y"
4592
4593                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), 
4594                                     yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4595                 ;
4596     break;}
4597 case 440:
4598 #line 2152 "./parse.y"
4599 {
4600                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4601                                     yyvsp[-2].node, yyvsp[0].node); 
4602                 ;
4603     break;}
4604 case 441:
4605 #line 2157 "./parse.y"
4606 {
4607                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4608                                     yyvsp[-2].node, yyvsp[0].node); 
4609                 ;
4610     break;}
4611 case 442:
4612 #line 2162 "./parse.y"
4613 {yyerror ("Missing term"); RECOVER;;
4614     break;}
4615 case 443:
4616 #line 2164 "./parse.y"
4617 {yyerror ("Missing term"); RECOVER;;
4618     break;}
4619 case 444:
4620 #line 2166 "./parse.y"
4621 {yyerror ("Missing term"); RECOVER;;
4622     break;}
4623 case 446:
4624 #line 2172 "./parse.y"
4625 {
4626                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4627                                     yyvsp[-2].node, yyvsp[0].node); 
4628                 ;
4629     break;}
4630 case 447:
4631 #line 2177 "./parse.y"
4632 {
4633                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4634                                     yyvsp[-2].node, yyvsp[0].node); 
4635                 ;
4636     break;}
4637 case 448:
4638 #line 2182 "./parse.y"
4639 {yyerror ("Missing term"); RECOVER;;
4640     break;}
4641 case 449:
4642 #line 2184 "./parse.y"
4643 {yyerror ("Missing term"); RECOVER;;
4644     break;}
4645 case 451:
4646 #line 2190 "./parse.y"
4647 {
4648                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4649                                     yyvsp[-2].node, yyvsp[0].node); 
4650                 ;
4651     break;}
4652 case 452:
4653 #line 2195 "./parse.y"
4654 {
4655                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4656                                     yyvsp[-2].node, yyvsp[0].node); 
4657                 ;
4658     break;}
4659 case 453:
4660 #line 2200 "./parse.y"
4661 {
4662                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4663                                     yyvsp[-2].node, yyvsp[0].node); 
4664                 ;
4665     break;}
4666 case 454:
4667 #line 2205 "./parse.y"
4668 {yyerror ("Missing term"); RECOVER;;
4669     break;}
4670 case 455:
4671 #line 2207 "./parse.y"
4672 {yyerror ("Missing term"); RECOVER;;
4673     break;}
4674 case 456:
4675 #line 2209 "./parse.y"
4676 {yyerror ("Missing term"); RECOVER;;
4677     break;}
4678 case 458:
4679 #line 2215 "./parse.y"
4680 {
4681                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4682                                     yyvsp[-2].node, yyvsp[0].node); 
4683                 ;
4684     break;}
4685 case 459:
4686 #line 2220 "./parse.y"
4687 {
4688                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4689                                     yyvsp[-2].node, yyvsp[0].node); 
4690                 ;
4691     break;}
4692 case 460:
4693 #line 2225 "./parse.y"
4694 {
4695                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4696                                     yyvsp[-2].node, yyvsp[0].node); 
4697                 ;
4698     break;}
4699 case 461:
4700 #line 2230 "./parse.y"
4701 {
4702                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4703                                     yyvsp[-2].node, yyvsp[0].node); 
4704                 ;
4705     break;}
4706 case 462:
4707 #line 2235 "./parse.y"
4708 { yyval.node = build_binop (INSTANCEOF_EXPR, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4709     break;}
4710 case 463:
4711 #line 2237 "./parse.y"
4712 {yyerror ("Missing term"); RECOVER;;
4713     break;}
4714 case 464:
4715 #line 2239 "./parse.y"
4716 {yyerror ("Missing term"); RECOVER;;
4717     break;}
4718 case 465:
4719 #line 2241 "./parse.y"
4720 {yyerror ("Missing term"); RECOVER;;
4721     break;}
4722 case 466:
4723 #line 2243 "./parse.y"
4724 {yyerror ("Missing term"); RECOVER;;
4725     break;}
4726 case 467:
4727 #line 2245 "./parse.y"
4728 {yyerror ("Invalid reference type"); RECOVER;;
4729     break;}
4730 case 469:
4731 #line 2251 "./parse.y"
4732 {
4733                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4734                                     yyvsp[-2].node, yyvsp[0].node); 
4735                 ;
4736     break;}
4737 case 470:
4738 #line 2256 "./parse.y"
4739 {
4740                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4741                                     yyvsp[-2].node, yyvsp[0].node); 
4742                 ;
4743     break;}
4744 case 471:
4745 #line 2261 "./parse.y"
4746 {yyerror ("Missing term"); RECOVER;;
4747     break;}
4748 case 472:
4749 #line 2263 "./parse.y"
4750 {yyerror ("Missing term"); RECOVER;;
4751     break;}
4752 case 474:
4753 #line 2269 "./parse.y"
4754 {
4755                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4756                                     yyvsp[-2].node, yyvsp[0].node); 
4757                 ;
4758     break;}
4759 case 475:
4760 #line 2274 "./parse.y"
4761 {yyerror ("Missing term"); RECOVER;;
4762     break;}
4763 case 477:
4764 #line 2280 "./parse.y"
4765 {
4766                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4767                                     yyvsp[-2].node, yyvsp[0].node); 
4768                 ;
4769     break;}
4770 case 478:
4771 #line 2285 "./parse.y"
4772 {yyerror ("Missing term"); RECOVER;;
4773     break;}
4774 case 480:
4775 #line 2291 "./parse.y"
4776 {
4777                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4778                                     yyvsp[-2].node, yyvsp[0].node); 
4779                 ;
4780     break;}
4781 case 481:
4782 #line 2296 "./parse.y"
4783 {yyerror ("Missing term"); RECOVER;;
4784     break;}
4785 case 483:
4786 #line 2302 "./parse.y"
4787 {
4788                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4789                                     yyvsp[-2].node, yyvsp[0].node); 
4790                 ;
4791     break;}
4792 case 484:
4793 #line 2307 "./parse.y"
4794 {yyerror ("Missing term"); RECOVER;;
4795     break;}
4796 case 486:
4797 #line 2313 "./parse.y"
4798 {
4799                   yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4800                                     yyvsp[-2].node, yyvsp[0].node); 
4801                 ;
4802     break;}
4803 case 487:
4804 #line 2318 "./parse.y"
4805 {yyerror ("Missing term"); RECOVER;;
4806     break;}
4807 case 489:
4808 #line 2324 "./parse.y"
4809 {
4810                   yyval.node = build (CONDITIONAL_EXPR, NULL_TREE, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);
4811                   EXPR_WFL_LINECOL (yyval.node) = yyvsp[-3].operator.location;
4812                 ;
4813     break;}
4814 case 490:
4815 #line 2329 "./parse.y"
4816 {
4817                   YYERROR_NOW;
4818                   yyerror ("Missing term");
4819                   DRECOVER (1);
4820                 ;
4821     break;}
4822 case 491:
4823 #line 2335 "./parse.y"
4824 {yyerror ("Missing term"); DRECOVER (2);;
4825     break;}
4826 case 492:
4827 #line 2337 "./parse.y"
4828 {yyerror ("Missing term"); DRECOVER (3);;
4829     break;}
4830 case 495:
4831 #line 2347 "./parse.y"
4832 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4833     break;}
4834 case 496:
4835 #line 2349 "./parse.y"
4836 {
4837                   if (ctxp->prevent_ese != lineno)
4838                     yyerror ("Missing term");
4839                   DRECOVER (assign);
4840                 ;
4841     break;}
4842 }
4843    /* the action file gets copied in in place of this dollarsign */
4844 #line 543 "/usr/lib/bison.simple"
4845 \f
4846   yyvsp -= yylen;
4847   yyssp -= yylen;
4848 #ifdef YYLSP_NEEDED
4849   yylsp -= yylen;
4850 #endif
4851
4852 #if YYDEBUG != 0
4853   if (yydebug)
4854     {
4855       short *ssp1 = yyss - 1;
4856       fprintf (stderr, "state stack now");
4857       while (ssp1 != yyssp)
4858         fprintf (stderr, " %d", *++ssp1);
4859       fprintf (stderr, "\n");
4860     }
4861 #endif
4862
4863   *++yyvsp = yyval;
4864
4865 #ifdef YYLSP_NEEDED
4866   yylsp++;
4867   if (yylen == 0)
4868     {
4869       yylsp->first_line = yylloc.first_line;
4870       yylsp->first_column = yylloc.first_column;
4871       yylsp->last_line = (yylsp-1)->last_line;
4872       yylsp->last_column = (yylsp-1)->last_column;
4873       yylsp->text = 0;
4874     }
4875   else
4876     {
4877       yylsp->last_line = (yylsp+yylen-1)->last_line;
4878       yylsp->last_column = (yylsp+yylen-1)->last_column;
4879     }
4880 #endif
4881
4882   /* Now "shift" the result of the reduction.
4883      Determine what state that goes to,
4884      based on the state we popped back to
4885      and the rule number reduced by.  */
4886
4887   yyn = yyr1[yyn];
4888
4889   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
4890   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4891     yystate = yytable[yystate];
4892   else
4893     yystate = yydefgoto[yyn - YYNTBASE];
4894
4895   goto yynewstate;
4896
4897 yyerrlab:   /* here on detecting error */
4898
4899   if (! yyerrstatus)
4900     /* If not already recovering from an error, report this error.  */
4901     {
4902       ++yynerrs;
4903
4904 #ifdef YYERROR_VERBOSE
4905       yyn = yypact[yystate];
4906
4907       if (yyn > YYFLAG && yyn < YYLAST)
4908         {
4909           int size = 0;
4910           char *msg;
4911           int x, count;
4912
4913           count = 0;
4914           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
4915           for (x = (yyn < 0 ? -yyn : 0);
4916                x < (sizeof(yytname) / sizeof(char *)); x++)
4917             if (yycheck[x + yyn] == x)
4918               size += strlen(yytname[x]) + 15, count++;
4919           msg = (char *) malloc(size + 15);
4920           if (msg != 0)
4921             {
4922               strcpy(msg, "parse error");
4923
4924               if (count < 5)
4925                 {
4926                   count = 0;
4927                   for (x = (yyn < 0 ? -yyn : 0);
4928                        x < (sizeof(yytname) / sizeof(char *)); x++)
4929                     if (yycheck[x + yyn] == x)
4930                       {
4931                         strcat(msg, count == 0 ? ", expecting `" : " or `");
4932                         strcat(msg, yytname[x]);
4933                         strcat(msg, "'");
4934                         count++;
4935                       }
4936                 }
4937               yyerror(msg);
4938               free(msg);
4939             }
4940           else
4941             yyerror ("parse error; also virtual memory exceeded");
4942         }
4943       else
4944 #endif /* YYERROR_VERBOSE */
4945         yyerror("parse error");
4946     }
4947
4948   goto yyerrlab1;
4949 yyerrlab1:   /* here on error raised explicitly by an action */
4950
4951   if (yyerrstatus == 3)
4952     {
4953       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
4954
4955       /* return failure if at end of input */
4956       if (yychar == YYEOF)
4957         YYABORT;
4958
4959 #if YYDEBUG != 0
4960       if (yydebug)
4961         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4962 #endif
4963
4964       yychar = YYEMPTY;
4965     }
4966
4967   /* Else will try to reuse lookahead token
4968      after shifting the error token.  */
4969
4970   yyerrstatus = 3;              /* Each real token shifted decrements this */
4971
4972   goto yyerrhandle;
4973
4974 yyerrdefault:  /* current state does not do anything special for the error token. */
4975
4976 #if 0
4977   /* This is wrong; only states that explicitly want error tokens
4978      should shift them.  */
4979   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
4980   if (yyn) goto yydefault;
4981 #endif
4982
4983 yyerrpop:   /* pop the current state because it cannot handle the error token */
4984
4985   if (yyssp == yyss) YYABORT;
4986   yyvsp--;
4987   yystate = *--yyssp;
4988 #ifdef YYLSP_NEEDED
4989   yylsp--;
4990 #endif
4991
4992 #if YYDEBUG != 0
4993   if (yydebug)
4994     {
4995       short *ssp1 = yyss - 1;
4996       fprintf (stderr, "Error: state stack now");
4997       while (ssp1 != yyssp)
4998         fprintf (stderr, " %d", *++ssp1);
4999       fprintf (stderr, "\n");
5000     }
5001 #endif
5002
5003 yyerrhandle:
5004
5005   yyn = yypact[yystate];
5006   if (yyn == YYFLAG)
5007     goto yyerrdefault;
5008
5009   yyn += YYTERROR;
5010   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
5011     goto yyerrdefault;
5012
5013   yyn = yytable[yyn];
5014   if (yyn < 0)
5015     {
5016       if (yyn == YYFLAG)
5017         goto yyerrpop;
5018       yyn = -yyn;
5019       goto yyreduce;
5020     }
5021   else if (yyn == 0)
5022     goto yyerrpop;
5023
5024   if (yyn == YYFINAL)
5025     YYACCEPT;
5026
5027 #if YYDEBUG != 0
5028   if (yydebug)
5029     fprintf(stderr, "Shifting error token, ");
5030 #endif
5031
5032   *++yyvsp = yylval;
5033 #ifdef YYLSP_NEEDED
5034   *++yylsp = yylloc;
5035 #endif
5036
5037   yystate = yyn;
5038   goto yynewstate;
5039
5040  yyacceptlab:
5041   /* YYACCEPT comes here.  */
5042   if (yyfree_stacks)
5043     {
5044       free (yyss);
5045       free (yyvs);
5046 #ifdef YYLSP_NEEDED
5047       free (yyls);
5048 #endif
5049     }
5050   return 0;
5051
5052  yyabortlab:
5053   /* YYABORT comes here.  */
5054   if (yyfree_stacks)
5055     {
5056       free (yyss);
5057       free (yyvs);
5058 #ifdef YYLSP_NEEDED
5059       free (yyls);
5060 #endif
5061     }
5062   return 1;
5063 }
5064 #line 2375 "./parse.y"
5065
5066 \f
5067
5068 /* Flag for the error report routine to issue the error the first time
5069    it's called (overriding the default behavior which is to drop the
5070    first invocation and honor the second one, taking advantage of a
5071    richer context.  */
5072 static int force_error = 0;
5073
5074 /* Create a new parser context and make it the current one. */
5075
5076 void
5077 java_push_parser_context ()
5078 {
5079   struct parser_ctxt *new = 
5080     (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
5081
5082   bzero ((PTR) new, sizeof (struct parser_ctxt));
5083   new->next = ctxp;
5084   ctxp = new;
5085   if (ctxp->next)
5086     {
5087       ctxp->incomplete_class = ctxp->next->incomplete_class;
5088       ctxp->gclass_list = ctxp->next->gclass_list;
5089     }
5090 }  
5091
5092 void
5093 java_parser_context_save_global ()
5094 {
5095   if (!ctxp)
5096     {
5097       java_push_parser_context ();
5098       ctxp->saved_data_ctx = 1;
5099     }
5100   else if (ctxp->saved_data)
5101     {
5102       struct parser_ctxt *new = 
5103         (struct parser_ctxt *)xmalloc(sizeof (struct parser_ctxt));
5104       bzero ((PTR)new, sizeof (struct parser_ctxt));
5105       memcpy ((PTR)new, (PTR)ctxp, sizeof (struct parser_ctxt));
5106       new->next = ctxp;
5107       ctxp = new;
5108       ctxp->saved_data_ctx = 1;
5109     }
5110   ctxp->finput = finput;
5111   ctxp->lineno = lineno;
5112   ctxp->current_class = current_class;
5113   ctxp->filename = input_filename;
5114   ctxp->current_function_decl = current_function_decl;
5115   ctxp->saved_data = 1;
5116 }
5117
5118 void
5119 java_parser_context_restore_global ()
5120 {
5121   finput = ctxp->finput;
5122   lineno = ctxp->lineno;
5123   current_class = ctxp->current_class;
5124   input_filename = ctxp->filename;
5125   ctxp->saved_data = 0;
5126   current_function_decl = ctxp->current_function_decl;
5127   if (ctxp->saved_data_ctx)
5128     java_pop_parser_context (0);
5129 }
5130
5131 void 
5132 java_pop_parser_context (generate)
5133      int generate;
5134 {
5135   tree current;
5136   struct parser_ctxt *toFree, *next;
5137
5138   if (!ctxp)
5139     return;
5140
5141   toFree = ctxp;
5142   next = ctxp->next;
5143   if (next)
5144     {
5145       next->incomplete_class = ctxp->incomplete_class;
5146       next->gclass_list = ctxp->gclass_list;
5147       lineno = ctxp->lineno;
5148       finput = ctxp->finput;
5149       current_class = ctxp->current_class;
5150     }
5151
5152   /* Set the single import class file flag to 0 for the current list
5153      of imported things */
5154   for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
5155     IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
5156
5157   /* And restore those of the previous context */
5158   if ((ctxp = next))            /* Assignment is really meant here */
5159     for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
5160       IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
5161
5162   if (generate)
5163     {
5164       toFree->next = ctxp_for_generation;
5165       ctxp_for_generation = toFree;
5166     }
5167   else
5168     free (toFree);
5169 }
5170
5171 /* Dump the stacked up parser contexts. Intended to be called from a
5172    debugger.  */
5173
5174 static void
5175 java_debug_context_do (tab)
5176      int tab;
5177 {
5178 #define JAVA_TAB_CONTEXT(C) \
5179   {int i; for (i = 0; i < (C); i++) fputc (' ', stderr);}
5180
5181   struct parser_ctxt *copy = ctxp;
5182   while (copy)
5183     {
5184       JAVA_TAB_CONTEXT (tab);
5185       fprintf (stderr, "ctxt: 0x%0lX\n", (unsigned long)copy);
5186       JAVA_TAB_CONTEXT (tab);
5187       fprintf (stderr, "filename: %s\n", copy->filename);
5188       JAVA_TAB_CONTEXT (tab);
5189       fprintf (stderr, "package: %s\n",
5190                (copy->package ? 
5191                 IDENTIFIER_POINTER (copy->package) : "<none>"));
5192       JAVA_TAB_CONTEXT (tab);
5193       fprintf (stderr, "context for saving: %d\n", copy->saved_data_ctx);
5194       JAVA_TAB_CONTEXT (tab);
5195       fprintf (stderr, "saved data: %d\n", copy->saved_data);
5196       copy = copy->next;
5197       tab += 2;
5198     }
5199 #undef JAVA_TAB_CONTEXT
5200 }
5201
5202 void
5203 java_debug_context ()
5204 {
5205   java_debug_context_do (0);
5206 }
5207
5208
5209 /* Reporting an constructor invocation error.  */
5210 static void
5211 parse_ctor_invocation_error ()
5212 {
5213   if (DECL_CONSTRUCTOR_P (current_function_decl))
5214     yyerror ("Constructor invocation must be first thing in a constructor"); 
5215   else
5216     yyerror ("Only constructors can invoke constructors");
5217 }
5218
5219 /* Reporting JDK1.1 features not implemented.  */
5220
5221 static tree
5222 parse_jdk1_1_error (msg)
5223     const char *msg;
5224 {
5225   sorry (": `%s' JDK1.1(TM) feature", msg);
5226   java_error_count++;
5227   return empty_stmt_node;
5228 }
5229
5230 static int do_warning = 0;
5231
5232 void
5233 yyerror (msg)
5234      const char *msg;
5235 {
5236   static java_lc elc;
5237   static int  prev_lineno;
5238   static const char *prev_msg;
5239
5240   int save_lineno;
5241   char *remainder, *code_from_source;
5242   extern struct obstack temporary_obstack;
5243   
5244   if (!force_error && prev_lineno == lineno)
5245     return;
5246
5247   /* Save current error location but report latter, when the context is
5248      richer.  */
5249   if (ctxp->java_error_flag == 0)
5250     {
5251       ctxp->java_error_flag = 1;
5252       elc = ctxp->elc;
5253       /* Do something to use the previous line if we're reaching the
5254          end of the file... */
5255 #ifdef VERBOSE_SKELETON
5256       printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
5257 #endif
5258       return;
5259     }
5260
5261   /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
5262   if (!force_error && msg == prev_msg && prev_lineno == elc.line)
5263     return;
5264
5265   ctxp->java_error_flag = 0;
5266   if (do_warning)
5267     java_warning_count++;
5268   else
5269     java_error_count++;
5270   
5271   if (elc.col == 0 && msg[1] == ';')
5272     {
5273       elc.col  = ctxp->p_line->char_col-1;
5274       elc.line = ctxp->p_line->lineno;
5275     }
5276
5277   save_lineno = lineno;
5278   prev_lineno = lineno = elc.line;
5279   prev_msg = msg;
5280
5281   code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
5282   obstack_grow0 (&temporary_obstack, 
5283                  code_from_source, strlen (code_from_source));
5284   remainder = obstack_finish (&temporary_obstack);
5285   if (do_warning)
5286     warning ("%s.\n%s", msg, remainder);
5287   else
5288     error ("%s.\n%s", msg, remainder);
5289
5290   /* This allow us to cheaply avoid an extra 'Invalid expression
5291      statement' error report when errors have been already reported on
5292      the same line. This occurs when we report an error but don't have
5293      a synchronization point other than ';', which
5294      expression_statement is the only one to take care of.  */
5295   ctxp->prevent_ese = lineno = save_lineno;
5296 }
5297
5298 static void
5299 issue_warning_error_from_context (cl, msg, ap)
5300      tree cl;
5301      const char *msg;
5302      va_list ap;
5303 {
5304   char *saved, *saved_input_filename;
5305   char buffer [4096];
5306   vsprintf (buffer, msg, ap);
5307   force_error = 1;
5308
5309   ctxp->elc.line = EXPR_WFL_LINENO (cl);
5310   ctxp->elc.col  = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : 
5311                     (EXPR_WFL_COLNO (cl) == 0xffe ? -2 : EXPR_WFL_COLNO (cl)));
5312
5313   /* We have a CL, that's a good reason for using it if it contains data */
5314   saved = ctxp->filename;
5315   if (TREE_CODE (cl) == EXPR_WITH_FILE_LOCATION && EXPR_WFL_FILENAME_NODE (cl))
5316     ctxp->filename = EXPR_WFL_FILENAME (cl);
5317   saved_input_filename = input_filename;
5318   input_filename = ctxp->filename;
5319   java_error (NULL);
5320   java_error (buffer);
5321   ctxp->filename = saved;
5322   input_filename = saved_input_filename;
5323   force_error = 0;
5324 }
5325
5326 /* Issue an error message at a current source line CL */
5327
5328 void
5329 parse_error_context VPARAMS ((tree cl, const char *msg, ...))
5330 {
5331 #ifndef ANSI_PROTOTYPES
5332   tree cl;
5333   const char *msg;
5334 #endif
5335   va_list ap;
5336
5337   VA_START (ap, msg);
5338 #ifndef ANSI_PROTOTYPES
5339   cl = va_arg (ap, tree);
5340   msg = va_arg (ap, const char *);
5341 #endif
5342   issue_warning_error_from_context (cl, msg, ap);
5343   va_end (ap);
5344 }
5345
5346 /* Issue a warning at a current source line CL */
5347
5348 static void
5349 parse_warning_context VPARAMS ((tree cl, const char *msg, ...))
5350 {
5351 #ifndef ANSI_PROTOTYPES
5352   tree cl;
5353   const char *msg;
5354 #endif
5355   va_list ap;
5356
5357   VA_START (ap, msg);
5358 #ifndef ANSI_PROTOTYPES
5359   cl = va_arg (ap, tree);
5360   msg = va_arg (ap, const char *);
5361 #endif
5362
5363   force_error = do_warning = 1;
5364   issue_warning_error_from_context (cl, msg, ap);
5365   do_warning = force_error = 0;
5366   va_end (ap);
5367 }
5368
5369 static tree
5370 find_expr_with_wfl (node)
5371      tree node;
5372 {
5373   while (node)
5374     {
5375       char code;
5376       tree to_return;
5377
5378       switch (TREE_CODE (node))
5379         {
5380         case BLOCK:
5381           node = BLOCK_EXPR_BODY (node);
5382           continue;
5383
5384         case COMPOUND_EXPR:
5385           to_return = find_expr_with_wfl (TREE_OPERAND (node, 0));
5386           if (to_return)
5387             return to_return;
5388           node = TREE_OPERAND (node, 1);
5389           continue;
5390
5391         case LOOP_EXPR:
5392           node = TREE_OPERAND (node, 0);
5393           continue;
5394           
5395         case LABELED_BLOCK_EXPR:
5396           node = TREE_OPERAND (node, 1);
5397           continue;
5398
5399         default:
5400           code = TREE_CODE_CLASS (TREE_CODE (node));
5401           if (((code == '1') || (code == '2') || (code == 'e'))
5402               && EXPR_WFL_LINECOL (node))
5403             return node;
5404           return NULL_TREE;
5405         }
5406     }
5407   return NULL_TREE;
5408 }
5409
5410 /* Issue a missing return statement error. Uses METHOD to figure the
5411    last line of the method the error occurs in.  */
5412
5413 static void
5414 missing_return_error (method)
5415      tree method;
5416 {
5417   EXPR_WFL_SET_LINECOL (wfl_operator, DECL_SOURCE_LINE_LAST (method), -2);
5418   parse_error_context (wfl_operator, "Missing return statement");
5419 }
5420
5421 /* Issue an unreachable statement error. From NODE, find the next
5422    statement to report appropriately.  */
5423 static void
5424 unreachable_stmt_error (node)
5425      tree node;
5426 {
5427   /* Browse node to find the next expression node that has a WFL. Use
5428      the location to report the error */
5429   if (TREE_CODE (node) == COMPOUND_EXPR)
5430     node = find_expr_with_wfl (TREE_OPERAND (node, 1));
5431   else
5432     node = find_expr_with_wfl (node);
5433
5434   if (node)
5435     {
5436       EXPR_WFL_SET_LINECOL (wfl_operator, EXPR_WFL_LINENO (node), -2);
5437       parse_error_context (wfl_operator, "Unreachable statement");
5438     }
5439   else
5440     fatal ("Can't get valid statement - unreachable_stmt_error");
5441 }
5442
5443 int
5444 java_report_errors ()
5445 {
5446   if (java_error_count)
5447     fprintf (stderr, "%d error%s", 
5448              java_error_count, (java_error_count == 1 ? "" : "s"));
5449   if (java_warning_count)
5450     fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
5451              java_warning_count, (java_warning_count == 1 ? "" : "s"));
5452   if (java_error_count || java_warning_count)
5453     putc ('\n', stderr);
5454   return java_error_count;
5455 }
5456
5457 static char *
5458 java_accstring_lookup (flags)
5459      int flags;
5460 {
5461   static char buffer [80];
5462 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
5463
5464   /* Access modifier looked-up first for easier report on forbidden
5465      access. */
5466   if (flags & ACC_PUBLIC) COPY_RETURN ("public");
5467   if (flags & ACC_PRIVATE) COPY_RETURN ("private");
5468   if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
5469   if (flags & ACC_STATIC) COPY_RETURN ("static");
5470   if (flags & ACC_FINAL) COPY_RETURN ("final");
5471   if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
5472   if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
5473   if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
5474   if (flags & ACC_NATIVE) COPY_RETURN ("native");
5475   if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
5476   if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
5477
5478   buffer [0] = '\0';
5479   return buffer;
5480 #undef COPY_RETURN
5481 }
5482
5483 /* Issuing error messages upon redefinition of classes, interfaces or
5484    variables. */
5485
5486 static void
5487 classitf_redefinition_error (context, id, decl, cl)
5488      const char *context;
5489      tree id, decl, cl;
5490 {
5491   parse_error_context (cl, "%s `%s' already defined in %s:%d", 
5492                        context, IDENTIFIER_POINTER (id), 
5493                        DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5494   /* Here we should point out where its redefined. It's a unicode. FIXME */
5495 }
5496
5497 static void
5498 variable_redefinition_error (context, name, type, line)
5499      tree context, name, type;
5500      int line;
5501 {
5502   const char *type_name;
5503
5504   /* Figure a proper name for type. We might haven't resolved it */
5505   if (TREE_CODE (type) == POINTER_TYPE && !TREE_TYPE (type))
5506     type_name = IDENTIFIER_POINTER (TYPE_NAME (type));
5507   else
5508     type_name = lang_printable_name (type, 0);
5509
5510   parse_error_context (context,
5511                        "Variable `%s' is already defined in this method and was declared `%s %s' at line %d", 
5512                        IDENTIFIER_POINTER (name),
5513                        type_name, IDENTIFIER_POINTER (name), line);
5514 }
5515
5516 static tree
5517 build_array_from_name (type, type_wfl, name, ret_name)
5518      tree type, type_wfl, name, *ret_name;
5519 {
5520   int more_dims = 0;
5521   const char *string;
5522
5523   /* Eventually get more dims */
5524   string = IDENTIFIER_POINTER (name);
5525   while (string [more_dims] == '[')
5526     more_dims++;
5527   
5528   /* If we have, then craft a new type for this variable */
5529   if (more_dims)
5530     {
5531       name = get_identifier (&string [more_dims]);
5532
5533       /* If we have a pointer, use its type */
5534       if (TREE_CODE (type) == POINTER_TYPE)
5535         type = TREE_TYPE (type);
5536
5537       /* Building the first dimension of a primitive type uses this
5538          function */
5539       if (JPRIMITIVE_TYPE_P (type))
5540         {
5541           type = build_java_array_type (type, -1);
5542           CLASS_LOADED_P (type) = 1;
5543           more_dims--;
5544         }
5545       /* Otherwise, if we have a WFL for this type, use it (the type
5546          is already an array on an unresolved type, and we just keep
5547          on adding dimensions) */
5548       else if (type_wfl)
5549         type = type_wfl;
5550
5551       /* Add all the dimensions */
5552       while (more_dims--)
5553         type = build_unresolved_array_type (type);
5554
5555       /* The type may have been incomplete in the first place */
5556       if (type_wfl)
5557         type = obtain_incomplete_type (type);
5558     }
5559
5560   *ret_name = name;
5561   return type;
5562 }
5563
5564 /* Build something that the type identifier resolver will identify as
5565    being an array to an unresolved type. TYPE_WFL is a WFL on a
5566    identifier. */
5567
5568 static tree
5569 build_unresolved_array_type (type_or_wfl)
5570      tree type_or_wfl;
5571 {
5572   const char *ptr;
5573
5574   /* TYPE_OR_WFL might be an array on a resolved type. In this case,
5575      just create a array type */
5576   if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
5577     {
5578       tree type = build_java_array_type (type_or_wfl, -1);
5579       CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
5580       return type;
5581     }
5582
5583   obstack_1grow (&temporary_obstack, '[');
5584   obstack_grow0 (&temporary_obstack,
5585                  IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
5586                  IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
5587   ptr = obstack_finish (&temporary_obstack);
5588   return build_expr_wfl (get_identifier (ptr),
5589                          EXPR_WFL_FILENAME (type_or_wfl),
5590                          EXPR_WFL_LINENO (type_or_wfl),
5591                          EXPR_WFL_COLNO (type_or_wfl));
5592 }
5593
5594 static void
5595 parser_add_interface (class_decl, interface_decl, wfl)
5596      tree class_decl, interface_decl, wfl;
5597 {
5598   if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
5599     parse_error_context (wfl, "Interface `%s' repeated",
5600                          IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
5601 }
5602
5603 /* Bulk of common class/interface checks. Return 1 if an error was
5604    encountered. TAG is 0 for a class, 1 for an interface.  */
5605
5606 static int
5607 check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
5608      int is_interface, flags;
5609      tree raw_name, qualified_name, decl, cl;
5610 {
5611   tree node;
5612
5613   if (!quiet_flag)
5614     fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"), 
5615              IDENTIFIER_POINTER (qualified_name));
5616
5617   /* Scope of an interface/class type name:
5618        - Can't be imported by a single type import
5619        - Can't already exists in the package */
5620   if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
5621       && (node = find_name_in_single_imports (raw_name)))
5622     {
5623       parse_error_context 
5624         (cl, "%s name `%s' clashes with imported type `%s'",
5625          (is_interface ? "Interface" : "Class"),
5626          IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
5627       return 1;
5628     }
5629   if (decl && CLASS_COMPLETE_P (decl))
5630     {
5631       classitf_redefinition_error ((is_interface ? "Interface" : "Class"), 
5632                                    qualified_name, decl, cl);
5633       return 1;
5634     }
5635
5636   /* If public, file name should match class/interface name */
5637   if (flags & ACC_PUBLIC)
5638     {
5639       const char *f;
5640
5641       /* Contains OS dependent assumption on path separator. FIXME */
5642       for (f = &input_filename [strlen (input_filename)]; 
5643            f != input_filename && f[0] != '/' && f[0] != DIR_SEPARATOR;
5644            f--)
5645         ;
5646       if (f[0] == '/' || f[0] == DIR_SEPARATOR)
5647         f++;
5648       if (strncmp (IDENTIFIER_POINTER (raw_name), 
5649                    f , IDENTIFIER_LENGTH (raw_name)) ||
5650           f [IDENTIFIER_LENGTH (raw_name)] != '.')
5651         parse_error_context
5652           (cl, "Public %s `%s' must be defined in a file called `%s.java'", 
5653                              (is_interface ? "interface" : "class"),
5654                              IDENTIFIER_POINTER (qualified_name),
5655                              IDENTIFIER_POINTER (raw_name));
5656     }
5657
5658   if (is_interface)
5659     check_modifiers ("Illegal modifier `%s' for interface declaration",
5660                      flags, INTERFACE_MODIFIERS);
5661   else
5662     check_modifiers ("Illegal modifier `%s' for class declaration",
5663                      flags, CLASS_MODIFIERS);
5664   return 0;
5665 }
5666
5667 /* If DECL is NULL, create and push a new DECL, record the current
5668    line CL and do other maintenance things.  */
5669
5670 static tree
5671 maybe_create_class_interface_decl (decl, qualified_name, cl)
5672      tree decl, qualified_name, cl;
5673 {
5674   if (!decl)
5675     decl = push_class (make_class (), qualified_name);
5676   
5677   /* Take care of the file and line business */
5678   DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
5679   /* If we're emiting xrefs, store the line/col number information */
5680   if (flag_emit_xref)
5681     DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl);
5682   else
5683     DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
5684   CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
5685   CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (TREE_TYPE (decl)) =
5686     IS_A_COMMAND_LINE_FILENAME_P (EXPR_WFL_FILENAME_NODE (cl));
5687
5688   ctxp->current_parsed_class = decl;
5689   
5690   /* Link the declaration to the already seen ones */
5691   TREE_CHAIN (decl) = ctxp->class_list;
5692   ctxp->class_list = decl;
5693
5694   /* Create a new nodes in the global lists */
5695   ctxp->gclass_list = tree_cons (NULL_TREE, decl, ctxp->gclass_list);
5696   all_class_list = tree_cons (NULL_TREE, decl, all_class_list);
5697
5698   /* Install a new dependency list element */
5699   create_jdep_list (ctxp);
5700
5701   SOURCE_FRONTEND_DEBUG (("Defining class/interface %s", 
5702                           IDENTIFIER_POINTER (qualified_name)));
5703   return decl;
5704 }
5705
5706 static void
5707 add_superinterfaces (decl, interface_list)
5708      tree decl, interface_list;
5709 {
5710   tree node;
5711   /* Superinterface(s): if present and defined, parser_check_super_interface ()
5712      takes care of ensuring that:
5713        - This is an accessible interface type,
5714        - Circularity detection.
5715    parser_add_interface is then called. If present but not defined,
5716    the check operation is delayed until the super interface gets
5717    defined.  */
5718   for (node = interface_list; node; node = TREE_CHAIN (node))
5719     {
5720       tree current = TREE_PURPOSE (node);
5721       tree idecl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current));
5722       if (idecl && CLASS_LOADED_P (TREE_TYPE (idecl)))
5723         {
5724           if (!parser_check_super_interface (idecl, decl, current))
5725             parser_add_interface (decl, idecl, current);
5726         }
5727       else
5728         register_incomplete_type (JDEP_INTERFACE,
5729                                   current, decl, NULL_TREE);
5730     }
5731 }
5732
5733 /* Create an interface in pass1 and return its decl. Return the
5734    interface's decl in pass 2.  */
5735
5736 static tree
5737 create_interface (flags, id, super)
5738      int flags;
5739      tree id, super;
5740 {
5741   tree raw_name = EXPR_WFL_NODE (id);
5742   tree q_name = parser_qualified_classname (id);
5743   tree decl = IDENTIFIER_CLASS_VALUE (q_name);
5744
5745   EXPR_WFL_NODE (id) = q_name;  /* Keep source location, even if refined. */
5746
5747   /* Basic checks: scope, redefinition, modifiers */ 
5748   if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
5749     return NULL_TREE;
5750
5751   /* Interface modifiers check
5752        - public/abstract allowed (already done at that point)
5753        - abstract is obsolete (comes first, it's a warning, or should be)
5754        - Can't use twice the same (checked in the modifier rule) */
5755   if ((flags & ACC_ABSTRACT) && flag_redundant)
5756     parse_warning_context 
5757       (MODIFIER_WFL (ABSTRACT_TK),
5758        "Redundant use of `abstract' modifier. Interface `%s' is implicitely abstract", IDENTIFIER_POINTER (raw_name));
5759
5760   /* Create a new decl if DECL is NULL, otherwise fix it */
5761   decl = maybe_create_class_interface_decl (decl, q_name, id);
5762
5763   /* Set super info and mark the class a complete */
5764   set_super_info (ACC_INTERFACE | flags, TREE_TYPE (decl), 
5765                   object_type_node, ctxp->interface_number);
5766   ctxp->interface_number = 0;
5767   CLASS_COMPLETE_P (decl) = 1;
5768   add_superinterfaces (decl, super);
5769
5770   return decl;
5771 }
5772
5773 /* Create an class in pass1 and return its decl. Return class
5774    interface's decl in pass 2.  */
5775
5776 static tree
5777 create_class (flags, id, super, interfaces)
5778      int flags;
5779      tree id, super, interfaces;
5780 {
5781   tree raw_name = EXPR_WFL_NODE (id);
5782   tree class_id, decl;
5783   tree super_decl_type;
5784
5785   class_id = parser_qualified_classname (id);
5786   decl = IDENTIFIER_CLASS_VALUE (class_id);
5787   ctxp->current_parsed_class_un = EXPR_WFL_NODE (id);
5788   EXPR_WFL_NODE (id) = class_id;
5789
5790   /* Basic check: scope, redefinition, modifiers */
5791   if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
5792     return NULL_TREE;
5793
5794   /* Class modifier check: 
5795        - Allowed modifier (already done at that point)
5796        - abstract AND final forbidden 
5797        - Public classes defined in the correct file */
5798   if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
5799     parse_error_context
5800       (id, "Class `%s' can't be declared both abstract and final",
5801        IDENTIFIER_POINTER (raw_name));
5802
5803   /* Create a new decl if DECL is NULL, otherwise fix it */
5804   decl = maybe_create_class_interface_decl (decl, class_id, id);
5805
5806   /* If SUPER exists, use it, otherwise use Object */
5807   if (super)
5808     {
5809       /* Can't extend java.lang.Object */
5810       if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
5811         {
5812           parse_error_context (id, "Can't extend `java.lang.Object'");
5813           return NULL_TREE;
5814         }
5815
5816       super_decl_type = 
5817         register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
5818     }
5819   else if (TREE_TYPE (decl) != object_type_node)
5820     super_decl_type = object_type_node;
5821   /* We're defining java.lang.Object */
5822   else
5823     super_decl_type = NULL_TREE;
5824
5825   /* Set super info and mark the class a complete */
5826   set_super_info (flags, TREE_TYPE (decl), super_decl_type, 
5827                   ctxp->interface_number);
5828   ctxp->interface_number = 0;
5829   CLASS_COMPLETE_P (decl) = 1;
5830   add_superinterfaces (decl, interfaces);
5831
5832   /* If doing xref, store the location at which the inherited class
5833      (if any) was seen. */
5834   if (flag_emit_xref && super)
5835     DECL_INHERITED_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (super);
5836
5837   /* Eventually sets the @deprecated tag flag */
5838   CHECK_DEPRECATED (decl);
5839
5840   return decl;
5841 }
5842
5843 /* Can't use lookup_field () since we don't want to load the class and
5844    can't set the CLASS_LOADED_P flag */
5845
5846 static tree
5847 find_field (class, name)
5848      tree class;
5849      tree name;
5850 {
5851   tree decl;
5852   for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
5853     {
5854       if (DECL_NAME (decl) == name)
5855         return decl;
5856     }
5857   return NULL_TREE;
5858 }
5859
5860 /* Wrap around lookup_field that doesn't potentially upset the value
5861    of CLASS */
5862
5863 static tree
5864 lookup_field_wrapper (class, name)
5865      tree class, name;
5866 {
5867   tree type = class;
5868   tree decl;
5869   java_parser_context_save_global ();
5870   decl = lookup_field (&type, name);
5871   java_parser_context_restore_global ();
5872   return decl == error_mark_node ? NULL : decl;
5873 }
5874
5875 /* Find duplicate field within the same class declarations and report
5876    the error. Returns 1 if a duplicated field was found, 0
5877    otherwise.  */
5878
5879 static int
5880 duplicate_declaration_error_p (new_field_name, new_type, cl)
5881      tree new_field_name, new_type, cl;
5882 {
5883   /* This might be modified to work with method decl as well */
5884   tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class), 
5885                           new_field_name);
5886   if (decl)
5887     {
5888       char *t1 = xstrdup (purify_type_name
5889                          ((TREE_CODE (new_type) == POINTER_TYPE 
5890                            && TREE_TYPE (new_type) == NULL_TREE) ?
5891                           IDENTIFIER_POINTER (TYPE_NAME (new_type)) :
5892                           lang_printable_name (new_type, 1)));
5893       /* The type may not have been completed by the time we report
5894          the error */
5895       char *t2 = xstrdup (purify_type_name
5896                          ((TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE 
5897                            && TREE_TYPE (TREE_TYPE (decl)) == NULL_TREE) ?
5898                           IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))) :
5899                           lang_printable_name (TREE_TYPE (decl), 1)));
5900       parse_error_context 
5901         (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", 
5902          t1, IDENTIFIER_POINTER (new_field_name),
5903          t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
5904          DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5905       free (t1);
5906       free (t2);
5907       return 1;
5908     }
5909   return 0;
5910 }
5911
5912 /* Field registration routine. If TYPE doesn't exist, field
5913    declarations are linked to the undefined TYPE dependency list, to
5914    be later resolved in java_complete_class () */
5915
5916 static void
5917 register_fields (flags, type, variable_list)
5918      int flags;
5919      tree type, variable_list;
5920 {
5921   tree current, saved_type;
5922   tree class_type = TREE_TYPE (ctxp->current_parsed_class);
5923   int saved_lineno = lineno;
5924   int must_chain = 0;
5925   tree wfl = NULL_TREE;
5926
5927   /* If we're adding fields to interfaces, those fields are public,
5928      static, final */
5929   if (CLASS_INTERFACE (TYPE_NAME (class_type)))
5930     {
5931       OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
5932                                  flags, ACC_PUBLIC, "interface field(s)");
5933       OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
5934                                  flags, ACC_STATIC, "interface field(s)");
5935       OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
5936                                  flags, ACC_FINAL, "interface field(s)");
5937       check_modifiers ("Illegal interface member modifier `%s'", flags,
5938                        INTERFACE_FIELD_MODIFIERS);
5939       flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
5940     }
5941
5942   /* Obtain a suitable type for resolution, if necessary */
5943   SET_TYPE_FOR_RESOLUTION (type, wfl, must_chain);
5944
5945   /* If TYPE is fully resolved and we don't have a reference, make one */
5946   PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5947
5948   for (current = variable_list, saved_type = type; current; 
5949        current = TREE_CHAIN (current), type = saved_type)
5950     {
5951       tree real_type;
5952       tree field_decl;
5953       tree cl = TREE_PURPOSE (current);
5954       tree init = TREE_VALUE (current);
5955       tree current_name = EXPR_WFL_NODE (cl);
5956
5957       /* Process NAME, as it may specify extra dimension(s) for it */
5958       type = build_array_from_name (type, wfl, current_name, &current_name);
5959
5960       /* Type adjustment. We may have just readjusted TYPE because
5961          the variable specified more dimensions. Make sure we have
5962          a reference if we can and don't have one already. Also
5963          change the name if we have an init. */
5964       if (type != saved_type)
5965         {
5966           PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
5967           if (init)
5968             EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = current_name;
5969         }
5970
5971       real_type = GET_REAL_TYPE (type);
5972       /* Check for redeclarations */
5973       if (duplicate_declaration_error_p (current_name, real_type, cl))
5974         continue;
5975
5976       /* Set lineno to the line the field was found and create a
5977          declaration for it. Eventually sets the @deprecated tag flag. */
5978       if (flag_emit_xref)
5979         lineno = EXPR_WFL_LINECOL (cl);
5980       else
5981         lineno = EXPR_WFL_LINENO (cl);
5982       field_decl = add_field (class_type, current_name, real_type, flags);
5983       CHECK_DEPRECATED (field_decl);
5984       
5985       /* Check if we must chain. */
5986       if (must_chain)
5987         register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
5988           
5989       /* If we have an initialization value tied to the field */
5990       if (init)
5991         {
5992           /* The field is declared static */
5993           if (flags & ACC_STATIC)
5994             {
5995               /* We include the field and its initialization part into
5996                  a list used to generate <clinit>. After <clinit> is
5997                  walked, field initializations will be processed and
5998                  fields initialized with known constants will be taken
5999                  out of <clinit> and have their DECL_INITIAL set
6000                  appropriately. */
6001               TREE_CHAIN (init) = ctxp->static_initialized;
6002               ctxp->static_initialized = init;
6003               if (TREE_OPERAND (init, 1) 
6004                   && TREE_CODE (TREE_OPERAND (init, 1)) == NEW_ARRAY_INIT)
6005                 TREE_STATIC (TREE_OPERAND (init, 1)) = 1;
6006             }
6007           /* A non-static field declared with an immediate initialization is
6008              to be initialized in <init>, if any.  This field is remembered
6009              to be processed at the time of the generation of <init>. */
6010           else
6011             {
6012               TREE_CHAIN (init) = ctxp->non_static_initialized;
6013               ctxp->non_static_initialized = init;
6014             }
6015           MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
6016           DECL_INITIAL (field_decl) = TREE_OPERAND (init, 1);
6017         }
6018     }
6019   lineno = saved_lineno;
6020 }
6021
6022 /* Generate the method $finit$ that initializes fields initialized
6023    upon declaration.  */
6024
6025 static void
6026 maybe_generate_finit ()
6027 {
6028   tree mdecl, current;
6029   
6030   if (!ctxp->non_static_initialized || java_error_count)
6031     return;
6032
6033   mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
6034                                     ACC_PRIVATE, void_type_node,
6035                                     finit_identifier_node, end_params_node);
6036   start_artificial_method_body (mdecl);
6037
6038   ctxp->non_static_initialized = nreverse (ctxp->non_static_initialized);
6039   for (current = ctxp->non_static_initialized; current;
6040        current = TREE_CHAIN (current))
6041     java_method_add_stmt (mdecl, 
6042                           build_debugable_stmt (EXPR_WFL_LINECOL (current), 
6043                                                 current));
6044
6045   end_artificial_method_body (mdecl);
6046   CLASS_HAS_FINIT_P (TREE_TYPE (ctxp->current_parsed_class)) = 1;
6047   ctxp->non_static_initialized = NULL_TREE;
6048 }
6049
6050 /* Check whether it is necessary to generate a <clinit> for the class
6051    we just parsed. */
6052
6053 static void
6054 maybe_generate_clinit ()
6055 {
6056   tree mdecl, c;
6057
6058   if (!ctxp->static_initialized || java_error_count)
6059     return;
6060
6061   mdecl = create_artificial_method (TREE_TYPE (ctxp->current_parsed_class),
6062                                     ACC_STATIC, void_type_node,
6063                                     clinit_identifier_node, end_params_node);
6064   start_artificial_method_body (mdecl);
6065
6066   /* Keep initialization in order to enforce 8.5 */
6067   ctxp->static_initialized = nreverse (ctxp->static_initialized);
6068
6069   /* We process the list of assignment we produced as the result of
6070      the declaration of initialized static field and add them as
6071      statement to the <clinit> method. */
6072   for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
6073     {
6074       /* We build the assignment expression that will initialize the
6075          field to its value. There are strict rules on static
6076          initializers (8.5). FIXME */
6077       java_method_add_stmt (mdecl, 
6078                             build_debugable_stmt (EXPR_WFL_LINECOL (c), c));
6079     }
6080
6081   end_artificial_method_body (mdecl);
6082   ctxp->static_initialized = NULL_TREE;
6083 }
6084
6085 /* Shared accros method_declarator and method_header to remember the
6086    patch stage that was reached during the declaration of the method.
6087    A method DECL is built differently is there is no patch
6088    (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
6089    pending on the currently defined method.  */
6090
6091 static int patch_stage;
6092
6093 /* Check the method declaration and add the method to its current
6094    class.  If the argument list is known to contain incomplete types,
6095    the method is partially added and the registration will be resume
6096    once the method arguments resolved. If TYPE is NULL, we're dealing
6097    with a constructor.  */
6098
6099 static tree
6100 method_header (flags, type, mdecl, throws)
6101      int flags;
6102      tree type, mdecl, throws;
6103 {
6104   tree meth = TREE_VALUE (mdecl);
6105   tree id = TREE_PURPOSE (mdecl);
6106   tree type_wfl = NULL_TREE;
6107   tree meth_name = NULL_TREE;
6108   tree current, orig_arg, this_class;
6109   int saved_lineno;
6110   int constructor_ok = 0, must_chain;
6111   
6112   check_modifiers_consistency (flags);
6113
6114   if (ctxp->current_parsed_class)
6115     this_class = TREE_TYPE (ctxp->current_parsed_class);
6116   else
6117     return NULL_TREE;
6118   
6119   /* There are some forbidden modifiers for an abstract method and its
6120      class must be abstract as well.  */
6121   if (type && (flags & ACC_ABSTRACT))
6122     {
6123       ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
6124       ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
6125       ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
6126       ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
6127       ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
6128       if (!CLASS_ABSTRACT (TYPE_NAME (this_class))
6129           && !CLASS_INTERFACE (TYPE_NAME (this_class)))
6130         parse_error_context 
6131           (id, "Class `%s' must be declared abstract to define abstract method `%s'", 
6132            IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
6133            IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
6134     }
6135   /* Things to be checked when declaring a constructor */
6136   if (!type)
6137     {
6138       int ec = java_error_count;
6139       /* 8.6: Constructor declarations: we might be trying to define a
6140          method without specifying a return type. */
6141       if (EXPR_WFL_NODE (id) != ctxp->current_parsed_class_un)
6142         parse_error_context 
6143           (id, "Invalid method declaration, return type required");
6144       /* 8.6.3: Constructor modifiers */
6145       else
6146         {
6147           JCONSTRUCTOR_CHECK (flags, ACC_ABSTRACT, id, "abstract");
6148           JCONSTRUCTOR_CHECK (flags, ACC_STATIC, id, "static");
6149           JCONSTRUCTOR_CHECK (flags, ACC_FINAL, id, "final");
6150           JCONSTRUCTOR_CHECK (flags, ACC_NATIVE, id, "native");
6151           JCONSTRUCTOR_CHECK (flags, ACC_SYNCHRONIZED, id, "synchronized");
6152         }
6153       /* If we found error here, we don't consider it's OK to tread
6154          the method definition as a constructor, for the rest of this
6155          function */
6156       if (ec == java_error_count)
6157         constructor_ok = 1;
6158     }
6159
6160   /* Method declared within the scope of an interface are implicitly
6161      abstract and public. Conflicts with other erroneously provided
6162      modifiers are checked right after. */
6163
6164   if (CLASS_INTERFACE (TYPE_NAME (this_class)))
6165     {
6166       /* If FLAGS isn't set because of a modifier, turn the
6167          corresponding modifier WFL to NULL so we issue a warning on
6168          the obsolete use of the modifier */
6169       if (!(flags & ACC_PUBLIC))
6170         MODIFIER_WFL (PUBLIC_TK) = NULL;
6171       if (!(flags & ACC_ABSTRACT))
6172         MODIFIER_WFL (ABSTRACT_TK) = NULL;
6173       flags |= ACC_PUBLIC;
6174       flags |= ACC_ABSTRACT;
6175     }
6176
6177   /* Modifiers context reset moved up, so abstract method declaration
6178      modifiers can be later checked.  */
6179
6180   /* Set constructor returned type to void and method name to <init>,
6181      unless we found an error identifier the constructor (in which
6182      case we retain the original name) */
6183   if (!type)
6184     {
6185       type = void_type_node;
6186       if (constructor_ok)
6187         meth_name = init_identifier_node;
6188     }
6189   else
6190     meth_name = EXPR_WFL_NODE (id);
6191
6192   /* Do the returned type resolution and registration if necessary */
6193   SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
6194
6195   if (meth_name)
6196     type = build_array_from_name (type, type_wfl, meth_name, &meth_name);
6197   EXPR_WFL_NODE (id) = meth_name;
6198   PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
6199
6200   if (must_chain)
6201     {
6202       patch_stage = JDEP_METHOD_RETURN;
6203       register_incomplete_type (patch_stage, type_wfl, id, type);
6204       TREE_TYPE (meth) = GET_REAL_TYPE (type);
6205     }
6206   else
6207     TREE_TYPE (meth) = type;
6208
6209   saved_lineno = lineno;
6210   /* When defining an abstract or interface method, the curly
6211      bracket at level 1 doesn't exist because there is no function
6212      body */
6213   lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 : 
6214             EXPR_WFL_LINENO (id));
6215
6216   /* Remember the original argument list */
6217   orig_arg = TYPE_ARG_TYPES (meth);
6218
6219   if (patch_stage)              /* includes ret type and/or all args */
6220     {
6221       jdep *jdep;
6222       meth = add_method_1 (this_class, flags, meth_name, meth);
6223       /* Patch for the return type */
6224       if (patch_stage == JDEP_METHOD_RETURN)
6225         {
6226           jdep = CLASSD_LAST (ctxp->classd_list);
6227           JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
6228         }
6229       /* This is the stop JDEP. METH allows the function's signature
6230          to be computed. */
6231       register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
6232     }
6233   else
6234     meth = add_method (this_class, flags, meth_name, 
6235                        build_java_signature (meth));
6236
6237   /* Fix the method argument list so we have the argument name
6238      information */
6239   fix_method_argument_names (orig_arg, meth);
6240
6241   /* Register the parameter number and re-install the current line
6242      number */
6243   DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
6244   lineno = saved_lineno;
6245
6246   /* Register exception specified by the `throws' keyword for
6247      resolution and set the method decl appropriate field to the list.
6248      Note: the grammar ensures that what we get here are class
6249      types. */
6250   if (throws)
6251     {
6252       throws = nreverse (throws);
6253       for (current = throws; current; current = TREE_CHAIN (current))
6254         {
6255           register_incomplete_type (JDEP_EXCEPTION, TREE_VALUE (current),
6256                                     NULL_TREE, NULL_TREE);
6257           JDEP_GET_PATCH (CLASSD_LAST (ctxp->classd_list)) = 
6258             &TREE_VALUE (current);
6259         }
6260       DECL_FUNCTION_THROWS (meth) = throws;
6261     }
6262
6263   /* We set the DECL_NAME to ID so we can track the location where
6264      the function was declared. This allow us to report
6265      redefinition error accurately. When method are verified,
6266      DECL_NAME is reinstalled properly (using the content of the
6267      WFL node ID) (see check_method_redefinition). We don't do that
6268      when Object is being defined. Constructor <init> names will be
6269      reinstalled the same way. */
6270   if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
6271     DECL_NAME (meth) = id;
6272
6273   /* Set the flag if we correctly processed a constructor */
6274   if (constructor_ok)
6275     DECL_CONSTRUCTOR_P (meth) = 1;
6276
6277   /* Eventually set the @deprecated tag flag */
6278   CHECK_DEPRECATED (meth);
6279
6280   /* If doing xref, store column and line number information instead
6281      of the line number only. */
6282   if (flag_emit_xref)
6283     DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id);
6284
6285   return meth;
6286 }
6287
6288 static void
6289 fix_method_argument_names (orig_arg, meth)
6290     tree orig_arg, meth;
6291 {
6292   tree arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
6293   if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
6294     {
6295       TREE_PURPOSE (arg) = this_identifier_node;
6296       arg = TREE_CHAIN (arg);
6297     }
6298   while (orig_arg != end_params_node)
6299     {
6300       TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
6301       orig_arg = TREE_CHAIN (orig_arg);
6302       arg = TREE_CHAIN (arg);
6303     }
6304 }
6305
6306 /* Complete the method declaration with METHOD_BODY.  */
6307
6308 static void
6309 finish_method_declaration (method_body)
6310      tree method_body;
6311 {
6312   int flags;
6313
6314   if (!current_function_decl)
6315     return;
6316
6317   flags = get_access_flags_from_decl (current_function_decl);
6318
6319   /* 8.4.5 Method Body */
6320   if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
6321     {
6322       tree wfl = DECL_NAME (current_function_decl);
6323       parse_error_context (wfl, 
6324                            "%s method `%s' can't have a body defined",
6325                            (METHOD_NATIVE (current_function_decl) ?
6326                             "Native" : "Abstract"),
6327                            IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
6328       method_body = NULL_TREE;
6329     }
6330   else if (!(flags & ACC_ABSTRACT) && !(flags & ACC_NATIVE) && !method_body)
6331     {
6332       tree wfl = DECL_NAME (current_function_decl);
6333       parse_error_context
6334         (wfl, 
6335          "Non native and non abstract method `%s' must have a body defined",
6336          IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
6337       method_body = NULL_TREE;
6338     }
6339
6340   if (flag_emit_class_files && method_body 
6341       && TREE_CODE (method_body) == NOP_EXPR 
6342       && TREE_TYPE (current_function_decl) 
6343       && TREE_TYPE (TREE_TYPE (current_function_decl)) == void_type_node)
6344     method_body = build1 (RETURN_EXPR, void_type_node, NULL);
6345     
6346   BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)) = method_body;
6347   maybe_absorb_scoping_blocks ();
6348   /* Exit function's body */
6349   exit_block ();
6350   /* Merge last line of the function with first line, directly in the
6351      function decl. It will be used to emit correct debug info. */
6352   if (!flag_emit_xref)
6353     DECL_SOURCE_LINE_MERGE (current_function_decl, ctxp->last_ccb_indent1);
6354   /* So we don't have an irrelevant function declaration context for
6355      the next static block we'll see. */
6356   current_function_decl = NULL_TREE;
6357 }
6358
6359 /* Build a an error message for constructor circularity errors.  */
6360
6361 static char *
6362 constructor_circularity_msg (from, to)
6363      tree from, to;
6364 {
6365   static char string [4096];
6366   char *t = xstrdup (lang_printable_name (from, 0));
6367   sprintf (string, "`%s' invokes `%s'", t, lang_printable_name (to, 0));
6368   free (t);
6369   return string;
6370 }
6371
6372 /* Verify a circular call to METH. Return 1 if an error is found, 0
6373    otherwise.  */
6374
6375 static int
6376 verify_constructor_circularity (meth, current)
6377      tree meth, current;
6378 {
6379   static tree list = NULL_TREE;
6380   tree c;
6381   for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6382     {
6383       if (TREE_VALUE (c) == meth)
6384         {
6385           char *t;
6386           if (list)
6387             {
6388               tree liste;
6389               list = nreverse (list);
6390               for (liste = list; liste; liste = TREE_CHAIN (liste))
6391                 {
6392                   parse_error_context 
6393                     (TREE_PURPOSE (TREE_PURPOSE (liste)), "%s",
6394                      constructor_circularity_msg
6395                       (TREE_VALUE (liste), TREE_VALUE (TREE_PURPOSE (liste)))); 
6396                   java_error_count--;
6397                 }
6398             }
6399           t = xstrdup (lang_printable_name (meth, 0));
6400           parse_error_context (TREE_PURPOSE (c), 
6401                                "%s: recursive invocation of constructor `%s'",
6402                                constructor_circularity_msg (current, meth), t);
6403           free (t);
6404           list = NULL_TREE;
6405           return 1;
6406         }
6407     }
6408   for (c = DECL_CONSTRUCTOR_CALLS (current); c; c = TREE_CHAIN (c))
6409     {
6410       list = tree_cons (c, current, list);
6411       if (verify_constructor_circularity (meth, TREE_VALUE (c)))
6412         return 1;
6413       list = TREE_CHAIN (list);
6414     }
6415   return 0;
6416 }
6417
6418 /* Check modifiers that can be declared but exclusively */
6419
6420 static void
6421 check_modifiers_consistency (flags)
6422      int flags;
6423 {
6424   int acc_count = 0;
6425   tree cl = NULL_TREE;
6426
6427   THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
6428   THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
6429   THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
6430   if (acc_count > 1)
6431     parse_error_context
6432       (cl, "Inconsistent member declaration. At most one of `public', `private', or `protected' may be specified");
6433 }
6434
6435 /* Check the methode header METH for abstract specifics features */
6436
6437 static void
6438 check_abstract_method_header (meth)
6439      tree meth;
6440 {
6441   int flags = get_access_flags_from_decl (meth);
6442   /* DECL_NAME might still be a WFL node */
6443   tree name = GET_METHOD_NAME (meth);
6444
6445   OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (ABSTRACT_TK), flags,
6446                               ACC_ABSTRACT, "abstract method",
6447                               IDENTIFIER_POINTER (name));
6448   OBSOLETE_MODIFIER_WARNING2 (MODIFIER_WFL (PUBLIC_TK), flags, 
6449                               ACC_PUBLIC, "abstract method",
6450                               IDENTIFIER_POINTER (name));
6451
6452   check_modifiers ("Illegal modifier `%s' for interface method",
6453                   flags, INTERFACE_METHOD_MODIFIERS);
6454 }
6455
6456 /* Create a FUNCTION_TYPE node and start augmenting it with the
6457    declared function arguments. Arguments type that can't be resolved
6458    are left as they are, but the returned node is marked as containing
6459    incomplete types.  */
6460
6461 static tree
6462 method_declarator (id, list)
6463      tree id, list;
6464 {
6465   tree arg_types = NULL_TREE, current, node;
6466   tree meth = make_node (FUNCTION_TYPE);
6467   jdep *jdep;
6468
6469   patch_stage = JDEP_NO_PATCH;
6470   
6471   for (current = list; current; current = TREE_CHAIN (current))
6472     {
6473       int must_chain = 0;
6474       tree wfl_name = TREE_PURPOSE (current);
6475       tree type = TREE_VALUE (current);
6476       tree name = EXPR_WFL_NODE (wfl_name);
6477       tree already, arg_node;
6478       tree type_wfl = NULL_TREE;
6479       tree real_type;
6480
6481       /* Obtain a suitable type for resolution, if necessary */
6482       SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
6483
6484       /* Process NAME, as it may specify extra dimension(s) for it */
6485       type = build_array_from_name (type, type_wfl, name, &name);
6486       EXPR_WFL_NODE (wfl_name) = name;
6487
6488       real_type = GET_REAL_TYPE (type);
6489       if (TREE_CODE (real_type) == RECORD_TYPE)
6490         {
6491           real_type = promote_type (real_type);
6492           if (TREE_CODE (type) == TREE_LIST)
6493             TREE_PURPOSE (type) = real_type;
6494         }
6495
6496       /* Check redefinition */
6497       for (already = arg_types; already; already = TREE_CHAIN (already))
6498         if (TREE_PURPOSE (already) == name)
6499           {
6500             parse_error_context
6501               (wfl_name, "Variable `%s' is used more than once in the argument list of method `%s'",
6502                IDENTIFIER_POINTER (name),
6503                IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
6504             break;
6505           }
6506
6507       /* If we've an incomplete argument type, we know there is a location
6508          to patch when the type get resolved, later.  */
6509       jdep = NULL;
6510       if (must_chain)
6511         {
6512           patch_stage = JDEP_METHOD;
6513           type = register_incomplete_type (patch_stage, 
6514                                            type_wfl, wfl_name, type);
6515           jdep = CLASSD_LAST (ctxp->classd_list);
6516           JDEP_MISC (jdep) = id;
6517         }
6518
6519       /* The argument node: a name and a (possibly) incomplete type */
6520       arg_node = build_tree_list (name, real_type);
6521       if (jdep)
6522         JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
6523       TREE_CHAIN (arg_node) = arg_types;
6524       arg_types = arg_node;
6525     }
6526   TYPE_ARG_TYPES (meth) = chainon (nreverse (arg_types), end_params_node);
6527   node = build_tree_list (id, meth);
6528   return node;
6529 }
6530
6531 static int
6532 unresolved_type_p (wfl, returned)
6533      tree wfl;
6534      tree *returned;
6535      
6536 {
6537   if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
6538     {
6539       tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
6540       if (returned)
6541         *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
6542       return 1;
6543     }
6544   if (returned)
6545     *returned = wfl;
6546   return 0;
6547 }
6548
6549 /* From NAME, build a qualified identifier node using the
6550    qualification from the current package definition. */
6551
6552 static tree
6553 parser_qualified_classname (name)
6554      tree name;
6555 {
6556   if (ctxp->package)
6557     return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
6558   else 
6559     return EXPR_WFL_NODE (name);
6560 }
6561
6562 /* Called once the type a interface extends is resolved. Returns 0 if
6563    everything is OK.  */
6564
6565 static int
6566 parser_check_super_interface (super_decl, this_decl, this_wfl)
6567      tree super_decl, this_decl, this_wfl;
6568 {
6569   tree super_type = TREE_TYPE (super_decl);
6570
6571   /* Has to be an interface */
6572   if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
6573     {
6574       parse_error_context 
6575         (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
6576          (TYPE_ARRAY_P (super_type) ? "array" : "class"),
6577          IDENTIFIER_POINTER (DECL_NAME (super_decl)),
6578          (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ? 
6579           "interface" : "class"),
6580          IDENTIFIER_POINTER (DECL_NAME (this_decl)));
6581       return 1;
6582     }
6583
6584   /* Check scope: same package OK, other package: OK if public */
6585   if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
6586     return 1;
6587
6588   SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
6589                           IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6590                           IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6591   return 0;
6592 }
6593
6594 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
6595    0 if everthing is OK.  */
6596
6597 static int
6598 parser_check_super (super_decl, this_decl, wfl)
6599      tree super_decl, this_decl, wfl;
6600 {
6601   tree super_type = TREE_TYPE (super_decl);
6602
6603   /* SUPER should be a CLASS (neither an array nor an interface) */
6604   if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
6605     {
6606       parse_error_context 
6607         (wfl, "Class `%s' can't subclass %s `%s'",
6608          IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6609          (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
6610          IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6611       return 1;
6612     }
6613
6614   if (CLASS_FINAL (TYPE_NAME (super_type)))
6615     {
6616       parse_error_context (wfl, "Can't subclass final classes: %s",
6617                            IDENTIFIER_POINTER (DECL_NAME (super_decl)));
6618       return 1;
6619     }
6620
6621   /* Check scope: same package OK, other package: OK if public */
6622   if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
6623     return 1;
6624   
6625   SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
6626                           IDENTIFIER_POINTER (DECL_NAME (this_decl)),
6627                           IDENTIFIER_POINTER (DECL_NAME (super_decl))));
6628   return 0;
6629 }
6630
6631 /* Create a new dependency list and link it (in a LIFO manner) to the
6632    CTXP list of type dependency list.  */
6633
6634 static void
6635 create_jdep_list (ctxp)
6636      struct parser_ctxt *ctxp;
6637 {
6638   jdeplist *new = (jdeplist *)xmalloc (sizeof (jdeplist));      
6639   new->first = new->last = NULL;
6640   new->next = ctxp->classd_list;
6641   ctxp->classd_list = new;
6642 }
6643
6644 static jdeplist *
6645 reverse_jdep_list (ctxp)
6646      struct parser_ctxt *ctxp;
6647 {
6648   register jdeplist *prev = NULL, *current, *next;
6649   for (current = ctxp->classd_list; current; current = next)
6650     {
6651       next = current->next;
6652       current->next = prev;
6653       prev = current;
6654     }
6655   return prev;
6656 }
6657
6658 /* Create a fake pointer based on the ID stored in
6659    TYPE_NAME. TYPE_NAME can be a WFL or a incomplete type asking to be
6660    registered again. */
6661
6662 static tree
6663 obtain_incomplete_type (type_name)
6664      tree type_name;
6665 {
6666   tree ptr, name;
6667
6668   if (TREE_CODE (type_name) == EXPR_WITH_FILE_LOCATION)
6669     name = EXPR_WFL_NODE (type_name);
6670   else if (INCOMPLETE_TYPE_P (type_name))
6671     name = TYPE_NAME (type_name);
6672   else
6673     fatal ("invalid type name - obtain_incomplete_type");
6674
6675   for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
6676     if (TYPE_NAME (ptr) == name)
6677       break;
6678
6679   if (!ptr)
6680     {
6681       push_obstacks (&permanent_obstack, &permanent_obstack);
6682       BUILD_PTR_FROM_NAME (ptr, name);
6683       layout_type (ptr);
6684       pop_obstacks ();
6685       TREE_CHAIN (ptr) = ctxp->incomplete_class;
6686       ctxp->incomplete_class = ptr;
6687     }
6688
6689   return ptr;
6690 }
6691
6692 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
6693    non NULL instead of computing a new fake type based on WFL. The new
6694    dependency is inserted in the current type dependency list, in FIFO
6695    manner.  */
6696
6697 static tree
6698 register_incomplete_type (kind, wfl, decl, ptr)
6699      int kind;
6700      tree wfl, decl, ptr;
6701 {
6702   jdep *new = (jdep *)xmalloc (sizeof (jdep));
6703
6704   if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
6705     ptr = obtain_incomplete_type (wfl);
6706
6707   JDEP_KIND (new) = kind;
6708   JDEP_DECL (new) = decl;
6709   JDEP_SOLV (new) = ptr;
6710   JDEP_WFL (new) = wfl;
6711   JDEP_CHAIN (new) = NULL;
6712   JDEP_MISC (new) = NULL_TREE;
6713   JDEP_GET_PATCH (new) = (tree *)NULL;
6714
6715   JDEP_INSERT (ctxp->classd_list, new);
6716
6717   return ptr;
6718 }
6719
6720 void
6721 java_check_circular_reference ()
6722 {
6723   tree current;
6724   for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6725     {
6726       tree type = TREE_TYPE (current);
6727       if (CLASS_INTERFACE (current))
6728         {
6729           /* Check all interfaces this class extends */
6730           tree basetype_vec = TYPE_BINFO_BASETYPES (type);
6731           int n, i;
6732
6733           if (!basetype_vec)
6734             return;
6735           n = TREE_VEC_LENGTH (basetype_vec);
6736           for (i = 0; i < n; i++)
6737             {
6738               tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
6739               if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node 
6740                   && interface_of_p (type, BINFO_TYPE (vec_elt)))
6741                 parse_error_context (lookup_cl (current),
6742                                      "Cyclic interface inheritance");
6743             }
6744         }
6745       else
6746         if (inherits_from_p (CLASSTYPE_SUPER (type), type))
6747           parse_error_context (lookup_cl (current), 
6748                                "Cyclic class inheritance");
6749     }
6750 }
6751
6752 /* Fix the constructors. This will be called right after circular
6753    references have been checked. It is necessary to fix constructors
6754    early even if no code generation will take place for that class:
6755    some generated constructor might be required by the class whose
6756    compilation triggered this one to be simply loaded.  */
6757
6758 void
6759 java_fix_constructors ()
6760 {
6761   tree current;
6762
6763   for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6764     {
6765       tree decl;
6766       tree class_type = TREE_TYPE (current);
6767       int saw_ctor = 0;
6768
6769       for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
6770         {
6771           if (DECL_CONSTRUCTOR_P (decl))
6772             {
6773               fix_constructors (decl);
6774               saw_ctor = 1;
6775             }
6776         }
6777
6778       if (!saw_ctor)
6779         {
6780           int flags = (get_access_flags_from_decl (current) & ACC_PUBLIC ?
6781                        ACC_PUBLIC : 0);
6782           decl = create_artificial_method (class_type, flags, void_type_node, 
6783                                            init_identifier_node, 
6784                                            end_params_node);
6785           DECL_CONSTRUCTOR_P (decl) = 1;
6786         }
6787     }
6788 }
6789
6790 /* safe_layout_class just makes sure that we can load a class without
6791    disrupting the current_class, input_file, lineno, etc, information
6792    about the class processed currently.  */
6793
6794 void
6795 safe_layout_class (class)
6796      tree class;
6797 {
6798   tree save_current_class = current_class;
6799   char *save_input_filename = input_filename;
6800   int save_lineno = lineno;
6801
6802   push_obstacks (&permanent_obstack, &permanent_obstack);
6803
6804   layout_class (class);
6805   pop_obstacks ();
6806
6807   current_class = save_current_class;
6808   input_filename = save_input_filename;
6809   lineno = save_lineno;
6810   CLASS_LOADED_P (class) = 1;
6811 }
6812
6813 static tree
6814 jdep_resolve_class (dep)
6815      jdep *dep;
6816 {
6817   tree decl;
6818
6819   if (JDEP_RESOLVED_P (dep))
6820     decl = JDEP_RESOLVED_DECL (dep);
6821   else
6822     {
6823       decl = resolve_class (JDEP_TO_RESOLVE (dep), 
6824                             JDEP_DECL (dep), JDEP_WFL (dep));
6825       JDEP_RESOLVED (dep, decl);
6826     }
6827     
6828   if (!decl)
6829     complete_class_report_errors (dep);
6830
6831   return decl;
6832 }
6833
6834 /* Complete unsatisfied class declaration and their dependencies */
6835
6836 void
6837 java_complete_class ()
6838 {
6839   tree cclass;
6840   jdeplist *cclassd;
6841   int error_found;
6842   tree type;
6843
6844   push_obstacks (&permanent_obstack, &permanent_obstack);
6845
6846   /* Process imports and reverse the import on demand list */
6847   process_imports ();
6848   if (ctxp->import_demand_list)
6849     ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
6850
6851   /* Rever things so we have the right order */
6852   ctxp->class_list = nreverse (ctxp->class_list);
6853   ctxp->classd_list = reverse_jdep_list (ctxp);
6854
6855   for (cclassd = ctxp->classd_list, cclass = ctxp->class_list; 
6856        cclass && cclassd; 
6857        cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
6858     {
6859       jdep *dep;
6860       for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
6861         {
6862           tree decl;
6863           if (!(decl = jdep_resolve_class (dep)))
6864             continue;
6865
6866           /* Now it's time to patch */
6867           switch (JDEP_KIND (dep))
6868             {
6869             case JDEP_SUPER:
6870               /* Simply patch super */
6871               if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
6872                 continue;
6873               BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO 
6874                 (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
6875               break;
6876
6877             case JDEP_FIELD:
6878               {
6879                 /* We do part of the job done in add_field */
6880                 tree field_decl = JDEP_DECL (dep);
6881                 tree field_type = TREE_TYPE (decl);
6882                 push_obstacks (&permanent_obstack, &permanent_obstack);
6883                 if (TREE_CODE (field_type) == RECORD_TYPE)
6884                   field_type = promote_type (field_type);
6885                 pop_obstacks ();
6886                 TREE_TYPE (field_decl) = field_type;
6887                 DECL_ALIGN (field_decl) = 0;
6888                 layout_decl (field_decl, 0);
6889                 SOURCE_FRONTEND_DEBUG 
6890                   (("Completed field/var decl `%s' with `%s'",
6891                     IDENTIFIER_POINTER (DECL_NAME (field_decl)),
6892                     IDENTIFIER_POINTER (DECL_NAME (decl))));
6893                 break;
6894               }
6895             case JDEP_METHOD:   /* We start patching a method */
6896             case JDEP_METHOD_RETURN:
6897               error_found = 0;
6898               while (1)
6899                 {
6900                   if (decl)
6901                     {
6902                       type = TREE_TYPE(decl);
6903                       if (TREE_CODE (type) == RECORD_TYPE)
6904                         type = promote_type (type);
6905                       JDEP_APPLY_PATCH (dep, type);
6906                       SOURCE_FRONTEND_DEBUG 
6907                         (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
6908                            "Completing fct `%s' with ret type `%s'":
6909                            "Completing arg `%s' with type `%s'"),
6910                           IDENTIFIER_POINTER (EXPR_WFL_NODE 
6911                                               (JDEP_DECL_WFL (dep))),
6912                           IDENTIFIER_POINTER (DECL_NAME (decl))));
6913                     }
6914                   else
6915                     error_found = 1;
6916                   dep = JDEP_CHAIN (dep);
6917                   if (JDEP_KIND (dep) == JDEP_METHOD_END)
6918                     break;
6919                   else
6920                     decl = jdep_resolve_class (dep);
6921                 }
6922               if (!error_found)
6923                 {
6924                   tree mdecl = JDEP_DECL (dep), signature;
6925                   push_obstacks (&permanent_obstack, &permanent_obstack);
6926                   /* Recompute and reset the signature */
6927                   signature = build_java_signature (TREE_TYPE (mdecl));
6928                   set_java_signature (TREE_TYPE (mdecl), signature);
6929                   pop_obstacks ();
6930                 }
6931               else
6932                 continue;
6933               break;
6934
6935             case JDEP_INTERFACE:
6936               if (parser_check_super_interface (decl, JDEP_DECL (dep),
6937                                                 JDEP_WFL (dep)))
6938                 continue;
6939               parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
6940               break;
6941
6942             case JDEP_PARM:
6943             case JDEP_VARIABLE:
6944               type = TREE_TYPE(decl);
6945               if (TREE_CODE (type) == RECORD_TYPE)
6946                 type = promote_type (type);
6947               JDEP_APPLY_PATCH (dep, type);
6948               break;
6949
6950             case JDEP_TYPE:
6951               JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6952               SOURCE_FRONTEND_DEBUG 
6953                 (("Completing a random type dependency on a '%s' node",
6954                   tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
6955               break;
6956
6957             case JDEP_EXCEPTION:
6958               JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
6959               SOURCE_FRONTEND_DEBUG 
6960                 (("Completing `%s' `throws' argument node",
6961                   IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))));
6962               break;
6963
6964             default:
6965               fatal ("Can't handle patch code %d - java_complete_class",
6966                      JDEP_KIND (dep));
6967             }
6968         }
6969     }
6970   pop_obstacks ();
6971   return;
6972 }
6973
6974 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
6975    array.  */
6976
6977 static tree
6978 resolve_class (class_type, decl, cl)
6979      tree class_type, decl, cl;
6980 {
6981   const char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
6982   const char *base = name;
6983   tree resolved_type = TREE_TYPE (class_type);
6984   tree resolved_type_decl;
6985   
6986   if (resolved_type != NULL_TREE)
6987     {
6988       tree resolved_type_decl = TYPE_NAME (resolved_type);
6989       if (resolved_type_decl == NULL_TREE
6990           || TREE_CODE (resolved_type_decl) == IDENTIFIER_NODE)
6991         {
6992           resolved_type_decl = build_decl (TYPE_DECL,
6993                                            TYPE_NAME (class_type),
6994                                            resolved_type);
6995         }
6996       return resolved_type_decl;
6997     }
6998
6999   /* 1- Check to see if we have an array. If true, find what we really
7000      want to resolve  */
7001   while (name[0] == '[')
7002     name++;
7003   if (base != name)
7004     TYPE_NAME (class_type) = get_identifier (name);
7005
7006   /* 2- Resolve the bare type */
7007   if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
7008     return NULL_TREE;
7009   resolved_type = TREE_TYPE (resolved_type_decl);
7010
7011   /* 3- If we have and array, reconstruct the array down to its nesting */
7012   if (base != name)
7013     {
7014       while (base != name)
7015         {
7016           if (TREE_CODE (resolved_type) == RECORD_TYPE)
7017             resolved_type  = promote_type (resolved_type);
7018           resolved_type = build_java_array_type (resolved_type, -1);
7019           CLASS_LOADED_P (resolved_type) = 1;
7020           name--;
7021         }
7022       /* Build a fake decl for this, since this is what is expected to
7023          be returned.  */
7024       resolved_type_decl =
7025         build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
7026       /* Figure how those two things are important for error report. FIXME */
7027       DECL_SOURCE_LINE (resolved_type_decl) = 0;
7028       DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
7029       TYPE_NAME (class_type) = TYPE_NAME (resolved_type);
7030     }
7031   TREE_TYPE (class_type) = resolved_type;
7032   return resolved_type_decl;
7033 }
7034
7035 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
7036    are used to report error messages.  */
7037
7038 tree
7039 do_resolve_class (class_type, decl, cl)
7040      tree class_type;
7041      tree decl;
7042      tree cl;
7043 {
7044   tree new_class_decl;
7045   tree original_name = NULL_TREE;
7046
7047   /* Do not try to replace TYPE_NAME (class_type) by a variable, since
7048      its is changed by find_in_imports{_on_demand} */
7049
7050   /* 1- Check for the type in single imports */
7051   if (find_in_imports (class_type))
7052     return NULL_TREE;
7053
7054   /* 2- And check for the type in the current compilation unit. If it fails,
7055      try with a name qualified with the package name we've seen so far */
7056   if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
7057     {
7058       if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
7059           !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
7060         load_class (TYPE_NAME (class_type), 0);
7061       return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7062     }
7063
7064   original_name = TYPE_NAME (class_type);
7065   if (!QUALIFIED_P (TYPE_NAME (class_type)))
7066     {
7067       tree package;
7068       for (package = package_list; package; package = TREE_CHAIN (package))
7069         {
7070           tree new_qualified;
7071           
7072           new_qualified = merge_qualified_name (TREE_PURPOSE (package),
7073                                                 original_name);
7074           TYPE_NAME (class_type) = new_qualified;
7075           new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7076           if (!new_class_decl)
7077             load_class (TYPE_NAME (class_type), 0);
7078           new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7079           if (new_class_decl)
7080             {
7081               if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
7082                   !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
7083                 load_class (TYPE_NAME (class_type), 0);
7084               return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7085             }
7086         }
7087     }
7088   TYPE_NAME (class_type) = original_name;
7089
7090   /* 3- Check an other compilation unit that bears the name of type */
7091   load_class (TYPE_NAME (class_type), 0);
7092   if (check_pkg_class_access (TYPE_NAME (class_type), 
7093                               (cl ? cl : lookup_cl (decl))))
7094     return NULL_TREE;
7095
7096   if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
7097     return new_class_decl;
7098
7099   /* 4- Check the import on demands. Don't allow bar.baz to be
7100      imported from foo.* */
7101   if (!QUALIFIED_P (TYPE_NAME (class_type)))
7102     if (find_in_imports_on_demand (class_type))
7103       return NULL_TREE;
7104
7105   /* 5- Last call for a resolution */
7106   return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
7107 }
7108
7109 /* Resolve NAME and lay it out (if not done and if not the current
7110    parsed class). Return a decl node. This function is meant to be
7111    called when type resolution is necessary during the walk pass.  */
7112
7113 static tree
7114 resolve_and_layout (something, cl)
7115      tree something;
7116      tree cl;
7117 {
7118   tree decl;
7119
7120   /* Don't do that on the current class */
7121   if (something == current_class)
7122     return TYPE_NAME (current_class);
7123
7124   /* Don't do anything for void and other primitive types */
7125   if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
7126     return NULL_TREE;
7127
7128   /* Pointer types can be reall pointer types or fake pointers. When
7129      finding a real pointer, recheck for primitive types */
7130   if (TREE_CODE (something) == POINTER_TYPE)
7131     {
7132       if (TREE_TYPE (something))
7133         {
7134           something = TREE_TYPE (something);
7135           if (JPRIMITIVE_TYPE_P (something) || something == void_type_node)
7136             return NULL_TREE;
7137         }
7138       else
7139         something = TYPE_NAME (something);
7140     }
7141
7142   /* Don't do anything for arrays of primitive types */
7143   if (TREE_CODE (something) == RECORD_TYPE && TYPE_ARRAY_P (something)
7144       && JPRIMITIVE_TYPE_P (TYPE_ARRAY_ELEMENT (something)))
7145     return NULL_TREE;
7146
7147   /* If something is not and IDENTIFIER_NODE, it can be a a TYPE_DECL
7148      or a real TYPE */
7149   if (TREE_CODE (something) != IDENTIFIER_NODE)
7150     something = (TREE_CODE (TYPE_NAME (something)) == TYPE_DECL ?
7151             DECL_NAME (TYPE_NAME (something)) : TYPE_NAME (something));
7152
7153   if (!(decl = resolve_no_layout (something, cl)))
7154     return NULL_TREE;
7155
7156   /* Resolve and layout if necessary */
7157   layout_class_methods (TREE_TYPE (decl));
7158   /* Check methods, but only once */
7159   if (CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) 
7160       && !CLASS_LOADED_P (TREE_TYPE (decl)))
7161     CHECK_METHODS (decl);
7162   if (TREE_TYPE (decl) != current_class && !CLASS_LOADED_P (TREE_TYPE (decl)))
7163     safe_layout_class (TREE_TYPE (decl));
7164
7165   return decl;
7166 }
7167
7168 /* Resolve a class, returns its decl but doesn't perform any
7169    layout. The current parsing context is saved and restored */
7170
7171 static tree
7172 resolve_no_layout (name, cl)
7173      tree name, cl;
7174 {
7175   tree ptr, decl;
7176   BUILD_PTR_FROM_NAME (ptr, name);
7177   java_parser_context_save_global ();
7178   decl = resolve_class (ptr, NULL_TREE, cl);
7179   java_parser_context_restore_global ();
7180   
7181   return decl;
7182 }
7183
7184 /* Called when reporting errors. Skip leader '[' in a complex array
7185    type description that failed to be resolved.  */
7186
7187 static const char *
7188 purify_type_name (name)
7189      const char *name;
7190 {
7191   while (*name && *name == '[')
7192     name++;
7193   return name;
7194 }
7195
7196 /* The type CURRENT refers to can't be found. We print error messages.  */
7197
7198 static void
7199 complete_class_report_errors (dep)
7200      jdep *dep;
7201 {
7202   const char *name;
7203
7204   if (!JDEP_WFL (dep))
7205     return;
7206
7207   name = IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)));
7208   switch (JDEP_KIND (dep))
7209     {
7210     case JDEP_SUPER:
7211       parse_error_context  
7212         (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
7213          purify_type_name (name),
7214          IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7215       break;
7216     case JDEP_FIELD:
7217       parse_error_context
7218         (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
7219          purify_type_name (name),
7220          IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7221       break;
7222     case JDEP_METHOD:           /* Covers arguments */
7223       parse_error_context
7224         (JDEP_WFL (dep), "Type `%s' not found in the declaration of the argument `%s' of method `%s'",
7225          purify_type_name (name),
7226          IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
7227          IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
7228       break;
7229     case JDEP_METHOD_RETURN:    /* Covers return type */
7230       parse_error_context
7231         (JDEP_WFL (dep), "Type `%s' not found in the declaration of the return type of method `%s'", 
7232          purify_type_name (name),
7233          IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
7234       break;
7235     case JDEP_INTERFACE:
7236       parse_error_context
7237         (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
7238          IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
7239          (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
7240          IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7241       break;
7242     case JDEP_VARIABLE:
7243       parse_error_context
7244         (JDEP_WFL (dep), "Type `%s' not found in the declaration of the local variable `%s'", 
7245          purify_type_name (IDENTIFIER_POINTER 
7246                            (EXPR_WFL_NODE (JDEP_WFL (dep)))),
7247          IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
7248       break;
7249     case JDEP_EXCEPTION:        /* As specified by `throws' */
7250       parse_error_context 
7251           (JDEP_WFL (dep), "Class `%s' not found in `throws'",
7252          IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))));
7253       break;
7254     default:
7255       /* Fix for -Wall. Just break doing nothing. The error will be
7256          caught later */
7257       break;
7258     }
7259 }
7260
7261 /* Check uninitialized final.  */
7262
7263 void
7264 java_check_final ()
7265 {
7266 }
7267
7268 /* Return a static string containing the DECL prototype string. If
7269    DECL is a constructor, use the class name instead of the form
7270    <init> */
7271
7272 static const char *
7273 get_printable_method_name (decl)
7274      tree decl;
7275 {
7276   const char *to_return;
7277   tree name = NULL_TREE;
7278
7279   if (DECL_CONSTRUCTOR_P (decl))
7280     {
7281       name = DECL_NAME (decl);
7282       DECL_NAME (decl) = DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)));
7283     }
7284       
7285   to_return = lang_printable_name (decl, 0);
7286   if (DECL_CONSTRUCTOR_P (decl))
7287     DECL_NAME (decl) = name;
7288   
7289   return to_return;
7290 }
7291
7292 /* Reinstall the proper DECL_NAME on METHOD. Return 0 if the method
7293    nevertheless needs to be verfied, 1 otherwise.  */
7294
7295 static int
7296 reset_method_name (method)
7297      tree method;
7298 {
7299   if (!IS_CLINIT (method) && DECL_NAME (method) != finit_identifier_node)
7300     {
7301       /* NAME is just the plain name when Object is being defined */
7302       if (DECL_CONTEXT (method) != object_type_node)
7303         DECL_NAME (method) = (DECL_CONSTRUCTOR_P (method) ? 
7304                               init_identifier_node : GET_METHOD_NAME (method));
7305       return 0;
7306     }
7307   else 
7308     return 1;
7309 }
7310
7311 /* Return the name of METHOD_DECL, when DECL_NAME is a WFL */
7312
7313 tree
7314 java_get_real_method_name (method_decl)
7315      tree method_decl;
7316 {
7317   tree method_name = DECL_NAME (method_decl);
7318   if (DECL_CONSTRUCTOR_P (method_decl))
7319     return init_identifier_node;
7320
7321   /* Explain here why METHOD_DECL doesn't have the DECL_CONSTRUCTUR_P
7322      and still can be a constructor. FIXME */
7323
7324   /* Don't confuse method only bearing the name of their class as
7325      constructors */
7326   else if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (method_decl))
7327            && ctxp
7328            && ctxp->current_parsed_class_un == EXPR_WFL_NODE (method_name)
7329            && get_access_flags_from_decl (method_decl) <= ACC_PROTECTED
7330            && TREE_TYPE (TREE_TYPE (method_decl)) == void_type_node)
7331     return init_identifier_node;
7332   else
7333     return EXPR_WFL_NODE (method_name);
7334 }
7335
7336 /* Track method being redefined inside the same class. As a side
7337    effect, set DECL_NAME to an IDENTIFIER (prior entering this
7338    function it's a FWL, so we can track errors more accurately.)  */
7339
7340 static int
7341 check_method_redefinition (class, method)
7342      tree class, method;
7343 {
7344   tree redef, name;
7345   tree cl = DECL_NAME (method);
7346   tree sig = TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (method));
7347   /* decl name of artificial <clinit> and $finit$ doesn't need to be
7348      fixed and checked */
7349
7350   /* Reset the method name before running the check. If it returns 1,
7351      the method doesn't need to be verified with respect to method
7352      redeclaration and we return 0 */
7353   if (reset_method_name (method))
7354     return 0;
7355
7356   name = DECL_NAME (method);
7357   for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
7358     {
7359       if (redef == method)
7360         break;
7361       if (DECL_NAME (redef) == name 
7362           && sig == TYPE_ARGUMENT_SIGNATURE (TREE_TYPE (redef)))
7363         {
7364           parse_error_context 
7365             (cl, "Duplicate %s declaration `%s'",
7366              (DECL_CONSTRUCTOR_P (redef) ? "constructor" : "method"),
7367              get_printable_method_name (redef));
7368           return 1;
7369         }
7370     }
7371   return 0;
7372 }
7373
7374 static void
7375 check_abstract_method_definitions (do_interface, class_decl, type)
7376      int do_interface;
7377      tree class_decl, type;
7378 {
7379   tree class = TREE_TYPE (class_decl);
7380   tree method, end_type;
7381
7382   end_type = (do_interface ? object_type_node : type);
7383   for (method = TYPE_METHODS (type); method; method = TREE_CHAIN (method))
7384     {
7385       tree other_super, other_method, method_sig, method_name;
7386       int found = 0;
7387       
7388       if (!METHOD_ABSTRACT (method) || METHOD_FINAL (method))
7389         continue;
7390       
7391       /* Now verify that somewhere in between TYPE and CLASS,
7392          abstract method METHOD gets a non abstract definition
7393          that is inherited by CLASS.  */
7394       
7395       method_sig = build_java_signature (TREE_TYPE (method));
7396       method_name = DECL_NAME (method);
7397       if (TREE_CODE (method_name) == EXPR_WITH_FILE_LOCATION)
7398         method_name = EXPR_WFL_NODE (method_name);
7399
7400       for (other_super = class; other_super != end_type; 
7401            other_super = CLASSTYPE_SUPER (other_super))
7402         {
7403           for (other_method = TYPE_METHODS (other_super); other_method;
7404                other_method = TREE_CHAIN (other_method))
7405             {
7406               tree s = build_java_signature (TREE_TYPE (other_method));
7407               tree other_name = DECL_NAME (other_method);
7408
7409               if (TREE_CODE (other_name) == EXPR_WITH_FILE_LOCATION)
7410                 other_name = EXPR_WFL_NODE (other_name);
7411               if (!IS_CLINIT (other_method)
7412                   && !DECL_CONSTRUCTOR_P (other_method)
7413                   && method_name == other_name && method_sig == s)
7414                 {
7415                   found = 1;
7416                   break;
7417                 }
7418             }
7419         }
7420       
7421       /* Report that abstract METHOD didn't find an implementation
7422          that CLASS can use. */
7423       if (!found)
7424         {
7425           char *t = xstrdup (lang_printable_name 
7426                             (TREE_TYPE (TREE_TYPE (method)), 0));
7427           tree ccn = DECL_NAME (TYPE_NAME (DECL_CONTEXT (method)));
7428           tree saved_wfl = NULL_TREE;
7429           
7430           if (TREE_CODE (DECL_NAME (method)) == EXPR_WITH_FILE_LOCATION)
7431             {
7432               saved_wfl = DECL_NAME (method);
7433               DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
7434             }
7435           
7436           parse_error_context 
7437             (lookup_cl (class_decl),
7438              "Class `%s' doesn't define the abstract method `%s %s' from %s `%s'. This method must be defined or %s `%s' must be declared abstract",
7439              IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7440              t, lang_printable_name (method, 0), 
7441              (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))) ? 
7442               "interface" : "class"),
7443              IDENTIFIER_POINTER (ccn),
7444              (CLASS_INTERFACE (class_decl) ? "interface" : "class"),
7445              IDENTIFIER_POINTER (DECL_NAME (class_decl)));
7446           
7447           free (t);
7448           
7449           if (saved_wfl)
7450             DECL_NAME (method) = saved_wfl;
7451         }
7452     }
7453 }
7454
7455 /* Check that CLASS_DECL somehow implements all inherited abstract
7456    methods.  */
7457
7458 static void
7459 java_check_abstract_method_definitions (class_decl)
7460      tree class_decl;
7461 {
7462   tree class = TREE_TYPE (class_decl);
7463   tree super, vector;
7464   int i;
7465
7466   if (CLASS_ABSTRACT (class_decl))
7467     return;
7468
7469   /* Check for inherited types */
7470   for (super = CLASSTYPE_SUPER (class); super != object_type_node; 
7471        super = CLASSTYPE_SUPER (super))
7472     {
7473       if (!CLASS_ABSTRACT (TYPE_NAME (super)))
7474         continue;
7475
7476       check_abstract_method_definitions (0, class_decl, super);
7477     }
7478
7479   /* Check for implemented interfaces. */
7480   vector = TYPE_BINFO_BASETYPES (class);
7481   for (i = 1; i < TREE_VEC_LENGTH (vector); i++)
7482     {
7483       super = BINFO_TYPE (TREE_VEC_ELT (vector, i));
7484       check_abstract_method_definitions (1, class_decl, super);
7485     }
7486 }
7487
7488 /* Check all the methods of CLASS_DECL. Methods are first completed
7489    then checked according to regular method existance rules.  If no
7490    constructor for CLASS_DECL were encountered, then build its
7491    declaration.  */
7492
7493 static void
7494 java_check_regular_methods (class_decl)
7495      tree class_decl;
7496 {
7497   int saw_constructor = 0;
7498   tree method;
7499   tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
7500   tree saved_found_wfl = NULL_TREE, found = NULL_TREE;
7501   tree mthrows;
7502
7503   /* It is not necessary to check methods defined in java.lang.Object */
7504   if (class == object_type_node)
7505     return;
7506
7507   if (!TYPE_NVIRTUALS (class))
7508     TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7509
7510   /* Should take interfaces into account. FIXME */
7511   for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
7512     {
7513       tree sig;
7514       tree method_wfl = DECL_NAME (method);
7515       int aflags;
7516
7517       /* If we previously found something and its name was saved,
7518          reinstall it now */
7519       if (found && saved_found_wfl)
7520         {
7521           DECL_NAME (found) = saved_found_wfl;
7522           saved_found_wfl = NULL_TREE;
7523         }
7524
7525       /* Check for redefinitions */
7526       if (check_method_redefinition (class, method))
7527         continue;
7528
7529       /* If we see one constructor a mark so we don't generate the
7530          default one. Also skip other verifications: constructors
7531          can't be inherited hence hiden or overriden */
7532      if (DECL_CONSTRUCTOR_P (method))
7533        {
7534          saw_constructor = 1;
7535          continue;
7536        }
7537
7538       /* We verify things thrown by the method. They must inherits from
7539          java.lang.Throwable */
7540       for (mthrows = DECL_FUNCTION_THROWS (method);
7541            mthrows; mthrows = TREE_CHAIN (mthrows))
7542         {
7543           if (!inherits_from_p (TREE_VALUE (mthrows), throwable_type_node))
7544             parse_error_context 
7545               (TREE_PURPOSE (mthrows), "Class `%s' in `throws' clause must be a subclass of class `java.lang.Throwable'",
7546                IDENTIFIER_POINTER 
7547                  (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))));
7548         }
7549
7550       sig = build_java_argument_signature (TREE_TYPE (method));
7551       found = lookup_argument_method2 (class, DECL_NAME (method), sig);
7552
7553       /* Nothing overrides or it's a private method. */
7554       if (!found)
7555         continue;
7556       if (METHOD_PRIVATE (found))
7557         {
7558           found = NULL_TREE;
7559           continue;
7560         }
7561
7562       /* If found wasn't verified, it's DECL_NAME won't be set properly. 
7563          We set it temporarily for the sake of the error report. */
7564       saved_found_wfl = DECL_NAME (found);
7565       reset_method_name (found);
7566
7567       /* If `found' is declared in an interface, make sure the
7568          modifier matches. */
7569       if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found))) 
7570           && clinit_identifier_node != DECL_NAME (found)
7571           && !METHOD_PUBLIC (method))
7572         {
7573           tree found_decl = TYPE_NAME (DECL_CONTEXT (found));
7574           parse_error_context (method_wfl, "Class `%s' must override `%s' with a public method in order to implement interface `%s'",
7575                                IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7576                                lang_printable_name (method, 0),
7577                                IDENTIFIER_POINTER (DECL_NAME (found_decl)));
7578         }
7579
7580       /* Can't override a method with the same name and different return
7581          types. */
7582       if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
7583         {
7584           char *t = xstrdup 
7585             (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
7586           parse_error_context 
7587             (method_wfl,
7588              "Method `%s' was defined with return type `%s' in class `%s'", 
7589              lang_printable_name (found, 0), t,
7590              IDENTIFIER_POINTER 
7591                (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7592           free (t);
7593         }
7594
7595       aflags = get_access_flags_from_decl (found);
7596       /* If the method has default, access in an other package, then
7597          issue a warning that the current method doesn't override the
7598          one that was found elsewhere. Do not issue this warning when
7599          the match was found in java.lang.Object.  */
7600       if (DECL_CONTEXT (found) != object_type_node
7601           && ((aflags & ACC_VISIBILITY) == 0)
7602           && !class_in_current_package (DECL_CONTEXT (found))
7603           && DECL_NAME (found) != clinit_identifier_node
7604           && flag_not_overriding)
7605         {
7606           parse_warning_context 
7607             (method_wfl, "Method `%s' in class `%s' does not override the corresponding method in class `%s', which is private to a different package",
7608              lang_printable_name (found, 0),
7609              IDENTIFIER_POINTER (DECL_NAME (class_decl)),
7610              IDENTIFIER_POINTER (DECL_NAME 
7611                                  (TYPE_NAME (DECL_CONTEXT (found)))));
7612           continue;
7613         }
7614
7615       /* Can't override final. Can't override static. */
7616       if (METHOD_FINAL (found) || METHOD_STATIC (found))
7617         {
7618           /* Static *can* override static */
7619           if (METHOD_STATIC (found) && METHOD_STATIC (method))
7620             continue;
7621           parse_error_context 
7622             (method_wfl,
7623              "%s methods can't be overriden. Method `%s' is %s in class `%s'",
7624              (METHOD_FINAL (found) ? "Final" : "Static"),
7625              lang_printable_name (found, 0),
7626              (METHOD_FINAL (found) ? "final" : "static"),
7627              IDENTIFIER_POINTER
7628                (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7629           continue;
7630         }
7631
7632       /* Static method can't override instance method. */
7633       if (METHOD_STATIC (method))
7634         {
7635           parse_error_context 
7636             (method_wfl,
7637              "Instance methods can't be overriden by a static method. Method `%s' is an instance method in class `%s'",
7638              lang_printable_name (found, 0),
7639              IDENTIFIER_POINTER
7640                (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7641           continue;
7642         }
7643
7644       /* - Overriding/hiding public must be public
7645          - Overriding/hiding protected must be protected or public
7646          - If the overriden or hidden method has default (package)
7647            access, then the overriding or hiding method must not be
7648            private; otherwise, a compile-time error occurs.  If
7649            `found' belongs to an interface, things have been already
7650            taken care of.  */
7651       if (!CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (found)))
7652           && ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method))
7653               || (METHOD_PROTECTED (found) 
7654                   && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method)))
7655               || (!(aflags & (ACC_PUBLIC | ACC_PRIVATE | ACC_STATIC))
7656                   && METHOD_PRIVATE (method))))
7657         {
7658           parse_error_context 
7659             (method_wfl,
7660              "Methods can't be overridden to be more private. Method `%s' is not %s in class `%s'", lang_printable_name (method, 0),
7661              (METHOD_PUBLIC (method) ? "public" : 
7662               (METHOD_PRIVATE (method) ? "private" : "protected")),
7663              IDENTIFIER_POINTER (DECL_NAME 
7664                                  (TYPE_NAME (DECL_CONTEXT (found)))));
7665           continue;
7666         }
7667
7668       /* Overriding methods must have compatible `throws' clauses on checked
7669          exceptions, if any */
7670       check_throws_clauses (method, method_wfl, found);
7671
7672       /* Inheriting multiple methods with the same signature. FIXME */
7673     }
7674   
7675   /* Don't forget eventual pending found and saved_found_wfl. Take
7676      into account that we might have exited because we saw an
7677      artificial method as the last entry. */
7678
7679   if (found && !DECL_ARTIFICIAL (found) && saved_found_wfl)
7680     DECL_NAME (found) = saved_found_wfl;
7681
7682   if (!TYPE_NVIRTUALS (class))
7683     TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
7684
7685   /* Search for inherited abstract method not yet implemented in this
7686      class.  */
7687   java_check_abstract_method_definitions (class_decl);
7688
7689   if (!saw_constructor)
7690     fatal ("No constructor found");
7691 }
7692
7693 /* Return a non zero value if the `throws' clause of METHOD (if any)
7694    is incompatible with the `throws' clause of FOUND (if any).  */
7695
7696 static void
7697 check_throws_clauses (method, method_wfl, found)
7698      tree method, method_wfl, found;
7699 {
7700   tree mthrows, fthrows;
7701
7702   /* Can't check these things with class loaded from bytecode. FIXME */
7703   if (!CLASS_FROM_SOURCE_P (DECL_CONTEXT (found)))
7704     return;
7705
7706   for (mthrows = DECL_FUNCTION_THROWS (method);
7707        mthrows; mthrows = TREE_CHAIN (mthrows))
7708     {
7709       /* We don't verify unchecked expressions */
7710       if (IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (mthrows)))
7711         continue;
7712       /* Checked expression must be compatible */
7713       for (fthrows = DECL_FUNCTION_THROWS (found); 
7714            fthrows; fthrows = TREE_CHAIN (fthrows))
7715         if (inherits_from_p (TREE_VALUE (mthrows), TREE_VALUE (fthrows)))
7716           break;
7717       if (!fthrows)
7718         {
7719           parse_error_context 
7720             (method_wfl, "Invalid checked exception class `%s' in `throws' clause. The exception must be a subclass of an exception thrown by `%s' from class `%s'",
7721              IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (TREE_VALUE (mthrows)))),
7722              lang_printable_name (found, 0),
7723              IDENTIFIER_POINTER 
7724                (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7725         }
7726     }
7727 }
7728
7729 /* Check abstract method of interface INTERFACE */
7730
7731 static void
7732 java_check_abstract_methods (interface_decl)
7733      tree interface_decl;
7734 {
7735   int i, n;
7736   tree method, basetype_vec, found;
7737   tree interface = TREE_TYPE (interface_decl);
7738
7739   for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
7740     {
7741       tree method_wfl = DECL_NAME (method);
7742
7743       /* 2- Check for double definition inside the defining interface */
7744       if (check_method_redefinition (interface, method))
7745         continue;
7746
7747       /* 3- Overriding is OK as far as we preserve the return type and
7748          the thrown exceptions (FIXME) */
7749       found = lookup_java_interface_method2 (interface, method);
7750       if (found)
7751         {
7752           char *t;
7753           tree saved_found_wfl = DECL_NAME (found);
7754           reset_method_name (found);
7755           t = xstrdup (lang_printable_name (TREE_TYPE (TREE_TYPE (found)), 0));
7756           parse_error_context 
7757             (method_wfl,
7758              "Method `%s' was defined with return type `%s' in class `%s'",
7759              lang_printable_name (found, 0), t,
7760              IDENTIFIER_POINTER 
7761                (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7762           free (t);
7763           DECL_NAME (found) = saved_found_wfl;
7764           continue;
7765         }
7766     }
7767
7768   /* 4- Inherited methods can't differ by their returned types */
7769   if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
7770     return;
7771   n = TREE_VEC_LENGTH (basetype_vec);
7772   for (i = 0; i < n; i++)
7773     {
7774       tree sub_interface_method, sub_interface;
7775       tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
7776       if (!vec_elt)
7777         continue;
7778       sub_interface = BINFO_TYPE (vec_elt);
7779       for (sub_interface_method = TYPE_METHODS (sub_interface); 
7780            sub_interface_method;
7781            sub_interface_method = TREE_CHAIN (sub_interface_method))
7782         {
7783           found = lookup_java_interface_method2 (interface, 
7784                                                  sub_interface_method);
7785           if (found && (found != sub_interface_method))
7786             {
7787               tree saved_found_wfl = DECL_NAME (found);
7788               reset_method_name (found);
7789               parse_error_context 
7790                 (lookup_cl (sub_interface_method),
7791                  "Interface `%s' inherits method `%s' from interface `%s'. This method is redefined with a different return type in interface `%s'",
7792                  IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
7793                  lang_printable_name (found, 0),
7794                  IDENTIFIER_POINTER 
7795                    (DECL_NAME (TYPE_NAME 
7796                                (DECL_CONTEXT (sub_interface_method)))),
7797                  IDENTIFIER_POINTER 
7798                    (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
7799               DECL_NAME (found) = saved_found_wfl;
7800             }
7801         }
7802     }
7803 }
7804
7805 /* Lookup methods in interfaces using their name and partial
7806    signature. Return a matching method only if their types differ.  */
7807
7808 static tree
7809 lookup_java_interface_method2 (class, method_decl)
7810      tree class, method_decl;
7811 {
7812   int i, n;
7813   tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
7814
7815   if (!basetype_vec)
7816     return NULL_TREE;
7817
7818   n = TREE_VEC_LENGTH (basetype_vec);
7819   for (i = 0; i < n; i++)
7820     {
7821       tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
7822       if ((BINFO_TYPE (vec_elt) != object_type_node)
7823           && (to_return = 
7824               lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
7825         return to_return;
7826     }
7827   for (i = 0; i < n; i++)
7828     {
7829       to_return = lookup_java_interface_method2 
7830         (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
7831       if (to_return)
7832         return to_return;
7833     }
7834
7835   return NULL_TREE;
7836 }
7837
7838 /* Lookup method using their name and partial signature. Return a
7839    matching method only if their types differ.  */
7840
7841 static tree
7842 lookup_java_method2 (clas, method_decl, do_interface)
7843      tree clas, method_decl;
7844      int do_interface;
7845 {
7846   tree method, method_signature, method_name, method_type, name;
7847
7848   method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
7849   name = DECL_NAME (method_decl);
7850   method_name = (TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ? 
7851                  EXPR_WFL_NODE (name) : name);
7852   method_type = TREE_TYPE (TREE_TYPE (method_decl));
7853
7854   while (clas != NULL_TREE)
7855     {
7856       for (method = TYPE_METHODS (clas);
7857            method != NULL_TREE;  method = TREE_CHAIN (method))
7858         {
7859           tree method_sig = build_java_argument_signature (TREE_TYPE (method));
7860           tree name = DECL_NAME (method);
7861           if ((TREE_CODE (name) == EXPR_WITH_FILE_LOCATION ?
7862                EXPR_WFL_NODE (name) : name) == method_name
7863               && method_sig == method_signature 
7864               && TREE_TYPE (TREE_TYPE (method)) != method_type)
7865             return method;
7866         }
7867       clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
7868     }
7869   return NULL_TREE;
7870 }
7871
7872 /* Return the line that matches DECL line number, and try its best to
7873    position the column number. Used during error reports.  */
7874
7875 static tree
7876 lookup_cl (decl)
7877      tree decl;
7878 {
7879   static tree cl = NULL_TREE;
7880   char *line, *found;
7881   
7882   if (!decl)
7883     return NULL_TREE;
7884
7885   if (cl == NULL_TREE)
7886     cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
7887
7888   EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
7889   EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
7890
7891   line = java_get_line_col (IDENTIFIER_POINTER (EXPR_WFL_FILENAME_NODE (cl)),
7892                             EXPR_WFL_LINENO (cl), EXPR_WFL_COLNO (cl));
7893
7894   found = strstr ((const char *)line, 
7895                   (const char *)IDENTIFIER_POINTER (DECL_NAME (decl)));
7896   if (found)
7897     EXPR_WFL_SET_LINECOL (cl, EXPR_WFL_LINENO (cl), found - line);
7898
7899   return cl;
7900 }
7901
7902 /* Look for a simple name in the single-type import list */
7903
7904 static tree
7905 find_name_in_single_imports (name)
7906      tree name;
7907 {
7908   tree node;
7909
7910   for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
7911     if (TREE_VALUE (node) == name)
7912       return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
7913
7914   return NULL_TREE;
7915 }
7916
7917 /* Process all single-type import. */
7918
7919 static int
7920 process_imports ()
7921 {
7922   tree import;
7923   int error_found;
7924
7925   for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7926     {
7927       tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
7928
7929       /* Don't load twice something already defined. */
7930       if (IDENTIFIER_CLASS_VALUE (to_be_found))
7931         continue;
7932       QUALIFIED_P (to_be_found) = 1;
7933       load_class (to_be_found, 0);
7934       error_found =
7935         check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
7936       if (!IDENTIFIER_CLASS_VALUE (to_be_found))
7937         {
7938           parse_error_context (TREE_PURPOSE (import),
7939                                "Class or interface `%s' not found in import",
7940                                IDENTIFIER_POINTER (to_be_found));
7941           return 1;
7942         }
7943       if (error_found)
7944         return 1;
7945     }
7946   return 0;
7947 }
7948
7949 /* Possibly find a class imported by a single-type import statement. Return
7950    1 if an error occured, 0 otherwise. */
7951
7952 static int
7953 find_in_imports (class_type)
7954      tree class_type;
7955 {
7956   tree import;
7957
7958   for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
7959     if (TREE_VALUE (import) == TYPE_NAME (class_type))
7960       {
7961         TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
7962         QUALIFIED_P (TYPE_NAME (class_type)) = 1;
7963       }
7964   return 0;
7965 }
7966
7967 static int
7968 note_possible_classname (name, len)
7969      const char *name;
7970      int len;
7971 {
7972   tree node;
7973   if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
7974     len = len - 5;
7975   else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
7976     len = len - 6;
7977   else
7978     return 0;
7979   node = ident_subst (name, len, "", '/', '.', "");
7980   IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
7981   QUALIFIED_P (node) = strchr (name, '/') ? 1 : 0;
7982   return 1;
7983 }
7984
7985 /* Read a import directory, gathering potential match for further type
7986    references. Indifferently reads a filesystem or a ZIP archive
7987    directory.  */
7988
7989 static void
7990 read_import_dir (wfl)
7991      tree wfl;
7992 {
7993   tree package_id = EXPR_WFL_NODE (wfl);
7994   const char *package_name = IDENTIFIER_POINTER (package_id);
7995   int package_length = IDENTIFIER_LENGTH (package_id);
7996   DIR *dirp = NULL;
7997   JCF *saved_jcf = current_jcf;
7998
7999   int found = 0;
8000   int k;
8001   void *entry;
8002   struct buffer filename[1];
8003
8004
8005   if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
8006     return;
8007   IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
8008
8009   BUFFER_INIT (filename);
8010   buffer_grow (filename, package_length + 100);
8011
8012   for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
8013     {
8014       const char *entry_name = jcf_path_name (entry);
8015       int entry_length = strlen (entry_name);
8016       if (jcf_path_is_zipfile (entry))
8017         {
8018           ZipFile *zipf;
8019           buffer_grow (filename, entry_length);
8020           memcpy (filename->data, entry_name, entry_length - 1);
8021           filename->data[entry_length-1] = '\0';
8022           zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
8023           if (zipf == NULL)
8024             error ("malformed .zip archive in CLASSPATH: %s", entry_name);
8025           else
8026             {
8027               ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
8028               BUFFER_RESET (filename);
8029               for (k = 0; k < package_length; k++)
8030                 {
8031                   char ch = package_name[k];
8032                   *filename->ptr++ = ch == '.' ? '/' : ch;
8033                 }
8034               *filename->ptr++ = '/';
8035
8036               for (k = 0; k < zipf->count;  k++, zipd = ZIPDIR_NEXT (zipd))
8037                 {
8038                   const char *current_entry = ZIPDIR_FILENAME (zipd);
8039                   int current_entry_len = zipd->filename_length;
8040
8041                   if (current_entry_len >= BUFFER_LENGTH (filename)
8042                       && strncmp (filename->data, current_entry, 
8043                                   BUFFER_LENGTH (filename)) != 0)
8044                     continue;
8045                   found |= note_possible_classname (current_entry,
8046                                                     current_entry_len);
8047                 }
8048             }
8049         }
8050       else
8051         {
8052           BUFFER_RESET (filename);
8053           buffer_grow (filename, entry_length + package_length + 4);
8054           strcpy (filename->data, entry_name);
8055           filename->ptr = filename->data + entry_length;
8056           for (k = 0; k < package_length; k++)
8057             {
8058               char ch = package_name[k];
8059               *filename->ptr++ = ch == '.' ? '/' : ch;
8060             }
8061           *filename->ptr = '\0';
8062
8063           dirp = opendir (filename->data);
8064           if (dirp == NULL)
8065             continue;
8066           *filename->ptr++ = '/';
8067           for (;;)
8068             {
8069               int len; 
8070               const char *d_name;
8071               struct dirent *direntp = readdir (dirp);
8072               if (!direntp)
8073                 break;
8074               d_name = direntp->d_name;
8075               len = strlen (direntp->d_name);
8076               buffer_grow (filename, len+1);
8077               strcpy (filename->ptr, d_name);
8078               found |= note_possible_classname (filename->data + entry_length,
8079                                                 package_length+len+1);
8080             }
8081           if (dirp)
8082             closedir (dirp);
8083         }
8084     }
8085
8086   free (filename->data);
8087
8088   /* Here we should have a unified way of retrieving an entry, to be
8089      indexed. */
8090   if (!found)
8091     {
8092       static int first = 1;
8093       if (first)
8094         {
8095           error ("Can't find default package `%s'. Check the CLASSPATH environment variable and the access to the archives.", package_name);
8096           java_error_count++;
8097           first = 0;
8098         }
8099       else
8100         parse_error_context (wfl, "Package `%s' not found in import",
8101                              package_name);
8102       current_jcf = saved_jcf;
8103       return;
8104     }
8105   current_jcf = saved_jcf;
8106 }
8107
8108 /* Possibly find a type in the import on demands specified
8109    types. Returns 1 if an error occured, 0 otherwise. Run throught the
8110    entire list, to detected potential double definitions.  */
8111                  
8112 static int
8113 find_in_imports_on_demand (class_type)
8114      tree class_type;
8115 {
8116   tree node, import, node_to_use = NULL_TREE;
8117   int seen_once = -1;
8118   tree cl = NULL_TREE;
8119
8120   for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
8121     {
8122       const char *id_name;
8123       obstack_grow (&temporary_obstack, 
8124                     IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
8125                     IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
8126       obstack_1grow (&temporary_obstack, '.');
8127       obstack_grow0 (&temporary_obstack, 
8128                      IDENTIFIER_POINTER (TYPE_NAME (class_type)),
8129                      IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
8130       id_name = obstack_finish (&temporary_obstack);
8131               
8132       node = maybe_get_identifier (id_name);
8133       if (node && IS_A_CLASSFILE_NAME (node))
8134         {
8135           if (seen_once < 0)
8136             {
8137               cl = TREE_PURPOSE (import);
8138               seen_once = 1;
8139               node_to_use = node;
8140             }
8141           else
8142             {
8143               seen_once++;
8144               parse_error_context 
8145                 (import, "Type `%s' also potentially defined in package `%s'",
8146                  IDENTIFIER_POINTER (TYPE_NAME (class_type)),
8147                  IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
8148             }
8149         }
8150     }
8151
8152   if (seen_once == 1)
8153     {
8154       /* Setup lineno so that it refers to the line of the import (in
8155          case we parse a class file and encounter errors */
8156       tree decl;
8157       int saved_lineno = lineno;
8158       lineno = EXPR_WFL_LINENO (cl);
8159       TYPE_NAME (class_type) = node_to_use;
8160       QUALIFIED_P (TYPE_NAME (class_type)) = 1;
8161       decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
8162       /* If there is no DECL set for the class or if the class isn't
8163          loaded and not seen in source yet, the load */
8164       if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
8165                     && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
8166         load_class (node_to_use, 0);
8167       lineno = saved_lineno;
8168       return check_pkg_class_access (TYPE_NAME (class_type), cl);
8169     }
8170   else
8171     return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
8172 }
8173
8174 static tree
8175 resolve_package (pkg, next)
8176      tree pkg, *next;
8177 {
8178   tree current;
8179   tree type_name = NULL_TREE;
8180   const char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (pkg));
8181
8182   /* The trick is to determine when the package name stops and were
8183      the name of something contained in the package starts. Then we
8184      return a fully qualified name of what we want to get. */
8185
8186   /* Do a quick search on well known package names */
8187   if (!strncmp (name, "java.lang.reflect", 17))
8188     {
8189       *next = 
8190         TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg))));
8191       type_name = lookup_package_type (name, 17);
8192     }
8193   else if (!strncmp (name, "java.lang", 9))
8194     {
8195       *next = TREE_CHAIN (TREE_CHAIN (EXPR_WFL_QUALIFICATION (pkg)));
8196       type_name = lookup_package_type (name, 9);
8197     }
8198
8199   /* If we found something here, return */
8200   if (type_name)
8201     return type_name; 
8202
8203   *next = EXPR_WFL_QUALIFICATION (pkg);
8204
8205   /* Try the current package. */
8206   if (ctxp->package && !strncmp (name, IDENTIFIER_POINTER (ctxp->package),  
8207                                  IDENTIFIER_LENGTH (ctxp->package)))
8208     {
8209       type_name = 
8210         lookup_package_type_and_set_next (name, 
8211                                           IDENTIFIER_LENGTH (ctxp->package), 
8212                                           next );
8213       if (type_name)
8214         return type_name;
8215     }
8216
8217   /* Search in imported package */
8218   for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
8219     {
8220       tree current_pkg_name = EXPR_WFL_NODE (TREE_PURPOSE (current));
8221       int len = IDENTIFIER_LENGTH (current_pkg_name);
8222       if (!strncmp (name, IDENTIFIER_POINTER (current_pkg_name), len))
8223         {
8224           tree left, dummy;
8225           
8226           breakdown_qualified (&left, &dummy, current_pkg_name);
8227           len = IDENTIFIER_LENGTH (left);
8228           type_name = lookup_package_type_and_set_next (name, len, next);
8229           if (type_name)
8230             break;
8231         }
8232     }
8233
8234   return type_name;
8235 }
8236
8237 static tree
8238 lookup_package_type_and_set_next (name, len, next)
8239      const char *name;
8240      int len;
8241      tree *next;
8242 {
8243   const char *ptr;
8244   tree type_name = lookup_package_type (name, len);
8245
8246   if (!type_name)
8247     return NULL;
8248   
8249   ptr = IDENTIFIER_POINTER (type_name);
8250   while (ptr && (ptr = strchr (ptr, '.'))) 
8251     {
8252       *next = TREE_CHAIN (*next);
8253       ptr++;
8254     }
8255   return type_name;
8256 }
8257
8258 static tree
8259 lookup_package_type (name, from)
8260      const char *name;
8261      int from;
8262 {
8263   char subname [128];
8264   const char *sub = &name[from+1];
8265   while (*sub != '.' && *sub)
8266     sub++;
8267   strncpy (subname, name, sub-name);
8268   subname [sub-name] = '\0';
8269   return get_identifier (subname);
8270 }
8271
8272 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
8273    access violations were found, 1 otherwise.  */
8274
8275 static int
8276 check_pkg_class_access (class_name, cl)
8277      tree class_name;
8278      tree cl;
8279 {
8280   tree type;
8281
8282   if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
8283     return 0;
8284
8285   if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
8286     return 0;
8287
8288   if (!CLASS_PUBLIC (TYPE_NAME (type)))
8289     {
8290       /* Access to a private class within the same package is
8291          allowed. */
8292       tree l, r;
8293       breakdown_qualified (&l, &r, class_name);
8294       if (l == ctxp->package)
8295         return 0;
8296
8297       parse_error_context 
8298         (cl, "Can't access %s `%s'. Only public classes and interfaces in other packages can be accessed",
8299          (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
8300          IDENTIFIER_POINTER (class_name));
8301       return 1;
8302     }
8303   return 0;
8304 }
8305
8306 /* Local variable declaration. */
8307
8308 static void
8309 declare_local_variables (modifier, type, vlist)
8310      int modifier;
8311      tree type;
8312      tree vlist;
8313 {
8314   tree decl, current, saved_type;
8315   tree type_wfl = NULL_TREE;
8316   int must_chain = 0;
8317
8318   /* Push a new block if statements were seen between the last time we
8319      pushed a block and now. Keep a cound of block to close */
8320   if (BLOCK_EXPR_BODY (GET_CURRENT_BLOCK (current_function_decl)))
8321     {
8322       tree body = GET_CURRENT_BLOCK (current_function_decl);
8323       tree b = enter_block ();
8324       BLOCK_EXPR_ORIGIN (b) = body;
8325     }
8326
8327   if (modifier)
8328     {
8329       int i;
8330       for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
8331       if (modifier == ACC_FINAL)
8332         {
8333           if (flag_static_local_jdk1_1)
8334             parse_warning_context (ctxp->modifier_ctx [i], 
8335               "Unsupported JDK1.1 `final' local variable (treated as non final)");
8336         }
8337       else 
8338         {
8339           parse_error_context 
8340             (ctxp->modifier_ctx [i], 
8341              "Only `final' is allowed as a local variables modifier");
8342           return;
8343         }
8344     }
8345
8346   /* Obtain an incomplete type if TYPE is not complete. TYPE_WFL will
8347      hold the TYPE value if a new incomplete has to be created (as
8348      opposed to being found already existing and reused). */
8349   SET_TYPE_FOR_RESOLUTION (type, type_wfl, must_chain);
8350
8351   /* If TYPE is fully resolved and we don't have a reference, make one */
8352   PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
8353
8354   /* Go through all the declared variables */
8355   for (current = vlist, saved_type = type; current;
8356        current = TREE_CHAIN (current), type = saved_type)
8357     {
8358       tree other, real_type;
8359       tree wfl  = TREE_PURPOSE (current);
8360       tree name = EXPR_WFL_NODE (wfl);
8361       tree init = TREE_VALUE (current);
8362
8363       /* Process NAME, as it may specify extra dimension(s) for it */
8364       type = build_array_from_name (type, type_wfl, name, &name);
8365
8366       /* Variable redefinition check */
8367       if ((other = lookup_name_in_blocks (name)))
8368         {
8369           variable_redefinition_error (wfl, name, TREE_TYPE (other),
8370                                        DECL_SOURCE_LINE (other));
8371           continue;
8372         }
8373
8374       /* Type adjustment. We may have just readjusted TYPE because
8375          the variable specified more dimensions. Make sure we have
8376          a reference if we can and don't have one already. */
8377       PROMOTE_RECORD_IF_COMPLETE (type, must_chain);
8378
8379       real_type = GET_REAL_TYPE (type);
8380       /* Never layout this decl. This will be done when its scope
8381          will be entered */
8382       decl = build_decl (VAR_DECL, name, real_type);
8383       BLOCK_CHAIN_DECL (decl);
8384       
8385       /* If doing xreferencing, replace the line number with the WFL
8386          compound value */
8387       if (flag_emit_xref)
8388         DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl);
8389       
8390       /* Don't try to use an INIT statement when an error was found */
8391       if (init && java_error_count)
8392         init = NULL_TREE;
8393       
8394       /* Add the initialization function to the current function's code */
8395       if (init)
8396         {
8397           /* Name might have been readjusted */
8398           EXPR_WFL_NODE (TREE_OPERAND (init, 0)) = name;
8399           MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
8400           java_method_add_stmt (current_function_decl,
8401                                 build_debugable_stmt (EXPR_WFL_LINECOL (init),
8402                                                       init));
8403         }
8404     
8405       /* Setup dependency the type of the decl */
8406       if (must_chain)
8407         {
8408           jdep *dep;
8409           register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
8410           dep = CLASSD_LAST (ctxp->classd_list);
8411           JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
8412         }
8413     }
8414   SOURCE_FRONTEND_DEBUG (("Defined locals"));
8415 }
8416
8417 /* Called during parsing. Build decls from argument list.  */
8418
8419 static void
8420 source_start_java_method (fndecl)
8421      tree fndecl;
8422 {
8423   tree tem;
8424   tree parm_decl;
8425   int i;
8426
8427   if (!fndecl)
8428     return;
8429
8430   current_function_decl = fndecl;
8431
8432   /* New scope for the function */
8433   enter_block ();
8434   for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
8435        tem != end_params_node; tem = TREE_CHAIN (tem), i++)
8436     {
8437       tree type = TREE_VALUE (tem);
8438       tree name = TREE_PURPOSE (tem);
8439       
8440       /* If type is incomplete. Create an incomplete decl and ask for
8441          the decl to be patched later */
8442       if (INCOMPLETE_TYPE_P (type))
8443         {
8444           jdep *jdep;
8445           tree real_type = GET_REAL_TYPE (type);
8446           parm_decl = build_decl (PARM_DECL, name, real_type);
8447           type = obtain_incomplete_type (type);
8448           register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
8449           jdep = CLASSD_LAST (ctxp->classd_list);
8450           JDEP_MISC (jdep) = name;
8451           JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
8452         }
8453       else
8454         parm_decl = build_decl (PARM_DECL, name, type);
8455
8456       BLOCK_CHAIN_DECL (parm_decl);
8457     }
8458   tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
8459   BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
8460     nreverse (tem);
8461   DECL_ARG_SLOT_COUNT (current_function_decl) = i;
8462 }
8463
8464 /* Called during parsing. Creates an artificial method declaration.  */
8465
8466 static tree
8467 create_artificial_method (class, flags, type, name, args)
8468      tree class;
8469      int flags;
8470      tree type, name, args;
8471 {
8472   int saved_lineno = lineno;                                        
8473   tree mdecl;
8474
8475   lineno = 0;                                                               
8476   mdecl = make_node (FUNCTION_TYPE);                                
8477   TREE_TYPE (mdecl) = type;
8478   TYPE_ARG_TYPES (mdecl) = args;
8479   mdecl = add_method (class, flags, name, build_java_signature (mdecl)); 
8480   lineno = saved_lineno;                                                    
8481   DECL_ARTIFICIAL (mdecl) = 1;                                      
8482   return mdecl;
8483 }
8484
8485 /* Starts the body if an artifical method.  */
8486
8487 static void
8488 start_artificial_method_body (mdecl)
8489      tree mdecl;
8490 {
8491   DECL_SOURCE_LINE (mdecl) = 1;
8492   DECL_SOURCE_LINE_MERGE (mdecl, 1);
8493   source_start_java_method (mdecl);
8494   enter_block ();
8495 }
8496
8497 static void
8498 end_artificial_method_body (mdecl)
8499      tree mdecl;
8500 {
8501   BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
8502   exit_block ();
8503 }
8504
8505 /* Called during expansion. Push decls formerly built from argument
8506    list so they're usable during expansion. */
8507
8508 static void
8509 expand_start_java_method (fndecl)
8510      tree fndecl;
8511 {
8512   tree tem, *ptr;
8513
8514   current_function_decl = fndecl;
8515
8516   announce_function (fndecl);
8517   pushlevel (1);                /* Push parameters */
8518   ptr = &DECL_ARGUMENTS (fndecl);
8519   tem  = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
8520   while (tem)
8521     {
8522       tree next = TREE_CHAIN (tem);
8523       tree type = TREE_TYPE (tem);
8524       if (PROMOTE_PROTOTYPES
8525           && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)
8526           && INTEGRAL_TYPE_P (type))
8527         type = integer_type_node;
8528       DECL_ARG_TYPE (tem) = type;
8529       layout_decl (tem, 0);
8530       pushdecl (tem);
8531       *ptr = tem;
8532       ptr = &TREE_CHAIN (tem);
8533       tem = next;
8534     }
8535   *ptr = NULL_TREE;
8536   pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8537   lineno = DECL_SOURCE_LINE_FIRST (fndecl);
8538 }
8539
8540 /* Terminate a function and expand its body.  */
8541
8542 static void
8543 source_end_java_method ()
8544 {
8545   tree fndecl = current_function_decl;
8546   int flag_asynchronous_exceptions = asynchronous_exceptions;
8547
8548   if (!fndecl)
8549     return;
8550
8551   java_parser_context_save_global ();
8552   lineno = ctxp->last_ccb_indent1;
8553
8554   /* Set EH language codes */
8555   java_set_exception_lang_code ();
8556
8557   /* Turn function bodies with only a NOP expr null, so they don't get
8558      generated at all and we won't get warnings when using the -W
8559      -Wall flags. */
8560   if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
8561     BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
8562
8563   /* Generate function's code */
8564   if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
8565       && ! flag_emit_class_files
8566       && ! flag_emit_xref)
8567     expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
8568
8569   /* pop out of its parameters */
8570   pushdecl_force_head (DECL_ARGUMENTS (fndecl));
8571   poplevel (1, 0, 1);
8572   BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
8573
8574   /* Generate rtl for function exit.  */
8575   if (! flag_emit_class_files && ! flag_emit_xref)
8576     {
8577       lineno = DECL_SOURCE_LINE_LAST (fndecl);
8578       /* Emit catch-finally clauses */
8579       emit_handlers ();
8580       expand_function_end (input_filename, lineno, 0);
8581
8582       /* FIXME: If the current method contains any exception handlers,
8583          force asynchronous_exceptions: this is necessary because signal
8584          handlers in libjava may throw exceptions.  This is far from being
8585          a perfect solution, but it's better than doing nothing at all.*/
8586       if (catch_clauses)
8587         asynchronous_exceptions = 1;
8588
8589       /* Run the optimizers and output assembler code for this function. */
8590       rest_of_compilation (fndecl);
8591     }
8592
8593   current_function_decl = NULL_TREE;
8594   permanent_allocation (1);
8595   java_parser_context_restore_global ();
8596   asynchronous_exceptions = flag_asynchronous_exceptions;
8597 }
8598
8599 /* Record EXPR in the current function block. Complements compound
8600    expression second operand if necessary.  */
8601
8602 tree
8603 java_method_add_stmt (fndecl, expr)
8604      tree fndecl, expr;
8605 {
8606   if (!GET_CURRENT_BLOCK (fndecl))
8607     return NULL_TREE;
8608   return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
8609 }
8610
8611 static tree
8612 add_stmt_to_block (b, type, stmt)
8613      tree b, type, stmt;
8614 {
8615   tree body = BLOCK_EXPR_BODY (b), c;
8616   
8617   if (java_error_count)
8618     return body;
8619     
8620   if ((c = add_stmt_to_compound (body, type, stmt)) == body)
8621     return body;
8622
8623   BLOCK_EXPR_BODY (b) = c;
8624   TREE_SIDE_EFFECTS (c) = 1;
8625   return c;
8626 }
8627
8628 /* Add STMT to EXISTING if possible, otherwise create a new
8629    COMPOUND_EXPR and add STMT to it. */
8630
8631 static tree
8632 add_stmt_to_compound (existing, type, stmt)
8633      tree existing, type, stmt;
8634 {
8635   if (existing)
8636     return build (COMPOUND_EXPR, type, existing, stmt);
8637   else
8638     return stmt;
8639 }
8640
8641 /* Hold THIS for the scope of the current public method decl.  */
8642 static tree current_this;
8643
8644 void java_layout_seen_class_methods ()
8645 {
8646   tree previous_list = all_class_list;
8647   tree end = NULL_TREE;
8648   tree current;
8649
8650   while (1)
8651     {
8652       for (current = previous_list; 
8653            current != end; current = TREE_CHAIN (current))
8654         layout_class_methods (TREE_TYPE (TREE_VALUE (current)));
8655       
8656       if (previous_list != all_class_list)
8657         {
8658           end = previous_list;
8659           previous_list = all_class_list;
8660         }
8661       else
8662         break;
8663     }
8664 }
8665
8666 /* Layout the methods of all classes loaded in one way on an
8667    other. Check methods of source parsed classes. Then reorder the
8668    fields and layout the classes or the type of all source parsed
8669    classes */
8670
8671 void
8672 java_layout_classes ()
8673 {
8674   tree current;
8675   int save_error_count = java_error_count;
8676
8677   /* Layout the methods of all classes seen so far */
8678   java_layout_seen_class_methods ();
8679   java_parse_abort_on_error ();
8680   all_class_list = NULL_TREE;
8681
8682   /* Then check the methods of all parsed classes */
8683   for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8684     if (CLASS_FROM_SOURCE_P (TREE_TYPE (TREE_VALUE (current))))
8685       CHECK_METHODS (TREE_VALUE (current));
8686   java_parse_abort_on_error ();
8687
8688   for (current = ctxp->gclass_list; current; current = TREE_CHAIN (current))
8689     {
8690       current_class = TREE_TYPE (TREE_VALUE (current));
8691
8692       /* Reverse the fields, but leave the dummy field in front.
8693          Fields are already ordered for Object and Class */
8694       if (TYPE_FIELDS (current_class) && current_class != object_type_node
8695           && current_class != class_type_node)
8696       {
8697         /* If the dummy field is there, reverse the right fields and
8698            just layout the type for proper fields offset */
8699         if (!DECL_NAME (TYPE_FIELDS (current_class)))
8700           {
8701             tree fields = TYPE_FIELDS (current_class);
8702             TREE_CHAIN (fields) = nreverse (TREE_CHAIN (fields));
8703             TYPE_SIZE (current_class) = NULL_TREE;
8704             layout_type (current_class);
8705           }
8706         /* We don't have a dummy field, we need to layout the class,
8707            after having reversed the fields */
8708         else
8709           {
8710             TYPE_FIELDS (current_class) = 
8711               nreverse (TYPE_FIELDS (current_class));
8712             TYPE_SIZE (current_class) = NULL_TREE;
8713             layout_class (current_class);
8714           }
8715       }
8716       else
8717         layout_class (current_class);
8718
8719       /* From now on, the class is considered completely loaded */
8720       CLASS_LOADED_P (current_class) = 1;
8721
8722       /* Error reported by the caller */
8723       if (java_error_count)
8724         return;
8725     }
8726
8727   /* We might have reloaded classes durign the process of laying out
8728      classes for code generation. We must layout the methods of those
8729      late additions, as constructor checks might use them */
8730   java_layout_seen_class_methods ();
8731   java_parse_abort_on_error ();
8732 }
8733
8734 /* Expand all methods in all registered classes.  */
8735
8736 static void
8737 java_complete_expand_methods ()
8738 {
8739   tree current;
8740
8741   do_not_fold = flag_emit_xref;
8742   
8743   for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
8744     {
8745       int is_interface;
8746       tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
8747       tree decl, prev_decl;
8748
8749       current_class = TREE_TYPE (current);
8750       is_interface = CLASS_INTERFACE (TYPE_NAME (current_class));
8751
8752       /* Initialize a new constant pool */
8753       init_outgoing_cpool ();
8754
8755       /* We want <clinit> (if any) to be processed first. */
8756       for (prev_decl = NULL_TREE, decl = TYPE_METHODS (class_type); 
8757            decl; prev_decl= decl, decl = TREE_CHAIN (decl))
8758         if (IS_CLINIT (decl))
8759           {
8760             if (!java_pre_expand_clinit (decl))
8761               {
8762                 if (prev_decl)
8763                   TREE_CHAIN (prev_decl) = TREE_CHAIN (decl);
8764                 else
8765                   TYPE_METHODS (class_type) = TREE_CHAIN (decl);
8766               }
8767             break;
8768           }
8769
8770       /* Now go on for regular business.  */
8771       for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8772         {
8773           current_function_decl = decl;
8774           /* Don't generate debug info on line zero when expanding a
8775              generated constructor. */
8776           if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
8777             {
8778               /* If we found errors, it's too dangerous to try to
8779                  generate and expand a constructor */
8780               if (!java_error_count)
8781                 {
8782                   restore_line_number_status (1);
8783                   java_complete_expand_method (decl);
8784                   restore_line_number_status (0);
8785                   }
8786             }
8787           else if (METHOD_ABSTRACT (decl) || METHOD_NATIVE (decl))
8788             continue;
8789           else 
8790             java_complete_expand_method (decl);
8791         }
8792
8793       /* Now verify constructor circularity (stop after the first one
8794          we find) */
8795       if (!is_interface)
8796         for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
8797           if (DECL_CONSTRUCTOR_P (decl) && 
8798               verify_constructor_circularity (decl, decl))
8799             break;
8800
8801       /* Make the class data, register it and run the rest of decl
8802          compilation on it */
8803       if (!java_error_count)
8804         {
8805           if (flag_emit_class_files)
8806             write_classfile (current_class);
8807           if (flag_emit_xref)
8808             expand_xref (current_class);
8809           else if (! flag_syntax_only)
8810             finish_class ();
8811         }
8812     }
8813 }
8814
8815 /* Hold a list of catch clauses list. The first element of this list is
8816    the list of the catch clauses of the currently analysed try block. */
8817 static tree currently_caught_type_list;
8818
8819 /* Complete and expand <clinit>. Return a non zero value if <clinit>
8820    is worth keeping.  */
8821
8822 static int
8823 java_pre_expand_clinit (decl)
8824      tree decl;
8825 {
8826   tree fbody = DECL_FUNCTION_BODY (decl);
8827   int to_return = 1;
8828
8829   if (fbody != NULL_TREE)
8830     {
8831       /* First check if we can ignore empty <clinit> */
8832       tree block_body = BLOCK_EXPR_BODY (fbody);
8833       
8834       current_this = NULL_TREE;
8835       current_function_decl = decl;
8836       if (block_body != NULL_TREE)
8837         {
8838           /* Prevent the use of `this' inside <clinit> */
8839           ctxp->explicit_constructor_p = 1;
8840           block_body = java_complete_tree (block_body);
8841           ctxp->explicit_constructor_p = 0;
8842
8843           BLOCK_EXPR_BODY (fbody) = block_body;
8844           if (block_body != NULL_TREE  && TREE_CODE (block_body) == BLOCK
8845               && BLOCK_EXPR_BODY (block_body) == empty_stmt_node)
8846             to_return = 0;
8847         }
8848     }
8849   return to_return;
8850 }
8851
8852 /* Complete and expand a method.  */
8853
8854 static void
8855 java_complete_expand_method (mdecl)
8856      tree mdecl;
8857 {
8858   /* Fix constructors before expanding them */
8859   if (DECL_CONSTRUCTOR_P (mdecl))
8860     fix_constructors (mdecl);
8861   
8862   /* Expand functions that have a body */
8863   if (DECL_FUNCTION_BODY (mdecl))
8864     {
8865       tree fbody = DECL_FUNCTION_BODY (mdecl);
8866       tree block_body = BLOCK_EXPR_BODY (fbody);
8867       tree exception_copy = NULL_TREE;
8868       expand_start_java_method (mdecl);
8869       build_result_decl (mdecl);
8870
8871       current_this 
8872         = (!METHOD_STATIC (mdecl) ? 
8873            BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
8874
8875       /* Purge the `throws' list of unchecked exceptions. If we're
8876          doing xref, save a copy of the list and re-install it
8877          later. */
8878       if (flag_emit_xref)
8879         exception_copy = copy_list (DECL_FUNCTION_THROWS (mdecl));
8880
8881       purge_unchecked_exceptions (mdecl);
8882
8883       /* Install exceptions thrown with `throws' */
8884       PUSH_EXCEPTIONS (DECL_FUNCTION_THROWS (mdecl));
8885
8886       if (block_body != NULL_TREE)
8887         {
8888           block_body = java_complete_tree (block_body);
8889           if (!flag_emit_xref)
8890             check_for_initialization (block_body);
8891           ctxp->explicit_constructor_p = 0;
8892         }
8893       BLOCK_EXPR_BODY (fbody) = block_body;
8894
8895       if ((block_body == NULL_TREE || CAN_COMPLETE_NORMALLY (block_body))
8896           && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
8897           && !flag_emit_xref)
8898         missing_return_error (current_function_decl);
8899
8900       complete_start_java_method (mdecl); 
8901
8902       /* Don't go any further if we've found error(s) during the
8903          expansion */
8904       if (!java_error_count)
8905         source_end_java_method ();
8906       else
8907         {
8908           pushdecl_force_head (DECL_ARGUMENTS (mdecl));
8909           poplevel (1, 0, 1);
8910         }
8911
8912       /* Pop the exceptions and sanity check */
8913       POP_EXCEPTIONS();
8914       if (currently_caught_type_list)
8915         fatal ("Exception list non empty - java_complete_expand_method");
8916
8917       if (flag_emit_xref)
8918         DECL_FUNCTION_THROWS (mdecl) = exception_copy;
8919     }
8920 }
8921
8922 /* Craft a body for default constructor. Patch existing constructor
8923    bodies with call to super() and field initialization statements if
8924    necessary.  */
8925
8926 static void
8927 fix_constructors (mdecl)
8928      tree mdecl;
8929 {
8930   tree body = DECL_FUNCTION_BODY (mdecl);
8931
8932   if (!body)
8933     {
8934       /* The constructor body must be crafted by hand. It's the
8935          constructor we defined when we realize we didn't have the
8936          CLASSNAME() constructor */
8937
8938       tree compound;
8939
8940       /* It is an error for the compiler to generate a default
8941          constructor if the superclass doesn't have a constructor that
8942          takes no argument */
8943       if (verify_constructor_super ())
8944         {
8945           tree sclass_decl = TYPE_NAME (CLASSTYPE_SUPER (current_class));
8946           const char *n = IDENTIFIER_POINTER (DECL_NAME (sclass_decl));
8947           parse_error_context
8948             (lookup_cl (TYPE_NAME (current_class)), 
8949              "No constructor matching `%s()' found in class `%s'", n, n);
8950         }
8951       
8952       start_artificial_method_body (mdecl);
8953       
8954       /* We don't generate a super constructor invocation if we're
8955          compiling java.lang.Object. build_super_invocation takes care
8956          of that. */
8957       compound = java_method_add_stmt (mdecl, build_super_invocation (mdecl));
8958
8959       end_artificial_method_body (mdecl);
8960     }
8961   /* Search for an explicit constructor invocation */
8962   else 
8963     {
8964       int found = 0;
8965       tree main_block = BLOCK_EXPR_BODY (body);
8966       tree compound = NULL_TREE;
8967       
8968       while (body)
8969         switch (TREE_CODE (body))
8970           {
8971           case CALL_EXPR:
8972             found = CALL_EXPLICIT_CONSTRUCTOR_P (body);
8973             body = NULL_TREE;
8974             break;
8975           case COMPOUND_EXPR:
8976           case EXPR_WITH_FILE_LOCATION:
8977             body = TREE_OPERAND (body, 0);
8978             break;
8979           case BLOCK:
8980             body = BLOCK_EXPR_BODY (body);
8981             break;
8982           default:
8983             found = 0;
8984             body = NULL_TREE;
8985           }
8986       /* The constructor is missing an invocation of super() */
8987       if (!found)
8988         compound = add_stmt_to_compound (compound, NULL_TREE,
8989                                          build_super_invocation (mdecl));
8990       
8991       /* Fix the constructor main block if we're adding extra stmts */
8992       if (compound)
8993         {
8994           compound = add_stmt_to_compound (compound, NULL_TREE,
8995                                            BLOCK_EXPR_BODY (main_block));
8996           BLOCK_EXPR_BODY (main_block) = compound;
8997         }
8998     }
8999 }
9000
9001 /* Browse constructors in the super class, searching for a constructor
9002    that doesn't take any argument. Return 0 if one is found, 1
9003    otherwise. */
9004
9005 static int
9006 verify_constructor_super ()
9007 {
9008   tree class = CLASSTYPE_SUPER (current_class);
9009   if (!class)
9010     return 0;
9011
9012   if (class)
9013     {
9014       tree mdecl;
9015       for (mdecl = TYPE_METHODS (class); mdecl; mdecl = TREE_CHAIN (mdecl))
9016         {
9017           if (DECL_CONSTRUCTOR_P (mdecl)
9018               && TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (mdecl))) 
9019                  == end_params_node)
9020             return 0;
9021         }
9022     }
9023   return 1;
9024 }
9025
9026 /* Expand finals.  */
9027
9028 static void
9029 java_expand_finals ()
9030 {
9031 }
9032
9033 /* Generate code for all context remembered for code generation.  */
9034
9035 void
9036 java_expand_classes ()
9037 {
9038   int save_error_count = 0;
9039   java_parse_abort_on_error ();
9040   if (!(ctxp = ctxp_for_generation))
9041     return;
9042   java_layout_classes ();
9043   java_parse_abort_on_error ();
9044
9045   for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
9046     {
9047       ctxp = ctxp_for_generation;
9048       lang_init_source (2);            /* Error msgs have method prototypes */
9049       java_complete_expand_methods (); /* Complete and expand method bodies */
9050       java_parse_abort_on_error ();
9051       java_expand_finals ();          /* Expand and check the finals */
9052       java_parse_abort_on_error ();
9053       java_check_final ();            /* Check unitialized final  */
9054       java_parse_abort_on_error ();
9055     }
9056 }
9057
9058 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
9059    a tree list node containing RIGHT. Fore coming RIGHTs will be
9060    chained to this hook. LOCATION contains the location of the
9061    separating `.' operator.  */
9062
9063 static tree
9064 make_qualified_primary (primary, right, location)
9065      tree primary, right;
9066      int location;
9067 {
9068   tree wfl;
9069
9070   /* We want to process THIS . xxx symbolicaly, to keep it consistent
9071      with the way we're processing SUPER. A THIS from a primary as a
9072      different form than a SUPER. Turn THIS into something symbolic */
9073   if (TREE_CODE (primary) == THIS_EXPR)
9074     {
9075       wfl = build_wfl_node (this_identifier_node);
9076       EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
9077       wfl = make_qualified_name (wfl, right, location);
9078       PRIMARY_P (wfl) = 1;
9079       return wfl;
9080     }
9081   /* Other non WFL node are wrapped around a WFL */
9082   else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
9083     {
9084       wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
9085       EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
9086       EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
9087     }
9088   else
9089     {
9090       wfl = primary;
9091       if (!EXPR_WFL_QUALIFICATION (primary))
9092         EXPR_WFL_QUALIFICATION (primary) = 
9093           build_tree_list (primary, NULL_TREE);
9094     }
9095
9096   EXPR_WFL_LINECOL (right) = location;
9097   chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
9098   PRIMARY_P (wfl) =  1;
9099   return wfl;
9100 }
9101
9102 /* Simple merge of two name separated by a `.' */
9103
9104 static tree
9105 merge_qualified_name (left, right)
9106      tree left, right;
9107 {
9108   tree node;
9109   obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
9110                 IDENTIFIER_LENGTH (left));
9111   obstack_1grow (&temporary_obstack, '.');
9112   obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
9113                  IDENTIFIER_LENGTH (right));
9114   node =  get_identifier (obstack_base (&temporary_obstack));
9115   obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
9116   QUALIFIED_P (node) = 1;
9117   return node;
9118 }
9119
9120 /* Merge the two parts of a qualified name into LEFT.  Set the
9121    location information of the resulting node to LOCATION, usually
9122    inherited from the location information of the `.' operator. */
9123
9124 static tree
9125 make_qualified_name (left, right, location)
9126      tree left, right;
9127      int location;
9128 {
9129 #ifdef USE_COMPONENT_REF
9130   tree node = build (COMPONENT_REF, NULL_TREE, left, right);
9131   EXPR_WFL_LINECOL (node) = location;
9132   return node;
9133 #else
9134   tree left_id = EXPR_WFL_NODE (left);
9135   tree right_id = EXPR_WFL_NODE (right);
9136   tree wfl, merge;
9137
9138   merge = merge_qualified_name (left_id, right_id);
9139
9140   /* Left wasn't qualified and is now qualified */
9141   if (!QUALIFIED_P (left_id))
9142     {
9143       tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
9144       EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
9145       EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
9146     }
9147   
9148   wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
9149   EXPR_WFL_LINECOL (wfl) = location;
9150   chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
9151
9152   EXPR_WFL_NODE (left) = merge;
9153   return left;
9154 #endif
9155 }
9156
9157 /* Extract the last identifier component of the qualified in WFL. The
9158    last identifier is removed from the linked list */
9159
9160 static tree
9161 cut_identifier_in_qualified (wfl)
9162      tree wfl;
9163 {
9164   tree q;
9165   tree previous = NULL_TREE;
9166   for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
9167     if (!TREE_CHAIN (q))
9168       {
9169         if (!previous)
9170           fatal ("Operating on a non qualified qualified WFL - cut_identifier_in_qualified");
9171         TREE_CHAIN (previous) = NULL_TREE;
9172         return TREE_PURPOSE (q);
9173       }
9174 }
9175
9176 /* Resolve the expression name NAME. Return its decl.  */
9177
9178 static tree
9179 resolve_expression_name (id, orig)
9180      tree id;
9181      tree *orig;
9182 {
9183   tree name = EXPR_WFL_NODE (id);
9184   tree decl;
9185
9186   /* 6.5.5.1: Simple expression names */
9187   if (!PRIMARY_P (id) && !QUALIFIED_P (name))
9188     {
9189       /* 15.13.1: NAME can appear within the scope of a local variable
9190          declaration */
9191       if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
9192         return decl;
9193
9194       /* 15.13.1: NAME can appear within a class declaration */
9195       else 
9196         {
9197           decl = lookup_field_wrapper (current_class, name);
9198           if (decl)
9199             {
9200               int fs = FIELD_STATIC (decl);
9201               /* Instance variable (8.3.1.1) can't appear within
9202                  static method, static initializer or initializer for
9203                  a static variable. */
9204               if (!fs && METHOD_STATIC (current_function_decl))
9205                 {
9206                   static_ref_err (id, name, current_class);
9207                   return error_mark_node;
9208                 }
9209               /* Instance variables can't appear as an argument of
9210                  an explicit constructor invocation */
9211               if (!fs && ctxp->explicit_constructor_p)
9212                 {
9213                   parse_error_context
9214                     (id, "Can't reference `%s' before the superclass constructor has been called", IDENTIFIER_POINTER (name));
9215                   return error_mark_node;
9216                 }
9217
9218               /* Otherwise build what it takes to access the field */
9219               decl = build_field_ref ((fs ? NULL_TREE : current_this),
9220                                       DECL_CONTEXT (decl), name);
9221               if (fs && !flag_emit_class_files && !flag_emit_xref)
9222                 decl = build_class_init (DECL_CONTEXT (decl), decl);
9223               /* We may be asked to save the real field access node */
9224               if (orig)
9225                 *orig = decl;
9226               /* And we return what we got */
9227               return decl;
9228             }
9229           /* Fall down to error report on undefined variable */
9230         }
9231     }
9232   /* 6.5.5.2 Qualified Expression Names */
9233   else
9234     {
9235       if (orig)
9236         *orig = NULL_TREE;
9237       qualify_ambiguous_name (id);
9238       /* 15.10.1 Field Access Using a Primary and/or Expression Name */
9239       /* 15.10.2: Accessing Superclass Members using super */
9240       return resolve_field_access (id, orig, NULL);
9241     }
9242
9243   /* We've got an error here */
9244   parse_error_context (id, "Undefined variable `%s'", 
9245                        IDENTIFIER_POINTER (name));
9246
9247   return error_mark_node;
9248 }
9249
9250 static void
9251 static_ref_err (wfl, field_id, class_type)
9252     tree wfl, field_id, class_type;
9253 {
9254   parse_error_context 
9255     (wfl, 
9256      "Can't make a static reference to nonstatic variable `%s' in class `%s'",
9257      IDENTIFIER_POINTER (field_id), 
9258      IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))));
9259 }
9260
9261 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
9262    We return something suitable to generate the field access. We also
9263    return the field decl in FIELD_DECL and its type in FIELD_TYPE.  If
9264    recipient's address can be null. */
9265
9266 static tree
9267 resolve_field_access (qual_wfl, field_decl, field_type)
9268      tree qual_wfl;
9269      tree *field_decl, *field_type;
9270 {
9271   int is_static = 0;
9272   tree field_ref;
9273   tree decl, where_found, type_found;
9274
9275   if (resolve_qualified_expression_name (qual_wfl, &decl,
9276                                          &where_found, &type_found))
9277     return error_mark_node;
9278
9279   /* Resolve the LENGTH field of an array here */
9280   if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
9281       && ! flag_emit_class_files && ! flag_emit_xref)
9282     {
9283       tree length = build_java_array_length_access (where_found);
9284       field_ref =
9285         build_java_arraynull_check (type_found, length, int_type_node);
9286     }
9287   /* We might have been trying to resolve field.method(). In which
9288      case, the resolution is over and decl is the answer */
9289   else if (JDECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
9290     field_ref = decl;
9291   else if (JDECL_P (decl))
9292     {
9293       int static_final_found = 0;
9294       if (!type_found)
9295         type_found = DECL_CONTEXT (decl);
9296       is_static = JDECL_P (decl) && FIELD_STATIC (decl);
9297       if (FIELD_FINAL (decl) 
9298           && JPRIMITIVE_TYPE_P (TREE_TYPE (decl))
9299           && DECL_LANG_SPECIFIC (decl)
9300           && DECL_INITIAL (decl))
9301         {
9302           field_ref = DECL_INITIAL (decl);
9303           static_final_found = 1;
9304         }
9305       else
9306         field_ref = build_field_ref ((is_static && !flag_emit_xref? 
9307                                       NULL_TREE : where_found), 
9308                                      type_found, DECL_NAME (decl));
9309       if (field_ref == error_mark_node)
9310         return error_mark_node;
9311       if (is_static && !static_final_found 
9312           && !flag_emit_class_files && !flag_emit_xref)
9313         field_ref = build_class_init (type_found, field_ref);
9314     }
9315   else
9316     field_ref = decl;
9317
9318   if (field_decl)
9319     *field_decl = decl;
9320   if (field_type)
9321     *field_type = (QUAL_DECL_TYPE (decl) ? 
9322                    QUAL_DECL_TYPE (decl) : TREE_TYPE (decl));
9323   return field_ref;
9324 }
9325
9326 /* If NODE is an access to f static field, strip out the class
9327    initialization part and return the field decl, otherwise, return
9328    NODE. */
9329
9330 static tree
9331 strip_out_static_field_access_decl (node)
9332     tree node;
9333 {
9334   if (TREE_CODE (node) == COMPOUND_EXPR)
9335     {
9336       tree op1 = TREE_OPERAND (node, 1);
9337       if (TREE_CODE (op1) == COMPOUND_EXPR)
9338          {
9339            tree call = TREE_OPERAND (op1, 0);
9340            if (TREE_CODE (call) == CALL_EXPR
9341                && TREE_CODE (TREE_OPERAND (call, 0)) == ADDR_EXPR
9342                && TREE_OPERAND (TREE_OPERAND (call, 0), 0)
9343                == soft_initclass_node)
9344              return TREE_OPERAND (op1, 1);
9345          }
9346       else if (JDECL_P (op1))
9347         return op1;
9348     }
9349   return node;
9350 }
9351
9352 /* 6.5.5.2: Qualified Expression Names */
9353
9354 static int
9355 resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
9356      tree wfl;
9357      tree *found_decl, *type_found, *where_found;
9358 {
9359   int from_type = 0;            /* Field search initiated from a type */
9360   int from_super = 0, from_cast = 0;
9361   int previous_call_static = 0;
9362   int is_static;
9363   tree decl = NULL_TREE, type = NULL_TREE, q;
9364   *type_found = *where_found = NULL_TREE;
9365
9366   for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
9367     {
9368       tree qual_wfl = QUAL_WFL (q);
9369       tree ret_decl;            /* for EH checking */
9370       int location;             /* for EH checking */
9371
9372       /* 15.10.1 Field Access Using a Primary */
9373       switch (TREE_CODE (qual_wfl))
9374         {
9375         case CALL_EXPR:
9376         case NEW_CLASS_EXPR:
9377           /* If the access to the function call is a non static field,
9378              build the code to access it. */
9379           if (JDECL_P (decl) && !FIELD_STATIC (decl))
9380             {
9381               decl = maybe_access_field (decl, *where_found, 
9382                                          DECL_CONTEXT (decl));
9383               if (decl == error_mark_node)
9384                 return 1;
9385             }
9386           /* And code for the function call */
9387           if (complete_function_arguments (qual_wfl))
9388             return 1;
9389           
9390           if (from_super && TREE_CODE (qual_wfl) == CALL_EXPR)
9391             CALL_USING_SUPER (qual_wfl) = 1;
9392           location = (TREE_CODE (qual_wfl) == CALL_EXPR ?
9393                       EXPR_WFL_LINECOL (TREE_OPERAND (qual_wfl, 0)) : 0);
9394           *where_found = patch_method_invocation (qual_wfl, decl, type, 
9395                                                   &is_static, &ret_decl);
9396           if (*where_found == error_mark_node)
9397             return 1;
9398           *type_found = type = QUAL_DECL_TYPE (*where_found);
9399
9400           /* EH check */
9401           if (location)
9402             check_thrown_exceptions (location, ret_decl);
9403
9404           /* If the previous call was static and this one is too,
9405              build a compound expression to hold the two (because in
9406              that case, previous function calls aren't transported as
9407              forcoming function's argument. */
9408           if (previous_call_static && is_static)
9409             {
9410               decl = build (COMPOUND_EXPR, type, decl, *where_found);
9411               TREE_SIDE_EFFECTS (decl) = 1;
9412             }
9413           else
9414             {
9415               previous_call_static = is_static;
9416               decl = *where_found;
9417             }
9418           continue;
9419
9420         case NEW_ARRAY_EXPR:
9421           *where_found = decl = java_complete_tree (qual_wfl);
9422           if (decl == error_mark_node)
9423             return 1;
9424           *type_found = type = QUAL_DECL_TYPE (decl);
9425           CLASS_LOADED_P (type) = 1;
9426           continue;
9427
9428         case CONVERT_EXPR:
9429           *where_found = decl = java_complete_tree (qual_wfl);
9430           if (decl == error_mark_node)
9431             return 1;
9432           *type_found = type = QUAL_DECL_TYPE (decl);
9433           from_cast = 1;
9434           continue;
9435
9436         case CONDITIONAL_EXPR:
9437         case STRING_CST:
9438         case MODIFY_EXPR:
9439           *where_found = decl = java_complete_tree (qual_wfl);
9440           if (decl == error_mark_node)
9441             return 1;
9442           *type_found = type = QUAL_DECL_TYPE (decl);
9443           continue;
9444
9445         case ARRAY_REF:
9446           /* If the access to the function call is a non static field,
9447              build the code to access it. */
9448           if (JDECL_P (decl) && !FIELD_STATIC (decl))
9449             {
9450               decl = maybe_access_field (decl, *where_found, type);
9451               if (decl == error_mark_node)
9452                 return 1;
9453             }
9454           /* And code for the array reference expression */
9455           decl = java_complete_tree (qual_wfl);
9456           if (decl == error_mark_node)
9457             return 1;
9458           type = QUAL_DECL_TYPE (decl);
9459           continue;
9460
9461         case PLUS_EXPR:
9462           if ((decl = java_complete_tree (qual_wfl)) == error_mark_node)
9463             return 1;
9464           if ((type = patch_string (decl)))
9465             decl = type;
9466           *where_found = QUAL_RESOLUTION (q) = decl;
9467           *type_found = type = TREE_TYPE (decl);
9468           break;
9469
9470         default:
9471           /* Fix for -Wall Just go to the next statement. Don't
9472              continue */
9473           break;
9474         }
9475
9476       /* If we fall here, we weren't processing a (static) function call. */
9477       previous_call_static = 0;
9478
9479       /* It can be the keyword THIS */
9480       if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
9481         {
9482           if (!current_this)
9483             {
9484               parse_error_context 
9485                 (wfl, "Keyword `this' used outside allowed context");
9486               return 1;
9487             }
9488           if (ctxp->explicit_constructor_p)
9489             {
9490               parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
9491               return 1;
9492             }
9493           /* We have to generate code for intermediate acess */
9494           *where_found = decl = current_this;
9495           *type_found = type = QUAL_DECL_TYPE (decl);
9496           continue;
9497         }
9498
9499       /* 15.10.2 Accessing Superclass Members using SUPER */
9500       if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
9501         {
9502           tree node;
9503           /* Check on the restricted use of SUPER */
9504           if (METHOD_STATIC (current_function_decl)
9505               || current_class == object_type_node)
9506             {
9507               parse_error_context 
9508                 (wfl, "Keyword `super' used outside allowed context");
9509               return 1;
9510             }
9511           /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
9512           node = build_cast (EXPR_WFL_LINECOL (qual_wfl), 
9513                              CLASSTYPE_SUPER (current_class),
9514                              build_this (EXPR_WFL_LINECOL (qual_wfl)));
9515           *where_found = decl = java_complete_tree (node);
9516           if (decl == error_mark_node)
9517             return 1;
9518           *type_found = type = QUAL_DECL_TYPE (decl);
9519           from_super = from_type = 1;
9520           continue;
9521         }
9522
9523       /* 15.13.1: Can't search for field name in packages, so we
9524          assume a variable/class name was meant. */
9525       if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
9526         {
9527           tree name = resolve_package (wfl, &q);
9528           if (name)
9529             {
9530               *where_found = decl = resolve_no_layout (name, qual_wfl);
9531               /* We wan't to be absolutely that the class is laid
9532                  out. We're going to search something inside it. */
9533               *type_found = type = TREE_TYPE (decl);
9534               layout_class (type);
9535               from_type = 1;
9536               /* Should be a list, really. FIXME */
9537               RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 1;
9538               RESOLVE_PACKAGE_NAME_P (QUAL_WFL (TREE_CHAIN (q))) = 0;
9539             }
9540           else
9541             {
9542               if (from_super || from_cast)
9543                 parse_error_context 
9544                   ((from_cast ? qual_wfl : wfl),
9545                    "No variable `%s' defined in class `%s'",
9546                    IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9547                    lang_printable_name (type, 0));
9548               else
9549                 parse_error_context
9550                   (qual_wfl, "Undefined variable or class name: `%s'",
9551                    IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
9552               return 1;
9553             }
9554         }
9555
9556       /* We have a type name. It's been already resolved when the
9557          expression was qualified. */
9558       else if (RESOLVE_TYPE_NAME_P (qual_wfl))
9559         {
9560           if (!(decl = QUAL_RESOLUTION (q)))
9561             return 1;           /* Error reported already */
9562
9563           if (not_accessible_p (TREE_TYPE (decl), decl, 0))
9564             {
9565               parse_error_context 
9566                 (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
9567                  java_accstring_lookup (get_access_flags_from_decl (decl)),
9568                  GET_TYPE_NAME (type),
9569                  IDENTIFIER_POINTER (DECL_NAME (decl)),
9570                  IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
9571               return 1;
9572             }
9573           check_deprecation (qual_wfl, decl);
9574           
9575           type = TREE_TYPE (decl);
9576           from_type = 1;
9577         }
9578       /* We resolve and expression name */
9579       else 
9580         {
9581           tree field_decl = NULL_TREE;
9582
9583           /* If there exists an early resolution, use it. That occurs
9584              only once and we know that there are more things to
9585              come. Don't do that when processing something after SUPER
9586              (we need more thing to be put in place below */
9587           if (!from_super && QUAL_RESOLUTION (q))
9588             {
9589               decl = QUAL_RESOLUTION (q);
9590               if (!type)
9591                 {
9592                   if (TREE_CODE (decl) == FIELD_DECL && !FIELD_STATIC (decl))
9593                     {
9594                       if (current_this)
9595                         *where_found = current_this;
9596                       else
9597                         {
9598                           static_ref_err (qual_wfl, DECL_NAME (decl),
9599                                           current_class);
9600                           return 1;
9601                         }
9602                     }
9603                   else
9604                     {
9605                       *where_found = TREE_TYPE (decl);
9606                       if (TREE_CODE (*where_found) == POINTER_TYPE)
9607                         *where_found = TREE_TYPE (*where_found);
9608                     }
9609                 }
9610             }
9611
9612           /* We have to search for a field, knowing the type of its
9613              container. The flag FROM_TYPE indicates that we resolved
9614              the last member of the expression as a type name, which
9615              means that for the resolution of this field, we'll look
9616              for other errors than if it was resolved as a member of
9617              an other field. */
9618           else
9619             {
9620               int is_static;
9621               tree field_decl_type; /* For layout */
9622
9623               if (!from_type && !JREFERENCE_TYPE_P (type))
9624                 {
9625                   parse_error_context 
9626                     (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
9627                      IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
9628                      lang_printable_name (type, 0),
9629                      IDENTIFIER_POINTER (DECL_NAME (field_decl)));
9630                   return 1;
9631                 }
9632               
9633               field_decl = lookup_field_wrapper (type,
9634                                                  EXPR_WFL_NODE (qual_wfl));
9635               if (field_decl == NULL_TREE)
9636                 {
9637                   parse_error_context 
9638                     (qual_wfl, "No variable `%s' defined in type `%s'",
9639                      IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)), 
9640                      GET_TYPE_NAME (type));
9641                   return 1;
9642                 }
9643               if (field_decl == error_mark_node)
9644                 return 1;
9645
9646               /* Layout the type of field_decl, since we may need
9647                  it. Don't do primitive types or loaded classes. The
9648                  situation of non primitive arrays may not handled
9649                  properly here. FIXME */
9650               if (TREE_CODE (TREE_TYPE (field_decl)) == POINTER_TYPE)
9651                 field_decl_type = TREE_TYPE (TREE_TYPE (field_decl));
9652               else
9653                 field_decl_type = TREE_TYPE (field_decl);
9654               if (!JPRIMITIVE_TYPE_P (field_decl_type) 
9655                   && !CLASS_LOADED_P (field_decl_type)
9656                   && !TYPE_ARRAY_P (field_decl_type))
9657                 resolve_and_layout (field_decl_type, NULL_TREE);
9658               if (TYPE_ARRAY_P (field_decl_type))
9659                 CLASS_LOADED_P (field_decl_type) = 1;
9660               
9661               /* Check on accessibility here */
9662               if (not_accessible_p (type, field_decl, from_super))
9663                 {
9664                   parse_error_context 
9665                     (qual_wfl,
9666                      "Can't access %s field `%s.%s' from `%s'",
9667                      java_accstring_lookup 
9668                        (get_access_flags_from_decl (field_decl)),
9669                      GET_TYPE_NAME (type),
9670                      IDENTIFIER_POINTER (DECL_NAME (field_decl)),
9671                      IDENTIFIER_POINTER 
9672                        (DECL_NAME (TYPE_NAME (current_class))));
9673                   return 1;
9674                 }
9675               check_deprecation (qual_wfl, field_decl);
9676               
9677               /* There are things to check when fields are accessed
9678                  from type. There are no restrictions on a static
9679                  declaration of the field when it is accessed from an
9680                  interface */
9681               is_static = FIELD_STATIC (field_decl);
9682               if (!from_super && from_type 
9683                   && !TYPE_INTERFACE_P (type) && !is_static)
9684                 {
9685                   static_ref_err (qual_wfl, EXPR_WFL_NODE (qual_wfl), type);
9686                   return 1;
9687                 }
9688               from_cast = from_super = 0;
9689
9690               /* If we need to generate something to get a proper
9691                  handle on what this field is accessed from, do it
9692                  now. */
9693               if (!is_static)
9694                 {
9695                   decl = maybe_access_field (decl, *where_found, *type_found);
9696                   if (decl == error_mark_node)
9697                     return 1;
9698                 }
9699
9700               /* We want to keep the location were found it, and the type
9701                  we found. */
9702               *where_found = decl;
9703               *type_found = type;
9704
9705               /* This is the decl found and eventually the next one to
9706                  search from */
9707               decl = field_decl;
9708             }
9709           from_type = 0;
9710           type = QUAL_DECL_TYPE (decl);
9711         }
9712     }
9713   *found_decl = decl;
9714   return 0;
9715 }
9716
9717 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
9718    can't be accessed from REFERENCE (a record type). */
9719
9720 static int
9721 not_accessible_p (reference, member, from_super)
9722      tree reference, member;
9723      int from_super;
9724 {
9725   int access_flag = get_access_flags_from_decl (member);
9726
9727   /* Access always granted for members declared public */
9728   if (access_flag & ACC_PUBLIC)
9729     return 0;
9730   
9731   /* Check access on protected members */
9732   if (access_flag & ACC_PROTECTED)
9733     {
9734       /* Access granted if it occurs from within the package
9735          containing the class in which the protected member is
9736          declared */
9737       if (class_in_current_package (DECL_CONTEXT (member)))
9738         return 0;
9739
9740       /* If accessed with the form `super.member', then access is granted */
9741       if (from_super)
9742         return 0;
9743
9744       /* Otherwise, access is granted if occuring from the class where
9745          member is declared or a subclass of it */
9746       if (inherits_from_p (reference, current_class))
9747         return 0;
9748       return 1;
9749     }
9750
9751   /* Check access on private members. Access is granted only if it
9752      occurs from within the class in witch it is declared */
9753   if (access_flag & ACC_PRIVATE)
9754     return (current_class == DECL_CONTEXT (member) ? 0 : 1);
9755
9756   /* Default access are permitted only when occuring within the
9757      package in which the type (REFERENCE) is declared. In other words,
9758      REFERENCE is defined in the current package */
9759   if (ctxp->package)
9760     return !class_in_current_package (reference);
9761   
9762   /* Otherwise, access is granted */
9763   return 0;
9764 }
9765
9766 /* Test deprecated decl access.  */
9767 static void
9768 check_deprecation (wfl, decl)
9769      tree wfl, decl;
9770 {
9771   const char *file = DECL_SOURCE_FILE (decl);
9772   /* Complain if the field is deprecated and the file it was defined
9773      in isn't compiled at the same time the file which contains its
9774      use is */
9775   if (DECL_DEPRECATED (decl) 
9776       && !IS_A_COMMAND_LINE_FILENAME_P (get_identifier (file)))
9777     {
9778       char the [20];
9779       switch (TREE_CODE (decl))
9780         {
9781         case FUNCTION_DECL:
9782           strcpy (the, "method");
9783           break;
9784         case FIELD_DECL:
9785           strcpy (the, "field");
9786           break;
9787         case TYPE_DECL:
9788           strcpy (the, "class");
9789           break;
9790         default:
9791           fatal ("unexpected DECL code - check_deprecation");
9792         }
9793       parse_warning_context 
9794         (wfl, "The %s `%s' in class `%s' has been deprecated", 
9795          the, lang_printable_name (decl, 0),
9796          IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))));
9797     }
9798 }
9799
9800 /* Returns 1 if class was declared in the current package, 0 otherwise */
9801
9802 static int
9803 class_in_current_package (class)
9804      tree class;
9805 {
9806   static tree cache = NULL_TREE;
9807   int qualified_flag;
9808   tree left;
9809
9810   if (cache == class)
9811     return 1;
9812
9813   qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
9814
9815   /* If the current package is empty and the name of CLASS is
9816      qualified, class isn't in the current package.  If there is a
9817      current package and the name of the CLASS is not qualified, class
9818      isn't in the current package */
9819   if ((!ctxp->package && qualified_flag) || (ctxp->package && !qualified_flag))
9820     return 0;
9821
9822   /* If there is not package and the name of CLASS isn't qualified,
9823      they belong to the same unnamed package */
9824   if (!ctxp->package && !qualified_flag)
9825     return 1;
9826
9827   /* Compare the left part of the name of CLASS with the package name */
9828   breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
9829   if (ctxp->package == left)
9830     {
9831       cache = class;
9832       return 1;
9833     }
9834   return 0;
9835 }
9836
9837 /* This function may generate code to access DECL from WHERE. This is
9838    done only if certain conditions meet.  */
9839
9840 static tree
9841 maybe_access_field (decl, where, type)
9842   tree decl, where, type;
9843 {
9844   if (TREE_CODE (decl) == FIELD_DECL && decl != current_this
9845       && !FIELD_STATIC (decl))
9846     decl = build_field_ref (where ? where : current_this, 
9847                             (type ? type : DECL_CONTEXT (decl)),
9848                             DECL_NAME (decl));
9849   return decl;
9850 }
9851
9852 /* Build a method invocation, by patching PATCH. If non NULL
9853    and according to the situation, PRIMARY and WHERE may be
9854    used. IS_STATIC is set to 1 if the invoked function is static. */
9855
9856 static tree
9857 patch_method_invocation (patch, primary, where, is_static, ret_decl)
9858      tree patch, primary, where;
9859      int *is_static;
9860      tree *ret_decl;
9861 {
9862   tree wfl = TREE_OPERAND (patch, 0);
9863   tree args = TREE_OPERAND (patch, 1);
9864   tree name = EXPR_WFL_NODE (wfl);
9865   tree list;
9866   int is_static_flag = 0;
9867   int is_super_init = 0;
9868   tree this_arg = NULL_TREE;
9869   
9870   /* Should be overriden if everything goes well. Otherwise, if
9871      something fails, it should keep this value. It stop the
9872      evaluation of a bogus assignment. See java_complete_tree,
9873      MODIFY_EXPR: for the reasons why we sometimes want to keep on
9874      evaluating an assignment */
9875   TREE_TYPE (patch) = error_mark_node;
9876
9877   /* Since lookup functions are messing with line numbers, save the
9878      context now.  */
9879   java_parser_context_save_global ();
9880
9881   /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
9882
9883   /* Resolution of qualified name, excluding constructors */
9884   if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
9885     {
9886       tree class_decl, identifier, identifier_wfl;
9887       /* Extract the last IDENTIFIER of the qualified
9888          expression. This is a wfl and we will use it's location
9889          data during error report. */
9890       identifier_wfl = cut_identifier_in_qualified (wfl);
9891       identifier = EXPR_WFL_NODE (identifier_wfl);
9892       
9893       /* Given the context, IDENTIFIER is syntactically qualified
9894          as a MethodName. We need to qualify what's before */
9895       qualify_ambiguous_name (wfl);
9896
9897       /* Package resolution */
9898       if (RESOLVE_PACKAGE_NAME_P (wfl))
9899         {
9900           tree next, decl, name = resolve_package (wfl, &next);
9901           
9902           if (!name)
9903             {
9904               tree remainder;
9905               breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
9906               parse_error_context
9907                 (wfl, "Can't search method `%s' in package `%s'",
9908                  IDENTIFIER_POINTER (identifier),
9909                  IDENTIFIER_POINTER (remainder));
9910               PATCH_METHOD_RETURN_ERROR ();
9911             }
9912           RESOLVE_PACKAGE_NAME_P (wfl) = 0;
9913           if ((decl = resolve_no_layout (name, QUAL_WFL (next))))
9914             {
9915               QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl)) = decl;
9916               RESOLVE_EXPRESSION_NAME_P (wfl) = 0;
9917               RESOLVE_TYPE_NAME_P (wfl) = 1;
9918             }
9919           else
9920             {
9921               RESOLVE_EXPRESSION_NAME_P (wfl) = 1;
9922               RESOLVE_TYPE_NAME_P (wfl) = 0;
9923             }
9924         }
9925
9926       /* We're resolving a call from a type */
9927       if (RESOLVE_TYPE_NAME_P (wfl))
9928         {
9929           tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
9930           tree name = DECL_NAME (decl);
9931           tree type;
9932
9933           class_decl = resolve_and_layout (name, wfl);
9934           if (CLASS_INTERFACE (decl))
9935             {
9936               parse_error_context
9937                 (identifier_wfl,
9938                 "Can't make static reference to method `%s' in interface `%s'",
9939                  IDENTIFIER_POINTER (identifier), 
9940                  IDENTIFIER_POINTER (name));
9941               PATCH_METHOD_RETURN_ERROR ();
9942             }
9943           /* Look the method up in the type selector. The method ought
9944              to be static. */
9945           type = TREE_TYPE (class_decl);
9946           list = lookup_method_invoke (0, wfl, type, identifier, args);
9947           if (list && !METHOD_STATIC (list))
9948             {
9949               char *fct_name = xstrdup (lang_printable_name (list, 0));
9950               parse_error_context 
9951                 (identifier_wfl,
9952                  "Can't make static reference to method `%s %s' in class `%s'",
9953                  lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), 
9954                  fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
9955               free (fct_name);
9956               PATCH_METHOD_RETURN_ERROR ();
9957             }
9958           args = nreverse (args);
9959         }
9960       /* We're resolving an expression name */
9961       else
9962         {
9963           tree field, type;
9964           
9965           /* 1- Find the field to which the call applies */
9966           field = resolve_field_access (wfl, NULL, &type);
9967           if (field == error_mark_node)
9968             PATCH_METHOD_RETURN_ERROR ();
9969           /* field is used in lieu of a primary. It alows us not to
9970            report errors on erroneous use of `this' in
9971            constructors. */
9972           primary = field;      
9973           
9974           /* 2- Do the layout of the class where the last field
9975              was found, so we can search it. */
9976           class_decl = resolve_and_layout (type, NULL_TREE);
9977           if (class_decl != NULL_TREE)
9978           type = TREE_TYPE (class_decl);
9979
9980           /* 3- Retrieve a filtered list of method matches, Refine
9981              if necessary. In any cases, point out errors.  */
9982           list = lookup_method_invoke (0, identifier_wfl, type, 
9983                                        identifier, args);
9984
9985           /* 4- Add the field as an argument */
9986           args = nreverse (args);
9987           this_arg = field;
9988         }
9989
9990       /* IDENTIFIER_WFL will be used to report any problem further */
9991       wfl = identifier_wfl;
9992     }
9993   /* Resolution of simple names, names generated after a primary: or
9994      constructors */
9995   else
9996     {
9997       tree class_to_search = NULL_TREE;
9998       int lc;           /* Looking for Constructor */
9999       
10000       /* We search constructor in their target class */
10001       if (CALL_CONSTRUCTOR_P (patch))
10002         {
10003           if (TREE_CODE (patch) == NEW_CLASS_EXPR)
10004             class_to_search = EXPR_WFL_NODE (wfl);
10005           else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) == 
10006                    this_identifier_node)
10007             class_to_search = NULL_TREE;
10008           else if (EXPR_WFL_NODE (TREE_OPERAND (patch, 0)) ==
10009                    super_identifier_node)
10010             {
10011               is_super_init = 1;
10012               if (CLASSTYPE_SUPER (current_class))
10013                 class_to_search = 
10014                   DECL_NAME (TYPE_NAME (CLASSTYPE_SUPER (current_class)));
10015               else
10016                 {
10017                   parse_error_context (wfl, "Can't invoke super constructor on java.lang.Object");
10018                   PATCH_METHOD_RETURN_ERROR ();
10019                 }
10020             }
10021
10022           /* Class to search is NULL if we're searching the current one */
10023           if (class_to_search)
10024             {
10025               class_to_search = resolve_and_layout (class_to_search, 
10026                                                     NULL_TREE);
10027               if (!class_to_search)
10028                 {
10029                   parse_error_context 
10030                     (wfl, "Class `%s' not found in type declaration",
10031                      IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
10032                   PATCH_METHOD_RETURN_ERROR ();
10033                 }
10034               
10035               /* Can't instantiate an abstract class, but we can
10036                  invoke it's constructor. It's use within the `new'
10037                  context is denied here. */
10038               if (CLASS_ABSTRACT (class_to_search) 
10039                   && TREE_CODE (patch) == NEW_CLASS_EXPR)
10040                 {
10041                   parse_error_context 
10042                     (wfl, "Class `%s' is an abstract class. It can't be instantiated",
10043                      IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
10044                   PATCH_METHOD_RETURN_ERROR ();
10045                 }
10046               class_to_search = TREE_TYPE (class_to_search);
10047             }
10048           else
10049             class_to_search = current_class;
10050           lc = 1;
10051         }
10052       /* This is a regular search in the local class, unless an
10053          alternate class is specified. */
10054       else
10055         {
10056           class_to_search = (where ? where : current_class);
10057           lc = 0;
10058         }
10059       
10060       /* NAME is a simple identifier or comes from a primary. Search
10061          in the class whose declaration contain the method being
10062          invoked. */
10063       resolve_and_layout (class_to_search, NULL_TREE);
10064       list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
10065
10066       /* Don't continue if no method were found, as the next statement
10067          can't be executed then. */
10068       if (!list)
10069         PATCH_METHOD_RETURN_ERROR ();
10070
10071       /* Check for static reference if non static methods */
10072       if (check_for_static_method_reference (wfl, patch, list, 
10073                                              class_to_search, primary))
10074         PATCH_METHOD_RETURN_ERROR ();
10075
10076       /* Non static methods are called with the current object extra
10077          argument. If patch a `new TYPE()', the argument is the value
10078          returned by the object allocator. If method is resolved as a
10079          primary, use the primary otherwise use the current THIS. */
10080       args = nreverse (args);
10081       if (TREE_CODE (patch) != NEW_CLASS_EXPR)
10082         this_arg = primary ? primary : current_this;
10083     }
10084
10085   /* Merge point of all resolution schemes. If we have nothing, this
10086      is an error, already signaled */
10087   if (!list) 
10088     PATCH_METHOD_RETURN_ERROR ();
10089
10090   /* Check accessibility, position the is_static flag, build and
10091      return the call */
10092   if (not_accessible_p (DECL_CONTEXT (current_function_decl), list, 0))
10093     {
10094       char *fct_name = xstrdup (lang_printable_name (list, 0));
10095       parse_error_context 
10096         (wfl, "Can't access %s method `%s %s.%s' from `%s'",
10097          java_accstring_lookup (get_access_flags_from_decl (list)),
10098          lang_printable_name (TREE_TYPE (TREE_TYPE (list)), 0), 
10099          IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (list)))), 
10100          fct_name, IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
10101       free (fct_name);
10102       PATCH_METHOD_RETURN_ERROR ();
10103     }
10104   check_deprecation (wfl, list);
10105
10106   is_static_flag = METHOD_STATIC (list);
10107   if (! METHOD_STATIC (list) && this_arg != NULL_TREE)
10108     args = tree_cons (NULL_TREE, this_arg, args);
10109
10110   /* In the context of an explicit constructor invocation, we can't
10111      invoke any method relying on `this'. Exceptions are: we're
10112      invoking a static function, primary exists and is not the current
10113      this, we're creating a new object. */
10114   if (ctxp->explicit_constructor_p 
10115       && !is_static_flag 
10116       && (!primary || primary == current_this)
10117       && (TREE_CODE (patch) != NEW_CLASS_EXPR))
10118     {
10119       parse_error_context (wfl, "Can't reference `this' before the superclass constructor has been called");
10120       PATCH_METHOD_RETURN_ERROR ();
10121     }
10122   java_parser_context_restore_global ();
10123   if (is_static) 
10124     *is_static = is_static_flag;
10125   /* Sometimes, we want the decl of the selected method. Such as for
10126      EH checking */
10127   if (ret_decl)
10128     *ret_decl = list;
10129   patch = patch_invoke (patch, list, args);
10130   if (is_super_init && CLASS_HAS_FINIT_P (current_class))
10131     {
10132       /* Generate the code used to initialize fields declared with an
10133          initialization statement. For now, it returns a call the the
10134          artificial function $finit$, if required. */
10135
10136       tree finit_call =
10137         build_method_invocation (build_expr_wfl (finit_identifier_node,  
10138                                                  input_filename, 0, 0),  
10139                                  NULL_TREE);
10140       patch = build (COMPOUND_EXPR, void_type_node, patch,
10141                      java_complete_tree (finit_call));
10142       CAN_COMPLETE_NORMALLY (patch) = 1;
10143     }
10144   return patch;
10145 }
10146
10147 /* Check that we're not trying to do a static reference to a method in
10148    non static method. Return 1 if it's the case, 0 otherwise. */
10149
10150 static int
10151 check_for_static_method_reference (wfl, node, method, where, primary)
10152      tree wfl, node, method, where, primary;
10153 {
10154   if (METHOD_STATIC (current_function_decl) 
10155       && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
10156     {
10157       char *fct_name = xstrdup (lang_printable_name (method, 0));
10158       parse_error_context 
10159         (wfl, "Can't make static reference to method `%s %s' in class `%s'", 
10160          lang_printable_name (TREE_TYPE (TREE_TYPE (method)), 0), fct_name,
10161          IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
10162       free (fct_name);
10163       return 1;
10164     }
10165   return 0;
10166 }
10167
10168 /* Patch an invoke expression METHOD and ARGS, based on its invocation
10169    mode.  */
10170
10171 static tree
10172 patch_invoke (patch, method, args)
10173      tree patch, method, args;
10174 {
10175   tree dtable, func;
10176   tree original_call, t, ta;
10177
10178   /* Last step for args: convert build-in types. If we're dealing with
10179      a new TYPE() type call, the first argument to the constructor
10180      isn't found in the incomming argument list, but delivered by
10181      `new' */
10182   t = TYPE_ARG_TYPES (TREE_TYPE (method));
10183   if (TREE_CODE (patch) == NEW_CLASS_EXPR)
10184     t = TREE_CHAIN (t);
10185   for (ta = args; t != end_params_node && ta; 
10186        t = TREE_CHAIN (t), ta = TREE_CHAIN (ta))
10187     if (JPRIMITIVE_TYPE_P (TREE_TYPE (TREE_VALUE (ta))) &&
10188         TREE_TYPE (TREE_VALUE (ta)) != TREE_VALUE (t))
10189       TREE_VALUE (ta) = convert (TREE_VALUE (t), TREE_VALUE (ta));
10190
10191   /* Resolve unresolved returned type isses */
10192   t = TREE_TYPE (TREE_TYPE (method));
10193   if (TREE_CODE (t) == POINTER_TYPE && !CLASS_LOADED_P (TREE_TYPE (t)))
10194     resolve_and_layout (TREE_TYPE (t), NULL);
10195   
10196   if (flag_emit_class_files || flag_emit_xref)
10197     func = method;
10198   else
10199     {
10200       tree signature = build_java_signature (TREE_TYPE (method));
10201       switch (invocation_mode (method, CALL_USING_SUPER (patch)))
10202         {
10203         case INVOKE_VIRTUAL:
10204           dtable = invoke_build_dtable (0, args);
10205           func = build_invokevirtual (dtable, method);
10206           break;
10207
10208         case INVOKE_SUPER:
10209         case INVOKE_STATIC:
10210           func = build_known_method_ref (method, TREE_TYPE (method),
10211                                          DECL_CONTEXT (method),
10212                                          signature, args);
10213           break;
10214
10215         case INVOKE_INTERFACE:
10216           dtable = invoke_build_dtable (1, args);
10217           func = build_invokeinterface (dtable, method);
10218           break;
10219
10220         default:
10221           fatal ("internal error - unknown invocation_mode result");
10222         }
10223
10224       /* Ensure self_type is initialized, (invokestatic). FIXME */
10225       func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
10226     }
10227
10228   TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
10229   TREE_OPERAND (patch, 0) = func;
10230   TREE_OPERAND (patch, 1) = args;
10231   original_call = patch;
10232
10233   /* We're processing a `new TYPE ()' form. New is called an its
10234      returned value is the first argument to the constructor. We build
10235      a COMPOUND_EXPR and use saved expression so that the overall NEW
10236      expression value is a pointer to a newly created and initialized
10237      class. */
10238   if (TREE_CODE (original_call) == NEW_CLASS_EXPR)
10239     {
10240       tree class = DECL_CONTEXT (method);
10241       tree c1, saved_new, size, new;
10242       if (flag_emit_class_files || flag_emit_xref)
10243         {
10244           TREE_TYPE (patch) = build_pointer_type (class);
10245           return patch;
10246         }
10247       if (!TYPE_SIZE (class))
10248         safe_layout_class (class);
10249       size = size_in_bytes (class);
10250       new = build (CALL_EXPR, promote_type (class),
10251                    build_address_of (alloc_object_node),
10252                    tree_cons (NULL_TREE, build_class_ref (class),
10253                               build_tree_list (NULL_TREE, 
10254                                                size_in_bytes (class))),
10255                    NULL_TREE);
10256       saved_new = save_expr (new);
10257       c1 = build_tree_list (NULL_TREE, saved_new);
10258       TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
10259       TREE_OPERAND (original_call, 1) = c1;
10260       TREE_SET_CODE (original_call, CALL_EXPR);
10261       patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
10262     }
10263   return patch;
10264 }
10265
10266 static int
10267 invocation_mode (method, super)
10268      tree method;
10269      int super;
10270 {
10271   int access = get_access_flags_from_decl (method);
10272
10273   if (super)
10274     return INVOKE_SUPER;
10275
10276   if (access & ACC_STATIC || access & ACC_FINAL || access & ACC_PRIVATE)
10277     return INVOKE_STATIC;
10278
10279   if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
10280     return INVOKE_STATIC;
10281   
10282   if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
10283     return INVOKE_INTERFACE;
10284   
10285   if (DECL_CONSTRUCTOR_P (method))
10286     return INVOKE_STATIC;
10287
10288   return INVOKE_VIRTUAL;
10289 }
10290
10291 /* Retrieve a refined list of matching methods. It covers the step
10292    15.11.2 (Compile-Time Step 2) */
10293
10294 static tree
10295 lookup_method_invoke (lc, cl, class, name, arg_list)
10296      int lc;
10297      tree cl;
10298      tree class, name, arg_list;
10299 {
10300   tree atl = end_params_node;           /* Arg Type List */
10301   tree method, signature, list, node;
10302   const char *candidates;               /* Used for error report */
10303   char *dup;
10304
10305   /* Fix the arguments */
10306   for (node = arg_list; node; node = TREE_CHAIN (node))
10307     {
10308       tree current_arg = TREE_TYPE (TREE_VALUE (node));
10309       /* Non primitive type may have to be resolved */
10310       if (!JPRIMITIVE_TYPE_P (current_arg))
10311         resolve_and_layout (current_arg, NULL_TREE);
10312       /* And promoted */
10313       if (TREE_CODE (current_arg) == RECORD_TYPE)
10314         current_arg = promote_type (current_arg);
10315       atl = tree_cons (NULL_TREE, current_arg, atl);
10316     }
10317
10318   /* Find all candidates and then refine the list, searching for the
10319      most specific method. */
10320   list = find_applicable_accessible_methods_list (lc, class, name, atl);
10321   list = find_most_specific_methods_list (list);
10322   if (list && !TREE_CHAIN (list))
10323     return TREE_VALUE (list);
10324
10325   /* Issue an error. List candidates if any. Candidates are listed
10326      only if accessible (non accessible methods may end-up here for
10327      the sake of a better error report). */
10328   candidates = NULL;
10329   if (list)
10330     {
10331       tree current;
10332       obstack_grow (&temporary_obstack, ". Candidates are:\n", 18);
10333       for (current = list; current; current = TREE_CHAIN (current))
10334         {
10335           tree cm = TREE_VALUE (current);
10336           char string [4096];
10337           if (!cm || not_accessible_p (class, cm, 0))
10338             continue;
10339           sprintf 
10340             (string, "  `%s' in `%s'%s",
10341              get_printable_method_name (cm),
10342              IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (cm)))),
10343              (TREE_CHAIN (current) ? "\n" : ""));
10344           obstack_grow (&temporary_obstack, string, strlen (string));
10345         }
10346       obstack_1grow (&temporary_obstack, '\0');
10347       candidates = obstack_finish (&temporary_obstack);
10348     }
10349   /* Issue the error message */
10350   method = make_node (FUNCTION_TYPE);
10351   TYPE_ARG_TYPES (method) = atl;
10352   signature = build_java_argument_signature (method);
10353   dup = xstrdup (lang_printable_name (class, 0));
10354   parse_error_context (cl, "Can't find %s `%s(%s)' in type `%s'%s",
10355                        (lc ? "constructor" : "method"),
10356                        (lc ? dup : IDENTIFIER_POINTER (name)),
10357                        IDENTIFIER_POINTER (signature), dup,
10358                        (candidates ? candidates : ""));
10359   free (dup);
10360   return NULL_TREE;
10361 }
10362
10363 /* 15.11.2.1: Find Methods that are Applicable and Accessible. LC is 1
10364    when we're looking for a constructor. */
10365
10366 static tree
10367 find_applicable_accessible_methods_list (lc, class, name, arglist)
10368      int lc;
10369      tree class, name, arglist;
10370 {
10371   tree list = NULL_TREE, all_list = NULL_TREE;
10372
10373   /* Search interfaces */
10374   if (CLASS_INTERFACE (TYPE_NAME (class)) 
10375       || CLASS_ABSTRACT (TYPE_NAME (class)))
10376     {
10377       static tree searched_interfaces = NULL_TREE;
10378       static int search_not_done = 0;
10379       int i, n;
10380       tree basetype_vec = TYPE_BINFO_BASETYPES (class);
10381
10382       /* Have we searched this interface already? */
10383       if (searched_interfaces)
10384         {  
10385           tree current;  
10386           for (current = searched_interfaces; 
10387                current; current = TREE_CHAIN (current))
10388             if (TREE_VALUE (current) == class)
10389               return NULL;
10390         }
10391       searched_interfaces = tree_cons (NULL_TREE, class, searched_interfaces);
10392
10393       search_applicable_methods_list 
10394         (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
10395
10396       n = TREE_VEC_LENGTH (basetype_vec);
10397       for (i = 0; i < n; i++)
10398         {
10399           tree t = BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i));
10400           tree rlist;
10401
10402           /* Skip java.lang.Object (we'll search it once later.) */
10403           if (t == object_type_node)
10404             continue;
10405
10406           search_not_done++;
10407           rlist = find_applicable_accessible_methods_list (lc,  t, name, 
10408                                                            arglist);
10409           all_list = chainon (rlist, (list ? list : all_list)); 
10410           search_not_done--;
10411         }
10412
10413       /* We're done. Reset the searched interfaces list and finally search
10414          java.lang.Object */
10415       if (!search_not_done)
10416         {  
10417           searched_interfaces = NULL_TREE;  
10418           search_applicable_methods_list (lc, TYPE_METHODS (object_type_node),
10419                                           name, arglist, &list, &all_list);
10420         }
10421     }
10422   /* Search classes */
10423   else
10424     while (class != NULL_TREE)
10425       {
10426         search_applicable_methods_list 
10427           (lc, TYPE_METHODS (class), name, arglist, &list, &all_list);
10428         class = (lc ? NULL_TREE : CLASSTYPE_SUPER (class));
10429       }
10430
10431   /* Either return the list obtained or all selected (but
10432      inaccessible) methods for better error report. */
10433   return (!list ? all_list : list);
10434 }
10435
10436 /* Effectively search for the approriate method in method */
10437
10438 static void 
10439 search_applicable_methods_list(lc, method, name, arglist, list, all_list)
10440      int lc;
10441      tree method, name, arglist;
10442      tree *list, *all_list;
10443 {
10444   for (; method; method = TREE_CHAIN (method))
10445     {
10446       /* When dealing with constructor, stop here, otherwise search
10447          other classes */
10448       if (lc && !DECL_CONSTRUCTOR_P (method))
10449         continue;
10450       else if (!lc && (DECL_CONSTRUCTOR_P (method) 
10451                        || (GET_METHOD_NAME (method) != name)))
10452         continue;
10453           
10454       if (argument_types_convertible (method, arglist))
10455         {
10456           /* Retain accessible methods only */
10457           if (!not_accessible_p (DECL_CONTEXT (current_function_decl), 
10458                                  method, 0))
10459             *list = tree_cons (NULL_TREE, method, *list);
10460           else
10461             /* Also retain all selected method here */
10462             *all_list = tree_cons (NULL_TREE, method, *list);
10463         }
10464     }
10465 }    
10466
10467 /* 15.11.2.2 Choose the Most Specific Method */
10468
10469 static tree
10470 find_most_specific_methods_list (list)
10471      tree list;
10472 {
10473   int max = 0;
10474   tree current, new_list = NULL_TREE;
10475   for (current = list; current; current = TREE_CHAIN (current))
10476     {
10477       tree method;
10478       DECL_SPECIFIC_COUNT (TREE_VALUE (current)) = 0;
10479
10480       for (method = list; method; method = TREE_CHAIN (method))
10481         {
10482           /* Don't test a method against itself */
10483           if (method == current)
10484             continue;
10485
10486           /* Compare arguments and location where method where declared */
10487           if (argument_types_convertible (TREE_VALUE (method), 
10488                                           TREE_VALUE (current))
10489               && valid_method_invocation_conversion_p 
10490                    (DECL_CONTEXT (TREE_VALUE (method)), 
10491                     DECL_CONTEXT (TREE_VALUE (current))))
10492             {
10493               int v = ++DECL_SPECIFIC_COUNT (TREE_VALUE (current));
10494               max = (v > max ? v : max);
10495             }
10496         }
10497     }
10498
10499   /* Review the list and select the maximally specific methods */
10500   for (current = list; current; current = TREE_CHAIN (current))
10501     if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
10502       new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
10503
10504   /* If we can't find one, lower expectations and try to gather multiple
10505      maximally specific methods */
10506   while (!new_list)
10507     {
10508       while (--max > 0)
10509         {
10510           if (DECL_SPECIFIC_COUNT (TREE_VALUE (current)) == max)
10511             new_list = tree_cons (NULL_TREE, TREE_VALUE (current), new_list);
10512         }
10513       return new_list;
10514     }
10515
10516   return new_list;
10517 }
10518
10519 /* Make sure that the type of each M2_OR_ARGLIST arguments can be
10520    converted by method invocation conversion (5.3) to the type of the
10521    corresponding parameter of M1. Implementation expects M2_OR_ARGLIST
10522    to change less often than M1. */
10523
10524 static int
10525 argument_types_convertible (m1, m2_or_arglist)
10526     tree m1, m2_or_arglist;
10527 {
10528   static tree m2_arg_value = NULL_TREE;
10529   static tree m2_arg_cache = NULL_TREE;
10530
10531   register tree m1_arg, m2_arg;
10532
10533   m1_arg = TYPE_ARG_TYPES (TREE_TYPE (m1));
10534   if (!METHOD_STATIC (m1))
10535     m1_arg = TREE_CHAIN (m1_arg);
10536
10537   if (m2_arg_value == m2_or_arglist)
10538     m2_arg = m2_arg_cache;
10539   else
10540     {
10541       /* M2_OR_ARGLIST can be a function DECL or a raw list of
10542          argument types */
10543       if (m2_or_arglist && TREE_CODE (m2_or_arglist) == FUNCTION_DECL)
10544         {
10545           m2_arg = TYPE_ARG_TYPES (TREE_TYPE (m2_or_arglist));
10546           if (!METHOD_STATIC (m2_or_arglist))
10547             m2_arg = TREE_CHAIN (m2_arg);
10548         }
10549       else
10550         m2_arg = m2_or_arglist;
10551
10552       m2_arg_value = m2_or_arglist;
10553       m2_arg_cache = m2_arg;
10554     }
10555
10556   while (m1_arg != end_params_node && m2_arg != end_params_node)
10557     {
10558       resolve_and_layout (TREE_VALUE (m1_arg), NULL_TREE);
10559       if (!valid_method_invocation_conversion_p (TREE_VALUE (m1_arg),
10560                                                  TREE_VALUE (m2_arg)))
10561         break;
10562       m1_arg = TREE_CHAIN (m1_arg);
10563       m2_arg = TREE_CHAIN (m2_arg);
10564     }
10565   return m1_arg == end_params_node && m2_arg == end_params_node;
10566 }
10567
10568 /* Qualification routines */
10569
10570 static void
10571 qualify_ambiguous_name (id)
10572      tree id;
10573 {
10574   tree qual, qual_wfl, name = NULL_TREE, decl, ptr_type = NULL_TREE,
10575     saved_current_class;
10576   int again, super_found = 0, this_found = 0, new_array_found = 0;
10577   int code;
10578
10579   /* We first qualify the first element, then derive qualification of
10580      others based on the first one. If the first element is qualified
10581      by a resolution (field or type), this resolution is stored in the
10582      QUAL_RESOLUTION of the qual element being examined. We need to
10583      save the current_class since the use of SUPER might change the
10584      its value. */
10585   saved_current_class = current_class;
10586   qual = EXPR_WFL_QUALIFICATION (id);
10587   do {
10588
10589     /* Simple qualified expression feature a qual_wfl that is a
10590        WFL. Expression derived from a primary feature more complicated
10591        things like a CALL_EXPR. Expression from primary need to be
10592        worked out to extract the part on which the qualification will
10593        take place. */
10594     qual_wfl = QUAL_WFL (qual);
10595     switch (TREE_CODE (qual_wfl))
10596       {
10597       case CALL_EXPR:
10598         qual_wfl = TREE_OPERAND (qual_wfl, 0);
10599         if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
10600           {
10601             qual = EXPR_WFL_QUALIFICATION (qual_wfl);
10602             qual_wfl = QUAL_WFL (qual);
10603           }
10604         break;
10605       case NEW_ARRAY_EXPR:
10606         qual = TREE_CHAIN (qual);
10607         again = new_array_found = 1;
10608         continue;
10609       case NEW_CLASS_EXPR:
10610       case CONVERT_EXPR:
10611         qual_wfl = TREE_OPERAND (qual_wfl, 0);
10612         break;
10613       case ARRAY_REF:
10614         while (TREE_CODE (qual_wfl) == ARRAY_REF)
10615           qual_wfl = TREE_OPERAND (qual_wfl, 0);
10616         break;
10617       case STRING_CST:
10618         qual = TREE_CHAIN (qual);
10619         qual_wfl = QUAL_WFL (qual);
10620         break;
10621       default:
10622         /* Fix for -Wall. Just break doing nothing */
10623         break;
10624       }
10625
10626     ptr_type = current_class;
10627     again = 0;
10628     code = TREE_CODE (qual_wfl);
10629
10630     /* Pos evaluation: non WFL leading expression nodes */
10631     if (code == CONVERT_EXPR
10632         && TREE_CODE (TREE_TYPE (qual_wfl)) == EXPR_WITH_FILE_LOCATION)
10633       name = EXPR_WFL_NODE (TREE_TYPE (qual_wfl));
10634
10635     else if ((code == ARRAY_REF || code == CALL_EXPR || code == MODIFY_EXPR) &&
10636              TREE_CODE (TREE_OPERAND (qual_wfl, 0)) == EXPR_WITH_FILE_LOCATION)
10637       name = EXPR_WFL_NODE (TREE_OPERAND (qual_wfl, 0));
10638
10639     else if (code == STRING_CST || code == CONDITIONAL_EXPR 
10640              || code == PLUS_EXPR)
10641       {
10642         qual = TREE_CHAIN (qual);
10643         qual_wfl = QUAL_WFL (qual);
10644         again = 1;
10645       }
10646     else 
10647       {
10648         name = EXPR_WFL_NODE (qual_wfl);
10649         if (!name)
10650           {
10651             qual = EXPR_WFL_QUALIFICATION (qual_wfl);
10652             again = 1;
10653           }
10654       }
10655
10656     /* If we have a THIS (from a primary), we set the context accordingly */
10657     if (name == this_identifier_node)
10658       {
10659         qual = TREE_CHAIN (qual);
10660         qual_wfl = QUAL_WFL (qual);
10661         if (TREE_CODE (qual_wfl) == CALL_EXPR)
10662           again = 1;
10663         else
10664           name = EXPR_WFL_NODE (qual_wfl);
10665         this_found = 1;
10666       }
10667     /* If we have a SUPER, we set the context accordingly */
10668     if (name == super_identifier_node)
10669       {
10670         current_class = CLASSTYPE_SUPER (ptr_type);
10671         /* Check that there is such a thing as a super class. If not,
10672            return.  The error will be caught later on, during the
10673            resolution */
10674         if (!current_class)
10675           {
10676             current_class = saved_current_class;
10677             return;
10678           }
10679         qual = TREE_CHAIN (qual);
10680         /* Do one more interation to set things up */
10681         super_found = again = 1;
10682       }
10683   } while (again);
10684   
10685   /* If name appears within the scope of a location variable
10686      declaration or parameter declaration, then it is an expression
10687      name. We don't carry this test out if we're in the context of the
10688      use of SUPER or THIS */
10689   if (!this_found && !super_found && 
10690       TREE_CODE (name) != STRING_CST && (decl = IDENTIFIER_LOCAL_VALUE (name)))
10691     {
10692       RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10693       QUAL_RESOLUTION (qual) = decl;
10694     }
10695
10696   /* If within the class/interface NAME was found to be used there
10697      exists a (possibly inherited) field named NAME, then this is an
10698      expression name. If we saw a NEW_ARRAY_EXPR before and want to
10699      address length, it is OK. */
10700   else if ((decl = lookup_field_wrapper (ptr_type, name))
10701            || (new_array_found && name == length_identifier_node))
10702     {
10703       RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10704       QUAL_RESOLUTION (qual) = (new_array_found ? NULL_TREE : decl);
10705     }
10706
10707   /* We reclassify NAME as yielding to a type name resolution if:
10708      - NAME is a class/interface declared within the compilation
10709        unit containing NAME,
10710      - NAME is imported via a single-type-import declaration,
10711      - NAME is declared in an another compilation unit of the package
10712        of the compilation unit containing NAME,
10713      - NAME is declared by exactly on type-import-on-demand declaration
10714      of the compilation unit containing NAME. 
10715      - NAME is actually a STRING_CST. */
10716   else if (TREE_CODE (name) == STRING_CST ||
10717            (decl = resolve_and_layout (name, NULL_TREE)))
10718     {
10719       RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
10720       QUAL_RESOLUTION (qual) = decl;
10721     }
10722
10723   /* Method call are expression name */
10724   else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR
10725            || TREE_CODE (QUAL_WFL (qual)) == ARRAY_REF
10726            || TREE_CODE (QUAL_WFL (qual)) == CONVERT_EXPR)
10727     RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
10728
10729   /* Check here that NAME isn't declared by more than one
10730      type-import-on-demand declaration of the compilation unit
10731      containing NAME. FIXME */
10732
10733   /* Otherwise, NAME is reclassified as a package name */
10734   else 
10735     RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
10736
10737   /* Propagate the qualification accross other components of the
10738      qualified name */
10739   for (qual = TREE_CHAIN (qual); qual;
10740        qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
10741     {
10742       if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
10743         RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
10744       else 
10745         RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
10746     }
10747
10748   /* Store the global qualification for the ambiguous part of ID back
10749      into ID fields */
10750   if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
10751     RESOLVE_EXPRESSION_NAME_P (id) = 1;
10752   else if (RESOLVE_TYPE_NAME_P (qual_wfl))
10753     RESOLVE_TYPE_NAME_P (id) = 1;
10754   else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
10755     RESOLVE_PACKAGE_NAME_P (id) = 1;
10756
10757   /* Restore the current class */
10758   current_class = saved_current_class;
10759 }
10760
10761 static int
10762 breakdown_qualified (left, right, source)
10763     tree *left, *right, source;
10764 {
10765   char *p = IDENTIFIER_POINTER (source), *base;
10766   int   l = IDENTIFIER_LENGTH (source);
10767
10768   /* Breakdown NAME into REMAINDER . IDENTIFIER */
10769   base = p;
10770   p += (l-1);
10771   while (*p != '.' && p != base)
10772     p--;
10773
10774   /* We didn't find a '.'. Return an error */
10775   if (p == base)
10776     return 1;
10777
10778   *p = '\0';
10779   if (right)
10780     *right = get_identifier (p+1);
10781   *left = get_identifier (IDENTIFIER_POINTER (source));
10782   *p = '.';
10783   
10784   return 0;
10785 }
10786
10787 /* Patch tree nodes in a function body. When a BLOCK is found, push
10788    local variable decls if present.
10789    Same as java_complete_lhs, but does resolve static finals to values. */
10790
10791 static tree
10792 java_complete_tree (node)
10793      tree node;
10794 {
10795   node = java_complete_lhs (node);
10796   if (TREE_CODE (node) == VAR_DECL && FIELD_STATIC (node)
10797       && FIELD_FINAL (node) && DECL_INITIAL (node) != NULL_TREE
10798       && !flag_emit_xref)
10799     {
10800       tree value = DECL_INITIAL (node);
10801       DECL_INITIAL (node) = NULL_TREE;
10802       push_obstacks (&permanent_obstack, &permanent_obstack);
10803       value = fold_constant_for_init (value, node);
10804       pop_obstacks ();
10805       DECL_INITIAL (node) = value;
10806       if (value != NULL_TREE)
10807         return value;
10808     }
10809   return node;
10810 }
10811
10812 static tree
10813 java_stabilize_reference (node)
10814      tree node;
10815 {
10816   if (TREE_CODE (node) == COMPOUND_EXPR)
10817     {
10818       tree op0 = TREE_OPERAND (node, 0);
10819       tree op1 = TREE_OPERAND (node, 1);
10820       TREE_OPERAND (node, 0) = save_expr (op0);
10821       TREE_OPERAND (node, 1) = java_stabilize_reference (op1);
10822       return node;
10823     }
10824   return stabilize_reference (node);
10825 }
10826
10827 /* Patch tree nodes in a function body. When a BLOCK is found, push
10828    local variable decls if present.
10829    Same as java_complete_tree, but does not resolve static finals to values. */
10830
10831 static tree
10832 java_complete_lhs (node)
10833      tree node;
10834 {
10835   tree nn, cn, wfl_op1, wfl_op2, wfl_op3;
10836   int flag;
10837
10838   /* CONVERT_EXPR always has its type set, even though it needs to be
10839      worked out. */
10840   if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
10841     return node;
10842
10843   /* The switch block implements cases processing container nodes
10844      first.  Contained nodes are always written back. Leaves come
10845      next and return a value. */
10846   switch (TREE_CODE (node))
10847     {
10848     case BLOCK:
10849
10850       /* 1- Block section.
10851          Set the local values on decl names so we can identify them
10852          faster when they're referenced. At that stage, identifiers
10853          are legal so we don't check for declaration errors. */
10854       for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10855         {
10856           DECL_CONTEXT (cn) = current_function_decl;
10857           IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
10858         }
10859       if (BLOCK_EXPR_BODY (node) == NULL_TREE)
10860           CAN_COMPLETE_NORMALLY (node) = 1;
10861       else
10862         {
10863           tree stmt = BLOCK_EXPR_BODY (node);
10864           tree *ptr;
10865           int error_seen = 0;
10866           if (TREE_CODE (stmt) == COMPOUND_EXPR)
10867             {
10868               /* Re-order from (((A; B); C); ...; Z) to 
10869                  (A; (B; (C ; (...; Z)))).
10870                  This makes it easier to scan the statements left-to-right
10871                  without using recursion (which might overflow the stack
10872                  if the block has many statements. */
10873               for (;;)
10874                 {
10875                   tree left = TREE_OPERAND (stmt, 0);
10876                   if (TREE_CODE (left) != COMPOUND_EXPR)
10877                     break;
10878                   TREE_OPERAND (stmt, 0) = TREE_OPERAND (left, 1);
10879                   TREE_OPERAND (left, 1) = stmt;
10880                   stmt = left;
10881                 }
10882               BLOCK_EXPR_BODY (node) = stmt;
10883             }
10884
10885           /* Now do the actual complete, without deep recursion for
10886              long blocks. */
10887           ptr = &BLOCK_EXPR_BODY (node);
10888           while (TREE_CODE (*ptr) == COMPOUND_EXPR
10889                  && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
10890             {
10891               tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
10892               tree *next = &TREE_OPERAND (*ptr, 1);
10893               TREE_OPERAND (*ptr, 0) = cur;
10894               if (cur == empty_stmt_node)
10895                 {
10896                   /* Optimization;  makes it easier to detect empty bodies.
10897                      Most useful for <clinit> with all-constant initializer. */
10898                   *ptr = *next;
10899                   continue;
10900                 }
10901               if (TREE_CODE (cur) == ERROR_MARK)
10902                 error_seen++;
10903               else if (! CAN_COMPLETE_NORMALLY (cur))
10904                 {
10905                   wfl_op2 = *next;
10906                   for (;;)
10907                     {
10908                       if (TREE_CODE (wfl_op2) == BLOCK)
10909                         wfl_op2 = BLOCK_EXPR_BODY (wfl_op2);
10910                       else if (TREE_CODE (wfl_op2) == COMPOUND_EXPR)
10911                         wfl_op2 = TREE_OPERAND (wfl_op2, 0);
10912                       else
10913                         break;
10914                     }
10915                   if (TREE_CODE (wfl_op2) != CASE_EXPR
10916                       && TREE_CODE (wfl_op2) != DEFAULT_EXPR)
10917                     unreachable_stmt_error (*ptr);
10918                 }
10919               ptr = next;
10920             }
10921           *ptr = java_complete_tree (*ptr);
10922
10923           if (TREE_CODE (*ptr) == ERROR_MARK || error_seen > 0)
10924             return error_mark_node;
10925           CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (*ptr);
10926         }
10927       /* Turn local bindings to null */
10928       for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
10929         IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
10930
10931       TREE_TYPE (node) = void_type_node;
10932       break;
10933
10934       /* 2- They are expressions but ultimately deal with statements */
10935
10936     case THROW_EXPR:
10937       wfl_op1 = TREE_OPERAND (node, 0);
10938       COMPLETE_CHECK_OP_0 (node);
10939       /* CAN_COMPLETE_NORMALLY (node) = 0; */
10940       return patch_throw_statement (node, wfl_op1);
10941
10942     case SYNCHRONIZED_EXPR:
10943       wfl_op1 = TREE_OPERAND (node, 0);
10944       return patch_synchronized_statement (node, wfl_op1);
10945
10946     case TRY_EXPR:
10947       return patch_try_statement (node);
10948
10949     case TRY_FINALLY_EXPR:
10950       COMPLETE_CHECK_OP_0 (node);
10951       COMPLETE_CHECK_OP_1 (node);
10952       CAN_COMPLETE_NORMALLY (node)
10953         = (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
10954            && CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)));
10955       TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 0));
10956       return node;
10957
10958     case CLEANUP_POINT_EXPR:
10959       COMPLETE_CHECK_OP_0 (node);
10960       TREE_TYPE (node) = void_type_node;
10961       CAN_COMPLETE_NORMALLY (node) = 
10962         CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
10963       return node;
10964
10965     case WITH_CLEANUP_EXPR:
10966       COMPLETE_CHECK_OP_0 (node);
10967       COMPLETE_CHECK_OP_2 (node);
10968       CAN_COMPLETE_NORMALLY (node) = 
10969         CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0));
10970       TREE_TYPE (node) = void_type_node;
10971       return node;
10972
10973     case LABELED_BLOCK_EXPR:
10974       PUSH_LABELED_BLOCK (node);
10975       if (LABELED_BLOCK_BODY (node))
10976         COMPLETE_CHECK_OP_1 (node);
10977       TREE_TYPE (node) = void_type_node;
10978       POP_LABELED_BLOCK ();
10979
10980       if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
10981         {
10982           LABELED_BLOCK_BODY (node) = NULL_TREE;
10983           CAN_COMPLETE_NORMALLY (node) = 1;
10984         }
10985       else if (CAN_COMPLETE_NORMALLY (LABELED_BLOCK_BODY (node)))
10986         CAN_COMPLETE_NORMALLY (node) = 1;
10987       return node;
10988
10989     case EXIT_BLOCK_EXPR:
10990       /* We don't complete operand 1, because it's the return value of
10991          the EXIT_BLOCK_EXPR which doesn't exist it Java */
10992       return patch_bc_statement (node);
10993
10994     case CASE_EXPR:
10995       cn = java_complete_tree (TREE_OPERAND (node, 0));
10996       if (cn == error_mark_node)
10997         return cn;
10998
10999       /* First, the case expression must be constant. Values of final
11000          fields are accepted. */
11001       cn = fold (cn);
11002       if ((TREE_CODE (cn) == COMPOUND_EXPR || TREE_CODE (cn) == COMPONENT_REF)
11003           && JDECL_P (TREE_OPERAND (cn, 1))
11004           && FIELD_FINAL (TREE_OPERAND (cn, 1))
11005           && DECL_INITIAL (TREE_OPERAND (cn, 1)))
11006         {
11007           push_obstacks (&permanent_obstack, &permanent_obstack);
11008           cn = fold_constant_for_init (DECL_INITIAL (TREE_OPERAND (cn, 1)),
11009                                        TREE_OPERAND (cn, 1));
11010           pop_obstacks ();
11011         }
11012
11013       if (!TREE_CONSTANT (cn) && !flag_emit_xref)
11014         {
11015           EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11016           parse_error_context (node, "Constant expression required");
11017           return error_mark_node;
11018         }
11019
11020       nn = ctxp->current_loop;
11021
11022       /* It must be assignable to the type of the switch expression. */
11023       if (!try_builtin_assignconv (NULL_TREE, 
11024                                    TREE_TYPE (TREE_OPERAND (nn, 0)), cn))
11025         {
11026           EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11027           parse_error_context 
11028             (wfl_operator,
11029              "Incompatible type for case. Can't convert `%s' to `int'",
11030              lang_printable_name (TREE_TYPE (cn), 0));
11031           return error_mark_node;
11032         }
11033
11034       cn = fold (convert (int_type_node, cn));
11035
11036       /* Multiple instance of a case label bearing the same
11037          value is checked during code generation. The case
11038          expression is allright so far. */
11039       TREE_OPERAND (node, 0) = cn;
11040       TREE_TYPE (node) = void_type_node;
11041       CAN_COMPLETE_NORMALLY (node) = 1;
11042       TREE_SIDE_EFFECTS (node) = 1;
11043       break;
11044
11045     case DEFAULT_EXPR:
11046       nn = ctxp->current_loop;
11047       /* Only one default label is allowed per switch statement */
11048       if (SWITCH_HAS_DEFAULT (nn))
11049         {
11050           EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11051           parse_error_context (wfl_operator, 
11052                                "Duplicate case label: `default'");
11053           return error_mark_node;
11054         }
11055       else
11056         SWITCH_HAS_DEFAULT (nn) = 1;
11057       TREE_TYPE (node) = void_type_node;
11058       TREE_SIDE_EFFECTS (node) = 1;
11059       CAN_COMPLETE_NORMALLY (node) = 1;
11060       break;
11061
11062     case SWITCH_EXPR:
11063     case LOOP_EXPR:
11064       PUSH_LOOP (node);
11065       /* Check whether the loop was enclosed in a labeled
11066          statement. If not, create one, insert the loop in it and
11067          return the node */
11068       nn = patch_loop_statement (node);
11069
11070       /* Anyways, walk the body of the loop */
11071       if (TREE_CODE (node) == LOOP_EXPR)
11072         TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11073       /* Switch statement: walk the switch expression and the cases */
11074       else
11075         node = patch_switch_statement (node);
11076
11077       if (TREE_OPERAND (node, 0) == error_mark_node)
11078         nn = error_mark_node;
11079       else
11080         {
11081           TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
11082           /* If we returned something different, that's because we
11083              inserted a label. Pop the label too. */
11084           if (nn != node)
11085             {
11086               if (CAN_COMPLETE_NORMALLY (node))
11087                 CAN_COMPLETE_NORMALLY (nn) = 1;
11088               POP_LABELED_BLOCK ();
11089             }
11090         }
11091       POP_LOOP ();
11092       return nn;
11093
11094     case EXIT_EXPR:
11095       TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11096       return patch_exit_expr (node);
11097
11098     case COND_EXPR:
11099       /* Condition */
11100       TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11101       if (TREE_OPERAND (node, 0) == error_mark_node)
11102         return error_mark_node;
11103       /* then-else branches */
11104       TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
11105       if (TREE_OPERAND (node, 1) == error_mark_node)
11106         return error_mark_node;
11107       TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
11108       if (TREE_OPERAND (node, 2) == error_mark_node)
11109         return error_mark_node;
11110       return patch_if_else_statement (node);
11111       break;
11112
11113     case CONDITIONAL_EXPR:
11114       /* Condition */
11115       wfl_op1 = TREE_OPERAND (node, 0);
11116       COMPLETE_CHECK_OP_0 (node);
11117       wfl_op2 = TREE_OPERAND (node, 1);
11118       COMPLETE_CHECK_OP_1 (node);
11119       wfl_op3 = TREE_OPERAND (node, 2);
11120       COMPLETE_CHECK_OP_2 (node);
11121       return patch_conditional_expr (node, wfl_op1, wfl_op2);
11122
11123       /* 3- Expression section */
11124     case COMPOUND_EXPR:
11125       wfl_op2 = TREE_OPERAND (node, 1);
11126       TREE_OPERAND (node, 0) = nn = 
11127         java_complete_tree (TREE_OPERAND (node, 0));
11128       if (wfl_op2 == empty_stmt_node)
11129         CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
11130       else
11131         {
11132           if (! CAN_COMPLETE_NORMALLY (nn) && TREE_CODE (nn) != ERROR_MARK)
11133             {
11134               /* An unreachable condition in a do-while statement
11135                  is *not* (technically) an unreachable statement. */
11136               nn = wfl_op2;
11137               if (TREE_CODE (nn) == EXPR_WITH_FILE_LOCATION)
11138                 nn = EXPR_WFL_NODE (nn);
11139               if (TREE_CODE (nn) != EXIT_EXPR)
11140                 {
11141                   SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
11142                   parse_error_context (wfl_operator, "Unreachable statement");
11143                 }
11144             }
11145           TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
11146           if (TREE_OPERAND (node, 1) == error_mark_node)
11147             return error_mark_node;
11148           CAN_COMPLETE_NORMALLY (node)
11149             = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1));
11150         }
11151       TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
11152       break;
11153
11154     case RETURN_EXPR:
11155       /* CAN_COMPLETE_NORMALLY (node) = 0; */
11156       return patch_return (node);
11157
11158     case EXPR_WITH_FILE_LOCATION:
11159       if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
11160           || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
11161         {
11162           tree wfl = node;
11163           node = resolve_expression_name (node, NULL);
11164           if (node == error_mark_node)
11165             return node;
11166           /* Keep line number information somewhere were it doesn't
11167              disrupt the completion process. */
11168           if (flag_emit_xref && TREE_CODE (node) != CALL_EXPR)
11169             {
11170               EXPR_WFL_NODE (wfl) = TREE_OPERAND (node, 1);
11171               TREE_OPERAND (node, 1) = wfl;
11172             }
11173           CAN_COMPLETE_NORMALLY (node) = 1;
11174         }
11175       else
11176         {
11177           tree body;
11178           int save_lineno = lineno;
11179           lineno = EXPR_WFL_LINENO (node);
11180           body = java_complete_tree (EXPR_WFL_NODE (node));
11181           lineno = save_lineno;
11182           EXPR_WFL_NODE (node) = body;
11183           TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
11184           CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
11185           if (body == empty_stmt_node)
11186             {
11187               /* Optimization;  makes it easier to detect empty bodies. */
11188               return body;
11189             }
11190           if (body == error_mark_node)
11191             {
11192               /* Its important for the evaluation of assignment that
11193                  this mark on the TREE_TYPE is propagated. */
11194               TREE_TYPE (node) = error_mark_node;
11195               return error_mark_node;
11196             }
11197           else
11198             TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
11199           
11200         }
11201       break;
11202
11203     case NEW_ARRAY_EXPR:
11204       /* Patch all the dimensions */
11205       flag = 0;
11206       for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
11207         {
11208           int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
11209           tree dim = convert (int_type_node, 
11210                               java_complete_tree (TREE_VALUE (cn)));
11211           if (dim == error_mark_node)
11212             {
11213               flag = 1;
11214               continue;
11215             }
11216           else
11217             {
11218               TREE_VALUE (cn) = dim;
11219               /* Setup the location of the current dimension, for
11220                  later error report. */
11221               TREE_PURPOSE (cn) = 
11222                 build_expr_wfl (NULL_TREE, input_filename, 0, 0);
11223               EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
11224             }
11225         }
11226       /* They complete the array creation expression, if no errors
11227          were found. */
11228       CAN_COMPLETE_NORMALLY (node) = 1;
11229       return (flag ? error_mark_node
11230               : force_evaluation_order (patch_newarray (node)));
11231
11232     case NEW_CLASS_EXPR:
11233     case CALL_EXPR:
11234       /* Complete function's argument(s) first */
11235       if (complete_function_arguments (node))
11236         return error_mark_node;
11237       else
11238         {
11239           tree decl, wfl = TREE_OPERAND (node, 0);
11240           int in_this = CALL_THIS_CONSTRUCTOR_P (node);
11241
11242           node = patch_method_invocation (node, NULL_TREE, 
11243                                           NULL_TREE, 0, &decl);
11244           if (node == error_mark_node)
11245             return error_mark_node;
11246
11247           check_thrown_exceptions (EXPR_WFL_LINECOL (node), decl);
11248           /* If we call this(...), register signature and positions */
11249           if (in_this)
11250             DECL_CONSTRUCTOR_CALLS (current_function_decl) = 
11251               tree_cons (wfl, decl, 
11252                          DECL_CONSTRUCTOR_CALLS (current_function_decl));
11253           CAN_COMPLETE_NORMALLY (node) = 1;
11254           return force_evaluation_order (node);
11255         }
11256
11257     case MODIFY_EXPR:
11258       /* Save potential wfls */
11259       wfl_op1 = TREE_OPERAND (node, 0);
11260       TREE_OPERAND (node, 0) = nn = java_complete_lhs (wfl_op1);
11261       if (MODIFY_EXPR_FROM_INITIALIZATION_P (node)
11262           && TREE_CODE (nn) == VAR_DECL && TREE_STATIC (nn)
11263           && DECL_INITIAL (nn) != NULL_TREE)
11264         {
11265           tree value;
11266           
11267           push_obstacks (&permanent_obstack, &permanent_obstack);
11268           value = fold_constant_for_init (nn, nn);
11269           pop_obstacks ();
11270           if (value != NULL_TREE)
11271             {
11272               tree type = TREE_TYPE (value);
11273               if (JPRIMITIVE_TYPE_P (type) || type == string_ptr_type_node)
11274                 return empty_stmt_node;
11275             }
11276           DECL_INITIAL (nn) = NULL_TREE;
11277         }
11278       wfl_op2 = TREE_OPERAND (node, 1);
11279
11280       if (TREE_OPERAND (node, 0) == error_mark_node)
11281         return error_mark_node;
11282
11283       flag = COMPOUND_ASSIGN_P (wfl_op2);
11284       if (flag)
11285         {
11286           tree lvalue = java_stabilize_reference (TREE_OPERAND (node, 0)); 
11287
11288           /* Hand stablize the lhs on both places */
11289           TREE_OPERAND (node, 0) = lvalue;
11290           TREE_OPERAND (TREE_OPERAND (node, 1), 0) = 
11291             (flag_emit_class_files ? lvalue : save_expr (lvalue));
11292
11293           /* 15.25.2.a: Left hand is not an array access. FIXME */
11294           /* Now complete the RHS. We write it back later on. */
11295           nn = java_complete_tree (TREE_OPERAND (node, 1));
11296
11297           if ((cn = patch_string (nn)))
11298             nn = cn;
11299
11300           /* The last part of the rewrite for E1 op= E2 is to have 
11301              E1 = (T)(E1 op E2), with T being the type of E1. */
11302           nn = java_complete_tree (build_cast (EXPR_WFL_LINECOL (wfl_op2), 
11303                                                TREE_TYPE (lvalue), nn));
11304
11305           /* 15.25.2.b: Left hand is an array access. FIXME */
11306         }
11307
11308       /* If we're about to patch a NEW_ARRAY_INIT, we call a special
11309          function to complete this RHS */
11310       else if (TREE_CODE (wfl_op2) == NEW_ARRAY_INIT)
11311         nn = patch_new_array_init (TREE_TYPE (TREE_OPERAND (node, 0)),
11312                                    TREE_OPERAND (node, 1));
11313       /* Otherwise we simply complete the RHS */
11314       else
11315         nn = java_complete_tree (TREE_OPERAND (node, 1));
11316
11317       if (nn == error_mark_node)
11318         return error_mark_node;
11319
11320       /* Write back the RHS as we evaluated it. */
11321       TREE_OPERAND (node, 1) = nn;
11322
11323       /* In case we're handling = with a String as a RHS, we need to
11324          produce a String out of the RHS (it might still be a
11325          STRING_CST or a StringBuffer at this stage */
11326       if ((nn = patch_string (TREE_OPERAND (node, 1))))
11327         TREE_OPERAND (node, 1) = nn;
11328       node = patch_assignment (node, wfl_op1, wfl_op2);
11329       /* Reorganize the tree if necessary. */
11330       if (flag && (!JREFERENCE_TYPE_P (TREE_TYPE (node)) 
11331                    || JSTRING_P (TREE_TYPE (node))))
11332         node = java_refold (node);
11333       CAN_COMPLETE_NORMALLY (node) = 1;
11334       return node;
11335
11336     case MULT_EXPR:
11337     case PLUS_EXPR:
11338     case MINUS_EXPR:
11339     case LSHIFT_EXPR:
11340     case RSHIFT_EXPR:
11341     case URSHIFT_EXPR:
11342     case BIT_AND_EXPR:
11343     case BIT_XOR_EXPR:
11344     case BIT_IOR_EXPR:
11345     case TRUNC_MOD_EXPR:
11346     case RDIV_EXPR:
11347     case TRUTH_ANDIF_EXPR:
11348     case TRUTH_ORIF_EXPR:
11349     case EQ_EXPR: 
11350     case NE_EXPR:
11351     case GT_EXPR:
11352     case GE_EXPR:
11353     case LT_EXPR:
11354     case LE_EXPR:
11355       /* Operands 0 and 1 are WFL in certain cases only. patch_binop
11356          knows how to handle those cases. */
11357       wfl_op1 = TREE_OPERAND (node, 0);
11358       wfl_op2 = TREE_OPERAND (node, 1);
11359
11360       CAN_COMPLETE_NORMALLY (node) = 1;
11361       /* Don't complete string nodes if dealing with the PLUS operand. */
11362       if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op1))
11363         {
11364           nn = java_complete_tree (wfl_op1);
11365           if (nn == error_mark_node)
11366             return error_mark_node;
11367           if ((cn = patch_string (nn)))
11368             nn = cn;
11369           TREE_OPERAND (node, 0) = nn;
11370         }
11371       if (TREE_CODE (node) != PLUS_EXPR || !JSTRING_P (wfl_op2))
11372         {
11373           nn = java_complete_tree (wfl_op2);
11374           if (nn == error_mark_node)
11375             return error_mark_node;
11376           if ((cn = patch_string (nn)))
11377             nn = cn;
11378           TREE_OPERAND (node, 1) = nn;
11379         }
11380       return force_evaluation_order (patch_binop (node, wfl_op1, wfl_op2));
11381
11382     case INSTANCEOF_EXPR:
11383       wfl_op1 = TREE_OPERAND (node, 0);
11384       COMPLETE_CHECK_OP_0 (node);
11385       if (flag_emit_xref)
11386         {
11387           TREE_TYPE (node) = boolean_type_node;
11388           return node;
11389         }
11390       return patch_binop (node, wfl_op1, TREE_OPERAND (node, 1));
11391
11392     case UNARY_PLUS_EXPR:
11393     case NEGATE_EXPR:
11394     case TRUTH_NOT_EXPR:
11395     case BIT_NOT_EXPR:
11396     case PREDECREMENT_EXPR:
11397     case PREINCREMENT_EXPR:
11398     case POSTDECREMENT_EXPR:
11399     case POSTINCREMENT_EXPR:
11400     case CONVERT_EXPR:
11401       /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
11402          how to handle those cases. */
11403       wfl_op1 = TREE_OPERAND (node, 0);
11404       CAN_COMPLETE_NORMALLY (node) = 1;
11405       TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
11406       if (TREE_OPERAND (node, 0) == error_mark_node)
11407         return error_mark_node;
11408       node = patch_unaryop (node, wfl_op1);
11409       CAN_COMPLETE_NORMALLY (node) = 1;
11410       break;
11411
11412     case ARRAY_REF:
11413       /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
11414          how to handle those cases. */
11415       wfl_op1 = TREE_OPERAND (node, 0);
11416       TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
11417       if (TREE_OPERAND (node, 0) == error_mark_node)
11418         return error_mark_node;
11419       if (!flag_emit_class_files && !flag_emit_xref)
11420         TREE_OPERAND (node, 0) = save_expr (TREE_OPERAND (node, 0));
11421       /* The same applies to wfl_op2 */
11422       wfl_op2 = TREE_OPERAND (node, 1);
11423       TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
11424       if (TREE_OPERAND (node, 1) == error_mark_node)
11425         return error_mark_node;
11426       if (!flag_emit_class_files && !flag_emit_xref)
11427         TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
11428       return patch_array_ref (node);
11429
11430     case RECORD_TYPE:
11431       return node;;
11432
11433     case COMPONENT_REF:
11434       /* The first step in the re-write of qualified name handling.  FIXME.
11435          So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
11436       TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
11437       if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
11438         {
11439           tree name = TREE_OPERAND (node, 1);
11440           tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
11441           if (field == NULL_TREE)
11442             {
11443               error ("missing static field `%s'", IDENTIFIER_POINTER (name));
11444               return error_mark_node;
11445             }
11446           if (! FIELD_STATIC (field))
11447             {
11448               error ("not a static field `%s'", IDENTIFIER_POINTER (name));
11449               return error_mark_node;
11450             }
11451           return field;
11452         }
11453       else
11454         fatal ("unimplemented java_complete_tree for COMPONENT_REF");
11455       break;
11456
11457     case THIS_EXPR:
11458       /* Can't use THIS in a static environment */
11459       if (!current_this)
11460         {
11461           EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11462           parse_error_context (wfl_operator,
11463                                "Keyword `this' used outside allowed context");
11464           TREE_TYPE (node) = error_mark_node;
11465           return error_mark_node;
11466         }
11467       if (ctxp->explicit_constructor_p)
11468         {
11469           EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11470           parse_error_context 
11471             (wfl_operator, "Can't reference `this' or `super' before the superclass constructor has been called");
11472           TREE_TYPE (node) = error_mark_node;
11473           return error_mark_node;
11474         }
11475       return current_this;
11476
11477     default:
11478       CAN_COMPLETE_NORMALLY (node) = 1;
11479       /* Ok: may be we have a STRING_CST or a crafted `StringBuffer'
11480          and it's time to turn it into the appropriate String object
11481          */
11482       if ((node = patch_string (node)))
11483         return node;
11484       fatal ("No case for tree code `%s' - java_complete_tree\n",
11485              tree_code_name [TREE_CODE (node)]);
11486     }
11487   return node;
11488 }
11489
11490 /* Complete function call's argument. Return a non zero value is an
11491    error was found.  */
11492
11493 static int
11494 complete_function_arguments (node)
11495      tree node;
11496 {
11497   int flag = 0;
11498   tree cn;
11499
11500   ctxp->explicit_constructor_p += (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
11501   for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
11502     {
11503       tree wfl = TREE_VALUE (cn), parm, temp;
11504       parm = java_complete_tree (wfl);
11505       if (parm == error_mark_node)
11506         {
11507           flag = 1;
11508           continue;
11509         }
11510       /* If have a string literal that we haven't transformed yet or a
11511          crafted string buffer, as a result of use of the the String
11512          `+' operator. Build `parm.toString()' and expand it. */
11513       if ((temp = patch_string (parm)))
11514         parm = temp;
11515       /* Inline PRIMTYPE.TYPE read access */
11516       parm = maybe_build_primttype_type_ref (parm, wfl);
11517
11518       TREE_VALUE (cn) = parm;
11519     }
11520   ctxp->explicit_constructor_p -= (CALL_EXPLICIT_CONSTRUCTOR_P (node) ? 1 : 0);
11521   return flag;
11522 }
11523
11524 /* Sometimes (for loops and variable initialized during their
11525    declaration), we want to wrap a statement around a WFL and turn it
11526    debugable.  */
11527
11528 static tree
11529 build_debugable_stmt (location, stmt)
11530     int location;
11531     tree stmt;
11532 {
11533   if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
11534     {
11535       stmt = build_expr_wfl (stmt, input_filename, 0, 0);
11536       EXPR_WFL_LINECOL (stmt) = location;
11537     }
11538   JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
11539   return stmt;
11540 }
11541
11542 static tree
11543 build_expr_block (body, decls)
11544      tree body, decls;
11545 {
11546   tree node = make_node (BLOCK);
11547   BLOCK_EXPR_DECLS (node) = decls;
11548   BLOCK_EXPR_BODY (node) = body;
11549   if (body)
11550     TREE_TYPE (node) = TREE_TYPE (body);
11551   TREE_SIDE_EFFECTS (node) = 1;
11552   return node;
11553 }
11554
11555 /* Create a new function block and link it approriately to current
11556    function block chain */
11557
11558 static tree
11559 enter_block ()
11560 {
11561   return (enter_a_block (build_expr_block (NULL_TREE, NULL_TREE)));
11562 }
11563
11564 /* Link block B supercontext to the previous block. The current
11565    function DECL is used as supercontext when enter_a_block is called
11566    for the first time for a given function. The current function body
11567    (DECL_FUNCTION_BODY) is set to be block B.  */
11568
11569 static tree
11570 enter_a_block (b)
11571      tree b;
11572 {
11573   tree fndecl = current_function_decl; 
11574
11575   if (!fndecl) {
11576     BLOCK_SUPERCONTEXT (b) = current_static_block;
11577     current_static_block = b;
11578   }
11579
11580   else if (!DECL_FUNCTION_BODY (fndecl))
11581     {
11582       BLOCK_SUPERCONTEXT (b) = fndecl;
11583       DECL_FUNCTION_BODY (fndecl) = b;
11584     }
11585   else
11586     {
11587       BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
11588       DECL_FUNCTION_BODY (fndecl) = b;
11589     }
11590   return b;
11591 }
11592
11593 /* Exit a block by changing the current function body
11594    (DECL_FUNCTION_BODY) to the current block super context, only if
11595    the block being exited isn't the method's top level one.  */
11596
11597 static tree
11598 exit_block ()
11599 {
11600   tree b;
11601   if (current_function_decl)
11602     {
11603       b = DECL_FUNCTION_BODY (current_function_decl);
11604       if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
11605         DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
11606     }
11607   else
11608     {
11609       b = current_static_block;
11610
11611       if (BLOCK_SUPERCONTEXT (b))
11612         current_static_block = BLOCK_SUPERCONTEXT (b);
11613     }
11614   return b;
11615 }
11616
11617 /* Lookup for NAME in the nested function's blocks, all the way up to
11618    the current toplevel one. It complies with Java's local variable
11619    scoping rules.  */
11620
11621 static tree
11622 lookup_name_in_blocks (name)
11623      tree name;
11624 {
11625   tree b = GET_CURRENT_BLOCK (current_function_decl);
11626
11627   while (b != current_function_decl)
11628     {
11629       tree current;
11630
11631       /* Paranoid sanity check. To be removed */
11632       if (TREE_CODE (b) != BLOCK)
11633         fatal ("non block expr function body - lookup_name_in_blocks");
11634
11635       for (current = BLOCK_EXPR_DECLS (b); current; 
11636            current = TREE_CHAIN (current))
11637         if (DECL_NAME (current) == name)
11638           return current;
11639       b = BLOCK_SUPERCONTEXT (b);
11640     }
11641   return NULL_TREE;
11642 }
11643
11644 static void
11645 maybe_absorb_scoping_blocks ()
11646 {
11647   while (BLOCK_EXPR_ORIGIN (GET_CURRENT_BLOCK (current_function_decl)))
11648     {
11649       tree b = exit_block ();
11650       java_method_add_stmt (current_function_decl, b);
11651       SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
11652     }
11653 }
11654
11655 \f
11656 /* This section of the source is reserved to build_* functions that
11657    are building incomplete tree nodes and the patch_* functions that
11658    are completing them.  */
11659
11660 /* Build a super() constructor invocation. Returns empty_stmt_node if
11661    we're currently dealing with the class java.lang.Object. */
11662
11663 static tree
11664 build_super_invocation (mdecl)
11665      tree mdecl;
11666 {
11667   if (DECL_CONTEXT (mdecl) == object_type_node)
11668     return empty_stmt_node;
11669   else
11670     {
11671       tree super_wfl = build_wfl_node (super_identifier_node);
11672       return build_method_invocation (super_wfl, NULL_TREE);
11673     }
11674 }
11675
11676 /* Build a SUPER/THIS qualified method invocation.  */
11677
11678 static tree
11679 build_this_super_qualified_invocation (use_this, name, args, lloc, rloc)
11680      int use_this;
11681      tree name, args;
11682      int lloc, rloc;
11683
11684 {
11685   tree invok;
11686   tree wfl = 
11687     build_wfl_node (use_this ? this_identifier_node : super_identifier_node);
11688   EXPR_WFL_LINECOL (wfl) = lloc;
11689   invok = build_method_invocation (name, args);
11690   return make_qualified_primary (wfl, invok, rloc);
11691 }
11692
11693 /* Build an incomplete CALL_EXPR node. */
11694
11695 static tree
11696 build_method_invocation (name, args)
11697     tree name;
11698     tree args;
11699 {
11700   tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
11701   TREE_SIDE_EFFECTS (call) = 1;
11702   EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
11703   return call;
11704 }
11705
11706 /* Build an incomplete new xxx(...) node. */
11707
11708 static tree
11709 build_new_invocation (name, args)
11710     tree name, args;
11711 {
11712   tree call = build (NEW_CLASS_EXPR, NULL_TREE, name, args, NULL_TREE);
11713   TREE_SIDE_EFFECTS (call) = 1;
11714   EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
11715   return call;
11716 }
11717
11718 /* Build an incomplete assignment expression. */
11719
11720 static tree
11721 build_assignment (op, op_location, lhs, rhs)
11722      int op, op_location;
11723      tree lhs, rhs;
11724 {
11725   tree assignment;
11726   /* Build the corresponding binop if we deal with a Compound
11727      Assignment operator. Mark the binop sub-tree as part of a
11728      Compound Assignment expression */
11729   if (op != ASSIGN_TK)
11730     {
11731       rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
11732       COMPOUND_ASSIGN_P (rhs) = 1;
11733     }
11734   assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
11735   TREE_SIDE_EFFECTS (assignment) = 1;
11736   EXPR_WFL_LINECOL (assignment) = op_location;
11737   return assignment;
11738 }
11739
11740 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
11741
11742 char *
11743 print_int_node (node)
11744     tree node;
11745 {
11746   static char buffer [80];
11747   if (TREE_CONSTANT_OVERFLOW (node))
11748     sprintf (buffer, "<overflow>");
11749     
11750   if (TREE_INT_CST_HIGH (node) == 0)
11751     sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
11752              TREE_INT_CST_LOW (node));
11753   else if (TREE_INT_CST_HIGH (node) == -1
11754            && TREE_INT_CST_LOW (node) != 0)
11755     {
11756       buffer [0] = '-';
11757       sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
11758                -TREE_INT_CST_LOW (node));
11759     }
11760   else
11761     sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
11762              TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
11763
11764   return buffer;
11765 }
11766
11767 /* Return 1 if an assignment to a FINAL is attempted in a non suitable
11768    context.  */
11769
11770 static int
11771 check_final_assignment (lvalue, wfl)
11772      tree lvalue, wfl;
11773 {
11774   if (JDECL_P (lvalue) 
11775       && FIELD_FINAL (lvalue) && !IS_CLINIT (current_function_decl))
11776     {
11777       parse_error_context 
11778         (wfl, "Can't assign a value to the final variable `%s'",
11779          IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
11780       return 1;
11781     }
11782   return 0;
11783 }
11784
11785 /* Inline references to java.lang.PRIMTYPE.TYPE when accessed in
11786    read. This is needed to avoid circularities in the implementation
11787    of these fields in libjava. */
11788
11789 static tree
11790 maybe_build_primttype_type_ref (rhs, wfl)
11791     tree rhs, wfl;
11792 {
11793   tree to_return = NULL_TREE;
11794   tree rhs_type = TREE_TYPE (rhs);
11795   if (TREE_CODE (rhs) == COMPOUND_EXPR)
11796     {
11797       tree n = TREE_OPERAND (rhs, 1);
11798       if (TREE_CODE (n) == VAR_DECL 
11799           && DECL_NAME (n) == TYPE_identifier_node
11800           && rhs_type == class_ptr_type)
11801         {
11802           const char *self_name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
11803           if (!strncmp (self_name, "java.lang.", 10))
11804             to_return = build_primtype_type_ref (self_name);
11805         }
11806     }
11807   return (to_return ? to_return : rhs );
11808 }
11809
11810 /* 15.25 Assignment operators. */
11811
11812 static tree
11813 patch_assignment (node, wfl_op1, wfl_op2)
11814      tree node;
11815      tree wfl_op1;
11816      tree wfl_op2;
11817 {
11818   tree rhs = TREE_OPERAND (node, 1);
11819   tree lvalue = TREE_OPERAND (node, 0), llvalue;
11820   tree lhs_type = NULL_TREE, rhs_type, new_rhs = NULL_TREE;
11821   int error_found = 0;
11822   int lvalue_from_array = 0;
11823
11824   /* Can't assign to a final. */
11825   if (check_final_assignment (lvalue, wfl_op1))
11826     error_found = 1;
11827
11828   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
11829
11830   /* Lhs can be a named variable */
11831   if (JDECL_P (lvalue))
11832     {
11833       lhs_type = TREE_TYPE (lvalue);
11834     }
11835   /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
11836      comment on reason why */
11837   else if (TREE_CODE (wfl_op1) == ARRAY_REF)
11838     {
11839       lhs_type = TREE_TYPE (lvalue);
11840       lvalue_from_array = 1;
11841     }
11842   /* Or a field access */
11843   else if (TREE_CODE (lvalue) == COMPONENT_REF)
11844     lhs_type = TREE_TYPE (lvalue);
11845   /* Or a function return slot */
11846   else if (TREE_CODE (lvalue) == RESULT_DECL)
11847     lhs_type = TREE_TYPE (lvalue);
11848   /* Otherwise, we might want to try to write into an optimized static
11849      final, this is an of a different nature, reported further on. */
11850   else if (TREE_CODE (wfl_op1) == EXPR_WITH_FILE_LOCATION
11851            && resolve_expression_name (wfl_op1, &llvalue))
11852     {
11853       if (check_final_assignment (llvalue, wfl_op1))
11854         {
11855           /* What we should do instead is resetting the all the flags
11856              previously set, exchange lvalue for llvalue and continue. */
11857           error_found = 1;
11858           return error_mark_node;
11859         }
11860       else 
11861         lhs_type = TREE_TYPE (lvalue);
11862     }
11863   else 
11864     {
11865       parse_error_context (wfl_op1, "Invalid left hand side of assignment");
11866       error_found = 1;
11867     }
11868
11869   rhs_type = TREE_TYPE (rhs);
11870   /* 5.1 Try the assignment conversion for builtin type. */
11871   new_rhs = try_builtin_assignconv (wfl_op1, lhs_type, rhs);
11872
11873   /* 5.2 If it failed, try a reference conversion */
11874   if (!new_rhs && (new_rhs = try_reference_assignconv (lhs_type, rhs)))
11875     lhs_type = promote_type (rhs_type);
11876
11877   /* 15.25.2 If we have a compound assignment, convert RHS into the
11878      type of the LHS */
11879   else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
11880     new_rhs = convert (lhs_type, rhs);
11881
11882   /* Explicit cast required. This is an error */
11883   if (!new_rhs)
11884     {
11885       char *t1 = xstrdup (lang_printable_name (TREE_TYPE (rhs), 0));
11886       char *t2 = xstrdup (lang_printable_name (lhs_type, 0));
11887       tree wfl;
11888       char operation [32];      /* Max size known */
11889
11890       /* If the assignment is part of a declaration, we use the WFL of
11891          the declared variable to point out the error and call it a
11892          declaration problem. If the assignment is a genuine =
11893          operator, we call is a operator `=' problem, otherwise we
11894          call it an assignment problem. In both of these last cases,
11895          we use the WFL of the operator to indicate the error. */
11896
11897       if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
11898         {
11899           wfl = wfl_op1;
11900           strcpy (operation, "declaration");
11901         }
11902       else
11903         {
11904           wfl = wfl_operator;
11905           if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
11906             strcpy (operation, "assignment");
11907           else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
11908             strcpy (operation, "`return'");
11909           else
11910             strcpy (operation, "`='");
11911         }
11912
11913       if (!valid_cast_to_p (rhs_type, lhs_type))
11914         parse_error_context
11915           (wfl, "Incompatible type for %s. Can't convert `%s' to `%s'",
11916            operation, t1, t2);
11917       else
11918         parse_error_context (wfl, "Incompatible type for %s. Explicit cast needed to convert `%s' to `%s'",
11919                              operation, t1, t2);
11920       free (t1); free (t2);
11921       error_found = 1;
11922     }
11923
11924   /* Inline read access to java.lang.PRIMTYPE.TYPE */
11925   if (new_rhs)
11926     new_rhs = maybe_build_primttype_type_ref (new_rhs, wfl_op2);
11927
11928   if (error_found)
11929     return error_mark_node;
11930
11931   /* 10.10: Array Store Exception runtime check */
11932   if (!flag_emit_class_files
11933       && !flag_emit_xref
11934       && lvalue_from_array 
11935       && JREFERENCE_TYPE_P (TYPE_ARRAY_ELEMENT (lhs_type)))
11936     {
11937       tree check;
11938       tree base = lvalue;
11939
11940       /* We need to retrieve the right argument for _Jv_CheckArrayStore */
11941       if (TREE_CODE (lvalue) == COMPOUND_EXPR)
11942         base = TREE_OPERAND (lvalue, 0);
11943       else
11944         {
11945           if (flag_bounds_check)
11946             base = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (base, 0), 1), 0);
11947           else
11948             base = TREE_OPERAND (TREE_OPERAND (base, 0), 0);
11949         }
11950
11951       /* Build the invocation of _Jv_CheckArrayStore */
11952       new_rhs = save_expr (new_rhs);
11953       check = build (CALL_EXPR, void_type_node,
11954                      build_address_of (soft_checkarraystore_node),
11955                      tree_cons (NULL_TREE, base,
11956                                 build_tree_list (NULL_TREE, new_rhs)),
11957                      NULL_TREE);
11958       TREE_SIDE_EFFECTS (check) = 1;
11959
11960       /* We have to decide on an insertion point */
11961       if (TREE_CODE (lvalue) == COMPOUND_EXPR)
11962         {
11963           tree t;
11964           if (flag_bounds_check)
11965             {
11966               t = TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0);
11967               TREE_OPERAND (TREE_OPERAND (TREE_OPERAND (lvalue, 1), 0), 0) =
11968                 build (COMPOUND_EXPR, void_type_node, t, check);
11969             }
11970           else
11971             TREE_OPERAND (lvalue, 1) = build (COMPOUND_EXPR, lhs_type,
11972                                               check, TREE_OPERAND (lvalue, 1));
11973         }
11974       else 
11975         {
11976           /* Make sure the bound check will happen before the store check */
11977           if (flag_bounds_check)
11978             TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0) =
11979               build (COMPOUND_EXPR, void_type_node,
11980                      TREE_OPERAND (TREE_OPERAND (lvalue, 0), 0), check);
11981           else
11982             lvalue = build (COMPOUND_EXPR, lhs_type, check, lvalue);
11983         }
11984     }
11985
11986   TREE_OPERAND (node, 0) = lvalue;
11987   TREE_OPERAND (node, 1) = new_rhs;
11988   TREE_TYPE (node) = lhs_type;
11989   return node;
11990 }
11991
11992 /* Check that type SOURCE can be cast into type DEST. If the cast
11993    can't occur at all, return 0 otherwise 1. This function is used to
11994    produce accurate error messages on the reasons why an assignment
11995    failed. */
11996
11997 static tree
11998 try_reference_assignconv (lhs_type, rhs)
11999      tree lhs_type, rhs;
12000 {
12001   tree new_rhs = NULL_TREE;
12002   tree rhs_type = TREE_TYPE (rhs);
12003
12004   if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
12005     {
12006       /* `null' may be assigned to any reference type */
12007       if (rhs == null_pointer_node)
12008         new_rhs = null_pointer_node;
12009       /* Try the reference assignment conversion */
12010       else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
12011         new_rhs = rhs;
12012       /* This is a magic assignment that we process differently */
12013       else if (rhs == soft_exceptioninfo_call_node)
12014         new_rhs = rhs;
12015     }
12016   return new_rhs;
12017 }
12018
12019 /* Check that RHS can be converted into LHS_TYPE by the assignment
12020    conversion (5.2), for the cases of RHS being a builtin type. Return
12021    NULL_TREE if the conversion fails or if because RHS isn't of a
12022    builtin type. Return a converted RHS if the conversion is possible.  */
12023
12024 static tree
12025 try_builtin_assignconv (wfl_op1, lhs_type, rhs)
12026      tree wfl_op1, lhs_type, rhs;
12027 {
12028   tree new_rhs = NULL_TREE;
12029   tree rhs_type = TREE_TYPE (rhs);
12030
12031   /* Zero accepted everywhere */
12032   if (TREE_CODE (rhs) == INTEGER_CST 
12033       && TREE_INT_CST_HIGH (rhs) == 0 && TREE_INT_CST_LOW (rhs) == 0
12034       && JPRIMITIVE_TYPE_P (rhs_type))
12035     new_rhs = convert (lhs_type, rhs);
12036
12037   /* 5.1.1 Try Identity Conversion,
12038      5.1.2 Try Widening Primitive Conversion */
12039   else if (valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type))
12040     new_rhs = convert (lhs_type, rhs);
12041
12042   /* Try a narrowing primitive conversion (5.1.3): 
12043        - expression is a constant expression of type int AND
12044        - variable is byte, short or char AND
12045        - The value of the expression is representable in the type of the 
12046          variable */
12047   else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
12048            && (lhs_type == byte_type_node || lhs_type == char_type_node
12049                || lhs_type == short_type_node))
12050     {
12051       if (int_fits_type_p (rhs, lhs_type))
12052         new_rhs = convert (lhs_type, rhs);
12053       else if (wfl_op1)         /* Might be called with a NULL */
12054         parse_warning_context 
12055           (wfl_op1, "Constant expression `%s' to wide for narrowing primitive conversion to `%s'", 
12056            print_int_node (rhs), lang_printable_name (lhs_type, 0));
12057       /* Reported a warning that will turn into an error further
12058          down, so we don't return */
12059     }
12060
12061   return new_rhs;
12062 }
12063
12064 /* Return 1 if RHS_TYPE can be converted to LHS_TYPE by identity
12065    conversion (5.1.1) or widening primitve conversion (5.1.2).  Return
12066    0 is the conversion test fails.  This implements parts the method
12067    invocation convertion (5.3).  */
12068
12069 static int
12070 valid_builtin_assignconv_identity_widening_p (lhs_type, rhs_type)
12071      tree lhs_type, rhs_type;
12072 {
12073   /* 5.1.1: This is the identity conversion part. */
12074   if (lhs_type == rhs_type)
12075     return 1;
12076
12077   /* Reject non primitive types */
12078   if (!JPRIMITIVE_TYPE_P (lhs_type) || !JPRIMITIVE_TYPE_P (rhs_type))
12079     return 0;
12080
12081   /* 5.1.2: widening primitive conversion. byte, even if it's smaller
12082      than a char can't be converted into a char. Short can't too, but
12083      the < test below takes care of that */
12084   if (lhs_type == char_type_node && rhs_type == byte_type_node)
12085     return 0;
12086
12087   /* Accept all promoted type here. Note, we can't use <= in the test
12088      below, because we still need to bounce out assignments of short
12089      to char and the likes */
12090   if (lhs_type == int_type_node
12091       && (rhs_type == promoted_byte_type_node
12092           || rhs_type == promoted_short_type_node
12093           || rhs_type == promoted_char_type_node
12094           || rhs_type == promoted_boolean_type_node))
12095     return 1;
12096
12097   /* From here, an integral is widened if its precision is smaller
12098      than the precision of the LHS or if the LHS is a floating point
12099      type, or the RHS is a float and the RHS a double. */
12100   if ((JINTEGRAL_TYPE_P (rhs_type) && JINTEGRAL_TYPE_P (lhs_type) 
12101        && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
12102       || (JINTEGRAL_TYPE_P (rhs_type) && JFLOAT_TYPE_P (lhs_type))
12103       || (rhs_type == float_type_node && lhs_type == double_type_node))
12104     return 1;
12105
12106   return 0;
12107 }
12108
12109 /* Check that something of SOURCE type can be assigned or cast to
12110    something of DEST type at runtime. Return 1 if the operation is
12111    valid, 0 otherwise. If CAST is set to 1, we're treating the case
12112    were SOURCE is cast into DEST, which borrows a lot of the
12113    assignment check. */
12114
12115 static int
12116 valid_ref_assignconv_cast_p (source, dest, cast)
12117      tree source;
12118      tree dest;
12119      int cast;
12120 {
12121   /* SOURCE or DEST might be null if not from a declared entity. */
12122   if (!source || !dest)
12123     return 0;
12124   if (JNULLP_TYPE_P (source))
12125     return 1;
12126   if (TREE_CODE (source) == POINTER_TYPE)
12127     source = TREE_TYPE (source);
12128   if (TREE_CODE (dest) == POINTER_TYPE)
12129     dest = TREE_TYPE (dest);
12130   /* Case where SOURCE is a class type */
12131   if (TYPE_CLASS_P (source))
12132     {
12133       if (TYPE_CLASS_P (dest))
12134         return  source == dest || inherits_from_p (source, dest)
12135           || (cast && inherits_from_p (dest, source));
12136       if (TYPE_INTERFACE_P (dest))
12137         {
12138           /* If doing a cast and SOURCE is final, the operation is
12139              always correct a compile time (because even if SOURCE
12140              does not implement DEST, a subclass of SOURCE might). */
12141           if (cast && !CLASS_FINAL (TYPE_NAME (source)))
12142             return 1;
12143           /* Otherwise, SOURCE must implement DEST */
12144           return interface_of_p (dest, source);
12145         }
12146       /* DEST is an array, cast permited if SOURCE is of Object type */
12147       return (cast && source == object_type_node ? 1 : 0);
12148     }
12149   if (TYPE_INTERFACE_P (source))
12150     {
12151       if (TYPE_CLASS_P (dest))
12152         {
12153           /* If not casting, DEST must be the Object type */
12154           if (!cast)
12155             return dest == object_type_node;
12156           /* We're doing a cast. The cast is always valid is class
12157              DEST is not final, otherwise, DEST must implement SOURCE */
12158           else if (!CLASS_FINAL (TYPE_NAME (dest)))
12159             return 1;
12160           else
12161             return interface_of_p (source, dest);
12162         }
12163       if (TYPE_INTERFACE_P (dest))
12164         {
12165           /* If doing a cast, then if SOURCE and DEST contain method
12166              with the same signature but different return type, then
12167              this is a (compile time) error */
12168           if (cast)
12169             {
12170               tree method_source, method_dest;
12171               tree source_type;
12172               tree source_sig;
12173               tree source_name;
12174               for (method_source = TYPE_METHODS (source); method_source; 
12175                    method_source = TREE_CHAIN (method_source))
12176                 {
12177                   source_sig = 
12178                     build_java_argument_signature (TREE_TYPE (method_source));
12179                   source_type = TREE_TYPE (TREE_TYPE (method_source));
12180                   source_name = DECL_NAME (method_source);
12181                   for (method_dest = TYPE_METHODS (dest);
12182                        method_dest; method_dest = TREE_CHAIN (method_dest))
12183                     if (source_sig == 
12184                         build_java_argument_signature (TREE_TYPE (method_dest))
12185                         && source_name == DECL_NAME (method_dest)
12186                         && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
12187                       return 0;
12188                 }
12189               return 1;
12190             }
12191           else
12192             return source == dest || interface_of_p (dest, source);
12193         }
12194       else                      /* Array */
12195         return (cast ? 
12196                 (DECL_NAME (TYPE_NAME (source)) == java_lang_cloneable) : 0);
12197     }
12198   if (TYPE_ARRAY_P (source))
12199     {
12200       if (TYPE_CLASS_P (dest))
12201         return dest == object_type_node;
12202       /* Can't cast an array to an interface unless the interface is
12203          java.lang.Cloneable */
12204       if (TYPE_INTERFACE_P (dest))
12205         return (DECL_NAME (TYPE_NAME (dest)) == java_lang_cloneable ? 1 : 0);
12206       else                      /* Arrays */
12207         {
12208           tree source_element_type = TYPE_ARRAY_ELEMENT (source);
12209           tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
12210           
12211           /* In case of severe errors, they turn out null */
12212           if (!dest_element_type || !source_element_type)
12213             return 0;
12214           if (source_element_type == dest_element_type)
12215             return 1;
12216           return valid_ref_assignconv_cast_p (source_element_type,
12217                                               dest_element_type, cast);
12218         }
12219       return 0;
12220     }
12221   return 0;
12222 }
12223
12224 static int
12225 valid_cast_to_p (source, dest)
12226      tree source;
12227      tree dest;
12228 {
12229   if (TREE_CODE (source) == POINTER_TYPE)
12230     source = TREE_TYPE (source);
12231   if (TREE_CODE (dest) == POINTER_TYPE)
12232     dest = TREE_TYPE (dest);
12233
12234   if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
12235     return valid_ref_assignconv_cast_p (source, dest, 1);
12236
12237   else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
12238     return 1;
12239
12240   return 0;
12241 }
12242
12243 /* Method invocation conversion test. Return 1 if type SOURCE can be
12244    converted to type DEST through the methond invocation conversion
12245    process (5.3) */
12246
12247 static tree
12248 do_unary_numeric_promotion (arg)
12249      tree arg;
12250 {
12251   tree type = TREE_TYPE (arg);
12252   if (TREE_CODE (type) == INTEGER_TYPE ? TYPE_PRECISION (type) < 32
12253       : TREE_CODE (type) == CHAR_TYPE)
12254     arg = convert (int_type_node, arg);
12255   return arg;
12256 }
12257
12258 /* Return a non zero value if SOURCE can be converted into DEST using
12259    the method invocation conversion rule (5.3).  */
12260 static int
12261 valid_method_invocation_conversion_p (dest, source)
12262      tree dest, source;
12263 {
12264   return ((JPRIMITIVE_TYPE_P (source) && JPRIMITIVE_TYPE_P (dest)
12265            && valid_builtin_assignconv_identity_widening_p (dest, source))
12266           || ((JREFERENCE_TYPE_P (source) || JNULLP_TYPE_P (source))
12267               && (JREFERENCE_TYPE_P (dest) || JNULLP_TYPE_P (dest))
12268               && valid_ref_assignconv_cast_p (source, dest, 0)));
12269 }
12270
12271 /* Build an incomplete binop expression. */
12272
12273 static tree
12274 build_binop (op, op_location, op1, op2)
12275      enum tree_code op;
12276      int op_location;
12277      tree op1, op2;
12278 {
12279   tree binop = build (op, NULL_TREE, op1, op2);
12280   TREE_SIDE_EFFECTS (binop) = 1;
12281   /* Store the location of the operator, for better error report. The
12282      string of the operator will be rebuild based on the OP value. */
12283   EXPR_WFL_LINECOL (binop) = op_location;
12284   return binop;
12285 }
12286
12287 /* Build the string of the operator retained by NODE. If NODE is part
12288    of a compound expression, add an '=' at the end of the string. This
12289    function is called when an error needs to be reported on an
12290    operator. The string is returned as a pointer to a static character
12291    buffer. */
12292
12293 static char *
12294 operator_string (node)
12295      tree node;
12296 {
12297 #define BUILD_OPERATOR_STRING(S)                                        \
12298   {                                                                     \
12299     sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
12300     return buffer;                                                      \
12301   }
12302   
12303   static char buffer [10];
12304   switch (TREE_CODE (node))
12305     {
12306     case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
12307     case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
12308     case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
12309     case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
12310     case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
12311     case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
12312     case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
12313     case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
12314     case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
12315     case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
12316     case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
12317     case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
12318     case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
12319     case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
12320     case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
12321     case GT_EXPR: BUILD_OPERATOR_STRING (">");
12322     case GE_EXPR: BUILD_OPERATOR_STRING (">=");
12323     case LT_EXPR: BUILD_OPERATOR_STRING ("<");
12324     case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
12325     case UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
12326     case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
12327     case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
12328     case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
12329     case PREINCREMENT_EXPR:     /* Fall through */
12330     case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
12331     case PREDECREMENT_EXPR:     /* Fall through */
12332     case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
12333     default:
12334       fatal ("unregistered operator %s - operator_string",
12335              tree_code_name [TREE_CODE (node)]);
12336     }
12337   return NULL;
12338 #undef BUILD_OPERATOR_STRING
12339 }
12340
12341 /* Return 1 if VAR_ACCESS1 is equivalent to VAR_ACCESS2.  */
12342
12343 static int
12344 java_decl_equiv (var_acc1, var_acc2)
12345      tree var_acc1, var_acc2;
12346 {
12347   if (JDECL_P (var_acc1))
12348     return (var_acc1 == var_acc2);
12349   
12350   return (TREE_CODE (var_acc1) == COMPONENT_REF
12351           && TREE_CODE (var_acc2) == COMPONENT_REF
12352           && TREE_OPERAND (TREE_OPERAND (var_acc1, 0), 0)
12353              == TREE_OPERAND (TREE_OPERAND (var_acc2, 0), 0)
12354           && TREE_OPERAND (var_acc1, 1) == TREE_OPERAND (var_acc2, 1));
12355 }
12356
12357 /* Return a non zero value if CODE is one of the operators that can be
12358    used in conjunction with the `=' operator in a compound assignment.  */
12359
12360 static int
12361 binop_compound_p (code)
12362     enum tree_code code;
12363 {
12364   int i;
12365   for (i = 0; i < BINOP_COMPOUND_CANDIDATES; i++)
12366     if (binop_lookup [i] == code)
12367       break;
12368
12369   return i < BINOP_COMPOUND_CANDIDATES;
12370 }
12371
12372 /* Reorganize after a fold to get SAVE_EXPR to generate what we want.  */
12373
12374 static tree
12375 java_refold (t)
12376      tree t;
12377 {
12378   tree c, b, ns, decl;
12379
12380   if (TREE_CODE (t) != MODIFY_EXPR)
12381     return t;
12382
12383   c = TREE_OPERAND (t, 1);
12384   if (! (c && TREE_CODE (c) == COMPOUND_EXPR
12385          && TREE_CODE (TREE_OPERAND (c, 0)) == MODIFY_EXPR
12386          && binop_compound_p (TREE_CODE (TREE_OPERAND (c, 1)))))
12387     return t;
12388
12389   /* Now the left branch of the binary operator. */
12390   b = TREE_OPERAND (TREE_OPERAND (c, 1), 0);
12391   if (! (b && TREE_CODE (b) == NOP_EXPR 
12392          && TREE_CODE (TREE_OPERAND (b, 0)) == SAVE_EXPR))
12393     return t;
12394
12395   ns = TREE_OPERAND (TREE_OPERAND (b, 0), 0);
12396   if (! (ns && TREE_CODE (ns) == NOP_EXPR
12397          && TREE_CODE (TREE_OPERAND (ns, 0)) == SAVE_EXPR))
12398     return t;
12399
12400   decl = TREE_OPERAND (TREE_OPERAND (ns, 0), 0);
12401   if ((JDECL_P (decl) || TREE_CODE (decl) == COMPONENT_REF)
12402       /* It's got to be the an equivalent decl */
12403       && java_decl_equiv (decl, TREE_OPERAND (TREE_OPERAND (c, 0), 0)))
12404     {
12405       /* Shorten the NOP_EXPR/SAVE_EXPR path. */
12406       TREE_OPERAND (TREE_OPERAND (c, 1), 0) = TREE_OPERAND (ns, 0);
12407       /* Substitute the COMPOUND_EXPR by the BINOP_EXPR */
12408       TREE_OPERAND (t, 1) = TREE_OPERAND (c, 1);
12409       /* Change the right part of the BINOP_EXPR */
12410       TREE_OPERAND (TREE_OPERAND (t, 1), 1) = TREE_OPERAND (c, 0);
12411     }
12412
12413   return t;
12414 }
12415
12416 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
12417    errors but we modify NODE so that it contains the type computed
12418    according to the expression, when it's fixed. Otherwise, we write
12419    error_mark_node as the type. It allows us to further the analysis
12420    of remaining nodes and detects more errors in certain cases.  */
12421
12422 static tree
12423 patch_binop (node, wfl_op1, wfl_op2)
12424      tree node;
12425      tree wfl_op1;
12426      tree wfl_op2;
12427 {
12428   tree op1 = TREE_OPERAND (node, 0);
12429   tree op2 = TREE_OPERAND (node, 1);
12430   tree op1_type = TREE_TYPE (op1);
12431   tree op2_type = TREE_TYPE (op2);
12432   tree prom_type = NULL_TREE;
12433   int code = TREE_CODE (node);
12434
12435   /* If 1, tell the routine that we have to return error_mark_node
12436      after checking for the initialization of the RHS */
12437   int error_found = 0;
12438
12439   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
12440
12441   switch (code)
12442     {
12443     /* 15.16 Multiplicative operators */
12444     case MULT_EXPR:             /* 15.16.1 Multiplication Operator * */
12445     case RDIV_EXPR:             /* 15.16.2 Division Operator / */
12446     case TRUNC_MOD_EXPR:        /* 15.16.3 Remainder operator % */
12447       if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
12448         {
12449           if (!JPRIMITIVE_TYPE_P (op1_type))
12450             ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12451           if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
12452             ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12453           TREE_TYPE (node) = error_mark_node;
12454           error_found = 1;
12455           break;
12456         }
12457       prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12458       /* Change the division operator if necessary */
12459       if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
12460         TREE_SET_CODE (node, TRUNC_DIV_EXPR);
12461
12462       if (TREE_CODE (prom_type) == INTEGER_TYPE
12463           && flag_use_divide_subroutine
12464           && ! flag_emit_class_files
12465           && (code == RDIV_EXPR || code == TRUNC_MOD_EXPR))
12466         return build_java_soft_divmod (TREE_CODE (node), prom_type, op1, op2);
12467  
12468       /* This one is more complicated. FLOATs are processed by a
12469          function call to soft_fmod. Duplicate the value of the
12470          COMPOUND_ASSIGN_P flag. */
12471       if (code == TRUNC_MOD_EXPR)
12472         {
12473           tree mod = build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
12474           COMPOUND_ASSIGN_P (mod) = COMPOUND_ASSIGN_P (node);
12475           TREE_SIDE_EFFECTS (mod)
12476             = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12477           return mod;
12478         }
12479       break;
12480
12481     /* 15.17 Additive Operators */
12482     case PLUS_EXPR:             /* 15.17.1 String Concatenation Operator + */
12483
12484       /* Operation is valid if either one argument is a string
12485          constant, a String object or a StringBuffer crafted for the
12486          purpose of the a previous usage of the String concatenation
12487          operator */
12488
12489       if (TREE_CODE (op1) == STRING_CST 
12490           || TREE_CODE (op2) == STRING_CST
12491           || JSTRING_TYPE_P (op1_type)
12492           || JSTRING_TYPE_P (op2_type)
12493           || IS_CRAFTED_STRING_BUFFER_P (op1)
12494           || IS_CRAFTED_STRING_BUFFER_P (op2))
12495         return build_string_concatenation (op1, op2);
12496
12497     case MINUS_EXPR:            /* 15.17.2 Additive Operators (+ and -) for
12498                                    Numeric Types */
12499       if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
12500         {
12501           if (!JPRIMITIVE_TYPE_P (op1_type))
12502             ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12503           if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
12504             ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12505           TREE_TYPE (node) = error_mark_node;
12506           error_found = 1;
12507           break;
12508         }
12509       prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12510       break;
12511
12512     /* 15.18 Shift Operators */
12513     case LSHIFT_EXPR:
12514     case RSHIFT_EXPR:
12515     case URSHIFT_EXPR:
12516       if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
12517         {
12518           if (!JINTEGRAL_TYPE_P (op1_type))
12519             ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
12520           else
12521             {
12522               if (JPRIMITIVE_TYPE_P (op2_type))
12523                 parse_error_context (wfl_operator,
12524                                      "Incompatible type for `%s'. Explicit cast needed to convert shift distance from `%s' to integral",
12525                                      operator_string (node),
12526                                      lang_printable_name (op2_type, 0));
12527               else
12528                 parse_error_context (wfl_operator,
12529                                      "Incompatible type for `%s'. Can't convert shift distance from `%s' to integral", 
12530                                      operator_string (node),
12531                                      lang_printable_name (op2_type, 0));
12532             }
12533           TREE_TYPE (node) = error_mark_node;
12534           error_found = 1;
12535           break;
12536         }
12537
12538       /* Unary numeric promotion (5.6.1) is performed on each operand
12539          separatly */
12540       op1 = do_unary_numeric_promotion (op1);
12541       op2 = do_unary_numeric_promotion (op2);
12542
12543       /* The type of the shift expression is the type of the promoted
12544          type of the left-hand operand */
12545       prom_type = TREE_TYPE (op1);
12546
12547       /* Shift int only up to 0x1f and long up to 0x3f. The bytecode
12548          generator should take care of removing this operation. FIXME */
12549       op2 = fold (build (BIT_AND_EXPR, prom_type, convert (prom_type, op2), 
12550                          (prom_type == int_type_node ? build_int_2 (0x1f, 0) :
12551                           convert (prom_type, build_int_2 (0x3f, 0)))));
12552
12553       /* The >>> operator is a >> operating on unsigned quantities */
12554       if (code == URSHIFT_EXPR && ! flag_emit_class_files)
12555         {
12556           tree to_return;
12557           tree utype = unsigned_type (prom_type);
12558           op1 = convert (utype, op1);
12559           TREE_SET_CODE (node, RSHIFT_EXPR);
12560           TREE_OPERAND (node, 0) = op1;
12561           TREE_OPERAND (node, 1) = op2;
12562           TREE_TYPE (node) = utype;
12563           to_return = convert (prom_type, node);
12564           /* Copy the original value of the COMPOUND_ASSIGN_P flag */
12565           COMPOUND_ASSIGN_P (to_return) = COMPOUND_ASSIGN_P (node);
12566           TREE_SIDE_EFFECTS (to_return)
12567             = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12568           return to_return;
12569         }
12570       break;
12571
12572       /* 15.19.1 Type Comparison Operator instaceof */
12573     case INSTANCEOF_EXPR:
12574
12575       TREE_TYPE (node) = boolean_type_node;
12576
12577       if (!(op2_type = resolve_type_during_patch (op2)))
12578         return error_mark_node;
12579
12580       /* The first operand must be a reference type or the null type */
12581       if (!JREFERENCE_TYPE_P (op1_type) && op1 != null_pointer_node)
12582         error_found = 1;        /* Error reported further below */
12583
12584       /* The second operand must be a reference type */
12585       if (!JREFERENCE_TYPE_P (op2_type))
12586         {
12587           SET_WFL_OPERATOR (wfl_operator, node, wfl_op2);
12588           parse_error_context
12589             (wfl_operator, "Invalid argument `%s' for `instanceof'",
12590              lang_printable_name (op2_type, 0));
12591           error_found = 1;
12592         }
12593
12594       if (!error_found && valid_ref_assignconv_cast_p (op1_type, op2_type, 1))
12595         {
12596           /* If the first operand is null, the result is always false */
12597           if (op1 == null_pointer_node)
12598             return boolean_false_node;
12599           else if (flag_emit_class_files)
12600             {
12601               TREE_OPERAND (node, 1) = op2_type;
12602               TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1);
12603               return node;
12604             }
12605           /* Otherwise we have to invoke instance of to figure it out */
12606           else
12607             {
12608               tree call =
12609                 build (CALL_EXPR, boolean_type_node,
12610                        build_address_of (soft_instanceof_node),
12611                        tree_cons 
12612                        (NULL_TREE, op1,
12613                         build_tree_list (NULL_TREE,
12614                                          build_class_ref (op2_type))),
12615                        NULL_TREE);
12616               TREE_SIDE_EFFECTS (call) = TREE_SIDE_EFFECTS (op1);
12617               return call;
12618             }
12619         }
12620       /* There is no way the expression operand can be an instance of
12621          the type operand. This is a compile time error. */
12622       else
12623         {
12624           char *t1 = xstrdup (lang_printable_name (op1_type, 0));
12625           SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
12626           parse_error_context 
12627             (wfl_operator, "Impossible for `%s' to be instance of `%s'",
12628              t1, lang_printable_name (op2_type, 0));
12629           free (t1);
12630           error_found = 1;
12631         }
12632       
12633       break;
12634
12635       /* 15.21 Bitwise and Logical Operators */
12636     case BIT_AND_EXPR:
12637     case BIT_XOR_EXPR:
12638     case BIT_IOR_EXPR:
12639       if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
12640         /* Binary numeric promotion is performed on both operand and the
12641            expression retain that type */
12642         prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12643
12644       else if (TREE_CODE (op1_type) == BOOLEAN_TYPE 
12645                && TREE_CODE (op1_type) == BOOLEAN_TYPE)
12646         /* The type of the bitwise operator expression is BOOLEAN */
12647         prom_type = boolean_type_node;
12648       else
12649         {
12650           if (!JINTEGRAL_TYPE_P (op1_type))
12651             ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
12652           if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
12653             ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
12654           TREE_TYPE (node) = error_mark_node;
12655           error_found = 1;
12656           /* Insert a break here if adding thing before the switch's
12657              break for this case */
12658         }
12659       break;
12660
12661       /* 15.22 Conditional-And Operator */
12662     case TRUTH_ANDIF_EXPR:
12663       /* 15.23 Conditional-Or Operator */
12664     case TRUTH_ORIF_EXPR:
12665       /* Operands must be of BOOLEAN type */
12666       if (TREE_CODE (op1_type) != BOOLEAN_TYPE || 
12667           TREE_CODE (op2_type) != BOOLEAN_TYPE)
12668         {
12669           if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
12670             ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
12671           if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
12672             ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
12673           TREE_TYPE (node) = boolean_type_node;
12674           error_found = 1;
12675           break;
12676         }
12677       /* The type of the conditional operators is BOOLEAN */
12678       prom_type = boolean_type_node;
12679       break;
12680
12681       /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
12682     case LT_EXPR:
12683     case GT_EXPR:
12684     case LE_EXPR:
12685     case GE_EXPR:
12686       /* The type of each of the operands must be a primitive numeric
12687          type */
12688       if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
12689         {
12690           if (!JNUMERIC_TYPE_P (op1_type))
12691             ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
12692           if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
12693             ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
12694           TREE_TYPE (node) = boolean_type_node;
12695           error_found = 1;
12696           break;
12697         }
12698       /* Binary numeric promotion is performed on the operands */
12699       binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12700       /* The type of the relation expression is always BOOLEAN */
12701       prom_type = boolean_type_node;
12702       break;
12703
12704       /* 15.20 Equality Operator */
12705     case EQ_EXPR:
12706     case NE_EXPR:
12707       /* 15.20.1 Numerical Equality Operators == and != */
12708       /* Binary numeric promotion is performed on the operands */
12709       if (JNUMERIC_TYPE_P (op1_type) && JNUMERIC_TYPE_P (op2_type))
12710         binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
12711       
12712       /* 15.20.2 Boolean Equality Operators == and != */
12713       else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
12714           TREE_CODE (op2_type) == BOOLEAN_TYPE)
12715         ;                       /* Nothing to do here */
12716       
12717       /* 15.20.3 Reference Equality Operators == and != */
12718       /* Types have to be either references or the null type. If
12719          they're references, it must be possible to convert either
12720          type to the other by casting conversion. */
12721       else if (op1 == null_pointer_node || op2 == null_pointer_node 
12722                || (JREFERENCE_TYPE_P (op1_type) && JREFERENCE_TYPE_P (op2_type)
12723                    && (valid_ref_assignconv_cast_p (op1_type, op2_type, 1)
12724                        || valid_ref_assignconv_cast_p (op2_type, 
12725                                                        op1_type, 1))))
12726         ;                       /* Nothing to do here */
12727           
12728       /* Else we have an error figure what can't be converted into
12729          what and report the error */
12730       else
12731         {
12732           char *t1;
12733           t1 = xstrdup (lang_printable_name (op1_type, 0));
12734           parse_error_context 
12735             (wfl_operator,
12736              "Incompatible type for `%s'. Can't convert `%s' to `%s'",
12737              operator_string (node), t1, 
12738              lang_printable_name (op2_type, 0));
12739           free (t1);
12740           TREE_TYPE (node) = boolean_type_node;
12741           error_found = 1;
12742           break;
12743         }
12744       prom_type = boolean_type_node;
12745       break;
12746     }
12747
12748   if (error_found)
12749     return error_mark_node;
12750
12751   TREE_OPERAND (node, 0) = op1;
12752   TREE_OPERAND (node, 1) = op2;
12753   TREE_TYPE (node) = prom_type;
12754   TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12755   
12756   if (flag_emit_xref)
12757     return node;
12758
12759   /* fold does not respect side-effect order as required for Java but not C.
12760    * Also, it sometimes create SAVE_EXPRs which are bad when emitting
12761    * bytecode.
12762    */
12763   if (flag_emit_class_files ? (TREE_CONSTANT (op1) && TREE_CONSTANT (op2))
12764       : ! TREE_SIDE_EFFECTS (node))
12765     node = fold (node);
12766   return node;
12767 }
12768
12769 /* Concatenate the STRING_CST CSTE and STRING. When AFTER is a non
12770    zero value, the value of CSTE comes after the valude of STRING */
12771
12772 static tree
12773 do_merge_string_cste (cste, string, string_len, after)
12774      tree cste;
12775      const char *string;
12776      int string_len, after;
12777 {
12778   int len = TREE_STRING_LENGTH (cste) + string_len;
12779   const char *old = TREE_STRING_POINTER (cste);
12780   TREE_STRING_LENGTH (cste) = len;
12781   TREE_STRING_POINTER (cste) = obstack_alloc (expression_obstack, len+1);
12782   if (after)
12783     {
12784       strcpy (TREE_STRING_POINTER (cste), string);
12785       strcat (TREE_STRING_POINTER (cste), old);
12786     }
12787   else
12788     {
12789       strcpy (TREE_STRING_POINTER (cste), old);
12790       strcat (TREE_STRING_POINTER (cste), string);
12791     }
12792   return cste;
12793 }
12794
12795 /* Tries to merge OP1 (a STRING_CST) and OP2 (if suitable). Return a
12796    new STRING_CST on success, NULL_TREE on failure */
12797
12798 static tree
12799 merge_string_cste (op1, op2, after)
12800      tree op1, op2;
12801      int after;
12802 {
12803   /* Handle two string constants right away */
12804   if (TREE_CODE (op2) == STRING_CST)
12805     return do_merge_string_cste (op1, TREE_STRING_POINTER (op2), 
12806                                  TREE_STRING_LENGTH (op2), after);
12807   
12808   /* Reasonable integer constant can be treated right away */
12809   if (TREE_CODE (op2) == INTEGER_CST && !TREE_CONSTANT_OVERFLOW (op2))
12810     {
12811       static const char *boolean_true = "true";
12812       static const char *boolean_false = "false";
12813       static const char *null_pointer = "null";
12814       char ch[3];
12815       const char *string;
12816       
12817       if (op2 == boolean_true_node)
12818         string = boolean_true;
12819       else if (op2 == boolean_false_node)
12820         string = boolean_false;
12821       else if (op2 == null_pointer_node)
12822         string = null_pointer;
12823       else if (TREE_TYPE (op2) == char_type_node)
12824         {
12825           ch[0] = (char )TREE_INT_CST_LOW (op2);
12826           ch[1] = '\0';
12827           string = ch;
12828         }
12829       else
12830           string = print_int_node (op2);
12831       
12832       return do_merge_string_cste (op1, string, strlen (string), after);
12833     }
12834   return NULL_TREE;
12835 }
12836
12837 /* Tries to statically concatenate OP1 and OP2 if possible. Either one
12838    has to be a STRING_CST and the other part must be a STRING_CST or a
12839    INTEGRAL constant. Return a new STRING_CST if the operation
12840    succeed, NULL_TREE otherwise.
12841
12842    If the case we want to optimize for space, we might want to return
12843    NULL_TREE for each invocation of this routine. FIXME */
12844
12845 static tree
12846 string_constant_concatenation (op1, op2)
12847      tree op1, op2;
12848 {
12849   if (TREE_CODE (op1) == STRING_CST || (TREE_CODE (op2) == STRING_CST))
12850     {
12851       tree string, rest;
12852       int invert;
12853       
12854       string = (TREE_CODE (op1) == STRING_CST ? op1 : op2);
12855       rest   = (string == op1 ? op2 : op1);
12856       invert = (string == op1 ? 0 : 1 );
12857       
12858       /* Walk REST, only if it looks reasonable */
12859       if (TREE_CODE (rest) != STRING_CST
12860           && !IS_CRAFTED_STRING_BUFFER_P (rest)
12861           && !JSTRING_TYPE_P (TREE_TYPE (rest))
12862           && TREE_CODE (rest) == EXPR_WITH_FILE_LOCATION)
12863         {
12864           rest = java_complete_tree (rest);
12865           if (rest == error_mark_node)
12866             return error_mark_node;
12867           rest = fold (rest);
12868         }
12869       return merge_string_cste (string, rest, invert);
12870     }
12871   return NULL_TREE;
12872 }
12873
12874 /* Implement the `+' operator. Does static optimization if possible,
12875    otherwise create (if necessary) and append elements to a
12876    StringBuffer. The StringBuffer will be carried around until it is
12877    used for a function call or an assignment. Then toString() will be
12878    called on it to turn it into a String object. */
12879
12880 static tree
12881 build_string_concatenation (op1, op2)
12882      tree op1, op2;
12883 {
12884   tree result;
12885   int side_effects = TREE_SIDE_EFFECTS (op1) | TREE_SIDE_EFFECTS (op2);
12886
12887   if (flag_emit_xref)
12888     return build (PLUS_EXPR, string_type_node, op1, op2);
12889   
12890   /* Try to do some static optimization */
12891   if ((result = string_constant_concatenation (op1, op2)))
12892     return result;
12893
12894   /* Discard empty strings on either side of the expression */
12895   if (TREE_CODE (op1) == STRING_CST && TREE_STRING_LENGTH (op1) == 0)
12896     {
12897       op1 = op2;
12898       op2 = NULL_TREE;
12899     }
12900   else if (TREE_CODE (op2) == STRING_CST && TREE_STRING_LENGTH (op2) == 0)
12901     op2 = NULL_TREE;
12902
12903   /* If operands are string constant, turn then into object references */
12904   if (TREE_CODE (op1) == STRING_CST)
12905     op1 = patch_string_cst (op1);
12906   if (op2 && TREE_CODE (op2) == STRING_CST)
12907     op2 = patch_string_cst (op2);
12908
12909   /* If either one of the constant is null and the other non null
12910      operand is a String object, return it. */
12911   if (JSTRING_TYPE_P (TREE_TYPE (op1)) && !op2)
12912     return op1;
12913
12914   /* If OP1 isn't already a StringBuffer, create and
12915      initialize a new one */
12916   if (!IS_CRAFTED_STRING_BUFFER_P (op1))
12917     {
12918       /* Two solutions here: 
12919          1) OP1 is a constant string reference, we call new StringBuffer(OP1)
12920          2) OP1 is something else, we call new StringBuffer().append(OP1).  */
12921       if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
12922         op1 = BUILD_STRING_BUFFER (op1);
12923       else
12924         {
12925           tree aNew = BUILD_STRING_BUFFER (NULL_TREE);
12926           op1 = make_qualified_primary (aNew, BUILD_APPEND (op1), 0);
12927         }
12928     }
12929
12930   if (op2)
12931     {
12932       /* OP1 is no longer the last node holding a crafted StringBuffer */
12933       IS_CRAFTED_STRING_BUFFER_P (op1) = 0;
12934       /* Create a node for `{new...,xxx}.append (op2)' */
12935       if (op2)
12936         op1 = make_qualified_primary (op1, BUILD_APPEND (op2), 0);
12937     }
12938
12939   /* Mark the last node holding a crafted StringBuffer */
12940   IS_CRAFTED_STRING_BUFFER_P (op1) = 1;
12941
12942   TREE_SIDE_EFFECTS (op1) = side_effects;
12943   return op1;
12944 }
12945
12946 /* Patch the string node NODE. NODE can be a STRING_CST of a crafted
12947    StringBuffer. If no string were found to be patched, return
12948    NULL. */
12949
12950 static tree
12951 patch_string (node)
12952     tree node;
12953 {
12954   if (node == error_mark_node)
12955     return error_mark_node;
12956   if (TREE_CODE (node) == STRING_CST)
12957     return patch_string_cst (node);
12958   else if (IS_CRAFTED_STRING_BUFFER_P (node))
12959     {
12960       int saved = ctxp->explicit_constructor_p;
12961       tree invoke = build_method_invocation (wfl_to_string, NULL_TREE);
12962       tree ret;
12963       /* Temporary disable forbid the use of `this'. */
12964       ctxp->explicit_constructor_p = 0;
12965       ret = java_complete_tree (make_qualified_primary (node, invoke, 0));
12966       /* String concatenation arguments must be evaluated in order too. */
12967       ret = force_evaluation_order (ret);
12968       /* Restore it at its previous value */
12969       ctxp->explicit_constructor_p = saved;
12970       return ret;
12971     }
12972   return NULL_TREE;
12973 }
12974
12975 /* Build the internal representation of a string constant.  */
12976
12977 static tree
12978 patch_string_cst (node)
12979      tree node;
12980 {
12981   int location;
12982   if (! flag_emit_class_files)
12983     {
12984       push_obstacks (&permanent_obstack, &permanent_obstack);
12985       node = get_identifier (TREE_STRING_POINTER (node));
12986       location = alloc_name_constant (CONSTANT_String, node);
12987       node = build_ref_from_constant_pool (location);
12988       pop_obstacks ();
12989     }
12990   TREE_TYPE (node) = string_ptr_type_node;
12991   TREE_CONSTANT (node) = 1;
12992   return node;
12993 }
12994
12995 /* Build an incomplete unary operator expression. */
12996
12997 static tree
12998 build_unaryop (op_token, op_location, op1)
12999      int op_token, op_location;
13000      tree op1;
13001 {
13002   enum tree_code op;
13003   tree unaryop;
13004   switch (op_token)
13005     {
13006     case PLUS_TK: op = UNARY_PLUS_EXPR; break;
13007     case MINUS_TK: op = NEGATE_EXPR; break;
13008     case NEG_TK: op = TRUTH_NOT_EXPR; break;
13009     case NOT_TK: op = BIT_NOT_EXPR; break;
13010     default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
13011                     op_token);
13012     }
13013
13014   unaryop = build1 (op, NULL_TREE, op1);
13015   TREE_SIDE_EFFECTS (unaryop) = 1;
13016   /* Store the location of the operator, for better error report. The
13017      string of the operator will be rebuild based on the OP value. */
13018   EXPR_WFL_LINECOL (unaryop) = op_location;
13019   return unaryop;
13020 }
13021
13022 /* Special case for the ++/-- operators, since they require an extra
13023    argument to build, which is set to NULL and patched
13024    later. IS_POST_P is 1 if the operator, 0 otherwise.  */
13025
13026 static tree
13027 build_incdec (op_token, op_location, op1, is_post_p)
13028      int op_token, op_location;
13029      tree op1;
13030      int is_post_p;
13031 {
13032   static enum tree_code lookup [2][2] = 
13033     {
13034       { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
13035       { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
13036     };
13037   tree node = build (lookup [is_post_p][(op_token - DECR_TK)], 
13038                      NULL_TREE, op1, NULL_TREE);
13039   TREE_SIDE_EFFECTS (node) = 1;
13040   /* Store the location of the operator, for better error report. The
13041      string of the operator will be rebuild based on the OP value. */
13042   EXPR_WFL_LINECOL (node) = op_location;
13043   return node;
13044 }     
13045
13046 /* Build an incomplete cast operator, based on the use of the
13047    CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
13048    set. java_complete_tree is trained to walk a CONVERT_EXPR even
13049    though its type is already set.  */
13050
13051 static tree
13052 build_cast (location, type, exp)
13053      int location;
13054      tree type, exp;
13055 {
13056   tree node = build1 (CONVERT_EXPR, type, exp);
13057   EXPR_WFL_LINECOL (node) = location;
13058   return node;
13059 }
13060
13061 /* 15.14 Unary operators. We return error_mark_node in case of error,
13062    but preserve the type of NODE if the type is fixed.  */
13063
13064 static tree
13065 patch_unaryop (node, wfl_op)
13066      tree node;
13067      tree wfl_op;
13068 {
13069   tree op = TREE_OPERAND (node, 0);
13070   tree op_type = TREE_TYPE (op);
13071   tree prom_type = NULL_TREE, value, decl;
13072   int code = TREE_CODE (node);
13073   int error_found = 0;
13074
13075   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13076
13077   switch (code)
13078     {
13079       /* 15.13.2 Postfix Increment Operator ++ */
13080     case POSTINCREMENT_EXPR:
13081       /* 15.13.3 Postfix Increment Operator -- */
13082     case POSTDECREMENT_EXPR:
13083       /* 15.14.1 Prefix Increment Operator ++ */
13084     case PREINCREMENT_EXPR:
13085       /* 15.14.2 Prefix Decrement Operator -- */
13086     case PREDECREMENT_EXPR:
13087       op = decl = strip_out_static_field_access_decl (op);
13088       /* We really should have a JAVA_ARRAY_EXPR to avoid this */
13089       if (!JDECL_P (decl) 
13090           && TREE_CODE (decl) != COMPONENT_REF
13091           && !(flag_emit_class_files && TREE_CODE (decl) == ARRAY_REF)
13092           && TREE_CODE (decl) != INDIRECT_REF
13093           && !(TREE_CODE (decl) == COMPOUND_EXPR
13094                && TREE_OPERAND (decl, 1)
13095                && (TREE_CODE (TREE_OPERAND (decl, 1)) == INDIRECT_REF)))
13096         {
13097           tree lvalue;
13098           /* Before screaming, check that we're not in fact trying to
13099              increment a optimized static final access, in which case
13100              we issue an different error message. */
13101           if (!(TREE_CODE (wfl_op) == EXPR_WITH_FILE_LOCATION
13102                 && resolve_expression_name (wfl_op, &lvalue)
13103                 && check_final_assignment (lvalue, wfl_op)))
13104             parse_error_context (wfl_operator, "Invalid argument to `%s'",
13105                                  operator_string (node));
13106           TREE_TYPE (node) = error_mark_node;
13107           error_found = 1;
13108         }
13109       else if (check_final_assignment (op, wfl_op))
13110         error_found = 1;
13111
13112       /* From now on, we know that op if a variable and that it has a
13113          valid wfl. We use wfl_op to locate errors related to the
13114          ++/-- operand. */
13115       else if (!JNUMERIC_TYPE_P (op_type))
13116         {
13117           parse_error_context
13118             (wfl_op, "Invalid argument type `%s' to `%s'",
13119              lang_printable_name (op_type, 0), operator_string (node));
13120           TREE_TYPE (node) = error_mark_node;
13121           error_found = 1;
13122         }
13123       else
13124         {
13125           /* Before the addition, binary numeric promotion is performed on
13126              both operands, if really necessary */
13127           if (JINTEGRAL_TYPE_P (op_type))
13128             {
13129               value = build_int_2 (1, 0);
13130               TREE_TYPE (value) = TREE_TYPE (node) = op_type;
13131             }
13132           else
13133             {
13134               value = build_int_2 (1, 0);
13135               TREE_TYPE (node) = 
13136                 binary_numeric_promotion (op_type, 
13137                                           TREE_TYPE (value), &op, &value);
13138             }
13139           /* And write back into the node. */
13140           TREE_OPERAND (node, 0) = op;
13141           TREE_OPERAND (node, 1) = value;
13142           /* Convert the overall back into its original type, if
13143              necessary, and return */
13144           if (JINTEGRAL_TYPE_P (op_type))
13145             return fold (node);
13146           else
13147             return fold (convert (op_type, node));
13148         }
13149       break;
13150
13151       /* 15.14.3 Unary Plus Operator + */
13152     case UNARY_PLUS_EXPR:
13153       /* 15.14.4 Unary Minus Operator - */
13154     case NEGATE_EXPR:
13155       if (!JNUMERIC_TYPE_P (op_type))
13156         {
13157           ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
13158           TREE_TYPE (node) = error_mark_node;
13159           error_found = 1;
13160         }
13161       /* Unary numeric promotion is performed on operand */
13162       else
13163         {
13164           op = do_unary_numeric_promotion (op);
13165           prom_type = TREE_TYPE (op);
13166           if (code == UNARY_PLUS_EXPR)
13167             return fold (op);
13168         }
13169       break;
13170
13171       /* 15.14.5 Bitwise Complement Operator ~ */
13172     case BIT_NOT_EXPR:
13173       if (!JINTEGRAL_TYPE_P (op_type))
13174         {
13175           ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
13176           TREE_TYPE (node) = error_mark_node;
13177           error_found = 1;
13178         }
13179       else
13180         {
13181           op = do_unary_numeric_promotion (op);
13182           prom_type = TREE_TYPE (op);
13183         }
13184       break;
13185
13186       /* 15.14.6 Logical Complement Operator ! */
13187     case TRUTH_NOT_EXPR:
13188       if (TREE_CODE (op_type) != BOOLEAN_TYPE)
13189         {
13190           ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
13191           /* But the type is known. We will report an error if further
13192              attempt of a assignment is made with this rhs */
13193           TREE_TYPE (node) = boolean_type_node;
13194           error_found = 1;
13195         }
13196       else
13197         prom_type = boolean_type_node;
13198       break;
13199
13200       /* 15.15 Cast Expression */
13201     case CONVERT_EXPR:
13202       value = patch_cast (node, wfl_operator);
13203       if (value == error_mark_node)
13204         {
13205           /* If this cast is part of an assignment, we tell the code
13206              that deals with it not to complain about a mismatch,
13207              because things have been cast, anyways */
13208           TREE_TYPE (node) = error_mark_node;
13209           error_found = 1;
13210         }
13211       else
13212         {
13213           value = fold (value);
13214           TREE_SIDE_EFFECTS (value) = TREE_SIDE_EFFECTS (op);
13215           return value;
13216         }
13217       break;
13218     }
13219   
13220   if (error_found)
13221     return error_mark_node;
13222
13223   /* There are cases where node has been replaced by something else
13224      and we don't end up returning here: UNARY_PLUS_EXPR,
13225      CONVERT_EXPR, {POST,PRE}{INCR,DECR}EMENT_EXPR. */
13226   TREE_OPERAND (node, 0) = fold (op);
13227   TREE_TYPE (node) = prom_type;
13228   TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (op);
13229   return fold (node);
13230 }
13231
13232 /* Generic type resolution that sometimes takes place during node
13233    patching. Returned the resolved type or generate an error
13234    message. Return the resolved type or NULL_TREE.  */
13235
13236 static tree
13237 resolve_type_during_patch (type)
13238      tree type;
13239 {
13240   if (unresolved_type_p (type, NULL))
13241     {
13242       tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
13243       if (!type_decl)
13244         {
13245           parse_error_context (type, 
13246                                "Class `%s' not found in type declaration",
13247                                IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
13248           return NULL_TREE;
13249         }
13250       else
13251         {
13252           CLASS_LOADED_P (TREE_TYPE (type_decl)) = 1;
13253           return TREE_TYPE (type_decl);
13254         }
13255     }
13256   return type;
13257 }
13258 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
13259    found. Otherwise NODE or something meant to replace it is returned.  */
13260
13261 static tree
13262 patch_cast (node, wfl_operator)
13263      tree node;
13264      tree wfl_operator;
13265 {
13266   tree op = TREE_OPERAND (node, 0);
13267   tree op_type = TREE_TYPE (op);
13268   tree cast_type = TREE_TYPE (node);
13269   char *t1;
13270
13271   /* First resolve OP_TYPE if unresolved */
13272   if (!(cast_type = resolve_type_during_patch (cast_type)))
13273     return error_mark_node;
13274
13275   /* Check on cast that are proven correct at compile time */
13276   if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
13277     {
13278       /* Same type */
13279       if (cast_type == op_type)
13280         return node;
13281
13282       /* float and double type are converted to the original type main
13283          variant and then to the target type. */
13284       if (JFLOAT_TYPE_P (op_type) && TREE_CODE (cast_type) == CHAR_TYPE)
13285         op = convert (integer_type_node, op);
13286
13287       /* Try widening/narowwing convertion. Potentially, things need
13288          to be worked out in gcc so we implement the extreme cases
13289          correctly. fold_convert() needs to be fixed. */
13290       return convert (cast_type, op);
13291     }
13292
13293   /* It's also valid to cast a boolean into a boolean */
13294   if (op_type == boolean_type_node && cast_type == boolean_type_node)
13295     return node;
13296
13297   /* null can be casted to references */
13298   if (op == null_pointer_node && JREFERENCE_TYPE_P (cast_type))
13299     return build_null_of_type (cast_type);
13300
13301   /* The remaining legal casts involve conversion between reference
13302      types. Check for their compile time correctness. */
13303   if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type) 
13304       && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
13305     {
13306       TREE_TYPE (node) = promote_type (cast_type);
13307       /* Now, the case can be determined correct at compile time if
13308          OP_TYPE can be converted into CAST_TYPE by assignment
13309          conversion (5.2) */
13310
13311       if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
13312         {
13313           TREE_SET_CODE (node, NOP_EXPR);
13314           return node;
13315         }
13316
13317       if (flag_emit_class_files)
13318         {
13319           TREE_SET_CODE (node, CONVERT_EXPR);
13320           return node;
13321         }
13322
13323       /* The cast requires a run-time check */
13324       return build (CALL_EXPR, promote_type (cast_type),
13325                     build_address_of (soft_checkcast_node),
13326                     tree_cons (NULL_TREE, build_class_ref (cast_type),
13327                                build_tree_list (NULL_TREE, op)),
13328                     NULL_TREE);
13329     }
13330
13331   /* Any other casts are proven incorrect at compile time */
13332   t1 = xstrdup (lang_printable_name (op_type, 0));
13333   parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
13334                        t1, lang_printable_name (cast_type, 0));
13335   free (t1);
13336   return error_mark_node;
13337 }
13338
13339 /* Build a null constant and give it the type TYPE.  */
13340
13341 static tree
13342 build_null_of_type (type)
13343      tree type;
13344 {
13345   tree node = build_int_2 (0, 0);
13346   TREE_TYPE (node) = promote_type (type);
13347   return node;
13348 }
13349
13350 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
13351    a list of indices. */
13352 static tree
13353 build_array_ref (location, array, index)
13354      int location;
13355      tree array, index;
13356 {
13357   tree node = build (ARRAY_REF, NULL_TREE, array, index);
13358   EXPR_WFL_LINECOL (node) = location;
13359   return node;
13360 }
13361
13362 /* 15.12 Array Access Expression */
13363
13364 static tree
13365 patch_array_ref (node)
13366      tree node;
13367 {
13368   tree array = TREE_OPERAND (node, 0);
13369   tree array_type  = TREE_TYPE (array);
13370   tree index = TREE_OPERAND (node, 1);
13371   tree index_type = TREE_TYPE (index);
13372   int error_found = 0;
13373
13374   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13375
13376   if (TREE_CODE (array_type) == POINTER_TYPE)
13377     array_type = TREE_TYPE (array_type);
13378
13379   /* The array reference must be an array */
13380   if (!TYPE_ARRAY_P (array_type))
13381     {
13382       parse_error_context 
13383         (wfl_operator,
13384          "`[]' can only be applied to arrays. It can't be applied to `%s'",
13385          lang_printable_name (array_type, 0));
13386       TREE_TYPE (node) = error_mark_node;
13387       error_found = 1;
13388     }
13389
13390   /* The array index underdoes unary numeric promotion. The promoted
13391      type must be int */
13392   index = do_unary_numeric_promotion (index);
13393   if (TREE_TYPE (index) != int_type_node)
13394     {
13395       if (valid_cast_to_p (index_type, int_type_node))
13396         parse_error_context (wfl_operator,
13397    "Incompatible type for `[]'. Explicit cast needed to convert `%s' to `int'",
13398                              lang_printable_name (index_type, 0));
13399       else
13400         parse_error_context (wfl_operator,
13401           "Incompatible type for `[]'. Can't convert `%s' to `int'",
13402                              lang_printable_name (index_type, 0));
13403       TREE_TYPE (node) = error_mark_node;
13404       error_found = 1;
13405     }
13406
13407   if (error_found)
13408     return error_mark_node;
13409
13410   array_type = TYPE_ARRAY_ELEMENT (array_type);
13411
13412   if (flag_emit_class_files || flag_emit_xref)
13413     {
13414       TREE_OPERAND (node, 0) = array;
13415       TREE_OPERAND (node, 1) = index;
13416     }
13417   else
13418     {
13419       /* The save_expr is for correct evaluation order.  It would be cleaner
13420          to use force_evaluation_order (see comment there), but that is
13421          difficult when we also have to deal with bounds checking. */
13422       if (TREE_SIDE_EFFECTS (index))
13423         array = save_expr (array);
13424       node = build_java_arrayaccess (array, array_type, index);
13425       if (TREE_SIDE_EFFECTS (index))
13426         node = build (COMPOUND_EXPR, array_type, array, node);
13427     }
13428   TREE_TYPE (node) = array_type;
13429   return node;
13430 }
13431
13432 /* 15.9 Array Creation Expressions */
13433
13434 static tree
13435 build_newarray_node (type, dims, extra_dims)
13436      tree type;
13437      tree dims;
13438      int extra_dims;
13439 {
13440   tree node =
13441     build (NEW_ARRAY_EXPR, NULL_TREE, type, nreverse (dims), 
13442            build_int_2 (extra_dims, 0));
13443   return node;
13444 }
13445
13446 static tree
13447 patch_newarray (node)
13448      tree node;
13449 {
13450   tree type = TREE_OPERAND (node, 0);
13451   tree dims = TREE_OPERAND (node, 1);
13452   tree cdim, array_type;
13453   int error_found = 0;
13454   int ndims = 0;
13455   int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
13456
13457   /* Dimension types are verified. It's better for the types to be
13458      verified in order. */
13459   for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
13460     {
13461       int dim_error = 0;
13462       tree dim = TREE_VALUE (cdim);
13463
13464       /* Dim might have been saved during its evaluation */
13465       dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
13466
13467       /* The type of each specified dimension must be an integral type. */
13468       if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
13469         dim_error = 1;
13470
13471       /* Each expression undergoes an unary numeric promotion (5.6.1) and the
13472          promoted type must be int. */
13473       else
13474         {
13475           dim = do_unary_numeric_promotion (dim);
13476           if (TREE_TYPE (dim) != int_type_node)
13477             dim_error = 1;
13478         }
13479
13480       /* Report errors on types here */
13481       if (dim_error)
13482         {
13483           parse_error_context 
13484             (TREE_PURPOSE (cdim), 
13485              "Incompatible type for dimension in array creation expression. %s convert `%s' to `int'", 
13486              (valid_cast_to_p (TREE_TYPE (dim), int_type_node) ?
13487               "Explicit cast needed to" : "Can't"),
13488              lang_printable_name (TREE_TYPE (dim), 0));
13489           error_found = 1;
13490         }
13491
13492       TREE_PURPOSE (cdim) = NULL_TREE;
13493     }
13494
13495   /* Resolve array base type if unresolved */
13496   if (!(type = resolve_type_during_patch (type)))
13497     error_found = 1;
13498
13499   if (error_found)
13500     {
13501       /* We don't want further evaluation of this bogus array creation
13502          operation */
13503       TREE_TYPE (node) = error_mark_node;
13504       return error_mark_node;
13505     }
13506
13507   /* Set array_type to the actual (promoted) array type of the result. */
13508   if (TREE_CODE (type) == RECORD_TYPE)
13509     type = build_pointer_type (type);
13510   while (--xdims >= 0)
13511     {
13512       type = promote_type (build_java_array_type (type, -1));
13513     }
13514   dims = nreverse (dims);
13515   array_type = type;
13516   for (cdim = dims; cdim; cdim = TREE_CHAIN (cdim))
13517     {
13518       type = array_type;
13519       array_type = build_java_array_type (type,
13520                                           TREE_CODE (cdim) == INTEGER_CST ?
13521                                           TREE_INT_CST_LOW (cdim) : -1);
13522       array_type = promote_type (array_type);
13523     }
13524   dims = nreverse (dims);
13525
13526   /* The node is transformed into a function call. Things are done
13527      differently according to the number of dimensions. If the number
13528      of dimension is equal to 1, then the nature of the base type
13529      (primitive or not) matters. */
13530   if (ndims == 1)
13531     return build_new_array (type, TREE_VALUE (dims));
13532   
13533   /* Can't reuse what's already written in expr.c because it uses the
13534      JVM stack representation. Provide a build_multianewarray. FIXME */
13535   return build (CALL_EXPR, array_type,
13536                 build_address_of (soft_multianewarray_node),
13537                 tree_cons (NULL_TREE, build_class_ref (TREE_TYPE (array_type)),
13538                            tree_cons (NULL_TREE, 
13539                                       build_int_2 (ndims, 0), dims )),
13540                 NULL_TREE);
13541 }
13542
13543 /* 10.6 Array initializer.  */
13544
13545 /* Build a wfl for array element that don't have one, so we can
13546    pin-point errors.  */
13547
13548 static tree
13549 maybe_build_array_element_wfl (node)
13550      tree node;
13551 {
13552   if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION)
13553     return build_expr_wfl (NULL_TREE, ctxp->filename,
13554                            ctxp->elc.line, ctxp->elc.prev_col);
13555   else
13556     return NULL_TREE;
13557 }
13558
13559 /* Build a NEW_ARRAY_INIT that features a CONSTRUCTOR node. This makes
13560    identification of initialized arrays easier to detect during walk
13561    and expansion.  */
13562
13563 static tree
13564 build_new_array_init (location, values)
13565      int location;
13566      tree values;
13567 {
13568   tree constructor = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, values);
13569   tree to_return = build1 (NEW_ARRAY_INIT, NULL_TREE, constructor);
13570   EXPR_WFL_LINECOL (to_return) = location;
13571   return to_return;
13572 }
13573
13574 /* Expand a NEW_ARRAY_INIT node. Return error_mark_node if an error
13575    occurred.  Otherwise return NODE after having set its type
13576    appropriately.  */
13577
13578 static tree
13579 patch_new_array_init (type, node)
13580      tree type, node;
13581 {
13582   int error_seen = 0;
13583   tree current, element_type;
13584   HOST_WIDE_INT length;
13585   int all_constant = 1;
13586   tree init = TREE_OPERAND (node, 0);
13587
13588   if (TREE_CODE (type) != POINTER_TYPE || ! TYPE_ARRAY_P (TREE_TYPE (type)))
13589     {
13590       parse_error_context (node,
13591                            "Invalid array initializer for non-array type `%s'",
13592                            lang_printable_name (type, 1));
13593       return error_mark_node;
13594     }
13595   type = TREE_TYPE (type);
13596   element_type = TYPE_ARRAY_ELEMENT (type);
13597
13598   CONSTRUCTOR_ELTS (init) = nreverse (CONSTRUCTOR_ELTS (init));
13599
13600   for (length = 0, current = CONSTRUCTOR_ELTS (init);
13601        current;  length++, current = TREE_CHAIN (current))
13602     {
13603       tree elt = TREE_VALUE (current);
13604       if (elt == NULL_TREE || TREE_CODE (elt) != NEW_ARRAY_INIT)
13605         {
13606           error_seen |= array_constructor_check_entry (element_type, current);
13607           elt = TREE_VALUE (current);
13608           /* When compiling to native code, STRING_CST is converted to
13609              INDIRECT_REF, but still with a TREE_CONSTANT flag. */
13610           if (! TREE_CONSTANT (elt) || TREE_CODE (elt) == INDIRECT_REF)
13611             all_constant = 0;
13612         }
13613       else
13614         {
13615           TREE_VALUE (current) = patch_new_array_init (element_type, elt);
13616           TREE_PURPOSE (current) = NULL_TREE;
13617           all_constant = 0;
13618         }
13619       if (elt && TREE_VALUE (elt) == error_mark_node)
13620         error_seen = 1;
13621     }
13622
13623   if (error_seen)
13624     return error_mark_node;
13625
13626   /* Create a new type. We can't reuse the one we have here by
13627      patching its dimension because it originally is of dimension -1
13628      hence reused by gcc. This would prevent triangular arrays. */
13629   type = build_java_array_type (element_type, length);
13630   TREE_TYPE (init) = TREE_TYPE (TREE_CHAIN (TREE_CHAIN (TYPE_FIELDS (type))));
13631   TREE_TYPE (node) = promote_type (type);
13632   TREE_CONSTANT (init) = all_constant;
13633   TREE_CONSTANT (node) = all_constant;
13634   return node;
13635 }
13636
13637 /* Verify that one entry of the initializer element list can be
13638    assigned to the array base type. Report 1 if an error occurred, 0
13639    otherwise.  */
13640
13641 static int
13642 array_constructor_check_entry (type, entry)
13643      tree type, entry;
13644 {
13645   char *array_type_string = NULL;       /* For error reports */
13646   tree value, type_value, new_value, wfl_value, patched;
13647   int error_seen = 0;
13648
13649   new_value = NULL_TREE;
13650   wfl_value = TREE_VALUE (entry);
13651
13652   push_obstacks (&permanent_obstack, &permanent_obstack);
13653   value = java_complete_tree (TREE_VALUE (entry));
13654   /* patch_string return error_mark_node if arg is error_mark_node */
13655   if ((patched = patch_string (value)))
13656     value = patched;
13657   if (value == error_mark_node)
13658     return 1;
13659   
13660   type_value = TREE_TYPE (value);
13661   
13662   /* At anytime, try_builtin_assignconv can report a warning on
13663      constant overflow during narrowing. */
13664   SET_WFL_OPERATOR (wfl_operator, TREE_PURPOSE (entry), wfl_value);
13665   new_value = try_builtin_assignconv (wfl_operator, type, value);
13666   if (!new_value && (new_value = try_reference_assignconv (type, value)))
13667     type_value = promote_type (type);
13668
13669   pop_obstacks ();
13670   /* Check and report errors */
13671   if (!new_value)
13672     {
13673       const char *msg = (!valid_cast_to_p (type_value, type) ?
13674                    "Can't" : "Explicit cast needed to");
13675       if (!array_type_string)
13676         array_type_string = xstrdup (lang_printable_name (type, 1));
13677       parse_error_context 
13678         (wfl_operator, "Incompatible type for array. %s convert `%s' to `%s'",
13679          msg, lang_printable_name (type_value, 1), array_type_string);
13680       error_seen = 1;
13681     }
13682   
13683   if (new_value)
13684     {
13685       new_value = maybe_build_primttype_type_ref (new_value, wfl_operator);
13686       TREE_VALUE (entry) = new_value;
13687     }
13688
13689   if (array_type_string)
13690     free (array_type_string);
13691
13692   TREE_PURPOSE (entry) = NULL_TREE;
13693   return error_seen;
13694 }
13695
13696 static tree
13697 build_this (location)
13698      int location;
13699 {
13700   tree node = build_wfl_node (this_identifier_node);
13701   TREE_SET_CODE (node, THIS_EXPR);
13702   EXPR_WFL_LINECOL (node) = location;
13703   return node;
13704 }
13705
13706 /* 14.15 The return statement. It builds a modify expression that
13707    assigns the returned value to the RESULT_DECL that hold the value
13708    to be returned. */
13709
13710 static tree
13711 build_return (location, op)
13712      int location;
13713      tree op;
13714 {
13715   tree node = build1 (RETURN_EXPR, NULL_TREE, op);
13716   EXPR_WFL_LINECOL (node) = location;
13717   node = build_debugable_stmt (location, node);
13718   return node;
13719 }
13720
13721 static tree
13722 patch_return (node)
13723      tree node;
13724 {
13725   tree return_exp = TREE_OPERAND (node, 0);
13726   tree meth = current_function_decl;
13727   tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
13728   int error_found = 0;
13729
13730   TREE_TYPE (node) = error_mark_node;
13731   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13732
13733   /* It's invalid to have a return value within a function that is
13734      declared with the keyword void or that is a constructor */
13735   if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
13736     error_found = 1;
13737
13738   /* It's invalid to use a return statement in a static block */
13739   if (IS_CLINIT (current_function_decl))
13740     error_found = 1;
13741
13742   /* It's invalid to have a no return value within a function that
13743      isn't declared with the keyword `void' */
13744   if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
13745     error_found = 2;
13746
13747   if (error_found)
13748     {
13749       if (IS_CLINIT (current_function_decl))
13750         parse_error_context (wfl_operator,
13751                              "`return' inside static initializer.");
13752
13753       else if (!DECL_CONSTRUCTOR_P (meth))
13754         {
13755           char *t = xstrdup (lang_printable_name (mtype, 0));
13756           parse_error_context (wfl_operator, 
13757                                "`return' with%s value from `%s %s'",
13758                                (error_found == 1 ? "" : "out"), 
13759                                t, lang_printable_name (meth, 0));
13760           free (t);
13761         }
13762       else
13763         parse_error_context (wfl_operator, 
13764                              "`return' with value from constructor `%s'",
13765                              lang_printable_name (meth, 0));
13766       return error_mark_node;
13767     }
13768
13769   /* If we have a return_exp, build a modify expression and expand
13770      it. Note: at that point, the assignment is declared valid, but we
13771      may want to carry some more hacks */
13772   if (return_exp)
13773     {
13774       tree exp = java_complete_tree (return_exp);
13775       tree modify, patched;
13776
13777       /* If the function returned value and EXP are booleans, EXP has
13778       to be converted into the type of DECL_RESULT, which is integer
13779       (see complete_start_java_method) */
13780       if (TREE_TYPE (exp) == boolean_type_node &&
13781           TREE_TYPE (TREE_TYPE (meth)) == boolean_type_node)
13782         exp = convert_to_integer (TREE_TYPE (DECL_RESULT (meth)), exp);
13783
13784       /* `null' can be assigned to a function returning a reference */
13785       if (JREFERENCE_TYPE_P (TREE_TYPE (TREE_TYPE (meth))) &&
13786           exp == null_pointer_node)
13787         exp = build_null_of_type (TREE_TYPE (TREE_TYPE (meth)));
13788
13789       if ((patched = patch_string (exp)))
13790         exp = patched;
13791       
13792       modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), exp);
13793       EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
13794       modify = java_complete_tree (modify);
13795
13796       if (modify != error_mark_node)
13797         {
13798           TREE_SIDE_EFFECTS (modify) = 1;
13799           TREE_OPERAND (node, 0) = modify;
13800         }
13801       else
13802         return error_mark_node;
13803     }
13804   TREE_TYPE (node) = void_type_node;
13805   TREE_SIDE_EFFECTS (node) = 1;
13806   return node;
13807 }
13808
13809 /* 14.8 The if Statement */
13810
13811 static tree
13812 build_if_else_statement (location, expression, if_body, else_body)
13813      int location;
13814      tree expression, if_body, else_body;
13815 {
13816   tree node;
13817   if (!else_body)
13818     else_body = empty_stmt_node;
13819   node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
13820   EXPR_WFL_LINECOL (node) = location;
13821   node = build_debugable_stmt (location, node);
13822   return node;
13823 }
13824
13825 static tree
13826 patch_if_else_statement (node)
13827      tree node;
13828 {
13829   tree expression = TREE_OPERAND (node, 0);
13830
13831   TREE_TYPE (node) = error_mark_node;
13832   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
13833
13834   /* The type of expression must be boolean */
13835   if (TREE_TYPE (expression) != boolean_type_node
13836       && TREE_TYPE (expression) != promoted_boolean_type_node)
13837     {
13838       parse_error_context 
13839         (wfl_operator, 
13840          "Incompatible type for `if'. Can't convert `%s' to `boolean'", 
13841          lang_printable_name (TREE_TYPE (expression), 0));
13842       return error_mark_node;
13843     }
13844   
13845   TREE_TYPE (node) = void_type_node;
13846   TREE_SIDE_EFFECTS (node) = 1;
13847   CAN_COMPLETE_NORMALLY (node)
13848     = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1))
13849     | CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 2));
13850   return node;
13851 }
13852
13853 /* 14.6 Labeled Statements */
13854
13855 /* Action taken when a lableled statement is parsed. a new
13856    LABELED_BLOCK_EXPR is created. No statement is attached to the
13857    label, yet.  LABEL can be NULL_TREE for artificially-generated blocks. */
13858
13859 static tree
13860 build_labeled_block (location, label)
13861      int location;
13862      tree label;
13863 {
13864   tree label_name ;
13865   tree label_decl, node;
13866   if (label == NULL_TREE || label == continue_identifier_node)
13867     label_name = label;
13868   else
13869     {
13870       label_name = merge_qualified_name (label_id, label);
13871       /* Issue an error if we try to reuse a label that was previously
13872          declared */
13873       if (IDENTIFIER_LOCAL_VALUE (label_name))
13874         {
13875           EXPR_WFL_LINECOL (wfl_operator) = location;
13876           parse_error_context (wfl_operator,
13877             "Declaration of `%s' shadows a previous label declaration",
13878                                IDENTIFIER_POINTER (label));
13879           EXPR_WFL_LINECOL (wfl_operator) = 
13880             EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
13881           parse_error_context (wfl_operator,
13882             "This is the location of the previous declaration of label `%s'",
13883                                IDENTIFIER_POINTER (label));
13884           java_error_count--;
13885         }
13886     }
13887
13888   label_decl = create_label_decl (label_name);
13889   node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
13890   EXPR_WFL_LINECOL (node) = location;
13891   TREE_SIDE_EFFECTS (node) = 1;
13892   return node;
13893 }
13894
13895 /* A labeled statement LBE is attached a statement.  */
13896
13897 static tree
13898 finish_labeled_statement (lbe, statement)
13899      tree lbe;                  /* Labeled block expr */
13900      tree statement;
13901 {
13902   /* In anyways, tie the loop to its statement */
13903   LABELED_BLOCK_BODY (lbe) = statement;
13904   pop_labeled_block ();
13905   POP_LABELED_BLOCK ();
13906   return lbe;
13907 }
13908
13909 /* 14.10, 14.11, 14.12 Loop Statements */
13910
13911 /* Create an empty LOOP_EXPR and make it the last in the nested loop
13912    list. */
13913
13914 static tree
13915 build_new_loop (loop_body)
13916      tree loop_body;
13917 {
13918   tree loop =  build (LOOP_EXPR, NULL_TREE, loop_body);
13919   TREE_SIDE_EFFECTS (loop) = 1;
13920   PUSH_LOOP (loop);
13921   return loop;
13922 }
13923
13924 /* Create a loop body according to the following structure:
13925      COMPOUND_EXPR
13926        COMPOUND_EXPR            (loop main body)
13927          EXIT_EXPR              (this order is for while/for loops.
13928          LABELED_BLOCK_EXPR      the order is reversed for do loops)
13929            LABEL_DECL           (a continue occuring here branches at the 
13930            BODY                  end of this labeled block)
13931        INCREMENT                (if any)
13932
13933   REVERSED, if non zero, tells that the loop condition expr comes
13934   after the body, like in the do-while loop.
13935
13936   To obtain a loop, the loop body structure described above is
13937   encapsulated within a LOOP_EXPR surrounded by a LABELED_BLOCK_EXPR:
13938
13939    LABELED_BLOCK_EXPR
13940      LABEL_DECL                   (use this label to exit the loop)
13941      LOOP_EXPR
13942        <structure described above> */
13943
13944 static tree
13945 build_loop_body (location, condition, reversed)
13946      int location;
13947      tree condition;
13948      int reversed;
13949 {
13950   tree first, second, body;
13951
13952   condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
13953   EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
13954   condition = build_debugable_stmt (location, condition);
13955   TREE_SIDE_EFFECTS (condition) = 1;
13956
13957   body = build_labeled_block (0, continue_identifier_node);
13958   first = (reversed ? body : condition);
13959   second = (reversed ? condition : body);
13960   return 
13961     build (COMPOUND_EXPR, NULL_TREE, 
13962            build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
13963 }
13964
13965 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
13966    their order) on the current loop. Unlink the current loop from the
13967    loop list.  */
13968
13969 static tree
13970 finish_loop_body (location, condition, body, reversed)
13971      int location;
13972      tree condition, body;
13973      int reversed;
13974 {
13975   tree to_return = ctxp->current_loop;
13976   tree loop_body = LOOP_EXPR_BODY (to_return);
13977   if (condition)
13978     {
13979       tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
13980       /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
13981          The real EXIT_EXPR is one operand further. */
13982       EXPR_WFL_LINECOL (cnode) = location;
13983       /* This one is for accurate error reports */
13984       EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
13985       TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
13986     }
13987   LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
13988   POP_LOOP ();
13989   return to_return;
13990 }
13991
13992 /* Tailored version of finish_loop_body for FOR loops, when FOR
13993    loops feature the condition part */
13994
13995 static tree
13996 finish_for_loop (location, condition, update, body)
13997     int location;
13998     tree condition, update, body;
13999 {
14000   /* Put the condition and the loop body in place */
14001   tree loop = finish_loop_body (location, condition, body, 0);
14002   /* LOOP is the current loop which has been now popped of the loop
14003      stack. Install the update block */
14004   LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
14005   return loop;
14006 }
14007
14008 /* Try to find the loop a block might be related to. This comprises
14009    the case where the LOOP_EXPR is found as the second operand of a
14010    COMPOUND_EXPR, because the loop happens to have an initialization
14011    part, then expressed as the first operand of the COMPOUND_EXPR. If
14012    the search finds something, 1 is returned. Otherwise, 0 is
14013    returned. The search is assumed to start from a
14014    LABELED_BLOCK_EXPR's block.  */
14015
14016 static tree
14017 search_loop (statement)
14018     tree statement;
14019 {
14020   if (TREE_CODE (statement) == LOOP_EXPR)
14021     return statement;
14022
14023   if (TREE_CODE (statement) == BLOCK)
14024     statement = BLOCK_SUBBLOCKS (statement);
14025   else
14026     return NULL_TREE;
14027
14028   if (statement && TREE_CODE (statement) == COMPOUND_EXPR)
14029     while (statement && TREE_CODE (statement) == COMPOUND_EXPR)
14030       statement = TREE_OPERAND (statement, 1);
14031
14032   return (TREE_CODE (statement) == LOOP_EXPR
14033           && IS_FOR_LOOP_P (statement) ? statement : NULL_TREE);
14034 }
14035
14036 /* Return 1 if LOOP can be found in the labeled block BLOCK. 0 is
14037    returned otherwise.  */
14038
14039 static int
14040 labeled_block_contains_loop_p (block, loop)
14041     tree block, loop;
14042 {
14043   if (!block)
14044     return 0;
14045
14046   if (LABELED_BLOCK_BODY (block) == loop)
14047     return 1;
14048
14049   if (IS_FOR_LOOP_P (loop) 
14050       && search_loop (LABELED_BLOCK_BODY (block)) == loop)
14051     return 1;
14052
14053   return 0;
14054 }
14055
14056 /* If the loop isn't surrounded by a labeled statement, create one and
14057    insert LOOP as its body.  */
14058
14059 static tree
14060 patch_loop_statement (loop)
14061      tree loop;
14062 {
14063   tree loop_label;
14064
14065   TREE_TYPE (loop) = void_type_node;
14066   if (labeled_block_contains_loop_p (ctxp->current_labeled_block, loop))
14067     return loop;
14068
14069   loop_label = build_labeled_block (0, NULL_TREE);
14070   /* LOOP is an EXPR node, so it should have a valid EXPR_WFL_LINECOL
14071      that LOOP_LABEL could enquire about, for a better accuracy. FIXME */
14072   LABELED_BLOCK_BODY (loop_label) = loop;
14073   PUSH_LABELED_BLOCK (loop_label);
14074   return loop_label;
14075 }
14076
14077 /* 14.13, 14.14: break and continue Statements */
14078
14079 /* Build a break or a continue statement. a null NAME indicates an
14080    unlabeled break/continue statement.  */
14081
14082 static tree
14083 build_bc_statement (location, is_break, name)
14084      int location, is_break;
14085      tree name;
14086 {
14087   tree break_continue, label_block_expr = NULL_TREE;
14088
14089   if (name)
14090     {
14091       if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE 
14092             (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
14093         /* Null means that we don't have a target for this named
14094            break/continue. In this case, we make the target to be the
14095            label name, so that the error can be reported accuratly in
14096            patch_bc_statement. */
14097         label_block_expr = EXPR_WFL_NODE (name);
14098     }
14099   /* Unlabeled break/continue will be handled during the
14100      break/continue patch operation */
14101   break_continue 
14102     = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
14103
14104   IS_BREAK_STMT_P (break_continue) = is_break;
14105   TREE_SIDE_EFFECTS (break_continue) = 1;
14106   EXPR_WFL_LINECOL (break_continue) = location;
14107   break_continue = build_debugable_stmt (location, break_continue);
14108   return break_continue;
14109 }
14110
14111 /* Verification of a break/continue statement. */
14112
14113 static tree
14114 patch_bc_statement (node)
14115      tree node;
14116 {
14117   tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
14118   tree labeled_block = ctxp->current_labeled_block;
14119   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
14120  
14121   /* Having an identifier here means that the target is unknown. */
14122   if (bc_label != NULL_TREE && TREE_CODE (bc_label) == IDENTIFIER_NODE)
14123     {
14124       parse_error_context (wfl_operator, "No label definition found for `%s'",
14125                            IDENTIFIER_POINTER (bc_label));
14126       return error_mark_node;
14127     }
14128   if (! IS_BREAK_STMT_P (node))
14129     {
14130       /* It's a continue statement. */
14131       for (;; labeled_block = TREE_CHAIN (labeled_block))
14132         {
14133           if (labeled_block == NULL_TREE)
14134             {
14135               if (bc_label == NULL_TREE)
14136                 parse_error_context (wfl_operator,
14137                                      "`continue' must be in loop");
14138               else
14139                 parse_error_context 
14140                   (wfl_operator, "continue label `%s' does not name a loop",
14141                    IDENTIFIER_POINTER (bc_label));
14142               return error_mark_node;
14143             }
14144           if ((DECL_NAME (LABELED_BLOCK_LABEL (labeled_block))
14145                == continue_identifier_node)
14146               && (bc_label == NULL_TREE
14147                   || TREE_CHAIN (labeled_block) == bc_label))
14148             {
14149               bc_label = labeled_block;
14150               break;
14151             }
14152         }
14153     }
14154   else if (!bc_label)
14155     { 
14156       for (;; labeled_block = TREE_CHAIN (labeled_block))
14157         {
14158           if (labeled_block == NULL_TREE)
14159             {
14160               parse_error_context (wfl_operator,
14161                                      "`break' must be in loop or switch");
14162               return error_mark_node;
14163             }
14164           target_stmt = LABELED_BLOCK_BODY (labeled_block);
14165           if (TREE_CODE (target_stmt) == SWITCH_EXPR
14166               || search_loop (target_stmt))
14167             {
14168               bc_label = labeled_block;
14169               break;
14170             }
14171         }
14172     }
14173
14174   EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
14175   CAN_COMPLETE_NORMALLY (bc_label) = 1;
14176
14177   /* Our break/continue don't return values. */
14178   TREE_TYPE (node) = void_type_node;
14179   /* Encapsulate the break within a compound statement so that it's
14180      expanded all the times by expand_expr (and not clobbered
14181      sometimes, like after a if statement) */
14182   node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
14183   TREE_SIDE_EFFECTS (node) = 1;
14184   return node;
14185 }
14186
14187 /* Process the exit expression belonging to a loop. Its type must be
14188    boolean.  */
14189
14190 static tree
14191 patch_exit_expr (node)
14192      tree node;
14193 {
14194   tree expression = TREE_OPERAND (node, 0);
14195   TREE_TYPE (node) = error_mark_node;
14196   EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
14197
14198   /* The type of expression must be boolean */
14199   if (TREE_TYPE (expression) != boolean_type_node)
14200     {
14201       parse_error_context 
14202         (wfl_operator, 
14203     "Incompatible type for loop conditional. Can't convert `%s' to `boolean'", 
14204          lang_printable_name (TREE_TYPE (expression), 0));
14205       return error_mark_node;
14206     }
14207   /* Now we know things are allright, invert the condition, fold and
14208      return */
14209   TREE_OPERAND (node, 0) = 
14210     fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
14211
14212   if (! integer_zerop (TREE_OPERAND (node, 0))
14213       && ctxp->current_loop != NULL_TREE
14214       && TREE_CODE (ctxp->current_loop) == LOOP_EXPR)
14215     CAN_COMPLETE_NORMALLY (ctxp->current_loop) = 1;
14216   if (! integer_onep (TREE_OPERAND (node, 0)))
14217     CAN_COMPLETE_NORMALLY (node) = 1;
14218
14219
14220   TREE_TYPE (node) = void_type_node;
14221   return node;
14222 }
14223
14224 /* 14.9 Switch statement */
14225
14226 static tree
14227 patch_switch_statement (node)
14228      tree node;
14229 {
14230   tree se = TREE_OPERAND (node, 0), se_type;
14231
14232   /* Complete the switch expression */
14233   se = TREE_OPERAND (node, 0) = java_complete_tree (se);
14234   se_type = TREE_TYPE (se);
14235   /* The type of the switch expression must be char, byte, short or
14236      int */
14237   if (!JINTEGRAL_TYPE_P (se_type))
14238     {
14239       EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
14240       parse_error_context (wfl_operator,
14241           "Incompatible type for `switch'. Can't convert `%s' to `int'",
14242                            lang_printable_name (se_type, 0));
14243       /* This is what java_complete_tree will check */
14244       TREE_OPERAND (node, 0) = error_mark_node;
14245       return error_mark_node;
14246     }
14247
14248   TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
14249
14250   /* Ready to return */
14251   if (TREE_CODE (TREE_OPERAND (node, 1)) == ERROR_MARK)
14252     {
14253       TREE_TYPE (node) = error_mark_node;
14254       return error_mark_node;
14255     }
14256   TREE_TYPE (node) = void_type_node;
14257   TREE_SIDE_EFFECTS (node) = 1;
14258   CAN_COMPLETE_NORMALLY (node)
14259     = CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 1)) 
14260       || ! SWITCH_HAS_DEFAULT (node);
14261   return node;
14262 }
14263
14264 /* 14.18 The try statement */
14265
14266 static tree
14267 build_try_statement (location, try_block, catches)
14268      int location;
14269      tree try_block, catches;
14270 {
14271   tree node = build (TRY_EXPR, NULL_TREE, try_block, catches);
14272   EXPR_WFL_LINECOL (node) = location;
14273   return node;
14274 }
14275
14276 static tree
14277 build_try_finally_statement (location, try_block, finally)
14278      int location;
14279      tree try_block, finally;
14280 {
14281   tree node = build (TRY_FINALLY_EXPR, NULL_TREE, try_block, finally);
14282   EXPR_WFL_LINECOL (node) = location;
14283   return node;
14284 }
14285
14286 static tree
14287 patch_try_statement (node)
14288      tree node;
14289 {
14290   int error_found = 0;
14291   tree try = TREE_OPERAND (node, 0);
14292   /* Exception handlers are considered in left to right order */
14293   tree catch = nreverse (TREE_OPERAND (node, 1));
14294   tree current, caught_type_list = NULL_TREE;
14295
14296   /* Check catch clauses, if any. Every time we find an error, we try
14297      to process the next catch clause. We process the catch clause before
14298      the try block so that when processing the try block we can check thrown
14299      exceptions againts the caught type list. */
14300   for (current = catch; current; current = TREE_CHAIN (current))
14301     {
14302       tree carg_decl, carg_type;
14303       tree sub_current, catch_block, catch_clause;
14304       int unreachable;
14305
14306       /* At this point, the structure of the catch clause is
14307            CATCH_EXPR           (catch node)
14308              BLOCK              (with the decl of the parameter)
14309                COMPOUND_EXPR
14310                  MODIFY_EXPR   (assignment of the catch parameter)
14311                  BLOCK          (catch clause block)
14312        */
14313       catch_clause = TREE_OPERAND (current, 0);
14314       carg_decl = BLOCK_EXPR_DECLS (catch_clause);
14315       carg_type = TREE_TYPE (TREE_TYPE (carg_decl));
14316
14317       /* Catch clauses can't have more than one parameter declared,
14318          but it's already enforced by the grammar. Make sure that the
14319          only parameter of the clause statement in of class Throwable
14320          or a subclass of Throwable, but that was done earlier. The
14321          catch clause parameter type has also been resolved. */
14322       
14323       /* Just make sure that the catch clause parameter type inherits
14324          from java.lang.Throwable */
14325       if (!inherits_from_p (carg_type, throwable_type_node))
14326         {
14327           EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
14328           parse_error_context (wfl_operator,
14329                                "Can't catch class `%s'. Catch clause parameter type must be a subclass of class `java.lang.Throwable'",
14330                                lang_printable_name (carg_type, 0));
14331           error_found = 1;
14332           continue;
14333         }
14334       
14335       /* Partial check for unreachable catch statement: The catch
14336          clause is reachable iff is no earlier catch block A in
14337          the try statement such that the type of the catch
14338          clause's parameter is the same as or a subclass of the
14339          type of A's parameter */
14340       unreachable = 0;
14341       for (sub_current = catch;
14342            sub_current != current; sub_current = TREE_CHAIN (sub_current))
14343         {
14344           tree sub_catch_clause, decl;
14345           sub_catch_clause = TREE_OPERAND (sub_current, 0);
14346           decl = BLOCK_EXPR_DECLS (sub_catch_clause);
14347
14348           if (inherits_from_p (carg_type, TREE_TYPE (TREE_TYPE (decl))))
14349             {
14350               EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (current);
14351               parse_error_context 
14352                 (wfl_operator,
14353                  "`catch' not reached because of the catch clause at line %d",
14354                  EXPR_WFL_LINENO (sub_current));
14355               unreachable = error_found = 1;
14356               break;
14357             }
14358         }
14359       /* Complete the catch clause block */
14360       catch_block = java_complete_tree (TREE_OPERAND (current, 0));
14361       if (catch_block == error_mark_node)
14362         {
14363           error_found = 1;
14364           continue;
14365         }
14366       if (CAN_COMPLETE_NORMALLY (catch_block))
14367         CAN_COMPLETE_NORMALLY (node) = 1;
14368       TREE_OPERAND (current, 0) = catch_block;
14369
14370       if (unreachable)
14371         continue;
14372
14373       /* Things to do here: the exception must be thrown */
14374
14375       /* Link this type to the caught type list */
14376       caught_type_list = tree_cons (NULL_TREE, carg_type, caught_type_list);
14377     }
14378
14379   PUSH_EXCEPTIONS (caught_type_list);
14380   if ((try = java_complete_tree (try)) == error_mark_node)
14381     error_found = 1;
14382   if (CAN_COMPLETE_NORMALLY (try))
14383     CAN_COMPLETE_NORMALLY (node) = 1;
14384   POP_EXCEPTIONS ();
14385
14386   /* Verification ends here */
14387   if (error_found) 
14388     return error_mark_node;
14389
14390   TREE_OPERAND (node, 0) = try;
14391   TREE_OPERAND (node, 1) = catch;
14392   TREE_TYPE (node) = void_type_node;
14393   return node;
14394 }
14395
14396 /* 14.17 The synchronized Statement */
14397
14398 static tree
14399 patch_synchronized_statement (node, wfl_op1)
14400     tree node, wfl_op1;
14401 {
14402   tree expr = java_complete_tree (TREE_OPERAND (node, 0));
14403   tree block = TREE_OPERAND (node, 1);
14404
14405   tree enter, exit, expr_decl, assignment;
14406
14407   if (expr == error_mark_node)
14408     {
14409       block = java_complete_tree (block);
14410       return expr;
14411     }
14412
14413   /* The TYPE of expr must be a reference type */
14414   if (!JREFERENCE_TYPE_P (TREE_TYPE (expr)))
14415     {
14416       SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14417       parse_error_context (wfl_operator, "Incompatible type for `synchronized'. Can't convert `%s' to `java.lang.Object'",
14418                            lang_printable_name (TREE_TYPE (expr), 0));
14419       return error_mark_node;
14420     }
14421
14422   if (flag_emit_xref)
14423     {
14424       TREE_OPERAND (node, 0) = expr;
14425       TREE_OPERAND (node, 1) = java_complete_tree (block);
14426       CAN_COMPLETE_NORMALLY (node) = 1;
14427       return node;
14428     }
14429
14430   /* Generate a try-finally for the synchronized statement, except
14431      that the handler that catches all throw exception calls
14432      _Jv_MonitorExit and then rethrow the exception.
14433      The synchronized statement is then implemented as:
14434      TRY 
14435        {
14436          _Jv_MonitorEnter (expression)
14437          synchronized_block
14438          _Jv_MonitorExit (expression)
14439        }
14440      CATCH_ALL
14441        {
14442          e = _Jv_exception_info ();
14443          _Jv_MonitorExit (expression)
14444          Throw (e);
14445        } */
14446
14447   expr_decl = build_decl (VAR_DECL, generate_name (), TREE_TYPE (expr));
14448   BUILD_MONITOR_ENTER (enter, expr_decl);
14449   BUILD_MONITOR_EXIT (exit, expr_decl);
14450   CAN_COMPLETE_NORMALLY (enter) = 1;
14451   CAN_COMPLETE_NORMALLY (exit) = 1;
14452   assignment = build (MODIFY_EXPR, NULL_TREE, expr_decl, expr);
14453   TREE_SIDE_EFFECTS (assignment) = 1;
14454   node = build1 (CLEANUP_POINT_EXPR, NULL_TREE,
14455                  build (COMPOUND_EXPR, NULL_TREE,
14456                         build (WITH_CLEANUP_EXPR, NULL_TREE,
14457                                build (COMPOUND_EXPR, NULL_TREE,
14458                                       assignment, enter),
14459                                NULL_TREE, exit),
14460                         block));
14461   node = build_expr_block (node, expr_decl);
14462
14463   return java_complete_tree (node);
14464 }
14465
14466 /* 14.16 The throw Statement */
14467
14468 static tree
14469 patch_throw_statement (node, wfl_op1)
14470     tree node, wfl_op1;
14471 {
14472   tree expr = TREE_OPERAND (node, 0);
14473   tree type = TREE_TYPE (expr);
14474   int unchecked_ok = 0, tryblock_throws_ok = 0;
14475
14476   /* Thrown expression must be assignable to java.lang.Throwable */
14477   if (!try_reference_assignconv (throwable_type_node, expr))
14478     {
14479       SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14480       parse_error_context (wfl_operator,
14481     "Can't throw `%s'; it must be a subclass of class `java.lang.Throwable'",
14482                            lang_printable_name (type, 0));
14483       /* If the thrown expression was a reference, we further the
14484          compile-time check. */
14485       if (!JREFERENCE_TYPE_P (type))
14486         return error_mark_node;
14487     }
14488
14489   /* At least one of the following must be true */
14490
14491   /* The type of the throw expression is a not checked exception,
14492      i.e. is a unchecked expression. */
14493   unchecked_ok = IS_UNCHECKED_EXCEPTION_P (TREE_TYPE (type));
14494
14495   /* Throw is contained in a try statement and at least one catch
14496      clause can receive the thrown expression or the current method is
14497      declared to throw such an exception. Or, the throw statement is
14498      contained in a method or constructor declaration and the type of
14499      the Expression is assignable to at least one type listed in the
14500      throws clause the declaration. */
14501   SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14502   if (!unchecked_ok)
14503     tryblock_throws_ok = check_thrown_exceptions_do (TREE_TYPE (expr));
14504   if (!(unchecked_ok || tryblock_throws_ok))
14505     {
14506       /* If there is a surrounding try block that has no matching
14507          clatch clause, report it first. A surrounding try block exits
14508          only if there is something after the list of checked
14509          exception thrown by the current function (if any). */
14510       if (IN_TRY_BLOCK_P ())
14511         parse_error_context (wfl_operator, "Checked exception `%s' can't be caught by any of the catch clause(s) of the surrounding `try' block",
14512                              lang_printable_name (type, 0));
14513       /* If we have no surrounding try statement and the method doesn't have
14514          any throws, report it now. FIXME */
14515
14516       /* We report that the exception can't be throw from a try block
14517          in all circumstances but when the `throw' is inside a static
14518          block. */
14519       else if (!EXCEPTIONS_P (currently_caught_type_list) 
14520                && !tryblock_throws_ok)
14521         {
14522           if (IS_CLINIT (current_function_decl))
14523             parse_error_context (wfl_operator,
14524                    "Checked exception `%s' can't be thrown in initializer",
14525                                  lang_printable_name (type, 0));
14526           else
14527             parse_error_context (wfl_operator,
14528                    "Checked exception `%s' isn't thrown from a `try' block", 
14529                                  lang_printable_name (type, 0));
14530         }
14531       /* Otherwise, the current method doesn't have the appropriate
14532          throws declaration */
14533       else
14534         parse_error_context (wfl_operator, "Checked exception `%s' doesn't match any of current method's `throws' declaration(s)", 
14535                              lang_printable_name (type, 0));
14536       return error_mark_node;
14537     }
14538
14539   if (! flag_emit_class_files && ! flag_emit_xref)
14540     BUILD_THROW (node, expr);
14541
14542   /* If doing xrefs, keep the location where the `throw' was seen. */
14543   if (flag_emit_xref)
14544     EXPR_WFL_LINECOL (node) = EXPR_WFL_LINECOL (wfl_op1);
14545   return node;
14546 }
14547
14548 /* Check that exception said to be thrown by method DECL can be
14549    effectively caught from where DECL is invoked.  */
14550
14551 static void
14552 check_thrown_exceptions (location, decl)
14553      int location;
14554      tree decl;
14555 {
14556   tree throws;
14557   /* For all the unchecked exceptions thrown by DECL */
14558   for (throws = DECL_FUNCTION_THROWS (decl); throws; 
14559        throws = TREE_CHAIN (throws)) 
14560     if (!check_thrown_exceptions_do (TREE_VALUE (throws)))
14561       {
14562 #if 1
14563         /* Temporary hack to suppresses errors about cloning arrays. FIXME */
14564         if (DECL_NAME (decl) == get_identifier ("clone"))
14565           continue;
14566 #endif
14567         EXPR_WFL_LINECOL (wfl_operator) = location;
14568         if (DECL_NAME (current_function_decl) == finit_identifier_node)
14569           parse_error_context
14570             (wfl_operator, "Exception `%s' can't be thrown in initializer",
14571              lang_printable_name (TREE_VALUE (throws), 0));
14572         else 
14573           {
14574             parse_error_context 
14575               (wfl_operator, "Exception `%s' must be caught, or it must be declared in the `throws' clause of `%s'", 
14576                lang_printable_name (TREE_VALUE (throws), 0),
14577                (DECL_NAME (current_function_decl) == init_identifier_node ?
14578                 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))) :
14579                 IDENTIFIER_POINTER (DECL_NAME (current_function_decl))));
14580           }
14581       }
14582 }
14583
14584 /* Return 1 if checked EXCEPTION is caught at the current nesting level of
14585    try-catch blocks, OR is listed in the `throws' clause of the
14586    current method.  */
14587
14588 static int
14589 check_thrown_exceptions_do (exception)
14590      tree exception;
14591 {
14592   tree list = currently_caught_type_list;
14593   resolve_and_layout (exception, NULL_TREE);
14594   /* First, all the nested try-catch-finally at that stage. The
14595      last element contains `throws' clause exceptions, if any. */
14596   if (IS_UNCHECKED_EXCEPTION_P (exception))
14597     return 1;
14598   while (list)
14599     {
14600       tree caught;
14601       for (caught = TREE_VALUE (list); caught; caught = TREE_CHAIN (caught))
14602         if (valid_ref_assignconv_cast_p (exception, TREE_VALUE (caught), 0))
14603           return 1;
14604       list = TREE_CHAIN (list);
14605     }
14606   return 0;
14607 }
14608
14609 static void
14610 purge_unchecked_exceptions (mdecl)
14611      tree mdecl;
14612 {
14613   tree throws = DECL_FUNCTION_THROWS (mdecl);
14614   tree new = NULL_TREE;
14615
14616   while (throws)
14617     {
14618       tree next = TREE_CHAIN (throws);
14619       if (!IS_UNCHECKED_EXCEPTION_P (TREE_VALUE (throws)))
14620         {
14621           TREE_CHAIN (throws) = new;
14622           new = throws;
14623         }
14624       throws = next;
14625     }
14626   /* List is inverted here, but it doesn't matter */
14627   DECL_FUNCTION_THROWS (mdecl) = new;
14628 }
14629
14630 /* 15.24 Conditional Operator ?: */
14631
14632 static tree
14633 patch_conditional_expr (node, wfl_cond, wfl_op1)
14634      tree node, wfl_cond, wfl_op1;
14635 {
14636   tree cond = TREE_OPERAND (node, 0);
14637   tree op1 = TREE_OPERAND (node, 1);
14638   tree op2 = TREE_OPERAND (node, 2);
14639   tree resulting_type = NULL_TREE;
14640   tree t1, t2, patched;
14641   int error_found = 0;
14642
14643   /* Operands of ?: might be StringBuffers crafted as a result of a
14644      string concatenation. Obtain a descent operand here.  */
14645   if ((patched = patch_string (op1)))
14646     TREE_OPERAND (node, 1) = op1 = patched;
14647   if ((patched = patch_string (op2)))
14648     TREE_OPERAND (node, 2) = op2 = patched;
14649
14650   t1 = TREE_TYPE (op1);
14651   t2 = TREE_TYPE (op2);
14652
14653   /* The first expression must be a boolean */
14654   if (TREE_TYPE (cond) != boolean_type_node)
14655     {
14656       SET_WFL_OPERATOR (wfl_operator, node, wfl_cond);
14657       parse_error_context (wfl_operator,
14658                "Incompatible type for `?:'. Can't convert `%s' to `boolean'",
14659                            lang_printable_name (TREE_TYPE (cond), 0));
14660       error_found = 1;
14661     }
14662
14663   /* Second and third can be numeric, boolean (i.e. primitive),
14664      references or null. Anything else results in an error */
14665   if (!((JNUMERIC_TYPE_P (t1) && JNUMERIC_TYPE_P (t2))
14666         || ((JREFERENCE_TYPE_P (t1) || op1 == null_pointer_node) 
14667             && (JREFERENCE_TYPE_P (t2) || op2 == null_pointer_node))
14668         || (t1 == boolean_type_node && t2 == boolean_type_node)))
14669     error_found = 1;
14670
14671   /* Determine the type of the conditional expression. Same types are
14672      easy to deal with */
14673   else if (t1 == t2)
14674     resulting_type = t1;
14675
14676   /* There are different rules for numeric types */
14677   else if (JNUMERIC_TYPE_P (t1))
14678     {
14679       /* if byte/short found, the resulting type is short */
14680       if ((t1 == byte_type_node && t2 == short_type_node)
14681           || (t1 == short_type_node && t2 == byte_type_node))
14682         resulting_type = short_type_node;
14683
14684       /* If t1 is a constant int and t2 is of type byte, short or char
14685          and t1's value fits in t2, then the resulting type is t2 */
14686       else if ((t1 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 1)))
14687           && JBSC_TYPE_P (t2) && int_fits_type_p (TREE_OPERAND (node, 1), t2))
14688         resulting_type = t2;
14689
14690       /* If t2 is a constant int and t1 is of type byte, short or char
14691          and t2's value fits in t1, then the resulting type is t1 */
14692       else if ((t2 == int_type_node && TREE_CONSTANT (TREE_OPERAND (node, 2)))
14693           && JBSC_TYPE_P (t1) && int_fits_type_p (TREE_OPERAND (node, 2), t1))
14694         resulting_type = t1;
14695
14696       /* Otherwise, binary numeric promotion is applied and the
14697          resulting type is the promoted type of operand 1 and 2 */
14698       else 
14699         resulting_type = binary_numeric_promotion (t1, t2, 
14700                                                    &TREE_OPERAND (node, 1), 
14701                                                    &TREE_OPERAND (node, 2));
14702     }
14703
14704   /* Cases of a reference and a null type */
14705   else if (JREFERENCE_TYPE_P (t1) && op2 == null_pointer_node)
14706     resulting_type = t1;
14707
14708   else if (JREFERENCE_TYPE_P (t2) && op1 == null_pointer_node)
14709     resulting_type = t2;
14710
14711   /* Last case: different reference types. If a type can be converted
14712      into the other one by assignment conversion, the latter
14713      determines the type of the expression */
14714   else if ((resulting_type = try_reference_assignconv (t1, op2)))
14715     resulting_type = promote_type (t1);
14716
14717   else if ((resulting_type = try_reference_assignconv (t2, op1)))
14718     resulting_type = promote_type (t2);
14719
14720   /* If we don't have any resulting type, we're in trouble */
14721   if (!resulting_type)
14722     {
14723       char *t = xstrdup (lang_printable_name (t1, 0));
14724       SET_WFL_OPERATOR (wfl_operator, node, wfl_op1);
14725       parse_error_context (wfl_operator,
14726                  "Incompatible type for `?:'. Can't convert `%s' to `%s'",
14727                            t, lang_printable_name (t2, 0));
14728       free (t);
14729       error_found = 1;
14730     }
14731
14732   if (error_found)
14733     {
14734       TREE_TYPE (node) = error_mark_node;
14735       return error_mark_node;
14736     }
14737
14738   TREE_TYPE (node) = resulting_type;
14739   TREE_SET_CODE (node, COND_EXPR);
14740   CAN_COMPLETE_NORMALLY (node) = 1;
14741   return node;
14742 }
14743
14744 /* Try to constant fold NODE.
14745    If NODE is not a constant expression, return NULL_EXPR.
14746    CONTEXT is a static final VAR_DECL whose initializer we are folding. */
14747
14748 static tree
14749 fold_constant_for_init (node, context)
14750      tree node;
14751      tree context;
14752 {
14753   tree op0, op1, val;
14754   enum tree_code code = TREE_CODE (node);
14755
14756   if (code == STRING_CST)
14757     return node;
14758
14759   if (code == INTEGER_CST || code == REAL_CST)
14760     return convert (TREE_TYPE (context), node);
14761   if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
14762     return NULL_TREE;
14763
14764   switch (code)
14765     {
14766     case PLUS_EXPR:
14767     case MINUS_EXPR:
14768     case MULT_EXPR:
14769     case TRUNC_MOD_EXPR:
14770     case RDIV_EXPR:
14771     case LSHIFT_EXPR:
14772     case RSHIFT_EXPR:
14773     case URSHIFT_EXPR:
14774     case BIT_AND_EXPR:
14775     case BIT_XOR_EXPR:
14776     case BIT_IOR_EXPR:
14777     case TRUTH_ANDIF_EXPR:
14778     case TRUTH_ORIF_EXPR:
14779     case EQ_EXPR: 
14780     case NE_EXPR:
14781     case GT_EXPR:
14782     case GE_EXPR:
14783     case LT_EXPR:
14784     case LE_EXPR:
14785       op0 = TREE_OPERAND (node, 0);
14786       op1 = TREE_OPERAND (node, 1);
14787       val = fold_constant_for_init (op0, context);
14788       if (val == NULL_TREE || ! TREE_CONSTANT (val))
14789         return NULL_TREE;
14790       TREE_OPERAND (node, 0) = val;
14791       val = fold_constant_for_init (op1, context);
14792       if (val == NULL_TREE || ! TREE_CONSTANT (val))
14793         return NULL_TREE;
14794       TREE_OPERAND (node, 1) = val;
14795       return patch_binop (node, op0, op1);
14796
14797     case UNARY_PLUS_EXPR:
14798     case NEGATE_EXPR:
14799     case TRUTH_NOT_EXPR:
14800     case BIT_NOT_EXPR:
14801     case CONVERT_EXPR:
14802       op0 = TREE_OPERAND (node, 0);
14803       val = fold_constant_for_init (op0, context);
14804       if (val == NULL_TREE || ! TREE_CONSTANT (val))
14805         return NULL_TREE;
14806       TREE_OPERAND (node, 0) = val;
14807       return patch_unaryop (node, op0);
14808       break;
14809
14810     case COND_EXPR:
14811       val = fold_constant_for_init (TREE_OPERAND (node, 0), context);
14812       if (val == NULL_TREE || ! TREE_CONSTANT (val))
14813         return NULL_TREE;
14814       TREE_OPERAND (node, 0) = val;
14815       val = fold_constant_for_init (TREE_OPERAND (node, 1), context);
14816       if (val == NULL_TREE || ! TREE_CONSTANT (val))
14817         return NULL_TREE;
14818       TREE_OPERAND (node, 1) = val;
14819       val = fold_constant_for_init (TREE_OPERAND (node, 2), context);
14820       if (val == NULL_TREE || ! TREE_CONSTANT (val))
14821         return NULL_TREE;
14822       TREE_OPERAND (node, 2) = val;
14823       return integer_zerop (TREE_OPERAND (node, 0)) ? TREE_OPERAND (node, 1)
14824         : TREE_OPERAND (node, 2);
14825
14826     case VAR_DECL:
14827     case FIELD_DECL:
14828       if (! FIELD_FINAL (node)
14829           || DECL_INITIAL (node) == NULL_TREE)
14830         return NULL_TREE;
14831       val = DECL_INITIAL (node);
14832       /* Guard against infinite recursion. */
14833       DECL_INITIAL (node) = NULL_TREE;
14834       val = fold_constant_for_init (val, node);
14835       DECL_INITIAL (node) = val;
14836       return val;
14837
14838     case EXPR_WITH_FILE_LOCATION:
14839       /* Compare java_complete_tree and resolve_expression_name. */
14840       if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
14841           || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
14842         {
14843           tree name = EXPR_WFL_NODE (node);
14844           tree decl;
14845           if (PRIMARY_P (node))
14846             return NULL_TREE;
14847           else if (! QUALIFIED_P (name))
14848             {
14849               decl = lookup_field_wrapper (DECL_CONTEXT (context), name);
14850               if (decl == NULL_TREE 
14851                   || (! FIELD_STATIC (decl) && ! FIELD_FINAL (decl)))
14852                 return NULL_TREE;
14853               return fold_constant_for_init (decl, decl);
14854             }
14855           else
14856             {
14857               /* Wait until the USE_COMPONENT_REF re-write.  FIXME. */
14858               qualify_ambiguous_name (node);
14859               if (resolve_field_access (node, &decl, NULL)
14860                   && decl != NULL_TREE)
14861                 return fold_constant_for_init (decl, decl);
14862               return NULL_TREE;
14863             }
14864         }
14865       else
14866         {
14867           op0 = TREE_OPERAND (node, 0);
14868           val = fold_constant_for_init (op0, context);
14869           if (val == NULL_TREE || ! TREE_CONSTANT (val))
14870             return NULL_TREE;
14871           TREE_OPERAND (node, 0) = val;
14872           return val;
14873         }
14874
14875 #ifdef USE_COMPONENT_REF
14876     case IDENTIFIER:
14877     case COMPONENT_REF:
14878       ?;
14879 #endif
14880
14881     default:
14882       return NULL_TREE;
14883     }
14884 }
14885
14886 #ifdef USE_COMPONENT_REF
14887 /* Context is 'T' for TypeName, 'P' for PackageName,
14888    'M' for MethodName, 'E' for ExpressionName, and 'A' for AmbiguousName. */
14889
14890 tree
14891 resolve_simple_name (name, context)
14892      tree name;
14893      int context;
14894 {
14895 }
14896
14897 tree
14898 resolve_qualified_name (name, context)
14899      tree name;
14900      int context;
14901 {
14902 }
14903 #endif