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