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