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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [cp-name-parser.c] - Blame information for rev 853

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

Line No. Rev Author Line
1 24 jeremybenn
/* 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
     INT = 258,
57
     FLOAT = 259,
58
     NAME = 260,
59
     STRUCT = 261,
60
     CLASS = 262,
61
     UNION = 263,
62
     ENUM = 264,
63
     SIZEOF = 265,
64
     UNSIGNED = 266,
65
     COLONCOLON = 267,
66
     TEMPLATE = 268,
67
     ERROR = 269,
68
     NEW = 270,
69
     DELETE = 271,
70
     OPERATOR = 272,
71
     STATIC_CAST = 273,
72
     REINTERPRET_CAST = 274,
73
     DYNAMIC_CAST = 275,
74
     SIGNED_KEYWORD = 276,
75
     LONG = 277,
76
     SHORT = 278,
77
     INT_KEYWORD = 279,
78
     CONST_KEYWORD = 280,
79
     VOLATILE_KEYWORD = 281,
80
     DOUBLE_KEYWORD = 282,
81
     BOOL = 283,
82
     ELLIPSIS = 284,
83
     RESTRICT = 285,
84
     VOID = 286,
85
     FLOAT_KEYWORD = 287,
86
     CHAR = 288,
87
     WCHAR_T = 289,
88
     ASSIGN_MODIFY = 290,
89
     TRUEKEYWORD = 291,
90
     FALSEKEYWORD = 292,
91
     DEMANGLER_SPECIAL = 293,
92
     CONSTRUCTION_VTABLE = 294,
93
     CONSTRUCTION_IN = 295,
94
     GLOBAL = 296,
95
     OROR = 297,
96
     ANDAND = 298,
97
     NOTEQUAL = 299,
98
     EQUAL = 300,
99
     GEQ = 301,
100
     LEQ = 302,
101
     RSH = 303,
102
     LSH = 304,
103
     DECREMENT = 305,
104
     INCREMENT = 306,
105
     UNARY = 307,
106
     ARROW = 308
107
   };
108
#endif
109
#define INT 258
110
#define FLOAT 259
111
#define NAME 260
112
#define STRUCT 261
113
#define CLASS 262
114
#define UNION 263
115
#define ENUM 264
116
#define SIZEOF 265
117
#define UNSIGNED 266
118
#define COLONCOLON 267
119
#define TEMPLATE 268
120
#define ERROR 269
121
#define NEW 270
122
#define DELETE 271
123
#define OPERATOR 272
124
#define STATIC_CAST 273
125
#define REINTERPRET_CAST 274
126
#define DYNAMIC_CAST 275
127
#define SIGNED_KEYWORD 276
128
#define LONG 277
129
#define SHORT 278
130
#define INT_KEYWORD 279
131
#define CONST_KEYWORD 280
132
#define VOLATILE_KEYWORD 281
133
#define DOUBLE_KEYWORD 282
134
#define BOOL 283
135
#define ELLIPSIS 284
136
#define RESTRICT 285
137
#define VOID 286
138
#define FLOAT_KEYWORD 287
139
#define CHAR 288
140
#define WCHAR_T 289
141
#define ASSIGN_MODIFY 290
142
#define TRUEKEYWORD 291
143
#define FALSEKEYWORD 292
144
#define DEMANGLER_SPECIAL 293
145
#define CONSTRUCTION_VTABLE 294
146
#define CONSTRUCTION_IN 295
147
#define GLOBAL 296
148
#define OROR 297
149
#define ANDAND 298
150
#define NOTEQUAL 299
151
#define EQUAL 300
152
#define GEQ 301
153
#define LEQ 302
154
#define RSH 303
155
#define LSH 304
156
#define DECREMENT 305
157
#define INCREMENT 306
158
#define UNARY 307
159
#define ARROW 308
160
 
161
 
162
 
163
 
164
/* Copy the first part of user declarations.  */
165
#line 32 "cp-name-parser.y"
166
 
167
 
168
#include <stdio.h>
169
#include <stdlib.h>
170
#include <unistd.h>
171
#include <string.h>
172
 
173
#include "safe-ctype.h"
174
#include "libiberty.h"
175
#include "demangle.h"
176
 
177
/* Bison does not make it easy to create a parser without global
178
   state, unfortunately.  Here are all the global variables used
179
   in this parser.  */
180
 
181
/* LEXPTR is the current pointer into our lex buffer.  PREV_LEXPTR
182
   is the start of the last token lexed, only used for diagnostics.
183
   ERROR_LEXPTR is the first place an error occurred.  GLOBAL_ERRMSG
184
   is the first error message encountered.  */
185
 
186
static const char *lexptr, *prev_lexptr, *error_lexptr, *global_errmsg;
187
 
188
/* The components built by the parser are allocated ahead of time,
189
   and cached in this structure.  */
190
 
191
#define ALLOC_CHUNK 100
192
 
193
struct demangle_info {
194
  int used;
195
  struct demangle_info *prev, *next;
196
  struct demangle_component comps[ALLOC_CHUNK];
197
};
198
 
199
static struct demangle_info *demangle_info;
200
 
201
static struct demangle_component *
202
d_grab (void)
203
{
204
  struct demangle_info *more;
205
 
206
  if (demangle_info->used >= ALLOC_CHUNK)
207
    {
208
      if (demangle_info->next == NULL)
209
        {
210
          more = xmalloc (sizeof (struct demangle_info));
211
          more->prev = demangle_info;
212
          more->next = NULL;
213
          demangle_info->next = more;
214
        }
215
      else
216
        more = demangle_info->next;
217
 
218
      more->used = 0;
219
      demangle_info = more;
220
    }
221
  return &demangle_info->comps[demangle_info->used++];
222
}
223
 
224
/* The parse tree created by the parser is stored here after a successful
225
   parse.  */
226
 
227
static struct demangle_component *global_result;
228
 
229
/* Prototypes for helper functions used when constructing the parse
230
   tree.  */
231
 
232
static struct demangle_component *d_qualify (struct demangle_component *, int,
233
                                             int);
234
 
235
static struct demangle_component *d_int_type (int);
236
 
237
static struct demangle_component *d_unary (const char *,
238
                                           struct demangle_component *);
239
static struct demangle_component *d_binary (const char *,
240
                                            struct demangle_component *,
241
                                            struct demangle_component *);
242
 
243
/* Flags passed to d_qualify.  */
244
 
245
#define QUAL_CONST 1
246
#define QUAL_RESTRICT 2
247
#define QUAL_VOLATILE 4
248
 
249
/* Flags passed to d_int_type.  */
250
 
251
#define INT_CHAR        (1 << 0)
252
#define INT_SHORT       (1 << 1)
253
#define INT_LONG        (1 << 2)
254
#define INT_LLONG       (1 << 3)
255
 
256
#define INT_SIGNED      (1 << 4)
257
#define INT_UNSIGNED    (1 << 5)
258
 
259
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
260
   as well as gratuitiously global symbol names, so we can have multiple
261
   yacc generated parsers in gdb.  Note that these are only the variables
262
   produced by yacc.  If other parser generators (bison, byacc, etc) produce
263
   additional global names that conflict at link time, then those parser
264
   generators need to be fixed instead of adding those names to this list. */
265
 
266
#define yymaxdepth cpname_maxdepth
267
#define yyparse cpname_parse
268
#define yylex   cpname_lex
269
#define yyerror cpname_error
270
#define yylval  cpname_lval
271
#define yychar  cpname_char
272
#define yydebug cpname_debug
273
#define yypact  cpname_pact     
274
#define yyr1    cpname_r1                       
275
#define yyr2    cpname_r2                       
276
#define yydef   cpname_def              
277
#define yychk   cpname_chk              
278
#define yypgo   cpname_pgo              
279
#define yyact   cpname_act              
280
#define yyexca  cpname_exca
281
#define yyerrflag cpname_errflag
282
#define yynerrs cpname_nerrs
283
#define yyps    cpname_ps
284
#define yypv    cpname_pv
285
#define yys     cpname_s
286
#define yy_yys  cpname_yys
287
#define yystate cpname_state
288
#define yytmp   cpname_tmp
289
#define yyv     cpname_v
290
#define yy_yyv  cpname_yyv
291
#define yyval   cpname_val
292
#define yylloc  cpname_lloc
293
#define yyreds  cpname_reds             /* With YYDEBUG defined */
294
#define yytoks  cpname_toks             /* With YYDEBUG defined */
295
#define yyname  cpname_name             /* With YYDEBUG defined */
296
#define yyrule  cpname_rule             /* With YYDEBUG defined */
297
#define yylhs   cpname_yylhs
298
#define yylen   cpname_yylen
299
#define yydefred cpname_yydefred
300
#define yydgoto cpname_yydgoto
301
#define yysindex cpname_yysindex
302
#define yyrindex cpname_yyrindex
303
#define yygindex cpname_yygindex
304
#define yytable  cpname_yytable
305
#define yycheck  cpname_yycheck
306
 
307
int yyparse (void);
308
static int yylex (void);
309
static void yyerror (char *);
310
 
311
/* Enable yydebug for the stand-alone parser.  */
312
#ifdef TEST_CPNAMES
313
# define YYDEBUG        1
314
#endif
315
 
316
/* Helper functions.  These wrap the demangler tree interface, handle
317
   allocation from our global store, and return the allocated component.  */
318
 
319
static struct demangle_component *
320
fill_comp (enum demangle_component_type d_type, struct demangle_component *lhs,
321
           struct demangle_component *rhs)
322
{
323
  struct demangle_component *ret = d_grab ();
324
  cplus_demangle_fill_component (ret, d_type, lhs, rhs);
325
  return ret;
326
}
327
 
328
static struct demangle_component *
329
make_empty (enum demangle_component_type d_type)
330
{
331
  struct demangle_component *ret = d_grab ();
332
  ret->type = d_type;
333
  return ret;
334
}
335
 
336
static struct demangle_component *
337
make_operator (const char *name, int args)
338
{
339
  struct demangle_component *ret = d_grab ();
340
  cplus_demangle_fill_operator (ret, name, args);
341
  return ret;
342
}
343
 
344
static struct demangle_component *
345
make_dtor (enum gnu_v3_dtor_kinds kind, struct demangle_component *name)
346
{
347
  struct demangle_component *ret = d_grab ();
348
  cplus_demangle_fill_dtor (ret, kind, name);
349
  return ret;
350
}
351
 
352
static struct demangle_component *
353
make_builtin_type (const char *name)
354
{
355
  struct demangle_component *ret = d_grab ();
356
  cplus_demangle_fill_builtin_type (ret, name);
357
  return ret;
358
}
359
 
360
static struct demangle_component *
361
make_name (const char *name, int len)
362
{
363
  struct demangle_component *ret = d_grab ();
364
  cplus_demangle_fill_name (ret, name, len);
365
  return ret;
366
}
367
 
368
#define d_left(dc) (dc)->u.s_binary.left
369
#define d_right(dc) (dc)->u.s_binary.right
370
 
371
 
372
 
373
/* Enabling traces.  */
374
#ifndef YYDEBUG
375
# define YYDEBUG 0
376
#endif
377
 
378
/* Enabling verbose error messages.  */
379
#ifdef YYERROR_VERBOSE
380
# undef YYERROR_VERBOSE
381
# define YYERROR_VERBOSE 1
382
#else
383
# define YYERROR_VERBOSE 0
384
#endif
385
 
386
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
387
#line 240 "cp-name-parser.y"
388
typedef union YYSTYPE {
389
    struct demangle_component *comp;
390
    struct nested {
391
      struct demangle_component *comp;
392
      struct demangle_component **last;
393
    } nested;
394
    struct {
395
      struct demangle_component *comp, *last;
396
    } nested1;
397
    struct {
398
      struct demangle_component *comp, **last;
399
      struct nested fn;
400
      struct demangle_component *start;
401
      int fold_flag;
402
    } abstract;
403
    int lval;
404
    struct {
405
      int val;
406
      struct demangle_component *type;
407
    } typed_val_int;
408
    const char *opname;
409
  } YYSTYPE;
410
/* Line 191 of yacc.c.  */
411
#line 412 "cp-name-parser.c.tmp"
412
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
413
# define YYSTYPE_IS_DECLARED 1
414
# define YYSTYPE_IS_TRIVIAL 1
415
#endif
416
 
417
 
418
 
419
/* Copy the second part of user declarations.  */
420
#line 316 "cp-name-parser.y"
421
 
422
enum {
423
  GLOBAL_CONSTRUCTORS = DEMANGLE_COMPONENT_LITERAL + 20,
424
  GLOBAL_DESTRUCTORS = DEMANGLE_COMPONENT_LITERAL + 21
425
};
426
 
427
 
428
/* Line 214 of yacc.c.  */
429
#line 430 "cp-name-parser.c.tmp"
430
 
431
#if ! defined (yyoverflow) || YYERROR_VERBOSE
432
 
433
# ifndef YYFREE
434
#  define YYFREE free
435
# endif
436
# ifndef YYMALLOC
437
#  define YYMALLOC xmalloc
438
# endif
439
 
440
/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
441
 
442
# ifdef YYSTACK_USE_ALLOCA
443
#  if YYSTACK_USE_ALLOCA
444
#   define YYSTACK_ALLOC alloca
445
#  endif
446
# else
447
#  if defined (alloca) || defined (_ALLOCA_H)
448
#   define YYSTACK_ALLOC alloca
449
#  else
450
#   ifdef __GNUC__
451
#    define YYSTACK_ALLOC __builtin_alloca
452
#   endif
453
#  endif
454
# endif
455
 
456
# ifdef YYSTACK_ALLOC
457
   /* Pacify GCC's `empty if-body' warning. */
458
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
459
# else
460
#  if defined (__STDC__) || defined (__cplusplus)
461
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
462
#   define YYSIZE_T size_t
463
#  endif
464
#  define YYSTACK_ALLOC YYMALLOC
465
#  define YYSTACK_FREE YYFREE
466
# endif
467
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
468
 
469
 
470
#if (! defined (yyoverflow) \
471
     && (! defined (__cplusplus) \
472
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
473
 
474
/* A type that is properly aligned for any stack member.  */
475
union yyalloc
476
{
477
  short yyss;
478
  YYSTYPE yyvs;
479
  };
480
 
481
/* The size of the maximum gap between one aligned stack and the next.  */
482
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
483
 
484
/* The size of an array large to enough to hold all stacks, each with
485
   N elements.  */
486
# define YYSTACK_BYTES(N) \
487
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
488
      + YYSTACK_GAP_MAXIMUM)
489
 
490
/* Copy COUNT objects from FROM to TO.  The source and destination do
491
   not overlap.  */
492
# ifndef YYCOPY
493
#  if defined (__GNUC__) && 1 < __GNUC__
494
#   define YYCOPY(To, From, Count) \
495
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
496
#  else
497
#   define YYCOPY(To, From, Count)              \
498
      do                                        \
499
        {                                       \
500
          register YYSIZE_T yyi;                \
501
          for (yyi = 0; yyi < (Count); yyi++)    \
502
            (To)[yyi] = (From)[yyi];            \
503
        }                                       \
504
      while (0)
505
#  endif
506
# endif
507
 
508
/* Relocate STACK from its old location to the new one.  The
509
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
510
   elements in the stack, and YYPTR gives the new location of the
511
   stack.  Advance YYPTR to a properly aligned location for the next
512
   stack.  */
513
# define YYSTACK_RELOCATE(Stack)                                        \
514
    do                                                                  \
515
      {                                                                 \
516
        YYSIZE_T yynewbytes;                                            \
517
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
518
        Stack = &yyptr->Stack;                                          \
519
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
520
        yyptr += yynewbytes / sizeof (*yyptr);                          \
521
      }                                                                 \
522
    while (0)
523
 
524
#endif
525
 
526
#if defined (__STDC__) || defined (__cplusplus)
527
   typedef signed char yysigned_char;
528
#else
529
   typedef short yysigned_char;
530
#endif
531
 
532
/* YYFINAL -- State number of the termination state. */
533
#define YYFINAL  85
534
/* YYLAST -- Last index in YYTABLE.  */
535
#define YYLAST   1054
536
 
537
/* YYNTOKENS -- Number of terminals. */
538
#define YYNTOKENS  76
539
/* YYNNTS -- Number of nonterminals. */
540
#define YYNNTS  40
541
/* YYNRULES -- Number of rules. */
542
#define YYNRULES  195
543
/* YYNRULES -- Number of states. */
544
#define YYNSTATES  325
545
 
546
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
547
#define YYUNDEFTOK  2
548
#define YYMAXUTOK   308
549
 
550
#define YYTRANSLATE(YYX)                                                \
551
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
552
 
553
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
554
static const unsigned char yytranslate[] =
555
{
556
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
557
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
558
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
559
       2,     2,     2,    73,     2,     2,     2,    64,    50,     2,
560
      74,    42,    62,    60,    43,    61,    68,    63,     2,     2,
561
       2,     2,     2,     2,     2,     2,     2,     2,    75,     2,
562
      53,    44,    54,    45,    59,     2,     2,     2,     2,     2,
563
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
564
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
565
       2,    69,     2,    71,    49,     2,     2,     2,     2,     2,
566
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
567
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
568
       2,     2,     2,     2,    48,     2,    72,     2,     2,     2,
569
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
570
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
571
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
572
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
573
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
574
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
575
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
576
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
577
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
578
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
579
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
580
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
581
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
582
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
583
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
584
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
585
      35,    36,    37,    38,    39,    40,    41,    46,    47,    51,
586
      52,    55,    56,    57,    58,    65,    66,    67,    70
587
};
588
 
589
#if YYDEBUG
590
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
591
   YYRHS.  */
592
static const unsigned short yyprhs[] =
593
{
594
       0,     0,     3,     5,     7,     9,    11,    12,    15,    18,
595
      22,    26,    29,    32,    35,    40,    42,    45,    48,    53,
596
      58,    61,    64,    67,    70,    73,    76,    79,    82,    85,
597
      88,    91,    94,    97,   100,   103,   106,   109,   112,   115,
598
     118,   121,   124,   127,   130,   133,   137,   140,   144,   148,
599
     151,   154,   156,   160,   163,   165,   170,   173,   175,   178,
600
     181,   183,   186,   188,   190,   192,   194,   197,   200,   202,
601
     205,   209,   212,   216,   221,   223,   227,   229,   232,   235,
602
     240,   242,   244,   247,   251,   256,   260,   265,   270,   274,
603
     275,   277,   279,   281,   283,   285,   288,   290,   292,   294,
604
     296,   298,   300,   302,   305,   307,   309,   311,   314,   316,
605
     318,   320,   323,   325,   329,   334,   337,   341,   344,   346,
606
     350,   353,   356,   358,   362,   365,   369,   372,   377,   381,
607
     383,   386,   388,   392,   395,   398,   400,   402,   405,   407,
608
     412,   415,   417,   420,   423,   425,   429,   432,   435,   437,
609
     440,   442,   444,   449,   454,   459,   462,   465,   468,   471,
610
     475,   477,   481,   484,   489,   492,   495,   498,   503,   511,
611
     519,   527,   531,   535,   539,   543,   547,   551,   555,   559,
612
     563,   567,   571,   575,   579,   583,   587,   591,   595,   599,
613
     603,   609,   611,   613,   618,   620
614
};
615
 
616
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
617
static const yysigned_char yyrhs[] =
618
{
619
      77,     0,    -1,    78,    -1,   109,    -1,    81,    -1,    80,
620
      -1,    -1,    12,    78,    -1,   105,   112,    -1,   105,    96,
621
      79,    -1,    89,    96,    79,    -1,    84,    79,    -1,    84,
622
     108,    -1,    38,    78,    -1,    39,    78,    40,    78,    -1,
623
      41,    -1,    17,    15,    -1,    17,    16,    -1,    17,    15,
624
      69,    71,    -1,    17,    16,    69,    71,    -1,    17,    60,
625
      -1,    17,    61,    -1,    17,    62,    -1,    17,    63,    -1,
626
      17,    64,    -1,    17,    49,    -1,    17,    50,    -1,    17,
627
      48,    -1,    17,    72,    -1,    17,    73,    -1,    17,    44,
628
      -1,    17,    53,    -1,    17,    54,    -1,    17,    35,    -1,
629
      17,    58,    -1,    17,    57,    -1,    17,    52,    -1,    17,
630
      51,    -1,    17,    56,    -1,    17,    55,    -1,    17,    47,
631
      -1,    17,    46,    -1,    17,    66,    -1,    17,    65,    -1,
632
      17,    43,    -1,    17,    70,    62,    -1,    17,    70,    -1,
633
      17,    74,    42,    -1,    17,    69,    71,    -1,    17,   105,
634
      -1,    91,    83,    -1,    83,    -1,    12,    91,    83,    -1,
635
      12,    83,    -1,    82,    -1,    82,    53,    93,    54,    -1,
636
      72,     5,    -1,    87,    -1,    12,    87,    -1,    91,     5,
637
      -1,     5,    -1,    91,    92,    -1,    92,    -1,    86,    -1,
638
      89,    -1,    90,    -1,    12,    90,    -1,    91,    85,    -1,
639
      85,    -1,     5,    12,    -1,    91,     5,    12,    -1,    92,
640
      12,    -1,    91,    92,    12,    -1,     5,    53,    93,    54,
641
      -1,    94,    -1,    93,    43,    94,    -1,   105,    -1,   105,
642
     106,    -1,    50,    78,    -1,    50,    74,    78,    42,    -1,
643
     114,    -1,   105,    -1,   105,   106,    -1,    95,    43,   105,
644
      -1,    95,    43,   105,   106,    -1,    95,    43,    29,    -1,
645
      74,    95,    42,    97,    -1,    74,    31,    42,    97,    -1,
646
      74,    42,    97,    -1,    -1,    99,    -1,    30,    -1,    26,
647
      -1,    25,    -1,    98,    -1,    98,    99,    -1,    24,    -1,
648
      21,    -1,    11,    -1,    33,    -1,    22,    -1,    23,    -1,
649
     100,    -1,   101,   100,    -1,   101,    -1,    32,    -1,    27,
650
      -1,    22,    27,    -1,    28,    -1,    34,    -1,    31,    -1,
651
      62,    97,    -1,    50,    -1,    91,    62,    97,    -1,    12,
652
      91,    62,    97,    -1,    69,    71,    -1,    69,     3,    71,
653
      -1,   102,    99,    -1,   102,    -1,    99,   102,    99,    -1,
654
      99,   102,    -1,    87,    99,    -1,    87,    -1,    99,    87,
655
      99,    -1,    99,    87,    -1,    12,    87,    99,    -1,    12,
656
      87,    -1,    99,    12,    87,    99,    -1,    99,    12,    87,
657
      -1,   103,    -1,   103,   106,    -1,   107,    -1,    74,   106,
658
      42,    -1,   107,    96,    -1,   107,   104,    -1,   104,    -1,
659
     103,    -1,   103,   108,    -1,   107,    -1,   107,    96,    12,
660
      78,    -1,    96,    79,    -1,   105,    -1,   105,   106,    -1,
661
     103,   110,    -1,   111,    -1,    74,   110,    42,    -1,   111,
662
      96,    -1,   111,   104,    -1,    88,    -1,   103,   112,    -1,
663
      88,    -1,   113,    -1,    88,    96,    12,    78,    -1,   113,
664
      96,    12,    78,    -1,    74,   103,   110,    42,    -1,   113,
665
      96,    -1,   113,   104,    -1,    88,    96,    -1,    88,   104,
666
      -1,    74,   115,    42,    -1,   114,    -1,   114,    54,   114,
667
      -1,    50,    78,    -1,    50,    74,    78,    42,    -1,    61,
668
     114,    -1,    73,   114,    -1,    72,   114,    -1,    74,   109,
669
      42,   114,    -1,    18,    53,   109,    54,    74,   115,    42,
670
      -1,    20,    53,   109,    54,    74,   115,    42,    -1,    19,
671
      53,   109,    54,    74,   115,    42,    -1,   114,    62,   114,
672
      -1,   114,    63,   114,    -1,   114,    64,   114,    -1,   114,
673
      60,   114,    -1,   114,    61,   114,    -1,   114,    58,   114,
674
      -1,   114,    57,   114,    -1,   114,    52,   114,    -1,   114,
675
      51,   114,    -1,   114,    56,   114,    -1,   114,    55,   114,
676
      -1,   114,    53,   114,    -1,   114,    50,   114,    -1,   114,
677
      49,   114,    -1,   114,    48,   114,    -1,   114,    47,   114,
678
      -1,   114,    46,   114,    -1,   114,    70,     5,    -1,   114,
679
      68,     5,    -1,   114,    45,   114,    75,   114,    -1,     3,
680
      -1,     4,    -1,    10,    74,   109,    42,    -1,    36,    -1,
681
      37,    -1
682
};
683
 
684
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
685
static const unsigned short yyrline[] =
686
{
687
       0,   366,   366,   370,   372,   374,   379,   380,   387,   396,
688
     399,   403,   406,   425,   429,   431,   437,   439,   441,   443,
689
     445,   447,   449,   451,   453,   455,   457,   459,   461,   463,
690
     465,   467,   469,   471,   473,   475,   477,   479,   481,   483,
691
     485,   487,   489,   491,   493,   495,   497,   499,   501,   509,
692
     514,   519,   523,   528,   536,   537,   539,   551,   552,   558,
693
     560,   561,   563,   566,   567,   570,   571,   575,   577,   580,
694
     586,   593,   599,   610,   614,   617,   628,   629,   633,   635,
695
     637,   640,   644,   649,   654,   660,   670,   674,   678,   686,
696
     687,   690,   692,   694,   698,   699,   706,   708,   710,   712,
697
     714,   716,   720,   721,   725,   727,   729,   731,   733,   735,
698
     737,   741,   747,   751,   759,   769,   773,   789,   791,   792,
699
     794,   797,   799,   800,   802,   805,   807,   809,   811,   816,
700
     819,   824,   831,   835,   846,   852,   870,   873,   881,   883,
701
     894,   901,   902,   908,   912,   916,   918,   923,   928,   941,
702
     945,   950,   958,   963,   972,   976,   981,   986,   990,   996,
703
    1002,  1005,  1012,  1014,  1019,  1023,  1027,  1034,  1050,  1057,
704
    1064,  1083,  1087,  1091,  1095,  1099,  1103,  1107,  1111,  1115,
705
    1119,  1123,  1127,  1131,  1135,  1139,  1143,  1147,  1152,  1156,
706
    1160,  1167,  1171,  1174,  1179,  1188
707
};
708
#endif
709
 
710
#if YYDEBUG || YYERROR_VERBOSE
711
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
712
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
713
static const char *const yytname[] =
714
{
715
  "$end", "error", "$undefined", "INT", "FLOAT", "NAME", "STRUCT",
716
  "CLASS", "UNION", "ENUM", "SIZEOF", "UNSIGNED", "COLONCOLON", "TEMPLATE",
717
  "ERROR", "NEW", "DELETE", "OPERATOR", "STATIC_CAST", "REINTERPRET_CAST",
718
  "DYNAMIC_CAST", "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD",
719
  "CONST_KEYWORD", "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "BOOL",
720
  "ELLIPSIS", "RESTRICT", "VOID", "FLOAT_KEYWORD", "CHAR", "WCHAR_T",
721
  "ASSIGN_MODIFY", "TRUEKEYWORD", "FALSEKEYWORD", "DEMANGLER_SPECIAL",
722
  "CONSTRUCTION_VTABLE", "CONSTRUCTION_IN", "GLOBAL", "')'", "','", "'='",
723
  "'?'", "OROR", "ANDAND", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'",
724
  "'>'", "GEQ", "LEQ", "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'",
725
  "'%'", "DECREMENT", "INCREMENT", "UNARY", "'.'", "'['", "ARROW", "']'",
726
  "'~'", "'!'", "'('", "':'", "$accept", "result", "start", "start_opt",
727
  "function", "demangler_special", "operator", "conversion_op",
728
  "conversion_op_name", "unqualified_name", "colon_name", "name",
729
  "colon_ext_name", "colon_ext_only", "ext_only_name", "nested_name",
730
  "template", "template_params", "template_arg", "function_args",
731
  "function_arglist", "qualifiers_opt", "qualifier", "qualifiers",
732
  "int_part", "int_seq", "builtin_type", "ptr_operator", "array_indicator",
733
  "typespec_2", "abstract_declarator", "direct_abstract_declarator",
734
  "abstract_declarator_fn", "type", "declarator", "direct_declarator",
735
  "declarator_1", "direct_declarator_1", "exp", "exp1", 0
736
};
737
#endif
738
 
739
# ifdef YYPRINT
740
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
741
   token YYLEX-NUM.  */
742
static const unsigned short yytoknum[] =
743
{
744
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
745
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
746
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
747
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
748
     295,   296,    41,    44,    61,    63,   297,   298,   124,    94,
749
      38,   299,   300,    60,    62,   301,   302,   303,   304,    64,
750
      43,    45,    42,    47,    37,   305,   306,   307,    46,    91,
751
     308,    93,   126,    33,    40,    58
752
};
753
# endif
754
 
755
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
756
static const unsigned char yyr1[] =
757
{
758
       0,    76,    77,    78,    78,    78,    79,    79,    80,    80,
759
      80,    80,    80,    81,    81,    81,    82,    82,    82,    82,
760
      82,    82,    82,    82,    82,    82,    82,    82,    82,    82,
761
      82,    82,    82,    82,    82,    82,    82,    82,    82,    82,
762
      82,    82,    82,    82,    82,    82,    82,    82,    82,    83,
763
      84,    84,    84,    84,    85,    85,    85,    86,    86,    87,
764
      87,    87,    87,    88,    88,    89,    89,    90,    90,    91,
765
      91,    91,    91,    92,    93,    93,    94,    94,    94,    94,
766
      94,    95,    95,    95,    95,    95,    96,    96,    96,    97,
767
      97,    98,    98,    98,    99,    99,   100,   100,   100,   100,
768
     100,   100,   101,   101,   102,   102,   102,   102,   102,   102,
769
     102,   103,   103,   103,   103,   104,   104,   105,   105,   105,
770
     105,   105,   105,   105,   105,   105,   105,   105,   105,   106,
771
     106,   106,   107,   107,   107,   107,   108,   108,   108,   108,
772
     108,   109,   109,   110,   110,   111,   111,   111,   111,   112,
773
     112,   112,   112,   112,   113,   113,   113,   113,   113,   114,
774
     115,   115,   115,   115,   114,   114,   114,   114,   114,   114,
775
     114,   114,   114,   114,   114,   114,   114,   114,   114,   114,
776
     114,   114,   114,   114,   114,   114,   114,   114,   114,   114,
777
     114,   114,   114,   114,   114,   114
778
};
779
 
780
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
781
static const unsigned char yyr2[] =
782
{
783
       0,     2,     1,     1,     1,     1,     0,     2,     2,     3,
784
       3,     2,     2,     2,     4,     1,     2,     2,     4,     4,
785
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
786
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
787
       2,     2,     2,     2,     2,     3,     2,     3,     3,     2,
788
       2,     1,     3,     2,     1,     4,     2,     1,     2,     2,
789
       1,     2,     1,     1,     1,     1,     2,     2,     1,     2,
790
       3,     2,     3,     4,     1,     3,     1,     2,     2,     4,
791
       1,     1,     2,     3,     4,     3,     4,     4,     3,     0,
792
       1,     1,     1,     1,     1,     2,     1,     1,     1,     1,
793
       1,     1,     1,     2,     1,     1,     1,     2,     1,     1,
794
       1,     2,     1,     3,     4,     2,     3,     2,     1,     3,
795
       2,     2,     1,     3,     2,     3,     2,     4,     3,     1,
796
       2,     1,     3,     2,     2,     1,     1,     2,     1,     4,
797
       2,     1,     2,     2,     1,     3,     2,     2,     1,     2,
798
       1,     1,     4,     4,     4,     2,     2,     2,     2,     3,
799
       1,     3,     2,     4,     2,     2,     2,     4,     7,     7,
800
       7,     3,     3,     3,     3,     3,     3,     3,     3,     3,
801
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
802
       5,     1,     1,     4,     1,     1
803
};
804
 
805
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
806
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
807
   means the default is an error.  */
808
static const unsigned char yydefact[] =
809
{
810
       0,    60,    98,     0,     0,    97,   100,   101,    96,    93,
811
      92,   106,   108,    91,   110,   105,    99,   109,     0,     0,
812
      15,     0,     0,     2,     5,     4,    54,    51,     6,    68,
813
     122,     0,    65,     0,    62,    94,     0,   102,   104,   118,
814
     141,     3,    69,     0,    53,   126,    66,     0,     0,    16,
815
      17,    33,    44,    30,    41,    40,    27,    25,    26,    37,
816
      36,    31,    32,    39,    38,    35,    34,    20,    21,    22,
817
      23,    24,    43,    42,     0,    46,    28,    29,     0,     0,
818
      49,   107,    13,     0,    56,     1,     0,     0,     0,   112,
819
      89,     0,     0,    11,     0,     0,     6,   136,   135,   138,
820
      12,   121,     0,     6,    59,    50,    67,    61,    71,    95,
821
       0,   124,   120,   100,   103,   117,     0,     0,     0,    63,
822
      57,   150,    64,     0,     6,   129,   142,   131,     8,   151,
823
     191,   192,     0,     0,     0,     0,   194,   195,     0,     0,
824
       0,     0,     0,     0,    74,    76,    80,   125,    52,     0,
825
       0,    48,    45,    47,     0,     0,     7,     0,   111,    90,
826
       0,   115,     0,   110,    89,     0,     0,     0,   129,    81,
827
       0,     0,    89,     0,     0,   140,     0,   137,   133,   134,
828
      10,    70,    72,   128,   123,   119,    58,     0,   129,   157,
829
     158,     9,     0,   130,   149,   133,   155,   156,     0,     0,
830
       0,     0,     0,    78,   164,   166,   165,     0,   141,     0,
831
     160,     0,     0,    73,    77,     0,     0,     0,     0,     0,
832
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
833
       0,     0,     0,     0,     0,    18,    19,    14,    55,    89,
834
     116,     0,    89,    88,    89,     0,    82,   132,   113,     0,
835
       0,   127,     0,   148,   129,     0,   144,     0,     0,     0,
836
       0,     0,     0,     0,     0,   162,     0,     0,   159,    75,
837
       0,   187,   186,   185,   184,   183,   179,   178,   182,   181,
838
     180,   177,   176,   174,   175,   171,   172,   173,   189,   188,
839
     114,    87,    86,    85,    83,   139,     0,   143,   154,   146,
840
     147,   152,   153,   193,     0,     0,     0,    79,     0,   167,
841
     161,     0,    84,   145,     0,     0,     0,   163,   190,     0,
842
       0,     0,   168,   170,   169
843
};
844
 
845
/* YYDEFGOTO[NTERM-NUM]. */
846
static const short yydefgoto[] =
847
{
848
      -1,    22,   156,    93,    24,    25,    26,    27,    28,    29,
849
     119,    30,   253,    31,    32,    79,    34,   143,   144,   167,
850
      96,   158,    35,    36,    37,    38,    39,   168,    98,    40,
851
     170,   127,   100,    41,   255,   256,   128,   129,   210,   211
852
};
853
 
854
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
855
   STATE-NUM.  */
856
#define YYPACT_NINF -263
857
static const short yypact[] =
858
{
859
     702,    22,  -263,    41,   499,  -263,   -14,  -263,  -263,  -263,
860
    -263,  -263,  -263,  -263,  -263,  -263,  -263,  -263,   702,   702,
861
    -263,    21,    30,  -263,  -263,  -263,     2,  -263,   228,  -263,
862
     111,   -11,  -263,    54,    57,   111,   661,  -263,   435,   111,
863
     628,  -263,  -263,   342,  -263,   111,  -263,    54,    67,    35,
864
      42,  -263,  -263,  -263,  -263,  -263,  -263,  -263,  -263,  -263,
865
    -263,  -263,  -263,  -263,  -263,  -263,  -263,  -263,  -263,  -263,
866
    -263,  -263,  -263,  -263,     6,    32,  -263,  -263,    72,    94,
867
    -263,  -263,  -263,    83,  -263,  -263,   342,    22,   702,  -263,
868
     111,     8,   466,  -263,    27,    57,   120,   230,  -263,   -53,
869
    -263,  -263,   726,   120,    49,  -263,  -263,   130,  -263,  -263,
870
      67,   111,   111,  -263,  -263,  -263,    59,   729,   466,  -263,
871
    -263,   -53,  -263,    19,   120,   629,  -263,   -53,  -263,   -53,
872
    -263,  -263,    70,    95,    96,    99,  -263,  -263,   565,    47,
873
      47,    47,   401,    85,  -263,   260,   865,  -263,  -263,    82,
874
      84,  -263,  -263,  -263,   702,    86,  -263,    28,  -263,  -263,
875
      88,  -263,    67,   114,   111,   260,    36,   104,   260,   260,
876
     115,    49,   111,   130,   702,  -263,   167,  -263,   161,  -263,
877
    -263,  -263,  -263,   111,  -263,  -263,  -263,   105,   637,   168,
878
    -263,  -263,   260,  -263,  -263,  -263,   169,  -263,   849,   849,
879
     849,   849,   702,  -263,    -8,    -8,    -8,   597,   260,   140,
880
     839,   142,   342,  -263,  -263,    47,    47,    47,    47,    47,
881
      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
882
      47,    47,    47,   180,   188,  -263,  -263,  -263,  -263,   111,
883
    -263,    43,   111,  -263,   111,   819,  -263,  -263,  -263,    44,
884
     702,  -263,   637,  -263,   637,   152,   -53,   702,   702,   154,
885
     144,   145,   146,   162,   702,  -263,    47,    47,  -263,  -263,
886
     759,   889,   912,   934,   600,   954,   970,   970,   984,   984,
887
     984,   795,   795,   268,   268,    -8,    -8,    -8,  -263,  -263,
888
    -263,  -263,  -263,  -263,   260,  -263,   163,  -263,  -263,  -263,
889
    -263,  -263,  -263,  -263,   129,   157,   171,  -263,   195,    -8,
890
     865,    47,  -263,  -263,   445,   445,   445,  -263,   865,   201,
891
     206,   207,  -263,  -263,  -263
892
};
893
 
894
/* YYPGOTO[NTERM-NUM].  */
895
static const short yypgoto[] =
896
{
897
    -263,  -263,    25,   -86,  -263,  -263,  -263,     9,  -263,   -27,
898
    -263,    -1,   -32,   -13,     1,     0,   150,   170,    50,  -263,
899
     -26,  -157,  -263,   156,   221,  -263,   227,    46,   -98,   185,
900
     -18,   -19,   172,   113,  -184,  -263,   141,  -263,    -6,  -262
901
};
902
 
903
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
904
   positive, shift that token.  If negative, reduce the rule which
905
   number is the opposite.  If zero, do what YYDEFACT says.
906
   If YYTABLE_NINF, syntax error.  */
907
#define YYTABLE_NINF -1
908
static const unsigned short yytable[] =
909
{
910
      33,   179,    45,    47,    46,   103,   106,   243,   121,    99,
911
     175,   160,    44,    81,   124,   248,    91,   180,    33,    33,
912
     106,   102,   126,   190,   104,    23,    84,   122,    94,   179,
913
      85,   197,   171,   104,    42,   111,   117,   146,   191,   120,
914
     123,   104,   105,    82,    83,     4,     1,    45,   104,   171,
915
     130,   131,   319,   320,   321,    86,   148,   132,     4,   104,
916
     233,   181,   234,   102,     1,   133,   134,   135,   296,   108,
917
     297,     4,     1,   178,    97,    43,   117,   151,    99,   161,
918
     146,   172,   290,   136,   137,   291,   125,   292,   157,   172,
919
     239,    21,   166,   121,   152,   189,   106,    94,   172,   104,
920
      21,   195,    43,   196,   149,   239,   239,   193,   139,   183,
921
     104,   150,   122,    21,   153,   186,   187,    46,   166,   140,
922
     141,   142,   117,   154,   120,   123,    21,   214,   212,   212,
923
     106,    21,   174,   204,   205,   206,     9,    10,    33,   213,
924
     238,    13,   182,    97,   198,    94,   244,   245,   199,   200,
925
     193,   246,   201,   235,    33,   236,   242,   247,   300,   240,
926
     106,    45,   241,   203,   188,    94,   105,   239,    94,    94,
927
     193,   125,    87,   250,    33,   122,   249,    21,    95,   237,
928
     257,   258,   266,   107,   268,   288,   101,   120,   123,    80,
929
     126,   109,    94,   289,   298,   115,   303,   107,   304,   305,
930
     306,   147,    33,   314,   307,   313,   146,    33,    94,   270,
931
     271,   272,   273,   274,   275,   276,   277,   278,   279,   280,
932
     281,   282,   283,   284,   285,   286,   287,   263,   145,   107,
933
     299,   315,   265,    87,   254,    87,   193,   317,   188,   122,
934
      88,   122,   176,   322,   173,   316,   159,    95,   323,   324,
935
      33,   120,   123,   120,   123,   209,   155,    33,    33,   114,
936
     309,   310,   269,   112,    33,    87,   194,   184,   185,   177,
937
       0,   145,   176,   107,     0,   295,   312,   169,    89,     0,
938
      89,     0,   301,   302,     0,     0,     0,   169,     0,   308,
939
      90,     0,    90,     0,    94,    95,     0,    91,   254,    91,
940
     254,     0,    92,   169,    92,   318,     0,   107,     0,     0,
941
      89,   259,   260,   261,   262,    95,   107,     0,    95,    95,
942
     159,     0,    90,     0,     0,     0,    95,   208,   159,    91,
943
     230,   231,   232,     0,   165,     0,   233,   107,   234,   251,
944
       0,     0,    95,     0,     0,   130,   131,     1,     0,     0,
945
       0,     0,   132,     2,    48,     0,     0,     0,    95,     0,
946
     133,   134,   135,     5,     6,     7,     8,     9,    10,    11,
947
      12,     0,    13,    14,    15,    16,    17,     0,   136,   137,
948
       0,     0,     0,   208,   208,   208,   208,     0,     0,     0,
949
       0,   107,   138,     0,     0,   159,     0,   145,   159,   173,
950
     159,     0,     0,   139,   130,   131,     1,     0,     0,     0,
951
       0,   132,     2,    48,   140,   141,   142,     0,     0,   133,
952
     134,   135,     5,     6,     7,     8,     9,    10,    11,    12,
953
     294,    13,    14,    15,    16,    17,     0,   136,   137,     0,
954
       0,     0,     0,     0,    95,     0,     2,     0,   130,   131,
955
       0,   207,     0,     0,     0,   132,     5,   113,     7,     8,
956
       0,     0,   139,   133,   134,   135,     0,     0,    16,     0,
957
       0,     1,     0,   140,   141,   142,     0,     2,   162,     0,
958
       0,   136,   137,     0,     0,     0,     0,     5,     6,     7,
959
       8,     9,    10,    11,    12,   207,    13,   163,    15,    16,
960
      17,     0,     0,     0,     1,     0,   139,     0,   164,     0,
961
       2,    48,     0,     0,    49,    50,    89,   140,   141,   142,
962
       5,     6,     7,     8,     9,    10,    11,    12,    90,    13,
963
      14,    15,    16,    17,    51,    91,     0,     0,     0,     0,
964
     165,     0,    52,    53,     0,    54,    55,    56,    57,    58,
965
      59,    60,    61,    62,    63,    64,    65,    66,     0,    67,
966
      68,    69,    70,    71,    72,    73,     0,     0,    74,    75,
967
       1,    76,    77,    78,     0,     0,     2,     3,     0,     0,
968
       0,     0,     4,     0,     0,     0,     5,     6,     7,     8,
969
       9,    10,    11,    12,     0,    13,    14,    15,    16,    17,
970
       0,     0,     1,    18,    19,     0,    20,     0,     2,     3,
971
       0,     0,     0,     0,     4,     0,     0,     0,     5,     6,
972
       7,     8,     9,    10,    11,    12,     0,    13,    14,    15,
973
      16,    17,     0,     1,     1,    18,    19,    21,    20,   202,
974
     116,   116,     1,     0,     0,   117,   117,     0,     0,   116,
975
     220,   221,   222,   223,   117,   224,   225,   226,   227,     0,
976
     228,   229,   230,   231,   232,     0,     1,     0,   233,    21,
977
     234,   264,     2,   110,     0,     0,     0,     0,    89,    89,
978
       0,     0,     5,     6,     7,     8,     0,    89,    11,    12,
979
      90,    90,    14,    15,    16,    17,     0,    91,    91,    90,
980
      21,    21,   118,   192,     0,     0,    91,     1,     0,    21,
981
       0,   252,     0,     2,     3,     0,     0,     0,     0,     4,
982
       0,     0,     0,     5,     6,     7,     8,     9,    10,    11,
983
      12,     1,    13,    14,    15,    16,    17,     2,    48,     0,
984
      18,    19,     0,    20,    49,    50,     0,     5,     6,     7,
985
       8,     9,    10,    11,    12,     0,    13,   163,    15,    16,
986
      17,     0,     0,     0,    51,     0,     0,     0,   164,     0,
987
       0,     0,    52,    53,    21,    54,    55,    56,    57,    58,
988
      59,    60,    61,    62,    63,    64,    65,    66,     0,    67,
989
      68,    69,    70,    71,    72,    73,     0,     0,    74,    75,
990
       0,    76,    77,    78,   215,   216,   217,   218,   219,   220,
991
     221,   222,   223,     0,   224,   225,   226,   227,     0,   228,
992
     229,   230,   231,   232,     1,     0,     0,   233,     0,   234,
993
       2,    48,     0,     0,   311,     0,     0,     0,     0,     0,
994
       5,     6,     7,     8,     9,    10,    11,    12,   293,    13,
995
      14,    15,    16,    17,     1,   228,   229,   230,   231,   232,
996
       2,    48,     0,   233,     0,   234,     0,     0,     0,     0,
997
       5,     6,     7,     8,     9,    10,    11,    12,     0,    13,
998
      14,    15,    16,    17,   215,   216,   217,   218,   219,   220,
999
     221,   222,   223,   267,   224,   225,   226,   227,     0,   228,
1000
     229,   230,   231,   232,     0,     0,     0,   233,     0,   234,
1001
     215,   216,   217,   218,   219,   220,   221,   222,   223,     0,
1002
     224,   225,   226,   227,     0,   228,   229,   230,   231,   232,
1003
       0,     0,     0,   233,     0,   234,   217,   218,   219,   220,
1004
     221,   222,   223,     0,   224,   225,   226,   227,     0,   228,
1005
     229,   230,   231,   232,     0,     0,     0,   233,     0,   234,
1006
     218,   219,   220,   221,   222,   223,     0,   224,   225,   226,
1007
     227,     0,   228,   229,   230,   231,   232,     0,     0,     0,
1008
     233,     0,   234,   219,   220,   221,   222,   223,     0,   224,
1009
     225,   226,   227,     0,   228,   229,   230,   231,   232,     0,
1010
       0,     0,   233,     0,   234,   221,   222,   223,     0,   224,
1011
     225,   226,   227,     0,   228,   229,   230,   231,   232,     0,
1012
       0,     0,   233,   223,   234,   224,   225,   226,   227,     0,
1013
     228,   229,   230,   231,   232,     0,     0,     0,   233,     0,
1014
     234,   226,   227,     0,   228,   229,   230,   231,   232,     0,
1015
       0,     0,   233,     0,   234
1016
};
1017
 
1018
static const short yycheck[] =
1019
{
1020
       0,    99,     3,     3,     3,    31,    33,   164,    40,    28,
1021
      96,     3,     3,    27,    40,   172,    69,   103,    18,    19,
1022
      47,    74,    40,   121,     5,     0,     5,    40,    28,   127,
1023
       0,   129,     5,     5,    12,    36,    17,    43,   124,    40,
1024
      40,     5,    33,    18,    19,    17,     5,    48,     5,     5,
1025
       3,     4,   314,   315,   316,    53,    47,    10,    17,     5,
1026
      68,    12,    70,    74,     5,    18,    19,    20,   252,    12,
1027
     254,    17,     5,    99,    28,    53,    17,    71,    97,    71,
1028
      86,    62,   239,    36,    37,   242,    40,   244,    88,    62,
1029
      62,    72,    92,   125,    62,   121,   123,    97,    62,     5,
1030
      72,   127,    53,   129,    69,    62,    62,   125,    61,   110,
1031
       5,    69,   125,    72,    42,   116,   116,   116,   118,    72,
1032
      73,    74,    17,    40,   125,   125,    72,   145,    43,    43,
1033
     157,    72,    12,   139,   140,   141,    25,    26,   138,    54,
1034
      54,    30,    12,    97,    74,   145,    42,    43,    53,    53,
1035
     168,   169,    53,    71,   154,    71,    42,    42,   256,    71,
1036
     187,   162,   162,   138,   118,   165,   157,    62,   168,   169,
1037
     188,   125,     5,    12,   174,   188,   176,    72,    28,   154,
1038
      12,    12,    42,    33,    42,     5,    30,   188,   188,     4,
1039
     208,    35,   192,     5,    42,    39,    42,    47,    54,    54,
1040
      54,    45,   202,    74,    42,    42,   212,   207,   208,   215,
1041
     216,   217,   218,   219,   220,   221,   222,   223,   224,   225,
1042
     226,   227,   228,   229,   230,   231,   232,   202,    43,    79,
1043
     256,    74,   207,     5,   188,     5,   254,    42,   192,   252,
1044
      12,   254,    12,    42,    94,    74,    90,    97,    42,    42,
1045
     250,   252,   252,   254,   254,   142,    86,   257,   258,    38,
1046
     266,   267,   212,    36,   264,     5,   125,   111,   112,    97,
1047
      -1,    86,    12,   123,    -1,   250,   294,    92,    50,    -1,
1048
      50,    -1,   257,   258,    -1,    -1,    -1,   102,    -1,   264,
1049
      62,    -1,    62,    -1,   294,   145,    -1,    69,   252,    69,
1050
     254,    -1,    74,   118,    74,   311,    -1,   157,    -1,    -1,
1051
      50,   198,   199,   200,   201,   165,   166,    -1,   168,   169,
1052
     164,    -1,    62,    -1,    -1,    -1,   176,   142,   172,    69,
1053
      62,    63,    64,    -1,    74,    -1,    68,   187,    70,   183,
1054
      -1,    -1,   192,    -1,    -1,     3,     4,     5,    -1,    -1,
1055
      -1,    -1,    10,    11,    12,    -1,    -1,    -1,   208,    -1,
1056
      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
1057
      28,    -1,    30,    31,    32,    33,    34,    -1,    36,    37,
1058
      -1,    -1,    -1,   198,   199,   200,   201,    -1,    -1,    -1,
1059
      -1,   241,    50,    -1,    -1,   239,    -1,   212,   242,   249,
1060
     244,    -1,    -1,    61,     3,     4,     5,    -1,    -1,    -1,
1061
      -1,    10,    11,    12,    72,    73,    74,    -1,    -1,    18,
1062
      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
1063
     245,    30,    31,    32,    33,    34,    -1,    36,    37,    -1,
1064
      -1,    -1,    -1,    -1,   294,    -1,    11,    -1,     3,     4,
1065
      -1,    50,    -1,    -1,    -1,    10,    21,    22,    23,    24,
1066
      -1,    -1,    61,    18,    19,    20,    -1,    -1,    33,    -1,
1067
      -1,     5,    -1,    72,    73,    74,    -1,    11,    12,    -1,
1068
      -1,    36,    37,    -1,    -1,    -1,    -1,    21,    22,    23,
1069
      24,    25,    26,    27,    28,    50,    30,    31,    32,    33,
1070
      34,    -1,    -1,    -1,     5,    -1,    61,    -1,    42,    -1,
1071
      11,    12,    -1,    -1,    15,    16,    50,    72,    73,    74,
1072
      21,    22,    23,    24,    25,    26,    27,    28,    62,    30,
1073
      31,    32,    33,    34,    35,    69,    -1,    -1,    -1,    -1,
1074
      74,    -1,    43,    44,    -1,    46,    47,    48,    49,    50,
1075
      51,    52,    53,    54,    55,    56,    57,    58,    -1,    60,
1076
      61,    62,    63,    64,    65,    66,    -1,    -1,    69,    70,
1077
       5,    72,    73,    74,    -1,    -1,    11,    12,    -1,    -1,
1078
      -1,    -1,    17,    -1,    -1,    -1,    21,    22,    23,    24,
1079
      25,    26,    27,    28,    -1,    30,    31,    32,    33,    34,
1080
      -1,    -1,     5,    38,    39,    -1,    41,    -1,    11,    12,
1081
      -1,    -1,    -1,    -1,    17,    -1,    -1,    -1,    21,    22,
1082
      23,    24,    25,    26,    27,    28,    -1,    30,    31,    32,
1083
      33,    34,    -1,     5,     5,    38,    39,    72,    41,    74,
1084
      12,    12,     5,    -1,    -1,    17,    17,    -1,    -1,    12,
1085
      50,    51,    52,    53,    17,    55,    56,    57,    58,    -1,
1086
      60,    61,    62,    63,    64,    -1,     5,    -1,    68,    72,
1087
      70,    74,    11,    12,    -1,    -1,    -1,    -1,    50,    50,
1088
      -1,    -1,    21,    22,    23,    24,    -1,    50,    27,    28,
1089
      62,    62,    31,    32,    33,    34,    -1,    69,    69,    62,
1090
      72,    72,    74,    74,    -1,    -1,    69,     5,    -1,    72,
1091
      -1,    74,    -1,    11,    12,    -1,    -1,    -1,    -1,    17,
1092
      -1,    -1,    -1,    21,    22,    23,    24,    25,    26,    27,
1093
      28,     5,    30,    31,    32,    33,    34,    11,    12,    -1,
1094
      38,    39,    -1,    41,    15,    16,    -1,    21,    22,    23,
1095
      24,    25,    26,    27,    28,    -1,    30,    31,    32,    33,
1096
      34,    -1,    -1,    -1,    35,    -1,    -1,    -1,    42,    -1,
1097
      -1,    -1,    43,    44,    72,    46,    47,    48,    49,    50,
1098
      51,    52,    53,    54,    55,    56,    57,    58,    -1,    60,
1099
      61,    62,    63,    64,    65,    66,    -1,    -1,    69,    70,
1100
      -1,    72,    73,    74,    45,    46,    47,    48,    49,    50,
1101
      51,    52,    53,    -1,    55,    56,    57,    58,    -1,    60,
1102
      61,    62,    63,    64,     5,    -1,    -1,    68,    -1,    70,
1103
      11,    12,    -1,    -1,    75,    -1,    -1,    -1,    -1,    -1,
1104
      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
1105
      31,    32,    33,    34,     5,    60,    61,    62,    63,    64,
1106
      11,    12,    -1,    68,    -1,    70,    -1,    -1,    -1,    -1,
1107
      21,    22,    23,    24,    25,    26,    27,    28,    -1,    30,
1108
      31,    32,    33,    34,    45,    46,    47,    48,    49,    50,
1109
      51,    52,    53,    54,    55,    56,    57,    58,    -1,    60,
1110
      61,    62,    63,    64,    -1,    -1,    -1,    68,    -1,    70,
1111
      45,    46,    47,    48,    49,    50,    51,    52,    53,    -1,
1112
      55,    56,    57,    58,    -1,    60,    61,    62,    63,    64,
1113
      -1,    -1,    -1,    68,    -1,    70,    47,    48,    49,    50,
1114
      51,    52,    53,    -1,    55,    56,    57,    58,    -1,    60,
1115
      61,    62,    63,    64,    -1,    -1,    -1,    68,    -1,    70,
1116
      48,    49,    50,    51,    52,    53,    -1,    55,    56,    57,
1117
      58,    -1,    60,    61,    62,    63,    64,    -1,    -1,    -1,
1118
      68,    -1,    70,    49,    50,    51,    52,    53,    -1,    55,
1119
      56,    57,    58,    -1,    60,    61,    62,    63,    64,    -1,
1120
      -1,    -1,    68,    -1,    70,    51,    52,    53,    -1,    55,
1121
      56,    57,    58,    -1,    60,    61,    62,    63,    64,    -1,
1122
      -1,    -1,    68,    53,    70,    55,    56,    57,    58,    -1,
1123
      60,    61,    62,    63,    64,    -1,    -1,    -1,    68,    -1,
1124
      70,    57,    58,    -1,    60,    61,    62,    63,    64,    -1,
1125
      -1,    -1,    68,    -1,    70
1126
};
1127
 
1128
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1129
   symbol of state STATE-NUM.  */
1130
static const unsigned char yystos[] =
1131
{
1132
       0,     5,    11,    12,    17,    21,    22,    23,    24,    25,
1133
      26,    27,    28,    30,    31,    32,    33,    34,    38,    39,
1134
      41,    72,    77,    78,    80,    81,    82,    83,    84,    85,
1135
      87,    89,    90,    91,    92,    98,    99,   100,   101,   102,
1136
     105,   109,    12,    53,    83,    87,    90,    91,    12,    15,
1137
      16,    35,    43,    44,    46,    47,    48,    49,    50,    51,
1138
      52,    53,    54,    55,    56,    57,    58,    60,    61,    62,
1139
      63,    64,    65,    66,    69,    70,    72,    73,    74,    91,
1140
     105,    27,    78,    78,     5,     0,    53,     5,    12,    50,
1141
      62,    69,    74,    79,    91,    92,    96,   103,   104,   107,
1142
     108,    99,    74,    96,     5,    83,    85,    92,    12,    99,
1143
      12,    87,   102,    22,   100,    99,    12,    17,    74,    86,
1144
      87,    88,    89,    91,    96,   103,   106,   107,   112,   113,
1145
       3,     4,    10,    18,    19,    20,    36,    37,    50,    61,
1146
      72,    73,    74,    93,    94,   105,   114,    99,    83,    69,
1147
      69,    71,    62,    42,    40,    93,    78,    91,    97,    99,
1148
       3,    71,    12,    31,    42,    74,    91,    95,   103,   105,
1149
     106,     5,    62,    92,    12,    79,    12,   108,    96,   104,
1150
      79,    12,    12,    87,    99,    99,    87,    91,   103,    96,
1151
     104,    79,    74,   106,   112,    96,    96,   104,    74,    53,
1152
      53,    53,    74,    78,   114,   114,   114,    50,   105,   109,
1153
     114,   115,    43,    54,   106,    45,    46,    47,    48,    49,
1154
      50,    51,    52,    53,    55,    56,    57,    58,    60,    61,
1155
      62,    63,    64,    68,    70,    71,    71,    78,    54,    62,
1156
      71,    91,    42,    97,    42,    43,   106,    42,    97,    91,
1157
      12,    99,    74,    88,   103,   110,   111,    12,    12,   109,
1158
     109,   109,   109,    78,    74,    78,    42,    54,    42,    94,
1159
     114,   114,   114,   114,   114,   114,   114,   114,   114,   114,
1160
     114,   114,   114,   114,   114,   114,   114,   114,     5,     5,
1161
      97,    97,    97,    29,   105,    78,   110,   110,    42,    96,
1162
     104,    78,    78,    42,    54,    54,    54,    42,    78,   114,
1163
     114,    75,   106,    42,    74,    74,    74,    42,   114,   115,
1164
     115,   115,    42,    42,    42
1165
};
1166
 
1167
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1168
# define YYSIZE_T __SIZE_TYPE__
1169
#endif
1170
#if ! defined (YYSIZE_T) && defined (size_t)
1171
# define YYSIZE_T size_t
1172
#endif
1173
#if ! defined (YYSIZE_T)
1174
# if defined (__STDC__) || defined (__cplusplus)
1175
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1176
#  define YYSIZE_T size_t
1177
# endif
1178
#endif
1179
#if ! defined (YYSIZE_T)
1180
# define YYSIZE_T unsigned int
1181
#endif
1182
 
1183
#define yyerrok         (yyerrstatus = 0)
1184
#define yyclearin       (yychar = YYEMPTY)
1185
#define YYEMPTY         (-2)
1186
#define YYEOF           0
1187
 
1188
#define YYACCEPT        goto yyacceptlab
1189
#define YYABORT         goto yyabortlab
1190
#define YYERROR         goto yyerrorlab
1191
 
1192
 
1193
/* Like YYERROR except do call yyerror.  This remains here temporarily
1194
   to ease the transition to the new meaning of YYERROR, for GCC.
1195
   Once GCC version 2 has supplanted version 1, this can go.  */
1196
 
1197
#define YYFAIL          goto yyerrlab
1198
 
1199
#define YYRECOVERING()  (!!yyerrstatus)
1200
 
1201
#define YYBACKUP(Token, Value)                                  \
1202
do                                                              \
1203
  if (yychar == YYEMPTY && yylen == 1)                          \
1204
    {                                                           \
1205
      yychar = (Token);                                         \
1206
      yylval = (Value);                                         \
1207
      yytoken = YYTRANSLATE (yychar);                           \
1208
      YYPOPSTACK;                                               \
1209
      goto yybackup;                                            \
1210
    }                                                           \
1211
  else                                                          \
1212
    {                                                           \
1213
      yyerror ("syntax error: cannot back up");\
1214
      YYERROR;                                                  \
1215
    }                                                           \
1216
while (0)
1217
 
1218
#define YYTERROR        1
1219
#define YYERRCODE       256
1220
 
1221
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
1222
   are run).  */
1223
 
1224
#ifndef YYLLOC_DEFAULT
1225
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
1226
   ((Current).first_line   = (Rhs)[1].first_line,       \
1227
    (Current).first_column = (Rhs)[1].first_column,     \
1228
    (Current).last_line    = (Rhs)[N].last_line,        \
1229
    (Current).last_column  = (Rhs)[N].last_column)
1230
#endif
1231
 
1232
/* YYLEX -- calling `yylex' with the right arguments.  */
1233
 
1234
#ifdef YYLEX_PARAM
1235
# define YYLEX yylex (YYLEX_PARAM)
1236
#else
1237
# define YYLEX yylex ()
1238
#endif
1239
 
1240
/* Enable debugging if requested.  */
1241
#if YYDEBUG
1242
 
1243
# ifndef YYFPRINTF
1244
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1245
#  define YYFPRINTF fprintf
1246
# endif
1247
 
1248
# define YYDPRINTF(Args)                        \
1249
do {                                            \
1250
  if (yydebug)                                  \
1251
    YYFPRINTF Args;                             \
1252
} while (0)
1253
 
1254
# define YYDSYMPRINT(Args)                      \
1255
do {                                            \
1256
  if (yydebug)                                  \
1257
    yysymprint Args;                            \
1258
} while (0)
1259
 
1260
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
1261
do {                                                            \
1262
  if (yydebug)                                                  \
1263
    {                                                           \
1264
      YYFPRINTF (stderr, "%s ", Title);                         \
1265
      yysymprint (stderr,                                       \
1266
                  Token, Value);        \
1267
      YYFPRINTF (stderr, "\n");                                 \
1268
    }                                                           \
1269
} while (0)
1270
 
1271
/*------------------------------------------------------------------.
1272
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1273
| TOP (included).                                                   |
1274
`------------------------------------------------------------------*/
1275
 
1276
#if defined (__STDC__) || defined (__cplusplus)
1277
static void
1278
yy_stack_print (short *bottom, short *top)
1279
#else
1280
static void
1281
yy_stack_print (bottom, top)
1282
    short *bottom;
1283
    short *top;
1284
#endif
1285
{
1286
  YYFPRINTF (stderr, "Stack now");
1287
  for (/* Nothing. */; bottom <= top; ++bottom)
1288
    YYFPRINTF (stderr, " %d", *bottom);
1289
  YYFPRINTF (stderr, "\n");
1290
}
1291
 
1292
# define YY_STACK_PRINT(Bottom, Top)                            \
1293
do {                                                            \
1294
  if (yydebug)                                                  \
1295
    yy_stack_print ((Bottom), (Top));                           \
1296
} while (0)
1297
 
1298
 
1299
/*------------------------------------------------.
1300
| Report that the YYRULE is going to be reduced.  |
1301
`------------------------------------------------*/
1302
 
1303
#if defined (__STDC__) || defined (__cplusplus)
1304
static void
1305
yy_reduce_print (int yyrule)
1306
#else
1307
static void
1308
yy_reduce_print (yyrule)
1309
    int yyrule;
1310
#endif
1311
{
1312
  int yyi;
1313
  unsigned int yylno = yyrline[yyrule];
1314
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1315
             yyrule - 1, yylno);
1316
  /* Print the symbols being reduced, and their result.  */
1317
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1318
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1319
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1320
}
1321
 
1322
# define YY_REDUCE_PRINT(Rule)          \
1323
do {                                    \
1324
  if (yydebug)                          \
1325
    yy_reduce_print (Rule);             \
1326
} while (0)
1327
 
1328
/* Nonzero means print parse trace.  It is left uninitialized so that
1329
   multiple parsers can coexist.  */
1330
int yydebug;
1331
#else /* !YYDEBUG */
1332
# define YYDPRINTF(Args)
1333
# define YYDSYMPRINT(Args)
1334
# define YYDSYMPRINTF(Title, Token, Value, Location)
1335
# define YY_STACK_PRINT(Bottom, Top)
1336
# define YY_REDUCE_PRINT(Rule)
1337
#endif /* !YYDEBUG */
1338
 
1339
 
1340
/* YYINITDEPTH -- initial size of the parser's stacks.  */
1341
#ifndef YYINITDEPTH
1342
# define YYINITDEPTH 200
1343
#endif
1344
 
1345
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1346
   if the built-in stack extension method is used).
1347
 
1348
   Do not make this value too large; the results are undefined if
1349
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1350
   evaluated with infinite-precision integer arithmetic.  */
1351
 
1352
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1353
# undef YYMAXDEPTH
1354
#endif
1355
 
1356
#ifndef YYMAXDEPTH
1357
# define YYMAXDEPTH 10000
1358
#endif
1359
 
1360
 
1361
 
1362
#if YYERROR_VERBOSE
1363
 
1364
# ifndef yystrlen
1365
#  if defined (__GLIBC__) && defined (_STRING_H)
1366
#   define yystrlen strlen
1367
#  else
1368
/* Return the length of YYSTR.  */
1369
static YYSIZE_T
1370
#   if defined (__STDC__) || defined (__cplusplus)
1371
yystrlen (const char *yystr)
1372
#   else
1373
yystrlen (yystr)
1374
     const char *yystr;
1375
#   endif
1376
{
1377
  register const char *yys = yystr;
1378
 
1379
  while (*yys++ != '\0')
1380
    continue;
1381
 
1382
  return yys - yystr - 1;
1383
}
1384
#  endif
1385
# endif
1386
 
1387
# ifndef yystpcpy
1388
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1389
#   define yystpcpy stpcpy
1390
#  else
1391
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1392
   YYDEST.  */
1393
static char *
1394
#   if defined (__STDC__) || defined (__cplusplus)
1395
yystpcpy (char *yydest, const char *yysrc)
1396
#   else
1397
yystpcpy (yydest, yysrc)
1398
     char *yydest;
1399
     const char *yysrc;
1400
#   endif
1401
{
1402
  register char *yyd = yydest;
1403
  register const char *yys = yysrc;
1404
 
1405
  while ((*yyd++ = *yys++) != '\0')
1406
    continue;
1407
 
1408
  return yyd - 1;
1409
}
1410
#  endif
1411
# endif
1412
 
1413
#endif /* !YYERROR_VERBOSE */
1414
 
1415
 
1416
 
1417
#if YYDEBUG
1418
/*--------------------------------.
1419
| Print this symbol on YYOUTPUT.  |
1420
`--------------------------------*/
1421
 
1422
#if defined (__STDC__) || defined (__cplusplus)
1423
static void
1424
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1425
#else
1426
static void
1427
yysymprint (yyoutput, yytype, yyvaluep)
1428
    FILE *yyoutput;
1429
    int yytype;
1430
    YYSTYPE *yyvaluep;
1431
#endif
1432
{
1433
  /* Pacify ``unused variable'' warnings.  */
1434
  (void) yyvaluep;
1435
 
1436
  if (yytype < YYNTOKENS)
1437
    {
1438
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1439
# ifdef YYPRINT
1440
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1441
# endif
1442
    }
1443
  else
1444
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1445
 
1446
  switch (yytype)
1447
    {
1448
      default:
1449
        break;
1450
    }
1451
  YYFPRINTF (yyoutput, ")");
1452
}
1453
 
1454
#endif /* ! YYDEBUG */
1455
/*-----------------------------------------------.
1456
| Release the memory associated to this symbol.  |
1457
`-----------------------------------------------*/
1458
 
1459
#if defined (__STDC__) || defined (__cplusplus)
1460
static void
1461
yydestruct (int yytype, YYSTYPE *yyvaluep)
1462
#else
1463
static void
1464
yydestruct (yytype, yyvaluep)
1465
    int yytype;
1466
    YYSTYPE *yyvaluep;
1467
#endif
1468
{
1469
  /* Pacify ``unused variable'' warnings.  */
1470
  (void) yyvaluep;
1471
 
1472
  switch (yytype)
1473
    {
1474
 
1475
      default:
1476
        break;
1477
    }
1478
}
1479
 
1480
 
1481
/* Prevent warnings from -Wmissing-prototypes.  */
1482
 
1483
#ifdef YYPARSE_PARAM
1484
# if defined (__STDC__) || defined (__cplusplus)
1485
int yyparse (void *YYPARSE_PARAM);
1486
# else
1487
int yyparse ();
1488
# endif
1489
#else /* ! YYPARSE_PARAM */
1490
#if defined (__STDC__) || defined (__cplusplus)
1491
int yyparse (void);
1492
#else
1493
int yyparse ();
1494
#endif
1495
#endif /* ! YYPARSE_PARAM */
1496
 
1497
 
1498
 
1499
/* The lookahead symbol.  */
1500
int yychar;
1501
 
1502
/* The semantic value of the lookahead symbol.  */
1503
YYSTYPE yylval;
1504
 
1505
/* Number of syntax errors so far.  */
1506
int yynerrs;
1507
 
1508
 
1509
 
1510
/*----------.
1511
| yyparse.  |
1512
`----------*/
1513
 
1514
#ifdef YYPARSE_PARAM
1515
# if defined (__STDC__) || defined (__cplusplus)
1516
int yyparse (void *YYPARSE_PARAM)
1517
# else
1518
int yyparse (YYPARSE_PARAM)
1519
  void *YYPARSE_PARAM;
1520
# endif
1521
#else /* ! YYPARSE_PARAM */
1522
#if defined (__STDC__) || defined (__cplusplus)
1523
int
1524
yyparse (void)
1525
#else
1526
int
1527
yyparse ()
1528
 
1529
#endif
1530
#endif
1531
{
1532
 
1533
  register int yystate;
1534
  register int yyn;
1535
  int yyresult;
1536
  /* Number of tokens to shift before error messages enabled.  */
1537
  int yyerrstatus;
1538
  /* Lookahead token as an internal (translated) token number.  */
1539
  int yytoken = 0;
1540
 
1541
  /* Three stacks and their tools:
1542
     `yyss': related to states,
1543
     `yyvs': related to semantic values,
1544
     `yyls': related to locations.
1545
 
1546
     Refer to the stacks thru separate pointers, to allow yyoverflow
1547
     to xreallocate them elsewhere.  */
1548
 
1549
  /* The state stack.  */
1550
  short yyssa[YYINITDEPTH];
1551
  short *yyss = yyssa;
1552
  register short *yyssp;
1553
 
1554
  /* The semantic value stack.  */
1555
  YYSTYPE yyvsa[YYINITDEPTH];
1556
  YYSTYPE *yyvs = yyvsa;
1557
  register YYSTYPE *yyvsp;
1558
 
1559
 
1560
 
1561
#define YYPOPSTACK   (yyvsp--, yyssp--)
1562
 
1563
  YYSIZE_T yystacksize = YYINITDEPTH;
1564
 
1565
  /* The variables used to return semantic value and location from the
1566
     action routines.  */
1567
  YYSTYPE yyval;
1568
 
1569
 
1570
  /* When reducing, the number of symbols on the RHS of the reduced
1571
     rule.  */
1572
  int yylen;
1573
 
1574
  YYDPRINTF ((stderr, "Starting parse\n"));
1575
 
1576
  yystate = 0;
1577
  yyerrstatus = 0;
1578
  yynerrs = 0;
1579
  yychar = YYEMPTY;             /* Cause a token to be read.  */
1580
 
1581
  /* Initialize stack pointers.
1582
     Waste one element of value and location stack
1583
     so that they stay on the same level as the state stack.
1584
     The wasted elements are never initialized.  */
1585
 
1586
  yyssp = yyss;
1587
  yyvsp = yyvs;
1588
 
1589
  goto yysetstate;
1590
 
1591
/*------------------------------------------------------------.
1592
| yynewstate -- Push a new state, which is found in yystate.  |
1593
`------------------------------------------------------------*/
1594
 yynewstate:
1595
  /* In all cases, when you get here, the value and location stacks
1596
     have just been pushed. so pushing a state here evens the stacks.
1597
     */
1598
  yyssp++;
1599
 
1600
 yysetstate:
1601
  *yyssp = yystate;
1602
 
1603
  if (yyss + yystacksize - 1 <= yyssp)
1604
    {
1605
      /* Get the current used size of the three stacks, in elements.  */
1606
      YYSIZE_T yysize = yyssp - yyss + 1;
1607
 
1608
#ifdef yyoverflow
1609
      {
1610
        /* Give user a chance to xreallocate the stack. Use copies of
1611
           these so that the &'s don't force the real ones into
1612
           memory.  */
1613
        YYSTYPE *yyvs1 = yyvs;
1614
        short *yyss1 = yyss;
1615
 
1616
 
1617
        /* Each stack pointer address is followed by the size of the
1618
           data in use in that stack, in bytes.  This used to be a
1619
           conditional around just the two extra args, but that might
1620
           be undefined if yyoverflow is a macro.  */
1621
        yyoverflow ("parser stack overflow",
1622
                    &yyss1, yysize * sizeof (*yyssp),
1623
                    &yyvs1, yysize * sizeof (*yyvsp),
1624
 
1625
                    &yystacksize);
1626
 
1627
        yyss = yyss1;
1628
        yyvs = yyvs1;
1629
      }
1630
#else /* no yyoverflow */
1631
# ifndef YYSTACK_RELOCATE
1632
      goto yyoverflowlab;
1633
# else
1634
      /* Extend the stack our own way.  */
1635
      if (YYMAXDEPTH <= yystacksize)
1636
        goto yyoverflowlab;
1637
      yystacksize *= 2;
1638
      if (YYMAXDEPTH < yystacksize)
1639
        yystacksize = YYMAXDEPTH;
1640
 
1641
      {
1642
        short *yyss1 = yyss;
1643
        union yyalloc *yyptr =
1644
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1645
        if (! yyptr)
1646
          goto yyoverflowlab;
1647
        YYSTACK_RELOCATE (yyss);
1648
        YYSTACK_RELOCATE (yyvs);
1649
 
1650
#  undef YYSTACK_RELOCATE
1651
        if (yyss1 != yyssa)
1652
          YYSTACK_FREE (yyss1);
1653
      }
1654
# endif
1655
#endif /* no yyoverflow */
1656
 
1657
      yyssp = yyss + yysize - 1;
1658
      yyvsp = yyvs + yysize - 1;
1659
 
1660
 
1661
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1662
                  (unsigned long int) yystacksize));
1663
 
1664
      if (yyss + yystacksize - 1 <= yyssp)
1665
        YYABORT;
1666
    }
1667
 
1668
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1669
 
1670
  goto yybackup;
1671
 
1672
/*-----------.
1673
| yybackup.  |
1674
`-----------*/
1675
yybackup:
1676
 
1677
/* Do appropriate processing given the current state.  */
1678
/* Read a lookahead token if we need one and don't already have one.  */
1679
/* yyresume: */
1680
 
1681
  /* First try to decide what to do without reference to lookahead token.  */
1682
 
1683
  yyn = yypact[yystate];
1684
  if (yyn == YYPACT_NINF)
1685
    goto yydefault;
1686
 
1687
  /* Not known => get a lookahead token if don't already have one.  */
1688
 
1689
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1690
  if (yychar == YYEMPTY)
1691
    {
1692
      YYDPRINTF ((stderr, "Reading a token: "));
1693
      yychar = YYLEX;
1694
    }
1695
 
1696
  if (yychar <= YYEOF)
1697
    {
1698
      yychar = yytoken = YYEOF;
1699
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1700
    }
1701
  else
1702
    {
1703
      yytoken = YYTRANSLATE (yychar);
1704
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1705
    }
1706
 
1707
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1708
     detect an error, take that action.  */
1709
  yyn += yytoken;
1710
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1711
    goto yydefault;
1712
  yyn = yytable[yyn];
1713
  if (yyn <= 0)
1714
    {
1715
      if (yyn == 0 || yyn == YYTABLE_NINF)
1716
        goto yyerrlab;
1717
      yyn = -yyn;
1718
      goto yyreduce;
1719
    }
1720
 
1721
  if (yyn == YYFINAL)
1722
    YYACCEPT;
1723
 
1724
  /* Shift the lookahead token.  */
1725
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1726
 
1727
  /* Discard the token being shifted unless it is eof.  */
1728
  if (yychar != YYEOF)
1729
    yychar = YYEMPTY;
1730
 
1731
  *++yyvsp = yylval;
1732
 
1733
 
1734
  /* Count tokens shifted since error; after three, turn off error
1735
     status.  */
1736
  if (yyerrstatus)
1737
    yyerrstatus--;
1738
 
1739
  yystate = yyn;
1740
  goto yynewstate;
1741
 
1742
 
1743
/*-----------------------------------------------------------.
1744
| yydefault -- do the default action for the current state.  |
1745
`-----------------------------------------------------------*/
1746
yydefault:
1747
  yyn = yydefact[yystate];
1748
  if (yyn == 0)
1749
    goto yyerrlab;
1750
  goto yyreduce;
1751
 
1752
 
1753
/*-----------------------------.
1754
| yyreduce -- Do a reduction.  |
1755
`-----------------------------*/
1756
yyreduce:
1757
  /* yyn is the number of a rule to reduce with.  */
1758
  yylen = yyr2[yyn];
1759
 
1760
  /* If YYLEN is nonzero, implement the default value of the action:
1761
     `$$ = $1'.
1762
 
1763
     Otherwise, the following line sets YYVAL to garbage.
1764
     This behavior is undocumented and Bison
1765
     users should not rely upon it.  Assigning to YYVAL
1766
     unconditionally makes the parser a bit smaller, and it avoids a
1767
     GCC warning that YYVAL may be used uninitialized.  */
1768
  yyval = yyvsp[1-yylen];
1769
 
1770
 
1771
  YY_REDUCE_PRINT (yyn);
1772
  switch (yyn)
1773
    {
1774
        case 2:
1775
#line 367 "cp-name-parser.y"
1776
    { global_result = yyvsp[0].comp; }
1777
    break;
1778
 
1779
  case 6:
1780
#line 379 "cp-name-parser.y"
1781
    { yyval.comp = NULL; }
1782
    break;
1783
 
1784
  case 7:
1785
#line 381 "cp-name-parser.y"
1786
    { yyval.comp = yyvsp[0].comp; }
1787
    break;
1788
 
1789
  case 8:
1790
#line 388 "cp-name-parser.y"
1791
    { yyval.comp = yyvsp[0].nested.comp;
1792
                          *yyvsp[0].nested.last = yyvsp[-1].comp;
1793
                        }
1794
    break;
1795
 
1796
  case 9:
1797
#line 397 "cp-name-parser.y"
1798
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, yyvsp[-2].comp, yyvsp[-1].nested.comp);
1799
                          if (yyvsp[0].comp) yyval.comp = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, yyval.comp, yyvsp[0].comp); }
1800
    break;
1801
 
1802
  case 10:
1803
#line 400 "cp-name-parser.y"
1804
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, yyvsp[-2].comp, yyvsp[-1].nested.comp);
1805
                          if (yyvsp[0].comp) yyval.comp = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, yyval.comp, yyvsp[0].comp); }
1806
    break;
1807
 
1808
  case 11:
1809
#line 404 "cp-name-parser.y"
1810
    { yyval.comp = yyvsp[-1].nested.comp;
1811
                          if (yyvsp[0].comp) yyval.comp = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, yyval.comp, yyvsp[0].comp); }
1812
    break;
1813
 
1814
  case 12:
1815
#line 407 "cp-name-parser.y"
1816
    { if (yyvsp[0].abstract.last)
1817
                            {
1818
                               /* First complete the abstract_declarator's type using
1819
                                  the typespec from the conversion_op_name.  */
1820
                              *yyvsp[0].abstract.last = *yyvsp[-1].nested.last;
1821
                              /* Then complete the conversion_op_name with the type.  */
1822
                              *yyvsp[-1].nested.last = yyvsp[0].abstract.comp;
1823
                            }
1824
                          /* If we have an arglist, build a function type.  */
1825
                          if (yyvsp[0].abstract.fn.comp)
1826
                            yyval.comp = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, yyvsp[-1].nested.comp, yyvsp[0].abstract.fn.comp);
1827
                          else
1828
                            yyval.comp = yyvsp[-1].nested.comp;
1829
                          if (yyvsp[0].abstract.start) yyval.comp = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, yyval.comp, yyvsp[0].abstract.start);
1830
                        }
1831
    break;
1832
 
1833
  case 13:
1834
#line 426 "cp-name-parser.y"
1835
    { yyval.comp = make_empty (yyvsp[-1].lval);
1836
                          d_left (yyval.comp) = yyvsp[0].comp;
1837
                          d_right (yyval.comp) = NULL; }
1838
    break;
1839
 
1840
  case 14:
1841
#line 430 "cp-name-parser.y"
1842
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, yyvsp[-2].comp, yyvsp[0].comp); }
1843
    break;
1844
 
1845
  case 15:
1846
#line 432 "cp-name-parser.y"
1847
    { yyval.comp = make_empty (yyvsp[0].typed_val_int.val);
1848
                          d_left (yyval.comp) = yyvsp[0].typed_val_int.type;
1849
                          d_right (yyval.comp) = NULL; }
1850
    break;
1851
 
1852
  case 16:
1853
#line 438 "cp-name-parser.y"
1854
    { yyval.comp = make_operator ("new", 1); }
1855
    break;
1856
 
1857
  case 17:
1858
#line 440 "cp-name-parser.y"
1859
    { yyval.comp = make_operator ("delete", 1); }
1860
    break;
1861
 
1862
  case 18:
1863
#line 442 "cp-name-parser.y"
1864
    { yyval.comp = make_operator ("new[]", 1); }
1865
    break;
1866
 
1867
  case 19:
1868
#line 444 "cp-name-parser.y"
1869
    { yyval.comp = make_operator ("delete[]", 1); }
1870
    break;
1871
 
1872
  case 20:
1873
#line 446 "cp-name-parser.y"
1874
    { yyval.comp = make_operator ("+", 2); }
1875
    break;
1876
 
1877
  case 21:
1878
#line 448 "cp-name-parser.y"
1879
    { yyval.comp = make_operator ("-", 2); }
1880
    break;
1881
 
1882
  case 22:
1883
#line 450 "cp-name-parser.y"
1884
    { yyval.comp = make_operator ("*", 2); }
1885
    break;
1886
 
1887
  case 23:
1888
#line 452 "cp-name-parser.y"
1889
    { yyval.comp = make_operator ("/", 2); }
1890
    break;
1891
 
1892
  case 24:
1893
#line 454 "cp-name-parser.y"
1894
    { yyval.comp = make_operator ("%", 2); }
1895
    break;
1896
 
1897
  case 25:
1898
#line 456 "cp-name-parser.y"
1899
    { yyval.comp = make_operator ("^", 2); }
1900
    break;
1901
 
1902
  case 26:
1903
#line 458 "cp-name-parser.y"
1904
    { yyval.comp = make_operator ("&", 2); }
1905
    break;
1906
 
1907
  case 27:
1908
#line 460 "cp-name-parser.y"
1909
    { yyval.comp = make_operator ("|", 2); }
1910
    break;
1911
 
1912
  case 28:
1913
#line 462 "cp-name-parser.y"
1914
    { yyval.comp = make_operator ("~", 1); }
1915
    break;
1916
 
1917
  case 29:
1918
#line 464 "cp-name-parser.y"
1919
    { yyval.comp = make_operator ("!", 1); }
1920
    break;
1921
 
1922
  case 30:
1923
#line 466 "cp-name-parser.y"
1924
    { yyval.comp = make_operator ("=", 2); }
1925
    break;
1926
 
1927
  case 31:
1928
#line 468 "cp-name-parser.y"
1929
    { yyval.comp = make_operator ("<", 2); }
1930
    break;
1931
 
1932
  case 32:
1933
#line 470 "cp-name-parser.y"
1934
    { yyval.comp = make_operator (">", 2); }
1935
    break;
1936
 
1937
  case 33:
1938
#line 472 "cp-name-parser.y"
1939
    { yyval.comp = make_operator (yyvsp[0].opname, 2); }
1940
    break;
1941
 
1942
  case 34:
1943
#line 474 "cp-name-parser.y"
1944
    { yyval.comp = make_operator ("<<", 2); }
1945
    break;
1946
 
1947
  case 35:
1948
#line 476 "cp-name-parser.y"
1949
    { yyval.comp = make_operator (">>", 2); }
1950
    break;
1951
 
1952
  case 36:
1953
#line 478 "cp-name-parser.y"
1954
    { yyval.comp = make_operator ("==", 2); }
1955
    break;
1956
 
1957
  case 37:
1958
#line 480 "cp-name-parser.y"
1959
    { yyval.comp = make_operator ("!=", 2); }
1960
    break;
1961
 
1962
  case 38:
1963
#line 482 "cp-name-parser.y"
1964
    { yyval.comp = make_operator ("<=", 2); }
1965
    break;
1966
 
1967
  case 39:
1968
#line 484 "cp-name-parser.y"
1969
    { yyval.comp = make_operator (">=", 2); }
1970
    break;
1971
 
1972
  case 40:
1973
#line 486 "cp-name-parser.y"
1974
    { yyval.comp = make_operator ("&&", 2); }
1975
    break;
1976
 
1977
  case 41:
1978
#line 488 "cp-name-parser.y"
1979
    { yyval.comp = make_operator ("||", 2); }
1980
    break;
1981
 
1982
  case 42:
1983
#line 490 "cp-name-parser.y"
1984
    { yyval.comp = make_operator ("++", 1); }
1985
    break;
1986
 
1987
  case 43:
1988
#line 492 "cp-name-parser.y"
1989
    { yyval.comp = make_operator ("--", 1); }
1990
    break;
1991
 
1992
  case 44:
1993
#line 494 "cp-name-parser.y"
1994
    { yyval.comp = make_operator (",", 2); }
1995
    break;
1996
 
1997
  case 45:
1998
#line 496 "cp-name-parser.y"
1999
    { yyval.comp = make_operator ("->*", 2); }
2000
    break;
2001
 
2002
  case 46:
2003
#line 498 "cp-name-parser.y"
2004
    { yyval.comp = make_operator ("->", 2); }
2005
    break;
2006
 
2007
  case 47:
2008
#line 500 "cp-name-parser.y"
2009
    { yyval.comp = make_operator ("()", 0); }
2010
    break;
2011
 
2012
  case 48:
2013
#line 502 "cp-name-parser.y"
2014
    { yyval.comp = make_operator ("[]", 2); }
2015
    break;
2016
 
2017
  case 49:
2018
#line 510 "cp-name-parser.y"
2019
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_CAST, yyvsp[0].comp, NULL); }
2020
    break;
2021
 
2022
  case 50:
2023
#line 515 "cp-name-parser.y"
2024
    { yyval.nested.comp = yyvsp[-1].nested1.comp;
2025
                          d_right (yyvsp[-1].nested1.last) = yyvsp[0].comp;
2026
                          yyval.nested.last = &d_left (yyvsp[0].comp);
2027
                        }
2028
    break;
2029
 
2030
  case 51:
2031
#line 520 "cp-name-parser.y"
2032
    { yyval.nested.comp = yyvsp[0].comp;
2033
                          yyval.nested.last = &d_left (yyvsp[0].comp);
2034
                        }
2035
    break;
2036
 
2037
  case 52:
2038
#line 524 "cp-name-parser.y"
2039
    { yyval.nested.comp = yyvsp[-1].nested1.comp;
2040
                          d_right (yyvsp[-1].nested1.last) = yyvsp[0].comp;
2041
                          yyval.nested.last = &d_left (yyvsp[0].comp);
2042
                        }
2043
    break;
2044
 
2045
  case 53:
2046
#line 529 "cp-name-parser.y"
2047
    { yyval.nested.comp = yyvsp[0].comp;
2048
                          yyval.nested.last = &d_left (yyvsp[0].comp);
2049
                        }
2050
    break;
2051
 
2052
  case 55:
2053
#line 538 "cp-name-parser.y"
2054
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, yyvsp[-3].comp, yyvsp[-1].nested.comp); }
2055
    break;
2056
 
2057
  case 56:
2058
#line 540 "cp-name-parser.y"
2059
    { yyval.comp = make_dtor (gnu_v3_complete_object_dtor, yyvsp[0].comp); }
2060
    break;
2061
 
2062
  case 58:
2063
#line 553 "cp-name-parser.y"
2064
    { yyval.comp = yyvsp[0].comp; }
2065
    break;
2066
 
2067
  case 59:
2068
#line 559 "cp-name-parser.y"
2069
    { yyval.comp = yyvsp[-1].nested1.comp; d_right (yyvsp[-1].nested1.last) = yyvsp[0].comp; }
2070
    break;
2071
 
2072
  case 61:
2073
#line 562 "cp-name-parser.y"
2074
    { yyval.comp = yyvsp[-1].nested1.comp; d_right (yyvsp[-1].nested1.last) = yyvsp[0].comp; }
2075
    break;
2076
 
2077
  case 66:
2078
#line 572 "cp-name-parser.y"
2079
    { yyval.comp = yyvsp[0].comp; }
2080
    break;
2081
 
2082
  case 67:
2083
#line 576 "cp-name-parser.y"
2084
    { yyval.comp = yyvsp[-1].nested1.comp; d_right (yyvsp[-1].nested1.last) = yyvsp[0].comp; }
2085
    break;
2086
 
2087
  case 69:
2088
#line 581 "cp-name-parser.y"
2089
    { yyval.nested1.comp = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
2090
                          d_left (yyval.nested1.comp) = yyvsp[-1].comp;
2091
                          d_right (yyval.nested1.comp) = NULL;
2092
                          yyval.nested1.last = yyval.nested1.comp;
2093
                        }
2094
    break;
2095
 
2096
  case 70:
2097
#line 587 "cp-name-parser.y"
2098
    { yyval.nested1.comp = yyvsp[-2].nested1.comp;
2099
                          d_right (yyvsp[-2].nested1.last) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
2100
                          yyval.nested1.last = d_right (yyvsp[-2].nested1.last);
2101
                          d_left (yyval.nested1.last) = yyvsp[-1].comp;
2102
                          d_right (yyval.nested1.last) = NULL;
2103
                        }
2104
    break;
2105
 
2106
  case 71:
2107
#line 594 "cp-name-parser.y"
2108
    { yyval.nested1.comp = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
2109
                          d_left (yyval.nested1.comp) = yyvsp[-1].comp;
2110
                          d_right (yyval.nested1.comp) = NULL;
2111
                          yyval.nested1.last = yyval.nested1.comp;
2112
                        }
2113
    break;
2114
 
2115
  case 72:
2116
#line 600 "cp-name-parser.y"
2117
    { yyval.nested1.comp = yyvsp[-2].nested1.comp;
2118
                          d_right (yyvsp[-2].nested1.last) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME);
2119
                          yyval.nested1.last = d_right (yyvsp[-2].nested1.last);
2120
                          d_left (yyval.nested1.last) = yyvsp[-1].comp;
2121
                          d_right (yyval.nested1.last) = NULL;
2122
                        }
2123
    break;
2124
 
2125
  case 73:
2126
#line 611 "cp-name-parser.y"
2127
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_TEMPLATE, yyvsp[-3].comp, yyvsp[-1].nested.comp); }
2128
    break;
2129
 
2130
  case 74:
2131
#line 615 "cp-name-parser.y"
2132
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, yyvsp[0].comp, NULL);
2133
                        yyval.nested.last = &d_right (yyval.nested.comp); }
2134
    break;
2135
 
2136
  case 75:
2137
#line 618 "cp-name-parser.y"
2138
    { yyval.nested.comp = yyvsp[-2].nested.comp;
2139
                          *yyvsp[-2].nested.last = fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, yyvsp[0].comp, NULL);
2140
                          yyval.nested.last = &d_right (*yyvsp[-2].nested.last);
2141
                        }
2142
    break;
2143
 
2144
  case 77:
2145
#line 630 "cp-name-parser.y"
2146
    { yyval.comp = yyvsp[0].abstract.comp;
2147
                          *yyvsp[0].abstract.last = yyvsp[-1].comp;
2148
                        }
2149
    break;
2150
 
2151
  case 78:
2152
#line 634 "cp-name-parser.y"
2153
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator ("&", 1), yyvsp[0].comp); }
2154
    break;
2155
 
2156
  case 79:
2157
#line 636 "cp-name-parser.y"
2158
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator ("&", 1), yyvsp[-1].comp); }
2159
    break;
2160
 
2161
  case 81:
2162
#line 641 "cp-name-parser.y"
2163
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_ARGLIST, yyvsp[0].comp, NULL);
2164
                          yyval.nested.last = &d_right (yyval.nested.comp);
2165
                        }
2166
    break;
2167
 
2168
  case 82:
2169
#line 645 "cp-name-parser.y"
2170
    { *yyvsp[0].abstract.last = yyvsp[-1].comp;
2171
                          yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_ARGLIST, yyvsp[0].abstract.comp, NULL);
2172
                          yyval.nested.last = &d_right (yyval.nested.comp);
2173
                        }
2174
    break;
2175
 
2176
  case 83:
2177
#line 650 "cp-name-parser.y"
2178
    { *yyvsp[-2].nested.last = fill_comp (DEMANGLE_COMPONENT_ARGLIST, yyvsp[0].comp, NULL);
2179
                          yyval.nested.comp = yyvsp[-2].nested.comp;
2180
                          yyval.nested.last = &d_right (*yyvsp[-2].nested.last);
2181
                        }
2182
    break;
2183
 
2184
  case 84:
2185
#line 655 "cp-name-parser.y"
2186
    { *yyvsp[0].abstract.last = yyvsp[-1].comp;
2187
                          *yyvsp[-3].nested.last = fill_comp (DEMANGLE_COMPONENT_ARGLIST, yyvsp[0].abstract.comp, NULL);
2188
                          yyval.nested.comp = yyvsp[-3].nested.comp;
2189
                          yyval.nested.last = &d_right (*yyvsp[-3].nested.last);
2190
                        }
2191
    break;
2192
 
2193
  case 85:
2194
#line 661 "cp-name-parser.y"
2195
    { *yyvsp[-2].nested.last
2196
                            = fill_comp (DEMANGLE_COMPONENT_ARGLIST,
2197
                                           make_builtin_type ("..."),
2198
                                           NULL);
2199
                          yyval.nested.comp = yyvsp[-2].nested.comp;
2200
                          yyval.nested.last = &d_right (*yyvsp[-2].nested.last);
2201
                        }
2202
    break;
2203
 
2204
  case 86:
2205
#line 671 "cp-name-parser.y"
2206
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, yyvsp[-2].nested.comp);
2207
                          yyval.nested.last = &d_left (yyval.nested.comp);
2208
                          yyval.nested.comp = d_qualify (yyval.nested.comp, yyvsp[0].lval, 1); }
2209
    break;
2210
 
2211
  case 87:
2212
#line 675 "cp-name-parser.y"
2213
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL);
2214
                          yyval.nested.last = &d_left (yyval.nested.comp);
2215
                          yyval.nested.comp = d_qualify (yyval.nested.comp, yyvsp[0].lval, 1); }
2216
    break;
2217
 
2218
  case 88:
2219
#line 679 "cp-name-parser.y"
2220
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE, NULL, NULL);
2221
                          yyval.nested.last = &d_left (yyval.nested.comp);
2222
                          yyval.nested.comp = d_qualify (yyval.nested.comp, yyvsp[0].lval, 1); }
2223
    break;
2224
 
2225
  case 89:
2226
#line 686 "cp-name-parser.y"
2227
    { yyval.lval = 0; }
2228
    break;
2229
 
2230
  case 91:
2231
#line 691 "cp-name-parser.y"
2232
    { yyval.lval = QUAL_RESTRICT; }
2233
    break;
2234
 
2235
  case 92:
2236
#line 693 "cp-name-parser.y"
2237
    { yyval.lval = QUAL_VOLATILE; }
2238
    break;
2239
 
2240
  case 93:
2241
#line 695 "cp-name-parser.y"
2242
    { yyval.lval = QUAL_CONST; }
2243
    break;
2244
 
2245
  case 95:
2246
#line 700 "cp-name-parser.y"
2247
    { yyval.lval = yyvsp[-1].lval | yyvsp[0].lval; }
2248
    break;
2249
 
2250
  case 96:
2251
#line 707 "cp-name-parser.y"
2252
    { yyval.lval = 0; }
2253
    break;
2254
 
2255
  case 97:
2256
#line 709 "cp-name-parser.y"
2257
    { yyval.lval = INT_SIGNED; }
2258
    break;
2259
 
2260
  case 98:
2261
#line 711 "cp-name-parser.y"
2262
    { yyval.lval = INT_UNSIGNED; }
2263
    break;
2264
 
2265
  case 99:
2266
#line 713 "cp-name-parser.y"
2267
    { yyval.lval = INT_CHAR; }
2268
    break;
2269
 
2270
  case 100:
2271
#line 715 "cp-name-parser.y"
2272
    { yyval.lval = INT_LONG; }
2273
    break;
2274
 
2275
  case 101:
2276
#line 717 "cp-name-parser.y"
2277
    { yyval.lval = INT_SHORT; }
2278
    break;
2279
 
2280
  case 103:
2281
#line 722 "cp-name-parser.y"
2282
    { yyval.lval = yyvsp[-1].lval | yyvsp[0].lval; if (yyvsp[-1].lval & yyvsp[0].lval & INT_LONG) yyval.lval = yyvsp[-1].lval | INT_LLONG; }
2283
    break;
2284
 
2285
  case 104:
2286
#line 726 "cp-name-parser.y"
2287
    { yyval.comp = d_int_type (yyvsp[0].lval); }
2288
    break;
2289
 
2290
  case 105:
2291
#line 728 "cp-name-parser.y"
2292
    { yyval.comp = make_builtin_type ("float"); }
2293
    break;
2294
 
2295
  case 106:
2296
#line 730 "cp-name-parser.y"
2297
    { yyval.comp = make_builtin_type ("double"); }
2298
    break;
2299
 
2300
  case 107:
2301
#line 732 "cp-name-parser.y"
2302
    { yyval.comp = make_builtin_type ("long double"); }
2303
    break;
2304
 
2305
  case 108:
2306
#line 734 "cp-name-parser.y"
2307
    { yyval.comp = make_builtin_type ("bool"); }
2308
    break;
2309
 
2310
  case 109:
2311
#line 736 "cp-name-parser.y"
2312
    { yyval.comp = make_builtin_type ("wchar_t"); }
2313
    break;
2314
 
2315
  case 110:
2316
#line 738 "cp-name-parser.y"
2317
    { yyval.comp = make_builtin_type ("void"); }
2318
    break;
2319
 
2320
  case 111:
2321
#line 742 "cp-name-parser.y"
2322
    { yyval.nested.comp = make_empty (DEMANGLE_COMPONENT_POINTER);
2323
                          yyval.nested.comp->u.s_binary.left = yyval.nested.comp->u.s_binary.right = NULL;
2324
                          yyval.nested.last = &d_left (yyval.nested.comp);
2325
                          yyval.nested.comp = d_qualify (yyval.nested.comp, yyvsp[0].lval, 0); }
2326
    break;
2327
 
2328
  case 112:
2329
#line 748 "cp-name-parser.y"
2330
    { yyval.nested.comp = make_empty (DEMANGLE_COMPONENT_REFERENCE);
2331
                          yyval.nested.comp->u.s_binary.left = yyval.nested.comp->u.s_binary.right = NULL;
2332
                          yyval.nested.last = &d_left (yyval.nested.comp); }
2333
    break;
2334
 
2335
  case 113:
2336
#line 752 "cp-name-parser.y"
2337
    { yyval.nested.comp = make_empty (DEMANGLE_COMPONENT_PTRMEM_TYPE);
2338
                          yyval.nested.comp->u.s_binary.left = yyvsp[-2].nested1.comp;
2339
                          /* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME.  */
2340
                          *yyvsp[-2].nested1.last = *d_left (yyvsp[-2].nested1.last);
2341
                          yyval.nested.comp->u.s_binary.right = NULL;
2342
                          yyval.nested.last = &d_right (yyval.nested.comp);
2343
                          yyval.nested.comp = d_qualify (yyval.nested.comp, yyvsp[0].lval, 0); }
2344
    break;
2345
 
2346
  case 114:
2347
#line 760 "cp-name-parser.y"
2348
    { yyval.nested.comp = make_empty (DEMANGLE_COMPONENT_PTRMEM_TYPE);
2349
                          yyval.nested.comp->u.s_binary.left = yyvsp[-2].nested1.comp;
2350
                          /* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME.  */
2351
                          *yyvsp[-2].nested1.last = *d_left (yyvsp[-2].nested1.last);
2352
                          yyval.nested.comp->u.s_binary.right = NULL;
2353
                          yyval.nested.last = &d_right (yyval.nested.comp);
2354
                          yyval.nested.comp = d_qualify (yyval.nested.comp, yyvsp[0].lval, 0); }
2355
    break;
2356
 
2357
  case 115:
2358
#line 770 "cp-name-parser.y"
2359
    { yyval.comp = make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE);
2360
                          d_left (yyval.comp) = NULL;
2361
                        }
2362
    break;
2363
 
2364
  case 116:
2365
#line 774 "cp-name-parser.y"
2366
    { yyval.comp = make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE);
2367
                          d_left (yyval.comp) = yyvsp[-1].comp;
2368
                        }
2369
    break;
2370
 
2371
  case 117:
2372
#line 790 "cp-name-parser.y"
2373
    { yyval.comp = d_qualify (yyvsp[-1].comp, yyvsp[0].lval, 0); }
2374
    break;
2375
 
2376
  case 119:
2377
#line 793 "cp-name-parser.y"
2378
    { yyval.comp = d_qualify (yyvsp[-1].comp, yyvsp[-2].lval | yyvsp[0].lval, 0); }
2379
    break;
2380
 
2381
  case 120:
2382
#line 795 "cp-name-parser.y"
2383
    { yyval.comp = d_qualify (yyvsp[0].comp, yyvsp[-1].lval, 0); }
2384
    break;
2385
 
2386
  case 121:
2387
#line 798 "cp-name-parser.y"
2388
    { yyval.comp = d_qualify (yyvsp[-1].comp, yyvsp[0].lval, 0); }
2389
    break;
2390
 
2391
  case 123:
2392
#line 801 "cp-name-parser.y"
2393
    { yyval.comp = d_qualify (yyvsp[-1].comp, yyvsp[-2].lval | yyvsp[0].lval, 0); }
2394
    break;
2395
 
2396
  case 124:
2397
#line 803 "cp-name-parser.y"
2398
    { yyval.comp = d_qualify (yyvsp[0].comp, yyvsp[-1].lval, 0); }
2399
    break;
2400
 
2401
  case 125:
2402
#line 806 "cp-name-parser.y"
2403
    { yyval.comp = d_qualify (yyvsp[-1].comp, yyvsp[0].lval, 0); }
2404
    break;
2405
 
2406
  case 126:
2407
#line 808 "cp-name-parser.y"
2408
    { yyval.comp = yyvsp[0].comp; }
2409
    break;
2410
 
2411
  case 127:
2412
#line 810 "cp-name-parser.y"
2413
    { yyval.comp = d_qualify (yyvsp[-1].comp, yyvsp[-3].lval | yyvsp[0].lval, 0); }
2414
    break;
2415
 
2416
  case 128:
2417
#line 812 "cp-name-parser.y"
2418
    { yyval.comp = d_qualify (yyvsp[0].comp, yyvsp[-2].lval, 0); }
2419
    break;
2420
 
2421
  case 129:
2422
#line 817 "cp-name-parser.y"
2423
    { yyval.abstract.comp = yyvsp[0].nested.comp; yyval.abstract.last = yyvsp[0].nested.last;
2424
                          yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL; }
2425
    break;
2426
 
2427
  case 130:
2428
#line 820 "cp-name-parser.y"
2429
    { yyval.abstract = yyvsp[0].abstract; yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL;
2430
                          if (yyvsp[0].abstract.fn.comp) { yyval.abstract.last = yyvsp[0].abstract.fn.last; *yyvsp[0].abstract.last = yyvsp[0].abstract.fn.comp; }
2431
                          *yyval.abstract.last = yyvsp[-1].nested.comp;
2432
                          yyval.abstract.last = yyvsp[-1].nested.last; }
2433
    break;
2434
 
2435
  case 131:
2436
#line 825 "cp-name-parser.y"
2437
    { yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL;
2438
                          if (yyvsp[0].abstract.fn.comp) { yyval.abstract.last = yyvsp[0].abstract.fn.last; *yyvsp[0].abstract.last = yyvsp[0].abstract.fn.comp; }
2439
                        }
2440
    break;
2441
 
2442
  case 132:
2443
#line 832 "cp-name-parser.y"
2444
    { yyval.abstract = yyvsp[-1].abstract; yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL; yyval.abstract.fold_flag = 1;
2445
                          if (yyvsp[-1].abstract.fn.comp) { yyval.abstract.last = yyvsp[-1].abstract.fn.last; *yyvsp[-1].abstract.last = yyvsp[-1].abstract.fn.comp; }
2446
                        }
2447
    break;
2448
 
2449
  case 133:
2450
#line 836 "cp-name-parser.y"
2451
    { yyval.abstract.fold_flag = 0;
2452
                          if (yyvsp[-1].abstract.fn.comp) { yyval.abstract.last = yyvsp[-1].abstract.fn.last; *yyvsp[-1].abstract.last = yyvsp[-1].abstract.fn.comp; }
2453
                          if (yyvsp[-1].abstract.fold_flag)
2454
                            {
2455
                              *yyval.abstract.last = yyvsp[0].nested.comp;
2456
                              yyval.abstract.last = yyvsp[0].nested.last;
2457
                            }
2458
                          else
2459
                            yyval.abstract.fn = yyvsp[0].nested;
2460
                        }
2461
    break;
2462
 
2463
  case 134:
2464
#line 847 "cp-name-parser.y"
2465
    { yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL; yyval.abstract.fold_flag = 0;
2466
                          if (yyvsp[-1].abstract.fn.comp) { yyval.abstract.last = yyvsp[-1].abstract.fn.last; *yyvsp[-1].abstract.last = yyvsp[-1].abstract.fn.comp; }
2467
                          *yyvsp[-1].abstract.last = yyvsp[0].comp;
2468
                          yyval.abstract.last = &d_right (yyvsp[0].comp);
2469
                        }
2470
    break;
2471
 
2472
  case 135:
2473
#line 853 "cp-name-parser.y"
2474
    { yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL; yyval.abstract.fold_flag = 0;
2475
                          yyval.abstract.comp = yyvsp[0].comp;
2476
                          yyval.abstract.last = &d_right (yyvsp[0].comp);
2477
                        }
2478
    break;
2479
 
2480
  case 136:
2481
#line 871 "cp-name-parser.y"
2482
    { yyval.abstract.comp = yyvsp[0].nested.comp; yyval.abstract.last = yyvsp[0].nested.last;
2483
                          yyval.abstract.fn.comp = NULL; yyval.abstract.fn.last = NULL; yyval.abstract.start = NULL; }
2484
    break;
2485
 
2486
  case 137:
2487
#line 874 "cp-name-parser.y"
2488
    { yyval.abstract = yyvsp[0].abstract;
2489
                          if (yyvsp[0].abstract.last)
2490
                            *yyval.abstract.last = yyvsp[-1].nested.comp;
2491
                          else
2492
                            yyval.abstract.comp = yyvsp[-1].nested.comp;
2493
                          yyval.abstract.last = yyvsp[-1].nested.last;
2494
                        }
2495
    break;
2496
 
2497
  case 138:
2498
#line 882 "cp-name-parser.y"
2499
    { yyval.abstract.comp = yyvsp[0].abstract.comp; yyval.abstract.last = yyvsp[0].abstract.last; yyval.abstract.fn = yyvsp[0].abstract.fn; yyval.abstract.start = NULL; }
2500
    break;
2501
 
2502
  case 139:
2503
#line 884 "cp-name-parser.y"
2504
    { yyval.abstract.start = yyvsp[0].comp;
2505
                          if (yyvsp[-3].abstract.fn.comp) { yyval.abstract.last = yyvsp[-3].abstract.fn.last; *yyvsp[-3].abstract.last = yyvsp[-3].abstract.fn.comp; }
2506
                          if (yyvsp[-3].abstract.fold_flag)
2507
                            {
2508
                              *yyval.abstract.last = yyvsp[-2].nested.comp;
2509
                              yyval.abstract.last = yyvsp[-2].nested.last;
2510
                            }
2511
                          else
2512
                            yyval.abstract.fn = yyvsp[-2].nested;
2513
                        }
2514
    break;
2515
 
2516
  case 140:
2517
#line 895 "cp-name-parser.y"
2518
    { yyval.abstract.fn = yyvsp[-1].nested;
2519
                          yyval.abstract.start = yyvsp[0].comp;
2520
                          yyval.abstract.comp = NULL; yyval.abstract.last = NULL;
2521
                        }
2522
    break;
2523
 
2524
  case 142:
2525
#line 903 "cp-name-parser.y"
2526
    { yyval.comp = yyvsp[0].abstract.comp;
2527
                          *yyvsp[0].abstract.last = yyvsp[-1].comp;
2528
                        }
2529
    break;
2530
 
2531
  case 143:
2532
#line 909 "cp-name-parser.y"
2533
    { yyval.nested.comp = yyvsp[0].nested.comp;
2534
                          yyval.nested.last = yyvsp[-1].nested.last;
2535
                          *yyvsp[0].nested.last = yyvsp[-1].nested.comp; }
2536
    break;
2537
 
2538
  case 145:
2539
#line 917 "cp-name-parser.y"
2540
    { yyval.nested = yyvsp[-1].nested; }
2541
    break;
2542
 
2543
  case 146:
2544
#line 919 "cp-name-parser.y"
2545
    { yyval.nested.comp = yyvsp[-1].nested.comp;
2546
                          *yyvsp[-1].nested.last = yyvsp[0].nested.comp;
2547
                          yyval.nested.last = yyvsp[0].nested.last;
2548
                        }
2549
    break;
2550
 
2551
  case 147:
2552
#line 924 "cp-name-parser.y"
2553
    { yyval.nested.comp = yyvsp[-1].nested.comp;
2554
                          *yyvsp[-1].nested.last = yyvsp[0].comp;
2555
                          yyval.nested.last = &d_right (yyvsp[0].comp);
2556
                        }
2557
    break;
2558
 
2559
  case 148:
2560
#line 929 "cp-name-parser.y"
2561
    { yyval.nested.comp = make_empty (DEMANGLE_COMPONENT_TYPED_NAME);
2562
                          d_left (yyval.nested.comp) = yyvsp[0].comp;
2563
                          yyval.nested.last = &d_right (yyval.nested.comp);
2564
                        }
2565
    break;
2566
 
2567
  case 149:
2568
#line 942 "cp-name-parser.y"
2569
    { yyval.nested.comp = yyvsp[0].nested.comp;
2570
                          yyval.nested.last = yyvsp[-1].nested.last;
2571
                          *yyvsp[0].nested.last = yyvsp[-1].nested.comp; }
2572
    break;
2573
 
2574
  case 150:
2575
#line 946 "cp-name-parser.y"
2576
    { yyval.nested.comp = make_empty (DEMANGLE_COMPONENT_TYPED_NAME);
2577
                          d_left (yyval.nested.comp) = yyvsp[0].comp;
2578
                          yyval.nested.last = &d_right (yyval.nested.comp);
2579
                        }
2580
    break;
2581
 
2582
  case 152:
2583
#line 959 "cp-name-parser.y"
2584
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, yyvsp[-3].comp, yyvsp[-2].nested.comp);
2585
                          yyval.nested.last = yyvsp[-2].nested.last;
2586
                          yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, yyval.nested.comp, yyvsp[0].comp);
2587
                        }
2588
    break;
2589
 
2590
  case 153:
2591
#line 964 "cp-name-parser.y"
2592
    { yyval.nested.comp = yyvsp[-3].nested.comp;
2593
                          *yyvsp[-3].nested.last = yyvsp[-2].nested.comp;
2594
                          yyval.nested.last = yyvsp[-2].nested.last;
2595
                          yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME, yyval.nested.comp, yyvsp[0].comp);
2596
                        }
2597
    break;
2598
 
2599
  case 154:
2600
#line 973 "cp-name-parser.y"
2601
    { yyval.nested.comp = yyvsp[-1].nested.comp;
2602
                          yyval.nested.last = yyvsp[-2].nested.last;
2603
                          *yyvsp[-1].nested.last = yyvsp[-2].nested.comp; }
2604
    break;
2605
 
2606
  case 155:
2607
#line 977 "cp-name-parser.y"
2608
    { yyval.nested.comp = yyvsp[-1].nested.comp;
2609
                          *yyvsp[-1].nested.last = yyvsp[0].nested.comp;
2610
                          yyval.nested.last = yyvsp[0].nested.last;
2611
                        }
2612
    break;
2613
 
2614
  case 156:
2615
#line 982 "cp-name-parser.y"
2616
    { yyval.nested.comp = yyvsp[-1].nested.comp;
2617
                          *yyvsp[-1].nested.last = yyvsp[0].comp;
2618
                          yyval.nested.last = &d_right (yyvsp[0].comp);
2619
                        }
2620
    break;
2621
 
2622
  case 157:
2623
#line 987 "cp-name-parser.y"
2624
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, yyvsp[-1].comp, yyvsp[0].nested.comp);
2625
                          yyval.nested.last = yyvsp[0].nested.last;
2626
                        }
2627
    break;
2628
 
2629
  case 158:
2630
#line 991 "cp-name-parser.y"
2631
    { yyval.nested.comp = fill_comp (DEMANGLE_COMPONENT_TYPED_NAME, yyvsp[-1].comp, yyvsp[0].comp);
2632
                          yyval.nested.last = &d_right (yyvsp[0].comp);
2633
                        }
2634
    break;
2635
 
2636
  case 159:
2637
#line 997 "cp-name-parser.y"
2638
    { yyval.comp = yyvsp[-1].comp; }
2639
    break;
2640
 
2641
  case 161:
2642
#line 1006 "cp-name-parser.y"
2643
    { yyval.comp = d_binary (">", yyvsp[-2].comp, yyvsp[0].comp); }
2644
    break;
2645
 
2646
  case 162:
2647
#line 1013 "cp-name-parser.y"
2648
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator ("&", 1), yyvsp[0].comp); }
2649
    break;
2650
 
2651
  case 163:
2652
#line 1015 "cp-name-parser.y"
2653
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator ("&", 1), yyvsp[-1].comp); }
2654
    break;
2655
 
2656
  case 164:
2657
#line 1020 "cp-name-parser.y"
2658
    { yyval.comp = d_unary ("-", yyvsp[0].comp); }
2659
    break;
2660
 
2661
  case 165:
2662
#line 1024 "cp-name-parser.y"
2663
    { yyval.comp = d_unary ("!", yyvsp[0].comp); }
2664
    break;
2665
 
2666
  case 166:
2667
#line 1028 "cp-name-parser.y"
2668
    { yyval.comp = d_unary ("~", yyvsp[0].comp); }
2669
    break;
2670
 
2671
  case 167:
2672
#line 1035 "cp-name-parser.y"
2673
    { if (yyvsp[0].comp->type == DEMANGLE_COMPONENT_LITERAL
2674
                      || yyvsp[0].comp->type == DEMANGLE_COMPONENT_LITERAL_NEG)
2675
                    {
2676
                      yyval.comp = yyvsp[0].comp;
2677
                      d_left (yyvsp[0].comp) = yyvsp[-2].comp;
2678
                    }
2679
                  else
2680
                    yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY,
2681
                                      fill_comp (DEMANGLE_COMPONENT_CAST, yyvsp[-2].comp, NULL),
2682
                                      yyvsp[0].comp);
2683
                }
2684
    break;
2685
 
2686
  case 168:
2687
#line 1051 "cp-name-parser.y"
2688
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY,
2689
                                    fill_comp (DEMANGLE_COMPONENT_CAST, yyvsp[-4].comp, NULL),
2690
                                    yyvsp[-1].comp);
2691
                }
2692
    break;
2693
 
2694
  case 169:
2695
#line 1058 "cp-name-parser.y"
2696
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY,
2697
                                    fill_comp (DEMANGLE_COMPONENT_CAST, yyvsp[-4].comp, NULL),
2698
                                    yyvsp[-1].comp);
2699
                }
2700
    break;
2701
 
2702
  case 170:
2703
#line 1065 "cp-name-parser.y"
2704
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_UNARY,
2705
                                    fill_comp (DEMANGLE_COMPONENT_CAST, yyvsp[-4].comp, NULL),
2706
                                    yyvsp[-1].comp);
2707
                }
2708
    break;
2709
 
2710
  case 171:
2711
#line 1084 "cp-name-parser.y"
2712
    { yyval.comp = d_binary ("*", yyvsp[-2].comp, yyvsp[0].comp); }
2713
    break;
2714
 
2715
  case 172:
2716
#line 1088 "cp-name-parser.y"
2717
    { yyval.comp = d_binary ("/", yyvsp[-2].comp, yyvsp[0].comp); }
2718
    break;
2719
 
2720
  case 173:
2721
#line 1092 "cp-name-parser.y"
2722
    { yyval.comp = d_binary ("%", yyvsp[-2].comp, yyvsp[0].comp); }
2723
    break;
2724
 
2725
  case 174:
2726
#line 1096 "cp-name-parser.y"
2727
    { yyval.comp = d_binary ("+", yyvsp[-2].comp, yyvsp[0].comp); }
2728
    break;
2729
 
2730
  case 175:
2731
#line 1100 "cp-name-parser.y"
2732
    { yyval.comp = d_binary ("-", yyvsp[-2].comp, yyvsp[0].comp); }
2733
    break;
2734
 
2735
  case 176:
2736
#line 1104 "cp-name-parser.y"
2737
    { yyval.comp = d_binary ("<<", yyvsp[-2].comp, yyvsp[0].comp); }
2738
    break;
2739
 
2740
  case 177:
2741
#line 1108 "cp-name-parser.y"
2742
    { yyval.comp = d_binary (">>", yyvsp[-2].comp, yyvsp[0].comp); }
2743
    break;
2744
 
2745
  case 178:
2746
#line 1112 "cp-name-parser.y"
2747
    { yyval.comp = d_binary ("==", yyvsp[-2].comp, yyvsp[0].comp); }
2748
    break;
2749
 
2750
  case 179:
2751
#line 1116 "cp-name-parser.y"
2752
    { yyval.comp = d_binary ("!=", yyvsp[-2].comp, yyvsp[0].comp); }
2753
    break;
2754
 
2755
  case 180:
2756
#line 1120 "cp-name-parser.y"
2757
    { yyval.comp = d_binary ("<=", yyvsp[-2].comp, yyvsp[0].comp); }
2758
    break;
2759
 
2760
  case 181:
2761
#line 1124 "cp-name-parser.y"
2762
    { yyval.comp = d_binary (">=", yyvsp[-2].comp, yyvsp[0].comp); }
2763
    break;
2764
 
2765
  case 182:
2766
#line 1128 "cp-name-parser.y"
2767
    { yyval.comp = d_binary ("<", yyvsp[-2].comp, yyvsp[0].comp); }
2768
    break;
2769
 
2770
  case 183:
2771
#line 1132 "cp-name-parser.y"
2772
    { yyval.comp = d_binary ("&", yyvsp[-2].comp, yyvsp[0].comp); }
2773
    break;
2774
 
2775
  case 184:
2776
#line 1136 "cp-name-parser.y"
2777
    { yyval.comp = d_binary ("^", yyvsp[-2].comp, yyvsp[0].comp); }
2778
    break;
2779
 
2780
  case 185:
2781
#line 1140 "cp-name-parser.y"
2782
    { yyval.comp = d_binary ("|", yyvsp[-2].comp, yyvsp[0].comp); }
2783
    break;
2784
 
2785
  case 186:
2786
#line 1144 "cp-name-parser.y"
2787
    { yyval.comp = d_binary ("&&", yyvsp[-2].comp, yyvsp[0].comp); }
2788
    break;
2789
 
2790
  case 187:
2791
#line 1148 "cp-name-parser.y"
2792
    { yyval.comp = d_binary ("||", yyvsp[-2].comp, yyvsp[0].comp); }
2793
    break;
2794
 
2795
  case 188:
2796
#line 1153 "cp-name-parser.y"
2797
    { yyval.comp = d_binary ("->", yyvsp[-2].comp, yyvsp[0].comp); }
2798
    break;
2799
 
2800
  case 189:
2801
#line 1157 "cp-name-parser.y"
2802
    { yyval.comp = d_binary (".", yyvsp[-2].comp, yyvsp[0].comp); }
2803
    break;
2804
 
2805
  case 190:
2806
#line 1161 "cp-name-parser.y"
2807
    { yyval.comp = fill_comp (DEMANGLE_COMPONENT_TRINARY, make_operator ("?", 3),
2808
                                    fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG1, yyvsp[-4].comp,
2809
                                                 fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG2, yyvsp[-2].comp, yyvsp[0].comp)));
2810
                }
2811
    break;
2812
 
2813
  case 193:
2814
#line 1175 "cp-name-parser.y"
2815
    { yyval.comp = d_unary ("sizeof", yyvsp[-1].comp); }
2816
    break;
2817
 
2818
  case 194:
2819
#line 1180 "cp-name-parser.y"
2820
    { struct demangle_component *i;
2821
                  i = make_name ("1", 1);
2822
                  yyval.comp = fill_comp (DEMANGLE_COMPONENT_LITERAL,
2823
                                    make_builtin_type ("bool"),
2824
                                    i);
2825
                }
2826
    break;
2827
 
2828
  case 195:
2829
#line 1189 "cp-name-parser.y"
2830
    { struct demangle_component *i;
2831
                  i = make_name ("0", 1);
2832
                  yyval.comp = fill_comp (DEMANGLE_COMPONENT_LITERAL,
2833
                                    make_builtin_type ("bool"),
2834
                                    i);
2835
                }
2836
    break;
2837
 
2838
 
2839
    }
2840
 
2841
/* Line 1000 of yacc.c.  */
2842
#line 2843 "cp-name-parser.c.tmp"
2843
 
2844
  yyvsp -= yylen;
2845
  yyssp -= yylen;
2846
 
2847
 
2848
  YY_STACK_PRINT (yyss, yyssp);
2849
 
2850
  *++yyvsp = yyval;
2851
 
2852
 
2853
  /* Now `shift' the result of the reduction.  Determine what state
2854
     that goes to, based on the state we popped back to and the rule
2855
     number reduced by.  */
2856
 
2857
  yyn = yyr1[yyn];
2858
 
2859
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2860
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2861
    yystate = yytable[yystate];
2862
  else
2863
    yystate = yydefgoto[yyn - YYNTOKENS];
2864
 
2865
  goto yynewstate;
2866
 
2867
 
2868
/*------------------------------------.
2869
| yyerrlab -- here on detecting error |
2870
`------------------------------------*/
2871
yyerrlab:
2872
  /* If not already recovering from an error, report this error.  */
2873
  if (!yyerrstatus)
2874
    {
2875
      ++yynerrs;
2876
#if YYERROR_VERBOSE
2877
      yyn = yypact[yystate];
2878
 
2879
      if (YYPACT_NINF < yyn && yyn < YYLAST)
2880
        {
2881
          YYSIZE_T yysize = 0;
2882
          int yytype = YYTRANSLATE (yychar);
2883
          const char* yyprefix;
2884
          char *yymsg;
2885
          int yyx;
2886
 
2887
          /* Start YYX at -YYN if negative to avoid negative indexes in
2888
             YYCHECK.  */
2889
          int yyxbegin = yyn < 0 ? -yyn : 0;
2890
 
2891
          /* Stay within bounds of both yycheck and yytname.  */
2892
          int yychecklim = YYLAST - yyn;
2893
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2894
          int yycount = 0;
2895
 
2896
          yyprefix = ", expecting ";
2897
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2898
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2899
              {
2900
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2901
                yycount += 1;
2902
                if (yycount == 5)
2903
                  {
2904
                    yysize = 0;
2905
                    break;
2906
                  }
2907
              }
2908
          yysize += (sizeof ("syntax error, unexpected ")
2909
                     + yystrlen (yytname[yytype]));
2910
          yymsg = (char *) YYSTACK_ALLOC (yysize);
2911
          if (yymsg != 0)
2912
            {
2913
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2914
              yyp = yystpcpy (yyp, yytname[yytype]);
2915
 
2916
              if (yycount < 5)
2917
                {
2918
                  yyprefix = ", expecting ";
2919
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2920
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2921
                      {
2922
                        yyp = yystpcpy (yyp, yyprefix);
2923
                        yyp = yystpcpy (yyp, yytname[yyx]);
2924
                        yyprefix = " or ";
2925
                      }
2926
                }
2927
              yyerror (yymsg);
2928
              YYSTACK_FREE (yymsg);
2929
            }
2930
          else
2931
            yyerror ("syntax error; also virtual memory exhausted");
2932
        }
2933
      else
2934
#endif /* YYERROR_VERBOSE */
2935
        yyerror ("syntax error");
2936
    }
2937
 
2938
 
2939
 
2940
  if (yyerrstatus == 3)
2941
    {
2942
      /* If just tried and failed to reuse lookahead token after an
2943
         error, discard it.  */
2944
 
2945
      if (yychar <= YYEOF)
2946
        {
2947
          /* If at end of input, pop the error token,
2948
             then the rest of the stack, then return failure.  */
2949
          if (yychar == YYEOF)
2950
             for (;;)
2951
               {
2952
                 YYPOPSTACK;
2953
                 if (yyssp == yyss)
2954
                   YYABORT;
2955
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2956
                 yydestruct (yystos[*yyssp], yyvsp);
2957
               }
2958
        }
2959
      else
2960
        {
2961
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2962
          yydestruct (yytoken, &yylval);
2963
          yychar = YYEMPTY;
2964
 
2965
        }
2966
    }
2967
 
2968
  /* Else will try to reuse lookahead token after shifting the error
2969
     token.  */
2970
  goto yyerrlab1;
2971
 
2972
 
2973
/*---------------------------------------------------.
2974
| yyerrorlab -- error raised explicitly by YYERROR.  |
2975
`---------------------------------------------------*/
2976
yyerrorlab:
2977
 
2978
#ifdef __GNUC__
2979
  /* Pacify GCC when the user code never invokes YYERROR and the label
2980
     yyerrorlab therefore never appears in user code.  */
2981
  if (0)
2982
     goto yyerrorlab;
2983
#endif
2984
 
2985
  yyvsp -= yylen;
2986
  yyssp -= yylen;
2987
  yystate = *yyssp;
2988
  goto yyerrlab1;
2989
 
2990
 
2991
/*-------------------------------------------------------------.
2992
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2993
`-------------------------------------------------------------*/
2994
yyerrlab1:
2995
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2996
 
2997
  for (;;)
2998
    {
2999
      yyn = yypact[yystate];
3000
      if (yyn != YYPACT_NINF)
3001
        {
3002
          yyn += YYTERROR;
3003
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3004
            {
3005
              yyn = yytable[yyn];
3006
              if (0 < yyn)
3007
                break;
3008
            }
3009
        }
3010
 
3011
      /* Pop the current state because it cannot handle the error token.  */
3012
      if (yyssp == yyss)
3013
        YYABORT;
3014
 
3015
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
3016
      yydestruct (yystos[yystate], yyvsp);
3017
      YYPOPSTACK;
3018
      yystate = *yyssp;
3019
      YY_STACK_PRINT (yyss, yyssp);
3020
    }
3021
 
3022
  if (yyn == YYFINAL)
3023
    YYACCEPT;
3024
 
3025
  YYDPRINTF ((stderr, "Shifting error token, "));
3026
 
3027
  *++yyvsp = yylval;
3028
 
3029
 
3030
  yystate = yyn;
3031
  goto yynewstate;
3032
 
3033
 
3034
/*-------------------------------------.
3035
| yyacceptlab -- YYACCEPT comes here.  |
3036
`-------------------------------------*/
3037
yyacceptlab:
3038
  yyresult = 0;
3039
  goto yyreturn;
3040
 
3041
/*-----------------------------------.
3042
| yyabortlab -- YYABORT comes here.  |
3043
`-----------------------------------*/
3044
yyabortlab:
3045
  yyresult = 1;
3046
  goto yyreturn;
3047
 
3048
#ifndef yyoverflow
3049
/*----------------------------------------------.
3050
| yyoverflowlab -- parser overflow comes here.  |
3051
`----------------------------------------------*/
3052
yyoverflowlab:
3053
  yyerror ("parser stack overflow");
3054
  yyresult = 2;
3055
  /* Fall through.  */
3056
#endif
3057
 
3058
yyreturn:
3059
#ifndef yyoverflow
3060
  if (yyss != yyssa)
3061
    YYSTACK_FREE (yyss);
3062
#endif
3063
  return yyresult;
3064
}
3065
 
3066
 
3067
#line 1199 "cp-name-parser.y"
3068
 
3069
 
3070
/* Apply QUALIFIERS to LHS and return a qualified component.  IS_METHOD
3071
   is set if LHS is a method, in which case the qualifiers are logically
3072
   applied to "this".  We apply qualifiers in a consistent order; LHS
3073
   may already be qualified; duplicate qualifiers are not created.  */
3074
 
3075
struct demangle_component *
3076
d_qualify (struct demangle_component *lhs, int qualifiers, int is_method)
3077
{
3078
  struct demangle_component **inner_p;
3079
  enum demangle_component_type type;
3080
 
3081
  /* For now the order is CONST (innermost), VOLATILE, RESTRICT.  */
3082
 
3083
#define HANDLE_QUAL(TYPE, MTYPE, QUAL)                          \
3084
  if ((qualifiers & QUAL) && (type != TYPE) && (type != MTYPE)) \
3085
    {                                                           \
3086
      *inner_p = fill_comp (is_method ? MTYPE : TYPE,   \
3087
                              *inner_p, NULL);                  \
3088
      inner_p = &d_left (*inner_p);                             \
3089
      type = (*inner_p)->type;                                  \
3090
    }                                                           \
3091
  else if (type == TYPE || type == MTYPE)                       \
3092
    {                                                           \
3093
      inner_p = &d_left (*inner_p);                             \
3094
      type = (*inner_p)->type;                                  \
3095
    }
3096
 
3097
  inner_p = &lhs;
3098
 
3099
  type = (*inner_p)->type;
3100
 
3101
  HANDLE_QUAL (DEMANGLE_COMPONENT_RESTRICT, DEMANGLE_COMPONENT_RESTRICT_THIS, QUAL_RESTRICT);
3102
  HANDLE_QUAL (DEMANGLE_COMPONENT_VOLATILE, DEMANGLE_COMPONENT_VOLATILE_THIS, QUAL_VOLATILE);
3103
  HANDLE_QUAL (DEMANGLE_COMPONENT_CONST, DEMANGLE_COMPONENT_CONST_THIS, QUAL_CONST);
3104
 
3105
  return lhs;
3106
}
3107
 
3108
/* Return a builtin type corresponding to FLAGS.  */
3109
 
3110
static struct demangle_component *
3111
d_int_type (int flags)
3112
{
3113
  const char *name;
3114
 
3115
  switch (flags)
3116
    {
3117
    case INT_SIGNED | INT_CHAR:
3118
      name = "signed char";
3119
      break;
3120
    case INT_CHAR:
3121
      name = "char";
3122
      break;
3123
    case INT_UNSIGNED | INT_CHAR:
3124
      name = "unsigned char";
3125
      break;
3126
    case 0:
3127
    case INT_SIGNED:
3128
      name = "int";
3129
      break;
3130
    case INT_UNSIGNED:
3131
      name = "unsigned int";
3132
      break;
3133
    case INT_LONG:
3134
    case INT_SIGNED | INT_LONG:
3135
      name = "long";
3136
      break;
3137
    case INT_UNSIGNED | INT_LONG:
3138
      name = "unsigned long";
3139
      break;
3140
    case INT_SHORT:
3141
    case INT_SIGNED | INT_SHORT:
3142
      name = "short";
3143
      break;
3144
    case INT_UNSIGNED | INT_SHORT:
3145
      name = "unsigned short";
3146
      break;
3147
    case INT_LLONG | INT_LONG:
3148
    case INT_SIGNED | INT_LLONG | INT_LONG:
3149
      name = "long long";
3150
      break;
3151
    case INT_UNSIGNED | INT_LLONG | INT_LONG:
3152
      name = "unsigned long long";
3153
      break;
3154
    default:
3155
      return NULL;
3156
    }
3157
 
3158
  return make_builtin_type (name);
3159
}
3160
 
3161
/* Wrapper to create a unary operation.  */
3162
 
3163
static struct demangle_component *
3164
d_unary (const char *name, struct demangle_component *lhs)
3165
{
3166
  return fill_comp (DEMANGLE_COMPONENT_UNARY, make_operator (name, 1), lhs);
3167
}
3168
 
3169
/* Wrapper to create a binary operation.  */
3170
 
3171
static struct demangle_component *
3172
d_binary (const char *name, struct demangle_component *lhs, struct demangle_component *rhs)
3173
{
3174
  return fill_comp (DEMANGLE_COMPONENT_BINARY, make_operator (name, 2),
3175
                      fill_comp (DEMANGLE_COMPONENT_BINARY_ARGS, lhs, rhs));
3176
}
3177
 
3178
/* Find the end of a symbol name starting at LEXPTR.  */
3179
 
3180
static const char *
3181
symbol_end (const char *lexptr)
3182
{
3183
  const char *p = lexptr;
3184
 
3185
  while (*p && (ISALNUM (*p) || *p == '_' || *p == '$' || *p == '.'))
3186
    p++;
3187
 
3188
  return p;
3189
}
3190
 
3191
/* Take care of parsing a number (anything that starts with a digit).
3192
   The number starts at P and contains LEN characters.  Store the result in
3193
   YYLVAL.  */
3194
 
3195
static int
3196
parse_number (const char *p, int len, int parsed_float)
3197
{
3198
  int unsigned_p = 0;
3199
 
3200
  /* Number of "L" suffixes encountered.  */
3201
  int long_p = 0;
3202
 
3203
  struct demangle_component *signed_type;
3204
  struct demangle_component *unsigned_type;
3205
  struct demangle_component *type, *name;
3206
  enum demangle_component_type literal_type;
3207
 
3208
  if (p[0] == '-')
3209
    {
3210
      literal_type = DEMANGLE_COMPONENT_LITERAL_NEG;
3211
      p++;
3212
      len--;
3213
    }
3214
  else
3215
    literal_type = DEMANGLE_COMPONENT_LITERAL;
3216
 
3217
  if (parsed_float)
3218
    {
3219
      /* It's a float since it contains a point or an exponent.  */
3220
      char c;
3221
 
3222
      /* The GDB lexer checks the result of scanf at this point.  Not doing
3223
         this leaves our error checking slightly weaker but only for invalid
3224
         data.  */
3225
 
3226
      /* See if it has `f' or `l' suffix (float or long double).  */
3227
 
3228
      c = TOLOWER (p[len - 1]);
3229
 
3230
      if (c == 'f')
3231
        {
3232
          len--;
3233
          type = make_builtin_type ("float");
3234
        }
3235
      else if (c == 'l')
3236
        {
3237
          len--;
3238
          type = make_builtin_type ("long double");
3239
        }
3240
      else if (ISDIGIT (c) || c == '.')
3241
        type = make_builtin_type ("double");
3242
      else
3243
        return ERROR;
3244
 
3245
      name = make_name (p, len);
3246
      yylval.comp = fill_comp (literal_type, type, name);
3247
 
3248
      return FLOAT;
3249
    }
3250
 
3251
  /* This treats 0x1 and 1 as different literals.  We also do not
3252
     automatically generate unsigned types.  */
3253
 
3254
  long_p = 0;
3255
  unsigned_p = 0;
3256
  while (len > 0)
3257
    {
3258
      if (p[len - 1] == 'l' || p[len - 1] == 'L')
3259
        {
3260
          len--;
3261
          long_p++;
3262
          continue;
3263
        }
3264
      if (p[len - 1] == 'u' || p[len - 1] == 'U')
3265
        {
3266
          len--;
3267
          unsigned_p++;
3268
          continue;
3269
        }
3270
      break;
3271
    }
3272
 
3273
  if (long_p == 0)
3274
    {
3275
      unsigned_type = make_builtin_type ("unsigned int");
3276
      signed_type = make_builtin_type ("int");
3277
    }
3278
  else if (long_p == 1)
3279
    {
3280
      unsigned_type = make_builtin_type ("unsigned long");
3281
      signed_type = make_builtin_type ("long");
3282
    }
3283
  else
3284
    {
3285
      unsigned_type = make_builtin_type ("unsigned long long");
3286
      signed_type = make_builtin_type ("long long");
3287
    }
3288
 
3289
   if (unsigned_p)
3290
     type = unsigned_type;
3291
   else
3292
     type = signed_type;
3293
 
3294
   name = make_name (p, len);
3295
   yylval.comp = fill_comp (literal_type, type, name);
3296
 
3297
   return INT;
3298
}
3299
 
3300
static char backslashable[] = "abefnrtv";
3301
static char represented[] = "\a\b\e\f\n\r\t\v";
3302
 
3303
/* Translate the backslash the way we would in the host character set.  */
3304
static int
3305
c_parse_backslash (int host_char, int *target_char)
3306
{
3307
  const char *ix;
3308
  ix = strchr (backslashable, host_char);
3309
  if (! ix)
3310
    return 0;
3311
  else
3312
    *target_char = represented[ix - backslashable];
3313
  return 1;
3314
}
3315
 
3316
/* Parse a C escape sequence.  STRING_PTR points to a variable
3317
   containing a pointer to the string to parse.  That pointer
3318
   should point to the character after the \.  That pointer
3319
   is updated past the characters we use.  The value of the
3320
   escape sequence is returned.
3321
 
3322
   A negative value means the sequence \ newline was seen,
3323
   which is supposed to be equivalent to nothing at all.
3324
 
3325
   If \ is followed by a null character, we return a negative
3326
   value and leave the string pointer pointing at the null character.
3327
 
3328
   If \ is followed by 000, we return 0 and leave the string pointer
3329
   after the zeros.  A value of 0 does not mean end of string.  */
3330
 
3331
static int
3332
parse_escape (const char **string_ptr)
3333
{
3334
  int target_char;
3335
  int c = *(*string_ptr)++;
3336
  if (c_parse_backslash (c, &target_char))
3337
    return target_char;
3338
  else
3339
    switch (c)
3340
      {
3341
      case '\n':
3342
        return -2;
3343
      case 0:
3344
        (*string_ptr)--;
3345
        return 0;
3346
      case '^':
3347
        {
3348
          c = *(*string_ptr)++;
3349
 
3350
          if (c == '?')
3351
            return 0177;
3352
          else if (c == '\\')
3353
            target_char = parse_escape (string_ptr);
3354
          else
3355
            target_char = c;
3356
 
3357
          /* Now target_char is something like `c', and we want to find
3358
             its control-character equivalent.  */
3359
          target_char = target_char & 037;
3360
 
3361
          return target_char;
3362
        }
3363
 
3364
      case '0':
3365
      case '1':
3366
      case '2':
3367
      case '3':
3368
      case '4':
3369
      case '5':
3370
      case '6':
3371
      case '7':
3372
        {
3373
          int i = c - '0';
3374
          int count = 0;
3375
          while (++count < 3)
3376
            {
3377
              c = (**string_ptr);
3378
              if (c >= '0' && c <= '7')
3379
                {
3380
                  (*string_ptr)++;
3381
                  i *= 8;
3382
                  i += c - '0';
3383
                }
3384
              else
3385
                {
3386
                  break;
3387
                }
3388
            }
3389
          return i;
3390
        }
3391
      default:
3392
        return c;
3393
      }
3394
}
3395
 
3396
#define HANDLE_SPECIAL(string, comp)                            \
3397
  if (strncmp (tokstart, string, sizeof (string) - 1) == 0)      \
3398
    {                                                           \
3399
      lexptr = tokstart + sizeof (string) - 1;                  \
3400
      yylval.lval = comp;                                       \
3401
      return DEMANGLER_SPECIAL;                                 \
3402
    }
3403
 
3404
#define HANDLE_TOKEN2(string, token)                    \
3405
  if (lexptr[1] == string[1])                           \
3406
    {                                                   \
3407
      lexptr += 2;                                      \
3408
      yylval.opname = string;                           \
3409
      return token;                                     \
3410
    }
3411
 
3412
#define HANDLE_TOKEN3(string, token)                    \
3413
  if (lexptr[1] == string[1] && lexptr[2] == string[2]) \
3414
    {                                                   \
3415
      lexptr += 3;                                      \
3416
      yylval.opname = string;                           \
3417
      return token;                                     \
3418
    }
3419
 
3420
/* Read one token, getting characters through LEXPTR.  */
3421
 
3422
static int
3423
yylex (void)
3424
{
3425
  int c;
3426
  int namelen;
3427
  const char *tokstart, *tokptr;
3428
 
3429
 retry:
3430
  prev_lexptr = lexptr;
3431
  tokstart = lexptr;
3432
 
3433
  switch (c = *tokstart)
3434
    {
3435
    case 0:
3436
      return 0;
3437
 
3438
    case ' ':
3439
    case '\t':
3440
    case '\n':
3441
      lexptr++;
3442
      goto retry;
3443
 
3444
    case '\'':
3445
      /* We either have a character constant ('0' or '\177' for example)
3446
         or we have a quoted symbol reference ('foo(int,int)' in C++
3447
         for example). */
3448
      lexptr++;
3449
      c = *lexptr++;
3450
      if (c == '\\')
3451
        c = parse_escape (&lexptr);
3452
      else if (c == '\'')
3453
        {
3454
          yyerror ("empty character constant");
3455
          return ERROR;
3456
        }
3457
 
3458
      c = *lexptr++;
3459
      if (c != '\'')
3460
        {
3461
          yyerror ("invalid character constant");
3462
          return ERROR;
3463
        }
3464
 
3465
      /* FIXME: We should refer to a canonical form of the character,
3466
         presumably the same one that appears in manglings - the decimal
3467
         representation.  But if that isn't in our input then we have to
3468
         allocate memory for it somewhere.  */
3469
      yylval.comp = fill_comp (DEMANGLE_COMPONENT_LITERAL,
3470
                                 make_builtin_type ("char"),
3471
                                 make_name (tokstart, lexptr - tokstart));
3472
 
3473
      return INT;
3474
 
3475
    case '(':
3476
      if (strncmp (tokstart, "(anonymous namespace)", 21) == 0)
3477
        {
3478
          lexptr += 21;
3479
          yylval.comp = make_name ("(anonymous namespace)",
3480
                                     sizeof "(anonymous namespace)" - 1);
3481
          return NAME;
3482
        }
3483
        /* FALL THROUGH */
3484
 
3485
    case ')':
3486
    case ',':
3487
      lexptr++;
3488
      return c;
3489
 
3490
    case '.':
3491
      if (lexptr[1] == '.' && lexptr[2] == '.')
3492
        {
3493
          lexptr += 3;
3494
          return ELLIPSIS;
3495
        }
3496
 
3497
      /* Might be a floating point number.  */
3498
      if (lexptr[1] < '0' || lexptr[1] > '9')
3499
        goto symbol;            /* Nope, must be a symbol. */
3500
 
3501
      goto try_number;
3502
 
3503
    case '-':
3504
      HANDLE_TOKEN2 ("-=", ASSIGN_MODIFY);
3505
      HANDLE_TOKEN2 ("--", DECREMENT);
3506
      HANDLE_TOKEN2 ("->", ARROW);
3507
 
3508
      /* For construction vtables.  This is kind of hokey.  */
3509
      if (strncmp (tokstart, "-in-", 4) == 0)
3510
        {
3511
          lexptr += 4;
3512
          return CONSTRUCTION_IN;
3513
        }
3514
 
3515
      if (lexptr[1] < '0' || lexptr[1] > '9')
3516
        {
3517
          lexptr++;
3518
          return '-';
3519
        }
3520
      /* FALL THRU into number case.  */
3521
 
3522
    try_number:
3523
    case '0':
3524
    case '1':
3525
    case '2':
3526
    case '3':
3527
    case '4':
3528
    case '5':
3529
    case '6':
3530
    case '7':
3531
    case '8':
3532
    case '9':
3533
      {
3534
        /* It's a number.  */
3535
        int got_dot = 0, got_e = 0, toktype;
3536
        const char *p = tokstart;
3537
        int hex = 0;
3538
 
3539
        if (c == '-')
3540
          p++;
3541
 
3542
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
3543
          {
3544
            p += 2;
3545
            hex = 1;
3546
          }
3547
        else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
3548
          {
3549
            p += 2;
3550
            hex = 0;
3551
          }
3552
 
3553
        for (;; ++p)
3554
          {
3555
            /* This test includes !hex because 'e' is a valid hex digit
3556
               and thus does not indicate a floating point number when
3557
               the radix is hex.  */
3558
            if (!hex && !got_e && (*p == 'e' || *p == 'E'))
3559
              got_dot = got_e = 1;
3560
            /* This test does not include !hex, because a '.' always indicates
3561
               a decimal floating point number regardless of the radix.
3562
 
3563
               NOTE drow/2005-03-09: This comment is not accurate in C99;
3564
               however, it's not clear that all the floating point support
3565
               in this file is doing any good here.  */
3566
            else if (!got_dot && *p == '.')
3567
              got_dot = 1;
3568
            else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
3569
                     && (*p == '-' || *p == '+'))
3570
              /* This is the sign of the exponent, not the end of the
3571
                 number.  */
3572
              continue;
3573
            /* We will take any letters or digits.  parse_number will
3574
               complain if past the radix, or if L or U are not final.  */
3575
            else if (! ISALNUM (*p))
3576
              break;
3577
          }
3578
        toktype = parse_number (tokstart, p - tokstart, got_dot|got_e);
3579
        if (toktype == ERROR)
3580
          {
3581
            char *err_copy = (char *) alloca (p - tokstart + 1);
3582
 
3583
            memcpy (err_copy, tokstart, p - tokstart);
3584
            err_copy[p - tokstart] = 0;
3585
            yyerror ("invalid number");
3586
            return ERROR;
3587
          }
3588
        lexptr = p;
3589
        return toktype;
3590
      }
3591
 
3592
    case '+':
3593
      HANDLE_TOKEN2 ("+=", ASSIGN_MODIFY);
3594
      HANDLE_TOKEN2 ("++", INCREMENT);
3595
      lexptr++;
3596
      return c;
3597
    case '*':
3598
      HANDLE_TOKEN2 ("*=", ASSIGN_MODIFY);
3599
      lexptr++;
3600
      return c;
3601
    case '/':
3602
      HANDLE_TOKEN2 ("/=", ASSIGN_MODIFY);
3603
      lexptr++;
3604
      return c;
3605
    case '%':
3606
      HANDLE_TOKEN2 ("%=", ASSIGN_MODIFY);
3607
      lexptr++;
3608
      return c;
3609
    case '|':
3610
      HANDLE_TOKEN2 ("|=", ASSIGN_MODIFY);
3611
      HANDLE_TOKEN2 ("||", OROR);
3612
      lexptr++;
3613
      return c;
3614
    case '&':
3615
      HANDLE_TOKEN2 ("&=", ASSIGN_MODIFY);
3616
      HANDLE_TOKEN2 ("&&", ANDAND);
3617
      lexptr++;
3618
      return c;
3619
    case '^':
3620
      HANDLE_TOKEN2 ("^=", ASSIGN_MODIFY);
3621
      lexptr++;
3622
      return c;
3623
    case '!':
3624
      HANDLE_TOKEN2 ("!=", NOTEQUAL);
3625
      lexptr++;
3626
      return c;
3627
    case '<':
3628
      HANDLE_TOKEN3 ("<<=", ASSIGN_MODIFY);
3629
      HANDLE_TOKEN2 ("<=", LEQ);
3630
      HANDLE_TOKEN2 ("<<", LSH);
3631
      lexptr++;
3632
      return c;
3633
    case '>':
3634
      HANDLE_TOKEN3 (">>=", ASSIGN_MODIFY);
3635
      HANDLE_TOKEN2 (">=", GEQ);
3636
      HANDLE_TOKEN2 (">>", RSH);
3637
      lexptr++;
3638
      return c;
3639
    case '=':
3640
      HANDLE_TOKEN2 ("==", EQUAL);
3641
      lexptr++;
3642
      return c;
3643
    case ':':
3644
      HANDLE_TOKEN2 ("::", COLONCOLON);
3645
      lexptr++;
3646
      return c;
3647
 
3648
    case '[':
3649
    case ']':
3650
    case '?':
3651
    case '@':
3652
    case '~':
3653
    case '{':
3654
    case '}':
3655
    symbol:
3656
      lexptr++;
3657
      return c;
3658
 
3659
    case '"':
3660
      /* These can't occur in C++ names.  */
3661
      yyerror ("unexpected string literal");
3662
      return ERROR;
3663
    }
3664
 
3665
  if (!(c == '_' || c == '$' || ISALPHA (c)))
3666
    {
3667
      /* We must have come across a bad character (e.g. ';').  */
3668
      yyerror ("invalid character");
3669
      return ERROR;
3670
    }
3671
 
3672
  /* It's a name.  See how long it is.  */
3673
  namelen = 0;
3674
  do
3675
    c = tokstart[++namelen];
3676
  while (ISALNUM (c) || c == '_' || c == '$');
3677
 
3678
  lexptr += namelen;
3679
 
3680
  /* Catch specific keywords.  Notice that some of the keywords contain
3681
     spaces, and are sorted by the length of the first word.  They must
3682
     all include a trailing space in the string comparison.  */
3683
  switch (namelen)
3684
    {
3685
    case 16:
3686
      if (strncmp (tokstart, "reinterpret_cast", 16) == 0)
3687
        return REINTERPRET_CAST;
3688
      break;
3689
    case 12:
3690
      if (strncmp (tokstart, "construction vtable for ", 24) == 0)
3691
        {
3692
          lexptr = tokstart + 24;
3693
          return CONSTRUCTION_VTABLE;
3694
        }
3695
      if (strncmp (tokstart, "dynamic_cast", 12) == 0)
3696
        return DYNAMIC_CAST;
3697
      break;
3698
    case 11:
3699
      if (strncmp (tokstart, "static_cast", 11) == 0)
3700
        return STATIC_CAST;
3701
      break;
3702
    case 9:
3703
      HANDLE_SPECIAL ("covariant return thunk to ", DEMANGLE_COMPONENT_COVARIANT_THUNK);
3704
      HANDLE_SPECIAL ("reference temporary for ", DEMANGLE_COMPONENT_REFTEMP);
3705
      break;
3706
    case 8:
3707
      HANDLE_SPECIAL ("typeinfo for ", DEMANGLE_COMPONENT_TYPEINFO);
3708
      HANDLE_SPECIAL ("typeinfo fn for ", DEMANGLE_COMPONENT_TYPEINFO_FN);
3709
      HANDLE_SPECIAL ("typeinfo name for ", DEMANGLE_COMPONENT_TYPEINFO_NAME);
3710
      if (strncmp (tokstart, "operator", 8) == 0)
3711
        return OPERATOR;
3712
      if (strncmp (tokstart, "restrict", 8) == 0)
3713
        return RESTRICT;
3714
      if (strncmp (tokstart, "unsigned", 8) == 0)
3715
        return UNSIGNED;
3716
      if (strncmp (tokstart, "template", 8) == 0)
3717
        return TEMPLATE;
3718
      if (strncmp (tokstart, "volatile", 8) == 0)
3719
        return VOLATILE_KEYWORD;
3720
      break;
3721
    case 7:
3722
      HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK);
3723
      if (strncmp (tokstart, "wchar_t", 7) == 0)
3724
        return WCHAR_T;
3725
      break;
3726
    case 6:
3727
      if (strncmp (tokstart, "global constructors keyed to ", 29) == 0)
3728
        {
3729
          const char *p;
3730
          lexptr = tokstart + 29;
3731
          yylval.typed_val_int.val = GLOBAL_CONSTRUCTORS;
3732
          /* Find the end of the symbol.  */
3733
          p = symbol_end (lexptr);
3734
          yylval.typed_val_int.type = make_name (lexptr, p - lexptr);
3735
          lexptr = p;
3736
          return GLOBAL;
3737
        }
3738
      if (strncmp (tokstart, "global destructors keyed to ", 28) == 0)
3739
        {
3740
          const char *p;
3741
          lexptr = tokstart + 28;
3742
          yylval.typed_val_int.val = GLOBAL_DESTRUCTORS;
3743
          /* Find the end of the symbol.  */
3744
          p = symbol_end (lexptr);
3745
          yylval.typed_val_int.type = make_name (lexptr, p - lexptr);
3746
          lexptr = p;
3747
          return GLOBAL;
3748
        }
3749
 
3750
      HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE);
3751
      if (strncmp (tokstart, "delete", 6) == 0)
3752
        return DELETE;
3753
      if (strncmp (tokstart, "struct", 6) == 0)
3754
        return STRUCT;
3755
      if (strncmp (tokstart, "signed", 6) == 0)
3756
        return SIGNED_KEYWORD;
3757
      if (strncmp (tokstart, "sizeof", 6) == 0)
3758
        return SIZEOF;
3759
      if (strncmp (tokstart, "double", 6) == 0)
3760
        return DOUBLE_KEYWORD;
3761
      break;
3762
    case 5:
3763
      HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD);
3764
      if (strncmp (tokstart, "false", 5) == 0)
3765
        return FALSEKEYWORD;
3766
      if (strncmp (tokstart, "class", 5) == 0)
3767
        return CLASS;
3768
      if (strncmp (tokstart, "union", 5) == 0)
3769
        return UNION;
3770
      if (strncmp (tokstart, "float", 5) == 0)
3771
        return FLOAT_KEYWORD;
3772
      if (strncmp (tokstart, "short", 5) == 0)
3773
        return SHORT;
3774
      if (strncmp (tokstart, "const", 5) == 0)
3775
        return CONST_KEYWORD;
3776
      break;
3777
    case 4:
3778
      if (strncmp (tokstart, "void", 4) == 0)
3779
        return VOID;
3780
      if (strncmp (tokstart, "bool", 4) == 0)
3781
        return BOOL;
3782
      if (strncmp (tokstart, "char", 4) == 0)
3783
        return CHAR;
3784
      if (strncmp (tokstart, "enum", 4) == 0)
3785
        return ENUM;
3786
      if (strncmp (tokstart, "long", 4) == 0)
3787
        return LONG;
3788
      if (strncmp (tokstart, "true", 4) == 0)
3789
        return TRUEKEYWORD;
3790
      break;
3791
    case 3:
3792
      HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT);
3793
      HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK);
3794
      if (strncmp (tokstart, "new", 3) == 0)
3795
        return NEW;
3796
      if (strncmp (tokstart, "int", 3) == 0)
3797
        return INT_KEYWORD;
3798
      break;
3799
    default:
3800
      break;
3801
    }
3802
 
3803
  yylval.comp = make_name (tokstart, namelen);
3804
  return NAME;
3805
}
3806
 
3807
static void
3808
yyerror (char *msg)
3809
{
3810
  if (global_errmsg)
3811
    return;
3812
 
3813
  error_lexptr = prev_lexptr;
3814
  global_errmsg = msg ? msg : "parse error";
3815
}
3816
 
3817
/* Allocate a chunk of the components we'll need to build a tree.  We
3818
   generally allocate too many components, but the extra memory usage
3819
   doesn't hurt because the trees are temporary and the storage is
3820
   reused.  More may be allocated later, by d_grab.  */
3821
static void
3822
allocate_info (void)
3823
{
3824
  if (demangle_info == NULL)
3825
    {
3826
      demangle_info = xmalloc (sizeof (struct demangle_info));
3827
      demangle_info->prev = NULL;
3828
      demangle_info->next = NULL;
3829
    }
3830
  else
3831
    while (demangle_info->prev)
3832
      demangle_info = demangle_info->prev;
3833
 
3834
  demangle_info->used = 0;
3835
}
3836
 
3837
/* Convert RESULT to a string.  The return value is allocated
3838
   using xmalloc.  ESTIMATED_LEN is used only as a guide to the
3839
   length of the result.  This functions handles a few cases that
3840
   cplus_demangle_print does not, specifically the global destructor
3841
   and constructor labels.  */
3842
 
3843
char *
3844
cp_comp_to_string (struct demangle_component *result, int estimated_len)
3845
{
3846
  char *str, *prefix = NULL, *buf;
3847
  size_t err = 0;
3848
 
3849
  if (result->type == GLOBAL_DESTRUCTORS)
3850
    {
3851
      result = d_left (result);
3852
      prefix = "global destructors keyed to ";
3853
    }
3854
  else if (result->type == GLOBAL_CONSTRUCTORS)
3855
    {
3856
      result = d_left (result);
3857
      prefix = "global constructors keyed to ";
3858
    }
3859
 
3860
  str = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, estimated_len, &err);
3861
  if (str == NULL)
3862
    return NULL;
3863
 
3864
  if (prefix == NULL)
3865
    return str;
3866
 
3867
  buf = xmalloc (strlen (str) + strlen (prefix) + 1);
3868
  strcpy (buf, prefix);
3869
  strcat (buf, str);
3870
  free (str);
3871
  return (buf);
3872
}
3873
 
3874
/* Convert a demangled name to a demangle_component tree.  On success,
3875
   the root of the new tree is returned; it is valid until the next
3876
   call to this function and should not be freed.  On error, NULL is
3877
   returned, and an error message will be set in *ERRMSG (which does
3878
   not need to be freed).  */
3879
 
3880
struct demangle_component *
3881
cp_demangled_name_to_comp (const char *demangled_name, const char **errmsg)
3882
{
3883
  static char errbuf[60];
3884
  struct demangle_component *result;
3885
 
3886
  prev_lexptr = lexptr = demangled_name;
3887
  error_lexptr = NULL;
3888
  global_errmsg = NULL;
3889
 
3890
  allocate_info ();
3891
 
3892
  if (yyparse ())
3893
    {
3894
      if (global_errmsg && errmsg)
3895
        {
3896
          snprintf (errbuf, sizeof (errbuf) - 2, "%s, near `%s",
3897
                    global_errmsg, error_lexptr);
3898
          strcat (errbuf, "'");
3899
          *errmsg = errbuf;
3900
        }
3901
      return NULL;
3902
    }
3903
 
3904
  result = global_result;
3905
  global_result = NULL;
3906
 
3907
  return result;
3908
}
3909
 
3910
#ifdef TEST_CPNAMES
3911
 
3912
static void
3913
cp_print (struct demangle_component *result)
3914
{
3915
  char *str;
3916
  size_t err = 0;
3917
 
3918
  if (result->type == GLOBAL_DESTRUCTORS)
3919
    {
3920
      result = d_left (result);
3921
      fputs ("global destructors keyed to ", stdout);
3922
    }
3923
  else if (result->type == GLOBAL_CONSTRUCTORS)
3924
    {
3925
      result = d_left (result);
3926
      fputs ("global constructors keyed to ", stdout);
3927
    }
3928
 
3929
  str = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, 64, &err);
3930
  if (str == NULL)
3931
    return;
3932
 
3933
  fputs (str, stdout);
3934
 
3935
  free (str);
3936
}
3937
 
3938
static char
3939
trim_chars (char *lexptr, char **extra_chars)
3940
{
3941
  char *p = (char *) symbol_end (lexptr);
3942
  char c = 0;
3943
 
3944
  if (*p)
3945
    {
3946
      c = *p;
3947
      *p = 0;
3948
      *extra_chars = p + 1;
3949
    }
3950
 
3951
  return c;
3952
}
3953
 
3954
int
3955
main (int argc, char **argv)
3956
{
3957
  char *str2, *extra_chars = "", c;
3958
  char buf[65536];
3959
  int arg;
3960
  const char *errmsg;
3961
  struct demangle_component *result;
3962
 
3963
  arg = 1;
3964
  if (argv[arg] && strcmp (argv[arg], "--debug") == 0)
3965
    {
3966
      yydebug = 1;
3967
      arg++;
3968
    }
3969
 
3970
  if (argv[arg] == NULL)
3971
    while (fgets (buf, 65536, stdin) != NULL)
3972
      {
3973
        int len;
3974
        buf[strlen (buf) - 1] = 0;
3975
        /* Use DMGL_VERBOSE to get expanded standard substitutions.  */
3976
        c = trim_chars (buf, &extra_chars);
3977
        str2 = cplus_demangle (buf, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE);
3978
        if (str2 == NULL)
3979
          {
3980
            /* printf ("Demangling error\n"); */
3981
            if (c)
3982
              printf ("%s%c%s\n", buf, c, extra_chars);
3983
            else
3984
              printf ("%s\n", buf);
3985
            continue;
3986
          }
3987
        result = cp_demangled_name_to_comp (str2, &errmsg);
3988
        if (result == NULL)
3989
          {
3990
            fputs (errmsg, stderr);
3991
            fputc ('\n', stderr);
3992
            continue;
3993
          }
3994
 
3995
        cp_print (result);
3996
 
3997
        free (str2);
3998
        if (c)
3999
          {
4000
            putchar (c);
4001
            fputs (extra_chars, stdout);
4002
          }
4003
        putchar ('\n');
4004
      }
4005
  else
4006
    {
4007
      result = cp_demangled_name_to_comp (argv[arg], &errmsg);
4008
      if (result == NULL)
4009
        {
4010
          fputs (errmsg, stderr);
4011
          fputc ('\n', stderr);
4012
          return 0;
4013
        }
4014
      cp_print (result);
4015
      putchar ('\n');
4016
    }
4017
  return 0;
4018
}
4019
 
4020
#endif
4021
 
4022
 

powered by: WebSVN 2.1.0

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