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