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