1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.2"
50 #define YYSKELETON_NAME "yacc.c"
64 /* Copy the first part of user declarations. */
65 #line 36 "ada-exp.y" /* yacc.c:339 */
70 #include "expression.h"
72 #include "parser-defs.h"
75 #include "bfd.h" /* Required by objfiles.h. */
76 #include "symfile.h" /* Required by objfiles.h. */
77 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
81 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
83 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
84 as well as gratuitiously global symbol names, so we can have multiple
85 yacc generated parsers in gdb. These are only the variables
86 produced by yacc. If other parser generators (bison, byacc, etc) produce
87 additional global names that conflict at link time, then those parser
88 generators need to be fixed instead of adding those names to this list. */
90 /* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
91 options. I presume we are maintaining it to accommodate systems
92 without BISON? (PNH) */
94 #define yymaxdepth ada_maxdepth
95 /* ada_parse calls this after initialization */
96 #define yyparse ada_parse_internal
98 #define yyerror ada_error
99 #define yylval ada_lval
100 #define yychar ada_char
101 #define yydebug ada_debug
102 #define yypact ada_pact
105 #define yydef ada_def
106 #define yychk ada_chk
107 #define yypgo ada_pgo
108 #define yyact ada_act
109 #define yyexca ada_exca
110 #define yyerrflag ada_errflag
111 #define yynerrs ada_nerrs
115 #define yy_yys ada_yys
116 #define yystate ada_state
117 #define yytmp ada_tmp
119 #define yy_yyv ada_yyv
120 #define yyval ada_val
121 #define yylloc ada_lloc
122 #define yyreds ada_reds /* With YYDEBUG defined */
123 #define yytoks ada_toks /* With YYDEBUG defined */
124 #define yyname ada_name /* With YYDEBUG defined */
125 #define yyrule ada_rule /* With YYDEBUG defined */
126 #define yyss ada_yyss
127 #define yysslim ada_yysslim
128 #define yyssp ada_yyssp
129 #define yystacksize ada_yystacksize
130 #define yyvs ada_yyvs
131 #define yyvsp ada_yyvsp
134 #define YYDEBUG 1 /* Default to yydebug support */
137 #define YYFPRINTF parser_fprintf
141 struct minimal_symbol *msym;
142 const struct block *block;
143 struct stoken stoken;
146 /* The state of the parser, used internally when we are parsing the
149 static struct parser_state *pstate = NULL;
151 static struct stoken empty_stoken = { "", 0 };
153 /* If expression is in the context of TYPE'(...), then TYPE, else
155 static struct type *type_qualifier;
159 static int yylex (void);
161 void yyerror (char *);
163 static void write_int (struct parser_state *, LONGEST, struct type *);
165 static void write_object_renaming (struct parser_state *,
166 const struct block *, const char *, int,
169 static struct type* write_var_or_type (struct parser_state *,
170 const struct block *, struct stoken);
172 static void write_name_assoc (struct parser_state *, struct stoken);
174 static void write_exp_op_with_string (struct parser_state *, enum exp_opcode,
177 static const struct block *block_lookup (const struct block *, const char *);
179 static LONGEST convert_char_literal (struct type *, LONGEST);
181 static void write_ambiguous_var (struct parser_state *,
182 const struct block *, char *, int);
184 static struct type *type_int (struct parser_state *);
186 static struct type *type_long (struct parser_state *);
188 static struct type *type_long_long (struct parser_state *);
190 static struct type *type_float (struct parser_state *);
192 static struct type *type_double (struct parser_state *);
194 static struct type *type_long_double (struct parser_state *);
196 static struct type *type_char (struct parser_state *);
198 static struct type *type_boolean (struct parser_state *);
200 static struct type *type_system_address (struct parser_state *);
203 #line 204 "ada-exp.c" /* yacc.c:339 */
206 # if defined __cplusplus && 201103L <= __cplusplus
207 # define YY_NULLPTR nullptr
209 # define YY_NULLPTR 0
213 /* Enabling verbose error messages. */
214 #ifdef YYERROR_VERBOSE
215 # undef YYERROR_VERBOSE
216 # define YYERROR_VERBOSE 1
218 # define YYERROR_VERBOSE 0
246 SPECIAL_VARIABLE = 269,
288 #define TRUEKEYWORD 262
289 #define FALSEKEYWORD 263
290 #define COLONCOLON 264
295 #define SPECIAL_VARIABLE 269
315 #define TICK_ACCESS 289
316 #define TICK_ADDRESS 290
317 #define TICK_FIRST 291
318 #define TICK_LAST 292
319 #define TICK_LENGTH 293
322 #define TICK_MODULUS 296
324 #define TICK_RANGE 298
325 #define TICK_SIZE 299
332 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
333 typedef union YYSTYPE YYSTYPE;
336 #line 175 "ada-exp.y" /* yacc.c:355 */
349 const struct block *bval;
350 struct internalvar *ivar;
353 #line 354 "ada-exp.c" /* yacc.c:355 */
355 # define YYSTYPE_IS_TRIVIAL 1
356 # define YYSTYPE_IS_DECLARED 1
360 extern YYSTYPE yylval;
366 /* Copy the second part of user declarations. */
368 #line 369 "ada-exp.c" /* yacc.c:358 */
375 typedef YYTYPE_UINT8 yytype_uint8;
377 typedef unsigned char yytype_uint8;
381 typedef YYTYPE_INT8 yytype_int8;
383 typedef signed char yytype_int8;
387 typedef YYTYPE_UINT16 yytype_uint16;
389 typedef unsigned short int yytype_uint16;
393 typedef YYTYPE_INT16 yytype_int16;
395 typedef short int yytype_int16;
399 # ifdef __SIZE_TYPE__
400 # define YYSIZE_T __SIZE_TYPE__
401 # elif defined size_t
402 # define YYSIZE_T size_t
403 # elif ! defined YYSIZE_T
404 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
405 # define YYSIZE_T size_t
407 # define YYSIZE_T unsigned int
411 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
414 # if defined YYENABLE_NLS && YYENABLE_NLS
416 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
417 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
421 # define YY_(Msgid) Msgid
426 # if (defined __GNUC__ \
427 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
428 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
429 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
431 # define YY_ATTRIBUTE(Spec) /* empty */
435 #ifndef YY_ATTRIBUTE_PURE
436 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
439 #ifndef YY_ATTRIBUTE_UNUSED
440 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
443 #if !defined _Noreturn \
444 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
445 # if defined _MSC_VER && 1200 <= _MSC_VER
446 # define _Noreturn __declspec (noreturn)
448 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
452 /* Suppress unused-variable warnings by "using" E. */
453 #if ! defined lint || defined __GNUC__
454 # define YYUSE(E) ((void) (E))
456 # define YYUSE(E) /* empty */
459 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
460 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
461 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
462 _Pragma ("GCC diagnostic push") \
463 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
464 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
465 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
466 _Pragma ("GCC diagnostic pop")
468 # define YY_INITIAL_VALUE(Value) Value
470 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
471 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
472 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
474 #ifndef YY_INITIAL_VALUE
475 # define YY_INITIAL_VALUE(Value) /* Nothing. */
479 #if ! defined yyoverflow || YYERROR_VERBOSE
481 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
483 # ifdef YYSTACK_USE_ALLOCA
484 # if YYSTACK_USE_ALLOCA
486 # define YYSTACK_ALLOC __builtin_alloca
487 # elif defined __BUILTIN_VA_ARG_INCR
488 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
490 # define YYSTACK_ALLOC __alloca
491 # elif defined _MSC_VER
492 # define alloca _alloca
494 # define YYSTACK_ALLOC alloca
495 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
496 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
497 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
498 # ifndef EXIT_SUCCESS
499 # define EXIT_SUCCESS 0
506 # ifdef YYSTACK_ALLOC
507 /* Pacify GCC's 'empty if-body' warning. */
508 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
509 # ifndef YYSTACK_ALLOC_MAXIMUM
510 /* The OS might guarantee only one guard page at the bottom of the stack,
511 and a page size can be as small as 4096 bytes. So we cannot safely
512 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
513 to allow for a few compiler-allocated temporary stack slots. */
514 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
517 # define YYSTACK_ALLOC YYMALLOC
518 # define YYSTACK_FREE YYFREE
519 # ifndef YYSTACK_ALLOC_MAXIMUM
520 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
522 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
523 && ! ((defined YYMALLOC || defined xmalloc) \
524 && (defined YYFREE || defined xfree)))
525 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
526 # ifndef EXIT_SUCCESS
527 # define EXIT_SUCCESS 0
531 # define YYMALLOC xmalloc
532 # if ! defined xmalloc && ! defined EXIT_SUCCESS
533 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
537 # define YYFREE xfree
538 # if ! defined xfree && ! defined EXIT_SUCCESS
539 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
543 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
546 #if (! defined yyoverflow \
547 && (! defined __cplusplus \
548 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
550 /* A type that is properly aligned for any stack member. */
553 yytype_int16 yyss_alloc;
557 /* The size of the maximum gap between one aligned stack and the next. */
558 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
560 /* The size of an array large to enough to hold all stacks, each with
562 # define YYSTACK_BYTES(N) \
563 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
564 + YYSTACK_GAP_MAXIMUM)
566 # define YYCOPY_NEEDED 1
568 /* Relocate STACK from its old location to the new one. The
569 local variables YYSIZE and YYSTACKSIZE give the old and new number of
570 elements in the stack, and YYPTR gives the new location of the
571 stack. Advance YYPTR to a properly aligned location for the next
573 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
576 YYSIZE_T yynewbytes; \
577 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
578 Stack = &yyptr->Stack_alloc; \
579 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
580 yyptr += yynewbytes / sizeof (*yyptr); \
586 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
587 /* Copy COUNT objects from SRC to DST. The source and destination do
590 # if defined __GNUC__ && 1 < __GNUC__
591 # define YYCOPY(Dst, Src, Count) \
592 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
594 # define YYCOPY(Dst, Src, Count) \
598 for (yyi = 0; yyi < (Count); yyi++) \
599 (Dst)[yyi] = (Src)[yyi]; \
604 #endif /* !YYCOPY_NEEDED */
606 /* YYFINAL -- State number of the termination state. */
608 /* YYLAST -- Last index in YYTABLE. */
611 /* YYNTOKENS -- Number of terminals. */
613 /* YYNNTS -- Number of nonterminals. */
615 /* YYNRULES -- Number of rules. */
617 /* YYNSTATES -- Number of states. */
618 #define YYNSTATES 233
620 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
621 by yylex, with out-of-bounds checking. */
623 #define YYMAXUTOK 303
625 #define YYTRANSLATE(YYX) \
626 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
628 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
629 as returned by yylex, without out-of-bounds checking. */
630 static const yytype_uint8 yytranslate[] =
632 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 32, 64,
636 58, 63, 34, 30, 65, 31, 57, 35, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 62,
638 23, 21, 24, 2, 29, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 59, 2, 68, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 66, 43, 67, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
647 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
648 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
649 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
650 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
651 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
652 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
653 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
654 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
655 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
656 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
657 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
658 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
659 15, 16, 17, 18, 19, 20, 22, 25, 26, 27,
660 28, 33, 36, 37, 38, 39, 40, 41, 42, 44,
661 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
666 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
667 static const yytype_uint16 yyrline[] =
669 0, 240, 240, 244, 245, 247, 252, 256, 261, 267,
670 286, 286, 298, 302, 304, 312, 323, 333, 337, 340,
671 343, 347, 351, 355, 359, 362, 364, 366, 368, 372,
672 385, 389, 393, 397, 401, 405, 409, 413, 417, 421,
673 424, 428, 432, 436, 438, 443, 451, 455, 461, 472,
674 476, 480, 484, 485, 486, 487, 488, 489, 493, 495,
675 500, 502, 507, 509, 514, 516, 520, 522, 534, 536,
676 543, 546, 549, 552, 554, 556, 558, 560, 562, 564,
677 568, 570, 575, 585, 587, 594, 598, 606, 614, 618,
678 624, 626, 630, 634, 636, 638, 646, 657, 659, 664,
679 673, 674, 680, 685, 691, 700, 701, 702, 706, 711,
680 726, 725, 728, 731, 730, 737, 736, 739, 742, 741,
685 #if YYDEBUG || YYERROR_VERBOSE || 0
686 /* YYTNAME[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", "NULL_PTR", "CHARLIT", "FLOAT",
691 "TRUEKEYWORD", "FALSEKEYWORD", "COLONCOLON", "STRING", "NAME", "DOT_ID",
692 "DOT_ALL", "SPECIAL_VARIABLE", "ASSIGN", "_AND_", "OR", "XOR", "THEN",
693 "ELSE", "'='", "NOTEQUAL", "'<'", "'>'", "LEQ", "GEQ", "IN", "DOTDOT",
694 "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'", "'/'", "MOD", "REM",
695 "STARSTAR", "ABS", "NOT", "VAR", "ARROW", "'|'", "TICK_ACCESS",
696 "TICK_ADDRESS", "TICK_FIRST", "TICK_LAST", "TICK_LENGTH", "TICK_MAX",
697 "TICK_MIN", "TICK_MODULUS", "TICK_POS", "TICK_RANGE", "TICK_SIZE",
698 "TICK_TAG", "TICK_VAL", "'.'", "'('", "'['", "NEW", "OTHERS", "';'",
699 "')'", "'\\''", "','", "'{'", "'}'", "']'", "$accept", "start", "exp1",
700 "primary", "$@1", "save_qualifier", "simple_exp", "arglist", "relation",
701 "exp", "and_exp", "and_then_exp", "or_exp", "or_else_exp", "xor_exp",
702 "tick_arglist", "type_prefix", "opt_type_prefix", "var_or_type", "block",
703 "aggregate", "aggregate_component_list", "positional_list",
704 "component_groups", "others", "component_group",
705 "component_associations", "$@2", "$@3", "$@4", "$@5", YY_NULLPTR
710 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
711 (internal) symbol number NUM (which must be that of a token). */
712 static const yytype_uint16 yytoknum[] =
714 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
715 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
716 275, 61, 276, 60, 62, 277, 278, 279, 280, 64,
717 43, 45, 38, 281, 42, 47, 282, 283, 284, 285,
718 286, 287, 288, 124, 289, 290, 291, 292, 293, 294,
719 295, 296, 297, 298, 299, 300, 301, 46, 40, 91,
720 302, 303, 59, 41, 39, 44, 123, 125, 93
724 #define YYPACT_NINF -104
726 #define yypact_value_is_default(Yystate) \
727 (!!((Yystate) == (-104)))
729 #define YYTABLE_NINF -83
731 #define yytable_value_is_error(Yytable_value) \
734 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
736 static const yytype_int16 yypact[] =
738 430, -104, -104, -104, -104, -104, -104, -104, 3, -104,
739 430, 430, 544, 544, 430, 430, 289, 44, 49, 26,
740 -53, -2, 679, 86, -104, 50, 55, 48, 57, 74,
741 -28, -1, 275, 61, -104, -104, -104, 577, 219, 219,
742 9, 9, 219, 219, 54, 58, -31, 616, 42, 45,
743 289, -104, -104, 46, -104, -104, 43, -104, 430, -104,
744 -104, 430, -104, -104, 59, 59, 59, -104, -104, 277,
745 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
746 430, 430, 430, 430, 430, 430, 430, 89, 353, 392,
747 430, 430, 94, 430, 100, 430, -104, 63, 64, 65,
748 67, 277, -104, 15, -104, -104, 430, -104, 430, 430,
749 468, -104, -104, 62, -104, 289, 544, -104, -104, 125,
750 -104, -104, -104, -4, 639, -57, -104, 70, 117, 117,
751 117, 117, 117, 117, 149, 563, 174, 549, 219, 219,
752 219, 91, 91, 91, 91, 91, 430, 430, -104, 430,
753 -104, -104, -104, 430, -104, 430, -104, 430, 430, 430,
754 430, 659, -38, -104, -104, -104, 430, 468, -104, 339,
755 -104, 692, -104, -104, -104, 9, 69, 430, 430, -104,
756 506, -104, 59, 430, 561, 708, 211, -104, -104, -104,
757 -104, 81, 99, 102, 93, 430, -104, 72, -104, -104,
758 -104, -104, -104, -104, 105, 82, -104, -104, 117, 59,
759 430, -104, 430, 430, -104, 214, 430, 430, 468, -104,
760 430, -104, 117, 106, 107, -104, 109, -104, -104, -104,
764 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
765 Performed when YYTABLE does not specify something else to do. Zero
766 means the default is an error. */
767 static const yytype_uint8 yydefact[] =
769 84, 85, 88, 86, 87, 90, 91, 89, 93, 17,
770 84, 84, 84, 84, 84, 84, 84, 0, 0, 0,
771 2, 19, 39, 52, 3, 53, 54, 55, 56, 57,
772 83, 0, 16, 0, 18, 97, 95, 19, 21, 20,
773 121, 120, 23, 22, 93, 0, 0, 39, 3, 0,
774 84, 100, 105, 106, 109, 92, 0, 1, 84, 7,
775 6, 84, 68, 69, 80, 80, 80, 73, 74, 84,
776 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
777 84, 84, 84, 84, 84, 84, 84, 0, 84, 84,
778 84, 84, 0, 84, 0, 84, 79, 0, 0, 0,
779 0, 84, 12, 94, 110, 115, 84, 15, 84, 84,
780 84, 103, 99, 101, 102, 84, 84, 4, 5, 0,
781 70, 71, 72, 93, 39, 0, 25, 0, 40, 41,
782 50, 51, 42, 49, 19, 0, 16, 35, 36, 38,
783 37, 31, 32, 34, 33, 30, 84, 84, 58, 84,
784 62, 66, 59, 84, 63, 84, 67, 84, 84, 84,
785 84, 39, 0, 10, 98, 96, 84, 84, 108, 0,
786 112, 0, 117, 104, 107, 29, 0, 84, 84, 8,
787 84, 122, 80, 84, 19, 0, 16, 60, 64, 61,
788 65, 0, 0, 0, 0, 84, 9, 0, 111, 116,
789 113, 118, 81, 26, 0, 93, 27, 44, 43, 80,
790 84, 78, 84, 84, 77, 0, 84, 84, 84, 13,
791 84, 47, 46, 0, 0, 14, 0, 114, 119, 28,
795 /* YYPGOTO[NTERM-NUM]. */
796 static const yytype_int16 yypgoto[] =
798 -104, -104, 157, 17, -104, -104, 4, 75, -54, 0,
799 -104, -104, -104, -104, -104, -64, -104, -104, -15, -104,
800 -104, -104, -104, -46, -104, -104, -103, -104, -104, -104,
804 /* YYDEFGOTO[NTERM-NUM]. */
805 static const yytype_int16 yydefgoto[] =
807 -1, 19, 20, 37, 197, 163, 22, 125, 23, 126,
808 25, 26, 27, 28, 29, 120, 30, 31, 32, 33,
809 34, 49, 50, 51, 52, 53, 54, 166, 217, 167,
813 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
814 positive, shift that token. If negative, reduce the rule whose
815 number is the opposite. If YYTABLE_NINF, syntax error. */
816 static const yytype_int16 yytable[] =
818 24, 121, 122, 56, 114, 35, 179, 172, 180, 58,
819 59, 60, 35, 61, 38, 39, 48, 21, 42, 43,
820 47, 59, 60, 96, 164, 196, 57, 180, 97, 40,
821 41, 58, 107, 21, 148, 150, 151, 152, 177, 154,
822 36, 156, 62, 63, 64, 65, 66, 36, 98, 99,
823 113, 100, 67, 68, 47, 55, 69, 70, 117, 165,
824 8, 118, 136, 35, 199, 93, 91, 69, 70, 174,
825 127, 92, 103, 124, 94, 128, 129, 130, 131, 132,
826 133, 135, 137, 138, 139, 140, 141, 142, 143, 144,
827 145, 35, 95, 187, 134, 188, 104, 105, 36, 189,
828 106, 190, 88, 89, 90, 161, 168, 111, 112, 170,
829 116, 115, 169, 153, 171, 228, 146, 119, 207, 171,
830 155, 157, 158, 159, 220, 160, 36, 173, 176, 86,
831 216, 186, 202, 175, 78, 79, 80, 81, 181, 82,
832 83, 84, 85, 86, 211, 221, 78, 79, 80, 81,
833 185, 82, 83, 84, 85, 86, 214, 191, 192, 193,
834 194, 59, 60, 184, 212, 0, 198, 213, 219, 230,
835 231, 171, 232, 46, -45, 0, 162, 203, 0, 0,
836 206, 0, 204, 0, 0, 0, 0, 208, 0, 0,
837 -45, -45, -45, 62, 63, 64, 65, 66, 0, 215,
838 0, 0, 182, 67, 68, 0, 0, 69, 70, 0,
839 0, -48, 223, 224, 222, 0, 226, 227, 0, 0,
840 229, 0, 171, -82, -82, -82, -82, -48, -48, -48,
841 -82, 0, 101, 0, 0, 0, -45, -45, 102, -45,
842 0, 0, -45, 78, 79, 80, 81, 0, 82, 83,
843 84, 85, 86, 82, 83, 84, 85, 86, 0, 0,
844 -82, -82, -82, -82, 0, 0, 0, -82, 0, 101,
845 0, 0, 0, -48, -48, 102, -48, 225, 0, -48,
846 1, 2, 3, 4, 5, 6, 0, 7, 123, 0,
847 0, 9, 1, 2, 3, 4, 5, 6, 0, 7,
848 44, 0, 0, 9, 0, 0, 0, 10, 11, 12,
849 0, 13, 0, 0, 0, 0, 14, 15, 0, 10,
850 11, 12, 0, 13, -82, -82, -82, -82, 14, 15,
851 0, -82, 0, 101, 0, 16, 0, 17, 0, 102,
852 -24, 0, -24, 18, 0, 0, 0, 16, 0, 17,
853 45, 0, 0, 0, 0, 18, 1, 2, 3, 4,
854 5, 6, 0, 7, 8, 0, 0, 9, 78, 79,
855 80, 81, 147, 82, 83, 84, 85, 86, 0, 0,
856 0, 200, 201, 10, 11, 12, 0, 13, 0, 0,
857 0, 0, 14, 15, 0, 1, 2, 3, 4, 5,
858 6, 0, 7, 8, 0, 0, 9, 0, 0, 0,
859 0, 16, 149, 17, 0, 0, 0, 0, 0, 18,
860 0, 0, 10, 11, 12, 0, 13, 0, 0, 0,
861 0, 14, 15, 1, 2, 3, 4, 5, 6, 0,
862 7, 8, 0, 0, 9, 0, 0, 0, 0, 0,
863 16, 0, 17, 0, 0, 0, 0, 0, 18, 0,
864 10, 11, 12, 0, 13, 0, 0, 0, 0, 14,
865 15, 1, 2, 3, 4, 5, 6, 0, 7, 44,
866 0, 0, 9, 0, 0, 0, 0, 0, 16, 0,
867 17, 0, 0, 0, 0, 0, 18, 0, 10, 11,
868 12, 0, 13, 0, 0, 0, 0, 14, 15, 1,
869 2, 3, 4, 5, 6, 0, 7, 205, 0, 0,
870 9, 0, 0, 0, 0, 0, 16, 0, 17, 0,
871 0, 0, 0, 0, 18, 0, 10, 11, 12, 0,
872 13, 0, 0, 0, 0, 14, 15, 1, 2, 3,
873 4, 5, 6, 0, 7, 8, 0, 0, 9, 0,
874 0, 0, 0, 0, 16, 0, 17, 0, 0, 0,
875 0, 0, 18, 59, 60, 0, 12, 0, 13, 79,
876 80, 81, 0, 82, 83, 84, 85, 86, 0, 59,
877 60, 183, 78, 79, 80, 81, 0, 82, 83, 84,
878 85, 86, 16, 0, 17, 62, 63, 64, 65, 66,
879 18, 0, 0, 0, 209, 67, 68, 0, 0, 69,
880 70, 62, 63, 64, 65, 66, 0, 0, 0, 0,
881 0, 67, 68, 0, 0, 69, 70, 71, 72, 73,
882 74, 75, 76, 77, 108, 78, 79, 80, 81, 0,
883 82, 83, 84, 85, 86, 0, 87, 0, 109, 110,
884 71, 72, 73, 74, 75, 76, 77, 178, 78, 79,
885 80, 81, 0, 82, 83, 84, 85, 86, 0, 87,
886 71, 72, 73, 74, 75, 76, 77, 195, 78, 79,
887 80, 81, 0, 82, 83, 84, 85, 86, 0, 87,
888 71, 72, 73, 74, 75, 76, 77, 0, 78, 79,
889 80, 81, 0, 82, 83, 84, 85, 86, 0, 87,
890 108, 78, 79, 80, 81, 0, 82, 83, 84, 85,
891 86, 0, 0, 0, 109, 110, 210, 78, 79, 80,
892 81, 0, 82, 83, 84, 85, 86
895 static const yytype_int16 yycheck[] =
897 0, 65, 66, 18, 50, 9, 63, 110, 65, 62,
898 12, 13, 9, 15, 10, 11, 16, 0, 14, 15,
899 16, 12, 13, 51, 9, 63, 0, 65, 56, 12,
900 13, 62, 63, 16, 88, 89, 90, 91, 42, 93,
901 44, 95, 44, 45, 46, 47, 48, 44, 49, 50,
902 50, 52, 54, 55, 50, 11, 58, 59, 58, 44,
903 11, 61, 77, 9, 167, 17, 16, 58, 59, 115,
904 70, 16, 11, 69, 17, 71, 72, 73, 74, 75,
905 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
906 86, 9, 18, 147, 77, 149, 42, 43, 44, 153,
907 42, 155, 16, 17, 18, 101, 106, 65, 63, 109,
908 67, 65, 108, 19, 110, 218, 27, 58, 182, 115,
909 20, 58, 58, 58, 42, 58, 44, 65, 3, 38,
910 58, 146, 63, 116, 29, 30, 31, 32, 68, 34,
911 35, 36, 37, 38, 63, 209, 29, 30, 31, 32,
912 146, 34, 35, 36, 37, 38, 63, 157, 158, 159,
913 160, 12, 13, 146, 65, -1, 166, 65, 63, 63,
914 63, 167, 63, 16, 0, -1, 101, 177, -1, -1,
915 180, -1, 178, -1, -1, -1, -1, 183, -1, -1,
916 16, 17, 18, 44, 45, 46, 47, 48, -1, 195,
917 -1, -1, 53, 54, 55, -1, -1, 58, 59, -1,
918 -1, 0, 212, 213, 210, -1, 216, 217, -1, -1,
919 220, -1, 218, 49, 50, 51, 52, 16, 17, 18,
920 56, -1, 58, -1, -1, -1, 62, 63, 64, 65,
921 -1, -1, 68, 29, 30, 31, 32, -1, 34, 35,
922 36, 37, 38, 34, 35, 36, 37, 38, -1, -1,
923 49, 50, 51, 52, -1, -1, -1, 56, -1, 58,
924 -1, -1, -1, 62, 63, 64, 65, 63, -1, 68,
925 3, 4, 5, 6, 7, 8, -1, 10, 11, -1,
926 -1, 14, 3, 4, 5, 6, 7, 8, -1, 10,
927 11, -1, -1, 14, -1, -1, -1, 30, 31, 32,
928 -1, 34, -1, -1, -1, -1, 39, 40, -1, 30,
929 31, 32, -1, 34, 49, 50, 51, 52, 39, 40,
930 -1, 56, -1, 58, -1, 58, -1, 60, -1, 64,
931 63, -1, 65, 66, -1, -1, -1, 58, -1, 60,
932 61, -1, -1, -1, -1, 66, 3, 4, 5, 6,
933 7, 8, -1, 10, 11, -1, -1, 14, 29, 30,
934 31, 32, 19, 34, 35, 36, 37, 38, -1, -1,
935 -1, 42, 43, 30, 31, 32, -1, 34, -1, -1,
936 -1, -1, 39, 40, -1, 3, 4, 5, 6, 7,
937 8, -1, 10, 11, -1, -1, 14, -1, -1, -1,
938 -1, 58, 20, 60, -1, -1, -1, -1, -1, 66,
939 -1, -1, 30, 31, 32, -1, 34, -1, -1, -1,
940 -1, 39, 40, 3, 4, 5, 6, 7, 8, -1,
941 10, 11, -1, -1, 14, -1, -1, -1, -1, -1,
942 58, -1, 60, -1, -1, -1, -1, -1, 66, -1,
943 30, 31, 32, -1, 34, -1, -1, -1, -1, 39,
944 40, 3, 4, 5, 6, 7, 8, -1, 10, 11,
945 -1, -1, 14, -1, -1, -1, -1, -1, 58, -1,
946 60, -1, -1, -1, -1, -1, 66, -1, 30, 31,
947 32, -1, 34, -1, -1, -1, -1, 39, 40, 3,
948 4, 5, 6, 7, 8, -1, 10, 11, -1, -1,
949 14, -1, -1, -1, -1, -1, 58, -1, 60, -1,
950 -1, -1, -1, -1, 66, -1, 30, 31, 32, -1,
951 34, -1, -1, -1, -1, 39, 40, 3, 4, 5,
952 6, 7, 8, -1, 10, 11, -1, -1, 14, -1,
953 -1, -1, -1, -1, 58, -1, 60, -1, -1, -1,
954 -1, -1, 66, 12, 13, -1, 32, -1, 34, 30,
955 31, 32, -1, 34, 35, 36, 37, 38, -1, 12,
956 13, 28, 29, 30, 31, 32, -1, 34, 35, 36,
957 37, 38, 58, -1, 60, 44, 45, 46, 47, 48,
958 66, -1, -1, -1, 53, 54, 55, -1, -1, 58,
959 59, 44, 45, 46, 47, 48, -1, -1, -1, -1,
960 -1, 54, 55, -1, -1, 58, 59, 21, 22, 23,
961 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
962 34, 35, 36, 37, 38, -1, 40, -1, 42, 43,
963 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
964 31, 32, -1, 34, 35, 36, 37, 38, -1, 40,
965 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
966 31, 32, -1, 34, 35, 36, 37, 38, -1, 40,
967 21, 22, 23, 24, 25, 26, 27, -1, 29, 30,
968 31, 32, -1, 34, 35, 36, 37, 38, -1, 40,
969 28, 29, 30, 31, 32, -1, 34, 35, 36, 37,
970 38, -1, -1, -1, 42, 43, 28, 29, 30, 31,
971 32, -1, 34, 35, 36, 37, 38
974 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
975 symbol of state STATE-NUM. */
976 static const yytype_uint8 yystos[] =
978 0, 3, 4, 5, 6, 7, 8, 10, 11, 14,
979 30, 31, 32, 34, 39, 40, 58, 60, 66, 70,
980 71, 72, 75, 77, 78, 79, 80, 81, 82, 83,
981 85, 86, 87, 88, 89, 9, 44, 72, 75, 75,
982 72, 72, 75, 75, 11, 61, 71, 75, 78, 90,
983 91, 92, 93, 94, 95, 11, 87, 0, 62, 12,
984 13, 15, 44, 45, 46, 47, 48, 54, 55, 58,
985 59, 21, 22, 23, 24, 25, 26, 27, 29, 30,
986 31, 32, 34, 35, 36, 37, 38, 40, 16, 17,
987 18, 16, 16, 17, 17, 18, 51, 56, 49, 50,
988 52, 58, 64, 11, 42, 43, 42, 63, 28, 42,
989 43, 65, 63, 78, 92, 65, 67, 78, 78, 58,
990 84, 84, 84, 11, 75, 76, 78, 78, 75, 75,
991 75, 75, 75, 75, 72, 75, 87, 75, 75, 75,
992 75, 75, 75, 75, 75, 75, 27, 19, 77, 20,
993 77, 77, 77, 19, 77, 20, 77, 58, 58, 58,
994 58, 75, 76, 74, 9, 44, 96, 98, 78, 75,
995 78, 75, 95, 65, 92, 72, 3, 42, 28, 63,
996 65, 68, 53, 28, 72, 75, 87, 77, 77, 77,
997 77, 78, 78, 78, 78, 28, 63, 73, 78, 95,
998 42, 43, 63, 78, 75, 11, 78, 84, 75, 53,
999 28, 63, 65, 65, 63, 75, 58, 97, 99, 63,
1000 42, 84, 75, 78, 78, 63, 78, 78, 95, 78,
1004 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1005 static const yytype_uint8 yyr1[] =
1007 0, 69, 70, 71, 71, 71, 72, 72, 72, 72,
1008 73, 72, 74, 72, 72, 72, 72, 72, 72, 75,
1009 75, 75, 75, 75, 76, 76, 76, 76, 76, 72,
1010 75, 75, 75, 75, 75, 75, 75, 75, 75, 77,
1011 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
1012 77, 77, 78, 78, 78, 78, 78, 78, 79, 79,
1013 80, 80, 81, 81, 82, 82, 83, 83, 72, 72,
1014 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
1015 84, 84, 85, 86, 86, 72, 72, 72, 72, 72,
1016 72, 72, 72, 87, 87, 87, 87, 88, 88, 89,
1017 90, 90, 90, 91, 91, 92, 92, 92, 93, 94,
1018 96, 95, 95, 97, 95, 98, 95, 95, 99, 95,
1022 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1023 static const yytype_uint8 yyr2[] =
1025 0, 2, 1, 1, 3, 3, 2, 2, 4, 4,
1026 0, 7, 0, 6, 6, 3, 1, 1, 1, 1,
1027 2, 2, 2, 2, 0, 1, 3, 3, 5, 4,
1028 3, 3, 3, 3, 3, 3, 3, 3, 3, 1,
1029 3, 3, 3, 5, 5, 3, 6, 6, 4, 3,
1030 3, 3, 1, 1, 1, 1, 1, 1, 3, 3,
1031 4, 4, 3, 3, 4, 4, 3, 3, 2, 2,
1032 3, 3, 3, 2, 2, 7, 7, 5, 5, 2,
1033 0, 3, 1, 1, 0, 1, 1, 1, 1, 1,
1034 1, 1, 2, 1, 2, 2, 3, 2, 3, 3,
1035 1, 2, 2, 2, 3, 1, 1, 3, 3, 1,
1036 0, 4, 3, 0, 6, 0, 4, 3, 0, 6,
1041 #define yyerrok (yyerrstatus = 0)
1042 #define yyclearin (yychar = YYEMPTY)
1043 #define YYEMPTY (-2)
1046 #define YYACCEPT goto yyacceptlab
1047 #define YYABORT goto yyabortlab
1048 #define YYERROR goto yyerrorlab
1051 #define YYRECOVERING() (!!yyerrstatus)
1053 #define YYBACKUP(Token, Value) \
1055 if (yychar == YYEMPTY) \
1059 YYPOPSTACK (yylen); \
1065 yyerror (YY_("syntax error: cannot back up")); \
1070 /* Error token number */
1072 #define YYERRCODE 256
1076 /* Enable debugging if requested. */
1080 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1081 # define YYFPRINTF fprintf
1084 # define YYDPRINTF(Args) \
1090 /* This macro is provided for backward compatibility. */
1091 #ifndef YY_LOCATION_PRINT
1092 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1096 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1100 YYFPRINTF (stderr, "%s ", Title); \
1101 yy_symbol_print (stderr, \
1103 YYFPRINTF (stderr, "\n"); \
1108 /*----------------------------------------.
1109 | Print this symbol's value on YYOUTPUT. |
1110 `----------------------------------------*/
1113 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1115 FILE *yyo = yyoutput;
1120 if (yytype < YYNTOKENS)
1121 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1127 /*--------------------------------.
1128 | Print this symbol on YYOUTPUT. |
1129 `--------------------------------*/
1132 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1134 YYFPRINTF (yyoutput, "%s %s (",
1135 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1137 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1138 YYFPRINTF (yyoutput, ")");
1141 /*------------------------------------------------------------------.
1142 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1144 `------------------------------------------------------------------*/
1147 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1149 YYFPRINTF (stderr, "Stack now");
1150 for (; yybottom <= yytop; yybottom++)
1152 int yybot = *yybottom;
1153 YYFPRINTF (stderr, " %d", yybot);
1155 YYFPRINTF (stderr, "\n");
1158 # define YY_STACK_PRINT(Bottom, Top) \
1161 yy_stack_print ((Bottom), (Top)); \
1165 /*------------------------------------------------.
1166 | Report that the YYRULE is going to be reduced. |
1167 `------------------------------------------------*/
1170 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
1172 unsigned long int yylno = yyrline[yyrule];
1173 int yynrhs = yyr2[yyrule];
1175 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1177 /* The symbols being reduced. */
1178 for (yyi = 0; yyi < yynrhs; yyi++)
1180 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1181 yy_symbol_print (stderr,
1182 yystos[yyssp[yyi + 1 - yynrhs]],
1183 &(yyvsp[(yyi + 1) - (yynrhs)])
1185 YYFPRINTF (stderr, "\n");
1189 # define YY_REDUCE_PRINT(Rule) \
1192 yy_reduce_print (yyssp, yyvsp, Rule); \
1195 /* Nonzero means print parse trace. It is left uninitialized so that
1196 multiple parsers can coexist. */
1198 #else /* !YYDEBUG */
1199 # define YYDPRINTF(Args)
1200 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1201 # define YY_STACK_PRINT(Bottom, Top)
1202 # define YY_REDUCE_PRINT(Rule)
1203 #endif /* !YYDEBUG */
1206 /* YYINITDEPTH -- initial size of the parser's stacks. */
1208 # define YYINITDEPTH 200
1211 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1212 if the built-in stack extension method is used).
1214 Do not make this value too large; the results are undefined if
1215 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1216 evaluated with infinite-precision integer arithmetic. */
1219 # define YYMAXDEPTH 10000
1226 # if defined __GLIBC__ && defined _STRING_H
1227 # define yystrlen strlen
1229 /* Return the length of YYSTR. */
1231 yystrlen (const char *yystr)
1234 for (yylen = 0; yystr[yylen]; yylen++)
1242 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1243 # define yystpcpy stpcpy
1245 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1248 yystpcpy (char *yydest, const char *yysrc)
1251 const char *yys = yysrc;
1253 while ((*yyd++ = *yys++) != '\0')
1262 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1263 quotes and backslashes, so that it's suitable for yyerror. The
1264 heuristic is that double-quoting is unnecessary unless the string
1265 contains an apostrophe, a comma, or backslash (other than
1266 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1267 null, do not copy; instead, return the length of what the result
1270 yytnamerr (char *yyres, const char *yystr)
1275 char const *yyp = yystr;
1282 goto do_not_strip_quotes;
1286 goto do_not_strip_quotes;
1299 do_not_strip_quotes: ;
1303 return yystrlen (yystr);
1305 return yystpcpy (yyres, yystr) - yyres;
1309 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1310 about the unexpected token YYTOKEN for the state stack whose top is
1313 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1314 not large enough to hold the message. In that case, also set
1315 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1316 required number of bytes is too large to store. */
1318 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1319 yytype_int16 *yyssp, int yytoken)
1321 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1322 YYSIZE_T yysize = yysize0;
1323 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1324 /* Internationalized format string. */
1325 const char *yyformat = YY_NULLPTR;
1326 /* Arguments of yyformat. */
1327 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1328 /* Number of reported tokens (one for the "unexpected", one per
1332 /* There are many possibilities here to consider:
1333 - If this state is a consistent state with a default action, then
1334 the only way this function was invoked is if the default action
1335 is an error action. In that case, don't check for expected
1336 tokens because there are none.
1337 - The only way there can be no lookahead present (in yychar) is if
1338 this state is a consistent state with a default action. Thus,
1339 detecting the absence of a lookahead is sufficient to determine
1340 that there is no unexpected or expected token to report. In that
1341 case, just report a simple "syntax error".
1342 - Don't assume there isn't a lookahead just because this state is a
1343 consistent state with a default action. There might have been a
1344 previous inconsistent state, consistent state with a non-default
1345 action, or user semantic action that manipulated yychar.
1346 - Of course, the expected token list depends on states to have
1347 correct lookahead information, and it depends on the parser not
1348 to perform extra reductions after fetching a lookahead from the
1349 scanner and before detecting a syntax error. Thus, state merging
1350 (from LALR or IELR) and default reductions corrupt the expected
1351 token list. However, the list is correct for canonical LR with
1352 one exception: it will still contain any token that will not be
1353 accepted due to an error action in a later state.
1355 if (yytoken != YYEMPTY)
1357 int yyn = yypact[*yyssp];
1358 yyarg[yycount++] = yytname[yytoken];
1359 if (!yypact_value_is_default (yyn))
1361 /* Start YYX at -YYN if negative to avoid negative indexes in
1362 YYCHECK. In other words, skip the first -YYN actions for
1363 this state because they are default actions. */
1364 int yyxbegin = yyn < 0 ? -yyn : 0;
1365 /* Stay within bounds of both yycheck and yytname. */
1366 int yychecklim = YYLAST - yyn + 1;
1367 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1370 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1371 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1372 && !yytable_value_is_error (yytable[yyx + yyn]))
1374 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1380 yyarg[yycount++] = yytname[yyx];
1382 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1383 if (! (yysize <= yysize1
1384 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1394 # define YYCASE_(N, S) \
1398 YYCASE_(0, YY_("syntax error"));
1399 YYCASE_(1, YY_("syntax error, unexpected %s"));
1400 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1401 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1402 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1403 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1408 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1409 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1414 if (*yymsg_alloc < yysize)
1416 *yymsg_alloc = 2 * yysize;
1417 if (! (yysize <= *yymsg_alloc
1418 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1419 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1423 /* Avoid sprintf, as that infringes on the user's name space.
1424 Don't have undefined behavior even if the translation
1425 produced a string with the wrong number of "%s"s. */
1429 while ((*yyp = *yyformat) != '\0')
1430 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1432 yyp += yytnamerr (yyp, yyarg[yyi++]);
1443 #endif /* YYERROR_VERBOSE */
1445 /*-----------------------------------------------.
1446 | Release the memory associated to this symbol. |
1447 `-----------------------------------------------*/
1450 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1455 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1457 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1459 YY_IGNORE_MAYBE_UNINITIALIZED_END
1465 /* The lookahead symbol. */
1468 /* The semantic value of the lookahead symbol. */
1470 /* Number of syntax errors so far. */
1482 /* Number of tokens to shift before error messages enabled. */
1485 /* The stacks and their tools:
1486 'yyss': related to states.
1487 'yyvs': related to semantic values.
1489 Refer to the stacks through separate pointers, to allow yyoverflow
1490 to xreallocate them elsewhere. */
1492 /* The state stack. */
1493 yytype_int16 yyssa[YYINITDEPTH];
1495 yytype_int16 *yyssp;
1497 /* The semantic value stack. */
1498 YYSTYPE yyvsa[YYINITDEPTH];
1502 YYSIZE_T yystacksize;
1506 /* Lookahead token as an internal (translated) token number. */
1508 /* The variables used to return semantic value and location from the
1513 /* Buffer for error messages, and its allocated size. */
1515 char *yymsg = yymsgbuf;
1516 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1519 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1521 /* The number of symbols on the RHS of the reduced rule.
1522 Keep to zero when no symbol should be popped. */
1525 yyssp = yyss = yyssa;
1526 yyvsp = yyvs = yyvsa;
1527 yystacksize = YYINITDEPTH;
1529 YYDPRINTF ((stderr, "Starting parse\n"));
1534 yychar = YYEMPTY; /* Cause a token to be read. */
1537 /*------------------------------------------------------------.
1538 | yynewstate -- Push a new state, which is found in yystate. |
1539 `------------------------------------------------------------*/
1541 /* In all cases, when you get here, the value and location stacks
1542 have just been pushed. So pushing a state here evens the stacks. */
1548 if (yyss + yystacksize - 1 <= yyssp)
1550 /* Get the current used size of the three stacks, in elements. */
1551 YYSIZE_T yysize = yyssp - yyss + 1;
1555 /* Give user a chance to xreallocate the stack. Use copies of
1556 these so that the &'s don't force the real ones into
1558 YYSTYPE *yyvs1 = yyvs;
1559 yytype_int16 *yyss1 = yyss;
1561 /* Each stack pointer address is followed by the size of the
1562 data in use in that stack, in bytes. This used to be a
1563 conditional around just the two extra args, but that might
1564 be undefined if yyoverflow is a macro. */
1565 yyoverflow (YY_("memory exhausted"),
1566 &yyss1, yysize * sizeof (*yyssp),
1567 &yyvs1, yysize * sizeof (*yyvsp),
1573 #else /* no yyoverflow */
1574 # ifndef YYSTACK_RELOCATE
1575 goto yyexhaustedlab;
1577 /* Extend the stack our own way. */
1578 if (YYMAXDEPTH <= yystacksize)
1579 goto yyexhaustedlab;
1581 if (YYMAXDEPTH < yystacksize)
1582 yystacksize = YYMAXDEPTH;
1585 yytype_int16 *yyss1 = yyss;
1586 union yyalloc *yyptr =
1587 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1589 goto yyexhaustedlab;
1590 YYSTACK_RELOCATE (yyss_alloc, yyss);
1591 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1592 # undef YYSTACK_RELOCATE
1594 YYSTACK_FREE (yyss1);
1597 #endif /* no yyoverflow */
1599 yyssp = yyss + yysize - 1;
1600 yyvsp = yyvs + yysize - 1;
1602 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1603 (unsigned long int) yystacksize));
1605 if (yyss + yystacksize - 1 <= yyssp)
1609 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1611 if (yystate == YYFINAL)
1621 /* Do appropriate processing given the current state. Read a
1622 lookahead token if we need one and don't already have one. */
1624 /* First try to decide what to do without reference to lookahead token. */
1625 yyn = yypact[yystate];
1626 if (yypact_value_is_default (yyn))
1629 /* Not known => get a lookahead token if don't already have one. */
1631 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1632 if (yychar == YYEMPTY)
1634 YYDPRINTF ((stderr, "Reading a token: "));
1638 if (yychar <= YYEOF)
1640 yychar = yytoken = YYEOF;
1641 YYDPRINTF ((stderr, "Now at end of input.\n"));
1645 yytoken = YYTRANSLATE (yychar);
1646 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1649 /* If the proper action on seeing token YYTOKEN is to reduce or to
1650 detect an error, take that action. */
1652 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1657 if (yytable_value_is_error (yyn))
1663 /* Count tokens shifted since error; after three, turn off error
1668 /* Shift the lookahead token. */
1669 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1671 /* Discard the shifted token. */
1675 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1677 YY_IGNORE_MAYBE_UNINITIALIZED_END
1682 /*-----------------------------------------------------------.
1683 | yydefault -- do the default action for the current state. |
1684 `-----------------------------------------------------------*/
1686 yyn = yydefact[yystate];
1692 /*-----------------------------.
1693 | yyreduce -- Do a reduction. |
1694 `-----------------------------*/
1696 /* yyn is the number of a rule to reduce with. */
1699 /* If YYLEN is nonzero, implement the default value of the action:
1702 Otherwise, the following line sets YYVAL to garbage.
1703 This behavior is undocumented and Bison
1704 users should not rely upon it. Assigning to YYVAL
1705 unconditionally makes the parser a bit smaller, and it avoids a
1706 GCC warning that YYVAL may be used uninitialized. */
1707 yyval = yyvsp[1-yylen];
1710 YY_REDUCE_PRINT (yyn);
1714 #line 246 "ada-exp.y" /* yacc.c:1646 */
1715 { write_exp_elt_opcode (pstate, BINOP_COMMA); }
1716 #line 1718 "ada-exp.c" /* yacc.c:1646 */
1720 #line 248 "ada-exp.y" /* yacc.c:1646 */
1721 { write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
1722 #line 1724 "ada-exp.c" /* yacc.c:1646 */
1726 #line 253 "ada-exp.y" /* yacc.c:1646 */
1727 { write_exp_elt_opcode (pstate, UNOP_IND); }
1728 #line 1730 "ada-exp.c" /* yacc.c:1646 */
1732 #line 257 "ada-exp.y" /* yacc.c:1646 */
1733 { write_exp_op_with_string (pstate, STRUCTOP_STRUCT,
1735 #line 1737 "ada-exp.c" /* yacc.c:1646 */
1739 #line 262 "ada-exp.y" /* yacc.c:1646 */
1741 write_exp_elt_opcode (pstate, OP_FUNCALL);
1742 write_exp_elt_longcst (pstate, (yyvsp[-1].lval));
1743 write_exp_elt_opcode (pstate, OP_FUNCALL);
1745 #line 1747 "ada-exp.c" /* yacc.c:1646 */
1749 #line 268 "ada-exp.y" /* yacc.c:1646 */
1751 if ((yyvsp[-3].tval) != NULL)
1753 if ((yyvsp[-1].lval) != 1)
1754 error (_("Invalid conversion"));
1755 write_exp_elt_opcode (pstate, UNOP_CAST);
1756 write_exp_elt_type (pstate, (yyvsp[-3].tval));
1757 write_exp_elt_opcode (pstate, UNOP_CAST);
1761 write_exp_elt_opcode (pstate, OP_FUNCALL);
1762 write_exp_elt_longcst (pstate, (yyvsp[-1].lval));
1763 write_exp_elt_opcode (pstate, OP_FUNCALL);
1766 #line 1768 "ada-exp.c" /* yacc.c:1646 */
1770 #line 286 "ada-exp.y" /* yacc.c:1646 */
1771 { type_qualifier = (yyvsp[-2].tval); }
1772 #line 1774 "ada-exp.c" /* yacc.c:1646 */
1776 #line 288 "ada-exp.y" /* yacc.c:1646 */
1778 if ((yyvsp[-6].tval) == NULL)
1779 error (_("Type required for qualification"));
1780 write_exp_elt_opcode (pstate, UNOP_QUAL);
1781 write_exp_elt_type (pstate, (yyvsp[-6].tval));
1782 write_exp_elt_opcode (pstate, UNOP_QUAL);
1783 type_qualifier = (yyvsp[-4].tval);
1785 #line 1787 "ada-exp.c" /* yacc.c:1646 */
1789 #line 298 "ada-exp.y" /* yacc.c:1646 */
1790 { (yyval.tval) = type_qualifier; }
1791 #line 1793 "ada-exp.c" /* yacc.c:1646 */
1795 #line 303 "ada-exp.y" /* yacc.c:1646 */
1796 { write_exp_elt_opcode (pstate, TERNOP_SLICE); }
1797 #line 1799 "ada-exp.c" /* yacc.c:1646 */
1801 #line 305 "ada-exp.y" /* yacc.c:1646 */
1802 { if ((yyvsp[-5].tval) == NULL)
1803 write_exp_elt_opcode (pstate, TERNOP_SLICE);
1805 error (_("Cannot slice a type"));
1807 #line 1809 "ada-exp.c" /* yacc.c:1646 */
1811 #line 312 "ada-exp.y" /* yacc.c:1646 */
1813 #line 1815 "ada-exp.c" /* yacc.c:1646 */
1817 #line 324 "ada-exp.y" /* yacc.c:1646 */
1818 { if ((yyvsp[0].tval) != NULL)
1820 write_exp_elt_opcode (pstate, OP_TYPE);
1821 write_exp_elt_type (pstate, (yyvsp[0].tval));
1822 write_exp_elt_opcode (pstate, OP_TYPE);
1825 #line 1827 "ada-exp.c" /* yacc.c:1646 */
1829 #line 334 "ada-exp.y" /* yacc.c:1646 */
1830 { write_dollar_variable (pstate, (yyvsp[0].sval)); }
1831 #line 1833 "ada-exp.c" /* yacc.c:1646 */
1835 #line 344 "ada-exp.y" /* yacc.c:1646 */
1836 { write_exp_elt_opcode (pstate, UNOP_NEG); }
1837 #line 1839 "ada-exp.c" /* yacc.c:1646 */
1841 #line 348 "ada-exp.y" /* yacc.c:1646 */
1842 { write_exp_elt_opcode (pstate, UNOP_PLUS); }
1843 #line 1845 "ada-exp.c" /* yacc.c:1646 */
1847 #line 352 "ada-exp.y" /* yacc.c:1646 */
1848 { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
1849 #line 1851 "ada-exp.c" /* yacc.c:1646 */
1853 #line 356 "ada-exp.y" /* yacc.c:1646 */
1854 { write_exp_elt_opcode (pstate, UNOP_ABS); }
1855 #line 1857 "ada-exp.c" /* yacc.c:1646 */
1859 #line 359 "ada-exp.y" /* yacc.c:1646 */
1860 { (yyval.lval) = 0; }
1861 #line 1863 "ada-exp.c" /* yacc.c:1646 */
1865 #line 363 "ada-exp.y" /* yacc.c:1646 */
1866 { (yyval.lval) = 1; }
1867 #line 1869 "ada-exp.c" /* yacc.c:1646 */
1871 #line 365 "ada-exp.y" /* yacc.c:1646 */
1872 { (yyval.lval) = 1; }
1873 #line 1875 "ada-exp.c" /* yacc.c:1646 */
1877 #line 367 "ada-exp.y" /* yacc.c:1646 */
1878 { (yyval.lval) = (yyvsp[-2].lval) + 1; }
1879 #line 1881 "ada-exp.c" /* yacc.c:1646 */
1883 #line 369 "ada-exp.y" /* yacc.c:1646 */
1884 { (yyval.lval) = (yyvsp[-4].lval) + 1; }
1885 #line 1887 "ada-exp.c" /* yacc.c:1646 */
1889 #line 374 "ada-exp.y" /* yacc.c:1646 */
1891 if ((yyvsp[-2].tval) == NULL)
1892 error (_("Type required within braces in coercion"));
1893 write_exp_elt_opcode (pstate, UNOP_MEMVAL);
1894 write_exp_elt_type (pstate, (yyvsp[-2].tval));
1895 write_exp_elt_opcode (pstate, UNOP_MEMVAL);
1897 #line 1899 "ada-exp.c" /* yacc.c:1646 */
1901 #line 386 "ada-exp.y" /* yacc.c:1646 */
1902 { write_exp_elt_opcode (pstate, BINOP_EXP); }
1903 #line 1905 "ada-exp.c" /* yacc.c:1646 */
1907 #line 390 "ada-exp.y" /* yacc.c:1646 */
1908 { write_exp_elt_opcode (pstate, BINOP_MUL); }
1909 #line 1911 "ada-exp.c" /* yacc.c:1646 */
1913 #line 394 "ada-exp.y" /* yacc.c:1646 */
1914 { write_exp_elt_opcode (pstate, BINOP_DIV); }
1915 #line 1917 "ada-exp.c" /* yacc.c:1646 */
1919 #line 398 "ada-exp.y" /* yacc.c:1646 */
1920 { write_exp_elt_opcode (pstate, BINOP_REM); }
1921 #line 1923 "ada-exp.c" /* yacc.c:1646 */
1925 #line 402 "ada-exp.y" /* yacc.c:1646 */
1926 { write_exp_elt_opcode (pstate, BINOP_MOD); }
1927 #line 1929 "ada-exp.c" /* yacc.c:1646 */
1931 #line 406 "ada-exp.y" /* yacc.c:1646 */
1932 { write_exp_elt_opcode (pstate, BINOP_REPEAT); }
1933 #line 1935 "ada-exp.c" /* yacc.c:1646 */
1937 #line 410 "ada-exp.y" /* yacc.c:1646 */
1938 { write_exp_elt_opcode (pstate, BINOP_ADD); }
1939 #line 1941 "ada-exp.c" /* yacc.c:1646 */
1943 #line 414 "ada-exp.y" /* yacc.c:1646 */
1944 { write_exp_elt_opcode (pstate, BINOP_CONCAT); }
1945 #line 1947 "ada-exp.c" /* yacc.c:1646 */
1949 #line 418 "ada-exp.y" /* yacc.c:1646 */
1950 { write_exp_elt_opcode (pstate, BINOP_SUB); }
1951 #line 1953 "ada-exp.c" /* yacc.c:1646 */
1955 #line 425 "ada-exp.y" /* yacc.c:1646 */
1956 { write_exp_elt_opcode (pstate, BINOP_EQUAL); }
1957 #line 1959 "ada-exp.c" /* yacc.c:1646 */
1961 #line 429 "ada-exp.y" /* yacc.c:1646 */
1962 { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
1963 #line 1965 "ada-exp.c" /* yacc.c:1646 */
1967 #line 433 "ada-exp.y" /* yacc.c:1646 */
1968 { write_exp_elt_opcode (pstate, BINOP_LEQ); }
1969 #line 1971 "ada-exp.c" /* yacc.c:1646 */
1973 #line 437 "ada-exp.y" /* yacc.c:1646 */
1974 { write_exp_elt_opcode (pstate, TERNOP_IN_RANGE); }
1975 #line 1977 "ada-exp.c" /* yacc.c:1646 */
1979 #line 439 "ada-exp.y" /* yacc.c:1646 */
1980 { write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
1981 write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval));
1982 write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
1984 #line 1986 "ada-exp.c" /* yacc.c:1646 */
1988 #line 444 "ada-exp.y" /* yacc.c:1646 */
1990 if ((yyvsp[0].tval) == NULL)
1991 error (_("Right operand of 'in' must be type"));
1992 write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
1993 write_exp_elt_type (pstate, (yyvsp[0].tval));
1994 write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
1996 #line 1998 "ada-exp.c" /* yacc.c:1646 */
2000 #line 452 "ada-exp.y" /* yacc.c:1646 */
2001 { write_exp_elt_opcode (pstate, TERNOP_IN_RANGE);
2002 write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
2004 #line 2006 "ada-exp.c" /* yacc.c:1646 */
2008 #line 456 "ada-exp.y" /* yacc.c:1646 */
2009 { write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
2010 write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval));
2011 write_exp_elt_opcode (pstate, BINOP_IN_BOUNDS);
2012 write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
2014 #line 2016 "ada-exp.c" /* yacc.c:1646 */
2018 #line 462 "ada-exp.y" /* yacc.c:1646 */
2020 if ((yyvsp[0].tval) == NULL)
2021 error (_("Right operand of 'in' must be type"));
2022 write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
2023 write_exp_elt_type (pstate, (yyvsp[0].tval));
2024 write_exp_elt_opcode (pstate, UNOP_IN_RANGE);
2025 write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT);
2027 #line 2029 "ada-exp.c" /* yacc.c:1646 */
2031 #line 473 "ada-exp.y" /* yacc.c:1646 */
2032 { write_exp_elt_opcode (pstate, BINOP_GEQ); }
2033 #line 2035 "ada-exp.c" /* yacc.c:1646 */
2037 #line 477 "ada-exp.y" /* yacc.c:1646 */
2038 { write_exp_elt_opcode (pstate, BINOP_LESS); }
2039 #line 2041 "ada-exp.c" /* yacc.c:1646 */
2043 #line 481 "ada-exp.y" /* yacc.c:1646 */
2044 { write_exp_elt_opcode (pstate, BINOP_GTR); }
2045 #line 2047 "ada-exp.c" /* yacc.c:1646 */
2049 #line 494 "ada-exp.y" /* yacc.c:1646 */
2050 { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
2051 #line 2053 "ada-exp.c" /* yacc.c:1646 */
2055 #line 496 "ada-exp.y" /* yacc.c:1646 */
2056 { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
2057 #line 2059 "ada-exp.c" /* yacc.c:1646 */
2061 #line 501 "ada-exp.y" /* yacc.c:1646 */
2062 { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
2063 #line 2065 "ada-exp.c" /* yacc.c:1646 */
2067 #line 503 "ada-exp.y" /* yacc.c:1646 */
2068 { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
2069 #line 2071 "ada-exp.c" /* yacc.c:1646 */
2073 #line 508 "ada-exp.y" /* yacc.c:1646 */
2074 { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
2075 #line 2077 "ada-exp.c" /* yacc.c:1646 */
2079 #line 510 "ada-exp.y" /* yacc.c:1646 */
2080 { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
2081 #line 2083 "ada-exp.c" /* yacc.c:1646 */
2085 #line 515 "ada-exp.y" /* yacc.c:1646 */
2086 { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
2087 #line 2089 "ada-exp.c" /* yacc.c:1646 */
2091 #line 517 "ada-exp.y" /* yacc.c:1646 */
2092 { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
2093 #line 2095 "ada-exp.c" /* yacc.c:1646 */
2097 #line 521 "ada-exp.y" /* yacc.c:1646 */
2098 { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
2099 #line 2101 "ada-exp.c" /* yacc.c:1646 */
2103 #line 523 "ada-exp.y" /* yacc.c:1646 */
2104 { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
2105 #line 2107 "ada-exp.c" /* yacc.c:1646 */
2109 #line 535 "ada-exp.y" /* yacc.c:1646 */
2110 { write_exp_elt_opcode (pstate, UNOP_ADDR); }
2111 #line 2113 "ada-exp.c" /* yacc.c:1646 */
2115 #line 537 "ada-exp.y" /* yacc.c:1646 */
2116 { write_exp_elt_opcode (pstate, UNOP_ADDR);
2117 write_exp_elt_opcode (pstate, UNOP_CAST);
2118 write_exp_elt_type (pstate,
2119 type_system_address (pstate));
2120 write_exp_elt_opcode (pstate, UNOP_CAST);
2122 #line 2124 "ada-exp.c" /* yacc.c:1646 */
2126 #line 544 "ada-exp.y" /* yacc.c:1646 */
2127 { write_int (pstate, (yyvsp[0].lval), type_int (pstate));
2128 write_exp_elt_opcode (pstate, OP_ATR_FIRST); }
2129 #line 2131 "ada-exp.c" /* yacc.c:1646 */
2133 #line 547 "ada-exp.y" /* yacc.c:1646 */
2134 { write_int (pstate, (yyvsp[0].lval), type_int (pstate));
2135 write_exp_elt_opcode (pstate, OP_ATR_LAST); }
2136 #line 2138 "ada-exp.c" /* yacc.c:1646 */
2140 #line 550 "ada-exp.y" /* yacc.c:1646 */
2141 { write_int (pstate, (yyvsp[0].lval), type_int (pstate));
2142 write_exp_elt_opcode (pstate, OP_ATR_LENGTH); }
2143 #line 2145 "ada-exp.c" /* yacc.c:1646 */
2147 #line 553 "ada-exp.y" /* yacc.c:1646 */
2148 { write_exp_elt_opcode (pstate, OP_ATR_SIZE); }
2149 #line 2151 "ada-exp.c" /* yacc.c:1646 */
2153 #line 555 "ada-exp.y" /* yacc.c:1646 */
2154 { write_exp_elt_opcode (pstate, OP_ATR_TAG); }
2155 #line 2157 "ada-exp.c" /* yacc.c:1646 */
2159 #line 557 "ada-exp.y" /* yacc.c:1646 */
2160 { write_exp_elt_opcode (pstate, OP_ATR_MIN); }
2161 #line 2163 "ada-exp.c" /* yacc.c:1646 */
2165 #line 559 "ada-exp.y" /* yacc.c:1646 */
2166 { write_exp_elt_opcode (pstate, OP_ATR_MAX); }
2167 #line 2169 "ada-exp.c" /* yacc.c:1646 */
2171 #line 561 "ada-exp.y" /* yacc.c:1646 */
2172 { write_exp_elt_opcode (pstate, OP_ATR_POS); }
2173 #line 2175 "ada-exp.c" /* yacc.c:1646 */
2177 #line 563 "ada-exp.y" /* yacc.c:1646 */
2178 { write_exp_elt_opcode (pstate, OP_ATR_VAL); }
2179 #line 2181 "ada-exp.c" /* yacc.c:1646 */
2183 #line 565 "ada-exp.y" /* yacc.c:1646 */
2184 { write_exp_elt_opcode (pstate, OP_ATR_MODULUS); }
2185 #line 2187 "ada-exp.c" /* yacc.c:1646 */
2189 #line 569 "ada-exp.y" /* yacc.c:1646 */
2190 { (yyval.lval) = 1; }
2191 #line 2193 "ada-exp.c" /* yacc.c:1646 */
2195 #line 571 "ada-exp.y" /* yacc.c:1646 */
2196 { (yyval.lval) = (yyvsp[-1].typed_val).val; }
2197 #line 2199 "ada-exp.c" /* yacc.c:1646 */
2201 #line 576 "ada-exp.y" /* yacc.c:1646 */
2203 if ((yyvsp[0].tval) == NULL)
2204 error (_("Prefix must be type"));
2205 write_exp_elt_opcode (pstate, OP_TYPE);
2206 write_exp_elt_type (pstate, (yyvsp[0].tval));
2207 write_exp_elt_opcode (pstate, OP_TYPE); }
2208 #line 2210 "ada-exp.c" /* yacc.c:1646 */
2212 #line 587 "ada-exp.y" /* yacc.c:1646 */
2213 { write_exp_elt_opcode (pstate, OP_TYPE);
2214 write_exp_elt_type (pstate,
2215 parse_type (pstate)->builtin_void);
2216 write_exp_elt_opcode (pstate, OP_TYPE); }
2217 #line 2219 "ada-exp.c" /* yacc.c:1646 */
2221 #line 595 "ada-exp.y" /* yacc.c:1646 */
2222 { write_int (pstate, (LONGEST) (yyvsp[0].typed_val).val, (yyvsp[0].typed_val).type); }
2223 #line 2225 "ada-exp.c" /* yacc.c:1646 */
2227 #line 599 "ada-exp.y" /* yacc.c:1646 */
2228 { write_int (pstate,
2229 convert_char_literal (type_qualifier, (yyvsp[0].typed_val).val),
2230 (type_qualifier == NULL)
2231 ? (yyvsp[0].typed_val).type : type_qualifier);
2233 #line 2235 "ada-exp.c" /* yacc.c:1646 */
2237 #line 607 "ada-exp.y" /* yacc.c:1646 */
2238 { write_exp_elt_opcode (pstate, OP_DOUBLE);
2239 write_exp_elt_type (pstate, (yyvsp[0].typed_val_float).type);
2240 write_exp_elt_dblcst (pstate, (yyvsp[0].typed_val_float).dval);
2241 write_exp_elt_opcode (pstate, OP_DOUBLE);
2243 #line 2245 "ada-exp.c" /* yacc.c:1646 */
2247 #line 615 "ada-exp.y" /* yacc.c:1646 */
2248 { write_int (pstate, 0, type_int (pstate)); }
2249 #line 2251 "ada-exp.c" /* yacc.c:1646 */
2253 #line 619 "ada-exp.y" /* yacc.c:1646 */
2255 write_exp_op_with_string (pstate, OP_STRING, (yyvsp[0].sval));
2257 #line 2259 "ada-exp.c" /* yacc.c:1646 */
2261 #line 625 "ada-exp.y" /* yacc.c:1646 */
2262 { write_int (pstate, 1, type_boolean (pstate)); }
2263 #line 2265 "ada-exp.c" /* yacc.c:1646 */
2267 #line 627 "ada-exp.y" /* yacc.c:1646 */
2268 { write_int (pstate, 0, type_boolean (pstate)); }
2269 #line 2271 "ada-exp.c" /* yacc.c:1646 */
2273 #line 631 "ada-exp.y" /* yacc.c:1646 */
2274 { error (_("NEW not implemented.")); }
2275 #line 2277 "ada-exp.c" /* yacc.c:1646 */
2279 #line 635 "ada-exp.y" /* yacc.c:1646 */
2280 { (yyval.tval) = write_var_or_type (pstate, NULL, (yyvsp[0].sval)); }
2281 #line 2283 "ada-exp.c" /* yacc.c:1646 */
2285 #line 637 "ada-exp.y" /* yacc.c:1646 */
2286 { (yyval.tval) = write_var_or_type (pstate, (yyvsp[-1].bval), (yyvsp[0].sval)); }
2287 #line 2289 "ada-exp.c" /* yacc.c:1646 */
2291 #line 639 "ada-exp.y" /* yacc.c:1646 */
2293 (yyval.tval) = write_var_or_type (pstate, NULL, (yyvsp[-1].sval));
2294 if ((yyval.tval) == NULL)
2295 write_exp_elt_opcode (pstate, UNOP_ADDR);
2297 (yyval.tval) = lookup_pointer_type ((yyval.tval));
2299 #line 2301 "ada-exp.c" /* yacc.c:1646 */
2303 #line 647 "ada-exp.y" /* yacc.c:1646 */
2305 (yyval.tval) = write_var_or_type (pstate, (yyvsp[-2].bval), (yyvsp[-1].sval));
2306 if ((yyval.tval) == NULL)
2307 write_exp_elt_opcode (pstate, UNOP_ADDR);
2309 (yyval.tval) = lookup_pointer_type ((yyval.tval));
2311 #line 2313 "ada-exp.c" /* yacc.c:1646 */
2315 #line 658 "ada-exp.y" /* yacc.c:1646 */
2316 { (yyval.bval) = block_lookup (NULL, (yyvsp[-1].sval).ptr); }
2317 #line 2319 "ada-exp.c" /* yacc.c:1646 */
2321 #line 660 "ada-exp.y" /* yacc.c:1646 */
2322 { (yyval.bval) = block_lookup ((yyvsp[-2].bval), (yyvsp[-1].sval).ptr); }
2323 #line 2325 "ada-exp.c" /* yacc.c:1646 */
2327 #line 665 "ada-exp.y" /* yacc.c:1646 */
2329 write_exp_elt_opcode (pstate, OP_AGGREGATE);
2330 write_exp_elt_longcst (pstate, (yyvsp[-1].lval));
2331 write_exp_elt_opcode (pstate, OP_AGGREGATE);
2333 #line 2335 "ada-exp.c" /* yacc.c:1646 */
2337 #line 673 "ada-exp.y" /* yacc.c:1646 */
2338 { (yyval.lval) = (yyvsp[0].lval); }
2339 #line 2341 "ada-exp.c" /* yacc.c:1646 */
2343 #line 675 "ada-exp.y" /* yacc.c:1646 */
2344 { write_exp_elt_opcode (pstate, OP_POSITIONAL);
2345 write_exp_elt_longcst (pstate, (yyvsp[-1].lval));
2346 write_exp_elt_opcode (pstate, OP_POSITIONAL);
2347 (yyval.lval) = (yyvsp[-1].lval) + 1;
2349 #line 2351 "ada-exp.c" /* yacc.c:1646 */
2353 #line 681 "ada-exp.y" /* yacc.c:1646 */
2354 { (yyval.lval) = (yyvsp[-1].lval) + (yyvsp[0].lval); }
2355 #line 2357 "ada-exp.c" /* yacc.c:1646 */
2359 #line 686 "ada-exp.y" /* yacc.c:1646 */
2360 { write_exp_elt_opcode (pstate, OP_POSITIONAL);
2361 write_exp_elt_longcst (pstate, 0);
2362 write_exp_elt_opcode (pstate, OP_POSITIONAL);
2365 #line 2367 "ada-exp.c" /* yacc.c:1646 */
2369 #line 692 "ada-exp.y" /* yacc.c:1646 */
2370 { write_exp_elt_opcode (pstate, OP_POSITIONAL);
2371 write_exp_elt_longcst (pstate, (yyvsp[-2].lval));
2372 write_exp_elt_opcode (pstate, OP_POSITIONAL);
2373 (yyval.lval) = (yyvsp[-2].lval) + 1;
2375 #line 2377 "ada-exp.c" /* yacc.c:1646 */
2379 #line 700 "ada-exp.y" /* yacc.c:1646 */
2380 { (yyval.lval) = 1; }
2381 #line 2383 "ada-exp.c" /* yacc.c:1646 */
2385 #line 701 "ada-exp.y" /* yacc.c:1646 */
2386 { (yyval.lval) = 1; }
2387 #line 2389 "ada-exp.c" /* yacc.c:1646 */
2391 #line 703 "ada-exp.y" /* yacc.c:1646 */
2392 { (yyval.lval) = (yyvsp[0].lval) + 1; }
2393 #line 2395 "ada-exp.c" /* yacc.c:1646 */
2397 #line 707 "ada-exp.y" /* yacc.c:1646 */
2398 { write_exp_elt_opcode (pstate, OP_OTHERS); }
2399 #line 2401 "ada-exp.c" /* yacc.c:1646 */
2403 #line 712 "ada-exp.y" /* yacc.c:1646 */
2405 write_exp_elt_opcode (pstate, OP_CHOICES);
2406 write_exp_elt_longcst (pstate, (yyvsp[0].lval));
2407 write_exp_elt_opcode (pstate, OP_CHOICES);
2409 #line 2411 "ada-exp.c" /* yacc.c:1646 */
2413 #line 726 "ada-exp.y" /* yacc.c:1646 */
2414 { write_name_assoc (pstate, (yyvsp[-1].sval)); }
2415 #line 2417 "ada-exp.c" /* yacc.c:1646 */
2419 #line 727 "ada-exp.y" /* yacc.c:1646 */
2420 { (yyval.lval) = 1; }
2421 #line 2423 "ada-exp.c" /* yacc.c:1646 */
2425 #line 729 "ada-exp.y" /* yacc.c:1646 */
2426 { (yyval.lval) = 1; }
2427 #line 2429 "ada-exp.c" /* yacc.c:1646 */
2431 #line 731 "ada-exp.y" /* yacc.c:1646 */
2432 { write_exp_elt_opcode (pstate, OP_DISCRETE_RANGE);
2433 write_exp_op_with_string (pstate, OP_NAME,
2436 #line 2438 "ada-exp.c" /* yacc.c:1646 */
2440 #line 735 "ada-exp.y" /* yacc.c:1646 */
2441 { (yyval.lval) = 1; }
2442 #line 2444 "ada-exp.c" /* yacc.c:1646 */
2446 #line 737 "ada-exp.y" /* yacc.c:1646 */
2447 { write_name_assoc (pstate, (yyvsp[-1].sval)); }
2448 #line 2450 "ada-exp.c" /* yacc.c:1646 */
2452 #line 738 "ada-exp.y" /* yacc.c:1646 */
2453 { (yyval.lval) = (yyvsp[0].lval) + 1; }
2454 #line 2456 "ada-exp.c" /* yacc.c:1646 */
2458 #line 740 "ada-exp.y" /* yacc.c:1646 */
2459 { (yyval.lval) = (yyvsp[0].lval) + 1; }
2460 #line 2462 "ada-exp.c" /* yacc.c:1646 */
2464 #line 742 "ada-exp.y" /* yacc.c:1646 */
2465 { write_exp_elt_opcode (pstate, OP_DISCRETE_RANGE); }
2466 #line 2468 "ada-exp.c" /* yacc.c:1646 */
2470 #line 743 "ada-exp.y" /* yacc.c:1646 */
2471 { (yyval.lval) = (yyvsp[0].lval) + 1; }
2472 #line 2474 "ada-exp.c" /* yacc.c:1646 */
2476 #line 750 "ada-exp.y" /* yacc.c:1646 */
2477 { write_exp_elt_opcode (pstate, UNOP_IND); }
2478 #line 2480 "ada-exp.c" /* yacc.c:1646 */
2482 #line 752 "ada-exp.y" /* yacc.c:1646 */
2483 { write_exp_elt_opcode (pstate, UNOP_ADDR); }
2484 #line 2486 "ada-exp.c" /* yacc.c:1646 */
2488 #line 754 "ada-exp.y" /* yacc.c:1646 */
2489 { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
2490 #line 2492 "ada-exp.c" /* yacc.c:1646 */
2494 #line 2496 "ada-exp.c" /* yacc.c:1646 */
2497 /* User semantic actions sometimes alter yychar, and that requires
2498 that yytoken be updated with the new translation. We take the
2499 approach of translating immediately before every use of yytoken.
2500 One alternative is translating here after every semantic action,
2501 but that translation would be missed if the semantic action invokes
2502 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2503 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2504 incorrect destructor might then be invoked immediately. In the
2505 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2506 to an incorrect destructor call or verbose syntax error message
2507 before the lookahead is translated. */
2508 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2512 YY_STACK_PRINT (yyss, yyssp);
2516 /* Now 'shift' the result of the reduction. Determine what state
2517 that goes to, based on the state we popped back to and the rule
2518 number reduced by. */
2522 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2523 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2524 yystate = yytable[yystate];
2526 yystate = yydefgoto[yyn - YYNTOKENS];
2531 /*--------------------------------------.
2532 | yyerrlab -- here on detecting error. |
2533 `--------------------------------------*/
2535 /* Make sure we have latest lookahead translation. See comments at
2536 user semantic actions for why this is necessary. */
2537 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2539 /* If not already recovering from an error, report this error. */
2543 #if ! YYERROR_VERBOSE
2544 yyerror (YY_("syntax error"));
2546 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2549 char const *yymsgp = YY_("syntax error");
2550 int yysyntax_error_status;
2551 yysyntax_error_status = YYSYNTAX_ERROR;
2552 if (yysyntax_error_status == 0)
2554 else if (yysyntax_error_status == 1)
2556 if (yymsg != yymsgbuf)
2557 YYSTACK_FREE (yymsg);
2558 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2562 yymsg_alloc = sizeof yymsgbuf;
2563 yysyntax_error_status = 2;
2567 yysyntax_error_status = YYSYNTAX_ERROR;
2572 if (yysyntax_error_status == 2)
2573 goto yyexhaustedlab;
2575 # undef YYSYNTAX_ERROR
2581 if (yyerrstatus == 3)
2583 /* If just tried and failed to reuse lookahead token after an
2584 error, discard it. */
2586 if (yychar <= YYEOF)
2588 /* Return failure if at end of input. */
2589 if (yychar == YYEOF)
2594 yydestruct ("Error: discarding",
2600 /* Else will try to reuse lookahead token after shifting the error
2605 /*---------------------------------------------------.
2606 | yyerrorlab -- error raised explicitly by YYERROR. |
2607 `---------------------------------------------------*/
2610 /* Pacify compilers like GCC when the user code never invokes
2611 YYERROR and the label yyerrorlab therefore never appears in user
2613 if (/*CONSTCOND*/ 0)
2616 /* Do not reclaim the symbols of the rule whose action triggered
2620 YY_STACK_PRINT (yyss, yyssp);
2625 /*-------------------------------------------------------------.
2626 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2627 `-------------------------------------------------------------*/
2629 yyerrstatus = 3; /* Each real token shifted decrements this. */
2633 yyn = yypact[yystate];
2634 if (!yypact_value_is_default (yyn))
2637 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2645 /* Pop the current state because it cannot handle the error token. */
2650 yydestruct ("Error: popping",
2651 yystos[yystate], yyvsp);
2654 YY_STACK_PRINT (yyss, yyssp);
2657 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2659 YY_IGNORE_MAYBE_UNINITIALIZED_END
2662 /* Shift the error token. */
2663 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2669 /*-------------------------------------.
2670 | yyacceptlab -- YYACCEPT comes here. |
2671 `-------------------------------------*/
2676 /*-----------------------------------.
2677 | yyabortlab -- YYABORT comes here. |
2678 `-----------------------------------*/
2683 #if !defined yyoverflow || YYERROR_VERBOSE
2684 /*-------------------------------------------------.
2685 | yyexhaustedlab -- memory exhaustion comes here. |
2686 `-------------------------------------------------*/
2688 yyerror (YY_("memory exhausted"));
2694 if (yychar != YYEMPTY)
2696 /* Make sure we have latest lookahead translation. See comments at
2697 user semantic actions for why this is necessary. */
2698 yytoken = YYTRANSLATE (yychar);
2699 yydestruct ("Cleanup: discarding lookahead",
2702 /* Do not reclaim the symbols of the rule whose action triggered
2703 this YYABORT or YYACCEPT. */
2705 YY_STACK_PRINT (yyss, yyssp);
2706 while (yyssp != yyss)
2708 yydestruct ("Cleanup: popping",
2709 yystos[*yyssp], yyvsp);
2714 YYSTACK_FREE (yyss);
2717 if (yymsg != yymsgbuf)
2718 YYSTACK_FREE (yymsg);
2722 #line 757 "ada-exp.y" /* yacc.c:1906 */
2725 /* yylex defined in ada-lex.c: Reads one token, getting characters */
2726 /* through lexptr. */
2728 /* Remap normal flex interface names (yylex) as well as gratuitiously */
2729 /* global symbol names, so we can have multiple flex-generated parsers */
2732 /* (See note above on previous definitions for YACC.) */
2734 #define yy_create_buffer ada_yy_create_buffer
2735 #define yy_delete_buffer ada_yy_delete_buffer
2736 #define yy_init_buffer ada_yy_init_buffer
2737 #define yy_load_buffer_state ada_yy_load_buffer_state
2738 #define yy_switch_to_buffer ada_yy_switch_to_buffer
2739 #define yyrestart ada_yyrestart
2740 #define yytext ada_yytext
2741 #define yywrap ada_yywrap
2743 static struct obstack temp_parse_space;
2745 /* The following kludge was found necessary to prevent conflicts between */
2746 /* defs.h and non-standard stdlib.h files. */
2747 #define qsort __qsort__dummy
2748 #include "ada-lex.c"
2751 ada_parse (struct parser_state *par_state)
2754 struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
2756 /* Setting up the parser state. */
2757 gdb_assert (par_state != NULL);
2760 lexer_init (yyin); /* (Re-)initialize lexer. */
2761 type_qualifier = NULL;
2762 obstack_free (&temp_parse_space, NULL);
2763 obstack_init (&temp_parse_space);
2765 result = yyparse ();
2773 error (_("Error in expression, near `%s'."), lexptr);
2776 /* Emit expression to access an instance of SYM, in block BLOCK (if
2777 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
2779 write_var_from_sym (struct parser_state *par_state,
2780 const struct block *orig_left_context,
2781 const struct block *block,
2784 if (orig_left_context == NULL && symbol_read_needs_frame (sym))
2786 if (innermost_block == 0
2787 || contained_in (block, innermost_block))
2788 innermost_block = block;
2791 write_exp_elt_opcode (par_state, OP_VAR_VALUE);
2792 write_exp_elt_block (par_state, block);
2793 write_exp_elt_sym (par_state, sym);
2794 write_exp_elt_opcode (par_state, OP_VAR_VALUE);
2797 /* Write integer or boolean constant ARG of type TYPE. */
2800 write_int (struct parser_state *par_state, LONGEST arg, struct type *type)
2802 write_exp_elt_opcode (par_state, OP_LONG);
2803 write_exp_elt_type (par_state, type);
2804 write_exp_elt_longcst (par_state, arg);
2805 write_exp_elt_opcode (par_state, OP_LONG);
2808 /* Write an OPCODE, string, OPCODE sequence to the current expression. */
2810 write_exp_op_with_string (struct parser_state *par_state,
2811 enum exp_opcode opcode, struct stoken token)
2813 write_exp_elt_opcode (par_state, opcode);
2814 write_exp_string (par_state, token);
2815 write_exp_elt_opcode (par_state, opcode);
2818 /* Emit expression corresponding to the renamed object named
2819 * designated by RENAMED_ENTITY[0 .. RENAMED_ENTITY_LEN-1] in the
2820 * context of ORIG_LEFT_CONTEXT, to which is applied the operations
2821 * encoded by RENAMING_EXPR. MAX_DEPTH is the maximum number of
2822 * cascaded renamings to allow. If ORIG_LEFT_CONTEXT is null, it
2823 * defaults to the currently selected block. ORIG_SYMBOL is the
2824 * symbol that originally encoded the renaming. It is needed only
2825 * because its prefix also qualifies any index variables used to index
2826 * or slice an array. It should not be necessary once we go to the
2827 * new encoding entirely (FIXME pnh 7/20/2007). */
2830 write_object_renaming (struct parser_state *par_state,
2831 const struct block *orig_left_context,
2832 const char *renamed_entity, int renamed_entity_len,
2833 const char *renaming_expr, int max_depth)
2836 enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
2837 struct ada_symbol_info sym_info;
2840 error (_("Could not find renamed symbol"));
2842 if (orig_left_context == NULL)
2843 orig_left_context = get_selected_block (NULL);
2845 name = obstack_copy0 (&temp_parse_space, renamed_entity, renamed_entity_len);
2846 ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN, &sym_info);
2847 if (sym_info.sym == NULL)
2848 error (_("Could not find renamed variable: %s"), ada_decode (name));
2849 else if (SYMBOL_CLASS (sym_info.sym) == LOC_TYPEDEF)
2850 /* We have a renaming of an old-style renaming symbol. Don't
2851 trust the block information. */
2852 sym_info.block = orig_left_context;
2855 const char *inner_renamed_entity;
2856 int inner_renamed_entity_len;
2857 const char *inner_renaming_expr;
2859 switch (ada_parse_renaming (sym_info.sym, &inner_renamed_entity,
2860 &inner_renamed_entity_len,
2861 &inner_renaming_expr))
2863 case ADA_NOT_RENAMING:
2864 write_var_from_sym (par_state, orig_left_context, sym_info.block,
2867 case ADA_OBJECT_RENAMING:
2868 write_object_renaming (par_state, sym_info.block,
2869 inner_renamed_entity, inner_renamed_entity_len,
2870 inner_renaming_expr, max_depth - 1);
2877 slice_state = SIMPLE_INDEX;
2878 while (*renaming_expr == 'X')
2882 switch (*renaming_expr) {
2885 write_exp_elt_opcode (par_state, UNOP_IND);
2888 slice_state = LOWER_BOUND;
2892 if (isdigit (*renaming_expr))
2895 long val = strtol (renaming_expr, &next, 10);
2896 if (next == renaming_expr)
2898 renaming_expr = next;
2899 write_exp_elt_opcode (par_state, OP_LONG);
2900 write_exp_elt_type (par_state, type_int (par_state));
2901 write_exp_elt_longcst (par_state, (LONGEST) val);
2902 write_exp_elt_opcode (par_state, OP_LONG);
2908 struct ada_symbol_info index_sym_info;
2910 end = strchr (renaming_expr, 'X');
2912 end = renaming_expr + strlen (renaming_expr);
2915 obstack_copy0 (&temp_parse_space, renaming_expr,
2916 end - renaming_expr);
2917 renaming_expr = end;
2919 ada_lookup_encoded_symbol (index_name, NULL, VAR_DOMAIN,
2921 if (index_sym_info.sym == NULL)
2922 error (_("Could not find %s"), index_name);
2923 else if (SYMBOL_CLASS (index_sym_info.sym) == LOC_TYPEDEF)
2924 /* Index is an old-style renaming symbol. */
2925 index_sym_info.block = orig_left_context;
2926 write_var_from_sym (par_state, NULL, index_sym_info.block,
2927 index_sym_info.sym);
2929 if (slice_state == SIMPLE_INDEX)
2931 write_exp_elt_opcode (par_state, OP_FUNCALL);
2932 write_exp_elt_longcst (par_state, (LONGEST) 1);
2933 write_exp_elt_opcode (par_state, OP_FUNCALL);
2935 else if (slice_state == LOWER_BOUND)
2936 slice_state = UPPER_BOUND;
2937 else if (slice_state == UPPER_BOUND)
2939 write_exp_elt_opcode (par_state, TERNOP_SLICE);
2940 slice_state = SIMPLE_INDEX;
2946 struct stoken field_name;
2952 if (slice_state != SIMPLE_INDEX)
2954 end = strchr (renaming_expr, 'X');
2956 end = renaming_expr + strlen (renaming_expr);
2957 field_name.length = end - renaming_expr;
2958 buf = xmalloc (end - renaming_expr + 1);
2959 field_name.ptr = buf;
2960 strncpy (buf, renaming_expr, end - renaming_expr);
2961 buf[end - renaming_expr] = '\000';
2962 renaming_expr = end;
2963 write_exp_op_with_string (par_state, STRUCTOP_STRUCT, field_name);
2971 if (slice_state == SIMPLE_INDEX)
2975 error (_("Internal error in encoding of renaming declaration"));
2978 static const struct block*
2979 block_lookup (const struct block *context, const char *raw_name)
2982 struct ada_symbol_info *syms;
2984 struct symtab *symtab;
2986 if (raw_name[0] == '\'')
2992 name = ada_encode (raw_name);
2994 nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms);
2996 && (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK))
2997 symtab = lookup_symtab (name);
3002 return BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab), STATIC_BLOCK);
3003 else if (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK)
3005 if (context == NULL)
3006 error (_("No file or function \"%s\"."), raw_name);
3008 error (_("No function \"%s\" in specified context."), raw_name);
3013 warning (_("Function name \"%s\" ambiguous here"), raw_name);
3014 return SYMBOL_BLOCK_VALUE (syms[0].sym);
3018 static struct symbol*
3019 select_possible_type_sym (struct ada_symbol_info *syms, int nsyms)
3022 int preferred_index;
3023 struct type *preferred_type;
3025 preferred_index = -1; preferred_type = NULL;
3026 for (i = 0; i < nsyms; i += 1)
3027 switch (SYMBOL_CLASS (syms[i].sym))
3030 if (ada_prefer_type (SYMBOL_TYPE (syms[i].sym), preferred_type))
3032 preferred_index = i;
3033 preferred_type = SYMBOL_TYPE (syms[i].sym);
3039 case LOC_REGPARM_ADDR:
3046 if (preferred_type == NULL)
3048 return syms[preferred_index].sym;
3052 find_primitive_type (struct parser_state *par_state, char *name)
3055 type = language_lookup_primitive_type (parse_language (par_state),
3056 parse_gdbarch (par_state),
3058 if (type == NULL && strcmp ("system__address", name) == 0)
3059 type = type_system_address (par_state);
3063 /* Check to see if we have a regular definition of this
3064 type that just didn't happen to have been read yet. */
3066 char *expanded_name =
3067 (char *) alloca (strlen (name) + sizeof ("standard__"));
3068 strcpy (expanded_name, "standard__");
3069 strcat (expanded_name, name);
3070 sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL);
3071 if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
3072 type = SYMBOL_TYPE (sym);
3079 chop_selector (char *name, int end)
3082 for (i = end - 1; i > 0; i -= 1)
3083 if (name[i] == '.' || (name[i] == '_' && name[i+1] == '_'))
3088 /* If NAME is a string beginning with a separator (either '__', or
3089 '.'), chop this separator and return the result; else, return
3093 chop_separator (char *name)
3098 if (name[0] == '_' && name[1] == '_')
3104 /* Given that SELS is a string of the form (<sep><identifier>)*, where
3105 <sep> is '__' or '.', write the indicated sequence of
3106 STRUCTOP_STRUCT expression operators. */
3108 write_selectors (struct parser_state *par_state, char *sels)
3110 while (*sels != '\0')
3112 struct stoken field_name;
3113 char *p = chop_separator (sels);
3115 while (*sels != '\0' && *sels != '.'
3116 && (sels[0] != '_' || sels[1] != '_'))
3118 field_name.length = sels - p;
3120 write_exp_op_with_string (par_state, STRUCTOP_STRUCT, field_name);
3124 /* Write a variable access (OP_VAR_VALUE) to ambiguous encoded name
3125 NAME[0..LEN-1], in block context BLOCK, to be resolved later. Writes
3126 a temporary symbol that is valid until the next call to ada_parse.
3129 write_ambiguous_var (struct parser_state *par_state,
3130 const struct block *block, char *name, int len)
3132 struct symbol *sym =
3133 obstack_alloc (&temp_parse_space, sizeof (struct symbol));
3134 memset (sym, 0, sizeof (struct symbol));
3135 SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
3136 SYMBOL_LINKAGE_NAME (sym) = obstack_copy0 (&temp_parse_space, name, len);
3137 SYMBOL_LANGUAGE (sym) = language_ada;
3139 write_exp_elt_opcode (par_state, OP_VAR_VALUE);
3140 write_exp_elt_block (par_state, block);
3141 write_exp_elt_sym (par_state, sym);
3142 write_exp_elt_opcode (par_state, OP_VAR_VALUE);
3145 /* A convenient wrapper around ada_get_field_index that takes
3146 a non NUL-terminated FIELD_NAME0 and a FIELD_NAME_LEN instead
3147 of a NUL-terminated field name. */
3150 ada_nget_field_index (const struct type *type, const char *field_name0,
3151 int field_name_len, int maybe_missing)
3153 char *field_name = alloca ((field_name_len + 1) * sizeof (char));
3155 strncpy (field_name, field_name0, field_name_len);
3156 field_name[field_name_len] = '\0';
3157 return ada_get_field_index (type, field_name, maybe_missing);
3160 /* If encoded_field_name is the name of a field inside symbol SYM,
3161 then return the type of that field. Otherwise, return NULL.
3163 This function is actually recursive, so if ENCODED_FIELD_NAME
3164 doesn't match one of the fields of our symbol, then try to see
3165 if ENCODED_FIELD_NAME could not be a succession of field names
3166 (in other words, the user entered an expression of the form
3167 TYPE_NAME.FIELD1.FIELD2.FIELD3), in which case we evaluate
3168 each field name sequentially to obtain the desired field type.
3169 In case of failure, we return NULL. */
3171 static struct type *
3172 get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
3174 char *field_name = encoded_field_name;
3175 char *subfield_name;
3176 struct type *type = SYMBOL_TYPE (sym);
3179 if (type == NULL || field_name == NULL)
3181 type = check_typedef (type);
3183 while (field_name[0] != '\0')
3185 field_name = chop_separator (field_name);
3187 fieldno = ada_get_field_index (type, field_name, 1);
3189 return TYPE_FIELD_TYPE (type, fieldno);
3191 subfield_name = field_name;
3192 while (*subfield_name != '\0' && *subfield_name != '.'
3193 && (subfield_name[0] != '_' || subfield_name[1] != '_'))
3196 if (subfield_name[0] == '\0')
3199 fieldno = ada_nget_field_index (type, field_name,
3200 subfield_name - field_name, 1);
3204 type = TYPE_FIELD_TYPE (type, fieldno);
3205 field_name = subfield_name;
3211 /* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
3212 expression_block_context if NULL). If it denotes a type, return
3213 that type. Otherwise, write expression code to evaluate it as an
3214 object and return NULL. In this second case, NAME0 will, in general,
3215 have the form <name>(.<selector_name>)*, where <name> is an object
3216 or renaming encoded in the debugging data. Calls error if no
3217 prefix <name> matches a name in the debugging data (i.e., matches
3218 either a complete name or, as a wild-card match, the final
3222 write_var_or_type (struct parser_state *par_state,
3223 const struct block *block, struct stoken name0)
3230 block = expression_context_block;
3232 encoded_name = ada_encode (name0.ptr);
3233 name_len = strlen (encoded_name);
3234 encoded_name = obstack_copy0 (&temp_parse_space, encoded_name, name_len);
3235 for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
3239 tail_index = name_len;
3240 while (tail_index > 0)
3243 struct ada_symbol_info *syms;
3244 struct symbol *type_sym;
3245 struct symbol *renaming_sym;
3246 const char* renaming;
3248 const char* renaming_expr;
3249 int terminator = encoded_name[tail_index];
3251 encoded_name[tail_index] = '\0';
3252 nsyms = ada_lookup_symbol_list (encoded_name, block,
3254 encoded_name[tail_index] = terminator;
3256 /* A single symbol may rename a package or object. */
3258 /* This should go away when we move entirely to new version.
3259 FIXME pnh 7/20/2007. */
3262 struct symbol *ren_sym =
3263 ada_find_renaming_symbol (syms[0].sym, syms[0].block);
3265 if (ren_sym != NULL)
3266 syms[0].sym = ren_sym;
3269 type_sym = select_possible_type_sym (syms, nsyms);
3271 if (type_sym != NULL)
3272 renaming_sym = type_sym;
3273 else if (nsyms == 1)
3274 renaming_sym = syms[0].sym;
3276 renaming_sym = NULL;
3278 switch (ada_parse_renaming (renaming_sym, &renaming,
3279 &renaming_len, &renaming_expr))
3281 case ADA_NOT_RENAMING:
3283 case ADA_PACKAGE_RENAMING:
3284 case ADA_EXCEPTION_RENAMING:
3285 case ADA_SUBPROGRAM_RENAMING:
3288 = obstack_alloc (&temp_parse_space,
3289 renaming_len + name_len - tail_index + 1);
3290 strncpy (new_name, renaming, renaming_len);
3291 strcpy (new_name + renaming_len, encoded_name + tail_index);
3292 encoded_name = new_name;
3293 name_len = renaming_len + name_len - tail_index;
3294 goto TryAfterRenaming;
3296 case ADA_OBJECT_RENAMING:
3297 write_object_renaming (par_state, block, renaming, renaming_len,
3298 renaming_expr, MAX_RENAMING_CHAIN_LENGTH);
3299 write_selectors (par_state, encoded_name + tail_index);
3302 internal_error (__FILE__, __LINE__,
3303 _("impossible value from ada_parse_renaming"));
3306 if (type_sym != NULL)
3308 struct type *field_type;
3310 if (tail_index == name_len)
3311 return SYMBOL_TYPE (type_sym);
3313 /* We have some extraneous characters after the type name.
3314 If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN",
3315 then try to get the type of FIELDN. */
3317 = get_symbol_field_type (type_sym, encoded_name + tail_index);
3318 if (field_type != NULL)
3321 error (_("Invalid attempt to select from type: \"%s\"."),
3324 else if (tail_index == name_len && nsyms == 0)
3326 struct type *type = find_primitive_type (par_state,
3335 write_var_from_sym (par_state, block, syms[0].block,
3337 write_selectors (par_state, encoded_name + tail_index);
3340 else if (nsyms == 0)
3342 struct bound_minimal_symbol msym
3343 = ada_lookup_simple_minsym (encoded_name);
3344 if (msym.minsym != NULL)
3346 write_exp_msymbol (par_state, msym);
3347 /* Maybe cause error here rather than later? FIXME? */
3348 write_selectors (par_state, encoded_name + tail_index);
3352 if (tail_index == name_len
3353 && strncmp (encoded_name, "standard__",
3354 sizeof ("standard__") - 1) == 0)
3355 error (_("No definition of \"%s\" found."), name0.ptr);
3357 tail_index = chop_selector (encoded_name, tail_index);
3361 write_ambiguous_var (par_state, block, encoded_name,
3363 write_selectors (par_state, encoded_name + tail_index);
3368 if (!have_full_symbols () && !have_partial_symbols () && block == NULL)
3369 error (_("No symbol table is loaded. Use the \"file\" command."));
3370 if (block == expression_context_block)
3371 error (_("No definition of \"%s\" in current context."), name0.ptr);
3373 error (_("No definition of \"%s\" in specified context."), name0.ptr);
3378 error (_("Could not find renamed symbol \"%s\""), name0.ptr);
3382 /* Write a left side of a component association (e.g., NAME in NAME =>
3383 exp). If NAME has the form of a selected component, write it as an
3384 ordinary expression. If it is a simple variable that unambiguously
3385 corresponds to exactly one symbol that does not denote a type or an
3386 object renaming, also write it normally as an OP_VAR_VALUE.
3387 Otherwise, write it as an OP_NAME.
3389 Unfortunately, we don't know at this point whether NAME is supposed
3390 to denote a record component name or the value of an array index.
3391 Therefore, it is not appropriate to disambiguate an ambiguous name
3392 as we normally would, nor to replace a renaming with its referent.
3393 As a result, in the (one hopes) rare case that one writes an
3394 aggregate such as (R => 42) where R renames an object or is an
3395 ambiguous name, one must write instead ((R) => 42). */
3398 write_name_assoc (struct parser_state *par_state, struct stoken name)
3400 if (strchr (name.ptr, '.') == NULL)
3402 struct ada_symbol_info *syms;
3403 int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
3405 if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF)
3406 write_exp_op_with_string (par_state, OP_NAME, name);
3408 write_var_from_sym (par_state, NULL, syms[0].block, syms[0].sym);
3411 if (write_var_or_type (par_state, NULL, name) != NULL)
3412 error (_("Invalid use of type."));
3415 /* Convert the character literal whose ASCII value would be VAL to the
3416 appropriate value of type TYPE, if there is a translation.
3417 Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
3418 the literal 'A' (VAL == 65), returns 0. */
3421 convert_char_literal (struct type *type, LONGEST val)
3428 type = check_typedef (type);
3429 if (TYPE_CODE (type) != TYPE_CODE_ENUM)
3432 xsnprintf (name, sizeof (name), "QU%02x", (int) val);
3433 for (f = 0; f < TYPE_NFIELDS (type); f += 1)
3435 if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0)
3436 return TYPE_FIELD_ENUMVAL (type, f);
3441 static struct type *
3442 type_int (struct parser_state *par_state)
3444 return parse_type (par_state)->builtin_int;
3447 static struct type *
3448 type_long (struct parser_state *par_state)
3450 return parse_type (par_state)->builtin_long;
3453 static struct type *
3454 type_long_long (struct parser_state *par_state)
3456 return parse_type (par_state)->builtin_long_long;
3459 static struct type *
3460 type_float (struct parser_state *par_state)
3462 return parse_type (par_state)->builtin_float;
3465 static struct type *
3466 type_double (struct parser_state *par_state)
3468 return parse_type (par_state)->builtin_double;
3471 static struct type *
3472 type_long_double (struct parser_state *par_state)
3474 return parse_type (par_state)->builtin_long_double;
3477 static struct type *
3478 type_char (struct parser_state *par_state)
3480 return language_string_char_type (parse_language (par_state),
3481 parse_gdbarch (par_state));
3484 static struct type *
3485 type_boolean (struct parser_state *par_state)
3487 return parse_type (par_state)->builtin_bool;
3490 static struct type *
3491 type_system_address (struct parser_state *par_state)
3494 = language_lookup_primitive_type (parse_language (par_state),
3495 parse_gdbarch (par_state),
3497 return type != NULL ? type : parse_type (par_state)->builtin_data_ptr;
3500 /* Provide a prototype to silence -Wmissing-prototypes. */
3501 extern initialize_file_ftype _initialize_ada_exp;
3504 _initialize_ada_exp (void)
3506 obstack_init (&temp_parse_space);