]>
Commit | Line | Data |
---|---|---|
10fa2066 RS |
1 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
2 | #line 3 "bison.simple" | |
3 | ||
4 | /* Skeleton output parser for bison, | |
21b14802 | 5 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. |
10fa2066 RS |
6 | |
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
21b14802 | 9 | the Free Software Foundation; either version 2, or (at your option) |
10fa2066 RS |
10 | any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
20 | ||
c71f8bba RS |
21 | /* As a special exception, when this file is copied by Bison into a |
22 | Bison output file, you may use that output file without restriction. | |
23 | This special exception was added by the Free Software Foundation | |
cfeaeb52 | 24 | in version 1.24 of Bison. */ |
10fa2066 | 25 | |
444fbf65 RS |
26 | /* This is the parser code that is written into each bison parser |
27 | when the %semantic_parser declaration is not specified in the grammar. | |
28 | It was written by Richard Stallman by simplifying the hairy parser | |
29 | used when %semantic_parser is specified. */ | |
30 | ||
70ddf897 RS |
31 | #ifndef YYSTACK_USE_ALLOCA |
32 | #ifdef alloca | |
33 | #define YYSTACK_USE_ALLOCA | |
34 | #else /* alloca not defined */ | |
10fa2066 | 35 | #ifdef __GNUC__ |
70ddf897 | 36 | #define YYSTACK_USE_ALLOCA |
10fa2066 RS |
37 | #define alloca __builtin_alloca |
38 | #else /* not GNU C. */ | |
b6287af6 | 39 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) |
70ddf897 | 40 | #define YYSTACK_USE_ALLOCA |
10fa2066 RS |
41 | #include <alloca.h> |
42 | #else /* not sparc */ | |
70ddf897 | 43 | /* We think this test detects Watcom and Microsoft C. */ |
db245ba8 | 44 | /* This used to test MSDOS, but that is a bad idea |
70ddf897 | 45 | since that symbol is in the user namespace. */ |
32d5c018 | 46 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) |
70ddf897 RS |
47 | #if 0 /* No need for malloc.h, which pollutes the namespace; |
48 | instead, just don't use alloca. */ | |
10fa2066 | 49 | #include <malloc.h> |
70ddf897 | 50 | #endif |
32d5c018 | 51 | #else /* not MSDOS, or __TURBOC__ */ |
10fa2066 | 52 | #if defined(_AIX) |
70ddf897 RS |
53 | /* I don't know what this was needed for, but it pollutes the namespace. |
54 | So I turned it off. rms, 2 May 1997. */ | |
55 | /* #include <malloc.h> */ | |
10fa2066 | 56 | #pragma alloca |
70ddf897 | 57 | #define YYSTACK_USE_ALLOCA |
32d5c018 | 58 | #else /* not MSDOS, or __TURBOC__, or _AIX */ |
70ddf897 RS |
59 | #if 0 |
60 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, | |
61 | and on HPUX 10. Eventually we can turn this on. */ | |
62 | #define YYSTACK_USE_ALLOCA | |
3054a9cd | 63 | #define alloca __builtin_alloca |
10fa2066 | 64 | #endif /* __hpux */ |
70ddf897 | 65 | #endif |
10fa2066 | 66 | #endif /* not _AIX */ |
32d5c018 | 67 | #endif /* not MSDOS, or __TURBOC__ */ |
70ddf897 RS |
68 | #endif /* not sparc */ |
69 | #endif /* not GNU C */ | |
70 | #endif /* alloca not defined */ | |
71 | #endif /* YYSTACK_USE_ALLOCA not defined */ | |
72 | ||
73 | #ifdef YYSTACK_USE_ALLOCA | |
74 | #define YYSTACK_ALLOC alloca | |
75 | #else | |
76 | #define YYSTACK_ALLOC malloc | |
77 | #endif | |
10fa2066 | 78 | |
10fa2066 RS |
79 | /* Note: there must be only one dollar sign in this file. |
80 | It is replaced by the list of actions, each action | |
81 | as one case of the switch. */ | |
82 | ||
83 | #define yyerrok (yyerrstatus = 0) | |
84 | #define yyclearin (yychar = YYEMPTY) | |
85 | #define YYEMPTY -2 | |
86 | #define YYEOF 0 | |
70ddf897 RS |
87 | #define YYACCEPT goto yyacceptlab |
88 | #define YYABORT goto yyabortlab | |
10fa2066 RS |
89 | #define YYERROR goto yyerrlab1 |
90 | /* Like YYERROR except do call yyerror. | |
91 | This remains here temporarily to ease the | |
92 | transition to the new meaning of YYERROR, for GCC. | |
93 | Once GCC version 2 has supplanted version 1, this can go. */ | |
94 | #define YYFAIL goto yyerrlab | |
95 | #define YYRECOVERING() (!!yyerrstatus) | |
96 | #define YYBACKUP(token, value) \ | |
97 | do \ | |
98 | if (yychar == YYEMPTY && yylen == 1) \ | |
99 | { yychar = (token), yylval = (value); \ | |
100 | yychar1 = YYTRANSLATE (yychar); \ | |
101 | YYPOPSTACK; \ | |
102 | goto yybackup; \ | |
103 | } \ | |
104 | else \ | |
105 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | |
106 | while (0) | |
107 | ||
108 | #define YYTERROR 1 | |
109 | #define YYERRCODE 256 | |
110 | ||
111 | #ifndef YYPURE | |
112 | #define YYLEX yylex() | |
113 | #endif | |
114 | ||
115 | #ifdef YYPURE | |
116 | #ifdef YYLSP_NEEDED | |
e425e872 RS |
117 | #ifdef YYLEX_PARAM |
118 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | |
119 | #else | |
10fa2066 | 120 | #define YYLEX yylex(&yylval, &yylloc) |
e425e872 RS |
121 | #endif |
122 | #else /* not YYLSP_NEEDED */ | |
123 | #ifdef YYLEX_PARAM | |
124 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | |
10fa2066 RS |
125 | #else |
126 | #define YYLEX yylex(&yylval) | |
127 | #endif | |
e425e872 | 128 | #endif /* not YYLSP_NEEDED */ |
10fa2066 RS |
129 | #endif |
130 | ||
131 | /* If nonreentrant, generate the variables here */ | |
132 | ||
133 | #ifndef YYPURE | |
134 | ||
135 | int yychar; /* the lookahead symbol */ | |
136 | YYSTYPE yylval; /* the semantic value of the */ | |
137 | /* lookahead symbol */ | |
138 | ||
139 | #ifdef YYLSP_NEEDED | |
140 | YYLTYPE yylloc; /* location data for the lookahead */ | |
141 | /* symbol */ | |
142 | #endif | |
143 | ||
144 | int yynerrs; /* number of parse errors so far */ | |
145 | #endif /* not YYPURE */ | |
146 | ||
147 | #if YYDEBUG != 0 | |
148 | int yydebug; /* nonzero means print parse trace */ | |
149 | /* Since this is uninitialized, it does not stop multiple parsers | |
150 | from coexisting. */ | |
151 | #endif | |
152 | ||
153 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | |
154 | ||
155 | #ifndef YYINITDEPTH | |
156 | #define YYINITDEPTH 200 | |
157 | #endif | |
158 | ||
159 | /* YYMAXDEPTH is the maximum size the stacks can grow to | |
160 | (effective only if the built-in stack extension method is used). */ | |
161 | ||
162 | #if YYMAXDEPTH == 0 | |
163 | #undef YYMAXDEPTH | |
164 | #endif | |
165 | ||
166 | #ifndef YYMAXDEPTH | |
167 | #define YYMAXDEPTH 10000 | |
168 | #endif | |
10fa2066 | 169 | \f |
5e02f2ad RS |
170 | /* Define __yy_memcpy. Note that the size argument |
171 | should be passed with type unsigned int, because that is what the non-GCC | |
172 | definitions require. With GCC, __builtin_memcpy takes an arg | |
173 | of type size_t, but it can handle unsigned int. */ | |
174 | ||
10fa2066 | 175 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ |
c245d0d3 | 176 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) |
10fa2066 RS |
177 | #else /* not GNU C or C++ */ |
178 | #ifndef __cplusplus | |
179 | ||
180 | /* This is the most reliable way to avoid incompatibilities | |
181 | in available built-in functions on various systems. */ | |
182 | static void | |
c245d0d3 | 183 | __yy_memcpy (to, from, count) |
10fa2066 | 184 | char *to; |
c245d0d3 | 185 | char *from; |
5e02f2ad | 186 | unsigned int count; |
10fa2066 RS |
187 | { |
188 | register char *f = from; | |
189 | register char *t = to; | |
190 | register int i = count; | |
191 | ||
192 | while (i-- > 0) | |
193 | *t++ = *f++; | |
194 | } | |
195 | ||
196 | #else /* __cplusplus */ | |
197 | ||
198 | /* This is the most reliable way to avoid incompatibilities | |
199 | in available built-in functions on various systems. */ | |
200 | static void | |
5e02f2ad | 201 | __yy_memcpy (char *to, char *from, unsigned int count) |
10fa2066 | 202 | { |
10fa2066 | 203 | register char *t = to; |
4cf401b2 | 204 | register char *f = from; |
10fa2066 RS |
205 | register int i = count; |
206 | ||
207 | while (i-- > 0) | |
208 | *t++ = *f++; | |
209 | } | |
210 | ||
211 | #endif | |
212 | #endif | |
213 | \f | |
70ddf897 | 214 | #line 215 "bison.simple" |
b658bf92 RS |
215 | |
216 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | |
217 | into yyparse. The argument should have type void *. | |
218 | It should actually point to an object. | |
219 | Grammar actions can access the variable by casting it | |
220 | to the proper pointer type. */ | |
221 | ||
222 | #ifdef YYPARSE_PARAM | |
30f5b1cc RS |
223 | #ifdef __cplusplus |
224 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | |
225 | #define YYPARSE_PARAM_DECL | |
226 | #else /* not __cplusplus */ | |
227 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | |
b658bf92 | 228 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
30f5b1cc RS |
229 | #endif /* not __cplusplus */ |
230 | #else /* not YYPARSE_PARAM */ | |
231 | #define YYPARSE_PARAM_ARG | |
21b3ea15 | 232 | #define YYPARSE_PARAM_DECL |
30f5b1cc | 233 | #endif /* not YYPARSE_PARAM */ |
b658bf92 | 234 | |
1b181651 PE |
235 | /* Prevent warning if -Wstrict-prototypes. */ |
236 | #ifdef __GNUC__ | |
237 | #ifdef YYPARSE_PARAM | |
238 | int yyparse (void *); | |
239 | #else | |
240 | int yyparse (void); | |
241 | #endif | |
242 | #endif | |
243 | ||
10fa2066 | 244 | int |
30f5b1cc | 245 | yyparse(YYPARSE_PARAM_ARG) |
b658bf92 | 246 | YYPARSE_PARAM_DECL |
10fa2066 RS |
247 | { |
248 | register int yystate; | |
249 | register int yyn; | |
250 | register short *yyssp; | |
251 | register YYSTYPE *yyvsp; | |
252 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | |
c6c88451 | 253 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ |
10fa2066 RS |
254 | |
255 | short yyssa[YYINITDEPTH]; /* the state stack */ | |
256 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | |
257 | ||
258 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | |
259 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | |
260 | ||
261 | #ifdef YYLSP_NEEDED | |
262 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | |
263 | YYLTYPE *yyls = yylsa; | |
264 | YYLTYPE *yylsp; | |
265 | ||
266 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | |
267 | #else | |
268 | #define YYPOPSTACK (yyvsp--, yyssp--) | |
269 | #endif | |
270 | ||
271 | int yystacksize = YYINITDEPTH; | |
70ddf897 | 272 | int yyfree_stacks = 0; |
10fa2066 RS |
273 | |
274 | #ifdef YYPURE | |
275 | int yychar; | |
276 | YYSTYPE yylval; | |
277 | int yynerrs; | |
278 | #ifdef YYLSP_NEEDED | |
279 | YYLTYPE yylloc; | |
280 | #endif | |
281 | #endif | |
282 | ||
283 | YYSTYPE yyval; /* the variable used to return */ | |
284 | /* semantic values from the action */ | |
285 | /* routines */ | |
286 | ||
287 | int yylen; | |
288 | ||
289 | #if YYDEBUG != 0 | |
290 | if (yydebug) | |
291 | fprintf(stderr, "Starting parse\n"); | |
292 | #endif | |
293 | ||
294 | yystate = 0; | |
295 | yyerrstatus = 0; | |
296 | yynerrs = 0; | |
297 | yychar = YYEMPTY; /* Cause a token to be read. */ | |
298 | ||
299 | /* Initialize stack pointers. | |
300 | Waste one element of value and location stack | |
301 | so that they stay on the same level as the state stack. | |
302 | The wasted elements are never initialized. */ | |
303 | ||
304 | yyssp = yyss - 1; | |
305 | yyvsp = yyvs; | |
306 | #ifdef YYLSP_NEEDED | |
307 | yylsp = yyls; | |
308 | #endif | |
309 | ||
310 | /* Push a new state, which is found in yystate . */ | |
311 | /* In all cases, when you get here, the value and location stacks | |
312 | have just been pushed. so pushing a state here evens the stacks. */ | |
313 | yynewstate: | |
314 | ||
315 | *++yyssp = yystate; | |
316 | ||
317 | if (yyssp >= yyss + yystacksize - 1) | |
318 | { | |
319 | /* Give user a chance to reallocate the stack */ | |
320 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | |
321 | YYSTYPE *yyvs1 = yyvs; | |
322 | short *yyss1 = yyss; | |
323 | #ifdef YYLSP_NEEDED | |
324 | YYLTYPE *yyls1 = yyls; | |
325 | #endif | |
326 | ||
327 | /* Get the current used size of the three stacks, in elements. */ | |
328 | int size = yyssp - yyss + 1; | |
329 | ||
330 | #ifdef yyoverflow | |
331 | /* Each stack pointer address is followed by the size of | |
332 | the data in use in that stack, in bytes. */ | |
be4bf877 RS |
333 | #ifdef YYLSP_NEEDED |
334 | /* This used to be a conditional around just the two extra args, | |
335 | but that might be undefined if yyoverflow is a macro. */ | |
10fa2066 RS |
336 | yyoverflow("parser stack overflow", |
337 | &yyss1, size * sizeof (*yyssp), | |
338 | &yyvs1, size * sizeof (*yyvsp), | |
10fa2066 | 339 | &yyls1, size * sizeof (*yylsp), |
10fa2066 | 340 | &yystacksize); |
be4bf877 RS |
341 | #else |
342 | yyoverflow("parser stack overflow", | |
343 | &yyss1, size * sizeof (*yyssp), | |
344 | &yyvs1, size * sizeof (*yyvsp), | |
345 | &yystacksize); | |
346 | #endif | |
10fa2066 RS |
347 | |
348 | yyss = yyss1; yyvs = yyvs1; | |
349 | #ifdef YYLSP_NEEDED | |
350 | yyls = yyls1; | |
351 | #endif | |
352 | #else /* no yyoverflow */ | |
353 | /* Extend the stack our own way. */ | |
354 | if (yystacksize >= YYMAXDEPTH) | |
355 | { | |
356 | yyerror("parser stack overflow"); | |
70ddf897 RS |
357 | if (yyfree_stacks) |
358 | { | |
359 | free (yyss); | |
360 | free (yyvs); | |
361 | #ifdef YYLSP_NEEDED | |
362 | free (yyls); | |
363 | #endif | |
364 | } | |
10fa2066 RS |
365 | return 2; |
366 | } | |
367 | yystacksize *= 2; | |
368 | if (yystacksize > YYMAXDEPTH) | |
369 | yystacksize = YYMAXDEPTH; | |
70ddf897 RS |
370 | #ifndef YYSTACK_USE_ALLOCA |
371 | yyfree_stacks = 1; | |
372 | #endif | |
373 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); | |
5e02f2ad RS |
374 | __yy_memcpy ((char *)yyss, (char *)yyss1, |
375 | size * (unsigned int) sizeof (*yyssp)); | |
70ddf897 | 376 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); |
5e02f2ad RS |
377 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, |
378 | size * (unsigned int) sizeof (*yyvsp)); | |
10fa2066 | 379 | #ifdef YYLSP_NEEDED |
70ddf897 | 380 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); |
5e02f2ad RS |
381 | __yy_memcpy ((char *)yyls, (char *)yyls1, |
382 | size * (unsigned int) sizeof (*yylsp)); | |
10fa2066 RS |
383 | #endif |
384 | #endif /* no yyoverflow */ | |
385 | ||
386 | yyssp = yyss + size - 1; | |
387 | yyvsp = yyvs + size - 1; | |
388 | #ifdef YYLSP_NEEDED | |
389 | yylsp = yyls + size - 1; | |
390 | #endif | |
391 | ||
392 | #if YYDEBUG != 0 | |
393 | if (yydebug) | |
394 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | |
395 | #endif | |
396 | ||
397 | if (yyssp >= yyss + yystacksize - 1) | |
398 | YYABORT; | |
399 | } | |
400 | ||
401 | #if YYDEBUG != 0 | |
402 | if (yydebug) | |
403 | fprintf(stderr, "Entering state %d\n", yystate); | |
404 | #endif | |
405 | ||
406 | goto yybackup; | |
407 | yybackup: | |
408 | ||
409 | /* Do appropriate processing given the current state. */ | |
410 | /* Read a lookahead token if we need one and don't already have one. */ | |
411 | /* yyresume: */ | |
412 | ||
413 | /* First try to decide what to do without reference to lookahead token. */ | |
414 | ||
415 | yyn = yypact[yystate]; | |
416 | if (yyn == YYFLAG) | |
417 | goto yydefault; | |
418 | ||
419 | /* Not known => get a lookahead token if don't already have one. */ | |
420 | ||
421 | /* yychar is either YYEMPTY or YYEOF | |
422 | or a valid token in external form. */ | |
423 | ||
424 | if (yychar == YYEMPTY) | |
425 | { | |
426 | #if YYDEBUG != 0 | |
427 | if (yydebug) | |
428 | fprintf(stderr, "Reading a token: "); | |
429 | #endif | |
430 | yychar = YYLEX; | |
431 | } | |
432 | ||
433 | /* Convert token to internal form (in yychar1) for indexing tables with */ | |
434 | ||
435 | if (yychar <= 0) /* This means end of input. */ | |
436 | { | |
437 | yychar1 = 0; | |
438 | yychar = YYEOF; /* Don't call YYLEX any more */ | |
439 | ||
440 | #if YYDEBUG != 0 | |
441 | if (yydebug) | |
442 | fprintf(stderr, "Now at end of input.\n"); | |
443 | #endif | |
444 | } | |
445 | else | |
446 | { | |
447 | yychar1 = YYTRANSLATE(yychar); | |
448 | ||
449 | #if YYDEBUG != 0 | |
450 | if (yydebug) | |
451 | { | |
452 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | |
453 | /* Give the individual parser a way to print the precise meaning | |
454 | of a token, for further debugging info. */ | |
455 | #ifdef YYPRINT | |
456 | YYPRINT (stderr, yychar, yylval); | |
457 | #endif | |
458 | fprintf (stderr, ")\n"); | |
459 | } | |
460 | #endif | |
461 | } | |
462 | ||
463 | yyn += yychar1; | |
464 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | |
465 | goto yydefault; | |
466 | ||
467 | yyn = yytable[yyn]; | |
468 | ||
469 | /* yyn is what to do for this token type in this state. | |
470 | Negative => reduce, -yyn is rule number. | |
471 | Positive => shift, yyn is new state. | |
472 | New state is final state => don't bother to shift, | |
473 | just return success. | |
474 | 0, or most negative number => error. */ | |
475 | ||
476 | if (yyn < 0) | |
477 | { | |
478 | if (yyn == YYFLAG) | |
479 | goto yyerrlab; | |
480 | yyn = -yyn; | |
481 | goto yyreduce; | |
482 | } | |
483 | else if (yyn == 0) | |
484 | goto yyerrlab; | |
485 | ||
486 | if (yyn == YYFINAL) | |
487 | YYACCEPT; | |
488 | ||
489 | /* Shift the lookahead token. */ | |
490 | ||
491 | #if YYDEBUG != 0 | |
492 | if (yydebug) | |
493 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | |
494 | #endif | |
495 | ||
496 | /* Discard the token being shifted unless it is eof. */ | |
497 | if (yychar != YYEOF) | |
498 | yychar = YYEMPTY; | |
499 | ||
500 | *++yyvsp = yylval; | |
501 | #ifdef YYLSP_NEEDED | |
502 | *++yylsp = yylloc; | |
503 | #endif | |
504 | ||
505 | /* count tokens shifted since error; after three, turn off error status. */ | |
506 | if (yyerrstatus) yyerrstatus--; | |
507 | ||
508 | yystate = yyn; | |
509 | goto yynewstate; | |
510 | ||
511 | /* Do the default action for the current state. */ | |
512 | yydefault: | |
513 | ||
514 | yyn = yydefact[yystate]; | |
515 | if (yyn == 0) | |
516 | goto yyerrlab; | |
517 | ||
518 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | |
519 | yyreduce: | |
520 | yylen = yyr2[yyn]; | |
fb75fa82 RS |
521 | if (yylen > 0) |
522 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | |
10fa2066 RS |
523 | |
524 | #if YYDEBUG != 0 | |
525 | if (yydebug) | |
526 | { | |
527 | int i; | |
528 | ||
529 | fprintf (stderr, "Reducing via rule %d (line %d), ", | |
530 | yyn, yyrline[yyn]); | |
531 | ||
532 | /* Print the symbols being reduced, and their result. */ | |
533 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | |
534 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | |
535 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | |
536 | } | |
537 | #endif | |
538 | ||
539 | $ /* the action file gets copied in in place of this dollarsign */ | |
70ddf897 | 540 | #line 541 "bison.simple" |
10fa2066 RS |
541 | \f |
542 | yyvsp -= yylen; | |
543 | yyssp -= yylen; | |
544 | #ifdef YYLSP_NEEDED | |
545 | yylsp -= yylen; | |
546 | #endif | |
547 | ||
548 | #if YYDEBUG != 0 | |
549 | if (yydebug) | |
550 | { | |
551 | short *ssp1 = yyss - 1; | |
552 | fprintf (stderr, "state stack now"); | |
553 | while (ssp1 != yyssp) | |
554 | fprintf (stderr, " %d", *++ssp1); | |
555 | fprintf (stderr, "\n"); | |
556 | } | |
557 | #endif | |
558 | ||
559 | *++yyvsp = yyval; | |
560 | ||
561 | #ifdef YYLSP_NEEDED | |
562 | yylsp++; | |
563 | if (yylen == 0) | |
564 | { | |
565 | yylsp->first_line = yylloc.first_line; | |
566 | yylsp->first_column = yylloc.first_column; | |
567 | yylsp->last_line = (yylsp-1)->last_line; | |
568 | yylsp->last_column = (yylsp-1)->last_column; | |
569 | yylsp->text = 0; | |
570 | } | |
571 | else | |
572 | { | |
573 | yylsp->last_line = (yylsp+yylen-1)->last_line; | |
574 | yylsp->last_column = (yylsp+yylen-1)->last_column; | |
575 | } | |
576 | #endif | |
577 | ||
578 | /* Now "shift" the result of the reduction. | |
579 | Determine what state that goes to, | |
580 | based on the state we popped back to | |
581 | and the rule number reduced by. */ | |
582 | ||
583 | yyn = yyr1[yyn]; | |
584 | ||
585 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | |
586 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | |
587 | yystate = yytable[yystate]; | |
588 | else | |
589 | yystate = yydefgoto[yyn - YYNTBASE]; | |
590 | ||
591 | goto yynewstate; | |
592 | ||
593 | yyerrlab: /* here on detecting error */ | |
594 | ||
595 | if (! yyerrstatus) | |
596 | /* If not already recovering from an error, report this error. */ | |
597 | { | |
598 | ++yynerrs; | |
599 | ||
600 | #ifdef YYERROR_VERBOSE | |
601 | yyn = yypact[yystate]; | |
602 | ||
603 | if (yyn > YYFLAG && yyn < YYLAST) | |
604 | { | |
605 | int size = 0; | |
606 | char *msg; | |
607 | int x, count; | |
608 | ||
609 | count = 0; | |
610 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | |
611 | for (x = (yyn < 0 ? -yyn : 0); | |
612 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
613 | if (yycheck[x + yyn] == x) | |
614 | size += strlen(yytname[x]) + 15, count++; | |
615 | msg = (char *) malloc(size + 15); | |
616 | if (msg != 0) | |
617 | { | |
618 | strcpy(msg, "parse error"); | |
619 | ||
620 | if (count < 5) | |
621 | { | |
622 | count = 0; | |
623 | for (x = (yyn < 0 ? -yyn : 0); | |
624 | x < (sizeof(yytname) / sizeof(char *)); x++) | |
625 | if (yycheck[x + yyn] == x) | |
626 | { | |
627 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | |
628 | strcat(msg, yytname[x]); | |
629 | strcat(msg, "'"); | |
630 | count++; | |
631 | } | |
632 | } | |
633 | yyerror(msg); | |
634 | free(msg); | |
635 | } | |
636 | else | |
637 | yyerror ("parse error; also virtual memory exceeded"); | |
638 | } | |
639 | else | |
640 | #endif /* YYERROR_VERBOSE */ | |
641 | yyerror("parse error"); | |
642 | } | |
643 | ||
644 | goto yyerrlab1; | |
645 | yyerrlab1: /* here on error raised explicitly by an action */ | |
646 | ||
647 | if (yyerrstatus == 3) | |
648 | { | |
649 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | |
650 | ||
651 | /* return failure if at end of input */ | |
652 | if (yychar == YYEOF) | |
653 | YYABORT; | |
654 | ||
655 | #if YYDEBUG != 0 | |
656 | if (yydebug) | |
657 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | |
658 | #endif | |
659 | ||
660 | yychar = YYEMPTY; | |
661 | } | |
662 | ||
663 | /* Else will try to reuse lookahead token | |
664 | after shifting the error token. */ | |
665 | ||
666 | yyerrstatus = 3; /* Each real token shifted decrements this */ | |
667 | ||
668 | goto yyerrhandle; | |
669 | ||
670 | yyerrdefault: /* current state does not do anything special for the error token. */ | |
671 | ||
672 | #if 0 | |
673 | /* This is wrong; only states that explicitly want error tokens | |
674 | should shift them. */ | |
675 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | |
676 | if (yyn) goto yydefault; | |
677 | #endif | |
678 | ||
679 | yyerrpop: /* pop the current state because it cannot handle the error token */ | |
680 | ||
681 | if (yyssp == yyss) YYABORT; | |
682 | yyvsp--; | |
683 | yystate = *--yyssp; | |
684 | #ifdef YYLSP_NEEDED | |
685 | yylsp--; | |
686 | #endif | |
687 | ||
688 | #if YYDEBUG != 0 | |
689 | if (yydebug) | |
690 | { | |
691 | short *ssp1 = yyss - 1; | |
692 | fprintf (stderr, "Error: state stack now"); | |
693 | while (ssp1 != yyssp) | |
694 | fprintf (stderr, " %d", *++ssp1); | |
695 | fprintf (stderr, "\n"); | |
696 | } | |
697 | #endif | |
698 | ||
699 | yyerrhandle: | |
700 | ||
701 | yyn = yypact[yystate]; | |
702 | if (yyn == YYFLAG) | |
703 | goto yyerrdefault; | |
704 | ||
705 | yyn += YYTERROR; | |
706 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | |
707 | goto yyerrdefault; | |
708 | ||
709 | yyn = yytable[yyn]; | |
710 | if (yyn < 0) | |
711 | { | |
712 | if (yyn == YYFLAG) | |
713 | goto yyerrpop; | |
714 | yyn = -yyn; | |
715 | goto yyreduce; | |
716 | } | |
717 | else if (yyn == 0) | |
718 | goto yyerrpop; | |
719 | ||
720 | if (yyn == YYFINAL) | |
721 | YYACCEPT; | |
722 | ||
723 | #if YYDEBUG != 0 | |
724 | if (yydebug) | |
725 | fprintf(stderr, "Shifting error token, "); | |
726 | #endif | |
727 | ||
728 | *++yyvsp = yylval; | |
729 | #ifdef YYLSP_NEEDED | |
730 | *++yylsp = yylloc; | |
731 | #endif | |
732 | ||
733 | yystate = yyn; | |
734 | goto yynewstate; | |
70ddf897 RS |
735 | |
736 | yyacceptlab: | |
737 | /* YYACCEPT comes here. */ | |
738 | if (yyfree_stacks) | |
739 | { | |
740 | free (yyss); | |
741 | free (yyvs); | |
742 | #ifdef YYLSP_NEEDED | |
743 | free (yyls); | |
744 | #endif | |
745 | } | |
746 | return 0; | |
747 | ||
748 | yyabortlab: | |
749 | /* YYABORT comes here. */ | |
750 | if (yyfree_stacks) | |
751 | { | |
752 | free (yyss); | |
753 | free (yyvs); | |
754 | #ifdef YYLSP_NEEDED | |
755 | free (yyls); | |
756 | #endif | |
757 | } | |
758 | return 1; | |
10fa2066 | 759 | } |