OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [binutils/] [arparse.c] - Blame information for rev 847

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* A Bison parser, made by GNU Bison 1.875c.  */
2
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2, or (at your option)
9
   any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
/* As a special exception, when this file is copied by Bison into a
22
   Bison output file, you may use that output file without restriction.
23
   This special exception was added by the Free Software Foundation
24
   in version 1.24 of Bison.  */
25
 
26
/* Written by Richard Stallman by simplifying the original so called
27
   ``semantic'' parser.  */
28
 
29
/* All symbols defined below should begin with yy or YY, to avoid
30
   infringing on user name space.  This should be done even for local
31
   variables, as they might otherwise be expanded by user macros.
32
   There are some unavoidable exceptions within include files to
33
   define necessary library symbols; they are noted "INFRINGES ON
34
   USER NAME SPACE" below.  */
35
 
36
/* Identify Bison output.  */
37
#define YYBISON 1
38
 
39
/* Skeleton name.  */
40
#define YYSKELETON_NAME "yacc.c"
41
 
42
/* Pure parsers.  */
43
#define YYPURE 0
44
 
45
/* Using locations.  */
46
#define YYLSP_NEEDED 0
47
 
48
 
49
 
50
/* Tokens.  */
51
#ifndef YYTOKENTYPE
52
# define YYTOKENTYPE
53
   /* Put the tokens into the symbol table, so that GDB and other debuggers
54
      know about them.  */
55
   enum yytokentype {
56
     NEWLINE = 258,
57
     VERBOSE = 259,
58
     FILENAME = 260,
59
     ADDLIB = 261,
60
     LIST = 262,
61
     ADDMOD = 263,
62
     CLEAR = 264,
63
     CREATE = 265,
64
     DELETE = 266,
65
     DIRECTORY = 267,
66
     END = 268,
67
     EXTRACT = 269,
68
     FULLDIR = 270,
69
     HELP = 271,
70
     QUIT = 272,
71
     REPLACE = 273,
72
     SAVE = 274,
73
     OPEN = 275
74
   };
75
#endif
76
#define NEWLINE 258
77
#define VERBOSE 259
78
#define FILENAME 260
79
#define ADDLIB 261
80
#define LIST 262
81
#define ADDMOD 263
82
#define CLEAR 264
83
#define CREATE 265
84
#define DELETE 266
85
#define DIRECTORY 267
86
#define END 268
87
#define EXTRACT 269
88
#define FULLDIR 270
89
#define HELP 271
90
#define QUIT 272
91
#define REPLACE 273
92
#define SAVE 274
93
#define OPEN 275
94
 
95
 
96
 
97
 
98
/* Copy the first part of user declarations.  */
99
#line 1 "arparse.y"
100
 
101
/* arparse.y - Stange script language parser */
102
 
103
/* Copyright 1992, 1993, 1995, 1997, 1999, 2002, 2003, 2007
104
   Free Software Foundation, Inc.
105
 
106
   This file is part of GNU Binutils.
107
 
108
   This program is free software; you can redistribute it and/or modify
109
   it under the terms of the GNU General Public License as published by
110
   the Free Software Foundation; either version 3 of the License, or
111
   (at your option) any later version.
112
 
113
   This program is distributed in the hope that it will be useful,
114
   but WITHOUT ANY WARRANTY; without even the implied warranty of
115
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
116
   GNU General Public License for more details.
117
 
118
   You should have received a copy of the GNU General Public License
119
   along with this program; if not, write to the Free Software
120
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
121
   MA 02110-1301, USA.  */
122
 
123
 
124
/* Contributed by Steve Chamberlain
125
                  sac@cygnus.com
126
 
127
*/
128
#define DONTDECLARE_MALLOC
129
#include "sysdep.h"
130
#include "bfd.h"
131
#include "arsup.h"
132
extern int verbose;
133
extern int yylex (void);
134
static int yyerror (const char *);
135
 
136
 
137
/* Enabling traces.  */
138
#ifndef YYDEBUG
139
# define YYDEBUG 0
140
#endif
141
 
142
/* Enabling verbose error messages.  */
143
#ifdef YYERROR_VERBOSE
144
# undef YYERROR_VERBOSE
145
# define YYERROR_VERBOSE 1
146
#else
147
# define YYERROR_VERBOSE 0
148
#endif
149
 
150
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
151
#line 38 "arparse.y"
152
typedef union YYSTYPE {
153
  char *name;
154
struct list *list ;
155
 
156
} YYSTYPE;
157
/* Line 191 of yacc.c.  */
158
#line 159 "arparse.c"
159
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
160
# define YYSTYPE_IS_DECLARED 1
161
# define YYSTYPE_IS_TRIVIAL 1
162
#endif
163
 
164
 
165
 
166
/* Copy the second part of user declarations.  */
167
 
168
 
169
/* Line 214 of yacc.c.  */
170
#line 171 "arparse.c"
171
 
172
#if ! defined (yyoverflow) || YYERROR_VERBOSE
173
 
174
# ifndef YYFREE
175
#  define YYFREE free
176
# endif
177
# ifndef YYMALLOC
178
#  define YYMALLOC malloc
179
# endif
180
 
181
/* The parser invokes alloca or malloc; define the necessary symbols.  */
182
 
183
# ifdef YYSTACK_USE_ALLOCA
184
#  if YYSTACK_USE_ALLOCA
185
#   define YYSTACK_ALLOC alloca
186
#  endif
187
# else
188
#  if defined (alloca) || defined (_ALLOCA_H)
189
#   define YYSTACK_ALLOC alloca
190
#  else
191
#   ifdef __GNUC__
192
#    define YYSTACK_ALLOC __builtin_alloca
193
#   endif
194
#  endif
195
# endif
196
 
197
# ifdef YYSTACK_ALLOC
198
   /* Pacify GCC's `empty if-body' warning. */
199
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
200
# else
201
#  if defined (__STDC__) || defined (__cplusplus)
202
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
203
#   define YYSIZE_T size_t
204
#  endif
205
#  define YYSTACK_ALLOC YYMALLOC
206
#  define YYSTACK_FREE YYFREE
207
# endif
208
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
209
 
210
 
211
#if (! defined (yyoverflow) \
212
     && (! defined (__cplusplus) \
213
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
214
 
215
/* A type that is properly aligned for any stack member.  */
216
union yyalloc
217
{
218
  short yyss;
219
  YYSTYPE yyvs;
220
  };
221
 
222
/* The size of the maximum gap between one aligned stack and the next.  */
223
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
224
 
225
/* The size of an array large to enough to hold all stacks, each with
226
   N elements.  */
227
# define YYSTACK_BYTES(N) \
228
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
229
      + YYSTACK_GAP_MAXIMUM)
230
 
231
/* Copy COUNT objects from FROM to TO.  The source and destination do
232
   not overlap.  */
233
# ifndef YYCOPY
234
#  if defined (__GNUC__) && 1 < __GNUC__
235
#   define YYCOPY(To, From, Count) \
236
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
237
#  else
238
#   define YYCOPY(To, From, Count)              \
239
      do                                        \
240
        {                                       \
241
          register YYSIZE_T yyi;                \
242
          for (yyi = 0; yyi < (Count); yyi++)    \
243
            (To)[yyi] = (From)[yyi];            \
244
        }                                       \
245
      while (0)
246
#  endif
247
# endif
248
 
249
/* Relocate STACK from its old location to the new one.  The
250
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
251
   elements in the stack, and YYPTR gives the new location of the
252
   stack.  Advance YYPTR to a properly aligned location for the next
253
   stack.  */
254
# define YYSTACK_RELOCATE(Stack)                                        \
255
    do                                                                  \
256
      {                                                                 \
257
        YYSIZE_T yynewbytes;                                            \
258
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
259
        Stack = &yyptr->Stack;                                          \
260
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
261
        yyptr += yynewbytes / sizeof (*yyptr);                          \
262
      }                                                                 \
263
    while (0)
264
 
265
#endif
266
 
267
#if defined (__STDC__) || defined (__cplusplus)
268
   typedef signed char yysigned_char;
269
#else
270
   typedef short yysigned_char;
271
#endif
272
 
273
/* YYFINAL -- State number of the termination state. */
274
#define YYFINAL  3
275
/* YYLAST -- Last index in YYTABLE.  */
276
#define YYLAST   34
277
 
278
/* YYNTOKENS -- Number of terminals. */
279
#define YYNTOKENS  24
280
/* YYNNTS -- Number of nonterminals. */
281
#define YYNNTS  22
282
/* YYNRULES -- Number of rules. */
283
#define YYNRULES  42
284
/* YYNRULES -- Number of states. */
285
#define YYNSTATES  53
286
 
287
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
288
#define YYUNDEFTOK  2
289
#define YYMAXUTOK   275
290
 
291
#define YYTRANSLATE(YYX)                                                \
292
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
293
 
294
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
295
static const unsigned char yytranslate[] =
296
{
297
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
298
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
299
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
300
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
301
      21,    22,     2,     2,    23,     2,     2,     2,     2,     2,
302
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
303
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
304
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
305
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
306
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
307
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
308
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
309
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
310
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
311
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
312
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
313
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
314
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
315
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
316
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
317
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
318
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
319
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
320
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
321
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
322
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
323
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
324
      15,    16,    17,    18,    19,    20
325
};
326
 
327
#if YYDEBUG
328
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
329
   YYRHS.  */
330
static const unsigned char yyprhs[] =
331
{
332
       0,     0,     3,     4,     7,    10,    11,    14,    16,    18,
333
      20,    22,    24,    26,    28,    30,    32,    34,    36,    38,
334
      40,    42,    44,    45,    48,    51,    53,    56,    59,    61,
335
      63,    66,    69,    73,    78,    80,    81,    85,    86,    90,
336
      91,    93,    94
337
};
338
 
339
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
340
static const yysigned_char yyrhs[] =
341
{
342
      25,     0,    -1,    -1,    26,    27,    -1,    27,    28,    -1,
343
      -1,    29,     3,    -1,    37,    -1,    38,    -1,    45,    -1,
344
      40,    -1,    39,    -1,    32,    -1,    34,    -1,    36,    -1,
345
      30,    -1,    31,    -1,    33,    -1,    35,    -1,    13,    -1,
346
       1,    -1,     5,    -1,    -1,    14,    43,    -1,    18,    43,
347
      -1,     9,    -1,    11,    43,    -1,     8,    43,    -1,     7,
348
      -1,    19,    -1,    20,     5,    -1,    10,     5,    -1,     6,
349
       5,    42,    -1,    12,     5,    42,    41,    -1,     5,    -1,
350
      -1,    21,    43,    22,    -1,    -1,    43,    44,     5,    -1,
351
      -1,    23,    -1,    -1,     4,    -1
352
};
353
 
354
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
355
static const unsigned char yyrline[] =
356
{
357
       0,    69,    69,    69,    73,    74,    78,    82,    83,    84,
358
      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
359
      95,    96,    97,   102,   107,   112,   117,   121,   126,   131,
360
     138,   143,   149,   153,   160,   162,   166,   169,   173,   179,
361
     184,   185,   190
362
};
363
#endif
364
 
365
#if YYDEBUG || YYERROR_VERBOSE
366
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
367
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
368
static const char *const yytname[] =
369
{
370
  "$end", "error", "$undefined", "NEWLINE", "VERBOSE", "FILENAME",
371
  "ADDLIB", "LIST", "ADDMOD", "CLEAR", "CREATE", "DELETE", "DIRECTORY",
372
  "END", "EXTRACT", "FULLDIR", "HELP", "QUIT", "REPLACE", "SAVE", "OPEN",
373
  "'('", "')'", "','", "$accept", "start", "@1", "session", "command_line",
374
  "command", "extract_command", "replace_command", "clear_command",
375
  "delete_command", "addmod_command", "list_command", "save_command",
376
  "open_command", "create_command", "addlib_command", "directory_command",
377
  "optional_filename", "modulelist", "modulename", "optcomma",
378
  "verbose_command", 0
379
};
380
#endif
381
 
382
# ifdef YYPRINT
383
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
384
   token YYLEX-NUM.  */
385
static const unsigned short yytoknum[] =
386
{
387
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
388
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
389
     275,    40,    41,    44
390
};
391
# endif
392
 
393
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
394
static const unsigned char yyr1[] =
395
{
396
       0,    24,    26,    25,    27,    27,    28,    29,    29,    29,
397
      29,    29,    29,    29,    29,    29,    29,    29,    29,    29,
398
      29,    29,    29,    30,    31,    32,    33,    34,    35,    36,
399
      37,    38,    39,    40,    41,    41,    42,    42,    43,    43,
400
      44,    44,    45
401
};
402
 
403
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
404
static const unsigned char yyr2[] =
405
{
406
       0,     2,     0,     2,     2,     0,     2,     1,     1,     1,
407
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
408
       1,     1,     0,     2,     2,     1,     2,     2,     1,     1,
409
       2,     2,     3,     4,     1,     0,     3,     0,     3,     0,
410
       1,     0,     1
411
};
412
 
413
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
414
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
415
   means the default is an error.  */
416
static const unsigned char yydefact[] =
417
{
418
       2,     0,     5,     1,     0,    20,    42,    21,     0,    28,
419
      39,    25,     0,    39,     0,    19,    39,    39,    29,     0,
420
       4,     0,    15,    16,    12,    17,    13,    18,    14,     7,
421
       8,    11,    10,     9,    37,    27,    31,    26,    37,    23,
422
      24,    30,     6,    39,    32,    40,     0,    35,    41,    38,
423
      34,    33,    36
424
};
425
 
426
/* YYDEFGOTO[NTERM-NUM]. */
427
static const yysigned_char yydefgoto[] =
428
{
429
      -1,     1,     2,     4,    20,    21,    22,    23,    24,    25,
430
      26,    27,    28,    29,    30,    31,    32,    51,    44,    35,
431
      46,    33
432
};
433
 
434
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
435
   STATE-NUM.  */
436
#define YYPACT_NINF -14
437
static const yysigned_char yypact[] =
438
{
439
     -14,     1,   -14,   -14,     5,   -14,   -14,   -14,     2,   -14,
440
     -14,   -14,    21,   -14,    22,   -14,   -14,   -14,   -14,    23,
441
     -14,    26,   -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,
442
     -14,   -14,   -14,   -14,    10,    -3,   -14,    -3,    10,    -3,
443
      -3,   -14,   -14,   -14,   -14,   -14,    27,    28,    -1,   -14,
444
     -14,   -14,   -14
445
};
446
 
447
/* YYPGOTO[NTERM-NUM].  */
448
static const yysigned_char yypgoto[] =
449
{
450
     -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,
451
     -14,   -14,   -14,   -14,   -14,   -14,   -14,   -14,    -4,   -13,
452
     -14,   -14
453
};
454
 
455
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
456
   positive, shift that token.  If negative, reduce the rule which
457
   number is the opposite.  If zero, do what YYDEFACT says.
458
   If YYTABLE_NINF, syntax error.  */
459
#define YYTABLE_NINF -42
460
static const yysigned_char yytable[] =
461
{
462
      37,     3,   -41,    39,    40,    -3,     5,    34,   -22,     6,
463
       7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
464
      45,    52,    45,    17,    18,    19,    36,    38,    41,    42,
465
      48,    43,    49,    50,    47
466
};
467
 
468
static const unsigned char yycheck[] =
469
{
470
      13,     0,     5,    16,    17,     0,     1,     5,     3,     4,
471
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
472
      23,    22,    23,    18,    19,    20,     5,     5,     5,     3,
473
      43,    21,     5,     5,    38
474
};
475
 
476
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
477
   symbol of state STATE-NUM.  */
478
static const unsigned char yystos[] =
479
{
480
       0,    25,    26,     0,    27,     1,     4,     5,     6,     7,
481
       8,     9,    10,    11,    12,    13,    14,    18,    19,    20,
482
      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
483
      38,    39,    40,    45,     5,    43,     5,    43,     5,    43,
484
      43,     5,     3,    21,    42,    23,    44,    42,    43,     5,
485
       5,    41,    22
486
};
487
 
488
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
489
# define YYSIZE_T __SIZE_TYPE__
490
#endif
491
#if ! defined (YYSIZE_T) && defined (size_t)
492
# define YYSIZE_T size_t
493
#endif
494
#if ! defined (YYSIZE_T)
495
# if defined (__STDC__) || defined (__cplusplus)
496
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
497
#  define YYSIZE_T size_t
498
# endif
499
#endif
500
#if ! defined (YYSIZE_T)
501
# define YYSIZE_T unsigned int
502
#endif
503
 
504
#define yyerrok         (yyerrstatus = 0)
505
#define yyclearin       (yychar = YYEMPTY)
506
#define YYEMPTY         (-2)
507
#define YYEOF           0
508
 
509
#define YYACCEPT        goto yyacceptlab
510
#define YYABORT         goto yyabortlab
511
#define YYERROR         goto yyerrorlab
512
 
513
 
514
/* Like YYERROR except do call yyerror.  This remains here temporarily
515
   to ease the transition to the new meaning of YYERROR, for GCC.
516
   Once GCC version 2 has supplanted version 1, this can go.  */
517
 
518
#define YYFAIL          goto yyerrlab
519
 
520
#define YYRECOVERING()  (!!yyerrstatus)
521
 
522
#define YYBACKUP(Token, Value)                                  \
523
do                                                              \
524
  if (yychar == YYEMPTY && yylen == 1)                          \
525
    {                                                           \
526
      yychar = (Token);                                         \
527
      yylval = (Value);                                         \
528
      yytoken = YYTRANSLATE (yychar);                           \
529
      YYPOPSTACK;                                               \
530
      goto yybackup;                                            \
531
    }                                                           \
532
  else                                                          \
533
    {                                                           \
534
      yyerror ("syntax error: cannot back up");\
535
      YYERROR;                                                  \
536
    }                                                           \
537
while (0)
538
 
539
#define YYTERROR        1
540
#define YYERRCODE       256
541
 
542
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
543
   are run).  */
544
 
545
#ifndef YYLLOC_DEFAULT
546
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
547
   ((Current).first_line   = (Rhs)[1].first_line,       \
548
    (Current).first_column = (Rhs)[1].first_column,     \
549
    (Current).last_line    = (Rhs)[N].last_line,        \
550
    (Current).last_column  = (Rhs)[N].last_column)
551
#endif
552
 
553
/* YYLEX -- calling `yylex' with the right arguments.  */
554
 
555
#ifdef YYLEX_PARAM
556
# define YYLEX yylex (YYLEX_PARAM)
557
#else
558
# define YYLEX yylex ()
559
#endif
560
 
561
/* Enable debugging if requested.  */
562
#if YYDEBUG
563
 
564
# ifndef YYFPRINTF
565
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
566
#  define YYFPRINTF fprintf
567
# endif
568
 
569
# define YYDPRINTF(Args)                        \
570
do {                                            \
571
  if (yydebug)                                  \
572
    YYFPRINTF Args;                             \
573
} while (0)
574
 
575
# define YYDSYMPRINT(Args)                      \
576
do {                                            \
577
  if (yydebug)                                  \
578
    yysymprint Args;                            \
579
} while (0)
580
 
581
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
582
do {                                                            \
583
  if (yydebug)                                                  \
584
    {                                                           \
585
      YYFPRINTF (stderr, "%s ", Title);                         \
586
      yysymprint (stderr,                                       \
587
                  Token, Value);        \
588
      YYFPRINTF (stderr, "\n");                                 \
589
    }                                                           \
590
} while (0)
591
 
592
/*------------------------------------------------------------------.
593
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
594
| TOP (included).                                                   |
595
`------------------------------------------------------------------*/
596
 
597
#if defined (__STDC__) || defined (__cplusplus)
598
static void
599
yy_stack_print (short *bottom, short *top)
600
#else
601
static void
602
yy_stack_print (bottom, top)
603
    short *bottom;
604
    short *top;
605
#endif
606
{
607
  YYFPRINTF (stderr, "Stack now");
608
  for (/* Nothing. */; bottom <= top; ++bottom)
609
    YYFPRINTF (stderr, " %d", *bottom);
610
  YYFPRINTF (stderr, "\n");
611
}
612
 
613
# define YY_STACK_PRINT(Bottom, Top)                            \
614
do {                                                            \
615
  if (yydebug)                                                  \
616
    yy_stack_print ((Bottom), (Top));                           \
617
} while (0)
618
 
619
 
620
/*------------------------------------------------.
621
| Report that the YYRULE is going to be reduced.  |
622
`------------------------------------------------*/
623
 
624
#if defined (__STDC__) || defined (__cplusplus)
625
static void
626
yy_reduce_print (int yyrule)
627
#else
628
static void
629
yy_reduce_print (yyrule)
630
    int yyrule;
631
#endif
632
{
633
  int yyi;
634
  unsigned int yylno = yyrline[yyrule];
635
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
636
             yyrule - 1, yylno);
637
  /* Print the symbols being reduced, and their result.  */
638
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
639
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
640
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
641
}
642
 
643
# define YY_REDUCE_PRINT(Rule)          \
644
do {                                    \
645
  if (yydebug)                          \
646
    yy_reduce_print (Rule);             \
647
} while (0)
648
 
649
/* Nonzero means print parse trace.  It is left uninitialized so that
650
   multiple parsers can coexist.  */
651
int yydebug;
652
#else /* !YYDEBUG */
653
# define YYDPRINTF(Args)
654
# define YYDSYMPRINT(Args)
655
# define YYDSYMPRINTF(Title, Token, Value, Location)
656
# define YY_STACK_PRINT(Bottom, Top)
657
# define YY_REDUCE_PRINT(Rule)
658
#endif /* !YYDEBUG */
659
 
660
 
661
/* YYINITDEPTH -- initial size of the parser's stacks.  */
662
#ifndef YYINITDEPTH
663
# define YYINITDEPTH 200
664
#endif
665
 
666
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
667
   if the built-in stack extension method is used).
668
 
669
   Do not make this value too large; the results are undefined if
670
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
671
   evaluated with infinite-precision integer arithmetic.  */
672
 
673
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
674
# undef YYMAXDEPTH
675
#endif
676
 
677
#ifndef YYMAXDEPTH
678
# define YYMAXDEPTH 10000
679
#endif
680
 
681
 
682
 
683
#if YYERROR_VERBOSE
684
 
685
# ifndef yystrlen
686
#  if defined (__GLIBC__) && defined (_STRING_H)
687
#   define yystrlen strlen
688
#  else
689
/* Return the length of YYSTR.  */
690
static YYSIZE_T
691
#   if defined (__STDC__) || defined (__cplusplus)
692
yystrlen (const char *yystr)
693
#   else
694
yystrlen (yystr)
695
     const char *yystr;
696
#   endif
697
{
698
  register const char *yys = yystr;
699
 
700
  while (*yys++ != '\0')
701
    continue;
702
 
703
  return yys - yystr - 1;
704
}
705
#  endif
706
# endif
707
 
708
# ifndef yystpcpy
709
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
710
#   define yystpcpy stpcpy
711
#  else
712
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
713
   YYDEST.  */
714
static char *
715
#   if defined (__STDC__) || defined (__cplusplus)
716
yystpcpy (char *yydest, const char *yysrc)
717
#   else
718
yystpcpy (yydest, yysrc)
719
     char *yydest;
720
     const char *yysrc;
721
#   endif
722
{
723
  register char *yyd = yydest;
724
  register const char *yys = yysrc;
725
 
726
  while ((*yyd++ = *yys++) != '\0')
727
    continue;
728
 
729
  return yyd - 1;
730
}
731
#  endif
732
# endif
733
 
734
#endif /* !YYERROR_VERBOSE */
735
 
736
 
737
 
738
#if YYDEBUG
739
/*--------------------------------.
740
| Print this symbol on YYOUTPUT.  |
741
`--------------------------------*/
742
 
743
#if defined (__STDC__) || defined (__cplusplus)
744
static void
745
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
746
#else
747
static void
748
yysymprint (yyoutput, yytype, yyvaluep)
749
    FILE *yyoutput;
750
    int yytype;
751
    YYSTYPE *yyvaluep;
752
#endif
753
{
754
  /* Pacify ``unused variable'' warnings.  */
755
  (void) yyvaluep;
756
 
757
  if (yytype < YYNTOKENS)
758
    {
759
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
760
# ifdef YYPRINT
761
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
762
# endif
763
    }
764
  else
765
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
766
 
767
  switch (yytype)
768
    {
769
      default:
770
        break;
771
    }
772
  YYFPRINTF (yyoutput, ")");
773
}
774
 
775
#endif /* ! YYDEBUG */
776
/*-----------------------------------------------.
777
| Release the memory associated to this symbol.  |
778
`-----------------------------------------------*/
779
 
780
#if defined (__STDC__) || defined (__cplusplus)
781
static void
782
yydestruct (int yytype, YYSTYPE *yyvaluep)
783
#else
784
static void
785
yydestruct (yytype, yyvaluep)
786
    int yytype;
787
    YYSTYPE *yyvaluep;
788
#endif
789
{
790
  /* Pacify ``unused variable'' warnings.  */
791
  (void) yyvaluep;
792
 
793
  switch (yytype)
794
    {
795
 
796
      default:
797
        break;
798
    }
799
}
800
 
801
 
802
/* Prevent warnings from -Wmissing-prototypes.  */
803
 
804
#ifdef YYPARSE_PARAM
805
# if defined (__STDC__) || defined (__cplusplus)
806
int yyparse (void *YYPARSE_PARAM);
807
# else
808
int yyparse ();
809
# endif
810
#else /* ! YYPARSE_PARAM */
811
#if defined (__STDC__) || defined (__cplusplus)
812
int yyparse (void);
813
#else
814
int yyparse ();
815
#endif
816
#endif /* ! YYPARSE_PARAM */
817
 
818
 
819
 
820
/* The lookahead symbol.  */
821
int yychar;
822
 
823
/* The semantic value of the lookahead symbol.  */
824
YYSTYPE yylval;
825
 
826
/* Number of syntax errors so far.  */
827
int yynerrs;
828
 
829
 
830
 
831
/*----------.
832
| yyparse.  |
833
`----------*/
834
 
835
#ifdef YYPARSE_PARAM
836
# if defined (__STDC__) || defined (__cplusplus)
837
int yyparse (void *YYPARSE_PARAM)
838
# else
839
int yyparse (YYPARSE_PARAM)
840
  void *YYPARSE_PARAM;
841
# endif
842
#else /* ! YYPARSE_PARAM */
843
#if defined (__STDC__) || defined (__cplusplus)
844
int
845
yyparse (void)
846
#else
847
int
848
yyparse ()
849
 
850
#endif
851
#endif
852
{
853
 
854
  register int yystate;
855
  register int yyn;
856
  int yyresult;
857
  /* Number of tokens to shift before error messages enabled.  */
858
  int yyerrstatus;
859
  /* Lookahead token as an internal (translated) token number.  */
860
  int yytoken = 0;
861
 
862
  /* Three stacks and their tools:
863
     `yyss': related to states,
864
     `yyvs': related to semantic values,
865
     `yyls': related to locations.
866
 
867
     Refer to the stacks thru separate pointers, to allow yyoverflow
868
     to reallocate them elsewhere.  */
869
 
870
  /* The state stack.  */
871
  short yyssa[YYINITDEPTH];
872
  short *yyss = yyssa;
873
  register short *yyssp;
874
 
875
  /* The semantic value stack.  */
876
  YYSTYPE yyvsa[YYINITDEPTH];
877
  YYSTYPE *yyvs = yyvsa;
878
  register YYSTYPE *yyvsp;
879
 
880
 
881
 
882
#define YYPOPSTACK   (yyvsp--, yyssp--)
883
 
884
  YYSIZE_T yystacksize = YYINITDEPTH;
885
 
886
  /* The variables used to return semantic value and location from the
887
     action routines.  */
888
  YYSTYPE yyval;
889
 
890
 
891
  /* When reducing, the number of symbols on the RHS of the reduced
892
     rule.  */
893
  int yylen;
894
 
895
  YYDPRINTF ((stderr, "Starting parse\n"));
896
 
897
  yystate = 0;
898
  yyerrstatus = 0;
899
  yynerrs = 0;
900
  yychar = YYEMPTY;             /* Cause a token to be read.  */
901
 
902
  /* Initialize stack pointers.
903
     Waste one element of value and location stack
904
     so that they stay on the same level as the state stack.
905
     The wasted elements are never initialized.  */
906
 
907
  yyssp = yyss;
908
  yyvsp = yyvs;
909
 
910
  goto yysetstate;
911
 
912
/*------------------------------------------------------------.
913
| yynewstate -- Push a new state, which is found in yystate.  |
914
`------------------------------------------------------------*/
915
 yynewstate:
916
  /* In all cases, when you get here, the value and location stacks
917
     have just been pushed. so pushing a state here evens the stacks.
918
     */
919
  yyssp++;
920
 
921
 yysetstate:
922
  *yyssp = yystate;
923
 
924
  if (yyss + yystacksize - 1 <= yyssp)
925
    {
926
      /* Get the current used size of the three stacks, in elements.  */
927
      YYSIZE_T yysize = yyssp - yyss + 1;
928
 
929
#ifdef yyoverflow
930
      {
931
        /* Give user a chance to reallocate the stack. Use copies of
932
           these so that the &'s don't force the real ones into
933
           memory.  */
934
        YYSTYPE *yyvs1 = yyvs;
935
        short *yyss1 = yyss;
936
 
937
 
938
        /* Each stack pointer address is followed by the size of the
939
           data in use in that stack, in bytes.  This used to be a
940
           conditional around just the two extra args, but that might
941
           be undefined if yyoverflow is a macro.  */
942
        yyoverflow ("parser stack overflow",
943
                    &yyss1, yysize * sizeof (*yyssp),
944
                    &yyvs1, yysize * sizeof (*yyvsp),
945
 
946
                    &yystacksize);
947
 
948
        yyss = yyss1;
949
        yyvs = yyvs1;
950
      }
951
#else /* no yyoverflow */
952
# ifndef YYSTACK_RELOCATE
953
      goto yyoverflowlab;
954
# else
955
      /* Extend the stack our own way.  */
956
      if (YYMAXDEPTH <= yystacksize)
957
        goto yyoverflowlab;
958
      yystacksize *= 2;
959
      if (YYMAXDEPTH < yystacksize)
960
        yystacksize = YYMAXDEPTH;
961
 
962
      {
963
        short *yyss1 = yyss;
964
        union yyalloc *yyptr =
965
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
966
        if (! yyptr)
967
          goto yyoverflowlab;
968
        YYSTACK_RELOCATE (yyss);
969
        YYSTACK_RELOCATE (yyvs);
970
 
971
#  undef YYSTACK_RELOCATE
972
        if (yyss1 != yyssa)
973
          YYSTACK_FREE (yyss1);
974
      }
975
# endif
976
#endif /* no yyoverflow */
977
 
978
      yyssp = yyss + yysize - 1;
979
      yyvsp = yyvs + yysize - 1;
980
 
981
 
982
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
983
                  (unsigned long int) yystacksize));
984
 
985
      if (yyss + yystacksize - 1 <= yyssp)
986
        YYABORT;
987
    }
988
 
989
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
990
 
991
  goto yybackup;
992
 
993
/*-----------.
994
| yybackup.  |
995
`-----------*/
996
yybackup:
997
 
998
/* Do appropriate processing given the current state.  */
999
/* Read a lookahead token if we need one and don't already have one.  */
1000
/* yyresume: */
1001
 
1002
  /* First try to decide what to do without reference to lookahead token.  */
1003
 
1004
  yyn = yypact[yystate];
1005
  if (yyn == YYPACT_NINF)
1006
    goto yydefault;
1007
 
1008
  /* Not known => get a lookahead token if don't already have one.  */
1009
 
1010
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1011
  if (yychar == YYEMPTY)
1012
    {
1013
      YYDPRINTF ((stderr, "Reading a token: "));
1014
      yychar = YYLEX;
1015
    }
1016
 
1017
  if (yychar <= YYEOF)
1018
    {
1019
      yychar = yytoken = YYEOF;
1020
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1021
    }
1022
  else
1023
    {
1024
      yytoken = YYTRANSLATE (yychar);
1025
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1026
    }
1027
 
1028
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1029
     detect an error, take that action.  */
1030
  yyn += yytoken;
1031
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1032
    goto yydefault;
1033
  yyn = yytable[yyn];
1034
  if (yyn <= 0)
1035
    {
1036
      if (yyn == 0 || yyn == YYTABLE_NINF)
1037
        goto yyerrlab;
1038
      yyn = -yyn;
1039
      goto yyreduce;
1040
    }
1041
 
1042
  if (yyn == YYFINAL)
1043
    YYACCEPT;
1044
 
1045
  /* Shift the lookahead token.  */
1046
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1047
 
1048
  /* Discard the token being shifted unless it is eof.  */
1049
  if (yychar != YYEOF)
1050
    yychar = YYEMPTY;
1051
 
1052
  *++yyvsp = yylval;
1053
 
1054
 
1055
  /* Count tokens shifted since error; after three, turn off error
1056
     status.  */
1057
  if (yyerrstatus)
1058
    yyerrstatus--;
1059
 
1060
  yystate = yyn;
1061
  goto yynewstate;
1062
 
1063
 
1064
/*-----------------------------------------------------------.
1065
| yydefault -- do the default action for the current state.  |
1066
`-----------------------------------------------------------*/
1067
yydefault:
1068
  yyn = yydefact[yystate];
1069
  if (yyn == 0)
1070
    goto yyerrlab;
1071
  goto yyreduce;
1072
 
1073
 
1074
/*-----------------------------.
1075
| yyreduce -- Do a reduction.  |
1076
`-----------------------------*/
1077
yyreduce:
1078
  /* yyn is the number of a rule to reduce with.  */
1079
  yylen = yyr2[yyn];
1080
 
1081
  /* If YYLEN is nonzero, implement the default value of the action:
1082
     `$$ = $1'.
1083
 
1084
     Otherwise, the following line sets YYVAL to garbage.
1085
     This behavior is undocumented and Bison
1086
     users should not rely upon it.  Assigning to YYVAL
1087
     unconditionally makes the parser a bit smaller, and it avoids a
1088
     GCC warning that YYVAL may be used uninitialized.  */
1089
  yyval = yyvsp[1-yylen];
1090
 
1091
 
1092
  YY_REDUCE_PRINT (yyn);
1093
  switch (yyn)
1094
    {
1095
        case 2:
1096
#line 69 "arparse.y"
1097
    { prompt(); }
1098
    break;
1099
 
1100
  case 6:
1101
#line 78 "arparse.y"
1102
    { prompt(); }
1103
    break;
1104
 
1105
  case 19:
1106
#line 94 "arparse.y"
1107
    { ar_end(); return 0; }
1108
    break;
1109
 
1110
  case 21:
1111
#line 96 "arparse.y"
1112
    { yyerror("foo"); }
1113
    break;
1114
 
1115
  case 23:
1116
#line 103 "arparse.y"
1117
    { ar_extract(yyvsp[0].list); }
1118
    break;
1119
 
1120
  case 24:
1121
#line 108 "arparse.y"
1122
    { ar_replace(yyvsp[0].list); }
1123
    break;
1124
 
1125
  case 25:
1126
#line 113 "arparse.y"
1127
    { ar_clear(); }
1128
    break;
1129
 
1130
  case 26:
1131
#line 118 "arparse.y"
1132
    { ar_delete(yyvsp[0].list); }
1133
    break;
1134
 
1135
  case 27:
1136
#line 122 "arparse.y"
1137
    { ar_addmod(yyvsp[0].list); }
1138
    break;
1139
 
1140
  case 28:
1141
#line 127 "arparse.y"
1142
    { ar_list(); }
1143
    break;
1144
 
1145
  case 29:
1146
#line 132 "arparse.y"
1147
    { ar_save(); }
1148
    break;
1149
 
1150
  case 30:
1151
#line 139 "arparse.y"
1152
    { ar_open(yyvsp[0].name,0); }
1153
    break;
1154
 
1155
  case 31:
1156
#line 144 "arparse.y"
1157
    { ar_open(yyvsp[0].name,1); }
1158
    break;
1159
 
1160
  case 32:
1161
#line 150 "arparse.y"
1162
    { ar_addlib(yyvsp[-1].name,yyvsp[0].list); }
1163
    break;
1164
 
1165
  case 33:
1166
#line 154 "arparse.y"
1167
    { ar_directory(yyvsp[-2].name, yyvsp[-1].list, yyvsp[0].name); }
1168
    break;
1169
 
1170
  case 34:
1171
#line 161 "arparse.y"
1172
    { yyval.name = yyvsp[0].name; }
1173
    break;
1174
 
1175
  case 35:
1176
#line 162 "arparse.y"
1177
    { yyval.name = 0; }
1178
    break;
1179
 
1180
  case 36:
1181
#line 167 "arparse.y"
1182
    { yyval.list = yyvsp[-1].list; }
1183
    break;
1184
 
1185
  case 37:
1186
#line 169 "arparse.y"
1187
    { yyval.list = 0; }
1188
    break;
1189
 
1190
  case 38:
1191
#line 174 "arparse.y"
1192
    {   struct list *n  = (struct list *) malloc(sizeof(struct list));
1193
                        n->next = yyvsp[-2].list;
1194
                        n->name = yyvsp[0].name;
1195
                        yyval.list = n;
1196
                 }
1197
    break;
1198
 
1199
  case 39:
1200
#line 179 "arparse.y"
1201
    { yyval.list = 0; }
1202
    break;
1203
 
1204
  case 42:
1205
#line 191 "arparse.y"
1206
    { verbose = !verbose; }
1207
    break;
1208
 
1209
 
1210
    }
1211
 
1212
/* Line 1000 of yacc.c.  */
1213
#line 1214 "arparse.c"
1214
 
1215
  yyvsp -= yylen;
1216
  yyssp -= yylen;
1217
 
1218
 
1219
  YY_STACK_PRINT (yyss, yyssp);
1220
 
1221
  *++yyvsp = yyval;
1222
 
1223
 
1224
  /* Now `shift' the result of the reduction.  Determine what state
1225
     that goes to, based on the state we popped back to and the rule
1226
     number reduced by.  */
1227
 
1228
  yyn = yyr1[yyn];
1229
 
1230
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1231
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1232
    yystate = yytable[yystate];
1233
  else
1234
    yystate = yydefgoto[yyn - YYNTOKENS];
1235
 
1236
  goto yynewstate;
1237
 
1238
 
1239
/*------------------------------------.
1240
| yyerrlab -- here on detecting error |
1241
`------------------------------------*/
1242
yyerrlab:
1243
  /* If not already recovering from an error, report this error.  */
1244
  if (!yyerrstatus)
1245
    {
1246
      ++yynerrs;
1247
#if YYERROR_VERBOSE
1248
      yyn = yypact[yystate];
1249
 
1250
      if (YYPACT_NINF < yyn && yyn < YYLAST)
1251
        {
1252
          YYSIZE_T yysize = 0;
1253
          int yytype = YYTRANSLATE (yychar);
1254
          const char* yyprefix;
1255
          char *yymsg;
1256
          int yyx;
1257
 
1258
          /* Start YYX at -YYN if negative to avoid negative indexes in
1259
             YYCHECK.  */
1260
          int yyxbegin = yyn < 0 ? -yyn : 0;
1261
 
1262
          /* Stay within bounds of both yycheck and yytname.  */
1263
          int yychecklim = YYLAST - yyn;
1264
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1265
          int yycount = 0;
1266
 
1267
          yyprefix = ", expecting ";
1268
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1269
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1270
              {
1271
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1272
                yycount += 1;
1273
                if (yycount == 5)
1274
                  {
1275
                    yysize = 0;
1276
                    break;
1277
                  }
1278
              }
1279
          yysize += (sizeof ("syntax error, unexpected ")
1280
                     + yystrlen (yytname[yytype]));
1281
          yymsg = (char *) YYSTACK_ALLOC (yysize);
1282
          if (yymsg != 0)
1283
            {
1284
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1285
              yyp = yystpcpy (yyp, yytname[yytype]);
1286
 
1287
              if (yycount < 5)
1288
                {
1289
                  yyprefix = ", expecting ";
1290
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1291
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1292
                      {
1293
                        yyp = yystpcpy (yyp, yyprefix);
1294
                        yyp = yystpcpy (yyp, yytname[yyx]);
1295
                        yyprefix = " or ";
1296
                      }
1297
                }
1298
              yyerror (yymsg);
1299
              YYSTACK_FREE (yymsg);
1300
            }
1301
          else
1302
            yyerror ("syntax error; also virtual memory exhausted");
1303
        }
1304
      else
1305
#endif /* YYERROR_VERBOSE */
1306
        yyerror ("syntax error");
1307
    }
1308
 
1309
 
1310
 
1311
  if (yyerrstatus == 3)
1312
    {
1313
      /* If just tried and failed to reuse lookahead token after an
1314
         error, discard it.  */
1315
 
1316
      if (yychar <= YYEOF)
1317
        {
1318
          /* If at end of input, pop the error token,
1319
             then the rest of the stack, then return failure.  */
1320
          if (yychar == YYEOF)
1321
             for (;;)
1322
               {
1323
                 YYPOPSTACK;
1324
                 if (yyssp == yyss)
1325
                   YYABORT;
1326
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1327
                 yydestruct (yystos[*yyssp], yyvsp);
1328
               }
1329
        }
1330
      else
1331
        {
1332
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1333
          yydestruct (yytoken, &yylval);
1334
          yychar = YYEMPTY;
1335
 
1336
        }
1337
    }
1338
 
1339
  /* Else will try to reuse lookahead token after shifting the error
1340
     token.  */
1341
  goto yyerrlab1;
1342
 
1343
 
1344
/*---------------------------------------------------.
1345
| yyerrorlab -- error raised explicitly by YYERROR.  |
1346
`---------------------------------------------------*/
1347
yyerrorlab:
1348
 
1349
#ifdef __GNUC__
1350
  /* Pacify GCC when the user code never invokes YYERROR and the label
1351
     yyerrorlab therefore never appears in user code.  */
1352
  if (0)
1353
     goto yyerrorlab;
1354
#endif
1355
 
1356
  yyvsp -= yylen;
1357
  yyssp -= yylen;
1358
  yystate = *yyssp;
1359
  goto yyerrlab1;
1360
 
1361
 
1362
/*-------------------------------------------------------------.
1363
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1364
`-------------------------------------------------------------*/
1365
yyerrlab1:
1366
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1367
 
1368
  for (;;)
1369
    {
1370
      yyn = yypact[yystate];
1371
      if (yyn != YYPACT_NINF)
1372
        {
1373
          yyn += YYTERROR;
1374
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1375
            {
1376
              yyn = yytable[yyn];
1377
              if (0 < yyn)
1378
                break;
1379
            }
1380
        }
1381
 
1382
      /* Pop the current state because it cannot handle the error token.  */
1383
      if (yyssp == yyss)
1384
        YYABORT;
1385
 
1386
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1387
      yydestruct (yystos[yystate], yyvsp);
1388
      YYPOPSTACK;
1389
      yystate = *yyssp;
1390
      YY_STACK_PRINT (yyss, yyssp);
1391
    }
1392
 
1393
  if (yyn == YYFINAL)
1394
    YYACCEPT;
1395
 
1396
  YYDPRINTF ((stderr, "Shifting error token, "));
1397
 
1398
  *++yyvsp = yylval;
1399
 
1400
 
1401
  yystate = yyn;
1402
  goto yynewstate;
1403
 
1404
 
1405
/*-------------------------------------.
1406
| yyacceptlab -- YYACCEPT comes here.  |
1407
`-------------------------------------*/
1408
yyacceptlab:
1409
  yyresult = 0;
1410
  goto yyreturn;
1411
 
1412
/*-----------------------------------.
1413
| yyabortlab -- YYABORT comes here.  |
1414
`-----------------------------------*/
1415
yyabortlab:
1416
  yyresult = 1;
1417
  goto yyreturn;
1418
 
1419
#ifndef yyoverflow
1420
/*----------------------------------------------.
1421
| yyoverflowlab -- parser overflow comes here.  |
1422
`----------------------------------------------*/
1423
yyoverflowlab:
1424
  yyerror ("parser stack overflow");
1425
  yyresult = 2;
1426
  /* Fall through.  */
1427
#endif
1428
 
1429
yyreturn:
1430
#ifndef yyoverflow
1431
  if (yyss != yyssa)
1432
    YYSTACK_FREE (yyss);
1433
#endif
1434
  return yyresult;
1435
}
1436
 
1437
 
1438
#line 195 "arparse.y"
1439
 
1440
 
1441
static int
1442
yyerror (const char *x ATTRIBUTE_UNUSED)
1443
{
1444
  extern int linenumber;
1445
 
1446
  printf (_("Syntax error in archive script, line %d\n"), linenumber + 1);
1447
  return 0;
1448
}
1449
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.