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