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