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