Commit | Line | Data |
---|---|---|
9733ab3f SS |
1 | |
2 | /* A Bison parser, made from f-exp.y | |
3 | by GNU Bison version 1.25 | |
4 | */ | |
5 | ||
6 | #define YYBISON 1 /* Identify Bison output. */ | |
7 | ||
8 | #define INT 258 | |
9 | #define FLOAT 259 | |
10 | #define STRING_LITERAL 260 | |
11 | #define BOOLEAN_LITERAL 261 | |
12 | #define NAME 262 | |
13 | #define TYPENAME 263 | |
14 | #define NAME_OR_INT 264 | |
15 | #define SIZEOF 265 | |
16 | #define ERROR 266 | |
17 | #define INT_KEYWORD 267 | |
18 | #define INT_S2_KEYWORD 268 | |
19 | #define LOGICAL_S1_KEYWORD 269 | |
20 | #define LOGICAL_S2_KEYWORD 270 | |
21 | #define LOGICAL_KEYWORD 271 | |
22 | #define REAL_KEYWORD 272 | |
23 | #define REAL_S8_KEYWORD 273 | |
24 | #define REAL_S16_KEYWORD 274 | |
25 | #define COMPLEX_S8_KEYWORD 275 | |
26 | #define COMPLEX_S16_KEYWORD 276 | |
27 | #define COMPLEX_S32_KEYWORD 277 | |
28 | #define BOOL_AND 278 | |
29 | #define BOOL_OR 279 | |
30 | #define BOOL_NOT 280 | |
31 | #define CHARACTER 281 | |
32 | #define VARIABLE 282 | |
33 | #define ASSIGN_MODIFY 283 | |
34 | #define ABOVE_COMMA 284 | |
35 | #define EQUAL 285 | |
36 | #define NOTEQUAL 286 | |
37 | #define LESSTHAN 287 | |
38 | #define GREATERTHAN 288 | |
39 | #define LEQ 289 | |
40 | #define GEQ 290 | |
41 | #define LSH 291 | |
42 | #define RSH 292 | |
43 | #define UNARY 293 | |
44 | ||
45 | #line 43 "f-exp.y" | |
46 | ||
47 | ||
48 | #include "defs.h" | |
49 | #include "gdb_string.h" | |
50 | #include "expression.h" | |
51 | #include "value.h" | |
52 | #include "parser-defs.h" | |
53 | #include "language.h" | |
54 | #include "f-lang.h" | |
55 | #include "bfd.h" /* Required by objfiles.h. */ | |
56 | #include "symfile.h" /* Required by objfiles.h. */ | |
57 | #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */ | |
58 | ||
59 | /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), | |
60 | as well as gratuitiously global symbol names, so we can have multiple | |
61 | yacc generated parsers in gdb. Note that these are only the variables | |
62 | produced by yacc. If other parser generators (bison, byacc, etc) produce | |
63 | additional global names that conflict at link time, then those parser | |
64 | generators need to be fixed instead of adding those names to this list. */ | |
65 | ||
66 | #define yymaxdepth f_maxdepth | |
67 | #define yyparse f_parse | |
68 | #define yylex f_lex | |
69 | #define yyerror f_error | |
70 | #define yylval f_lval | |
71 | #define yychar f_char | |
72 | #define yydebug f_debug | |
73 | #define yypact f_pact | |
74 | #define yyr1 f_r1 | |
75 | #define yyr2 f_r2 | |
76 | #define yydef f_def | |
77 | #define yychk f_chk | |
78 | #define yypgo f_pgo | |
79 | #define yyact f_act | |
80 | #define yyexca f_exca | |
81 | #define yyerrflag f_errflag | |
82 | #define yynerrs f_nerrs | |
83 | #define yyps f_ps | |
84 | #define yypv f_pv | |
85 | #define yys f_s | |
86 | #define yy_yys f_yys | |
87 | #define yystate f_state | |
88 | #define yytmp f_tmp | |
89 | #define yyv f_v | |
90 | #define yy_yyv f_yyv | |
91 | #define yyval f_val | |
92 | #define yylloc f_lloc | |
93 | #define yyreds f_reds /* With YYDEBUG defined */ | |
94 | #define yytoks f_toks /* With YYDEBUG defined */ | |
95 | #define yylhs f_yylhs | |
96 | #define yylen f_yylen | |
97 | #define yydefred f_yydefred | |
98 | #define yydgoto f_yydgoto | |
99 | #define yysindex f_yysindex | |
100 | #define yyrindex f_yyrindex | |
101 | #define yygindex f_yygindex | |
102 | #define yytable f_yytable | |
103 | #define yycheck f_yycheck | |
104 | ||
105 | #ifndef YYDEBUG | |
106 | #define YYDEBUG 1 /* Default to no yydebug support */ | |
107 | #endif | |
108 | ||
109 | int yyparse PARAMS ((void)); | |
110 | ||
111 | static int yylex PARAMS ((void)); | |
112 | ||
113 | void yyerror PARAMS ((char *)); | |
114 | ||
115 | static void growbuf_by_size PARAMS ((int)); | |
116 | ||
117 | static int match_string_literal PARAMS ((void)); | |
118 | ||
119 | ||
120 | #line 122 "f-exp.y" | |
121 | typedef union | |
122 | { | |
123 | LONGEST lval; | |
124 | struct { | |
125 | LONGEST val; | |
126 | struct type *type; | |
127 | } typed_val; | |
128 | DOUBLEST dval; | |
129 | struct symbol *sym; | |
130 | struct type *tval; | |
131 | struct stoken sval; | |
132 | struct ttype tsym; | |
133 | struct symtoken ssym; | |
134 | int voidval; | |
135 | struct block *bval; | |
136 | enum exp_opcode opcode; | |
137 | struct internalvar *ivar; | |
138 | ||
139 | struct type **tvec; | |
140 | int *ivec; | |
141 | } YYSTYPE; | |
142 | #line 144 "f-exp.y" | |
143 | ||
144 | /* YYSTYPE gets defined by %union */ | |
145 | static int parse_number PARAMS ((char *, int, int, YYSTYPE *)); | |
146 | #include <stdio.h> | |
147 | ||
148 | #ifndef __cplusplus | |
149 | #ifndef __STDC__ | |
150 | #define const | |
151 | #endif | |
152 | #endif | |
153 | ||
154 | ||
155 | ||
156 | #define YYFINAL 125 | |
157 | #define YYFLAG -32768 | |
158 | #define YYNTBASE 55 | |
159 | ||
160 | #define YYTRANSLATE(x) ((unsigned)(x) <= 293 ? yytranslate[x] : 71) | |
161 | ||
162 | static const char yytranslate[] = { 0, | |
163 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
164 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
165 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
166 | 2, 2, 2, 2, 2, 2, 49, 35, 2, 51, | |
167 | 52, 47, 45, 29, 46, 2, 48, 2, 2, 2, | |
168 | 2, 2, 2, 2, 2, 2, 2, 54, 2, 2, | |
169 | 31, 2, 32, 44, 2, 2, 2, 2, 2, 2, | |
170 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
171 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
172 | 2, 2, 2, 34, 2, 2, 2, 2, 2, 2, | |
173 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
174 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
175 | 2, 2, 2, 33, 2, 53, 2, 2, 2, 2, | |
176 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
177 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
178 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
179 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
180 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
181 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
182 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
183 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
184 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
185 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
186 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
187 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
188 | 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, | |
189 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | |
190 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, | |
191 | 26, 27, 28, 30, 36, 37, 38, 39, 40, 41, | |
192 | 42, 43, 50 | |
193 | }; | |
194 | ||
195 | #if YYDEBUG != 0 | |
196 | static const short yyprhs[] = { 0, | |
197 | 0, 2, 4, 6, 10, 13, 16, 19, 22, 25, | |
198 | 28, 29, 35, 36, 38, 40, 44, 48, 52, 56, | |
199 | 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, | |
200 | 101, 105, 109, 113, 117, 121, 125, 129, 133, 137, | |
201 | 141, 145, 147, 149, 151, 153, 155, 160, 162, 164, | |
202 | 166, 168, 170, 173, 175, 178, 180, 183, 185, 189, | |
203 | 192, 194, 197, 201, 203, 205, 207, 209, 211, 213, | |
204 | 215, 217, 219, 221, 223, 225, 227, 229, 231, 235, | |
205 | 237, 239, 241 | |
206 | }; | |
207 | ||
208 | static const short yyrhs[] = { 57, | |
209 | 0, 56, 0, 63, 0, 51, 57, 52, 0, 47, | |
210 | 57, 0, 35, 57, 0, 46, 57, 0, 25, 57, | |
211 | 0, 53, 57, 0, 10, 57, 0, 0, 57, 51, | |
212 | 58, 59, 52, 0, 0, 57, 0, 60, 0, 59, | |
213 | 29, 57, 0, 57, 54, 57, 0, 57, 29, 57, | |
214 | 0, 51, 61, 52, 0, 51, 63, 52, 57, 0, | |
215 | 57, 44, 57, 0, 57, 47, 57, 0, 57, 48, | |
216 | 57, 0, 57, 49, 57, 0, 57, 45, 57, 0, | |
217 | 57, 46, 57, 0, 57, 42, 57, 0, 57, 43, | |
218 | 57, 0, 57, 36, 57, 0, 57, 37, 57, 0, | |
219 | 57, 40, 57, 0, 57, 41, 57, 0, 57, 38, | |
220 | 57, 0, 57, 39, 57, 0, 57, 35, 57, 0, | |
221 | 57, 34, 57, 0, 57, 33, 57, 0, 57, 23, | |
222 | 57, 0, 57, 24, 57, 0, 57, 31, 57, 0, | |
223 | 57, 28, 57, 0, 3, 0, 9, 0, 4, 0, | |
224 | 62, 0, 27, 0, 10, 51, 63, 52, 0, 6, | |
225 | 0, 5, 0, 70, 0, 64, 0, 68, 0, 68, | |
226 | 65, 0, 47, 0, 47, 65, 0, 35, 0, 35, | |
227 | 65, 0, 66, 0, 51, 65, 52, 0, 66, 67, | |
228 | 0, 67, 0, 51, 52, 0, 51, 69, 52, 0, | |
229 | 8, 0, 12, 0, 13, 0, 26, 0, 16, 0, | |
230 | 15, 0, 14, 0, 17, 0, 18, 0, 19, 0, | |
231 | 20, 0, 21, 0, 22, 0, 8, 0, 63, 0, | |
232 | 69, 29, 63, 0, 7, 0, 8, 0, 9, 0, | |
233 | 7, 0 | |
234 | }; | |
235 | ||
236 | #endif | |
237 | ||
238 | #if YYDEBUG != 0 | |
239 | static const short yyrline[] = { 0, | |
240 | 221, 222, 225, 231, 236, 239, 242, 246, 250, 254, | |
241 | 263, 265, 271, 274, 278, 281, 285, 290, 294, 298, | |
242 | 306, 310, 314, 318, 322, 326, 330, 334, 338, 342, | |
243 | 346, 350, 354, 358, 362, 366, 370, 374, 379, 383, | |
244 | 387, 393, 400, 409, 416, 419, 422, 430, 437, 445, | |
245 | 489, 492, 493, 536, 538, 540, 542, 544, 547, 549, | |
246 | 551, 555, 557, 562, 564, 566, 568, 570, 572, 574, | |
247 | 576, 578, 580, 582, 584, 586, 590, 594, 599, 606, | |
248 | 608, 610, 614 | |
249 | }; | |
250 | #endif | |
251 | ||
252 | ||
253 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | |
254 | ||
255 | static const char * const yytname[] = { "$","error","$undefined.","INT","FLOAT", | |
256 | "STRING_LITERAL","BOOLEAN_LITERAL","NAME","TYPENAME","NAME_OR_INT","SIZEOF", | |
257 | "ERROR","INT_KEYWORD","INT_S2_KEYWORD","LOGICAL_S1_KEYWORD","LOGICAL_S2_KEYWORD", | |
258 | "LOGICAL_KEYWORD","REAL_KEYWORD","REAL_S8_KEYWORD","REAL_S16_KEYWORD","COMPLEX_S8_KEYWORD", | |
259 | "COMPLEX_S16_KEYWORD","COMPLEX_S32_KEYWORD","BOOL_AND","BOOL_OR","BOOL_NOT", | |
260 | "CHARACTER","VARIABLE","ASSIGN_MODIFY","','","ABOVE_COMMA","'='","'?'","'|'", | |
261 | "'^'","'&'","EQUAL","NOTEQUAL","LESSTHAN","GREATERTHAN","LEQ","GEQ","LSH","RSH", | |
262 | "'@'","'+'","'-'","'*'","'/'","'%'","UNARY","'('","')'","'~'","':'","start", | |
263 | "type_exp","exp","@1","arglist","substring","complexnum","variable","type","ptype", | |
264 | "abs_decl","direct_abs_decl","func_mod","typebase","nonempty_typelist","name_not_typename", NULL | |
265 | }; | |
266 | #endif | |
267 | ||
268 | static const short yyr1[] = { 0, | |
269 | 55, 55, 56, 57, 57, 57, 57, 57, 57, 57, | |
270 | 58, 57, 59, 59, 59, 59, 60, 61, 57, 57, | |
271 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, | |
272 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, | |
273 | 57, 57, 57, 57, 57, 57, 57, 57, 57, 62, | |
274 | 63, 64, 64, 65, 65, 65, 65, 65, 66, 66, | |
275 | 66, 67, 67, 68, 68, 68, 68, 68, 68, 68, | |
276 | 68, 68, 68, 68, 68, 68, -1, 69, 69, -1, | |
277 | -1, -1, 70 | |
278 | }; | |
279 | ||
280 | static const short yyr2[] = { 0, | |
281 | 1, 1, 1, 3, 2, 2, 2, 2, 2, 2, | |
282 | 0, 5, 0, 1, 1, 3, 3, 3, 3, 4, | |
283 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
284 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
285 | 3, 1, 1, 1, 1, 1, 4, 1, 1, 1, | |
286 | 1, 1, 2, 1, 2, 1, 2, 1, 3, 2, | |
287 | 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, | |
288 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, | |
289 | 1, 1, 1 | |
290 | }; | |
291 | ||
292 | static const short yydefact[] = { 0, | |
293 | 42, 44, 49, 48, 83, 64, 43, 0, 65, 66, | |
294 | 70, 69, 68, 71, 72, 73, 74, 75, 76, 0, | |
295 | 67, 46, 0, 0, 0, 0, 0, 2, 1, 45, | |
296 | 3, 51, 52, 50, 0, 10, 8, 6, 7, 5, | |
297 | 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, | |
298 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
299 | 0, 0, 0, 0, 0, 11, 56, 54, 0, 53, | |
300 | 58, 61, 0, 0, 4, 19, 0, 38, 39, 41, | |
301 | 40, 37, 36, 35, 29, 30, 33, 34, 31, 32, | |
302 | 27, 28, 21, 25, 26, 22, 23, 24, 13, 57, | |
303 | 55, 62, 78, 0, 0, 0, 60, 47, 18, 20, | |
304 | 14, 0, 15, 59, 0, 63, 0, 0, 12, 79, | |
305 | 17, 16, 0, 0, 0 | |
306 | }; | |
307 | ||
308 | static const short yydefgoto[] = { 123, | |
309 | 28, 41, 99, 112, 113, 42, 30, 103, 32, 70, | |
310 | 71, 72, 33, 105, 34 | |
311 | }; | |
312 | ||
313 | static const short yypact[] = { 75, | |
314 | -32768,-32768,-32768,-32768,-32768,-32768,-32768, 126,-32768,-32768, | |
315 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 135, | |
316 | -32768,-32768, 135, 135, 135, 75, 135,-32768, 309,-32768, | |
317 | -32768,-32768, -34,-32768, 75, -49, -49, -49, -49, -49, | |
318 | 279, -46, -45, -49, 135, 135, 135, 135, 135, 135, | |
319 | 135, 135, 135, 135, 135, 135, 135, 135, 135, 135, | |
320 | 135, 135, 135, 135, 135,-32768, -34, -34, 206,-32768, | |
321 | -42,-32768, -36, 135,-32768,-32768, 135, 355, 336, 309, | |
322 | 309, 390, 407, 161, 221, 221, -11, -11, -11, -11, | |
323 | 22, 22, 58, -37, -37, -49, -49, -49, 135,-32768, | |
324 | -32768,-32768,-32768, -33, -26, 230,-32768, 186, 309, -49, | |
325 | 250, -24,-32768,-32768, 397,-32768, 135, 135,-32768,-32768, | |
326 | 309, 309, 15, 18,-32768 | |
327 | }; | |
328 | ||
329 | static const short yypgoto[] = {-32768, | |
330 | -32768, 0,-32768,-32768,-32768,-32768,-32768, 4,-32768, -25, | |
331 | -32768, -50,-32768,-32768,-32768 | |
332 | }; | |
333 | ||
334 | ||
335 | #define YYLAST 458 | |
336 | ||
337 | ||
338 | static const short yytable[] = { 29, | |
339 | 67, 66, 115, 31, 118, 76, 77, 36, 106, 63, | |
340 | 64, 65, 68, 66, 124, 108, 69, 125, 114, 37, | |
341 | 107, 0, 38, 39, 40, 116, 44, 119, 0, 43, | |
342 | 58, 59, 60, 61, 62, 63, 64, 65, 73, 66, | |
343 | 0, 100, 101, 104, 78, 79, 80, 81, 82, 83, | |
344 | 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, | |
345 | 94, 95, 96, 97, 98, 60, 61, 62, 63, 64, | |
346 | 65, 0, 66, 109, 0, 0, 110, 1, 2, 3, | |
347 | 4, 5, 6, 7, 8, 0, 9, 10, 11, 12, | |
348 | 13, 14, 15, 16, 17, 18, 19, 0, 111, 20, | |
349 | 21, 22, 61, 62, 63, 64, 65, 110, 66, 23, | |
350 | 0, 0, 0, 0, 0, 0, 121, 122, 120, 0, | |
351 | 24, 25, 0, 0, 0, 26, 0, 27, 1, 2, | |
352 | 3, 4, 5, 0, 7, 8, 0, 1, 2, 3, | |
353 | 4, 5, 0, 7, 8, 0, 0, 0, 0, 0, | |
354 | 20, 0, 22, 0, 0, 0, 0, 0, 0, 20, | |
355 | 23, 22, 0, 0, 0, 0, 0, 0, 0, 23, | |
356 | 0, 24, 25, 0, 0, 0, 35, 0, 27, 0, | |
357 | 24, 25, 0, 0, 0, 26, 0, 27, 1, 2, | |
358 | 3, 4, 5, 0, 7, 8, 52, 53, 54, 55, | |
359 | 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, | |
360 | 20, 66, 22, 6, 0, 0, 0, 9, 10, 11, | |
361 | 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, | |
362 | 0, 21, 0, 0, 0, 0, 26, 6, 27, 0, | |
363 | 67, 9, 10, 11, 12, 13, 14, 15, 16, 17, | |
364 | 18, 19, 68, 0, 0, 21, 69, 102, 54, 55, | |
365 | 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, | |
366 | 0, 66, 45, 46, 0, 0, 0, 47, 0, 0, | |
367 | 48, 102, 49, 50, 51, 52, 53, 54, 55, 56, | |
368 | 57, 58, 59, 60, 61, 62, 63, 64, 65, 0, | |
369 | 66, 45, 46, 117, 0, 0, 47, 74, 0, 48, | |
370 | 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, | |
371 | 58, 59, 60, 61, 62, 63, 64, 65, 0, 66, | |
372 | 75, 45, 46, 0, 0, 0, 47, 0, 0, 48, | |
373 | 0, 49, 50, 51, 52, 53, 54, 55, 56, 57, | |
374 | 58, 59, 60, 61, 62, 63, 64, 65, 45, 66, | |
375 | 0, 0, 0, 0, 0, 0, 0, 0, 49, 50, | |
376 | 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, | |
377 | 61, 62, 63, 64, 65, 0, 66, 49, 50, 51, | |
378 | 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, | |
379 | 62, 63, 64, 65, 6, 66, 0, 0, 9, 10, | |
380 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, | |
381 | 0, 0, 21, 50, 51, 52, 53, 54, 55, 56, | |
382 | 57, 58, 59, 60, 61, 62, 63, 64, 65, 0, | |
383 | 66, 51, 52, 53, 54, 55, 56, 57, 58, 59, | |
384 | 60, 61, 62, 63, 64, 65, 0, 66 | |
385 | }; | |
386 | ||
387 | static const short yycheck[] = { 0, | |
388 | 35, 51, 29, 0, 29, 52, 52, 8, 51, 47, | |
389 | 48, 49, 47, 51, 0, 52, 51, 0, 52, 20, | |
390 | 71, -1, 23, 24, 25, 52, 27, 52, -1, 26, | |
391 | 42, 43, 44, 45, 46, 47, 48, 49, 35, 51, | |
392 | -1, 67, 68, 69, 45, 46, 47, 48, 49, 50, | |
393 | 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, | |
394 | 61, 62, 63, 64, 65, 44, 45, 46, 47, 48, | |
395 | 49, -1, 51, 74, -1, -1, 77, 3, 4, 5, | |
396 | 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, | |
397 | 16, 17, 18, 19, 20, 21, 22, -1, 99, 25, | |
398 | 26, 27, 45, 46, 47, 48, 49, 108, 51, 35, | |
399 | -1, -1, -1, -1, -1, -1, 117, 118, 115, -1, | |
400 | 46, 47, -1, -1, -1, 51, -1, 53, 3, 4, | |
401 | 5, 6, 7, -1, 9, 10, -1, 3, 4, 5, | |
402 | 6, 7, -1, 9, 10, -1, -1, -1, -1, -1, | |
403 | 25, -1, 27, -1, -1, -1, -1, -1, -1, 25, | |
404 | 35, 27, -1, -1, -1, -1, -1, -1, -1, 35, | |
405 | -1, 46, 47, -1, -1, -1, 51, -1, 53, -1, | |
406 | 46, 47, -1, -1, -1, 51, -1, 53, 3, 4, | |
407 | 5, 6, 7, -1, 9, 10, 36, 37, 38, 39, | |
408 | 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, | |
409 | 25, 51, 27, 8, -1, -1, -1, 12, 13, 14, | |
410 | 15, 16, 17, 18, 19, 20, 21, 22, -1, -1, | |
411 | -1, 26, -1, -1, -1, -1, 51, 8, 53, -1, | |
412 | 35, 12, 13, 14, 15, 16, 17, 18, 19, 20, | |
413 | 21, 22, 47, -1, -1, 26, 51, 52, 38, 39, | |
414 | 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, | |
415 | -1, 51, 23, 24, -1, -1, -1, 28, -1, -1, | |
416 | 31, 52, 33, 34, 35, 36, 37, 38, 39, 40, | |
417 | 41, 42, 43, 44, 45, 46, 47, 48, 49, -1, | |
418 | 51, 23, 24, 54, -1, -1, 28, 29, -1, 31, | |
419 | -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, | |
420 | 42, 43, 44, 45, 46, 47, 48, 49, -1, 51, | |
421 | 52, 23, 24, -1, -1, -1, 28, -1, -1, 31, | |
422 | -1, 33, 34, 35, 36, 37, 38, 39, 40, 41, | |
423 | 42, 43, 44, 45, 46, 47, 48, 49, 23, 51, | |
424 | -1, -1, -1, -1, -1, -1, -1, -1, 33, 34, | |
425 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, | |
426 | 45, 46, 47, 48, 49, -1, 51, 33, 34, 35, | |
427 | 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, | |
428 | 46, 47, 48, 49, 8, 51, -1, -1, 12, 13, | |
429 | 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, | |
430 | -1, -1, 26, 34, 35, 36, 37, 38, 39, 40, | |
431 | 41, 42, 43, 44, 45, 46, 47, 48, 49, -1, | |
432 | 51, 35, 36, 37, 38, 39, 40, 41, 42, 43, | |
433 | 44, 45, 46, 47, 48, 49, -1, 51 | |
434 | }; | |
435 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
436 | #line 3 "/stone/jimb/main-98r2/share/bison.simple" | |
437 | ||
438 | /* Skeleton output parser for bison, | |
439 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
440 | ||
441 | This program is free software; you can redistribute it and/or modify | |
442 | it under the terms of the GNU General Public License as published by | |
443 | the Free Software Foundation; either version 2, or (at your option) | |
444 | any later version. | |
445 | ||
446 | This program is distributed in the hope that it will be useful, | |
447 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
448 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
449 | GNU General Public License for more details. | |
450 | ||
451 | You should have received a copy of the GNU General Public License | |
452 | along with this program; if not, write to the Free Software | |
453 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
454 | ||
455 | /* As a special exception, when this file is copied by Bison into a | |
456 | Bison output file, you may use that output file without restriction. | |
457 | This special exception was added by the Free Software Foundation | |
458 | in version 1.24 of Bison. */ | |
459 | ||
460 | #ifndef alloca | |
461 | #ifdef __GNUC__ | |
462 | #define alloca __builtin_alloca | |
463 | #else /* not GNU C. */ | |
464 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) | |
465 | #include <alloca.h> | |
466 | #else /* not sparc */ | |
467 | #if defined (MSDOS) && !defined (__TURBOC__) | |
468 | #else /* not MSDOS, or __TURBOC__ */ | |
469 | #if defined(_AIX) | |
470 | #pragma alloca | |
471 | #else /* not MSDOS, __TURBOC__, or _AIX */ | |
472 | #ifdef __hpux | |
473 | #ifdef __cplusplus | |
474 | extern "C" { | |
475 | void *alloca (unsigned int); | |
476 | }; | |
477 | #else /* not __cplusplus */ | |
478 | void *alloca (); | |
479 | #endif /* not __cplusplus */ | |
480 | #endif /* __hpux */ | |
481 | #endif /* not _AIX */ | |
482 | #endif /* not MSDOS, or __TURBOC__ */ | |
483 | #endif /* not sparc. */ | |
484 | #endif /* not GNU C. */ | |
485 | #endif /* alloca not defined. */ | |
486 | ||
487 | /* This is the parser code that is written into each bison parser | |
488 | when the %semantic_parser declaration is not specified in the grammar. | |
489 | It was written by Richard Stallman by simplifying the hairy parser | |
490 | used when %semantic_parser is specified. */ | |
491 | ||
492 | /* Note: there must be only one dollar sign in this file. | |
493 | It is replaced by the list of actions, each action | |
494 | as one case of the switch. */ | |
495 | ||
496 | #define yyerrok (yyerrstatus = 0) | |
497 | #define yyclearin (yychar = YYEMPTY) | |
498 | #define YYEMPTY -2 | |
499 | #define YYEOF 0 | |
500 | #define YYACCEPT return(0) | |
501 | #define YYABORT return(1) | |
502 | #define YYERROR goto yyerrlab1 | |
503 | /* Like YYERROR except do call yyerror. | |
504 | This remains here temporarily to ease the | |
505 | transition to the new meaning of YYERROR, for GCC. | |
506 | Once GCC version 2 has supplanted version 1, this can go. */ | |
507 | #define YYFAIL goto yyerrlab | |
508 | #define YYRECOVERING() (!!yyerrstatus) | |
509 | #define YYBACKUP(token, value) \ | |
510 | do \ | |
511 | if (yychar == YYEMPTY && yylen == 1) \ | |
512 | { yychar = (token), yylval = (value); \ | |
513 | yychar1 = YYTRANSLATE (yychar); \ | |
514 | YYPOPSTACK; \ | |
515 | goto yybackup; \ | |
516 | } \ | |
517 | else \ | |
518 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
519 | while (0) | |
520 | ||
521 | #define YYTERROR 1 | |
522 | #define YYERRCODE 256 | |
523 | ||
524 | #ifndef YYPURE | |
525 | #define YYLEX yylex() | |
526 | #endif | |
527 | ||
528 | #ifdef YYPURE | |
529 | #ifdef YYLSP_NEEDED | |
530 | #ifdef YYLEX_PARAM | |
531 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
532 | #else | |
533 | #define YYLEX yylex(&yylval, &yylloc) | |
534 | #endif | |
535 | #else /* not YYLSP_NEEDED */ | |
536 | #ifdef YYLEX_PARAM | |
537 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
538 | #else | |
539 | #define YYLEX yylex(&yylval) | |
540 | #endif | |
541 | #endif /* not YYLSP_NEEDED */ | |
542 | #endif | |
543 | ||
544 | /* If nonreentrant, generate the variables here */ | |
545 | ||
546 | #ifndef YYPURE | |
547 | ||
548 | int yychar; /* the lookahead symbol */ | |
549 | YYSTYPE yylval; /* the semantic value of the */ | |
550 | /* lookahead symbol */ | |
551 | ||
552 | #ifdef YYLSP_NEEDED | |
553 | YYLTYPE yylloc; /* location data for the lookahead */ | |
554 | /* symbol */ | |
555 | #endif | |
556 | ||
557 | int yynerrs; /* number of parse errors so far */ | |
558 | #endif /* not YYPURE */ | |
559 | ||
560 | #if YYDEBUG != 0 | |
561 | int yydebug; /* nonzero means print parse trace */ | |
562 | /* Since this is uninitialized, it does not stop multiple parsers | |
563 | from coexisting. */ | |
564 | #endif | |
565 | ||
566 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
567 | ||
568 | #ifndef YYINITDEPTH | |
569 | #define YYINITDEPTH 200 | |
570 | #endif | |
571 | ||
572 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
573 | (effective only if the built-in stack extension method is used). */ | |
574 | ||
575 | #if YYMAXDEPTH == 0 | |
576 | #undef YYMAXDEPTH | |
577 | #endif | |
578 | ||
579 | #ifndef YYMAXDEPTH | |
580 | #define YYMAXDEPTH 10000 | |
581 | #endif | |
582 | ||
583 | /* Prevent warning if -Wstrict-prototypes. */ | |
584 | #ifdef __GNUC__ | |
585 | int yyparse (void); | |
586 | #endif | |
587 | \f | |
588 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | |
589 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) | |
590 | #else /* not GNU C or C++ */ | |
591 | #ifndef __cplusplus | |
592 | ||
593 | /* This is the most reliable way to avoid incompatibilities | |
594 | in available built-in functions on various systems. */ | |
595 | static void | |
596 | __yy_memcpy (to, from, count) | |
597 | char *to; | |
598 | char *from; | |
599 | int count; | |
600 | { | |
601 | register char *f = from; | |
602 | register char *t = to; | |
603 | register int i = count; | |
604 | ||
605 | while (i-- > 0) | |
606 | *t++ = *f++; | |
607 | } | |
608 | ||
609 | #else /* __cplusplus */ | |
610 | ||
611 | /* This is the most reliable way to avoid incompatibilities | |
612 | in available built-in functions on various systems. */ | |
613 | static void | |
614 | __yy_memcpy (char *to, char *from, int count) | |
615 | { | |
616 | register char *f = from; | |
617 | register char *t = to; | |
618 | register int i = count; | |
619 | ||
620 | while (i-- > 0) | |
621 | *t++ = *f++; | |
622 | } | |
623 | ||
624 | #endif | |
625 | #endif | |
626 | \f | |
627 | #line 196 "/stone/jimb/main-98r2/share/bison.simple" | |
628 | ||
629 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
630 | into yyparse. The argument should have type void *. | |
631 | It should actually point to an object. | |
632 | Grammar actions can access the variable by casting it | |
633 | to the proper pointer type. */ | |
634 | ||
635 | #ifdef YYPARSE_PARAM | |
636 | #ifdef __cplusplus | |
637 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
638 | #define YYPARSE_PARAM_DECL | |
639 | #else /* not __cplusplus */ | |
640 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
641 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
642 | #endif /* not __cplusplus */ | |
643 | #else /* not YYPARSE_PARAM */ | |
644 | #define YYPARSE_PARAM_ARG | |
645 | #define YYPARSE_PARAM_DECL | |
646 | #endif /* not YYPARSE_PARAM */ | |
647 | ||
648 | int | |
649 | yyparse(YYPARSE_PARAM_ARG) | |
650 | YYPARSE_PARAM_DECL | |
651 | { | |
652 | register int yystate; | |
653 | register int yyn; | |
654 | register short *yyssp; | |
655 | register YYSTYPE *yyvsp; | |
656 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
657 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ | |
658 | ||
659 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
660 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
661 | ||
662 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
663 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to xreallocate them elsewhere */ | |
664 | ||
665 | #ifdef YYLSP_NEEDED | |
666 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
667 | YYLTYPE *yyls = yylsa; | |
668 | YYLTYPE *yylsp; | |
669 | ||
670 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
671 | #else | |
672 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
673 | #endif | |
674 | ||
675 | int yystacksize = YYINITDEPTH; | |
676 | ||
677 | #ifdef YYPURE | |
678 | int yychar; | |
679 | YYSTYPE yylval; | |
680 | int yynerrs; | |
681 | #ifdef YYLSP_NEEDED | |
682 | YYLTYPE yylloc; | |
683 | #endif | |
684 | #endif | |
685 | ||
686 | YYSTYPE yyval; /* the variable used to return */ | |
687 | /* semantic values from the action */ | |
688 | /* routines */ | |
689 | ||
690 | int yylen; | |
691 | ||
692 | #if YYDEBUG != 0 | |
693 | if (yydebug) | |
694 | fprintf(stderr, "Starting parse\n"); | |
695 | #endif | |
696 | ||
697 | yystate = 0; | |
698 | yyerrstatus = 0; | |
699 | yynerrs = 0; | |
700 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
701 | ||
702 | /* Initialize stack pointers. | |
703 | Waste one element of value and location stack | |
704 | so that they stay on the same level as the state stack. | |
705 | The wasted elements are never initialized. */ | |
706 | ||
707 | yyssp = yyss - 1; | |
708 | yyvsp = yyvs; | |
709 | #ifdef YYLSP_NEEDED | |
710 | yylsp = yyls; | |
711 | #endif | |
712 | ||
713 | /* Push a new state, which is found in yystate . */ | |
714 | /* In all cases, when you get here, the value and location stacks | |
715 | have just been pushed. so pushing a state here evens the stacks. */ | |
716 | yynewstate: | |
717 | ||
718 | *++yyssp = yystate; | |
719 | ||
720 | if (yyssp >= yyss + yystacksize - 1) | |
721 | { | |
722 | /* Give user a chance to xreallocate the stack */ | |
723 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
724 | YYSTYPE *yyvs1 = yyvs; | |
725 | short *yyss1 = yyss; | |
726 | #ifdef YYLSP_NEEDED | |
727 | YYLTYPE *yyls1 = yyls; | |
728 | #endif | |
729 | ||
730 | /* Get the current used size of the three stacks, in elements. */ | |
731 | int size = yyssp - yyss + 1; | |
732 | ||
733 | #ifdef yyoverflow | |
734 | /* Each stack pointer address is followed by the size of | |
735 | the data in use in that stack, in bytes. */ | |
736 | #ifdef YYLSP_NEEDED | |
737 | /* This used to be a conditional around just the two extra args, | |
738 | but that might be undefined if yyoverflow is a macro. */ | |
739 | yyoverflow("parser stack overflow", | |
740 | &yyss1, size * sizeof (*yyssp), | |
741 | &yyvs1, size * sizeof (*yyvsp), | |
742 | &yyls1, size * sizeof (*yylsp), | |
743 | &yystacksize); | |
744 | #else | |
745 | yyoverflow("parser stack overflow", | |
746 | &yyss1, size * sizeof (*yyssp), | |
747 | &yyvs1, size * sizeof (*yyvsp), | |
748 | &yystacksize); | |
749 | #endif | |
750 | ||
751 | yyss = yyss1; yyvs = yyvs1; | |
752 | #ifdef YYLSP_NEEDED | |
753 | yyls = yyls1; | |
754 | #endif | |
755 | #else /* no yyoverflow */ | |
756 | /* Extend the stack our own way. */ | |
757 | if (yystacksize >= YYMAXDEPTH) | |
758 | { | |
759 | yyerror("parser stack overflow"); | |
760 | return 2; | |
761 | } | |
762 | yystacksize *= 2; | |
763 | if (yystacksize > YYMAXDEPTH) | |
764 | yystacksize = YYMAXDEPTH; | |
765 | yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); | |
766 | __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); | |
767 | yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); | |
768 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); | |
769 | #ifdef YYLSP_NEEDED | |
770 | yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); | |
771 | __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); | |
772 | #endif | |
773 | #endif /* no yyoverflow */ | |
774 | ||
775 | yyssp = yyss + size - 1; | |
776 | yyvsp = yyvs + size - 1; | |
777 | #ifdef YYLSP_NEEDED | |
778 | yylsp = yyls + size - 1; | |
779 | #endif | |
780 | ||
781 | #if YYDEBUG != 0 | |
782 | if (yydebug) | |
783 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
784 | #endif | |
785 | ||
786 | if (yyssp >= yyss + yystacksize - 1) | |
787 | YYABORT; | |
788 | } | |
789 | ||
790 | #if YYDEBUG != 0 | |
791 | if (yydebug) | |
792 | fprintf(stderr, "Entering state %d\n", yystate); | |
793 | #endif | |
794 | ||
795 | goto yybackup; | |
796 | yybackup: | |
797 | ||
798 | /* Do appropriate processing given the current state. */ | |
799 | /* Read a lookahead token if we need one and don't already have one. */ | |
800 | /* yyresume: */ | |
801 | ||
802 | /* First try to decide what to do without reference to lookahead token. */ | |
803 | ||
804 | yyn = yypact[yystate]; | |
805 | if (yyn == YYFLAG) | |
806 | goto yydefault; | |
807 | ||
808 | /* Not known => get a lookahead token if don't already have one. */ | |
809 | ||
810 | /* yychar is either YYEMPTY or YYEOF | |
811 | or a valid token in external form. */ | |
812 | ||
813 | if (yychar == YYEMPTY) | |
814 | { | |
815 | #if YYDEBUG != 0 | |
816 | if (yydebug) | |
817 | fprintf(stderr, "Reading a token: "); | |
818 | #endif | |
819 | yychar = YYLEX; | |
820 | } | |
821 | ||
822 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
823 | ||
824 | if (yychar <= 0) /* This means end of input. */ | |
825 | { | |
826 | yychar1 = 0; | |
827 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
828 | ||
829 | #if YYDEBUG != 0 | |
830 | if (yydebug) | |
831 | fprintf(stderr, "Now at end of input.\n"); | |
832 | #endif | |
833 | } | |
834 | else | |
835 | { | |
836 | yychar1 = YYTRANSLATE(yychar); | |
837 | ||
838 | #if YYDEBUG != 0 | |
839 | if (yydebug) | |
840 | { | |
841 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
842 | /* Give the individual parser a way to print the precise meaning | |
843 | of a token, for further debugging info. */ | |
844 | #ifdef YYPRINT | |
845 | YYPRINT (stderr, yychar, yylval); | |
846 | #endif | |
847 | fprintf (stderr, ")\n"); | |
848 | } | |
849 | #endif | |
850 | } | |
851 | ||
852 | yyn += yychar1; | |
853 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
854 | goto yydefault; | |
855 | ||
856 | yyn = yytable[yyn]; | |
857 | ||
858 | /* yyn is what to do for this token type in this state. | |
859 | Negative => reduce, -yyn is rule number. | |
860 | Positive => shift, yyn is new state. | |
861 | New state is final state => don't bother to shift, | |
862 | just return success. | |
863 | 0, or most negative number => error. */ | |
864 | ||
865 | if (yyn < 0) | |
866 | { | |
867 | if (yyn == YYFLAG) | |
868 | goto yyerrlab; | |
869 | yyn = -yyn; | |
870 | goto yyreduce; | |
871 | } | |
872 | else if (yyn == 0) | |
873 | goto yyerrlab; | |
874 | ||
875 | if (yyn == YYFINAL) | |
876 | YYACCEPT; | |
877 | ||
878 | /* Shift the lookahead token. */ | |
879 | ||
880 | #if YYDEBUG != 0 | |
881 | if (yydebug) | |
882 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
883 | #endif | |
884 | ||
885 | /* Discard the token being shifted unless it is eof. */ | |
886 | if (yychar != YYEOF) | |
887 | yychar = YYEMPTY; | |
888 | ||
889 | *++yyvsp = yylval; | |
890 | #ifdef YYLSP_NEEDED | |
891 | *++yylsp = yylloc; | |
892 | #endif | |
893 | ||
894 | /* count tokens shifted since error; after three, turn off error status. */ | |
895 | if (yyerrstatus) yyerrstatus--; | |
896 | ||
897 | yystate = yyn; | |
898 | goto yynewstate; | |
899 | ||
900 | /* Do the default action for the current state. */ | |
901 | yydefault: | |
902 | ||
903 | yyn = yydefact[yystate]; | |
904 | if (yyn == 0) | |
905 | goto yyerrlab; | |
906 | ||
907 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
908 | yyreduce: | |
909 | yylen = yyr2[yyn]; | |
910 | if (yylen > 0) | |
911 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
912 | ||
913 | #if YYDEBUG != 0 | |
914 | if (yydebug) | |
915 | { | |
916 | int i; | |
917 | ||
918 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
919 | yyn, yyrline[yyn]); | |
920 | ||
921 | /* Print the symbols being reduced, and their result. */ | |
922 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
923 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
924 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
925 | } | |
926 | #endif | |
927 | ||
928 | ||
929 | switch (yyn) { | |
930 | ||
931 | case 3: | |
932 | #line 226 "f-exp.y" | |
933 | { write_exp_elt_opcode(OP_TYPE); | |
934 | write_exp_elt_type(yyvsp[0].tval); | |
935 | write_exp_elt_opcode(OP_TYPE); ; | |
936 | break;} | |
937 | case 4: | |
938 | #line 232 "f-exp.y" | |
939 | { ; | |
940 | break;} | |
941 | case 5: | |
942 | #line 237 "f-exp.y" | |
943 | { write_exp_elt_opcode (UNOP_IND); ; | |
944 | break;} | |
945 | case 6: | |
946 | #line 240 "f-exp.y" | |
947 | { write_exp_elt_opcode (UNOP_ADDR); ; | |
948 | break;} | |
949 | case 7: | |
950 | #line 243 "f-exp.y" | |
951 | { write_exp_elt_opcode (UNOP_NEG); ; | |
952 | break;} | |
953 | case 8: | |
954 | #line 247 "f-exp.y" | |
955 | { write_exp_elt_opcode (UNOP_LOGICAL_NOT); ; | |
956 | break;} | |
957 | case 9: | |
958 | #line 251 "f-exp.y" | |
959 | { write_exp_elt_opcode (UNOP_COMPLEMENT); ; | |
960 | break;} | |
961 | case 10: | |
962 | #line 255 "f-exp.y" | |
963 | { write_exp_elt_opcode (UNOP_SIZEOF); ; | |
964 | break;} | |
965 | case 11: | |
966 | #line 264 "f-exp.y" | |
967 | { start_arglist (); ; | |
968 | break;} | |
969 | case 12: | |
970 | #line 266 "f-exp.y" | |
971 | { write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); | |
972 | write_exp_elt_longcst ((LONGEST) end_arglist ()); | |
973 | write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); ; | |
974 | break;} | |
975 | case 14: | |
976 | #line 275 "f-exp.y" | |
977 | { arglist_len = 1; ; | |
978 | break;} | |
979 | case 15: | |
980 | #line 279 "f-exp.y" | |
981 | { arglist_len = 2;; | |
982 | break;} | |
983 | case 16: | |
984 | #line 282 "f-exp.y" | |
985 | { arglist_len++; ; | |
986 | break;} | |
987 | case 17: | |
988 | #line 286 "f-exp.y" | |
989 | { ; | |
990 | break;} | |
991 | case 18: | |
992 | #line 291 "f-exp.y" | |
993 | { ; | |
994 | break;} | |
995 | case 19: | |
996 | #line 295 "f-exp.y" | |
997 | { write_exp_elt_opcode(OP_COMPLEX); ; | |
998 | break;} | |
999 | case 20: | |
1000 | #line 299 "f-exp.y" | |
1001 | { write_exp_elt_opcode (UNOP_CAST); | |
1002 | write_exp_elt_type (yyvsp[-2].tval); | |
1003 | write_exp_elt_opcode (UNOP_CAST); ; | |
1004 | break;} | |
1005 | case 21: | |
1006 | #line 307 "f-exp.y" | |
1007 | { write_exp_elt_opcode (BINOP_REPEAT); ; | |
1008 | break;} | |
1009 | case 22: | |
1010 | #line 311 "f-exp.y" | |
1011 | { write_exp_elt_opcode (BINOP_MUL); ; | |
1012 | break;} | |
1013 | case 23: | |
1014 | #line 315 "f-exp.y" | |
1015 | { write_exp_elt_opcode (BINOP_DIV); ; | |
1016 | break;} | |
1017 | case 24: | |
1018 | #line 319 "f-exp.y" | |
1019 | { write_exp_elt_opcode (BINOP_REM); ; | |
1020 | break;} | |
1021 | case 25: | |
1022 | #line 323 "f-exp.y" | |
1023 | { write_exp_elt_opcode (BINOP_ADD); ; | |
1024 | break;} | |
1025 | case 26: | |
1026 | #line 327 "f-exp.y" | |
1027 | { write_exp_elt_opcode (BINOP_SUB); ; | |
1028 | break;} | |
1029 | case 27: | |
1030 | #line 331 "f-exp.y" | |
1031 | { write_exp_elt_opcode (BINOP_LSH); ; | |
1032 | break;} | |
1033 | case 28: | |
1034 | #line 335 "f-exp.y" | |
1035 | { write_exp_elt_opcode (BINOP_RSH); ; | |
1036 | break;} | |
1037 | case 29: | |
1038 | #line 339 "f-exp.y" | |
1039 | { write_exp_elt_opcode (BINOP_EQUAL); ; | |
1040 | break;} | |
1041 | case 30: | |
1042 | #line 343 "f-exp.y" | |
1043 | { write_exp_elt_opcode (BINOP_NOTEQUAL); ; | |
1044 | break;} | |
1045 | case 31: | |
1046 | #line 347 "f-exp.y" | |
1047 | { write_exp_elt_opcode (BINOP_LEQ); ; | |
1048 | break;} | |
1049 | case 32: | |
1050 | #line 351 "f-exp.y" | |
1051 | { write_exp_elt_opcode (BINOP_GEQ); ; | |
1052 | break;} | |
1053 | case 33: | |
1054 | #line 355 "f-exp.y" | |
1055 | { write_exp_elt_opcode (BINOP_LESS); ; | |
1056 | break;} | |
1057 | case 34: | |
1058 | #line 359 "f-exp.y" | |
1059 | { write_exp_elt_opcode (BINOP_GTR); ; | |
1060 | break;} | |
1061 | case 35: | |
1062 | #line 363 "f-exp.y" | |
1063 | { write_exp_elt_opcode (BINOP_BITWISE_AND); ; | |
1064 | break;} | |
1065 | case 36: | |
1066 | #line 367 "f-exp.y" | |
1067 | { write_exp_elt_opcode (BINOP_BITWISE_XOR); ; | |
1068 | break;} | |
1069 | case 37: | |
1070 | #line 371 "f-exp.y" | |
1071 | { write_exp_elt_opcode (BINOP_BITWISE_IOR); ; | |
1072 | break;} | |
1073 | case 38: | |
1074 | #line 375 "f-exp.y" | |
1075 | { write_exp_elt_opcode (BINOP_LOGICAL_AND); ; | |
1076 | break;} | |
1077 | case 39: | |
1078 | #line 380 "f-exp.y" | |
1079 | { write_exp_elt_opcode (BINOP_LOGICAL_OR); ; | |
1080 | break;} | |
1081 | case 40: | |
1082 | #line 384 "f-exp.y" | |
1083 | { write_exp_elt_opcode (BINOP_ASSIGN); ; | |
1084 | break;} | |
1085 | case 41: | |
1086 | #line 388 "f-exp.y" | |
1087 | { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); | |
1088 | write_exp_elt_opcode (yyvsp[-1].opcode); | |
1089 | write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ; | |
1090 | break;} | |
1091 | case 42: | |
1092 | #line 394 "f-exp.y" | |
1093 | { write_exp_elt_opcode (OP_LONG); | |
1094 | write_exp_elt_type (yyvsp[0].typed_val.type); | |
1095 | write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val)); | |
1096 | write_exp_elt_opcode (OP_LONG); ; | |
1097 | break;} | |
1098 | case 43: | |
1099 | #line 401 "f-exp.y" | |
1100 | { YYSTYPE val; | |
1101 | parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val); | |
1102 | write_exp_elt_opcode (OP_LONG); | |
1103 | write_exp_elt_type (val.typed_val.type); | |
1104 | write_exp_elt_longcst ((LONGEST)val.typed_val.val); | |
1105 | write_exp_elt_opcode (OP_LONG); ; | |
1106 | break;} | |
1107 | case 44: | |
1108 | #line 410 "f-exp.y" | |
1109 | { write_exp_elt_opcode (OP_DOUBLE); | |
1110 | write_exp_elt_type (builtin_type_f_real_s8); | |
1111 | write_exp_elt_dblcst (yyvsp[0].dval); | |
1112 | write_exp_elt_opcode (OP_DOUBLE); ; | |
1113 | break;} | |
1114 | case 47: | |
1115 | #line 423 "f-exp.y" | |
1116 | { write_exp_elt_opcode (OP_LONG); | |
1117 | write_exp_elt_type (builtin_type_f_integer); | |
1118 | CHECK_TYPEDEF (yyvsp[-1].tval); | |
1119 | write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval)); | |
1120 | write_exp_elt_opcode (OP_LONG); ; | |
1121 | break;} | |
1122 | case 48: | |
1123 | #line 431 "f-exp.y" | |
1124 | { write_exp_elt_opcode (OP_BOOL); | |
1125 | write_exp_elt_longcst ((LONGEST) yyvsp[0].lval); | |
1126 | write_exp_elt_opcode (OP_BOOL); | |
1127 | ; | |
1128 | break;} | |
1129 | case 49: | |
1130 | #line 438 "f-exp.y" | |
1131 | { | |
1132 | write_exp_elt_opcode (OP_STRING); | |
1133 | write_exp_string (yyvsp[0].sval); | |
1134 | write_exp_elt_opcode (OP_STRING); | |
1135 | ; | |
1136 | break;} | |
1137 | case 50: | |
1138 | #line 446 "f-exp.y" | |
1139 | { struct symbol *sym = yyvsp[0].ssym.sym; | |
1140 | ||
1141 | if (sym) | |
1142 | { | |
1143 | if (symbol_read_needs_frame (sym)) | |
1144 | { | |
1145 | if (innermost_block == 0 || | |
1146 | contained_in (block_found, | |
1147 | innermost_block)) | |
1148 | innermost_block = block_found; | |
1149 | } | |
1150 | write_exp_elt_opcode (OP_VAR_VALUE); | |
1151 | /* We want to use the selected frame, not | |
1152 | another more inner frame which happens to | |
1153 | be in the same block. */ | |
1154 | write_exp_elt_block (NULL); | |
1155 | write_exp_elt_sym (sym); | |
1156 | write_exp_elt_opcode (OP_VAR_VALUE); | |
1157 | break; | |
1158 | } | |
1159 | else | |
1160 | { | |
1161 | struct minimal_symbol *msymbol; | |
1162 | register char *arg = copy_name (yyvsp[0].ssym.stoken); | |
1163 | ||
1164 | msymbol = | |
1165 | lookup_minimal_symbol (arg, NULL, NULL); | |
1166 | if (msymbol != NULL) | |
1167 | { | |
1168 | write_exp_msymbol (msymbol, | |
1169 | lookup_function_type (builtin_type_int), | |
1170 | builtin_type_int); | |
1171 | } | |
1172 | else if (!have_full_symbols () && !have_partial_symbols ()) | |
1173 | error ("No symbol table is loaded. Use the \"file\" command."); | |
1174 | else | |
1175 | error ("No symbol \"%s\" in current context.", | |
1176 | copy_name (yyvsp[0].ssym.stoken)); | |
1177 | } | |
1178 | ; | |
1179 | break;} | |
1180 | case 53: | |
1181 | #line 494 "f-exp.y" | |
1182 | { | |
1183 | /* This is where the interesting stuff happens. */ | |
1184 | int done = 0; | |
1185 | int array_size; | |
1186 | struct type *follow_type = yyvsp[-1].tval; | |
1187 | struct type *range_type; | |
1188 | ||
1189 | while (!done) | |
1190 | switch (pop_type ()) | |
1191 | { | |
1192 | case tp_end: | |
1193 | done = 1; | |
1194 | break; | |
1195 | case tp_pointer: | |
1196 | follow_type = lookup_pointer_type (follow_type); | |
1197 | break; | |
1198 | case tp_reference: | |
1199 | follow_type = lookup_reference_type (follow_type); | |
1200 | break; | |
1201 | case tp_array: | |
1202 | array_size = pop_type_int (); | |
1203 | if (array_size != -1) | |
1204 | { | |
1205 | range_type = | |
1206 | create_range_type ((struct type *) NULL, | |
1207 | builtin_type_f_integer, 0, | |
1208 | array_size - 1); | |
1209 | follow_type = | |
1210 | create_array_type ((struct type *) NULL, | |
1211 | follow_type, range_type); | |
1212 | } | |
1213 | else | |
1214 | follow_type = lookup_pointer_type (follow_type); | |
1215 | break; | |
1216 | case tp_function: | |
1217 | follow_type = lookup_function_type (follow_type); | |
1218 | break; | |
1219 | } | |
1220 | yyval.tval = follow_type; | |
1221 | ; | |
1222 | break;} | |
1223 | case 54: | |
1224 | #line 537 "f-exp.y" | |
1225 | { push_type (tp_pointer); yyval.voidval = 0; ; | |
1226 | break;} | |
1227 | case 55: | |
1228 | #line 539 "f-exp.y" | |
1229 | { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ; | |
1230 | break;} | |
1231 | case 56: | |
1232 | #line 541 "f-exp.y" | |
1233 | { push_type (tp_reference); yyval.voidval = 0; ; | |
1234 | break;} | |
1235 | case 57: | |
1236 | #line 543 "f-exp.y" | |
1237 | { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ; | |
1238 | break;} | |
1239 | case 59: | |
1240 | #line 548 "f-exp.y" | |
1241 | { yyval.voidval = yyvsp[-1].voidval; ; | |
1242 | break;} | |
1243 | case 60: | |
1244 | #line 550 "f-exp.y" | |
1245 | { push_type (tp_function); ; | |
1246 | break;} | |
1247 | case 61: | |
1248 | #line 552 "f-exp.y" | |
1249 | { push_type (tp_function); ; | |
1250 | break;} | |
1251 | case 62: | |
1252 | #line 556 "f-exp.y" | |
1253 | { yyval.voidval = 0; ; | |
1254 | break;} | |
1255 | case 63: | |
1256 | #line 558 "f-exp.y" | |
1257 | { free ((PTR)yyvsp[-1].tvec); yyval.voidval = 0; ; | |
1258 | break;} | |
1259 | case 64: | |
1260 | #line 563 "f-exp.y" | |
1261 | { yyval.tval = yyvsp[0].tsym.type; ; | |
1262 | break;} | |
1263 | case 65: | |
1264 | #line 565 "f-exp.y" | |
1265 | { yyval.tval = builtin_type_f_integer; ; | |
1266 | break;} | |
1267 | case 66: | |
1268 | #line 567 "f-exp.y" | |
1269 | { yyval.tval = builtin_type_f_integer_s2; ; | |
1270 | break;} | |
1271 | case 67: | |
1272 | #line 569 "f-exp.y" | |
1273 | { yyval.tval = builtin_type_f_character; ; | |
1274 | break;} | |
1275 | case 68: | |
1276 | #line 571 "f-exp.y" | |
1277 | { yyval.tval = builtin_type_f_logical;; | |
1278 | break;} | |
1279 | case 69: | |
1280 | #line 573 "f-exp.y" | |
1281 | { yyval.tval = builtin_type_f_logical_s2;; | |
1282 | break;} | |
1283 | case 70: | |
1284 | #line 575 "f-exp.y" | |
1285 | { yyval.tval = builtin_type_f_logical_s1;; | |
1286 | break;} | |
1287 | case 71: | |
1288 | #line 577 "f-exp.y" | |
1289 | { yyval.tval = builtin_type_f_real;; | |
1290 | break;} | |
1291 | case 72: | |
1292 | #line 579 "f-exp.y" | |
1293 | { yyval.tval = builtin_type_f_real_s8;; | |
1294 | break;} | |
1295 | case 73: | |
1296 | #line 581 "f-exp.y" | |
1297 | { yyval.tval = builtin_type_f_real_s16;; | |
1298 | break;} | |
1299 | case 74: | |
1300 | #line 583 "f-exp.y" | |
1301 | { yyval.tval = builtin_type_f_complex_s8;; | |
1302 | break;} | |
1303 | case 75: | |
1304 | #line 585 "f-exp.y" | |
1305 | { yyval.tval = builtin_type_f_complex_s16;; | |
1306 | break;} | |
1307 | case 76: | |
1308 | #line 587 "f-exp.y" | |
1309 | { yyval.tval = builtin_type_f_complex_s32;; | |
1310 | break;} | |
1311 | case 78: | |
1312 | #line 595 "f-exp.y" | |
1313 | { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2); | |
1314 | yyval.ivec[0] = 1; /* Number of types in vector */ | |
1315 | yyval.tvec[1] = yyvsp[0].tval; | |
1316 | ; | |
1317 | break;} | |
1318 | case 79: | |
1319 | #line 600 "f-exp.y" | |
1320 | { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1); | |
1321 | yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len); | |
1322 | yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval; | |
1323 | ; | |
1324 | break;} | |
1325 | case 80: | |
1326 | #line 607 "f-exp.y" | |
1327 | { yyval.sval = yyvsp[0].ssym.stoken; ; | |
1328 | break;} | |
1329 | case 81: | |
1330 | #line 609 "f-exp.y" | |
1331 | { yyval.sval = yyvsp[0].tsym.stoken; ; | |
1332 | break;} | |
1333 | case 82: | |
1334 | #line 611 "f-exp.y" | |
1335 | { yyval.sval = yyvsp[0].ssym.stoken; ; | |
1336 | break;} | |
1337 | } | |
1338 | /* the action file gets copied in in place of this dollarsign */ | |
1339 | #line 498 "/stone/jimb/main-98r2/share/bison.simple" | |
1340 | \f | |
1341 | yyvsp -= yylen; | |
1342 | yyssp -= yylen; | |
1343 | #ifdef YYLSP_NEEDED | |
1344 | yylsp -= yylen; | |
1345 | #endif | |
1346 | ||
1347 | #if YYDEBUG != 0 | |
1348 | if (yydebug) | |
1349 | { | |
1350 | short *ssp1 = yyss - 1; | |
1351 | fprintf (stderr, "state stack now"); | |
1352 | while (ssp1 != yyssp) | |
1353 | fprintf (stderr, " %d", *++ssp1); | |
1354 | fprintf (stderr, "\n"); | |
1355 | } | |
1356 | #endif | |
1357 | ||
1358 | *++yyvsp = yyval; | |
1359 | ||
1360 | #ifdef YYLSP_NEEDED | |
1361 | yylsp++; | |
1362 | if (yylen == 0) | |
1363 | { | |
1364 | yylsp->first_line = yylloc.first_line; | |
1365 | yylsp->first_column = yylloc.first_column; | |
1366 | yylsp->last_line = (yylsp-1)->last_line; | |
1367 | yylsp->last_column = (yylsp-1)->last_column; | |
1368 | yylsp->text = 0; | |
1369 | } | |
1370 | else | |
1371 | { | |
1372 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
1373 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
1374 | } | |
1375 | #endif | |
1376 | ||
1377 | /* Now "shift" the result of the reduction. | |
1378 | Determine what state that goes to, | |
1379 | based on the state we popped back to | |
1380 | and the rule number reduced by. */ | |
1381 | ||
1382 | yyn = yyr1[yyn]; | |
1383 | ||
1384 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
1385 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
1386 | yystate = yytable[yystate]; | |
1387 | else | |
1388 | yystate = yydefgoto[yyn - YYNTBASE]; | |
1389 | ||
1390 | goto yynewstate; | |
1391 | ||
1392 | yyerrlab: /* here on detecting error */ | |
1393 | ||
1394 | if (! yyerrstatus) | |
1395 | /* If not already recovering from an error, report this error. */ | |
1396 | { | |
1397 | ++yynerrs; | |
1398 | ||
1399 | #ifdef YYERROR_VERBOSE | |
1400 | yyn = yypact[yystate]; | |
1401 | ||
1402 | if (yyn > YYFLAG && yyn < YYLAST) | |
1403 | { | |
1404 | int size = 0; | |
1405 | char *msg; | |
1406 | int x, count; | |
1407 | ||
1408 | count = 0; | |
1409 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
1410 | for (x = (yyn < 0 ? -yyn : 0); | |
1411 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
1412 | if (yycheck[x + yyn] == x) | |
1413 | size += strlen(yytname[x]) + 15, count++; | |
1414 | msg = (char *) xmalloc(size + 15); | |
1415 | if (msg != 0) | |
1416 | { | |
1417 | strcpy(msg, "parse error"); | |
1418 | ||
1419 | if (count < 5) | |
1420 | { | |
1421 | count = 0; | |
1422 | for (x = (yyn < 0 ? -yyn : 0); | |
1423 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
1424 | if (yycheck[x + yyn] == x) | |
1425 | { | |
1426 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
1427 | strcat(msg, yytname[x]); | |
1428 | strcat(msg, "'"); | |
1429 | count++; | |
1430 | } | |
1431 | } | |
1432 | yyerror(msg); | |
1433 | free(msg); | |
1434 | } | |
1435 | else | |
1436 | yyerror ("parse error; also virtual memory exceeded"); | |
1437 | } | |
1438 | else | |
1439 | #endif /* YYERROR_VERBOSE */ | |
1440 | yyerror("parse error"); | |
1441 | } | |
1442 | ||
1443 | goto yyerrlab1; | |
1444 | yyerrlab1: /* here on error raised explicitly by an action */ | |
1445 | ||
1446 | if (yyerrstatus == 3) | |
1447 | { | |
1448 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
1449 | ||
1450 | /* return failure if at end of input */ | |
1451 | if (yychar == YYEOF) | |
1452 | YYABORT; | |
1453 | ||
1454 | #if YYDEBUG != 0 | |
1455 | if (yydebug) | |
1456 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
1457 | #endif | |
1458 | ||
1459 | yychar = YYEMPTY; | |
1460 | } | |
1461 | ||
1462 | /* Else will try to reuse lookahead token | |
1463 | after shifting the error token. */ | |
1464 | ||
1465 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
1466 | ||
1467 | goto yyerrhandle; | |
1468 | ||
1469 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
1470 | ||
1471 | #if 0 | |
1472 | /* This is wrong; only states that explicitly want error tokens | |
1473 | should shift them. */ | |
1474 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
1475 | if (yyn) goto yydefault; | |
1476 | #endif | |
1477 | ||
1478 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
1479 | ||
1480 | if (yyssp == yyss) YYABORT; | |
1481 | yyvsp--; | |
1482 | yystate = *--yyssp; | |
1483 | #ifdef YYLSP_NEEDED | |
1484 | yylsp--; | |
1485 | #endif | |
1486 | ||
1487 | #if YYDEBUG != 0 | |
1488 | if (yydebug) | |
1489 | { | |
1490 | short *ssp1 = yyss - 1; | |
1491 | fprintf (stderr, "Error: state stack now"); | |
1492 | while (ssp1 != yyssp) | |
1493 | fprintf (stderr, " %d", *++ssp1); | |
1494 | fprintf (stderr, "\n"); | |
1495 | } | |
1496 | #endif | |
1497 | ||
1498 | yyerrhandle: | |
1499 | ||
1500 | yyn = yypact[yystate]; | |
1501 | if (yyn == YYFLAG) | |
1502 | goto yyerrdefault; | |
1503 | ||
1504 | yyn += YYTERROR; | |
1505 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
1506 | goto yyerrdefault; | |
1507 | ||
1508 | yyn = yytable[yyn]; | |
1509 | if (yyn < 0) | |
1510 | { | |
1511 | if (yyn == YYFLAG) | |
1512 | goto yyerrpop; | |
1513 | yyn = -yyn; | |
1514 | goto yyreduce; | |
1515 | } | |
1516 | else if (yyn == 0) | |
1517 | goto yyerrpop; | |
1518 | ||
1519 | if (yyn == YYFINAL) | |
1520 | YYACCEPT; | |
1521 | ||
1522 | #if YYDEBUG != 0 | |
1523 | if (yydebug) | |
1524 | fprintf(stderr, "Shifting error token, "); | |
1525 | #endif | |
1526 | ||
1527 | *++yyvsp = yylval; | |
1528 | #ifdef YYLSP_NEEDED | |
1529 | *++yylsp = yylloc; | |
1530 | #endif | |
1531 | ||
1532 | yystate = yyn; | |
1533 | goto yynewstate; | |
1534 | } | |
1535 | #line 624 "f-exp.y" | |
1536 | ||
1537 | ||
1538 | /* Take care of parsing a number (anything that starts with a digit). | |
1539 | Set yylval and return the token type; update lexptr. | |
1540 | LEN is the number of characters in it. */ | |
1541 | ||
1542 | /*** Needs some error checking for the float case ***/ | |
1543 | ||
1544 | static int | |
1545 | parse_number (p, len, parsed_float, putithere) | |
1546 | register char *p; | |
1547 | register int len; | |
1548 | int parsed_float; | |
1549 | YYSTYPE *putithere; | |
1550 | { | |
1551 | register LONGEST n = 0; | |
1552 | register LONGEST prevn = 0; | |
1553 | register int i; | |
1554 | register int c; | |
1555 | register int base = input_radix; | |
1556 | int unsigned_p = 0; | |
1557 | int long_p = 0; | |
1558 | ULONGEST high_bit; | |
1559 | struct type *signed_type; | |
1560 | struct type *unsigned_type; | |
1561 | ||
1562 | if (parsed_float) | |
1563 | { | |
1564 | /* It's a float since it contains a point or an exponent. */ | |
1565 | /* [dD] is not understood as an exponent by atof, change it to 'e'. */ | |
1566 | char *tmp, *tmp2; | |
1567 | ||
1568 | tmp = strsave (p); | |
1569 | for (tmp2 = tmp; *tmp2; ++tmp2) | |
1570 | if (*tmp2 == 'd' || *tmp2 == 'D') | |
1571 | *tmp2 = 'e'; | |
1572 | putithere->dval = atof (tmp); | |
1573 | free (tmp); | |
1574 | return FLOAT; | |
1575 | } | |
1576 | ||
1577 | /* Handle base-switching prefixes 0x, 0t, 0d, 0 */ | |
1578 | if (p[0] == '0') | |
1579 | switch (p[1]) | |
1580 | { | |
1581 | case 'x': | |
1582 | case 'X': | |
1583 | if (len >= 3) | |
1584 | { | |
1585 | p += 2; | |
1586 | base = 16; | |
1587 | len -= 2; | |
1588 | } | |
1589 | break; | |
1590 | ||
1591 | case 't': | |
1592 | case 'T': | |
1593 | case 'd': | |
1594 | case 'D': | |
1595 | if (len >= 3) | |
1596 | { | |
1597 | p += 2; | |
1598 | base = 10; | |
1599 | len -= 2; | |
1600 | } | |
1601 | break; | |
1602 | ||
1603 | default: | |
1604 | base = 8; | |
1605 | break; | |
1606 | } | |
1607 | ||
1608 | while (len-- > 0) | |
1609 | { | |
1610 | c = *p++; | |
1611 | if (c >= 'A' && c <= 'Z') | |
1612 | c += 'a' - 'A'; | |
1613 | if (c != 'l' && c != 'u') | |
1614 | n *= base; | |
1615 | if (c >= '0' && c <= '9') | |
1616 | n += i = c - '0'; | |
1617 | else | |
1618 | { | |
1619 | if (base > 10 && c >= 'a' && c <= 'f') | |
1620 | n += i = c - 'a' + 10; | |
1621 | else if (len == 0 && c == 'l') | |
1622 | long_p = 1; | |
1623 | else if (len == 0 && c == 'u') | |
1624 | unsigned_p = 1; | |
1625 | else | |
1626 | return ERROR; /* Char not a digit */ | |
1627 | } | |
1628 | if (i >= base) | |
1629 | return ERROR; /* Invalid digit in this base */ | |
1630 | ||
1631 | /* Portably test for overflow (only works for nonzero values, so make | |
1632 | a second check for zero). */ | |
1633 | if ((prevn >= n) && n != 0) | |
1634 | unsigned_p=1; /* Try something unsigned */ | |
1635 | /* If range checking enabled, portably test for unsigned overflow. */ | |
1636 | if (RANGE_CHECK && n != 0) | |
1637 | { | |
1638 | if ((unsigned_p && (unsigned)prevn >= (unsigned)n)) | |
1639 | range_error("Overflow on numeric constant."); | |
1640 | } | |
1641 | prevn = n; | |
1642 | } | |
1643 | ||
1644 | /* If the number is too big to be an int, or it's got an l suffix | |
1645 | then it's a long. Work out if this has to be a long by | |
1646 | shifting right and and seeing if anything remains, and the | |
1647 | target int size is different to the target long size. | |
1648 | ||
1649 | In the expression below, we could have tested | |
1650 | (n >> TARGET_INT_BIT) | |
1651 | to see if it was zero, | |
1652 | but too many compilers warn about that, when ints and longs | |
1653 | are the same size. So we shift it twice, with fewer bits | |
1654 | each time, for the same result. */ | |
1655 | ||
1656 | if ((TARGET_INT_BIT != TARGET_LONG_BIT | |
1657 | && ((n >> 2) >> (TARGET_INT_BIT-2))) /* Avoid shift warning */ | |
1658 | || long_p) | |
1659 | { | |
1660 | high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1); | |
1661 | unsigned_type = builtin_type_unsigned_long; | |
1662 | signed_type = builtin_type_long; | |
1663 | } | |
1664 | else | |
1665 | { | |
1666 | high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1); | |
1667 | unsigned_type = builtin_type_unsigned_int; | |
1668 | signed_type = builtin_type_int; | |
1669 | } | |
1670 | ||
1671 | putithere->typed_val.val = n; | |
1672 | ||
1673 | /* If the high bit of the worked out type is set then this number | |
1674 | has to be unsigned. */ | |
1675 | ||
1676 | if (unsigned_p || (n & high_bit)) | |
1677 | putithere->typed_val.type = unsigned_type; | |
1678 | else | |
1679 | putithere->typed_val.type = signed_type; | |
1680 | ||
1681 | return INT; | |
1682 | } | |
1683 | ||
1684 | struct token | |
1685 | { | |
1686 | char *operator; | |
1687 | int token; | |
1688 | enum exp_opcode opcode; | |
1689 | }; | |
1690 | ||
1691 | static const struct token dot_ops[] = | |
1692 | { | |
1693 | { ".and.", BOOL_AND, BINOP_END }, | |
1694 | { ".AND.", BOOL_AND, BINOP_END }, | |
1695 | { ".or.", BOOL_OR, BINOP_END }, | |
1696 | { ".OR.", BOOL_OR, BINOP_END }, | |
1697 | { ".not.", BOOL_NOT, BINOP_END }, | |
1698 | { ".NOT.", BOOL_NOT, BINOP_END }, | |
1699 | { ".eq.", EQUAL, BINOP_END }, | |
1700 | { ".EQ.", EQUAL, BINOP_END }, | |
1701 | { ".eqv.", EQUAL, BINOP_END }, | |
1702 | { ".NEQV.", NOTEQUAL, BINOP_END }, | |
1703 | { ".neqv.", NOTEQUAL, BINOP_END }, | |
1704 | { ".EQV.", EQUAL, BINOP_END }, | |
1705 | { ".ne.", NOTEQUAL, BINOP_END }, | |
1706 | { ".NE.", NOTEQUAL, BINOP_END }, | |
1707 | { ".le.", LEQ, BINOP_END }, | |
1708 | { ".LE.", LEQ, BINOP_END }, | |
1709 | { ".ge.", GEQ, BINOP_END }, | |
1710 | { ".GE.", GEQ, BINOP_END }, | |
1711 | { ".gt.", GREATERTHAN, BINOP_END }, | |
1712 | { ".GT.", GREATERTHAN, BINOP_END }, | |
1713 | { ".lt.", LESSTHAN, BINOP_END }, | |
1714 | { ".LT.", LESSTHAN, BINOP_END }, | |
1715 | { NULL, 0, 0 } | |
1716 | }; | |
1717 | ||
1718 | struct f77_boolean_val | |
1719 | { | |
1720 | char *name; | |
1721 | int value; | |
1722 | }; | |
1723 | ||
1724 | static const struct f77_boolean_val boolean_values[] = | |
1725 | { | |
1726 | { ".true.", 1 }, | |
1727 | { ".TRUE.", 1 }, | |
1728 | { ".false.", 0 }, | |
1729 | { ".FALSE.", 0 }, | |
1730 | { NULL, 0 } | |
1731 | }; | |
1732 | ||
1733 | static const struct token f77_keywords[] = | |
1734 | { | |
1735 | { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END }, | |
1736 | { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END }, | |
1737 | { "character", CHARACTER, BINOP_END }, | |
1738 | { "integer_2", INT_S2_KEYWORD, BINOP_END }, | |
1739 | { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END }, | |
1740 | { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END }, | |
1741 | { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END }, | |
1742 | { "integer", INT_KEYWORD, BINOP_END }, | |
1743 | { "logical", LOGICAL_KEYWORD, BINOP_END }, | |
1744 | { "real_16", REAL_S16_KEYWORD, BINOP_END }, | |
1745 | { "complex", COMPLEX_S8_KEYWORD, BINOP_END }, | |
1746 | { "sizeof", SIZEOF, BINOP_END }, | |
1747 | { "real_8", REAL_S8_KEYWORD, BINOP_END }, | |
1748 | { "real", REAL_KEYWORD, BINOP_END }, | |
1749 | { NULL, 0, 0 } | |
1750 | }; | |
1751 | ||
1752 | /* Implementation of a dynamically expandable buffer for processing input | |
1753 | characters acquired through lexptr and building a value to return in | |
1754 | yylval. Ripped off from ch-exp.y */ | |
1755 | ||
1756 | static char *tempbuf; /* Current buffer contents */ | |
1757 | static int tempbufsize; /* Size of allocated buffer */ | |
1758 | static int tempbufindex; /* Current index into buffer */ | |
1759 | ||
1760 | #define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */ | |
1761 | ||
1762 | #define CHECKBUF(size) \ | |
1763 | do { \ | |
1764 | if (tempbufindex + (size) >= tempbufsize) \ | |
1765 | { \ | |
1766 | growbuf_by_size (size); \ | |
1767 | } \ | |
1768 | } while (0); | |
1769 | ||
1770 | ||
1771 | /* Grow the static temp buffer if necessary, including allocating the first one | |
1772 | on demand. */ | |
1773 | ||
1774 | static void | |
1775 | growbuf_by_size (count) | |
1776 | int count; | |
1777 | { | |
1778 | int growby; | |
1779 | ||
1780 | growby = max (count, GROWBY_MIN_SIZE); | |
1781 | tempbufsize += growby; | |
1782 | if (tempbuf == NULL) | |
1783 | tempbuf = (char *) xmalloc (tempbufsize); | |
1784 | else | |
1785 | tempbuf = (char *) xrealloc (tempbuf, tempbufsize); | |
1786 | } | |
1787 | ||
1788 | /* Blatantly ripped off from ch-exp.y. This routine recognizes F77 | |
1789 | string-literals. | |
1790 | ||
1791 | Recognize a string literal. A string literal is a nonzero sequence | |
1792 | of characters enclosed in matching single quotes, except that | |
1793 | a single character inside single quotes is a character literal, which | |
1794 | we reject as a string literal. To embed the terminator character inside | |
1795 | a string, it is simply doubled (I.E. 'this''is''one''string') */ | |
1796 | ||
1797 | static int | |
1798 | match_string_literal () | |
1799 | { | |
1800 | char *tokptr = lexptr; | |
1801 | ||
1802 | for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++) | |
1803 | { | |
1804 | CHECKBUF (1); | |
1805 | if (*tokptr == *lexptr) | |
1806 | { | |
1807 | if (*(tokptr + 1) == *lexptr) | |
1808 | tokptr++; | |
1809 | else | |
1810 | break; | |
1811 | } | |
1812 | tempbuf[tempbufindex++] = *tokptr; | |
1813 | } | |
1814 | if (*tokptr == '\0' /* no terminator */ | |
1815 | || tempbufindex == 0) /* no string */ | |
1816 | return 0; | |
1817 | else | |
1818 | { | |
1819 | tempbuf[tempbufindex] = '\0'; | |
1820 | yylval.sval.ptr = tempbuf; | |
1821 | yylval.sval.length = tempbufindex; | |
1822 | lexptr = ++tokptr; | |
1823 | return STRING_LITERAL; | |
1824 | } | |
1825 | } | |
1826 | ||
1827 | /* Read one token, getting characters through lexptr. */ | |
1828 | ||
1829 | static int | |
1830 | yylex () | |
1831 | { | |
1832 | int c; | |
1833 | int namelen; | |
1834 | unsigned int i,token; | |
1835 | char *tokstart; | |
1836 | ||
1837 | retry: | |
1838 | ||
1839 | tokstart = lexptr; | |
1840 | ||
1841 | /* First of all, let us make sure we are not dealing with the | |
1842 | special tokens .true. and .false. which evaluate to 1 and 0. */ | |
1843 | ||
1844 | if (*lexptr == '.') | |
1845 | { | |
1846 | for (i = 0; boolean_values[i].name != NULL; i++) | |
1847 | { | |
1848 | if STREQN (tokstart, boolean_values[i].name, | |
1849 | strlen (boolean_values[i].name)) | |
1850 | { | |
1851 | lexptr += strlen (boolean_values[i].name); | |
1852 | yylval.lval = boolean_values[i].value; | |
1853 | return BOOLEAN_LITERAL; | |
1854 | } | |
1855 | } | |
1856 | } | |
1857 | ||
1858 | /* See if it is a special .foo. operator */ | |
1859 | ||
1860 | for (i = 0; dot_ops[i].operator != NULL; i++) | |
1861 | if (STREQN (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator))) | |
1862 | { | |
1863 | lexptr += strlen (dot_ops[i].operator); | |
1864 | yylval.opcode = dot_ops[i].opcode; | |
1865 | return dot_ops[i].token; | |
1866 | } | |
1867 | ||
1868 | switch (c = *tokstart) | |
1869 | { | |
1870 | case 0: | |
1871 | return 0; | |
1872 | ||
1873 | case ' ': | |
1874 | case '\t': | |
1875 | case '\n': | |
1876 | lexptr++; | |
1877 | goto retry; | |
1878 | ||
1879 | case '\'': | |
1880 | token = match_string_literal (); | |
1881 | if (token != 0) | |
1882 | return (token); | |
1883 | break; | |
1884 | ||
1885 | case '(': | |
1886 | paren_depth++; | |
1887 | lexptr++; | |
1888 | return c; | |
1889 | ||
1890 | case ')': | |
1891 | if (paren_depth == 0) | |
1892 | return 0; | |
1893 | paren_depth--; | |
1894 | lexptr++; | |
1895 | return c; | |
1896 | ||
1897 | case ',': | |
1898 | if (comma_terminates && paren_depth == 0) | |
1899 | return 0; | |
1900 | lexptr++; | |
1901 | return c; | |
1902 | ||
1903 | case '.': | |
1904 | /* Might be a floating point number. */ | |
1905 | if (lexptr[1] < '0' || lexptr[1] > '9') | |
1906 | goto symbol; /* Nope, must be a symbol. */ | |
1907 | /* FALL THRU into number case. */ | |
1908 | ||
1909 | case '0': | |
1910 | case '1': | |
1911 | case '2': | |
1912 | case '3': | |
1913 | case '4': | |
1914 | case '5': | |
1915 | case '6': | |
1916 | case '7': | |
1917 | case '8': | |
1918 | case '9': | |
1919 | { | |
1920 | /* It's a number. */ | |
1921 | int got_dot = 0, got_e = 0, got_d = 0, toktype; | |
1922 | register char *p = tokstart; | |
1923 | int hex = input_radix > 10; | |
1924 | ||
1925 | if (c == '0' && (p[1] == 'x' || p[1] == 'X')) | |
1926 | { | |
1927 | p += 2; | |
1928 | hex = 1; | |
1929 | } | |
1930 | else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D')) | |
1931 | { | |
1932 | p += 2; | |
1933 | hex = 0; | |
1934 | } | |
1935 | ||
1936 | for (;; ++p) | |
1937 | { | |
1938 | if (!hex && !got_e && (*p == 'e' || *p == 'E')) | |
1939 | got_dot = got_e = 1; | |
1940 | else if (!hex && !got_d && (*p == 'd' || *p == 'D')) | |
1941 | got_dot = got_d = 1; | |
1942 | else if (!hex && !got_dot && *p == '.') | |
1943 | got_dot = 1; | |
1944 | else if (((got_e && (p[-1] == 'e' || p[-1] == 'E')) | |
1945 | || (got_d && (p[-1] == 'd' || p[-1] == 'D'))) | |
1946 | && (*p == '-' || *p == '+')) | |
1947 | /* This is the sign of the exponent, not the end of the | |
1948 | number. */ | |
1949 | continue; | |
1950 | /* We will take any letters or digits. parse_number will | |
1951 | complain if past the radix, or if L or U are not final. */ | |
1952 | else if ((*p < '0' || *p > '9') | |
1953 | && ((*p < 'a' || *p > 'z') | |
1954 | && (*p < 'A' || *p > 'Z'))) | |
1955 | break; | |
1956 | } | |
1957 | toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d, | |
1958 | &yylval); | |
1959 | if (toktype == ERROR) | |
1960 | { | |
1961 | char *err_copy = (char *) alloca (p - tokstart + 1); | |
1962 | ||
1963 | memcpy (err_copy, tokstart, p - tokstart); | |
1964 | err_copy[p - tokstart] = 0; | |
1965 | error ("Invalid number \"%s\".", err_copy); | |
1966 | } | |
1967 | lexptr = p; | |
1968 | return toktype; | |
1969 | } | |
1970 | ||
1971 | case '+': | |
1972 | case '-': | |
1973 | case '*': | |
1974 | case '/': | |
1975 | case '%': | |
1976 | case '|': | |
1977 | case '&': | |
1978 | case '^': | |
1979 | case '~': | |
1980 | case '!': | |
1981 | case '@': | |
1982 | case '<': | |
1983 | case '>': | |
1984 | case '[': | |
1985 | case ']': | |
1986 | case '?': | |
1987 | case ':': | |
1988 | case '=': | |
1989 | case '{': | |
1990 | case '}': | |
1991 | symbol: | |
1992 | lexptr++; | |
1993 | return c; | |
1994 | } | |
1995 | ||
1996 | if (!(c == '_' || c == '$' | |
1997 | || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) | |
1998 | /* We must have come across a bad character (e.g. ';'). */ | |
1999 | error ("Invalid character '%c' in expression.", c); | |
2000 | ||
2001 | namelen = 0; | |
2002 | for (c = tokstart[namelen]; | |
2003 | (c == '_' || c == '$' || (c >= '0' && c <= '9') | |
2004 | || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); | |
2005 | c = tokstart[++namelen]); | |
2006 | ||
2007 | /* The token "if" terminates the expression and is NOT | |
2008 | removed from the input stream. */ | |
2009 | ||
2010 | if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f') | |
2011 | return 0; | |
2012 | ||
2013 | lexptr += namelen; | |
2014 | ||
2015 | /* Catch specific keywords. */ | |
2016 | ||
2017 | for (i = 0; f77_keywords[i].operator != NULL; i++) | |
2018 | if (STREQN(tokstart, f77_keywords[i].operator, | |
2019 | strlen(f77_keywords[i].operator))) | |
2020 | { | |
2021 | /* lexptr += strlen(f77_keywords[i].operator); */ | |
2022 | yylval.opcode = f77_keywords[i].opcode; | |
2023 | return f77_keywords[i].token; | |
2024 | } | |
2025 | ||
2026 | yylval.sval.ptr = tokstart; | |
2027 | yylval.sval.length = namelen; | |
2028 | ||
2029 | if (*tokstart == '$') | |
2030 | { | |
2031 | write_dollar_variable (yylval.sval); | |
2032 | return VARIABLE; | |
2033 | } | |
2034 | ||
2035 | /* Use token-type TYPENAME for symbols that happen to be defined | |
2036 | currently as names of types; NAME for other symbols. | |
2037 | The caller is not constrained to care about the distinction. */ | |
2038 | { | |
2039 | char *tmp = copy_name (yylval.sval); | |
2040 | struct symbol *sym; | |
2041 | int is_a_field_of_this = 0; | |
2042 | int hextype; | |
2043 | ||
2044 | sym = lookup_symbol (tmp, expression_context_block, | |
2045 | VAR_NAMESPACE, | |
2046 | current_language->la_language == language_cplus | |
2047 | ? &is_a_field_of_this : NULL, | |
2048 | NULL); | |
2049 | if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF) | |
2050 | { | |
2051 | yylval.tsym.type = SYMBOL_TYPE (sym); | |
2052 | return TYPENAME; | |
2053 | } | |
2054 | if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0) | |
2055 | return TYPENAME; | |
2056 | ||
2057 | /* Input names that aren't symbols but ARE valid hex numbers, | |
2058 | when the input radix permits them, can be names or numbers | |
2059 | depending on the parse. Note we support radixes > 16 here. */ | |
2060 | if (!sym | |
2061 | && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) | |
2062 | || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10))) | |
2063 | { | |
2064 | YYSTYPE newlval; /* Its value is ignored. */ | |
2065 | hextype = parse_number (tokstart, namelen, 0, &newlval); | |
2066 | if (hextype == INT) | |
2067 | { | |
2068 | yylval.ssym.sym = sym; | |
2069 | yylval.ssym.is_a_field_of_this = is_a_field_of_this; | |
2070 | return NAME_OR_INT; | |
2071 | } | |
2072 | } | |
2073 | ||
2074 | /* Any other kind of symbol */ | |
2075 | yylval.ssym.sym = sym; | |
2076 | yylval.ssym.is_a_field_of_this = is_a_field_of_this; | |
2077 | return NAME; | |
2078 | } | |
2079 | } | |
2080 | ||
2081 | void | |
2082 | yyerror (msg) | |
2083 | char *msg; | |
2084 | { | |
2085 | error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr); | |
2086 | } |