1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
\r
2 #line 3 "cfbison.simple"
\r
3 /* This file comes from bison-1.28. */
\r
5 /* Skeleton output parser for bison,
\r
6 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
\r
8 This program is free software; you can redistribute it and/or modify
\r
9 it under the terms of the GNU General Public License as published by
\r
10 the Free Software Foundation; either version 2, or (at your option)
\r
13 This program is distributed in the hope that it will be useful,
\r
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 GNU General Public License for more details.
\r
18 You should have received a copy of the GNU General Public License
\r
19 along with this program; if not, write to the Free Software
\r
20 Foundation, Inc., 59 Temple Place - Suite 330,
\r
21 Boston, MA 02111-1307, USA. */
\r
23 /* As a special exception, when this file is copied by Bison into a
\r
24 Bison output file, you may use that output file without restriction.
\r
25 This special exception was added by the Free Software Foundation
\r
26 in version 1.24 of Bison. */
\r
28 /* This is the parser code that is written into each bison parser
\r
29 when the %semantic_parser declaration is not specified in the grammar.
\r
30 It was written by Richard Stallman by simplifying the hairy parser
\r
31 used when %semantic_parser is specified. */
\r
33 #ifndef YYSTACK_USE_ALLOCA
\r
35 #define YYSTACK_USE_ALLOCA
\r
36 #else /* alloca not defined */
\r
38 #define YYSTACK_USE_ALLOCA
\r
39 #define alloca __builtin_alloca
\r
40 #else /* not GNU C. */
\r
41 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
\r
42 #define YYSTACK_USE_ALLOCA
\r
44 #else /* not sparc */
\r
45 /* We think this test detects Watcom and Microsoft C. */
\r
46 /* This used to test MSDOS, but that is a bad idea
\r
47 since that symbol is in the user namespace. */
\r
48 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
\r
49 #if 0 /* No need for malloc.h, which pollutes the namespace;
\r
50 instead, just don't use alloca. */
\r
53 #else /* not MSDOS, or __TURBOC__ */
\r
55 /* I don't know what this was needed for, but it pollutes the namespace.
\r
56 So I turned it off. rms, 2 May 1997. */
\r
57 /* #include <malloc.h> */
\r
59 #define YYSTACK_USE_ALLOCA
\r
60 #else /* not MSDOS, or __TURBOC__, or _AIX */
\r
62 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
\r
63 and on HPUX 10. Eventually we can turn this on. */
\r
64 #define YYSTACK_USE_ALLOCA
\r
65 #define alloca __builtin_alloca
\r
68 #endif /* not _AIX */
\r
69 #endif /* not MSDOS, or __TURBOC__ */
\r
70 #endif /* not sparc */
\r
71 #endif /* not GNU C */
\r
72 #endif /* alloca not defined */
\r
73 #endif /* YYSTACK_USE_ALLOCA not defined */
\r
75 #ifdef YYSTACK_USE_ALLOCA
\r
76 #define YYSTACK_ALLOC alloca
\r
78 #define YYSTACK_ALLOC malloc
\r
81 /* Note: there must be only one dollar sign in this file.
\r
82 It is replaced by the list of actions, each action
\r
83 as one case of the switch. */
\r
85 #define yyerrok (yyerrstatus = 0)
\r
86 #define yyclearin (yychar = YYEMPTY)
\r
89 #define YYACCEPT goto yyacceptlab
\r
90 #define YYABORT goto yyabortlab
\r
91 #define YYERROR goto yyerrlab1
\r
92 /* Like YYERROR except do call yyerror.
\r
93 This remains here temporarily to ease the
\r
94 transition to the new meaning of YYERROR, for GCC.
\r
95 Once GCC version 2 has supplanted version 1, this can go. */
\r
96 #define YYFAIL goto yyerrlab
\r
97 #define YYRECOVERING() (!!yyerrstatus)
\r
98 #define YYBACKUP(token, value) \
\r
100 if (yychar == YYEMPTY && yylen == 1) \
\r
101 { yychar = (token), yylval = (value); \
\r
102 yychar1 = YYTRANSLATE (yychar); \
\r
107 { yyerror ("syntax error: cannot back up"); YYERROR; } \
\r
111 #define YYERRCODE 256
\r
114 #define YYLEX yylex()
\r
118 #ifdef YYLSP_NEEDED
\r
120 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
\r
122 #define YYLEX yylex(&yylval, &yylloc)
\r
124 #else /* not YYLSP_NEEDED */
\r
126 #define YYLEX yylex(&yylval, YYLEX_PARAM)
\r
128 #define YYLEX yylex(&yylval)
\r
130 #endif /* not YYLSP_NEEDED */
\r
133 /* If nonreentrant, generate the variables here */
\r
137 int yychar; /* the lookahead symbol */
\r
138 YYSTYPE yylval; /* the semantic value of the */
\r
139 /* lookahead symbol */
\r
141 #ifdef YYLSP_NEEDED
\r
142 YYLTYPE yylloc; /* location data for the lookahead */
\r
146 int yynerrs; /* number of parse errors so far */
\r
147 #endif /* not YYPURE */
\r
150 int yydebug; /* nonzero means print parse trace */
\r
151 /* Since this is uninitialized, it does not stop multiple parsers
\r
152 from coexisting. */
\r
155 /* YYINITDEPTH indicates the initial size of the parser's stacks */
\r
157 #ifndef YYINITDEPTH
\r
158 #define YYINITDEPTH 200
\r
161 /* YYMAXDEPTH is the maximum size the stacks can grow to
\r
162 (effective only if the built-in stack extension method is used). */
\r
164 #if YYMAXDEPTH == 0
\r
169 #define YYMAXDEPTH 10000
\r
172 /* Define __yy_memcpy. Note that the size argument
\r
173 should be passed with type unsigned int, because that is what the non-GCC
\r
174 definitions require. With GCC, __builtin_memcpy takes an arg
\r
175 of type size_t, but it can handle unsigned int. */
\r
177 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
\r
178 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
\r
179 #else /* not GNU C or C++ */
\r
180 #ifndef __cplusplus
\r
182 /* This is the most reliable way to avoid incompatibilities
\r
183 in available built-in functions on various systems. */
\r
185 __yy_memcpy (to, from, count)
\r
188 unsigned int count;
\r
190 register char *f = from;
\r
191 register char *t = to;
\r
192 register int i = count;
\r
198 #else /* __cplusplus */
\r
200 /* This is the most reliable way to avoid incompatibilities
\r
201 in available built-in functions on various systems. */
\r
203 __yy_memcpy (char *to, char *from, unsigned int count)
\r
205 register char *t = to;
\r
206 register char *f = from;
\r
207 register int i = count;
\r
216 #line 217 "cfbison.simple"
\r
218 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
\r
219 into yyparse. The argument should have type void *.
\r
220 It should actually point to an object.
\r
221 Grammar actions can access the variable by casting it
\r
222 to the proper pointer type. */
\r
224 #ifdef YYPARSE_PARAM
\r
226 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
\r
227 #define YYPARSE_PARAM_DECL
\r
228 #else /* not __cplusplus */
\r
229 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
\r
230 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
\r
231 #endif /* not __cplusplus */
\r
232 #else /* not YYPARSE_PARAM */
\r
233 #define YYPARSE_PARAM_ARG
\r
234 #define YYPARSE_PARAM_DECL
\r
235 #endif /* not YYPARSE_PARAM */
\r
237 /* Prevent warning if -Wstrict-prototypes. */
\r
239 #ifdef YYPARSE_PARAM
\r
240 int yyparse (void *);
\r
242 int yyparse (void);
\r
247 yyparse(YYPARSE_PARAM_ARG)
\r
250 register int yystate;
\r
252 register short *yyssp;
\r
253 register YYSTYPE *yyvsp;
\r
254 int yyerrstatus; /* number of tokens to shift before error messages enabled */
\r
255 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
\r
257 short yyssa[YYINITDEPTH]; /* the state stack */
\r
258 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
\r
260 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
\r
261 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
\r
263 #ifdef YYLSP_NEEDED
\r
264 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
\r
265 YYLTYPE *yyls = yylsa;
\r
268 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
\r
270 #define YYPOPSTACK (yyvsp--, yyssp--)
\r
273 int yystacksize = YYINITDEPTH;
\r
274 int yyfree_stacks = 0;
\r
280 #ifdef YYLSP_NEEDED
\r
285 YYSTYPE yyval; /* the variable used to return */
\r
286 /* semantic values from the action */
\r
288 // ace: big fake for VC7 because it checks if yyval is init or not
\r
294 fprintf(stderr, "Starting parse\n");
\r
300 yychar = YYEMPTY; /* Cause a token to be read. */
\r
302 /* Initialize stack pointers.
\r
303 Waste one element of value and location stack
\r
304 so that they stay on the same level as the state stack.
\r
305 The wasted elements are never initialized. */
\r
309 #ifdef YYLSP_NEEDED
\r
313 /* Push a new state, which is found in yystate . */
\r
314 /* In all cases, when you get here, the value and location stacks
\r
315 have just been pushed. so pushing a state here evens the stacks. */
\r
318 *++yyssp = yystate;
\r
320 if (yyssp >= yyss + yystacksize - 1)
\r
322 /* Give user a chance to reallocate the stack */
\r
323 /* Use copies of these so that the &'s don't force the real ones into memory. */
\r
324 YYSTYPE *yyvs1 = yyvs;
\r
325 short *yyss1 = yyss;
\r
326 #ifdef YYLSP_NEEDED
\r
327 YYLTYPE *yyls1 = yyls;
\r
330 /* Get the current used size of the three stacks, in elements. */
\r
331 int size = (int)(yyssp - yyss + 1);
\r
334 /* Each stack pointer address is followed by the size of
\r
335 the data in use in that stack, in bytes. */
\r
336 #ifdef YYLSP_NEEDED
\r
337 /* This used to be a conditional around just the two extra args,
\r
338 but that might be undefined if yyoverflow is a macro. */
\r
339 yyoverflow("parser stack overflow",
\r
340 &yyss1, size * sizeof (*yyssp),
\r
341 &yyvs1, size * sizeof (*yyvsp),
\r
342 &yyls1, size * sizeof (*yylsp),
\r
345 yyoverflow("parser stack overflow",
\r
346 &yyss1, size * sizeof (*yyssp),
\r
347 &yyvs1, size * sizeof (*yyvsp),
\r
351 yyss = yyss1; yyvs = yyvs1;
\r
352 #ifdef YYLSP_NEEDED
\r
355 #else /* no yyoverflow */
\r
356 /* Extend the stack our own way. */
\r
357 if (yystacksize >= YYMAXDEPTH)
\r
359 yyerror("parser stack overflow");
\r
364 #ifdef YYLSP_NEEDED
\r
371 if (yystacksize > YYMAXDEPTH)
\r
372 yystacksize = YYMAXDEPTH;
\r
373 #ifndef YYSTACK_USE_ALLOCA
\r
376 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
\r
377 __yy_memcpy ((char *)yyss, (char *)yyss1,
\r
378 size * (unsigned int) sizeof (*yyssp));
\r
379 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
\r
380 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
\r
381 size * (unsigned int) sizeof (*yyvsp));
\r
382 #ifdef YYLSP_NEEDED
\r
383 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
\r
384 __yy_memcpy ((char *)yyls, (char *)yyls1,
\r
385 size * (unsigned int) sizeof (*yylsp));
\r
387 #endif /* no yyoverflow */
\r
389 yyssp = yyss + size - 1;
\r
390 yyvsp = yyvs + size - 1;
\r
391 #ifdef YYLSP_NEEDED
\r
392 yylsp = yyls + size - 1;
\r
397 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
\r
400 if (yyssp >= yyss + yystacksize - 1)
\r
406 fprintf(stderr, "Entering state %d\n", yystate);
\r
412 /* Do appropriate processing given the current state. */
\r
413 /* Read a lookahead token if we need one and don't already have one. */
\r
416 /* First try to decide what to do without reference to lookahead token. */
\r
418 yyn = yypact[yystate];
\r
422 /* Not known => get a lookahead token if don't already have one. */
\r
424 /* yychar is either YYEMPTY or YYEOF
\r
425 or a valid token in external form. */
\r
427 if (yychar == YYEMPTY)
\r
431 fprintf(stderr, "Reading a token: ");
\r
436 /* Convert token to internal form (in yychar1) for indexing tables with */
\r
438 if (yychar <= 0) /* This means end of input. */
\r
441 yychar = YYEOF; /* Don't call YYLEX any more */
\r
445 fprintf(stderr, "Now at end of input.\n");
\r
450 yychar1 = YYTRANSLATE(yychar);
\r
455 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
\r
456 /* Give the individual parser a way to print the precise meaning
\r
457 of a token, for further debugging info. */
\r
459 YYPRINT (stderr, yychar, yylval);
\r
461 fprintf (stderr, ")\n");
\r
467 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
\r
470 yyn = yytable[yyn];
\r
472 /* yyn is what to do for this token type in this state.
\r
473 Negative => reduce, -yyn is rule number.
\r
474 Positive => shift, yyn is new state.
\r
475 New state is final state => don't bother to shift,
\r
476 just return success.
\r
477 0, or most negative number => error. */
\r
489 if (yyn == YYFINAL)
\r
492 /* Shift the lookahead token. */
\r
496 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
\r
499 /* Discard the token being shifted unless it is eof. */
\r
500 if (yychar != YYEOF)
\r
504 #ifdef YYLSP_NEEDED
\r
508 /* count tokens shifted since error; after three, turn off error status. */
\r
509 if (yyerrstatus) yyerrstatus--;
\r
514 /* Do the default action for the current state. */
\r
517 yyn = yydefact[yystate];
\r
521 /* Do a reduction. yyn is the number of a rule to reduce with. */
\r
525 yyval = yyvsp[1-yylen]; /* implement default value of the action */
\r
532 fprintf (stderr, "Reducing via rule %d (line %d), ",
\r
533 yyn, yyrline[yyn]);
\r
535 /* Print the symbols being reduced, and their result. */
\r
536 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
\r
537 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
\r
538 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
\r
542 $ /* the action file gets copied in in place of this dollarsign */
\r
543 #line 543 "cfbison.simple"
\r
547 #ifdef YYLSP_NEEDED
\r
554 short *ssp1 = yyss - 1;
\r
555 fprintf (stderr, "state stack now");
\r
556 while (ssp1 != yyssp)
\r
557 fprintf (stderr, " %d", *++ssp1);
\r
558 fprintf (stderr, "\n");
\r
564 #ifdef YYLSP_NEEDED
\r
568 yylsp->first_line = yylloc.first_line;
\r
569 yylsp->first_column = yylloc.first_column;
\r
570 yylsp->last_line = (yylsp-1)->last_line;
\r
571 yylsp->last_column = (yylsp-1)->last_column;
\r
576 yylsp->last_line = (yylsp+yylen-1)->last_line;
\r
577 yylsp->last_column = (yylsp+yylen-1)->last_column;
\r
581 /* Now "shift" the result of the reduction.
\r
582 Determine what state that goes to,
\r
583 based on the state we popped back to
\r
584 and the rule number reduced by. */
\r
588 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
\r
589 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
\r
590 yystate = yytable[yystate];
\r
592 yystate = yydefgoto[yyn - YYNTBASE];
\r
596 yyerrlab: /* here on detecting error */
\r
599 /* If not already recovering from an error, report this error. */
\r
603 #ifdef YYERROR_VERBOSE
\r
604 yyn = yypact[yystate];
\r
606 if (yyn > YYFLAG && yyn < YYLAST)
\r
613 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
\r
614 for (x = (yyn < 0 ? -yyn : 0);
\r
615 x < (sizeof(yytname) / sizeof(char *)); x++)
\r
616 if (yycheck[x + yyn] == x)
\r
617 size += strlen(yytname[x]) + 15, count++;
\r
618 msg = (char *) malloc(size + 15);
\r
621 strcpy(msg, "parse error");
\r
626 for (x = (yyn < 0 ? -yyn : 0);
\r
627 x < (sizeof(yytname) / sizeof(char *)); x++)
\r
628 if (yycheck[x + yyn] == x)
\r
630 strcat(msg, count == 0 ? ", expecting `" : " or `");
\r
631 strcat(msg, yytname[x]);
\r
640 yyerror ("parse error; also virtual memory exceeded");
\r
643 #endif /* YYERROR_VERBOSE */
\r
644 yyerror("parse error");
\r
648 yyerrlab1: /* here on error raised explicitly by an action */
\r
650 if (yyerrstatus == 3)
\r
652 /* if just tried and failed to reuse lookahead token after an error, discard it. */
\r
654 /* return failure if at end of input */
\r
655 if (yychar == YYEOF)
\r
660 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
\r
666 /* Else will try to reuse lookahead token
\r
667 after shifting the error token. */
\r
669 yyerrstatus = 3; /* Each real token shifted decrements this */
\r
673 yyerrdefault: /* current state does not do anything special for the error token. */
\r
676 /* This is wrong; only states that explicitly want error tokens
\r
677 should shift them. */
\r
678 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
\r
679 if (yyn) goto yydefault;
\r
682 yyerrpop: /* pop the current state because it cannot handle the error token */
\r
684 if (yyssp == yyss) YYABORT;
\r
686 yystate = *--yyssp;
\r
687 #ifdef YYLSP_NEEDED
\r
694 short *ssp1 = yyss - 1;
\r
695 fprintf (stderr, "Error: state stack now");
\r
696 while (ssp1 != yyssp)
\r
697 fprintf (stderr, " %d", *++ssp1);
\r
698 fprintf (stderr, "\n");
\r
704 yyn = yypact[yystate];
\r
709 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
\r
712 yyn = yytable[yyn];
\r
723 if (yyn == YYFINAL)
\r
728 fprintf(stderr, "Shifting error token, ");
\r
732 #ifdef YYLSP_NEEDED
\r
740 /* YYACCEPT comes here. */
\r
745 #ifdef YYLSP_NEEDED
\r
752 /* YYABORT comes here. */
\r
757 #ifdef YYLSP_NEEDED
\r