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