]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | ** Inserted at beginning of c files generated by bison | |
3 | ** REMEMBER: Change bison.reset too. | |
4 | */ | |
5 | ||
6 | /*@-allmacros@*/ | |
7 | /*@+boolint@*/ | |
8 | /*@+charint@*/ | |
9 | /*@-macroparams@*/ | |
10 | /*@-macroundef@*/ | |
11 | /*@-unreachable@*/ | |
12 | /*@-macrospec@*/ | |
13 | /*@-varuse@*/ | |
14 | /*@+ignorequals@*/ | |
15 | /*@-macrostmt@*/ | |
16 | /*@-noeffect@*/ | |
17 | /*@-shadow@*/ | |
18 | /*@-exitarg@*/ | |
19 | /*@-macroredef@*/ | |
20 | /*@-uniondef@*/ | |
21 | /*@-compdef@*/ | |
22 | /*@-matchfields@*/ | |
23 | /*@-exportlocal@*/ | |
24 | /*@-evalorderuncon@*/ | |
25 | /*@-exportheader@*/ | |
26 | /*@-typeuse@*/ | |
27 | /*@-redecl@*/ | |
28 | /*@-redef@*/ | |
29 | /*@-noparams@*/ | |
30 | /*@-ansireserved@*/ | |
31 | /*@-fielduse@*/ | |
32 | /*@-ifblock@*/ | |
33 | /*@-elseifcomplete@*/ | |
34 | /*@-whileblock@*/ | |
35 | /*@-forblock@*/ | |
36 | /*@-branchstate@*/ | |
37 | /*@-readonlytrans@*/ | |
38 | /*@-namechecks@*/ | |
39 | /*@-usedef@*/ | |
40 | /*@-systemunrecog@*/ | |
41 | /*@-dependenttrans@*/ | |
42 | /*@-unqualifiedtrans@*/ | |
43 | /*@-nullassign@*/ | |
44 | /*@-nullpass@*/ | |
45 | /*@-nullptrarith*/ | |
46 | /*@-usereleased@*/ | |
47 | /*@-declundef@*/ | |
48 | ||
49 | /*drl added 11/27/2001*/ | |
50 | /*@-bounds@*/ | |
51 | /* < end of bison.head > */ | |
52 | ||
53 | ||
54 | /* A Bison parser, made from signature.y | |
55 | by GNU Bison version 1.28 */ | |
56 | ||
57 | #define YYBISON 1 /* Identify Bison output. */ | |
58 | ||
59 | #define yyparse lslparse | |
60 | #define yylex lsllex | |
61 | #define yyerror lslerror | |
62 | #define yylval lsllval | |
63 | #define yychar lslchar | |
64 | #define yydebug lsldebug | |
65 | #define yynerrs lslnerrs | |
66 | #define LST_SIMPLEID 257 | |
67 | #define LST_LOGICALOP 258 | |
68 | #define LST_EQOP 259 | |
69 | #define LST_SIMPLEOP 260 | |
70 | #define LST_MAPSYM 261 | |
71 | #define LST_FIELDMAPSYM 262 | |
72 | #define LST_MARKERSYM 263 | |
73 | #define LST_ifTOKEN 264 | |
74 | #define LST_thenTOKEN 265 | |
75 | #define LST_elseTOKEN 266 | |
76 | #define LST_LBRACKET 267 | |
77 | #define LST_RBRACKET 268 | |
78 | #define LST_SELECTSYM 269 | |
79 | #define LST_SEPSYM 270 | |
80 | #define LST_OPENSYM 271 | |
81 | #define LST_CLOSESYM 272 | |
82 | #define LST_COLON 273 | |
83 | #define LST_COMMA 274 | |
84 | #define LST_EOL 275 | |
85 | #define LST_COMMENTSYM 276 | |
86 | #define LST_WHITESPACE 277 | |
87 | #define LST_QUANTIFIERSYM 278 | |
88 | #define LST_EQUATIONSYM 279 | |
89 | #define LST_EQSEPSYM 280 | |
90 | #define LST_COMPOSESYM 281 | |
91 | #define LST_LPAR 282 | |
92 | #define LST_RPAR 283 | |
93 | #define LST_assertsTOKEN 284 | |
94 | #define LST_assumesTOKEN 285 | |
95 | #define LST_byTOKEN 286 | |
96 | #define LST_convertsTOKEN 287 | |
97 | #define LST_enumerationTOKEN 288 | |
98 | #define LST_equationsTOKEN 289 | |
99 | #define LST_exemptingTOKEN 290 | |
100 | #define LST_forTOKEN 291 | |
101 | #define LST_generatedTOKEN 292 | |
102 | #define LST_impliesTOKEN 293 | |
103 | #define LST_includesTOKEN 294 | |
104 | #define LST_introducesTOKEN 295 | |
105 | #define LST_ofTOKEN 296 | |
106 | #define LST_partitionedTOKEN 297 | |
107 | #define LST_traitTOKEN 298 | |
108 | #define LST_tupleTOKEN 299 | |
109 | #define LST_unionTOKEN 300 | |
110 | #define LST_BADTOKEN 301 | |
111 | ||
112 | ||
113 | ||
114 | # include <stdio.h> | |
115 | # include "splintMacros.nf" | |
116 | # include "llbasic.h" | |
117 | # include "lslparse.h" | |
118 | # include "signature.h" | |
119 | ||
120 | static void lslerror (char *); | |
121 | extern int lsllex (); | |
122 | ||
123 | /*@dependent@*/ /*@null@*/ lslOp importedlslOp; | |
124 | ||
125 | /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ | |
126 | static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); | |
127 | /*@=noparams@*/ | |
128 | ||
129 | # define YYPRINT(file, type, value) yyprint (file, type, value) | |
130 | ||
131 | # define YYDEBUG 1 | |
132 | ||
133 | /*@-redef@*/ | |
134 | /*@-readonlytrans@*/ | |
135 | /*@-nullassign@*/ | |
136 | ||
137 | ||
138 | typedef union { | |
139 | ltoken ltok; /* a leaf is also an ltoken */ | |
140 | unsigned int count; | |
141 | /*@only@*/ ltokenList ltokenList; | |
142 | /*@only@*/ opFormNode opform; | |
143 | /*@owned@*/ sigNode signature; | |
144 | /*@only@*/ nameNode name; | |
145 | /*@owned@*/ lslOp operator; | |
146 | /*@only@*/ lslOpList operators; | |
147 | /*@-redef@*/ /*@-matchfields@*/ | |
148 | } YYSTYPE; | |
149 | #ifndef YYDEBUG | |
150 | #define YYDEBUG 1 | |
151 | #endif | |
152 | ||
153 | #include <stdio.h> | |
154 | ||
155 | #ifndef __cplusplus | |
156 | #ifndef __STDC__ | |
157 | #define const | |
158 | #endif | |
159 | #endif | |
160 | ||
161 | ||
162 | ||
163 | #define YYFINAL 62 | |
164 | #define YYFLAG -32768 | |
165 | #define YYNTBASE 48 | |
166 | ||
167 | #define YYTRANSLATE(x) ((unsigned)(x) <= 301 ? yytranslate[x] : 62) | |
168 | ||
169 | static const char yytranslate[] = { 0, | |
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, 2, 2, 2, 2, 2, 2, 2, | |
173 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
174 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
175 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
176 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
177 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
178 | 2, 2, 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, 2, 2, 2, 2, 2, | |
189 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
190 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
191 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
192 | 2, 2, 2, 2, 2, 2, 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, 1, 3, 4, 5, 6, | |
196 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | |
197 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, | |
198 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, | |
199 | 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, | |
200 | 47 | |
201 | }; | |
202 | ||
203 | #if YYDEBUG != 0 | |
204 | static const short yyprhs[] = { 0, | |
205 | 0, 2, 4, 7, 11, 13, 15, 22, 24, 27, | |
206 | 30, 34, 38, 43, 48, 54, 58, 63, 68, 74, | |
207 | 77, 81, 85, 87, 89, 91, 92, 94, 96, 100, | |
208 | 102, 104, 108, 109, 111, 113, 117, 119 | |
209 | }; | |
210 | ||
211 | static const short yyrhs[] = { 49, | |
212 | 0, 50, 0, 49, 50, 0, 51, 19, 57, 0, | |
213 | 61, 0, 52, 0, 10, 9, 11, 9, 12, 9, | |
214 | 0, 53, 0, 9, 53, 0, 53, 9, 0, 9, | |
215 | 53, 9, 0, 17, 54, 18, 0, 9, 17, 54, | |
216 | 18, 0, 17, 54, 18, 9, 0, 9, 17, 54, | |
217 | 18, 9, 0, 13, 54, 14, 0, 9, 13, 54, | |
218 | 14, 0, 13, 54, 14, 9, 0, 9, 13, 54, | |
219 | 14, 9, 0, 15, 3, 0, 9, 15, 3, 0, | |
220 | 9, 8, 3, 0, 6, 0, 4, 0, 5, 0, | |
221 | 0, 55, 0, 9, 0, 55, 56, 9, 0, 20, | |
222 | 0, 16, 0, 58, 7, 60, 0, 0, 59, 0, | |
223 | 60, 0, 59, 20, 60, 0, 3, 0, 3, 0 | |
224 | }; | |
225 | ||
226 | #endif | |
227 | ||
228 | #if YYDEBUG != 0 | |
229 | static const short yyrline[] = { 0, | |
230 | 139, 141, 146, 150, 156, 158, 162, 164, 166, 168, | |
231 | 170, 172, 174, 176, 178, 181, 184, 187, 190, 193, | |
232 | 196, 201, 206, 208, 210, 213, 215, 218, 220, 223, | |
233 | 225, 228, 231, 233, 236, 238, 241, 247 | |
234 | }; | |
235 | #endif | |
236 | ||
237 | ||
238 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | |
239 | ||
240 | static const char * const yytname[] = { "$","error","$undefined.","LST_SIMPLEID", | |
241 | "LST_LOGICALOP","LST_EQOP","LST_SIMPLEOP","LST_MAPSYM","LST_FIELDMAPSYM","LST_MARKERSYM", | |
242 | "LST_ifTOKEN","LST_thenTOKEN","LST_elseTOKEN","LST_LBRACKET","LST_RBRACKET", | |
243 | "LST_SELECTSYM","LST_SEPSYM","LST_OPENSYM","LST_CLOSESYM","LST_COLON","LST_COMMA", | |
244 | "LST_EOL","LST_COMMENTSYM","LST_WHITESPACE","LST_QUANTIFIERSYM","LST_EQUATIONSYM", | |
245 | "LST_EQSEPSYM","LST_COMPOSESYM","LST_LPAR","LST_RPAR","LST_assertsTOKEN","LST_assumesTOKEN", | |
246 | "LST_byTOKEN","LST_convertsTOKEN","LST_enumerationTOKEN","LST_equationsTOKEN", | |
247 | "LST_exemptingTOKEN","LST_forTOKEN","LST_generatedTOKEN","LST_impliesTOKEN", | |
248 | "LST_includesTOKEN","LST_introducesTOKEN","LST_ofTOKEN","LST_partitionedTOKEN", | |
249 | "LST_traitTOKEN","LST_tupleTOKEN","LST_unionTOKEN","LST_BADTOKEN","top","operatorList", | |
250 | "operator","name","opForm","anyOp","middle","placeList","separator","signature", | |
251 | "domain","sortList","sortId","opId", NULL | |
252 | }; | |
253 | #endif | |
254 | ||
255 | static const short yyr1[] = { 0, | |
256 | 48, 49, 49, 50, 51, 51, 52, 52, 52, 52, | |
257 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | |
258 | 52, 52, 53, 53, 53, 54, 54, 55, 55, 56, | |
259 | 56, 57, 58, 58, 59, 59, 60, 61 | |
260 | }; | |
261 | ||
262 | static const short yyr2[] = { 0, | |
263 | 1, 1, 2, 3, 1, 1, 6, 1, 2, 2, | |
264 | 3, 3, 4, 4, 5, 3, 4, 4, 5, 2, | |
265 | 3, 3, 1, 1, 1, 0, 1, 1, 3, 1, | |
266 | 1, 3, 0, 1, 1, 3, 1, 1 | |
267 | }; | |
268 | ||
269 | static const short yydefact[] = { 0, | |
270 | 38, 24, 25, 23, 0, 0, 26, 0, 26, 1, | |
271 | 2, 0, 6, 8, 5, 0, 26, 0, 26, 9, | |
272 | 0, 28, 0, 27, 20, 0, 3, 33, 10, 22, | |
273 | 0, 21, 0, 11, 0, 16, 31, 30, 0, 12, | |
274 | 37, 4, 0, 34, 35, 17, 13, 0, 18, 29, | |
275 | 14, 0, 0, 19, 15, 0, 32, 36, 7, 0, | |
276 | 0, 0 | |
277 | }; | |
278 | ||
279 | static const short yydefgoto[] = { 60, | |
280 | 10, 11, 12, 13, 14, 23, 24, 39, 42, 43, | |
281 | 44, 45, 15 | |
282 | }; | |
283 | ||
284 | static const short yypact[] = { -3, | |
285 | -32768,-32768,-32768,-32768, 11, -4, 0, 8, 0, -3, | |
286 | -32768, -1,-32768, 13,-32768, 17, 0, 22, 0, 18, | |
287 | 20,-32768, 19, -12,-32768, 14,-32768, 31,-32768,-32768, | |
288 | 21,-32768, 23,-32768, 27, 28,-32768,-32768, 29, 30, | |
289 | -32768,-32768, 33, 24,-32768, 34, 36, 35,-32768,-32768, | |
290 | -32768, 31, 31,-32768,-32768, 37,-32768,-32768,-32768, 42, | |
291 | 48,-32768 | |
292 | }; | |
293 | ||
294 | static const short yypgoto[] = {-32768, | |
295 | -32768, 39,-32768,-32768, 45, 4,-32768,-32768,-32768,-32768, | |
296 | -32768, -23,-32768 | |
297 | }; | |
298 | ||
299 | ||
300 | #define YYLAST 50 | |
301 | ||
302 | ||
303 | static const short yytable[] = { 1, | |
304 | 2, 3, 4, 37, 21, 5, 6, 38, 22, 7, | |
305 | 25, 8, 26, 9, 2, 3, 4, 28, 16, 30, | |
306 | 31, 29, 33, 17, 32, 18, 34, 19, 57, 58, | |
307 | 35, 40, 36, 41, 46, 48, 49, 50, 51, 52, | |
308 | 47, 61, 54, 53, 55, 59, 56, 62, 27, 20 | |
309 | }; | |
310 | ||
311 | static const short yycheck[] = { 3, | |
312 | 4, 5, 6, 16, 9, 9, 10, 20, 9, 13, | |
313 | 3, 15, 9, 17, 4, 5, 6, 19, 8, 3, | |
314 | 17, 9, 19, 13, 3, 15, 9, 17, 52, 53, | |
315 | 11, 18, 14, 3, 14, 9, 9, 9, 9, 7, | |
316 | 18, 0, 9, 20, 9, 9, 12, 0, 10, 5 | |
317 | }; | |
318 | #define YYPURE 1 | |
319 | ||
320 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | |
321 | ||
322 | /* This file comes from bison-1.28. */ | |
323 | ||
324 | /* Skeleton output parser for bison, | |
325 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | |
326 | ||
327 | This program is free software; you can redistribute it and/or modify | |
328 | it under the terms of the GNU General Public License as published by | |
329 | the Free Software Foundation; either version 2, or (at your option) | |
330 | any later version. | |
331 | ||
332 | This program is distributed in the hope that it will be useful, | |
333 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
334 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
335 | GNU General Public License for more details. | |
336 | ||
337 | You should have received a copy of the GNU General Public License | |
338 | along with this program; if not, write to the Free Software | |
339 | Foundation, Inc., 59 Temple Place - Suite 330, | |
340 | Boston, MA 02111-1307, USA. */ | |
341 | ||
342 | /* As a special exception, when this file is copied by Bison into a | |
343 | Bison output file, you may use that output file without restriction. | |
344 | This special exception was added by the Free Software Foundation | |
345 | in version 1.24 of Bison. */ | |
346 | ||
347 | /* This is the parser code that is written into each bison parser | |
348 | when the %semantic_parser declaration is not specified in the grammar. | |
349 | It was written by Richard Stallman by simplifying the hairy parser | |
350 | used when %semantic_parser is specified. */ | |
351 | ||
352 | #ifndef YYSTACK_USE_ALLOCA | |
353 | #ifdef alloca | |
354 | #define YYSTACK_USE_ALLOCA | |
355 | #else /* alloca not defined */ | |
356 | #ifdef __GNUC__ | |
357 | #define YYSTACK_USE_ALLOCA | |
358 | #define alloca __builtin_alloca | |
359 | #else /* not GNU C. */ | |
360 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) | |
361 | #define YYSTACK_USE_ALLOCA | |
362 | #include <alloca.h> | |
363 | #else /* not sparc */ | |
364 | /* We think this test detects Watcom and Microsoft C. */ | |
365 | /* This used to test MSDOS, but that is a bad idea | |
366 | since that symbol is in the user namespace. */ | |
367 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | |
368 | #if 0 /* No need for malloc.h, which pollutes the namespace; | |
369 | instead, just don't use alloca. */ | |
370 | #include <malloc.h> | |
371 | #endif | |
372 | #else /* not MSDOS, or __TURBOC__ */ | |
373 | #if defined(_AIX) | |
374 | /* I don't know what this was needed for, but it pollutes the namespace. | |
375 | So I turned it off. rms, 2 May 1997. */ | |
376 | /* #include <malloc.h> */ | |
377 | #pragma alloca | |
378 | #define YYSTACK_USE_ALLOCA | |
379 | #else /* not MSDOS, or __TURBOC__, or _AIX */ | |
380 | #if 0 | |
381 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, | |
382 | and on HPUX 10. Eventually we can turn this on. */ | |
383 | #define YYSTACK_USE_ALLOCA | |
384 | #define alloca __builtin_alloca | |
385 | #endif /* __hpux */ | |
386 | #endif | |
387 | #endif /* not _AIX */ | |
388 | #endif /* not MSDOS, or __TURBOC__ */ | |
389 | #endif /* not sparc */ | |
390 | #endif /* not GNU C */ | |
391 | #endif /* alloca not defined */ | |
392 | #endif /* YYSTACK_USE_ALLOCA not defined */ | |
393 | ||
394 | #ifdef YYSTACK_USE_ALLOCA | |
395 | #define YYSTACK_ALLOC alloca | |
396 | #else | |
397 | #define YYSTACK_ALLOC malloc | |
398 | #endif | |
399 | ||
400 | /* Note: there must be only one dollar sign in this file. | |
401 | It is replaced by the list of actions, each action | |
402 | as one case of the switch. */ | |
403 | ||
404 | #define yyerrok (yyerrstatus = 0) | |
405 | #define yyclearin (yychar = YYEMPTY) | |
406 | #define YYEMPTY -2 | |
407 | #define YYEOF 0 | |
408 | #define YYACCEPT goto yyacceptlab | |
409 | #define YYABORT goto yyabortlab | |
410 | #define YYERROR goto yyerrlab1 | |
411 | /* Like YYERROR except do call yyerror. | |
412 | This remains here temporarily to ease the | |
413 | transition to the new meaning of YYERROR, for GCC. | |
414 | Once GCC version 2 has supplanted version 1, this can go. */ | |
415 | #define YYFAIL goto yyerrlab | |
416 | #define YYRECOVERING() (!!yyerrstatus) | |
417 | #define YYBACKUP(token, value) \ | |
418 | do \ | |
419 | if (yychar == YYEMPTY && yylen == 1) \ | |
420 | { yychar = (token), yylval = (value); \ | |
421 | yychar1 = YYTRANSLATE (yychar); \ | |
422 | YYPOPSTACK; \ | |
423 | goto yybackup; \ | |
424 | } \ | |
425 | else \ | |
426 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
427 | while (0) | |
428 | ||
429 | #define YYTERROR 1 | |
430 | #define YYERRCODE 256 | |
431 | ||
432 | #ifndef YYPURE | |
433 | #define YYLEX yylex() | |
434 | #endif | |
435 | ||
436 | #ifdef YYPURE | |
437 | #ifdef YYLSP_NEEDED | |
438 | #ifdef YYLEX_PARAM | |
439 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
440 | #else | |
441 | #define YYLEX yylex(&yylval, &yylloc) | |
442 | #endif | |
443 | #else /* not YYLSP_NEEDED */ | |
444 | #ifdef YYLEX_PARAM | |
445 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
446 | #else | |
447 | #define YYLEX yylex(&yylval) | |
448 | #endif | |
449 | #endif /* not YYLSP_NEEDED */ | |
450 | #endif | |
451 | ||
452 | /* If nonreentrant, generate the variables here */ | |
453 | ||
454 | #ifndef YYPURE | |
455 | ||
456 | int yychar; /* the lookahead symbol */ | |
457 | YYSTYPE yylval; /* the semantic value of the */ | |
458 | /* lookahead symbol */ | |
459 | ||
460 | #ifdef YYLSP_NEEDED | |
461 | YYLTYPE yylloc; /* location data for the lookahead */ | |
462 | /* symbol */ | |
463 | #endif | |
464 | ||
465 | int yynerrs; /* number of parse errors so far */ | |
466 | #endif /* not YYPURE */ | |
467 | ||
468 | #if YYDEBUG != 0 | |
469 | int yydebug; /* nonzero means print parse trace */ | |
470 | /* Since this is uninitialized, it does not stop multiple parsers | |
471 | from coexisting. */ | |
472 | #endif | |
473 | ||
474 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
475 | ||
476 | #ifndef YYINITDEPTH | |
477 | #define YYINITDEPTH 200 | |
478 | #endif | |
479 | ||
480 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
481 | (effective only if the built-in stack extension method is used). */ | |
482 | ||
483 | #if YYMAXDEPTH == 0 | |
484 | #undef YYMAXDEPTH | |
485 | #endif | |
486 | ||
487 | #ifndef YYMAXDEPTH | |
488 | #define YYMAXDEPTH 10000 | |
489 | #endif | |
490 | \f | |
491 | /* Define __yy_memcpy. Note that the size argument | |
492 | should be passed with type unsigned int, because that is what the non-GCC | |
493 | definitions require. With GCC, __builtin_memcpy takes an arg | |
494 | of type size_t, but it can handle unsigned int. */ | |
495 | ||
496 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | |
497 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) | |
498 | #else /* not GNU C or C++ */ | |
499 | #ifndef __cplusplus | |
500 | ||
501 | /* This is the most reliable way to avoid incompatibilities | |
502 | in available built-in functions on various systems. */ | |
503 | static void | |
504 | __yy_memcpy (to, from, count) | |
505 | char *to; | |
506 | char *from; | |
507 | unsigned int count; | |
508 | { | |
509 | register char *f = from; | |
510 | register char *t = to; | |
511 | register int i = count; | |
512 | ||
513 | while (i-- > 0) | |
514 | *t++ = *f++; | |
515 | } | |
516 | ||
517 | #else /* __cplusplus */ | |
518 | ||
519 | /* This is the most reliable way to avoid incompatibilities | |
520 | in available built-in functions on various systems. */ | |
521 | static void | |
522 | __yy_memcpy (char *to, char *from, unsigned int count) | |
523 | { | |
524 | register char *t = to; | |
525 | register char *f = from; | |
526 | register int i = count; | |
527 | ||
528 | while (i-- > 0) | |
529 | *t++ = *f++; | |
530 | } | |
531 | ||
532 | #endif | |
533 | #endif | |
534 | \f | |
535 | ||
536 | ||
537 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
538 | into yyparse. The argument should have type void *. | |
539 | It should actually point to an object. | |
540 | Grammar actions can access the variable by casting it | |
541 | to the proper pointer type. */ | |
542 | ||
543 | #ifdef YYPARSE_PARAM | |
544 | #ifdef __cplusplus | |
545 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
546 | #define YYPARSE_PARAM_DECL | |
547 | #else /* not __cplusplus */ | |
548 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
549 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | |
550 | #endif /* not __cplusplus */ | |
551 | #else /* not YYPARSE_PARAM */ | |
552 | #define YYPARSE_PARAM_ARG | |
553 | #define YYPARSE_PARAM_DECL | |
554 | #endif /* not YYPARSE_PARAM */ | |
555 | ||
556 | /* Prevent warning if -Wstrict-prototypes. */ | |
557 | #ifdef __GNUC__ | |
558 | #ifdef YYPARSE_PARAM | |
559 | int yyparse (void *); | |
560 | #else | |
561 | int yyparse (void); | |
562 | #endif | |
563 | #endif | |
564 | ||
565 | int | |
566 | yyparse(YYPARSE_PARAM_ARG) | |
567 | YYPARSE_PARAM_DECL | |
568 | { | |
569 | register int yystate; | |
570 | register int yyn; | |
571 | register short *yyssp; | |
572 | register YYSTYPE *yyvsp; | |
573 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
574 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ | |
575 | ||
576 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
577 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
578 | ||
579 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
580 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | |
581 | ||
582 | #ifdef YYLSP_NEEDED | |
583 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
584 | YYLTYPE *yyls = yylsa; | |
585 | YYLTYPE *yylsp; | |
586 | ||
587 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
588 | #else | |
589 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
590 | #endif | |
591 | ||
592 | int yystacksize = YYINITDEPTH; | |
593 | int yyfree_stacks = 0; | |
594 | ||
595 | #ifdef YYPURE | |
596 | int yychar; | |
597 | YYSTYPE yylval; | |
598 | int yynerrs; | |
599 | #ifdef YYLSP_NEEDED | |
600 | YYLTYPE yylloc; | |
601 | #endif | |
602 | #endif | |
603 | ||
604 | YYSTYPE yyval; /* the variable used to return */ | |
605 | /* semantic values from the action */ | |
606 | /* routines */ | |
607 | ||
608 | int yylen; | |
609 | ||
610 | #if YYDEBUG != 0 | |
611 | if (yydebug) | |
612 | fprintf(stderr, "Starting parse\n"); | |
613 | #endif | |
614 | ||
615 | yystate = 0; | |
616 | yyerrstatus = 0; | |
617 | yynerrs = 0; | |
618 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
619 | ||
620 | /* Initialize stack pointers. | |
621 | Waste one element of value and location stack | |
622 | so that they stay on the same level as the state stack. | |
623 | The wasted elements are never initialized. */ | |
624 | ||
625 | yyssp = yyss - 1; | |
626 | yyvsp = yyvs; | |
627 | #ifdef YYLSP_NEEDED | |
628 | yylsp = yyls; | |
629 | #endif | |
630 | ||
631 | /* Push a new state, which is found in yystate . */ | |
632 | /* In all cases, when you get here, the value and location stacks | |
633 | have just been pushed. so pushing a state here evens the stacks. */ | |
634 | yynewstate: | |
635 | ||
636 | *++yyssp = yystate; | |
637 | ||
638 | if (yyssp >= yyss + yystacksize - 1) | |
639 | { | |
640 | /* Give user a chance to reallocate the stack */ | |
641 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
642 | YYSTYPE *yyvs1 = yyvs; | |
643 | short *yyss1 = yyss; | |
644 | #ifdef YYLSP_NEEDED | |
645 | YYLTYPE *yyls1 = yyls; | |
646 | #endif | |
647 | ||
648 | /* Get the current used size of the three stacks, in elements. */ | |
649 | int size = yyssp - yyss + 1; | |
650 | ||
651 | #ifdef yyoverflow | |
652 | /* Each stack pointer address is followed by the size of | |
653 | the data in use in that stack, in bytes. */ | |
654 | #ifdef YYLSP_NEEDED | |
655 | /* This used to be a conditional around just the two extra args, | |
656 | but that might be undefined if yyoverflow is a macro. */ | |
657 | yyoverflow("parser stack overflow", | |
658 | &yyss1, size * sizeof (*yyssp), | |
659 | &yyvs1, size * sizeof (*yyvsp), | |
660 | &yyls1, size * sizeof (*yylsp), | |
661 | &yystacksize); | |
662 | #else | |
663 | yyoverflow("parser stack overflow", | |
664 | &yyss1, size * sizeof (*yyssp), | |
665 | &yyvs1, size * sizeof (*yyvsp), | |
666 | &yystacksize); | |
667 | #endif | |
668 | ||
669 | yyss = yyss1; yyvs = yyvs1; | |
670 | #ifdef YYLSP_NEEDED | |
671 | yyls = yyls1; | |
672 | #endif | |
673 | #else /* no yyoverflow */ | |
674 | /* Extend the stack our own way. */ | |
675 | if (yystacksize >= YYMAXDEPTH) | |
676 | { | |
677 | yyerror("parser stack overflow"); | |
678 | if (yyfree_stacks) | |
679 | { | |
680 | free (yyss); | |
681 | free (yyvs); | |
682 | #ifdef YYLSP_NEEDED | |
683 | free (yyls); | |
684 | #endif | |
685 | } | |
686 | return 2; | |
687 | } | |
688 | yystacksize *= 2; | |
689 | if (yystacksize > YYMAXDEPTH) | |
690 | yystacksize = YYMAXDEPTH; | |
691 | #ifndef YYSTACK_USE_ALLOCA | |
692 | yyfree_stacks = 1; | |
693 | #endif | |
694 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); | |
695 | __yy_memcpy ((char *)yyss, (char *)yyss1, | |
696 | size * (unsigned int) sizeof (*yyssp)); | |
697 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); | |
698 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, | |
699 | size * (unsigned int) sizeof (*yyvsp)); | |
700 | #ifdef YYLSP_NEEDED | |
701 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); | |
702 | __yy_memcpy ((char *)yyls, (char *)yyls1, | |
703 | size * (unsigned int) sizeof (*yylsp)); | |
704 | #endif | |
705 | #endif /* no yyoverflow */ | |
706 | ||
707 | yyssp = yyss + size - 1; | |
708 | yyvsp = yyvs + size - 1; | |
709 | #ifdef YYLSP_NEEDED | |
710 | yylsp = yyls + size - 1; | |
711 | #endif | |
712 | ||
713 | #if YYDEBUG != 0 | |
714 | if (yydebug) | |
715 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
716 | #endif | |
717 | ||
718 | if (yyssp >= yyss + yystacksize - 1) | |
719 | YYABORT; | |
720 | } | |
721 | ||
722 | #if YYDEBUG != 0 | |
723 | if (yydebug) | |
724 | fprintf(stderr, "Entering state %d\n", yystate); | |
725 | #endif | |
726 | ||
727 | goto yybackup; | |
728 | yybackup: | |
729 | ||
730 | /* Do appropriate processing given the current state. */ | |
731 | /* Read a lookahead token if we need one and don't already have one. */ | |
732 | /* yyresume: */ | |
733 | ||
734 | /* First try to decide what to do without reference to lookahead token. */ | |
735 | ||
736 | yyn = yypact[yystate]; | |
737 | if (yyn == YYFLAG) | |
738 | goto yydefault; | |
739 | ||
740 | /* Not known => get a lookahead token if don't already have one. */ | |
741 | ||
742 | /* yychar is either YYEMPTY or YYEOF | |
743 | or a valid token in external form. */ | |
744 | ||
745 | if (yychar == YYEMPTY) | |
746 | { | |
747 | #if YYDEBUG != 0 | |
748 | if (yydebug) | |
749 | fprintf(stderr, "Reading a token: "); | |
750 | #endif | |
751 | yychar = YYLEX; | |
752 | } | |
753 | ||
754 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
755 | ||
756 | if (yychar <= 0) /* This means end of input. */ | |
757 | { | |
758 | yychar1 = 0; | |
759 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
760 | ||
761 | #if YYDEBUG != 0 | |
762 | if (yydebug) | |
763 | fprintf(stderr, "Now at end of input.\n"); | |
764 | #endif | |
765 | } | |
766 | else | |
767 | { | |
768 | yychar1 = YYTRANSLATE(yychar); | |
769 | ||
770 | #if YYDEBUG != 0 | |
771 | if (yydebug) | |
772 | { | |
773 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
774 | /* Give the individual parser a way to print the precise meaning | |
775 | of a token, for further debugging info. */ | |
776 | #ifdef YYPRINT | |
777 | YYPRINT (stderr, yychar, yylval); | |
778 | #endif | |
779 | fprintf (stderr, ")\n"); | |
780 | } | |
781 | #endif | |
782 | } | |
783 | ||
784 | yyn += yychar1; | |
785 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
786 | goto yydefault; | |
787 | ||
788 | yyn = yytable[yyn]; | |
789 | ||
790 | /* yyn is what to do for this token type in this state. | |
791 | Negative => reduce, -yyn is rule number. | |
792 | Positive => shift, yyn is new state. | |
793 | New state is final state => don't bother to shift, | |
794 | just return success. | |
795 | 0, or most negative number => error. */ | |
796 | ||
797 | if (yyn < 0) | |
798 | { | |
799 | if (yyn == YYFLAG) | |
800 | goto yyerrlab; | |
801 | yyn = -yyn; | |
802 | goto yyreduce; | |
803 | } | |
804 | else if (yyn == 0) | |
805 | goto yyerrlab; | |
806 | ||
807 | if (yyn == YYFINAL) | |
808 | YYACCEPT; | |
809 | ||
810 | /* Shift the lookahead token. */ | |
811 | ||
812 | #if YYDEBUG != 0 | |
813 | if (yydebug) | |
814 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
815 | #endif | |
816 | ||
817 | /* Discard the token being shifted unless it is eof. */ | |
818 | if (yychar != YYEOF) | |
819 | yychar = YYEMPTY; | |
820 | ||
821 | *++yyvsp = yylval; | |
822 | #ifdef YYLSP_NEEDED | |
823 | *++yylsp = yylloc; | |
824 | #endif | |
825 | ||
826 | /* count tokens shifted since error; after three, turn off error status. */ | |
827 | if (yyerrstatus) yyerrstatus--; | |
828 | ||
829 | yystate = yyn; | |
830 | goto yynewstate; | |
831 | ||
832 | /* Do the default action for the current state. */ | |
833 | yydefault: | |
834 | ||
835 | yyn = yydefact[yystate]; | |
836 | if (yyn == 0) | |
837 | goto yyerrlab; | |
838 | ||
839 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
840 | yyreduce: | |
841 | yylen = yyr2[yyn]; | |
842 | if (yylen > 0) | |
843 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
844 | ||
845 | #if YYDEBUG != 0 | |
846 | if (yydebug) | |
847 | { | |
848 | int i; | |
849 | ||
850 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
851 | yyn, yyrline[yyn]); | |
852 | ||
853 | /* Print the symbols being reduced, and their result. */ | |
854 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
855 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
856 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
857 | } | |
858 | #endif | |
859 | ||
860 | ||
861 | switch (yyn) { | |
862 | ||
863 | case 1: | |
864 | { lslOpList_free (yyvsp[0].operators); ; | |
865 | break;} | |
866 | case 2: | |
867 | { lslOpList x = lslOpList_new (); | |
868 | g_importedlslOp = yyvsp[0].operator; | |
869 | lslOpList_add (x, yyvsp[0].operator); | |
870 | yyval.operators = x; ; | |
871 | break;} | |
872 | case 3: | |
873 | { lslOpList_add (yyvsp[-1].operators, yyvsp[0].operator); | |
874 | yyval.operators = yyvsp[-1].operators; ; | |
875 | break;} | |
876 | case 4: | |
877 | { yyval.operator = makelslOpNode (yyvsp[-2].name, yyvsp[0].signature); ; | |
878 | break;} | |
879 | case 5: | |
880 | { yyval.name = makeNameNodeId (yyvsp[0].ltok); ; | |
881 | break;} | |
882 | case 6: | |
883 | { yyval.name = makeNameNodeForm (yyvsp[0].opform); ; | |
884 | break;} | |
885 | case 7: | |
886 | { yyval.opform = makeOpFormNode (yyvsp[-5].ltok, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ; | |
887 | break;} | |
888 | case 8: | |
889 | { yyval.opform = makeOpFormNode (yyvsp[0].ltok, OPF_ANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ; | |
890 | break;} | |
891 | case 9: | |
892 | { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_MANYOP, opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ; | |
893 | break;} | |
894 | case 10: | |
895 | { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_ANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ; | |
896 | break;} | |
897 | case 11: | |
898 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MANYOPM, opFormUnion_createAnyOp (yyvsp[-1].ltok), ltoken_undefined); ; | |
899 | break;} | |
900 | case 12: | |
901 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ; | |
902 | break;} | |
903 | case 13: | |
904 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMIDDLE, opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ; | |
905 | break;} | |
906 | case 14: | |
907 | { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MIDDLEM, opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ; | |
908 | break;} | |
909 | case 15: | |
910 | { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_MMIDDLEM, | |
911 | opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ; | |
912 | break;} | |
913 | case 16: | |
914 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMIDDLE, | |
915 | opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ; | |
916 | break;} | |
917 | case 17: | |
918 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_BMMIDDLE, | |
919 | opFormUnion_createMiddle (yyvsp[-1].count), yyvsp[0].ltok); ; | |
920 | break;} | |
921 | case 18: | |
922 | { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMIDDLEM, | |
923 | opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ; | |
924 | break;} | |
925 | case 19: | |
926 | { yyval.opform = makeOpFormNode (yyvsp[-3].ltok, OPF_BMMIDDLEM, | |
927 | opFormUnion_createMiddle (yyvsp[-2].count), yyvsp[-1].ltok); ; | |
928 | break;} | |
929 | case 20: | |
930 | { yyval.opform = makeOpFormNode (yyvsp[-1].ltok, OPF_SELECT, | |
931 | opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ; | |
932 | break;} | |
933 | case 21: | |
934 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MSELECT, | |
935 | opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ; | |
936 | break;} | |
937 | case 22: | |
938 | { yyval.opform = makeOpFormNode (yyvsp[-2].ltok, OPF_MMAP, | |
939 | opFormUnion_createAnyOp (yyvsp[0].ltok), ltoken_undefined); ; | |
940 | break;} | |
941 | case 23: | |
942 | { yyval.ltok = yyvsp[0].ltok; ; | |
943 | break;} | |
944 | case 24: | |
945 | { yyval.ltok = yyvsp[0].ltok; ; | |
946 | break;} | |
947 | case 25: | |
948 | { yyval.ltok = yyvsp[0].ltok; ; | |
949 | break;} | |
950 | case 26: | |
951 | { yyval.count = 0; ; | |
952 | break;} | |
953 | case 27: | |
954 | { yyval.count = yyvsp[0].count; ; | |
955 | break;} | |
956 | case 28: | |
957 | { yyval.count = 1; ; | |
958 | break;} | |
959 | case 29: | |
960 | { yyval.count = yyvsp[-2].count + 1; ; | |
961 | break;} | |
962 | case 30: | |
963 | { yyval.ltok = yyvsp[0].ltok; ; | |
964 | break;} | |
965 | case 31: | |
966 | { yyval.ltok = yyvsp[0].ltok; ; | |
967 | break;} | |
968 | case 32: | |
969 | { yyval.signature = makesigNode (yyvsp[-1].ltok, yyvsp[-2].ltokenList, yyvsp[0].ltok); ; | |
970 | break;} | |
971 | case 33: | |
972 | { yyval.ltokenList = ltokenList_new (); ; | |
973 | break;} | |
974 | case 34: | |
975 | { yyval.ltokenList = yyvsp[0].ltokenList; ; | |
976 | break;} | |
977 | case 35: | |
978 | { yyval.ltokenList = ltokenList_singleton (yyvsp[0].ltok); ; | |
979 | break;} | |
980 | case 36: | |
981 | { yyval.ltokenList = ltokenList_push (yyvsp[-2].ltokenList, yyvsp[0].ltok); ; | |
982 | break;} | |
983 | case 37: | |
984 | { | |
985 | yyval.ltok = yyvsp[0].ltok; | |
986 | ltoken_setText (yyval.ltok, processTraitSortId (ltoken_getText (yyvsp[0].ltok))); | |
987 | ; | |
988 | break;} | |
989 | case 38: | |
990 | { yyval.ltok = yyvsp[0].ltok; ; | |
991 | break;} | |
992 | } | |
993 | /* the action file gets copied in in place of this dollarsign */ | |
994 | ||
995 | \f | |
996 | yyvsp -= yylen; | |
997 | yyssp -= yylen; | |
998 | #ifdef YYLSP_NEEDED | |
999 | yylsp -= yylen; | |
1000 | #endif | |
1001 | ||
1002 | #if YYDEBUG != 0 | |
1003 | if (yydebug) | |
1004 | { | |
1005 | short *ssp1 = yyss - 1; | |
1006 | fprintf (stderr, "state stack now"); | |
1007 | while (ssp1 != yyssp) | |
1008 | fprintf (stderr, " %d", *++ssp1); | |
1009 | fprintf (stderr, "\n"); | |
1010 | } | |
1011 | #endif | |
1012 | ||
1013 | *++yyvsp = yyval; | |
1014 | ||
1015 | #ifdef YYLSP_NEEDED | |
1016 | yylsp++; | |
1017 | if (yylen == 0) | |
1018 | { | |
1019 | yylsp->first_line = yylloc.first_line; | |
1020 | yylsp->first_column = yylloc.first_column; | |
1021 | yylsp->last_line = (yylsp-1)->last_line; | |
1022 | yylsp->last_column = (yylsp-1)->last_column; | |
1023 | yylsp->text = 0; | |
1024 | } | |
1025 | else | |
1026 | { | |
1027 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
1028 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
1029 | } | |
1030 | #endif | |
1031 | ||
1032 | /* Now "shift" the result of the reduction. | |
1033 | Determine what state that goes to, | |
1034 | based on the state we popped back to | |
1035 | and the rule number reduced by. */ | |
1036 | ||
1037 | yyn = yyr1[yyn]; | |
1038 | ||
1039 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
1040 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
1041 | yystate = yytable[yystate]; | |
1042 | else | |
1043 | yystate = yydefgoto[yyn - YYNTBASE]; | |
1044 | ||
1045 | goto yynewstate; | |
1046 | ||
1047 | yyerrlab: /* here on detecting error */ | |
1048 | ||
1049 | if (! yyerrstatus) | |
1050 | /* If not already recovering from an error, report this error. */ | |
1051 | { | |
1052 | ++yynerrs; | |
1053 | ||
1054 | #ifdef YYERROR_VERBOSE | |
1055 | yyn = yypact[yystate]; | |
1056 | ||
1057 | if (yyn > YYFLAG && yyn < YYLAST) | |
1058 | { | |
1059 | int size = 0; | |
1060 | char *msg; | |
1061 | int x, count; | |
1062 | ||
1063 | count = 0; | |
1064 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
1065 | for (x = (yyn < 0 ? -yyn : 0); | |
1066 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
1067 | if (yycheck[x + yyn] == x) | |
1068 | size += strlen(yytname[x]) + 15, count++; | |
1069 | msg = (char *) malloc(size + 15); | |
1070 | if (msg != 0) | |
1071 | { | |
1072 | strcpy(msg, "parse error"); | |
1073 | ||
1074 | if (count < 5) | |
1075 | { | |
1076 | count = 0; | |
1077 | for (x = (yyn < 0 ? -yyn : 0); | |
1078 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
1079 | if (yycheck[x + yyn] == x) | |
1080 | { | |
1081 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
1082 | strcat(msg, yytname[x]); | |
1083 | strcat(msg, "'"); | |
1084 | count++; | |
1085 | } | |
1086 | } | |
1087 | yyerror(msg); | |
1088 | free(msg); | |
1089 | } | |
1090 | else | |
1091 | yyerror ("parse error; also virtual memory exceeded"); | |
1092 | } | |
1093 | else | |
1094 | #endif /* YYERROR_VERBOSE */ | |
1095 | yyerror("parse error"); | |
1096 | } | |
1097 | ||
1098 | goto yyerrlab1; | |
1099 | yyerrlab1: /* here on error raised explicitly by an action */ | |
1100 | ||
1101 | if (yyerrstatus == 3) | |
1102 | { | |
1103 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
1104 | ||
1105 | /* return failure if at end of input */ | |
1106 | if (yychar == YYEOF) | |
1107 | YYABORT; | |
1108 | ||
1109 | #if YYDEBUG != 0 | |
1110 | if (yydebug) | |
1111 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
1112 | #endif | |
1113 | ||
1114 | yychar = YYEMPTY; | |
1115 | } | |
1116 | ||
1117 | /* Else will try to reuse lookahead token | |
1118 | after shifting the error token. */ | |
1119 | ||
1120 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
1121 | ||
1122 | goto yyerrhandle; | |
1123 | ||
1124 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
1125 | ||
1126 | #if 0 | |
1127 | /* This is wrong; only states that explicitly want error tokens | |
1128 | should shift them. */ | |
1129 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
1130 | if (yyn) goto yydefault; | |
1131 | #endif | |
1132 | ||
1133 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
1134 | ||
1135 | if (yyssp == yyss) YYABORT; | |
1136 | yyvsp--; | |
1137 | yystate = *--yyssp; | |
1138 | #ifdef YYLSP_NEEDED | |
1139 | yylsp--; | |
1140 | #endif | |
1141 | ||
1142 | #if YYDEBUG != 0 | |
1143 | if (yydebug) | |
1144 | { | |
1145 | short *ssp1 = yyss - 1; | |
1146 | fprintf (stderr, "Error: state stack now"); | |
1147 | while (ssp1 != yyssp) | |
1148 | fprintf (stderr, " %d", *++ssp1); | |
1149 | fprintf (stderr, "\n"); | |
1150 | } | |
1151 | #endif | |
1152 | ||
1153 | yyerrhandle: | |
1154 | ||
1155 | yyn = yypact[yystate]; | |
1156 | if (yyn == YYFLAG) | |
1157 | goto yyerrdefault; | |
1158 | ||
1159 | yyn += YYTERROR; | |
1160 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
1161 | goto yyerrdefault; | |
1162 | ||
1163 | yyn = yytable[yyn]; | |
1164 | if (yyn < 0) | |
1165 | { | |
1166 | if (yyn == YYFLAG) | |
1167 | goto yyerrpop; | |
1168 | yyn = -yyn; | |
1169 | goto yyreduce; | |
1170 | } | |
1171 | else if (yyn == 0) | |
1172 | goto yyerrpop; | |
1173 | ||
1174 | if (yyn == YYFINAL) | |
1175 | YYACCEPT; | |
1176 | ||
1177 | #if YYDEBUG != 0 | |
1178 | if (yydebug) | |
1179 | fprintf(stderr, "Shifting error token, "); | |
1180 | #endif | |
1181 | ||
1182 | *++yyvsp = yylval; | |
1183 | #ifdef YYLSP_NEEDED | |
1184 | *++yylsp = yylloc; | |
1185 | #endif | |
1186 | ||
1187 | yystate = yyn; | |
1188 | goto yynewstate; | |
1189 | ||
1190 | yyacceptlab: | |
1191 | /* YYACCEPT comes here. */ | |
1192 | if (yyfree_stacks) | |
1193 | { | |
1194 | free (yyss); | |
1195 | free (yyvs); | |
1196 | #ifdef YYLSP_NEEDED | |
1197 | free (yyls); | |
1198 | #endif | |
1199 | } | |
1200 | return 0; | |
1201 | ||
1202 | yyabortlab: | |
1203 | /* YYABORT comes here. */ | |
1204 | if (yyfree_stacks) | |
1205 | { | |
1206 | free (yyss); | |
1207 | free (yyvs); | |
1208 | #ifdef YYLSP_NEEDED | |
1209 | free (yyls); | |
1210 | #endif | |
1211 | } | |
1212 | return 1; | |
1213 | } | |
1214 | ||
1215 | ||
1216 | # include "bison.reset" | |
1217 | ||
1218 | extern char *yytext; | |
1219 | ||
1220 | void lslerror (char *s) | |
1221 | { | |
1222 | llfatalbug | |
1223 | (cstring_makeLiteral | |
1224 | ("There has been a problem in the parser with LSL signatures. This is believed to result " | |
1225 | "from a problem with bison v. 1.25. Please try rebuidling Splint " | |
1226 | "using the pre-compiled grammar files by commenting out the " | |
1227 | "BISON= line in the top-level Makefile.")); | |
1228 | } | |
1229 | ||
1230 | static void yyprint (FILE *file, int type, YYSTYPE value) | |
1231 | { | |
1232 | fprintf (file, " (%u:%u type: %d; text: %s) ", | |
1233 | ltoken_getLine (value.ltok), | |
1234 | ltoken_getCol (value.ltok), | |
1235 | type, | |
1236 | ltoken_getRawTextChars (value.ltok)); | |
1237 | } | |
1238 | ||
1239 | extern void PrintToken (ltoken tok) { | |
1240 | char *codStr; | |
1241 | ||
1242 | switch (ltoken_getCode (tok)) | |
1243 | { | |
1244 | case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break; | |
1245 | case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break; | |
1246 | case LST_LOGICALOP: codStr = "LOGICALOP: "; break; | |
1247 | case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break; | |
1248 | case LST_OPENSYM: codStr = "LST_OPENSYM"; break; | |
1249 | case LST_SEPSYM: codStr = "SEPSYM"; break; | |
1250 | case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break; | |
1251 | case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break; | |
1252 | case LST_MAPSYM: codStr = "MAPSYM"; break; | |
1253 | case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break; | |
1254 | case LST_COMMENTSYM: codStr = "COMMENTSYM"; break; | |
1255 | case LST_SIMPLEOP: codStr = "SIMPLEOP"; break; | |
1256 | case LST_COLON: codStr = "LST_COLON"; break; | |
1257 | case LST_COMMA: codStr = "COMMA"; break; | |
1258 | case LST_LBRACKET: codStr = "LST_LBRACKET"; break; | |
1259 | case LST_LPAR: codStr = "LST_LPAR"; break; | |
1260 | case LST_RBRACKET: codStr = "LST_RBRACKET"; break; | |
1261 | case LST_RPAR: codStr = "LST_RPAR"; break; | |
1262 | case LST_EQOP: codStr = "LST_EQOP"; break; | |
1263 | case LST_WHITESPACE: codStr = "WHITESPACE,"; break; | |
1264 | case LST_EOL: codStr = "LST_EOL"; break; | |
1265 | case LST_elseTOKEN: codStr = "elseTOKEN"; break; | |
1266 | case LST_ifTOKEN: codStr = "ifTOKEN"; break; | |
1267 | case LST_thenTOKEN: codStr = "thenTOKEN"; break; | |
1268 | case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break; | |
1269 | case LEOFTOKEN: /* can't reach LEOFTOKEN easily */ | |
1270 | codStr = "LEOFTOKEN"; break; | |
1271 | default: | |
1272 | codStr = "*** invalid token code ***"; | |
1273 | break; | |
1274 | } /* end switch */ | |
1275 | ||
1276 | /* only used for debugging */ | |
1277 | printf ("%u:%u: Token Code (%u): %s", | |
1278 | ltoken_getLine (tok), ltoken_getCol (tok), | |
1279 | ltoken_getCode (tok), codStr); | |
1280 | if (ltoken_getRawText (tok) != 0) | |
1281 | { | |
1282 | printf (", Token String (%lu): %s\n", | |
1283 | ltoken_getRawText (tok), ltoken_getRawTextChars (tok)); | |
1284 | } | |
1285 | else printf ("\n"); | |
1286 | } | |
1287 | ||
1288 | ||
1289 | ||
1290 | ||
1291 | /* | |
1292 | ** Resets all flags in bison.head | |
1293 | */ | |
1294 | ||
1295 | ||
1296 | /*@=allmacros@*/ | |
1297 | /*@=boolint@*/ | |
1298 | /*@=charint@*/ | |
1299 | /*@=macroparams@*/ | |
1300 | /*@=macroundef@*/ | |
1301 | /*@=unreachable@*/ | |
1302 | /*@=macrospec@*/ | |
1303 | /*@=varuse@*/ | |
1304 | /*@=ignorequals@*/ | |
1305 | /*@=macrostmt@*/ | |
1306 | /*@=noeffect@*/ | |
1307 | /*@=shadow@*/ | |
1308 | /*@=exitarg@*/ | |
1309 | /*@=macroredef@*/ | |
1310 | /*@=uniondef@*/ | |
1311 | /*@=compdef@*/ | |
1312 | /*@=matchfields@*/ | |
1313 | /*@=exportlocal@*/ | |
1314 | /*@=evalorderuncon@*/ | |
1315 | /*@=exportheader@*/ | |
1316 | /*@=typeuse@*/ | |
1317 | /*@=redecl@*/ | |
1318 | /*@=redef@*/ | |
1319 | /*@=noparams@*/ | |
1320 | /*@=ansireserved@*/ | |
1321 | /*@=fielduse@*/ | |
1322 | /*@=ifblock@*/ | |
1323 | /*@=elseifcomplete@*/ | |
1324 | /*@=whileblock@*/ | |
1325 | /*@=forblock@*/ | |
1326 | /*@=branchstate@*/ | |
1327 | /*@=readonlytrans@*/ | |
1328 | /*@=namechecks@*/ | |
1329 | /*@=usedef@*/ | |
1330 | /*@=systemunrecog@*/ | |
1331 | /*@=dependenttrans@*/ | |
1332 | /*@=unqualifiedtrans@*/ | |
1333 | /*@=declundef@*/ | |
1334 | ||
1335 | ||
1336 | /*drl added 11/27/2001*/ | |
1337 | /*@=bounds@*/ |