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