OSDN Git Service

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