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