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