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
65 SPECIAL_VARIABLE
= 267,
106 #define COLONCOLON 262
111 #define SPECIAL_VARIABLE 267
131 #define TICK_LENGTH 287
132 #define TICK_LAST 288
133 #define TICK_FIRST 289
134 #define TICK_ADDRESS 290
135 #define TICK_ACCESS 291
136 #define TICK_MODULUS 292
141 #define TICK_SIZE 297
142 #define TICK_RANGE 298
150 /* Copy the first part of user declarations. */
155 #include "gdb_string.h"
157 #include "expression.h"
159 #include "parser-defs.h"
160 #include "language.h"
161 #include "ada-lang.h"
162 #include "bfd.h" /* Required by objfiles.h. */
163 #include "symfile.h" /* Required by objfiles.h. */
164 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
168 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
169 as well as gratuitiously global symbol names, so we can have multiple
170 yacc generated parsers in gdb. These are only the variables
171 produced by yacc. If other parser generators (bison, byacc, etc) produce
172 additional global names that conflict at link time, then those parser
173 generators need to be fixed instead of adding those names to this list. */
175 /* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
176 options. I presume we are maintaining it to accommodate systems
177 without BISON? (PNH) */
179 #define yymaxdepth ada_maxdepth
180 #define yyparse _ada_parse /* ada_parse calls this after initialization */
181 #define yylex ada_lex
182 #define yyerror ada_error
183 #define yylval ada_lval
184 #define yychar ada_char
185 #define yydebug ada_debug
186 #define yypact ada_pact
189 #define yydef ada_def
190 #define yychk ada_chk
191 #define yypgo ada_pgo
192 #define yyact ada_act
193 #define yyexca ada_exca
194 #define yyerrflag ada_errflag
195 #define yynerrs ada_nerrs
199 #define yy_yys ada_yys
200 #define yystate ada_state
201 #define yytmp ada_tmp
203 #define yy_yyv ada_yyv
204 #define yyval ada_val
205 #define yylloc ada_lloc
206 #define yyreds ada_reds /* With YYDEBUG defined */
207 #define yytoks ada_toks /* With YYDEBUG defined */
208 #define yyname ada_name /* With YYDEBUG defined */
209 #define yyrule ada_rule /* With YYDEBUG defined */
212 #define YYDEBUG 1 /* Default to yydebug support */
215 #define YYFPRINTF parser_fprintf
219 struct minimal_symbol
*msym
;
221 struct stoken stoken
;
224 static struct stoken empty_stoken
= { "", 0 };
226 /* If expression is in the context of TYPE'(...), then TYPE, else
228 static struct type
*type_qualifier
;
232 static int yylex (void);
234 void yyerror (char *);
236 static struct stoken
string_to_operator (struct stoken
);
238 static void write_int (LONGEST
, struct type
*);
240 static void write_object_renaming (struct block
*, struct symbol
*, int);
242 static struct type
* write_var_or_type (struct block
*, struct stoken
);
244 static void write_name_assoc (struct stoken
);
246 static void write_exp_op_with_string (enum exp_opcode
, struct stoken
);
248 static struct block
*block_lookup (struct block
*, char *);
250 static LONGEST
convert_char_literal (struct type
*, LONGEST
);
252 static void write_ambiguous_var (struct block
*, char *, int);
254 static struct type
*type_int (void);
256 static struct type
*type_long (void);
258 static struct type
*type_long_long (void);
260 static struct type
*type_float (void);
262 static struct type
*type_double (void);
264 static struct type
*type_long_double (void);
266 static struct type
*type_char (void);
268 static struct type
*type_system_address (void);
272 /* Enabling traces. */
277 /* Enabling verbose error messages. */
278 #ifdef YYERROR_VERBOSE
279 # undef YYERROR_VERBOSE
280 # define YYERROR_VERBOSE 1
282 # define YYERROR_VERBOSE 0
285 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
286 #line 160 "ada-exp.y"
287 typedef union YYSTYPE
{
300 struct internalvar
*ivar
;
302 /* Line 191 of yacc.c. */
303 #line 304 "ada-exp.c.tmp"
304 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
305 # define YYSTYPE_IS_DECLARED 1
306 # define YYSTYPE_IS_TRIVIAL 1
311 /* Copy the second part of user declarations. */
314 /* Line 214 of yacc.c. */
315 #line 316 "ada-exp.c.tmp"
317 #if ! defined (yyoverflow) || YYERROR_VERBOSE
323 # define YYMALLOC xmalloc
326 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
328 # ifdef YYSTACK_USE_ALLOCA
329 # if YYSTACK_USE_ALLOCA
330 # define YYSTACK_ALLOC alloca
333 # if defined (alloca) || defined (_ALLOCA_H)
334 # define YYSTACK_ALLOC alloca
337 # define YYSTACK_ALLOC __builtin_alloca
342 # ifdef YYSTACK_ALLOC
343 /* Pacify GCC's `empty if-body' warning. */
344 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
346 # if defined (__STDC__) || defined (__cplusplus)
347 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
348 # define YYSIZE_T size_t
350 # define YYSTACK_ALLOC YYMALLOC
351 # define YYSTACK_FREE YYFREE
353 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
356 #if (! defined (yyoverflow) \
357 && (! defined (__cplusplus) \
358 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
360 /* A type that is properly aligned for any stack member. */
367 /* The size of the maximum gap between one aligned stack and the next. */
368 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
370 /* The size of an array large to enough to hold all stacks, each with
372 # define YYSTACK_BYTES(N) \
373 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
374 + YYSTACK_GAP_MAXIMUM)
376 /* Copy COUNT objects from FROM to TO. The source and destination do
379 # if defined (__GNUC__) && 1 < __GNUC__
380 # define YYCOPY(To, From, Count) \
381 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
383 # define YYCOPY(To, From, Count) \
386 register YYSIZE_T yyi; \
387 for (yyi = 0; yyi < (Count); yyi++) \
388 (To)[yyi] = (From)[yyi]; \
394 /* Relocate STACK from its old location to the new one. The
395 local variables YYSIZE and YYSTACKSIZE give the old and new number of
396 elements in the stack, and YYPTR gives the new location of the
397 stack. Advance YYPTR to a properly aligned location for the next
399 # define YYSTACK_RELOCATE(Stack) \
402 YYSIZE_T yynewbytes; \
403 YYCOPY (&yyptr->Stack, Stack, yysize); \
404 Stack = &yyptr->Stack; \
405 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
406 yyptr += yynewbytes / sizeof (*yyptr); \
412 #if defined (__STDC__) || defined (__cplusplus)
413 typedef signed char yysigned_char
;
415 typedef short yysigned_char
;
418 /* YYFINAL -- State number of the termination state. */
420 /* YYLAST -- Last index in YYTABLE. */
423 /* YYNTOKENS -- Number of terminals. */
425 /* YYNNTS -- Number of nonterminals. */
427 /* YYNRULES -- Number of rules. */
429 /* YYNRULES -- Number of states. */
430 #define YYNSTATES 231
432 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
434 #define YYMAXUTOK 301
436 #define YYTRANSLATE(YYX) \
437 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
439 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
440 static const unsigned char yytranslate
[] =
442 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 30, 62,
446 56, 61, 32, 28, 63, 29, 55, 33, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 60,
448 20, 19, 21, 2, 27, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 57, 2, 66, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 64, 40, 65, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
468 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
469 15, 16, 17, 18, 22, 23, 24, 25, 26, 31,
470 34, 35, 36, 37, 38, 39, 41, 42, 43, 44,
471 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
476 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
478 static const unsigned short yyprhs
[] =
480 0, 0, 3, 5, 7, 11, 15, 18, 21, 26,
481 31, 32, 40, 41, 48, 55, 59, 61, 63, 65,
482 67, 70, 73, 76, 79, 80, 82, 86, 90, 96,
483 101, 105, 109, 113, 117, 121, 125, 129, 133, 137,
484 139, 143, 147, 151, 157, 163, 167, 174, 181, 186,
485 190, 194, 198, 200, 202, 204, 206, 208, 210, 214,
486 218, 223, 228, 232, 236, 241, 246, 250, 254, 257,
487 260, 264, 268, 272, 275, 278, 286, 294, 300, 306,
488 309, 310, 314, 316, 318, 319, 321, 323, 325, 327,
489 329, 332, 334, 337, 340, 344, 347, 351, 355, 357,
490 360, 363, 366, 370, 372, 374, 378, 382, 384, 385,
491 390, 394, 395, 402, 403, 408, 412, 413, 420, 423,
495 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
496 static const yysigned_char yyrhs
[] =
498 68, 0, -1, 69, -1, 76, -1, 69, 60, 76,
499 -1, 70, 13, 76, -1, 70, 11, -1, 70, 10,
500 -1, 70, 56, 74, 61, -1, 85, 56, 74, 61,
501 -1, -1, 85, 62, 72, 71, 56, 76, 61, -1,
502 -1, 70, 56, 73, 22, 73, 61, -1, 85, 56,
503 73, 22, 73, 61, -1, 56, 69, 61, -1, 85,
504 -1, 12, -1, 87, -1, 70, -1, 29, 73, -1,
505 28, 73, -1, 36, 73, -1, 37, 73, -1, -1,
506 76, -1, 9, 41, 76, -1, 74, 63, 76, -1,
507 74, 63, 9, 41, 76, -1, 64, 85, 65, 73,
508 -1, 73, 38, 73, -1, 73, 32, 73, -1, 73,
509 33, 73, -1, 73, 34, 73, -1, 73, 35, 73,
510 -1, 73, 27, 73, -1, 73, 28, 73, -1, 73,
511 30, 73, -1, 73, 29, 73, -1, 73, -1, 73,
512 19, 73, -1, 73, 26, 73, -1, 73, 25, 73,
513 -1, 73, 23, 73, 22, 73, -1, 73, 23, 70,
514 53, 82, -1, 73, 23, 85, -1, 73, 36, 23,
515 73, 22, 73, -1, 73, 36, 23, 70, 53, 82,
516 -1, 73, 36, 23, 85, -1, 73, 24, 73, -1,
517 73, 20, 73, -1, 73, 21, 73, -1, 75, -1,
518 77, -1, 78, -1, 79, -1, 80, -1, 81, -1,
519 75, 18, 75, -1, 77, 18, 75, -1, 75, 18,
520 15, 75, -1, 78, 18, 15, 75, -1, 75, 17,
521 75, -1, 79, 17, 75, -1, 75, 17, 14, 75,
522 -1, 80, 17, 14, 75, -1, 75, 16, 75, -1,
523 81, 16, 75, -1, 70, 46, -1, 70, 45, -1,
524 70, 44, 82, -1, 70, 43, 82, -1, 70, 42,
525 82, -1, 70, 52, -1, 70, 51, -1, 84, 48,
526 56, 76, 63, 76, 61, -1, 84, 49, 56, 76,
527 63, 76, 61, -1, 84, 54, 56, 76, 61, -1,
528 83, 50, 56, 76, 61, -1, 83, 47, -1, -1,
529 56, 3, 61, -1, 85, -1, 83, -1, -1, 3,
530 -1, 5, -1, 6, -1, 4, -1, 8, -1, 58,
531 9, -1, 9, -1, 86, 9, -1, 9, 46, -1,
532 86, 9, 46, -1, 9, 7, -1, 86, 9, 7,
533 -1, 56, 88, 61, -1, 90, -1, 89, 76, -1,
534 89, 90, -1, 76, 63, -1, 89, 76, 63, -1,
535 91, -1, 92, -1, 92, 63, 90, -1, 59, 41,
536 76, -1, 93, -1, -1, 9, 41, 94, 76, -1,
537 73, 41, 76, -1, -1, 73, 22, 73, 41, 95,
538 76, -1, -1, 9, 40, 96, 93, -1, 73, 40,
539 93, -1, -1, 73, 22, 73, 40, 97, 93, -1,
540 32, 70, -1, 30, 70, -1, 70, 57, 76, 66,
544 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
545 static const unsigned short yyrline
[] =
547 0, 224, 224, 228, 229, 231, 236, 240, 244, 250,
548 269, 269, 281, 285, 287, 295, 306, 316, 320, 323,
549 326, 330, 334, 338, 342, 345, 347, 349, 351, 355,
550 368, 372, 376, 380, 384, 388, 392, 396, 400, 404,
551 407, 411, 415, 419, 421, 426, 434, 438, 444, 455,
552 459, 463, 467, 468, 469, 470, 471, 472, 476, 478,
553 483, 485, 490, 492, 497, 499, 503, 505, 517, 519,
554 525, 528, 531, 534, 536, 538, 540, 542, 544, 546,
555 550, 552, 557, 567, 569, 575, 579, 586, 594, 598,
556 604, 608, 610, 612, 620, 631, 633, 638, 647, 648,
557 654, 659, 665, 674, 675, 676, 680, 685, 700, 699,
558 702, 705, 704, 710, 709, 712, 715, 714, 722, 724,
563 #if YYDEBUG || YYERROR_VERBOSE
564 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
565 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
566 static const char *const yytname
[] =
568 "$end", "error", "$undefined", "INT", "NULL_PTR", "CHARLIT", "FLOAT",
569 "COLONCOLON", "STRING", "NAME", "DOT_ID", "DOT_ALL", "SPECIAL_VARIABLE",
570 "ASSIGN", "ELSE", "THEN", "XOR", "OR", "_AND_", "'='", "'<'", "'>'",
571 "DOTDOT", "IN", "GEQ", "LEQ", "NOTEQUAL", "'@'", "'+'", "'-'", "'&'",
572 "UNARY", "'*'", "'/'", "REM", "MOD", "NOT", "ABS", "STARSTAR", "VAR",
573 "'|'", "ARROW", "TICK_LENGTH", "TICK_LAST", "TICK_FIRST", "TICK_ADDRESS",
574 "TICK_ACCESS", "TICK_MODULUS", "TICK_MIN", "TICK_MAX", "TICK_VAL",
575 "TICK_TAG", "TICK_SIZE", "TICK_RANGE", "TICK_POS", "'.'", "'('", "'['",
576 "NEW", "OTHERS", "';'", "')'", "'''", "','", "'{'", "'}'", "']'",
577 "$accept", "start", "exp1", "primary", "@1", "save_qualifier",
578 "simple_exp", "arglist", "relation", "exp", "and_exp", "and_then_exp",
579 "or_exp", "or_else_exp", "xor_exp", "tick_arglist", "type_prefix",
580 "opt_type_prefix", "var_or_type", "block", "aggregate",
581 "aggregate_component_list", "positional_list", "component_groups",
582 "others", "component_group", "component_associations", "@2", "@3", "@4",
588 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
590 static const unsigned short yytoknum
[] =
592 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
593 265, 266, 267, 268, 269, 270, 271, 272, 273, 61,
594 60, 62, 274, 275, 276, 277, 278, 64, 43, 45,
595 38, 279, 42, 47, 280, 281, 282, 283, 284, 285,
596 124, 286, 287, 288, 289, 290, 291, 292, 293, 294,
597 295, 296, 297, 298, 299, 46, 40, 91, 300, 301,
598 59, 41, 39, 44, 123, 125, 93
602 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
603 static const unsigned char yyr1
[] =
605 0, 67, 68, 69, 69, 69, 70, 70, 70, 70,
606 71, 70, 72, 70, 70, 70, 70, 70, 70, 73,
607 73, 73, 73, 73, 74, 74, 74, 74, 74, 73,
608 73, 73, 73, 73, 73, 73, 73, 73, 73, 75,
609 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
610 75, 75, 76, 76, 76, 76, 76, 76, 77, 77,
611 78, 78, 79, 79, 80, 80, 81, 81, 70, 70,
612 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
613 82, 82, 83, 84, 84, 70, 70, 70, 70, 70,
614 70, 85, 85, 85, 85, 86, 86, 87, 88, 88,
615 88, 89, 89, 90, 90, 90, 91, 92, 94, 93,
616 93, 95, 93, 96, 93, 93, 97, 93, 70, 70,
620 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
621 static const unsigned char yyr2
[] =
623 0, 2, 1, 1, 3, 3, 2, 2, 4, 4,
624 0, 7, 0, 6, 6, 3, 1, 1, 1, 1,
625 2, 2, 2, 2, 0, 1, 3, 3, 5, 4,
626 3, 3, 3, 3, 3, 3, 3, 3, 3, 1,
627 3, 3, 3, 5, 5, 3, 6, 6, 4, 3,
628 3, 3, 1, 1, 1, 1, 1, 1, 3, 3,
629 4, 4, 3, 3, 4, 4, 3, 3, 2, 2,
630 3, 3, 3, 2, 2, 7, 7, 5, 5, 2,
631 0, 3, 1, 1, 0, 1, 1, 1, 1, 1,
632 2, 1, 2, 2, 3, 2, 3, 3, 1, 2,
633 2, 2, 3, 1, 1, 3, 3, 1, 0, 4,
634 3, 0, 6, 0, 4, 3, 0, 6, 2, 2,
638 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
639 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
640 means the default is an error. */
641 static const unsigned char yydefact
[] =
643 84, 85, 88, 86, 87, 89, 91, 17, 84, 84,
644 84, 84, 84, 84, 84, 0, 0, 0, 2, 19,
645 39, 52, 3, 53, 54, 55, 56, 57, 83, 0,
646 16, 0, 18, 95, 93, 19, 21, 20, 119, 118,
647 22, 23, 91, 0, 0, 39, 3, 0, 84, 98,
648 103, 104, 107, 90, 0, 1, 84, 7, 6, 84,
649 80, 80, 80, 69, 68, 74, 73, 84, 84, 84,
650 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
651 84, 84, 84, 84, 0, 84, 84, 84, 84, 84,
652 0, 84, 0, 84, 79, 0, 0, 0, 0, 84,
653 12, 92, 113, 108, 84, 15, 84, 84, 84, 101,
654 97, 99, 100, 84, 84, 4, 5, 0, 72, 71,
655 70, 91, 39, 0, 25, 0, 40, 50, 51, 19,
656 0, 16, 49, 42, 41, 35, 36, 38, 37, 31,
657 32, 33, 34, 84, 30, 66, 84, 62, 84, 58,
658 59, 84, 63, 84, 67, 84, 84, 84, 84, 39,
659 0, 10, 96, 94, 84, 84, 106, 0, 0, 115,
660 110, 102, 105, 29, 0, 84, 84, 8, 84, 120,
661 80, 84, 19, 0, 16, 64, 60, 61, 65, 0,
662 0, 0, 0, 84, 9, 0, 114, 109, 116, 111,
663 81, 26, 0, 91, 27, 44, 43, 80, 84, 78,
664 84, 84, 77, 0, 84, 84, 84, 13, 84, 47,
665 46, 0, 0, 14, 0, 117, 112, 28, 75, 76,
669 /* YYDEFGOTO[NTERM-NUM]. */
670 static const short yydefgoto
[] =
672 -1, 17, 18, 35, 195, 161, 20, 123, 21, 124,
673 23, 24, 25, 26, 27, 118, 28, 29, 30, 31,
674 32, 47, 48, 49, 50, 51, 52, 165, 216, 164,
678 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
680 #define YYPACT_NINF -104
681 static const short yypact
[] =
683 396, -104, -104, -104, -104, -104, 16, -104, 396, 396,
684 121, 121, 396, 396, 282, 2, 6, 9, -28, 150,
685 629, 89, -104, 20, 24, 33, 41, 35, 43, 18,
686 275, 55, -104, -104, -104, 513, -7, -7, -3, -3,
687 -7, -7, 3, 28, -14, 566, 25, 31, 282, -104,
688 -104, 37, -104, -104, 44, -104, 396, -104, -104, 396,
689 42, 42, 42, -104, -104, -104, -104, 272, 396, 396,
690 396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
691 396, 396, 396, 396, 79, 396, 396, 339, 351, 396,
692 50, 396, 99, 396, -104, 58, 59, 60, 63, 272,
693 -104, 17, -104, -104, 396, -104, 396, 408, 396, -104,
694 -104, 57, -104, 282, 396, -104, -104, 119, -104, -104,
695 -104, -1, 589, -41, -104, 65, 656, 656, 656, 476,
696 215, 173, 656, 656, 656, 667, -7, -7, -7, 85,
697 85, 85, 85, 396, 85, -104, 396, -104, 396, -104,
698 -104, 396, -104, 396, -104, 396, 396, 396, 396, 609,
699 34, -104, -104, -104, 408, 396, -104, 641, 466, -104,
700 -104, -104, -104, -104, 71, 396, 396, -104, 453, -104,
701 42, 396, 492, 441, 208, -104, -104, -104, -104, 73,
702 76, 81, 84, 396, -104, 93, -104, -104, -104, -104,
703 -104, -104, 108, 14, -104, -104, 656, 42, 396, -104,
704 396, 396, -104, 544, 396, 408, 396, -104, 396, -104,
705 656, 91, 98, -104, 103, -104, -104, -104, -104, -104,
709 /* YYPGOTO[NTERM-NUM]. */
710 static const short yypgoto
[] =
712 -104, -104, 136, 19, -104, -104, 4, 67, -52, 0,
713 -104, -104, -104, -104, -104, -59, -104, -104, -15, -104,
714 -104, -104, -104, -43, -104, -104, -103, -104, -104, -104,
718 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
719 positive, shift that token. If negative, reduce the rule which
720 number is the opposite. If zero, do what YYDEFACT says.
721 If YYTABLE_NINF, syntax error. */
722 #define YYTABLE_NINF -83
723 static const short yytable
[] =
725 22, 54, 119, 120, 169, 112, 33, 57, 58, 55,
726 33, 53, 36, 37, 46, 6, 40, 41, 45, 19,
727 177, 33, 178, 33, 162, 80, 81, 82, 83, 38,
728 39, 85, 56, 19, 145, 147, 149, 150, 89, 152,
729 175, 154, 90, 102, 103, 34, 56, 105, 111, 34,
730 91, 93, 45, 67, 68, 218, 115, 131, 92, 116,
731 34, 196, 34, 163, 101, 151, 96, 97, 125, 104,
732 172, 122, 98, 126, 127, 128, 130, 132, 133, 134,
733 135, 136, 137, 138, 139, 140, 141, 142, 109, 144,
734 94, 129, 110, 95, 185, 194, 186, 178, 117, 187,
735 113, 188, 143, 159, 166, 86, 87, 88, 170, 114,
736 167, 168, 225, 153, 155, 156, 157, 168, 173, 158,
737 171, 205, 174, 85, 1, 2, 3, 4, 184, 5,
738 6, 179, 200, 7, 209, 76, 77, 78, 79, 210,
739 80, 81, 82, 83, 211, 212, 85, 183, 219, 214,
740 44, 10, 228, 11, 0, 189, 190, 191, 192, 229,
741 57, 58, 182, 59, 230, 197, 160, 0, 168, 217,
742 0, 0, 0, -45, 0, 201, 0, 14, 204, 15,
743 202, 0, 0, 0, 0, 206, 0, 0, 0, -45,
744 -45, -45, 60, 61, 62, 63, 64, 213, 0, 0,
745 0, 65, 66, 0, 0, 0, 67, 68, -48, 0,
746 221, 222, 220, 0, 224, 0, 226, 0, 227, 168,
747 -82, -82, -82, -82, -48, -48, -48, -82, 0, 99,
748 0, 0, 0, -45, -45, 100, -45, 181, 0, -45,
749 0, 0, 76, 77, 78, 79, 0, 80, 81, 82,
750 83, 0, 0, 85, 0, -82, -82, -82, -82, 0,
751 0, 0, -82, 0, 99, 0, 0, 0, -48, -48,
752 100, -48, 0, 0, -48, 1, 2, 3, 4, 0,
753 5, 121, 0, 0, 7, 1, 2, 3, 4, 0,
754 5, 42, 0, 0, 7, 0, 0, 0, 0, 0,
755 8, 9, 10, 0, 11, 0, 0, 0, 12, 13,
756 8, 9, 10, 0, 11, 0, 0, 0, 12, 13,
757 0, 0, -82, -82, -82, -82, 0, 0, 14, -82,
758 15, 99, 0, -24, 0, -24, 16, 100, 14, 0,
759 15, 43, 1, 2, 3, 4, 16, 5, 6, 0,
760 0, 7, 0, 146, 1, 2, 3, 4, 0, 5,
761 6, 0, 0, 7, 0, 0, 148, 8, 9, 10,
762 0, 11, 0, 0, 0, 12, 13, 0, 0, 8,
763 9, 10, 0, 11, 0, 0, 0, 12, 13, 0,
764 0, 0, 0, 0, 0, 14, 0, 15, 0, 1,
765 2, 3, 4, 16, 5, 6, 0, 14, 7, 15,
766 0, 1, 2, 3, 4, 16, 5, 42, 0, 0,
767 7, 0, 0, 0, 8, 9, 10, 0, 11, 0,
768 0, 0, 12, 13, 0, 0, 8, 9, 10, 0,
769 11, 0, 0, 0, 12, 13, 0, 0, 0, 0,
770 0, 0, 14, 0, 15, 0, 1, 2, 3, 4,
771 16, 5, 203, 208, 14, 7, 15, 0, 76, 77,
772 78, 79, 16, 80, 81, 82, 83, 0, 0, 85,
773 0, 8, 9, 10, 0, 11, 57, 58, 106, 12,
774 13, 0, 0, 76, 77, 78, 79, 0, 80, 81,
775 82, 83, 57, 58, 85, 0, 107, 108, 0, 14,
776 0, 15, 0, 0, 0, 0, 0, 16, 60, 61,
777 62, 63, 64, 57, 58, 0, 0, 65, 66, 180,
778 0, 0, 67, 68, 60, 61, 62, 63, 64, 0,
779 0, 0, 0, 65, 66, 207, 0, 0, 67, 68,
780 0, 0, 0, 0, 0, 60, 61, 62, 63, 64,
781 0, 0, 0, 0, 65, 66, 0, 0, 0, 67,
782 68, 76, 77, 78, 79, 0, 80, 81, 82, 83,
783 0, 0, 85, 0, 0, 69, 70, 71, 106, 72,
784 73, 74, 75, 76, 77, 78, 79, 0, 80, 81,
785 82, 83, 84, 0, 85, 223, 107, 108, 69, 70,
786 71, 176, 72, 73, 74, 75, 76, 77, 78, 79,
787 0, 80, 81, 82, 83, 84, 0, 85, 69, 70,
788 71, 193, 72, 73, 74, 75, 76, 77, 78, 79,
789 0, 80, 81, 82, 83, 84, 0, 85, 69, 70,
790 71, 0, 72, 73, 74, 75, 76, 77, 78, 79,
791 0, 80, 81, 82, 83, 84, 0, 85, 76, 77,
792 78, 79, 0, 80, 81, 82, 83, 0, 0, 85,
793 0, 198, 199, 76, 77, 78, 79, 0, 80, 81,
794 82, 83, 0, 0, 85, 77, 78, 79, 0, 80,
798 static const short yycheck
[] =
800 0, 16, 61, 62, 107, 48, 7, 10, 11, 0,
801 7, 9, 8, 9, 14, 9, 12, 13, 14, 0,
802 61, 7, 63, 7, 7, 32, 33, 34, 35, 10,
803 11, 38, 60, 14, 86, 87, 88, 89, 18, 91,
804 41, 93, 18, 40, 41, 46, 60, 61, 48, 46,
805 17, 16, 48, 56, 57, 41, 56, 72, 17, 59,
806 46, 164, 46, 46, 9, 15, 48, 49, 68, 41,
807 113, 67, 54, 69, 70, 71, 72, 73, 74, 75,
808 76, 77, 78, 79, 80, 81, 82, 83, 63, 85,
809 47, 72, 61, 50, 146, 61, 148, 63, 56, 151,
810 63, 153, 23, 99, 104, 16, 17, 18, 108, 65,
811 106, 107, 215, 14, 56, 56, 56, 113, 114, 56,
812 63, 180, 3, 38, 3, 4, 5, 6, 143, 8,
813 9, 66, 61, 12, 61, 27, 28, 29, 30, 63,
814 32, 33, 34, 35, 63, 61, 38, 143, 207, 56,
815 14, 30, 61, 32, -1, 155, 156, 157, 158, 61,
816 10, 11, 143, 13, 61, 165, 99, -1, 164, 61,
817 -1, -1, -1, 0, -1, 175, -1, 56, 178, 58,
818 176, -1, -1, -1, -1, 181, -1, -1, -1, 16,
819 17, 18, 42, 43, 44, 45, 46, 193, -1, -1,
820 -1, 51, 52, -1, -1, -1, 56, 57, 0, -1,
821 210, 211, 208, -1, 214, -1, 216, -1, 218, 215,
822 47, 48, 49, 50, 16, 17, 18, 54, -1, 56,
823 -1, -1, -1, 60, 61, 62, 63, 22, -1, 66,
824 -1, -1, 27, 28, 29, 30, -1, 32, 33, 34,
825 35, -1, -1, 38, -1, 47, 48, 49, 50, -1,
826 -1, -1, 54, -1, 56, -1, -1, -1, 60, 61,
827 62, 63, -1, -1, 66, 3, 4, 5, 6, -1,
828 8, 9, -1, -1, 12, 3, 4, 5, 6, -1,
829 8, 9, -1, -1, 12, -1, -1, -1, -1, -1,
830 28, 29, 30, -1, 32, -1, -1, -1, 36, 37,
831 28, 29, 30, -1, 32, -1, -1, -1, 36, 37,
832 -1, -1, 47, 48, 49, 50, -1, -1, 56, 54,
833 58, 56, -1, 61, -1, 63, 64, 62, 56, -1,
834 58, 59, 3, 4, 5, 6, 64, 8, 9, -1,
835 -1, 12, -1, 14, 3, 4, 5, 6, -1, 8,
836 9, -1, -1, 12, -1, -1, 15, 28, 29, 30,
837 -1, 32, -1, -1, -1, 36, 37, -1, -1, 28,
838 29, 30, -1, 32, -1, -1, -1, 36, 37, -1,
839 -1, -1, -1, -1, -1, 56, -1, 58, -1, 3,
840 4, 5, 6, 64, 8, 9, -1, 56, 12, 58,
841 -1, 3, 4, 5, 6, 64, 8, 9, -1, -1,
842 12, -1, -1, -1, 28, 29, 30, -1, 32, -1,
843 -1, -1, 36, 37, -1, -1, 28, 29, 30, -1,
844 32, -1, -1, -1, 36, 37, -1, -1, -1, -1,
845 -1, -1, 56, -1, 58, -1, 3, 4, 5, 6,
846 64, 8, 9, 22, 56, 12, 58, -1, 27, 28,
847 29, 30, 64, 32, 33, 34, 35, -1, -1, 38,
848 -1, 28, 29, 30, -1, 32, 10, 11, 22, 36,
849 37, -1, -1, 27, 28, 29, 30, -1, 32, 33,
850 34, 35, 10, 11, 38, -1, 40, 41, -1, 56,
851 -1, 58, -1, -1, -1, -1, -1, 64, 42, 43,
852 44, 45, 46, 10, 11, -1, -1, 51, 52, 53,
853 -1, -1, 56, 57, 42, 43, 44, 45, 46, -1,
854 -1, -1, -1, 51, 52, 53, -1, -1, 56, 57,
855 -1, -1, -1, -1, -1, 42, 43, 44, 45, 46,
856 -1, -1, -1, -1, 51, 52, -1, -1, -1, 56,
857 57, 27, 28, 29, 30, -1, 32, 33, 34, 35,
858 -1, -1, 38, -1, -1, 19, 20, 21, 22, 23,
859 24, 25, 26, 27, 28, 29, 30, -1, 32, 33,
860 34, 35, 36, -1, 38, 61, 40, 41, 19, 20,
861 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
862 -1, 32, 33, 34, 35, 36, -1, 38, 19, 20,
863 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
864 -1, 32, 33, 34, 35, 36, -1, 38, 19, 20,
865 21, -1, 23, 24, 25, 26, 27, 28, 29, 30,
866 -1, 32, 33, 34, 35, 36, -1, 38, 27, 28,
867 29, 30, -1, 32, 33, 34, 35, -1, -1, 38,
868 -1, 40, 41, 27, 28, 29, 30, -1, 32, 33,
869 34, 35, -1, -1, 38, 28, 29, 30, -1, 32,
870 33, 34, 35, -1, -1, 38
873 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
874 symbol of state STATE-NUM. */
875 static const unsigned char yystos
[] =
877 0, 3, 4, 5, 6, 8, 9, 12, 28, 29,
878 30, 32, 36, 37, 56, 58, 64, 68, 69, 70,
879 73, 75, 76, 77, 78, 79, 80, 81, 83, 84,
880 85, 86, 87, 7, 46, 70, 73, 73, 70, 70,
881 73, 73, 9, 59, 69, 73, 76, 88, 89, 90,
882 91, 92, 93, 9, 85, 0, 60, 10, 11, 13,
883 42, 43, 44, 45, 46, 51, 52, 56, 57, 19,
884 20, 21, 23, 24, 25, 26, 27, 28, 29, 30,
885 32, 33, 34, 35, 36, 38, 16, 17, 18, 18,
886 18, 17, 17, 16, 47, 50, 48, 49, 54, 56,
887 62, 9, 40, 41, 41, 61, 22, 40, 41, 63,
888 61, 76, 90, 63, 65, 76, 76, 56, 82, 82,
889 82, 9, 73, 74, 76, 76, 73, 73, 73, 70,
890 73, 85, 73, 73, 73, 73, 73, 73, 73, 73,
891 73, 73, 73, 23, 73, 75, 14, 75, 15, 75,
892 75, 15, 75, 14, 75, 56, 56, 56, 56, 73,
893 74, 72, 7, 46, 96, 94, 76, 73, 73, 93,
894 76, 63, 90, 73, 3, 41, 22, 61, 63, 66,
895 53, 22, 70, 73, 85, 75, 75, 75, 75, 76,
896 76, 76, 76, 22, 61, 71, 93, 76, 40, 41,
897 61, 76, 73, 9, 76, 82, 73, 53, 22, 61,
898 63, 63, 61, 73, 56, 97, 95, 61, 41, 82,
899 73, 76, 76, 61, 76, 93, 76, 76, 61, 61,
903 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
904 # define YYSIZE_T __SIZE_TYPE__
906 #if ! defined (YYSIZE_T) && defined (size_t)
907 # define YYSIZE_T size_t
909 #if ! defined (YYSIZE_T)
910 # if defined (__STDC__) || defined (__cplusplus)
911 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
912 # define YYSIZE_T size_t
915 #if ! defined (YYSIZE_T)
916 # define YYSIZE_T unsigned int
919 #define yyerrok (yyerrstatus = 0)
920 #define yyclearin (yychar = YYEMPTY)
924 #define YYACCEPT goto yyacceptlab
925 #define YYABORT goto yyabortlab
926 #define YYERROR goto yyerrorlab
929 /* Like YYERROR except do call yyerror. This remains here temporarily
930 to ease the transition to the new meaning of YYERROR, for GCC.
931 Once GCC version 2 has supplanted version 1, this can go. */
933 #define YYFAIL goto yyerrlab
935 #define YYRECOVERING() (!!yyerrstatus)
937 #define YYBACKUP(Token, Value) \
939 if (yychar == YYEMPTY && yylen == 1) \
943 yytoken = YYTRANSLATE (yychar); \
949 yyerror ("syntax error: cannot back up");\
955 #define YYERRCODE 256
957 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
960 #ifndef YYLLOC_DEFAULT
961 # define YYLLOC_DEFAULT(Current, Rhs, N) \
962 ((Current).first_line = (Rhs)[1].first_line, \
963 (Current).first_column = (Rhs)[1].first_column, \
964 (Current).last_line = (Rhs)[N].last_line, \
965 (Current).last_column = (Rhs)[N].last_column)
968 /* YYLEX -- calling `yylex' with the right arguments. */
971 # define YYLEX yylex (YYLEX_PARAM)
973 # define YYLEX yylex ()
976 /* Enable debugging if requested. */
980 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
981 # define YYFPRINTF fprintf
984 # define YYDPRINTF(Args) \
990 # define YYDSYMPRINT(Args) \
996 # define YYDSYMPRINTF(Title, Token, Value, Location) \
1000 YYFPRINTF (stderr, "%s ", Title); \
1001 yysymprint (stderr, \
1003 YYFPRINTF (stderr, "\n"); \
1007 /*------------------------------------------------------------------.
1008 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1010 `------------------------------------------------------------------*/
1012 #if defined (__STDC__) || defined (__cplusplus)
1014 yy_stack_print (short *bottom
, short *top
)
1017 yy_stack_print (bottom
, top
)
1022 YYFPRINTF (stderr
, "Stack now");
1023 for (/* Nothing. */; bottom
<= top
; ++bottom
)
1024 YYFPRINTF (stderr
, " %d", *bottom
);
1025 YYFPRINTF (stderr
, "\n");
1028 # define YY_STACK_PRINT(Bottom, Top) \
1031 yy_stack_print ((Bottom), (Top)); \
1035 /*------------------------------------------------.
1036 | Report that the YYRULE is going to be reduced. |
1037 `------------------------------------------------*/
1039 #if defined (__STDC__) || defined (__cplusplus)
1041 yy_reduce_print (int yyrule
)
1044 yy_reduce_print (yyrule
)
1049 unsigned int yylno
= yyrline
[yyrule
];
1050 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
1052 /* Print the symbols being reduced, and their result. */
1053 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
1054 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1055 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
1058 # define YY_REDUCE_PRINT(Rule) \
1061 yy_reduce_print (Rule); \
1064 /* Nonzero means print parse trace. It is left uninitialized so that
1065 multiple parsers can coexist. */
1067 #else /* !YYDEBUG */
1068 # define YYDPRINTF(Args)
1069 # define YYDSYMPRINT(Args)
1070 # define YYDSYMPRINTF(Title, Token, Value, Location)
1071 # define YY_STACK_PRINT(Bottom, Top)
1072 # define YY_REDUCE_PRINT(Rule)
1073 #endif /* !YYDEBUG */
1076 /* YYINITDEPTH -- initial size of the parser's stacks. */
1078 # define YYINITDEPTH 200
1081 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1082 if the built-in stack extension method is used).
1084 Do not make this value too large; the results are undefined if
1085 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1086 evaluated with infinite-precision integer arithmetic. */
1088 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1093 # define YYMAXDEPTH 10000
1101 # if defined (__GLIBC__) && defined (_STRING_H)
1102 # define yystrlen strlen
1104 /* Return the length of YYSTR. */
1106 # if defined (__STDC__) || defined (__cplusplus)
1107 yystrlen (const char *yystr
)
1113 register const char *yys
= yystr
;
1115 while (*yys
++ != '\0')
1118 return yys
- yystr
- 1;
1124 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1125 # define yystpcpy stpcpy
1127 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1130 # if defined (__STDC__) || defined (__cplusplus)
1131 yystpcpy (char *yydest
, const char *yysrc
)
1133 yystpcpy (yydest
, yysrc
)
1138 register char *yyd
= yydest
;
1139 register const char *yys
= yysrc
;
1141 while ((*yyd
++ = *yys
++) != '\0')
1149 #endif /* !YYERROR_VERBOSE */
1154 /*--------------------------------.
1155 | Print this symbol on YYOUTPUT. |
1156 `--------------------------------*/
1158 #if defined (__STDC__) || defined (__cplusplus)
1160 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
1163 yysymprint (yyoutput
, yytype
, yyvaluep
)
1169 /* Pacify ``unused variable'' warnings. */
1172 if (yytype
< YYNTOKENS
)
1174 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1176 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1180 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1187 YYFPRINTF (yyoutput
, ")");
1190 #endif /* ! YYDEBUG */
1191 /*-----------------------------------------------.
1192 | Release the memory associated to this symbol. |
1193 `-----------------------------------------------*/
1195 #if defined (__STDC__) || defined (__cplusplus)
1197 yydestruct (int yytype
, YYSTYPE
*yyvaluep
)
1200 yydestruct (yytype
, yyvaluep
)
1205 /* Pacify ``unused variable'' warnings. */
1217 /* Prevent warnings from -Wmissing-prototypes. */
1219 #ifdef YYPARSE_PARAM
1220 # if defined (__STDC__) || defined (__cplusplus)
1221 int yyparse (void *YYPARSE_PARAM
);
1225 #else /* ! YYPARSE_PARAM */
1226 #if defined (__STDC__) || defined (__cplusplus)
1231 #endif /* ! YYPARSE_PARAM */
1235 /* The lookahead symbol. */
1238 /* The semantic value of the lookahead symbol. */
1241 /* Number of syntax errors so far. */
1250 #ifdef YYPARSE_PARAM
1251 # if defined (__STDC__) || defined (__cplusplus)
1252 int yyparse (void *YYPARSE_PARAM
)
1254 int yyparse (YYPARSE_PARAM
)
1255 void *YYPARSE_PARAM
;
1257 #else /* ! YYPARSE_PARAM */
1258 #if defined (__STDC__) || defined (__cplusplus)
1269 register int yystate
;
1272 /* Number of tokens to shift before error messages enabled. */
1274 /* Lookahead token as an internal (translated) token number. */
1277 /* Three stacks and their tools:
1278 `yyss': related to states,
1279 `yyvs': related to semantic values,
1280 `yyls': related to locations.
1282 Refer to the stacks thru separate pointers, to allow yyoverflow
1283 to xreallocate them elsewhere. */
1285 /* The state stack. */
1286 short yyssa
[YYINITDEPTH
];
1287 short *yyss
= yyssa
;
1288 register short *yyssp
;
1290 /* The semantic value stack. */
1291 YYSTYPE yyvsa
[YYINITDEPTH
];
1292 YYSTYPE
*yyvs
= yyvsa
;
1293 register YYSTYPE
*yyvsp
;
1297 #define YYPOPSTACK (yyvsp--, yyssp--)
1299 YYSIZE_T yystacksize
= YYINITDEPTH
;
1301 /* The variables used to return semantic value and location from the
1306 /* When reducing, the number of symbols on the RHS of the reduced
1310 YYDPRINTF ((stderr
, "Starting parse\n"));
1315 yychar
= YYEMPTY
; /* Cause a token to be read. */
1317 /* Initialize stack pointers.
1318 Waste one element of value and location stack
1319 so that they stay on the same level as the state stack.
1320 The wasted elements are never initialized. */
1327 /*------------------------------------------------------------.
1328 | yynewstate -- Push a new state, which is found in yystate. |
1329 `------------------------------------------------------------*/
1331 /* In all cases, when you get here, the value and location stacks
1332 have just been pushed. so pushing a state here evens the stacks.
1339 if (yyss
+ yystacksize
- 1 <= yyssp
)
1341 /* Get the current used size of the three stacks, in elements. */
1342 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1346 /* Give user a chance to xreallocate the stack. Use copies of
1347 these so that the &'s don't force the real ones into
1349 YYSTYPE
*yyvs1
= yyvs
;
1350 short *yyss1
= yyss
;
1353 /* Each stack pointer address is followed by the size of the
1354 data in use in that stack, in bytes. This used to be a
1355 conditional around just the two extra args, but that might
1356 be undefined if yyoverflow is a macro. */
1357 yyoverflow ("parser stack overflow",
1358 &yyss1
, yysize
* sizeof (*yyssp
),
1359 &yyvs1
, yysize
* sizeof (*yyvsp
),
1366 #else /* no yyoverflow */
1367 # ifndef YYSTACK_RELOCATE
1370 /* Extend the stack our own way. */
1371 if (YYMAXDEPTH
<= yystacksize
)
1374 if (YYMAXDEPTH
< yystacksize
)
1375 yystacksize
= YYMAXDEPTH
;
1378 short *yyss1
= yyss
;
1379 union yyalloc
*yyptr
=
1380 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1383 YYSTACK_RELOCATE (yyss
);
1384 YYSTACK_RELOCATE (yyvs
);
1386 # undef YYSTACK_RELOCATE
1388 YYSTACK_FREE (yyss1
);
1391 #endif /* no yyoverflow */
1393 yyssp
= yyss
+ yysize
- 1;
1394 yyvsp
= yyvs
+ yysize
- 1;
1397 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1398 (unsigned long int) yystacksize
));
1400 if (yyss
+ yystacksize
- 1 <= yyssp
)
1404 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1413 /* Do appropriate processing given the current state. */
1414 /* Read a lookahead token if we need one and don't already have one. */
1417 /* First try to decide what to do without reference to lookahead token. */
1419 yyn
= yypact
[yystate
];
1420 if (yyn
== YYPACT_NINF
)
1423 /* Not known => get a lookahead token if don't already have one. */
1425 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1426 if (yychar
== YYEMPTY
)
1428 YYDPRINTF ((stderr
, "Reading a token: "));
1432 if (yychar
<= YYEOF
)
1434 yychar
= yytoken
= YYEOF
;
1435 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1439 yytoken
= YYTRANSLATE (yychar
);
1440 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1443 /* If the proper action on seeing token YYTOKEN is to reduce or to
1444 detect an error, take that action. */
1446 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1451 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1460 /* Shift the lookahead token. */
1461 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1463 /* Discard the token being shifted unless it is eof. */
1464 if (yychar
!= YYEOF
)
1470 /* Count tokens shifted since error; after three, turn off error
1479 /*-----------------------------------------------------------.
1480 | yydefault -- do the default action for the current state. |
1481 `-----------------------------------------------------------*/
1483 yyn
= yydefact
[yystate
];
1489 /*-----------------------------.
1490 | yyreduce -- Do a reduction. |
1491 `-----------------------------*/
1493 /* yyn is the number of a rule to reduce with. */
1496 /* If YYLEN is nonzero, implement the default value of the action:
1499 Otherwise, the following line sets YYVAL to garbage.
1500 This behavior is undocumented and Bison
1501 users should not rely upon it. Assigning to YYVAL
1502 unconditionally makes the parser a bit smaller, and it avoids a
1503 GCC warning that YYVAL may be used uninitialized. */
1504 yyval
= yyvsp
[1-yylen
];
1507 YY_REDUCE_PRINT (yyn
);
1511 #line 230 "ada-exp.y"
1512 { write_exp_elt_opcode (BINOP_COMMA
); }
1516 #line 232 "ada-exp.y"
1517 { write_exp_elt_opcode (BINOP_ASSIGN
); }
1521 #line 237 "ada-exp.y"
1522 { write_exp_elt_opcode (UNOP_IND
); }
1526 #line 241 "ada-exp.y"
1527 { write_exp_op_with_string (STRUCTOP_STRUCT
, yyvsp
[0].sval
); }
1531 #line 245 "ada-exp.y"
1533 write_exp_elt_opcode (OP_FUNCALL
);
1534 write_exp_elt_longcst (yyvsp
[-1].lval
);
1535 write_exp_elt_opcode (OP_FUNCALL
);
1540 #line 251 "ada-exp.y"
1542 if (yyvsp
[-3].tval
!= NULL
)
1544 if (yyvsp
[-1].lval
!= 1)
1545 error (_("Invalid conversion"));
1546 write_exp_elt_opcode (UNOP_CAST
);
1547 write_exp_elt_type (yyvsp
[-3].tval
);
1548 write_exp_elt_opcode (UNOP_CAST
);
1552 write_exp_elt_opcode (OP_FUNCALL
);
1553 write_exp_elt_longcst (yyvsp
[-1].lval
);
1554 write_exp_elt_opcode (OP_FUNCALL
);
1560 #line 269 "ada-exp.y"
1561 { type_qualifier
= yyvsp
[-2].tval
; }
1565 #line 271 "ada-exp.y"
1567 if (yyvsp
[-6].tval
== NULL
)
1568 error (_("Type required for qualification"));
1569 write_exp_elt_opcode (UNOP_QUAL
);
1570 write_exp_elt_type (yyvsp
[-6].tval
);
1571 write_exp_elt_opcode (UNOP_QUAL
);
1572 type_qualifier
= yyvsp
[-4].tval
;
1577 #line 281 "ada-exp.y"
1578 { yyval
.tval
= type_qualifier
; }
1582 #line 286 "ada-exp.y"
1583 { write_exp_elt_opcode (TERNOP_SLICE
); }
1587 #line 288 "ada-exp.y"
1588 { if (yyvsp
[-5].tval
== NULL
)
1589 write_exp_elt_opcode (TERNOP_SLICE
);
1591 error (_("Cannot slice a type"));
1596 #line 295 "ada-exp.y"
1601 #line 307 "ada-exp.y"
1602 { if (yyvsp
[0].tval
!= NULL
)
1604 write_exp_elt_opcode (OP_TYPE
);
1605 write_exp_elt_type (yyvsp
[0].tval
);
1606 write_exp_elt_opcode (OP_TYPE
);
1612 #line 317 "ada-exp.y"
1613 { write_dollar_variable (yyvsp
[0].sval
); }
1617 #line 327 "ada-exp.y"
1618 { write_exp_elt_opcode (UNOP_NEG
); }
1622 #line 331 "ada-exp.y"
1623 { write_exp_elt_opcode (UNOP_PLUS
); }
1627 #line 335 "ada-exp.y"
1628 { write_exp_elt_opcode (UNOP_LOGICAL_NOT
); }
1632 #line 339 "ada-exp.y"
1633 { write_exp_elt_opcode (UNOP_ABS
); }
1637 #line 342 "ada-exp.y"
1642 #line 346 "ada-exp.y"
1647 #line 348 "ada-exp.y"
1652 #line 350 "ada-exp.y"
1653 { yyval
.lval
= yyvsp
[-2].lval
+ 1; }
1657 #line 352 "ada-exp.y"
1658 { yyval
.lval
= yyvsp
[-4].lval
+ 1; }
1662 #line 357 "ada-exp.y"
1664 if (yyvsp
[-2].tval
== NULL
)
1665 error (_("Type required within braces in coercion"));
1666 write_exp_elt_opcode (UNOP_MEMVAL
);
1667 write_exp_elt_type (yyvsp
[-2].tval
);
1668 write_exp_elt_opcode (UNOP_MEMVAL
);
1673 #line 369 "ada-exp.y"
1674 { write_exp_elt_opcode (BINOP_EXP
); }
1678 #line 373 "ada-exp.y"
1679 { write_exp_elt_opcode (BINOP_MUL
); }
1683 #line 377 "ada-exp.y"
1684 { write_exp_elt_opcode (BINOP_DIV
); }
1688 #line 381 "ada-exp.y"
1689 { write_exp_elt_opcode (BINOP_REM
); }
1693 #line 385 "ada-exp.y"
1694 { write_exp_elt_opcode (BINOP_MOD
); }
1698 #line 389 "ada-exp.y"
1699 { write_exp_elt_opcode (BINOP_REPEAT
); }
1703 #line 393 "ada-exp.y"
1704 { write_exp_elt_opcode (BINOP_ADD
); }
1708 #line 397 "ada-exp.y"
1709 { write_exp_elt_opcode (BINOP_CONCAT
); }
1713 #line 401 "ada-exp.y"
1714 { write_exp_elt_opcode (BINOP_SUB
); }
1718 #line 408 "ada-exp.y"
1719 { write_exp_elt_opcode (BINOP_EQUAL
); }
1723 #line 412 "ada-exp.y"
1724 { write_exp_elt_opcode (BINOP_NOTEQUAL
); }
1728 #line 416 "ada-exp.y"
1729 { write_exp_elt_opcode (BINOP_LEQ
); }
1733 #line 420 "ada-exp.y"
1734 { write_exp_elt_opcode (TERNOP_IN_RANGE
); }
1738 #line 422 "ada-exp.y"
1739 { write_exp_elt_opcode (BINOP_IN_BOUNDS
);
1740 write_exp_elt_longcst ((LONGEST
) yyvsp
[0].lval
);
1741 write_exp_elt_opcode (BINOP_IN_BOUNDS
);
1746 #line 427 "ada-exp.y"
1748 if (yyvsp
[0].tval
== NULL
)
1749 error (_("Right operand of 'in' must be type"));
1750 write_exp_elt_opcode (UNOP_IN_RANGE
);
1751 write_exp_elt_type (yyvsp
[0].tval
);
1752 write_exp_elt_opcode (UNOP_IN_RANGE
);
1757 #line 435 "ada-exp.y"
1758 { write_exp_elt_opcode (TERNOP_IN_RANGE
);
1759 write_exp_elt_opcode (UNOP_LOGICAL_NOT
);
1764 #line 439 "ada-exp.y"
1765 { write_exp_elt_opcode (BINOP_IN_BOUNDS
);
1766 write_exp_elt_longcst ((LONGEST
) yyvsp
[0].lval
);
1767 write_exp_elt_opcode (BINOP_IN_BOUNDS
);
1768 write_exp_elt_opcode (UNOP_LOGICAL_NOT
);
1773 #line 445 "ada-exp.y"
1775 if (yyvsp
[0].tval
== NULL
)
1776 error (_("Right operand of 'in' must be type"));
1777 write_exp_elt_opcode (UNOP_IN_RANGE
);
1778 write_exp_elt_type (yyvsp
[0].tval
);
1779 write_exp_elt_opcode (UNOP_IN_RANGE
);
1780 write_exp_elt_opcode (UNOP_LOGICAL_NOT
);
1785 #line 456 "ada-exp.y"
1786 { write_exp_elt_opcode (BINOP_GEQ
); }
1790 #line 460 "ada-exp.y"
1791 { write_exp_elt_opcode (BINOP_LESS
); }
1795 #line 464 "ada-exp.y"
1796 { write_exp_elt_opcode (BINOP_GTR
); }
1800 #line 477 "ada-exp.y"
1801 { write_exp_elt_opcode (BINOP_BITWISE_AND
); }
1805 #line 479 "ada-exp.y"
1806 { write_exp_elt_opcode (BINOP_BITWISE_AND
); }
1810 #line 484 "ada-exp.y"
1811 { write_exp_elt_opcode (BINOP_LOGICAL_AND
); }
1815 #line 486 "ada-exp.y"
1816 { write_exp_elt_opcode (BINOP_LOGICAL_AND
); }
1820 #line 491 "ada-exp.y"
1821 { write_exp_elt_opcode (BINOP_BITWISE_IOR
); }
1825 #line 493 "ada-exp.y"
1826 { write_exp_elt_opcode (BINOP_BITWISE_IOR
); }
1830 #line 498 "ada-exp.y"
1831 { write_exp_elt_opcode (BINOP_LOGICAL_OR
); }
1835 #line 500 "ada-exp.y"
1836 { write_exp_elt_opcode (BINOP_LOGICAL_OR
); }
1840 #line 504 "ada-exp.y"
1841 { write_exp_elt_opcode (BINOP_BITWISE_XOR
); }
1845 #line 506 "ada-exp.y"
1846 { write_exp_elt_opcode (BINOP_BITWISE_XOR
); }
1850 #line 518 "ada-exp.y"
1851 { write_exp_elt_opcode (UNOP_ADDR
); }
1855 #line 520 "ada-exp.y"
1856 { write_exp_elt_opcode (UNOP_ADDR
);
1857 write_exp_elt_opcode (UNOP_CAST
);
1858 write_exp_elt_type (type_system_address ());
1859 write_exp_elt_opcode (UNOP_CAST
);
1864 #line 526 "ada-exp.y"
1865 { write_int (yyvsp
[0].lval
, type_int ());
1866 write_exp_elt_opcode (OP_ATR_FIRST
); }
1870 #line 529 "ada-exp.y"
1871 { write_int (yyvsp
[0].lval
, type_int ());
1872 write_exp_elt_opcode (OP_ATR_LAST
); }
1876 #line 532 "ada-exp.y"
1877 { write_int (yyvsp
[0].lval
, type_int ());
1878 write_exp_elt_opcode (OP_ATR_LENGTH
); }
1882 #line 535 "ada-exp.y"
1883 { write_exp_elt_opcode (OP_ATR_SIZE
); }
1887 #line 537 "ada-exp.y"
1888 { write_exp_elt_opcode (OP_ATR_TAG
); }
1892 #line 539 "ada-exp.y"
1893 { write_exp_elt_opcode (OP_ATR_MIN
); }
1897 #line 541 "ada-exp.y"
1898 { write_exp_elt_opcode (OP_ATR_MAX
); }
1902 #line 543 "ada-exp.y"
1903 { write_exp_elt_opcode (OP_ATR_POS
); }
1907 #line 545 "ada-exp.y"
1908 { write_exp_elt_opcode (OP_ATR_VAL
); }
1912 #line 547 "ada-exp.y"
1913 { write_exp_elt_opcode (OP_ATR_MODULUS
); }
1917 #line 551 "ada-exp.y"
1922 #line 553 "ada-exp.y"
1923 { yyval
.lval
= yyvsp
[-1].typed_val
.val
; }
1927 #line 558 "ada-exp.y"
1929 if (yyvsp
[0].tval
== NULL
)
1930 error (_("Prefix must be type"));
1931 write_exp_elt_opcode (OP_TYPE
);
1932 write_exp_elt_type (yyvsp
[0].tval
);
1933 write_exp_elt_opcode (OP_TYPE
); }
1937 #line 569 "ada-exp.y"
1938 { write_exp_elt_opcode (OP_TYPE
);
1939 write_exp_elt_type (builtin_type_void
);
1940 write_exp_elt_opcode (OP_TYPE
); }
1944 #line 576 "ada-exp.y"
1945 { write_int ((LONGEST
) yyvsp
[0].typed_val
.val
, yyvsp
[0].typed_val
.type
); }
1949 #line 580 "ada-exp.y"
1950 { write_int (convert_char_literal (type_qualifier
, yyvsp
[0].typed_val
.val
),
1951 (type_qualifier
== NULL
)
1952 ? yyvsp
[0].typed_val
.type
: type_qualifier
);
1957 #line 587 "ada-exp.y"
1958 { write_exp_elt_opcode (OP_DOUBLE
);
1959 write_exp_elt_type (yyvsp
[0].typed_val_float
.type
);
1960 write_exp_elt_dblcst (yyvsp
[0].typed_val_float
.dval
);
1961 write_exp_elt_opcode (OP_DOUBLE
);
1966 #line 595 "ada-exp.y"
1967 { write_int (0, type_int ()); }
1971 #line 599 "ada-exp.y"
1973 write_exp_op_with_string (OP_STRING
, yyvsp
[0].sval
);
1978 #line 605 "ada-exp.y"
1979 { error (_("NEW not implemented.")); }
1983 #line 609 "ada-exp.y"
1984 { yyval
.tval
= write_var_or_type (NULL
, yyvsp
[0].sval
); }
1988 #line 611 "ada-exp.y"
1989 { yyval
.tval
= write_var_or_type (yyvsp
[-1].bval
, yyvsp
[0].sval
); }
1993 #line 613 "ada-exp.y"
1995 yyval
.tval
= write_var_or_type (NULL
, yyvsp
[-1].sval
);
1996 if (yyval
.tval
== NULL
)
1997 write_exp_elt_opcode (UNOP_ADDR
);
1999 yyval
.tval
= lookup_pointer_type (yyval
.tval
);
2004 #line 621 "ada-exp.y"
2006 yyval
.tval
= write_var_or_type (yyvsp
[-2].bval
, yyvsp
[-1].sval
);
2007 if (yyval
.tval
== NULL
)
2008 write_exp_elt_opcode (UNOP_ADDR
);
2010 yyval
.tval
= lookup_pointer_type (yyval
.tval
);
2015 #line 632 "ada-exp.y"
2016 { yyval
.bval
= block_lookup (NULL
, yyvsp
[-1].sval
.ptr
); }
2020 #line 634 "ada-exp.y"
2021 { yyval
.bval
= block_lookup (yyvsp
[-2].bval
, yyvsp
[-1].sval
.ptr
); }
2025 #line 639 "ada-exp.y"
2027 write_exp_elt_opcode (OP_AGGREGATE
);
2028 write_exp_elt_longcst (yyvsp
[-1].lval
);
2029 write_exp_elt_opcode (OP_AGGREGATE
);
2034 #line 647 "ada-exp.y"
2035 { yyval
.lval
= yyvsp
[0].lval
; }
2039 #line 649 "ada-exp.y"
2040 { write_exp_elt_opcode (OP_POSITIONAL
);
2041 write_exp_elt_longcst (yyvsp
[-1].lval
);
2042 write_exp_elt_opcode (OP_POSITIONAL
);
2043 yyval
.lval
= yyvsp
[-1].lval
+ 1;
2048 #line 655 "ada-exp.y"
2049 { yyval
.lval
= yyvsp
[-1].lval
+ yyvsp
[0].lval
; }
2053 #line 660 "ada-exp.y"
2054 { write_exp_elt_opcode (OP_POSITIONAL
);
2055 write_exp_elt_longcst (0);
2056 write_exp_elt_opcode (OP_POSITIONAL
);
2062 #line 666 "ada-exp.y"
2063 { write_exp_elt_opcode (OP_POSITIONAL
);
2064 write_exp_elt_longcst (yyvsp
[-2].lval
);
2065 write_exp_elt_opcode (OP_POSITIONAL
);
2066 yyval
.lval
= yyvsp
[-2].lval
+ 1;
2071 #line 674 "ada-exp.y"
2076 #line 675 "ada-exp.y"
2081 #line 677 "ada-exp.y"
2082 { yyval
.lval
= yyvsp
[0].lval
+ 1; }
2086 #line 681 "ada-exp.y"
2087 { write_exp_elt_opcode (OP_OTHERS
); }
2091 #line 686 "ada-exp.y"
2093 write_exp_elt_opcode (OP_CHOICES
);
2094 write_exp_elt_longcst (yyvsp
[0].lval
);
2095 write_exp_elt_opcode (OP_CHOICES
);
2100 #line 700 "ada-exp.y"
2101 { write_name_assoc (yyvsp
[-1].sval
); }
2105 #line 701 "ada-exp.y"
2110 #line 703 "ada-exp.y"
2115 #line 705 "ada-exp.y"
2116 { write_exp_elt_opcode (OP_DISCRETE_RANGE
);
2117 write_exp_op_with_string (OP_NAME
, empty_stoken
);
2122 #line 708 "ada-exp.y"
2127 #line 710 "ada-exp.y"
2128 { write_name_assoc (yyvsp
[-1].sval
); }
2132 #line 711 "ada-exp.y"
2133 { yyval
.lval
= yyvsp
[0].lval
+ 1; }
2137 #line 713 "ada-exp.y"
2138 { yyval
.lval
= yyvsp
[0].lval
+ 1; }
2142 #line 715 "ada-exp.y"
2143 { write_exp_elt_opcode (OP_DISCRETE_RANGE
); }
2147 #line 716 "ada-exp.y"
2148 { yyval
.lval
= yyvsp
[0].lval
+ 1; }
2152 #line 723 "ada-exp.y"
2153 { write_exp_elt_opcode (UNOP_IND
); }
2157 #line 725 "ada-exp.y"
2158 { write_exp_elt_opcode (UNOP_ADDR
); }
2162 #line 727 "ada-exp.y"
2163 { write_exp_elt_opcode (BINOP_SUBSCRIPT
); }
2169 /* Line 1000 of yacc.c. */
2170 #line 2171 "ada-exp.c.tmp"
2176 YY_STACK_PRINT (yyss
, yyssp
);
2181 /* Now `shift' the result of the reduction. Determine what state
2182 that goes to, based on the state we popped back to and the rule
2183 number reduced by. */
2187 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2188 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2189 yystate
= yytable
[yystate
];
2191 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2196 /*------------------------------------.
2197 | yyerrlab -- here on detecting error |
2198 `------------------------------------*/
2200 /* If not already recovering from an error, report this error. */
2205 yyn
= yypact
[yystate
];
2207 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
2209 YYSIZE_T yysize
= 0;
2210 int yytype
= YYTRANSLATE (yychar
);
2211 const char* yyprefix
;
2215 /* Start YYX at -YYN if negative to avoid negative indexes in
2217 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
2219 /* Stay within bounds of both yycheck and yytname. */
2220 int yychecklim
= YYLAST
- yyn
;
2221 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
2224 yyprefix
= ", expecting ";
2225 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2226 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
2228 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
2236 yysize
+= (sizeof ("syntax error, unexpected ")
2237 + yystrlen (yytname
[yytype
]));
2238 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
2241 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
2242 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
2246 yyprefix
= ", expecting ";
2247 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2248 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
2250 yyp
= yystpcpy (yyp
, yyprefix
);
2251 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
2256 YYSTACK_FREE (yymsg
);
2259 yyerror ("syntax error; also virtual memory exhausted");
2262 #endif /* YYERROR_VERBOSE */
2263 yyerror ("syntax error");
2268 if (yyerrstatus
== 3)
2270 /* If just tried and failed to reuse lookahead token after an
2271 error, discard it. */
2273 if (yychar
<= YYEOF
)
2275 /* If at end of input, pop the error token,
2276 then the rest of the stack, then return failure. */
2277 if (yychar
== YYEOF
)
2283 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
2284 yydestruct (yystos
[*yyssp
], yyvsp
);
2289 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
2290 yydestruct (yytoken
, &yylval
);
2296 /* Else will try to reuse lookahead token after shifting the error
2301 /*---------------------------------------------------.
2302 | yyerrorlab -- error raised explicitly by YYERROR. |
2303 `---------------------------------------------------*/
2307 /* Pacify GCC when the user code never invokes YYERROR and the label
2308 yyerrorlab therefore never appears in user code. */
2319 /*-------------------------------------------------------------.
2320 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2321 `-------------------------------------------------------------*/
2323 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2327 yyn
= yypact
[yystate
];
2328 if (yyn
!= YYPACT_NINF
)
2331 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2339 /* Pop the current state because it cannot handle the error token. */
2343 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
2344 yydestruct (yystos
[yystate
], yyvsp
);
2347 YY_STACK_PRINT (yyss
, yyssp
);
2353 YYDPRINTF ((stderr
, "Shifting error token, "));
2362 /*-------------------------------------.
2363 | yyacceptlab -- YYACCEPT comes here. |
2364 `-------------------------------------*/
2369 /*-----------------------------------.
2370 | yyabortlab -- YYABORT comes here. |
2371 `-----------------------------------*/
2377 /*----------------------------------------------.
2378 | yyoverflowlab -- parser overflow comes here. |
2379 `----------------------------------------------*/
2381 yyerror ("parser stack overflow");
2389 YYSTACK_FREE (yyss
);
2395 #line 730 "ada-exp.y"
2398 /* yylex defined in ada-lex.c: Reads one token, getting characters */
2399 /* through lexptr. */
2401 /* Remap normal flex interface names (yylex) as well as gratuitiously */
2402 /* global symbol names, so we can have multiple flex-generated parsers */
2405 /* (See note above on previous definitions for YACC.) */
2407 #define yy_create_buffer ada_yy_create_buffer
2408 #define yy_delete_buffer ada_yy_delete_buffer
2409 #define yy_init_buffer ada_yy_init_buffer
2410 #define yy_load_buffer_state ada_yy_load_buffer_state
2411 #define yy_switch_to_buffer ada_yy_switch_to_buffer
2412 #define yyrestart ada_yyrestart
2413 #define yytext ada_yytext
2414 #define yywrap ada_yywrap
2416 static struct obstack temp_parse_space
;
2418 /* The following kludge was found necessary to prevent conflicts between */
2419 /* defs.h and non-standard stdlib.h files. */
2420 #define qsort __qsort__dummy
2421 #include "ada-lex.c"
2426 lexer_init (yyin
); /* (Re-)initialize lexer. */
2427 type_qualifier
= NULL
;
2428 obstack_free (&temp_parse_space
, NULL
);
2429 obstack_init (&temp_parse_space
);
2431 return _ada_parse ();
2437 error (_("Error in expression, near `%s'."), lexptr
);
2440 /* The operator name corresponding to operator symbol STRING (adds
2441 quotes and maps to lower-case). Destroys the previous contents of
2442 the array pointed to by STRING.ptr. Error if STRING does not match
2443 a valid Ada operator. Assumes that STRING.ptr points to a
2444 null-terminated string and that, if STRING is a valid operator
2445 symbol, the array pointed to by STRING.ptr contains at least
2446 STRING.length+3 characters. */
2448 static struct stoken
2449 string_to_operator (struct stoken string
)
2453 for (i
= 0; ada_opname_table
[i
].encoded
!= NULL
; i
+= 1)
2455 if (string
.length
== strlen (ada_opname_table
[i
].decoded
)-2
2456 && strncasecmp (string
.ptr
, ada_opname_table
[i
].decoded
+1,
2457 string
.length
) == 0)
2459 strncpy (string
.ptr
, ada_opname_table
[i
].decoded
,
2465 error (_("Invalid operator symbol `%s'"), string
.ptr
);
2468 /* Emit expression to access an instance of SYM, in block BLOCK (if
2469 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
2471 write_var_from_sym (struct block
*orig_left_context
,
2472 struct block
*block
,
2475 if (orig_left_context
== NULL
&& symbol_read_needs_frame (sym
))
2477 if (innermost_block
== 0
2478 || contained_in (block
, innermost_block
))
2479 innermost_block
= block
;
2482 write_exp_elt_opcode (OP_VAR_VALUE
);
2483 write_exp_elt_block (block
);
2484 write_exp_elt_sym (sym
);
2485 write_exp_elt_opcode (OP_VAR_VALUE
);
2488 /* Write integer constant ARG of type TYPE. */
2491 write_int (LONGEST arg
, struct type
*type
)
2493 write_exp_elt_opcode (OP_LONG
);
2494 write_exp_elt_type (type
);
2495 write_exp_elt_longcst (arg
);
2496 write_exp_elt_opcode (OP_LONG
);
2499 /* Write an OPCODE, string, OPCODE sequence to the current expression. */
2501 write_exp_op_with_string (enum exp_opcode opcode
, struct stoken token
)
2503 write_exp_elt_opcode (opcode
);
2504 write_exp_string (token
);
2505 write_exp_elt_opcode (opcode
);
2508 /* Emit expression corresponding to the renamed object designated by
2509 * the type RENAMING, which must be the referent of an object renaming
2510 * type, in the context of ORIG_LEFT_CONTEXT. MAX_DEPTH is the maximum
2511 * number of cascaded renamings to allow. */
2513 write_object_renaming (struct block
*orig_left_context
,
2514 struct symbol
*renaming
, int max_depth
)
2516 const char *qualification
= SYMBOL_LINKAGE_NAME (renaming
);
2517 const char *simple_tail
;
2518 const char *expr
= TYPE_FIELD_NAME (SYMBOL_TYPE (renaming
), 0);
2522 enum { SIMPLE_INDEX
, LOWER_BOUND
, UPPER_BOUND
} slice_state
;
2525 error (_("Could not find renamed symbol"));
2527 /* if orig_left_context is null, then use the currently selected
2528 block; otherwise we might fail our symbol lookup below. */
2529 if (orig_left_context
== NULL
)
2530 orig_left_context
= get_selected_block (NULL
);
2532 for (simple_tail
= qualification
+ strlen (qualification
);
2533 simple_tail
!= qualification
; simple_tail
-= 1)
2535 if (*simple_tail
== '.')
2540 else if (strncmp (simple_tail
, "__", 2) == 0)
2547 suffix
= strstr (expr
, "___XE");
2551 name
= (char *) obstack_alloc (&temp_parse_space
, suffix
- expr
+ 1);
2552 strncpy (name
, expr
, suffix
-expr
);
2553 name
[suffix
-expr
] = '\000';
2554 sym
= lookup_symbol (name
, orig_left_context
, VAR_DOMAIN
, 0, NULL
);
2556 error (_("Could not find renamed variable: %s"), ada_decode (name
));
2557 if (ada_is_object_renaming (sym
))
2558 write_object_renaming (orig_left_context
, sym
, max_depth
-1);
2560 write_var_from_sym (orig_left_context
, block_found
, sym
);
2563 slice_state
= SIMPLE_INDEX
;
2564 while (*suffix
== 'X')
2571 write_exp_elt_opcode (UNOP_IND
);
2574 slice_state
= LOWER_BOUND
;
2577 if (isdigit (*suffix
))
2580 long val
= strtol (suffix
, &next
, 10);
2584 write_exp_elt_opcode (OP_LONG
);
2585 write_exp_elt_type (type_int ());
2586 write_exp_elt_longcst ((LONGEST
) val
);
2587 write_exp_elt_opcode (OP_LONG
);
2594 struct symbol
*index_sym
;
2596 end
= strchr (suffix
, 'X');
2598 end
= suffix
+ strlen (suffix
);
2600 index_len
= simple_tail
- qualification
+ 2 + (suffix
- end
) + 1;
2602 = (char *) obstack_alloc (&temp_parse_space
, index_len
);
2603 memset (index_name
, '\000', index_len
);
2604 strncpy (index_name
, qualification
, simple_tail
- qualification
);
2605 index_name
[simple_tail
- qualification
] = '\000';
2606 strncat (index_name
, suffix
, suffix
-end
);
2610 lookup_symbol (index_name
, NULL
, VAR_DOMAIN
, 0, NULL
);
2611 if (index_sym
== NULL
)
2612 error (_("Could not find %s"), index_name
);
2613 write_var_from_sym (NULL
, block_found
, sym
);
2615 if (slice_state
== SIMPLE_INDEX
)
2617 write_exp_elt_opcode (OP_FUNCALL
);
2618 write_exp_elt_longcst ((LONGEST
) 1);
2619 write_exp_elt_opcode (OP_FUNCALL
);
2621 else if (slice_state
== LOWER_BOUND
)
2622 slice_state
= UPPER_BOUND
;
2623 else if (slice_state
== UPPER_BOUND
)
2625 write_exp_elt_opcode (TERNOP_SLICE
);
2626 slice_state
= SIMPLE_INDEX
;
2632 struct stoken field_name
;
2636 if (slice_state
!= SIMPLE_INDEX
)
2638 end
= strchr (suffix
, 'X');
2640 end
= suffix
+ strlen (suffix
);
2641 field_name
.length
= end
- suffix
;
2642 field_name
.ptr
= xmalloc (end
- suffix
+ 1);
2643 strncpy (field_name
.ptr
, suffix
, end
- suffix
);
2644 field_name
.ptr
[end
- suffix
] = '\000';
2646 write_exp_op_with_string (STRUCTOP_STRUCT
, field_name
);
2654 if (slice_state
== SIMPLE_INDEX
)
2658 error (_("Internal error in encoding of renaming declaration: %s"),
2659 SYMBOL_LINKAGE_NAME (renaming
));
2662 static struct block
*
2663 block_lookup (struct block
*context
, char *raw_name
)
2666 struct ada_symbol_info
*syms
;
2668 struct symtab
*symtab
;
2670 if (raw_name
[0] == '\'')
2676 name
= ada_encode (raw_name
);
2678 nsyms
= ada_lookup_symbol_list (name
, context
, VAR_DOMAIN
, &syms
);
2679 if (context
== NULL
&&
2680 (nsyms
== 0 || SYMBOL_CLASS (syms
[0].sym
) != LOC_BLOCK
))
2681 symtab
= lookup_symtab (name
);
2686 return BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab
), STATIC_BLOCK
);
2687 else if (nsyms
== 0 || SYMBOL_CLASS (syms
[0].sym
) != LOC_BLOCK
)
2689 if (context
== NULL
)
2690 error (_("No file or function \"%s\"."), raw_name
);
2692 error (_("No function \"%s\" in specified context."), raw_name
);
2697 warning (_("Function name \"%s\" ambiguous here"), raw_name
);
2698 return SYMBOL_BLOCK_VALUE (syms
[0].sym
);
2702 static struct symbol
*
2703 select_possible_type_sym (struct ada_symbol_info
*syms
, int nsyms
)
2706 int preferred_index
;
2707 struct type
*preferred_type
;
2709 preferred_index
= -1; preferred_type
= NULL
;
2710 for (i
= 0; i
< nsyms
; i
+= 1)
2711 switch (SYMBOL_CLASS (syms
[i
].sym
))
2714 if (ada_prefer_type (SYMBOL_TYPE (syms
[i
].sym
), preferred_type
))
2716 preferred_index
= i
;
2717 preferred_type
= SYMBOL_TYPE (syms
[i
].sym
);
2724 case LOC_REGPARM_ADDR
:
2728 case LOC_BASEREG_ARG
:
2730 case LOC_COMPUTED_ARG
:
2735 if (preferred_type
== NULL
)
2737 return syms
[preferred_index
].sym
;
2741 find_primitive_type (char *name
)
2744 type
= language_lookup_primitive_type_by_name (current_language
,
2747 if (type
== NULL
&& strcmp ("system__address", name
) == 0)
2748 type
= type_system_address ();
2752 /* Check to see if we have a regular definition of this
2753 type that just didn't happen to have been read yet. */
2756 char *expanded_name
=
2757 (char *) alloca (strlen (name
) + sizeof ("standard__"));
2758 strcpy (expanded_name
, "standard__");
2759 strcat (expanded_name
, name
);
2760 sym
= ada_lookup_symbol (expanded_name
, NULL
, VAR_DOMAIN
, NULL
, NULL
);
2761 if (sym
!= NULL
&& SYMBOL_CLASS (sym
) == LOC_TYPEDEF
)
2762 type
= SYMBOL_TYPE (sym
);
2769 chop_selector (char *name
, int end
)
2772 for (i
= end
- 1; i
> 0; i
-= 1)
2773 if (name
[i
] == '.' || (name
[i
] == '_' && name
[i
+1] == '_'))
2778 /* Given that SELS is a string of the form (<sep><identifier>)*, where
2779 <sep> is '__' or '.', write the indicated sequence of
2780 STRUCTOP_STRUCT expression operators. */
2782 write_selectors (char *sels
)
2784 while (*sels
!= '\0')
2786 struct stoken field_name
;
2788 while (*sels
== '_' || *sels
== '.')
2791 while (*sels
!= '\0' && *sels
!= '.'
2792 && (sels
[0] != '_' || sels
[1] != '_'))
2794 field_name
.length
= sels
- p
;
2796 write_exp_op_with_string (STRUCTOP_STRUCT
, field_name
);
2800 /* Write a variable access (OP_VAR_VALUE) to ambiguous encoded name
2801 NAME[0..LEN-1], in block context BLOCK, to be resolved later. Writes
2802 a temporary symbol that is valid until the next call to ada_parse.
2805 write_ambiguous_var (struct block
*block
, char *name
, int len
)
2807 struct symbol
*sym
=
2808 obstack_alloc (&temp_parse_space
, sizeof (struct symbol
));
2809 memset (sym
, 0, sizeof (struct symbol
));
2810 SYMBOL_DOMAIN (sym
) = UNDEF_DOMAIN
;
2811 SYMBOL_LINKAGE_NAME (sym
) = obsavestring (name
, len
, &temp_parse_space
);
2812 SYMBOL_LANGUAGE (sym
) = language_ada
;
2814 write_exp_elt_opcode (OP_VAR_VALUE
);
2815 write_exp_elt_block (block
);
2816 write_exp_elt_sym (sym
);
2817 write_exp_elt_opcode (OP_VAR_VALUE
);
2821 /* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
2822 expression_block_context if NULL). If it denotes a type, return
2823 that type. Otherwise, write expression code to evaluate it as an
2824 object and return NULL. In this second case, NAME0 will, in general,
2825 have the form <name>(.<selector_name>)*, where <name> is an object
2826 or renaming encoded in the debugging data. Calls error if no
2827 prefix <name> matches a name in the debugging data (i.e., matches
2828 either a complete name or, as a wild-card match, the final
2832 write_var_or_type (struct block
*block
, struct stoken name0
)
2839 block
= expression_context_block
;
2841 encoded_name
= ada_encode (name0
.ptr
);
2842 name_len
= strlen (encoded_name
);
2843 encoded_name
= obsavestring (encoded_name
, name_len
, &temp_parse_space
);
2844 for (depth
= 0; depth
< MAX_RENAMING_CHAIN_LENGTH
; depth
+= 1)
2848 tail_index
= name_len
;
2849 while (tail_index
> 0)
2852 struct ada_symbol_info
*syms
;
2853 struct symbol
*type_sym
;
2854 int terminator
= encoded_name
[tail_index
];
2856 encoded_name
[tail_index
] = '\0';
2857 nsyms
= ada_lookup_symbol_list (encoded_name
, block
,
2859 encoded_name
[tail_index
] = terminator
;
2861 /* A single symbol may rename a package or object. */
2863 if (nsyms
== 1 && !ada_is_object_renaming (syms
[0].sym
))
2865 struct symbol
*renaming_sym
=
2866 ada_find_renaming_symbol (SYMBOL_LINKAGE_NAME (syms
[0].sym
),
2869 if (renaming_sym
!= NULL
)
2870 syms
[0].sym
= renaming_sym
;
2873 type_sym
= select_possible_type_sym (syms
, nsyms
);
2874 if (type_sym
!= NULL
)
2876 struct type
*type
= SYMBOL_TYPE (type_sym
);
2878 if (TYPE_CODE (type
) == TYPE_CODE_VOID
)
2879 error (_("`%s' matches only void type name(s)"), name0
.ptr
);
2880 else if (ada_is_object_renaming (type_sym
))
2882 write_object_renaming (block
, type_sym
,
2883 MAX_RENAMING_CHAIN_LENGTH
);
2884 write_selectors (encoded_name
+ tail_index
);
2887 else if (ada_renaming_type (SYMBOL_TYPE (type_sym
)) != NULL
)
2890 char *renaming
= ada_simple_renamed_entity (type_sym
);
2891 int renaming_len
= strlen (renaming
);
2894 = obstack_alloc (&temp_parse_space
,
2895 renaming_len
+ name_len
- tail_index
2897 strcpy (new_name
, renaming
);
2899 strcpy (new_name
+ renaming_len
, encoded_name
+ tail_index
);
2900 encoded_name
= new_name
;
2901 name_len
= renaming_len
+ name_len
- tail_index
;
2902 goto TryAfterRenaming
;
2904 else if (tail_index
== name_len
)
2907 error (_("Invalid attempt to select from type: \"%s\"."), name0
.ptr
);
2909 else if (tail_index
== name_len
&& nsyms
== 0)
2911 struct type
*type
= find_primitive_type (encoded_name
);
2919 write_var_from_sym (block
, syms
[0].block
, syms
[0].sym
);
2920 write_selectors (encoded_name
+ tail_index
);
2923 else if (nsyms
== 0)
2926 struct minimal_symbol
*msym
2927 = ada_lookup_simple_minsym (encoded_name
);
2930 write_exp_msymbol (msym
, lookup_function_type (type_int ()),
2932 /* Maybe cause error here rather than later? FIXME? */
2933 write_selectors (encoded_name
+ tail_index
);
2937 if (tail_index
== name_len
2938 && strncmp (encoded_name
, "standard__",
2939 sizeof ("standard__") - 1) == 0)
2940 error (_("No definition of \"%s\" found."), name0
.ptr
);
2942 tail_index
= chop_selector (encoded_name
, tail_index
);
2946 write_ambiguous_var (block
, encoded_name
, tail_index
);
2947 write_selectors (encoded_name
+ tail_index
);
2952 if (!have_full_symbols () && !have_partial_symbols () && block
== NULL
)
2953 error (_("No symbol table is loaded. Use the \"file\" command."));
2954 if (block
== expression_context_block
)
2955 error (_("No definition of \"%s\" in current context."), name0
.ptr
);
2957 error (_("No definition of \"%s\" in specified context."), name0
.ptr
);
2962 error (_("Could not find renamed symbol \"%s\""), name0
.ptr
);
2966 /* Write a left side of a component association (e.g., NAME in NAME =>
2967 exp). If NAME has the form of a selected component, write it as an
2968 ordinary expression. If it is a simple variable that unambiguously
2969 corresponds to exactly one symbol that does not denote a type or an
2970 object renaming, also write it normally as an OP_VAR_VALUE.
2971 Otherwise, write it as an OP_NAME.
2973 Unfortunately, we don't know at this point whether NAME is supposed
2974 to denote a record component name or the value of an array index.
2975 Therefore, it is not appropriate to disambiguate an ambiguous name
2976 as we normally would, nor to replace a renaming with its referent.
2977 As a result, in the (one hopes) rare case that one writes an
2978 aggregate such as (R => 42) where R renames an object or is an
2979 ambiguous name, one must write instead ((R) => 42). */
2982 write_name_assoc (struct stoken name
)
2984 if (strchr (name
.ptr
, '.') == NULL
)
2986 struct ada_symbol_info
*syms
;
2987 int nsyms
= ada_lookup_symbol_list (name
.ptr
, expression_context_block
,
2989 if (nsyms
!= 1 || SYMBOL_CLASS (syms
[0].sym
) == LOC_TYPEDEF
)
2990 write_exp_op_with_string (OP_NAME
, name
);
2992 write_var_from_sym (NULL
, syms
[0].block
, syms
[0].sym
);
2995 if (write_var_or_type (NULL
, name
) != NULL
)
2996 error (_("Invalid use of type."));
2999 /* Convert the character literal whose ASCII value would be VAL to the
3000 appropriate value of type TYPE, if there is a translation.
3001 Otherwise return VAL. Hence, in an enumeration type ('A', 'B'),
3002 the literal 'A' (VAL == 65), returns 0. */
3005 convert_char_literal (struct type
*type
, LONGEST val
)
3010 if (type
== NULL
|| TYPE_CODE (type
) != TYPE_CODE_ENUM
)
3012 sprintf (name
, "QU%02x", (int) val
);
3013 for (f
= 0; f
< TYPE_NFIELDS (type
); f
+= 1)
3015 if (strcmp (name
, TYPE_FIELD_NAME (type
, f
)) == 0)
3016 return TYPE_FIELD_BITPOS (type
, f
);
3021 static struct type
*
3024 return builtin_type (current_gdbarch
)->builtin_int
;
3027 static struct type
*
3030 return builtin_type (current_gdbarch
)->builtin_long
;
3033 static struct type
*
3034 type_long_long (void)
3036 return builtin_type (current_gdbarch
)->builtin_long_long
;
3039 static struct type
*
3042 return builtin_type (current_gdbarch
)->builtin_float
;
3045 static struct type
*
3048 return builtin_type (current_gdbarch
)->builtin_double
;
3051 static struct type
*
3052 type_long_double (void)
3054 return builtin_type (current_gdbarch
)->builtin_long_double
;
3057 static struct type
*
3060 return language_string_char_type (current_language
, current_gdbarch
);
3063 static struct type
*
3064 type_system_address (void)
3067 = language_lookup_primitive_type_by_name (current_language
,
3070 return type
!= NULL
? type
: lookup_pointer_type (builtin_type_void
);
3074 _initialize_ada_exp (void)
3076 obstack_init (&temp_parse_space
);
3079 /* FIXME: hilfingr/2004-10-05: Hack to remove warning. The function
3080 string_to_operator is supposed to be used for cases where one
3081 calls an operator function with prefix notation, as in
3082 "+" (a, b), but at some point, this code seems to have gone
3085 struct stoken (*dummy_string_to_ada_operator
) (struct stoken
)
3086 = string_to_operator
;