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