2 /* A Bison parser, made from arparse.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
28 /* arparse.y - Stange script language parser */
30 /* Copyright 1992, 1993, 1995, 1997, 1999 Free Software Foundation, Inc.
32 This file is part of GNU Binutils.
34 This program is free software; you can redistribute it and/or modify
35 it under the terms of the GNU General Public License as published by
36 the Free Software Foundation; either version 2 of the License, or
37 (at your option) any later version.
39 This program is distributed in the hope that it will be useful,
40 but WITHOUT ANY WARRANTY; without even the implied warranty of
41 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42 GNU General Public License for more details.
44 You should have received a copy of the GNU General Public License
45 along with this program; if not, write to the Free Software
46 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
49 /* Contributed by Steve Chamberlain
53 #define DONTDECLARE_MALLOC
58 extern int yylex
PARAMS ((void));
59 static int yyerror
PARAMS ((const char *));
81 #define YYTRANSLATE(x) ((unsigned)(x) <= 274 ? yytranslate[x] : 45)
83 static const char yytranslate
[] = { 0,
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, 21,
88 22, 2, 2, 23, 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, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
104 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
110 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
115 static const short yyprhs
[] = { 0,
116 0, 1, 4, 7, 8, 11, 13, 15, 17, 19,
117 21, 23, 25, 27, 29, 31, 33, 35, 37, 39,
118 41, 42, 45, 48, 50, 53, 56, 58, 60, 63,
119 66, 70, 75, 77, 78, 82, 83, 87, 88, 90,
123 static const short yyrhs
[] = { -1,
124 25, 26, 0, 26, 27, 0, 0, 28, 3, 0,
125 36, 0, 37, 0, 44, 0, 39, 0, 38, 0,
126 31, 0, 33, 0, 35, 0, 29, 0, 30, 0,
127 32, 0, 34, 0, 13, 0, 1, 0, 5, 0,
128 0, 14, 42, 0, 18, 42, 0, 9, 0, 11,
129 42, 0, 8, 42, 0, 7, 0, 19, 0, 20,
130 5, 0, 10, 5, 0, 6, 5, 41, 0, 12,
131 5, 41, 40, 0, 5, 0, 0, 21, 42, 22,
132 0, 0, 42, 43, 5, 0, 0, 23, 0, 0,
139 static const short yyrline
[] = { 0,
140 66, 68, 70, 72, 75, 78, 80, 81, 82, 83,
141 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
142 94, 98, 103, 108, 113, 117, 122, 127, 134, 139,
143 145, 149, 156, 159, 162, 165, 169, 176, 180, 182,
149 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
151 static const char * const yytname
[] = { "$","error","$undefined.","NEWLINE",
152 "VERBOSE","FILENAME","ADDLIB","LIST","ADDMOD","CLEAR","CREATE","DELETE","DIRECTORY",
153 "END","EXTRACT","FULLDIR","HELP","QUIT","REPLACE","SAVE","OPEN","'('","')'",
154 "','","start","@1","session","command_line","command","extract_command","replace_command",
155 "clear_command","delete_command","addmod_command","list_command","save_command",
156 "open_command","create_command","addlib_command","directory_command","optional_filename",
157 "modulelist","modulename","optcomma","verbose_command", NULL
161 static const short yyr1
[] = { 0,
162 25, 24, 26, 26, 27, 28, 28, 28, 28, 28,
163 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
164 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
165 38, 39, 40, 40, 41, 41, 42, 42, 43, 43,
169 static const short yyr2
[] = { 0,
170 0, 2, 2, 0, 2, 1, 1, 1, 1, 1,
171 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
172 0, 2, 2, 1, 2, 2, 1, 1, 2, 2,
173 3, 4, 1, 0, 3, 0, 3, 0, 1, 0,
177 static const short yydefact
[] = { 1,
178 4, 0, 19, 41, 20, 0, 27, 38, 24, 0,
179 38, 0, 18, 38, 38, 28, 0, 3, 0, 14,
180 15, 11, 16, 12, 17, 13, 6, 7, 10, 9,
181 8, 36, 26, 30, 25, 36, 22, 23, 29, 5,
182 38, 31, 39, 0, 34, 40, 37, 33, 32, 35,
186 static const short yydefgoto
[] = { 51,
187 1, 2, 18, 19, 20, 21, 22, 23, 24, 25,
188 26, 27, 28, 29, 30, 49, 42, 33, 44, 31
191 static const short yypact
[] = {-32768,
192 -32768, 5,-32768,-32768,-32768, -4,-32768,-32768,-32768, 2,
193 -32768, 21,-32768,-32768,-32768,-32768, 22,-32768, 25,-32768,
194 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
195 -32768, 8, -3,-32768, -3, 8, -3, -3,-32768,-32768,
196 -32768,-32768,-32768, 26, 27, -1,-32768,-32768,-32768,-32768,
200 static const short yypgoto
[] = {-32768,
201 -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
202 -32768,-32768,-32768,-32768,-32768,-32768, 0, -11,-32768,-32768
209 static const short yytable
[] = { 35,
210 32, -40, 37, 38, -2, 3, 34, -21, 4, 5,
211 6, 7, 8, 9, 10, 11, 12, 13, 14, 43,
212 50, 43, 15, 16, 17, 36, 39, 40, 41, 46,
213 47, 48, 52, 53, 0, 45
216 static const short yycheck
[] = { 11,
217 5, 5, 14, 15, 0, 1, 5, 3, 4, 5,
218 6, 7, 8, 9, 10, 11, 12, 13, 14, 23,
219 22, 23, 18, 19, 20, 5, 5, 3, 21, 41,
222 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
223 #line 3 "/usr/share/bison/bison.simple"
224 /* This file comes from bison-1.28. */
226 /* Skeleton output parser for bison,
227 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
229 This program is free software; you can redistribute it and/or modify
230 it under the terms of the GNU General Public License as published by
231 the Free Software Foundation; either version 2, or (at your option)
234 This program is distributed in the hope that it will be useful,
235 but WITHOUT ANY WARRANTY; without even the implied warranty of
236 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
237 GNU General Public License for more details.
239 You should have received a copy of the GNU General Public License
240 along with this program; if not, write to the Free Software
241 Foundation, Inc., 59 Temple Place - Suite 330,
242 Boston, MA 02111-1307, USA. */
244 /* As a special exception, when this file is copied by Bison into a
245 Bison output file, you may use that output file without restriction.
246 This special exception was added by the Free Software Foundation
247 in version 1.24 of Bison. */
249 /* This is the parser code that is written into each bison parser
250 when the %semantic_parser declaration is not specified in the grammar.
251 It was written by Richard Stallman by simplifying the hairy parser
252 used when %semantic_parser is specified. */
254 #ifndef YYSTACK_USE_ALLOCA
256 #define YYSTACK_USE_ALLOCA
257 #else /* alloca not defined */
259 #define YYSTACK_USE_ALLOCA
260 #define alloca __builtin_alloca
261 #else /* not GNU C. */
262 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
263 #define YYSTACK_USE_ALLOCA
265 #else /* not sparc */
266 /* We think this test detects Watcom and Microsoft C. */
267 /* This used to test MSDOS, but that is a bad idea
268 since that symbol is in the user namespace. */
269 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
270 #if 0 /* No need for malloc.h, which pollutes the namespace;
271 instead, just don't use alloca. */
274 #else /* not MSDOS, or __TURBOC__ */
276 /* I don't know what this was needed for, but it pollutes the namespace.
277 So I turned it off. rms, 2 May 1997. */
278 /* #include <malloc.h> */
280 #define YYSTACK_USE_ALLOCA
281 #else /* not MSDOS, or __TURBOC__, or _AIX */
283 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
284 and on HPUX 10. Eventually we can turn this on. */
285 #define YYSTACK_USE_ALLOCA
286 #define alloca __builtin_alloca
289 #endif /* not _AIX */
290 #endif /* not MSDOS, or __TURBOC__ */
291 #endif /* not sparc */
292 #endif /* not GNU C */
293 #endif /* alloca not defined */
294 #endif /* YYSTACK_USE_ALLOCA not defined */
296 #ifdef YYSTACK_USE_ALLOCA
297 #define YYSTACK_ALLOC alloca
299 #define YYSTACK_ALLOC malloc
302 /* Note: there must be only one dollar sign in this file.
303 It is replaced by the list of actions, each action
304 as one case of the switch. */
306 #define yyerrok (yyerrstatus = 0)
307 #define yyclearin (yychar = YYEMPTY)
310 #define YYACCEPT goto yyacceptlab
311 #define YYABORT goto yyabortlab
312 #define YYERROR goto yyerrlab1
313 /* Like YYERROR except do call yyerror.
314 This remains here temporarily to ease the
315 transition to the new meaning of YYERROR, for GCC.
316 Once GCC version 2 has supplanted version 1, this can go. */
317 #define YYFAIL goto yyerrlab
318 #define YYRECOVERING() (!!yyerrstatus)
319 #define YYBACKUP(token, value) \
321 if (yychar == YYEMPTY && yylen == 1) \
322 { yychar = (token), yylval = (value); \
323 yychar1 = YYTRANSLATE (yychar); \
328 { yyerror ("syntax error: cannot back up"); YYERROR; } \
332 #define YYERRCODE 256
335 #define YYLEX yylex()
341 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
343 #define YYLEX yylex(&yylval, &yylloc)
345 #else /* not YYLSP_NEEDED */
347 #define YYLEX yylex(&yylval, YYLEX_PARAM)
349 #define YYLEX yylex(&yylval)
351 #endif /* not YYLSP_NEEDED */
354 /* If nonreentrant, generate the variables here */
358 int yychar
; /* the lookahead symbol */
359 YYSTYPE yylval
; /* the semantic value of the */
360 /* lookahead symbol */
363 YYLTYPE yylloc
; /* location data for the lookahead */
367 int yynerrs
; /* number of parse errors so far */
368 #endif /* not YYPURE */
371 int yydebug
; /* nonzero means print parse trace */
372 /* Since this is uninitialized, it does not stop multiple parsers
376 /* YYINITDEPTH indicates the initial size of the parser's stacks */
379 #define YYINITDEPTH 200
382 /* YYMAXDEPTH is the maximum size the stacks can grow to
383 (effective only if the built-in stack extension method is used). */
390 #define YYMAXDEPTH 10000
393 /* Define __yy_memcpy. Note that the size argument
394 should be passed with type unsigned int, because that is what the non-GCC
395 definitions require. With GCC, __builtin_memcpy takes an arg
396 of type size_t, but it can handle unsigned int. */
398 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
399 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
400 #else /* not GNU C or C++ */
403 /* This is the most reliable way to avoid incompatibilities
404 in available built-in functions on various systems. */
406 __yy_memcpy (to
, from
, count
)
411 register char *f
= from
;
412 register char *t
= to
;
413 register int i
= count
;
419 #else /* __cplusplus */
421 /* This is the most reliable way to avoid incompatibilities
422 in available built-in functions on various systems. */
424 __yy_memcpy (char *to
, char *from
, unsigned int count
)
426 register char *t
= to
;
427 register char *f
= from
;
428 register int i
= count
;
437 #line 217 "/usr/share/bison/bison.simple"
439 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
440 into yyparse. The argument should have type void *.
441 It should actually point to an object.
442 Grammar actions can access the variable by casting it
443 to the proper pointer type. */
447 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
448 #define YYPARSE_PARAM_DECL
449 #else /* not __cplusplus */
450 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
451 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
452 #endif /* not __cplusplus */
453 #else /* not YYPARSE_PARAM */
454 #define YYPARSE_PARAM_ARG
455 #define YYPARSE_PARAM_DECL
456 #endif /* not YYPARSE_PARAM */
458 /* Prevent warning if -Wstrict-prototypes. */
461 int yyparse (void *);
468 yyparse(YYPARSE_PARAM_ARG
)
471 register int yystate
;
473 register short *yyssp
;
474 register YYSTYPE
*yyvsp
;
475 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
476 int yychar1
= 0; /* lookahead token as an internal (translated) token number */
478 short yyssa
[YYINITDEPTH
]; /* the state stack */
479 YYSTYPE yyvsa
[YYINITDEPTH
]; /* the semantic value stack */
481 short *yyss
= yyssa
; /* refer to the stacks thru separate pointers */
482 YYSTYPE
*yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
485 YYLTYPE yylsa
[YYINITDEPTH
]; /* the location stack */
486 YYLTYPE
*yyls
= yylsa
;
489 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
491 #define YYPOPSTACK (yyvsp--, yyssp--)
494 int yystacksize
= YYINITDEPTH
;
495 int yyfree_stacks
= 0;
506 YYSTYPE yyval
; /* the variable used to return */
507 /* semantic values from the action */
514 fprintf(stderr
, "Starting parse\n");
520 yychar
= YYEMPTY
; /* Cause a token to be read. */
522 /* Initialize stack pointers.
523 Waste one element of value and location stack
524 so that they stay on the same level as the state stack.
525 The wasted elements are never initialized. */
533 /* Push a new state, which is found in yystate . */
534 /* In all cases, when you get here, the value and location stacks
535 have just been pushed. so pushing a state here evens the stacks. */
540 if (yyssp
>= yyss
+ yystacksize
- 1)
542 /* Give user a chance to reallocate the stack */
543 /* Use copies of these so that the &'s don't force the real ones into memory. */
544 YYSTYPE
*yyvs1
= yyvs
;
547 YYLTYPE
*yyls1
= yyls
;
550 /* Get the current used size of the three stacks, in elements. */
551 int size
= yyssp
- yyss
+ 1;
554 /* Each stack pointer address is followed by the size of
555 the data in use in that stack, in bytes. */
557 /* This used to be a conditional around just the two extra args,
558 but that might be undefined if yyoverflow is a macro. */
559 yyoverflow("parser stack overflow",
560 &yyss1
, size
* sizeof (*yyssp
),
561 &yyvs1
, size
* sizeof (*yyvsp
),
562 &yyls1
, size
* sizeof (*yylsp
),
565 yyoverflow("parser stack overflow",
566 &yyss1
, size
* sizeof (*yyssp
),
567 &yyvs1
, size
* sizeof (*yyvsp
),
571 yyss
= yyss1
; yyvs
= yyvs1
;
575 #else /* no yyoverflow */
576 /* Extend the stack our own way. */
577 if (yystacksize
>= YYMAXDEPTH
)
579 yyerror("parser stack overflow");
591 if (yystacksize
> YYMAXDEPTH
)
592 yystacksize
= YYMAXDEPTH
;
593 #ifndef YYSTACK_USE_ALLOCA
596 yyss
= (short *) YYSTACK_ALLOC (yystacksize
* sizeof (*yyssp
));
597 __yy_memcpy ((char *)yyss
, (char *)yyss1
,
598 size
* (unsigned int) sizeof (*yyssp
));
599 yyvs
= (YYSTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yyvsp
));
600 __yy_memcpy ((char *)yyvs
, (char *)yyvs1
,
601 size
* (unsigned int) sizeof (*yyvsp
));
603 yyls
= (YYLTYPE
*) YYSTACK_ALLOC (yystacksize
* sizeof (*yylsp
));
604 __yy_memcpy ((char *)yyls
, (char *)yyls1
,
605 size
* (unsigned int) sizeof (*yylsp
));
607 #endif /* no yyoverflow */
609 yyssp
= yyss
+ size
- 1;
610 yyvsp
= yyvs
+ size
- 1;
612 yylsp
= yyls
+ size
- 1;
617 fprintf(stderr
, "Stack size increased to %d\n", yystacksize
);
620 if (yyssp
>= yyss
+ yystacksize
- 1)
626 fprintf(stderr
, "Entering state %d\n", yystate
);
632 /* Do appropriate processing given the current state. */
633 /* Read a lookahead token if we need one and don't already have one. */
636 /* First try to decide what to do without reference to lookahead token. */
638 yyn
= yypact
[yystate
];
642 /* Not known => get a lookahead token if don't already have one. */
644 /* yychar is either YYEMPTY or YYEOF
645 or a valid token in external form. */
647 if (yychar
== YYEMPTY
)
651 fprintf(stderr
, "Reading a token: ");
656 /* Convert token to internal form (in yychar1) for indexing tables with */
658 if (yychar
<= 0) /* This means end of input. */
661 yychar
= YYEOF
; /* Don't call YYLEX any more */
665 fprintf(stderr
, "Now at end of input.\n");
670 yychar1
= YYTRANSLATE(yychar
);
675 fprintf (stderr
, "Next token is %d (%s", yychar
, yytname
[yychar1
]);
676 /* Give the individual parser a way to print the precise meaning
677 of a token, for further debugging info. */
679 YYPRINT (stderr
, yychar
, yylval
);
681 fprintf (stderr
, ")\n");
687 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != yychar1
)
692 /* yyn is what to do for this token type in this state.
693 Negative => reduce, -yyn is rule number.
694 Positive => shift, yyn is new state.
695 New state is final state => don't bother to shift,
697 0, or most negative number => error. */
712 /* Shift the lookahead token. */
716 fprintf(stderr
, "Shifting token %d (%s), ", yychar
, yytname
[yychar1
]);
719 /* Discard the token being shifted unless it is eof. */
728 /* count tokens shifted since error; after three, turn off error status. */
729 if (yyerrstatus
) yyerrstatus
--;
734 /* Do the default action for the current state. */
737 yyn
= yydefact
[yystate
];
741 /* Do a reduction. yyn is the number of a rule to reduce with. */
745 yyval
= yyvsp
[1-yylen
]; /* implement default value of the action */
752 fprintf (stderr
, "Reducing via rule %d (line %d), ",
755 /* Print the symbols being reduced, and their result. */
756 for (i
= yyprhs
[yyn
]; yyrhs
[i
] > 0; i
++)
757 fprintf (stderr
, "%s ", yytname
[yyrhs
[i
]]);
758 fprintf (stderr
, " -> %s\n", yytname
[yyr1
[yyn
]]);
775 { ar_end(); return 0; ;
782 #line 100 "arparse.y"
783 { ar_extract(yyvsp
[0].list
); ;
786 #line 105 "arparse.y"
787 { ar_replace(yyvsp
[0].list
); ;
790 #line 110 "arparse.y"
794 #line 115 "arparse.y"
795 { ar_delete(yyvsp
[0].list
); ;
798 #line 119 "arparse.y"
799 { ar_addmod(yyvsp
[0].list
); ;
802 #line 124 "arparse.y"
806 #line 129 "arparse.y"
810 #line 136 "arparse.y"
811 { ar_open(yyvsp
[0].name
,0); ;
814 #line 141 "arparse.y"
815 { ar_open(yyvsp
[0].name
,1); ;
818 #line 147 "arparse.y"
819 { ar_addlib(yyvsp
[-1].name
,yyvsp
[0].list
); ;
822 #line 151 "arparse.y"
823 { ar_directory(yyvsp
[-2].name
, yyvsp
[-1].list
, yyvsp
[0].name
); ;
826 #line 158 "arparse.y"
827 { yyval
.name
= yyvsp
[0].name
; ;
830 #line 159 "arparse.y"
834 #line 164 "arparse.y"
835 { yyval
.list
= yyvsp
[-1].list
; ;
838 #line 166 "arparse.y"
842 #line 171 "arparse.y"
843 { struct list
*n
= (struct list
*) malloc(sizeof(struct list
));
844 n
->next
= yyvsp
[-2].list
;
845 n
->name
= yyvsp
[0].name
;
850 #line 176 "arparse.y"
854 #line 188 "arparse.y"
855 { verbose
= !verbose
; ;
858 /* the action file gets copied in in place of this dollarsign */
859 #line 543 "/usr/share/bison/bison.simple"
870 short *ssp1
= yyss
- 1;
871 fprintf (stderr
, "state stack now");
872 while (ssp1
!= yyssp
)
873 fprintf (stderr
, " %d", *++ssp1
);
874 fprintf (stderr
, "\n");
884 yylsp
->first_line
= yylloc
.first_line
;
885 yylsp
->first_column
= yylloc
.first_column
;
886 yylsp
->last_line
= (yylsp
-1)->last_line
;
887 yylsp
->last_column
= (yylsp
-1)->last_column
;
892 yylsp
->last_line
= (yylsp
+yylen
-1)->last_line
;
893 yylsp
->last_column
= (yylsp
+yylen
-1)->last_column
;
897 /* Now "shift" the result of the reduction.
898 Determine what state that goes to,
899 based on the state we popped back to
900 and the rule number reduced by. */
904 yystate
= yypgoto
[yyn
- YYNTBASE
] + *yyssp
;
905 if (yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
906 yystate
= yytable
[yystate
];
908 yystate
= yydefgoto
[yyn
- YYNTBASE
];
912 yyerrlab
: /* here on detecting error */
915 /* If not already recovering from an error, report this error. */
919 #ifdef YYERROR_VERBOSE
920 yyn
= yypact
[yystate
];
922 if (yyn
> YYFLAG
&& yyn
< YYLAST
)
929 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
930 for (x
= (yyn
< 0 ? -yyn
: 0);
931 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
932 if (yycheck
[x
+ yyn
] == x
)
933 size
+= strlen(yytname
[x
]) + 15, count
++;
934 msg
= (char *) malloc(size
+ 15);
937 strcpy(msg
, "parse error");
942 for (x
= (yyn
< 0 ? -yyn
: 0);
943 x
< (sizeof(yytname
) / sizeof(char *)); x
++)
944 if (yycheck
[x
+ yyn
] == x
)
946 strcat(msg
, count
== 0 ? ", expecting `" : " or `");
947 strcat(msg
, yytname
[x
]);
956 yyerror ("parse error; also virtual memory exceeded");
959 #endif /* YYERROR_VERBOSE */
960 yyerror("parse error");
964 yyerrlab1
: /* here on error raised explicitly by an action */
966 if (yyerrstatus
== 3)
968 /* if just tried and failed to reuse lookahead token after an error, discard it. */
970 /* return failure if at end of input */
976 fprintf(stderr
, "Discarding token %d (%s).\n", yychar
, yytname
[yychar1
]);
982 /* Else will try to reuse lookahead token
983 after shifting the error token. */
985 yyerrstatus
= 3; /* Each real token shifted decrements this */
989 yyerrdefault
: /* current state does not do anything special for the error token. */
992 /* This is wrong; only states that explicitly want error tokens
993 should shift them. */
994 yyn
= yydefact
[yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
995 if (yyn
) goto yydefault
;
998 yyerrpop
: /* pop the current state because it cannot handle the error token */
1000 if (yyssp
== yyss
) YYABORT
;
1010 short *ssp1
= yyss
- 1;
1011 fprintf (stderr
, "Error: state stack now");
1012 while (ssp1
!= yyssp
)
1013 fprintf (stderr
, " %d", *++ssp1
);
1014 fprintf (stderr
, "\n");
1020 yyn
= yypact
[yystate
];
1025 if (yyn
< 0 || yyn
> YYLAST
|| yycheck
[yyn
] != YYTERROR
)
1044 fprintf(stderr
, "Shifting error token, ");
1056 /* YYACCEPT comes here. */
1068 /* YYABORT comes here. */
1079 #line 192 "arparse.y"
1084 const char *x ATTRIBUTE_UNUSED
;
1086 extern int linenumber
;
1088 printf (_("Syntax error in archive script, line %d\n"), linenumber
+ 1);