]> git.saurik.com Git - bison.git/blame_incremental - src/bison.simple
Instead of mapping the LHS of unused rules to -1, keep the LHS
[bison.git] / src / bison.simple
... / ...
CommitLineData
1/* -*- C -*- */
2
3/* A Bison parser, made from %%filename
4 by GNU bison %%version. */
5
6/* Skeleton output parser for bison,
7 Copyright 1984, 1989, 1990, 2000, 2001 Free Software Foundation, Inc.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
23
24/* As a special exception, when this file is copied by Bison into a
25 Bison output file, you may use that output file without restriction.
26 This special exception was added by the Free Software Foundation
27 in version 1.24 of Bison. */
28
29/* This is the parser code that is written into each bison parser when
30 the %semantic_parser declaration is not specified in the grammar.
31 It was written by Richard Stallman by simplifying the hairy parser
32 used when %semantic_parser is specified. */
33
34#include <stdio.h>
35
36/* If name_prefix is specify substitute the variables and functions
37 names. */
38#define yyparse %%prefix##parse
39#define yylex %%prefix##lex
40#define yyerror %%prefix##error
41#define yylval %%prefix##lval
42#define yychar %%prefix##char
43#define yydebug %%prefix##debug
44#define yynerrs %%prefix##nerrs
45
46/* Copy the user declarations. */
47#line %%input-line "%%filename"
48%%prologue
49
50#line %%line "%%skeleton"
51#ifndef __cplusplus
52# ifndef __STDC__
53# define const
54# endif
55#endif
56
57#ifndef YYSTACK_USE_ALLOCA
58# ifdef alloca
59# define YYSTACK_USE_ALLOCA 1
60# else /* alloca not defined */
61# ifdef __GNUC__
62# define YYSTACK_USE_ALLOCA 1
63# define alloca __builtin_alloca
64# else /* not GNU C. */
65# if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
66# define YYSTACK_USE_ALLOCA 1
67# include <alloca.h>
68# else /* not sparc */
69 /* We think this test detects Watcom and Microsoft C. */
70 /* This used to test MSDOS, but that is a bad idea since that
71 symbol is in the user namespace. */
72# if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
73# if 0
74 /* No need for malloc.h, which pollutes the namespace; instead,
75 just don't use alloca. */
76# include <malloc.h>
77# endif
78# else /* not MSDOS, or __TURBOC__ */
79# if defined(_AIX)
80 /* I don't know what this was needed for, but it pollutes the
81 namespace. So I turned it off. rms, 2 May 1997. */
82 /* #include <malloc.h> */
83 #pragma alloca
84# define YYSTACK_USE_ALLOCA 1
85# else /* not MSDOS, or __TURBOC__, or _AIX */
86# if 0
87 /* haible@ilog.fr says this works for HPUX 9.05 and up, and on
88 HPUX 10. Eventually we can turn this on. */
89# ifdef __hpux
90# define YYSTACK_USE_ALLOCA 1
91# define alloca __builtin_alloca
92# endif /* __hpux */
93# endif
94# endif /* not _AIX */
95# endif /* not MSDOS, or __TURBOC__ */
96# endif /* not sparc */
97# endif /* not GNU C */
98# endif /* alloca not defined */
99#endif /* YYSTACK_USE_ALLOCA not defined */
100
101#ifndef YYSTACK_USE_ALLOCA
102# define YYSTACK_USE_ALLOCA 0
103#endif
104
105#if YYSTACK_USE_ALLOCA
106# define YYSTACK_ALLOC alloca
107# define YYSTACK_FREE(Ptr) /* empty */
108#else
109# define YYSTACK_ALLOC malloc
110# define YYSTACK_FREE(Ptr) free (Ptr)
111#endif
112
113/* A type that is properly aligned for any stack member. */
114union yyalloc
115{
116 short yys;
117 YYSTYPE yyv;
118#if YYLSP_NEEDED
119 YYLTYPE yyl;
120#endif
121};
122
123/* The size of the maximum gap between one aligned stack and the next. */
124#define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
125
126/* The size of an array large to enough to hold all stacks, each with
127 N elements. */
128#if YYLSP_NEEDED
129# define YYSTACK_BYTES(N) \
130 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
131 + 2 * YYSTACK_GAP_MAX)
132#else
133# define YYSTACK_BYTES(N) \
134 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
135 + YYSTACK_GAP_MAX)
136#endif
137
138/* Relocate the TYPE STACK from its old location to the new one. The
139 local variables SIZE and YYSTACKSIZE give the old and new number of
140 elements in the stack, and YYPTR gives the new location of the
141 stack. Advance YYPTR to a properly aligned location for the next
142 stack. */
143#define YYSTACK_RELOCATE(Type, Stack) \
144do \
145 { \
146 size_t yynewbytes; \
147 __yy_memcpy (yyptr, (char *) (Stack), size * sizeof (Type)); \
148 (Stack) = (Type *) yyptr; \
149 yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
150 yynewbytes -= yynewbytes % sizeof (union yyalloc); \
151 yyptr += yynewbytes; \
152 } \
153while (0)
154
155#define YYBISON 1 /* Identify Bison output. */
156#define YYPURE %%pure /* Identify pure parsers. */
157
158#ifndef YYDEBUG
159# define YYDEBUG %%debug
160#endif
161
162#line %%input-line "%%filename"
163#ifndef YYSTYPE
164typedef %%stype yystype;
165# define YYSTYPE yystype
166#endif
167
168#ifndef YYLTYPE
169typedef struct yyltype
170{
171 int first_line;
172 int first_column;
173 int last_line;
174 int last_column;
175} yyltype;
176# define YYLTYPE %%ltype
177#endif
178
179#ifdef YYERROR_VERBOSE
180# undef YYERROR_VERBOSE
181#endif
182
183#define YYERROR_VERBOSE %%error-verbose
184
185/* Tokens. */
186%%tokendef
187
188#define YYFINAL %%final
189#define YYFLAG %%flag
190#define YYNTBASE %%ntbase
191#define YYLAST %%last
192
193#define YYNTOKENS %%ntokens
194#define YYNNTS %%nnts
195#define YYNRULES %%nrules
196#define YYNSTATES %%nstates
197#define YYMAXUTOK %%maxtok
198
199/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
200#define YYTRANSLATE(x) ((unsigned)(x) <= %%maxtok ? yytranslate[x] : %%nsym)
201
202/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
203static const char yytranslate[] =
204{
205 %%translate
206};
207
208#if YYDEBUG
209static const short yyprhs[] =
210{
211 %%prhs
212};
213
214static const short yyrhs[] =
215{
216 %%rhs
217};
218
219/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
220static const short yyrline[] =
221{
222 %%rline
223};
224#endif
225
226#if YYDEBUG || YYERROR_VERBOSE
227/* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
228static const char *const yytname[] =
229{
230 %%tname
231};
232#endif
233
234/* YYTOKNUM[YYN] -- Index in YYTNAME corresponding to YYLEX. */
235static const short yytoknum[] =
236{
237 %%toknum
238};
239
240/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
241static const short yyr1[] =
242{
243 %%r1
244};
245
246/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
247static const short yyr2[] =
248{
249 %%r2
250};
251
252/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
253 doesn't specify something else to do. Zero means the default is an
254 error. */
255static const short yydefact[] =
256{
257 %%defact
258};
259
260static const short yydefgoto[] =
261{
262 %%defgoto
263};
264
265static const short yypact[] =
266{
267 %%pact
268};
269
270static const short yypgoto[] =
271{
272 %%pgoto
273};
274
275static const short yytable[] =
276{
277 %%table
278};
279
280static const short yycheck[] =
281{
282 %%check
283};
284
285#define yyerrok (yyerrstatus = 0)
286#define yyclearin (yychar = YYEMPTY)
287#define YYEMPTY -2
288#define YYEOF 0
289
290#define YYACCEPT goto yyacceptlab
291#define YYABORT goto yyabortlab
292#define YYERROR goto yyerrlab1
293
294/* Like YYERROR except do call yyerror. This remains here temporarily
295 to ease the transition to the new meaning of YYERROR, for GCC.
296 Once GCC version 2 has supplanted version 1, this can go. */
297
298#define YYFAIL goto yyerrlab
299
300#define YYRECOVERING() (!!yyerrstatus)
301
302#define YYBACKUP(Token, Value) \
303do \
304 if (yychar == YYEMPTY && yylen == 1) \
305 { \
306 yychar = (Token); \
307 yylval = (Value); \
308 yychar1 = YYTRANSLATE (yychar); \
309 YYPOPSTACK; \
310 goto yybackup; \
311 } \
312 else \
313 { \
314 yyerror ("syntax error: cannot back up"); \
315 YYERROR; \
316 } \
317while (0)
318
319#define YYTERROR 1
320#define YYERRCODE 256
321
322/* YYLLOC_DEFAULT -- Compute the default location (before the actions
323 are run).
324
325 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
326 first token. By default, to implement support for ranges, extend
327 its range to the last symbol. */
328
329#ifndef YYLLOC_DEFAULT
330# define YYLLOC_DEFAULT(Current, Rhs, N) \
331 Current.last_line = Rhs[N].last_line; \
332 Current.last_column = Rhs[N].last_column;
333#endif
334
335/* Definition of YYLSP_NEEDED. */
336#define YYLSP_NEEDED %%locations-flag
337
338/* YYLEX -- calling `yylex' with the right arguments. */
339
340#if YYPURE
341# if YYLSP_NEEDED
342# ifdef YYLEX_PARAM
343# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
344# else
345# define YYLEX yylex (&yylval, &yylloc)
346# endif
347# else /* !YYLSP_NEEDED */
348# ifdef YYLEX_PARAM
349# define YYLEX yylex (&yylval, YYLEX_PARAM)
350# else
351# define YYLEX yylex (&yylval)
352# endif
353# endif /* !YYLSP_NEEDED */
354#else /* !YYPURE */
355# define YYLEX yylex ()
356#endif /* !YYPURE */
357
358/* Enable debugging if requested. */
359#if YYDEBUG
360# define YYDPRINTF(Args) \
361do { \
362 if (yydebug) \
363 fprintf Args; \
364} while (0)
365/* Nonzero means print parse trace. [The following comment makes no
366 sense to me. Could someone clarify it? --akim] Since this is
367 uninitialized, it does not stop multiple parsers from coexisting.
368 */
369int yydebug;
370#else /* !YYDEBUG */
371# define YYDPRINTF(Args)
372#endif /* !YYDEBUG */
373
374/* YYINITDEPTH -- initial size of the parser's stacks. */
375#ifndef YYINITDEPTH
376# define YYINITDEPTH %%initdepth
377#endif
378
379/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
380 if the built-in stack extension method is used).
381
382 Do not make this value too large; the results are undefined if
383 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
384 evaluated with infinite-precision integer arithmetic. */
385
386#if YYMAXDEPTH == 0
387# undef YYMAXDEPTH
388#endif
389
390#ifndef YYMAXDEPTH
391# define YYMAXDEPTH %%maxdepth
392#endif
393
394\f
395
396#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
397# define __yy_memcpy(To, From, Count) __builtin_memcpy (To, From, Count)
398#else /* not GNU C or C++ */
399
400/* This is the most reliable way to avoid incompatibilities
401 in available built-in functions on various systems. */
402static void
403# ifndef __cplusplus
404__yy_memcpy (to, from, count)
405 char *to;
406 const char *from;
407 size_t count;
408# else /* __cplusplus */
409__yy_memcpy (char *to, const char *from, size_t count)
410# endif
411{
412 register const char *f = from;
413 register char *t = to;
414 register size_t i = count;
415
416 while (i-- != 0)
417 *t++ = *f++;
418}
419#endif
420
421\f
422
423#line %%line "%%skeleton"
424
425/* The user can define YYPARSE_PARAM as the name of an argument to be passed
426 into yyparse. The argument should have type void *.
427 It should actually point to an object.
428 Grammar actions can access the variable by casting it
429 to the proper pointer type. */
430
431#ifdef YYPARSE_PARAM
432# ifdef __cplusplus
433# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
434# define YYPARSE_PARAM_DECL
435# else /* !__cplusplus */
436# define YYPARSE_PARAM_ARG YYPARSE_PARAM
437# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
438# endif /* !__cplusplus */
439#else /* !YYPARSE_PARAM */
440# define YYPARSE_PARAM_ARG
441# define YYPARSE_PARAM_DECL
442#endif /* !YYPARSE_PARAM */
443
444/* Prevent warning if -Wstrict-prototypes. */
445#ifdef __GNUC__
446# ifdef YYPARSE_PARAM
447int yyparse (void *);
448# else
449int yyparse (void);
450# endif
451#endif
452
453/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
454 variables are global, or local to YYPARSE. */
455
456#define _YY_DECL_VARIABLES \
457/* The lookahead symbol. */ \
458int yychar; \
459 \
460/* The semantic value of the lookahead symbol. */ \
461YYSTYPE yylval; \
462 \
463/* Number of parse errors so far. */ \
464int yynerrs;
465
466#if YYLSP_NEEDED
467# define YY_DECL_VARIABLES \
468_YY_DECL_VARIABLES \
469 \
470/* Location data for the lookahead symbol. */ \
471YYLTYPE yylloc;
472#else
473# define YY_DECL_VARIABLES \
474_YY_DECL_VARIABLES
475#endif
476
477/* If nonreentrant, generate the variables here. */
478
479#if !YYPURE
480YY_DECL_VARIABLES
481#endif /* !YYPURE */
482
483int
484yyparse (YYPARSE_PARAM_ARG)
485 YYPARSE_PARAM_DECL
486{
487 /* If reentrant, generate the variables here. */
488#if YYPURE
489 YY_DECL_VARIABLES
490#endif /* !YYPURE */
491
492 register int yystate;
493 register int yyn;
494 int yyresult;
495 /* Number of tokens to shift before error messages enabled. */
496 int yyerrstatus;
497 /* Lookahead token as an internal (translated) token number. */
498 int yychar1 = 0;
499
500 /* Three stacks and their tools:
501 `yyss': related to states,
502 `yyvs': related to semantic values,
503 `yyls': related to locations.
504
505 Refer to the stacks thru separate pointers, to allow yyoverflow
506 to reallocate them elsewhere. */
507
508 /* The state stack. */
509 short yyssa[YYINITDEPTH];
510 short *yyss = yyssa;
511 register short *yyssp;
512
513 /* The semantic value stack. */
514 YYSTYPE yyvsa[YYINITDEPTH];
515 YYSTYPE *yyvs = yyvsa;
516 register YYSTYPE *yyvsp;
517
518#if YYLSP_NEEDED
519 /* The location stack. */
520 YYLTYPE yylsa[YYINITDEPTH];
521 YYLTYPE *yyls = yylsa;
522 YYLTYPE *yylsp;
523#endif
524
525#if YYLSP_NEEDED
526# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
527#else
528# define YYPOPSTACK (yyvsp--, yyssp--)
529#endif
530
531 size_t yystacksize = YYINITDEPTH;
532
533 /* The variables used to return semantic value and location from the
534 action routines. */
535 YYSTYPE yyval;
536# if YYLSP_NEEDED
537 YYLTYPE yyloc;
538# endif
539
540 /* When reducing, the number of symbols on the RHS of the reduced
541 rule. */
542 int yylen;
543
544 YYDPRINTF ((stderr, "Starting parse\n"));
545
546 yystate = 0;
547 yyerrstatus = 0;
548 yynerrs = 0;
549 yychar = YYEMPTY; /* Cause a token to be read. */
550
551 /* Initialize stack pointers.
552 Waste one element of value and location stack
553 so that they stay on the same level as the state stack.
554 The wasted elements are never initialized. */
555
556 yyssp = yyss;
557 yyvsp = yyvs;
558#if YYLSP_NEEDED
559 yylsp = yyls;
560#endif
561 goto yysetstate;
562
563/*------------------------------------------------------------.
564| yynewstate -- Push a new state, which is found in yystate. |
565`------------------------------------------------------------*/
566 yynewstate:
567 /* In all cases, when you get here, the value and location stacks
568 have just been pushed. so pushing a state here evens the stacks.
569 */
570 yyssp++;
571
572 yysetstate:
573 *yyssp = yystate;
574
575 if (yyssp >= yyss + yystacksize - 1)
576 {
577 /* Get the current used size of the three stacks, in elements. */
578 size_t size = yyssp - yyss + 1;
579
580#ifdef yyoverflow
581 {
582 /* Give user a chance to reallocate the stack. Use copies of
583 these so that the &'s don't force the real ones into
584 memory. */
585 YYSTYPE *yyvs1 = yyvs;
586 short *yyss1 = yyss;
587
588 /* Each stack pointer address is followed by the size of the
589 data in use in that stack, in bytes. */
590# if YYLSP_NEEDED
591 YYLTYPE *yyls1 = yyls;
592 /* This used to be a conditional around just the two extra args,
593 but that might be undefined if yyoverflow is a macro. */
594 yyoverflow ("parser stack overflow",
595 &yyss1, size * sizeof (*yyssp),
596 &yyvs1, size * sizeof (*yyvsp),
597 &yyls1, size * sizeof (*yylsp),
598 &yystacksize);
599 yyls = yyls1;
600# else
601 yyoverflow ("parser stack overflow",
602 &yyss1, size * sizeof (*yyssp),
603 &yyvs1, size * sizeof (*yyvsp),
604 &yystacksize);
605# endif
606 yyss = yyss1;
607 yyvs = yyvs1;
608 }
609#else /* no yyoverflow */
610 /* Extend the stack our own way. */
611 if (yystacksize >= YYMAXDEPTH)
612 goto yyoverflowlab;
613 yystacksize *= 2;
614 if (yystacksize > YYMAXDEPTH)
615 yystacksize = YYMAXDEPTH;
616
617 {
618 short *yyss1 = yyss;
619 char *yyptr = (char *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
620 if (! yyptr)
621 goto yyoverflowlab;
622 YYSTACK_RELOCATE (short, yyss);
623 YYSTACK_RELOCATE (YYSTYPE, yyvs);
624# if YYLSP_NEEDED
625 YYSTACK_RELOCATE (YYLTYPE, yyls);
626# endif
627# undef YYSTACK_RELOCATE
628 if (yyss1 != yyssa)
629 YYSTACK_FREE (yyss1);
630 }
631#endif /* no yyoverflow */
632
633 yyssp = yyss + size - 1;
634 yyvsp = yyvs + size - 1;
635#if YYLSP_NEEDED
636 yylsp = yyls + size - 1;
637#endif
638
639 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
640 (unsigned long int) yystacksize));
641
642 if (yyssp >= yyss + yystacksize - 1)
643 YYABORT;
644 }
645
646 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
647
648 goto yybackup;
649
650/*-----------.
651| yybackup. |
652`-----------*/
653yybackup:
654
655/* Do appropriate processing given the current state. */
656/* Read a lookahead token if we need one and don't already have one. */
657/* yyresume: */
658
659 /* First try to decide what to do without reference to lookahead token. */
660
661 yyn = yypact[yystate];
662 if (yyn == YYFLAG)
663 goto yydefault;
664
665 /* Not known => get a lookahead token if don't already have one. */
666
667 /* yychar is either YYEMPTY or YYEOF
668 or a valid token in external form. */
669
670 if (yychar == YYEMPTY)
671 {
672 YYDPRINTF ((stderr, "Reading a token: "));
673 yychar = YYLEX;
674 }
675
676 /* Convert token to internal form (in yychar1) for indexing tables with. */
677
678 if (yychar <= 0) /* This means end of input. */
679 {
680 yychar1 = 0;
681 yychar = YYEOF; /* Don't call YYLEX any more. */
682
683 YYDPRINTF ((stderr, "Now at end of input.\n"));
684 }
685 else
686 {
687 yychar1 = YYTRANSLATE (yychar);
688
689#if YYDEBUG
690 /* We have to keep this `#if YYDEBUG', since we use variables
691 which are defined only if `YYDEBUG' is set. */
692 if (yydebug)
693 {
694 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
695 /* Give the individual parser a way to print the precise
696 meaning of a token, for further debugging info. */
697# ifdef YYPRINT
698 YYPRINT (stderr, yychar, yylval);
699# endif
700 fprintf (stderr, ")\n");
701 }
702#endif
703 }
704
705 yyn += yychar1;
706 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
707 goto yydefault;
708
709 yyn = yytable[yyn];
710
711 /* yyn is what to do for this token type in this state.
712 Negative => reduce, -yyn is rule number.
713 Positive => shift, yyn is new state.
714 New state is final state => don't bother to shift,
715 just return success.
716 0, or most negative number => error. */
717
718 if (yyn < 0)
719 {
720 if (yyn == YYFLAG)
721 goto yyerrlab;
722 yyn = -yyn;
723 goto yyreduce;
724 }
725 else if (yyn == 0)
726 goto yyerrlab;
727
728 if (yyn == YYFINAL)
729 YYACCEPT;
730
731 /* Shift the lookahead token. */
732 YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]));
733
734 /* Discard the token being shifted unless it is eof. */
735 if (yychar != YYEOF)
736 yychar = YYEMPTY;
737
738 *++yyvsp = yylval;
739#if YYLSP_NEEDED
740 *++yylsp = yylloc;
741#endif
742
743 /* Count tokens shifted since error; after three, turn off error
744 status. */
745 if (yyerrstatus)
746 yyerrstatus--;
747
748 yystate = yyn;
749 goto yynewstate;
750
751
752/*-----------------------------------------------------------.
753| yydefault -- do the default action for the current state. |
754`-----------------------------------------------------------*/
755yydefault:
756 yyn = yydefact[yystate];
757 if (yyn == 0)
758 goto yyerrlab;
759 goto yyreduce;
760
761
762/*-----------------------------.
763| yyreduce -- Do a reduction. |
764`-----------------------------*/
765yyreduce:
766 /* yyn is the number of a rule to reduce with. */
767 yylen = yyr2[yyn];
768
769 /* If YYLEN is nonzero, implement the default value of the action:
770 `$$ = $1'.
771
772 Otherwise, the following line sets YYVAL to the semantic value of
773 the lookahead token. This behavior is undocumented and Bison
774 users should not rely upon it. Assigning to YYVAL
775 unconditionally makes the parser a bit smaller, and it avoids a
776 GCC warning that YYVAL may be used uninitialized. */
777 yyval = yyvsp[1-yylen];
778
779#if YYLSP_NEEDED
780 /* Similarly for the default location. Let the user run additional
781 commands if for instance locations are ranges. */
782 yyloc = yylsp[1-yylen];
783 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
784#endif
785
786#if YYDEBUG
787 /* We have to keep this `#if YYDEBUG', since we use variables which
788 are defined only if `YYDEBUG' is set. */
789 if (yydebug)
790 {
791 int i;
792
793 fprintf (stderr, "Reducing via rule %d (line %d), ",
794 yyn, yyrline[yyn]);
795
796 /* Print the symbols being reduced, and their result. */
797 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
798 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
799 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
800 }
801#endif
802 switch (yyn)
803 {
804 %%action
805 }
806#line %%line "%%skeleton"
807\f
808 yyvsp -= yylen;
809 yyssp -= yylen;
810#if YYLSP_NEEDED
811 yylsp -= yylen;
812#endif
813
814#if YYDEBUG
815 if (yydebug)
816 {
817 short *ssp1 = yyss - 1;
818 fprintf (stderr, "state stack now");
819 while (ssp1 != yyssp)
820 fprintf (stderr, " %d", *++ssp1);
821 fprintf (stderr, "\n");
822 }
823#endif
824
825 *++yyvsp = yyval;
826#if YYLSP_NEEDED
827 *++yylsp = yyloc;
828#endif
829
830 /* Now `shift' the result of the reduction. Determine what state
831 that goes to, based on the state we popped back to and the rule
832 number reduced by. */
833
834 yyn = yyr1[yyn];
835
836 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
837 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
838 yystate = yytable[yystate];
839 else
840 yystate = yydefgoto[yyn - YYNTBASE];
841
842 goto yynewstate;
843
844
845/*------------------------------------.
846| yyerrlab -- here on detecting error |
847`------------------------------------*/
848yyerrlab:
849 /* If not already recovering from an error, report this error. */
850 if (!yyerrstatus)
851 {
852 ++yynerrs;
853
854#if YYERROR_VERBOSE
855 yyn = yypact[yystate];
856
857 if (yyn > YYFLAG && yyn < YYLAST)
858 {
859 size_t size = 0;
860 char *msg;
861 int x, count;
862
863 count = 0;
864 /* Start X at -YYN if negative to avoid negative indexes in
865 YYCHECK. */
866 for (x = yyn < 0 ? -yyn : 0;
867 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
868 if (yycheck[x + yyn] == x)
869 size += strlen (yytname[x]) + 15, count++;
870 size += strlen ("parse error, unexpected ") + 1;
871 size += strlen (yytname[YYTRANSLATE (yychar)]);
872 msg = (char *) malloc (size);
873 if (msg != 0)
874 {
875 strcpy (msg, "parse error, unexpected ");
876 strcat (msg, yytname[YYTRANSLATE (yychar)]);
877
878 if (count < 5)
879 {
880 count = 0;
881 for (x = yyn < 0 ? -yyn : 0;
882 x < (int) (sizeof (yytname) / sizeof (char *)); x++)
883 if (yycheck[x + yyn] == x)
884 {
885 strcat (msg, count == 0 ? ", expecting " : " or ");
886 strcat (msg, yytname[x]);
887 count++;
888 }
889 }
890 yyerror (msg);
891 free (msg);
892 }
893 else
894 yyerror ("parse error; also virtual memory exhausted");
895 }
896 else
897#endif /* YYERROR_VERBOSE */
898 yyerror ("parse error");
899 }
900 goto yyerrlab1;
901
902
903/*----------------------------------------------------.
904| yyerrlab1 -- error raised explicitly by an action. |
905`----------------------------------------------------*/
906yyerrlab1:
907 if (yyerrstatus == 3)
908 {
909 /* If just tried and failed to reuse lookahead token after an
910 error, discard it. */
911
912 /* Return failure if at end of input. */
913 if (yychar == YYEOF)
914 YYABORT;
915 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
916 yychar, yytname[yychar1]));
917 yychar = YYEMPTY;
918 }
919
920 /* Else will try to reuse lookahead token after shifting the error
921 token. */
922
923 yyerrstatus = 3; /* Each real token shifted decrements this. */
924
925 goto yyerrhandle;
926
927
928/*-------------------------------------------------------------------.
929| yyerrdefault -- current state does not do anything special for the |
930| error token. |
931`-------------------------------------------------------------------*/
932yyerrdefault:
933#if 0
934 /* This is wrong; only states that explicitly want error tokens
935 should shift them. */
936
937 /* If its default is to accept any token, ok. Otherwise pop it. */
938 yyn = yydefact[yystate];
939 if (yyn)
940 goto yydefault;
941#endif
942
943
944/*---------------------------------------------------------------.
945| yyerrpop -- pop the current state because it cannot handle the |
946| error token. |
947`---------------------------------------------------------------*/
948yyerrpop:
949 if (yyssp == yyss)
950 YYABORT;
951 yyvsp--;
952 yystate = *--yyssp;
953#if YYLSP_NEEDED
954 yylsp--;
955#endif
956
957#if YYDEBUG
958 if (yydebug)
959 {
960 short *ssp1 = yyss - 1;
961 fprintf (stderr, "Error: state stack now");
962 while (ssp1 != yyssp)
963 fprintf (stderr, " %d", *++ssp1);
964 fprintf (stderr, "\n");
965 }
966#endif
967
968/*--------------.
969| yyerrhandle. |
970`--------------*/
971yyerrhandle:
972 yyn = yypact[yystate];
973 if (yyn == YYFLAG)
974 goto yyerrdefault;
975
976 yyn += YYTERROR;
977 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
978 goto yyerrdefault;
979
980 yyn = yytable[yyn];
981 if (yyn < 0)
982 {
983 if (yyn == YYFLAG)
984 goto yyerrpop;
985 yyn = -yyn;
986 goto yyreduce;
987 }
988 else if (yyn == 0)
989 goto yyerrpop;
990
991 if (yyn == YYFINAL)
992 YYACCEPT;
993
994 YYDPRINTF ((stderr, "Shifting error token, "));
995
996 *++yyvsp = yylval;
997#if YYLSP_NEEDED
998 *++yylsp = yylloc;
999#endif
1000
1001 yystate = yyn;
1002 goto yynewstate;
1003
1004
1005/*-------------------------------------.
1006| yyacceptlab -- YYACCEPT comes here. |
1007`-------------------------------------*/
1008yyacceptlab:
1009 yyresult = 0;
1010 goto yyreturn;
1011
1012/*-----------------------------------.
1013| yyabortlab -- YYABORT comes here. |
1014`-----------------------------------*/
1015yyabortlab:
1016 yyresult = 1;
1017 goto yyreturn;
1018
1019/*---------------------------------------------.
1020| yyoverflowab -- parser overflow comes here. |
1021`---------------------------------------------*/
1022yyoverflowlab:
1023 yyerror ("parser stack overflow");
1024 yyresult = 2;
1025 /* Fall through. */
1026
1027yyreturn:
1028#ifndef yyoverflow
1029 if (yyss != yyssa)
1030 YYSTACK_FREE (yyss);
1031#endif
1032 return yyresult;
1033}
1034
1035#line %%input-line "%%filename"
1036%%epilogue