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