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