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