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