Pass 9th fp argument correctly on System V/eabi; Add @plt for -fPIC/-mrelocatable
[official-gcc.git] / gcc / bi-parser.c
blob9f6f2b02e3c41585f671932216d448b893dd1686
2 /* A Bison parser, made from bi-parser.y with Bison version GNU Bison version 1.24
3 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define DEFOP 258
8 #define STRING 259
10 #line 22 "bi-parser.y"
13 #include <stdio.h>
14 #include "hconfig.h"
15 #include "bi-defs.h"
17 extern char yytext[];
18 extern int yyleng;
21 /* Chain of all defs built by the parser. */
22 struct def *defs;
23 int ndefs;
25 static struct node *makenode ();
26 static struct variation *makevar ();
27 static struct def *makedef ();
29 void yyerror ();
32 #line 44 "bi-parser.y"
33 typedef union
35 char *string;
36 struct def *def;
37 struct variation *variation;
38 struct node *node;
39 } YYSTYPE;
41 #ifndef YYLTYPE
42 typedef
43 struct yyltype
45 int timestamp;
46 int first_line;
47 int first_column;
48 int last_line;
49 int last_column;
50 char *text;
52 yyltype;
54 #define YYLTYPE yyltype
55 #endif
57 #include <stdio.h>
59 #ifndef __cplusplus
60 #ifndef __STDC__
61 #define const
62 #endif
63 #endif
67 #define YYFINAL 39
68 #define YYFLAG -32768
69 #define YYNTBASE 8
71 #define YYTRANSLATE(x) ((unsigned)(x) <= 259 ? yytranslate[x] : 17)
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
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
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
118 #endif
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
126 static const char * const yytname[] = { "$","error","$undefined.","DEFOP",
127 "STRING","'('","','","')'","top","defs","def","variations","variation","opt_string",
128 "list","items","item",""
130 #endif
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
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
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
149 static const short yydefgoto[] = { 37,
150 2, 3, 13, 14, 9, 23, 25, 26
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
160 static const short yypgoto[] = {-32768,
161 -32768, 27,-32768, 19, 20, -27, -12,-32768
165 #define YYLAST 35
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
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
181 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
182 #line 3 "/usr/local/share/bison.simple"
184 /* Skeleton output parser for bison,
185 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
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.
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.
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. */
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. */
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);
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. */
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. */
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. */
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; \
265 else \
266 { yyerror ("syntax error: cannot back up"); YYERROR; } \
267 while (0)
269 #define YYTERROR 1
270 #define YYERRCODE 256
272 #ifndef YYPURE
273 #define YYLEX yylex()
274 #endif
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
292 /* If nonreentrant, generate the variables here */
294 #ifndef YYPURE
296 int yychar; /* the lookahead symbol */
297 YYSTYPE yylval; /* the semantic value of the */
298 /* lookahead symbol */
300 #ifdef YYLSP_NEEDED
301 YYLTYPE yylloc; /* location data for the lookahead */
302 /* symbol */
303 #endif
305 int yynerrs; /* number of parse errors so far */
306 #endif /* not YYPURE */
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
314 /* YYINITDEPTH indicates the initial size of the parser's stacks */
316 #ifndef YYINITDEPTH
317 #define YYINITDEPTH 200
318 #endif
320 /* YYMAXDEPTH is the maximum size the stacks can grow to
321 (effective only if the built-in stack extension method is used). */
323 #if YYMAXDEPTH == 0
324 #undef YYMAXDEPTH
325 #endif
327 #ifndef YYMAXDEPTH
328 #define YYMAXDEPTH 10000
329 #endif
331 /* Prevent warning if -Wstrict-prototypes. */
332 #ifdef __GNUC__
333 int yyparse (void);
334 #endif
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
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;
349 register char *f = from;
350 register char *t = to;
351 register int i = count;
353 while (i-- > 0)
354 *t++ = *f++;
357 #else /* __cplusplus */
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)
364 register char *f = from;
365 register char *t = to;
366 register int i = count;
368 while (i-- > 0)
369 *t++ = *f++;
372 #endif
373 #endif
375 #line 192 "/usr/local/share/bison.simple"
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. */
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
391 yyparse(YYPARSE_PARAM)
392 YYPARSE_PARAM_DECL
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 */
401 short yyssa[YYINITDEPTH]; /* the state stack */
402 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
404 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
405 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
407 #ifdef YYLSP_NEEDED
408 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
409 YYLTYPE *yyls = yylsa;
410 YYLTYPE *yylsp;
412 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
413 #else
414 #define YYPOPSTACK (yyvsp--, yyssp--)
415 #endif
417 int yystacksize = YYINITDEPTH;
419 #ifdef YYPURE
420 int yychar;
421 YYSTYPE yylval;
422 int yynerrs;
423 #ifdef YYLSP_NEEDED
424 YYLTYPE yylloc;
425 #endif
426 #endif
428 YYSTYPE yyval; /* the variable used to return */
429 /* semantic values from the action */
430 /* routines */
432 int yylen;
434 #if YYDEBUG != 0
435 if (yydebug)
436 fprintf(stderr, "Starting parse\n");
437 #endif
439 yystate = 0;
440 yyerrstatus = 0;
441 yynerrs = 0;
442 yychar = YYEMPTY; /* Cause a token to be read. */
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. */
449 yyssp = yyss - 1;
450 yyvsp = yyvs;
451 #ifdef YYLSP_NEEDED
452 yylsp = yyls;
453 #endif
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:
460 *++yyssp = yystate;
462 if (yyssp >= yyss + yystacksize - 1)
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
472 /* Get the current used size of the three stacks, in elements. */
473 int size = yyssp - yyss + 1;
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
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)
501 yyerror("parser stack overflow");
502 return 2;
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 */
517 yyssp = yyss + size - 1;
518 yyvsp = yyvs + size - 1;
519 #ifdef YYLSP_NEEDED
520 yylsp = yyls + size - 1;
521 #endif
523 #if YYDEBUG != 0
524 if (yydebug)
525 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
526 #endif
528 if (yyssp >= yyss + yystacksize - 1)
529 YYABORT;
532 #if YYDEBUG != 0
533 if (yydebug)
534 fprintf(stderr, "Entering state %d\n", yystate);
535 #endif
537 goto yybackup;
538 yybackup:
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: */
544 /* First try to decide what to do without reference to lookahead token. */
546 yyn = yypact[yystate];
547 if (yyn == YYFLAG)
548 goto yydefault;
550 /* Not known => get a lookahead token if don't already have one. */
552 /* yychar is either YYEMPTY or YYEOF
553 or a valid token in external form. */
555 if (yychar == YYEMPTY)
557 #if YYDEBUG != 0
558 if (yydebug)
559 fprintf(stderr, "Reading a token: ");
560 #endif
561 yychar = YYLEX;
564 /* Convert token to internal form (in yychar1) for indexing tables with */
566 if (yychar <= 0) /* This means end of input. */
568 yychar1 = 0;
569 yychar = YYEOF; /* Don't call YYLEX any more */
571 #if YYDEBUG != 0
572 if (yydebug)
573 fprintf(stderr, "Now at end of input.\n");
574 #endif
576 else
578 yychar1 = YYTRANSLATE(yychar);
580 #if YYDEBUG != 0
581 if (yydebug)
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");
591 #endif
594 yyn += yychar1;
595 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
596 goto yydefault;
598 yyn = yytable[yyn];
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. */
607 if (yyn < 0)
609 if (yyn == YYFLAG)
610 goto yyerrlab;
611 yyn = -yyn;
612 goto yyreduce;
614 else if (yyn == 0)
615 goto yyerrlab;
617 if (yyn == YYFINAL)
618 YYACCEPT;
620 /* Shift the lookahead token. */
622 #if YYDEBUG != 0
623 if (yydebug)
624 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
625 #endif
627 /* Discard the token being shifted unless it is eof. */
628 if (yychar != YYEOF)
629 yychar = YYEMPTY;
631 *++yyvsp = yylval;
632 #ifdef YYLSP_NEEDED
633 *++yylsp = yylloc;
634 #endif
636 /* count tokens shifted since error; after three, turn off error status. */
637 if (yyerrstatus) yyerrstatus--;
639 yystate = yyn;
640 goto yynewstate;
642 /* Do the default action for the current state. */
643 yydefault:
645 yyn = yydefact[yystate];
646 if (yyn == 0)
647 goto yyerrlab;
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 */
655 #if YYDEBUG != 0
656 if (yydebug)
658 int i;
660 fprintf (stderr, "Reducing via rule %d (line %d), ",
661 yyn, yyrline[yyn]);
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]]);
668 #endif
671 switch (yyn) {
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;}
730 /* the action file gets copied in in place of this dollarsign */
731 #line 487 "/usr/local/share/bison.simple"
733 yyvsp -= yylen;
734 yyssp -= yylen;
735 #ifdef YYLSP_NEEDED
736 yylsp -= yylen;
737 #endif
739 #if YYDEBUG != 0
740 if (yydebug)
742 short *ssp1 = yyss - 1;
743 fprintf (stderr, "state stack now");
744 while (ssp1 != yyssp)
745 fprintf (stderr, " %d", *++ssp1);
746 fprintf (stderr, "\n");
748 #endif
750 *++yyvsp = yyval;
752 #ifdef YYLSP_NEEDED
753 yylsp++;
754 if (yylen == 0)
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;
762 else
764 yylsp->last_line = (yylsp+yylen-1)->last_line;
765 yylsp->last_column = (yylsp+yylen-1)->last_column;
767 #endif
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. */
774 yyn = yyr1[yyn];
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];
782 goto yynewstate;
784 yyerrlab: /* here on detecting error */
786 if (! yyerrstatus)
787 /* If not already recovering from an error, report this error. */
789 ++yynerrs;
791 #ifdef YYERROR_VERBOSE
792 yyn = yypact[yystate];
794 if (yyn > YYFLAG && yyn < YYLAST)
796 int size = 0;
797 char *msg;
798 int x, count;
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)
809 strcpy(msg, "parse error");
811 if (count < 5)
813 count = 0;
814 for (x = (yyn < 0 ? -yyn : 0);
815 x < (sizeof(yytname) / sizeof(char *)); x++)
816 if (yycheck[x + yyn] == x)
818 strcat(msg, count == 0 ? ", expecting `" : " or `");
819 strcat(msg, yytname[x]);
820 strcat(msg, "'");
821 count++;
824 yyerror(msg);
825 free(msg);
827 else
828 yyerror ("parse error; also virtual memory exceeded");
830 else
831 #endif /* YYERROR_VERBOSE */
832 yyerror("parse error");
835 goto yyerrlab1;
836 yyerrlab1: /* here on error raised explicitly by an action */
838 if (yyerrstatus == 3)
840 /* if just tried and failed to reuse lookahead token after an error, discard it. */
842 /* return failure if at end of input */
843 if (yychar == YYEOF)
844 YYABORT;
846 #if YYDEBUG != 0
847 if (yydebug)
848 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
849 #endif
851 yychar = YYEMPTY;
854 /* Else will try to reuse lookahead token
855 after shifting the error token. */
857 yyerrstatus = 3; /* Each real token shifted decrements this */
859 goto yyerrhandle;
861 yyerrdefault: /* current state does not do anything special for the error token. */
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
870 yyerrpop: /* pop the current state because it cannot handle the error token */
872 if (yyssp == yyss) YYABORT;
873 yyvsp--;
874 yystate = *--yyssp;
875 #ifdef YYLSP_NEEDED
876 yylsp--;
877 #endif
879 #if YYDEBUG != 0
880 if (yydebug)
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");
888 #endif
890 yyerrhandle:
892 yyn = yypact[yystate];
893 if (yyn == YYFLAG)
894 goto yyerrdefault;
896 yyn += YYTERROR;
897 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
898 goto yyerrdefault;
900 yyn = yytable[yyn];
901 if (yyn < 0)
903 if (yyn == YYFLAG)
904 goto yyerrpop;
905 yyn = -yyn;
906 goto yyreduce;
908 else if (yyn == 0)
909 goto yyerrpop;
911 if (yyn == YYFINAL)
912 YYACCEPT;
914 #if YYDEBUG != 0
915 if (yydebug)
916 fprintf(stderr, "Shifting error token, ");
917 #endif
919 *++yyvsp = yylval;
920 #ifdef YYLSP_NEEDED
921 *++yylsp = yylloc;
922 #endif
924 yystate = yyn;
925 goto yynewstate;
927 #line 117 "bi-parser.y"
930 static struct node *
931 makenode (s)
932 char *s;
934 struct node *n;
936 n = (struct node *) malloc (sizeof (struct node));
937 n->text = s;
938 n->next = NULL;
939 return n;
942 static struct variation *
943 makevar (name, inputs, outputs, literals)
944 char *name;
945 struct node *inputs, *outputs, *literals;
947 struct variation *v;
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;
959 static struct def *
960 makedef (name, template, vars)
961 char *name, *template;
962 struct variation *vars;
964 struct def *d;
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;
974 void
975 yyerror (s)
976 char *s;
978 fprintf (stderr, "syntax error in input\n");
979 exit (FATAL_EXIT_CODE);