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