]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/java/parse.c
Initial revision
[thirdparty/gcc.git] / gcc / java / parse.c
1
2 /* A Bison parser, made from /nfs/hoser/beer/java/egcs/gcc/java/parse.y
3 by GNU Bison version 1.25
4 */
5
6 #define YYBISON 1 /* Identify Bison output. */
7
8 #define yyparse java_parse
9 #define yylex java_lex
10 #define yyerror java_error
11 #define yylval java_lval
12 #define yychar java_char
13 #define yydebug java_debug
14 #define yynerrs java_nerrs
15 #define PLUS_TK 258
16 #define MINUS_TK 259
17 #define MULT_TK 260
18 #define DIV_TK 261
19 #define REM_TK 262
20 #define LS_TK 263
21 #define SRS_TK 264
22 #define ZRS_TK 265
23 #define AND_TK 266
24 #define XOR_TK 267
25 #define OR_TK 268
26 #define BOOL_AND_TK 269
27 #define BOOL_OR_TK 270
28 #define EQ_TK 271
29 #define NEQ_TK 272
30 #define GT_TK 273
31 #define GTE_TK 274
32 #define LT_TK 275
33 #define LTE_TK 276
34 #define PLUS_ASSIGN_TK 277
35 #define MINUS_ASSIGN_TK 278
36 #define MULT_ASSIGN_TK 279
37 #define DIV_ASSIGN_TK 280
38 #define REM_ASSIGN_TK 281
39 #define LS_ASSIGN_TK 282
40 #define SRS_ASSIGN_TK 283
41 #define ZRS_ASSIGN_TK 284
42 #define AND_ASSIGN_TK 285
43 #define XOR_ASSIGN_TK 286
44 #define OR_ASSIGN_TK 287
45 #define PUBLIC_TK 288
46 #define PRIVATE_TK 289
47 #define PROTECTED_TK 290
48 #define STATIC_TK 291
49 #define FINAL_TK 292
50 #define SYNCHRONIZED_TK 293
51 #define VOLATILE_TK 294
52 #define TRANSIENT_TK 295
53 #define NATIVE_TK 296
54 #define PAD_TK 297
55 #define ABSTRACT_TK 298
56 #define MODIFIER_TK 299
57 #define DECR_TK 300
58 #define INCR_TK 301
59 #define DEFAULT_TK 302
60 #define IF_TK 303
61 #define THROW_TK 304
62 #define BOOLEAN_TK 305
63 #define DO_TK 306
64 #define IMPLEMENTS_TK 307
65 #define THROWS_TK 308
66 #define BREAK_TK 309
67 #define IMPORT_TK 310
68 #define ELSE_TK 311
69 #define INSTANCEOF_TK 312
70 #define RETURN_TK 313
71 #define VOID_TK 314
72 #define CATCH_TK 315
73 #define INTERFACE_TK 316
74 #define CASE_TK 317
75 #define EXTENDS_TK 318
76 #define FINALLY_TK 319
77 #define SUPER_TK 320
78 #define WHILE_TK 321
79 #define CLASS_TK 322
80 #define SWITCH_TK 323
81 #define CONST_TK 324
82 #define TRY_TK 325
83 #define FOR_TK 326
84 #define NEW_TK 327
85 #define CONTINUE_TK 328
86 #define GOTO_TK 329
87 #define PACKAGE_TK 330
88 #define THIS_TK 331
89 #define BYTE_TK 332
90 #define SHORT_TK 333
91 #define INT_TK 334
92 #define LONG_TK 335
93 #define CHAR_TK 336
94 #define INTEGRAL_TK 337
95 #define FLOAT_TK 338
96 #define DOUBLE_TK 339
97 #define FP_TK 340
98 #define ID_TK 341
99 #define REL_QM_TK 342
100 #define REL_CL_TK 343
101 #define NOT_TK 344
102 #define NEG_TK 345
103 #define ASSIGN_ANY_TK 346
104 #define ASSIGN_TK 347
105 #define OP_TK 348
106 #define CP_TK 349
107 #define OCB_TK 350
108 #define CCB_TK 351
109 #define OSB_TK 352
110 #define CSB_TK 353
111 #define SC_TK 354
112 #define C_TK 355
113 #define DOT_TK 356
114 #define STRING_LIT_TK 357
115 #define CHAR_LIT_TK 358
116 #define INT_LIT_TK 359
117 #define FP_LIT_TK 360
118 #define TRUE_TK 361
119 #define FALSE_TK 362
120 #define BOOL_LIT_TK 363
121 #define NULL_TK 364
122
123 #line 49 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
124
125 #include <stdio.h>
126 #include <stdlib.h>
127 #include <string.h>
128 #include <dirent.h>
129 #ifdef __STDC__
130 #include <stdarg.h>
131 #else
132 #include <varargs.h>
133 #endif
134
135 #include "config.h"
136 #include "tree.h"
137 #include "rtl.h"
138 #include "obstack.h"
139 #include "flags.h"
140 #include "java-tree.h"
141 #include "jcf.h"
142 #include "lex.h"
143 #include "parse.h"
144 #include "zipfile.h"
145
146 /* Number of error found so far. */
147 int java_error_count;
148 /* Number of warning found so far. */
149 int java_warning_count;
150
151 /* The current parser context */
152 static struct parser_ctxt *ctxp;
153
154 /* binop_lookup maps token to tree_code. It is used where binary
155 operations are involved and required by the parser. RDIV_EXPR
156 covers both integral/floating point division. The code is changed
157 once the type of both operator is worked out. */
158
159 static enum tree_code binop_lookup[19] =
160 {
161 PLUS_EXPR, MINUS_EXPR, MULT_EXPR, RDIV_EXPR, TRUNC_MOD_EXPR,
162 LSHIFT_EXPR, RSHIFT_EXPR, URSHIFT_EXPR,
163 BIT_AND_EXPR, BIT_XOR_EXPR, BIT_IOR_EXPR,
164 TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR,
165 EQ_EXPR, NE_EXPR, GT_EXPR, GE_EXPR, LT_EXPR, LE_EXPR,
166 };
167 #define BINOP_LOOKUP(VALUE) \
168 binop_lookup [((VALUE) - PLUS_TK)% \
169 (sizeof (binop_lookup) / sizeof (binop_lookup[0]))]
170
171 /* Fake WFL used to report error message. It is initialized once if
172 needed and reused with it's location information is overriden. */
173 static tree wfl_operator = NULL_TREE;
174
175 /* The "$L" identifier we use to create labels. */
176 static tree label_id;
177
178 #line 104 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
179 typedef union {
180 tree node;
181 int sub_token;
182 struct {
183 int token;
184 int location;
185 } operator;
186 int value;
187 } YYSTYPE;
188 #ifndef YYDEBUG
189 #define YYDEBUG 1
190 #endif
191
192 #include <stdio.h>
193
194 #ifndef __cplusplus
195 #ifndef __STDC__
196 #define const
197 #endif
198 #endif
199
200
201
202 #define YYFINAL 772
203 #define YYFLAG -32768
204 #define YYNTBASE 110
205
206 #define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 259)
207
208 static const char yytranslate[] = { 0,
209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
210 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
211 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
215 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
216 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
217 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
218 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
219 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
220 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
221 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
222 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
223 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
224 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
225 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
226 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
227 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
228 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
229 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
230 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
231 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
232 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
233 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
234 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
235 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
236 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
237 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
238 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
239 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
240 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
241 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
242 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
243 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
244 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
245 106, 107, 108, 109
246 };
247
248 #if YYDEBUG != 0
249 static const short yyprhs[] = { 0,
250 0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
251 20, 22, 24, 26, 28, 30, 32, 34, 38, 42,
252 46, 50, 54, 56, 58, 60, 64, 66, 67, 69,
253 71, 73, 76, 79, 82, 86, 88, 91, 93, 96,
254 100, 103, 107, 109, 111, 115, 118, 122, 128, 133,
255 139, 141, 143, 145, 147, 149, 152, 153, 161, 162,
256 169, 173, 176, 180, 185, 186, 189, 193, 196, 197,
257 200, 203, 205, 209, 213, 216, 220, 222, 225, 227,
258 229, 231, 233, 235, 237, 239, 241, 245, 250, 252,
259 256, 260, 262, 266, 270, 275, 277, 281, 284, 288,
260 292, 294, 296, 297, 301, 304, 308, 312, 317, 322,
261 325, 329, 332, 336, 339, 343, 348, 352, 356, 360,
262 362, 366, 370, 373, 377, 380, 384, 385, 388, 391,
263 393, 397, 401, 403, 406, 408, 411, 415, 417, 421,
264 426, 431, 437, 441, 446, 449, 453, 457, 462, 467,
265 473, 481, 488, 490, 492, 493, 498, 499, 505, 506,
266 512, 513, 520, 524, 529, 532, 536, 539, 543, 546,
267 550, 552, 555, 557, 559, 561, 563, 565, 568, 571,
268 574, 578, 582, 587, 589, 593, 597, 600, 601, 606,
269 608, 611, 613, 615, 617, 620, 623, 627, 629, 631,
270 633, 635, 637, 639, 641, 643, 645, 647, 649, 651,
271 653, 655, 657, 659, 661, 663, 665, 667, 669, 671,
272 673, 676, 679, 682, 685, 688, 691, 694, 697, 701,
273 706, 711, 717, 722, 728, 735, 743, 750, 752, 754,
274 756, 758, 760, 762, 764, 770, 773, 777, 782, 790,
275 798, 804, 807, 811, 817, 820, 824, 828, 833, 835,
276 838, 841, 843, 846, 850, 853, 856, 860, 863, 868,
277 871, 874, 878, 883, 886, 888, 896, 904, 911, 915,
278 921, 926, 934, 941, 944, 947, 951, 954, 955, 957,
279 959, 962, 963, 965, 967, 971, 975, 978, 982, 985,
280 989, 992, 996, 999, 1003, 1006, 1010, 1013, 1017, 1021,
281 1024, 1028, 1034, 1040, 1043, 1048, 1052, 1054, 1058, 1062,
282 1067, 1070, 1072, 1075, 1081, 1084, 1089, 1093, 1096, 1099,
283 1101, 1103, 1105, 1107, 1111, 1113, 1115, 1117, 1119, 1123,
284 1127, 1131, 1135, 1139, 1143, 1147, 1151, 1157, 1162, 1169,
285 1175, 1180, 1186, 1192, 1199, 1203, 1207, 1212, 1218, 1221,
286 1225, 1229, 1233, 1235, 1239, 1243, 1247, 1251, 1256, 1261,
287 1266, 1271, 1275, 1279, 1281, 1284, 1288, 1292, 1295, 1298,
288 1302, 1306, 1310, 1314, 1317, 1321, 1326, 1332, 1339, 1345,
289 1352, 1357, 1362, 1367, 1372, 1376, 1381, 1385, 1390, 1392,
290 1394, 1396, 1398, 1401, 1404, 1406, 1408, 1411, 1414, 1416,
291 1419, 1422, 1425, 1428, 1431, 1434, 1436, 1439, 1442, 1444,
292 1447, 1450, 1456, 1461, 1466, 1472, 1477, 1480, 1486, 1491,
293 1497, 1499, 1503, 1507, 1511, 1515, 1519, 1523, 1525, 1529,
294 1533, 1537, 1541, 1543, 1547, 1551, 1555, 1559, 1563, 1567,
295 1569, 1573, 1577, 1581, 1585, 1589, 1593, 1597, 1601, 1605,
296 1609, 1611, 1615, 1619, 1623, 1627, 1629, 1633, 1637, 1639,
297 1643, 1647, 1649, 1653, 1657, 1659, 1663, 1667, 1669, 1673,
298 1677, 1679, 1685, 1690, 1694, 1700, 1702, 1704, 1708, 1712,
299 1714, 1716, 1718, 1720, 1722, 1724
300 };
301
302 static const short yyrhs[] = { 123,
303 0, 104, 0, 105, 0, 108, 0, 103, 0, 102,
304 0, 109, 0, 113, 0, 114, 0, 82, 0, 85,
305 0, 50, 0, 115, 0, 118, 0, 119, 0, 115,
306 0, 115, 0, 113, 97, 98, 0, 119, 97, 98,
307 0, 118, 97, 98, 0, 113, 97, 1, 0, 118,
308 97, 1, 0, 120, 0, 121, 0, 122, 0, 119,
309 101, 122, 0, 86, 0, 0, 126, 0, 124, 0,
310 125, 0, 126, 124, 0, 126, 125, 0, 124, 125,
311 0, 126, 124, 125, 0, 127, 0, 124, 127, 0,
312 130, 0, 125, 130, 0, 75, 119, 99, 0, 75,
313 1, 0, 75, 119, 1, 0, 128, 0, 129, 0,
314 55, 119, 99, 0, 55, 1, 0, 55, 119, 1,
315 0, 55, 119, 101, 5, 99, 0, 55, 119, 101,
316 1, 0, 55, 119, 101, 5, 1, 0, 132, 0,
317 163, 0, 99, 0, 1, 0, 44, 0, 131, 44,
318 0, 0, 131, 67, 122, 135, 136, 133, 138, 0,
319 0, 67, 122, 135, 136, 134, 138, 0, 131, 67,
320 1, 0, 67, 1, 0, 67, 122, 1, 0, 131,
321 67, 122, 1, 0, 0, 63, 116, 0, 63, 116,
322 1, 0, 63, 1, 0, 0, 52, 137, 0, 52,
323 1, 0, 117, 0, 137, 100, 117, 0, 137, 100,
324 1, 0, 95, 96, 0, 95, 139, 96, 0, 140,
325 0, 139, 140, 0, 141, 0, 156, 0, 158, 0,
326 176, 0, 142, 0, 147, 0, 132, 0, 163, 0,
327 112, 143, 99, 0, 131, 112, 143, 99, 0, 144,
328 0, 143, 100, 144, 0, 143, 100, 1, 0, 145,
329 0, 145, 92, 146, 0, 145, 92, 1, 0, 145,
330 92, 146, 1, 0, 122, 0, 145, 97, 98, 0,
331 122, 1, 0, 145, 97, 1, 0, 145, 98, 1,
332 0, 257, 0, 174, 0, 0, 149, 148, 155, 0,
333 149, 1, 0, 112, 150, 153, 0, 59, 150, 153,
334 0, 131, 112, 150, 153, 0, 131, 59, 150, 153,
335 0, 112, 1, 0, 131, 112, 1, 0, 59, 1,
336 0, 131, 59, 1, 0, 131, 1, 0, 122, 93,
337 94, 0, 122, 93, 151, 94, 0, 150, 97, 98,
338 0, 122, 93, 1, 0, 150, 97, 1, 0, 152,
339 0, 151, 100, 152, 0, 151, 100, 1, 0, 112,
340 145, 0, 131, 112, 145, 0, 112, 1, 0, 131,
341 112, 1, 0, 0, 53, 154, 0, 53, 1, 0,
342 116, 0, 154, 100, 116, 0, 154, 100, 1, 0,
343 176, 0, 176, 99, 0, 99, 0, 157, 176, 0,
344 157, 176, 99, 0, 44, 0, 159, 153, 160, 0,
345 131, 159, 153, 160, 0, 159, 153, 160, 99, 0,
346 131, 159, 153, 160, 99, 0, 120, 93, 94, 0,
347 120, 93, 151, 94, 0, 95, 96, 0, 95, 161,
348 96, 0, 95, 178, 96, 0, 95, 161, 178, 96,
349 0, 162, 93, 94, 99, 0, 162, 93, 226, 94,
350 99, 0, 119, 101, 65, 93, 226, 94, 99, 0,
351 119, 101, 65, 93, 94, 99, 0, 76, 0, 65,
352 0, 0, 61, 122, 164, 169, 0, 0, 131, 61,
353 122, 165, 169, 0, 0, 61, 122, 168, 166, 169,
354 0, 0, 131, 61, 122, 168, 167, 169, 0, 61,
355 122, 1, 0, 131, 61, 122, 1, 0, 63, 117,
356 0, 168, 100, 117, 0, 63, 1, 0, 168, 100,
357 1, 0, 95, 96, 0, 95, 170, 96, 0, 171,
358 0, 170, 171, 0, 172, 0, 173, 0, 132, 0,
359 163, 0, 142, 0, 149, 99, 0, 149, 1, 0,
360 95, 96, 0, 95, 175, 96, 0, 95, 100, 96,
361 0, 95, 175, 100, 96, 0, 146, 0, 175, 100,
362 146, 0, 175, 100, 1, 0, 95, 96, 0, 0,
363 95, 177, 178, 96, 0, 179, 0, 178, 179, 0,
364 180, 0, 182, 0, 132, 0, 181, 99, 0, 112,
365 143, 0, 131, 112, 143, 0, 184, 0, 187, 0,
366 191, 0, 192, 0, 201, 0, 205, 0, 184, 0,
367 188, 0, 193, 0, 202, 0, 206, 0, 176, 0,
368 185, 0, 189, 0, 194, 0, 204, 0, 212, 0,
369 213, 0, 214, 0, 216, 0, 215, 0, 218, 0,
370 99, 0, 122, 88, 0, 186, 182, 0, 122, 1,
371 0, 186, 183, 0, 190, 99, 0, 1, 99, 0,
372 1, 95, 0, 1, 96, 0, 162, 93, 1, 0,
373 162, 93, 94, 1, 0, 162, 93, 226, 1, 0,
374 162, 93, 226, 94, 1, 0, 119, 101, 65, 1,
375 0, 119, 101, 65, 93, 1, 0, 119, 101, 65,
376 93, 226, 1, 0, 119, 101, 65, 93, 226, 94,
377 1, 0, 119, 101, 65, 93, 94, 1, 0, 254,
378 0, 238, 0, 239, 0, 235, 0, 236, 0, 232,
379 0, 224, 0, 48, 93, 257, 94, 182, 0, 48,
380 1, 0, 48, 93, 1, 0, 48, 93, 257, 1,
381 0, 48, 93, 257, 94, 183, 56, 182, 0, 48,
382 93, 257, 94, 183, 56, 183, 0, 68, 93, 257,
383 94, 195, 0, 68, 1, 0, 68, 93, 1, 0,
384 68, 93, 257, 94, 1, 0, 95, 96, 0, 95,
385 198, 96, 0, 95, 196, 96, 0, 95, 196, 198,
386 96, 0, 197, 0, 196, 197, 0, 198, 178, 0,
387 199, 0, 198, 199, 0, 62, 258, 88, 0, 47,
388 88, 0, 62, 1, 0, 62, 258, 1, 0, 47,
389 1, 0, 66, 93, 257, 94, 0, 200, 182, 0,
390 66, 1, 0, 66, 93, 1, 0, 66, 93, 257,
391 1, 0, 200, 183, 0, 51, 0, 203, 182, 66,
392 93, 257, 94, 99, 0, 208, 99, 257, 99, 210,
393 94, 182, 0, 208, 99, 99, 210, 94, 182, 0,
394 208, 99, 1, 0, 208, 99, 257, 99, 1, 0,
395 208, 99, 99, 1, 0, 208, 99, 257, 99, 210,
396 94, 183, 0, 208, 99, 99, 210, 94, 183, 0,
397 71, 93, 0, 71, 1, 0, 71, 93, 1, 0,
398 207, 209, 0, 0, 211, 0, 181, 0, 211, 1,
399 0, 0, 211, 0, 190, 0, 211, 100, 190, 0,
400 211, 100, 1, 0, 54, 99, 0, 54, 122, 99,
401 0, 54, 1, 0, 54, 122, 1, 0, 73, 99,
402 0, 73, 122, 99, 0, 73, 1, 0, 73, 122,
403 1, 0, 58, 99, 0, 58, 257, 99, 0, 58,
404 1, 0, 58, 257, 1, 0, 49, 257, 99, 0,
405 49, 1, 0, 49, 257, 1, 0, 217, 93, 257,
406 94, 176, 0, 217, 93, 257, 94, 1, 0, 217,
407 1, 0, 217, 93, 1, 94, 0, 217, 93, 1,
408 0, 44, 0, 70, 176, 219, 0, 70, 176, 221,
409 0, 70, 176, 219, 221, 0, 70, 1, 0, 220,
410 0, 219, 220, 0, 60, 93, 152, 94, 176, 0,
411 60, 1, 0, 60, 93, 1, 94, 0, 60, 93,
412 1, 0, 64, 176, 0, 64, 1, 0, 223, 0,
413 227, 0, 111, 0, 76, 0, 93, 257, 94, 0,
414 224, 0, 231, 0, 232, 0, 233, 0, 119, 101,
415 67, 0, 113, 101, 67, 0, 59, 101, 67, 0,
416 119, 101, 76, 0, 93, 257, 1, 0, 119, 101,
417 1, 0, 113, 101, 1, 0, 59, 101, 1, 0,
418 72, 116, 93, 226, 94, 0, 72, 116, 93, 94,
419 0, 72, 116, 93, 226, 94, 138, 0, 72, 116,
420 93, 94, 138, 0, 225, 122, 93, 94, 0, 225,
421 122, 93, 94, 138, 0, 225, 122, 93, 226, 94,
422 0, 225, 122, 93, 226, 94, 138, 0, 72, 1,
423 99, 0, 72, 116, 1, 0, 72, 116, 93, 1,
424 0, 72, 116, 93, 226, 1, 0, 225, 1, 0,
425 225, 122, 1, 0, 119, 101, 72, 0, 222, 101,
426 72, 0, 257, 0, 226, 100, 257, 0, 226, 100,
427 1, 0, 72, 113, 228, 0, 72, 115, 228, 0,
428 72, 113, 228, 230, 0, 72, 115, 228, 230, 0,
429 72, 115, 230, 174, 0, 72, 113, 230, 174, 0,
430 72, 1, 98, 0, 72, 1, 97, 0, 229, 0,
431 228, 229, 0, 97, 257, 98, 0, 97, 257, 1,
432 0, 97, 1, 0, 97, 98, 0, 230, 97, 98,
433 0, 230, 97, 1, 0, 222, 101, 122, 0, 65,
434 101, 122, 0, 65, 1, 0, 119, 93, 94, 0,
435 119, 93, 226, 94, 0, 222, 101, 122, 93, 94,
436 0, 222, 101, 122, 93, 226, 94, 0, 65, 101,
437 122, 93, 94, 0, 65, 101, 122, 93, 226, 94,
438 0, 65, 101, 1, 94, 0, 65, 101, 1, 101,
439 0, 119, 97, 257, 98, 0, 223, 97, 257, 98,
440 0, 119, 97, 1, 0, 119, 97, 257, 1, 0,
441 223, 97, 1, 0, 223, 97, 257, 1, 0, 222,
442 0, 119, 0, 235, 0, 236, 0, 234, 46, 0,
443 234, 45, 0, 238, 0, 239, 0, 3, 237, 0,
444 4, 237, 0, 240, 0, 3, 1, 0, 4, 1,
445 0, 46, 237, 0, 46, 1, 0, 45, 237, 0,
446 45, 1, 0, 234, 0, 89, 237, 0, 90, 237,
447 0, 241, 0, 89, 1, 0, 90, 1, 0, 93,
448 113, 230, 94, 237, 0, 93, 113, 94, 237, 0,
449 93, 257, 94, 240, 0, 93, 119, 230, 94, 240,
450 0, 93, 113, 97, 1, 0, 93, 1, 0, 93,
451 113, 230, 94, 1, 0, 93, 113, 94, 1, 0,
452 93, 119, 230, 94, 1, 0, 237, 0, 242, 5,
453 237, 0, 242, 6, 237, 0, 242, 7, 237, 0,
454 242, 5, 1, 0, 242, 6, 1, 0, 242, 7,
455 1, 0, 242, 0, 243, 3, 242, 0, 243, 4,
456 242, 0, 243, 3, 1, 0, 243, 4, 1, 0,
457 243, 0, 244, 8, 243, 0, 244, 9, 243, 0,
458 244, 10, 243, 0, 244, 8, 1, 0, 244, 9,
459 1, 0, 244, 10, 1, 0, 244, 0, 245, 20,
460 244, 0, 245, 18, 244, 0, 245, 21, 244, 0,
461 245, 19, 244, 0, 245, 57, 114, 0, 245, 20,
462 1, 0, 245, 18, 1, 0, 245, 21, 1, 0,
463 245, 19, 1, 0, 245, 57, 1, 0, 245, 0,
464 246, 16, 245, 0, 246, 17, 245, 0, 246, 16,
465 1, 0, 246, 17, 1, 0, 246, 0, 247, 11,
466 246, 0, 247, 11, 1, 0, 247, 0, 248, 12,
467 247, 0, 248, 12, 1, 0, 248, 0, 249, 13,
468 248, 0, 249, 13, 1, 0, 249, 0, 250, 14,
469 249, 0, 250, 14, 1, 0, 250, 0, 251, 15,
470 250, 0, 251, 15, 1, 0, 251, 0, 251, 87,
471 257, 88, 252, 0, 251, 87, 88, 1, 0, 251,
472 87, 1, 0, 251, 87, 257, 88, 1, 0, 252,
473 0, 254, 0, 255, 256, 253, 0, 255, 256, 1,
474 0, 119, 0, 231, 0, 233, 0, 91, 0, 92,
475 0, 253, 0, 257, 0
476 };
477
478 #endif
479
480 #if YYDEBUG != 0
481 static const short yyrline[] = { 0,
482 251, 257, 259, 260, 261, 262, 263, 267, 269, 272,
483 274, 275, 278, 280, 283, 287, 291, 295, 301, 303,
484 305, 307, 312, 314, 317, 321, 326, 331, 333, 334,
485 335, 336, 337, 338, 339, 342, 347, 353, 355, 358,
486 361, 363, 367, 369, 372, 402, 404, 408, 421, 423,
487 427, 433, 434, 436, 446, 451, 466, 470, 473, 476,
488 479, 481, 483, 485, 489, 491, 493, 495, 499, 501,
489 503, 510, 516, 521, 525, 528, 532, 534, 537, 539,
490 540, 541, 544, 546, 547, 548, 552, 555, 567, 570,
491 572, 576, 579, 586, 592, 600, 602, 606, 608, 610,
492 614, 616, 621, 628, 640, 644, 647, 649, 651, 653,
493 655, 657, 659, 661, 668, 671, 673, 678, 680, 684,
494 689, 694, 698, 703, 708, 710, 717, 718, 719, 723,
495 725, 726, 730, 732, 733, 738, 743, 749, 761, 766,
496 772, 777, 786, 788, 791, 793, 794, 795, 799, 801,
497 804, 805, 809, 816, 826, 830, 833, 836, 839, 842,
498 845, 848, 851, 853, 857, 863, 868, 870, 874, 877,
499 881, 883, 886, 888, 889, 890, 893, 897, 903, 908,
500 913, 917, 921, 927, 929, 930, 935, 938, 941, 948,
501 950, 953, 955, 957, 960, 964, 967, 971, 973, 975,
502 977, 979, 981, 991, 993, 995, 997, 999, 1003, 1006,
503 1008, 1010, 1012, 1014, 1016, 1018, 1019, 1021, 1023, 1027,
504 1032, 1043, 1050, 1054, 1065, 1075, 1081, 1087, 1093, 1095,
505 1097, 1099, 1101, 1103, 1105, 1107, 1109, 1113, 1115, 1119,
506 1123, 1127, 1131, 1132, 1138, 1141, 1143, 1145, 1149, 1154,
507 1159, 1161, 1163, 1165, 1169, 1171, 1172, 1173, 1176, 1178,
508 1181, 1186, 1188, 1191, 1193, 1194, 1196, 1198, 1202, 1210,
509 1213, 1215, 1217, 1221, 1226, 1235, 1240, 1243, 1250, 1252,
510 1254, 1258, 1261, 1270, 1277, 1279, 1283, 1296, 1298, 1304,
511 1310, 1314, 1316, 1320, 1323, 1325, 1329, 1332, 1334, 1336,
512 1340, 1343, 1345, 1347, 1351, 1354, 1356, 1358, 1362, 1364,
513 1366, 1370, 1372, 1374, 1376, 1378, 1382, 1389, 1391, 1392,
514 1393, 1397, 1399, 1402, 1404, 1406, 1408, 1412, 1414, 1419,
515 1421, 1424, 1426, 1428, 1430, 1431, 1432, 1433, 1437, 1438,
516 1439, 1443, 1444, 1446, 1448, 1450, 1454, 1460, 1468, 1470,
517 1475, 1476, 1477, 1478, 1479, 1481, 1483, 1485, 1487, 1489,
518 1493, 1495, 1498, 1504, 1509, 1513, 1516, 1518, 1520, 1524,
519 1526, 1528, 1530, 1534, 1537, 1541, 1547, 1549, 1557, 1560,
520 1562, 1566, 1569, 1576, 1580, 1583, 1585, 1590, 1595, 1603,
521 1615, 1617, 1621, 1624, 1626, 1631, 1636, 1641, 1648, 1650,
522 1651, 1652, 1655, 1660, 1665, 1667, 1668, 1670, 1672, 1673,
523 1675, 1679, 1682, 1686, 1689, 1693, 1695, 1697, 1699, 1700,
524 1702, 1706, 1714, 1716, 1718, 1730, 1732, 1738, 1740, 1742,
525 1746, 1748, 1753, 1758, 1763, 1765, 1767, 1771, 1773, 1778,
526 1783, 1785, 1789, 1791, 1796, 1801, 1806, 1808, 1810, 1814,
527 1816, 1821, 1826, 1831, 1836, 1837, 1839, 1841, 1843, 1845,
528 1849, 1851, 1856, 1861, 1863, 1867, 1869, 1874, 1878, 1880,
529 1885, 1889, 1891, 1896, 1900, 1902, 1907, 1911, 1913, 1918,
530 1922, 1924, 1925, 1931, 1933, 1937, 1939, 1942, 1945, 1953,
531 1955, 1956, 1959, 1961, 1964, 1968
532 };
533 #endif
534
535
536 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
537
538 static const char * const yytname[] = { "$","error","$undefined.","PLUS_TK",
539 "MINUS_TK","MULT_TK","DIV_TK","REM_TK","LS_TK","SRS_TK","ZRS_TK","AND_TK","XOR_TK",
540 "OR_TK","BOOL_AND_TK","BOOL_OR_TK","EQ_TK","NEQ_TK","GT_TK","GTE_TK","LT_TK",
541 "LTE_TK","PLUS_ASSIGN_TK","MINUS_ASSIGN_TK","MULT_ASSIGN_TK","DIV_ASSIGN_TK",
542 "REM_ASSIGN_TK","LS_ASSIGN_TK","SRS_ASSIGN_TK","ZRS_ASSIGN_TK","AND_ASSIGN_TK",
543 "XOR_ASSIGN_TK","OR_ASSIGN_TK","PUBLIC_TK","PRIVATE_TK","PROTECTED_TK","STATIC_TK",
544 "FINAL_TK","SYNCHRONIZED_TK","VOLATILE_TK","TRANSIENT_TK","NATIVE_TK","PAD_TK",
545 "ABSTRACT_TK","MODIFIER_TK","DECR_TK","INCR_TK","DEFAULT_TK","IF_TK","THROW_TK",
546 "BOOLEAN_TK","DO_TK","IMPLEMENTS_TK","THROWS_TK","BREAK_TK","IMPORT_TK","ELSE_TK",
547 "INSTANCEOF_TK","RETURN_TK","VOID_TK","CATCH_TK","INTERFACE_TK","CASE_TK","EXTENDS_TK",
548 "FINALLY_TK","SUPER_TK","WHILE_TK","CLASS_TK","SWITCH_TK","CONST_TK","TRY_TK",
549 "FOR_TK","NEW_TK","CONTINUE_TK","GOTO_TK","PACKAGE_TK","THIS_TK","BYTE_TK","SHORT_TK",
550 "INT_TK","LONG_TK","CHAR_TK","INTEGRAL_TK","FLOAT_TK","DOUBLE_TK","FP_TK","ID_TK",
551 "REL_QM_TK","REL_CL_TK","NOT_TK","NEG_TK","ASSIGN_ANY_TK","ASSIGN_TK","OP_TK",
552 "CP_TK","OCB_TK","CCB_TK","OSB_TK","CSB_TK","SC_TK","C_TK","DOT_TK","STRING_LIT_TK",
553 "CHAR_LIT_TK","INT_LIT_TK","FP_LIT_TK","TRUE_TK","FALSE_TK","BOOL_LIT_TK","NULL_TK",
554 "goal","literal","type","primitive_type","reference_type","class_or_interface_type",
555 "class_type","interface_type","array_type","name","simple_name","qualified_name",
556 "identifier","compilation_unit","import_declarations","type_declarations","package_declaration",
557 "import_declaration","single_type_import_declaration","type_import_on_demand_declaration",
558 "type_declaration","modifiers","class_declaration","@1","@2","super","interfaces",
559 "interface_type_list","class_body","class_body_declarations","class_body_declaration",
560 "class_member_declaration","field_declaration","variable_declarators","variable_declarator",
561 "variable_declarator_id","variable_initializer","method_declaration","@3","method_header",
562 "method_declarator","formal_parameter_list","formal_parameter","throws","class_type_list",
563 "method_body","static_initializer","static","constructor_declaration","constructor_declarator",
564 "constructor_body","explicit_constructor_invocation","this_or_super","interface_declaration",
565 "@4","@5","@6","@7","extends_interfaces","interface_body","interface_member_declarations",
566 "interface_member_declaration","constant_declaration","abstract_method_declaration",
567 "array_initializer","variable_initializers","block","@8","block_statements",
568 "block_statement","local_variable_declaration_statement","local_variable_declaration",
569 "statement","statement_nsi","statement_without_trailing_substatement","empty_statement",
570 "label_decl","labeled_statement","labeled_statement_nsi","expression_statement",
571 "statement_expression","if_then_statement","if_then_else_statement","if_then_else_statement_nsi",
572 "switch_statement","switch_block","switch_block_statement_groups","switch_block_statement_group",
573 "switch_labels","switch_label","while_expression","while_statement","while_statement_nsi",
574 "do_statement_begin","do_statement","for_statement","for_statement_nsi","for_header",
575 "for_begin","for_init","for_update","statement_expression_list","break_statement",
576 "continue_statement","return_statement","throw_statement","synchronized_statement",
577 "synchronized","try_statement","catches","catch_clause","finally","primary",
578 "primary_no_new_array","class_instance_creation_expression","something_dot_new",
579 "argument_list","array_creation_expression","dim_exprs","dim_expr","dims","field_access",
580 "method_invocation","array_access","postfix_expression","post_increment_expression",
581 "post_decrement_expression","unary_expression","pre_increment_expression","pre_decrement_expression",
582 "unary_expression_not_plus_minus","cast_expression","multiplicative_expression",
583 "additive_expression","shift_expression","relational_expression","equality_expression",
584 "and_expression","exclusive_or_expression","inclusive_or_expression","conditional_and_expression",
585 "conditional_or_expression","conditional_expression","assignment_expression",
586 "assignment","left_hand_side","assignment_operator","expression","constant_expression", NULL
587 };
588 #endif
589
590 static const short yyr1[] = { 0,
591 110, 111, 111, 111, 111, 111, 111, 112, 112, 113,
592 113, 113, 114, 114, 115, 116, 117, 118, 118, 118,
593 118, 118, 119, 119, 120, 121, 122, 123, 123, 123,
594 123, 123, 123, 123, 123, 124, 124, 125, 125, 126,
595 126, 126, 127, 127, 128, 128, 128, 129, 129, 129,
596 130, 130, 130, 130, 131, 131, 133, 132, 134, 132,
597 132, 132, 132, 132, 135, 135, 135, 135, 136, 136,
598 136, 137, 137, 137, 138, 138, 139, 139, 140, 140,
599 140, 140, 141, 141, 141, 141, 142, 142, 143, 143,
600 143, 144, 144, 144, 144, 145, 145, 145, 145, 145,
601 146, 146, 148, 147, 147, 149, 149, 149, 149, 149,
602 149, 149, 149, 149, 150, 150, 150, 150, 150, 151,
603 151, 151, 152, 152, 152, 152, 153, 153, 153, 154,
604 154, 154, 155, 155, 155, 156, 156, 157, 158, 158,
605 158, 158, 159, 159, 160, 160, 160, 160, 161, 161,
606 161, 161, 162, 162, 164, 163, 165, 163, 166, 163,
607 167, 163, 163, 163, 168, 168, 168, 168, 169, 169,
608 170, 170, 171, 171, 171, 171, 172, 173, 173, 174,
609 174, 174, 174, 175, 175, 175, 176, 177, 176, 178,
610 178, 179, 179, 179, 180, 181, 181, 182, 182, 182,
611 182, 182, 182, 183, 183, 183, 183, 183, 184, 184,
612 184, 184, 184, 184, 184, 184, 184, 184, 184, 185,
613 186, 187, 187, 188, 189, 189, 189, 189, 189, 189,
614 189, 189, 189, 189, 189, 189, 189, 190, 190, 190,
615 190, 190, 190, 190, 191, 191, 191, 191, 192, 193,
616 194, 194, 194, 194, 195, 195, 195, 195, 196, 196,
617 197, 198, 198, 199, 199, 199, 199, 199, 200, 201,
618 201, 201, 201, 202, 203, 204, 205, 205, 205, 205,
619 205, 206, 206, 207, 207, 207, 208, 209, 209, 209,
620 209, 210, 210, 211, 211, 211, 212, 212, 212, 212,
621 213, 213, 213, 213, 214, 214, 214, 214, 215, 215,
622 215, 216, 216, 216, 216, 216, 217, 218, 218, 218,
623 218, 219, 219, 220, 220, 220, 220, 221, 221, 222,
624 222, 223, 223, 223, 223, 223, 223, 223, 223, 223,
625 223, 223, 223, 223, 223, 223, 224, 224, 224, 224,
626 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
627 225, 225, 226, 226, 226, 227, 227, 227, 227, 227,
628 227, 227, 227, 228, 228, 229, 229, 229, 230, 230,
629 230, 231, 231, 231, 232, 232, 232, 232, 232, 232,
630 232, 232, 233, 233, 233, 233, 233, 233, 234, 234,
631 234, 234, 235, 236, 237, 237, 237, 237, 237, 237,
632 237, 238, 238, 239, 239, 240, 240, 240, 240, 240,
633 240, 241, 241, 241, 241, 241, 241, 241, 241, 241,
634 242, 242, 242, 242, 242, 242, 242, 243, 243, 243,
635 243, 243, 244, 244, 244, 244, 244, 244, 244, 245,
636 245, 245, 245, 245, 245, 245, 245, 245, 245, 245,
637 246, 246, 246, 246, 246, 247, 247, 247, 248, 248,
638 248, 249, 249, 249, 250, 250, 250, 251, 251, 251,
639 252, 252, 252, 252, 252, 253, 253, 254, 254, 255,
640 255, 255, 256, 256, 257, 258
641 };
642
643 static const short yyr2[] = { 0,
644 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
645 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
646 3, 3, 1, 1, 1, 3, 1, 0, 1, 1,
647 1, 2, 2, 2, 3, 1, 2, 1, 2, 3,
648 2, 3, 1, 1, 3, 2, 3, 5, 4, 5,
649 1, 1, 1, 1, 1, 2, 0, 7, 0, 6,
650 3, 2, 3, 4, 0, 2, 3, 2, 0, 2,
651 2, 1, 3, 3, 2, 3, 1, 2, 1, 1,
652 1, 1, 1, 1, 1, 1, 3, 4, 1, 3,
653 3, 1, 3, 3, 4, 1, 3, 2, 3, 3,
654 1, 1, 0, 3, 2, 3, 3, 4, 4, 2,
655 3, 2, 3, 2, 3, 4, 3, 3, 3, 1,
656 3, 3, 2, 3, 2, 3, 0, 2, 2, 1,
657 3, 3, 1, 2, 1, 2, 3, 1, 3, 4,
658 4, 5, 3, 4, 2, 3, 3, 4, 4, 5,
659 7, 6, 1, 1, 0, 4, 0, 5, 0, 5,
660 0, 6, 3, 4, 2, 3, 2, 3, 2, 3,
661 1, 2, 1, 1, 1, 1, 1, 2, 2, 2,
662 3, 3, 4, 1, 3, 3, 2, 0, 4, 1,
663 2, 1, 1, 1, 2, 2, 3, 1, 1, 1,
664 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
665 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
666 2, 2, 2, 2, 2, 2, 2, 2, 3, 4,
667 4, 5, 4, 5, 6, 7, 6, 1, 1, 1,
668 1, 1, 1, 1, 5, 2, 3, 4, 7, 7,
669 5, 2, 3, 5, 2, 3, 3, 4, 1, 2,
670 2, 1, 2, 3, 2, 2, 3, 2, 4, 2,
671 2, 3, 4, 2, 1, 7, 7, 6, 3, 5,
672 4, 7, 6, 2, 2, 3, 2, 0, 1, 1,
673 2, 0, 1, 1, 3, 3, 2, 3, 2, 3,
674 2, 3, 2, 3, 2, 3, 2, 3, 3, 2,
675 3, 5, 5, 2, 4, 3, 1, 3, 3, 4,
676 2, 1, 2, 5, 2, 4, 3, 2, 2, 1,
677 1, 1, 1, 3, 1, 1, 1, 1, 3, 3,
678 3, 3, 3, 3, 3, 3, 5, 4, 6, 5,
679 4, 5, 5, 6, 3, 3, 4, 5, 2, 3,
680 3, 3, 1, 3, 3, 3, 3, 4, 4, 4,
681 4, 3, 3, 1, 2, 3, 3, 2, 2, 3,
682 3, 3, 3, 2, 3, 4, 5, 6, 5, 6,
683 4, 4, 4, 4, 3, 4, 3, 4, 1, 1,
684 1, 1, 2, 2, 1, 1, 2, 2, 1, 2,
685 2, 2, 2, 2, 2, 1, 2, 2, 1, 2,
686 2, 5, 4, 4, 5, 4, 2, 5, 4, 5,
687 1, 3, 3, 3, 3, 3, 3, 1, 3, 3,
688 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
689 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
690 1, 3, 3, 3, 3, 1, 3, 3, 1, 3,
691 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
692 1, 5, 4, 3, 5, 1, 1, 3, 3, 1,
693 1, 1, 1, 1, 1, 1
694 };
695
696 static const short yydefact[] = { 0,
697 54, 55, 0, 0, 0, 0, 53, 1, 0, 0,
698 0, 36, 43, 44, 38, 0, 51, 52, 46, 27,
699 0, 23, 24, 25, 0, 62, 0, 41, 0, 0,
700 37, 39, 0, 0, 56, 0, 0, 47, 45, 0,
701 163, 0, 0, 159, 63, 0, 69, 42, 40, 0,
702 0, 0, 61, 0, 49, 0, 26, 167, 17, 165,
703 15, 0, 156, 0, 0, 68, 16, 0, 0, 59,
704 164, 0, 161, 64, 69, 50, 48, 12, 0, 10,
705 11, 169, 0, 8, 9, 13, 14, 15, 0, 175,
706 177, 0, 176, 0, 171, 173, 174, 168, 166, 160,
707 67, 71, 72, 70, 0, 158, 0, 57, 112, 0,
708 127, 110, 0, 0, 89, 92, 127, 0, 0, 0,
709 114, 0, 0, 179, 178, 170, 172, 0, 0, 60,
710 162, 0, 0, 0, 0, 107, 98, 87, 0, 0,
711 0, 0, 106, 21, 18, 22, 20, 19, 113, 127,
712 111, 0, 127, 74, 73, 55, 188, 75, 23, 0,
713 85, 0, 77, 79, 83, 84, 0, 80, 0, 81,
714 127, 86, 82, 58, 118, 115, 0, 0, 0, 120,
715 129, 130, 128, 119, 117, 91, 0, 90, 94, 0,
716 0, 0, 0, 0, 0, 0, 333, 0, 0, 0,
717 0, 6, 5, 2, 3, 4, 7, 332, 0, 400,
718 0, 102, 399, 330, 335, 0, 331, 336, 337, 338,
719 416, 401, 402, 431, 405, 406, 409, 419, 438, 443,
720 450, 461, 466, 469, 472, 475, 478, 481, 486, 495,
721 487, 0, 101, 99, 97, 100, 109, 88, 108, 187,
722 0, 0, 127, 76, 78, 105, 0, 136, 0, 125,
723 123, 0, 116, 0, 0, 410, 400, 336, 338, 407,
724 411, 408, 415, 414, 413, 412, 0, 384, 0, 0,
725 0, 16, 0, 420, 417, 421, 418, 427, 0, 400,
726 0, 180, 0, 184, 0, 0, 0, 0, 0, 95,
727 0, 0, 359, 0, 404, 403, 0, 0, 0, 0,
728 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
729 0, 0, 0, 0, 0, 0, 0, 493, 494, 0,
730 0, 55, 0, 0, 275, 0, 0, 0, 0, 0,
731 0, 0, 0, 333, 0, 220, 0, 8, 400, 0,
732 0, 194, 0, 209, 0, 190, 192, 0, 193, 198,
733 210, 0, 199, 211, 0, 200, 201, 212, 0, 202,
734 0, 213, 203, 288, 0, 214, 215, 216, 218, 217,
735 0, 219, 244, 243, 0, 241, 242, 239, 240, 238,
736 143, 0, 0, 135, 104, 133, 137, 0, 139, 126,
737 124, 122, 121, 132, 131, 346, 341, 0, 383, 373,
738 372, 355, 0, 366, 374, 0, 367, 0, 356, 0,
739 0, 0, 0, 0, 0, 343, 334, 182, 181, 0,
740 345, 340, 385, 0, 363, 395, 0, 344, 339, 361,
741 342, 362, 382, 397, 0, 360, 0, 435, 432, 436,
742 433, 437, 434, 441, 439, 442, 440, 447, 444, 448,
743 445, 449, 446, 457, 452, 459, 454, 456, 451, 458,
744 453, 460, 0, 455, 464, 462, 465, 463, 468, 467,
745 471, 470, 474, 473, 477, 476, 480, 479, 484, 0,
746 0, 489, 488, 227, 228, 226, 246, 0, 310, 0,
747 299, 297, 0, 307, 305, 0, 271, 0, 252, 0,
748 321, 0, 285, 0, 303, 301, 0, 0, 196, 0,
749 0, 223, 221, 0, 0, 189, 191, 195, 317, 400,
750 222, 225, 270, 0, 400, 0, 290, 294, 287, 0,
751 0, 314, 0, 144, 140, 134, 145, 400, 0, 0,
752 0, 141, 391, 392, 0, 378, 379, 0, 375, 368,
753 0, 371, 369, 370, 357, 348, 0, 429, 423, 426,
754 0, 0, 424, 186, 183, 185, 386, 0, 396, 393,
755 0, 398, 394, 351, 0, 483, 0, 247, 0, 311,
756 309, 300, 298, 308, 306, 272, 0, 253, 0, 0,
757 0, 318, 322, 319, 286, 304, 302, 334, 0, 197,
758 229, 0, 0, 0, 291, 0, 279, 0, 0, 316,
759 0, 142, 0, 146, 0, 0, 147, 389, 0, 377,
760 376, 381, 380, 350, 358, 347, 428, 422, 430, 425,
761 365, 364, 387, 0, 352, 353, 485, 482, 248, 0,
762 273, 269, 0, 325, 0, 329, 328, 323, 320, 233,
763 0, 230, 231, 0, 0, 296, 295, 281, 0, 293,
764 0, 315, 0, 0, 148, 0, 0, 390, 349, 388,
765 354, 0, 245, 0, 198, 0, 205, 206, 0, 207,
766 208, 0, 254, 0, 251, 327, 0, 234, 0, 0,
767 232, 0, 0, 280, 0, 313, 312, 0, 149, 0,
768 0, 0, 224, 274, 0, 0, 0, 255, 0, 259,
769 0, 262, 326, 0, 237, 235, 0, 0, 278, 0,
770 0, 0, 150, 0, 249, 0, 0, 268, 265, 266,
771 496, 0, 257, 260, 0, 256, 0, 263, 324, 236,
772 276, 277, 152, 0, 0, 0, 0, 267, 264, 258,
773 151, 0, 0, 0, 0, 283, 0, 250, 282, 0,
774 0, 0
775 };
776
777 static const short yydefgoto[] = { 770,
778 208, 347, 209, 85, 86, 68, 60, 87, 210, 22,
779 23, 24, 8, 9, 10, 11, 12, 13, 14, 15,
780 351, 352, 132, 105, 47, 70, 104, 130, 162, 163,
781 164, 91, 114, 115, 116, 211, 166, 257, 92, 111,
782 179, 180, 136, 183, 395, 168, 169, 170, 171, 399,
783 549, 353, 18, 43, 72, 65, 107, 44, 63, 94,
784 95, 96, 97, 212, 295, 354, 251, 747, 356, 357,
785 358, 359, 684, 360, 361, 362, 363, 687, 364, 365,
786 366, 367, 688, 368, 695, 719, 720, 721, 722, 369,
787 370, 690, 371, 372, 373, 691, 374, 375, 539, 669,
788 670, 376, 377, 378, 379, 380, 381, 382, 602, 603,
789 604, 213, 214, 215, 216, 434, 217, 414, 415, 416,
790 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
791 228, 229, 230, 231, 232, 233, 234, 235, 236, 237,
792 238, 239, 240, 241, 242, 330, 435, 742
793 };
794
795 static const short yypact[] = { 353,
796 -32768,-32768, 325, -41, 376, 398,-32768,-32768, 164, 528,
797 436,-32768,-32768,-32768,-32768, 494,-32768,-32768,-32768,-32768,
798 10,-32768,-32768,-32768, 18,-32768, 297,-32768, 11, 576,
799 -32768,-32768, 445, 598,-32768, -41, 428,-32768,-32768, 690,
800 -32768, 470, -13, -46,-32768, 495, 82,-32768,-32768, -41,
801 612, 328,-32768, 381,-32768, 28,-32768,-32768,-32768,-32768,
802 -36, 1021,-32768, 531, -13,-32768,-32768, 232, 577,-32768,
803 -32768, -13, -46,-32768, 82,-32768,-32768,-32768, 590,-32768,
804 -32768,-32768, 592, 2,-32768,-32768, 170, -7, 916,-32768,
805 -32768, 92,-32768, 1055,-32768,-32768,-32768,-32768,-32768,-32768,
806 -32768,-32768,-32768, 172, 202,-32768, -13,-32768,-32768, 262,
807 -1,-32768, 424, -75,-32768, 504, -1, 9, 86, 278,
808 -32768, 615, 617,-32768,-32768,-32768,-32768, 637, 936,-32768,
809 -32768, 202, 729, 653, 117,-32768,-32768,-32768, 660, 2333,
810 132, 384,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -1,
811 -32768, 655, -1,-32768,-32768, 337, 377,-32768, 417, 916,
812 -32768, 1001,-32768,-32768,-32768,-32768, 47,-32768, 406,-32768,
813 472,-32768,-32768,-32768,-32768,-32768, 667, 903, 551,-32768,
814 -32768,-32768, 442,-32768,-32768,-32768, 460,-32768,-32768, 3080,
815 3145, 3196, 3261, 466, 21, 497,-32768, 3312, 3377, 3428,
816 5442,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 543, 915,
817 99,-32768, 548, 560,-32768, 712,-32768, 770,-32768, 836,
818 888,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 619, 945,
819 1019, 937, 935, 669, 676, 694, 714, 258,-32768,-32768,
820 -32768, 872,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
821 2125, 731, 472,-32768,-32768,-32768, 128, 634, 668,-32768,
822 873, 719,-32768, 585, 721,-32768, 673,-32768,-32768,-32768,
823 -32768,-32768,-32768,-32768,-32768,-32768, 25,-32768, 724, 992,
824 643, 643, 290,-32768,-32768,-32768,-32768,-32768, 746, 962,
825 208,-32768, 654,-32768, 358, 331, 5509, 3493, 622,-32768,
826 427, 3544,-32768, 393,-32768,-32768, 3609, 3660, 3725, 3776,
827 3841, 3892, 3957, 4008, 4073, 4124, 4189, 4240, 525, 4305,
828 4356, 4421, 4472, 4537, 4588, 4653, 2384,-32768,-32768, 4704,
829 510, 415, 416, 4769,-32768, 182, 2449, 13, 418, 426,
830 26, 450, 204, 679, 5741,-32768, -41, 618, 844, 448,
831 827,-32768, 684,-32768, 1785,-32768,-32768, 685,-32768,-32768,
832 -32768, 2193,-32768,-32768, 689,-32768,-32768,-32768, 2193,-32768,
833 2193,-32768,-32768, 5792, 697,-32768,-32768,-32768,-32768,-32768,
834 469,-32768, 702, 711, 888, 947, 965,-32768,-32768,-32768,
835 -32768, 759, 668,-32768,-32768, 728,-32768, 1853, 732,-32768,
836 873,-32768,-32768,-32768,-32768,-32768,-32768, 123, 740,-32768,
837 -32768,-32768, 2500, 643,-32768, 493, 643, 493,-32768, 2565,
838 4820, 166, -30, 2616, 308,-32768, 1180,-32768,-32768, 1645,
839 -32768,-32768,-32768, 781,-32768,-32768, 239,-32768,-32768,-32768,
840 -32768,-32768, 772,-32768, 244,-32768, 5560,-32768,-32768,-32768,
841 -32768,-32768,-32768,-32768, 619,-32768, 619,-32768, 945,-32768,
842 945,-32768, 945,-32768, 1019,-32768, 1019,-32768, 1019,-32768,
843 1019,-32768, 2,-32768,-32768, 937,-32768, 937,-32768, 935,
844 -32768, 669,-32768, 676,-32768, 694,-32768, 714,-32768, 766,
845 784,-32768,-32768,-32768,-32768,-32768,-32768, 4885,-32768, 143,
846 -32768,-32768, 153,-32768,-32768, 180,-32768, 4936,-32768, 5001,
847 -32768, 681,-32768, 5350,-32768,-32768, 235, 242, 783, 2681,
848 620,-32768,-32768, -41, 2732,-32768,-32768,-32768,-32768, 1070,
849 -32768,-32768,-32768, 821, 984, 903,-32768,-32768,-32768, 104,
850 2797,-32768, 5052,-32768, 802,-32768,-32768, 1037, 1921, 812,
851 1989,-32768,-32768,-32768, 5625,-32768,-32768, 259,-32768, 826,
852 295,-32768, 826,-32768,-32768, 202, 61,-32768,-32768,-32768,
853 5117, 817,-32768,-32768,-32768,-32768,-32768, 5168,-32768,-32768,
854 5676,-32768,-32768, 202, 785,-32768, 5233,-32768, 252,-32768,
855 -32768,-32768,-32768,-32768,-32768,-32768, 253,-32768, 845, 471,
856 46, 681,-32768,-32768,-32768,-32768,-32768,-32768, 473, 783,
857 -32768, 941, 122, 851,-32768, 5484,-32768, 5375, 855, 865,
858 867,-32768, 645,-32768, 2057, 2848,-32768,-32768, 792,-32768,
859 -32768,-32768,-32768,-32768,-32768, 202,-32768,-32768,-32768,-32768,
860 -32768,-32768,-32768, 814,-32768, 202,-32768,-32768,-32768, 2259,
861 -32768,-32768, 87,-32768, 788,-32768,-32768,-32768,-32768,-32768,
862 2913,-32768,-32768, 972, 5741,-32768,-32768,-32768, 885, 884,
863 5417,-32768, 206, 478,-32768, 245, 134,-32768,-32768,-32768,
864 -32768, 481,-32768, 931, 934, 2259,-32768,-32768, 2259,-32768,
865 -32768, 897,-32768, 733,-32768, 905, 910,-32768, 1016, 138,
866 -32768, 929, 2193,-32768, 939,-32768,-32768, 2964,-32768, 257,
867 4885, 2193,-32768,-32768, 3029, 167, 5284,-32768, 739,-32768,
868 1484,-32768,-32768, 406,-32768,-32768, 1024, 944,-32768, 2193,
869 273, 150,-32768, 269,-32768, 5375, 948,-32768,-32768,-32768,
870 -32768, 212,-32768,-32768, 1571,-32768, 1717,-32768,-32768,-32768,
871 -32768,-32768,-32768, 276, 2259, 946, 5417,-32768,-32768,-32768,
872 -32768, 974, 2259, 955, 2259,-32768, 2259,-32768,-32768, 1038,
873 1052,-32768
874 };
875
876 static const short yypgoto[] = {-32768,
877 -32768, -58, 14, 737, 4, -99, 674,-32768, -3, 677,
878 -32768, 79,-32768, 1047, 760,-32768, 266,-32768,-32768, 881,
879 7, 23,-32768,-32768, 1007, 997,-32768, -131,-32768, 912,
880 -32768, 281, -121, 928, 431, -195,-32768,-32768, 408, 509,
881 832, -259, -73,-32768,-32768,-32768,-32768,-32768, 918, 686,
882 -32768, 700, -34,-32768,-32768,-32768,-32768, 1040, 508,-32768,
883 1006,-32768,-32768, 500,-32768, -120,-32768, -221, -340,-32768,
884 727, -299, 101, -526,-32768, -325,-32768,-32768,-32768, -336,
885 -32768,-32768,-32768,-32768,-32768,-32768, 389, 391, -666, -300,
886 -32768,-32768,-32768,-32768,-32768,-32768,-32768, -280,-32768, -297,
887 741,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 511,
888 517,-32768,-32768, -31,-32768, -369,-32768, 813, 219, -269,
889 1157, 133, 1187, 279, 423, 486, -20, 569, 607, -419,
890 -32768, 703, 819, 534, 699, 799, 801, 803, 800, 816,
891 -32768, 552, 815, 695,-32768,-32768, -51,-32768
892 };
893
894
895 #define YYLAST 5901
896
897
898 static const short yytable[] = { 21,
899 174, 152, 29, 83, 403, 294, 16, 573, 173, 144,
900 38, 48, 418, 278, 527, 16, 16, 16, 41, 423,
901 425, 278, 17, 138, 139, 406, 511, 93, 76, 355,
902 123, 17, 17, 17, 182, 83, 16, 538, 61, 16,
903 16, 173, 61, 143, 20, 59, 656, 256, 258, 67,
904 567, 134, 17, 64, 748, 17, 17, 16, 88, 93,
905 61, 635, 531, 571, 50, 61, 561, 59, 89, 533,
906 83, 534, 59, 17, 177, 84, 247, 585, 748, 249,
907 42, 62, 25, 27, 90, 88, 146, 693, 243, 120,
908 88, 407, 124, 50, 172, 135, 283, 259, 118, 300,
909 89, 123, 84, 83, 615, -154, 145, 84, 39, 49,
910 40, 50, -155, 279, 52, 54, 90, 184, 57, 262,
911 157, 279, 663, 685, 61, 88, 77, 172, 57, 88,
912 61, 59, 244, 69, 663, 160, 396, 67, 726, 178,
913 157, -103, 84, 590, 560, -103, 84, 563, 291, 243,
914 726, 161, 640, 592, 636, 613, 88, 110, 88, 685,
915 578, 113, 685, -30, 1, 405, 570, 738, 160, 270,
916 272, 274, 276, 84, 88, 84, 551, 285, 287, 393,
917 594, 694, 501, 147, 161, 629, 267, 267, 267, 267,
918 125, 84, 61, 177, 267, 267, 290, -93, -93, 282,
919 110, 113, -289, 616, 515, 177, 706, 2, 426, 281,
920 527, 644, 758, 289, 185, 664, 553, 187, 3, 383,
921 512, 578, 157, 554, 4, 519, 394, 710, 685, 245,
922 5, 727, 101, 578, 576, 606, 685, 578, 685, 579,
923 685, 591, 426, 754, 582, 662, 437, 349, 88, 578,
924 445, 593, 649, 651, 739, 187, 677, 701, 178, 630,
925 88, 61, 7, 557, 348, 84, 119, 20, 67, 649,
926 178, 128, 326, 725, 31, 491, 750, 84, 595, 667,
927 502, 538, 500, -66, 527, 506, 449, 451, 453, 20,
928 419, 700, 524, 518, 304, 632, 129, 45, 31, 759,
929 157, 427, 516, 267, 267, 267, 267, 267, 267, 267,
930 267, 267, 267, 267, 267, 88, 267, 267, 267, 267,
931 267, 267, 267, 383, 686, 19, -66, 625, 71, 350,
932 383, 431, 473, 607, 538, 608, 580, 383, 732, 383,
933 187, 583, 383, 709, 327, 650, 652, 88, -65, 689,
934 683, 349, -28, 1, 133, 733, 631, 409, 530, 46,
935 686, 558, 755, 686, 84, 530, 383, 530, 348, 692,
936 535, 753, 437, 705, 761, 148, 26, 57, 243, 443,
937 536, 74, 420, 384, 246, 689, 531, 348, 689, 533,
938 42, -65, 633, 446, 548, 697, 2, 432, 28, 538,
939 569, 572, 610, 729, 561, 692, 527, 3, 692, 165,
940 20, 348, 735, 4, 503, -317, 497, 267, 507, 5,
941 538, 517, -157, 267, 137, 187, 509, 6, 53, 686,
942 752, -138, -65, 350, 634, -29, 1, 686, 756, 686,
943 350, 686, 165, 46, -32, 1, 589, 350, 522, 350,
944 513, 7, 645, 429, 689, 683, 597, 430, 599, 764,
945 137, 20, 689, 729, 689, 735, 689, 752, 437, 542,
946 58, 654, 250, 660, 692, -65, 350, 524, 660, 2,
947 657, 497, 692, 20, 692, 447, 692, 384, 2, 619,
948 3, 621, -25, -25, 384, 66, 4, 280, 442, 3,
949 157, 384, 5, 384, 679, 4, 384, -317, 498, 252,
950 508, 5, 20, 20, 681, -96, 133, 383, 510, 383,
951 -96, -96, -96, -96, 134, 472, 642, -31, 1, 385,
952 384, 98, 88, -25, 7, 523, 167, 35, -25, -25,
953 -25, 265, 514, 7, -25, 349, 78, 349, -25, 84,
954 638, -96, 707, -96, 36, 20, -96, -96, -96, -96,
955 37, 543, 348, 655, 348, 661, 277, 267, 267, 167,
956 708, 2, 100, 711, 78, -34, 1, 102, 80, 106,
957 20, 81, 20, 267, 383, 402, 383, 201, 4, 561,
958 109, 117, 112, 383, 5, 140, 177, -33, 1, 57,
959 141, 142, 187, 749, 494, 495, 80, 261, 496, 81,
960 20, -35, 1, 702, 131, 149, 20, 151, 383, 2,
961 438, 349, 438, 307, 308, 309, 7, 350, 2, 350,
962 150, 153, 559, 385, 78, 559, 4, 154, 348, 383,
963 385, 2, 5, 296, 263, 438, 530, 385, 301, 385,
964 264, 88, 385, 181, 383, 2, 302, 383, 4, 734,
965 186, 178, 20, 737, 5, 741, 80, 260, 84, 81,
966 20, 383, 4, 386, 7, 20, 385, 20, 5, 322,
967 383, 384, 530, 384, 609, 530, 439, 323, 439, 383,
968 55, 440, 401, 440, 56, 441, 7, 441, 383, 530,
969 20, 57, 20, 350, 383, 20, 324, 20, 530, 674,
970 7, 439, 303, 383, 118, 383, 440, 349, 296, 400,
971 441, 404, 20, 383, 408, 383, 530, 325, 350, 175,
972 20, 383, 397, 383, 348, 383, 387, 99, 20, 413,
973 600, 349, 103, 349, 601, 20, -335, -335, 384, 428,
974 384, 530, 20, 248, 139, -337, -337, 384, 348, 530,
975 348, 530, 398, 530, 350, 297, 586, 350, 30, 298,
976 34, -153, 2, 299, 2, 20, 525, 386, 78, 716,
977 78, 350, 384, 528, 386, 716, 713, 532, 696, 714,
978 350, 386, 51, 386, 717, 541, 386, 20, -335, 350,
979 717, 155, -335, 384, 20, 159, 20, -337, 350, 20,
980 80, -337, 80, 81, 20, 81, 20, 639, 384, 388,
981 386, 384, 176, 350, 391, 350, 546, 385, 718, 385,
982 552, 2, 555, 350, 743, 384, 159, 78, 159, 421,
983 387, 350, 422, 350, 384, 350, 296, 387, 465, 467,
984 469, 471, 544, 384, 387, 762, 387, 389, 264, 387,
985 -491, -491, 384, 766, 581, 768, 78, 769, 384, 80,
986 35, 587, 81, 20, 577, 194, 78, 384, 646, 384,
987 578, 195, 139, 387, 578, 678, 614, 384, 196, 384,
988 32, 578, 197, 37, 385, 384, 385, 384, 80, 384,
989 622, 81, 20, 385, 626, 198, 199, 680, 80, 200,
990 32, 81, 20, 578, 32, 562, 121, 564, 202, 203,
991 204, 205, 561, 388, 206, 207, -492, -492, 385, -15,
992 388, 32, 305, 306, -490, -490, 297, 388, 653, 388,
993 520, 662, 388, 665, 521, 390, 35, 310, 311, 385,
994 320, 321, 78, 671, 315, 316, 317, 318, 672, 35,
995 673, 389, 328, 329, 385, 78, 388, 385, 389, 141,
996 142, 386, 701, 386, 122, 389, 36, 389, 703, 156,
997 389, 385, 37, 616, 80, 78, 712, 81, 20, -204,
998 385, -401, -401, 319, 79, 715, 4, 80, 723, 385,
999 81, 20, 5, 724, 389, -490, -490, 297, 385, -402,
1000 -402, 298, 455, 457, 385, 299, 725, 80, 476, 478,
1001 81, 20, 728, 385, 750, 385, 312, 313, 314, 765,
1002 157, 158, 730, 385, 387, 385, 387, 771, 386, 763,
1003 386, 385, 751, 385, 156, 385, 757, 386, 767, 390,
1004 78, 772, -490, -490, 297, 474, 390, 33, 424, 79,
1005 75, 4, 299, 390, 2, 390, 188, 5, 390, -15,
1006 78, 108, 386, 255, -490, -490, 297, 253, 545, 79,
1007 520, 4, 80, 392, 299, 81, 20, 5, 410, 411,
1008 412, 73, 390, 386, 417, 157, 254, 550, 2, 127,
1009 537, 387, 80, 387, 78, 81, 20, 744, 386, 745,
1010 387, 386, 658, 79, 540, 4, 82, 388, 659, 388,
1011 480, 5, -15, 482, 486, 386, 484, -490, -490, 297,
1012 459, 461, 463, 520, 386, 387, 80, 623, 648, 81,
1013 20, 488, 0, 386, 493, 0, 0, 0, 0, 0,
1014 126, 0, 386, 0, 0, 389, 387, 389, 386, 0,
1015 -490, -490, 297, 0, 0, 0, 298, 386, 0, 386,
1016 521, 387, 0, 0, 387, 0, 0, 386, 0, 386,
1017 0, 0, 0, 0, 388, 386, 388, 386, 387, 386,
1018 0, 0, 0, 388, 0, 0, 0, 387, 0, 0,
1019 0, 0, 0, 0, 0, 0, 387, 0, 0, 0,
1020 0, 0, 0, 0, 0, 387, 0, 0, 388, 0,
1021 0, 387, 389, 0, 389, 0, 0, 0, 0, 78,
1022 387, 389, 387, 0, 0, 0, 0, 0, 194, 388,
1023 387, 0, 387, 390, 195, 390, 0, 0, 387, 0,
1024 387, 196, 387, 0, 388, 197, 389, 388, 0, 0,
1025 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1026 0, 388, 200, 0, 0, 0, 0, 389, 0, 0,
1027 388, 202, 203, 204, 205, 0, 0, 206, 207, 388,
1028 0, 0, 389, 0, 0, 389, 0, 0, 388, 0,
1029 0, 0, 0, 0, 388, 0, 0, 0, 0, 389,
1030 390, 0, 390, 388, 0, 388, 0, 0, 389, 390,
1031 0, 0, 0, 388, 0, 388, 0, 389, 0, 0,
1032 0, 388, 0, 388, 0, 388, 389, 0, 0, 0,
1033 0, 0, 389, 0, 390, 0, 268, 268, 268, 268,
1034 0, 389, 0, 389, 268, 268, 0, 0, 0, 0,
1035 0, 389, 0, 389, 0, 390, 0, 0, 0, 389,
1036 0, 389, 0, 389, 0, 0, 269, 269, 269, 269,
1037 390, 0, 0, 390, 269, 269, 0, 0, 0, 0,
1038 0, 0, 0, 0, 0, 0, 0, 390, 0, 0,
1039 0, 0, 0, 0, 0, 0, 390, 0, 0, 0,
1040 0, 0, 0, 0, 0, 390, 0, 0, 0, 0,
1041 0, 0, 0, 0, 390, 0, 0, 0, 0, 0,
1042 390, 0, 0, 0, 0, 0, 0, 0, 0, 390,
1043 0, 390, 0, 0, 0, 0, 0, 0, 0, 390,
1044 0, 390, 0, 0, 0, 0, 0, 390, 0, 390,
1045 0, 390, 0, 268, 268, 268, 268, 268, 268, 268,
1046 268, 268, 268, 268, 268, 0, 268, 268, 268, 268,
1047 268, 268, 268, 0, 331, 0, 0, 0, 0, 0,
1048 0, 0, 0, 269, 269, 269, 269, 269, 269, 269,
1049 269, 269, 269, 269, 269, 0, 269, 269, 269, 269,
1050 269, 269, 269, 0, 0, 0, 0, 0, 0, 0,
1051 0, 0, 0, 0, 0, 0, 0, 332, 192, 193,
1052 716, 333, 334, 78, 335, 0, 0, 336, 0, 0,
1053 0, 337, 194, 0, 0, 717, 0, 0, 338, 339,
1054 5, 340, 0, 341, 342, 196, 343, 0, 0, 344,
1055 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1056 0, 331, 0, 0, 0, 0, 345, 268, 157, 746,
1057 0, 0, 346, 268, 0, 202, 203, 204, 205, 0,
1058 0, 206, 207, 0, 0, 0, 0, 0, 0, 0,
1059 0, 0, 0, 0, 0, 0, 0, 269, 0, 0,
1060 0, 0, 0, 269, 332, 192, 193, 716, 333, 334,
1061 78, 335, 0, 0, 336, 0, 0, 0, 337, 194,
1062 0, 0, 717, 0, 0, 338, 339, 5, 340, 0,
1063 341, 342, 196, 343, 0, 574, 344, 190, 191, 0,
1064 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
1065 0, 0, 0, 345, 0, 157, 760, 0, 0, 346,
1066 0, 0, 202, 203, 204, 205, 0, 0, 206, 207,
1067 0, 0, 0, 0, 0, 0, 0, 0, 0, 192,
1068 193, 0, 0, 0, 78, 0, 0, 0, 0, 0,
1069 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1070 0, 0, 0, 0, 0, 0, 196, 331, 0, 0,
1071 197, 0, 0, 0, 0, 0, 80, 268, 268, 81,
1072 20, 0, 0, 198, 199, 0, 0, 200, 0, 201,
1073 575, 0, 0, 268, 0, 0, 202, 203, 204, 205,
1074 0, 0, 206, 207, 0, 0, 0, 269, 269, 0,
1075 332, 192, 193, -261, 333, 334, 78, 335, 0, 0,
1076 336, 0, 0, 269, 337, 194, 0, 0, -261, 0,
1077 0, 338, 339, 5, 340, 331, 341, 342, 196, 343,
1078 0, 0, 344, 0, 0, 0, 0, 0, 80, 0,
1079 0, 81, 20, 0, 0, 0, 0, 0, 0, 345,
1080 0, 157, -261, 0, 0, 346, 0, 0, 202, 203,
1081 204, 205, 0, 0, 206, 207, 0, 0, 332, 192,
1082 193, 0, 333, 334, 78, 335, 0, 0, 336, 0,
1083 0, 0, 337, 194, 0, 0, 0, 0, 0, 338,
1084 339, 5, 340, 331, 341, 342, 196, 343, 0, 0,
1085 344, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1086 20, 0, 0, 0, 0, 0, 0, 345, 0, 157,
1087 526, 0, 0, 346, 0, 0, 202, 203, 204, 205,
1088 0, 0, 206, 207, 0, 0, 332, 192, 193, 0,
1089 333, 334, 78, 335, 0, 0, 336, 0, 0, 0,
1090 337, 194, 0, 0, 0, 0, 0, 338, 339, 5,
1091 340, 331, 341, 342, 196, 343, 0, 0, 344, 0,
1092 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1093 0, 0, 0, 0, 0, 345, 0, 157, 547, 0,
1094 0, 346, 0, 0, 202, 203, 204, 205, 0, 0,
1095 206, 207, 0, 0, 332, 192, 193, 0, 333, 334,
1096 78, 335, 0, 0, 336, 0, 0, 0, 337, 194,
1097 0, 0, 0, 0, 0, 338, 339, 5, 340, 331,
1098 341, 342, 196, 343, 0, 0, 344, 0, 0, 0,
1099 0, 0, 80, 0, 0, 81, 20, 0, 0, 0,
1100 0, 0, 0, 345, 0, 157, 624, 0, 0, 346,
1101 0, 0, 202, 203, 204, 205, 0, 0, 206, 207,
1102 0, 0, 332, 192, 193, 0, 333, 334, 78, 335,
1103 0, 0, 336, 0, 0, 0, 337, 194, 0, 0,
1104 0, 0, 0, 338, 339, 5, 340, 331, 341, 342,
1105 196, 343, 0, 0, 344, 0, 0, 0, 0, 0,
1106 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
1107 0, 345, 0, 157, 627, 0, 0, 346, 0, 0,
1108 202, 203, 204, 205, 0, 0, 206, 207, 0, 0,
1109 332, 192, 193, 0, 333, 334, 78, 335, 0, 0,
1110 336, 0, 0, 0, 337, 194, 0, 0, 0, 0,
1111 0, 338, 339, 5, 340, 331, 341, 342, 196, 343,
1112 0, 0, 344, 0, 0, 0, 0, 0, 80, 0,
1113 0, 81, 20, 0, 0, 0, 0, 0, 0, 345,
1114 0, 157, 675, 0, 0, 346, 0, 0, 202, 203,
1115 204, 205, 0, 0, 206, 207, 0, 0, 332, 192,
1116 193, 0, 333, 334, 78, 335, 0, 0, 336, 0,
1117 0, 0, 337, 194, 0, 0, 0, 0, 0, 338,
1118 339, 5, 340, 331, 341, 342, 196, 343, 0, 0,
1119 344, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1120 20, 0, 0, 0, 0, 0, 0, 345, 0, 157,
1121 0, 0, 0, 346, 0, 0, 202, 203, 204, 205,
1122 0, 0, 206, 207, 0, 0, 529, 192, 193, 0,
1123 333, 334, 78, 335, 0, 0, 336, 0, 0, 0,
1124 337, 194, 0, 0, 0, 0, 0, 338, 339, 331,
1125 340, 0, 341, 342, 196, 343, 0, 0, 344, 0,
1126 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1127 0, 0, 0, 0, 0, 345, 0, 157, 0, 0,
1128 0, 346, 0, 0, 202, 203, 204, 205, 0, 0,
1129 206, 207, 529, 192, 193, 0, 682, 334, 78, 335,
1130 0, 0, 336, 0, 0, 0, 337, 194, 0, 0,
1131 0, 0, 0, 338, 339, 0, 340, 0, 341, 342,
1132 196, 343, 0, 189, 344, 190, 191, 0, 0, 0,
1133 80, 0, 0, 81, 20, 0, 0, 0, 0, 0,
1134 0, 345, 0, 157, 0, 0, 0, 346, 0, 0,
1135 202, 203, 204, 205, 0, 0, 206, 207, 0, 0,
1136 0, 0, 0, 0, 0, 0, 0, 192, 193, 0,
1137 0, 0, 78, 0, 489, 0, 190, 191, 0, 0,
1138 0, 194, 0, 0, 0, 0, 0, 195, 0, 0,
1139 0, 0, 0, 0, 196, 0, 0, 0, 197, 0,
1140 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1141 0, 198, 199, 0, 0, 200, 0, 201, 192, 193,
1142 0, 0, 0, 78, 202, 203, 204, 205, 0, 0,
1143 206, 207, 194, 0, 0, 0, 0, 0, 195, 504,
1144 0, 190, 191, 0, 0, 196, 0, 0, 0, 197,
1145 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1146 0, 490, 198, 199, 0, 0, 200, 0, 0, 0,
1147 0, 0, 0, 0, 0, 202, 203, 204, 205, 0,
1148 0, 206, 207, 192, 193, 0, 0, 0, 78, 0,
1149 556, 0, 190, 191, 0, 0, 0, 194, 0, 0,
1150 0, 0, 0, 195, 0, 0, 0, 0, 0, 0,
1151 196, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1152 80, 0, 0, 81, 20, 0, 0, 198, 199, 0,
1153 0, 200, 0, 0, 192, 193, 0, 505, 0, 78,
1154 202, 203, 204, 205, 0, 0, 206, 207, 194, 0,
1155 0, 0, 0, 0, 195, 565, 0, 190, 191, 0,
1156 0, 196, 0, 0, 0, 197, 0, 0, 0, 0,
1157 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1158 0, 0, 200, 0, 0, 0, 0, 557, 0, 0,
1159 0, 202, 203, 204, 205, 0, 0, 206, 207, 192,
1160 193, 0, 0, 0, 78, 0, 436, 0, 190, 191,
1161 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1162 0, 0, 0, 0, 0, 0, 196, 0, 0, 0,
1163 197, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1164 20, 0, 0, 198, 199, 0, 0, 200, 566, 0,
1165 192, 193, 0, 0, 0, 78, 202, 203, 204, 205,
1166 0, 0, 206, 207, 194, 0, 0, 0, 0, 0,
1167 195, 436, 0, 190, 191, 0, 0, 196, 0, 0,
1168 0, 197, 0, 0, 0, 0, 0, 80, 0, 0,
1169 81, 20, 0, 0, 198, 199, 0, 0, 200, 0,
1170 0, 0, 0, 557, 0, 0, 0, 202, 203, 204,
1171 205, 0, 0, 206, 207, 192, 193, 0, 0, 0,
1172 78, 0, 611, 0, 190, 191, 0, 0, 0, 194,
1173 0, 0, 0, 0, 0, 195, 0, 0, 0, 0,
1174 0, 0, 196, 0, 0, 0, 197, 0, 0, 0,
1175 0, 0, 80, 0, 0, 81, 20, 0, 0, 198,
1176 199, 0, 0, 200, 0, 0, 192, 193, 148, 0,
1177 0, 78, 202, 203, 204, 205, 0, 0, 206, 207,
1178 194, 0, 0, 0, 0, 0, 195, 617, 0, 190,
1179 191, 0, 0, 196, 0, 0, 0, 197, 0, 0,
1180 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1181 198, 199, 0, 0, 200, 612, 0, 0, 0, 0,
1182 0, 0, 0, 202, 203, 204, 205, 0, 0, 206,
1183 207, 192, 193, 0, 0, 0, 78, 0, 611, 0,
1184 190, 191, 0, 0, 0, 194, 0, 0, 0, 0,
1185 0, 195, 0, 0, 0, 0, 0, 0, 196, 0,
1186 0, 0, 197, 0, 0, 0, 0, 0, 80, 0,
1187 0, 81, 20, 0, 0, 198, 199, 0, 0, 200,
1188 0, 0, 192, 193, 0, 618, 0, 78, 202, 203,
1189 204, 205, 0, 0, 206, 207, 194, 0, 0, 0,
1190 0, 0, 195, 698, 0, 190, 191, 0, 0, 196,
1191 0, 0, 0, 197, 0, 0, 0, 0, 0, 80,
1192 0, 0, 81, 20, 0, 0, 198, 199, 0, 0,
1193 200, 676, 0, 0, 0, 0, 0, 0, 0, 202,
1194 203, 204, 205, 0, 0, 206, 207, 192, 193, 0,
1195 0, 0, 78, 0, 698, 0, 190, 191, 0, 0,
1196 0, 194, 0, 0, 0, 0, 0, 195, 0, 0,
1197 0, 0, 0, 0, 196, 0, 0, 0, 197, 0,
1198 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1199 0, 198, 199, 0, 0, 200, 699, 0, 192, 193,
1200 0, 0, 0, 78, 202, 203, 204, 205, 0, 0,
1201 206, 207, 194, 0, 0, 0, 0, 0, 195, 617,
1202 0, 190, 191, 0, 0, 196, 0, 0, 0, 197,
1203 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1204 0, 0, 198, 199, 0, 0, 200, 731, 0, 0,
1205 0, 0, 0, 0, 0, 202, 203, 204, 205, 0,
1206 0, 206, 207, 192, 193, 0, 0, 0, 78, 0,
1207 266, 0, 190, 191, 0, 0, 0, 194, 0, 0,
1208 0, 0, 0, 195, 0, 0, 0, 0, 0, 0,
1209 196, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1210 80, 0, 0, 81, 20, 0, 0, 198, 199, 0,
1211 0, 200, 0, 0, 192, 193, 0, 736, 0, 78,
1212 202, 203, 204, 205, 0, 0, 206, 207, 194, 0,
1213 0, 0, 0, 0, 195, 271, 0, 190, 191, 0,
1214 0, 196, 0, 0, 0, 197, 0, 0, 0, 0,
1215 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1216 0, 0, 200, 0, 0, 0, 0, 0, 0, 0,
1217 0, 202, 203, 204, 205, 0, 0, 206, 207, 192,
1218 193, 0, 0, 0, 78, 0, 273, 0, 190, 191,
1219 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1220 0, 0, 0, 0, 0, 0, 196, 0, 0, 0,
1221 197, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1222 20, 0, 0, 198, 199, 0, 0, 200, 0, 0,
1223 192, 193, 0, 0, 0, 78, 202, 203, 204, 205,
1224 0, 0, 206, 207, 194, 0, 0, 0, 0, 0,
1225 195, 275, 0, 190, 191, 0, 0, 196, 0, 0,
1226 0, 197, 0, 0, 0, 0, 0, 80, 0, 0,
1227 81, 20, 0, 0, 198, 199, 0, 0, 200, 0,
1228 0, 0, 0, 0, 0, 0, 0, 202, 203, 204,
1229 205, 0, 0, 206, 207, 192, 193, 0, 0, 0,
1230 78, 0, 284, 0, 190, 191, 0, 0, 0, 194,
1231 0, 0, 0, 0, 0, 195, 0, 0, 0, 0,
1232 0, 0, 196, 0, 0, 0, 197, 0, 0, 0,
1233 0, 0, 80, 0, 0, 81, 20, 0, 0, 198,
1234 199, 0, 0, 200, 0, 0, 192, 193, 0, 0,
1235 0, 78, 202, 203, 204, 205, 0, 0, 206, 207,
1236 194, 0, 0, 0, 0, 0, 195, 286, 0, 190,
1237 191, 0, 0, 196, 0, 0, 0, 197, 0, 0,
1238 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1239 198, 199, 0, 0, 200, 0, 0, 0, 0, 0,
1240 0, 0, 0, 202, 203, 204, 205, 0, 0, 206,
1241 207, 192, 193, 0, 0, 0, 78, 0, 288, 0,
1242 190, 191, 0, 0, 0, 194, 0, 0, 0, 0,
1243 0, 195, 0, 0, 0, 0, 0, 0, 196, 0,
1244 0, 0, 197, 0, 0, 0, 0, 0, 80, 0,
1245 0, 81, 20, 0, 0, 198, 199, 0, 0, 200,
1246 0, 0, 192, 193, 0, 0, 0, 78, 202, 203,
1247 204, 205, 0, 0, 206, 207, 194, 0, 0, 0,
1248 0, 0, 195, 436, 0, 190, 191, 0, 0, 196,
1249 0, 0, 0, 197, 0, 0, 0, 0, 0, 80,
1250 0, 0, 81, 20, 0, 0, 198, 199, 0, 0,
1251 200, 0, 0, 0, 0, 0, 0, 0, 0, 202,
1252 203, 204, 205, 0, 0, 206, 207, 192, 193, 0,
1253 0, 0, 78, 0, 444, 0, 190, 191, 0, 0,
1254 0, 194, 0, 0, 0, 0, 0, 195, 0, 0,
1255 0, 0, 0, 0, 196, 0, 0, 0, 197, 0,
1256 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1257 0, 198, 199, 0, 0, 200, 0, 0, 192, 193,
1258 0, 0, 0, 78, 202, 203, 204, 205, 0, 0,
1259 206, 207, 194, 0, 0, 0, 0, 0, 195, 448,
1260 0, 190, 191, 0, 0, 196, 0, 0, 0, 197,
1261 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1262 0, 0, 198, 199, 0, 0, 200, 0, 0, 0,
1263 0, 0, 0, 0, 0, 202, 203, 204, 205, 0,
1264 0, 206, 207, 192, 193, 0, 0, 0, 78, 0,
1265 450, 0, 190, 191, 0, 0, 0, 194, 0, 0,
1266 0, 0, 0, 195, 0, 0, 0, 0, 0, 0,
1267 196, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1268 80, 0, 0, 81, 20, 0, 0, 198, 199, 0,
1269 0, 200, 0, 0, 192, 193, 0, 0, 0, 78,
1270 202, 203, 204, 205, 0, 0, 206, 207, 194, 0,
1271 0, 0, 0, 0, 195, 452, 0, 190, 191, 0,
1272 0, 196, 0, 0, 0, 197, 0, 0, 0, 0,
1273 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1274 0, 0, 200, 0, 0, 0, 0, 0, 0, 0,
1275 0, 202, 203, 204, 205, 0, 0, 206, 207, 192,
1276 193, 0, 0, 0, 78, 0, 454, 0, 190, 191,
1277 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1278 0, 0, 0, 0, 0, 0, 196, 0, 0, 0,
1279 197, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1280 20, 0, 0, 198, 199, 0, 0, 200, 0, 0,
1281 192, 193, 0, 0, 0, 78, 202, 203, 204, 205,
1282 0, 0, 206, 207, 194, 0, 0, 0, 0, 0,
1283 195, 456, 0, 190, 191, 0, 0, 196, 0, 0,
1284 0, 197, 0, 0, 0, 0, 0, 80, 0, 0,
1285 81, 20, 0, 0, 198, 199, 0, 0, 200, 0,
1286 0, 0, 0, 0, 0, 0, 0, 202, 203, 204,
1287 205, 0, 0, 206, 207, 192, 193, 0, 0, 0,
1288 78, 0, 458, 0, 190, 191, 0, 0, 0, 194,
1289 0, 0, 0, 0, 0, 195, 0, 0, 0, 0,
1290 0, 0, 196, 0, 0, 0, 197, 0, 0, 0,
1291 0, 0, 80, 0, 0, 81, 20, 0, 0, 198,
1292 199, 0, 0, 200, 0, 0, 192, 193, 0, 0,
1293 0, 78, 202, 203, 204, 205, 0, 0, 206, 207,
1294 194, 0, 0, 0, 0, 0, 195, 460, 0, 190,
1295 191, 0, 0, 196, 0, 0, 0, 197, 0, 0,
1296 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1297 198, 199, 0, 0, 200, 0, 0, 0, 0, 0,
1298 0, 0, 0, 202, 203, 204, 205, 0, 0, 206,
1299 207, 192, 193, 0, 0, 0, 78, 0, 462, 0,
1300 190, 191, 0, 0, 0, 194, 0, 0, 0, 0,
1301 0, 195, 0, 0, 0, 0, 0, 0, 196, 0,
1302 0, 0, 197, 0, 0, 0, 0, 0, 80, 0,
1303 0, 81, 20, 0, 0, 198, 199, 0, 0, 200,
1304 0, 0, 192, 193, 0, 0, 0, 78, 202, 203,
1305 204, 205, 0, 0, 206, 207, 194, 0, 0, 0,
1306 0, 0, 195, 464, 0, 190, 191, 0, 0, 196,
1307 0, 0, 0, 197, 0, 0, 0, 0, 0, 80,
1308 0, 0, 81, 20, 0, 0, 198, 199, 0, 0,
1309 200, 0, 0, 0, 0, 0, 0, 0, 0, 202,
1310 203, 204, 205, 0, 0, 206, 207, 192, 193, 0,
1311 0, 0, 78, 0, 466, 0, 190, 191, 0, 0,
1312 0, 194, 0, 0, 0, 0, 0, 195, 0, 0,
1313 0, 0, 0, 0, 196, 0, 0, 0, 197, 0,
1314 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1315 0, 198, 199, 0, 0, 200, 0, 0, 192, 193,
1316 0, 0, 0, 78, 202, 203, 204, 205, 0, 0,
1317 206, 207, 194, 0, 0, 0, 0, 0, 195, 468,
1318 0, 190, 191, 0, 0, 196, 0, 0, 0, 197,
1319 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1320 0, 0, 198, 199, 0, 0, 200, 0, 0, 0,
1321 0, 0, 0, 0, 0, 202, 203, 204, 205, 0,
1322 0, 206, 207, 192, 193, 0, 0, 0, 78, 0,
1323 470, 0, 190, 191, 0, 0, 0, 194, 0, 0,
1324 0, 0, 0, 195, 0, 0, 0, 0, 0, 0,
1325 196, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1326 80, 0, 0, 81, 20, 0, 0, 198, 199, 0,
1327 0, 200, 0, 0, 192, 193, 0, 0, 0, 78,
1328 202, 203, 204, 205, 0, 0, 206, 207, 194, 0,
1329 0, 0, 0, 0, 195, 475, 0, 190, 191, 0,
1330 0, 196, 0, 0, 0, 197, 0, 0, 0, 0,
1331 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1332 0, 0, 200, 0, 0, 0, 0, 0, 0, 0,
1333 0, 202, 203, 204, 205, 0, 0, 206, 207, 192,
1334 193, 0, 0, 0, 78, 0, 477, 0, 190, 191,
1335 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1336 0, 0, 0, 0, 0, 0, 196, 0, 0, 0,
1337 197, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1338 20, 0, 0, 198, 199, 0, 0, 200, 0, 0,
1339 192, 193, 0, 0, 0, 78, 202, 203, 204, 205,
1340 0, 0, 206, 207, 194, 0, 0, 0, 0, 0,
1341 195, 479, 0, 190, 191, 0, 0, 196, 0, 0,
1342 0, 197, 0, 0, 0, 0, 0, 80, 0, 0,
1343 81, 20, 0, 0, 198, 199, 0, 0, 200, 0,
1344 0, 0, 0, 0, 0, 0, 0, 202, 203, 204,
1345 205, 0, 0, 206, 207, 192, 193, 0, 0, 0,
1346 78, 0, 481, 0, 190, 191, 0, 0, 0, 194,
1347 0, 0, 0, 0, 0, 195, 0, 0, 0, 0,
1348 0, 0, 196, 0, 0, 0, 197, 0, 0, 0,
1349 0, 0, 80, 0, 0, 81, 20, 0, 0, 198,
1350 199, 0, 0, 200, 0, 0, 192, 193, 0, 0,
1351 0, 78, 202, 203, 204, 205, 0, 0, 206, 207,
1352 194, 0, 0, 0, 0, 0, 195, 483, 0, 190,
1353 191, 0, 0, 196, 0, 0, 0, 197, 0, 0,
1354 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1355 198, 199, 0, 0, 200, 0, 0, 0, 0, 0,
1356 0, 0, 0, 202, 203, 204, 205, 0, 0, 206,
1357 207, 192, 193, 0, 0, 0, 78, 0, 485, 0,
1358 190, 191, 0, 0, 0, 194, 0, 0, 0, 0,
1359 0, 195, 0, 0, 0, 0, 0, 0, 196, 0,
1360 0, 0, 197, 0, 0, 0, 0, 0, 80, 0,
1361 0, 81, 20, 0, 0, 198, 199, 0, 0, 200,
1362 0, 0, 192, 193, 0, 0, 0, 78, 202, 203,
1363 204, 205, 0, 0, 206, 207, 194, 0, 0, 0,
1364 0, 0, 195, 487, 0, 190, 191, 0, 0, 196,
1365 0, 0, 0, 197, 0, 0, 0, 0, 0, 80,
1366 0, 0, 81, 20, 0, 0, 198, 199, 0, 0,
1367 200, 0, 0, 0, 0, 0, 0, 0, 0, 202,
1368 203, 204, 205, 0, 0, 206, 207, 192, 193, 0,
1369 0, 0, 78, 0, 492, 0, 190, 191, 0, 0,
1370 0, 194, 0, 0, 0, 0, 0, 195, 0, 0,
1371 0, 0, 0, 0, 196, 0, 0, 0, 197, 0,
1372 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1373 0, 198, 199, 0, 0, 200, 0, 0, 192, 193,
1374 0, 0, 0, 78, 202, 203, 204, 205, 0, 0,
1375 206, 207, 194, 0, 0, 0, 0, 0, 195, 499,
1376 0, 190, 191, 0, 0, 196, 0, 0, 0, 197,
1377 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1378 0, 0, 198, 199, 0, 0, 200, 0, 0, 0,
1379 0, 0, 0, 0, 0, 202, 203, 204, 205, 0,
1380 0, 206, 207, 192, 193, 0, 0, 0, 78, 0,
1381 568, 0, 190, 191, 0, 0, 0, 194, 0, 0,
1382 0, 0, 0, 195, 0, 0, 0, 0, 0, 0,
1383 196, 0, 0, 0, 197, 0, 0, 0, 0, 0,
1384 80, 0, 0, 81, 20, 0, 0, 198, 199, 0,
1385 0, 200, 0, 0, 192, 193, 0, 0, 0, 78,
1386 202, 203, 204, 205, 0, 0, 206, 207, 194, 0,
1387 0, 0, 0, 0, 195, 588, 0, 190, 191, 0,
1388 0, 196, 0, 0, 0, 197, 0, 0, 0, 0,
1389 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1390 0, 0, 200, 0, 0, 0, 0, 0, 0, 0,
1391 0, 202, 203, 204, 205, 0, 0, 206, 207, 192,
1392 193, 0, 0, 0, 78, 0, 596, 0, 190, 191,
1393 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1394 0, 0, 0, 0, 0, 0, 196, 0, 0, 0,
1395 197, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1396 20, 0, 0, 198, 199, 0, 0, 200, 0, 0,
1397 192, 193, 0, 0, 0, 78, 202, 203, 204, 205,
1398 0, 0, 206, 207, 194, 0, 0, 0, 0, 0,
1399 195, 598, 0, 190, 191, 0, 0, 196, 0, 0,
1400 0, 197, 0, 0, 0, 0, 0, 80, 0, 0,
1401 81, 20, 0, 0, 198, 199, 0, 0, 200, 0,
1402 0, 0, 0, 0, 0, 0, 0, 202, 203, 204,
1403 205, 0, 0, 206, 207, 192, 193, 0, 0, 0,
1404 78, 0, 620, 0, 190, 191, 0, 0, 0, 194,
1405 0, 0, 0, 0, 0, 195, 0, 0, 0, 0,
1406 0, 0, 196, 0, 0, 0, 197, 0, 0, 0,
1407 0, 0, 80, 0, 0, 81, 20, 0, 0, 198,
1408 199, 0, 0, 200, 0, 0, 192, 193, 0, 0,
1409 0, 78, 202, 203, 204, 205, 0, 0, 206, 207,
1410 194, 0, 0, 0, 0, 0, 195, 637, 0, 190,
1411 191, 0, 0, 196, 0, 0, 0, 197, 0, 0,
1412 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1413 198, 199, 0, 0, 200, 0, 0, 0, 0, 0,
1414 0, 0, 0, 202, 203, 204, 205, 0, 0, 206,
1415 207, 192, 193, 0, 0, 0, 78, 0, 641, 0,
1416 190, 191, 0, 0, 0, 194, 0, 0, 0, 0,
1417 0, 195, 0, 0, 0, 0, 0, 0, 196, 0,
1418 0, 0, 197, 0, 0, 0, 0, 0, 80, 0,
1419 0, 81, 20, 0, 0, 198, 199, 0, 0, 200,
1420 0, 0, 192, 193, 0, 0, 0, 78, 202, 203,
1421 204, 205, 0, 0, 206, 207, 194, 0, 0, 0,
1422 0, 0, 195, 647, 0, 190, 191, 0, 0, 196,
1423 0, 0, 0, 197, 0, 0, 0, 0, 0, 80,
1424 0, 0, 81, 20, 0, 0, 198, 199, 0, 0,
1425 200, 0, 0, 0, 0, 0, 0, 0, 0, 202,
1426 203, 204, 205, 0, 0, 206, 207, 192, 193, 0,
1427 0, 0, 78, 0, 740, 0, 190, 191, 0, 0,
1428 0, 194, 0, 0, 0, 0, 0, 195, 0, 0,
1429 0, 0, 0, 0, 196, 0, 0, 0, 197, 0,
1430 0, 0, 0, 0, 80, 0, 0, 81, 20, 0,
1431 0, 198, 199, 0, 0, 200, 0, 0, 192, 193,
1432 0, 0, 0, 78, 202, 203, 204, 205, 0, 0,
1433 206, 207, 194, 0, 0, 0, 0, 0, 195, 0,
1434 605, 0, 0, 0, 0, 196, 0, 0, 0, 197,
1435 0, 0, 0, 0, 0, 80, 0, 0, 81, 20,
1436 0, 0, 198, 199, 0, 668, 200, 0, 0, 0,
1437 0, 0, 0, 0, 0, 202, 203, 204, 205, 0,
1438 0, 206, 207, -284, -284, -284, 0, 0, 0, -284,
1439 0, 0, 0, 0, 0, 0, 0, 0, -284, 0,
1440 0, 0, 0, 0, -284, 0, 0, 704, 0, 192,
1441 193, -284, 0, 0, 78, -284, 0, 0, 0, 0,
1442 0, -284, 0, 194, -284, -284, 0, 0, 0, 195,
1443 0, 0, -284, 0, 190, 191, 196, 0, -284, 0,
1444 197, -284, -284, -284, -284, 0, 80, -284, -284, 81,
1445 20, 192, 193, 0, 0, 0, 78, 345, -292, 0,
1446 0, 0, 0, 0, 0, 194, 202, 203, 204, 205,
1447 0, 195, 206, 207, 666, 0, 192, 193, 196, 0,
1448 0, 78, 197, 0, 0, 0, 0, 0, 80, 0,
1449 194, 81, 20, 0, 0, 0, 195, 0, 0, 345,
1450 -292, 190, 191, 196, 0, 0, 0, 197, 202, 203,
1451 204, 205, 0, 80, 206, 207, 81, 20, 192, 193,
1452 198, 199, 0, 78, 200, 0, 201, 292, 0, 0,
1453 0, 293, 194, 202, 203, 204, 205, 0, 195, 206,
1454 207, 0, 0, 192, 193, 196, 0, 0, 78, 197,
1455 0, 0, 190, 191, 0, 80, 0, 194, 81, 20,
1456 0, 0, 0, 195, 0, 0, 345, 0, 0, 0,
1457 196, 0, 0, 0, 197, 202, 203, 204, 205, 0,
1458 80, 206, 207, 81, 20, 0, 0, 198, 199, 0,
1459 0, 200, 433, 0, 192, 193, 0, 0, 0, 78,
1460 202, 203, 204, 205, 0, 0, 206, 207, 194, 0,
1461 0, 0, 0, 0, 195, 0, 0, 190, 191, 0,
1462 0, 196, 0, 0, 0, 197, 0, 0, 0, 0,
1463 0, 80, 0, 0, 81, 20, 0, 0, 198, 199,
1464 0, 0, 200, 584, 0, 0, 0, 0, 0, 0,
1465 0, 202, 203, 204, 205, 0, 0, 206, 207, 192,
1466 193, 0, 0, 0, 78, 0, 0, 0, 190, 191,
1467 0, 0, 0, 194, 0, 0, 0, 0, 0, 195,
1468 0, 0, 0, 0, 0, 0, 196, 0, 0, 0,
1469 197, 0, 0, 0, 0, 0, 80, 0, 0, 81,
1470 20, 0, 0, 198, 199, 0, 0, 200, 628, 0,
1471 192, 193, 0, 0, 0, 78, 202, 203, 204, 205,
1472 0, 0, 206, 207, 194, 0, 0, 0, 0, 0,
1473 195, 0, 0, 190, 191, 0, 0, 196, 0, 0,
1474 0, 197, 0, 0, 0, 0, 0, 80, 0, 0,
1475 81, 20, 0, 0, 198, 199, 0, 0, 200, 643,
1476 0, 0, 0, 0, 0, 0, 0, 202, 203, 204,
1477 205, 0, 0, 206, 207, 192, 193, 0, 0, 0,
1478 78, 0, 0, 0, 0, 0, 0, 0, 0, 194,
1479 0, 0, 0, 0, 0, 195, 0, 0, 0, 0,
1480 0, 0, 196, 0, 0, 0, 197, 0, 0, 0,
1481 0, 0, 80, 0, 0, 81, 20, 0, 0, 198,
1482 199, 0, 0, 200, 0, 2, 192, 193, 0, 0,
1483 0, 78, 202, 203, 204, 205, 0, 0, 206, 207,
1484 194, 0, 0, 0, 0, 0, 195, 0, 0, 0,
1485 0, 0, 0, 196, 0, 0, 0, 197, 0, 0,
1486 0, 0, 0, 80, 0, 0, 81, 20, 0, 0,
1487 0, 0, 0, 0, 345, 0, 0, 0, 0, 0,
1488 0, 0, 0, 202, 203, 204, 205, 0, 0, 206,
1489 207
1490 };
1491
1492 static const short yycheck[] = { 3,
1493 132, 123, 6, 62, 264, 201, 0, 427, 129, 1,
1494 1, 1, 282, 1, 355, 9, 10, 11, 1, 289,
1495 290, 1, 0, 99, 100, 1, 1, 62, 1, 251,
1496 89, 9, 10, 11, 134, 94, 30, 374, 42, 33,
1497 34, 162, 46, 117, 86, 42, 1, 1, 169, 46,
1498 420, 53, 30, 100, 721, 33, 34, 51, 62, 94,
1499 64, 1, 362, 94, 101, 69, 97, 64, 62, 369,
1500 129, 371, 69, 51, 133, 62, 150, 447, 745, 153,
1501 63, 95, 4, 5, 62, 89, 1, 1, 140, 97,
1502 94, 67, 1, 101, 129, 97, 196, 171, 97, 1,
1503 94, 160, 89, 162, 1, 93, 98, 94, 99, 99,
1504 101, 101, 95, 101, 36, 37, 94, 1, 40, 178,
1505 95, 101, 1, 650, 128, 129, 99, 162, 50, 133,
1506 134, 128, 1, 52, 1, 129, 257, 134, 1, 133,
1507 95, 95, 129, 1, 414, 99, 133, 417, 200, 201,
1508 1, 129, 572, 1, 94, 525, 160, 79, 162, 686,
1509 100, 83, 689, 0, 1, 265, 1, 1, 162, 190,
1510 191, 192, 193, 160, 178, 162, 398, 198, 199, 253,
1511 1, 95, 1, 98, 162, 555, 190, 191, 192, 193,
1512 99, 178, 196, 252, 198, 199, 200, 99, 100, 196,
1513 122, 123, 99, 100, 1, 264, 1, 44, 1, 196,
1514 551, 581, 1, 200, 98, 94, 94, 139, 55, 251,
1515 341, 100, 95, 101, 61, 347, 99, 94, 755, 98,
1516 67, 94, 1, 100, 430, 1, 763, 100, 765, 1,
1517 767, 99, 1, 94, 1, 1, 298, 251, 252, 100,
1518 302, 99, 1, 1, 88, 177, 626, 1, 252, 1,
1519 264, 265, 99, 98, 251, 252, 97, 86, 265, 1,
1520 264, 100, 15, 1, 9, 327, 1, 264, 99, 616,
1521 99, 618, 334, 52, 625, 337, 307, 308, 309, 86,
1522 1, 661, 351, 345, 216, 1, 95, 1, 33, 88,
1523 95, 94, 99, 307, 308, 309, 310, 311, 312, 313,
1524 314, 315, 316, 317, 318, 319, 320, 321, 322, 323,
1525 324, 325, 326, 355, 650, 1, 95, 549, 1, 251,
1526 362, 1, 319, 99, 671, 94, 98, 369, 708, 371,
1527 262, 98, 374, 99, 87, 94, 94, 351, 52, 650,
1528 650, 355, 0, 1, 93, 99, 98, 279, 362, 63,
1529 686, 413, 94, 689, 351, 369, 398, 371, 355, 650,
1530 374, 99, 424, 671, 99, 98, 1, 299, 430, 301,
1531 374, 1, 93, 251, 1, 686, 686, 374, 689, 689,
1532 63, 95, 98, 1, 398, 655, 44, 67, 1, 736,
1533 421, 94, 524, 703, 97, 686, 747, 55, 689, 129,
1534 86, 398, 712, 61, 336, 1, 1, 421, 1, 67,
1535 757, 343, 95, 427, 1, 347, 1, 75, 1, 755,
1536 730, 95, 52, 355, 566, 0, 1, 763, 736, 765,
1537 362, 767, 162, 63, 0, 1, 498, 369, 1, 371,
1538 1, 99, 584, 96, 755, 755, 508, 100, 510, 757,
1539 1, 86, 763, 763, 765, 765, 767, 767, 520, 1,
1540 1, 1, 96, 1, 755, 95, 398, 536, 1, 44,
1541 601, 1, 763, 86, 765, 93, 767, 355, 44, 541,
1542 55, 543, 45, 46, 362, 1, 61, 1, 72, 55,
1543 95, 369, 67, 371, 636, 61, 374, 93, 93, 93,
1544 93, 67, 86, 86, 646, 92, 93, 549, 93, 551,
1545 97, 98, 99, 100, 53, 1, 578, 0, 1, 251,
1546 398, 1, 536, 86, 99, 88, 129, 44, 91, 92,
1547 93, 100, 93, 99, 97, 549, 50, 551, 101, 536,
1548 571, 92, 673, 94, 61, 86, 97, 98, 99, 100,
1549 67, 93, 549, 93, 551, 93, 101, 571, 572, 162,
1550 93, 44, 65, 93, 50, 0, 1, 1, 82, 72,
1551 86, 85, 86, 587, 616, 1, 618, 95, 61, 97,
1552 1, 83, 1, 625, 67, 92, 655, 0, 1, 521,
1553 97, 98, 524, 724, 95, 96, 82, 177, 99, 85,
1554 86, 0, 1, 665, 107, 1, 86, 1, 650, 44,
1555 1, 625, 1, 5, 6, 7, 99, 549, 44, 551,
1556 122, 123, 414, 355, 50, 417, 61, 1, 625, 671,
1557 362, 44, 67, 101, 94, 1, 650, 369, 101, 371,
1558 100, 655, 374, 1, 686, 44, 97, 689, 61, 711,
1559 1, 655, 86, 715, 67, 717, 82, 1, 655, 85,
1560 86, 703, 61, 251, 99, 86, 398, 86, 67, 11,
1561 712, 549, 686, 551, 65, 689, 67, 12, 67, 721,
1562 1, 72, 262, 72, 5, 76, 99, 76, 730, 703,
1563 86, 623, 86, 625, 736, 86, 13, 86, 712, 65,
1564 99, 67, 1, 745, 97, 747, 72, 721, 101, 1,
1565 76, 1, 86, 755, 1, 757, 730, 14, 650, 1,
1566 86, 763, 99, 765, 721, 767, 251, 64, 86, 97,
1567 60, 745, 69, 747, 64, 86, 45, 46, 616, 96,
1568 618, 755, 86, 99, 100, 45, 46, 625, 745, 763,
1569 747, 765, 95, 767, 686, 93, 1, 689, 9, 97,
1570 11, 93, 44, 101, 44, 86, 93, 355, 50, 47,
1571 50, 703, 650, 99, 362, 47, 686, 99, 1, 689,
1572 712, 369, 33, 371, 62, 99, 374, 86, 97, 721,
1573 62, 128, 101, 671, 86, 129, 86, 97, 730, 86,
1574 82, 101, 82, 85, 86, 85, 86, 1, 686, 251,
1575 398, 689, 94, 745, 94, 747, 99, 549, 96, 551,
1576 99, 44, 93, 755, 96, 703, 160, 50, 162, 94,
1577 355, 763, 97, 765, 712, 767, 101, 362, 315, 316,
1578 317, 318, 94, 721, 369, 755, 371, 251, 100, 374,
1579 91, 92, 730, 763, 93, 765, 50, 767, 736, 82,
1580 44, 88, 85, 86, 94, 59, 50, 745, 94, 747,
1581 100, 65, 100, 398, 100, 94, 66, 755, 72, 757,
1582 10, 100, 76, 67, 616, 763, 618, 765, 82, 767,
1583 99, 85, 86, 625, 93, 89, 90, 94, 82, 93,
1584 30, 85, 86, 100, 34, 416, 1, 418, 102, 103,
1585 104, 105, 97, 355, 108, 109, 91, 92, 650, 86,
1586 362, 51, 45, 46, 91, 92, 93, 369, 94, 371,
1587 97, 1, 374, 93, 101, 251, 44, 3, 4, 671,
1588 16, 17, 50, 99, 18, 19, 20, 21, 94, 44,
1589 94, 355, 91, 92, 686, 50, 398, 689, 362, 97,
1590 98, 549, 1, 551, 59, 369, 61, 371, 94, 44,
1591 374, 703, 67, 100, 82, 50, 56, 85, 86, 56,
1592 712, 45, 46, 57, 59, 99, 61, 82, 94, 721,
1593 85, 86, 67, 94, 398, 91, 92, 93, 730, 45,
1594 46, 97, 310, 311, 736, 101, 1, 82, 320, 321,
1595 85, 86, 94, 745, 1, 747, 8, 9, 10, 56,
1596 95, 96, 94, 755, 549, 757, 551, 0, 616, 94,
1597 618, 763, 99, 765, 44, 767, 99, 625, 94, 355,
1598 50, 0, 91, 92, 93, 319, 362, 11, 97, 59,
1599 54, 61, 101, 369, 44, 371, 139, 67, 374, 86,
1600 50, 75, 650, 162, 91, 92, 93, 160, 393, 59,
1601 97, 61, 82, 252, 101, 85, 86, 67, 97, 98,
1602 99, 52, 398, 671, 282, 95, 96, 398, 44, 94,
1603 374, 616, 82, 618, 50, 85, 86, 719, 686, 719,
1604 625, 689, 602, 59, 374, 61, 96, 549, 602, 551,
1605 322, 67, 86, 323, 325, 703, 324, 91, 92, 93,
1606 312, 313, 314, 97, 712, 650, 82, 101, 587, 85,
1607 86, 326, -1, 721, 330, -1, -1, -1, -1, -1,
1608 96, -1, 730, -1, -1, 549, 671, 551, 736, -1,
1609 91, 92, 93, -1, -1, -1, 97, 745, -1, 747,
1610 101, 686, -1, -1, 689, -1, -1, 755, -1, 757,
1611 -1, -1, -1, -1, 616, 763, 618, 765, 703, 767,
1612 -1, -1, -1, 625, -1, -1, -1, 712, -1, -1,
1613 -1, -1, -1, -1, -1, -1, 721, -1, -1, -1,
1614 -1, -1, -1, -1, -1, 730, -1, -1, 650, -1,
1615 -1, 736, 616, -1, 618, -1, -1, -1, -1, 50,
1616 745, 625, 747, -1, -1, -1, -1, -1, 59, 671,
1617 755, -1, 757, 549, 65, 551, -1, -1, 763, -1,
1618 765, 72, 767, -1, 686, 76, 650, 689, -1, -1,
1619 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1620 -1, 703, 93, -1, -1, -1, -1, 671, -1, -1,
1621 712, 102, 103, 104, 105, -1, -1, 108, 109, 721,
1622 -1, -1, 686, -1, -1, 689, -1, -1, 730, -1,
1623 -1, -1, -1, -1, 736, -1, -1, -1, -1, 703,
1624 616, -1, 618, 745, -1, 747, -1, -1, 712, 625,
1625 -1, -1, -1, 755, -1, 757, -1, 721, -1, -1,
1626 -1, 763, -1, 765, -1, 767, 730, -1, -1, -1,
1627 -1, -1, 736, -1, 650, -1, 190, 191, 192, 193,
1628 -1, 745, -1, 747, 198, 199, -1, -1, -1, -1,
1629 -1, 755, -1, 757, -1, 671, -1, -1, -1, 763,
1630 -1, 765, -1, 767, -1, -1, 190, 191, 192, 193,
1631 686, -1, -1, 689, 198, 199, -1, -1, -1, -1,
1632 -1, -1, -1, -1, -1, -1, -1, 703, -1, -1,
1633 -1, -1, -1, -1, -1, -1, 712, -1, -1, -1,
1634 -1, -1, -1, -1, -1, 721, -1, -1, -1, -1,
1635 -1, -1, -1, -1, 730, -1, -1, -1, -1, -1,
1636 736, -1, -1, -1, -1, -1, -1, -1, -1, 745,
1637 -1, 747, -1, -1, -1, -1, -1, -1, -1, 755,
1638 -1, 757, -1, -1, -1, -1, -1, 763, -1, 765,
1639 -1, 767, -1, 307, 308, 309, 310, 311, 312, 313,
1640 314, 315, 316, 317, 318, -1, 320, 321, 322, 323,
1641 324, 325, 326, -1, 1, -1, -1, -1, -1, -1,
1642 -1, -1, -1, 307, 308, 309, 310, 311, 312, 313,
1643 314, 315, 316, 317, 318, -1, 320, 321, 322, 323,
1644 324, 325, 326, -1, -1, -1, -1, -1, -1, -1,
1645 -1, -1, -1, -1, -1, -1, -1, 44, 45, 46,
1646 47, 48, 49, 50, 51, -1, -1, 54, -1, -1,
1647 -1, 58, 59, -1, -1, 62, -1, -1, 65, 66,
1648 67, 68, -1, 70, 71, 72, 73, -1, -1, 76,
1649 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1650 -1, 1, -1, -1, -1, -1, 93, 421, 95, 96,
1651 -1, -1, 99, 427, -1, 102, 103, 104, 105, -1,
1652 -1, 108, 109, -1, -1, -1, -1, -1, -1, -1,
1653 -1, -1, -1, -1, -1, -1, -1, 421, -1, -1,
1654 -1, -1, -1, 427, 44, 45, 46, 47, 48, 49,
1655 50, 51, -1, -1, 54, -1, -1, -1, 58, 59,
1656 -1, -1, 62, -1, -1, 65, 66, 67, 68, -1,
1657 70, 71, 72, 73, -1, 1, 76, 3, 4, -1,
1658 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
1659 -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
1660 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1661 -1, -1, -1, -1, -1, -1, -1, -1, -1, 45,
1662 46, -1, -1, -1, 50, -1, -1, -1, -1, -1,
1663 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1664 -1, -1, -1, -1, -1, -1, 72, 1, -1, -1,
1665 76, -1, -1, -1, -1, -1, 82, 571, 572, 85,
1666 86, -1, -1, 89, 90, -1, -1, 93, -1, 95,
1667 96, -1, -1, 587, -1, -1, 102, 103, 104, 105,
1668 -1, -1, 108, 109, -1, -1, -1, 571, 572, -1,
1669 44, 45, 46, 47, 48, 49, 50, 51, -1, -1,
1670 54, -1, -1, 587, 58, 59, -1, -1, 62, -1,
1671 -1, 65, 66, 67, 68, 1, 70, 71, 72, 73,
1672 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1673 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1674 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1675 104, 105, -1, -1, 108, 109, -1, -1, 44, 45,
1676 46, -1, 48, 49, 50, 51, -1, -1, 54, -1,
1677 -1, -1, 58, 59, -1, -1, -1, -1, -1, 65,
1678 66, 67, 68, 1, 70, 71, 72, 73, -1, -1,
1679 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1680 86, -1, -1, -1, -1, -1, -1, 93, -1, 95,
1681 96, -1, -1, 99, -1, -1, 102, 103, 104, 105,
1682 -1, -1, 108, 109, -1, -1, 44, 45, 46, -1,
1683 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
1684 58, 59, -1, -1, -1, -1, -1, 65, 66, 67,
1685 68, 1, 70, 71, 72, 73, -1, -1, 76, -1,
1686 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1687 -1, -1, -1, -1, -1, 93, -1, 95, 96, -1,
1688 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
1689 108, 109, -1, -1, 44, 45, 46, -1, 48, 49,
1690 50, 51, -1, -1, 54, -1, -1, -1, 58, 59,
1691 -1, -1, -1, -1, -1, 65, 66, 67, 68, 1,
1692 70, 71, 72, 73, -1, -1, 76, -1, -1, -1,
1693 -1, -1, 82, -1, -1, 85, 86, -1, -1, -1,
1694 -1, -1, -1, 93, -1, 95, 96, -1, -1, 99,
1695 -1, -1, 102, 103, 104, 105, -1, -1, 108, 109,
1696 -1, -1, 44, 45, 46, -1, 48, 49, 50, 51,
1697 -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
1698 -1, -1, -1, 65, 66, 67, 68, 1, 70, 71,
1699 72, 73, -1, -1, 76, -1, -1, -1, -1, -1,
1700 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1701 -1, 93, -1, 95, 96, -1, -1, 99, -1, -1,
1702 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
1703 44, 45, 46, -1, 48, 49, 50, 51, -1, -1,
1704 54, -1, -1, -1, 58, 59, -1, -1, -1, -1,
1705 -1, 65, 66, 67, 68, 1, 70, 71, 72, 73,
1706 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1707 -1, 85, 86, -1, -1, -1, -1, -1, -1, 93,
1708 -1, 95, 96, -1, -1, 99, -1, -1, 102, 103,
1709 104, 105, -1, -1, 108, 109, -1, -1, 44, 45,
1710 46, -1, 48, 49, 50, 51, -1, -1, 54, -1,
1711 -1, -1, 58, 59, -1, -1, -1, -1, -1, 65,
1712 66, 67, 68, 1, 70, 71, 72, 73, -1, -1,
1713 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1714 86, -1, -1, -1, -1, -1, -1, 93, -1, 95,
1715 -1, -1, -1, 99, -1, -1, 102, 103, 104, 105,
1716 -1, -1, 108, 109, -1, -1, 44, 45, 46, -1,
1717 48, 49, 50, 51, -1, -1, 54, -1, -1, -1,
1718 58, 59, -1, -1, -1, -1, -1, 65, 66, 1,
1719 68, -1, 70, 71, 72, 73, -1, -1, 76, -1,
1720 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1721 -1, -1, -1, -1, -1, 93, -1, 95, -1, -1,
1722 -1, 99, -1, -1, 102, 103, 104, 105, -1, -1,
1723 108, 109, 44, 45, 46, -1, 48, 49, 50, 51,
1724 -1, -1, 54, -1, -1, -1, 58, 59, -1, -1,
1725 -1, -1, -1, 65, 66, -1, 68, -1, 70, 71,
1726 72, 73, -1, 1, 76, 3, 4, -1, -1, -1,
1727 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
1728 -1, 93, -1, 95, -1, -1, -1, 99, -1, -1,
1729 102, 103, 104, 105, -1, -1, 108, 109, -1, -1,
1730 -1, -1, -1, -1, -1, -1, -1, 45, 46, -1,
1731 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1732 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1733 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1734 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1735 -1, 89, 90, -1, -1, 93, -1, 95, 45, 46,
1736 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1737 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1738 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1739 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1740 -1, 88, 89, 90, -1, -1, 93, -1, -1, -1,
1741 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1742 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1743 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1744 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1745 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1746 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1747 -1, 93, -1, -1, 45, 46, -1, 99, -1, 50,
1748 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1749 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1750 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1751 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1752 -1, -1, 93, -1, -1, -1, -1, 98, -1, -1,
1753 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1754 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1755 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1756 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1757 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1758 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
1759 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1760 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1761 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1762 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1763 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1764 -1, -1, -1, 98, -1, -1, -1, 102, 103, 104,
1765 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1766 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1767 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1768 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1769 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1770 90, -1, -1, 93, -1, -1, 45, 46, 98, -1,
1771 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1772 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1773 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1774 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1775 89, 90, -1, -1, 93, 94, -1, -1, -1, -1,
1776 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1777 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1778 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1779 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1780 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1781 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1782 -1, -1, 45, 46, -1, 99, -1, 50, 102, 103,
1783 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1784 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1785 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1786 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1787 93, 94, -1, -1, -1, -1, -1, -1, -1, 102,
1788 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1789 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1790 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1791 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1792 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1793 -1, 89, 90, -1, -1, 93, 94, -1, 45, 46,
1794 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1795 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1796 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1797 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1798 -1, -1, 89, 90, -1, -1, 93, 94, -1, -1,
1799 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1800 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1801 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1802 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1803 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1804 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1805 -1, 93, -1, -1, 45, 46, -1, 99, -1, 50,
1806 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1807 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1808 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1809 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1810 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
1811 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1812 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1813 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1814 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1815 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1816 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1817 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1818 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1819 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1820 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1821 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1822 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1823 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1824 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1825 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1826 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1827 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1828 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
1829 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1830 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1831 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1832 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1833 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1834 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1835 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1836 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1837 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1838 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1839 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1840 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
1841 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1842 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1843 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1844 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1845 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
1846 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1847 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1848 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1849 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1850 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1851 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
1852 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1853 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1854 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1855 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1856 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1857 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1858 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1859 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1860 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1861 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1862 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1863 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
1864 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1865 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1866 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1867 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1868 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
1869 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1870 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1871 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1872 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1873 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1874 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1875 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1876 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1877 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1878 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1879 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1880 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1881 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1882 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1883 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1884 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1885 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1886 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
1887 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1888 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1889 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1890 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1891 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1892 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1893 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1894 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1895 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1896 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1897 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1898 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
1899 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1900 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1901 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1902 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1903 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
1904 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1905 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1906 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1907 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1908 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1909 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
1910 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1911 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1912 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1913 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1914 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1915 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1916 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1917 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1918 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1919 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1920 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1921 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
1922 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1923 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1924 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1925 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1926 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
1927 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1928 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1929 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1930 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1931 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1932 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1933 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1934 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1935 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1936 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1937 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1938 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1939 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1940 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1941 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
1942 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
1943 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
1944 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
1945 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
1946 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
1947 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
1948 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
1949 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
1950 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
1951 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
1952 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
1953 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
1954 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
1955 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
1956 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
1957 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
1958 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
1959 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
1960 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
1961 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
1962 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
1963 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
1964 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
1965 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
1966 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
1967 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
1968 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
1969 108, 109, 59, -1, -1, -1, -1, -1, 65, 1,
1970 -1, 3, 4, -1, -1, 72, -1, -1, -1, 76,
1971 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
1972 -1, -1, 89, 90, -1, -1, 93, -1, -1, -1,
1973 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
1974 -1, 108, 109, 45, 46, -1, -1, -1, 50, -1,
1975 1, -1, 3, 4, -1, -1, -1, 59, -1, -1,
1976 -1, -1, -1, 65, -1, -1, -1, -1, -1, -1,
1977 72, -1, -1, -1, 76, -1, -1, -1, -1, -1,
1978 82, -1, -1, 85, 86, -1, -1, 89, 90, -1,
1979 -1, 93, -1, -1, 45, 46, -1, -1, -1, 50,
1980 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
1981 -1, -1, -1, -1, 65, 1, -1, 3, 4, -1,
1982 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
1983 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
1984 -1, -1, 93, -1, -1, -1, -1, -1, -1, -1,
1985 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
1986 46, -1, -1, -1, 50, -1, 1, -1, 3, 4,
1987 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
1988 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
1989 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
1990 86, -1, -1, 89, 90, -1, -1, 93, -1, -1,
1991 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
1992 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
1993 65, 1, -1, 3, 4, -1, -1, 72, -1, -1,
1994 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
1995 85, 86, -1, -1, 89, 90, -1, -1, 93, -1,
1996 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
1997 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
1998 50, -1, 1, -1, 3, 4, -1, -1, -1, 59,
1999 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2000 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2001 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2002 90, -1, -1, 93, -1, -1, 45, 46, -1, -1,
2003 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2004 59, -1, -1, -1, -1, -1, 65, 1, -1, 3,
2005 4, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2006 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2007 89, 90, -1, -1, 93, -1, -1, -1, -1, -1,
2008 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2009 109, 45, 46, -1, -1, -1, 50, -1, 1, -1,
2010 3, 4, -1, -1, -1, 59, -1, -1, -1, -1,
2011 -1, 65, -1, -1, -1, -1, -1, -1, 72, -1,
2012 -1, -1, 76, -1, -1, -1, -1, -1, 82, -1,
2013 -1, 85, 86, -1, -1, 89, 90, -1, -1, 93,
2014 -1, -1, 45, 46, -1, -1, -1, 50, 102, 103,
2015 104, 105, -1, -1, 108, 109, 59, -1, -1, -1,
2016 -1, -1, 65, 1, -1, 3, 4, -1, -1, 72,
2017 -1, -1, -1, 76, -1, -1, -1, -1, -1, 82,
2018 -1, -1, 85, 86, -1, -1, 89, 90, -1, -1,
2019 93, -1, -1, -1, -1, -1, -1, -1, -1, 102,
2020 103, 104, 105, -1, -1, 108, 109, 45, 46, -1,
2021 -1, -1, 50, -1, 1, -1, 3, 4, -1, -1,
2022 -1, 59, -1, -1, -1, -1, -1, 65, -1, -1,
2023 -1, -1, -1, -1, 72, -1, -1, -1, 76, -1,
2024 -1, -1, -1, -1, 82, -1, -1, 85, 86, -1,
2025 -1, 89, 90, -1, -1, 93, -1, -1, 45, 46,
2026 -1, -1, -1, 50, 102, 103, 104, 105, -1, -1,
2027 108, 109, 59, -1, -1, -1, -1, -1, 65, -1,
2028 1, -1, -1, -1, -1, 72, -1, -1, -1, 76,
2029 -1, -1, -1, -1, -1, 82, -1, -1, 85, 86,
2030 -1, -1, 89, 90, -1, 1, 93, -1, -1, -1,
2031 -1, -1, -1, -1, -1, 102, 103, 104, 105, -1,
2032 -1, 108, 109, 44, 45, 46, -1, -1, -1, 50,
2033 -1, -1, -1, -1, -1, -1, -1, -1, 59, -1,
2034 -1, -1, -1, -1, 65, -1, -1, 1, -1, 45,
2035 46, 72, -1, -1, 50, 76, -1, -1, -1, -1,
2036 -1, 82, -1, 59, 85, 86, -1, -1, -1, 65,
2037 -1, -1, 93, -1, 3, 4, 72, -1, 99, -1,
2038 76, 102, 103, 104, 105, -1, 82, 108, 109, 85,
2039 86, 45, 46, -1, -1, -1, 50, 93, 94, -1,
2040 -1, -1, -1, -1, -1, 59, 102, 103, 104, 105,
2041 -1, 65, 108, 109, 1, -1, 45, 46, 72, -1,
2042 -1, 50, 76, -1, -1, -1, -1, -1, 82, -1,
2043 59, 85, 86, -1, -1, -1, 65, -1, -1, 93,
2044 94, 3, 4, 72, -1, -1, -1, 76, 102, 103,
2045 104, 105, -1, 82, 108, 109, 85, 86, 45, 46,
2046 89, 90, -1, 50, 93, -1, 95, 96, -1, -1,
2047 -1, 100, 59, 102, 103, 104, 105, -1, 65, 108,
2048 109, -1, -1, 45, 46, 72, -1, -1, 50, 76,
2049 -1, -1, 3, 4, -1, 82, -1, 59, 85, 86,
2050 -1, -1, -1, 65, -1, -1, 93, -1, -1, -1,
2051 72, -1, -1, -1, 76, 102, 103, 104, 105, -1,
2052 82, 108, 109, 85, 86, -1, -1, 89, 90, -1,
2053 -1, 93, 94, -1, 45, 46, -1, -1, -1, 50,
2054 102, 103, 104, 105, -1, -1, 108, 109, 59, -1,
2055 -1, -1, -1, -1, 65, -1, -1, 3, 4, -1,
2056 -1, 72, -1, -1, -1, 76, -1, -1, -1, -1,
2057 -1, 82, -1, -1, 85, 86, -1, -1, 89, 90,
2058 -1, -1, 93, 94, -1, -1, -1, -1, -1, -1,
2059 -1, 102, 103, 104, 105, -1, -1, 108, 109, 45,
2060 46, -1, -1, -1, 50, -1, -1, -1, 3, 4,
2061 -1, -1, -1, 59, -1, -1, -1, -1, -1, 65,
2062 -1, -1, -1, -1, -1, -1, 72, -1, -1, -1,
2063 76, -1, -1, -1, -1, -1, 82, -1, -1, 85,
2064 86, -1, -1, 89, 90, -1, -1, 93, 94, -1,
2065 45, 46, -1, -1, -1, 50, 102, 103, 104, 105,
2066 -1, -1, 108, 109, 59, -1, -1, -1, -1, -1,
2067 65, -1, -1, 3, 4, -1, -1, 72, -1, -1,
2068 -1, 76, -1, -1, -1, -1, -1, 82, -1, -1,
2069 85, 86, -1, -1, 89, 90, -1, -1, 93, 94,
2070 -1, -1, -1, -1, -1, -1, -1, 102, 103, 104,
2071 105, -1, -1, 108, 109, 45, 46, -1, -1, -1,
2072 50, -1, -1, -1, -1, -1, -1, -1, -1, 59,
2073 -1, -1, -1, -1, -1, 65, -1, -1, -1, -1,
2074 -1, -1, 72, -1, -1, -1, 76, -1, -1, -1,
2075 -1, -1, 82, -1, -1, 85, 86, -1, -1, 89,
2076 90, -1, -1, 93, -1, 44, 45, 46, -1, -1,
2077 -1, 50, 102, 103, 104, 105, -1, -1, 108, 109,
2078 59, -1, -1, -1, -1, -1, 65, -1, -1, -1,
2079 -1, -1, -1, 72, -1, -1, -1, 76, -1, -1,
2080 -1, -1, -1, 82, -1, -1, 85, 86, -1, -1,
2081 -1, -1, -1, -1, 93, -1, -1, -1, -1, -1,
2082 -1, -1, -1, 102, 103, 104, 105, -1, -1, 108,
2083 109
2084 };
2085 #define YYPURE 1
2086
2087 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
2088 #line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple"
2089
2090 /* Skeleton output parser for bison,
2091 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
2092
2093 This program is free software; you can redistribute it and/or modify
2094 it under the terms of the GNU General Public License as published by
2095 the Free Software Foundation; either version 2, or (at your option)
2096 any later version.
2097
2098 This program is distributed in the hope that it will be useful,
2099 but WITHOUT ANY WARRANTY; without even the implied warranty of
2100 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2101 GNU General Public License for more details.
2102
2103 You should have received a copy of the GNU General Public License
2104 along with this program; if not, write to the Free Software
2105 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
2106
2107 /* As a special exception, when this file is copied by Bison into a
2108 Bison output file, you may use that output file without restriction.
2109 This special exception was added by the Free Software Foundation
2110 in version 1.24 of Bison. */
2111
2112 #ifndef alloca
2113 #ifdef __GNUC__
2114 #define alloca __builtin_alloca
2115 #else /* not GNU C. */
2116 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
2117 #include <alloca.h>
2118 #else /* not sparc */
2119 #if defined (MSDOS) && !defined (__TURBOC__)
2120 #include <malloc.h>
2121 #else /* not MSDOS, or __TURBOC__ */
2122 #if defined(_AIX)
2123 #include <malloc.h>
2124 #pragma alloca
2125 #else /* not MSDOS, __TURBOC__, or _AIX */
2126 #ifdef __hpux
2127 #ifdef __cplusplus
2128 extern "C" {
2129 void *alloca (unsigned int);
2130 };
2131 #else /* not __cplusplus */
2132 void *alloca ();
2133 #endif /* not __cplusplus */
2134 #endif /* __hpux */
2135 #endif /* not _AIX */
2136 #endif /* not MSDOS, or __TURBOC__ */
2137 #endif /* not sparc. */
2138 #endif /* not GNU C. */
2139 #endif /* alloca not defined. */
2140
2141 /* This is the parser code that is written into each bison parser
2142 when the %semantic_parser declaration is not specified in the grammar.
2143 It was written by Richard Stallman by simplifying the hairy parser
2144 used when %semantic_parser is specified. */
2145
2146 /* Note: there must be only one dollar sign in this file.
2147 It is replaced by the list of actions, each action
2148 as one case of the switch. */
2149
2150 #define yyerrok (yyerrstatus = 0)
2151 #define yyclearin (yychar = YYEMPTY)
2152 #define YYEMPTY -2
2153 #define YYEOF 0
2154 #define YYACCEPT return(0)
2155 #define YYABORT return(1)
2156 #define YYERROR goto yyerrlab1
2157 /* Like YYERROR except do call yyerror.
2158 This remains here temporarily to ease the
2159 transition to the new meaning of YYERROR, for GCC.
2160 Once GCC version 2 has supplanted version 1, this can go. */
2161 #define YYFAIL goto yyerrlab
2162 #define YYRECOVERING() (!!yyerrstatus)
2163 #define YYBACKUP(token, value) \
2164 do \
2165 if (yychar == YYEMPTY && yylen == 1) \
2166 { yychar = (token), yylval = (value); \
2167 yychar1 = YYTRANSLATE (yychar); \
2168 YYPOPSTACK; \
2169 goto yybackup; \
2170 } \
2171 else \
2172 { yyerror ("syntax error: cannot back up"); YYERROR; } \
2173 while (0)
2174
2175 #define YYTERROR 1
2176 #define YYERRCODE 256
2177
2178 #ifndef YYPURE
2179 #define YYLEX yylex()
2180 #endif
2181
2182 #ifdef YYPURE
2183 #ifdef YYLSP_NEEDED
2184 #ifdef YYLEX_PARAM
2185 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
2186 #else
2187 #define YYLEX yylex(&yylval, &yylloc)
2188 #endif
2189 #else /* not YYLSP_NEEDED */
2190 #ifdef YYLEX_PARAM
2191 #define YYLEX yylex(&yylval, YYLEX_PARAM)
2192 #else
2193 #define YYLEX yylex(&yylval)
2194 #endif
2195 #endif /* not YYLSP_NEEDED */
2196 #endif
2197
2198 /* If nonreentrant, generate the variables here */
2199
2200 #ifndef YYPURE
2201
2202 int yychar; /* the lookahead symbol */
2203 YYSTYPE yylval; /* the semantic value of the */
2204 /* lookahead symbol */
2205
2206 #ifdef YYLSP_NEEDED
2207 YYLTYPE yylloc; /* location data for the lookahead */
2208 /* symbol */
2209 #endif
2210
2211 int yynerrs; /* number of parse errors so far */
2212 #endif /* not YYPURE */
2213
2214 #if YYDEBUG != 0
2215 int yydebug; /* nonzero means print parse trace */
2216 /* Since this is uninitialized, it does not stop multiple parsers
2217 from coexisting. */
2218 #endif
2219
2220 /* YYINITDEPTH indicates the initial size of the parser's stacks */
2221
2222 #ifndef YYINITDEPTH
2223 #define YYINITDEPTH 200
2224 #endif
2225
2226 /* YYMAXDEPTH is the maximum size the stacks can grow to
2227 (effective only if the built-in stack extension method is used). */
2228
2229 #if YYMAXDEPTH == 0
2230 #undef YYMAXDEPTH
2231 #endif
2232
2233 #ifndef YYMAXDEPTH
2234 #define YYMAXDEPTH 10000
2235 #endif
2236
2237 /* Prevent warning if -Wstrict-prototypes. */
2238 #ifdef __GNUC__
2239 int yyparse (void);
2240 #endif
2241 \f
2242 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
2243 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
2244 #else /* not GNU C or C++ */
2245 #ifndef __cplusplus
2246
2247 /* This is the most reliable way to avoid incompatibilities
2248 in available built-in functions on various systems. */
2249 static void
2250 __yy_memcpy (to, from, count)
2251 char *to;
2252 char *from;
2253 int count;
2254 {
2255 register char *f = from;
2256 register char *t = to;
2257 register int i = count;
2258
2259 while (i-- > 0)
2260 *t++ = *f++;
2261 }
2262
2263 #else /* __cplusplus */
2264
2265 /* This is the most reliable way to avoid incompatibilities
2266 in available built-in functions on various systems. */
2267 static void
2268 __yy_memcpy (char *to, char *from, int count)
2269 {
2270 register char *f = from;
2271 register char *t = to;
2272 register int i = count;
2273
2274 while (i-- > 0)
2275 *t++ = *f++;
2276 }
2277
2278 #endif
2279 #endif
2280 \f
2281 #line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple"
2282
2283 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2284 into yyparse. The argument should have type void *.
2285 It should actually point to an object.
2286 Grammar actions can access the variable by casting it
2287 to the proper pointer type. */
2288
2289 #ifdef YYPARSE_PARAM
2290 #ifdef __cplusplus
2291 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2292 #define YYPARSE_PARAM_DECL
2293 #else /* not __cplusplus */
2294 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
2295 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2296 #endif /* not __cplusplus */
2297 #else /* not YYPARSE_PARAM */
2298 #define YYPARSE_PARAM_ARG
2299 #define YYPARSE_PARAM_DECL
2300 #endif /* not YYPARSE_PARAM */
2301
2302 int
2303 yyparse(YYPARSE_PARAM_ARG)
2304 YYPARSE_PARAM_DECL
2305 {
2306 register int yystate;
2307 register int yyn;
2308 register short *yyssp;
2309 register YYSTYPE *yyvsp;
2310 int yyerrstatus; /* number of tokens to shift before error messages enabled */
2311 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
2312
2313 short yyssa[YYINITDEPTH]; /* the state stack */
2314 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
2315
2316 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
2317 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
2318
2319 #ifdef YYLSP_NEEDED
2320 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
2321 YYLTYPE *yyls = yylsa;
2322 YYLTYPE *yylsp;
2323
2324 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
2325 #else
2326 #define YYPOPSTACK (yyvsp--, yyssp--)
2327 #endif
2328
2329 int yystacksize = YYINITDEPTH;
2330
2331 #ifdef YYPURE
2332 int yychar;
2333 YYSTYPE yylval;
2334 int yynerrs;
2335 #ifdef YYLSP_NEEDED
2336 YYLTYPE yylloc;
2337 #endif
2338 #endif
2339
2340 YYSTYPE yyval; /* the variable used to return */
2341 /* semantic values from the action */
2342 /* routines */
2343
2344 int yylen;
2345
2346 #if YYDEBUG != 0
2347 if (yydebug)
2348 fprintf(stderr, "Starting parse\n");
2349 #endif
2350
2351 yystate = 0;
2352 yyerrstatus = 0;
2353 yynerrs = 0;
2354 yychar = YYEMPTY; /* Cause a token to be read. */
2355
2356 /* Initialize stack pointers.
2357 Waste one element of value and location stack
2358 so that they stay on the same level as the state stack.
2359 The wasted elements are never initialized. */
2360
2361 yyssp = yyss - 1;
2362 yyvsp = yyvs;
2363 #ifdef YYLSP_NEEDED
2364 yylsp = yyls;
2365 #endif
2366
2367 /* Push a new state, which is found in yystate . */
2368 /* In all cases, when you get here, the value and location stacks
2369 have just been pushed. so pushing a state here evens the stacks. */
2370 yynewstate:
2371
2372 *++yyssp = yystate;
2373
2374 if (yyssp >= yyss + yystacksize - 1)
2375 {
2376 /* Give user a chance to reallocate the stack */
2377 /* Use copies of these so that the &'s don't force the real ones into memory. */
2378 YYSTYPE *yyvs1 = yyvs;
2379 short *yyss1 = yyss;
2380 #ifdef YYLSP_NEEDED
2381 YYLTYPE *yyls1 = yyls;
2382 #endif
2383
2384 /* Get the current used size of the three stacks, in elements. */
2385 int size = yyssp - yyss + 1;
2386
2387 #ifdef yyoverflow
2388 /* Each stack pointer address is followed by the size of
2389 the data in use in that stack, in bytes. */
2390 #ifdef YYLSP_NEEDED
2391 /* This used to be a conditional around just the two extra args,
2392 but that might be undefined if yyoverflow is a macro. */
2393 yyoverflow("parser stack overflow",
2394 &yyss1, size * sizeof (*yyssp),
2395 &yyvs1, size * sizeof (*yyvsp),
2396 &yyls1, size * sizeof (*yylsp),
2397 &yystacksize);
2398 #else
2399 yyoverflow("parser stack overflow",
2400 &yyss1, size * sizeof (*yyssp),
2401 &yyvs1, size * sizeof (*yyvsp),
2402 &yystacksize);
2403 #endif
2404
2405 yyss = yyss1; yyvs = yyvs1;
2406 #ifdef YYLSP_NEEDED
2407 yyls = yyls1;
2408 #endif
2409 #else /* no yyoverflow */
2410 /* Extend the stack our own way. */
2411 if (yystacksize >= YYMAXDEPTH)
2412 {
2413 yyerror("parser stack overflow");
2414 return 2;
2415 }
2416 yystacksize *= 2;
2417 if (yystacksize > YYMAXDEPTH)
2418 yystacksize = YYMAXDEPTH;
2419 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
2420 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
2421 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
2422 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
2423 #ifdef YYLSP_NEEDED
2424 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
2425 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
2426 #endif
2427 #endif /* no yyoverflow */
2428
2429 yyssp = yyss + size - 1;
2430 yyvsp = yyvs + size - 1;
2431 #ifdef YYLSP_NEEDED
2432 yylsp = yyls + size - 1;
2433 #endif
2434
2435 #if YYDEBUG != 0
2436 if (yydebug)
2437 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
2438 #endif
2439
2440 if (yyssp >= yyss + yystacksize - 1)
2441 YYABORT;
2442 }
2443
2444 #if YYDEBUG != 0
2445 if (yydebug)
2446 fprintf(stderr, "Entering state %d\n", yystate);
2447 #endif
2448
2449 goto yybackup;
2450 yybackup:
2451
2452 /* Do appropriate processing given the current state. */
2453 /* Read a lookahead token if we need one and don't already have one. */
2454 /* yyresume: */
2455
2456 /* First try to decide what to do without reference to lookahead token. */
2457
2458 yyn = yypact[yystate];
2459 if (yyn == YYFLAG)
2460 goto yydefault;
2461
2462 /* Not known => get a lookahead token if don't already have one. */
2463
2464 /* yychar is either YYEMPTY or YYEOF
2465 or a valid token in external form. */
2466
2467 if (yychar == YYEMPTY)
2468 {
2469 #if YYDEBUG != 0
2470 if (yydebug)
2471 fprintf(stderr, "Reading a token: ");
2472 #endif
2473 yychar = YYLEX;
2474 }
2475
2476 /* Convert token to internal form (in yychar1) for indexing tables with */
2477
2478 if (yychar <= 0) /* This means end of input. */
2479 {
2480 yychar1 = 0;
2481 yychar = YYEOF; /* Don't call YYLEX any more */
2482
2483 #if YYDEBUG != 0
2484 if (yydebug)
2485 fprintf(stderr, "Now at end of input.\n");
2486 #endif
2487 }
2488 else
2489 {
2490 yychar1 = YYTRANSLATE(yychar);
2491
2492 #if YYDEBUG != 0
2493 if (yydebug)
2494 {
2495 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
2496 /* Give the individual parser a way to print the precise meaning
2497 of a token, for further debugging info. */
2498 #ifdef YYPRINT
2499 YYPRINT (stderr, yychar, yylval);
2500 #endif
2501 fprintf (stderr, ")\n");
2502 }
2503 #endif
2504 }
2505
2506 yyn += yychar1;
2507 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
2508 goto yydefault;
2509
2510 yyn = yytable[yyn];
2511
2512 /* yyn is what to do for this token type in this state.
2513 Negative => reduce, -yyn is rule number.
2514 Positive => shift, yyn is new state.
2515 New state is final state => don't bother to shift,
2516 just return success.
2517 0, or most negative number => error. */
2518
2519 if (yyn < 0)
2520 {
2521 if (yyn == YYFLAG)
2522 goto yyerrlab;
2523 yyn = -yyn;
2524 goto yyreduce;
2525 }
2526 else if (yyn == 0)
2527 goto yyerrlab;
2528
2529 if (yyn == YYFINAL)
2530 YYACCEPT;
2531
2532 /* Shift the lookahead token. */
2533
2534 #if YYDEBUG != 0
2535 if (yydebug)
2536 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
2537 #endif
2538
2539 /* Discard the token being shifted unless it is eof. */
2540 if (yychar != YYEOF)
2541 yychar = YYEMPTY;
2542
2543 *++yyvsp = yylval;
2544 #ifdef YYLSP_NEEDED
2545 *++yylsp = yylloc;
2546 #endif
2547
2548 /* count tokens shifted since error; after three, turn off error status. */
2549 if (yyerrstatus) yyerrstatus--;
2550
2551 yystate = yyn;
2552 goto yynewstate;
2553
2554 /* Do the default action for the current state. */
2555 yydefault:
2556
2557 yyn = yydefact[yystate];
2558 if (yyn == 0)
2559 goto yyerrlab;
2560
2561 /* Do a reduction. yyn is the number of a rule to reduce with. */
2562 yyreduce:
2563 yylen = yyr2[yyn];
2564 if (yylen > 0)
2565 yyval = yyvsp[1-yylen]; /* implement default value of the action */
2566
2567 #if YYDEBUG != 0
2568 if (yydebug)
2569 {
2570 int i;
2571
2572 fprintf (stderr, "Reducing via rule %d (line %d), ",
2573 yyn, yyrline[yyn]);
2574
2575 /* Print the symbols being reduced, and their result. */
2576 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
2577 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
2578 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2579 }
2580 #endif
2581
2582
2583 switch (yyn) {
2584
2585 case 1:
2586 #line 253 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2587 {;
2588 break;}
2589 case 18:
2590 #line 297 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2591 {
2592 yyval.node = build_java_array_type (yyvsp[-2].node, -1);
2593 CLASS_LOADED_P (yyval.node) = 1;
2594 ;
2595 break;}
2596 case 19:
2597 #line 302 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2598 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2599 break;}
2600 case 20:
2601 #line 304 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2602 { yyval.node = build_unresolved_array_type (yyvsp[-2].node); ;
2603 break;}
2604 case 21:
2605 #line 306 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2606 {RULE ("']' expected"); RECOVER;;
2607 break;}
2608 case 22:
2609 #line 308 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2610 {RULE ("']' expected"); RECOVER;;
2611 break;}
2612 case 26:
2613 #line 323 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2614 { yyval.node = make_qualified_name (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
2615 break;}
2616 case 28:
2617 #line 332 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2618 {yyval.node = NULL;;
2619 break;}
2620 case 36:
2621 #line 344 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2622 {
2623 yyval.node = NULL;
2624 ;
2625 break;}
2626 case 37:
2627 #line 348 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2628 {
2629 yyval.node = NULL;
2630 ;
2631 break;}
2632 case 40:
2633 #line 360 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2634 { ctxp->package = EXPR_WFL_NODE (yyvsp[-1].node); ;
2635 break;}
2636 case 41:
2637 #line 362 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2638 {yyerror ("Missing name"); RECOVER;;
2639 break;}
2640 case 42:
2641 #line 364 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2642 {yyerror ("';' expected"); RECOVER;;
2643 break;}
2644 case 45:
2645 #line 374 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2646 {
2647 tree name = EXPR_WFL_NODE (yyvsp[-1].node), node, last_name;
2648 int i = IDENTIFIER_LENGTH (name)-1;
2649 char *last = &IDENTIFIER_POINTER (name)[i];
2650 while (last != IDENTIFIER_POINTER (name))
2651 {
2652 if (last [0] == '.')
2653 break;
2654 last--;
2655 }
2656 last_name = get_identifier (++last);
2657 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name))
2658 {
2659 tree err = find_name_in_single_imports (last_name);
2660 if (err && err != name)
2661 parse_error_context
2662 (yyvsp[-1].node, "Ambiguous class: `%s' and `%s'",
2663 IDENTIFIER_POINTER (name),
2664 IDENTIFIER_POINTER (err));
2665 }
2666 else
2667 {
2668 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (last_name) = 1;
2669 node = build_tree_list (yyvsp[-1].node, last_name);
2670 TREE_CHAIN (node) = ctxp->import_list;
2671 ctxp->import_list = node;
2672 }
2673 ;
2674 break;}
2675 case 46:
2676 #line 403 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2677 {yyerror ("Missing name"); RECOVER;;
2678 break;}
2679 case 47:
2680 #line 405 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2681 {yyerror ("';' expected"); RECOVER;;
2682 break;}
2683 case 48:
2684 #line 410 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2685 {
2686 tree name = EXPR_WFL_NODE (yyvsp[-3].node);
2687 tree node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2688 if (!IS_AN_IMPORT_ON_DEMAND_P (name))
2689 {
2690 read_import_dir (yyvsp[-3].node);
2691 IS_AN_IMPORT_ON_DEMAND_P (name) = 1;
2692 }
2693 TREE_CHAIN (node) = ctxp->import_demand_list;
2694 ctxp->import_demand_list = node;
2695 ;
2696 break;}
2697 case 49:
2698 #line 422 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2699 {yyerror ("'*' expected"); RECOVER;;
2700 break;}
2701 case 50:
2702 #line 424 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2703 {yyerror ("';' expected"); RECOVER;;
2704 break;}
2705 case 51:
2706 #line 429 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2707 {
2708 maybe_generate_clinit ();
2709 yyval.node = yyvsp[0].node;
2710 ;
2711 break;}
2712 case 53:
2713 #line 435 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2714 { yyval.node = NULL; ;
2715 break;}
2716 case 54:
2717 #line 437 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2718 {
2719 YYERROR_NOW;
2720 yyerror ("Class or interface declaration expected");
2721 ;
2722 break;}
2723 case 55:
2724 #line 448 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2725 {
2726 yyval.value = (1 << yyvsp[0].value);
2727 ;
2728 break;}
2729 case 56:
2730 #line 452 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2731 {
2732 int acc = (1 << yyvsp[0].value);
2733 if (yyval.value & acc)
2734 parse_error_context
2735 (ctxp->modifier_ctx [yyvsp[0].value], "Modifier `%s' declared twice",
2736 java_accstring_lookup (acc));
2737 else
2738 {
2739 yyval.value |= acc;
2740 }
2741 ;
2742 break;}
2743 case 57:
2744 #line 468 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2745 { create_class (yyvsp[-4].value, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2746 break;}
2747 case 58:
2748 #line 470 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2749 {
2750 yyval.node = yyvsp[0].node;
2751 ;
2752 break;}
2753 case 59:
2754 #line 474 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2755 { create_class (0, yyvsp[-2].node, yyvsp[-1].node, yyvsp[0].node); ;
2756 break;}
2757 case 60:
2758 #line 476 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2759 {
2760 yyval.node = yyvsp[0].node;
2761 ;
2762 break;}
2763 case 61:
2764 #line 480 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2765 {yyerror ("Missing class name"); RECOVER;;
2766 break;}
2767 case 62:
2768 #line 482 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2769 {yyerror ("Missing class name"); RECOVER;;
2770 break;}
2771 case 63:
2772 #line 484 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2773 {if (!ctxp->class_err) yyerror ("'{' expected"); DRECOVER(class1);;
2774 break;}
2775 case 64:
2776 #line 486 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2777 {if (!ctxp->class_err) yyerror ("'{' expected"); RECOVER;;
2778 break;}
2779 case 65:
2780 #line 490 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2781 { yyval.node = NULL; ;
2782 break;}
2783 case 66:
2784 #line 492 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2785 { yyval.node = yyvsp[0].node; ;
2786 break;}
2787 case 67:
2788 #line 494 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2789 {yyerror ("'{' expected"); ctxp->class_err=1;;
2790 break;}
2791 case 68:
2792 #line 496 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2793 {yyerror ("Missing super class name"); ctxp->class_err=1;;
2794 break;}
2795 case 69:
2796 #line 500 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2797 { yyval.node = NULL_TREE; ;
2798 break;}
2799 case 70:
2800 #line 502 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2801 { yyval.node = yyvsp[0].node; ;
2802 break;}
2803 case 71:
2804 #line 504 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2805 {
2806 ctxp->class_err=1;
2807 yyerror ("Missing interface name");
2808 ;
2809 break;}
2810 case 72:
2811 #line 512 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2812 {
2813 ctxp->interface_number = 1;
2814 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
2815 ;
2816 break;}
2817 case 73:
2818 #line 517 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2819 {
2820 ctxp->interface_number++;
2821 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
2822 ;
2823 break;}
2824 case 74:
2825 #line 522 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2826 {yyerror ("Missing interface name"); RECOVER;;
2827 break;}
2828 case 75:
2829 #line 527 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2830 { yyval.node = ctxp->current_parsed_class; ;
2831 break;}
2832 case 76:
2833 #line 529 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2834 { yyval.node = ctxp->current_parsed_class; ;
2835 break;}
2836 case 87:
2837 #line 554 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2838 { register_fields (0, yyvsp[-2].node, yyvsp[-1].node); ;
2839 break;}
2840 case 88:
2841 #line 556 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2842 {
2843 int acc_count = 0;
2844
2845 check_modifiers
2846 ("Illegal modifier `%s' for field declaration",
2847 yyvsp[-3].value, FIELD_MODIFIERS);
2848 check_modifiers_consistency (yyvsp[-3].value);
2849 register_fields (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node);
2850 ;
2851 break;}
2852 case 90:
2853 #line 571 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2854 { yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node); ;
2855 break;}
2856 case 91:
2857 #line 573 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2858 {yyerror ("Missing term"); RECOVER;;
2859 break;}
2860 case 92:
2861 #line 578 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2862 { yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE); ;
2863 break;}
2864 case 93:
2865 #line 580 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2866 {
2867 if (java_error_count)
2868 yyvsp[0].node = NULL_TREE;
2869 yyval.node = build_tree_list
2870 (yyvsp[-2].node, build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node));
2871 ;
2872 break;}
2873 case 94:
2874 #line 587 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2875 {
2876 yyerror ("Missing variable initializer");
2877 yyval.node = build_tree_list (yyvsp[-2].node, NULL_TREE);
2878 RECOVER;
2879 ;
2880 break;}
2881 case 95:
2882 #line 593 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2883 {
2884 yyerror ("';' expected");
2885 yyval.node = build_tree_list (yyvsp[-3].node, NULL_TREE);
2886 RECOVER;
2887 ;
2888 break;}
2889 case 97:
2890 #line 603 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2891 {
2892 yyval.node = NULL; /* FIXME */
2893 ;
2894 break;}
2895 case 98:
2896 #line 607 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2897 {yyerror ("Invalid declaration"); DRECOVER(vdi);;
2898 break;}
2899 case 99:
2900 #line 609 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2901 {yyerror ("']' expected"); DRECOVER(vdi);;
2902 break;}
2903 case 100:
2904 #line 611 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2905 {yyerror ("Unbalanced ']'"); DRECOVER(vdi);;
2906 break;}
2907 case 102:
2908 #line 617 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2909 { yyval.node = NULL; ;
2910 break;}
2911 case 103:
2912 #line 623 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2913 {
2914 current_function_decl = yyvsp[0].node;
2915 source_start_java_method (current_function_decl);
2916 ;
2917 break;}
2918 case 104:
2919 #line 628 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2920 {
2921 BLOCK_EXPR_BODY
2922 (DECL_FUNCTION_BODY (current_function_decl)) = yyvsp[0].node;
2923 maybe_absorb_scoping_blocks ();
2924 exit_block (); /* Exit function's body. */
2925
2926 /* Merge last line of the function with first line,
2927 directly in the function decl. It will be used to
2928 emit correct debug info. */
2929 DECL_SOURCE_LINE_MERGE (current_function_decl,
2930 ctxp->last_ccb_indent1);
2931 ;
2932 break;}
2933 case 105:
2934 #line 641 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2935 {YYNOT_TWICE yyerror ("'{' expected"); RECOVER;;
2936 break;}
2937 case 106:
2938 #line 646 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2939 { yyval.node = method_header (0, yyvsp[-2].node, yyvsp[-1].node, NULL); ;
2940 break;}
2941 case 107:
2942 #line 648 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2943 { yyval.node = method_header (0, void_type_node, yyvsp[-1].node, NULL); ;
2944 break;}
2945 case 108:
2946 #line 650 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2947 { yyval.node = method_header (yyvsp[-3].value, yyvsp[-2].node, yyvsp[-1].node, NULL); ;
2948 break;}
2949 case 109:
2950 #line 652 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2951 { yyval.node = method_header (yyvsp[-3].value, void_type_node, yyvsp[-1].node, NULL); ;
2952 break;}
2953 case 110:
2954 #line 654 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2955 {RECOVER;;
2956 break;}
2957 case 111:
2958 #line 656 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2959 {RECOVER;;
2960 break;}
2961 case 112:
2962 #line 658 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2963 {yyerror ("Identifier expected"); RECOVER;;
2964 break;}
2965 case 113:
2966 #line 660 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2967 {yyerror ("Identifier expected"); RECOVER;;
2968 break;}
2969 case 114:
2970 #line 662 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2971 {
2972 yyerror ("Invalid method declaration, return type required");
2973 RECOVER;
2974 ;
2975 break;}
2976 case 115:
2977 #line 670 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2978 { yyval.node = method_declarator (yyvsp[-2].node, NULL_TREE); ;
2979 break;}
2980 case 116:
2981 #line 672 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2982 { yyval.node = method_declarator (yyvsp[-3].node, yyvsp[-1].node); ;
2983 break;}
2984 case 117:
2985 #line 674 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2986 {
2987 /* Issue a warning here: obsolete declaration. FIXME */
2988 yyval.node = NULL; /* FIXME */
2989 ;
2990 break;}
2991 case 118:
2992 #line 679 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2993 {yyerror ("')' expected"); DRECOVER(method_declarator);;
2994 break;}
2995 case 119:
2996 #line 681 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
2997 {yyerror ("']' expected"); RECOVER;;
2998 break;}
2999 case 120:
3000 #line 686 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3001 {
3002 ctxp->formal_parameter_number = 1;
3003 ;
3004 break;}
3005 case 121:
3006 #line 690 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3007 {
3008 ctxp->formal_parameter_number += 1;
3009 yyval.node = chainon (yyvsp[-2].node, yyvsp[0].node);
3010 ;
3011 break;}
3012 case 122:
3013 #line 695 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3014 {yyerror ("Missing formal parameter term"); RECOVER;;
3015 break;}
3016 case 123:
3017 #line 700 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3018 {
3019 yyval.node = build_tree_list (yyvsp[0].node, yyvsp[-1].node);
3020 ;
3021 break;}
3022 case 124:
3023 #line 704 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3024 {
3025 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
3026 yyval.node = NULL; /* FIXME */
3027 ;
3028 break;}
3029 case 125:
3030 #line 709 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3031 {yyerror ("Missing identifier"); RECOVER;;
3032 break;}
3033 case 126:
3034 #line 711 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3035 {
3036 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-2].value));
3037 yyerror ("Missing identifier"); RECOVER;
3038 ;
3039 break;}
3040 case 129:
3041 #line 720 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3042 {yyerror ("Missing class type term"); RECOVER;;
3043 break;}
3044 case 132:
3045 #line 727 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3046 {yyerror ("Missing class type term"); RECOVER;;
3047 break;}
3048 case 135:
3049 #line 734 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3050 { yyval.node = NULL_TREE; ;
3051 break;}
3052 case 136:
3053 #line 740 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3054 {
3055 RULE ("STATIC_INITIALIZER");
3056 ;
3057 break;}
3058 case 137:
3059 #line 744 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3060 {
3061 RULE ("STATIC_INITIALIZER");
3062 ;
3063 break;}
3064 case 138:
3065 #line 751 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3066 {
3067 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3068 ;
3069 break;}
3070 case 139:
3071 #line 763 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3072 {
3073 RULE ("CONSTRUCTOR_DECLARATION");
3074 ;
3075 break;}
3076 case 140:
3077 #line 767 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3078 {
3079 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-3].value));
3080 RULE ("CONSTRUCTOR_DECLARATION (modifier)");
3081 ;
3082 break;}
3083 case 141:
3084 #line 773 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3085 {
3086 RULE ("CONSTRUCTOR_DECLARATION");
3087 ;
3088 break;}
3089 case 142:
3090 #line 778 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3091 {
3092 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[-4].value));
3093 RULE ("CONSTRUCTOR_DECLARATION (modifier)");
3094 ;
3095 break;}
3096 case 152:
3097 #line 806 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3098 {RULE ("explicit_constructor_invocation (X.super)");;
3099 break;}
3100 case 153:
3101 #line 811 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3102 {
3103 tree wfl = build_wfl_node (this_identifier_node, input_filename, 0, 0);
3104 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3105 yyval.node = wfl;
3106 ;
3107 break;}
3108 case 154:
3109 #line 817 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3110 {
3111 tree wfl = build_wfl_node (super_identifier_node, input_filename, 0, 0);
3112 EXPR_WFL_LINECOL (wfl) = yyvsp[0].operator.location;
3113 yyval.node = wfl;
3114 ;
3115 break;}
3116 case 155:
3117 #line 828 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3118 { create_interface (0, yyvsp[0].node, NULL_TREE); ;
3119 break;}
3120 case 156:
3121 #line 830 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3122 {
3123 yyval.node = yyvsp[0].node;
3124 ;
3125 break;}
3126 case 157:
3127 #line 834 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3128 { create_interface (yyvsp[-2].value, yyvsp[0].node, NULL_TREE); ;
3129 break;}
3130 case 158:
3131 #line 836 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3132 {
3133 yyval.node = yyvsp[0].node;
3134 ;
3135 break;}
3136 case 159:
3137 #line 840 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3138 { create_interface (0, yyvsp[-1].node, yyvsp[0].node); ;
3139 break;}
3140 case 160:
3141 #line 842 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3142 {
3143 yyval.node = yyvsp[0].node;
3144 ;
3145 break;}
3146 case 161:
3147 #line 846 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3148 { create_interface (yyvsp[-3].value, yyvsp[-1].node, yyvsp[0].node); ;
3149 break;}
3150 case 162:
3151 #line 848 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3152 {
3153 yyval.node = yyvsp[0].node;
3154 ;
3155 break;}
3156 case 163:
3157 #line 852 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3158 {yyerror ("(here)'{' expected"); RECOVER;;
3159 break;}
3160 case 164:
3161 #line 854 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3162 {yyerror ("(there)'{' expected"); RECOVER;;
3163 break;}
3164 case 165:
3165 #line 859 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3166 {
3167 ctxp->interface_number = 1;
3168 yyval.node = build_tree_list (yyvsp[0].node, NULL_TREE);
3169 ;
3170 break;}
3171 case 166:
3172 #line 864 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3173 {
3174 ctxp->interface_number++;
3175 yyval.node = chainon (yyvsp[-2].node, build_tree_list (yyvsp[0].node, NULL_TREE));
3176 ;
3177 break;}
3178 case 167:
3179 #line 869 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3180 {yyerror ("Invalid interface type"); RECOVER;;
3181 break;}
3182 case 168:
3183 #line 871 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3184 {yyerror ("Missing term"); RECOVER;;
3185 break;}
3186 case 169:
3187 #line 876 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3188 { yyval.node = NULL_TREE; ;
3189 break;}
3190 case 170:
3191 #line 878 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3192 { yyval.node = NULL_TREE; ;
3193 break;}
3194 case 178:
3195 #line 899 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3196 {
3197 check_abstract_method_header (yyvsp[-1].node);
3198 current_function_decl = NULL_TREE; /* FIXME ? */
3199 ;
3200 break;}
3201 case 179:
3202 #line 904 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3203 {yyerror ("';' expected"); RECOVER;;
3204 break;}
3205 case 180:
3206 #line 910 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3207 {
3208 RULE ("ARRAY_INITIALIZER (empty)");
3209 ;
3210 break;}
3211 case 181:
3212 #line 914 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3213 {
3214 RULE ("ARRAY_INITIALIZER (variable)");
3215 ;
3216 break;}
3217 case 182:
3218 #line 918 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3219 {
3220 RULE ("ARRAY_INITIALIZER (,)");
3221 ;
3222 break;}
3223 case 183:
3224 #line 922 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3225 {
3226 RULE ("ARRAY_INITIALIZER (variable, ,)");
3227 ;
3228 break;}
3229 case 186:
3230 #line 931 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3231 {yyerror ("Missing term"); RECOVER;;
3232 break;}
3233 case 187:
3234 #line 937 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3235 { yyval.node = size_zero_node; ;
3236 break;}
3237 case 188:
3238 #line 939 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3239 { enter_block (); ;
3240 break;}
3241 case 189:
3242 #line 942 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3243 {
3244 maybe_absorb_scoping_blocks ();
3245 yyval.node = exit_block ();
3246 ;
3247 break;}
3248 case 193:
3249 #line 956 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3250 { yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node); ;
3251 break;}
3252 case 196:
3253 #line 966 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3254 { declare_local_variables (0, yyvsp[-1].node, yyvsp[0].node); ;
3255 break;}
3256 case 197:
3257 #line 968 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3258 { declare_local_variables (yyvsp[-2].value, yyvsp[-1].node, yyvsp[0].node); ;
3259 break;}
3260 case 199:
3261 #line 974 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3262 { RULE ("STATEMENT (labeled)"); ;
3263 break;}
3264 case 200:
3265 #line 976 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3266 { RULE ("STATEMENT (if-then)"); ;
3267 break;}
3268 case 201:
3269 #line 978 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3270 { RULE ("STATEMENT (if-then-else)"); ;
3271 break;}
3272 case 202:
3273 #line 980 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3274 { RULE ("STATEMENT (while)"); ;
3275 break;}
3276 case 203:
3277 #line 982 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3278 {
3279 /* If the for loop is unlabeled, we must return the
3280 block it was defined it. It our last chance to
3281 get a hold on it. */
3282 if (!LOOP_HAS_LABEL_P (yyval.node))
3283 yyval.node = exit_block ();
3284 ;
3285 break;}
3286 case 205:
3287 #line 994 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3288 { RULE ("NSI STATEMENT (labeled)"); ;
3289 break;}
3290 case 206:
3291 #line 996 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3292 { RULE ("NSI STATEMENT (if-then-else)"); ;
3293 break;}
3294 case 207:
3295 #line 998 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3296 { RULE ("NSI STATEMENT (while)"); ;
3297 break;}
3298 case 208:
3299 #line 1000 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3300 { RULE ("NSI STATEMENT (for)"); ;
3301 break;}
3302 case 209:
3303 #line 1005 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3304 { RULE ("STATEMENT (block)"); ;
3305 break;}
3306 case 210:
3307 #line 1007 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3308 { RULE ("STATEMENT (empty)"); ;
3309 break;}
3310 case 211:
3311 #line 1009 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3312 { RULE ("STATEMENT (expression)"); ;
3313 break;}
3314 case 212:
3315 #line 1011 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3316 { RULE ("STATEMENT (switch)"); ;
3317 break;}
3318 case 213:
3319 #line 1013 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3320 { RULE ("STATEMENT (do)"); ;
3321 break;}
3322 case 214:
3323 #line 1015 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3324 { RULE ("STATEMENT (break)"); ;
3325 break;}
3326 case 215:
3327 #line 1017 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3328 { RULE ("STATEMENT (continue)"); ;
3329 break;}
3330 case 217:
3331 #line 1020 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3332 { RULE ("STATEMENT (synchronized)"); ;
3333 break;}
3334 case 218:
3335 #line 1022 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3336 { RULE ("STATEMENT (throw)"); ;
3337 break;}
3338 case 219:
3339 #line 1024 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3340 { RULE ("STATEMENT (try)"); ;
3341 break;}
3342 case 220:
3343 #line 1029 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3344 { yyval.node = size_zero_node; ;
3345 break;}
3346 case 221:
3347 #line 1034 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3348 {
3349 yyval.node = build_labeled_block (EXPR_WFL_LINECOL (yyvsp[-1].node),
3350 EXPR_WFL_NODE (yyvsp[-1].node), yyvsp[-1].node);
3351 pushlevel (2);
3352 push_labeled_block (yyval.node);
3353 PUSH_LABELED_BLOCK (yyval.node);
3354 ;
3355 break;}
3356 case 222:
3357 #line 1045 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3358 {
3359 yyval.node = complete_labeled_statement (yyvsp[-1].node, yyvsp[0].node);
3360 pop_labeled_block ();
3361 POP_LABELED_BLOCK ();
3362 ;
3363 break;}
3364 case 223:
3365 #line 1051 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3366 {yyerror ("':' expected"); RECOVER;;
3367 break;}
3368 case 224:
3369 #line 1056 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3370 {
3371 yyval.node = complete_labeled_statement (yyvsp[-1].node, yyvsp[0].node);
3372 pop_labeled_block ();
3373 POP_LABELED_BLOCK ();
3374 ;
3375 break;}
3376 case 225:
3377 #line 1067 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3378 {
3379 /* We have a statement. Generate a WFL around it so
3380 we can debug it */
3381 yyval.node = build_expr_wfl (yyvsp[-1].node, input_filename, lineno, 0);
3382 /* We know we have a statement, so set the debug
3383 info to be eventually generate here. */
3384 yyval.node = JAVA_MAYBE_GENERATE_DEBUG_INFO (yyval.node);
3385 ;
3386 break;}
3387 case 226:
3388 #line 1076 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3389 {
3390 if (ctxp->prevent_ese != lineno)
3391 yyerror ("Invalid expression statement");
3392 DRECOVER (expr_stmt);
3393 ;
3394 break;}
3395 case 227:
3396 #line 1082 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3397 {
3398 if (ctxp->prevent_ese != lineno)
3399 yyerror ("Invalid expression statement");
3400 DRECOVER (expr_stmt);
3401 ;
3402 break;}
3403 case 228:
3404 #line 1088 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3405 {
3406 if (ctxp->prevent_ese != lineno)
3407 yyerror ("Invalid expression statement");
3408 DRECOVER (expr_stmt);
3409 ;
3410 break;}
3411 case 229:
3412 #line 1094 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3413 {yyerror ("')' expected"); RECOVER;;
3414 break;}
3415 case 230:
3416 #line 1096 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3417 {yyerror ("';' expected"); RECOVER;;
3418 break;}
3419 case 231:
3420 #line 1098 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3421 {yyerror ("')' expected"); RECOVER;;
3422 break;}
3423 case 232:
3424 #line 1100 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3425 {yyerror ("';' expected"); RECOVER;;
3426 break;}
3427 case 233:
3428 #line 1102 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3429 {yyerror ("'(' expected"); RECOVER;;
3430 break;}
3431 case 234:
3432 #line 1104 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3433 {yyerror ("')' expected"); RECOVER;;
3434 break;}
3435 case 235:
3436 #line 1106 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3437 {yyerror ("')' expected"); RECOVER;;
3438 break;}
3439 case 236:
3440 #line 1108 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3441 {yyerror ("';' expected"); RECOVER;;
3442 break;}
3443 case 237:
3444 #line 1110 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3445 {yyerror ("';' expected"); RECOVER;;
3446 break;}
3447 case 239:
3448 #line 1116 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3449 {
3450 RULE ("++INCREMENT");
3451 ;
3452 break;}
3453 case 240:
3454 #line 1120 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3455 {
3456 RULE ("--DECREMENT");
3457 ;
3458 break;}
3459 case 241:
3460 #line 1124 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3461 {
3462 RULE ("INCREMENT++");
3463 ;
3464 break;}
3465 case 242:
3466 #line 1128 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3467 {
3468 RULE ("DECREMENT--");
3469 ;
3470 break;}
3471 case 244:
3472 #line 1133 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3473 {
3474 RULE ("INSTANCE CREATION");
3475 ;
3476 break;}
3477 case 245:
3478 #line 1140 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3479 { yyval.node = build_if_else_statement (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node, NULL_TREE); ;
3480 break;}
3481 case 246:
3482 #line 1142 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3483 {yyerror ("'(' expected"); RECOVER;;
3484 break;}
3485 case 247:
3486 #line 1144 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3487 {yyerror ("Missing term"); RECOVER;;
3488 break;}
3489 case 248:
3490 #line 1146 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3491 {yyerror ("')' expected"); RECOVER;;
3492 break;}
3493 case 249:
3494 #line 1151 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3495 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3496 break;}
3497 case 250:
3498 #line 1156 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3499 { yyval.node = build_if_else_statement (yyvsp[-5].operator.location, yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node); ;
3500 break;}
3501 case 252:
3502 #line 1162 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3503 {yyerror ("'(' expected"); RECOVER;;
3504 break;}
3505 case 253:
3506 #line 1164 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3507 {yyerror ("Missing term or ')'"); DRECOVER(switch_statement);;
3508 break;}
3509 case 254:
3510 #line 1166 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3511 {yyerror ("'{' expected"); RECOVER;;
3512 break;}
3513 case 266:
3514 #line 1195 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3515 {yyerror ("Missing or invalid constant expression"); RECOVER;;
3516 break;}
3517 case 267:
3518 #line 1197 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3519 {yyerror ("':' expected"); RECOVER;;
3520 break;}
3521 case 268:
3522 #line 1199 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3523 {yyerror ("':' expected"); RECOVER;;
3524 break;}
3525 case 269:
3526 #line 1204 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3527 {
3528 tree body = build_loop_body (yyvsp[-2].operator.location, yyvsp[-1].node, 0);
3529 yyval.node = build_new_loop (body);
3530 ;
3531 break;}
3532 case 270:
3533 #line 1212 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3534 { yyval.node = complete_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3535 break;}
3536 case 271:
3537 #line 1214 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3538 {YYERROR_NOW; yyerror ("'(' expected"); RECOVER;;
3539 break;}
3540 case 272:
3541 #line 1216 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3542 {yyerror ("Missing term and ')' expected"); RECOVER;;
3543 break;}
3544 case 273:
3545 #line 1218 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3546 {yyerror ("')' expected"); RECOVER;;
3547 break;}
3548 case 274:
3549 #line 1223 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3550 { yyval.node = complete_loop_body (0, NULL_TREE, yyvsp[0].node, 0); ;
3551 break;}
3552 case 275:
3553 #line 1228 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3554 {
3555 tree body = build_loop_body (0, NULL_TREE, 1);
3556 yyval.node = build_new_loop (body);
3557 ;
3558 break;}
3559 case 276:
3560 #line 1237 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3561 { yyval.node = complete_loop_body (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[-5].node, 1); ;
3562 break;}
3563 case 277:
3564 #line 1242 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3565 { yyval.node = complete_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3566 break;}
3567 case 278:
3568 #line 1244 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3569 {
3570 yyval.node = complete_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3571 /* We have not condition, so we get rid of the EXIT_EXPR */
3572 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3573 size_zero_node;
3574 ;
3575 break;}
3576 case 279:
3577 #line 1251 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3578 {yyerror ("Invalid control expression"); RECOVER;;
3579 break;}
3580 case 280:
3581 #line 1253 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3582 {yyerror ("Invalid update expression"); RECOVER;;
3583 break;}
3584 case 281:
3585 #line 1255 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3586 {yyerror ("Invalid update expression"); RECOVER;;
3587 break;}
3588 case 282:
3589 #line 1260 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3590 { yyval.node = complete_for_loop (EXPR_WFL_LINECOL (yyvsp[-4].node), yyvsp[-4].node, yyvsp[-2].node, yyvsp[0].node);;
3591 break;}
3592 case 283:
3593 #line 1262 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3594 {
3595 yyval.node = complete_for_loop (0, NULL_TREE, yyvsp[-2].node, yyvsp[0].node);
3596 /* We have not condition, so we get rid of the EXIT_EXPR */
3597 LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY (yyval.node), 0) =
3598 size_zero_node;
3599 ;
3600 break;}
3601 case 284:
3602 #line 1272 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3603 {
3604 /* This scope defined for local variable that may be
3605 defined within the scope of the for loop */
3606 enter_block ();
3607 ;
3608 break;}
3609 case 285:
3610 #line 1278 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3611 {yyerror ("'(' expected"); DRECOVER(for_1);;
3612 break;}
3613 case 286:
3614 #line 1280 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3615 {yyerror ("Invalid init statement"); RECOVER;;
3616 break;}
3617 case 287:
3618 #line 1285 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3619 {
3620 /* We now declare the loop body. The loop is
3621 declared as a for loop. */
3622 tree body = build_loop_body (0, NULL_TREE, 0);
3623 yyval.node = build_new_loop (body);
3624 IS_FOR_LOOP_P (yyval.node) = 1;
3625 /* The loop is added to the current block the for
3626 statement is defined within */
3627 java_method_add_stmt (current_function_decl, yyval.node);
3628 ;
3629 break;}
3630 case 288:
3631 #line 1297 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3632 { yyval.node = size_zero_node; ;
3633 break;}
3634 case 289:
3635 #line 1299 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3636 {
3637 /* Init statement recorded within the previously
3638 defined block scope */
3639 yyval.node = java_method_add_stmt (current_function_decl, yyvsp[0].node);
3640 ;
3641 break;}
3642 case 290:
3643 #line 1305 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3644 {
3645 /* Local variable are recorded within the previously
3646 defined block scope */
3647 yyval.node = NULL_TREE;
3648 ;
3649 break;}
3650 case 291:
3651 #line 1311 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3652 {yyerror ("';' expected"); DRECOVER(for_init_1);;
3653 break;}
3654 case 292:
3655 #line 1315 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3656 {yyval.node = size_zero_node;;
3657 break;}
3658 case 293:
3659 #line 1317 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3660 { yyval.node = build_debugable_stmt (BUILD_LOCATION (), yyvsp[0].node); ;
3661 break;}
3662 case 294:
3663 #line 1322 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3664 { yyval.node = add_stmt_to_compound (NULL_TREE, NULL_TREE, yyvsp[0].node); ;
3665 break;}
3666 case 295:
3667 #line 1324 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3668 { yyval.node = add_stmt_to_compound (yyvsp[-2].node, NULL_TREE, yyvsp[0].node); ;
3669 break;}
3670 case 296:
3671 #line 1326 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3672 {yyerror ("Missing term"); RECOVER;;
3673 break;}
3674 case 297:
3675 #line 1331 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3676 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 1, NULL_TREE); ;
3677 break;}
3678 case 298:
3679 #line 1333 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3680 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 1, yyvsp[-1].node); ;
3681 break;}
3682 case 299:
3683 #line 1335 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3684 {yyerror ("Missing term"); RECOVER;;
3685 break;}
3686 case 300:
3687 #line 1337 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3688 {yyerror ("';' expected"); RECOVER;;
3689 break;}
3690 case 301:
3691 #line 1342 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3692 { yyval.node = build_bc_statement (yyvsp[-1].operator.location, 0, NULL_TREE); ;
3693 break;}
3694 case 302:
3695 #line 1344 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3696 { yyval.node = build_bc_statement (yyvsp[-2].operator.location, 0, yyvsp[-1].node); ;
3697 break;}
3698 case 303:
3699 #line 1346 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3700 {yyerror ("Missing term"); RECOVER;;
3701 break;}
3702 case 304:
3703 #line 1348 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3704 {yyerror ("';' expected"); RECOVER;;
3705 break;}
3706 case 305:
3707 #line 1353 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3708 { yyval.node = build_return (yyvsp[-1].operator.location, NULL_TREE); ;
3709 break;}
3710 case 306:
3711 #line 1355 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3712 { yyval.node = build_return (yyvsp[-2].operator.location, yyvsp[-1].node); ;
3713 break;}
3714 case 307:
3715 #line 1357 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3716 {yyerror ("Missing term"); RECOVER;;
3717 break;}
3718 case 308:
3719 #line 1359 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3720 {yyerror ("';' expected"); RECOVER;;
3721 break;}
3722 case 310:
3723 #line 1365 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3724 {yyerror ("Missing term"); RECOVER;;
3725 break;}
3726 case 311:
3727 #line 1367 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3728 {yyerror ("';' expected"); RECOVER;;
3729 break;}
3730 case 313:
3731 #line 1373 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3732 {yyerror ("'{' expected"); RECOVER;;
3733 break;}
3734 case 314:
3735 #line 1375 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3736 {yyerror ("'(' expected"); RECOVER;;
3737 break;}
3738 case 315:
3739 #line 1377 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3740 {yyerror ("Missing term"); RECOVER;;
3741 break;}
3742 case 316:
3743 #line 1379 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3744 {yyerror ("Missing term"); RECOVER;;
3745 break;}
3746 case 317:
3747 #line 1384 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3748 {
3749 SOURCE_FRONTEND_DEBUG (("Modifiers: %d", yyvsp[0].value));
3750 ;
3751 break;}
3752 case 321:
3753 #line 1394 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3754 {yyerror ("'{' expected"); DRECOVER (try_statement);;
3755 break;}
3756 case 325:
3757 #line 1405 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3758 {yyerror ("'(' expected"); RECOVER;;
3759 break;}
3760 case 326:
3761 #line 1407 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3762 {yyerror ("Missing term"); DRECOVER (1);;
3763 break;}
3764 case 327:
3765 #line 1409 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3766 {yyerror ("Missing term"); DRECOVER (2);;
3767 break;}
3768 case 329:
3769 #line 1415 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3770 {yyerror ("'{' expected"); RECOVER; ;
3771 break;}
3772 case 333:
3773 #line 1427 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3774 { yyval.node = build_this (yyvsp[0].operator.location); ;
3775 break;}
3776 case 334:
3777 #line 1429 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3778 {yyval.node = yyvsp[-1].node;;
3779 break;}
3780 case 343:
3781 #line 1445 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3782 {yyerror ("')' expected"); RECOVER;;
3783 break;}
3784 case 344:
3785 #line 1447 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3786 {yyerror ("'class' or 'this' expected" ); RECOVER;;
3787 break;}
3788 case 345:
3789 #line 1449 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3790 {yyerror ("'class' expected" ); RECOVER;;
3791 break;}
3792 case 346:
3793 #line 1451 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3794 {yyerror ("'class' expected" ); RECOVER;;
3795 break;}
3796 case 347:
3797 #line 1456 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3798 {
3799 yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
3800 TREE_SET_CODE (yyval.node, JAVA_NEW_CLASS_EXPR);
3801 ;
3802 break;}
3803 case 348:
3804 #line 1461 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3805 {
3806 yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE);
3807 TREE_SET_CODE (yyval.node, JAVA_NEW_CLASS_EXPR);
3808 ;
3809 break;}
3810 case 349:
3811 #line 1469 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3812 {yyval.node = yyvsp[-4].node;;
3813 break;}
3814 case 350:
3815 #line 1471 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3816 {yyval.node = yyvsp[-3].node;;
3817 break;}
3818 case 355:
3819 #line 1480 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3820 {yyerror ("'(' expected"); DRECOVER(new_1);;
3821 break;}
3822 case 356:
3823 #line 1482 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3824 {yyerror ("'(' expected"); RECOVER;;
3825 break;}
3826 case 357:
3827 #line 1484 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3828 {yyerror ("')' or term expected"); RECOVER;;
3829 break;}
3830 case 358:
3831 #line 1486 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3832 {yyerror ("')' expected"); RECOVER;;
3833 break;}
3834 case 359:
3835 #line 1488 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3836 {YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;;
3837 break;}
3838 case 360:
3839 #line 1490 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3840 {yyerror ("'(' expected"); RECOVER;;
3841 break;}
3842 case 363:
3843 #line 1500 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3844 {
3845 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, NULL_TREE);
3846 ctxp->formal_parameter_number = 1;
3847 ;
3848 break;}
3849 case 364:
3850 #line 1505 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3851 {
3852 ctxp->formal_parameter_number += 1;
3853 yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyvsp[-2].node);
3854 ;
3855 break;}
3856 case 365:
3857 #line 1510 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3858 {yyerror ("Missing term"); RECOVER;;
3859 break;}
3860 case 366:
3861 #line 1515 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3862 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
3863 break;}
3864 case 367:
3865 #line 1517 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3866 { yyval.node = build_newarray_node (yyvsp[-1].node, yyvsp[0].node, 0); ;
3867 break;}
3868 case 368:
3869 #line 1519 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3870 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, ctxp->osb_number); ;
3871 break;}
3872 case 369:
3873 #line 1521 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3874 { yyval.node = build_newarray_node (yyvsp[-2].node, yyvsp[-1].node, ctxp->osb_number); ;
3875 break;}
3876 case 370:
3877 #line 1525 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3878 {yyval.node = yyvsp[-2].node;;
3879 break;}
3880 case 371:
3881 #line 1527 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3882 {yyval.node = yyvsp[-2].node;;
3883 break;}
3884 case 372:
3885 #line 1529 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3886 {yyerror ("'[' expected"); DRECOVER ("]");;
3887 break;}
3888 case 373:
3889 #line 1531 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3890 {yyerror ("']' expected"); RECOVER;;
3891 break;}
3892 case 374:
3893 #line 1536 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3894 { yyval.node = build_tree_list (NULL_TREE, yyvsp[0].node); ;
3895 break;}
3896 case 375:
3897 #line 1538 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3898 { yyval.node = tree_cons (NULL_TREE, yyvsp[0].node, yyval.node); ;
3899 break;}
3900 case 376:
3901 #line 1543 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3902 {
3903 EXPR_WFL_LINECOL (yyvsp[-1].node) = yyvsp[-2].operator.location;
3904 yyval.node = yyvsp[-1].node;
3905 ;
3906 break;}
3907 case 377:
3908 #line 1548 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3909 {yyerror ("']' expected"); RECOVER;;
3910 break;}
3911 case 378:
3912 #line 1550 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3913 {
3914 yyerror ("Missing term");
3915 yyerror ("']' expected");
3916 RECOVER;
3917 ;
3918 break;}
3919 case 379:
3920 #line 1559 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3921 { ctxp->osb_number = 1; ;
3922 break;}
3923 case 380:
3924 #line 1561 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3925 { ctxp->osb_number++; ;
3926 break;}
3927 case 381:
3928 #line 1563 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3929 { yyerror ("']' expected"); RECOVER;;
3930 break;}
3931 case 382:
3932 #line 1568 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3933 { yyval.node = make_qualified_primary (yyvsp[-2].node, yyvsp[0].node, yyvsp[-1].operator.location); ;
3934 break;}
3935 case 383:
3936 #line 1570 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3937 {
3938 tree super_wfl =
3939 build_wfl_node (super_identifier_node, input_filename, 0, 0);
3940 EXPR_WFL_LINECOL (super_wfl) = yyvsp[-2].operator.location;
3941 yyval.node = make_qualified_name (super_wfl, yyvsp[0].node, yyvsp[-1].operator.location);
3942 ;
3943 break;}
3944 case 384:
3945 #line 1577 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3946 {yyerror ("Field expected"); DRECOVER (super_field_acces);;
3947 break;}
3948 case 385:
3949 #line 1582 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3950 { yyval.node = build_method_invocation (yyvsp[-2].node, NULL_TREE); ;
3951 break;}
3952 case 386:
3953 #line 1584 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3954 { yyval.node = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node); ;
3955 break;}
3956 case 387:
3957 #line 1586 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3958 {
3959 tree invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
3960 yyval.node = make_qualified_primary (yyvsp[-4].node, invok, yyvsp[-3].operator.location);
3961 ;
3962 break;}
3963 case 388:
3964 #line 1591 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3965 {
3966 tree invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
3967 yyval.node = make_qualified_primary (yyvsp[-5].node, invok, yyvsp[-4].operator.location);
3968 ;
3969 break;}
3970 case 389:
3971 #line 1596 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3972 {
3973 tree invok;
3974 tree wfl = build_wfl_node (super_identifier_node, input_filename, 0, 0);
3975 EXPR_WFL_LINECOL (wfl) = yyvsp[-4].operator.location;
3976 invok = build_method_invocation (yyvsp[-2].node, NULL_TREE);
3977 yyval.node = make_qualified_primary (wfl, invok, yyvsp[-3].operator.location);
3978 ;
3979 break;}
3980 case 390:
3981 #line 1604 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3982 {
3983 tree invok;
3984 tree wfl = build_wfl_node (super_identifier_node, input_filename, 0, 0);
3985 EXPR_WFL_LINECOL (wfl) = yyvsp[-5].operator.location;
3986 invok = build_method_invocation (yyvsp[-3].node, yyvsp[-1].node);
3987 yyval.node = make_qualified_primary (wfl, invok, yyvsp[-4].operator.location);
3988 ;
3989 break;}
3990 case 391:
3991 #line 1616 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3992 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
3993 break;}
3994 case 392:
3995 #line 1618 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
3996 { yyerror ("'(' expected"); DRECOVER (method_invocation); ;
3997 break;}
3998 case 393:
3999 #line 1623 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4000 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4001 break;}
4002 case 394:
4003 #line 1625 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4004 { yyval.node = build_array_ref (yyvsp[-2].operator.location, yyvsp[-3].node, yyvsp[-1].node); ;
4005 break;}
4006 case 395:
4007 #line 1627 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4008 {
4009 yyerror ("Missing term and ']' expected");
4010 DRECOVER(array_access);
4011 ;
4012 break;}
4013 case 396:
4014 #line 1632 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4015 {
4016 yyerror ("']' expected");
4017 DRECOVER(array_access);
4018 ;
4019 break;}
4020 case 397:
4021 #line 1637 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4022 {
4023 yyerror ("Missing term and ']' expected");
4024 DRECOVER(array_access);
4025 ;
4026 break;}
4027 case 398:
4028 #line 1642 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4029 {
4030 yyerror ("']' expected");
4031 DRECOVER(array_access);
4032 ;
4033 break;}
4034 case 403:
4035 #line 1657 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4036 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4037 break;}
4038 case 404:
4039 #line 1662 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4040 { yyval.node = build_incdec (yyvsp[0].operator.token, yyvsp[0].operator.location, yyvsp[-1].node, 1); ;
4041 break;}
4042 case 407:
4043 #line 1669 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4044 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4045 break;}
4046 case 408:
4047 #line 1671 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4048 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4049 break;}
4050 case 410:
4051 #line 1674 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4052 {yyerror ("Missing term"); RECOVER;
4053 break;}
4054 case 411:
4055 #line 1676 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4056 {yyerror ("Missing term"); RECOVER;
4057 break;}
4058 case 412:
4059 #line 1681 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4060 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4061 break;}
4062 case 413:
4063 #line 1683 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4064 {yyerror ("Missing term"); RECOVER;
4065 break;}
4066 case 414:
4067 #line 1688 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4068 {yyval.node = build_incdec (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node, 0); ;
4069 break;}
4070 case 415:
4071 #line 1690 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4072 {yyerror ("Missing term"); RECOVER;
4073 break;}
4074 case 417:
4075 #line 1696 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4076 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4077 break;}
4078 case 418:
4079 #line 1698 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4080 {yyval.node = build_unaryop (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[0].node); ;
4081 break;}
4082 case 420:
4083 #line 1701 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4084 {yyerror ("Missing term"); RECOVER;
4085 break;}
4086 case 421:
4087 #line 1703 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4088 {yyerror ("Missing term"); RECOVER;
4089 break;}
4090 case 422:
4091 #line 1708 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4092 {
4093 tree type = yyvsp[-3].node;
4094 while (ctxp->osb_number--)
4095 type = build_java_array_type (type, -1);
4096 yyval.node = build_cast (yyvsp[-4].operator.location, type, yyvsp[0].node);
4097 ;
4098 break;}
4099 case 423:
4100 #line 1715 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4101 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4102 break;}
4103 case 424:
4104 #line 1717 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4105 { yyval.node = build_cast (yyvsp[-3].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4106 break;}
4107 case 425:
4108 #line 1719 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4109 {
4110 char *ptr;
4111 while (ctxp->osb_number--)
4112 obstack_1grow (&temporary_obstack, '[');
4113 obstack_grow0 (&temporary_obstack,
4114 IDENTIFIER_POINTER (EXPR_WFL_NODE (yyvsp[-3].node)),
4115 IDENTIFIER_LENGTH (EXPR_WFL_NODE (yyvsp[-3].node)));
4116 ptr = obstack_finish (&temporary_obstack);
4117 EXPR_WFL_NODE (yyvsp[-3].node) = get_identifier (ptr);
4118 yyval.node = build_cast (yyvsp[-4].operator.location, yyvsp[-3].node, yyvsp[0].node);
4119 ;
4120 break;}
4121 case 426:
4122 #line 1731 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4123 {yyerror ("']' expected, invalid type expression");;
4124 break;}
4125 case 427:
4126 #line 1733 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4127 {
4128 if (ctxp->prevent_ese != lineno)
4129 yyerror ("Invalid type expression"); RECOVER;
4130 RECOVER;
4131 ;
4132 break;}
4133 case 428:
4134 #line 1739 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4135 {yyerror ("Missing term"); RECOVER;;
4136 break;}
4137 case 429:
4138 #line 1741 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4139 {yyerror ("Missing term"); RECOVER;;
4140 break;}
4141 case 430:
4142 #line 1743 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4143 {yyerror ("Missing term"); RECOVER;;
4144 break;}
4145 case 432:
4146 #line 1749 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4147 {
4148 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token),
4149 yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node);
4150 ;
4151 break;}
4152 case 433:
4153 #line 1754 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4154 {
4155 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4156 yyvsp[-2].node, yyvsp[0].node);
4157 ;
4158 break;}
4159 case 434:
4160 #line 1759 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4161 {
4162 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4163 yyvsp[-2].node, yyvsp[0].node);
4164 ;
4165 break;}
4166 case 435:
4167 #line 1764 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4168 {yyerror ("Missing term"); RECOVER;;
4169 break;}
4170 case 436:
4171 #line 1766 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4172 {yyerror ("Missing term"); RECOVER;;
4173 break;}
4174 case 437:
4175 #line 1768 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4176 {yyerror ("Missing term"); RECOVER;;
4177 break;}
4178 case 439:
4179 #line 1774 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4180 {
4181 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4182 yyvsp[-2].node, yyvsp[0].node);
4183 ;
4184 break;}
4185 case 440:
4186 #line 1779 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4187 {
4188 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4189 yyvsp[-2].node, yyvsp[0].node);
4190 ;
4191 break;}
4192 case 441:
4193 #line 1784 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4194 {yyerror ("Missing term"); RECOVER;;
4195 break;}
4196 case 442:
4197 #line 1786 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4198 {yyerror ("Missing term"); RECOVER;;
4199 break;}
4200 case 444:
4201 #line 1792 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4202 {
4203 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4204 yyvsp[-2].node, yyvsp[0].node);
4205 ;
4206 break;}
4207 case 445:
4208 #line 1797 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4209 {
4210 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4211 yyvsp[-2].node, yyvsp[0].node);
4212 ;
4213 break;}
4214 case 446:
4215 #line 1802 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4216 {
4217 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4218 yyvsp[-2].node, yyvsp[0].node);
4219 ;
4220 break;}
4221 case 447:
4222 #line 1807 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4223 {yyerror ("Missing term"); RECOVER;;
4224 break;}
4225 case 448:
4226 #line 1809 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4227 {yyerror ("Missing term"); RECOVER;;
4228 break;}
4229 case 449:
4230 #line 1811 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4231 {yyerror ("Missing term"); RECOVER;;
4232 break;}
4233 case 451:
4234 #line 1817 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4235 {
4236 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4237 yyvsp[-2].node, yyvsp[0].node);
4238 ;
4239 break;}
4240 case 452:
4241 #line 1822 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4242 {
4243 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4244 yyvsp[-2].node, yyvsp[0].node);
4245 ;
4246 break;}
4247 case 453:
4248 #line 1827 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4249 {
4250 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4251 yyvsp[-2].node, yyvsp[0].node);
4252 ;
4253 break;}
4254 case 454:
4255 #line 1832 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4256 {
4257 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4258 yyvsp[-2].node, yyvsp[0].node);
4259 ;
4260 break;}
4261 case 456:
4262 #line 1838 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4263 {yyerror ("Missing term"); RECOVER;;
4264 break;}
4265 case 457:
4266 #line 1840 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4267 {yyerror ("Missing term"); RECOVER;;
4268 break;}
4269 case 458:
4270 #line 1842 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4271 {yyerror ("Missing term"); RECOVER;;
4272 break;}
4273 case 459:
4274 #line 1844 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4275 {yyerror ("Missing term"); RECOVER;;
4276 break;}
4277 case 460:
4278 #line 1846 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4279 {yyerror ("Invalid reference type"); RECOVER;;
4280 break;}
4281 case 462:
4282 #line 1852 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4283 {
4284 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4285 yyvsp[-2].node, yyvsp[0].node);
4286 ;
4287 break;}
4288 case 463:
4289 #line 1857 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4290 {
4291 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4292 yyvsp[-2].node, yyvsp[0].node);
4293 ;
4294 break;}
4295 case 464:
4296 #line 1862 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4297 {yyerror ("Missing term"); RECOVER;;
4298 break;}
4299 case 465:
4300 #line 1864 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4301 {yyerror ("Missing term"); RECOVER;;
4302 break;}
4303 case 467:
4304 #line 1870 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4305 {
4306 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4307 yyvsp[-2].node, yyvsp[0].node);
4308 ;
4309 break;}
4310 case 468:
4311 #line 1875 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4312 {yyerror ("Missing term"); RECOVER;;
4313 break;}
4314 case 470:
4315 #line 1881 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4316 {
4317 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4318 yyvsp[-2].node, yyvsp[0].node);
4319 ;
4320 break;}
4321 case 471:
4322 #line 1886 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4323 {yyerror ("Missing term"); RECOVER;;
4324 break;}
4325 case 473:
4326 #line 1892 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4327 {
4328 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4329 yyvsp[-2].node, yyvsp[0].node);
4330 ;
4331 break;}
4332 case 474:
4333 #line 1897 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4334 {yyerror ("Missing term"); RECOVER;;
4335 break;}
4336 case 476:
4337 #line 1903 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4338 {
4339 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4340 yyvsp[-2].node, yyvsp[0].node);
4341 ;
4342 break;}
4343 case 477:
4344 #line 1908 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4345 {yyerror ("Missing term"); RECOVER;;
4346 break;}
4347 case 479:
4348 #line 1914 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4349 {
4350 yyval.node = build_binop (BINOP_LOOKUP (yyvsp[-1].operator.token), yyvsp[-1].operator.location,
4351 yyvsp[-2].node, yyvsp[0].node);
4352 ;
4353 break;}
4354 case 480:
4355 #line 1919 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4356 {yyerror ("Missing term"); RECOVER;;
4357 break;}
4358 case 483:
4359 #line 1926 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4360 {
4361 YYERROR_NOW;
4362 yyerror ("Missing term");
4363 DRECOVER (1);
4364 ;
4365 break;}
4366 case 484:
4367 #line 1932 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4368 {yyerror ("Missing term"); DRECOVER (2);;
4369 break;}
4370 case 485:
4371 #line 1934 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4372 {yyerror ("Missing term"); DRECOVER (3);;
4373 break;}
4374 case 488:
4375 #line 1944 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4376 { yyval.node = build_assignment (yyvsp[-1].operator.token, yyvsp[-1].operator.location, yyvsp[-2].node, yyvsp[0].node); ;
4377 break;}
4378 case 489:
4379 #line 1946 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4380 {
4381 if (ctxp->prevent_ese != lineno)
4382 yyerror ("Missing term");
4383 DRECOVER (assign);
4384 ;
4385 break;}
4386 }
4387 /* the action file gets copied in in place of this dollarsign */
4388 #line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple"
4389 \f
4390 yyvsp -= yylen;
4391 yyssp -= yylen;
4392 #ifdef YYLSP_NEEDED
4393 yylsp -= yylen;
4394 #endif
4395
4396 #if YYDEBUG != 0
4397 if (yydebug)
4398 {
4399 short *ssp1 = yyss - 1;
4400 fprintf (stderr, "state stack now");
4401 while (ssp1 != yyssp)
4402 fprintf (stderr, " %d", *++ssp1);
4403 fprintf (stderr, "\n");
4404 }
4405 #endif
4406
4407 *++yyvsp = yyval;
4408
4409 #ifdef YYLSP_NEEDED
4410 yylsp++;
4411 if (yylen == 0)
4412 {
4413 yylsp->first_line = yylloc.first_line;
4414 yylsp->first_column = yylloc.first_column;
4415 yylsp->last_line = (yylsp-1)->last_line;
4416 yylsp->last_column = (yylsp-1)->last_column;
4417 yylsp->text = 0;
4418 }
4419 else
4420 {
4421 yylsp->last_line = (yylsp+yylen-1)->last_line;
4422 yylsp->last_column = (yylsp+yylen-1)->last_column;
4423 }
4424 #endif
4425
4426 /* Now "shift" the result of the reduction.
4427 Determine what state that goes to,
4428 based on the state we popped back to
4429 and the rule number reduced by. */
4430
4431 yyn = yyr1[yyn];
4432
4433 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
4434 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
4435 yystate = yytable[yystate];
4436 else
4437 yystate = yydefgoto[yyn - YYNTBASE];
4438
4439 goto yynewstate;
4440
4441 yyerrlab: /* here on detecting error */
4442
4443 if (! yyerrstatus)
4444 /* If not already recovering from an error, report this error. */
4445 {
4446 ++yynerrs;
4447
4448 #ifdef YYERROR_VERBOSE
4449 yyn = yypact[yystate];
4450
4451 if (yyn > YYFLAG && yyn < YYLAST)
4452 {
4453 int size = 0;
4454 char *msg;
4455 int x, count;
4456
4457 count = 0;
4458 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
4459 for (x = (yyn < 0 ? -yyn : 0);
4460 x < (sizeof(yytname) / sizeof(char *)); x++)
4461 if (yycheck[x + yyn] == x)
4462 size += strlen(yytname[x]) + 15, count++;
4463 msg = (char *) malloc(size + 15);
4464 if (msg != 0)
4465 {
4466 strcpy(msg, "parse error");
4467
4468 if (count < 5)
4469 {
4470 count = 0;
4471 for (x = (yyn < 0 ? -yyn : 0);
4472 x < (sizeof(yytname) / sizeof(char *)); x++)
4473 if (yycheck[x + yyn] == x)
4474 {
4475 strcat(msg, count == 0 ? ", expecting `" : " or `");
4476 strcat(msg, yytname[x]);
4477 strcat(msg, "'");
4478 count++;
4479 }
4480 }
4481 yyerror(msg);
4482 free(msg);
4483 }
4484 else
4485 yyerror ("parse error; also virtual memory exceeded");
4486 }
4487 else
4488 #endif /* YYERROR_VERBOSE */
4489 yyerror("parse error");
4490 }
4491
4492 goto yyerrlab1;
4493 yyerrlab1: /* here on error raised explicitly by an action */
4494
4495 if (yyerrstatus == 3)
4496 {
4497 /* if just tried and failed to reuse lookahead token after an error, discard it. */
4498
4499 /* return failure if at end of input */
4500 if (yychar == YYEOF)
4501 YYABORT;
4502
4503 #if YYDEBUG != 0
4504 if (yydebug)
4505 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
4506 #endif
4507
4508 yychar = YYEMPTY;
4509 }
4510
4511 /* Else will try to reuse lookahead token
4512 after shifting the error token. */
4513
4514 yyerrstatus = 3; /* Each real token shifted decrements this */
4515
4516 goto yyerrhandle;
4517
4518 yyerrdefault: /* current state does not do anything special for the error token. */
4519
4520 #if 0
4521 /* This is wrong; only states that explicitly want error tokens
4522 should shift them. */
4523 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
4524 if (yyn) goto yydefault;
4525 #endif
4526
4527 yyerrpop: /* pop the current state because it cannot handle the error token */
4528
4529 if (yyssp == yyss) YYABORT;
4530 yyvsp--;
4531 yystate = *--yyssp;
4532 #ifdef YYLSP_NEEDED
4533 yylsp--;
4534 #endif
4535
4536 #if YYDEBUG != 0
4537 if (yydebug)
4538 {
4539 short *ssp1 = yyss - 1;
4540 fprintf (stderr, "Error: state stack now");
4541 while (ssp1 != yyssp)
4542 fprintf (stderr, " %d", *++ssp1);
4543 fprintf (stderr, "\n");
4544 }
4545 #endif
4546
4547 yyerrhandle:
4548
4549 yyn = yypact[yystate];
4550 if (yyn == YYFLAG)
4551 goto yyerrdefault;
4552
4553 yyn += YYTERROR;
4554 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
4555 goto yyerrdefault;
4556
4557 yyn = yytable[yyn];
4558 if (yyn < 0)
4559 {
4560 if (yyn == YYFLAG)
4561 goto yyerrpop;
4562 yyn = -yyn;
4563 goto yyreduce;
4564 }
4565 else if (yyn == 0)
4566 goto yyerrpop;
4567
4568 if (yyn == YYFINAL)
4569 YYACCEPT;
4570
4571 #if YYDEBUG != 0
4572 if (yydebug)
4573 fprintf(stderr, "Shifting error token, ");
4574 #endif
4575
4576 *++yyvsp = yylval;
4577 #ifdef YYLSP_NEEDED
4578 *++yylsp = yylloc;
4579 #endif
4580
4581 yystate = yyn;
4582 goto yynewstate;
4583 }
4584 #line 1972 "/nfs/hoser/beer/java/egcs/gcc/java/parse.y"
4585
4586 \f
4587
4588 #include "lex.c"
4589
4590 /* Flag for the error report routine to issue the error the first time
4591 it's called (overriding the default behavior which is to drop the
4592 first invocation and honor the second one, taking advantage of a
4593 richer context. */
4594 static int force_error = 0;
4595
4596 /* Create a new parser context and make it the current one. */
4597
4598 void
4599 java_push_parser_context ()
4600 {
4601 struct parser_ctxt *new =
4602 (struct parser_ctxt *)malloc(sizeof (struct parser_ctxt));
4603
4604 bzero (new, sizeof (struct parser_ctxt));
4605 new->next = ctxp;
4606 ctxp = new;
4607 if (ctxp->next)
4608 ctxp->incomplete_class = ctxp->next->incomplete_class;
4609 }
4610
4611 void
4612 java_parser_context_save_global ()
4613 {
4614 ctxp->finput = finput;
4615 ctxp->lineno = lineno;
4616 ctxp->current_class = current_class;
4617 ctxp->filename = input_filename;
4618 ctxp->current_function_decl = current_function_decl;
4619 }
4620
4621 void
4622 java_parser_context_restore_global ()
4623 {
4624 finput = ctxp->finput;
4625 lineno = ctxp->lineno;
4626 current_class = ctxp->current_class;
4627 input_filename = ctxp->filename;
4628 current_function_decl = ctxp->current_function_decl;
4629 }
4630
4631 void
4632 java_pop_parser_context ()
4633 {
4634 tree current;
4635 struct parser_ctxt *toFree = ctxp;
4636 struct parser_ctxt *next = ctxp->next;
4637
4638 if (next)
4639 {
4640 next->incomplete_class = ctxp->incomplete_class;
4641 lineno = ctxp->lineno;
4642 finput = ctxp->finput;
4643 current_class = ctxp->current_class;
4644 }
4645
4646 /* Set the single import class file flag to 0 for the current list
4647 of imported things */
4648 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
4649 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 0;
4650
4651 /* And restore those of the previous context */
4652 if (ctxp = next)
4653 for (current = ctxp->import_list; current; current = TREE_CHAIN (current))
4654 IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (TREE_PURPOSE (current)) = 1;
4655
4656 free (toFree);
4657 }
4658
4659 static int do_warning = 0;
4660
4661 void
4662 yyerror (msg)
4663 char *msg;
4664 {
4665 static java_lc elc;
4666 static int prev_lineno;
4667 static char *prev_msg;
4668
4669 int i, save_lineno;
4670 char *remainder, *code_from_source;
4671 extern struct obstack temporary_obstack;
4672
4673 if (!force_error && prev_lineno == lineno)
4674 return;
4675
4676 /* Save current error location but report latter, when the context is
4677 richer. */
4678 if (ctxp->java_error_flag == 0)
4679 {
4680 ctxp->java_error_flag = 1;
4681 elc = ctxp->elc;
4682 /* Do something to use the previous line if we're reaching the
4683 end of the file... */
4684 #ifdef VERBOSE_SKELETON
4685 printf ("* Error detected (%s)\n", (msg ? msg : "(null)"));
4686 #endif
4687 return;
4688 }
4689
4690 /* Ignore duplicate message on the same line. BTW, this is dubious. FIXME */
4691 if (!force_error && msg == prev_msg && prev_lineno == elc.line)
4692 return;
4693
4694 ctxp->java_error_flag = 0;
4695 if (do_warning)
4696 java_warning_count++;
4697 else
4698 java_error_count++;
4699
4700 if (elc.col == 0 && msg[1] == ';')
4701 {
4702 elc.col = ctxp->p_line->char_col-1;
4703 elc.line = ctxp->p_line->lineno;
4704 }
4705
4706 save_lineno = lineno;
4707 prev_lineno = lineno = elc.line;
4708 prev_msg = msg;
4709
4710 code_from_source = java_get_line_col (ctxp->filename, elc.line, elc.col);
4711 obstack_grow0 (&temporary_obstack,
4712 code_from_source, strlen (code_from_source));
4713 remainder = obstack_finish (&temporary_obstack);
4714 if (do_warning)
4715 warning ("%s.\n%s", msg, remainder);
4716 else
4717 error ("%s.\n%s", msg, remainder);
4718
4719 /* This allow us to cheaply avoid an extra 'Invalid expression
4720 statement' error report when errors have been already reported on
4721 the same line. This occurs when we report an error but don't have
4722 a synchronization point other than ';', which
4723 expression_statement is the only one to take care of. */
4724 ctxp->prevent_ese = lineno = save_lineno;
4725 }
4726
4727 static void
4728 parse_error (msg)
4729 char *msg;
4730 {
4731 java_error (NULL);
4732 java_error (msg);
4733 }
4734
4735 /* Issue an error message at a current source line CL */
4736
4737 static void
4738 parse_error_context VPROTO ((tree cl, char *msg, ...))
4739 {
4740 #ifndef __STDC__
4741 tree cl;
4742 char *msg;
4743 #endif
4744 char buffer [4096];
4745 va_list ap;
4746
4747 VA_START (ap, msg);
4748 #ifndef __STDC__
4749 cl = va_arg (ap, tree);
4750 msg = va_arg (ap, char *);
4751 #endif
4752 vsprintf (buffer, msg, ap);
4753
4754 force_error = 1;
4755 ctxp->elc.line = EXPR_WFL_LINENO (cl);
4756 ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : EXPR_WFL_COLNO (cl));
4757
4758 parse_error (buffer);
4759 force_error = 0;
4760 }
4761
4762 /* Issue a warning at a current source line CL */
4763
4764 static void
4765 parse_warning_context VPROTO ((tree cl, char *msg, ...))
4766 {
4767 #ifndef __STDC__
4768 tree cl;
4769 char *msg;
4770 #endif
4771 char buffer [4096];
4772 va_list ap;
4773
4774 VA_START (ap, msg);
4775 #ifndef __STDC__
4776 cl = va_arg (ap, tree);
4777 msg = va_arg (ap, char *);
4778 #endif
4779 vsprintf (buffer, msg, ap);
4780
4781 force_error = do_warning = 1;
4782 ctxp->elc.line = EXPR_WFL_LINENO (cl);
4783 ctxp->elc.col = (EXPR_WFL_COLNO (cl) == 0xfff ? -1 : EXPR_WFL_COLNO (cl));
4784
4785 parse_error (buffer);
4786 do_warning = force_error = 0;
4787 }
4788
4789 void
4790 java_report_errors ()
4791 {
4792 if (java_error_count)
4793 fprintf (stderr, "%d error%s",
4794 java_error_count, (java_error_count == 1 ? "" : "s"));
4795 if (java_warning_count)
4796 fprintf (stderr, "%s%d warning%s", (java_error_count ? ", " : ""),
4797 java_warning_count, (java_warning_count == 1 ? "" : "s"));
4798 if (java_error_count || java_warning_count)
4799 putc ('\n', stderr);
4800 }
4801
4802 static char *
4803 java_accstring_lookup (flags)
4804 int flags;
4805 {
4806 static char buffer [80];
4807 #define COPY_RETURN(S) {strcpy (buffer, S); return buffer;}
4808
4809 /* Access modifier looked-up first for easier report on forbidden
4810 access. */
4811 if (flags & ACC_PUBLIC) COPY_RETURN ("public");
4812 if (flags & ACC_PRIVATE) COPY_RETURN ("private");
4813 if (flags & ACC_PROTECTED) COPY_RETURN ("protected");
4814 if (flags & ACC_STATIC) COPY_RETURN ("static");
4815 if (flags & ACC_FINAL) COPY_RETURN ("final");
4816 if (flags & ACC_SYNCHRONIZED) COPY_RETURN ("synchronized");
4817 if (flags & ACC_VOLATILE) COPY_RETURN ("volatile");
4818 if (flags & ACC_TRANSIENT) COPY_RETURN ("transient");
4819 if (flags & ACC_NATIVE) COPY_RETURN ("native");
4820 if (flags & ACC_INTERFACE) COPY_RETURN ("interface");
4821 if (flags & ACC_ABSTRACT) COPY_RETURN ("abstract");
4822
4823 buffer [0] = '\0';
4824 return buffer;
4825 #undef COPY_RETURN
4826 }
4827
4828 static void
4829 redefinition_error (context, id, decl, cl)
4830 char *context;
4831 tree id, decl, cl;
4832 {
4833 parse_error_context (cl, "%s `%s' already defined in %s:%d",
4834 context, IDENTIFIER_POINTER (id),
4835 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
4836 /* Here we should point out where its redefined. It's a unicode. FIXME */
4837 }
4838
4839 /* Build something that the type identifier resolver will identify as
4840 being an array to an unresolved type. TYPE_WFL is a WFL on a
4841 identifier. */
4842
4843 static tree
4844 build_unresolved_array_type (type_or_wfl)
4845 tree type_or_wfl;
4846 {
4847 char *ptr;
4848
4849 /* TYPE_OR_WFL might be an array on a primitive type. In this case,
4850 just create a array type */
4851 if (TREE_CODE (type_or_wfl) == RECORD_TYPE)
4852 {
4853 tree type = build_java_array_type (type_or_wfl, -1);
4854 CLASS_LOADED_P (type) = CLASS_LOADED_P (type_or_wfl);
4855 return type;
4856 }
4857
4858 obstack_1grow (&temporary_obstack, '[');
4859 obstack_grow0 (&temporary_obstack,
4860 IDENTIFIER_POINTER (EXPR_WFL_NODE (type_or_wfl)),
4861 IDENTIFIER_LENGTH (EXPR_WFL_NODE (type_or_wfl)));
4862 ptr = obstack_finish (&temporary_obstack);
4863 return build_expr_wfl (get_identifier (ptr),
4864 EXPR_WFL_FILENAME (type_or_wfl),
4865 EXPR_WFL_LINENO (type_or_wfl),
4866 EXPR_WFL_COLNO (type_or_wfl));
4867 }
4868
4869 /* Check modifiers. If one doesn't fit, retrieve it in its declaration line
4870 and point it out. */
4871
4872 static void
4873 check_modifiers (message, value, mask)
4874 char *message;
4875 int value;
4876 int mask;
4877 {
4878 /* Should point out the one that don't fit. ASCII/unicode,
4879 going backward. FIXME */
4880 if (value & ~mask)
4881 {
4882 int i, remainder = value & ~mask;
4883 for (i = 0; i <= 10; i++)
4884 if ((1 << i) & remainder)
4885 parse_error_context (ctxp->modifier_ctx [i], message,
4886 java_accstring_lookup (1 << i));
4887 }
4888 }
4889
4890 static void
4891 parser_add_interface (class_decl, interface_decl, wfl)
4892 tree class_decl, interface_decl, wfl;
4893 {
4894 if (maybe_add_interface (TREE_TYPE (class_decl), TREE_TYPE (interface_decl)))
4895 parse_error_context (wfl, "Interface `%s' repeated",
4896 IDENTIFIER_POINTER (DECL_NAME (interface_decl)));
4897 }
4898
4899 /* Bulk of common class/interface checks. Return 1 if an error was
4900 encountered. TAG is 0 for a class, 1 for an interface. */
4901
4902 static int
4903 check_class_interface_creation (is_interface, flags, raw_name, qualified_name, decl, cl)
4904 int is_interface, flags;
4905 tree raw_name, qualified_name, decl, cl;
4906 {
4907 tree node;
4908
4909 if (!quiet_flag)
4910 fprintf (stderr, " %s %s", (is_interface ? "interface" : "class"),
4911 IDENTIFIER_POINTER (qualified_name));
4912
4913 /* Scope of an interface/class type name:
4914 - Can't be imported by a single type import
4915 - Can't already exists in the package */
4916 if (IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (raw_name)
4917 && (node = find_name_in_single_imports (raw_name)))
4918 {
4919 parse_error_context
4920 (cl, "%s name `%s' clashes with imported type `%s'",
4921 (is_interface ? "Interface" : "Class"),
4922 IDENTIFIER_POINTER (raw_name), IDENTIFIER_POINTER (node));
4923 return 1;
4924 }
4925 if (decl && CLASS_COMPLETE_P (decl))
4926 {
4927 redefinition_error ((is_interface ? "Interface" : "Class"),
4928 qualified_name, decl, cl);
4929 return 1;
4930 }
4931
4932 /* If public, file name should match class/interface name */
4933 if (flags & ACC_PUBLIC)
4934 {
4935 char *f;
4936
4937 /* Contains OS dependent assumption on path separator. FIXME */
4938 for (f = &input_filename [strlen (input_filename)];
4939 f != input_filename && f[0] != '/'; f--);
4940 if (f[0] == '/')
4941 f++;
4942 if (strncmp (IDENTIFIER_POINTER (raw_name),
4943 f , IDENTIFIER_LENGTH (raw_name)) ||
4944 f [IDENTIFIER_LENGTH (raw_name)] != '.')
4945 parse_error_context (cl, "Public %s `%s' must be defined in a file "
4946 "called `%s.java'",
4947 (is_interface ? "interface" : "class"),
4948 IDENTIFIER_POINTER (qualified_name),
4949 IDENTIFIER_POINTER (raw_name));
4950 }
4951
4952 check_modifiers ((is_interface ?
4953 "Illegal modifier `%s' for interface declaration" :
4954 "Illegal modifier `%s' for class declaration"), flags,
4955 (is_interface ? INTERFACE_MODIFIERS : CLASS_MODIFIERS));
4956 return 0;
4957 }
4958
4959 /* If DECL is NULL, create and push a new DECL, record the current
4960 line CL and do other maintenance things. */
4961
4962 static tree
4963 maybe_create_class_interface_decl (decl, qualified_name, cl)
4964 tree decl, qualified_name, cl;
4965 {
4966 if (decl)
4967 DECL_ARTIFICIAL (decl) = 1; /* FIXME */
4968 else
4969 decl = push_class (make_class (), qualified_name);
4970
4971 /* Take care of the file and line business */
4972 DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl);
4973 DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl);
4974 CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1;
4975
4976 ctxp->current_parsed_class = decl;
4977
4978 /* Link the declaration to the already seen ones */
4979 TREE_CHAIN (decl) = ctxp->class_list;
4980 ctxp->class_list = decl;
4981 /* Install a new dependency list element */
4982 create_jdep_list (ctxp);
4983
4984 SOURCE_FRONTEND_DEBUG (("Defining class/interface %s",
4985 IDENTIFIER_POINTER (qualified_name)));
4986 return decl;
4987 }
4988
4989 static void
4990 add_superinterfaces (decl, interface_list)
4991 tree decl, interface_list;
4992 {
4993 tree node;
4994 /* Superinterface(s): if present and defined, parser_check_super_interface ()
4995 takes care of ensuring that:
4996 - This is an accessible interface type,
4997 - Circularity detection.
4998 parser_add_interface is then called. If present but not defined,
4999 the check operation is delayed until the super interface gets
5000 defined. */
5001 for (node = interface_list; node; node = TREE_CHAIN (node))
5002 {
5003 tree current = TREE_PURPOSE (node), interface_decl;
5004 if ((interface_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (current))))
5005 {
5006 if (!parser_check_super_interface (interface_decl, decl, current))
5007 parser_add_interface (decl, interface_decl, current);
5008 }
5009 else
5010 register_incomplete_type (JDEP_INTERFACE,
5011 current, decl, NULL_TREE);
5012 }
5013 }
5014
5015 /* Create an interface in pass1 and return its decl. Return the
5016 interface's decl in pass 2. */
5017
5018 static tree
5019 create_interface (flags, id, super)
5020 int flags;
5021 tree id, super;
5022 {
5023 int chk;
5024 tree raw_name = EXPR_WFL_NODE (id);
5025 tree q_name = parser_qualified_classname (id);
5026 tree decl = IDENTIFIER_CLASS_VALUE (q_name);
5027
5028 EXPR_WFL_NODE (id) = q_name; /* Keep source location, even if refined. */
5029
5030 /* Basic checks: scope, redefinition, modifiers */
5031 if (check_class_interface_creation (1, flags, raw_name, q_name, decl, id))
5032 return NULL_TREE;
5033
5034 /* Interface modifiers check
5035 - public/abstract allowed (already done at that point)
5036 - abstract is obsolete (comes first, it's a warning, or should be)
5037 - Can't use twice the same (checked in the modifier rule) */
5038 if (flags & ACC_ABSTRACT)
5039 parse_warning_context
5040 (MODIFIER_WFL (ABSTRACT_TK),
5041 "Obsolete use of `abstract' modifier. Interface `%s' is implicitely "
5042 "abstract", IDENTIFIER_POINTER (raw_name));
5043 if (flags & ACC_PUBLIC && flags & ACC_ABSTRACT)
5044 parse_error_context
5045 (MODIFIER_WFL (ABSTRACT_TK),
5046 "Can't specify both `public' and `abstract' modifiers in the "
5047 "definition of interface `%s'", IDENTIFIER_POINTER (raw_name));
5048
5049 /* Create a new decl if DECL is NULL, otherwise fix it */
5050 decl = maybe_create_class_interface_decl (decl, q_name, id);
5051
5052 /* Set super info and mark the class a complete */
5053 set_super_info (ACC_ABSTRACT | ACC_INTERFACE | flags, TREE_TYPE (decl),
5054 object_type_node, ctxp->interface_number);
5055 ctxp->interface_number = 0;
5056 CLASS_COMPLETE_P (decl) = 1;
5057 add_superinterfaces (decl, super);
5058
5059 return decl;
5060 }
5061
5062 /* Create an class in pass1 and return its decl. Return class
5063 interface's decl in pass 2. */
5064
5065 static tree
5066 create_class (flags, id, super, interfaces)
5067 int flags;
5068 tree id, super, interfaces;
5069 {
5070 int chk;
5071 tree raw_name = EXPR_WFL_NODE (id);
5072 tree class_id, decl;
5073 tree super_decl = NULL, super_decl_type;
5074
5075 class_id = parser_qualified_classname (id);
5076 decl = IDENTIFIER_CLASS_VALUE (class_id);
5077 EXPR_WFL_NODE (id) = class_id;
5078
5079 /* Basic check: scope, redefinition, modifiers */
5080 if (check_class_interface_creation (0, flags, raw_name, class_id, decl, id))
5081 return NULL_TREE;
5082
5083 /* Class modifier check:
5084 - Allowed modifier (already done at that point)
5085 - abstract AND final forbidden
5086 - Public classes defined in the correct file */
5087 if ((flags & ACC_ABSTRACT) && (flags & ACC_FINAL))
5088 parse_error_context (id, "Class `%s' can't be declared both abstract "
5089 "and final", IDENTIFIER_POINTER (raw_name));
5090
5091 /* Create a new decl if DECL is NULL, otherwise fix it */
5092 decl = maybe_create_class_interface_decl (decl, class_id, id);
5093
5094 /* If SUPER exists, use it, otherwise use Object */
5095 if (super)
5096 {
5097 /* Can't extend java.lang.Object */
5098 if (TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_id)) == object_type_node)
5099 {
5100 parse_error_context (id, "Can't extend `java.lang.Object'");
5101 return NULL_TREE;
5102 }
5103
5104 /* The class is known and exists if there is a decl. Otherwise,
5105 postpone the operation and do it later. */
5106 super_decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (super));
5107 if (super_decl)
5108 {
5109 parser_check_super (super_decl, decl, id);
5110 super_decl_type = TREE_TYPE (super_decl);
5111 }
5112 else
5113 super_decl_type =
5114 register_incomplete_type (JDEP_SUPER, super, decl, NULL_TREE);
5115 }
5116 else if (TREE_TYPE (decl) != object_type_node)
5117 super_decl_type = object_type_node;
5118 /* We're defining java.lang.Object */
5119 else
5120 super_decl_type = NULL_TREE;
5121
5122 /* Set super info and mark the class a complete */
5123 set_super_info (flags, TREE_TYPE (decl), super_decl_type,
5124 ctxp->interface_number);
5125 ctxp->interface_number = 0;
5126 CLASS_COMPLETE_P (decl) = 1;
5127 add_superinterfaces (decl, interfaces);
5128
5129 return decl;
5130 }
5131
5132 /* Can't use lookup_field () since we don't want to load the class and
5133 can't set the CLASS_LOADED_P flag */
5134
5135 static tree
5136 find_field (class, name)
5137 tree class;
5138 tree name;
5139 {
5140 tree decl;
5141 for (decl = TYPE_FIELDS (class); decl; decl = TREE_CHAIN (decl))
5142 {
5143 if (DECL_NAME (decl) == name)
5144 return decl;
5145 }
5146 return NULL_TREE;
5147 }
5148
5149 /* Wrap around lookup_field that doesn't potentially upset the value
5150 of CLASS */
5151
5152 static tree
5153 lookup_field_wrapper (class, name)
5154 tree class, name;
5155 {
5156 tree type = class;
5157 return lookup_field (&type, name);
5158 }
5159
5160 /* Find duplicate field within the same class declarations and report
5161 the error */
5162
5163 static int
5164 duplicate_declaration_error (class, new_field_name, new_type, cl)
5165 tree class, new_field_name, new_type, cl;
5166 {
5167 /* This might be modified to work with method decl as well */
5168 tree decl = find_field (TREE_TYPE (ctxp->current_parsed_class),
5169 new_field_name);
5170 if (decl)
5171 {
5172 char *t1 = strdup ((char *)lang_printable_name (new_type, 1));
5173 char *t2 =
5174 strdup ((TREE_CODE (TREE_TYPE (decl)) == TREE_LIST ?
5175 IDENTIFIER_POINTER (TYPE_NAME
5176 (TREE_PURPOSE (TREE_TYPE (decl)))) :
5177 (char *)lang_printable_name (TREE_TYPE (decl), 1)));
5178 parse_error_context
5179 (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)",
5180 t1, IDENTIFIER_POINTER (new_field_name),
5181 t2, IDENTIFIER_POINTER (DECL_NAME (decl)),
5182 DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
5183 free (t1);
5184 free (t2);
5185 return 0;
5186 }
5187 return 1;
5188 }
5189
5190 /* Field registration routine. If TYPE doesn't exist, field
5191 declarations are linked to the undefined TYPE dependency list, to
5192 be later resolved in java_complete_class () */
5193
5194 static void
5195 register_fields (flags, type, variable_list)
5196 int flags;
5197 tree type, variable_list;
5198 {
5199 tree current, type_decl, returned_type;
5200 tree class_type = TREE_TYPE (ctxp->current_parsed_class);
5201 int saved_lineno = lineno;
5202 int must_chain = 0;
5203 tree wfl = NULL_TREE;
5204
5205 /* If we're adding fields to interfaces, those fields are public,
5206 static, final */
5207 if (CLASS_INTERFACE (TYPE_NAME (class_type)))
5208 {
5209 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK),
5210 flags, ACC_PUBLIC,
5211 "%s", "interface field(s)");
5212 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (STATIC_TK),
5213 flags, ACC_STATIC,
5214 "%s", "interface field(s)");
5215 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (FINAL_TK),
5216 flags, ACC_FINAL, "%s", "interface field(s)");
5217 check_modifiers ("Illegal interface member modifier `%s'", flags,
5218 INTERFACE_FIELD_MODIFIERS);
5219 flags |= (ACC_PUBLIC | ACC_STATIC | ACC_FINAL);
5220 }
5221
5222 if (unresolved_type_p (type, &returned_type))
5223 {
5224 if (returned_type)
5225 type = returned_type;
5226 else
5227 {
5228 wfl = type;
5229 type = obtain_incomplete_type (type);
5230 must_chain = 1;
5231 }
5232 }
5233
5234 for (current = variable_list; current; current = TREE_CHAIN (current))
5235 {
5236 tree cl = TREE_PURPOSE (current);
5237 tree init = TREE_VALUE (current);
5238 tree current_name = EXPR_WFL_NODE (cl);
5239
5240 if (duplicate_declaration_error (class_type, current_name, type, cl))
5241 {
5242 tree field_decl;
5243 lineno = EXPR_WFL_LINENO (cl);
5244 field_decl = add_field (class_type, current_name, type, flags);
5245
5246 /* Check if we must chain. */
5247 if (must_chain)
5248 register_incomplete_type (JDEP_FIELD, wfl, field_decl, type);
5249
5250 /* Default value of a static field is 0 and it is considered
5251 initialized. */
5252 if (flags & ACC_STATIC)
5253 INITIALIZED_P (field_decl) = 1;
5254
5255 /* If we have an initialization value tied to the field */
5256 if (init)
5257 {
5258 /* The field is declared static */
5259 if (flags & ACC_STATIC)
5260 {
5261 /* FIXME */
5262 if (flags & ACC_FINAL)
5263 ;
5264 /* Otherwise, the field should be initialized in
5265 <clinit>. This field is remembered so we can
5266 generate <clinit> later. */
5267 else
5268 {
5269 INITIALIZED_P (field_decl) = 1;
5270 TREE_CHAIN (init) = ctxp->static_initialized;
5271 ctxp->static_initialized = init;
5272 }
5273 }
5274 /* A non-static field declared with an immediate
5275 initialization is to be initialized in <init>, if
5276 any. This field is remembered to be processed at the
5277 time of the generation of <init>. */
5278 else
5279 {
5280 TREE_CHAIN (init) = ctxp->non_static_initialized;
5281 ctxp->non_static_initialized = init;
5282 }
5283 }
5284 }
5285 }
5286 lineno = saved_lineno;
5287 }
5288
5289 /* Check whether it is necessary to generate a <clinit> for the class
5290 we just parsed. */
5291
5292 static void
5293 maybe_generate_clinit ()
5294 {
5295 int saved_lineno;
5296 tree meth, mdecl, c;
5297 tree cclass, class_wfl;
5298
5299 if (!ctxp->static_initialized || java_error_count)
5300 return;
5301
5302 cclass = TREE_TYPE (ctxp->current_parsed_class);
5303 class_wfl = build_expr_wfl (DECL_NAME (TYPE_NAME (cclass)),
5304 input_filename, 0, 0);
5305
5306 saved_lineno = lineno;
5307 lineno = 0;
5308 meth = make_node (FUNCTION_TYPE);
5309 TREE_TYPE (meth) = void_type_node;
5310 TYPE_ARG_TYPES (meth) = NULL_TREE;
5311 mdecl = add_method (cclass, ACC_STATIC, clinit_identifier_node,
5312 build_java_signature (meth));
5313 lineno = saved_lineno;
5314
5315 DECL_SOURCE_LINE (mdecl) = 1;
5316 DECL_SOURCE_LINE_MERGE (mdecl, 1);
5317 source_start_java_method (mdecl);
5318 enter_block ();
5319
5320 /* Keep initialization in order to enforce 8.5 */
5321 ctxp->static_initialized = nreverse (ctxp->static_initialized);
5322
5323 /* We process the list of assignment we produced as the result of
5324 the declaration of initialized static field and add them as
5325 statement to the <clinit> method. */
5326 for (c = ctxp->static_initialized; c; c = TREE_CHAIN (c))
5327 {
5328 /* We build the assignment expression that will initialize the
5329 field to its value. There are strict rules on static
5330 initializers (8.5). FIXME */
5331 java_method_add_stmt (mdecl, c);
5332 }
5333
5334 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = exit_block ();
5335 exit_block ();
5336 ctxp->static_initialized = NULL_TREE;
5337 }
5338
5339 /* Shared accros method_declarator and method_header to remember the
5340 patch stage that was reached during the declaration of the method.
5341 A method DECL is built differently is there is no patch
5342 (JDEP_NO_PATCH) or a patch (JDEP_METHOD or JDEP_METHOD_RETURN)
5343 pending on the currently defined method. */
5344
5345 static int patch_stage;
5346
5347 /* Check the method declaration and add the method to its current
5348 class. If the argument list is known to contain incomplete types,
5349 the method is partially added and the registration will be resume
5350 once the method arguments resolved */
5351
5352 static tree
5353 method_header (flags, type, mdecl, throws)
5354 int flags;
5355 tree type, mdecl, throws;
5356 {
5357 tree meth = TREE_VALUE (mdecl);
5358 tree id = TREE_PURPOSE (mdecl);
5359 tree this_class = TREE_TYPE (ctxp->current_parsed_class);
5360 tree handle_class = CLASS_TO_HANDLE_TYPE (this_class);
5361 tree meth_name, returned_type;
5362 int saved_lineno;
5363
5364 check_modifiers_consistency (flags);
5365
5366 /* There are some forbidden modifiers for an abstract method and its
5367 class must be abstract as well. */
5368 if (flags & ACC_ABSTRACT)
5369 {
5370 ABSTRACT_CHECK (flags, ACC_PRIVATE, id, "Private");
5371 ABSTRACT_CHECK (flags, ACC_STATIC, id, "Static");
5372 ABSTRACT_CHECK (flags, ACC_FINAL, id, "Final");
5373 ABSTRACT_CHECK (flags, ACC_NATIVE, id, "Native");
5374 ABSTRACT_CHECK (flags, ACC_SYNCHRONIZED,id, "Synchronized");
5375 if (!CLASS_ABSTRACT (TYPE_NAME (this_class)))
5376 parse_error_context
5377 (id, "Class `%s' must be declared abstract to define abstract "
5378 "method `%s'",
5379 IDENTIFIER_POINTER (DECL_NAME (ctxp->current_parsed_class)),
5380 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
5381 }
5382
5383
5384 /* Method declared within the scope of an interface are implicitly
5385 abstract and public. Conflicts with other erroneously provided
5386 modifiers are check right after. */
5387
5388 if (CLASS_INTERFACE (TYPE_NAME (this_class)))
5389 {
5390 /* If FLAGS isn't set because of a modifier, turn the
5391 corresponding modifier WFL to NULL so we issue a warning on
5392 the obsolete use of the modifier */
5393 if (!(flags & ACC_PUBLIC))
5394 MODIFIER_WFL (PUBLIC_TK) = NULL;
5395 if (!(flags & ACC_ABSTRACT))
5396 MODIFIER_WFL (ABSTRACT_TK) = NULL;
5397 flags |= ACC_PUBLIC;
5398 flags |= ACC_ABSTRACT;
5399 }
5400
5401 /* Modifiers context reset moved up, so abstract method declaration
5402 modifiers can be later checked. */
5403
5404 meth_name = EXPR_WFL_NODE (id);
5405
5406 if (unresolved_type_p (type, &returned_type))
5407 {
5408 if (returned_type)
5409 TREE_TYPE (meth) = returned_type;
5410 else
5411 {
5412 patch_stage = JDEP_METHOD_RETURN;
5413 TREE_TYPE (meth) =
5414 register_incomplete_type (patch_stage, type, id, NULL_TREE);
5415 }
5416 }
5417 else
5418 TREE_TYPE (meth) = type;
5419
5420 saved_lineno = lineno;
5421 /* When defining an abstract or interface method, the curly
5422 bracket at level 1 doesn't exist because there is no function
5423 body */
5424 lineno = (ctxp->first_ccb_indent1 ? ctxp->first_ccb_indent1 :
5425 EXPR_WFL_LINENO (id));
5426
5427 if (patch_stage) /* includes ret type and/or all args */
5428 {
5429 jdep *jdep;
5430 meth = add_method_1 (this_class, flags, meth_name, meth);
5431 /* Patch for the return type */
5432 if (patch_stage == JDEP_METHOD_RETURN)
5433 {
5434 jdep = CLASSD_LAST (ctxp->classd_list);
5435 JDEP_GET_PATCH (jdep) = &TREE_TYPE (TREE_TYPE (meth));
5436 }
5437 /* This is the stop JDEP. METH allows the function's signature
5438 to be computed. */
5439 register_incomplete_type (JDEP_METHOD_END, NULL_TREE, meth, NULL_TREE);
5440 }
5441 else
5442 {
5443 tree signature = build_java_signature (meth);
5444 tree arg, orig_arg;
5445 /* Save original argument list, including argument's names */
5446 orig_arg = TYPE_ARG_TYPES (meth);
5447 /* Add the method to its class */
5448 meth = add_method (this_class, flags, meth_name, signature);
5449 /* Fix the method argument list so we have the argument name
5450 information */
5451 arg = TYPE_ARG_TYPES (TREE_TYPE (meth));
5452 if (TREE_CODE (TREE_TYPE (meth)) == METHOD_TYPE)
5453 {
5454 TREE_PURPOSE (arg) = this_identifier_node;
5455 arg = TREE_CHAIN (arg);
5456 }
5457 while (orig_arg)
5458 {
5459 TREE_PURPOSE (arg) = TREE_PURPOSE (orig_arg);
5460 orig_arg = TREE_CHAIN (orig_arg);
5461 arg = TREE_CHAIN (arg);
5462 }
5463 }
5464 DECL_MAX_LOCALS (meth) = ctxp->formal_parameter_number+1;
5465 lineno = saved_lineno;
5466 /* We set the DECL_NAME to ID so we can track the location where
5467 the function was declared. This allow us to report
5468 redefinition error accurately. When method are verified,
5469 DECL_NAME is reinstalled properly (using the content of the
5470 WFL node ID) (see check_method_redefinition). We don't do that
5471 when Object is being defined. */
5472 if (TREE_TYPE (ctxp->current_parsed_class) != object_type_node)
5473 DECL_NAME (meth) = id;
5474 return meth;
5475 }
5476
5477 /* Check modifiers that can be declared but exclusively */
5478
5479 static void
5480 check_modifiers_consistency (flags)
5481 int flags;
5482 {
5483 int acc_count = 0;
5484 tree cl = NULL_TREE;
5485
5486 THIS_MODIFIER_ONLY (flags, ACC_PUBLIC, 0, acc_count, cl);
5487 THIS_MODIFIER_ONLY (flags, ACC_PRIVATE, 1, acc_count, cl);
5488 THIS_MODIFIER_ONLY (flags, ACC_PROTECTED, 2, acc_count, cl);
5489 if (acc_count > 1)
5490 parse_error_context
5491 (cl, "Inconsistent member declaration. At most one of `public', "
5492 "`private', or `protected' may be specified");
5493 }
5494
5495 /* Check the methode header METH for abstract specifics features */
5496
5497 static void
5498 check_abstract_method_header (meth)
5499 tree meth;
5500 {
5501 int flags = get_access_flags_from_decl (meth);
5502 /* DECL_NAME might still be a WFL node */
5503 tree name = (TREE_CODE (DECL_NAME (meth)) == EXPR_WITH_FILE_LOCATION ?
5504 EXPR_WFL_NODE (DECL_NAME (meth)) : DECL_NAME (meth));
5505
5506 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (ABSTRACT_TK), flags,
5507 ACC_ABSTRACT, "abstract method `%s'",
5508 IDENTIFIER_POINTER (name));
5509 OBSOLETE_MODIFIER_WARNING (MODIFIER_WFL (PUBLIC_TK), flags,
5510 ACC_PUBLIC, "abstract method `%s'",
5511 IDENTIFIER_POINTER (name));
5512
5513 check_modifiers ("Illegal modifier `%s' for interface method",
5514 flags, INTERFACE_METHOD_MODIFIERS);
5515 }
5516
5517 /* Create a FUNCTION_TYPE node and start augmenting it with the
5518 declared function arguments. Arguments type that can't be resolved
5519 are left as they are, but the returned node is marked as containing
5520 incomplete types. */
5521
5522 static tree
5523 method_declarator (id, list)
5524 tree id, list;
5525 {
5526 tree arg_types = NULL_TREE, current, node;
5527 tree meth = make_node (FUNCTION_TYPE);
5528 jdep *jdep;
5529 int incomplete = 0;
5530
5531 patch_stage = JDEP_NO_PATCH;
5532
5533 for (current = list; current; current = TREE_CHAIN (current))
5534 {
5535 tree wfl_name = TREE_PURPOSE (current);
5536 tree type = TREE_VALUE (current);
5537 tree name = EXPR_WFL_NODE (wfl_name);
5538 tree patchable_type = NULL_TREE, already;
5539 tree arg_node, returned_type;
5540
5541 /* Check redefinition */
5542 for (already = arg_types; already; already = TREE_CHAIN (already))
5543 if (TREE_PURPOSE (already) == name)
5544 {
5545 parse_error_context
5546 (wfl_name, "Variable `%s' is used more than once in the "
5547 "argument list of method `%s'", IDENTIFIER_POINTER (name),
5548 IDENTIFIER_POINTER (EXPR_WFL_NODE (id)));
5549 break;
5550 }
5551
5552 /* If we've an incomplete argument type, we know there is a location
5553 to patch when the type get resolved, later. */
5554 jdep = NULL;
5555 if (unresolved_type_p (type, &returned_type))
5556 {
5557 if (returned_type)
5558 type = returned_type;
5559 else
5560 {
5561 patch_stage = JDEP_METHOD;
5562 type = register_incomplete_type (patch_stage, type,
5563 wfl_name, NULL_TREE);
5564 jdep = CLASSD_LAST (ctxp->classd_list);
5565 JDEP_MISC (jdep) = id;
5566 }
5567 }
5568 /* The argument node: a name and a (possibly) incomplete type */
5569 arg_node = build_tree_list (name, type);
5570 if (jdep)
5571 JDEP_GET_PATCH (jdep) = &TREE_VALUE (arg_node);
5572 TREE_CHAIN (arg_node) = arg_types;
5573 arg_types = arg_node;
5574 }
5575 TYPE_ARG_TYPES (meth) = nreverse (arg_types);
5576 node = build_tree_list (id, meth);
5577 return node;
5578 }
5579
5580 static int
5581 unresolved_type_p (wfl, returned)
5582 tree wfl;
5583 tree *returned;
5584
5585 {
5586 if (TREE_CODE (wfl) == EXPR_WITH_FILE_LOCATION)
5587 {
5588 tree decl = IDENTIFIER_CLASS_VALUE (EXPR_WFL_NODE (wfl));
5589 if (returned)
5590 *returned = (decl ? TREE_TYPE (decl) : NULL_TREE);
5591 return 1;
5592 }
5593 if (returned)
5594 *returned = wfl;
5595 return 0;
5596 }
5597
5598 /* From NAME, build a qualified identifier node using the
5599 qualification from the current package definition. */
5600
5601 static tree
5602 parser_qualified_classname (name)
5603 tree name;
5604 {
5605 if (ctxp->package)
5606 return merge_qualified_name (ctxp->package, EXPR_WFL_NODE (name));
5607 else
5608 return EXPR_WFL_NODE (name);
5609 }
5610
5611 /* Called once the type a interface extends is resolved. Returns 0 if
5612 everything is OK. */
5613
5614 static int
5615 parser_check_super_interface (super_decl, this_decl, this_wfl)
5616 tree super_decl, this_decl, this_wfl;
5617 {
5618 tree super_type = TREE_TYPE (super_decl);
5619
5620 /* Has to be an interface */
5621 if (!CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (super_decl))))
5622 {
5623 parse_error_context
5624 (this_wfl, "Can't use %s `%s' to implement/extend %s `%s'",
5625 (TYPE_ARRAY_P (super_type) ? "array" : "class"),
5626 IDENTIFIER_POINTER (DECL_NAME (super_decl)),
5627 (CLASS_INTERFACE (TYPE_NAME (TREE_TYPE (this_decl))) ?
5628 "interface" : "class"),
5629 IDENTIFIER_POINTER (DECL_NAME (this_decl)));
5630 return 1;
5631 }
5632
5633 /* Check scope: same package OK, other package: OK if public */
5634 if (check_pkg_class_access (DECL_NAME (super_decl), lookup_cl (this_decl)))
5635 return 1;
5636
5637 SOURCE_FRONTEND_DEBUG (("Completing interface %s with %s",
5638 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
5639 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
5640 return 0;
5641 }
5642
5643 /* Makes sure that SUPER_DECL is suitable to extend THIS_DECL. Returns
5644 0 if everthing is OK. */
5645
5646 static int
5647 parser_check_super (super_decl, this_decl, wfl)
5648 tree super_decl, this_decl, wfl;
5649 {
5650 tree this_type = TREE_TYPE (this_decl);
5651 tree super_type = TREE_TYPE (super_decl);
5652
5653 /* SUPER should be a CLASS (neither an array nor an interface) */
5654 if (TYPE_ARRAY_P (super_type) || CLASS_INTERFACE (TYPE_NAME (super_type)))
5655 {
5656 parse_error_context
5657 (wfl, "Class `%s' can't subclass %s `%s'",
5658 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
5659 (CLASS_INTERFACE (TYPE_NAME (super_type)) ? "interface" : "array"),
5660 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
5661 return 1;
5662 }
5663
5664 if (CLASS_FINAL (TYPE_NAME (super_type)))
5665 {
5666 parse_error_context (wfl, "Can't subclass final classes: %s",
5667 IDENTIFIER_POINTER (DECL_NAME (super_decl)));
5668 return 1;
5669 }
5670
5671 /* Check scope: same package OK, other package: OK if public */
5672 if (check_pkg_class_access (DECL_NAME (super_decl), wfl))
5673 return 1;
5674
5675 SOURCE_FRONTEND_DEBUG (("Completing class %s with %s",
5676 IDENTIFIER_POINTER (DECL_NAME (this_decl)),
5677 IDENTIFIER_POINTER (DECL_NAME (super_decl))));
5678 return 0;
5679 }
5680
5681 /* Create a new dependency list and link it (in a LIFO manner) to the
5682 CTXP list of type dependency list. */
5683
5684 static void
5685 create_jdep_list (ctxp)
5686 struct parser_ctxt *ctxp;
5687 {
5688 jdeplist *new = malloc (sizeof (jdeplist));
5689
5690 if (!new)
5691 fatal ("Can't alloc jdeplist - create_jdep_list");
5692
5693 new->first = new->last = NULL;
5694 new->next = ctxp->classd_list;
5695 ctxp->classd_list = new;
5696 }
5697
5698 static jdeplist *
5699 reverse_jdep_list (ctxp)
5700 struct parser_ctxt *ctxp;
5701 {
5702 register jdeplist *prev = NULL, *current, *next;
5703 for (current = ctxp->classd_list; current; current = next)
5704 {
5705 next = current->next;
5706 current->next = prev;
5707 prev = current;
5708 }
5709 return prev;
5710 }
5711
5712 /* Create a fake pointer based on the ID stored in the WFL */
5713
5714 static tree
5715 obtain_incomplete_type (wfl)
5716 tree wfl;
5717 {
5718 tree ptr;
5719 tree name = EXPR_WFL_NODE (wfl);
5720
5721 for (ptr = ctxp->incomplete_class; ptr; ptr = TREE_CHAIN (ptr))
5722 if (TYPE_NAME (TREE_PURPOSE (ptr)) == name)
5723 break;
5724
5725 if (!ptr)
5726 {
5727 tree core;
5728 push_obstacks (&permanent_obstack, &permanent_obstack);
5729 BUILD_PTR_FROM_NAME (core, name);
5730 ptr = build_tree_list (core, NULL_TREE);
5731 pop_obstacks ();
5732 TREE_CHAIN (ptr) = ctxp->incomplete_class;
5733 ctxp->incomplete_class = ptr;
5734 }
5735
5736 return ptr;
5737 }
5738
5739 /* Register a incomplete type whose name is WFL. Reuse PTR if PTR is
5740 non NULL instead of computing a new fake type based on WFL. The new
5741 dependency is inserted in the current type dependency list, in FIFO
5742 manner. */
5743
5744 static tree
5745 register_incomplete_type (kind, wfl, decl, ptr)
5746 int kind;
5747 tree wfl, decl, ptr;
5748 {
5749 jdep *new = malloc (sizeof (jdep));
5750
5751 if (!new)
5752 fatal ("Can't allocate new jdep - register_incomplete_type");
5753 if (!ptr && kind != JDEP_METHOD_END) /* JDEP_METHOD_END is a mere marker */
5754 ptr = obtain_incomplete_type (wfl);
5755
5756 JDEP_KIND (new) = kind;
5757 JDEP_DECL (new) = decl;
5758 JDEP_SOLV (new) = ptr;
5759 JDEP_WFL (new) = wfl;
5760 JDEP_CHAIN (new) = NULL;
5761 JDEP_MISC (new) = NULL_TREE;
5762 JDEP_GET_PATCH (new) = (tree *)NULL;
5763
5764 JDEP_INSERT (ctxp->classd_list, new);
5765
5766 return ptr;
5767 }
5768
5769 void
5770 java_check_circular_reference ()
5771 {
5772 tree current;
5773 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
5774 {
5775 tree type = TREE_TYPE (current);
5776 if (CLASS_INTERFACE (TYPE_NAME (type)))
5777 {
5778 /* Check all interfaces this class extends */
5779 tree basetype_vec = TYPE_BINFO_BASETYPES (type);
5780 int n, i;
5781
5782 if (!basetype_vec)
5783 return;
5784 n = TREE_VEC_LENGTH (basetype_vec);
5785 for (i = 0; i < n; i++)
5786 {
5787 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
5788 if (vec_elt && BINFO_TYPE (vec_elt) != object_type_node
5789 && interface_of_p (type, BINFO_TYPE (vec_elt)))
5790 parse_error_context (lookup_cl (current),
5791 "Cyclic interface inheritance");
5792 }
5793 }
5794 else
5795 if (inherits_from_p (CLASSTYPE_SUPER (type), type))
5796 parse_error_context (lookup_cl (current),
5797 "Cyclic class inheritance");
5798 }
5799 }
5800
5801 void
5802 safe_layout_class (class)
5803 tree class;
5804 {
5805 tree save_current_class = current_class;
5806 char *save_input_filename = input_filename;
5807 int save_lineno = lineno;
5808
5809 push_obstacks (&permanent_obstack, &permanent_obstack);
5810 layout_class (class);
5811 pop_obstacks ();
5812
5813 current_class = save_current_class;
5814 input_filename = save_input_filename;
5815 lineno = save_lineno;
5816 CLASS_LOADED_P (class) = 1;
5817 }
5818
5819 static tree
5820 jdep_resolve_class (dep)
5821 jdep *dep;
5822 {
5823 tree decl;
5824
5825 if (!JDEP_RESOLVED_P (dep))
5826 {
5827 decl =
5828 resolve_class (JDEP_TO_RESOLVE (dep), JDEP_DECL (dep), JDEP_WFL (dep));
5829 JDEP_RESOLVED (dep, decl);
5830 }
5831 else
5832 decl = JDEP_RESOLVED_DECL (dep);
5833
5834 if (!decl)
5835 {
5836 complete_class_report_errors (dep);
5837 return NULL_TREE;
5838 }
5839 return decl;
5840 }
5841
5842 /* Complete unsatisfied class declaration and their dependencies */
5843
5844 void
5845 java_complete_class ()
5846 {
5847 tree current;
5848 tree cclass;
5849 jdeplist *cclassd;
5850 int error_found;
5851
5852 push_obstacks (&permanent_obstack, &permanent_obstack);
5853
5854 /* Process imports and reverse the import on demand list */
5855 process_imports ();
5856 if (ctxp->import_demand_list)
5857 ctxp->import_demand_list = nreverse (ctxp->import_demand_list);
5858
5859 /* Rever things so we have the right order */
5860 ctxp->class_list = nreverse (ctxp->class_list);
5861 ctxp->classd_list = reverse_jdep_list (ctxp);
5862
5863 for (cclassd = ctxp->classd_list, cclass = ctxp->class_list;
5864 cclass && cclassd;
5865 cclass = TREE_CHAIN (cclass), cclassd = CLASSD_CHAIN (cclassd))
5866 {
5867 jdep *dep;
5868 for (dep = CLASSD_FIRST (cclassd); dep; dep = JDEP_CHAIN (dep))
5869 {
5870 tree decl;
5871
5872 if (!(decl = jdep_resolve_class (dep)))
5873 continue;
5874
5875 /* Now it's time to patch */
5876 switch (JDEP_KIND (dep))
5877 {
5878 case JDEP_SUPER:
5879 /* Simply patch super */
5880 if (parser_check_super (decl, JDEP_DECL (dep), JDEP_WFL (dep)))
5881 continue;
5882 BINFO_TYPE (TREE_VEC_ELT (BINFO_BASETYPES (TYPE_BINFO
5883 (TREE_TYPE (JDEP_DECL (dep)))), 0)) = TREE_TYPE (decl);
5884 break;
5885
5886 case JDEP_FIELD:
5887 {
5888 /* We do part of the job done in add_field */
5889 tree field_decl = JDEP_DECL (dep);
5890 tree field_type = TREE_TYPE (decl);
5891 push_obstacks (&permanent_obstack, &permanent_obstack);
5892 #if ! JAVA_PROMOTE_TO_INT
5893 if (TREE_CODE (field_type) == RECORD_TYPE)
5894 #endif
5895 field_type = promote_type (field_type);
5896 pop_obstacks ();
5897 TREE_TYPE (field_decl) = field_type;
5898 SOURCE_FRONTEND_DEBUG
5899 (("Completed field/var decl `%s' with `%s'",
5900 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
5901 IDENTIFIER_POINTER (DECL_NAME (decl))));
5902 break;
5903 }
5904 case JDEP_METHOD: /* We start patching a method */
5905 case JDEP_METHOD_RETURN:
5906 error_found = 0;
5907 while (1)
5908 {
5909 if (decl)
5910 {
5911 tree type = promote_type (TREE_TYPE(decl));
5912 JDEP_APPLY_PATCH (dep, type);
5913 SOURCE_FRONTEND_DEBUG
5914 (((JDEP_KIND (dep) == JDEP_METHOD_RETURN ?
5915 "Completing fct `%s' with ret type `%s'":
5916 "Completing arg `%s' with type `%s'"),
5917 IDENTIFIER_POINTER (EXPR_WFL_NODE
5918 (JDEP_DECL_WFL (dep))),
5919 IDENTIFIER_POINTER (DECL_NAME (decl))));
5920 }
5921 else
5922 error_found = 1;
5923 dep = JDEP_CHAIN (dep);
5924 if (JDEP_KIND (dep) == JDEP_METHOD_END)
5925 break;
5926 else
5927 decl = jdep_resolve_class (dep);
5928 }
5929 if (!error_found)
5930 {
5931 tree mdecl = JDEP_DECL (dep), signature;
5932 push_obstacks (&permanent_obstack, &permanent_obstack);
5933 /* Recompute and reset the signature */
5934 signature = build_java_signature (TREE_TYPE (mdecl));
5935 set_java_signature (TREE_TYPE (mdecl), signature);
5936 pop_obstacks ();
5937 }
5938 else
5939 continue;
5940 break;
5941
5942 case JDEP_INTERFACE:
5943 if (parser_check_super_interface (decl, JDEP_DECL (dep),
5944 JDEP_WFL (dep)))
5945 continue;
5946 parser_add_interface (JDEP_DECL (dep), decl, JDEP_WFL (dep));
5947 break;
5948
5949 case JDEP_VARIABLE:
5950 JDEP_APPLY_PATCH (dep, promote_type (TREE_TYPE (decl)));
5951 SOURCE_FRONTEND_DEBUG
5952 (("Completing variable `%s' with type `%s'",
5953 (TREE_CODE (JDEP_DECL_WFL (dep)) == EXPR_WITH_FILE_LOCATION ?
5954 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))) :
5955 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL_WFL (dep)))),
5956 IDENTIFIER_POINTER (DECL_NAME (decl))));
5957 break;
5958
5959 case JDEP_TYPE:
5960 JDEP_APPLY_PATCH (dep, TREE_TYPE (decl));
5961 SOURCE_FRONTEND_DEBUG
5962 (("Completing a random type dependency on a '%s' node",
5963 tree_code_name [TREE_CODE (JDEP_DECL (dep))]));
5964 break;
5965
5966 case JDEP_PARM:
5967 JDEP_APPLY_PATCH (dep, promote_type (TREE_TYPE (decl)));
5968 SOURCE_FRONTEND_DEBUG
5969 (("Completing parameter `%s' with type `%s'",
5970 IDENTIFIER_POINTER (JDEP_MISC (dep)),
5971 IDENTIFIER_POINTER (DECL_NAME (decl))));
5972 break;
5973
5974 default:
5975 fatal ("incomplete switch - java_complete_class");
5976 }
5977 }
5978 }
5979 pop_obstacks ();
5980 return;
5981 }
5982
5983 /* Resolve class CLASS_TYPE. Handle the case of trying to resolve an
5984 array. */
5985
5986 static tree
5987 resolve_class (class_type, decl, cl)
5988 tree class_type, decl, cl;
5989 {
5990 char *name = IDENTIFIER_POINTER (TYPE_NAME (class_type));
5991 char *base = name;
5992 tree resolved_type, resolved_type_decl;
5993
5994 /* 1- Check to see if we have an array. If true, find what we really
5995 want to resolve */
5996 while (name[0] == '[')
5997 name++;
5998 if (base != name)
5999 TYPE_NAME (class_type) = get_identifier (name);
6000
6001 /* 2- Resolve the bare type */
6002 if (!(resolved_type_decl = do_resolve_class (class_type, decl, cl)))
6003 return NULL_TREE;
6004 resolved_type = TREE_TYPE (resolved_type_decl);
6005
6006 /* 3- If we have and array, reconstruct the array down to its nesting */
6007 if (base != name)
6008 {
6009 while (base != name)
6010 {
6011 if (TREE_CODE (resolved_type) == RECORD_TYPE)
6012 resolved_type = promote_type (resolved_type);
6013 resolved_type = build_java_array_type (resolved_type, -1);
6014 name--;
6015 }
6016 /* Build a fake decl for this, since this is what is expected to
6017 be returned. */
6018 resolved_type_decl =
6019 build_decl (TYPE_DECL, TYPE_NAME (resolved_type), resolved_type);
6020 /* Figure how those two things are important for error report. FIXME */
6021 DECL_SOURCE_LINE (resolved_type_decl) = 0;
6022 DECL_SOURCE_FILE (resolved_type_decl) = input_filename;
6023 }
6024 return resolved_type_decl;
6025 }
6026
6027 /* Effectively perform the resolution of class CLASS_TYPE. DECL or CL
6028 are used to report error messages. */
6029
6030 static tree
6031 do_resolve_class (class_type, decl, cl)
6032 tree class_type;
6033 tree decl;
6034 tree cl;
6035 {
6036 tree new_class_decl;
6037 tree original_name = NULL_TREE;
6038
6039 /* Do not try to replace TYPE_NAME (class_type) by a variable, since
6040 its is changed by find_in_imports{_on_demand} */
6041
6042 /* 1- Check for the type in single imports */
6043 if (find_in_imports (class_type))
6044 return NULL_TREE;
6045
6046 /* 2- And check for the type in the current compilation unit. If it fails,
6047 try with a name qualified with the package name if appropriate. */
6048
6049 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6050 {
6051 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6052 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6053 load_class (TYPE_NAME (class_type), 0);
6054 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6055 }
6056
6057 original_name = TYPE_NAME (class_type);
6058 if (!QUALIFIED_P (TYPE_NAME (class_type)) && ctxp->package)
6059 TYPE_NAME (class_type) = merge_qualified_name (ctxp->package,
6060 TYPE_NAME (class_type));
6061 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6062 {
6063 if (!CLASS_LOADED_P (TREE_TYPE (new_class_decl)) &&
6064 !CLASS_FROM_SOURCE_P (TREE_TYPE (new_class_decl)))
6065 load_class (TYPE_NAME (class_type), 0);
6066 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6067 }
6068 TYPE_NAME (class_type) = original_name;
6069
6070 /* 3- Check an other compilation unit that bears the name of type */
6071 load_class (TYPE_NAME (class_type), 0);
6072 if (check_pkg_class_access (TYPE_NAME (class_type),
6073 (cl ? cl : lookup_cl (decl))))
6074 return NULL_TREE;
6075
6076 if ((new_class_decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type))))
6077 return new_class_decl;
6078
6079 /* 4- Check the import on demands. Don't allow bar.baz to be
6080 imported from foo.* */
6081 if (!QUALIFIED_P (TYPE_NAME (class_type)))
6082 if (find_in_imports_on_demand (class_type))
6083 return NULL_TREE;
6084
6085 /* 5- Last call for a resolution */
6086 return IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6087 }
6088
6089 /* Resolve NAME and lay it out (if not done and if not the current
6090 parsed class). Return a decl node. */
6091
6092 static tree
6093 resolve_and_layout (name, cl)
6094 tree name;
6095 tree cl;
6096 {
6097 tree decl = resolve_no_layout (name, cl);
6098 if (decl && TREE_TYPE (decl) != current_class
6099 && !CLASS_LOADED_P (TREE_TYPE (decl)))
6100 safe_layout_class (TREE_TYPE (decl));
6101 return decl;
6102 }
6103
6104 /* Resolve a class, returns its decl but doesn't perform any
6105 layout. The current parsing context is saved and restored */
6106
6107 static tree
6108 resolve_no_layout (name, cl)
6109 tree name, cl;
6110 {
6111 tree ptr, decl;
6112 BUILD_PTR_FROM_NAME (ptr, name);
6113 java_parser_context_save_global ();
6114 decl = resolve_class (ptr, NULL_TREE, cl);
6115 java_parser_context_restore_global ();
6116
6117 return decl;
6118 }
6119
6120 /* Called to report errors. Skip leader '[' in a complex array type
6121 description that failed to be resolved. */
6122
6123 static char *
6124 purify_type_name (name)
6125 char *name;
6126 {
6127 while (*name && *name == '[')
6128 name++;
6129 return name;
6130 }
6131
6132 /* The type CURRENT refers to can't be found. We print error messages. */
6133
6134 static void
6135 complete_class_report_errors (dep)
6136 jdep *dep;
6137 {
6138 switch (JDEP_KIND (dep))
6139 {
6140 case JDEP_SUPER:
6141 parse_error_context
6142 (JDEP_WFL (dep), "Superclass `%s' of class `%s' not found",
6143 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6144 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6145 break;
6146 case JDEP_FIELD:
6147 parse_error_context
6148 (JDEP_WFL (dep), "Type `%s' not found in declaration of field `%s'",
6149 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6150 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6151 break;
6152 case JDEP_METHOD: /* Covers arguments */
6153 parse_error_context
6154 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6155 "argument `%s' of method `%s'",
6156 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6157 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))),
6158 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_MISC (dep))));
6159 break;
6160 case JDEP_METHOD_RETURN: /* Covers return type */
6161 parse_error_context
6162 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6163 "return type of method `%s'",
6164 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6165 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_DECL_WFL (dep))));
6166 break;
6167 case JDEP_INTERFACE:
6168 parse_error_context
6169 (JDEP_WFL (dep), "Superinterface `%s' of %s `%s' not found",
6170 IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep))),
6171 (CLASS_OR_INTERFACE (JDEP_DECL (dep), "class", "interface")),
6172 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6173 break;
6174 case JDEP_VARIABLE:
6175 parse_error_context
6176 (JDEP_WFL (dep), "Type `%s' not found in the declaration of the "
6177 "local variable `%s'",
6178 purify_type_name (IDENTIFIER_POINTER (EXPR_WFL_NODE (JDEP_WFL (dep)))),
6179 IDENTIFIER_POINTER (DECL_NAME (JDEP_DECL (dep))));
6180 break;
6181 }
6182 }
6183
6184 /* Check uninitialized final. */
6185
6186 void
6187 java_check_final ()
6188 {
6189 }
6190
6191 static int
6192 check_method_redefinition (class, method)
6193 tree class, method;
6194 {
6195 tree redef, name;
6196 tree cl = DECL_NAME (method);
6197 tree sig = TYPE_LANG_SPECIFIC (TREE_TYPE (method))->signature;
6198 /* decl name of generated <clinit> doesn't need to be fixed and
6199 checked */
6200 if (DECL_NAME (method) != clinit_identifier_node)
6201 {
6202 /* NAME is just the plain name when Object is being defined */
6203 if (class != object_type_node)
6204 name = DECL_NAME (method) = EXPR_WFL_NODE (DECL_NAME (method));
6205 else
6206 name = DECL_NAME (method);
6207 }
6208 else
6209 return 0;
6210
6211 for (redef = TYPE_METHODS (class); redef; redef = TREE_CHAIN (redef))
6212 {
6213 struct lang_type *t = TYPE_LANG_SPECIFIC (TREE_TYPE (redef));
6214
6215 if (! t || (redef == method))
6216 break;
6217 if (DECL_NAME (redef) == name && sig == t->signature)
6218 {
6219 parse_error_context (cl, "Duplicate method declaration");
6220 return 1;
6221 }
6222 }
6223 return 0;
6224 }
6225
6226 /* Check all the methods of CLASS. Methods are first completed then
6227 checked according to regular method existance rules.
6228 If no constructor were encountered, then build its declaration. */
6229
6230 static void
6231 java_check_regular_methods (class_decl)
6232 tree class_decl;
6233 {
6234 tree method;
6235 tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (class_decl));
6236 tree super_class = CLASSTYPE_SUPER (class);
6237 int seen_constructor = 0;
6238
6239 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
6240
6241 /* Should take interfaces into account. FIXME */
6242 for (method = TYPE_METHODS (class); method; method = TREE_CHAIN (method))
6243 {
6244 tree found, sig;
6245 tree method_wfl = DECL_NAME (method);
6246 int aflags;
6247
6248 if (DECL_CONSTRUCTOR_P (method))
6249 seen_constructor = 1;
6250
6251 /* Check for redefinitions */
6252 if (check_method_redefinition (class, method))
6253 continue;
6254
6255 sig = build_java_argument_signature (TREE_TYPE (method));
6256
6257 found = lookup_argument_method (super_class, DECL_NAME (method), sig);
6258 if (! found)
6259 continue;
6260 /* Can't override a method with the same name and different return
6261 types. */
6262 if (TREE_TYPE (TREE_TYPE (found)) != TREE_TYPE (TREE_TYPE (method)))
6263 parse_warning_context
6264 (method_wfl,
6265 "Method `%s' redefined with different return type in class `%s'",
6266 lang_printable_name (found),
6267 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
6268
6269 /* Can't override final. Can't override static. */
6270 if (METHOD_FINAL (found) || METHOD_STATIC (found))
6271 {
6272 /* Static *can* override static */
6273 if (METHOD_STATIC (found) && METHOD_STATIC (method))
6274 continue;
6275 parse_error_context
6276 (method_wfl,
6277 "%s methods can't be overriden. Method `%s' is %s in class `%s'",
6278 (METHOD_FINAL (found) ? "Final" : "Static"),
6279 lang_printable_name (found),
6280 (METHOD_FINAL (found) ? "final" : "static"),
6281 IDENTIFIER_POINTER
6282 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
6283 continue;
6284 }
6285 /* Static method can't override instance method. */
6286 if (METHOD_STATIC (method))
6287 {
6288 parse_error_context
6289 (method_wfl,
6290 "Instance methods can't be overriden by a static method. Method "
6291 "`%s' is an instance method in class `%s'",
6292 lang_printable_name (found),
6293 IDENTIFIER_POINTER
6294 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
6295 continue;
6296 }
6297 /* Overriding/hiding public must be public or
6298 overriding/hiding protected must be protected or public */
6299 if ((METHOD_PUBLIC (found) && !METHOD_PUBLIC (method)) ||
6300 (METHOD_PROTECTED (found)
6301 && !(METHOD_PUBLIC (method) || METHOD_PROTECTED (method))))
6302 {
6303 parse_error_context
6304 (method_wfl,
6305 "Methods can't be overridden to be more private. Method `%s' is "
6306 "%s in class `%s'", lang_printable_name (found),
6307 (METHOD_PUBLIC (found) ? "public" : "protected"),
6308 IDENTIFIER_POINTER
6309 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
6310 continue;
6311 }
6312
6313 /* If the method has default access in an other package, then
6314 issue a warning that the current method doesn't override the one
6315 that was found elsewhere */
6316 aflags = get_access_flags_from_decl (found);
6317 if ((!aflags || (aflags > ACC_PROTECTED))
6318 && !class_in_current_package (DECL_CONTEXT (found)))
6319 parse_warning_context
6320 (method_wfl, "Method `%s' in class `%s' does not "
6321 "override the corresponding method in class `%s', which is "
6322 "private to a different package",
6323 lang_printable_name (found),
6324 IDENTIFIER_POINTER (DECL_NAME (class_decl)),
6325 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
6326
6327 /* Check on (default) package access. FIXME. */
6328 /* Inheriting multiple methods with the same signature. FIXME */
6329 }
6330
6331 TYPE_METHODS (class) = nreverse (TYPE_METHODS (class));
6332
6333 if (!seen_constructor)
6334 {
6335 /* No constructor seen, we craft one, at line 0 */
6336 int saved_lineno = lineno;
6337 tree meth, decl;
6338 lineno = 0;
6339 meth = make_node (FUNCTION_TYPE);
6340 TREE_TYPE (meth) = void_type_node;
6341 TYPE_ARG_TYPES (meth) = NULL_TREE;
6342 decl = add_method (class, 0, init_identifier_node,
6343 build_java_signature (meth));
6344 DECL_CONSTRUCTOR_P (decl) = 1;
6345 lineno = saved_lineno;
6346 }
6347 }
6348
6349 /* Check abstract method of interface INTERFACE */
6350
6351 static void
6352 java_check_abstract_methods (interface)
6353 tree interface;
6354 {
6355 int i, n;
6356 tree method, basetype_vec, found;
6357
6358 for (method = TYPE_METHODS (interface); method; method = TREE_CHAIN (method))
6359 {
6360 char *csig;
6361 tree name = DECL_NAME (method);
6362
6363 /* 2- Check for double definition inside the defining interface */
6364 if (check_method_redefinition (interface, method))
6365 continue;
6366
6367 /* 3- Overriding is OK as far as we preserve the return type and
6368 the thrown exceptions */
6369 found = lookup_java_interface_method2 (interface, method);
6370 if (found)
6371 {
6372 parse_error_context
6373 (lookup_cl (method),
6374 "Method `%s' previously defined in interface `%s' is "
6375 "redefined with different return type in interface `%s'",
6376 lang_printable_name (found),
6377 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))),
6378 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))));
6379 continue;
6380 }
6381 }
6382
6383 /* 4- Inherited methods can't differ by their returned types */
6384 if (!(basetype_vec = TYPE_BINFO_BASETYPES (interface)))
6385 return;
6386 n = TREE_VEC_LENGTH (basetype_vec);
6387 for (i = 0; i < n; i++)
6388 {
6389 tree sub_interface_method, sub_interface;
6390 tree vec_elt = TREE_VEC_ELT (basetype_vec, i);
6391 if (!vec_elt)
6392 continue;
6393 sub_interface = BINFO_TYPE (vec_elt);
6394 for (sub_interface_method = TYPE_METHODS (sub_interface);
6395 sub_interface_method;
6396 sub_interface_method = TREE_CHAIN (sub_interface_method))
6397 {
6398 found = lookup_java_interface_method2 (interface,
6399 sub_interface_method);
6400 if (found && (found != sub_interface_method))
6401 parse_error_context
6402 (lookup_cl (sub_interface_method),
6403 "Interface `%s' inherits method `%s' from interface `%s'. This "
6404 "method is redefined with a different return "
6405 "type in interface `%s'",
6406 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (interface))),
6407 lang_printable_name (found),
6408 IDENTIFIER_POINTER
6409 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (sub_interface_method)))),
6410 IDENTIFIER_POINTER
6411 (DECL_NAME (TYPE_NAME (DECL_CONTEXT (found)))));
6412 }
6413 }
6414 }
6415
6416 /* Check the method on all the defined classes. Should be done to the
6417 classes declared in the compilation unit only. FIXME */
6418
6419 void
6420 java_check_methods ()
6421 {
6422
6423 tree current;
6424 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
6425 if (CLASS_FROM_SOURCE_P (TREE_TYPE (current)))
6426 {
6427 tree class = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
6428
6429 if (CLASS_INTERFACE (TYPE_NAME (class)))
6430 java_check_abstract_methods (class);
6431 else
6432 java_check_regular_methods (current);
6433 }
6434 }
6435
6436 /* Lookup methods in interfaces using their name and partial
6437 signature. Return a matching method only if their types differ. */
6438
6439 static tree
6440 lookup_java_interface_method2 (class, method_decl)
6441 tree class, method_decl;
6442 {
6443 int i, n;
6444 tree basetype_vec = TYPE_BINFO_BASETYPES (class), to_return;
6445
6446 if (!basetype_vec)
6447 return NULL_TREE;
6448
6449 n = TREE_VEC_LENGTH (basetype_vec);
6450 for (i = 0; i < n; i++)
6451 {
6452 tree vec_elt = TREE_VEC_ELT (basetype_vec, i), to_return;
6453 if ((BINFO_TYPE (vec_elt) != object_type_node)
6454 && (to_return =
6455 lookup_java_method2 (BINFO_TYPE (vec_elt), method_decl, 1)))
6456 return to_return;
6457 }
6458 for (i = 0; i < n; i++)
6459 {
6460 to_return = lookup_java_interface_method2
6461 (BINFO_TYPE (TREE_VEC_ELT (basetype_vec, i)), method_decl);
6462 if (to_return)
6463 return to_return;
6464 }
6465
6466 return NULL_TREE;
6467 }
6468
6469 /* Lookup method using their name and partial signature. Return a
6470 matching method only if their types differ. */
6471
6472 static tree
6473 lookup_java_method2 (clas, method_decl, do_interface)
6474 tree clas, method_decl;
6475 int do_interface;
6476 {
6477 tree method, method_signature, method_name, method_type;
6478 method_signature = build_java_argument_signature (TREE_TYPE (method_decl));
6479 method_name = DECL_NAME (method_decl);
6480 method_type = TREE_TYPE (TREE_TYPE (method_decl));
6481
6482 while (clas != NULL_TREE)
6483 {
6484 for (method = TYPE_METHODS (clas);
6485 method != NULL_TREE; method = TREE_CHAIN (method))
6486 {
6487 tree method_sig = build_java_argument_signature (TREE_TYPE (method));
6488 if (DECL_NAME (method) == method_name
6489 && method_sig == method_signature
6490 && TREE_TYPE (TREE_TYPE (method)) != method_type)
6491 {
6492 return method;
6493 }
6494 }
6495 clas = (do_interface ? NULL_TREE : CLASSTYPE_SUPER (clas));
6496 }
6497 return NULL_TREE;
6498 }
6499
6500 /* Return the line that matches DECL line number. Used during error
6501 report */
6502
6503 static tree
6504 lookup_cl (decl)
6505 tree decl;
6506 {
6507 static tree cl = NULL_TREE;
6508
6509 if (!decl)
6510 return NULL_TREE;
6511
6512 if (cl == NULL_TREE)
6513 cl = build_expr_wfl (NULL_TREE, NULL, 0, 0);
6514
6515 EXPR_WFL_FILENAME_NODE (cl) = get_identifier (DECL_SOURCE_FILE (decl));
6516 EXPR_WFL_SET_LINECOL (cl, DECL_SOURCE_LINE_FIRST (decl), -1);
6517
6518 return cl;
6519 }
6520
6521 /* Look for a simple name in the single-type import list */
6522
6523 static tree
6524 find_name_in_single_imports (name)
6525 tree name;
6526 {
6527 tree node;
6528
6529 for (node = ctxp->import_list; node; node = TREE_CHAIN (node))
6530 if (TREE_VALUE (node) == name)
6531 return (EXPR_WFL_NODE (TREE_PURPOSE (node)));
6532
6533 return NULL_TREE;
6534 }
6535
6536 /* Process all single-type import. */
6537
6538 static int
6539 process_imports ()
6540 {
6541 tree import;
6542 int error_found;
6543
6544 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
6545 {
6546 tree to_be_found = EXPR_WFL_NODE (TREE_PURPOSE (import));
6547
6548 /* Don't load twice something already defined. */
6549 if (IDENTIFIER_CLASS_VALUE (to_be_found))
6550 continue;
6551 QUALIFIED_P (to_be_found) = 1;
6552 load_class (to_be_found, 0);
6553 error_found =
6554 check_pkg_class_access (to_be_found, TREE_PURPOSE (import));
6555 if (!IDENTIFIER_CLASS_VALUE (to_be_found))
6556 {
6557 parse_error_context (TREE_PURPOSE (import),
6558 "Class or interface `%s' not found in import",
6559 IDENTIFIER_POINTER (to_be_found));
6560 return 1;
6561 }
6562 if (error_found)
6563 return 1;
6564 }
6565 return 0;
6566 }
6567
6568 /* Possibly find a class imported by a single-type import statement. Return
6569 1 if an error occured, 0 otherwise. */
6570
6571 static int
6572 find_in_imports (class_type)
6573 tree class_type;
6574 {
6575 tree import;
6576
6577 for (import = ctxp->import_list; import; import = TREE_CHAIN (import))
6578 if (TREE_VALUE (import) == TYPE_NAME (class_type))
6579 {
6580 TYPE_NAME (class_type) = EXPR_WFL_NODE (TREE_PURPOSE (import));
6581 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
6582 return check_pkg_class_access (TYPE_NAME (class_type),
6583 TREE_PURPOSE (import));
6584 }
6585 return 0;
6586 }
6587
6588 /* Process a import on demand statement (lazy) */
6589
6590 static int
6591 read_import_entry (jcf, dirp, returned_name)
6592 JCF *jcf;
6593 DIR *dirp;
6594 char **returned_name;
6595 {
6596 if (dirp)
6597 {
6598 struct dirent *direntp = readdir (dirp);
6599 if (!direntp)
6600 {
6601 *returned_name = NULL;
6602 return 0;
6603 }
6604 else
6605 {
6606 *returned_name = direntp->d_name;
6607 return (strlen (direntp->d_name));
6608 }
6609 }
6610 else
6611 {
6612 int current_dir_len = strlen (jcf->classname);
6613 char *current_entry;
6614 int current_entry_len;
6615
6616 /* Here we read a zip directory as a file directory. The files
6617 we're selecting must have the same root than the directory
6618 we're examining. */
6619
6620 ZipDirectory *zipd = (ZipDirectory *)jcf->zipd;
6621
6622 while (zipd)
6623 {
6624 current_entry = ZIPDIR_FILENAME (zipd);
6625 current_entry_len = zipd->filename_length;
6626 while (current_entry_len && current_entry [current_entry_len] != '/')
6627 current_entry_len--;
6628 /* If the path of the current file doesn't match the directory we're
6629 scanning, that the end of the search */
6630 current_entry_len++;
6631 if (strncmp (jcf->classname, current_entry, current_dir_len))
6632 {
6633 *returned_name = NULL;
6634 return 0;
6635 }
6636 /* Ok, we have at least the same path. The position of the last '/'
6637 of the current file we're examining should match the size of
6638 name of the directory we're browsing, otherwise that an entry
6639 belonging to a sub directory, we want to skip it. */
6640 if (current_entry_len != current_dir_len)
6641 zipd = ZIPDIR_NEXT (zipd);
6642 else
6643 {
6644 jcf->zipd = ZIPDIR_NEXT (zipd); /* Prepare next read */
6645 *returned_name = &current_entry [current_entry_len];
6646 return (zipd->filename_length - current_entry_len);
6647 }
6648 }
6649 }
6650 }
6651
6652 /* Read a import directory, gathering potential match for further type
6653 references. Indifferently reads a filesystem or a ZIP archive
6654 directory. */
6655
6656 static void
6657 read_import_dir (wfl)
6658 tree wfl;
6659 {
6660 char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
6661 int name_len = IDENTIFIER_LENGTH (EXPR_WFL_NODE (wfl)), reclen;
6662 DIR *dirp = NULL;
6663 tree dirname = ident_subst (name, name_len, "", '.', '/', "");
6664 JCF jcfr, *jcf, *saved_jcf = current_jcf;
6665 char *founddirname, *d_name;
6666 struct ZipFileCache zip_cache;
6667
6668 jcf = &jcfr;
6669 if (!classpath)
6670 fix_classpath ();
6671 if (!(founddirname = find_class (name, name_len, jcf, 0)))
6672 fatal ("Can't import `%s'", name);
6673 if (jcf->outofsynch)
6674 jcf_out_of_synch (jcf);
6675 if (jcf->seen_in_zip)
6676 jcf->zipd = ZIPDIR_NEXT ((ZipDirectory *)jcf->zipd);
6677
6678 else if (founddirname && (dirp = opendir (founddirname)))
6679 {
6680 readdir (dirp); readdir (dirp);
6681 }
6682
6683 if (!founddirname && !dirp)
6684 {
6685 static int first = 1;
6686 if (first)
6687 {
6688 char buffer [256];
6689 sprintf (buffer, "Can't find default package `%s'. Check "
6690 "the CLASSPATH environment variable and the access to the "
6691 "archives.", name);
6692 error (buffer);
6693 java_error_count++;
6694 first = 0;
6695 }
6696 else
6697 parse_error_context (wfl, "Package `%s' not found in import", name);
6698 current_jcf = saved_jcf;
6699 return;
6700 }
6701
6702 /* Here we should have a unified way of retrieving an entry, to be
6703 indexed. */
6704 while ((reclen = read_import_entry (jcf, dirp, &d_name)))
6705 {
6706 int java_or_class = 0;
6707 int len;
6708 if ((reclen > 5)
6709 && !strcmp (&d_name [reclen-5], ".java"))
6710 {
6711 java_or_class = 1;
6712 len = reclen - 5;
6713 }
6714
6715 if (!java_or_class && (reclen > 6) &&
6716 !strcmp (&d_name [reclen-6], ".class"))
6717 {
6718 java_or_class = 2;
6719 len = reclen - 6;
6720 }
6721
6722 if (java_or_class)
6723 {
6724 char *id_name;
6725 tree node, old;
6726
6727 obstack_grow (&temporary_obstack, name, name_len);
6728 obstack_1grow (&temporary_obstack, '/');
6729 obstack_grow0 (&temporary_obstack, d_name, len);
6730 id_name = obstack_finish (&temporary_obstack);
6731
6732 node = get_identifier (id_name);
6733 IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
6734 QUALIFIED_P (node) = 1; /* As soon as we turn / into . */
6735 }
6736 }
6737 if (dirp)
6738 closedir (dirp);
6739
6740 current_jcf = saved_jcf;
6741 }
6742
6743 /* Possibly find a type in the import on demands specified
6744 types. Returns 1 if an error occured, 0 otherwise. Run throught the
6745 entire list, to detected potential double definitions. */
6746
6747 static int
6748 find_in_imports_on_demand (class_type)
6749 tree class_type;
6750 {
6751 tree node, import, node_to_use;
6752 int seen_once = -1;
6753 tree cl;
6754
6755 for (import = ctxp->import_demand_list; import; import = TREE_CHAIN (import))
6756 {
6757 char *id_name;
6758 tree found;
6759 obstack_grow (&temporary_obstack,
6760 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
6761 IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
6762 obstack_1grow (&temporary_obstack, '/');
6763 obstack_grow0 (&temporary_obstack,
6764 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
6765 IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
6766 id_name = obstack_finish (&temporary_obstack);
6767
6768 node = maybe_get_identifier (id_name);
6769 if (node && IS_A_CLASSFILE_NAME (node))
6770 {
6771 if (seen_once < 0)
6772 {
6773 cl = TREE_PURPOSE (import);
6774 seen_once = 1;
6775 node_to_use = node;
6776 }
6777 else
6778 {
6779 seen_once++;
6780 parse_error_context
6781 (import, "Type `%s' also potentially defined in package `%s'",
6782 IDENTIFIER_POINTER (TYPE_NAME (class_type)),
6783 IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))));
6784 }
6785 }
6786 }
6787
6788 if (seen_once == 1)
6789 {
6790 /* Setup lineno so that it refers to the line of the import (in
6791 case we parse a class file and encounter errors */
6792 tree decl;
6793 int saved_lineno = lineno;
6794 lineno = EXPR_WFL_LINENO (cl);
6795 TYPE_NAME (class_type) = ident_subst (IDENTIFIER_POINTER (node_to_use),
6796 IDENTIFIER_LENGTH (node_to_use),
6797 "", '/', '.', "");
6798 QUALIFIED_P (TYPE_NAME (class_type)) = 1;
6799 decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
6800 /* If there is no DECL set for the class or if the class isn't
6801 loaded and not seen in source yet, the load */
6802 if (!decl || (!CLASS_LOADED_P (TREE_TYPE (decl))
6803 && !CLASS_FROM_SOURCE_P (TREE_TYPE (decl))))
6804 load_class (node_to_use, 0);
6805 lineno = saved_lineno;
6806 return check_pkg_class_access (TYPE_NAME (class_type), cl);
6807 }
6808 else
6809 return (seen_once < 0 ? 0 : seen_once); /* It's ok not to have found */
6810 }
6811
6812 /* Check that CLASS_NAME refers to a PUBLIC class. Return 0 if no
6813 access violations were found, 1 otherwise. */
6814
6815 static int
6816 check_pkg_class_access (class_name, cl)
6817 tree class_name;
6818 tree cl;
6819 {
6820 tree type;
6821 int access;
6822
6823 if (!QUALIFIED_P (class_name) || !IDENTIFIER_CLASS_VALUE (class_name))
6824 return 0;
6825
6826 if (!(type = TREE_TYPE (IDENTIFIER_CLASS_VALUE (class_name))))
6827 return 0;
6828
6829 if (!CLASS_PUBLIC (TYPE_NAME (type)))
6830 {
6831 parse_error_context
6832 (cl, "Can't access %s `%s'. Only public classes and interfaces in "
6833 "other packages can be accessed",
6834 (CLASS_INTERFACE (TYPE_NAME (type)) ? "interface" : "class"),
6835 IDENTIFIER_POINTER (class_name));
6836 return 1;
6837 }
6838 return 0;
6839 }
6840
6841 /* Local variable declaration. */
6842
6843 static void
6844 declare_local_variables (modifier, type, vlist)
6845 int modifier;
6846 tree type;
6847 tree vlist;
6848 {
6849 tree decl, current, returned_type, type_wfl, init_stmt = NULL_TREE;
6850 int must_chain = 0;
6851
6852 /* Push a new block if statement were seen between the last time we
6853 pushed a block and now. Keep a cound of block to close */
6854 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (current_function_decl)))
6855 {
6856 tree body = DECL_FUNCTION_BODY (current_function_decl);
6857 tree b = enter_block ();
6858 BLOCK_EXPR_ORIGIN(b) = body;
6859 }
6860
6861 if (modifier)
6862 {
6863 int i;
6864 for (i = 0; i <= 10; i++) if (1 << i & modifier) break;
6865 parse_error_context
6866 (ctxp->modifier_ctx [i],
6867 (modifier == ACC_FINAL ?
6868 "Unsupported JDK1.1 `final' locals" :
6869 "Only `final' is allowed as a local variables modifier"));
6870 return;
6871 }
6872
6873 if (unresolved_type_p (type, &returned_type))
6874 {
6875 if (returned_type)
6876 type = returned_type;
6877 else
6878 {
6879 type_wfl = type;
6880 type = obtain_incomplete_type (type);
6881 must_chain = 1;
6882 }
6883 }
6884
6885 for (current = vlist; current; current = TREE_CHAIN (current))
6886 {
6887 tree wfl = TREE_PURPOSE (current);
6888 tree name = EXPR_WFL_NODE (wfl);
6889 tree init = TREE_VALUE (current);
6890 tree other = lookup_name_in_blocks (name);
6891
6892 /* Don't try to use an INIT statement when an error was found */
6893 if (init && java_error_count)
6894 init = NULL_TREE;
6895
6896 if (other)
6897 parse_error_context
6898 (wfl, "Variable `%s' is already defined in this method and was "
6899 "declared `%s %s' in line %d",
6900 IDENTIFIER_POINTER (name), lang_printable_name (TREE_TYPE (other)),
6901 IDENTIFIER_POINTER (name), DECL_SOURCE_LINE (other));
6902 else
6903 {
6904 if (!must_chain && TREE_CODE (type) == RECORD_TYPE)
6905 type = promote_type (type);
6906 /* Never layout this decl. This will be done when its scope
6907 will be entered */
6908 decl = build_decl_no_layout (VAR_DECL, name, type);
6909 BLOCK_CHAIN_DECL (decl);
6910
6911 /* Add the initialization function to the current function's code */
6912 if (init)
6913 {
6914 tree wfl;
6915 MODIFY_EXPR_FROM_INITIALIZATION_P (init) = 1;
6916 java_method_add_stmt
6917 (current_function_decl,
6918 build_debugable_stmt (EXPR_WFL_LINECOL (init), init));
6919 }
6920
6921 if (must_chain)
6922 {
6923 jdep *dep;
6924 register_incomplete_type (JDEP_VARIABLE, type_wfl, decl, type);
6925 dep = CLASSD_LAST (ctxp->classd_list);
6926 JDEP_GET_PATCH (dep) = &TREE_TYPE (decl);
6927 }
6928 }
6929 }
6930 SOURCE_FRONTEND_DEBUG (("Defined locals"));
6931 }
6932
6933 /* Called during parsing. Build decls from argument list. */
6934
6935 static void
6936 source_start_java_method (fndecl)
6937 tree fndecl;
6938 {
6939 tree tem;
6940 tree parm_decl;
6941 int i;
6942
6943 extern tree current_binding_level;
6944 current_function_decl = fndecl;
6945
6946 /* New scope for the function */
6947 enter_block ();
6948 for (tem = TYPE_ARG_TYPES (TREE_TYPE (fndecl)), i = 0;
6949 tem != NULL_TREE; tem = TREE_CHAIN (tem), i++)
6950 {
6951 tree type = TREE_VALUE (tem);
6952 tree name = TREE_PURPOSE (tem);
6953
6954 /* If type is incomplete. Layout can't take place
6955 now. Create an incomplete decl and ask for the decl to be
6956 patched later */
6957 if (INCOMPLETE_TYPE_P (type))
6958 {
6959 jdep *jdep;
6960 parm_decl = build_decl_no_layout (PARM_DECL, name, type);
6961
6962 register_incomplete_type (JDEP_PARM, NULL_TREE, NULL_TREE, type);
6963 jdep = CLASSD_LAST (ctxp->classd_list);
6964 JDEP_MISC (jdep) = name;
6965 JDEP_GET_PATCH (jdep) = &TREE_TYPE (parm_decl);
6966 }
6967 else
6968 parm_decl = build_decl (PARM_DECL, name, type);
6969
6970 BLOCK_CHAIN_DECL (parm_decl);
6971 }
6972 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
6973 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl)) =
6974 nreverse (tem);
6975 DECL_ARG_SLOT_COUNT (current_function_decl) = i;
6976 }
6977
6978 /* Called during expansion. Push decls formerly built from argument
6979 list so they're usable during expansion. */
6980
6981 static void
6982 expand_start_java_method (fndecl)
6983 tree fndecl;
6984 {
6985 tree tem, *ptr;
6986 tree parm_decl;
6987
6988 extern tree current_binding_level;
6989 current_function_decl = fndecl;
6990
6991 announce_function (fndecl);
6992 pushlevel (1); /* Push parameters */
6993 ptr = &DECL_ARGUMENTS (fndecl);
6994 tem = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (current_function_decl));
6995 while (tem)
6996 {
6997 tree next = TREE_CHAIN (tem);
6998 DECL_ARG_TYPE (tem) = TREE_TYPE (tem);
6999 layout_decl (tem, 0);
7000 pushdecl (tem);
7001 INITIALIZED_P (tem) = 1; /* Parms are initialized */
7002 *ptr = tem;
7003 ptr = &TREE_CHAIN (tem);
7004 tem = next;
7005 }
7006 *ptr = NULL_TREE;
7007 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
7008 lineno = DECL_SOURCE_LINE_FIRST (fndecl);
7009 complete_start_java_method (fndecl);
7010 }
7011
7012 /* Terminate a function and expand its body. */
7013
7014 static void
7015 source_end_java_method ()
7016 {
7017 tree fndecl = current_function_decl;
7018
7019 java_parser_context_save_global ();
7020 lineno = ctxp->last_ccb_indent1;
7021
7022 /* Generate function's code */
7023 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
7024 && ! flag_emit_class_files)
7025 expand_expr_stmt (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)));
7026
7027 /* pop out of its parameters */
7028 pushdecl_force_head (DECL_ARGUMENTS (fndecl));
7029 poplevel (1, 0, 1);
7030 BLOCK_SUPERCONTEXT (DECL_INITIAL (fndecl)) = fndecl;
7031
7032 /* Generate rtl for function exit. */
7033 if (! flag_emit_class_files)
7034 {
7035 lineno = DECL_SOURCE_LINE_LAST (fndecl);
7036 expand_function_end (input_filename, lineno, 0);
7037
7038 /* Run the optimizers and output assembler code for this function. */
7039 rest_of_compilation (fndecl);
7040 }
7041
7042 current_function_decl = NULL_TREE;
7043 /* permanent_allocation (1); */
7044 java_parser_context_restore_global ();
7045 }
7046
7047 /* Record EXPR in the current function block. Complements compound
7048 expression second operand if necessary. */
7049
7050 tree
7051 java_method_add_stmt (fndecl, expr)
7052 tree fndecl, expr;
7053 {
7054 tree body = BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl));
7055 tree node;
7056
7057 if (java_error_count)
7058 return body;
7059 if ((node = add_stmt_to_compound (body, NULL_TREE, expr)) == body)
7060 return body;
7061
7062 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = node;
7063 TREE_SIDE_EFFECTS (node) = 1;
7064 return node;
7065 }
7066
7067 /* Add STMT to EXISTING if possible, otherwise create a new
7068 COMPOUND_EXPR and add STMT to it. */
7069
7070 static tree
7071 add_stmt_to_compound (existing, type, stmt)
7072 tree existing, type, stmt;
7073 {
7074 tree node;
7075
7076 if (existing && (TREE_CODE (existing) == COMPOUND_EXPR)
7077 && TREE_OPERAND (existing, 1) == size_zero_node)
7078 {
7079 TREE_OPERAND (existing, 1) = stmt;
7080 TREE_TYPE (existing) = type;
7081 return existing;
7082 }
7083 else if (existing)
7084 node = build (COMPOUND_EXPR, type, existing, stmt);
7085 else
7086 node = build (COMPOUND_EXPR, type, stmt, size_zero_node);
7087
7088 return node;
7089 }
7090
7091 /* Hold THIS for the scope of the current public method decl. */
7092 static tree current_this;
7093
7094 /* Layout all class found during parsing */
7095
7096 void
7097 java_layout_classes ()
7098 {
7099 tree current;
7100 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
7101 {
7102 current_class = TREE_TYPE (current);
7103 TYPE_FIELDS (current_class) = nreverse (TYPE_FIELDS (current_class));
7104 if (!TYPE_SIZE (current_class))
7105 safe_layout_class (current_class);
7106 }
7107 }
7108
7109 /* Expand all methods in all registered classes. */
7110
7111 void
7112 java_complete_expand_methods ()
7113 {
7114 tree current;
7115
7116 for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
7117 {
7118 extern tree current_constant_pool_data_ref;
7119 tree class_type = CLASS_TO_HANDLE_TYPE (TREE_TYPE (current));
7120 tree decl;
7121 int saved_lineno;
7122
7123 current_class = TREE_TYPE (current);
7124
7125 /* Initialize a new constant pool */
7126 init_outgoing_cpool ();
7127
7128 /* Don't process function bodies in interfaces */
7129 if (!CLASS_INTERFACE (TYPE_NAME (current_class)))
7130 for (decl = TYPE_METHODS (class_type); decl; decl = TREE_CHAIN (decl))
7131 {
7132 current_function_decl = decl;
7133 /* Don't generate debug info on line zero when expanding a
7134 generated constructor. */
7135 if (DECL_CONSTRUCTOR_P (decl) && !DECL_FUNCTION_BODY (decl))
7136 {
7137 /* If we found errors, it's too dangerous to try to generate
7138 and expand a constructor */
7139 if (!java_error_count)
7140 {
7141 restore_line_number_status (1);
7142 java_complete_expand_method (decl);
7143 restore_line_number_status (0);
7144 }
7145 }
7146 else
7147 java_complete_expand_method (decl);
7148 }
7149
7150 /* Make the class data, register it and run the rest of decl
7151 compilation on it */
7152 if (!java_error_count && ! flag_emit_class_files)
7153 {
7154 make_class_data (current_class);
7155 register_class ();
7156 rest_of_decl_compilation (TYPE_NAME (current_class), (char*) 0, 1, 0);
7157 }
7158 }
7159 }
7160
7161 /* Complete and expand a method. */
7162
7163 static void
7164 java_complete_expand_method (mdecl)
7165 tree mdecl;
7166 {
7167 tree node;
7168 jdep *current;
7169 int no_ac_found = 1;
7170
7171 /* We generate some code for an empty constructor */
7172 if (DECL_CONSTRUCTOR_P (mdecl) && !DECL_FUNCTION_BODY (mdecl))
7173 {
7174 tree arg_list, func, call;
7175 tree method_type = TREE_TYPE (mdecl);
7176 tree class_type = CLASS_TO_HANDLE_TYPE (current_class);
7177 tree self_type = (CLASSTYPE_SUPER (class_type) ?
7178 CLASSTYPE_SUPER (class_type) : class_type);
7179 tree method_signature =
7180 TYPE_LANG_SPECIFIC (method_type)->signature;
7181 tree method =
7182 lookup_java_constructor (CLASS_TO_HANDLE_TYPE (self_type),
7183 method_signature);
7184 tree block, compound;
7185
7186 /* Fixe the begining/ending lines of the method so that with
7187 no_line_numbers set to 1 it doesn't generate debug info at
7188 line 1 for this artificial constructor. */
7189 DECL_SOURCE_LINE (mdecl) = 1;
7190 DECL_SOURCE_LINE_MERGE (mdecl, 1);
7191 source_start_java_method (mdecl);
7192 arg_list = BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl));
7193 enter_block ();
7194 func = build_known_method_ref (method, method_type, self_type,
7195 method_signature, arg_list);
7196
7197 if (! flag_emit_class_files)
7198 func = build1 (NOP_EXPR, build_pointer_type (method_type), func);
7199 call = build (CALL_EXPR, TREE_TYPE (method_type), func,
7200 build_tree_list (NULL_TREE, arg_list), NULL_TREE);
7201 TREE_SIDE_EFFECTS (call) = 1;
7202 call = build_class_init (self_type, call);
7203 compound = java_method_add_stmt (mdecl, call);
7204 block = exit_block ();
7205 BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) = block;
7206 /* The function decl, its block and the compound statement
7207 within this block are all of void type. */
7208 TREE_TYPE (block) = TREE_TYPE (compound) =
7209 TREE_TYPE (DECL_FUNCTION_BODY (mdecl)) = void_type_node;
7210 exit_block ();
7211 no_ac_found = 0;
7212 }
7213
7214 if (DECL_FUNCTION_BODY (mdecl))
7215 {
7216 expand_start_java_method (mdecl);
7217
7218 current_this
7219 = (!METHOD_STATIC (mdecl) ?
7220 BLOCK_EXPR_DECLS (DECL_FUNCTION_BODY (mdecl)) : NULL_TREE);
7221
7222 if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)) && no_ac_found)
7223 java_complete_tree (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (mdecl)));
7224 /* Don't go any further if we've found error(s) during the
7225 expansion */
7226 if (!java_error_count)
7227 source_end_java_method ();
7228 }
7229 }
7230
7231 /* Expand finals. */
7232
7233 void
7234 java_expand_finals ()
7235 {
7236 }
7237
7238 /* Wrap non WFL PRIMARY around a WFL and set EXPR_WFL_QUALIFICATION to
7239 a tree list node containing RIGHT. Fore coming RIGHTs will be
7240 chained to this hook. LOCATION contains the location of the
7241 separating `.' operator. */
7242
7243 static tree
7244 make_qualified_primary (primary, right, location)
7245 tree primary, right;
7246 int location;
7247 {
7248 tree wfl;
7249
7250 /* We want to process THIS . xxx symbolicaly, to keep it consistent
7251 with the way we're processing SUPER. A THIS from a primary as a
7252 different form than a SUPER. Turn THIS into something symbolic */
7253 if (TREE_CODE (primary) == JAVA_THIS_EXPR)
7254 {
7255 wfl = build_wfl_node (this_identifier_node, input_filename, 0, 0);
7256 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
7257 wfl = make_qualified_name (wfl, right, location);
7258 PRIMARY_P (wfl) = 1;
7259 return wfl;
7260 }
7261 /* Other non WFL node are wrapped around a WFL */
7262 else if (TREE_CODE (primary) != EXPR_WITH_FILE_LOCATION)
7263 {
7264 wfl = build_expr_wfl (NULL_TREE, ctxp->filename, 0, 0);
7265 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (primary);
7266 EXPR_WFL_QUALIFICATION (wfl) = build_tree_list (primary, NULL_TREE);
7267 }
7268 else
7269 {
7270 wfl = primary;
7271 if (!EXPR_WFL_QUALIFICATION (primary))
7272 EXPR_WFL_QUALIFICATION (primary) =
7273 build_tree_list (primary, NULL_TREE);
7274 }
7275
7276 EXPR_WFL_LINECOL (right) = location;
7277 chainon (EXPR_WFL_QUALIFICATION (wfl), build_tree_list (right, NULL_TREE));
7278 PRIMARY_P (wfl) = 1;
7279 return wfl;
7280 }
7281
7282 /* Simple merge of two name separated by a `.' */
7283
7284 static tree
7285 merge_qualified_name (left, right)
7286 tree left, right;
7287 {
7288 tree node;
7289 obstack_grow (&temporary_obstack, IDENTIFIER_POINTER (left),
7290 IDENTIFIER_LENGTH (left));
7291 obstack_1grow (&temporary_obstack, '.');
7292 obstack_grow0 (&temporary_obstack, IDENTIFIER_POINTER (right),
7293 IDENTIFIER_LENGTH (right));
7294 node = get_identifier (obstack_base (&temporary_obstack));
7295 obstack_free (&temporary_obstack, obstack_base (&temporary_obstack));
7296 QUALIFIED_P (node) = 1;
7297 return node;
7298 }
7299
7300 /* Merge the two parts of a qualified name into LEFT. Set the
7301 location information of the resulting node to LOCATION, usually
7302 inherited from the location information of the `.' operator. */
7303
7304 static tree
7305 make_qualified_name (left, right, location)
7306 tree left, right;
7307 int location;
7308 {
7309 int qualified;
7310 tree left_id = EXPR_WFL_NODE (left);
7311 tree right_id = EXPR_WFL_NODE (right);
7312 tree wfl, merge;
7313
7314 merge = merge_qualified_name (left_id, right_id);
7315
7316 /* Left wasn't qualified and is now qualified */
7317 if (!QUALIFIED_P (left_id))
7318 {
7319 tree wfl = build_expr_wfl (left_id, ctxp->filename, 0, 0);
7320 EXPR_WFL_LINECOL (wfl) = EXPR_WFL_LINECOL (left);
7321 EXPR_WFL_QUALIFICATION (left) = build_tree_list (wfl, NULL_TREE);
7322 }
7323
7324 wfl = build_expr_wfl (right_id, ctxp->filename, 0, 0);
7325 EXPR_WFL_LINECOL (wfl) = location;
7326 chainon (EXPR_WFL_QUALIFICATION (left), build_tree_list (wfl, NULL_TREE));
7327
7328 EXPR_WFL_NODE (left) = merge;
7329 return left;
7330 }
7331
7332 /* Extract the last identifier component of the qualified in WFL. The
7333 last identifier is removed from the linked list */
7334
7335 static tree
7336 cut_identifier_in_qualified (wfl)
7337 tree wfl;
7338 {
7339 tree q;
7340 tree previous = NULL_TREE;
7341 for (q = EXPR_WFL_QUALIFICATION (wfl); ; previous = q, q = TREE_CHAIN (q))
7342 if (!TREE_CHAIN (q))
7343 {
7344 if (!previous)
7345 fatal ("Operating on a non qualified qualified WFL - "
7346 "cut_identifier_in_qualified");
7347 TREE_CHAIN (previous) = NULL_TREE;
7348 return TREE_PURPOSE (q);
7349 }
7350 }
7351
7352 /* Resolve the expression name NAME. Return its decl. */
7353
7354 static tree
7355 resolve_expression_name (id)
7356 tree id;
7357 {
7358 tree name = EXPR_WFL_NODE (id);
7359 tree decl;
7360
7361 /* 6.5.5.1: Simple expression names */
7362 if (!PRIMARY_P (id) && !QUALIFIED_P (name))
7363 {
7364 /* 15.13.1: NAME can appear within the scope of a local variable
7365 declaration */
7366 if ((decl = IDENTIFIER_LOCAL_VALUE (name)))
7367 return decl;
7368
7369 /* 15.13.1: NAME can appear within a class declaration */
7370 else
7371 {
7372 decl = lookup_field_wrapper (current_class, name);
7373 if (decl)
7374 {
7375 int fs = FIELD_STATIC (decl);
7376 /* Instance variable (8.3.1.1) can't appear within
7377 static method, static initializer or initializer for
7378 a static variable. */
7379 if (!fs && METHOD_STATIC (current_function_decl))
7380 {
7381 parse_error_context
7382 (id, "Can't make a static reference to nonstatic variable "
7383 "`%s' in class `%s'",
7384 IDENTIFIER_POINTER (name),
7385 IDENTIFIER_POINTER (DECL_NAME
7386 (TYPE_NAME (current_class))));
7387 return error_mark_node;
7388 }
7389 decl = build_field_ref ((fs ? NULL_TREE : current_this),
7390 current_class, name);
7391 return (fs ? build_class_init (current_class, decl) : decl);
7392 }
7393 /* Fall down to error report on undefined variable */
7394 }
7395 }
7396 /* 6.5.5.2 Qualified Expression Names */
7397 else
7398 {
7399 qualify_ambiguous_name (id);
7400 /* 15.10.1 Field Access Using a Primary and/or Expression Name */
7401 /* 15.10.2: Accessing Superclass Members using super */
7402 return resolve_field_access (id, NULL, NULL);
7403 }
7404
7405 /* We've got an error here */
7406 parse_error_context (id, "Undefined variable `%s'",
7407 IDENTIFIER_POINTER (name));
7408
7409 return error_mark_node;
7410 }
7411
7412 /* 15.10.1 Field Acess Using a Primary and/or Expression Name.
7413 We return something suitable to generate the field access. We also
7414 return the field decl in FIELD_DECL and its type in FIELD_TYPE. If
7415 recipient's address can be null. */
7416
7417 static tree
7418 resolve_field_access (qual_wfl, field_decl, field_type)
7419 tree qual_wfl;
7420 tree *field_decl, *field_type;
7421 {
7422 int is_static = 0;
7423 tree field_ref;
7424 tree decl, where_found, type_found;
7425
7426 if (resolve_qualified_expression_name (qual_wfl, &decl,
7427 &where_found, &type_found))
7428 return error_mark_node;
7429
7430 /* Resolve the LENGTH field of an array here */
7431 if (DECL_NAME (decl) == length_identifier_node && TYPE_ARRAY_P (type_found)
7432 && ! flag_emit_class_files)
7433 {
7434 tree length = build_java_array_length_access (where_found);
7435 field_ref =
7436 build_java_arraynull_check (type_found, length, int_type_node);
7437 }
7438 /* We might have been trying to resolve field.method(). In which
7439 case, the resolution is over and decl is the answer */
7440 else if (DECL_P (decl) && IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)) == decl)
7441 field_ref = decl;
7442 else if (DECL_P (decl))
7443 {
7444 is_static = DECL_P (decl) && FIELD_STATIC (decl);
7445 field_ref = build_field_ref ((is_static ? NULL_TREE : where_found),
7446 type_found, DECL_NAME (decl));
7447 if (field_ref == error_mark_node)
7448 return error_mark_node;
7449 if (is_static)
7450 {
7451 field_ref = build_class_init (type_found, field_ref);
7452 /* If the static field was identified by an expression that
7453 needs to be generated, make the field access a compound
7454 expression whose first part of the evaluation of the
7455 field selector part. */
7456 if (where_found && TREE_CODE (where_found) != TYPE_DECL)
7457 {
7458 tree type = QUAL_DECL_TYPE (field_ref);
7459 field_ref = build (COMPOUND_EXPR, type, where_found, field_ref);
7460 }
7461 }
7462 }
7463 else
7464 field_ref = decl;
7465
7466 if (field_decl)
7467 *field_decl = decl;
7468 if (field_type)
7469 *field_type = QUAL_DECL_TYPE (decl);
7470 return field_ref;
7471 }
7472
7473 /* 6.5.5.2: Qualified Expression Names */
7474
7475 static int
7476 resolve_qualified_expression_name (wfl, found_decl, where_found, type_found)
7477 tree wfl;
7478 tree *found_decl, *type_found, *where_found;
7479 {
7480 int from_type = 0; /* Field search initiated from a type */
7481 int from_super = 0, from_cast = 0;
7482 int previous_call_static = 0;
7483 int is_static;
7484 tree decl = NULL_TREE, type = NULL_TREE, q;
7485 *where_found = NULL_TREE;
7486
7487 for (q = EXPR_WFL_QUALIFICATION (wfl); q; q = TREE_CHAIN (q))
7488 {
7489 tree qual_wfl = QUAL_WFL (q);
7490
7491 /* 15.10.1 Field Access Using a Primary */
7492
7493 switch (TREE_CODE (qual_wfl))
7494 {
7495 case CALL_EXPR:
7496 case JAVA_NEW_CLASS_EXPR:
7497 /* If the access to the function call is a non static field,
7498 build the code to access it. */
7499 if (DECL_P (decl) && !FIELD_STATIC (decl))
7500 {
7501 decl = maybe_access_field (decl, *where_found, type);
7502 if (decl == error_mark_node)
7503 return 1;
7504 }
7505 /* And code for the function call */
7506 if (complete_function_arguments (qual_wfl))
7507 return 1;
7508 *where_found =
7509 patch_method_invocation_stmt (qual_wfl, decl, type, &is_static);
7510 if (*where_found == error_mark_node)
7511 return 1;
7512 *type_found = type = QUAL_DECL_TYPE (*where_found);
7513
7514 /* If the previous call was static and this one is too,
7515 build a compound expression to hold the two (because in
7516 that case, previous function calls aren't transported as
7517 forcoming function's argument. */
7518 if (previous_call_static && is_static)
7519 {
7520 decl = build (COMPOUND_EXPR, type, decl, *where_found);
7521 TREE_SIDE_EFFECTS (decl) = 1;
7522 }
7523 else
7524 {
7525 previous_call_static = is_static;
7526 decl = *where_found;
7527 }
7528 continue;
7529
7530 case CONVERT_EXPR:
7531 *where_found = decl = java_complete_tree (qual_wfl);
7532 if (decl == error_mark_node)
7533 return 1;
7534 *type_found = type = QUAL_DECL_TYPE (decl);
7535 from_cast = 1;
7536 continue;
7537
7538 case ARRAY_REF:
7539 /* If the access to the function call is a non static field,
7540 build the code to access it. */
7541 if (DECL_P (decl) && !FIELD_STATIC (decl))
7542 {
7543 decl = maybe_access_field (decl, *where_found, type);
7544 if (decl == error_mark_node)
7545 return 1;
7546 }
7547 /* And code for the array reference expression */
7548 decl = java_complete_tree (qual_wfl);
7549 if (decl == error_mark_node)
7550 return 1;
7551 type = QUAL_DECL_TYPE (decl);
7552 continue;
7553 }
7554
7555 /* If we fall here, we weren't processing a (static) function call. */
7556 previous_call_static = 0;
7557
7558 /* It can be the keyword THIS */
7559 if (EXPR_WFL_NODE (qual_wfl) == this_identifier_node)
7560 {
7561 if (!current_this)
7562 {
7563 parse_error_context
7564 (wfl, "Keyword `this' used outside allowed context");
7565 return 1;
7566 }
7567 /* We have to generate code for intermediate acess */
7568 *where_found = decl = current_this;
7569 type = QUAL_DECL_TYPE (decl);
7570 continue;
7571 }
7572
7573 /* 15.10.2 Accessing Superclass Members using SUPER */
7574 if (EXPR_WFL_NODE (qual_wfl) == super_identifier_node)
7575 {
7576 tree node;
7577 /* Check on the restricted use of SUPER */
7578 if (METHOD_STATIC (current_function_decl)
7579 || current_class == object_type_node)
7580 {
7581 parse_error_context
7582 (wfl, "Keyword `super' used outside allowed context");
7583 return 1;
7584 }
7585 /* Otherwise, treat SUPER as (SUPER_CLASS)THIS */
7586 node = build_cast (EXPR_WFL_LINECOL (qual_wfl),
7587 CLASSTYPE_SUPER (current_class),
7588 build_this (EXPR_WFL_LINECOL (qual_wfl)));
7589 *where_found = decl = java_complete_tree (node);
7590 *type_found = type = QUAL_DECL_TYPE (decl);
7591 from_super = from_type = 1;
7592 continue;
7593 }
7594
7595 /* 15.13.1: Can't search for field name in packages, so we
7596 assume a variable/class name was meant. */
7597 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
7598 {
7599 if (from_super || from_cast)
7600 parse_error_context
7601 ((from_cast ? qual_wfl : wfl),
7602 "No variable `%s' defined in class `%s'",
7603 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
7604 lang_printable_name (type));
7605 else
7606 parse_error_context
7607 (qual_wfl, "Undefined variable or class name: `%s'",
7608 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)));
7609 return 1;
7610 }
7611
7612 /* We have a type name. It's been already resolved when the
7613 expression was qualified. */
7614 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
7615 {
7616 if (!(decl = QUAL_RESOLUTION (q)))
7617 return 1; /* Error reported already */
7618
7619 if (not_accessible_p (TREE_TYPE (decl), decl, 0))
7620 {
7621 parse_error_context
7622 (qual_wfl, "Can't access %s field `%s.%s' from `%s'",
7623 java_accstring_lookup (get_access_flags_from_decl (decl)),
7624 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
7625 IDENTIFIER_POINTER (DECL_NAME (decl)),
7626 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
7627 return 1;
7628 }
7629
7630 type = TREE_TYPE (decl);
7631 from_type = 1;
7632 }
7633 /* We resolve and expression name */
7634 else
7635 {
7636 tree field_decl;
7637
7638 /* If there exists an early resolution, use it. That occurs
7639 only once and we know that there are more things to
7640 come. Don't do that when processing something after SUPER
7641 (we need more thing to be put in place below */
7642 if (!from_super && QUAL_RESOLUTION (q))
7643 decl = QUAL_RESOLUTION (q);
7644
7645 /* We have to search for a field, knowing the type of its
7646 container. The flag FROM_TYPE indicates that we resolved
7647 the last member of the expression as a type name, which
7648 means that for the resolution of this field, will check
7649 on other errors than if the it was resolved as a member
7650 of an other field. */
7651 else
7652 {
7653 int is_static;
7654 if (!from_type && !JREFERENCE_TYPE_P (type))
7655 {
7656 parse_error_context
7657 (qual_wfl, "Attempt to reference field `%s' in `%s %s'",
7658 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
7659 lang_printable_name (type),
7660 IDENTIFIER_POINTER (DECL_NAME (field_decl)));
7661 return 1;
7662 }
7663
7664 if (!(field_decl =
7665 lookup_field_wrapper (type, EXPR_WFL_NODE (qual_wfl))))
7666 {
7667 parse_error_context
7668 (qual_wfl, "No variable `%s' defined in class `%s'",
7669 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
7670 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
7671 return 1;
7672 }
7673
7674 /* Check on accessibility here */
7675 if (not_accessible_p (type, field_decl, from_super))
7676 {
7677 parse_error_context
7678 (qual_wfl,
7679 "Can't access %s field `%s.%s' from `%s'",
7680 java_accstring_lookup
7681 (get_access_flags_from_decl (field_decl)),
7682 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))),
7683 IDENTIFIER_POINTER (DECL_NAME (field_decl)),
7684 IDENTIFIER_POINTER
7685 (DECL_NAME (TYPE_NAME (current_class))));
7686 return 1;
7687 }
7688
7689 /* There are things to check when fields are accessed
7690 from type. There are no restrictions on a static
7691 declaration of the field when it is accessed from an
7692 interface */
7693 is_static = FIELD_STATIC (field_decl);
7694 if (!from_super && from_type
7695 && !TYPE_INTERFACE_P (type) && !is_static)
7696 {
7697 parse_error_context
7698 (qual_wfl, "Can't make a static reference to nonstatic "
7699 "variable `%s' in class `%s'",
7700 IDENTIFIER_POINTER (EXPR_WFL_NODE (qual_wfl)),
7701 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
7702 return 1;
7703 }
7704 from_cast = from_super = 0;
7705
7706 /* If we need to generate something to get a proper handle
7707 on what this field is accessed from, do it now. */
7708 if (!is_static)
7709 {
7710 decl = maybe_access_field (decl, *where_found, type);
7711 if (decl == error_mark_node)
7712 return 1;
7713 }
7714
7715 /* We want to keep the location were found it, and the type
7716 we found. */
7717 *where_found = decl;
7718 *type_found = type;
7719
7720 /* This is the decl found and eventually the next one to
7721 search from */
7722 decl = field_decl;
7723 }
7724
7725 from_type = 0;
7726 type = QUAL_DECL_TYPE (decl);
7727 }
7728 }
7729 *found_decl = decl;
7730 return 0;
7731 }
7732
7733 /* 6.6 Qualified name and access control. Returns 1 if MEMBER (a decl)
7734 can't be accessed from REFERENCE (a record type). */
7735
7736 int not_accessible_p (reference, member, from_super)
7737 tree reference, member;
7738 int from_super;
7739 {
7740 int access_flag = get_access_flags_from_decl (member);
7741
7742 /* Access always granted for members declared public */
7743 if (access_flag & ACC_PUBLIC)
7744 return 0;
7745
7746 /* Check access on protected members */
7747 if (access_flag & ACC_PROTECTED)
7748 {
7749 /* Access granted if it occurs from within the package
7750 containing the class in which the protected member is
7751 declared */
7752 if (class_in_current_package (DECL_CONTEXT (member)))
7753 return 0;
7754
7755 if (TREE_CODE (member) == FUNCTION_DECL && DECL_CONSTRUCTOR_P (member))
7756 {
7757 /* Access from SUPER is granted */
7758 if (from_super)
7759 return 0;
7760 /* Otherwise, access isn't granted */
7761 return 1;
7762 }
7763 else
7764 {
7765 /* If accessed with the form `super.member', then access is
7766 granted */
7767 if (from_super)
7768 return 0;
7769
7770 /* Otherwise, access is granted if occuring from the class where
7771 member is declared or a subclass of it */
7772 if (inherits_from_p (reference, current_class))
7773 return 0;
7774 }
7775 return 1;
7776 }
7777
7778 /* Check access on private members. Access is granted only if it
7779 occurs from within the class in witch it is declared*/
7780
7781 if (access_flag & ACC_PRIVATE)
7782 return (current_class == DECL_CONTEXT (member) ? 0 : 1);
7783
7784 /* Default access are permitted only when occuring within the
7785 package in which the type (REFERENCE) is declared. In other words,
7786 REFERENCE is defined in the current package */
7787 if (ctxp->package)
7788 return !class_in_current_package (reference);
7789
7790 /* Otherwise, access is granted */
7791 return 0;
7792 }
7793
7794 /* Returns 1 if class was declared in the current package, 0 otherwise */
7795
7796 static int
7797 class_in_current_package (class)
7798 tree class;
7799 {
7800 static tree cache = NULL_TREE;
7801 int qualified_flag;
7802 tree left;
7803
7804 if (cache == class)
7805 return 1;
7806
7807 qualified_flag = QUALIFIED_P (DECL_NAME (TYPE_NAME (class)));
7808
7809 /* If the current package is empty and the name of CLASS is
7810 qualified, class isn't in the current package. If there is a
7811 current package and the name of the CLASS is not qualified, class
7812 isn't in the current package */
7813 if (!ctxp->package && qualified_flag || ctxp->package && !qualified_flag)
7814 return 0;
7815
7816 /* If there is not package and the name of CLASS isn't qualified,
7817 they belong to the same unnamed package */
7818 if (!ctxp->package && !qualified_flag)
7819 return 1;
7820
7821 /* Compare the left part of the name of CLASS with the package name */
7822 breakdown_qualified (&left, NULL, DECL_NAME (TYPE_NAME (class)));
7823 if (ctxp->package == left)
7824 {
7825 cache = class;
7826 return 1;
7827 }
7828 return 0;
7829 }
7830
7831 /* This function may generate code to access DECL from WHERE. This is
7832 done only if certain conditions meet. */
7833
7834 static tree
7835 maybe_access_field (decl, where, type)
7836 tree decl, where, type;
7837 {
7838 if (DECL_P (decl) && decl != current_this
7839 && (!(TREE_CODE (decl) != PARM_DECL
7840 && FIELD_STATIC (decl)))
7841 && !IDENTIFIER_LOCAL_VALUE (DECL_NAME (decl)))
7842 decl = build_field_ref (where ? where : current_this,
7843 type, DECL_NAME (decl));
7844 return decl;
7845 }
7846
7847 /* Build a method invocation statement, by patching PATCH. If non NULL
7848 and according to the situation, PRIMARY and WHERE may be
7849 used. IS_STATIC is set to 1 if the invoked function is static. */
7850
7851 static tree
7852 patch_method_invocation_stmt (patch, primary, where, is_static)
7853 tree patch, primary, where;
7854 int *is_static;
7855 {
7856 tree wfl = TREE_OPERAND (patch, 0);
7857 tree args = TREE_OPERAND (patch, 1);
7858 tree name = EXPR_WFL_NODE (wfl);
7859 tree list, class_type;
7860
7861 /* Should be overriden if everything goes well. Otherwise, if
7862 something fails, it should keep this value. It stop the
7863 evaluation of a bogus assignment. See java_complete_tree,
7864 MODIFY_EXPR: for the reasons why we sometimes want to keep on
7865 evaluating an assignment */
7866 TREE_TYPE (patch) = error_mark_node;
7867
7868 /* Since lookup functions are messing with line numbers, save the
7869 context now. */
7870 java_parser_context_save_global ();
7871
7872 /* 15.11.1: Compile-Time Step 1: Determine Class or Interface to Search */
7873
7874 /* Resolution of qualified name, excluding constructors */
7875 if (QUALIFIED_P (name) && !CALL_CONSTRUCTOR_P (patch))
7876 {
7877 tree class_decl, identifier, identifier_wfl;
7878 /* Extract the last IDENTIFIER of the qualified
7879 expression. This is a wfl and we will use it's location
7880 data during error report. */
7881 identifier_wfl = cut_identifier_in_qualified (wfl);
7882 identifier = EXPR_WFL_NODE (identifier_wfl);
7883
7884 /* Given the context, IDENTIFIER is syntactically qualified
7885 as a MethodName. We need to qualify what's before */
7886 qualify_ambiguous_name (wfl);
7887
7888 /* Package resolution are erroneous */
7889 if (RESOLVE_PACKAGE_NAME_P (wfl))
7890 {
7891 tree remainder;
7892 breakdown_qualified (&remainder, NULL, EXPR_WFL_NODE (wfl));
7893 parse_error_context (wfl, "Can't search method `%s' in package "
7894 "`%s'",IDENTIFIER_POINTER (identifier),
7895 IDENTIFIER_POINTER (remainder));
7896 return error_mark_node;
7897 }
7898 /* We're resolving a call from a type */
7899 else if (RESOLVE_TYPE_NAME_P (wfl))
7900 {
7901 tree decl = QUAL_RESOLUTION (EXPR_WFL_QUALIFICATION (wfl));
7902 tree name = DECL_NAME (decl);
7903 tree type;
7904
7905 class_decl = resolve_and_layout (name, wfl);
7906 if (CLASS_INTERFACE (decl))
7907 {
7908 parse_error_context
7909 (identifier_wfl, "Can't make static reference to method "
7910 "`%s' in interface `%s'", IDENTIFIER_POINTER (identifier),
7911 IDENTIFIER_POINTER (name));
7912 return error_mark_node;
7913 }
7914 /* Look the method up in the type selector. The method ought
7915 to be static. */
7916 type = TREE_TYPE (class_decl);
7917 list = lookup_method_invoke (0, wfl, type, identifier, args);
7918 if (list && !METHOD_STATIC (list))
7919 {
7920 char *fct_name = strdup ((char *)lang_printable_name (list));
7921 parse_error_context
7922 (identifier_wfl,
7923 "Can't make static reference to method `%s %s' in class `%s'",
7924 lang_printable_name (TREE_TYPE (TREE_TYPE (list))), fct_name,
7925 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
7926 free (fct_name);
7927 return error_mark_node;
7928 }
7929 }
7930 /* We're resolving an expression name */
7931 else
7932 {
7933 tree field, type;
7934
7935 /* 1- Find the field to which the call applies */
7936 field = resolve_field_access (wfl, NULL, &type);
7937 if (field == error_mark_node)
7938 return error_mark_node;
7939
7940 /* 2- Do the layout of the class where the last field
7941 was found, so we can search it. */
7942 class_decl =
7943 resolve_and_layout (DECL_NAME (TYPE_NAME (type)), NULL_TREE);
7944
7945 /* 3- Retrieve a filtered list of method matches, Refine
7946 if necessary. In any cases, point out errors. */
7947 list = lookup_method_invoke (0, identifier_wfl, type,
7948 identifier, args);
7949
7950 /* 4- Add the field as an argument */
7951 args = tree_cons (NULL_TREE, field, args);
7952 }
7953
7954 /* CLASS_TYPE is used during the call to not_accessible_p and
7955 IDENTIFIER_WFL will be used to report any problem further */
7956 class_type = TREE_TYPE (class_decl);
7957 wfl = identifier_wfl;
7958 }
7959 /* Resolution of simple names, names generated after a primary: or
7960 constructors */
7961 else
7962 {
7963 tree class_to_search;
7964 int lc; /* Looking for Constructor */
7965
7966 /* We search constructor in their target class */
7967 if (CALL_CONSTRUCTOR_P (patch))
7968 {
7969 class_to_search = resolve_no_layout (EXPR_WFL_NODE (wfl), NULL_TREE);
7970 if (!class_to_search)
7971 {
7972 parse_error_context
7973 (wfl, "Class `%s' not found in type declaration",
7974 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
7975 return error_mark_node;
7976 }
7977
7978 /* Can't instantiate an abstract class */
7979 if (CLASS_ABSTRACT (class_to_search))
7980 {
7981 parse_error_context
7982 (wfl, "Class `%s' is an abstract class. It can't be "
7983 "instantiated", IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl)));
7984 return error_mark_node;
7985 }
7986 class_to_search = TREE_TYPE (class_to_search);
7987 lc = 1;
7988 }
7989 /* This is a regular search in the local class, unless an
7990 alternate class is specified. */
7991 else
7992 {
7993 class_to_search = (where ? where : current_class);
7994 lc = 0;
7995 }
7996
7997 /* NAME is a simple identifier or comes from a primary. Search
7998 in the class whose declaration contain the method being
7999 invoked. */
8000 list = lookup_method_invoke (lc, wfl, class_to_search, name, args);
8001
8002 /* Don't continue if no method were found, as the next statement
8003 can't be executed then. */
8004 if (!list) return error_mark_node;
8005
8006 /* Check for static reference if non static methods */
8007 if (check_for_static_method_reference (wfl, patch, list,
8008 class_to_search, primary))
8009 return error_mark_node;
8010
8011 /* Non static/constructor methods are called with the current
8012 object extra argument. If method is resolved as a primary,
8013 use the primary otherwise use the current THIS. */
8014 if (!CALL_CONSTRUCTOR_P (patch) && !METHOD_STATIC (list))
8015 args = tree_cons (NULL_TREE, primary ? primary : current_this, args);
8016
8017 class_type = class_to_search;
8018 }
8019
8020 /* Merge point of all resolution schemes. If we have nothing, this
8021 is an error, already signaled */
8022 if (!list) return error_mark_node;
8023
8024 /* Check accessibility, position the is_static flag, build and
8025 return the call */
8026 if (not_accessible_p (class_type, list, 0))
8027 {
8028 char *fct_name = strdup ((char *)lang_printable_name (list));
8029 parse_error_context
8030 (wfl, "Can't access %s method `%s %s.%s' from `%s'",
8031 java_accstring_lookup (get_access_flags_from_decl (list)),
8032 lang_printable_name (TREE_TYPE (TREE_TYPE (list))),
8033 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class_type))), fct_name,
8034 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (current_class))));
8035 free (fct_name);
8036 return error_mark_node;
8037 }
8038
8039 if (is_static)
8040 *is_static = METHOD_STATIC (list);
8041 java_parser_context_restore_global ();
8042 return patch_invoke (patch, list, args, wfl);
8043 }
8044
8045 /* Check that we're not trying to do a static reference to a method in
8046 non static method. Return 1 if it's the case, 0 otherwise. */
8047
8048 static int
8049 check_for_static_method_reference (wfl, node, method, where, primary)
8050 tree wfl, node, method, where, primary;
8051 {
8052 if (METHOD_STATIC (current_function_decl)
8053 && !METHOD_STATIC (method) && !primary && !CALL_CONSTRUCTOR_P (node))
8054 {
8055 char *fct_name = strdup ((char *)lang_printable_name (method));
8056 parse_error_context
8057 (wfl, "Can't make static reference to method `%s %s' in class `%s'",
8058 lang_printable_name (TREE_TYPE (TREE_TYPE (method))), fct_name,
8059 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (where))));
8060 free (fct_name);
8061 return 1;
8062 }
8063 return 0;
8064 }
8065
8066 /* Patch an invoke expression METHOD and ARGS, based on its invocation
8067 mode. */
8068
8069 static tree
8070 patch_invoke (patch, method, args, cl)
8071 tree patch, method, args;
8072 tree cl;
8073 {
8074 tree dtable, func;
8075 tree signature = build_java_signature (TREE_TYPE (method));
8076 tree original_call;
8077
8078 switch (invocation_mode (method, 0))
8079 {
8080 case INVOKE_VIRTUAL:
8081 dtable = invoke_build_dtable (0, args);
8082 func = build_invokevirtual (dtable, method);
8083 break;
8084 case INVOKE_STATIC:
8085 func = build_known_method_ref (method, TREE_TYPE (method),
8086 DECL_CONTEXT (method),
8087 signature, args);
8088 args = nreverse (args);
8089 break;
8090
8091 default:
8092 fatal ("Unknown invocation mode - build_invoke");
8093 return NULL_TREE;
8094 }
8095
8096
8097 /* Ensure self_type is initialized, (invokestatic). FIXME */
8098 func = build1 (NOP_EXPR, build_pointer_type (TREE_TYPE (method)), func);
8099 TREE_TYPE (patch) = TREE_TYPE (TREE_TYPE (method));
8100 TREE_OPERAND (patch, 0) = func;
8101 TREE_OPERAND (patch, 1) = args;
8102 original_call = patch;
8103
8104 /* We're calling a constructor. New is called an its returned value
8105 is an argument to the constructor. We build a COMPOUND_EXPR and
8106 use saved expression so that the overall NEW expression value is
8107 a pointer to a newly created and initialized class. */
8108 if (CALL_CONSTRUCTOR_P (original_call))
8109 {
8110 tree class = DECL_CONTEXT (method);
8111 tree c1, saved_new, size, new;
8112 if (!TYPE_SIZE (class))
8113 safe_layout_class (class);
8114 size = size_in_bytes (class);
8115 new = build (CALL_EXPR, promote_type (class),
8116 build_address_of (alloc_object_node),
8117 tree_cons (NULL_TREE, build_class_ref (class),
8118 build_tree_list (NULL_TREE,
8119 size_in_bytes (class))),
8120 NULL_TREE);
8121 saved_new = save_expr (new);
8122 c1 = build_tree_list (NULL_TREE, saved_new);
8123 TREE_CHAIN (c1) = TREE_OPERAND (original_call, 1);
8124 TREE_OPERAND (original_call, 1) = c1;
8125 TREE_SET_CODE (original_call, CALL_EXPR);
8126 patch = build (COMPOUND_EXPR, TREE_TYPE (new), patch, saved_new);
8127 }
8128 return patch;
8129 }
8130
8131 static int
8132 invocation_mode (method, super)
8133 tree method;
8134 int super;
8135 {
8136 int access = get_access_flags_from_decl (method);
8137
8138 if (access & ACC_STATIC)
8139 return INVOKE_STATIC;
8140
8141 if (CLASS_FINAL (TYPE_NAME (DECL_CONTEXT (method))))
8142 return INVOKE_STATIC;
8143
8144 if (super)
8145 return INVOKE_SUPER;
8146
8147 if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (method))))
8148 return INVOKE_INTERFACE;
8149
8150 if (DECL_CONSTRUCTOR_P (method))
8151 return INVOKE_STATIC;
8152
8153 return INVOKE_VIRTUAL;
8154 }
8155
8156 /* Retrieve a refined list of matching methods. */
8157
8158 static tree
8159 lookup_method_invoke (lc, cl, class, name, arg_list)
8160 int lc;
8161 tree cl;
8162 tree class, name, arg_list;
8163 {
8164 tree method = make_node (FUNCTION_TYPE);
8165 tree arg_type_list = NULL_TREE;
8166 tree signature, list, node, scratch;
8167
8168 for (node = arg_list; node; node = TREE_CHAIN (node))
8169 {
8170 tree current_arg;
8171 current_arg =
8172 build_tree_list (NULL_TREE,
8173 promote_type (TREE_TYPE (TREE_VALUE (node))));
8174 arg_type_list = chainon (current_arg, arg_type_list);
8175 }
8176 TYPE_ARG_TYPES (method) = arg_type_list;
8177
8178 if (!lc)
8179 {
8180 signature = build_java_argument_signature (method);
8181 list = match_java_method (class, name, signature);
8182 list = refine_accessible_methods_list (lc, list);
8183 }
8184 else
8185 {
8186 TREE_TYPE (method) = void_type_node;
8187 signature = build_java_signature (method);
8188 list = lookup_java_constructor (class, signature);
8189 }
8190
8191 if (!list)
8192 {
8193 parse_error_context (cl, "Can't find method `%s(%s)' in class `%s'",
8194 IDENTIFIER_POINTER (name),
8195 IDENTIFIER_POINTER (signature),
8196 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))));
8197 return NULL_TREE;
8198 }
8199
8200 if (lc)
8201 return list;
8202
8203 if (TREE_CHAIN (list))
8204 {
8205 tree most_specific_list = NULL_TREE;
8206 tree current;
8207 /* 15.11.2.2 Choose the Most Specific Method */
8208 for (current = list; current; current = TREE_CHAIN (current))
8209 {
8210 tree rest;
8211 tree method = TREE_VALUE (list);
8212 tree class_from = DECL_CONTEXT (method);
8213 for (rest = TREE_CHAIN (current); rest; rest = TREE_CHAIN (rest))
8214 {
8215 tree other = TREE_VALUE (rest);
8216
8217 /* METHOD can be declared more specific with regard to OTHER iif:
8218
8219 - The class METHOD belongs can be converted to the
8220 class OTHER belongs by method invocation conversion
8221 (5.3). Since we're dealing with classes here, it is
8222 covered by the identity conversion or the windening
8223 primitive conversion.
8224
8225 - The types of the arguments of METHOD can be
8226 converted to the types of the arguments of OTHER by
8227 method invocation conversion (5.3). */
8228
8229 if (valid_ref_assignconv_cast_p (class_from,
8230 DECL_CONTEXT (other), 0)
8231 && 1) /* Test on args non implemented */
8232 most_specific_list = tree_cons (NULL_TREE, method,
8233 most_specific_list);
8234 }
8235 }
8236 list = most_specific_list;
8237 }
8238
8239 if (!list || TREE_CHAIN (list))
8240 {
8241 parse_error_context (cl, "Can't find method `%s(%s)' in class `%s'",
8242 IDENTIFIER_POINTER (name),
8243 IDENTIFIER_POINTER (signature),
8244 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))));
8245 return NULL_TREE;
8246 }
8247
8248 /* 15.11.3 Is the Chosen Method Appropriate ? */
8249 else
8250 return TREE_VALUE (list);
8251 }
8252
8253 /* Refine accessible methods from the raw matching method list, as
8254 specified in 15.11.4.3. Return a (possibly empty) new method
8255 list. */
8256
8257 static tree
8258 refine_accessible_methods_list (lc, list)
8259 int lc; /* Looking for Constructor */
8260 tree list;
8261 {
8262 #define ADD_TO_LIST_AND_CONTINUE \
8263 { \
8264 refined_list = tree_cons (NULL_TREE, method, refined_list); \
8265 continue; \
8266 }
8267 tree node, refined_list = NULL_TREE;
8268 tree current_class_name = DECL_NAME (TYPE_NAME (current_class));
8269
8270 for (node = list; node; node = TREE_CHAIN (node))
8271 {
8272 int access, identical;
8273 tree class_from, method, class_from_name;
8274
8275 method = TREE_VALUE (node);
8276
8277 /* Constructor not retained here, unless were specifically
8278 looking for them. */
8279 if (lc && DECL_CONSTRUCTOR_P (method))
8280 ADD_TO_LIST_AND_CONTINUE;
8281
8282 access = get_access_flags_from_decl (method);
8283 class_from = DECL_CONTEXT (method);
8284 class_from_name = DECL_NAME (TYPE_NAME (class_from));
8285
8286 identical = identical_subpath_p (current_class_name, class_from_name);
8287
8288 /* Check accessibility of class_from from the current one: This
8289 test has been already carried out when qualify_ambiguous_name
8290 tried to resolve a type found in an other package. It is not
8291 necessary to retest things here, the error has been already
8292 reported. */
8293
8294 /* Public method are always OK */
8295 if (access & ACC_PUBLIC)
8296 ADD_TO_LIST_AND_CONTINUE;
8297
8298 /* Protected method access is OK if classes are from the
8299 same package or part of the same inheritance lineage */
8300 if ((access & ACC_PROTECTED)
8301 && (inherits_from_p (current_class, class_from) || identical))
8302 ADD_TO_LIST_AND_CONTINUE;
8303
8304 /* Methods with default (package) access are OK if classes are
8305 from the same default package. */
8306 if (identical ||
8307 (!QUALIFIED_P (class_from_name) && !QUALIFIED_P (current_class_name)))
8308 ADD_TO_LIST_AND_CONTINUE;
8309
8310 /* Private method accessible iff current class is the node where
8311 the method is defined */
8312 if ((access & ACC_PRIVATE) && (class_from == current_class))
8313 ADD_TO_LIST_AND_CONTINUE;
8314 }
8315 #undef ADD_TO_LIST_AND_CONTINUE
8316 return refined_list;
8317 }
8318
8319 /* Qualification routines */
8320
8321 static void
8322 qualify_ambiguous_name (id)
8323 tree id;
8324 {
8325 tree qual, qual_wfl, name, decl, ptr_type, saved_current_class;
8326 int again, super_found = 0, this_found = 0;
8327
8328 /* We first qualify the first element, then derive qualification of
8329 others based on the first one. If the first element is qualified
8330 by a resolution (field or type), this resolution is stored in the
8331 QUAL_RESOLUTION of the qual element being examined. We need to
8332 save the current_class since the use of SUPER might change the
8333 its value. */
8334 saved_current_class = current_class;
8335 qual = EXPR_WFL_QUALIFICATION (id);
8336 do {
8337
8338 /* Simple qualified expression feature a qual_wfl that is a
8339 WFL. Expression derived from a primary feature more complicated
8340 things like a CALL_EXPR. Expression from primary need to be
8341 worked out to extract the part on which the qualification will
8342 take place. */
8343 qual_wfl = QUAL_WFL (qual);
8344 switch (TREE_CODE (qual_wfl))
8345 {
8346 case CALL_EXPR:
8347 qual_wfl = TREE_OPERAND (qual_wfl, 0);
8348 if (TREE_CODE (qual_wfl) != EXPR_WITH_FILE_LOCATION)
8349 {
8350 qual = EXPR_WFL_QUALIFICATION (qual_wfl);
8351 qual_wfl = QUAL_WFL (qual);
8352 }
8353 break;
8354 case JAVA_NEW_CLASS_EXPR:
8355 case CONVERT_EXPR:
8356 case ARRAY_REF:
8357 qual_wfl = TREE_OPERAND (qual_wfl, 0);
8358 break;
8359 }
8360 name = EXPR_WFL_NODE (qual_wfl);
8361 ptr_type = current_class;
8362 again = 0;
8363 /* If we have a THIS (from a primary), we set the context accordingly */
8364 if (name == this_identifier_node)
8365 {
8366 qual = TREE_CHAIN (qual);
8367 qual_wfl = QUAL_WFL (qual);
8368 name = EXPR_WFL_NODE (qual_wfl);
8369 this_found = 1;
8370 }
8371 /* If we have a SUPER, we set the context accordingly */
8372 if (name == super_identifier_node)
8373 {
8374 current_class = CLASSTYPE_SUPER (ptr_type);
8375 /* Check that there is such a thing as a super class. If not,
8376 return. The error will be caught later on, during the
8377 resolution */
8378 if (!current_class)
8379 {
8380 current_class = saved_current_class;
8381 return;
8382 }
8383 qual = TREE_CHAIN (qual);
8384 /* Do one more interation to set things up */
8385 super_found = again = 1;
8386 }
8387 } while (again);
8388
8389 /* If name appears within the scope of a location variable
8390 declaration or parameter declaration, then it is an expression
8391 name. We don't carry this test out if we're in the context of the
8392 use of SUPER or THIS */
8393
8394 if (!this_found && !super_found && (decl = IDENTIFIER_LOCAL_VALUE (name)))
8395 {
8396 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
8397 QUAL_RESOLUTION (qual) = decl;
8398 }
8399
8400 /* If within the class/interface NAME was found to be used there
8401 exists a (possibly inherited) field named NAME, then this is an
8402 expression name. */
8403 else if ((decl = lookup_field_wrapper (ptr_type, name)))
8404 {
8405 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
8406 QUAL_RESOLUTION (qual) = decl;
8407 }
8408
8409 /* We reclassify NAME as a type name if:
8410 - NAME is a class/interface declared within the compilation
8411 unit containing NAME,
8412 - NAME is imported via a single-type-import declaration,
8413 - NAME is declared in an another compilation unit of the package
8414 of the compilation unit containing NAME,
8415 - NAME is declared by exactly on type-import-on-demand declaration
8416 of the compilation unit containing NAME. */
8417 else if ((decl = resolve_and_layout (name, NULL_TREE)))
8418 {
8419 RESOLVE_TYPE_NAME_P (qual_wfl) = 1;
8420 QUAL_RESOLUTION (qual) = decl;
8421 }
8422
8423 /* Method call are expression name */
8424 else if (TREE_CODE (QUAL_WFL (qual)) == CALL_EXPR)
8425 RESOLVE_EXPRESSION_NAME_P (qual_wfl) = 1;
8426
8427 /* Check here that NAME isn't declared by more than one
8428 type-import-on-demand declaration of the compilation unit
8429 containing NAME. FIXME */
8430
8431 /* Otherwise, NAME is reclassified as a package name */
8432 else
8433 RESOLVE_PACKAGE_NAME_P (qual_wfl) = 1;
8434
8435 /* Propagate the qualification accross other components of the
8436 qualified name */
8437 for (qual = TREE_CHAIN (qual); qual;
8438 qual_wfl = QUAL_WFL (qual), qual = TREE_CHAIN (qual))
8439 {
8440 if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
8441 RESOLVE_PACKAGE_NAME_P (QUAL_WFL (qual)) = 1;
8442 else
8443 RESOLVE_EXPRESSION_NAME_P (QUAL_WFL (qual)) = 1;
8444 }
8445
8446 /* Store the global qualification for the ambiguous part of ID back
8447 into ID fields */
8448 if (RESOLVE_EXPRESSION_NAME_P (qual_wfl))
8449 RESOLVE_EXPRESSION_NAME_P (id) = 1;
8450 else if (RESOLVE_TYPE_NAME_P (qual_wfl))
8451 RESOLVE_TYPE_NAME_P (id) = 1;
8452 else if (RESOLVE_PACKAGE_NAME_P (qual_wfl))
8453 RESOLVE_PACKAGE_NAME_P (id) = 1;
8454
8455 /* Restore the current class */
8456 current_class = saved_current_class;
8457 }
8458
8459 static int
8460 breakdown_qualified (left, right, source)
8461 tree *left, *right, source;
8462 {
8463 char *p = IDENTIFIER_POINTER (source), *base;
8464 int l = IDENTIFIER_LENGTH (source);
8465
8466 /* Breakdown NAME into REMAINDER . IDENTIFIER */
8467 base = p;
8468 p += (l-1);
8469 while (*p != '.' && p != base)
8470 p--;
8471
8472 /* We didn't find a '.'. Return an error */
8473 if (p == base)
8474 return 1;
8475
8476 *p = '\0';
8477 if (right)
8478 *right = get_identifier (p+1);
8479 *left = get_identifier (IDENTIFIER_POINTER (source));
8480 *p = '.';
8481
8482 return 0;
8483 }
8484
8485 /* Return 1 if N1 and N2 have identical sub-path. */
8486
8487 static int
8488 identical_subpath_p (n1, n2)
8489 tree n1, n2;
8490 {
8491 tree left1, left2;
8492
8493 if (!QUALIFIED_P (n1) || !QUALIFIED_P (n2))
8494 return n1 == n2;
8495
8496 breakdown_qualified (&left1, NULL, n1);
8497 breakdown_qualified (&left2, NULL, n2);
8498
8499 return left1 == left2;
8500 }
8501
8502 static int
8503 not_initialized_as_it_should_p (decl)
8504 tree decl;
8505 {
8506 if (DECL_P (decl))
8507 {
8508 if (TREE_CODE (decl) == FIELD_DECL
8509 && METHOD_STATIC (current_function_decl))
8510 return 0;
8511 return DECL_P (decl) && !INITIALIZED_P (decl);
8512 }
8513 return 0;
8514 }
8515
8516 /* Patch tree nodes in a function body. When a BLOCK is found, push
8517 local variable decls if present. */
8518
8519 static tree
8520 java_complete_tree (node)
8521 tree node;
8522 {
8523 tree nn, cn, wfl_op1, wfl_op2;
8524 int flag, location;
8525
8526 /* CONVERT_EXPR always has its type set, even though it needs to be
8527 worked out */
8528 if (TREE_TYPE (node) && TREE_CODE (node) != CONVERT_EXPR)
8529 return node;
8530
8531 /* The switch block implements cases processing container nodes
8532 first. Contained nodes are always written back. Leaves come
8533 next and return a value. */
8534 switch (TREE_CODE (node))
8535 {
8536 case BLOCK:
8537
8538 /* 1- Block section.
8539 Set the local values on decl names so we can identify them
8540 faster when they're referenced. At that stage, identifiers
8541 are legal so we don't check for declaration errors. */
8542 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
8543 {
8544 DECL_CONTEXT (cn) = current_function_decl;
8545 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = cn;
8546 INITIALIZED_P (cn) = 0;
8547 }
8548 if (BLOCK_EXPR_BODY (node))
8549 {
8550 BLOCK_EXPR_BODY (node) = java_complete_tree (BLOCK_EXPR_BODY (node));
8551 if (BLOCK_EXPR_BODY (node) == error_mark_node)
8552 return error_mark_node;
8553 }
8554 /* Turn local bindings to null */
8555 for (cn = BLOCK_EXPR_DECLS (node); cn; cn = TREE_CHAIN (cn))
8556 IDENTIFIER_LOCAL_VALUE (DECL_NAME (cn)) = NULL_TREE;
8557
8558 TREE_TYPE (node) = void_type_node;
8559 break;
8560
8561 /* 2- They are expressions but ultimately deal with statements */
8562 case LABELED_BLOCK_EXPR:
8563 PUSH_LABELED_BLOCK (node);
8564 if (LABELED_BLOCK_BODY (node))
8565 COMPLETE_CHECK_OP_1 (node);
8566 TREE_TYPE (node) = void_type_node;
8567 POP_LABELED_BLOCK ();
8568 return node;
8569
8570 case EXIT_BLOCK_EXPR:
8571 /* We don't complete operand 1, because it's the return value of
8572 the EXIT_BLOCK_EXPR which doesn't exist it Java */
8573 return patch_bc_statement (node);
8574
8575 case LOOP_EXPR:
8576 PUSH_LOOP (node);
8577 /* Check whether the loop was enclosed in a labeled
8578 statement. If not, create one, insert the loop in it and
8579 return the node */
8580 nn = patch_loop_statement (node);
8581 /* Anyways, walk the body of the loop */
8582 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
8583 if (TREE_OPERAND (node, 0) == error_mark_node)
8584 return error_mark_node;
8585 TREE_TYPE (nn) = TREE_TYPE (node) = void_type_node;
8586 /* If we returned something different, that's because we
8587 inserted a label. Pop the label too. */
8588 if (nn != node)
8589 POP_LABELED_BLOCK ();
8590 POP_LOOP ();
8591 return nn;
8592
8593 case EXIT_EXPR:
8594 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
8595 return patch_exit_expr (node);
8596
8597 case COND_EXPR:
8598 /* Condition */
8599 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
8600 if (TREE_OPERAND (node, 0) == error_mark_node)
8601 return error_mark_node;
8602 /* then-else branches */
8603 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
8604 if (TREE_OPERAND (node, 1) == error_mark_node)
8605 return error_mark_node;
8606 TREE_OPERAND (node, 2) = java_complete_tree (TREE_OPERAND (node, 2));
8607 if (TREE_OPERAND (node, 2) == error_mark_node)
8608 return error_mark_node;
8609 return patch_if_else_statement (node);
8610 break;
8611
8612 /* 3- Expression section */
8613 case COMPOUND_EXPR:
8614 TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
8615 TREE_OPERAND (node, 1) = java_complete_tree (TREE_OPERAND (node, 1));
8616 if (TREE_OPERAND (node, 1) == error_mark_node)
8617 return error_mark_node;
8618 TREE_TYPE (node) = TREE_TYPE (TREE_OPERAND (node, 1));
8619 break;
8620
8621 case RETURN_EXPR:
8622 return patch_return (node);
8623
8624 case EXPR_WITH_FILE_LOCATION:
8625 if (!EXPR_WFL_NODE (node) /* Or a PRIMARY flag ? */
8626 || TREE_CODE (EXPR_WFL_NODE (node)) == IDENTIFIER_NODE)
8627 return resolve_expression_name (node);
8628 else
8629 {
8630 EXPR_WFL_NODE (node) = java_complete_tree (EXPR_WFL_NODE (node));
8631 TREE_SIDE_EFFECTS (node) = 1;
8632 if (EXPR_WFL_NODE (node) == error_mark_node)
8633 {
8634 /* Its important for the evaluation of assignment that
8635 this mark on the TREE_TYPE is propagated. */
8636 TREE_TYPE (node) = error_mark_node;
8637 return error_mark_node;
8638 }
8639 else
8640 TREE_TYPE (node) = TREE_TYPE (EXPR_WFL_NODE (node));
8641 }
8642 break;
8643
8644 case JAVA_NEW_ARRAY_EXPR:
8645 /* Patch all the dimensions */
8646 flag = 0;
8647 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
8648 {
8649 int location = EXPR_WFL_LINECOL (TREE_VALUE (cn));
8650 tree dim = java_complete_tree (TREE_VALUE (cn));
8651 if (dim == error_mark_node)
8652 {
8653 flag = 1;
8654 continue;
8655 }
8656 else
8657 {
8658 TREE_VALUE (cn) = save_expr (dim);
8659 /* Setup the location of the current dimension, for
8660 later error report. */
8661 TREE_PURPOSE (cn) =
8662 build_expr_wfl (NULL_TREE, input_filename, 0, 0);
8663 EXPR_WFL_LINECOL (TREE_PURPOSE (cn)) = location;
8664 }
8665 }
8666 /* They complete the array creation expression, if no errors
8667 were found. */
8668 return (flag ? error_mark_node : patch_newarray (node));
8669
8670 case JAVA_NEW_CLASS_EXPR:
8671 case CALL_EXPR:
8672 /* Complete function's argument first */
8673 if (complete_function_arguments (node))
8674 return error_mark_node;
8675 else
8676 return patch_method_invocation_stmt (node, NULL_TREE, NULL_TREE, NULL);
8677
8678 case MODIFY_EXPR:
8679 /* Save potential wfls */
8680 wfl_op1 = TREE_OPERAND (node, 0);
8681 wfl_op2 = TREE_OPERAND (node, 1);
8682 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
8683 if (TREE_OPERAND (node, 0) == error_mark_node)
8684 return error_mark_node;
8685
8686 if (COMPOUND_ASSIGN_P (wfl_op2))
8687 {
8688 tree lvalue;
8689 tree other =
8690 java_complete_tree (TREE_OPERAND (wfl_op2, 0));
8691
8692 /* Hand stablize the lhs on both places */
8693 lvalue = stabilize_reference (other);
8694 TREE_OPERAND (node, 0) = lvalue;
8695 TREE_OPERAND (TREE_OPERAND (node, 1), 0) = lvalue;
8696 }
8697
8698 /* There are cases where the type of RHS is fixed. In those
8699 cases, if the evaluation of the RHS fails, we further the
8700 evaluation of the assignment to detect more errors. */
8701 nn = java_complete_tree (TREE_OPERAND (node, 1));
8702 if (nn == error_mark_node)
8703 {
8704 /* It's hopeless, but we can further things on to discover
8705 an error during the assignment. In any cases, the
8706 assignment operation fails. */
8707 if (TREE_CODE (TREE_OPERAND (node, 1)) != EXPR_WITH_FILE_LOCATION
8708 && TREE_TYPE (TREE_OPERAND (node, 1)) != error_mark_node)
8709 patch_assignment (node, wfl_op1, wfl_op2);
8710
8711 /* Now, we still mark the lhs as initialized */
8712 if (DECL_P (TREE_OPERAND (node, 0)))
8713 INITIALIZED_P (TREE_OPERAND (node, 0)) = 1;
8714
8715 return error_mark_node;
8716 }
8717 TREE_OPERAND (node, 1) = nn;
8718 return patch_assignment (node, wfl_op1, wfl_op2);
8719
8720 case MULT_EXPR:
8721 case PLUS_EXPR:
8722 case MINUS_EXPR:
8723 case LSHIFT_EXPR:
8724 case RSHIFT_EXPR:
8725 case URSHIFT_EXPR:
8726 case BIT_AND_EXPR:
8727 case BIT_XOR_EXPR:
8728 case BIT_IOR_EXPR:
8729 case TRUNC_MOD_EXPR:
8730 case RDIV_EXPR:
8731 case TRUTH_ANDIF_EXPR:
8732 case TRUTH_ORIF_EXPR:
8733 case EQ_EXPR:
8734 case NE_EXPR:
8735 case GT_EXPR:
8736 case GE_EXPR:
8737 case LT_EXPR:
8738 case LE_EXPR:
8739 /* Operands 0 and 1 are WFL in certain cases only. patch_binop
8740 knows how to handle those cases. */
8741 wfl_op1 = TREE_OPERAND (node, 0);
8742 wfl_op2 = TREE_OPERAND (node, 1);
8743 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
8744 if (TREE_OPERAND (node, 0) == error_mark_node)
8745 return error_mark_node;
8746 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
8747 if (TREE_OPERAND (node, 1) == error_mark_node)
8748 return error_mark_node;
8749 return patch_binop (node, wfl_op1, wfl_op2);
8750
8751 case JAVA_UNARY_PLUS_EXPR:
8752 case NEGATE_EXPR:
8753 case TRUTH_NOT_EXPR:
8754 case BIT_NOT_EXPR:
8755 case PREDECREMENT_EXPR:
8756 case PREINCREMENT_EXPR:
8757 case POSTDECREMENT_EXPR:
8758 case POSTINCREMENT_EXPR:
8759 case CONVERT_EXPR:
8760 /* There are cases were wfl_op1 is a WFL. patch_unaryop knows
8761 how to handle those cases. */
8762 wfl_op1 = TREE_OPERAND (node, 0);
8763 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
8764 if (TREE_OPERAND (node, 0) == error_mark_node)
8765 return error_mark_node;
8766 return patch_unaryop (node, wfl_op1);
8767
8768 case ARRAY_REF:
8769 /* There are cases were wfl_op1 is a WFL. patch_array_ref knows
8770 how to handle those cases. */
8771 wfl_op1 = TREE_OPERAND (node, 0);
8772 TREE_OPERAND (node, 0) = java_complete_tree (wfl_op1);
8773 if (TREE_OPERAND (node, 0) == error_mark_node)
8774 return error_mark_node;
8775 /* The same applies to wfl_op2 */
8776 wfl_op2 = TREE_OPERAND (node, 1);
8777 TREE_OPERAND (node, 1) = java_complete_tree (wfl_op2);
8778 if (TREE_OPERAND (node, 1) == error_mark_node)
8779 return error_mark_node;
8780 return patch_array_ref (node, wfl_op1, wfl_op2);
8781
8782 case JAVA_THIS_EXPR:
8783 /* Can't use THIS in a static environment */
8784 if (!current_this)
8785 {
8786 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
8787 parse_error_context (wfl_operator, "Keyword `this' used outside "
8788 "allowed context");
8789 TREE_TYPE (node) = error_mark_node;
8790 return error_mark_node;
8791 }
8792 return current_this;
8793
8794 case STRING_CST:
8795 /* Build the internal string representation */
8796 push_obstacks (&permanent_obstack, &permanent_obstack);
8797 node = get_identifier (TREE_STRING_POINTER (node));
8798 location = alloc_name_constant (CONSTANT_String, node);
8799 node = build_ref_from_constant_pool (location);
8800 TREE_TYPE (node) = promote_type (string_type_node);
8801 return node;
8802
8803 default:
8804 fatal ("No case for tree code `%s' - java_complete_tree\n",
8805 tree_code_name [TREE_CODE (node)]);
8806 }
8807 return node;
8808 }
8809
8810 /* Complete function call's argument. Return a non zero value is an
8811 error was found. */
8812
8813 static int
8814 complete_function_arguments (node)
8815 tree node;
8816 {
8817 int flag = 0;
8818 tree cn;
8819
8820 for (cn = TREE_OPERAND (node, 1); cn; cn = TREE_CHAIN (cn))
8821 {
8822 tree wfl = TREE_VALUE (cn), parm;
8823 parm = java_complete_tree (wfl);
8824 if (parm == error_mark_node)
8825 {
8826 flag = 1;
8827 continue;
8828 }
8829 if (TREE_CODE (TREE_TYPE (parm)) == RECORD_TYPE)
8830 TREE_VALUE (cn) = convert (promote_type (TREE_TYPE (parm)), parm);
8831 else
8832 TREE_VALUE (cn) = save_expr (parm);
8833 if (not_initialized_as_it_should_p (parm))
8834 {
8835 ERROR_VARIABLE_NOT_INITIALIZED (wfl, EXPR_WFL_NODE (wfl));
8836 INITIALIZED_P (parm) = 1;
8837 }
8838 }
8839 return flag;
8840 }
8841
8842 /* Sometimes (for loops and variable initialized during their
8843 declaration), we want to wrap a statement around a WFL and turn it
8844 debugable. */
8845
8846 static tree
8847 build_debugable_stmt (location, stmt)
8848 int location;
8849 tree stmt;
8850 {
8851 if (TREE_CODE (stmt) != EXPR_WITH_FILE_LOCATION)
8852 {
8853 stmt = build_expr_wfl (stmt, input_filename, 0, 0);
8854 EXPR_WFL_LINECOL (stmt) = location;
8855 }
8856 JAVA_MAYBE_GENERATE_DEBUG_INFO (stmt);
8857 return stmt;
8858 }
8859
8860 static tree
8861 build_expr_block (body, decls)
8862 tree body, decls;
8863 {
8864 tree node = make_node (BLOCK);
8865 BLOCK_EXPR_DECLS (node) = decls;
8866 BLOCK_EXPR_BODY (body);
8867 if (body)
8868 TREE_TYPE (node) = TREE_TYPE (body);
8869 TREE_SIDE_EFFECTS (node) = 1;
8870 return node;
8871 }
8872
8873 /* Create a new function block and link its supercontext to the
8874 previous block. The current function DECL is used as supercontext
8875 when enter_block is called for the first time for a given
8876 function. The current function body (DECL_FUNCTION_BODY) is set to
8877 the newly created block. */
8878
8879 static block_level = 0;
8880
8881 static tree
8882 enter_block ()
8883 {
8884 tree b = build_expr_block (NULL_TREE, NULL_TREE);
8885 tree fndecl = current_function_decl;
8886
8887 if (!DECL_FUNCTION_BODY (fndecl))
8888 {
8889 BLOCK_SUPERCONTEXT (b) = fndecl;
8890 DECL_FUNCTION_BODY (fndecl) = b;
8891 }
8892 else
8893 {
8894 BLOCK_SUPERCONTEXT (b) = DECL_FUNCTION_BODY (fndecl);
8895 DECL_FUNCTION_BODY (fndecl) = b;
8896 }
8897 return b;
8898 }
8899
8900 /* Exit a block by changing the current function body
8901 (DECL_FUNCTION_BODY) to the current block super context, only if
8902 the block being exited isn't the method's top level one. */
8903
8904 static tree
8905 exit_block ()
8906 {
8907 tree b = DECL_FUNCTION_BODY (current_function_decl);
8908
8909 if (BLOCK_SUPERCONTEXT (b) != current_function_decl)
8910 DECL_FUNCTION_BODY (current_function_decl) = BLOCK_SUPERCONTEXT (b);
8911
8912 return b;
8913 }
8914
8915 /* Lookup for NAME in the nested function's blocks, all the way up to
8916 the current toplevel one. It complies with Java's local variable
8917 scoping rules. */
8918
8919 static tree
8920 lookup_name_in_blocks (name)
8921 tree name;
8922 {
8923 tree b = DECL_FUNCTION_BODY (current_function_decl);
8924
8925 while (b != current_function_decl)
8926 {
8927 tree current;
8928
8929 /* Paranoid sanity check. To be removed */
8930 if (TREE_CODE (b) != BLOCK)
8931 fatal ("non block expr function body - lookup_name_in_blocks");
8932
8933 for (current = BLOCK_EXPR_DECLS (b); current;
8934 current = TREE_CHAIN (current))
8935 if (DECL_NAME (current) == name)
8936 return current;
8937 b = BLOCK_SUPERCONTEXT (b);
8938 }
8939 return NULL_TREE;
8940 }
8941
8942 static void
8943 maybe_absorb_scoping_blocks ()
8944 {
8945 while (BLOCK_EXPR_ORIGIN (DECL_FUNCTION_BODY (current_function_decl)))
8946 {
8947 tree b = exit_block ();
8948 java_method_add_stmt (current_function_decl, b);
8949 SOURCE_FRONTEND_DEBUG (("Absorbing scoping block at line %d", lineno));
8950 }
8951 }
8952
8953 \f
8954 /* This section of the source is reserved to build_* functions that
8955 are building incomplete tree nodes and the patch_* functions that
8956 are completing them. */
8957
8958 /* Build an incomplete CALL_EXPR node. Encapsulate it within a WFL */
8959
8960 static tree
8961 build_method_invocation (name, args)
8962 tree name;
8963 tree args;
8964 {
8965 tree call = build (CALL_EXPR, NULL_TREE, name, args, NULL_TREE);
8966 TREE_SIDE_EFFECTS (call) = 1;
8967 /* Check on cases where NAME isn't a WFL. FIXME */
8968 EXPR_WFL_LINECOL (call) = EXPR_WFL_LINECOL (name);
8969 return call;
8970 }
8971
8972 /* Build an incomplete assignment expression. */
8973
8974 static tree
8975 build_assignment (op, op_location, lhs, rhs)
8976 int op, op_location;
8977 tree lhs, rhs;
8978 {
8979 tree assignment;
8980 /* Build the corresponding binop if we deal with a Compound
8981 Assignment operator. Mark the binop sub-tree as part of a
8982 Compound Assignment expression */
8983 if (op != ASSIGN_TK)
8984 {
8985 rhs = build_binop (BINOP_LOOKUP (op), op_location, lhs, rhs);
8986 COMPOUND_ASSIGN_P (rhs) = 1;
8987 }
8988 assignment = build (MODIFY_EXPR, NULL_TREE, lhs, rhs);
8989 TREE_SIDE_EFFECTS (assignment) = 1;
8990 EXPR_WFL_LINECOL (assignment) = op_location;
8991 return assignment;
8992 }
8993
8994 /* Print an INTEGER_CST node in a static buffer, and return the buffer. */
8995
8996 static char *
8997 print_int_node (node)
8998 tree node;
8999 {
9000 static char buffer [80];
9001 if (TREE_CONSTANT_OVERFLOW (node))
9002 sprintf (buffer, "<overflow>");
9003
9004 if (TREE_INT_CST_HIGH (node) == 0)
9005 sprintf (buffer, HOST_WIDE_INT_PRINT_UNSIGNED,
9006 TREE_INT_CST_LOW (node));
9007 else if (TREE_INT_CST_HIGH (node) == -1
9008 && TREE_INT_CST_LOW (node) != 0)
9009 {
9010 buffer [0] = '-';
9011 sprintf (&buffer [1], HOST_WIDE_INT_PRINT_UNSIGNED,
9012 -TREE_INT_CST_LOW (node));
9013 }
9014 else
9015 sprintf (buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
9016 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
9017
9018 return buffer;
9019 }
9020
9021 /* 15.25 Assignment operators. */
9022
9023 static tree
9024 patch_assignment (node, wfl_op1, wfl_op2)
9025 tree node;
9026 tree wfl_op1;
9027 tree wfl_op2;
9028 {
9029 tree rhs = TREE_OPERAND (node, 1);
9030 tree lvalue = TREE_OPERAND (node, 0);
9031 tree lhs_type, rhs_type, new_rhs = NULL_TREE;
9032 int all_primitive;
9033 int error_found = 0;
9034 int lvalue_from_array = 0;
9035
9036 /* Can't assign to a final. */
9037 if (DECL_P (lvalue) && FIELD_FINAL (lvalue))
9038 {
9039 parse_error_context
9040 (wfl_op1, "Can't assign a value to the final variable `%s'",
9041 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl_op1)));
9042 error_found = 1;
9043 }
9044
9045 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
9046
9047 /* Lhs can be a named variable */
9048 if (DECL_P (lvalue))
9049 {
9050 INITIALIZED_P (lvalue) = 1;
9051 lhs_type = TREE_TYPE (lvalue);
9052 }
9053 /* Or Lhs can be a array acccess. Should that be lvalue ? FIXME +
9054 comment on reason why */
9055 else if (TREE_CODE (wfl_op1) == ARRAY_REF)
9056 {
9057 lhs_type = TREE_TYPE (lvalue);
9058 lvalue_from_array = 1;
9059 }
9060 /* Or a field access */
9061 else if (TREE_CODE (lvalue) == COMPONENT_REF)
9062 lhs_type = TREE_TYPE (lvalue);
9063 /* Or a function return slot */
9064 else if (TREE_CODE (lvalue) == RESULT_DECL)
9065 lhs_type = TREE_TYPE (lvalue);
9066 /* Otherwise, this is an error */
9067 else
9068 {
9069 parse_error_context (wfl_op1, "Invalid left hand side of assignment");
9070 error_found = 1;
9071 }
9072
9073 rhs_type = TREE_TYPE (rhs);
9074
9075 /* 5.2 Begin Assignment conversion */
9076
9077 /* 5.1.1 Try Identity Conversion */
9078 if (lhs_type == rhs_type)
9079 new_rhs = rhs;
9080
9081 /* 5.1.2 Try Widening Primitive Conversion */
9082 all_primitive = JPRIMITIVE_TYPE_P (lhs_type) && JPRIMITIVE_TYPE_P (rhs_type);
9083 if (all_primitive && JINTEGRAL_TYPE_P (rhs_type)
9084 && ((TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type))
9085 || (JFLOAT_TYPE_P (lhs_type) &&
9086 TYPE_PRECISION (rhs_type) == TYPE_PRECISION (lhs_type))))
9087 new_rhs = convert (lhs_type, rhs);
9088 else if (all_primitive && JFLOAT_TYPE_P (rhs_type)
9089 && (TYPE_PRECISION (rhs_type) < TYPE_PRECISION (lhs_type)))
9090 new_rhs = convert (lhs_type, rhs);
9091
9092 /* Try a narrowing primitive conversion:
9093 - expression is a constant expression of type int AND
9094 - variable is byte, short or char AND
9095 - The value of the expression is representable in the type of the
9096 variable */
9097 else if (rhs_type == int_type_node && TREE_CONSTANT (rhs)
9098 && (lhs_type == byte_type_node || lhs_type == char_type_node
9099 || lhs_type == short_type_node))
9100 {
9101 if (int_fits_type_p (rhs, lhs_type))
9102 new_rhs = convert (lhs_type, rhs);
9103 else
9104 parse_warning_context
9105 (wfl_op1, "Constant expression `%s' to wide for narrowing "
9106 "primitive conversion to `%s'",
9107 print_int_node (rhs), lang_printable_name (lhs_type));
9108 /* Reported a warning that will turn into an error further
9109 down, so we don't return */
9110 }
9111
9112 /* 5.2 Try a reference conversion */
9113 else if (!JPRIMITIVE_TYPE_P (rhs_type) && JREFERENCE_TYPE_P (lhs_type))
9114 {
9115 /* `null' may be assigned to any reference type */
9116 if (rhs == null_pointer_node)
9117 new_rhs = null_pointer_node;
9118 /* Try the reference assignment conversion */
9119 else if (valid_ref_assignconv_cast_p (rhs_type, lhs_type, 0))
9120 new_rhs = rhs;
9121 if (new_rhs)
9122 lhs_type = promote_type (rhs_type);
9123 }
9124
9125 /* 15.25.2 If we have a compound assignment, convert RHS into the
9126 type of the LHS */
9127 else if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
9128 new_rhs = convert (lhs_type, rhs);
9129
9130 /* Explicit cast required. This is an error */
9131 if (!new_rhs)
9132 {
9133 char *t1 = strdup ((char *)lang_printable_name (TREE_TYPE (rhs)));
9134 char *t2 = strdup ((char *)lang_printable_name (lhs_type));
9135 tree wfl;
9136 char operation [32]; /* Max size known */
9137
9138 /* If the assignment is part of a declaration, we use the WFL of
9139 the declared variable to point out the error and call it a
9140 declaration problem. If the assignment is a genuine =
9141 operator, we call is a operator `=' problem, otherwise we
9142 call it an assignment problem. In both of these last cases,
9143 we use the WFL of the operator to indicate the error. */
9144
9145 if (MODIFY_EXPR_FROM_INITIALIZATION_P (node))
9146 {
9147 wfl = wfl_op1;
9148 strcpy (operation, "declaration");
9149 }
9150 else
9151 {
9152 wfl = wfl_operator;
9153 if (COMPOUND_ASSIGN_P (TREE_OPERAND (node, 1)))
9154 strcpy (operation, "assignment");
9155 else if (TREE_CODE (TREE_OPERAND (node, 0)) == RESULT_DECL)
9156 strcpy (operation, "`return'");
9157 else
9158 strcpy (operation, "`='");
9159 }
9160
9161 parse_error_context
9162 (wfl, (!can_cast_to_p (rhs_type, lhs_type) ?
9163 "Incompatible type for %s. Can't convert `%s' to `%s'" :
9164 "Incompatible type for %s. Explicit cast "
9165 "needed to convert `%s' to `%s'"), operation, t1, t2);
9166 free (t1); free (t2);
9167 error_found = 1;
9168 }
9169
9170 /* Before reporting type incompatibility errors, check that the rhs
9171 is initialized, if a variable */
9172 if (not_initialized_as_it_should_p (rhs))
9173 {
9174 ERROR_VARIABLE_NOT_INITIALIZED (wfl_op2, DECL_NAME (rhs));
9175 INITIALIZED_P (rhs) = 1;
9176 }
9177
9178 if (error_found)
9179 return error_mark_node;
9180
9181 /* If we built a compound expression as the result of a reference
9182 assignment into an array element, return it here. */
9183 if (TREE_CODE (node) == COMPOUND_EXPR)
9184 return node;
9185
9186 TREE_OPERAND (node, 0) = lvalue;
9187 TREE_OPERAND (node, 1) = new_rhs;
9188 TREE_TYPE (node) = lhs_type;
9189 return node;
9190 }
9191
9192 /* Check that SOURCE can be converted into DEST, at least with a
9193 cast. If the convertion can't occur at all, return 0 otherwise
9194 1. This function is used to produce accurate error messages on the
9195 reasons why an assignment failed. */
9196
9197 static int
9198 can_cast_to_p (source, dest)
9199 tree source;
9200 tree dest;
9201 {
9202 if (TREE_CODE (source) == POINTER_TYPE)
9203 source = TREE_TYPE (source);
9204 if (TREE_CODE (dest) == POINTER_TYPE)
9205 dest = TREE_TYPE (dest);
9206
9207 if (TREE_CODE (source) == RECORD_TYPE && TREE_CODE (dest) == RECORD_TYPE)
9208 return valid_ref_assignconv_cast_p (source, dest, 1);
9209
9210 else if (JNUMERIC_TYPE_P (source) && JNUMERIC_TYPE_P (dest))
9211 return 1;
9212
9213 return 0;
9214 }
9215
9216 /* Check that something of SOURCE type can be assigned or cast to
9217 something of DEST type at runtime. Return 1 if the operation is
9218 valid, 0 otherwise. If CAST is set to 1, we're treating the case
9219 were SOURCE is cast into DEST, which borrows a lot of the
9220 assignment check. */
9221
9222 static int
9223 valid_ref_assignconv_cast_p (source, dest, cast)
9224 tree source;
9225 tree dest;
9226 int cast;
9227 {
9228 if (TREE_CODE (source) == POINTER_TYPE)
9229 source = TREE_TYPE (source);
9230 if (TREE_CODE (dest) == POINTER_TYPE)
9231 dest = TREE_TYPE (dest);
9232 /* Case where SOURCE is a class type */
9233 if (TYPE_CLASS_P (source))
9234 {
9235 if (TYPE_CLASS_P (dest))
9236 return source == dest || inherits_from_p (source, dest)
9237 || cast && inherits_from_p (dest, source);
9238 if (TYPE_INTERFACE_P (dest))
9239 {
9240 /* If doing a cast and SOURCE is final, the operation is
9241 always correct a compile time (because even if SOURCE
9242 does not implement DEST, a subclass of SOURCE might). */
9243 if (cast && !CLASS_FINAL (TYPE_NAME (source)))
9244 return 1;
9245 /* Otherwise, SOURCE must implement DEST */
9246 return interface_of_p (dest, source);
9247 }
9248 /* DEST is an array, cast permited if SOURCE is of Object type */
9249 return (cast && source == object_type_node ? 1 : 0);
9250 }
9251 if (TYPE_INTERFACE_P (source))
9252 {
9253 if (TYPE_CLASS_P (dest))
9254 {
9255 /* If not casting, DEST must be the Object type */
9256 if (!cast)
9257 return dest == object_type_node;
9258 /* We're doing a cast. The cast is always valid is class
9259 DEST is not final, otherwise, DEST must implement SOURCE */
9260 else if (!CLASS_FINAL (TYPE_NAME (source)))
9261 return 1;
9262 else
9263 return interface_of_p (source, dest);
9264 }
9265 if (TYPE_INTERFACE_P (dest))
9266 {
9267 /* If doing a cast, then if SOURCE and DEST contain method
9268 with the same signature but different return type, then
9269 this is a (compile time) error */
9270 if (cast)
9271 {
9272 tree method_source, method_dest;
9273 tree source_type;
9274 tree source_sig, dest_sig;
9275 tree source_name;
9276 for (method_source = TYPE_METHODS (source); method_source;
9277 method_source = TREE_CHAIN (method_source))
9278 {
9279 source_sig =
9280 build_java_argument_signature (TREE_TYPE (method_source));
9281 source_type = TREE_TYPE (TREE_TYPE (method_source));
9282 source_name = DECL_NAME (method_source);
9283 for (method_dest = TYPE_METHODS (dest);
9284 method_dest; method_dest = TREE_CHAIN (method_dest))
9285 if (source_sig ==
9286 build_java_argument_signature (TREE_TYPE (method_dest))
9287 && source_name == DECL_NAME (method_dest)
9288 && source_type != TREE_TYPE (TREE_TYPE (method_dest)))
9289 return 0;
9290 }
9291 return 1;
9292 }
9293 else
9294 return source == dest || interface_of_p (dest, source);
9295 }
9296 else /* Array */
9297 return 0;
9298 }
9299 if (TYPE_ARRAY_P (source))
9300 {
9301 if (TYPE_CLASS_P (dest))
9302 return dest == object_type_node;
9303 if (TYPE_INTERFACE_P (dest))
9304 return 0; /* Install test on Clonable. FIXME */
9305 else /* Arrays */
9306 {
9307 tree source_element_type = TYPE_ARRAY_ELEMENT (source);
9308 tree dest_element_type = TYPE_ARRAY_ELEMENT (dest);
9309
9310 if (source_element_type == dest_element_type)
9311 return 1;
9312 return valid_ref_assignconv_cast_p (source_element_type,
9313 dest_element_type, cast);
9314 }
9315 return 0;
9316 }
9317 return 0;
9318 }
9319
9320 /* Build an incomplete binop expression. */
9321
9322 static tree
9323 build_binop (op, op_location, op1, op2)
9324 enum tree_code op;
9325 int op_location;
9326 tree op1, op2;
9327 {
9328 tree wfl;
9329
9330 /* URSHIFT_EXPR is not part of what GCC understands, we can't directly build
9331 a node with it */
9332 tree binop =
9333 build ((op == URSHIFT_EXPR ? RSHIFT_EXPR : op), NULL_TREE, op1, op2);
9334 if (op == URSHIFT_EXPR)
9335 TREE_SET_CODE (binop, op);
9336
9337 TREE_SIDE_EFFECTS (binop) = 1;
9338 /* Store the location of the operator, for better error report. The
9339 string of the operator will be rebuild based on the OP value. */
9340 EXPR_WFL_LINECOL (binop) = op_location;
9341 return binop;
9342 }
9343
9344 /* Build the string of the operator retained by NODE. If NODE is part
9345 of a compound expression, add an '=' at the end of the string. This
9346 function is called when an error needs to be reported on an
9347 operator. The string is returned as a pointer to a static character
9348 buffer. */
9349
9350 static char *
9351 operator_string (node)
9352 tree node;
9353 {
9354 #define BUILD_OPERATOR_STRING(S) \
9355 { \
9356 sprintf (buffer, "%s%s", S, (COMPOUND_ASSIGN_P (node) ? "=" : "")); \
9357 return buffer; \
9358 }
9359
9360 static char buffer [10];
9361 switch (TREE_CODE (node))
9362 {
9363 case MULT_EXPR: BUILD_OPERATOR_STRING ("*");
9364 case RDIV_EXPR: BUILD_OPERATOR_STRING ("/");
9365 case TRUNC_MOD_EXPR: BUILD_OPERATOR_STRING ("%");
9366 case PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
9367 case MINUS_EXPR: BUILD_OPERATOR_STRING ("-");
9368 case LSHIFT_EXPR: BUILD_OPERATOR_STRING ("<<");
9369 case RSHIFT_EXPR: BUILD_OPERATOR_STRING (">>");
9370 case URSHIFT_EXPR: BUILD_OPERATOR_STRING (">>>");
9371 case BIT_AND_EXPR: BUILD_OPERATOR_STRING ("&");
9372 case BIT_XOR_EXPR: BUILD_OPERATOR_STRING ("^");
9373 case BIT_IOR_EXPR: BUILD_OPERATOR_STRING ("|");
9374 case TRUTH_ANDIF_EXPR: BUILD_OPERATOR_STRING ("&&");
9375 case TRUTH_ORIF_EXPR: BUILD_OPERATOR_STRING ("||");
9376 case EQ_EXPR: BUILD_OPERATOR_STRING ("==");
9377 case NE_EXPR: BUILD_OPERATOR_STRING ("!=");
9378 case GT_EXPR: BUILD_OPERATOR_STRING (">");
9379 case GE_EXPR: BUILD_OPERATOR_STRING (">=");
9380 case LT_EXPR: BUILD_OPERATOR_STRING ("<");
9381 case LE_EXPR: BUILD_OPERATOR_STRING ("<=");
9382 case JAVA_UNARY_PLUS_EXPR: BUILD_OPERATOR_STRING ("+");
9383 case NEGATE_EXPR: BUILD_OPERATOR_STRING ("-");
9384 case TRUTH_NOT_EXPR: BUILD_OPERATOR_STRING ("!");
9385 case BIT_NOT_EXPR: BUILD_OPERATOR_STRING ("~");
9386 case PREINCREMENT_EXPR: /* Fall through */
9387 case POSTINCREMENT_EXPR: BUILD_OPERATOR_STRING ("++");
9388 case PREDECREMENT_EXPR: /* Fall through */
9389 case POSTDECREMENT_EXPR: BUILD_OPERATOR_STRING ("--");
9390 default:
9391 fatal ("unregistered operator %s - operator_string",
9392 tree_code_name [TREE_CODE (node)]);
9393 }
9394 return NULL;
9395 #undef BUILD_OPERATOR_STRING
9396 }
9397
9398 /* Binary operators (15.16 up to 15.18). We return error_mark_node on
9399 errors but we modify NODE so that it contains the type computed
9400 according to the expression, when it's fixed. Otherwise, we write
9401 error_mark_node as the type. It allows us to further the analysis
9402 of remaining nodes and detects more errors in certain cases. */
9403
9404 static tree
9405 patch_binop (node, wfl_op1, wfl_op2)
9406 tree node;
9407 tree wfl_op1;
9408 tree wfl_op2;
9409 {
9410 tree op1 = TREE_OPERAND (node, 0);
9411 tree op2 = TREE_OPERAND (node, 1);
9412 tree op1_type = TREE_TYPE (op1);
9413 tree op2_type = TREE_TYPE (op2);
9414 tree prom_type;
9415 int code = TREE_CODE (node);
9416 /* If 1, tell the routine that we have to return error_mark_node
9417 after checking for the initialization of the RHS */
9418 int error_found = 0;
9419
9420 /* Figure what is going to be checked first for initialization prior
9421 its use. If NODE is part of a compound assignment, we check the
9422 second operand first, otherwise the first one first. We also
9423 initialize the matching WFL for the error report. `cfi' stands
9424 for Check For Initialization */
9425 tree cfi = (COMPOUND_ASSIGN_P (node) ? op2 : op1);
9426 tree cfi_wfl = (COMPOUND_ASSIGN_P (node) ? wfl_op2 : wfl_op1);
9427
9428 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
9429
9430 /* Check initialization of LHS first. We then silence further error
9431 message if the variable wasn't initialized */
9432 if (not_initialized_as_it_should_p (cfi))
9433 {
9434 ERROR_VARIABLE_NOT_INITIALIZED (cfi_wfl, DECL_NAME (cfi));
9435 INITIALIZED_P (op1) = 1;
9436 }
9437
9438 switch (code)
9439 {
9440 /* 15.16 Multiplicative operators */
9441 case MULT_EXPR: /* 15.16.1 Multiplication Operator * */
9442 case RDIV_EXPR: /* 15.16.2 Division Operator / */
9443 case TRUNC_MOD_EXPR: /* 15.16.3 Remainder operator % */
9444 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
9445 {
9446 if (!JPRIMITIVE_TYPE_P (op1_type))
9447 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
9448 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
9449 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
9450 TREE_TYPE (node) = error_mark_node;
9451 error_found = 1;
9452 break;
9453 }
9454 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
9455 /* Change the division operator if necessary */
9456 if (code == RDIV_EXPR && TREE_CODE (prom_type) == INTEGER_TYPE)
9457 TREE_SET_CODE (node, TRUNC_DIV_EXPR);
9458 /* This one is more complicated. FLOATs are processed by a function
9459 call to soft_fmod. */
9460 if (code == TRUNC_MOD_EXPR)
9461 return build_java_binop (TRUNC_MOD_EXPR, prom_type, op1, op2);
9462 break;
9463
9464 /* 15.17 Additive Operators */
9465 case PLUS_EXPR: /* 15.17.1 String Concatenation Operator + */
9466 if (JSTRING_TYPE_P (op1_type) || JSTRING_TYPE_P (op2_type))
9467 fatal ("operator `+' non implemented on String - patch_binop");
9468 case MINUS_EXPR: /* 15.17.2 Additive Operators (+ and -) for
9469 Numeric Types */
9470 if (!JPRIMITIVE_TYPE_P (op1_type) || !JPRIMITIVE_TYPE_P (op2_type))
9471 {
9472 if (!JPRIMITIVE_TYPE_P (op1_type))
9473 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
9474 if (!JPRIMITIVE_TYPE_P (op2_type) && (op1_type != op2_type))
9475 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
9476 TREE_TYPE (node) = error_mark_node;
9477 error_found = 1;
9478 break;
9479 }
9480 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
9481 break;
9482
9483 /* 15.18 Shift Operators */
9484 case LSHIFT_EXPR:
9485 case RSHIFT_EXPR:
9486 case URSHIFT_EXPR:
9487 if (!JINTEGRAL_TYPE_P (op1_type) || !JINTEGRAL_TYPE_P (op2_type))
9488 {
9489 if (!JINTEGRAL_TYPE_P (op1_type))
9490 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
9491 else
9492 parse_error_context
9493 (wfl_operator, (JPRIMITIVE_TYPE_P (op2_type) ?
9494 "Incompatible type for `%s'. Explicit cast needed to convert "
9495 "shift distance from `%s' to integral" :
9496 "Incompatible type for `%s'. Can't convert shift distance from "
9497 "`%s' to integral"),
9498 operator_string (node), lang_printable_name (op2_type));
9499 TREE_TYPE (node) = error_mark_node;
9500 error_found = 1;
9501 break;
9502 }
9503
9504 /* Unary numeric promotion (5.6.1) is performed on each operand
9505 separatly */
9506 op1 = convert (promote_type (op1_type), op1);
9507 op2 = convert (promote_type (op2_type), op2);
9508
9509 /* The type of the shift expression is the type of the promoted
9510 type of the left-hand operand */
9511 prom_type = TREE_TYPE (op1);
9512
9513 /* Shift int only up to 0x1f and long up to 0x3f */
9514 if (prom_type == int_type_node)
9515 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
9516 build_int_2 (0x1f, 0)));
9517 else
9518 op2 = fold (build (BIT_AND_EXPR, int_type_node, op2,
9519 build_int_2 (0x3f, 0)));
9520
9521 /* The >>> operator is a >> operating on unsigned quantities */
9522 if (code == URSHIFT_EXPR)
9523 {
9524 op1 = convert (unsigned_type (prom_type), op1);
9525 TREE_SET_CODE (node, RSHIFT_EXPR);
9526 }
9527 break;
9528
9529
9530 /* 15.21 Bitwise and Logical Operators */
9531 case BIT_AND_EXPR:
9532 case BIT_XOR_EXPR:
9533 case BIT_IOR_EXPR:
9534 if (JINTEGRAL_TYPE_P (op1_type) && JINTEGRAL_TYPE_P (op2_type))
9535 /* Binary numeric promotion is performed on both operand and the
9536 expression retain that type */
9537 prom_type = binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
9538
9539 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE
9540 && TREE_CODE (op1_type) == BOOLEAN_TYPE)
9541 /* The type of the bitwise operator expression is BOOLEAN */
9542 prom_type = boolean_type_node;
9543 else
9544 {
9545 if (!JINTEGRAL_TYPE_P (op1_type))
9546 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op1_type);
9547 if (!JINTEGRAL_TYPE_P (op2_type) && (op1_type != op2_type))
9548 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op2_type);
9549 TREE_TYPE (node) = error_mark_node;
9550 error_found = 1;
9551 /* Insert a break here if adding thing before the switch's
9552 break for this case */
9553 }
9554 break;
9555
9556 /* 15.22 Conditional-And Operator */
9557 case TRUTH_ANDIF_EXPR:
9558 /* 15.23 Conditional-Or Operator */
9559 case TRUTH_ORIF_EXPR:
9560 /* Operands must be of BOOLEAN type */
9561 if (TREE_CODE (op1_type) != BOOLEAN_TYPE ||
9562 TREE_CODE (op2_type) != BOOLEAN_TYPE)
9563 {
9564 if (TREE_CODE (op1_type) != BOOLEAN_TYPE)
9565 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op1_type);
9566 if (TREE_CODE (op2_type) != BOOLEAN_TYPE && (op1_type != op2_type))
9567 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op2_type);
9568 TREE_TYPE (node) = boolean_type_node;
9569 error_found = 1;
9570 break;
9571 }
9572 /* The type of the conditional operators is BOOLEAN */
9573 prom_type = boolean_type_node;
9574 break;
9575
9576 /* 15.19.1 Numerical Comparison Operators <, <=, >, >= */
9577 case LT_EXPR:
9578 case GT_EXPR:
9579 case LE_EXPR:
9580 case GE_EXPR:
9581 /* The type of each of the operands must be a primitive numeric
9582 type */
9583 if (!JNUMERIC_TYPE_P (op1_type) || ! JNUMERIC_TYPE_P (op2_type))
9584 {
9585 if (!JNUMERIC_TYPE_P (op1_type))
9586 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op1_type);
9587 if (!JNUMERIC_TYPE_P (op2_type) && (op1_type != op2_type))
9588 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op2_type);
9589 TREE_TYPE (node) = boolean_type_node;
9590 error_found = 1;
9591 break;
9592 }
9593 /* Binary numeric promotion is performed on the operands */
9594 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
9595 /* The type of the relation expression is always BOOLEAN */
9596 prom_type = boolean_type_node;
9597 break;
9598
9599 /* 15.20 Equality Operator */
9600 case EQ_EXPR:
9601 case NE_EXPR:
9602 /* 15.20.1 Numerical Equality Operators == and != */
9603 /* Binary numeric promotion is performed on the operands */
9604 if (JPRIMITIVE_TYPE_P (op1_type) && JPRIMITIVE_TYPE_P (op2_type))
9605 binary_numeric_promotion (op1_type, op2_type, &op1, &op2);
9606
9607 /* 15.20.2 Boolean Equality Operators == and != */
9608 else if (TREE_CODE (op1_type) == BOOLEAN_TYPE &&
9609 TREE_CODE (op2_type) == BOOLEAN_TYPE)
9610 ; /* Nothing to do here */
9611
9612 /* 15.20.3 Reference Equality Operators == and != */
9613 /* Types have to be either references or the null type */
9614 else if ((op1 == null_pointer_node || op2 == null_pointer_node
9615 || JREFERENCE_TYPE_P (op1_type)
9616 || JREFERENCE_TYPE_P (op2_type))
9617 && ((op1_type == op2_type)
9618 /* The should use a can_cast_to_p() */
9619 ))
9620 ; /* Nothing to do here */
9621
9622 /* Else we have an error figure what can't be converted into
9623 what and report the error */
9624 else
9625 {
9626 char *t1;
9627 t1 = strdup ((char *)lang_printable_name (op1_type));
9628 parse_error_context
9629 (wfl_operator, "Incompatible type for `%s'. Can't convert `%s' "
9630 "to `%s'", operator_string (node), t1,
9631 lang_printable_name (op2_type));
9632 free (t1);
9633 TREE_TYPE (node) = boolean_type_node;
9634 error_found = 1;
9635 break;
9636 }
9637 prom_type = boolean_type_node;
9638 break;
9639 }
9640
9641 /* Then check the initialization of the RHS. We don't do that if
9642 we're dealing with a node that is part of a compound
9643 assignment. We then silence further error message if the variable
9644 wasn't initialized */
9645 if (not_initialized_as_it_should_p (op2) && !COMPOUND_ASSIGN_P (node))
9646 {
9647 ERROR_VARIABLE_NOT_INITIALIZED (wfl_op2, DECL_NAME (op2));
9648 INITIALIZED_P (op2) = 1;
9649 }
9650
9651 if (error_found)
9652 return error_mark_node;
9653
9654 TREE_OPERAND (node, 0) = op1;
9655 TREE_OPERAND (node, 1) = op2;
9656 TREE_TYPE (node) = prom_type;
9657 return fold (node);
9658 }
9659
9660 /* Build an incomplete unary operator expression. Unary `+' node is
9661 build as a CONV_EXPR, even though its tree code is overridden by a
9662 JAVA_UNARY_PLUS_EXPR that isn't a tree code, to differentiate it during
9663 the walk. */
9664
9665 static tree
9666 build_unaryop (op_token, op_location, op1)
9667 int op_token, op_location;
9668 tree op1;
9669 {
9670 enum tree_code op;
9671 tree unaryop;
9672 switch (op_token)
9673 {
9674 case PLUS_TK: op = CONVERT_EXPR; break;
9675 case MINUS_TK: op = NEGATE_EXPR; break;
9676 case NEG_TK: op = TRUTH_NOT_EXPR; break;
9677 case NOT_TK: op = BIT_NOT_EXPR; break;
9678 default: fatal ("Unknown token `%d' for unary operator - build_unaryop",
9679 op_token);
9680 }
9681
9682 unaryop = build1 (op, NULL_TREE, op1);
9683 if (op_token == PLUS_TK)
9684 TREE_SET_CODE (unaryop, JAVA_UNARY_PLUS_EXPR);
9685
9686 TREE_SIDE_EFFECTS (unaryop) = 1;
9687 /* Store the location of the operator, for better error report. The
9688 string of the operator will be rebuild based on the OP value. */
9689 EXPR_WFL_LINECOL (unaryop) = op_location;
9690 return unaryop;
9691 }
9692
9693 /* Special case for the ++/-- operators, since they require an extra
9694 argument to build, which is set to NULL and patched
9695 later. IS_POST_P is 1 if the operator, 0 otherwise. */
9696
9697 static tree
9698 build_incdec (op_token, op_location, op1, is_post_p)
9699 int op_token, op_location;
9700 tree op1;
9701 int is_post_p;
9702 {
9703 static enum tree_code lookup [2][2] =
9704 {
9705 { PREDECREMENT_EXPR, PREINCREMENT_EXPR, },
9706 { POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, },
9707 };
9708 tree node = build (lookup [is_post_p][(op_token - DECR_TK)],
9709 NULL_TREE, op1, NULL_TREE);
9710 TREE_SIDE_EFFECTS (node) = 1;
9711 /* Store the location of the operator, for better error report. The
9712 string of the operator will be rebuild based on the OP value. */
9713 EXPR_WFL_LINECOL (node) = op_location;
9714 return node;
9715 }
9716
9717 /* Build an incomplete cast operator, based on the use of the
9718 CONVERT_EXPR. Note that TREE_TYPE of the constructed node is
9719 set. java_complete_tree is trained to walk a CONVERT_EXPR even
9720 though its type is already set. */
9721
9722 static tree
9723 build_cast (location, type, exp)
9724 int location;
9725 tree type, exp;
9726 {
9727 tree node = build1 (CONVERT_EXPR, type, exp);
9728 EXPR_WFL_LINECOL (node) = location;
9729 return node;
9730 }
9731
9732 /* 15.14 Unary operators. We return error_mark_node in case of error,
9733 but preserve the type of NODE if the type is fixed. */
9734
9735 static tree
9736 patch_unaryop (node, wfl_op)
9737 tree node;
9738 tree wfl_op;
9739 {
9740 tree op = TREE_OPERAND (node, 0);
9741 tree op_type = TREE_TYPE (op);
9742 tree prom_type, value;
9743 int code = TREE_CODE (node);
9744 int error_found = 0;
9745
9746 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
9747
9748 switch (code)
9749 {
9750 /* 15.13.2 Postfix Increment Operator ++ */
9751 case POSTINCREMENT_EXPR:
9752 /* 15.13.3 Postfix Increment Operator -- */
9753 case POSTDECREMENT_EXPR:
9754 /* 15.14.1 Prefix Increment Operator ++ */
9755 case PREINCREMENT_EXPR:
9756 /* 15.14.2 Prefix Decrement Operator -- */
9757 case PREDECREMENT_EXPR:
9758 if (!DECL_P (op))
9759 {
9760 parse_error_context (wfl_operator, "Invalid argument to `%s'",
9761 operator_string (node));
9762 TREE_TYPE (node) = error_mark_node;
9763 error_found = 1;
9764 }
9765 else if (FIELD_FINAL (op))
9766 {
9767 parse_error_context
9768 (wfl_op, "Can't assign a value to the final variable `%s'",
9769 IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl_op)));
9770 TREE_TYPE (node) = error_mark_node;
9771 error_found = 1;
9772 }
9773 /* From now on, we know that op if a variable and that it has a
9774 valid wfl. We use wfl_op to locate errors related to the
9775 ++/-- operand. */
9776 else if (!JNUMERIC_TYPE_P (op_type))
9777 {
9778 parse_error_context
9779 (wfl_op, "Invalid argument type `%s' to `%s'",
9780 lang_printable_name (op_type), operator_string (node));
9781 TREE_TYPE (node) = error_mark_node;
9782 error_found = 1;
9783 }
9784 else
9785 {
9786 /* Before the addition, binary numeric promotion if performed on
9787 both operands */
9788 value = integer_one_node;
9789 prom_type = binary_numeric_promotion (op_type, TREE_TYPE (value),
9790 &op, &value);
9791 /* And write the promoted increment back */
9792 TREE_OPERAND (node, 1) = value;
9793 }
9794 break;
9795
9796 /* 15.14.3 Unary Plus Operator + */
9797 case JAVA_UNARY_PLUS_EXPR:
9798 /* 15.14.4 Unary Minus Operator - */
9799 case NEGATE_EXPR:
9800 if (!JNUMERIC_TYPE_P (op_type))
9801 {
9802 ERROR_CANT_CONVERT_TO_NUMERIC (wfl_operator, node, op_type);
9803 TREE_TYPE (node) = error_mark_node;
9804 error_found = 1;
9805 }
9806 /* Unary numeric promotion is performed on operand */
9807 else
9808 {
9809 prom_type = promote_type (op_type);
9810 op = convert (prom_type, op);
9811 if (code == JAVA_UNARY_PLUS_EXPR)
9812 node = op;
9813 }
9814 break;
9815
9816 /* 15.14.5 Bitwise Complement Operator ~ */
9817 case BIT_NOT_EXPR:
9818 if (!JINTEGRAL_TYPE_P (op_type))
9819 {
9820 ERROR_CAST_NEEDED_TO_INTEGRAL (wfl_operator, node, op_type);
9821 TREE_TYPE (node) = error_mark_node;
9822 error_found = 1;
9823 }
9824 else
9825 {
9826 prom_type = promote_type (op_type);
9827 op = convert (prom_type, op);
9828 }
9829 break;
9830
9831 /* 15.14.6 Logical Complement Operator ! */
9832 case TRUTH_NOT_EXPR:
9833 if (TREE_CODE (op_type) != BOOLEAN_TYPE)
9834 {
9835 ERROR_CANT_CONVERT_TO_BOOLEAN (wfl_operator, node, op_type);
9836 TREE_TYPE (node) = boolean_type_node;
9837 error_found = 1;
9838 }
9839 else
9840 prom_type = boolean_type_node;
9841 break;
9842
9843 /* 15.15 Cast Expression */
9844 case CONVERT_EXPR:
9845 value = patch_cast (node, wfl_op, wfl_operator);
9846 if (value == error_mark_node)
9847 {
9848 TREE_TYPE (node) = error_mark_node;
9849 error_found = 1;
9850 }
9851 else
9852 node = value;
9853 break;
9854 }
9855
9856 /* Check variable initialization */
9857 if (not_initialized_as_it_should_p (op))
9858 {
9859 ERROR_VARIABLE_NOT_INITIALIZED (wfl_op, DECL_NAME (op));
9860 INITIALIZED_P (op) = 1;
9861 }
9862
9863 if (error_found)
9864 return error_mark_node;
9865 /* In the case of JAVA_UNARY_PLUS_EXPR, we replaced NODE by a new one */
9866 else if (code != JAVA_UNARY_PLUS_EXPR && code != CONVERT_EXPR)
9867 {
9868 TREE_OPERAND (node, 0) = op;
9869 TREE_TYPE (node) = prom_type;
9870 }
9871 return fold (node);
9872 }
9873
9874 /* Generic type resolution that sometimes takes place during node
9875 patching. Returned the resolved type or generate an error
9876 message. Return the resolved type or NULL_TREE. */
9877
9878 static tree
9879 resolve_type_during_patch (type)
9880 tree type;
9881 {
9882 if (unresolved_type_p (type, NULL))
9883 {
9884 tree type_decl = resolve_no_layout (EXPR_WFL_NODE (type), NULL_TREE);
9885 if (!type_decl)
9886 {
9887 parse_error_context (type,
9888 "Class `%s' not found in type declaration",
9889 IDENTIFIER_POINTER (EXPR_WFL_NODE (type)));
9890 return NULL_TREE;
9891 }
9892 else
9893 return TREE_TYPE (type_decl);
9894 }
9895 return type;
9896 }
9897 /* 5.5 Casting Conversion. error_mark_node is returned if an error is
9898 found. Otherwise NODE or something meant to replace it is returned. */
9899
9900 static tree
9901 patch_cast (node, wfl_op, wfl_operator)
9902 tree node;
9903 tree wfl_op;
9904 tree wfl_operator;
9905 {
9906 tree op = TREE_OPERAND (node, 0);
9907 tree op_type = TREE_TYPE (op);
9908 tree cast_type = TREE_TYPE (node);
9909 char *t1;
9910
9911 /* First resolve OP_TYPE if unresolved */
9912 if (!(cast_type = resolve_type_during_patch (cast_type)))
9913 return error_mark_node;
9914
9915 /* Check on cast that are proven correct at compile time */
9916 if (JNUMERIC_TYPE_P (cast_type) && JNUMERIC_TYPE_P (op_type))
9917 {
9918 static tree convert_narrow ();
9919 /* Same type */
9920 if (cast_type == op_type)
9921 return node;
9922
9923 /* Try widening/narowwing convertion. Potentially, things need
9924 to be worked out in gcc so we implement the extreme cases
9925 correctly. fold_convert() needs to be fixed. */
9926 return convert (cast_type, op);
9927 }
9928
9929 /* The remaining legal casts involve conversion between reference
9930 types. Check for their compile time correctness. */
9931 if (JREFERENCE_TYPE_P (op_type) && JREFERENCE_TYPE_P (cast_type)
9932 && valid_ref_assignconv_cast_p (op_type, cast_type, 1))
9933 {
9934 TREE_TYPE (node) = promote_type (cast_type);
9935 /* Now, the case can be determined correct at compile time if
9936 OP_TYPE can be converted into CAST_TYPE by assignment
9937 conversion (5.2) */
9938
9939 if (valid_ref_assignconv_cast_p (op_type, cast_type, 0))
9940 return node;
9941
9942 /* The cast requires a run-time check */
9943 return build (CALL_EXPR, promote_type (cast_type),
9944 build_address_of (soft_checkcast_node),
9945 tree_cons (NULL_TREE, build_class_ref (cast_type),
9946 build_tree_list (NULL_TREE, op)),
9947 NULL_TREE);
9948 }
9949
9950 /* Any other casts are proven incorrect at compile time */
9951 t1 = strdup ((char *)lang_printable_name (op_type));
9952 parse_error_context (wfl_operator, "Invalid cast from `%s' to `%s'",
9953 t1, lang_printable_name (cast_type));
9954 free (t1);
9955 return error_mark_node;
9956 }
9957
9958 /* Build an ARRAY_REF incomplete tree node. Note that operand 1 isn't
9959 a list of indices. */
9960 static tree
9961 build_array_ref (location, array, index)
9962 int location;
9963 tree array, index;
9964 {
9965 tree node = build (ARRAY_REF, NULL_TREE, array, index);
9966 EXPR_WFL_LINECOL (node) = location;
9967 return node;
9968 }
9969
9970 /* 15.12 Array Access Expression */
9971
9972 static tree
9973 patch_array_ref (node, wfl_array, wfl_index)
9974 tree node, wfl_array, wfl_index;
9975 {
9976 tree array = TREE_OPERAND (node, 0);
9977 tree array_type = TREE_TYPE (array);
9978 tree index = TREE_OPERAND (node, 1);
9979 tree index_type = TREE_TYPE (index);
9980 tree promoted_index_type;
9981 int error_found = 0;
9982
9983 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
9984
9985 if (not_initialized_as_it_should_p (array))
9986 {
9987 ERROR_VARIABLE_NOT_INITIALIZED (wfl_array, DECL_NAME (array));
9988 INITIALIZED_P (array) = 1;
9989 }
9990 if (! flag_emit_class_files)
9991 array = save_expr (array);
9992
9993 if (TREE_CODE (array_type) == POINTER_TYPE)
9994 array_type = TREE_TYPE (array_type);
9995
9996 /* The array reference must be an array */
9997 if (!TYPE_ARRAY_P (array_type))
9998 {
9999 parse_error_context
10000 (wfl_operator, "`[]' can only be applied to arrays. It can't be "
10001 "applied to `%s'", lang_printable_name (array_type));
10002 TREE_TYPE (node) = error_mark_node;
10003 error_found = 1;
10004 }
10005
10006 /* The array index underdoes unary numeric promotion. The promoted
10007 type must be int */
10008 promoted_index_type = promote_type (index_type);
10009 if (promoted_index_type != int_type_node)
10010 {
10011 int could_cast = can_cast_to_p (index_type, int_type_node);
10012 parse_error_context
10013 (wfl_operator,
10014 (could_cast ? "Incompatible type for `[]'. Explicit cast needed to "
10015 "convert `%s' to `int'" : "Incompatible type for `[]'. "
10016 "Can't convert `%s' to `int'"),
10017 lang_printable_name (index_type));
10018 TREE_TYPE (node) = error_mark_node;
10019 error_found = 1;
10020 }
10021
10022 /* Now if the index is a var/parm decl, check on its initialization */
10023 if (not_initialized_as_it_should_p (index))
10024 {
10025 ERROR_VARIABLE_NOT_INITIALIZED (wfl_index, DECL_NAME (index));
10026 INITIALIZED_P (index) = 1;
10027 }
10028
10029 if (error_found)
10030 return error_mark_node;
10031 index = convert (promoted_index_type, index);
10032
10033 if (TREE_CODE (array_type) == RECORD_TYPE)
10034 array_type = promote_type (TYPE_ARRAY_ELEMENT (array_type));
10035 if (flag_emit_class_files)
10036 {
10037 TREE_OPERAND (node, 0)= array;
10038 TREE_OPERAND (node, 1)= index;
10039 }
10040 else
10041 node = build_java_arrayaccess (array, array_type, index);
10042 TREE_TYPE (node) = array_type;
10043 return node;
10044 }
10045
10046 /* 15.9 Array Creation Expressions */
10047
10048 static tree
10049 build_newarray_node (type, dims, extra_dims)
10050 tree type;
10051 tree dims;
10052 int extra_dims;
10053 {
10054 tree node =
10055 build (CALL_EXPR, NULL_TREE, type, nreverse (dims),
10056 build_int_2 (extra_dims, 0));
10057 TREE_SET_CODE (node, JAVA_NEW_ARRAY_EXPR);
10058 return node;
10059 }
10060
10061 static tree
10062 patch_newarray (node)
10063 tree node;
10064 {
10065 tree type = TREE_OPERAND (node, 0);
10066 tree dims = TREE_OPERAND (node, 1);
10067 tree cdim, array_type;
10068 int error_found = 0;
10069 int ndims = 0;
10070 int xdims = TREE_INT_CST_LOW (TREE_OPERAND (node, 2));
10071 int total_dims;
10072
10073 /* Dimension types are verified. It's better for the types to be
10074 verified in order. */
10075 for (cdim = dims, ndims = 0; cdim; cdim = TREE_CHAIN (cdim), ndims++ )
10076 {
10077 int dim_error = 0;
10078 tree dim = TREE_VALUE (cdim);
10079
10080 /* Dim might have been saved during its evaluation */
10081 dim = (TREE_CODE (dim) == SAVE_EXPR ? dim = TREE_OPERAND (dim, 0) : dim);
10082
10083 /* The type of each specified dimension must be an integral type. */
10084 if (!JINTEGRAL_TYPE_P (TREE_TYPE (dim)))
10085 dim_error = 1;
10086
10087 /* Each expression undergoes an unary numeric promotion (5.6.1) and the
10088 promoted type must be int. */
10089 else
10090 {
10091 dim = convert (promote_type (TREE_TYPE (dim)), dim);
10092 if (TREE_TYPE (dim) != int_type_node)
10093 dim_error = 1;
10094 }
10095
10096 /* Report errors on types here */
10097 if (dim_error)
10098 {
10099 parse_error_context
10100 (TREE_PURPOSE (cdim),
10101 "Incompatible type for dimension in array creation expression. "
10102 "%s convert `%s' to `int'",
10103 (can_cast_to_p (TREE_TYPE (dim), int_type_node) ?
10104 "Explicit cast needed to" : "Can't"),
10105 lang_printable_name (TREE_TYPE (dim)));
10106 error_found = 1;
10107 }
10108
10109 /* Check for uninitialized variables */
10110 if (not_initialized_as_it_should_p (dim))
10111 {
10112 ERROR_VARIABLE_NOT_INITIALIZED (TREE_PURPOSE (cdim),
10113 DECL_NAME (dim));
10114 INITIALIZED_P (dim) = 1;
10115 error_found = 1;
10116 }
10117
10118 TREE_PURPOSE (cdim) = NULL_TREE;
10119 }
10120
10121 /* Resolve array base type if unresolved */
10122 if (!(type = resolve_type_during_patch (type)))
10123 error_found = 1;
10124
10125 if (error_found)
10126 {
10127 /* We don't want further evaluation of this bogus array creation
10128 operation */
10129 TREE_TYPE (node) = error_mark_node;
10130 return error_mark_node;
10131 }
10132
10133 /* The node is transformed into a function call. Things are done
10134 differently according to the number of dimensions. If the number
10135 of dimension is equal to 1, then the nature of the base type
10136 (primitive or not) matters. */
10137 total_dims = xdims + ndims;
10138 if (total_dims == 1)
10139 {
10140 if (JPRIMITIVE_TYPE_P (type))
10141 {
10142 int type_code;
10143 if (type == boolean_type_node)
10144 type_code = 4;
10145 else if (type == char_type_node)
10146 type_code = 5;
10147 else if (type == float_type_node)
10148 type_code = 6;
10149 else if (type == double_type_node)
10150 type_code = 7;
10151 else if (type == byte_type_node)
10152 type_code = 8;
10153 else if (type == short_type_node)
10154 type_code = 9;
10155 else if (type == int_type_node)
10156 type_code = 10;
10157 else if (type == long_type_node)
10158 type_code = 11;
10159 else
10160 fatal ("Can't compute type code - patch_newarray");
10161 return build_newarray (type_code, TREE_VALUE (dims));
10162 }
10163 else
10164 return build_anewarray (type, TREE_VALUE (dims));
10165 }
10166
10167 /* Add extra dimensions as unknown dimensions */
10168 while (xdims--)
10169 dims =
10170 chainon (dims, build_tree_list (NULL_TREE, integer_negative_one_node));
10171 dims = chainon (dims, build_tree_list (NULL_TREE, integer_zero_node));
10172
10173 /* Can't reuse what's already written in expr.c because it uses the
10174 JVM stack representation. Provide a build_multianewarray. FIXME */
10175 array_type = type;
10176 for (cdim = TREE_CHAIN (dims); cdim; cdim = TREE_CHAIN (cdim))
10177 array_type = build_java_array_type (promote_type (array_type),
10178 TREE_CODE (cdim) == INTEGER_CST ?
10179 TREE_INT_CST_LOW (cdim) : -1);
10180 return build (CALL_EXPR,
10181 promote_type (array_type),
10182 build_address_of (soft_multianewarray_node),
10183 tree_cons (NULL_TREE, build_class_ref (array_type),
10184 tree_cons (NULL_TREE,
10185 build_int_2 (total_dims, 0), dims )),
10186 NULL_TREE);
10187 }
10188
10189 static tree
10190 build_this (location)
10191 int location;
10192 {
10193 tree node = build_wfl_node (this_identifier_node, input_filename, 0, 0);
10194 TREE_SET_CODE (node, JAVA_THIS_EXPR);
10195 EXPR_WFL_LINECOL (node) = location;
10196 return node;
10197 }
10198
10199 /* 14.15 The return statement. It builds a modify expression that
10200 assigns the returned value to the RESULT_DECL that hold the value
10201 to be returned. */
10202
10203 static tree
10204 build_return (location, op)
10205 int location;
10206 tree op;
10207 {
10208 tree node = build1 (RETURN_EXPR, NULL_TREE, op);
10209 EXPR_WFL_LINECOL (node) = location;
10210 return node;
10211 }
10212
10213 static tree
10214 patch_return (node)
10215 tree node;
10216 {
10217 tree return_exp = TREE_OPERAND (node, 0);
10218 tree meth = current_function_decl;
10219 tree mtype = TREE_TYPE (TREE_TYPE (current_function_decl));
10220 tree modify;
10221 int error_found = 0;
10222
10223 TREE_TYPE (node) = error_mark_node;
10224 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10225
10226 /* It's invalid to have a return value within a function that is
10227 declared with the keyword void or that is a constructor */
10228 if (return_exp && (mtype == void_type_node || DECL_CONSTRUCTOR_P (meth)))
10229 error_found = 1;
10230
10231 /* It's invalid to have a no return value within a function that
10232 isn't declared with the keyword `void' */
10233 if (!return_exp && (mtype != void_type_node && !DECL_CONSTRUCTOR_P (meth)))
10234 error_found = 2;
10235
10236 if (error_found)
10237 {
10238 char *t = strdup ((char *)lang_printable_name (mtype));
10239 parse_error_context (wfl_operator, "`return' with%s value from `%s %s'",
10240 (error_found == 1 ? "" : "out"), t,
10241 lang_printable_name (meth));
10242 free (t);
10243 return error_mark_node;
10244 }
10245
10246 /* If we have a return_exp, build a modify expression and expand it */
10247 if (return_exp)
10248 {
10249 modify = build (MODIFY_EXPR, NULL_TREE, DECL_RESULT (meth), return_exp);
10250 EXPR_WFL_LINECOL (modify) = EXPR_WFL_LINECOL (node);
10251 modify = java_complete_tree (modify);
10252 if (modify != error_mark_node)
10253 {
10254 TREE_SIDE_EFFECTS (modify) = 1;
10255 TREE_OPERAND (node, 0) = modify;
10256 }
10257 else
10258 return error_mark_node;
10259 }
10260 TREE_TYPE (node) = void_type_node;
10261 TREE_SIDE_EFFECTS (node) = 1;
10262 return node;
10263 }
10264
10265 /* 14.8 The if Statement */
10266
10267 static tree
10268 build_if_else_statement (location, expression, if_body, else_body)
10269 int location;
10270 tree expression, if_body, else_body;
10271 {
10272 tree node;
10273 /* FIXME: make else body be a void node, where this function is
10274 called */
10275 if (!else_body)
10276 else_body = build (COMPOUND_EXPR, void_type_node, NULL_TREE, NULL_TREE);
10277 node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
10278 EXPR_WFL_LINECOL (node) = location;
10279 return node;
10280 }
10281
10282 static tree
10283 patch_if_else_statement (node)
10284 tree node;
10285 {
10286 tree expression = TREE_OPERAND (node, 0);
10287
10288 TREE_TYPE (node) = error_mark_node;
10289 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10290
10291 /* The type of expression must be boolean */
10292 if (TREE_TYPE (expression) != boolean_type_node)
10293 {
10294 parse_error_context
10295 (wfl_operator,
10296 "Incompatible type for `if'. Can't convert `%s' to `boolean'",
10297 lang_printable_name (TREE_TYPE (expression)));
10298 return error_mark_node;
10299 }
10300
10301 TREE_TYPE (node) = void_type_node;
10302 TREE_SIDE_EFFECTS (node) = 1;
10303 return node;
10304 }
10305
10306 /* 14.6 Labeled Statements */
10307
10308 /* Action taken when a lableled statement is parsed. a new
10309 LABELED_BLOCK_EXPR is created. No statement is attached to the
10310 label, yet. */
10311
10312 static tree
10313 build_labeled_block (location, label, wfl)
10314 int location;
10315 tree label, wfl;
10316 {
10317 tree label_name = merge_qualified_name (label_id, label);
10318 tree label_decl, node;
10319
10320 /* Issue a warning if we try to reuse a label that was previously
10321 declared */
10322 if (IDENTIFIER_LOCAL_VALUE (label_name))
10323 {
10324 EXPR_WFL_LINECOL (wfl_operator) = location;
10325 parse_warning_context (wfl_operator, "Declaration of `%s' shadows "
10326 "a previous declaration",
10327 IDENTIFIER_POINTER (label));
10328 EXPR_WFL_LINECOL (wfl_operator) =
10329 EXPR_WFL_LINECOL (IDENTIFIER_LOCAL_VALUE (label_name));
10330 parse_warning_context (wfl_operator, "This is the location of the "
10331 "previous declaration of label `%s'",
10332 IDENTIFIER_POINTER (label));
10333 java_warning_count--;
10334 }
10335
10336 label_decl = create_label_decl (label_name);
10337 node = build (LABELED_BLOCK_EXPR, NULL_TREE, label_decl, NULL_TREE);
10338 EXPR_WFL_LINECOL (node) = location;
10339 TREE_SIDE_EFFECTS (node) = 1;
10340 return node;
10341 }
10342
10343 /* Generate a label crafting a unique name for it. This is used to
10344 implicitely label loops that aren't the body part of labeled
10345 statement. */
10346
10347 static tree
10348 generate_labeled_block ()
10349 {
10350 static int l_number = 0;
10351 char buf [20];
10352 tree label_name;
10353
10354 sprintf (buf, "$a%d", l_number++);
10355 return build_labeled_block (0, get_identifier (buf), NULL_TREE);
10356 }
10357
10358 /* A labeled statement LBE is attached a statement. If the statement
10359 happens to be a loop, a link from the loop back to the label is
10360 installed. */
10361
10362 static tree
10363 complete_labeled_statement (lbe, statement)
10364 tree lbe; /* Labeled block expr */
10365 tree statement;
10366 {
10367 /* In anyways, tie the loop to its statement */
10368 LABELED_BLOCK_BODY (lbe) = statement;
10369
10370 /* Ok, if statement is a for loop, we have to attach the labeled
10371 statement to the block the for loop belongs to and return the
10372 block instead */
10373 if (TREE_CODE (statement) == LOOP_EXPR && IS_FOR_LOOP_P (statement))
10374 {
10375 java_method_add_stmt (current_function_decl, lbe);
10376 return exit_block ();
10377 }
10378
10379 return lbe;
10380 }
10381
10382 /* 14.10, 14.11, 14.12 Loop Statements */
10383
10384 /* Create an empty LOOP_EXPR and make it the last in the nested loop
10385 list. */
10386
10387 static tree
10388 build_new_loop (loop_body)
10389 tree loop_body;
10390 {
10391 tree loop = build (LOOP_EXPR, NULL_TREE, loop_body);
10392 TREE_SIDE_EFFECTS (loop) = 1;
10393 PUSH_LOOP (loop);
10394 return loop;
10395 }
10396
10397 /* Create a loop body according to the following structure:
10398 COMPOUND_EXPR
10399 COMPOUND_EXPR (loop main body)
10400 EXIT_EXPR (this order is for while/for loops.
10401 LABELED_BLOCK_EXPR the order is reversed for do loops)
10402 LABEL_DECL (continue occurding here branche at the
10403 BODY end of this labeled block)
10404 INCREMENT (if any)
10405
10406 REVERSED, if non zero, tells that the loop condition expr comes
10407 after the body, like in the do-while loop. */
10408
10409 static tree
10410 build_loop_body (location, condition, reversed)
10411 int location;
10412 tree condition;
10413 int reversed;
10414 {
10415 tree first, second, label, body;
10416
10417 condition = build (EXIT_EXPR, NULL_TREE, condition); /* Force walk */
10418 EXPR_WFL_LINECOL (condition) = location; /* For accurate error report */
10419 condition = build_debugable_stmt (location, condition);
10420 TREE_SIDE_EFFECTS (condition) = 1;
10421
10422 body = generate_labeled_block ();
10423 first = (reversed ? body : condition);
10424 second = (reversed ? condition : body);
10425 return
10426 build (COMPOUND_EXPR, NULL_TREE,
10427 build (COMPOUND_EXPR, NULL_TREE, first, second), size_zero_node);
10428 }
10429
10430 /* Install CONDITION (if any) and loop BODY (using REVERSED to tell
10431 their order) on the current loop. Unlink the current loop from the
10432 loop list. */
10433
10434 static tree
10435 complete_loop_body (location, condition, body, reversed)
10436 int location;
10437 tree condition, body;
10438 int reversed;
10439 {
10440 tree to_return = ctxp->current_loop;
10441 tree loop_body = LOOP_EXPR_BODY (to_return);
10442 if (condition)
10443 {
10444 tree cnode = LOOP_EXPR_BODY_CONDITION_EXPR (loop_body, reversed);
10445 /* We wrapped the EXIT_EXPR around a WFL so we can debug it.
10446 The real EXIT_EXPR is one operand further. */
10447 EXPR_WFL_LINECOL (cnode) = location;
10448 /* This one is for accurate error reports */
10449 EXPR_WFL_LINECOL (TREE_OPERAND (cnode, 0)) = location;
10450 TREE_OPERAND (TREE_OPERAND (cnode, 0), 0) = condition;
10451 }
10452 LOOP_EXPR_BODY_BODY_EXPR (loop_body, reversed) = body;
10453 POP_LOOP ();
10454 return to_return;
10455 }
10456
10457 /* Tailored version of complete_loop_body for FOR loops, when FOR
10458 loops feature the condition part */
10459
10460 static tree
10461 complete_for_loop (location, condition, update, body)
10462 int location;
10463 tree condition, update, body;
10464 {
10465 /* Put the condition and the loop body in place */
10466 tree loop = complete_loop_body (location, condition, body, 0);
10467 /* LOOP is the current loop which has been now popped of the loop
10468 stack. Install the update block */
10469 LOOP_EXPR_BODY_UPDATE_BLOCK (LOOP_EXPR_BODY (loop)) = update;
10470 return loop;
10471 }
10472
10473 /* If the loop isn't surrounded by a labeled statement, create one and
10474 insert LOOP as it's body. */
10475
10476 static tree
10477 patch_loop_statement (loop)
10478 tree loop;
10479 {
10480 tree cbl, loop_label, to_return_as_loop;
10481
10482 if (LOOP_HAS_LABEL_P (loop))
10483 {
10484 loop_label = ctxp->current_labeled_block;
10485 to_return_as_loop = loop;
10486 }
10487 else
10488 {
10489 loop_label = generate_labeled_block ();
10490 LABELED_BLOCK_BODY (loop_label) = loop;
10491 PUSH_LABELED_BLOCK (loop_label);
10492 to_return_as_loop = loop_label;
10493 }
10494 TREE_TYPE (to_return_as_loop) = void_type_node;
10495 return to_return_as_loop;
10496 }
10497
10498 /* 14.13, 14.14: break and continue Statements */
10499
10500 /* Build a break or a continue statement. a null NAME indicates an
10501 unlabeled break/continue statement. */
10502
10503 static tree
10504 build_bc_statement (location, is_break, name)
10505 int location, is_break;
10506 tree name;
10507 {
10508 tree break_continue, label_block_expr = NULL_TREE;
10509
10510 if (name)
10511 {
10512 if (!(label_block_expr = IDENTIFIER_LOCAL_VALUE
10513 (merge_qualified_name (label_id, EXPR_WFL_NODE (name)))))
10514 /* Null means that we don't have a target for this named
10515 break/continue. In this case, we make the target to be the
10516 label name, so that the error can be reported accuratly in
10517 patch_bc_statement. */
10518 label_block_expr = EXPR_WFL_NODE (name);
10519 }
10520 /* Unlabeled break/continue will be handled during the
10521 break/continue patch operation */
10522 break_continue
10523 = build (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr, NULL_TREE);
10524
10525 IS_BREAK_STMT_P (break_continue) = is_break;
10526 TREE_SIDE_EFFECTS (break_continue) = 1;
10527 EXPR_WFL_LINECOL (break_continue) = location;
10528 return break_continue;
10529 }
10530
10531 /* Verification of a break/continue statement. */
10532
10533 static tree
10534 patch_bc_statement (node)
10535 tree node;
10536 {
10537 tree bc_label = EXIT_BLOCK_LABELED_BLOCK (node), target_stmt;
10538 int is_unlabeled = 0;
10539 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10540
10541 /* Not having a target means that the break/continue statement is
10542 unlabeled. We try to find a descent label for it */
10543 if (!bc_label)
10544 {
10545 is_unlabeled = 1;
10546 /* There should be a loop to branch to */
10547 if (ctxp->current_loop)
10548 {
10549 /* At that stage, we're in the loop body, which is
10550 encapsulated around a LABELED_BLOCK_EXPR. So searching
10551 the current loop label requires us to consider the
10552 labeled block before the current one. */
10553 if (!LOOP_HAS_LABEL_SKIP_P (ctxp->current_loop))
10554 fatal ("unlabeled loop has not installed label -- "
10555 "patch_bc_statement");
10556 bc_label = TREE_CHAIN (ctxp->current_labeled_block);
10557 }
10558 /* Not having a loop to break/continue to is an error */
10559 else
10560 {
10561 parse_error_context (wfl_operator, "`%s' must be in loop%s",
10562 (IS_BREAK_STMT_P (node) ? "break" : "continue"),
10563 (IS_BREAK_STMT_P (node) ? " or switch" : ""));
10564 return error_mark_node;
10565 }
10566 }
10567 /* Having an identifier here means that the target is unknown. */
10568 else if (TREE_CODE (bc_label) == IDENTIFIER_NODE)
10569 {
10570 parse_error_context (wfl_operator, "No label definition found for `%s'",
10571 IDENTIFIER_POINTER (bc_label));
10572 return error_mark_node;
10573 }
10574
10575 /* Find the statement we're targeting. */
10576 target_stmt = LABELED_BLOCK_BODY (bc_label);
10577
10578 /* 14.13 The break Statement */
10579 if (IS_BREAK_STMT_P (node))
10580 {
10581 /* Named break are always fine, as far as they have a target
10582 (already verified). Anonymous break need to target
10583 while/do/for/switch */
10584 if (is_unlabeled &&
10585 !(TREE_CODE (target_stmt) == LOOP_EXPR /* do/while/for */
10586 || 0)) /* switch FIXME */
10587 {
10588 parse_error_context (wfl_operator,
10589 "`break' must be in loop or switch");
10590 return error_mark_node;
10591 }
10592 /* If previously unlabeled, install the new found label */
10593 if (is_unlabeled)
10594 EXIT_BLOCK_LABELED_BLOCK (node) = bc_label;
10595 }
10596 /* 14.14 The continue Statement */
10597 /* The continue statement must always target a loop */
10598 else
10599 {
10600 if (TREE_CODE (target_stmt) != LOOP_EXPR) /* do/while/for */
10601 {
10602 parse_error_context (wfl_operator, "`continue' must be in loop");
10603 return error_mark_node;
10604 }
10605 /* Everything looks good. We can fix the `continue' jump to go
10606 at the place in the loop were the continue is. The continue
10607 is the current labeled block, by construction. */
10608 EXIT_BLOCK_LABELED_BLOCK (node) = ctxp->current_labeled_block;
10609 }
10610
10611 /* Our break/continue don't return values. */
10612 TREE_TYPE (node) = void_type_node;
10613 /* Encapsulate the break within a compound statement so that it's
10614 expanded all the times by expand_expr (and not clobered
10615 sometimes, like after a if statement) */
10616 node = add_stmt_to_compound (NULL_TREE, void_type_node, node);
10617 TREE_SIDE_EFFECTS (node) = 1;
10618 return node;
10619 }
10620
10621 /* Process the exit expression belonging to a loop. Its type must be
10622 boolean. */
10623
10624 static tree
10625 patch_exit_expr (node)
10626 tree node;
10627 {
10628 tree expression = TREE_OPERAND (node, 0);
10629 TREE_TYPE (node) = error_mark_node;
10630 EXPR_WFL_LINECOL (wfl_operator) = EXPR_WFL_LINECOL (node);
10631
10632 /* The type of expression must be boolean */
10633 if (TREE_TYPE (expression) != boolean_type_node)
10634 {
10635 parse_error_context
10636 (wfl_operator,
10637 "Incompatible type for loop conditional. Can't convert `%s' to "
10638 "`boolean'",
10639 lang_printable_name (TREE_TYPE (expression)));
10640 return error_mark_node;
10641 }
10642 /* Now we know things are allright, invert the condition, fold and
10643 return */
10644 TREE_OPERAND (node, 0) =
10645 fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, expression));
10646 TREE_TYPE (node) = void_type_node;
10647 return node;
10648 }