1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
72 REINTERPRET_CAST
= 274,
79 VOLATILE_KEYWORD
= 281,
91 DEMANGLER_SPECIAL
= 293,
92 CONSTRUCTION_VTABLE
= 294,
93 CONSTRUCTION_IN
= 295,
118 #define COLONCOLON 267
124 #define STATIC_CAST 273
125 #define REINTERPRET_CAST 274
126 #define DYNAMIC_CAST 275
127 #define SIGNED_KEYWORD 276
130 #define INT_KEYWORD 279
131 #define CONST_KEYWORD 280
132 #define VOLATILE_KEYWORD 281
133 #define DOUBLE_KEYWORD 282
138 #define FLOAT_KEYWORD 287
141 #define ASSIGN_MODIFY 290
142 #define TRUEKEYWORD 291
143 #define FALSEKEYWORD 292
144 #define DEMANGLER_SPECIAL 293
145 #define CONSTRUCTION_VTABLE 294
146 #define CONSTRUCTION_IN 295
156 #define DECREMENT 305
157 #define INCREMENT 306
164 /* Copy the first part of user declarations. */
165 #line 33 "cp-name-parser.y"
173 #include "safe-ctype.h"
174 #include "libiberty.h"
175 #include "demangle.h"
177 /* Bison does not make it easy to create a parser without global
178 state, unfortunately. Here are all the global variables used
181 /* LEXPTR is the current pointer into our lex buffer. PREV_LEXPTR
182 is the start of the last token lexed, only used for diagnostics.
183 ERROR_LEXPTR is the first place an error occurred. GLOBAL_ERRMSG
184 is the first error message encountered. */
186 static const char *lexptr
, *prev_lexptr
, *error_lexptr
, *global_errmsg
;
188 /* The components built by the parser are allocated ahead of time,
189 and cached in this structure. */
191 struct demangle_info
{
193 struct demangle_component comps
[1];
196 static struct demangle_info
*demangle_info
;
197 #define d_grab() (&demangle_info->comps[demangle_info->used++])
199 /* The parse tree created by the parser is stored here after a successful
202 static struct demangle_component
*global_result
;
204 /* Prototypes for helper functions used when constructing the parse
207 static struct demangle_component
*d_qualify (struct demangle_component
*, int,
210 static struct demangle_component
*d_int_type (int);
212 static struct demangle_component
*d_unary (const char *,
213 struct demangle_component
*);
214 static struct demangle_component
*d_binary (const char *,
215 struct demangle_component
*,
216 struct demangle_component
*);
218 /* Flags passed to d_qualify. */
221 #define QUAL_RESTRICT 2
222 #define QUAL_VOLATILE 4
224 /* Flags passed to d_int_type. */
226 #define INT_CHAR (1 << 0)
227 #define INT_SHORT (1 << 1)
228 #define INT_LONG (1 << 2)
229 #define INT_LLONG (1 << 3)
231 #define INT_SIGNED (1 << 4)
232 #define INT_UNSIGNED (1 << 5)
234 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
235 as well as gratuitiously global symbol names, so we can have multiple
236 yacc generated parsers in gdb. Note that these are only the variables
237 produced by yacc. If other parser generators (bison, byacc, etc) produce
238 additional global names that conflict at link time, then those parser
239 generators need to be fixed instead of adding those names to this list. */
241 #define yymaxdepth cpname_maxdepth
242 #define yyparse cpname_parse
243 #define yylex cpname_lex
244 #define yyerror cpname_error
245 #define yylval cpname_lval
246 #define yychar cpname_char
247 #define yydebug cpname_debug
248 #define yypact cpname_pact
249 #define yyr1 cpname_r1
250 #define yyr2 cpname_r2
251 #define yydef cpname_def
252 #define yychk cpname_chk
253 #define yypgo cpname_pgo
254 #define yyact cpname_act
255 #define yyexca cpname_exca
256 #define yyerrflag cpname_errflag
257 #define yynerrs cpname_nerrs
258 #define yyps cpname_ps
259 #define yypv cpname_pv
261 #define yy_yys cpname_yys
262 #define yystate cpname_state
263 #define yytmp cpname_tmp
265 #define yy_yyv cpname_yyv
266 #define yyval cpname_val
267 #define yylloc cpname_lloc
268 #define yyreds cpname_reds /* With YYDEBUG defined */
269 #define yytoks cpname_toks /* With YYDEBUG defined */
270 #define yyname cpname_name /* With YYDEBUG defined */
271 #define yyrule cpname_rule /* With YYDEBUG defined */
272 #define yylhs cpname_yylhs
273 #define yylen cpname_yylen
274 #define yydefred cpname_yydefred
275 #define yydgoto cpname_yydgoto
276 #define yysindex cpname_yysindex
277 #define yyrindex cpname_yyrindex
278 #define yygindex cpname_yygindex
279 #define yytable cpname_yytable
280 #define yycheck cpname_yycheck
283 static int yylex (void);
284 static void yyerror (char *);
286 /* Enable yydebug for the stand-alone parser. */
291 /* Helper functions. These wrap the demangler tree interface, handle
292 allocation from our global store, and return the allocated component. */
294 static struct demangle_component
*
295 fill_comp (enum demangle_component_type d_type
, struct demangle_component
*lhs
,
296 struct demangle_component
*rhs
)
298 struct demangle_component
*ret
= d_grab ();
299 cplus_demangle_fill_component (ret
, d_type
, lhs
, rhs
);
303 static struct demangle_component
*
304 make_empty (enum demangle_component_type d_type
)
306 struct demangle_component
*ret
= d_grab ();
311 static struct demangle_component
*
312 make_operator (const char *name
, int args
)
314 struct demangle_component
*ret
= d_grab ();
315 cplus_demangle_fill_operator (ret
, name
, args
);
319 static struct demangle_component
*
320 make_dtor (enum gnu_v3_dtor_kinds kind
, struct demangle_component
*name
)
322 struct demangle_component
*ret
= d_grab ();
323 cplus_demangle_fill_dtor (ret
, kind
, name
);
327 static struct demangle_component
*
328 make_builtin_type (const char *name
)
330 struct demangle_component
*ret
= d_grab ();
331 cplus_demangle_fill_builtin_type (ret
, name
);
335 static struct demangle_component
*
336 make_name (const char *name
, int len
)
338 struct demangle_component
*ret
= d_grab ();
339 cplus_demangle_fill_name (ret
, name
, len
);
343 #define d_left(dc) (dc)->u.s_binary.left
344 #define d_right(dc) (dc)->u.s_binary.right
348 /* Enabling traces. */
353 /* Enabling verbose error messages. */
354 #ifdef YYERROR_VERBOSE
355 # undef YYERROR_VERBOSE
356 # define YYERROR_VERBOSE 1
358 # define YYERROR_VERBOSE 0
361 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
362 #line 216 "cp-name-parser.y"
363 typedef union YYSTYPE
{
364 struct demangle_component
*comp
;
366 struct demangle_component
*comp
;
367 struct demangle_component
**last
;
370 struct demangle_component
*comp
, *last
;
373 struct demangle_component
*comp
, **last
;
375 struct demangle_component
*start
;
381 struct demangle_component
*type
;
385 /* Line 191 of yacc.c. */
386 #line 387 "cp-name-parser.c.tmp"
387 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
388 # define YYSTYPE_IS_DECLARED 1
389 # define YYSTYPE_IS_TRIVIAL 1
394 /* Copy the second part of user declarations. */
395 #line 292 "cp-name-parser.y"
398 GLOBAL_CONSTRUCTORS
= DEMANGLE_COMPONENT_LITERAL
+ 20,
399 GLOBAL_DESTRUCTORS
= DEMANGLE_COMPONENT_LITERAL
+ 21
403 /* Line 214 of yacc.c. */
404 #line 405 "cp-name-parser.c.tmp"
406 #if ! defined (yyoverflow) || YYERROR_VERBOSE
412 # define YYMALLOC xmalloc
415 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
417 # ifdef YYSTACK_USE_ALLOCA
418 # if YYSTACK_USE_ALLOCA
419 # define YYSTACK_ALLOC alloca
422 # if defined (alloca) || defined (_ALLOCA_H)
423 # define YYSTACK_ALLOC alloca
426 # define YYSTACK_ALLOC __builtin_alloca
431 # ifdef YYSTACK_ALLOC
432 /* Pacify GCC's `empty if-body' warning. */
433 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
435 # if defined (__STDC__) || defined (__cplusplus)
436 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
437 # define YYSIZE_T size_t
439 # define YYSTACK_ALLOC YYMALLOC
440 # define YYSTACK_FREE YYFREE
442 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
445 #if (! defined (yyoverflow) \
446 && (! defined (__cplusplus) \
447 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
449 /* A type that is properly aligned for any stack member. */
456 /* The size of the maximum gap between one aligned stack and the next. */
457 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
459 /* The size of an array large to enough to hold all stacks, each with
461 # define YYSTACK_BYTES(N) \
462 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
463 + YYSTACK_GAP_MAXIMUM)
465 /* Copy COUNT objects from FROM to TO. The source and destination do
468 # if defined (__GNUC__) && 1 < __GNUC__
469 # define YYCOPY(To, From, Count) \
470 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
472 # define YYCOPY(To, From, Count) \
475 register YYSIZE_T yyi; \
476 for (yyi = 0; yyi < (Count); yyi++) \
477 (To)[yyi] = (From)[yyi]; \
483 /* Relocate STACK from its old location to the new one. The
484 local variables YYSIZE and YYSTACKSIZE give the old and new number of
485 elements in the stack, and YYPTR gives the new location of the
486 stack. Advance YYPTR to a properly aligned location for the next
488 # define YYSTACK_RELOCATE(Stack) \
491 YYSIZE_T yynewbytes; \
492 YYCOPY (&yyptr->Stack, Stack, yysize); \
493 Stack = &yyptr->Stack; \
494 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
495 yyptr += yynewbytes / sizeof (*yyptr); \
501 #if defined (__STDC__) || defined (__cplusplus)
502 typedef signed char yysigned_char
;
504 typedef short yysigned_char
;
507 /* YYFINAL -- State number of the termination state. */
509 /* YYLAST -- Last index in YYTABLE. */
512 /* YYNTOKENS -- Number of terminals. */
514 /* YYNNTS -- Number of nonterminals. */
516 /* YYNRULES -- Number of rules. */
518 /* YYNRULES -- Number of states. */
519 #define YYNSTATES 330
521 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
523 #define YYMAXUTOK 308
525 #define YYTRANSLATE(YYX) \
526 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
528 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
529 static const unsigned char yytranslate
[] =
531 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 73, 2, 2, 2, 64, 50, 2,
535 74, 42, 62, 60, 43, 61, 68, 63, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 75, 2,
537 53, 44, 54, 45, 59, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 69, 2, 71, 49, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 48, 2, 72, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
557 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
558 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
559 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
560 35, 36, 37, 38, 39, 40, 41, 46, 47, 51,
561 52, 55, 56, 57, 58, 65, 66, 67, 70
565 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
567 static const unsigned short yyprhs
[] =
569 0, 0, 3, 5, 7, 9, 11, 12, 15, 18,
570 22, 26, 29, 32, 35, 40, 42, 45, 48, 53,
571 58, 61, 64, 67, 70, 73, 76, 79, 82, 85,
572 88, 91, 94, 97, 100, 103, 106, 109, 112, 115,
573 118, 121, 124, 127, 130, 133, 137, 140, 144, 148,
574 151, 154, 156, 160, 163, 165, 170, 173, 175, 178,
575 181, 183, 186, 188, 190, 192, 194, 197, 200, 202,
576 205, 209, 212, 216, 221, 223, 227, 229, 232, 235,
577 240, 242, 244, 247, 251, 256, 260, 265, 270, 274,
578 275, 277, 279, 281, 283, 285, 288, 290, 292, 294,
579 296, 298, 300, 302, 305, 307, 309, 311, 314, 316,
580 318, 320, 323, 325, 329, 334, 337, 341, 344, 346,
581 350, 353, 356, 358, 362, 365, 369, 372, 377, 381,
582 383, 386, 388, 392, 395, 398, 400, 402, 405, 407,
583 412, 415, 417, 420, 423, 425, 429, 432, 435, 437,
584 440, 442, 444, 449, 454, 459, 462, 465, 468, 471,
585 475, 477, 481, 484, 487, 490, 493, 498, 506, 514,
586 522, 527, 531, 535, 539, 543, 547, 551, 555, 559,
587 563, 567, 571, 575, 579, 583, 587, 591, 595, 599,
588 603, 609, 611, 613, 618, 620
591 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
592 static const yysigned_char yyrhs
[] =
594 77, 0, -1, 78, -1, 109, -1, 81, -1, 80,
595 -1, -1, 12, 78, -1, 105, 112, -1, 105, 96,
596 79, -1, 89, 96, 79, -1, 84, 79, -1, 84,
597 108, -1, 38, 78, -1, 39, 78, 40, 78, -1,
598 41, -1, 17, 15, -1, 17, 16, -1, 17, 15,
599 69, 71, -1, 17, 16, 69, 71, -1, 17, 60,
600 -1, 17, 61, -1, 17, 62, -1, 17, 63, -1,
601 17, 64, -1, 17, 49, -1, 17, 50, -1, 17,
602 48, -1, 17, 72, -1, 17, 73, -1, 17, 44,
603 -1, 17, 53, -1, 17, 54, -1, 17, 35, -1,
604 17, 58, -1, 17, 57, -1, 17, 52, -1, 17,
605 51, -1, 17, 56, -1, 17, 55, -1, 17, 47,
606 -1, 17, 46, -1, 17, 66, -1, 17, 65, -1,
607 17, 43, -1, 17, 70, 62, -1, 17, 70, -1,
608 17, 74, 42, -1, 17, 69, 71, -1, 17, 105,
609 -1, 91, 83, -1, 83, -1, 12, 91, 83, -1,
610 12, 83, -1, 82, -1, 82, 53, 93, 54, -1,
611 72, 5, -1, 87, -1, 12, 87, -1, 91, 5,
612 -1, 5, -1, 91, 92, -1, 92, -1, 86, -1,
613 89, -1, 90, -1, 12, 90, -1, 91, 85, -1,
614 85, -1, 5, 12, -1, 91, 5, 12, -1, 92,
615 12, -1, 91, 92, 12, -1, 5, 53, 93, 54,
616 -1, 94, -1, 93, 43, 94, -1, 105, -1, 105,
617 106, -1, 50, 78, -1, 50, 74, 78, 42, -1,
618 114, -1, 105, -1, 105, 106, -1, 95, 43, 105,
619 -1, 95, 43, 105, 106, -1, 95, 43, 29, -1,
620 74, 95, 42, 97, -1, 74, 31, 42, 97, -1,
621 74, 42, 97, -1, -1, 99, -1, 30, -1, 26,
622 -1, 25, -1, 98, -1, 98, 99, -1, 24, -1,
623 21, -1, 11, -1, 33, -1, 22, -1, 23, -1,
624 100, -1, 101, 100, -1, 101, -1, 32, -1, 27,
625 -1, 22, 27, -1, 28, -1, 34, -1, 31, -1,
626 62, 97, -1, 50, -1, 91, 62, 97, -1, 12,
627 91, 62, 97, -1, 69, 71, -1, 69, 3, 71,
628 -1, 102, 99, -1, 102, -1, 99, 102, 99, -1,
629 99, 102, -1, 87, 99, -1, 87, -1, 99, 87,
630 99, -1, 99, 87, -1, 12, 87, 99, -1, 12,
631 87, -1, 99, 12, 87, 99, -1, 99, 12, 87,
632 -1, 103, -1, 103, 106, -1, 107, -1, 74, 106,
633 42, -1, 107, 96, -1, 107, 104, -1, 104, -1,
634 103, -1, 103, 108, -1, 107, -1, 107, 96, 12,
635 78, -1, 96, 79, -1, 105, -1, 105, 106, -1,
636 103, 110, -1, 111, -1, 74, 110, 42, -1, 111,
637 96, -1, 111, 104, -1, 88, -1, 103, 112, -1,
638 88, -1, 113, -1, 88, 96, 12, 78, -1, 113,
639 96, 12, 78, -1, 74, 103, 110, 42, -1, 113,
640 96, -1, 113, 104, -1, 88, 96, -1, 88, 104,
641 -1, 74, 115, 42, -1, 114, -1, 114, 54, 114,
642 -1, 50, 78, -1, 61, 114, -1, 73, 114, -1,
643 72, 114, -1, 74, 109, 42, 114, -1, 18, 53,
644 109, 54, 74, 115, 42, -1, 20, 53, 109, 54,
645 74, 115, 42, -1, 19, 53, 109, 54, 74, 115,
646 42, -1, 105, 74, 115, 42, -1, 114, 62, 114,
647 -1, 114, 63, 114, -1, 114, 64, 114, -1, 114,
648 60, 114, -1, 114, 61, 114, -1, 114, 58, 114,
649 -1, 114, 57, 114, -1, 114, 52, 114, -1, 114,
650 51, 114, -1, 114, 56, 114, -1, 114, 55, 114,
651 -1, 114, 53, 114, -1, 114, 50, 114, -1, 114,
652 49, 114, -1, 114, 48, 114, -1, 114, 47, 114,
653 -1, 114, 46, 114, -1, 114, 70, 5, -1, 114,
654 68, 5, -1, 114, 45, 114, 75, 114, -1, 3,
655 -1, 4, -1, 10, 74, 109, 42, -1, 36, -1,
659 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
660 static const unsigned short yyrline
[] =
662 0, 342, 342, 346, 348, 350, 355, 356, 363, 372,
663 375, 379, 382, 401, 405, 407, 413, 415, 417, 419,
664 421, 423, 425, 427, 429, 431, 433, 435, 437, 439,
665 441, 443, 445, 447, 449, 451, 453, 455, 457, 459,
666 461, 463, 465, 467, 469, 471, 473, 475, 477, 485,
667 490, 495, 499, 504, 512, 513, 515, 527, 528, 534,
668 536, 537, 539, 542, 543, 546, 547, 551, 553, 556,
669 562, 569, 575, 586, 590, 593, 604, 605, 609, 611,
670 613, 616, 620, 625, 630, 636, 646, 650, 654, 662,
671 663, 666, 668, 670, 674, 675, 682, 684, 686, 688,
672 690, 692, 696, 697, 701, 703, 705, 707, 709, 711,
673 713, 717, 723, 727, 735, 745, 749, 765, 767, 768,
674 770, 773, 775, 776, 778, 781, 783, 785, 787, 792,
675 795, 800, 807, 811, 822, 828, 846, 849, 857, 859,
676 870, 877, 878, 884, 888, 892, 894, 899, 904, 917,
677 921, 926, 934, 939, 948, 952, 957, 962, 966, 972,
678 978, 981, 988, 993, 997, 1001, 1008, 1024, 1031, 1038,
679 1051, 1062, 1066, 1070, 1074, 1078, 1082, 1086, 1090, 1094,
680 1098, 1102, 1106, 1110, 1114, 1118, 1122, 1126, 1131, 1135,
681 1139, 1146, 1150, 1153, 1158, 1167
685 #if YYDEBUG || YYERROR_VERBOSE
686 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
687 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
688 static const char *const yytname
[] =
690 "$end", "error", "$undefined", "INT", "FLOAT", "NAME", "STRUCT",
691 "CLASS", "UNION", "ENUM", "SIZEOF", "UNSIGNED", "COLONCOLON", "TEMPLATE",
692 "ERROR", "NEW", "DELETE", "OPERATOR", "STATIC_CAST", "REINTERPRET_CAST",
693 "DYNAMIC_CAST", "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD",
694 "CONST_KEYWORD", "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "BOOL",
695 "ELLIPSIS", "RESTRICT", "VOID", "FLOAT_KEYWORD", "CHAR", "WCHAR_T",
696 "ASSIGN_MODIFY", "TRUEKEYWORD", "FALSEKEYWORD", "DEMANGLER_SPECIAL",
697 "CONSTRUCTION_VTABLE", "CONSTRUCTION_IN", "GLOBAL", "')'", "','", "'='",
698 "'?'", "OROR", "ANDAND", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'",
699 "'>'", "GEQ", "LEQ", "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'",
700 "'%'", "DECREMENT", "INCREMENT", "UNARY", "'.'", "'['", "ARROW", "']'",
701 "'~'", "'!'", "'('", "':'", "$accept", "result", "start", "start_opt",
702 "function", "demangler_special", "operator", "conversion_op",
703 "conversion_op_name", "unqualified_name", "colon_name", "name",
704 "colon_ext_name", "colon_ext_only", "ext_only_name", "nested_name",
705 "template", "template_params", "template_arg", "function_args",
706 "function_arglist", "qualifiers_opt", "qualifier", "qualifiers",
707 "int_part", "int_seq", "builtin_type", "ptr_operator", "array_indicator",
708 "typespec_2", "abstract_declarator", "direct_abstract_declarator",
709 "abstract_declarator_fn", "type", "declarator", "direct_declarator",
710 "declarator_1", "direct_declarator_1", "exp", "exp1", 0
715 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
717 static const unsigned short yytoknum
[] =
719 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
720 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
721 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
722 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
723 295, 296, 41, 44, 61, 63, 297, 298, 124, 94,
724 38, 299, 300, 60, 62, 301, 302, 303, 304, 64,
725 43, 45, 42, 47, 37, 305, 306, 307, 46, 91,
726 308, 93, 126, 33, 40, 58
730 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
731 static const unsigned char yyr1
[] =
733 0, 76, 77, 78, 78, 78, 79, 79, 80, 80,
734 80, 80, 80, 81, 81, 81, 82, 82, 82, 82,
735 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
736 82, 82, 82, 82, 82, 82, 82, 82, 82, 82,
737 82, 82, 82, 82, 82, 82, 82, 82, 82, 83,
738 84, 84, 84, 84, 85, 85, 85, 86, 86, 87,
739 87, 87, 87, 88, 88, 89, 89, 90, 90, 91,
740 91, 91, 91, 92, 93, 93, 94, 94, 94, 94,
741 94, 95, 95, 95, 95, 95, 96, 96, 96, 97,
742 97, 98, 98, 98, 99, 99, 100, 100, 100, 100,
743 100, 100, 101, 101, 102, 102, 102, 102, 102, 102,
744 102, 103, 103, 103, 103, 104, 104, 105, 105, 105,
745 105, 105, 105, 105, 105, 105, 105, 105, 105, 106,
746 106, 106, 107, 107, 107, 107, 108, 108, 108, 108,
747 108, 109, 109, 110, 110, 111, 111, 111, 111, 112,
748 112, 112, 112, 112, 113, 113, 113, 113, 113, 114,
749 115, 115, 115, 114, 114, 114, 114, 114, 114, 114,
750 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
751 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
752 114, 114, 114, 114, 114, 114
755 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
756 static const unsigned char yyr2
[] =
758 0, 2, 1, 1, 1, 1, 0, 2, 2, 3,
759 3, 2, 2, 2, 4, 1, 2, 2, 4, 4,
760 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
761 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
762 2, 2, 2, 2, 2, 3, 2, 3, 3, 2,
763 2, 1, 3, 2, 1, 4, 2, 1, 2, 2,
764 1, 2, 1, 1, 1, 1, 2, 2, 1, 2,
765 3, 2, 3, 4, 1, 3, 1, 2, 2, 4,
766 1, 1, 2, 3, 4, 3, 4, 4, 3, 0,
767 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
768 1, 1, 1, 2, 1, 1, 1, 2, 1, 1,
769 1, 2, 1, 3, 4, 2, 3, 2, 1, 3,
770 2, 2, 1, 3, 2, 3, 2, 4, 3, 1,
771 2, 1, 3, 2, 2, 1, 1, 2, 1, 4,
772 2, 1, 2, 2, 1, 3, 2, 2, 1, 2,
773 1, 1, 4, 4, 4, 2, 2, 2, 2, 3,
774 1, 3, 2, 2, 2, 2, 4, 7, 7, 7,
775 4, 3, 3, 3, 3, 3, 3, 3, 3, 3,
776 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
780 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
781 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
782 means the default is an error. */
783 static const unsigned char yydefact
[] =
785 0, 60, 98, 0, 0, 97, 100, 101, 96, 93,
786 92, 106, 108, 91, 110, 105, 99, 109, 0, 0,
787 15, 0, 0, 2, 5, 4, 54, 51, 6, 68,
788 122, 0, 65, 0, 62, 94, 0, 102, 104, 118,
789 141, 3, 69, 0, 53, 126, 66, 0, 0, 16,
790 17, 33, 44, 30, 41, 40, 27, 25, 26, 37,
791 36, 31, 32, 39, 38, 35, 34, 20, 21, 22,
792 23, 24, 43, 42, 0, 46, 28, 29, 0, 0,
793 49, 107, 13, 0, 56, 1, 0, 0, 0, 112,
794 89, 0, 0, 11, 0, 0, 6, 136, 135, 138,
795 12, 121, 0, 6, 59, 50, 67, 61, 71, 95,
796 0, 124, 120, 100, 103, 117, 0, 0, 0, 63,
797 57, 150, 64, 0, 6, 129, 142, 131, 8, 151,
798 191, 192, 0, 0, 0, 0, 194, 195, 0, 0,
799 0, 0, 0, 0, 74, 76, 80, 125, 52, 0,
800 0, 48, 45, 47, 0, 0, 7, 0, 111, 90,
801 0, 115, 0, 110, 89, 0, 0, 0, 129, 81,
802 0, 0, 89, 0, 0, 140, 0, 137, 133, 134,
803 10, 70, 72, 128, 123, 119, 58, 0, 129, 157,
804 158, 9, 0, 130, 149, 133, 155, 156, 0, 0,
805 0, 0, 0, 78, 0, 163, 165, 164, 0, 141,
806 0, 160, 0, 0, 73, 0, 77, 0, 0, 0,
807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
808 0, 0, 0, 0, 0, 0, 0, 18, 19, 14,
809 55, 89, 116, 0, 89, 88, 89, 0, 82, 132,
810 113, 0, 0, 127, 0, 148, 129, 0, 144, 0,
811 0, 141, 0, 0, 0, 0, 0, 0, 162, 0,
812 0, 159, 75, 112, 0, 0, 0, 187, 186, 185,
813 184, 183, 179, 178, 182, 181, 180, 177, 176, 174,
814 175, 171, 172, 173, 189, 188, 114, 87, 86, 85,
815 83, 139, 0, 143, 154, 146, 147, 152, 153, 193,
816 0, 0, 0, 79, 166, 161, 170, 0, 84, 145,
817 0, 0, 0, 190, 0, 0, 0, 167, 169, 168
820 /* YYDEFGOTO[NTERM-NUM]. */
821 static const short yydefgoto
[] =
823 -1, 22, 156, 93, 24, 25, 26, 27, 28, 29,
824 119, 30, 255, 31, 32, 79, 34, 143, 144, 167,
825 96, 158, 35, 36, 37, 38, 39, 168, 98, 204,
826 170, 127, 100, 41, 257, 258, 128, 129, 211, 212
829 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
831 #define YYPACT_NINF -142
832 static const short yypact
[] =
834 777, 9, -142, 10, 625, -142, -15, -142, -142, -142,
835 -142, -142, -142, -142, -142, -142, -142, -142, 777, 777,
836 -142, 11, 38, -142, -142, -142, -11, -142, 21, -142,
837 147, -10, -142, 32, 58, 147, 1007, -142, 375, 147,
838 274, -142, -142, 439, -142, 147, -142, 32, 76, 37,
839 62, -142, -142, -142, -142, -142, -142, -142, -142, -142,
840 -142, -142, -142, -142, -142, -142, -142, -142, -142, -142,
841 -142, -142, -142, -142, 30, 34, -142, -142, 81, 124,
842 -142, -142, -142, 94, -142, -142, 439, 9, 777, -142,
843 147, 8, 722, -142, 12, 58, 125, 359, -142, -18,
844 -142, -142, 895, 125, 54, -142, -142, 129, -142, -142,
845 76, 147, 147, -142, -142, -142, 50, 829, 722, -142,
846 -142, -18, -142, 68, 125, 435, -142, -18, -142, -18,
847 -142, -142, 74, 97, 100, 104, -142, -142, 691, 571,
848 571, 571, 512, -13, -142, 491, 1023, -142, -142, 71,
849 93, -142, -142, -142, 777, 60, -142, 139, -142, -142,
850 99, -142, 76, 136, 147, 559, 27, 33, 559, 559,
851 151, 54, 147, 129, 777, -142, 161, -142, 169, -142,
852 -142, -142, -142, 147, -142, -142, -142, 179, 723, 182,
853 -142, -142, 559, -142, -142, -142, 183, -142, 983, 983,
854 983, 983, 777, -142, 123, -7, -7, -7, 777, 491,
855 156, 997, 158, 439, -142, 357, -142, 571, 571, 571,
856 571, 571, 571, 571, 571, 571, 571, 571, 571, 571,
857 571, 571, 571, 571, 571, 198, 202, -142, -142, -142,
858 -142, 147, -142, 43, 147, -142, 147, 953, -142, -142,
859 -142, 48, 777, -142, 723, -142, 723, 171, -18, 777,
860 777, 559, 172, 163, 168, 178, 193, 512, -142, 571,
861 571, -142, -142, 802, 357, 194, 893, 1047, 1070, 1092,
862 1113, 795, 1129, 1129, 554, 554, 554, 267, 267, 142,
863 142, -7, -7, -7, -142, -142, -142, -142, -142, -142,
864 559, -142, 200, -142, -142, -142, -142, -142, -142, -142,
865 170, 173, 175, -142, -7, 1023, -142, 571, -142, -142,
866 512, 512, 512, 1023, 201, 203, 204, -142, -142, -142
869 /* YYPGOTO[NTERM-NUM]. */
870 static const short yypgoto
[] =
872 -142, -142, 80, 56, -142, -142, -142, 3, -142, -2,
873 -142, -1, -32, -17, 4, 0, 247, 176, 44, -142,
874 -27, -95, -142, -25, 220, -142, 229, -6, -75, 25,
875 95, -19, 174, -141, -128, -142, 141, -142, 89, -131
878 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
879 positive, shift that token. If negative, reduce the rule which
880 number is the opposite. If zero, do what YYDEFACT says.
881 If YYTABLE_NINF, syntax error. */
882 #define YYTABLE_NINF -1
883 static const unsigned short yytable
[] =
885 33, 210, 45, 47, 103, 101, 44, 46, 121, 99,
886 109, 160, 81, 124, 115, 1, 84, 171, 33, 33,
887 147, 42, 97, 122, 179, 40, 87, 4, 94, 80,
888 213, 106, 104, 88, 125, 111, 105, 104, 85, 120,
889 123, 214, 86, 40, 40, 106, 190, 45, 104, 4,
890 148, 91, 179, 171, 197, 1, 102, 262, 263, 264,
891 265, 235, 43, 236, 102, 159, 181, 117, 145, 245,
892 108, 89, 178, 104, 172, 246, 247, 250, 99, 161,
893 23, 1, 21, 90, 275, 117, 184, 185, 157, 172,
894 91, 97, 166, 121, 189, 92, 152, 94, 82, 83,
895 195, 151, 196, 213, 21, 241, 149, 43, 122, 183,
896 241, 145, 188, 40, 240, 186, 187, 169, 166, 125,
897 46, 106, 21, 153, 120, 123, 302, 169, 303, 104,
898 172, 150, 146, 210, 154, 126, 275, 174, 33, 159,
899 21, 182, 237, 169, 104, 94, 296, 159, 198, 297,
900 199, 298, 175, 200, 33, 106, 4, 201, 253, 180,
901 105, 45, 243, 40, 238, 94, 87, 209, 94, 94,
902 242, 122, 9, 10, 33, 146, 251, 13, 244, 40,
903 191, 252, 256, 306, 104, 106, 188, 120, 123, 324,
904 325, 326, 94, 249, 259, 260, 117, 267, 269, 40,
905 271, 241, 33, 294, 232, 233, 234, 295, 33, 94,
906 235, 21, 236, 304, 309, 166, 159, 310, 203, 159,
907 193, 159, 311, 261, 261, 261, 261, 40, 205, 206,
908 207, 305, 312, 40, 239, 313, 316, 122, 145, 122,
909 216, 241, 319, 327, 320, 328, 329, 321, 256, 322,
910 256, 21, 33, 120, 123, 120, 123, 272, 114, 33,
911 33, 94, 155, 193, 248, 112, 194, 0, 0, 0,
912 0, 177, 300, 33, 166, 95, 0, 40, 0, 1,
913 107, 0, 266, 193, 40, 40, 116, 0, 268, 0,
914 0, 117, 0, 0, 107, 0, 0, 0, 40, 209,
915 94, 0, 146, 0, 126, 0, 276, 277, 278, 279,
916 280, 281, 282, 283, 284, 285, 286, 287, 288, 289,
917 290, 291, 292, 293, 89, 0, 107, 230, 231, 232,
918 233, 234, 301, 0, 0, 235, 90, 236, 0, 307,
919 308, 173, 0, 91, 95, 0, 21, 0, 118, 0,
920 0, 193, 0, 268, 0, 0, 126, 0, 314, 315,
921 130, 131, 1, 0, 87, 0, 0, 132, 2, 162,
922 107, 176, 0, 0, 0, 133, 134, 135, 5, 6,
923 7, 8, 9, 10, 11, 12, 2, 13, 14, 15,
924 16, 17, 95, 136, 137, 318, 5, 113, 7, 8,
925 0, 0, 0, 0, 107, 0, 323, 273, 16, 89,
926 0, 0, 95, 107, 0, 95, 95, 0, 139, 90,
927 0, 90, 0, 95, 0, 0, 91, 0, 91, 140,
928 141, 274, 0, 92, 107, 0, 0, 0, 0, 95,
929 1, 0, 130, 131, 1, 0, 0, 116, 0, 132,
930 2, 48, 117, 0, 0, 0, 95, 133, 134, 135,
931 5, 6, 7, 8, 9, 10, 11, 12, 0, 13,
932 14, 15, 16, 17, 0, 136, 137, 0, 0, 0,
933 0, 0, 0, 0, 0, 89, 0, 0, 0, 138,
934 107, 0, 0, 0, 0, 0, 87, 90, 173, 0,
935 139, 0, 0, 176, 91, 0, 0, 21, 95, 192,
936 0, 140, 141, 142, 0, 130, 131, 1, 0, 0,
937 0, 0, 132, 2, 48, 0, 0, 0, 0, 0,
938 133, 134, 135, 5, 6, 7, 8, 9, 10, 11,
939 12, 89, 13, 14, 15, 16, 17, 95, 136, 137,
940 0, 0, 0, 90, 0, 0, 0, 0, 0, 0,
941 91, 0, 208, 0, 87, 215, 0, 0, 0, 0,
942 0, 176, 0, 139, 130, 131, 1, 0, 0, 0,
943 0, 132, 2, 48, 140, 141, 142, 0, 0, 133,
944 134, 135, 5, 6, 7, 8, 9, 10, 11, 12,
945 0, 13, 14, 15, 16, 17, 0, 136, 137, 89,
946 0, 228, 229, 0, 230, 231, 232, 233, 234, 0,
947 0, 90, 235, 0, 236, 0, 0, 0, 91, 0,
948 1, 0, 139, 165, 0, 0, 2, 48, 0, 0,
949 49, 50, 0, 140, 141, 142, 5, 6, 7, 8,
950 9, 10, 11, 12, 0, 13, 14, 15, 16, 17,
951 51, 0, 0, 0, 0, 0, 0, 0, 52, 53,
952 0, 54, 55, 56, 57, 58, 59, 60, 61, 62,
953 63, 64, 65, 66, 0, 67, 68, 69, 70, 71,
954 72, 73, 0, 0, 74, 75, 1, 76, 77, 78,
955 0, 0, 2, 3, 0, 0, 0, 0, 4, 0,
956 0, 0, 5, 6, 7, 8, 9, 10, 11, 12,
957 0, 13, 14, 15, 16, 17, 0, 1, 1, 18,
958 19, 0, 20, 2, 162, 116, 0, 0, 0, 0,
959 117, 0, 0, 5, 6, 7, 8, 9, 10, 11,
960 12, 0, 13, 163, 15, 16, 17, 0, 0, 0,
961 0, 0, 0, 21, 164, 202, 0, 0, 0, 0,
962 0, 0, 89, 89, 0, 0, 0, 0, 0, 0,
963 0, 0, 1, 0, 90, 90, 0, 0, 2, 3,
964 0, 91, 91, 0, 4, 21, 165, 254, 5, 6,
965 7, 8, 9, 10, 11, 12, 0, 13, 14, 15,
966 16, 17, 0, 2, 3, 18, 19, 0, 20, 4,
967 0, 0, 0, 5, 6, 7, 8, 9, 10, 11,
968 12, 0, 13, 14, 15, 16, 17, 0, 0, 0,
969 18, 19, 0, 20, 49, 50, 223, 224, 225, 21,
970 226, 227, 228, 229, 0, 230, 231, 232, 233, 234,
971 0, 0, 0, 235, 51, 236, 0, 0, 0, 0,
972 0, 0, 52, 53, 21, 54, 55, 56, 57, 58,
973 59, 60, 61, 62, 63, 64, 65, 66, 0, 67,
974 68, 69, 70, 71, 72, 73, 0, 0, 74, 75,
975 1, 76, 77, 78, 0, 0, 2, 48, 0, 0,
976 0, 0, 0, 0, 0, 0, 5, 6, 7, 8,
977 9, 10, 11, 12, 0, 13, 163, 15, 16, 17,
978 0, 0, 0, 0, 0, 0, 0, 164, 217, 218,
979 219, 220, 221, 222, 223, 224, 225, 0, 226, 227,
980 228, 229, 0, 230, 231, 232, 233, 234, 1, 0,
981 0, 235, 0, 236, 2, 48, 0, 0, 317, 0,
982 0, 0, 0, 0, 5, 6, 7, 8, 9, 10,
983 11, 12, 299, 13, 14, 15, 16, 17, 1, 0,
984 0, 0, 0, 0, 2, 48, 0, 0, 0, 0,
985 0, 0, 0, 0, 5, 6, 7, 8, 9, 10,
986 11, 12, 1, 13, 14, 15, 16, 17, 2, 110,
987 0, 0, 0, 0, 0, 0, 0, 0, 5, 6,
988 7, 8, 0, 0, 11, 12, 0, 0, 14, 15,
989 16, 17, 217, 218, 219, 220, 221, 222, 223, 224,
990 225, 270, 226, 227, 228, 229, 0, 230, 231, 232,
991 233, 234, 0, 0, 0, 235, 0, 236, 217, 218,
992 219, 220, 221, 222, 223, 224, 225, 0, 226, 227,
993 228, 229, 0, 230, 231, 232, 233, 234, 0, 0,
994 0, 235, 0, 236, 219, 220, 221, 222, 223, 224,
995 225, 0, 226, 227, 228, 229, 0, 230, 231, 232,
996 233, 234, 0, 0, 0, 235, 0, 236, 220, 221,
997 222, 223, 224, 225, 0, 226, 227, 228, 229, 0,
998 230, 231, 232, 233, 234, 0, 0, 0, 235, 0,
999 236, 221, 222, 223, 224, 225, 0, 226, 227, 228,
1000 229, 0, 230, 231, 232, 233, 234, 0, 0, 0,
1001 235, 0, 236, 222, 223, 224, 225, 0, 226, 227,
1002 228, 229, 0, 230, 231, 232, 233, 234, 0, 0,
1003 0, 235, 225, 236, 226, 227, 228, 229, 0, 230,
1004 231, 232, 233, 234, 0, 0, 0, 235, 0, 236
1007 static const short yycheck
[] =
1009 0, 142, 3, 3, 31, 30, 3, 3, 40, 28,
1010 35, 3, 27, 40, 39, 5, 5, 5, 18, 19,
1011 45, 12, 28, 40, 99, 0, 5, 17, 28, 4,
1012 43, 33, 5, 12, 40, 36, 33, 5, 0, 40,
1013 40, 54, 53, 18, 19, 47, 121, 48, 5, 17,
1014 47, 69, 127, 5, 129, 5, 74, 198, 199, 200,
1015 201, 68, 53, 70, 74, 90, 12, 17, 43, 164,
1016 12, 50, 99, 5, 62, 42, 43, 172, 97, 71,
1017 0, 5, 72, 62, 215, 17, 111, 112, 88, 62,
1018 69, 97, 92, 125, 121, 74, 62, 97, 18, 19,
1019 127, 71, 129, 43, 72, 62, 69, 53, 125, 110,
1020 62, 86, 118, 88, 54, 116, 116, 92, 118, 125,
1021 116, 123, 72, 42, 125, 125, 254, 102, 256, 5,
1022 62, 69, 43, 274, 40, 40, 267, 12, 138, 164,
1023 72, 12, 71, 118, 5, 145, 241, 172, 74, 244,
1024 53, 246, 96, 53, 154, 157, 17, 53, 183, 103,
1025 157, 162, 162, 138, 71, 165, 5, 142, 168, 169,
1026 71, 188, 25, 26, 174, 86, 176, 30, 42, 154,
1027 124, 12, 188, 258, 5, 187, 192, 188, 188, 320,
1028 321, 322, 192, 42, 12, 12, 17, 74, 42, 174,
1029 42, 62, 202, 5, 62, 63, 64, 5, 208, 209,
1030 68, 72, 70, 42, 42, 215, 241, 54, 138, 244,
1031 125, 246, 54, 198, 199, 200, 201, 202, 139, 140,
1032 141, 258, 54, 208, 154, 42, 42, 254, 213, 256,
1033 145, 62, 42, 42, 74, 42, 42, 74, 254, 74,
1034 256, 72, 252, 254, 254, 256, 256, 213, 38, 259,
1035 260, 261, 86, 168, 169, 36, 125, -1, -1, -1,
1036 -1, 97, 247, 273, 274, 28, -1, 252, -1, 5,
1037 33, -1, 202, 188, 259, 260, 12, -1, 208, -1,
1038 -1, 17, -1, -1, 47, -1, -1, -1, 273, 274,
1039 300, -1, 213, -1, 209, -1, 217, 218, 219, 220,
1040 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
1041 231, 232, 233, 234, 50, -1, 79, 60, 61, 62,
1042 63, 64, 252, -1, -1, 68, 62, 70, -1, 259,
1043 260, 94, -1, 69, 97, -1, 72, -1, 74, -1,
1044 -1, 256, -1, 273, -1, -1, 261, -1, 269, 270,
1045 3, 4, 5, -1, 5, -1, -1, 10, 11, 12,
1046 123, 12, -1, -1, -1, 18, 19, 20, 21, 22,
1047 23, 24, 25, 26, 27, 28, 11, 30, 31, 32,
1048 33, 34, 145, 36, 37, 300, 21, 22, 23, 24,
1049 -1, -1, -1, -1, 157, -1, 317, 50, 33, 50,
1050 -1, -1, 165, 166, -1, 168, 169, -1, 61, 62,
1051 -1, 62, -1, 176, -1, -1, 69, -1, 69, 72,
1052 73, 74, -1, 74, 187, -1, -1, -1, -1, 192,
1053 5, -1, 3, 4, 5, -1, -1, 12, -1, 10,
1054 11, 12, 17, -1, -1, -1, 209, 18, 19, 20,
1055 21, 22, 23, 24, 25, 26, 27, 28, -1, 30,
1056 31, 32, 33, 34, -1, 36, 37, -1, -1, -1,
1057 -1, -1, -1, -1, -1, 50, -1, -1, -1, 50,
1058 243, -1, -1, -1, -1, -1, 5, 62, 251, -1,
1059 61, -1, -1, 12, 69, -1, -1, 72, 261, 74,
1060 -1, 72, 73, 74, -1, 3, 4, 5, -1, -1,
1061 -1, -1, 10, 11, 12, -1, -1, -1, -1, -1,
1062 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
1063 28, 50, 30, 31, 32, 33, 34, 300, 36, 37,
1064 -1, -1, -1, 62, -1, -1, -1, -1, -1, -1,
1065 69, -1, 50, -1, 5, 74, -1, -1, -1, -1,
1066 -1, 12, -1, 61, 3, 4, 5, -1, -1, -1,
1067 -1, 10, 11, 12, 72, 73, 74, -1, -1, 18,
1068 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1069 -1, 30, 31, 32, 33, 34, -1, 36, 37, 50,
1070 -1, 57, 58, -1, 60, 61, 62, 63, 64, -1,
1071 -1, 62, 68, -1, 70, -1, -1, -1, 69, -1,
1072 5, -1, 61, 74, -1, -1, 11, 12, -1, -1,
1073 15, 16, -1, 72, 73, 74, 21, 22, 23, 24,
1074 25, 26, 27, 28, -1, 30, 31, 32, 33, 34,
1075 35, -1, -1, -1, -1, -1, -1, -1, 43, 44,
1076 -1, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1077 55, 56, 57, 58, -1, 60, 61, 62, 63, 64,
1078 65, 66, -1, -1, 69, 70, 5, 72, 73, 74,
1079 -1, -1, 11, 12, -1, -1, -1, -1, 17, -1,
1080 -1, -1, 21, 22, 23, 24, 25, 26, 27, 28,
1081 -1, 30, 31, 32, 33, 34, -1, 5, 5, 38,
1082 39, -1, 41, 11, 12, 12, -1, -1, -1, -1,
1083 17, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1084 28, -1, 30, 31, 32, 33, 34, -1, -1, -1,
1085 -1, -1, -1, 72, 42, 74, -1, -1, -1, -1,
1086 -1, -1, 50, 50, -1, -1, -1, -1, -1, -1,
1087 -1, -1, 5, -1, 62, 62, -1, -1, 11, 12,
1088 -1, 69, 69, -1, 17, 72, 74, 74, 21, 22,
1089 23, 24, 25, 26, 27, 28, -1, 30, 31, 32,
1090 33, 34, -1, 11, 12, 38, 39, -1, 41, 17,
1091 -1, -1, -1, 21, 22, 23, 24, 25, 26, 27,
1092 28, -1, 30, 31, 32, 33, 34, -1, -1, -1,
1093 38, 39, -1, 41, 15, 16, 51, 52, 53, 72,
1094 55, 56, 57, 58, -1, 60, 61, 62, 63, 64,
1095 -1, -1, -1, 68, 35, 70, -1, -1, -1, -1,
1096 -1, -1, 43, 44, 72, 46, 47, 48, 49, 50,
1097 51, 52, 53, 54, 55, 56, 57, 58, -1, 60,
1098 61, 62, 63, 64, 65, 66, -1, -1, 69, 70,
1099 5, 72, 73, 74, -1, -1, 11, 12, -1, -1,
1100 -1, -1, -1, -1, -1, -1, 21, 22, 23, 24,
1101 25, 26, 27, 28, -1, 30, 31, 32, 33, 34,
1102 -1, -1, -1, -1, -1, -1, -1, 42, 45, 46,
1103 47, 48, 49, 50, 51, 52, 53, -1, 55, 56,
1104 57, 58, -1, 60, 61, 62, 63, 64, 5, -1,
1105 -1, 68, -1, 70, 11, 12, -1, -1, 75, -1,
1106 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1107 27, 28, 29, 30, 31, 32, 33, 34, 5, -1,
1108 -1, -1, -1, -1, 11, 12, -1, -1, -1, -1,
1109 -1, -1, -1, -1, 21, 22, 23, 24, 25, 26,
1110 27, 28, 5, 30, 31, 32, 33, 34, 11, 12,
1111 -1, -1, -1, -1, -1, -1, -1, -1, 21, 22,
1112 23, 24, -1, -1, 27, 28, -1, -1, 31, 32,
1113 33, 34, 45, 46, 47, 48, 49, 50, 51, 52,
1114 53, 54, 55, 56, 57, 58, -1, 60, 61, 62,
1115 63, 64, -1, -1, -1, 68, -1, 70, 45, 46,
1116 47, 48, 49, 50, 51, 52, 53, -1, 55, 56,
1117 57, 58, -1, 60, 61, 62, 63, 64, -1, -1,
1118 -1, 68, -1, 70, 47, 48, 49, 50, 51, 52,
1119 53, -1, 55, 56, 57, 58, -1, 60, 61, 62,
1120 63, 64, -1, -1, -1, 68, -1, 70, 48, 49,
1121 50, 51, 52, 53, -1, 55, 56, 57, 58, -1,
1122 60, 61, 62, 63, 64, -1, -1, -1, 68, -1,
1123 70, 49, 50, 51, 52, 53, -1, 55, 56, 57,
1124 58, -1, 60, 61, 62, 63, 64, -1, -1, -1,
1125 68, -1, 70, 50, 51, 52, 53, -1, 55, 56,
1126 57, 58, -1, 60, 61, 62, 63, 64, -1, -1,
1127 -1, 68, 53, 70, 55, 56, 57, 58, -1, 60,
1128 61, 62, 63, 64, -1, -1, -1, 68, -1, 70
1131 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1132 symbol of state STATE-NUM. */
1133 static const unsigned char yystos
[] =
1135 0, 5, 11, 12, 17, 21, 22, 23, 24, 25,
1136 26, 27, 28, 30, 31, 32, 33, 34, 38, 39,
1137 41, 72, 77, 78, 80, 81, 82, 83, 84, 85,
1138 87, 89, 90, 91, 92, 98, 99, 100, 101, 102,
1139 105, 109, 12, 53, 83, 87, 90, 91, 12, 15,
1140 16, 35, 43, 44, 46, 47, 48, 49, 50, 51,
1141 52, 53, 54, 55, 56, 57, 58, 60, 61, 62,
1142 63, 64, 65, 66, 69, 70, 72, 73, 74, 91,
1143 105, 27, 78, 78, 5, 0, 53, 5, 12, 50,
1144 62, 69, 74, 79, 91, 92, 96, 103, 104, 107,
1145 108, 99, 74, 96, 5, 83, 85, 92, 12, 99,
1146 12, 87, 102, 22, 100, 99, 12, 17, 74, 86,
1147 87, 88, 89, 91, 96, 103, 106, 107, 112, 113,
1148 3, 4, 10, 18, 19, 20, 36, 37, 50, 61,
1149 72, 73, 74, 93, 94, 105, 114, 99, 83, 69,
1150 69, 71, 62, 42, 40, 93, 78, 91, 97, 99,
1151 3, 71, 12, 31, 42, 74, 91, 95, 103, 105,
1152 106, 5, 62, 92, 12, 79, 12, 108, 96, 104,
1153 79, 12, 12, 87, 99, 99, 87, 91, 103, 96,
1154 104, 79, 74, 106, 112, 96, 96, 104, 74, 53,
1155 53, 53, 74, 78, 105, 114, 114, 114, 50, 105,
1156 109, 114, 115, 43, 54, 74, 106, 45, 46, 47,
1157 48, 49, 50, 51, 52, 53, 55, 56, 57, 58,
1158 60, 61, 62, 63, 64, 68, 70, 71, 71, 78,
1159 54, 62, 71, 91, 42, 97, 42, 43, 106, 42,
1160 97, 91, 12, 99, 74, 88, 103, 110, 111, 12,
1161 12, 105, 109, 109, 109, 109, 78, 74, 78, 42,
1162 54, 42, 94, 50, 74, 115, 114, 114, 114, 114,
1163 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
1164 114, 114, 114, 114, 5, 5, 97, 97, 97, 29,
1165 105, 78, 110, 110, 42, 96, 104, 78, 78, 42,
1166 54, 54, 54, 42, 114, 114, 42, 75, 106, 42,
1167 74, 74, 74, 114, 115, 115, 115, 42, 42, 42
1170 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1171 # define YYSIZE_T __SIZE_TYPE__
1173 #if ! defined (YYSIZE_T) && defined (size_t)
1174 # define YYSIZE_T size_t
1176 #if ! defined (YYSIZE_T)
1177 # if defined (__STDC__) || defined (__cplusplus)
1178 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1179 # define YYSIZE_T size_t
1182 #if ! defined (YYSIZE_T)
1183 # define YYSIZE_T unsigned int
1186 #define yyerrok (yyerrstatus = 0)
1187 #define yyclearin (yychar = YYEMPTY)
1188 #define YYEMPTY (-2)
1191 #define YYACCEPT goto yyacceptlab
1192 #define YYABORT goto yyabortlab
1193 #define YYERROR goto yyerrorlab
1196 /* Like YYERROR except do call yyerror. This remains here temporarily
1197 to ease the transition to the new meaning of YYERROR, for GCC.
1198 Once GCC version 2 has supplanted version 1, this can go. */
1200 #define YYFAIL goto yyerrlab
1202 #define YYRECOVERING() (!!yyerrstatus)
1204 #define YYBACKUP(Token, Value) \
1206 if (yychar == YYEMPTY && yylen == 1) \
1210 yytoken = YYTRANSLATE (yychar); \
1216 yyerror ("syntax error: cannot back up");\
1222 #define YYERRCODE 256
1224 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
1227 #ifndef YYLLOC_DEFAULT
1228 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1229 ((Current).first_line = (Rhs)[1].first_line, \
1230 (Current).first_column = (Rhs)[1].first_column, \
1231 (Current).last_line = (Rhs)[N].last_line, \
1232 (Current).last_column = (Rhs)[N].last_column)
1235 /* YYLEX -- calling `yylex' with the right arguments. */
1238 # define YYLEX yylex (YYLEX_PARAM)
1240 # define YYLEX yylex ()
1243 /* Enable debugging if requested. */
1247 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1248 # define YYFPRINTF fprintf
1251 # define YYDPRINTF(Args) \
1257 # define YYDSYMPRINT(Args) \
1263 # define YYDSYMPRINTF(Title, Token, Value, Location) \
1267 YYFPRINTF (stderr, "%s ", Title); \
1268 yysymprint (stderr, \
1270 YYFPRINTF (stderr, "\n"); \
1274 /*------------------------------------------------------------------.
1275 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1277 `------------------------------------------------------------------*/
1279 #if defined (__STDC__) || defined (__cplusplus)
1281 yy_stack_print (short *bottom
, short *top
)
1284 yy_stack_print (bottom
, top
)
1289 YYFPRINTF (stderr
, "Stack now");
1290 for (/* Nothing. */; bottom
<= top
; ++bottom
)
1291 YYFPRINTF (stderr
, " %d", *bottom
);
1292 YYFPRINTF (stderr
, "\n");
1295 # define YY_STACK_PRINT(Bottom, Top) \
1298 yy_stack_print ((Bottom), (Top)); \
1302 /*------------------------------------------------.
1303 | Report that the YYRULE is going to be reduced. |
1304 `------------------------------------------------*/
1306 #if defined (__STDC__) || defined (__cplusplus)
1308 yy_reduce_print (int yyrule
)
1311 yy_reduce_print (yyrule
)
1316 unsigned int yylno
= yyrline
[yyrule
];
1317 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
1319 /* Print the symbols being reduced, and their result. */
1320 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
1321 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1322 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
1325 # define YY_REDUCE_PRINT(Rule) \
1328 yy_reduce_print (Rule); \
1331 /* Nonzero means print parse trace. It is left uninitialized so that
1332 multiple parsers can coexist. */
1334 #else /* !YYDEBUG */
1335 # define YYDPRINTF(Args)
1336 # define YYDSYMPRINT(Args)
1337 # define YYDSYMPRINTF(Title, Token, Value, Location)
1338 # define YY_STACK_PRINT(Bottom, Top)
1339 # define YY_REDUCE_PRINT(Rule)
1340 #endif /* !YYDEBUG */
1343 /* YYINITDEPTH -- initial size of the parser's stacks. */
1345 # define YYINITDEPTH 200
1348 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1349 if the built-in stack extension method is used).
1351 Do not make this value too large; the results are undefined if
1352 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1353 evaluated with infinite-precision integer arithmetic. */
1355 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1360 # define YYMAXDEPTH 10000
1368 # if defined (__GLIBC__) && defined (_STRING_H)
1369 # define yystrlen strlen
1371 /* Return the length of YYSTR. */
1373 # if defined (__STDC__) || defined (__cplusplus)
1374 yystrlen (const char *yystr
)
1380 register const char *yys
= yystr
;
1382 while (*yys
++ != '\0')
1385 return yys
- yystr
- 1;
1391 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1392 # define yystpcpy stpcpy
1394 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1397 # if defined (__STDC__) || defined (__cplusplus)
1398 yystpcpy (char *yydest
, const char *yysrc
)
1400 yystpcpy (yydest
, yysrc
)
1405 register char *yyd
= yydest
;
1406 register const char *yys
= yysrc
;
1408 while ((*yyd
++ = *yys
++) != '\0')
1416 #endif /* !YYERROR_VERBOSE */
1421 /*--------------------------------.
1422 | Print this symbol on YYOUTPUT. |
1423 `--------------------------------*/
1425 #if defined (__STDC__) || defined (__cplusplus)
1427 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
1430 yysymprint (yyoutput
, yytype
, yyvaluep
)
1436 /* Pacify ``unused variable'' warnings. */
1439 if (yytype
< YYNTOKENS
)
1441 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1443 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1447 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1454 YYFPRINTF (yyoutput
, ")");
1457 #endif /* ! YYDEBUG */
1458 /*-----------------------------------------------.
1459 | Release the memory associated to this symbol. |
1460 `-----------------------------------------------*/
1462 #if defined (__STDC__) || defined (__cplusplus)
1464 yydestruct (int yytype
, YYSTYPE
*yyvaluep
)
1467 yydestruct (yytype
, yyvaluep
)
1472 /* Pacify ``unused variable'' warnings. */
1484 /* Prevent warnings from -Wmissing-prototypes. */
1486 #ifdef YYPARSE_PARAM
1487 # if defined (__STDC__) || defined (__cplusplus)
1488 int yyparse (void *YYPARSE_PARAM
);
1492 #else /* ! YYPARSE_PARAM */
1493 #if defined (__STDC__) || defined (__cplusplus)
1498 #endif /* ! YYPARSE_PARAM */
1502 /* The lookahead symbol. */
1505 /* The semantic value of the lookahead symbol. */
1508 /* Number of syntax errors so far. */
1517 #ifdef YYPARSE_PARAM
1518 # if defined (__STDC__) || defined (__cplusplus)
1519 int yyparse (void *YYPARSE_PARAM
)
1521 int yyparse (YYPARSE_PARAM
)
1522 void *YYPARSE_PARAM
;
1524 #else /* ! YYPARSE_PARAM */
1525 #if defined (__STDC__) || defined (__cplusplus)
1536 register int yystate
;
1539 /* Number of tokens to shift before error messages enabled. */
1541 /* Lookahead token as an internal (translated) token number. */
1544 /* Three stacks and their tools:
1545 `yyss': related to states,
1546 `yyvs': related to semantic values,
1547 `yyls': related to locations.
1549 Refer to the stacks thru separate pointers, to allow yyoverflow
1550 to xreallocate them elsewhere. */
1552 /* The state stack. */
1553 short yyssa
[YYINITDEPTH
];
1554 short *yyss
= yyssa
;
1555 register short *yyssp
;
1557 /* The semantic value stack. */
1558 YYSTYPE yyvsa
[YYINITDEPTH
];
1559 YYSTYPE
*yyvs
= yyvsa
;
1560 register YYSTYPE
*yyvsp
;
1564 #define YYPOPSTACK (yyvsp--, yyssp--)
1566 YYSIZE_T yystacksize
= YYINITDEPTH
;
1568 /* The variables used to return semantic value and location from the
1573 /* When reducing, the number of symbols on the RHS of the reduced
1577 YYDPRINTF ((stderr
, "Starting parse\n"));
1582 yychar
= YYEMPTY
; /* Cause a token to be read. */
1584 /* Initialize stack pointers.
1585 Waste one element of value and location stack
1586 so that they stay on the same level as the state stack.
1587 The wasted elements are never initialized. */
1594 /*------------------------------------------------------------.
1595 | yynewstate -- Push a new state, which is found in yystate. |
1596 `------------------------------------------------------------*/
1598 /* In all cases, when you get here, the value and location stacks
1599 have just been pushed. so pushing a state here evens the stacks.
1606 if (yyss
+ yystacksize
- 1 <= yyssp
)
1608 /* Get the current used size of the three stacks, in elements. */
1609 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1613 /* Give user a chance to xreallocate the stack. Use copies of
1614 these so that the &'s don't force the real ones into
1616 YYSTYPE
*yyvs1
= yyvs
;
1617 short *yyss1
= yyss
;
1620 /* Each stack pointer address is followed by the size of the
1621 data in use in that stack, in bytes. This used to be a
1622 conditional around just the two extra args, but that might
1623 be undefined if yyoverflow is a macro. */
1624 yyoverflow ("parser stack overflow",
1625 &yyss1
, yysize
* sizeof (*yyssp
),
1626 &yyvs1
, yysize
* sizeof (*yyvsp
),
1633 #else /* no yyoverflow */
1634 # ifndef YYSTACK_RELOCATE
1637 /* Extend the stack our own way. */
1638 if (YYMAXDEPTH
<= yystacksize
)
1641 if (YYMAXDEPTH
< yystacksize
)
1642 yystacksize
= YYMAXDEPTH
;
1645 short *yyss1
= yyss
;
1646 union yyalloc
*yyptr
=
1647 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1650 YYSTACK_RELOCATE (yyss
);
1651 YYSTACK_RELOCATE (yyvs
);
1653 # undef YYSTACK_RELOCATE
1655 YYSTACK_FREE (yyss1
);
1658 #endif /* no yyoverflow */
1660 yyssp
= yyss
+ yysize
- 1;
1661 yyvsp
= yyvs
+ yysize
- 1;
1664 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1665 (unsigned long int) yystacksize
));
1667 if (yyss
+ yystacksize
- 1 <= yyssp
)
1671 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1680 /* Do appropriate processing given the current state. */
1681 /* Read a lookahead token if we need one and don't already have one. */
1684 /* First try to decide what to do without reference to lookahead token. */
1686 yyn
= yypact
[yystate
];
1687 if (yyn
== YYPACT_NINF
)
1690 /* Not known => get a lookahead token if don't already have one. */
1692 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1693 if (yychar
== YYEMPTY
)
1695 YYDPRINTF ((stderr
, "Reading a token: "));
1699 if (yychar
<= YYEOF
)
1701 yychar
= yytoken
= YYEOF
;
1702 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1706 yytoken
= YYTRANSLATE (yychar
);
1707 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1710 /* If the proper action on seeing token YYTOKEN is to reduce or to
1711 detect an error, take that action. */
1713 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1718 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1727 /* Shift the lookahead token. */
1728 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1730 /* Discard the token being shifted unless it is eof. */
1731 if (yychar
!= YYEOF
)
1737 /* Count tokens shifted since error; after three, turn off error
1746 /*-----------------------------------------------------------.
1747 | yydefault -- do the default action for the current state. |
1748 `-----------------------------------------------------------*/
1750 yyn
= yydefact
[yystate
];
1756 /*-----------------------------.
1757 | yyreduce -- Do a reduction. |
1758 `-----------------------------*/
1760 /* yyn is the number of a rule to reduce with. */
1763 /* If YYLEN is nonzero, implement the default value of the action:
1766 Otherwise, the following line sets YYVAL to garbage.
1767 This behavior is undocumented and Bison
1768 users should not rely upon it. Assigning to YYVAL
1769 unconditionally makes the parser a bit smaller, and it avoids a
1770 GCC warning that YYVAL may be used uninitialized. */
1771 yyval
= yyvsp
[1-yylen
];
1774 YY_REDUCE_PRINT (yyn
);
1778 #line 343 "cp-name-parser.y"
1779 { global_result
= yyvsp
[0].comp
; }
1783 #line 355 "cp-name-parser.y"
1784 { yyval
.comp
= NULL
; }
1788 #line 357 "cp-name-parser.y"
1789 { yyval
.comp
= yyvsp
[0].comp
; }
1793 #line 364 "cp-name-parser.y"
1794 { yyval
.comp
= yyvsp
[0].nested
.comp
;
1795 *yyvsp
[0].nested
.last
= yyvsp
[-1].comp
;
1800 #line 373 "cp-name-parser.y"
1801 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_TYPED_NAME
, yyvsp
[-2].comp
, yyvsp
[-1].nested
.comp
);
1802 if (yyvsp
[0].comp
) yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME
, yyval
.comp
, yyvsp
[0].comp
); }
1806 #line 376 "cp-name-parser.y"
1807 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_TYPED_NAME
, yyvsp
[-2].comp
, yyvsp
[-1].nested
.comp
);
1808 if (yyvsp
[0].comp
) yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME
, yyval
.comp
, yyvsp
[0].comp
); }
1812 #line 380 "cp-name-parser.y"
1813 { yyval
.comp
= yyvsp
[-1].nested
.comp
;
1814 if (yyvsp
[0].comp
) yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME
, yyval
.comp
, yyvsp
[0].comp
); }
1818 #line 383 "cp-name-parser.y"
1819 { if (yyvsp
[0].abstract
.last
)
1821 /* First complete the abstract_declarator's type using
1822 the typespec from the conversion_op_name. */
1823 *yyvsp
[0].abstract
.last
= *yyvsp
[-1].nested
.last
;
1824 /* Then complete the conversion_op_name with the type. */
1825 *yyvsp
[-1].nested
.last
= yyvsp
[0].abstract
.comp
;
1827 /* If we have an arglist, build a function type. */
1828 if (yyvsp
[0].abstract
.fn
.comp
)
1829 yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_TYPED_NAME
, yyvsp
[-1].nested
.comp
, yyvsp
[0].abstract
.fn
.comp
);
1831 yyval
.comp
= yyvsp
[-1].nested
.comp
;
1832 if (yyvsp
[0].abstract
.start
) yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME
, yyval
.comp
, yyvsp
[0].abstract
.start
);
1837 #line 402 "cp-name-parser.y"
1838 { yyval
.comp
= make_empty (yyvsp
[-1].lval
);
1839 d_left (yyval
.comp
) = yyvsp
[0].comp
;
1840 d_right (yyval
.comp
) = NULL
; }
1844 #line 406 "cp-name-parser.y"
1845 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE
, yyvsp
[-2].comp
, yyvsp
[0].comp
); }
1849 #line 408 "cp-name-parser.y"
1850 { yyval
.comp
= make_empty (yyvsp
[0].typed_val_int
.val
);
1851 d_left (yyval
.comp
) = yyvsp
[0].typed_val_int
.type
;
1852 d_right (yyval
.comp
) = NULL
; }
1856 #line 414 "cp-name-parser.y"
1857 { yyval
.comp
= make_operator ("new", 1); }
1861 #line 416 "cp-name-parser.y"
1862 { yyval
.comp
= make_operator ("delete", 1); }
1866 #line 418 "cp-name-parser.y"
1867 { yyval
.comp
= make_operator ("new[]", 1); }
1871 #line 420 "cp-name-parser.y"
1872 { yyval
.comp
= make_operator ("delete[]", 1); }
1876 #line 422 "cp-name-parser.y"
1877 { yyval
.comp
= make_operator ("+", 2); }
1881 #line 424 "cp-name-parser.y"
1882 { yyval
.comp
= make_operator ("-", 2); }
1886 #line 426 "cp-name-parser.y"
1887 { yyval
.comp
= make_operator ("*", 2); }
1891 #line 428 "cp-name-parser.y"
1892 { yyval
.comp
= make_operator ("/", 2); }
1896 #line 430 "cp-name-parser.y"
1897 { yyval
.comp
= make_operator ("%", 2); }
1901 #line 432 "cp-name-parser.y"
1902 { yyval
.comp
= make_operator ("^", 2); }
1906 #line 434 "cp-name-parser.y"
1907 { yyval
.comp
= make_operator ("&", 2); }
1911 #line 436 "cp-name-parser.y"
1912 { yyval
.comp
= make_operator ("|", 2); }
1916 #line 438 "cp-name-parser.y"
1917 { yyval
.comp
= make_operator ("~", 1); }
1921 #line 440 "cp-name-parser.y"
1922 { yyval
.comp
= make_operator ("!", 1); }
1926 #line 442 "cp-name-parser.y"
1927 { yyval
.comp
= make_operator ("=", 2); }
1931 #line 444 "cp-name-parser.y"
1932 { yyval
.comp
= make_operator ("<", 2); }
1936 #line 446 "cp-name-parser.y"
1937 { yyval
.comp
= make_operator (">", 2); }
1941 #line 448 "cp-name-parser.y"
1942 { yyval
.comp
= make_operator (yyvsp
[0].opname
, 2); }
1946 #line 450 "cp-name-parser.y"
1947 { yyval
.comp
= make_operator ("<<", 2); }
1951 #line 452 "cp-name-parser.y"
1952 { yyval
.comp
= make_operator (">>", 2); }
1956 #line 454 "cp-name-parser.y"
1957 { yyval
.comp
= make_operator ("==", 2); }
1961 #line 456 "cp-name-parser.y"
1962 { yyval
.comp
= make_operator ("!=", 2); }
1966 #line 458 "cp-name-parser.y"
1967 { yyval
.comp
= make_operator ("<=", 2); }
1971 #line 460 "cp-name-parser.y"
1972 { yyval
.comp
= make_operator (">=", 2); }
1976 #line 462 "cp-name-parser.y"
1977 { yyval
.comp
= make_operator ("&&", 2); }
1981 #line 464 "cp-name-parser.y"
1982 { yyval
.comp
= make_operator ("||", 2); }
1986 #line 466 "cp-name-parser.y"
1987 { yyval
.comp
= make_operator ("++", 1); }
1991 #line 468 "cp-name-parser.y"
1992 { yyval
.comp
= make_operator ("--", 1); }
1996 #line 470 "cp-name-parser.y"
1997 { yyval
.comp
= make_operator (",", 2); }
2001 #line 472 "cp-name-parser.y"
2002 { yyval
.comp
= make_operator ("->*", 2); }
2006 #line 474 "cp-name-parser.y"
2007 { yyval
.comp
= make_operator ("->", 2); }
2011 #line 476 "cp-name-parser.y"
2012 { yyval
.comp
= make_operator ("()", 0); }
2016 #line 478 "cp-name-parser.y"
2017 { yyval
.comp
= make_operator ("[]", 2); }
2021 #line 486 "cp-name-parser.y"
2022 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_CAST
, yyvsp
[0].comp
, NULL
); }
2026 #line 491 "cp-name-parser.y"
2027 { yyval
.nested
.comp
= yyvsp
[-1].nested1
.comp
;
2028 d_right (yyvsp
[-1].nested1
.last
) = yyvsp
[0].comp
;
2029 yyval
.nested
.last
= &d_left (yyvsp
[0].comp
);
2034 #line 496 "cp-name-parser.y"
2035 { yyval
.nested
.comp
= yyvsp
[0].comp
;
2036 yyval
.nested
.last
= &d_left (yyvsp
[0].comp
);
2041 #line 500 "cp-name-parser.y"
2042 { yyval
.nested
.comp
= yyvsp
[-1].nested1
.comp
;
2043 d_right (yyvsp
[-1].nested1
.last
) = yyvsp
[0].comp
;
2044 yyval
.nested
.last
= &d_left (yyvsp
[0].comp
);
2049 #line 505 "cp-name-parser.y"
2050 { yyval
.nested
.comp
= yyvsp
[0].comp
;
2051 yyval
.nested
.last
= &d_left (yyvsp
[0].comp
);
2056 #line 514 "cp-name-parser.y"
2057 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_TEMPLATE
, yyvsp
[-3].comp
, yyvsp
[-1].nested
.comp
); }
2061 #line 516 "cp-name-parser.y"
2062 { yyval
.comp
= make_dtor (gnu_v3_complete_object_dtor
, yyvsp
[0].comp
); }
2066 #line 529 "cp-name-parser.y"
2067 { yyval
.comp
= yyvsp
[0].comp
; }
2071 #line 535 "cp-name-parser.y"
2072 { yyval
.comp
= yyvsp
[-1].nested1
.comp
; d_right (yyvsp
[-1].nested1
.last
) = yyvsp
[0].comp
; }
2076 #line 538 "cp-name-parser.y"
2077 { yyval
.comp
= yyvsp
[-1].nested1
.comp
; d_right (yyvsp
[-1].nested1
.last
) = yyvsp
[0].comp
; }
2081 #line 548 "cp-name-parser.y"
2082 { yyval
.comp
= yyvsp
[0].comp
; }
2086 #line 552 "cp-name-parser.y"
2087 { yyval
.comp
= yyvsp
[-1].nested1
.comp
; d_right (yyvsp
[-1].nested1
.last
) = yyvsp
[0].comp
; }
2091 #line 557 "cp-name-parser.y"
2092 { yyval
.nested1
.comp
= make_empty (DEMANGLE_COMPONENT_QUAL_NAME
);
2093 d_left (yyval
.nested1
.comp
) = yyvsp
[-1].comp
;
2094 d_right (yyval
.nested1
.comp
) = NULL
;
2095 yyval
.nested1
.last
= yyval
.nested1
.comp
;
2100 #line 563 "cp-name-parser.y"
2101 { yyval
.nested1
.comp
= yyvsp
[-2].nested1
.comp
;
2102 d_right (yyvsp
[-2].nested1
.last
) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME
);
2103 yyval
.nested1
.last
= d_right (yyvsp
[-2].nested1
.last
);
2104 d_left (yyval
.nested1
.last
) = yyvsp
[-1].comp
;
2105 d_right (yyval
.nested1
.last
) = NULL
;
2110 #line 570 "cp-name-parser.y"
2111 { yyval
.nested1
.comp
= make_empty (DEMANGLE_COMPONENT_QUAL_NAME
);
2112 d_left (yyval
.nested1
.comp
) = yyvsp
[-1].comp
;
2113 d_right (yyval
.nested1
.comp
) = NULL
;
2114 yyval
.nested1
.last
= yyval
.nested1
.comp
;
2119 #line 576 "cp-name-parser.y"
2120 { yyval
.nested1
.comp
= yyvsp
[-2].nested1
.comp
;
2121 d_right (yyvsp
[-2].nested1
.last
) = make_empty (DEMANGLE_COMPONENT_QUAL_NAME
);
2122 yyval
.nested1
.last
= d_right (yyvsp
[-2].nested1
.last
);
2123 d_left (yyval
.nested1
.last
) = yyvsp
[-1].comp
;
2124 d_right (yyval
.nested1
.last
) = NULL
;
2129 #line 587 "cp-name-parser.y"
2130 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_TEMPLATE
, yyvsp
[-3].comp
, yyvsp
[-1].nested
.comp
); }
2134 #line 591 "cp-name-parser.y"
2135 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST
, yyvsp
[0].comp
, NULL
);
2136 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
); }
2140 #line 594 "cp-name-parser.y"
2141 { yyval
.nested
.comp
= yyvsp
[-2].nested
.comp
;
2142 *yyvsp
[-2].nested
.last
= fill_comp (DEMANGLE_COMPONENT_TEMPLATE_ARGLIST
, yyvsp
[0].comp
, NULL
);
2143 yyval
.nested
.last
= &d_right (*yyvsp
[-2].nested
.last
);
2148 #line 606 "cp-name-parser.y"
2149 { yyval
.comp
= yyvsp
[0].abstract
.comp
;
2150 *yyvsp
[0].abstract
.last
= yyvsp
[-1].comp
;
2155 #line 610 "cp-name-parser.y"
2156 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
, make_operator ("&", 1), yyvsp
[0].comp
); }
2160 #line 612 "cp-name-parser.y"
2161 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
, make_operator ("&", 1), yyvsp
[-1].comp
); }
2165 #line 617 "cp-name-parser.y"
2166 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_ARGLIST
, yyvsp
[0].comp
, NULL
);
2167 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
);
2172 #line 621 "cp-name-parser.y"
2173 { *yyvsp
[0].abstract
.last
= yyvsp
[-1].comp
;
2174 yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_ARGLIST
, yyvsp
[0].abstract
.comp
, NULL
);
2175 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
);
2180 #line 626 "cp-name-parser.y"
2181 { *yyvsp
[-2].nested
.last
= fill_comp (DEMANGLE_COMPONENT_ARGLIST
, yyvsp
[0].comp
, NULL
);
2182 yyval
.nested
.comp
= yyvsp
[-2].nested
.comp
;
2183 yyval
.nested
.last
= &d_right (*yyvsp
[-2].nested
.last
);
2188 #line 631 "cp-name-parser.y"
2189 { *yyvsp
[0].abstract
.last
= yyvsp
[-1].comp
;
2190 *yyvsp
[-3].nested
.last
= fill_comp (DEMANGLE_COMPONENT_ARGLIST
, yyvsp
[0].abstract
.comp
, NULL
);
2191 yyval
.nested
.comp
= yyvsp
[-3].nested
.comp
;
2192 yyval
.nested
.last
= &d_right (*yyvsp
[-3].nested
.last
);
2197 #line 637 "cp-name-parser.y"
2198 { *yyvsp
[-2].nested
.last
2199 = fill_comp (DEMANGLE_COMPONENT_ARGLIST
,
2200 make_builtin_type ("..."),
2202 yyval
.nested
.comp
= yyvsp
[-2].nested
.comp
;
2203 yyval
.nested
.last
= &d_right (*yyvsp
[-2].nested
.last
);
2208 #line 647 "cp-name-parser.y"
2209 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE
, NULL
, yyvsp
[-2].nested
.comp
);
2210 yyval
.nested
.last
= &d_left (yyval
.nested
.comp
);
2211 yyval
.nested
.comp
= d_qualify (yyval
.nested
.comp
, yyvsp
[0].lval
, 1); }
2215 #line 651 "cp-name-parser.y"
2216 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE
, NULL
, NULL
);
2217 yyval
.nested
.last
= &d_left (yyval
.nested
.comp
);
2218 yyval
.nested
.comp
= d_qualify (yyval
.nested
.comp
, yyvsp
[0].lval
, 1); }
2222 #line 655 "cp-name-parser.y"
2223 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_FUNCTION_TYPE
, NULL
, NULL
);
2224 yyval
.nested
.last
= &d_left (yyval
.nested
.comp
);
2225 yyval
.nested
.comp
= d_qualify (yyval
.nested
.comp
, yyvsp
[0].lval
, 1); }
2229 #line 662 "cp-name-parser.y"
2234 #line 667 "cp-name-parser.y"
2235 { yyval
.lval
= QUAL_RESTRICT
; }
2239 #line 669 "cp-name-parser.y"
2240 { yyval
.lval
= QUAL_VOLATILE
; }
2244 #line 671 "cp-name-parser.y"
2245 { yyval
.lval
= QUAL_CONST
; }
2249 #line 676 "cp-name-parser.y"
2250 { yyval
.lval
= yyvsp
[-1].lval
| yyvsp
[0].lval
; }
2254 #line 683 "cp-name-parser.y"
2259 #line 685 "cp-name-parser.y"
2260 { yyval
.lval
= INT_SIGNED
; }
2264 #line 687 "cp-name-parser.y"
2265 { yyval
.lval
= INT_UNSIGNED
; }
2269 #line 689 "cp-name-parser.y"
2270 { yyval
.lval
= INT_CHAR
; }
2274 #line 691 "cp-name-parser.y"
2275 { yyval
.lval
= INT_LONG
; }
2279 #line 693 "cp-name-parser.y"
2280 { yyval
.lval
= INT_SHORT
; }
2284 #line 698 "cp-name-parser.y"
2285 { yyval
.lval
= yyvsp
[-1].lval
| yyvsp
[0].lval
; if (yyvsp
[-1].lval
& yyvsp
[0].lval
& INT_LONG
) yyval
.lval
= yyvsp
[-1].lval
| INT_LLONG
; }
2289 #line 702 "cp-name-parser.y"
2290 { yyval
.comp
= d_int_type (yyvsp
[0].lval
); }
2294 #line 704 "cp-name-parser.y"
2295 { yyval
.comp
= make_builtin_type ("float"); }
2299 #line 706 "cp-name-parser.y"
2300 { yyval
.comp
= make_builtin_type ("double"); }
2304 #line 708 "cp-name-parser.y"
2305 { yyval
.comp
= make_builtin_type ("long double"); }
2309 #line 710 "cp-name-parser.y"
2310 { yyval
.comp
= make_builtin_type ("bool"); }
2314 #line 712 "cp-name-parser.y"
2315 { yyval
.comp
= make_builtin_type ("wchar_t"); }
2319 #line 714 "cp-name-parser.y"
2320 { yyval
.comp
= make_builtin_type ("void"); }
2324 #line 718 "cp-name-parser.y"
2325 { yyval
.nested
.comp
= make_empty (DEMANGLE_COMPONENT_POINTER
);
2326 yyval
.nested
.comp
->u
.s_binary
.left
= yyval
.nested
.comp
->u
.s_binary
.right
= NULL
;
2327 yyval
.nested
.last
= &d_left (yyval
.nested
.comp
);
2328 yyval
.nested
.comp
= d_qualify (yyval
.nested
.comp
, yyvsp
[0].lval
, 0); }
2332 #line 724 "cp-name-parser.y"
2333 { yyval
.nested
.comp
= make_empty (DEMANGLE_COMPONENT_REFERENCE
);
2334 yyval
.nested
.comp
->u
.s_binary
.left
= yyval
.nested
.comp
->u
.s_binary
.right
= NULL
;
2335 yyval
.nested
.last
= &d_left (yyval
.nested
.comp
); }
2339 #line 728 "cp-name-parser.y"
2340 { yyval
.nested
.comp
= make_empty (DEMANGLE_COMPONENT_PTRMEM_TYPE
);
2341 yyval
.nested
.comp
->u
.s_binary
.left
= yyvsp
[-2].nested1
.comp
;
2342 /* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME. */
2343 *yyvsp
[-2].nested1
.last
= *d_left (yyvsp
[-2].nested1
.last
);
2344 yyval
.nested
.comp
->u
.s_binary
.right
= NULL
;
2345 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
);
2346 yyval
.nested
.comp
= d_qualify (yyval
.nested
.comp
, yyvsp
[0].lval
, 0); }
2350 #line 736 "cp-name-parser.y"
2351 { yyval
.nested
.comp
= make_empty (DEMANGLE_COMPONENT_PTRMEM_TYPE
);
2352 yyval
.nested
.comp
->u
.s_binary
.left
= yyvsp
[-2].nested1
.comp
;
2353 /* Convert the innermost DEMANGLE_COMPONENT_QUAL_NAME to a DEMANGLE_COMPONENT_NAME. */
2354 *yyvsp
[-2].nested1
.last
= *d_left (yyvsp
[-2].nested1
.last
);
2355 yyval
.nested
.comp
->u
.s_binary
.right
= NULL
;
2356 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
);
2357 yyval
.nested
.comp
= d_qualify (yyval
.nested
.comp
, yyvsp
[0].lval
, 0); }
2361 #line 746 "cp-name-parser.y"
2362 { yyval
.comp
= make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE
);
2363 d_left (yyval
.comp
) = NULL
;
2368 #line 750 "cp-name-parser.y"
2369 { yyval
.comp
= make_empty (DEMANGLE_COMPONENT_ARRAY_TYPE
);
2370 d_left (yyval
.comp
) = yyvsp
[-1].comp
;
2375 #line 766 "cp-name-parser.y"
2376 { yyval
.comp
= d_qualify (yyvsp
[-1].comp
, yyvsp
[0].lval
, 0); }
2380 #line 769 "cp-name-parser.y"
2381 { yyval
.comp
= d_qualify (yyvsp
[-1].comp
, yyvsp
[-2].lval
| yyvsp
[0].lval
, 0); }
2385 #line 771 "cp-name-parser.y"
2386 { yyval
.comp
= d_qualify (yyvsp
[0].comp
, yyvsp
[-1].lval
, 0); }
2390 #line 774 "cp-name-parser.y"
2391 { yyval
.comp
= d_qualify (yyvsp
[-1].comp
, yyvsp
[0].lval
, 0); }
2395 #line 777 "cp-name-parser.y"
2396 { yyval
.comp
= d_qualify (yyvsp
[-1].comp
, yyvsp
[-2].lval
| yyvsp
[0].lval
, 0); }
2400 #line 779 "cp-name-parser.y"
2401 { yyval
.comp
= d_qualify (yyvsp
[0].comp
, yyvsp
[-1].lval
, 0); }
2405 #line 782 "cp-name-parser.y"
2406 { yyval
.comp
= d_qualify (yyvsp
[-1].comp
, yyvsp
[0].lval
, 0); }
2410 #line 784 "cp-name-parser.y"
2411 { yyval
.comp
= yyvsp
[0].comp
; }
2415 #line 786 "cp-name-parser.y"
2416 { yyval
.comp
= d_qualify (yyvsp
[-1].comp
, yyvsp
[-3].lval
| yyvsp
[0].lval
, 0); }
2420 #line 788 "cp-name-parser.y"
2421 { yyval
.comp
= d_qualify (yyvsp
[0].comp
, yyvsp
[-2].lval
, 0); }
2425 #line 793 "cp-name-parser.y"
2426 { yyval
.abstract
.comp
= yyvsp
[0].nested
.comp
; yyval
.abstract
.last
= yyvsp
[0].nested
.last
;
2427 yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
; }
2431 #line 796 "cp-name-parser.y"
2432 { yyval
.abstract
= yyvsp
[0].abstract
; yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
;
2433 if (yyvsp
[0].abstract
.fn
.comp
) { yyval
.abstract
.last
= yyvsp
[0].abstract
.fn
.last
; *yyvsp
[0].abstract
.last
= yyvsp
[0].abstract
.fn
.comp
; }
2434 *yyval
.abstract
.last
= yyvsp
[-1].nested
.comp
;
2435 yyval
.abstract
.last
= yyvsp
[-1].nested
.last
; }
2439 #line 801 "cp-name-parser.y"
2440 { yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
;
2441 if (yyvsp
[0].abstract
.fn
.comp
) { yyval
.abstract
.last
= yyvsp
[0].abstract
.fn
.last
; *yyvsp
[0].abstract
.last
= yyvsp
[0].abstract
.fn
.comp
; }
2446 #line 808 "cp-name-parser.y"
2447 { yyval
.abstract
= yyvsp
[-1].abstract
; yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
; yyval
.abstract
.fold_flag
= 1;
2448 if (yyvsp
[-1].abstract
.fn
.comp
) { yyval
.abstract
.last
= yyvsp
[-1].abstract
.fn
.last
; *yyvsp
[-1].abstract
.last
= yyvsp
[-1].abstract
.fn
.comp
; }
2453 #line 812 "cp-name-parser.y"
2454 { yyval
.abstract
.fold_flag
= 0;
2455 if (yyvsp
[-1].abstract
.fn
.comp
) { yyval
.abstract
.last
= yyvsp
[-1].abstract
.fn
.last
; *yyvsp
[-1].abstract
.last
= yyvsp
[-1].abstract
.fn
.comp
; }
2456 if (yyvsp
[-1].abstract
.fold_flag
)
2458 *yyval
.abstract
.last
= yyvsp
[0].nested
.comp
;
2459 yyval
.abstract
.last
= yyvsp
[0].nested
.last
;
2462 yyval
.abstract
.fn
= yyvsp
[0].nested
;
2467 #line 823 "cp-name-parser.y"
2468 { yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
; yyval
.abstract
.fold_flag
= 0;
2469 if (yyvsp
[-1].abstract
.fn
.comp
) { yyval
.abstract
.last
= yyvsp
[-1].abstract
.fn
.last
; *yyvsp
[-1].abstract
.last
= yyvsp
[-1].abstract
.fn
.comp
; }
2470 *yyvsp
[-1].abstract
.last
= yyvsp
[0].comp
;
2471 yyval
.abstract
.last
= &d_right (yyvsp
[0].comp
);
2476 #line 829 "cp-name-parser.y"
2477 { yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
; yyval
.abstract
.fold_flag
= 0;
2478 yyval
.abstract
.comp
= yyvsp
[0].comp
;
2479 yyval
.abstract
.last
= &d_right (yyvsp
[0].comp
);
2484 #line 847 "cp-name-parser.y"
2485 { yyval
.abstract
.comp
= yyvsp
[0].nested
.comp
; yyval
.abstract
.last
= yyvsp
[0].nested
.last
;
2486 yyval
.abstract
.fn
.comp
= NULL
; yyval
.abstract
.fn
.last
= NULL
; yyval
.abstract
.start
= NULL
; }
2490 #line 850 "cp-name-parser.y"
2491 { yyval
.abstract
= yyvsp
[0].abstract
;
2492 if (yyvsp
[0].abstract
.last
)
2493 *yyval
.abstract
.last
= yyvsp
[-1].nested
.comp
;
2495 yyval
.abstract
.comp
= yyvsp
[-1].nested
.comp
;
2496 yyval
.abstract
.last
= yyvsp
[-1].nested
.last
;
2501 #line 858 "cp-name-parser.y"
2502 { yyval
.abstract
.comp
= yyvsp
[0].abstract
.comp
; yyval
.abstract
.last
= yyvsp
[0].abstract
.last
; yyval
.abstract
.fn
= yyvsp
[0].abstract
.fn
; yyval
.abstract
.start
= NULL
; }
2506 #line 860 "cp-name-parser.y"
2507 { yyval
.abstract
.start
= yyvsp
[0].comp
;
2508 if (yyvsp
[-3].abstract
.fn
.comp
) { yyval
.abstract
.last
= yyvsp
[-3].abstract
.fn
.last
; *yyvsp
[-3].abstract
.last
= yyvsp
[-3].abstract
.fn
.comp
; }
2509 if (yyvsp
[-3].abstract
.fold_flag
)
2511 *yyval
.abstract
.last
= yyvsp
[-2].nested
.comp
;
2512 yyval
.abstract
.last
= yyvsp
[-2].nested
.last
;
2515 yyval
.abstract
.fn
= yyvsp
[-2].nested
;
2520 #line 871 "cp-name-parser.y"
2521 { yyval
.abstract
.fn
= yyvsp
[-1].nested
;
2522 yyval
.abstract
.start
= yyvsp
[0].comp
;
2523 yyval
.abstract
.comp
= NULL
; yyval
.abstract
.last
= NULL
;
2528 #line 879 "cp-name-parser.y"
2529 { yyval
.comp
= yyvsp
[0].abstract
.comp
;
2530 *yyvsp
[0].abstract
.last
= yyvsp
[-1].comp
;
2535 #line 885 "cp-name-parser.y"
2536 { yyval
.nested
.comp
= yyvsp
[0].nested
.comp
;
2537 yyval
.nested
.last
= yyvsp
[-1].nested
.last
;
2538 *yyvsp
[0].nested
.last
= yyvsp
[-1].nested
.comp
; }
2542 #line 893 "cp-name-parser.y"
2543 { yyval
.nested
= yyvsp
[-1].nested
; }
2547 #line 895 "cp-name-parser.y"
2548 { yyval
.nested
.comp
= yyvsp
[-1].nested
.comp
;
2549 *yyvsp
[-1].nested
.last
= yyvsp
[0].nested
.comp
;
2550 yyval
.nested
.last
= yyvsp
[0].nested
.last
;
2555 #line 900 "cp-name-parser.y"
2556 { yyval
.nested
.comp
= yyvsp
[-1].nested
.comp
;
2557 *yyvsp
[-1].nested
.last
= yyvsp
[0].comp
;
2558 yyval
.nested
.last
= &d_right (yyvsp
[0].comp
);
2563 #line 905 "cp-name-parser.y"
2564 { yyval
.nested
.comp
= make_empty (DEMANGLE_COMPONENT_TYPED_NAME
);
2565 d_left (yyval
.nested
.comp
) = yyvsp
[0].comp
;
2566 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
);
2571 #line 918 "cp-name-parser.y"
2572 { yyval
.nested
.comp
= yyvsp
[0].nested
.comp
;
2573 yyval
.nested
.last
= yyvsp
[-1].nested
.last
;
2574 *yyvsp
[0].nested
.last
= yyvsp
[-1].nested
.comp
; }
2578 #line 922 "cp-name-parser.y"
2579 { yyval
.nested
.comp
= make_empty (DEMANGLE_COMPONENT_TYPED_NAME
);
2580 d_left (yyval
.nested
.comp
) = yyvsp
[0].comp
;
2581 yyval
.nested
.last
= &d_right (yyval
.nested
.comp
);
2586 #line 935 "cp-name-parser.y"
2587 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_TYPED_NAME
, yyvsp
[-3].comp
, yyvsp
[-2].nested
.comp
);
2588 yyval
.nested
.last
= yyvsp
[-2].nested
.last
;
2589 yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME
, yyval
.nested
.comp
, yyvsp
[0].comp
);
2594 #line 940 "cp-name-parser.y"
2595 { yyval
.nested
.comp
= yyvsp
[-3].nested
.comp
;
2596 *yyvsp
[-3].nested
.last
= yyvsp
[-2].nested
.comp
;
2597 yyval
.nested
.last
= yyvsp
[-2].nested
.last
;
2598 yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_LOCAL_NAME
, yyval
.nested
.comp
, yyvsp
[0].comp
);
2603 #line 949 "cp-name-parser.y"
2604 { yyval
.nested
.comp
= yyvsp
[-1].nested
.comp
;
2605 yyval
.nested
.last
= yyvsp
[-2].nested
.last
;
2606 *yyvsp
[-1].nested
.last
= yyvsp
[-2].nested
.comp
; }
2610 #line 953 "cp-name-parser.y"
2611 { yyval
.nested
.comp
= yyvsp
[-1].nested
.comp
;
2612 *yyvsp
[-1].nested
.last
= yyvsp
[0].nested
.comp
;
2613 yyval
.nested
.last
= yyvsp
[0].nested
.last
;
2618 #line 958 "cp-name-parser.y"
2619 { yyval
.nested
.comp
= yyvsp
[-1].nested
.comp
;
2620 *yyvsp
[-1].nested
.last
= yyvsp
[0].comp
;
2621 yyval
.nested
.last
= &d_right (yyvsp
[0].comp
);
2626 #line 963 "cp-name-parser.y"
2627 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_TYPED_NAME
, yyvsp
[-1].comp
, yyvsp
[0].nested
.comp
);
2628 yyval
.nested
.last
= yyvsp
[0].nested
.last
;
2633 #line 967 "cp-name-parser.y"
2634 { yyval
.nested
.comp
= fill_comp (DEMANGLE_COMPONENT_TYPED_NAME
, yyvsp
[-1].comp
, yyvsp
[0].comp
);
2635 yyval
.nested
.last
= &d_right (yyvsp
[0].comp
);
2640 #line 973 "cp-name-parser.y"
2641 { yyval
.comp
= yyvsp
[-1].comp
; }
2645 #line 982 "cp-name-parser.y"
2646 { yyval
.comp
= d_binary (">", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2650 #line 989 "cp-name-parser.y"
2651 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
, make_operator ("&", 1), yyvsp
[0].comp
); }
2655 #line 994 "cp-name-parser.y"
2656 { yyval
.comp
= d_unary ("-", yyvsp
[0].comp
); }
2660 #line 998 "cp-name-parser.y"
2661 { yyval
.comp
= d_unary ("!", yyvsp
[0].comp
); }
2665 #line 1002 "cp-name-parser.y"
2666 { yyval
.comp
= d_unary ("~", yyvsp
[0].comp
); }
2670 #line 1009 "cp-name-parser.y"
2671 { if (yyvsp
[0].comp
->type
== DEMANGLE_COMPONENT_LITERAL
2672 || yyvsp
[0].comp
->type
== DEMANGLE_COMPONENT_LITERAL_NEG
)
2674 yyval
.comp
= yyvsp
[0].comp
;
2675 d_left (yyvsp
[0].comp
) = yyvsp
[-2].comp
;
2678 yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
,
2679 fill_comp (DEMANGLE_COMPONENT_CAST
, yyvsp
[-2].comp
, NULL
),
2685 #line 1025 "cp-name-parser.y"
2686 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
,
2687 fill_comp (DEMANGLE_COMPONENT_CAST
, yyvsp
[-4].comp
, NULL
),
2693 #line 1032 "cp-name-parser.y"
2694 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
,
2695 fill_comp (DEMANGLE_COMPONENT_CAST
, yyvsp
[-4].comp
, NULL
),
2701 #line 1039 "cp-name-parser.y"
2702 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
,
2703 fill_comp (DEMANGLE_COMPONENT_CAST
, yyvsp
[-4].comp
, NULL
),
2709 #line 1052 "cp-name-parser.y"
2710 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_UNARY
,
2711 fill_comp (DEMANGLE_COMPONENT_CAST
, yyvsp
[-3].comp
, NULL
),
2717 #line 1063 "cp-name-parser.y"
2718 { yyval
.comp
= d_binary ("*", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2722 #line 1067 "cp-name-parser.y"
2723 { yyval
.comp
= d_binary ("/", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2727 #line 1071 "cp-name-parser.y"
2728 { yyval
.comp
= d_binary ("%", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2732 #line 1075 "cp-name-parser.y"
2733 { yyval
.comp
= d_binary ("+", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2737 #line 1079 "cp-name-parser.y"
2738 { yyval
.comp
= d_binary ("-", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2742 #line 1083 "cp-name-parser.y"
2743 { yyval
.comp
= d_binary ("<<", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2747 #line 1087 "cp-name-parser.y"
2748 { yyval
.comp
= d_binary (">>", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2752 #line 1091 "cp-name-parser.y"
2753 { yyval
.comp
= d_binary ("==", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2757 #line 1095 "cp-name-parser.y"
2758 { yyval
.comp
= d_binary ("!=", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2762 #line 1099 "cp-name-parser.y"
2763 { yyval
.comp
= d_binary ("<=", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2767 #line 1103 "cp-name-parser.y"
2768 { yyval
.comp
= d_binary (">=", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2772 #line 1107 "cp-name-parser.y"
2773 { yyval
.comp
= d_binary ("<", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2777 #line 1111 "cp-name-parser.y"
2778 { yyval
.comp
= d_binary ("&", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2782 #line 1115 "cp-name-parser.y"
2783 { yyval
.comp
= d_binary ("^", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2787 #line 1119 "cp-name-parser.y"
2788 { yyval
.comp
= d_binary ("|", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2792 #line 1123 "cp-name-parser.y"
2793 { yyval
.comp
= d_binary ("&&", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2797 #line 1127 "cp-name-parser.y"
2798 { yyval
.comp
= d_binary ("||", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2802 #line 1132 "cp-name-parser.y"
2803 { yyval
.comp
= d_binary ("->", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2807 #line 1136 "cp-name-parser.y"
2808 { yyval
.comp
= d_binary (".", yyvsp
[-2].comp
, yyvsp
[0].comp
); }
2812 #line 1140 "cp-name-parser.y"
2813 { yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_TRINARY
, make_operator ("?", 3),
2814 fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG1
, yyvsp
[-4].comp
,
2815 fill_comp (DEMANGLE_COMPONENT_TRINARY_ARG2
, yyvsp
[-2].comp
, yyvsp
[0].comp
)));
2820 #line 1154 "cp-name-parser.y"
2821 { yyval
.comp
= d_unary ("sizeof", yyvsp
[-1].comp
); }
2825 #line 1159 "cp-name-parser.y"
2826 { struct demangle_component
*i
;
2827 i
= make_name ("1", 1);
2828 yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_LITERAL
,
2829 make_builtin_type ("bool"),
2835 #line 1168 "cp-name-parser.y"
2836 { struct demangle_component
*i
;
2837 i
= make_name ("0", 1);
2838 yyval
.comp
= fill_comp (DEMANGLE_COMPONENT_LITERAL
,
2839 make_builtin_type ("bool"),
2847 /* Line 1000 of yacc.c. */
2848 #line 2849 "cp-name-parser.c.tmp"
2854 YY_STACK_PRINT (yyss
, yyssp
);
2859 /* Now `shift' the result of the reduction. Determine what state
2860 that goes to, based on the state we popped back to and the rule
2861 number reduced by. */
2865 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2866 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2867 yystate
= yytable
[yystate
];
2869 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2874 /*------------------------------------.
2875 | yyerrlab -- here on detecting error |
2876 `------------------------------------*/
2878 /* If not already recovering from an error, report this error. */
2883 yyn
= yypact
[yystate
];
2885 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
2887 YYSIZE_T yysize
= 0;
2888 int yytype
= YYTRANSLATE (yychar
);
2889 const char* yyprefix
;
2893 /* Start YYX at -YYN if negative to avoid negative indexes in
2895 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
2897 /* Stay within bounds of both yycheck and yytname. */
2898 int yychecklim
= YYLAST
- yyn
;
2899 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
2902 yyprefix
= ", expecting ";
2903 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2904 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
2906 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
2914 yysize
+= (sizeof ("syntax error, unexpected ")
2915 + yystrlen (yytname
[yytype
]));
2916 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
2919 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
2920 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
2924 yyprefix
= ", expecting ";
2925 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2926 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
2928 yyp
= yystpcpy (yyp
, yyprefix
);
2929 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
2934 YYSTACK_FREE (yymsg
);
2937 yyerror ("syntax error; also virtual memory exhausted");
2940 #endif /* YYERROR_VERBOSE */
2941 yyerror ("syntax error");
2946 if (yyerrstatus
== 3)
2948 /* If just tried and failed to reuse lookahead token after an
2949 error, discard it. */
2951 if (yychar
<= YYEOF
)
2953 /* If at end of input, pop the error token,
2954 then the rest of the stack, then return failure. */
2955 if (yychar
== YYEOF
)
2961 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
2962 yydestruct (yystos
[*yyssp
], yyvsp
);
2967 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
2968 yydestruct (yytoken
, &yylval
);
2974 /* Else will try to reuse lookahead token after shifting the error
2979 /*---------------------------------------------------.
2980 | yyerrorlab -- error raised explicitly by YYERROR. |
2981 `---------------------------------------------------*/
2985 /* Pacify GCC when the user code never invokes YYERROR and the label
2986 yyerrorlab therefore never appears in user code. */
2997 /*-------------------------------------------------------------.
2998 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2999 `-------------------------------------------------------------*/
3001 yyerrstatus
= 3; /* Each real token shifted decrements this. */
3005 yyn
= yypact
[yystate
];
3006 if (yyn
!= YYPACT_NINF
)
3009 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
3017 /* Pop the current state because it cannot handle the error token. */
3021 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
3022 yydestruct (yystos
[yystate
], yyvsp
);
3025 YY_STACK_PRINT (yyss
, yyssp
);
3031 YYDPRINTF ((stderr
, "Shifting error token, "));
3040 /*-------------------------------------.
3041 | yyacceptlab -- YYACCEPT comes here. |
3042 `-------------------------------------*/
3047 /*-----------------------------------.
3048 | yyabortlab -- YYABORT comes here. |
3049 `-----------------------------------*/
3055 /*----------------------------------------------.
3056 | yyoverflowlab -- parser overflow comes here. |
3057 `----------------------------------------------*/
3059 yyerror ("parser stack overflow");
3067 YYSTACK_FREE (yyss
);
3073 #line 1178 "cp-name-parser.y"
3076 /* Apply QUALIFIERS to LHS and return a qualified component. IS_METHOD
3077 is set if LHS is a method, in which case the qualifiers are logically
3078 applied to "this". We apply qualifiers in a consistent order; LHS
3079 may already be qualified; duplicate qualifiers are not created. */
3081 struct demangle_component
*
3082 d_qualify (struct demangle_component
*lhs
, int qualifiers
, int is_method
)
3084 struct demangle_component
**inner_p
;
3085 enum demangle_component_type type
;
3087 /* For now the order is CONST (innermost), VOLATILE, RESTRICT. */
3089 #define HANDLE_QUAL(TYPE, MTYPE, QUAL) \
3090 if ((qualifiers & QUAL) && (type != TYPE) && (type != MTYPE)) \
3092 *inner_p = fill_comp (is_method ? MTYPE : TYPE, \
3094 inner_p = &d_left (*inner_p); \
3095 type = (*inner_p)->type; \
3097 else if (type == TYPE || type == MTYPE) \
3099 inner_p = &d_left (*inner_p); \
3100 type = (*inner_p)->type; \
3105 type
= (*inner_p
)->type
;
3107 HANDLE_QUAL (DEMANGLE_COMPONENT_RESTRICT
, DEMANGLE_COMPONENT_RESTRICT_THIS
, QUAL_RESTRICT
);
3108 HANDLE_QUAL (DEMANGLE_COMPONENT_VOLATILE
, DEMANGLE_COMPONENT_VOLATILE_THIS
, QUAL_VOLATILE
);
3109 HANDLE_QUAL (DEMANGLE_COMPONENT_CONST
, DEMANGLE_COMPONENT_CONST_THIS
, QUAL_CONST
);
3114 /* Return a builtin type corresponding to FLAGS. */
3116 static struct demangle_component
*
3117 d_int_type (int flags
)
3123 case INT_SIGNED
| INT_CHAR
:
3124 name
= "signed char";
3129 case INT_UNSIGNED
| INT_CHAR
:
3130 name
= "unsigned char";
3137 name
= "unsigned int";
3140 case INT_SIGNED
| INT_LONG
:
3143 case INT_UNSIGNED
| INT_LONG
:
3144 name
= "unsigned long";
3147 case INT_SIGNED
| INT_SHORT
:
3150 case INT_UNSIGNED
| INT_SHORT
:
3151 name
= "unsigned short";
3153 case INT_LLONG
| INT_LONG
:
3154 case INT_SIGNED
| INT_LLONG
| INT_LONG
:
3157 case INT_UNSIGNED
| INT_LLONG
| INT_LONG
:
3158 name
= "unsigned long long";
3164 return make_builtin_type (name
);
3167 /* Wrapper to create a unary operation. */
3169 static struct demangle_component
*
3170 d_unary (const char *name
, struct demangle_component
*lhs
)
3172 return fill_comp (DEMANGLE_COMPONENT_UNARY
, make_operator (name
, 1), lhs
);
3175 /* Wrapper to create a binary operation. */
3177 static struct demangle_component
*
3178 d_binary (const char *name
, struct demangle_component
*lhs
, struct demangle_component
*rhs
)
3180 return fill_comp (DEMANGLE_COMPONENT_BINARY
, make_operator (name
, 2),
3181 fill_comp (DEMANGLE_COMPONENT_BINARY_ARGS
, lhs
, rhs
));
3184 /* Find the end of a symbol name starting at LEXPTR. */
3187 symbol_end (const char *lexptr
)
3189 const char *p
= lexptr
;
3191 while (*p
&& (ISALNUM (*p
) || *p
== '_' || *p
== '$' || *p
== '.'))
3197 /* Take care of parsing a number (anything that starts with a digit).
3198 The number starts at P and contains LEN characters. Store the result in
3202 parse_number (const char *p
, int len
, int parsed_float
)
3206 /* Number of "L" suffixes encountered. */
3209 struct demangle_component
*signed_type
;
3210 struct demangle_component
*unsigned_type
;
3211 struct demangle_component
*type
, *name
;
3212 enum demangle_component_type literal_type
;
3216 literal_type
= DEMANGLE_COMPONENT_LITERAL_NEG
;
3221 literal_type
= DEMANGLE_COMPONENT_LITERAL
;
3225 /* It's a float since it contains a point or an exponent. */
3228 /* The GDB lexer checks the result of scanf at this point. Not doing
3229 this leaves our error checking slightly weaker but only for invalid
3232 /* See if it has `f' or `l' suffix (float or long double). */
3234 c
= TOLOWER (p
[len
- 1]);
3239 type
= make_builtin_type ("float");
3244 type
= make_builtin_type ("long double");
3246 else if (ISDIGIT (c
) || c
== '.')
3247 type
= make_builtin_type ("double");
3251 name
= make_name (p
, len
);
3252 yylval
.comp
= fill_comp (literal_type
, type
, name
);
3257 /* This treats 0x1 and 1 as different literals. We also do not
3258 automatically generate unsigned types. */
3264 if (p
[len
- 1] == 'l' || p
[len
- 1] == 'L')
3270 if (p
[len
- 1] == 'u' || p
[len
- 1] == 'U')
3281 unsigned_type
= make_builtin_type ("unsigned int");
3282 signed_type
= make_builtin_type ("int");
3284 else if (long_p
== 1)
3286 unsigned_type
= make_builtin_type ("unsigned long");
3287 signed_type
= make_builtin_type ("long");
3291 unsigned_type
= make_builtin_type ("unsigned long long");
3292 signed_type
= make_builtin_type ("long long");
3296 type
= unsigned_type
;
3300 name
= make_name (p
, len
);
3301 yylval
.comp
= fill_comp (literal_type
, type
, name
);
3306 static char backslashable
[] = "abefnrtv";
3307 static char represented
[] = "\a\b\e\f\n\r\t\v";
3309 /* Translate the backslash the way we would in the host character set. */
3311 c_parse_backslash (int host_char
, int *target_char
)
3314 ix
= strchr (backslashable
, host_char
);
3318 *target_char
= represented
[ix
- backslashable
];
3322 /* Parse a C escape sequence. STRING_PTR points to a variable
3323 containing a pointer to the string to parse. That pointer
3324 should point to the character after the \. That pointer
3325 is updated past the characters we use. The value of the
3326 escape sequence is returned.
3328 A negative value means the sequence \ newline was seen,
3329 which is supposed to be equivalent to nothing at all.
3331 If \ is followed by a null character, we return a negative
3332 value and leave the string pointer pointing at the null character.
3334 If \ is followed by 000, we return 0 and leave the string pointer
3335 after the zeros. A value of 0 does not mean end of string. */
3338 parse_escape (const char **string_ptr
)
3341 int c
= *(*string_ptr
)++;
3342 if (c_parse_backslash (c
, &target_char
))
3354 c
= *(*string_ptr
)++;
3359 target_char
= parse_escape (string_ptr
);
3363 /* Now target_char is something like `c', and we want to find
3364 its control-character equivalent. */
3365 target_char
= target_char
& 037;
3384 if (c
>= '0' && c
<= '7')
3402 #define HANDLE_SPECIAL(string, comp) \
3403 if (strncmp (tokstart, string, sizeof (string) - 1) == 0) \
3405 lexptr = tokstart + sizeof (string) - 1; \
3406 yylval.lval = comp; \
3407 return DEMANGLER_SPECIAL; \
3410 #define HANDLE_TOKEN2(string, token) \
3411 if (lexptr[1] == string[1]) \
3414 yylval.opname = string; \
3418 #define HANDLE_TOKEN3(string, token) \
3419 if (lexptr[1] == string[1] && lexptr[2] == string[2]) \
3422 yylval.opname = string; \
3426 /* Read one token, getting characters through LEXPTR. */
3433 const char *tokstart
, *tokptr
;
3436 prev_lexptr
= lexptr
;
3439 switch (c
= *tokstart
)
3451 /* We either have a character constant ('0' or '\177' for example)
3452 or we have a quoted symbol reference ('foo(int,int)' in C++
3457 c
= parse_escape (&lexptr
);
3460 yyerror ("empty character constant");
3467 yyerror ("invalid character constant");
3471 /* FIXME: We should refer to a canonical form of the character,
3472 presumably the same one that appears in manglings - the decimal
3473 representation. But if that isn't in our input then we have to
3474 allocate memory for it somewhere. */
3475 yylval
.comp
= fill_comp (DEMANGLE_COMPONENT_LITERAL
,
3476 make_builtin_type ("char"),
3477 make_name (tokstart
, lexptr
- tokstart
));
3482 if (strncmp (tokstart
, "(anonymous namespace)", 21) == 0)
3485 yylval
.comp
= make_name ("(anonymous namespace)",
3486 sizeof "(anonymous namespace)" - 1);
3497 if (lexptr
[1] == '.' && lexptr
[2] == '.')
3503 /* Might be a floating point number. */
3504 if (lexptr
[1] < '0' || lexptr
[1] > '9')
3505 goto symbol
; /* Nope, must be a symbol. */
3510 HANDLE_TOKEN2 ("-=", ASSIGN_MODIFY
);
3511 HANDLE_TOKEN2 ("--", DECREMENT
);
3512 HANDLE_TOKEN2 ("->", ARROW
);
3514 /* For construction vtables. This is kind of hokey. */
3515 if (strncmp (tokstart
, "-in-", 4) == 0)
3518 return CONSTRUCTION_IN
;
3521 if (lexptr
[1] < '0' || lexptr
[1] > '9')
3526 /* FALL THRU into number case. */
3540 /* It's a number. */
3541 int got_dot
= 0, got_e
= 0, toktype
;
3542 const char *p
= tokstart
;
3548 if (c
== '0' && (p
[1] == 'x' || p
[1] == 'X'))
3553 else if (c
== '0' && (p
[1]=='t' || p
[1]=='T' || p
[1]=='d' || p
[1]=='D'))
3561 /* This test includes !hex because 'e' is a valid hex digit
3562 and thus does not indicate a floating point number when
3563 the radix is hex. */
3564 if (!hex
&& !got_e
&& (*p
== 'e' || *p
== 'E'))
3565 got_dot
= got_e
= 1;
3566 /* This test does not include !hex, because a '.' always indicates
3567 a decimal floating point number regardless of the radix.
3569 NOTE drow/2005-03-09: This comment is not accurate in C99;
3570 however, it's not clear that all the floating point support
3571 in this file is doing any good here. */
3572 else if (!got_dot
&& *p
== '.')
3574 else if (got_e
&& (p
[-1] == 'e' || p
[-1] == 'E')
3575 && (*p
== '-' || *p
== '+'))
3576 /* This is the sign of the exponent, not the end of the
3579 /* We will take any letters or digits. parse_number will
3580 complain if past the radix, or if L or U are not final. */
3581 else if (! ISALNUM (*p
))
3584 toktype
= parse_number (tokstart
, p
- tokstart
, got_dot
|got_e
);
3585 if (toktype
== ERROR
)
3587 char *err_copy
= (char *) alloca (p
- tokstart
+ 1);
3589 memcpy (err_copy
, tokstart
, p
- tokstart
);
3590 err_copy
[p
- tokstart
] = 0;
3591 yyerror ("invalid number");
3599 HANDLE_TOKEN2 ("+=", ASSIGN_MODIFY
);
3600 HANDLE_TOKEN2 ("++", INCREMENT
);
3604 HANDLE_TOKEN2 ("*=", ASSIGN_MODIFY
);
3608 HANDLE_TOKEN2 ("/=", ASSIGN_MODIFY
);
3612 HANDLE_TOKEN2 ("%=", ASSIGN_MODIFY
);
3616 HANDLE_TOKEN2 ("|=", ASSIGN_MODIFY
);
3617 HANDLE_TOKEN2 ("||", OROR
);
3621 HANDLE_TOKEN2 ("&=", ASSIGN_MODIFY
);
3622 HANDLE_TOKEN2 ("&&", ANDAND
);
3626 HANDLE_TOKEN2 ("^=", ASSIGN_MODIFY
);
3630 HANDLE_TOKEN2 ("!=", NOTEQUAL
);
3634 HANDLE_TOKEN3 ("<<=", ASSIGN_MODIFY
);
3635 HANDLE_TOKEN2 ("<=", LEQ
);
3636 HANDLE_TOKEN2 ("<<", LSH
);
3640 HANDLE_TOKEN3 (">>=", ASSIGN_MODIFY
);
3641 HANDLE_TOKEN2 (">=", GEQ
);
3642 HANDLE_TOKEN2 (">>", RSH
);
3646 HANDLE_TOKEN2 ("==", EQUAL
);
3650 HANDLE_TOKEN2 ("::", COLONCOLON
);
3666 /* These can't occur in C++ names. */
3667 yyerror ("unexpected string literal");
3671 if (!(c
== '_' || c
== '$' || ISALPHA (c
)))
3673 /* We must have come across a bad character (e.g. ';'). */
3674 yyerror ("invalid character");
3678 /* It's a name. See how long it is. */
3681 c
= tokstart
[++namelen
];
3682 while (ISALNUM (c
) || c
== '_' || c
== '$');
3686 /* Catch specific keywords. Notice that some of the keywords contain
3687 spaces, and are sorted by the length of the first word. They must
3688 all include a trailing space in the string comparison. */
3692 if (strncmp (tokstart
, "reinterpret_cast", 16) == 0)
3693 return REINTERPRET_CAST
;
3696 if (strncmp (tokstart
, "construction vtable for ", 24) == 0)
3698 lexptr
= tokstart
+ 24;
3699 return CONSTRUCTION_VTABLE
;
3701 if (strncmp (tokstart
, "dynamic_cast", 12) == 0)
3702 return DYNAMIC_CAST
;
3705 if (strncmp (tokstart
, "static_cast", 11) == 0)
3709 HANDLE_SPECIAL ("covariant return thunk to ", DEMANGLE_COMPONENT_COVARIANT_THUNK
);
3710 HANDLE_SPECIAL ("reference temporary for ", DEMANGLE_COMPONENT_REFTEMP
);
3713 HANDLE_SPECIAL ("typeinfo for ", DEMANGLE_COMPONENT_TYPEINFO
);
3714 HANDLE_SPECIAL ("typeinfo fn for ", DEMANGLE_COMPONENT_TYPEINFO_FN
);
3715 HANDLE_SPECIAL ("typeinfo name for ", DEMANGLE_COMPONENT_TYPEINFO_NAME
);
3716 if (strncmp (tokstart
, "operator", 8) == 0)
3718 if (strncmp (tokstart
, "restrict", 8) == 0)
3720 if (strncmp (tokstart
, "unsigned", 8) == 0)
3722 if (strncmp (tokstart
, "template", 8) == 0)
3724 if (strncmp (tokstart
, "volatile", 8) == 0)
3725 return VOLATILE_KEYWORD
;
3728 HANDLE_SPECIAL ("virtual thunk to ", DEMANGLE_COMPONENT_VIRTUAL_THUNK
);
3729 if (strncmp (tokstart
, "wchar_t", 7) == 0)
3733 if (strncmp (tokstart
, "global constructors keyed to ", 29) == 0)
3736 lexptr
= tokstart
+ 29;
3737 yylval
.typed_val_int
.val
= GLOBAL_CONSTRUCTORS
;
3738 /* Find the end of the symbol. */
3739 p
= symbol_end (lexptr
);
3740 yylval
.typed_val_int
.type
= make_name (lexptr
, p
- lexptr
);
3744 if (strncmp (tokstart
, "global destructors keyed to ", 28) == 0)
3747 lexptr
= tokstart
+ 28;
3748 yylval
.typed_val_int
.val
= GLOBAL_DESTRUCTORS
;
3749 /* Find the end of the symbol. */
3750 p
= symbol_end (lexptr
);
3751 yylval
.typed_val_int
.type
= make_name (lexptr
, p
- lexptr
);
3756 HANDLE_SPECIAL ("vtable for ", DEMANGLE_COMPONENT_VTABLE
);
3757 if (strncmp (tokstart
, "delete", 6) == 0)
3759 if (strncmp (tokstart
, "struct", 6) == 0)
3761 if (strncmp (tokstart
, "signed", 6) == 0)
3762 return SIGNED_KEYWORD
;
3763 if (strncmp (tokstart
, "sizeof", 6) == 0)
3765 if (strncmp (tokstart
, "double", 6) == 0)
3766 return DOUBLE_KEYWORD
;
3769 HANDLE_SPECIAL ("guard variable for ", DEMANGLE_COMPONENT_GUARD
);
3770 if (strncmp (tokstart
, "false", 5) == 0)
3771 return FALSEKEYWORD
;
3772 if (strncmp (tokstart
, "class", 5) == 0)
3774 if (strncmp (tokstart
, "union", 5) == 0)
3776 if (strncmp (tokstart
, "float", 5) == 0)
3777 return FLOAT_KEYWORD
;
3778 if (strncmp (tokstart
, "short", 5) == 0)
3780 if (strncmp (tokstart
, "const", 5) == 0)
3781 return CONST_KEYWORD
;
3784 if (strncmp (tokstart
, "void", 4) == 0)
3786 if (strncmp (tokstart
, "bool", 4) == 0)
3788 if (strncmp (tokstart
, "char", 4) == 0)
3790 if (strncmp (tokstart
, "enum", 4) == 0)
3792 if (strncmp (tokstart
, "long", 4) == 0)
3794 if (strncmp (tokstart
, "true", 4) == 0)
3798 HANDLE_SPECIAL ("VTT for ", DEMANGLE_COMPONENT_VTT
);
3799 HANDLE_SPECIAL ("non-virtual thunk to ", DEMANGLE_COMPONENT_THUNK
);
3800 if (strncmp (tokstart
, "new", 3) == 0)
3802 if (strncmp (tokstart
, "int", 3) == 0)
3809 yylval
.comp
= make_name (tokstart
, namelen
);
3819 error_lexptr
= prev_lexptr
;
3820 global_errmsg
= msg
? msg
: "parse error";
3823 /* Allocate all the components we'll need to build a tree. We generally
3824 allocate too many components, but the extra memory usage doesn't hurt
3825 because the trees are temporary. If we start keeping the trees for
3826 a longer lifetime we'll need to be cleverer. */
3827 static struct demangle_info
*
3828 allocate_info (int comps
)
3830 struct demangle_info
*ret
;
3832 ret
= xmalloc (sizeof (struct demangle_info
)
3833 + sizeof (struct demangle_component
) * (comps
- 1));
3838 /* Convert RESULT to a string. The return value is allocated
3839 using xmalloc. ESTIMATED_LEN is used only as a guide to the
3840 length of the result. This functions handles a few cases that
3841 cplus_demangle_print does not, specifically the global destructor
3842 and constructor labels. */
3845 cp_comp_to_string (struct demangle_component
*result
, int estimated_len
)
3847 char *str
, *prefix
= NULL
, *buf
;
3850 if (result
->type
== GLOBAL_DESTRUCTORS
)
3852 result
= d_left (result
);
3853 prefix
= "global destructors keyed to ";
3855 else if (result
->type
== GLOBAL_CONSTRUCTORS
)
3857 result
= d_left (result
);
3858 prefix
= "global constructors keyed to ";
3861 str
= cplus_demangle_print (DMGL_PARAMS
| DMGL_ANSI
, result
, estimated_len
, &err
);
3868 buf
= xmalloc (strlen (str
) + strlen (prefix
) + 1);
3869 strcpy (buf
, prefix
);
3875 /* Convert a demangled name to a demangle_component tree. *MEMORY is set to the
3876 block of used memory that should be freed when finished with the
3877 tree. On error, NULL is returned, and an error message will be
3878 set in *ERRMSG (which does not need to be freed). */
3880 struct demangle_component
*
3881 cp_demangled_name_to_comp (const char *demangled_name
, void **memory
,
3882 const char **errmsg
)
3884 static char errbuf
[60];
3885 struct demangle_component
*result
;
3887 int len
= strlen (demangled_name
);
3889 len
= len
+ len
/ 8;
3890 prev_lexptr
= lexptr
= demangled_name
;
3891 error_lexptr
= NULL
;
3892 global_errmsg
= NULL
;
3894 demangle_info
= allocate_info (len
);
3898 if (global_errmsg
&& errmsg
)
3900 snprintf (errbuf
, sizeof (errbuf
) - 2, "%s, near `%s",
3901 global_errmsg
, error_lexptr
);
3902 strcat (errbuf
, "'");
3905 free (demangle_info
);
3909 *memory
= demangle_info
;
3910 result
= global_result
;
3911 global_result
= NULL
;
3919 cp_print (struct demangle_component
*result
)
3924 if (result
->type
== GLOBAL_DESTRUCTORS
)
3926 result
= d_left (result
);
3927 fputs ("global destructors keyed to ", stdout
);
3929 else if (result
->type
== GLOBAL_CONSTRUCTORS
)
3931 result
= d_left (result
);
3932 fputs ("global constructors keyed to ", stdout
);
3935 str
= cplus_demangle_print (DMGL_PARAMS
| DMGL_ANSI
, result
, 64, &err
);
3939 fputs (str
, stdout
);
3945 trim_chars (char *lexptr
, char **extra_chars
)
3947 char *p
= (char *) symbol_end (lexptr
);
3954 *extra_chars
= p
+ 1;
3961 main (int argc
, char **argv
)
3963 char *str2
, *extra_chars
, c
;
3968 struct demangle_component
*result
;
3971 if (argv
[arg
] && strcmp (argv
[arg
], "--debug") == 0)
3977 if (argv
[arg
] == NULL
)
3978 while (fgets (buf
, 65536, stdin
) != NULL
)
3981 buf
[strlen (buf
) - 1] = 0;
3982 /* Use DMGL_VERBOSE to get expanded standard substitutions. */
3983 c
= trim_chars (buf
, &extra_chars
);
3984 str2
= cplus_demangle (buf
, DMGL_PARAMS
| DMGL_ANSI
| DMGL_VERBOSE
);
3987 /* printf ("Demangling error\n"); */
3989 printf ("%s%c%s\n", buf
, c
, extra_chars
);
3991 printf ("%s\n", buf
);
3994 result
= cp_demangled_name_to_comp (str2
, &memory
, &errmsg
);
3997 fputs (errmsg
, stderr
);
3998 fputc ('\n', stderr
);
4009 fputs (extra_chars
, stdout
);
4015 result
= cp_demangled_name_to_comp (argv
[arg
], &memory
, &errmsg
);
4018 fputs (errmsg
, stderr
);
4019 fputc ('\n', stderr
);