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