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