[project @ 1996-11-15 17:29:21 by sof]
[ghc-hetmet.git] / ghc / utils / ugen / syntax.tab.c
1
2 /*  A Bison parser, made from syntax.y with Bison version GNU Bison version 1.21
3   */
4
5 #define YYBISON 1  /* Identify Bison output.  */
6
7 #define ID      258
8 #define TYPE    259
9 #define SEMICOL 260
10 #define COLON   261
11 #define END     262
12 #define STDEF   263
13 #define ENDDEF  264
14
15 #line 1 "syntax.y"
16
17 #define YYSTYPE long
18 # include "id.h"
19 # include "tree.h"
20 extern tree root;
21
22 #ifndef YYLTYPE
23 typedef
24   struct yyltype
25     {
26       int timestamp;
27       int first_line;
28       int first_column;
29       int last_line;
30       int last_column;
31       char *text;
32    }
33   yyltype;
34
35 #define YYLTYPE yyltype
36 #endif
37
38 #ifndef YYSTYPE
39 #define YYSTYPE int
40 #endif
41 #include <stdio.h>
42
43 #ifndef __cplusplus
44 #ifndef __STDC__
45 #define const
46 #endif
47 #endif
48
49
50
51 #define YYFINAL         25
52 #define YYFLAG          -32768
53 #define YYNTBASE        10
54
55 #define YYTRANSLATE(x) ((unsigned)(x) <= 264 ? yytranslate[x] : 15)
56
57 static const char yytranslate[] = {     0,
58      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
59      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
60      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
61      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
62      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
63      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
64      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
65      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
66      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
67      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
68      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
69      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
70      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
71      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
72      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
73      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
74      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
75      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
76      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
77      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
78      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
79      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
80      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
81      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
82      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
83      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
84      6,     7,     8,     9
85 };
86
87 #if YYDEBUG != 0
88 static const short yyprhs[] = {     0,
89      0,     7,     9,    12,    19,    25,    27,    30
90 };
91
92 static const short yyrhs[] = {     4,
93      3,     5,    11,     7,     5,     0,    12,     0,    11,    12,
94      0,     3,     6,     8,    13,     9,     5,     0,     3,     6,
95      8,     9,     5,     0,    14,     0,    13,    14,     0,     3,
96      6,     3,     5,     0
97 };
98
99 #endif
100
101 #if YYDEBUG != 0
102 static const short yyrline[] = { 0,
103     10,    16,    20,    26,    30,    36,    40,    46
104 };
105
106 static const char * const yytname[] = {   "$","error","$illegal.","ID","TYPE",
107 "SEMICOL","COLON","END","STDEF","ENDDEF","typdef","deflist","def","itemlist",
108 "item",""
109 };
110 #endif
111
112 static const short yyr1[] = {     0,
113     10,    11,    11,    12,    12,    13,    13,    14
114 };
115
116 static const short yyr2[] = {     0,
117      6,     1,     2,     6,     5,     1,     2,     4
118 };
119
120 static const short yydefact[] = {     0,
121      0,     0,     0,     0,     0,     2,     0,     0,     3,     0,
122      1,     0,     0,     0,     6,     0,     5,     0,     7,     0,
123      4,     8,     0,     0,     0
124 };
125
126 static const short yydefgoto[] = {    23,
127      5,     6,    14,    15
128 };
129
130 static const short yypact[] = {    -1,
131      2,     4,     7,    -4,     1,-32768,     3,     8,-32768,    -3,
132 -32768,     6,     9,    -2,-32768,    12,-32768,    11,-32768,    13,
133 -32768,-32768,    17,    19,-32768
134 };
135
136 static const short yypgoto[] = {-32768,
137 -32768,    15,-32768,    10
138 };
139
140
141 #define YYLAST          24
142
143
144 static const short yytable[] = {    12,
145     12,     7,     1,     4,     2,    13,    18,     8,     3,     4,
146     10,    16,    11,    17,    20,    21,    24,    22,    25,     9,
147      0,     0,     0,    19
148 };
149
150 static const short yycheck[] = {     3,
151      3,     6,     4,     3,     3,     9,     9,     7,     5,     3,
152      8,     6,     5,     5,     3,     5,     0,     5,     0,     5,
153     -1,    -1,    -1,    14
154 };
155 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
156 #line 3 "/usr/local/gnu/lib/bison.simple"
157
158 /* Skeleton output parser for bison,
159    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
160
161    This program is free software; you can redistribute it and/or modify
162    it under the terms of the GNU General Public License as published by
163    the Free Software Foundation; either version 1, or (at your option)
164    any later version.
165
166    This program is distributed in the hope that it will be useful,
167    but WITHOUT ANY WARRANTY; without even the implied warranty of
168    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
169    GNU General Public License for more details.
170
171    You should have received a copy of the GNU General Public License
172    along with this program; if not, write to the Free Software
173    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
174
175
176 #ifndef alloca
177 #ifdef __GNUC__
178 #define alloca __builtin_alloca
179 #else /* not GNU C.  */
180 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
181 #include <alloca.h>
182 #else /* not sparc */
183 #if defined (MSDOS) && !defined (__TURBOC__)
184 #include <malloc.h>
185 #else /* not MSDOS, or __TURBOC__ */
186 #if defined(_AIX)
187 #include <malloc.h>
188  #pragma alloca
189 #else /* not MSDOS, __TURBOC__, or _AIX */
190 #ifdef __hpux
191 #ifdef __cplusplus
192 extern "C" {
193 void *alloca (unsigned int);
194 };
195 #else /* not __cplusplus */
196 void *alloca (unsigned int);
197 #endif /* not __cplusplus */
198 #endif /* __hpux */
199 #endif /* not _AIX */
200 #endif /* not MSDOS, or __TURBOC__ */
201 #endif /* not sparc.  */
202 #endif /* not GNU C.  */
203 #endif /* alloca not defined.  */
204
205 /* This is the parser code that is written into each bison parser
206   when the %semantic_parser declaration is not specified in the grammar.
207   It was written by Richard Stallman by simplifying the hairy parser
208   used when %semantic_parser is specified.  */
209
210 /* Note: there must be only one dollar sign in this file.
211    It is replaced by the list of actions, each action
212    as one case of the switch.  */
213
214 #define yyerrok         (yyerrstatus = 0)
215 #define yyclearin       (yychar = YYEMPTY)
216 #define YYEMPTY         -2
217 #define YYEOF           0
218 #define YYACCEPT        return(0)
219 #define YYABORT         return(1)
220 #define YYERROR         goto yyerrlab1
221 /* Like YYERROR except do call yyerror.
222    This remains here temporarily to ease the
223    transition to the new meaning of YYERROR, for GCC.
224    Once GCC version 2 has supplanted version 1, this can go.  */
225 #define YYFAIL          goto yyerrlab
226 #define YYRECOVERING()  (!!yyerrstatus)
227 #define YYBACKUP(token, value) \
228 do                                                              \
229   if (yychar == YYEMPTY && yylen == 1)                          \
230     { yychar = (token), yylval = (value);                       \
231       yychar1 = YYTRANSLATE (yychar);                           \
232       YYPOPSTACK;                                               \
233       goto yybackup;                                            \
234     }                                                           \
235   else                                                          \
236     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
237 while (0)
238
239 #define YYTERROR        1
240 #define YYERRCODE       256
241
242 #ifndef YYPURE
243 #define YYLEX           yylex()
244 #endif
245
246 #ifdef YYPURE
247 #ifdef YYLSP_NEEDED
248 #define YYLEX           yylex(&yylval, &yylloc)
249 #else
250 #define YYLEX           yylex(&yylval)
251 #endif
252 #endif
253
254 /* If nonreentrant, generate the variables here */
255
256 #ifndef YYPURE
257
258 int     yychar;                 /*  the lookahead symbol                */
259 YYSTYPE yylval;                 /*  the semantic value of the           */
260                                 /*  lookahead symbol                    */
261
262 #ifdef YYLSP_NEEDED
263 YYLTYPE yylloc;                 /*  location data for the lookahead     */
264                                 /*  symbol                              */
265 #endif
266
267 int yynerrs;                    /*  number of parse errors so far       */
268 #endif  /* not YYPURE */
269
270 #if YYDEBUG != 0
271 int yydebug;                    /*  nonzero means print parse trace     */
272 /* Since this is uninitialized, it does not stop multiple parsers
273    from coexisting.  */
274 #endif
275
276 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
277
278 #ifndef YYINITDEPTH
279 #define YYINITDEPTH 200
280 #endif
281
282 /*  YYMAXDEPTH is the maximum size the stacks can grow to
283     (effective only if the built-in stack extension method is used).  */
284
285 #if YYMAXDEPTH == 0
286 #undef YYMAXDEPTH
287 #endif
288
289 #ifndef YYMAXDEPTH
290 #define YYMAXDEPTH 10000
291 #endif
292
293 /* Prevent warning if -Wstrict-prototypes.  */
294 #ifdef __GNUC__
295 int yyparse (void);
296 #endif
297 \f
298 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
299 #define __yy_bcopy(FROM,TO,COUNT)       __builtin_memcpy(TO,FROM,COUNT)
300 #else                           /* not GNU C or C++ */
301 #ifndef __cplusplus
302
303 /* This is the most reliable way to avoid incompatibilities
304    in available built-in functions on various systems.  */
305 static void
306 __yy_bcopy (from, to, count)
307      char *from;
308      char *to;
309      int count;
310 {
311   register char *f = from;
312   register char *t = to;
313   register int i = count;
314
315   while (i-- > 0)
316     *t++ = *f++;
317 }
318
319 #else /* __cplusplus */
320
321 /* This is the most reliable way to avoid incompatibilities
322    in available built-in functions on various systems.  */
323 static void
324 __yy_bcopy (char *from, char *to, int count)
325 {
326   register char *f = from;
327   register char *t = to;
328   register int i = count;
329
330   while (i-- > 0)
331     *t++ = *f++;
332 }
333
334 #endif
335 #endif
336 \f
337 #line 184 "/usr/local/gnu/lib/bison.simple"
338 int
339 yyparse()
340 {
341   register int yystate;
342   register int yyn;
343   register short *yyssp;
344   register YYSTYPE *yyvsp;
345   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
346   int yychar1;          /*  lookahead token as an internal (translated) token number */
347
348   short yyssa[YYINITDEPTH];     /*  the state stack                     */
349   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
350
351   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
352   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
353
354 #ifdef YYLSP_NEEDED
355   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
356   YYLTYPE *yyls = yylsa;
357   YYLTYPE *yylsp;
358
359 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
360 #else
361 #define YYPOPSTACK   (yyvsp--, yyssp--)
362 #endif
363
364   int yystacksize = YYINITDEPTH;
365
366 #ifdef YYPURE
367   int yychar;
368   YYSTYPE yylval;
369   int yynerrs;
370 #ifdef YYLSP_NEEDED
371   YYLTYPE yylloc;
372 #endif
373 #endif
374
375   YYSTYPE yyval;                /*  the variable used to return         */
376                                 /*  semantic values from the action     */
377                                 /*  routines                            */
378
379   int yylen;
380
381 #if YYDEBUG != 0
382   if (yydebug)
383     fprintf(stderr, "Starting parse\n");
384 #endif
385
386   yystate = 0;
387   yyerrstatus = 0;
388   yynerrs = 0;
389   yychar = YYEMPTY;             /* Cause a token to be read.  */
390
391   /* Initialize stack pointers.
392      Waste one element of value and location stack
393      so that they stay on the same level as the state stack.
394      The wasted elements are never initialized.  */
395
396   yyssp = yyss - 1;
397   yyvsp = yyvs;
398 #ifdef YYLSP_NEEDED
399   yylsp = yyls;
400 #endif
401
402 /* Push a new state, which is found in  yystate  .  */
403 /* In all cases, when you get here, the value and location stacks
404    have just been pushed. so pushing a state here evens the stacks.  */
405 yynewstate:
406
407   *++yyssp = yystate;
408
409   if (yyssp >= yyss + yystacksize - 1)
410     {
411       /* Give user a chance to reallocate the stack */
412       /* Use copies of these so that the &'s don't force the real ones into memory. */
413       YYSTYPE *yyvs1 = yyvs;
414       short *yyss1 = yyss;
415 #ifdef YYLSP_NEEDED
416       YYLTYPE *yyls1 = yyls;
417 #endif
418
419       /* Get the current used size of the three stacks, in elements.  */
420       int size = yyssp - yyss + 1;
421
422 #ifdef yyoverflow
423       /* Each stack pointer address is followed by the size of
424          the data in use in that stack, in bytes.  */
425       yyoverflow("parser stack overflow",
426                  &yyss1, size * sizeof (*yyssp),
427                  &yyvs1, size * sizeof (*yyvsp),
428 #ifdef YYLSP_NEEDED
429                  &yyls1, size * sizeof (*yylsp),
430 #endif
431                  &yystacksize);
432
433       yyss = yyss1; yyvs = yyvs1;
434 #ifdef YYLSP_NEEDED
435       yyls = yyls1;
436 #endif
437 #else /* no yyoverflow */
438       /* Extend the stack our own way.  */
439       if (yystacksize >= YYMAXDEPTH)
440         {
441           yyerror("parser stack overflow");
442           return 2;
443         }
444       yystacksize *= 2;
445       if (yystacksize > YYMAXDEPTH)
446         yystacksize = YYMAXDEPTH;
447       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
448       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
449       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
450       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
451 #ifdef YYLSP_NEEDED
452       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
453       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
454 #endif
455 #endif /* no yyoverflow */
456
457       yyssp = yyss + size - 1;
458       yyvsp = yyvs + size - 1;
459 #ifdef YYLSP_NEEDED
460       yylsp = yyls + size - 1;
461 #endif
462
463 #if YYDEBUG != 0
464       if (yydebug)
465         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
466 #endif
467
468       if (yyssp >= yyss + yystacksize - 1)
469         YYABORT;
470     }
471
472 #if YYDEBUG != 0
473   if (yydebug)
474     fprintf(stderr, "Entering state %d\n", yystate);
475 #endif
476
477   goto yybackup;
478  yybackup:
479
480 /* Do appropriate processing given the current state.  */
481 /* Read a lookahead token if we need one and don't already have one.  */
482 /* yyresume: */
483
484   /* First try to decide what to do without reference to lookahead token.  */
485
486   yyn = yypact[yystate];
487   if (yyn == YYFLAG)
488     goto yydefault;
489
490   /* Not known => get a lookahead token if don't already have one.  */
491
492   /* yychar is either YYEMPTY or YYEOF
493      or a valid token in external form.  */
494
495   if (yychar == YYEMPTY)
496     {
497 #if YYDEBUG != 0
498       if (yydebug)
499         fprintf(stderr, "Reading a token: ");
500 #endif
501       yychar = YYLEX;
502     }
503
504   /* Convert token to internal form (in yychar1) for indexing tables with */
505
506   if (yychar <= 0)              /* This means end of input. */
507     {
508       yychar1 = 0;
509       yychar = YYEOF;           /* Don't call YYLEX any more */
510
511 #if YYDEBUG != 0
512       if (yydebug)
513         fprintf(stderr, "Now at end of input.\n");
514 #endif
515     }
516   else
517     {
518       yychar1 = YYTRANSLATE(yychar);
519
520 #if YYDEBUG != 0
521       if (yydebug)
522         {
523           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
524           /* Give the individual parser a way to print the precise meaning
525              of a token, for further debugging info.  */
526 #ifdef YYPRINT
527           YYPRINT (stderr, yychar, yylval);
528 #endif
529           fprintf (stderr, ")\n");
530         }
531 #endif
532     }
533
534   yyn += yychar1;
535   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
536     goto yydefault;
537
538   yyn = yytable[yyn];
539
540   /* yyn is what to do for this token type in this state.
541      Negative => reduce, -yyn is rule number.
542      Positive => shift, yyn is new state.
543        New state is final state => don't bother to shift,
544        just return success.
545      0, or most negative number => error.  */
546
547   if (yyn < 0)
548     {
549       if (yyn == YYFLAG)
550         goto yyerrlab;
551       yyn = -yyn;
552       goto yyreduce;
553     }
554   else if (yyn == 0)
555     goto yyerrlab;
556
557   if (yyn == YYFINAL)
558     YYACCEPT;
559
560   /* Shift the lookahead token.  */
561
562 #if YYDEBUG != 0
563   if (yydebug)
564     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
565 #endif
566
567   /* Discard the token being shifted unless it is eof.  */
568   if (yychar != YYEOF)
569     yychar = YYEMPTY;
570
571   *++yyvsp = yylval;
572 #ifdef YYLSP_NEEDED
573   *++yylsp = yylloc;
574 #endif
575
576   /* count tokens shifted since error; after three, turn off error status.  */
577   if (yyerrstatus) yyerrstatus--;
578
579   yystate = yyn;
580   goto yynewstate;
581
582 /* Do the default action for the current state.  */
583 yydefault:
584
585   yyn = yydefact[yystate];
586   if (yyn == 0)
587     goto yyerrlab;
588
589 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
590 yyreduce:
591   yylen = yyr2[yyn];
592   yyval = yyvsp[1-yylen]; /* implement default value of the action */
593
594 #if YYDEBUG != 0
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
608
609
610   switch (yyn) {
611
612 case 1:
613 #line 12 "syntax.y"
614 {
615                 root = mktypdef(yyvsp[-4], yyvsp[-2]);
616         ;
617     break;}
618 case 2:
619 #line 18 "syntax.y"
620 {
621                 yyval = yyvsp[0];
622         ;
623     break;}
624 case 3:
625 #line 22 "syntax.y"
626 {
627                 yyval = (long) mkdeflist(yyvsp[-1], yyvsp[0]);
628         ;
629     break;}
630 case 4:
631 #line 28 "syntax.y"
632 {
633                 yyval = (long) mkdef(yyvsp[-5], yyvsp[-2]);
634         ;
635     break;}
636 case 5:
637 #line 32 "syntax.y"
638 {
639                 yyval = (long) mkdef(yyvsp[-4], mkemitemlist());
640         ;
641     break;}
642 case 6:
643 #line 38 "syntax.y"
644 {
645                 yyval = yyvsp[0];
646         ;
647     break;}
648 case 7:
649 #line 42 "syntax.y"
650 {
651                 yyval = (long) mkitemlist(yyvsp[-1], yyvsp[0]);
652         ;
653     break;}
654 case 8:
655 #line 48 "syntax.y"
656 {
657                 yyval = (long) mkitem(yyvsp[-3], yyvsp[-1]);
658         ;
659     break;}
660 }
661    /* the action file gets copied in in place of this dollarsign */
662 #line 457 "/usr/local/gnu/lib/bison.simple"
663 \f
664   yyvsp -= yylen;
665   yyssp -= yylen;
666 #ifdef YYLSP_NEEDED
667   yylsp -= yylen;
668 #endif
669
670 #if YYDEBUG != 0
671   if (yydebug)
672     {
673       short *ssp1 = yyss - 1;
674       fprintf (stderr, "state stack now");
675       while (ssp1 != yyssp)
676         fprintf (stderr, " %d", *++ssp1);
677       fprintf (stderr, "\n");
678     }
679 #endif
680
681   *++yyvsp = yyval;
682
683 #ifdef YYLSP_NEEDED
684   yylsp++;
685   if (yylen == 0)
686     {
687       yylsp->first_line = yylloc.first_line;
688       yylsp->first_column = yylloc.first_column;
689       yylsp->last_line = (yylsp-1)->last_line;
690       yylsp->last_column = (yylsp-1)->last_column;
691       yylsp->text = 0;
692     }
693   else
694     {
695       yylsp->last_line = (yylsp+yylen-1)->last_line;
696       yylsp->last_column = (yylsp+yylen-1)->last_column;
697     }
698 #endif
699
700   /* Now "shift" the result of the reduction.
701      Determine what state that goes to,
702      based on the state we popped back to
703      and the rule number reduced by.  */
704
705   yyn = yyr1[yyn];
706
707   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
708   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
709     yystate = yytable[yystate];
710   else
711     yystate = yydefgoto[yyn - YYNTBASE];
712
713   goto yynewstate;
714
715 yyerrlab:   /* here on detecting error */
716
717   if (! yyerrstatus)
718     /* If not already recovering from an error, report this error.  */
719     {
720       ++yynerrs;
721
722 #ifdef YYERROR_VERBOSE
723       yyn = yypact[yystate];
724
725       if (yyn > YYFLAG && yyn < YYLAST)
726         {
727           int size = 0;
728           char *msg;
729           int x, count;
730
731           count = 0;
732           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
733           for (x = (yyn < 0 ? -yyn : 0);
734                x < (sizeof(yytname) / sizeof(char *)); x++)
735             if (yycheck[x + yyn] == x)
736               size += strlen(yytname[x]) + 15, count++;
737           msg = (char *) malloc(size + 15);
738           if (msg != 0)
739             {
740               strcpy(msg, "parse error");
741
742               if (count < 5)
743                 {
744                   count = 0;
745                   for (x = (yyn < 0 ? -yyn : 0);
746                        x < (sizeof(yytname) / sizeof(char *)); x++)
747                     if (yycheck[x + yyn] == x)
748                       {
749                         strcat(msg, count == 0 ? ", expecting `" : " or `");
750                         strcat(msg, yytname[x]);
751                         strcat(msg, "'");
752                         count++;
753                       }
754                 }
755               yyerror(msg);
756               free(msg);
757             }
758           else
759             yyerror ("parse error; also virtual memory exceeded");
760         }
761       else
762 #endif /* YYERROR_VERBOSE */
763         yyerror("parse error");
764     }
765
766   goto yyerrlab1;
767 yyerrlab1:   /* here on error raised explicitly by an action */
768
769   if (yyerrstatus == 3)
770     {
771       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
772
773       /* return failure if at end of input */
774       if (yychar == YYEOF)
775         YYABORT;
776
777 #if YYDEBUG != 0
778       if (yydebug)
779         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
780 #endif
781
782       yychar = YYEMPTY;
783     }
784
785   /* Else will try to reuse lookahead token
786      after shifting the error token.  */
787
788   yyerrstatus = 3;              /* Each real token shifted decrements this */
789
790   goto yyerrhandle;
791
792 yyerrdefault:  /* current state does not do anything special for the error token. */
793
794 #if 0
795   /* This is wrong; only states that explicitly want error tokens
796      should shift them.  */
797   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
798   if (yyn) goto yydefault;
799 #endif
800
801 yyerrpop:   /* pop the current state because it cannot handle the error token */
802
803   if (yyssp == yyss) YYABORT;
804   yyvsp--;
805   yystate = *--yyssp;
806 #ifdef YYLSP_NEEDED
807   yylsp--;
808 #endif
809
810 #if YYDEBUG != 0
811   if (yydebug)
812     {
813       short *ssp1 = yyss - 1;
814       fprintf (stderr, "Error: state stack now");
815       while (ssp1 != yyssp)
816         fprintf (stderr, " %d", *++ssp1);
817       fprintf (stderr, "\n");
818     }
819 #endif
820
821 yyerrhandle:
822
823   yyn = yypact[yystate];
824   if (yyn == YYFLAG)
825     goto yyerrdefault;
826
827   yyn += YYTERROR;
828   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
829     goto yyerrdefault;
830
831   yyn = yytable[yyn];
832   if (yyn < 0)
833     {
834       if (yyn == YYFLAG)
835         goto yyerrpop;
836       yyn = -yyn;
837       goto yyreduce;
838     }
839   else if (yyn == 0)
840     goto yyerrpop;
841
842   if (yyn == YYFINAL)
843     YYACCEPT;
844
845 #if YYDEBUG != 0
846   if (yydebug)
847     fprintf(stderr, "Shifting error token, ");
848 #endif
849
850   *++yyvsp = yylval;
851 #ifdef YYLSP_NEEDED
852   *++yylsp = yylloc;
853 #endif
854
855   yystate = yyn;
856   goto yynewstate;
857 }
858 #line 51 "syntax.y"