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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [ada-exp.c] - Blame information for rev 825

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

Line No. Rev Author Line
1 227 jeremybenn
/* A Bison parser, made by GNU Bison 1.875c.  */
2
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2, or (at your option)
9
   any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
/* As a special exception, when this file is copied by Bison into a
22
   Bison output file, you may use that output file without restriction.
23
   This special exception was added by the Free Software Foundation
24
   in version 1.24 of Bison.  */
25
 
26
/* Written by Richard Stallman by simplifying the original so called
27
   ``semantic'' parser.  */
28
 
29
/* All symbols defined below should begin with yy or YY, to avoid
30
   infringing on user name space.  This should be done even for local
31
   variables, as they might otherwise be expanded by user macros.
32
   There are some unavoidable exceptions within include files to
33
   define necessary library symbols; they are noted "INFRINGES ON
34
   USER NAME SPACE" below.  */
35
 
36
/* Identify Bison output.  */
37
#define YYBISON 1
38
 
39
/* Skeleton name.  */
40
#define YYSKELETON_NAME "yacc.c"
41
 
42
/* Pure parsers.  */
43
#define YYPURE 0
44
 
45
/* Using locations.  */
46
#define YYLSP_NEEDED 0
47
 
48
 
49
 
50
/* Tokens.  */
51
#ifndef YYTOKENTYPE
52
# define YYTOKENTYPE
53
   /* Put the tokens into the symbol table, so that GDB and other debuggers
54
      know about them.  */
55
   enum yytokentype {
56
     INT = 258,
57
     NULL_PTR = 259,
58
     CHARLIT = 260,
59
     FLOAT = 261,
60
     TRUEKEYWORD = 262,
61
     FALSEKEYWORD = 263,
62
     COLONCOLON = 264,
63
     STRING = 265,
64
     NAME = 266,
65
     DOT_ID = 267,
66
     DOT_ALL = 268,
67
     SPECIAL_VARIABLE = 269,
68
     ASSIGN = 270,
69
     ELSE = 271,
70
     THEN = 272,
71
     XOR = 273,
72
     OR = 274,
73
     _AND_ = 275,
74
     DOTDOT = 276,
75
     IN = 277,
76
     GEQ = 278,
77
     LEQ = 279,
78
     NOTEQUAL = 280,
79
     UNARY = 281,
80
     REM = 282,
81
     MOD = 283,
82
     NOT = 284,
83
     ABS = 285,
84
     STARSTAR = 286,
85
     VAR = 287,
86
     ARROW = 288,
87
     TICK_LENGTH = 289,
88
     TICK_LAST = 290,
89
     TICK_FIRST = 291,
90
     TICK_ADDRESS = 292,
91
     TICK_ACCESS = 293,
92
     TICK_MODULUS = 294,
93
     TICK_MIN = 295,
94
     TICK_MAX = 296,
95
     TICK_VAL = 297,
96
     TICK_TAG = 298,
97
     TICK_SIZE = 299,
98
     TICK_RANGE = 300,
99
     TICK_POS = 301,
100
     NEW = 302,
101
     OTHERS = 303
102
   };
103
#endif
104
#define INT 258
105
#define NULL_PTR 259
106
#define CHARLIT 260
107
#define FLOAT 261
108
#define TRUEKEYWORD 262
109
#define FALSEKEYWORD 263
110
#define COLONCOLON 264
111
#define STRING 265
112
#define NAME 266
113
#define DOT_ID 267
114
#define DOT_ALL 268
115
#define SPECIAL_VARIABLE 269
116
#define ASSIGN 270
117
#define ELSE 271
118
#define THEN 272
119
#define XOR 273
120
#define OR 274
121
#define _AND_ 275
122
#define DOTDOT 276
123
#define IN 277
124
#define GEQ 278
125
#define LEQ 279
126
#define NOTEQUAL 280
127
#define UNARY 281
128
#define REM 282
129
#define MOD 283
130
#define NOT 284
131
#define ABS 285
132
#define STARSTAR 286
133
#define VAR 287
134
#define ARROW 288
135
#define TICK_LENGTH 289
136
#define TICK_LAST 290
137
#define TICK_FIRST 291
138
#define TICK_ADDRESS 292
139
#define TICK_ACCESS 293
140
#define TICK_MODULUS 294
141
#define TICK_MIN 295
142
#define TICK_MAX 296
143
#define TICK_VAL 297
144
#define TICK_TAG 298
145
#define TICK_SIZE 299
146
#define TICK_RANGE 300
147
#define TICK_POS 301
148
#define NEW 302
149
#define OTHERS 303
150
 
151
 
152
 
153
 
154
/* Copy the first part of user declarations.  */
155
#line 37 "ada-exp.y"
156
 
157
 
158
#include "defs.h"
159
#include "gdb_string.h"
160
#include <ctype.h>
161
#include "expression.h"
162
#include "value.h"
163
#include "parser-defs.h"
164
#include "language.h"
165
#include "ada-lang.h"
166
#include "bfd.h" /* Required by objfiles.h.  */
167
#include "symfile.h" /* Required by objfiles.h.  */
168
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
169
#include "frame.h"
170
#include "block.h"
171
 
172
#define parse_type builtin_type (parse_gdbarch)
173
 
174
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
175
   as well as gratuitiously global symbol names, so we can have multiple
176
   yacc generated parsers in gdb.  These are only the variables
177
   produced by yacc.  If other parser generators (bison, byacc, etc) produce
178
   additional global names that conflict at link time, then those parser
179
   generators need to be fixed instead of adding those names to this list.  */
180
 
181
/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
182
   options.  I presume we are maintaining it to accommodate systems
183
   without BISON?  (PNH) */
184
 
185
#define yymaxdepth ada_maxdepth
186
#define yyparse _ada_parse      /* ada_parse calls this after  initialization */
187
#define yylex   ada_lex
188
#define yyerror ada_error
189
#define yylval  ada_lval
190
#define yychar  ada_char
191
#define yydebug ada_debug
192
#define yypact  ada_pact
193
#define yyr1    ada_r1
194
#define yyr2    ada_r2
195
#define yydef   ada_def
196
#define yychk   ada_chk
197
#define yypgo   ada_pgo
198
#define yyact   ada_act
199
#define yyexca  ada_exca
200
#define yyerrflag ada_errflag
201
#define yynerrs ada_nerrs
202
#define yyps    ada_ps
203
#define yypv    ada_pv
204
#define yys     ada_s
205
#define yy_yys  ada_yys
206
#define yystate ada_state
207
#define yytmp   ada_tmp
208
#define yyv     ada_v
209
#define yy_yyv  ada_yyv
210
#define yyval   ada_val
211
#define yylloc  ada_lloc
212
#define yyreds  ada_reds                /* With YYDEBUG defined */
213
#define yytoks  ada_toks                /* With YYDEBUG defined */
214
#define yyname  ada_name                /* With YYDEBUG defined */
215
#define yyrule  ada_rule                /* With YYDEBUG defined */
216
 
217
#ifndef YYDEBUG
218
#define YYDEBUG 1               /* Default to yydebug support */
219
#endif
220
 
221
#define YYFPRINTF parser_fprintf
222
 
223
struct name_info {
224
  struct symbol *sym;
225
  struct minimal_symbol *msym;
226
  struct block *block;
227
  struct stoken stoken;
228
};
229
 
230
static struct stoken empty_stoken = { "", 0 };
231
 
232
/* If expression is in the context of TYPE'(...), then TYPE, else
233
 * NULL.  */
234
static struct type *type_qualifier;
235
 
236
int yyparse (void);
237
 
238
static int yylex (void);
239
 
240
void yyerror (char *);
241
 
242
static struct stoken string_to_operator (struct stoken);
243
 
244
static void write_int (LONGEST, struct type *);
245
 
246
static void write_object_renaming (struct block *, const char *, int,
247
                                   const char *, int);
248
 
249
static struct type* write_var_or_type (struct block *, struct stoken);
250
 
251
static void write_name_assoc (struct stoken);
252
 
253
static void write_exp_op_with_string (enum exp_opcode, struct stoken);
254
 
255
static struct block *block_lookup (struct block *, char *);
256
 
257
static LONGEST convert_char_literal (struct type *, LONGEST);
258
 
259
static void write_ambiguous_var (struct block *, char *, int);
260
 
261
static struct type *type_int (void);
262
 
263
static struct type *type_long (void);
264
 
265
static struct type *type_long_long (void);
266
 
267
static struct type *type_float (void);
268
 
269
static struct type *type_double (void);
270
 
271
static struct type *type_long_double (void);
272
 
273
static struct type *type_char (void);
274
 
275
static struct type *type_boolean (void);
276
 
277
static struct type *type_system_address (void);
278
 
279
 
280
 
281
/* Enabling traces.  */
282
#ifndef YYDEBUG
283
# define YYDEBUG 0
284
#endif
285
 
286
/* Enabling verbose error messages.  */
287
#ifdef YYERROR_VERBOSE
288
# undef YYERROR_VERBOSE
289
# define YYERROR_VERBOSE 1
290
#else
291
# define YYERROR_VERBOSE 0
292
#endif
293
 
294
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
295
#line 163 "ada-exp.y"
296
typedef union YYSTYPE {
297
    LONGEST lval;
298
    struct {
299
      LONGEST val;
300
      struct type *type;
301
    } typed_val;
302
    struct {
303
      DOUBLEST dval;
304
      struct type *type;
305
    } typed_val_float;
306
    struct type *tval;
307
    struct stoken sval;
308
    struct block *bval;
309
    struct internalvar *ivar;
310
  } YYSTYPE;
311
/* Line 191 of yacc.c.  */
312
#line 313 "ada-exp.c.tmp"
313
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
314
# define YYSTYPE_IS_DECLARED 1
315
# define YYSTYPE_IS_TRIVIAL 1
316
#endif
317
 
318
 
319
 
320
/* Copy the second part of user declarations.  */
321
 
322
 
323
/* Line 214 of yacc.c.  */
324
#line 325 "ada-exp.c.tmp"
325
 
326
#if ! defined (yyoverflow) || YYERROR_VERBOSE
327
 
328
# ifndef YYFREE
329
#  define YYFREE xfree
330
# endif
331
# ifndef YYMALLOC
332
#  define YYMALLOC xmalloc
333
# endif
334
 
335
/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
336
 
337
# ifdef YYSTACK_USE_ALLOCA
338
#  if YYSTACK_USE_ALLOCA
339
#   define YYSTACK_ALLOC alloca
340
#  endif
341
# else
342
#  if defined (alloca) || defined (_ALLOCA_H)
343
#   define YYSTACK_ALLOC alloca
344
#  else
345
#   ifdef __GNUC__
346
#    define YYSTACK_ALLOC __builtin_alloca
347
#   endif
348
#  endif
349
# endif
350
 
351
# ifdef YYSTACK_ALLOC
352
   /* Pacify GCC's `empty if-body' warning. */
353
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
354
# else
355
#  if defined (__STDC__) || defined (__cplusplus)
356
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
357
#   define YYSIZE_T size_t
358
#  endif
359
#  define YYSTACK_ALLOC YYMALLOC
360
#  define YYSTACK_FREE YYFREE
361
# endif
362
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
363
 
364
 
365
#if (! defined (yyoverflow) \
366
     && (! defined (__cplusplus) \
367
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
368
 
369
/* A type that is properly aligned for any stack member.  */
370
union yyalloc
371
{
372
  short yyss;
373
  YYSTYPE yyvs;
374
  };
375
 
376
/* The size of the maximum gap between one aligned stack and the next.  */
377
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
378
 
379
/* The size of an array large to enough to hold all stacks, each with
380
   N elements.  */
381
# define YYSTACK_BYTES(N) \
382
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
383
      + YYSTACK_GAP_MAXIMUM)
384
 
385
/* Copy COUNT objects from FROM to TO.  The source and destination do
386
   not overlap.  */
387
# ifndef YYCOPY
388
#  if defined (__GNUC__) && 1 < __GNUC__
389
#   define YYCOPY(To, From, Count) \
390
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
391
#  else
392
#   define YYCOPY(To, From, Count)              \
393
      do                                        \
394
        {                                       \
395
          register YYSIZE_T yyi;                \
396
          for (yyi = 0; yyi < (Count); yyi++)    \
397
            (To)[yyi] = (From)[yyi];            \
398
        }                                       \
399
      while (0)
400
#  endif
401
# endif
402
 
403
/* Relocate STACK from its old location to the new one.  The
404
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
405
   elements in the stack, and YYPTR gives the new location of the
406
   stack.  Advance YYPTR to a properly aligned location for the next
407
   stack.  */
408
# define YYSTACK_RELOCATE(Stack)                                        \
409
    do                                                                  \
410
      {                                                                 \
411
        YYSIZE_T yynewbytes;                                            \
412
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
413
        Stack = &yyptr->Stack;                                          \
414
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
415
        yyptr += yynewbytes / sizeof (*yyptr);                          \
416
      }                                                                 \
417
    while (0)
418
 
419
#endif
420
 
421
#if defined (__STDC__) || defined (__cplusplus)
422
   typedef signed char yysigned_char;
423
#else
424
   typedef short yysigned_char;
425
#endif
426
 
427
/* YYFINAL -- State number of the termination state. */
428
#define YYFINAL  57
429
/* YYLAST -- Last index in YYTABLE.  */
430
#define YYLAST   770
431
 
432
/* YYNTOKENS -- Number of terminals. */
433
#define YYNTOKENS  69
434
/* YYNNTS -- Number of nonterminals. */
435
#define YYNNTS  31
436
/* YYNRULES -- Number of rules. */
437
#define YYNRULES  122
438
/* YYNRULES -- Number of states. */
439
#define YYNSTATES  233
440
 
441
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
442
#define YYUNDEFTOK  2
443
#define YYMAXUTOK   303
444
 
445
#define YYTRANSLATE(YYX)                                                \
446
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
447
 
448
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
449
static const unsigned char yytranslate[] =
450
{
451
       0,     2,     2,     2,     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,     2,     2,     2,     2,     2,    32,    64,
455
      58,    63,    34,    30,    65,    31,    57,    35,     2,     2,
456
       2,     2,     2,     2,     2,     2,     2,     2,     2,    62,
457
      22,    21,    23,     2,    29,     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,    59,     2,    68,     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,    66,    42,    67,     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,     2,     2,     2,     2,
468
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
469
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
470
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
471
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
472
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
473
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
474
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
475
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
476
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
477
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
478
      15,    16,    17,    18,    19,    20,    24,    25,    26,    27,
479
      28,    33,    36,    37,    38,    39,    40,    41,    43,    44,
480
      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
481
      55,    56,    60,    61
482
};
483
 
484
#if YYDEBUG
485
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
486
   YYRHS.  */
487
static const unsigned short yyprhs[] =
488
{
489
       0,     0,     3,     5,     7,    11,    15,    18,    21,    26,
490
      31,    32,    40,    41,    48,    55,    59,    61,    63,    65,
491
      67,    70,    73,    76,    79,    80,    82,    86,    90,    96,
492
     101,   105,   109,   113,   117,   121,   125,   129,   133,   137,
493
     139,   143,   147,   151,   157,   163,   167,   174,   181,   186,
494
     190,   194,   198,   200,   202,   204,   206,   208,   210,   214,
495
     218,   223,   228,   232,   236,   241,   246,   250,   254,   257,
496
     260,   264,   268,   272,   275,   278,   286,   294,   300,   306,
497
     309,   310,   314,   316,   318,   319,   321,   323,   325,   327,
498
     329,   331,   333,   336,   338,   341,   344,   348,   351,   355,
499
     359,   361,   364,   367,   370,   374,   376,   378,   382,   386,
500
     388,   389,   394,   398,   399,   406,   407,   412,   416,   417,
501
     424,   427,   430
502
};
503
 
504
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
505
static const yysigned_char yyrhs[] =
506
{
507
      70,     0,    -1,    71,    -1,    78,    -1,    71,    62,    78,
508
      -1,    72,    15,    78,    -1,    72,    13,    -1,    72,    12,
509
      -1,    72,    58,    76,    63,    -1,    87,    58,    76,    63,
510
      -1,    -1,    87,    64,    74,    73,    58,    78,    63,    -1,
511
      -1,    72,    58,    75,    24,    75,    63,    -1,    87,    58,
512
      75,    24,    75,    63,    -1,    58,    71,    63,    -1,    87,
513
      -1,    14,    -1,    89,    -1,    72,    -1,    31,    75,    -1,
514
      30,    75,    -1,    38,    75,    -1,    39,    75,    -1,    -1,
515
      78,    -1,    11,    43,    78,    -1,    76,    65,    78,    -1,
516
      76,    65,    11,    43,    78,    -1,    66,    87,    67,    72,
517
      -1,    75,    40,    75,    -1,    75,    34,    75,    -1,    75,
518
      35,    75,    -1,    75,    36,    75,    -1,    75,    37,    75,
519
      -1,    75,    29,    75,    -1,    75,    30,    75,    -1,    75,
520
      32,    75,    -1,    75,    31,    75,    -1,    75,    -1,    75,
521
      21,    75,    -1,    75,    28,    75,    -1,    75,    27,    75,
522
      -1,    75,    25,    75,    24,    75,    -1,    75,    25,    72,
523
      55,    84,    -1,    75,    25,    87,    -1,    75,    38,    25,
524
      75,    24,    75,    -1,    75,    38,    25,    72,    55,    84,
525
      -1,    75,    38,    25,    87,    -1,    75,    26,    75,    -1,
526
      75,    22,    75,    -1,    75,    23,    75,    -1,    77,    -1,
527
      79,    -1,    80,    -1,    81,    -1,    82,    -1,    83,    -1,
528
      77,    20,    77,    -1,    79,    20,    77,    -1,    77,    20,
529
      17,    77,    -1,    80,    20,    17,    77,    -1,    77,    19,
530
      77,    -1,    81,    19,    77,    -1,    77,    19,    16,    77,
531
      -1,    82,    19,    16,    77,    -1,    77,    18,    77,    -1,
532
      83,    18,    77,    -1,    72,    48,    -1,    72,    47,    -1,
533
      72,    46,    84,    -1,    72,    45,    84,    -1,    72,    44,
534
      84,    -1,    72,    54,    -1,    72,    53,    -1,    86,    50,
535
      58,    78,    65,    78,    63,    -1,    86,    51,    58,    78,
536
      65,    78,    63,    -1,    86,    56,    58,    78,    63,    -1,
537
      85,    52,    58,    78,    63,    -1,    85,    49,    -1,    -1,
538
      58,     3,    63,    -1,    87,    -1,    85,    -1,    -1,     3,
539
      -1,     5,    -1,     6,    -1,     4,    -1,    10,    -1,     7,
540
      -1,     8,    -1,    60,    11,    -1,    11,    -1,    88,    11,
541
      -1,    11,    48,    -1,    88,    11,    48,    -1,    11,     9,
542
      -1,    88,    11,     9,    -1,    58,    90,    63,    -1,    92,
543
      -1,    91,    78,    -1,    91,    92,    -1,    78,    65,    -1,
544
      91,    78,    65,    -1,    93,    -1,    94,    -1,    94,    65,
545
      92,    -1,    61,    43,    78,    -1,    95,    -1,    -1,    11,
546
      43,    96,    78,    -1,    75,    43,    78,    -1,    -1,    75,
547
      24,    75,    43,    97,    78,    -1,    -1,    11,    42,    98,
548
      95,    -1,    75,    42,    95,    -1,    -1,    75,    24,    75,
549
      42,    99,    95,    -1,    34,    72,    -1,    32,    72,    -1,
550
      72,    59,    78,    68,    -1
551
};
552
 
553
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
554
static const unsigned short yyrline[] =
555
{
556
       0,   228,   228,   232,   233,   235,   240,   244,   248,   254,
557
     273,   273,   285,   289,   291,   299,   310,   320,   324,   327,
558
     330,   334,   338,   342,   346,   349,   351,   353,   355,   359,
559
     372,   376,   380,   384,   388,   392,   396,   400,   404,   408,
560
     411,   415,   419,   423,   425,   430,   438,   442,   448,   459,
561
     463,   467,   471,   472,   473,   474,   475,   476,   480,   482,
562
     487,   489,   494,   496,   501,   503,   507,   509,   521,   523,
563
     529,   532,   535,   538,   540,   542,   544,   546,   548,   550,
564
     554,   556,   561,   571,   573,   579,   583,   590,   598,   602,
565
     608,   610,   614,   618,   620,   622,   630,   641,   643,   648,
566
     657,   658,   664,   669,   675,   684,   685,   686,   690,   695,
567
     710,   709,   712,   715,   714,   720,   719,   722,   725,   724,
568
     732,   734,   736
569
};
570
#endif
571
 
572
#if YYDEBUG || YYERROR_VERBOSE
573
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
574
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
575
static const char *const yytname[] =
576
{
577
  "$end", "error", "$undefined", "INT", "NULL_PTR", "CHARLIT", "FLOAT",
578
  "TRUEKEYWORD", "FALSEKEYWORD", "COLONCOLON", "STRING", "NAME", "DOT_ID",
579
  "DOT_ALL", "SPECIAL_VARIABLE", "ASSIGN", "ELSE", "THEN", "XOR", "OR",
580
  "_AND_", "'='", "'<'", "'>'", "DOTDOT", "IN", "GEQ", "LEQ", "NOTEQUAL",
581
  "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'", "'/'", "REM", "MOD", "NOT",
582
  "ABS", "STARSTAR", "VAR", "'|'", "ARROW", "TICK_LENGTH", "TICK_LAST",
583
  "TICK_FIRST", "TICK_ADDRESS", "TICK_ACCESS", "TICK_MODULUS", "TICK_MIN",
584
  "TICK_MAX", "TICK_VAL", "TICK_TAG", "TICK_SIZE", "TICK_RANGE",
585
  "TICK_POS", "'.'", "'('", "'['", "NEW", "OTHERS", "';'", "')'", "'''",
586
  "','", "'{'", "'}'", "']'", "$accept", "start", "exp1", "primary", "@1",
587
  "save_qualifier", "simple_exp", "arglist", "relation", "exp", "and_exp",
588
  "and_then_exp", "or_exp", "or_else_exp", "xor_exp", "tick_arglist",
589
  "type_prefix", "opt_type_prefix", "var_or_type", "block", "aggregate",
590
  "aggregate_component_list", "positional_list", "component_groups",
591
  "others", "component_group", "component_associations", "@2", "@3", "@4",
592
  "@5", 0
593
};
594
#endif
595
 
596
# ifdef YYPRINT
597
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
598
   token YYLEX-NUM.  */
599
static const unsigned short yytoknum[] =
600
{
601
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
602
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
603
     275,    61,    60,    62,   276,   277,   278,   279,   280,    64,
604
      43,    45,    38,   281,    42,    47,   282,   283,   284,   285,
605
     286,   287,   124,   288,   289,   290,   291,   292,   293,   294,
606
     295,   296,   297,   298,   299,   300,   301,    46,    40,    91,
607
     302,   303,    59,    41,    39,    44,   123,   125,    93
608
};
609
# endif
610
 
611
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
612
static const unsigned char yyr1[] =
613
{
614
       0,    69,    70,    71,    71,    71,    72,    72,    72,    72,
615
      73,    72,    74,    72,    72,    72,    72,    72,    72,    75,
616
      75,    75,    75,    75,    76,    76,    76,    76,    76,    72,
617
      75,    75,    75,    75,    75,    75,    75,    75,    75,    77,
618
      77,    77,    77,    77,    77,    77,    77,    77,    77,    77,
619
      77,    77,    78,    78,    78,    78,    78,    78,    79,    79,
620
      80,    80,    81,    81,    82,    82,    83,    83,    72,    72,
621
      72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
622
      84,    84,    85,    86,    86,    72,    72,    72,    72,    72,
623
      72,    72,    72,    87,    87,    87,    87,    88,    88,    89,
624
      90,    90,    90,    91,    91,    92,    92,    92,    93,    94,
625
      96,    95,    95,    97,    95,    98,    95,    95,    99,    95,
626
      72,    72,    72
627
};
628
 
629
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
630
static const unsigned char yyr2[] =
631
{
632
       0,     2,     1,     1,     3,     3,     2,     2,     4,     4,
633
       0,     7,     0,     6,     6,     3,     1,     1,     1,     1,
634
       2,     2,     2,     2,     0,     1,     3,     3,     5,     4,
635
       3,     3,     3,     3,     3,     3,     3,     3,     3,     1,
636
       3,     3,     3,     5,     5,     3,     6,     6,     4,     3,
637
       3,     3,     1,     1,     1,     1,     1,     1,     3,     3,
638
       4,     4,     3,     3,     4,     4,     3,     3,     2,     2,
639
       3,     3,     3,     2,     2,     7,     7,     5,     5,     2,
640
       0,     3,     1,     1,     0,     1,     1,     1,     1,     1,
641
       1,     1,     2,     1,     2,     2,     3,     2,     3,     3,
642
       1,     2,     2,     2,     3,     1,     1,     3,     3,     1,
643
       0,     4,     3,     0,     6,     0,     4,     3,     0,     6,
644
       2,     2,     4
645
};
646
 
647
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
648
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
649
   means the default is an error.  */
650
static const unsigned char yydefact[] =
651
{
652
      84,    85,    88,    86,    87,    90,    91,    89,    93,    17,
653
      84,    84,    84,    84,    84,    84,    84,     0,     0,     0,
654
       2,    19,    39,    52,     3,    53,    54,    55,    56,    57,
655
      83,     0,    16,     0,    18,    97,    95,    19,    21,    20,
656
     121,   120,    22,    23,    93,     0,     0,    39,     3,     0,
657
      84,   100,   105,   106,   109,    92,     0,     1,    84,     7,
658
       6,    84,    80,    80,    80,    69,    68,    74,    73,    84,
659
      84,    84,    84,    84,    84,    84,    84,    84,    84,    84,
660
      84,    84,    84,    84,    84,    84,     0,    84,    84,    84,
661
      84,    84,     0,    84,     0,    84,    79,     0,     0,     0,
662
       0,    84,    12,    94,   115,   110,    84,    15,    84,    84,
663
      84,   103,    99,   101,   102,    84,    84,     4,     5,     0,
664
      72,    71,    70,    93,    39,     0,    25,     0,    40,    50,
665
      51,    19,     0,    16,    49,    42,    41,    35,    36,    38,
666
      37,    31,    32,    33,    34,    84,    30,    66,    84,    62,
667
      84,    58,    59,    84,    63,    84,    67,    84,    84,    84,
668
      84,    39,     0,    10,    98,    96,    84,    84,   108,     0,
669
       0,   117,   112,   104,   107,    29,     0,    84,    84,     8,
670
      84,   122,    80,    84,    19,     0,    16,    64,    60,    61,
671
      65,     0,     0,     0,     0,    84,     9,     0,   116,   111,
672
     118,   113,    81,    26,     0,    93,    27,    44,    43,    80,
673
      84,    78,    84,    84,    77,     0,    84,    84,    84,    13,
674
      84,    47,    46,     0,     0,    14,     0,   119,   114,    28,
675
      75,    76,    11
676
};
677
 
678
/* YYDEFGOTO[NTERM-NUM]. */
679
static const short yydefgoto[] =
680
{
681
      -1,    19,    20,    37,   197,   163,    22,   125,    23,   126,
682
      25,    26,    27,    28,    29,   120,    30,    31,    32,    33,
683
      34,    49,    50,    51,    52,    53,    54,   167,   218,   166,
684
     217
685
};
686
 
687
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
688
   STATE-NUM.  */
689
#define YYPACT_NINF -104
690
static const short yypact[] =
691
{
692
     424,  -104,  -104,  -104,  -104,  -104,  -104,  -104,    16,  -104,
693
     424,   424,   118,   118,   424,   424,   286,    -7,     6,    31,
694
     -26,   501,   674,    20,  -104,    28,    32,    22,    34,    42,
695
     -44,   -21,    84,    57,  -104,  -104,  -104,   558,    63,    63,
696
      -3,    -3,    63,    63,    23,    26,   -36,   611,     9,    27,
697
     286,  -104,  -104,    29,  -104,  -104,    25,  -104,   424,  -104,
698
    -104,   424,    35,    35,    35,  -104,  -104,  -104,  -104,   274,
699
     424,   424,   424,   424,   424,   424,   424,   424,   424,   424,
700
     424,   424,   424,   424,   424,   424,    71,   424,   424,   350,
701
     387,   424,    91,   424,    85,   424,  -104,    53,    58,    59,
702
      60,   274,  -104,    19,  -104,  -104,   424,  -104,   424,   461,
703
     424,  -104,  -104,    50,  -104,   286,   118,  -104,  -104,   124,
704
    -104,  -104,  -104,     3,   634,   -52,  -104,    70,   719,   719,
705
     719,   521,   166,   173,   719,   719,   719,   730,    63,    63,
706
      63,    99,    99,    99,    99,   424,    99,  -104,   424,  -104,
707
     424,  -104,  -104,   424,  -104,   424,  -104,   424,   424,   424,
708
     424,   654,   -41,  -104,  -104,  -104,   461,   424,  -104,   704,
709
     689,  -104,  -104,  -104,  -104,    -3,    68,   424,   424,  -104,
710
     498,  -104,    35,   424,   538,   215,   208,  -104,  -104,  -104,
711
    -104,    78,    79,    80,    83,   424,  -104,    93,  -104,  -104,
712
    -104,  -104,  -104,  -104,   339,    14,  -104,  -104,   719,    35,
713
     424,  -104,   424,   424,  -104,   589,   424,   461,   424,  -104,
714
     424,  -104,   719,    90,    92,  -104,    98,  -104,  -104,  -104,
715
    -104,  -104,  -104
716
};
717
 
718
/* YYPGOTO[NTERM-NUM].  */
719
static const yysigned_char yypgoto[] =
720
{
721
    -104,  -104,   127,    21,  -104,  -104,     4,    55,   -46,     0,
722
    -104,  -104,  -104,  -104,  -104,   -62,  -104,  -104,   -15,  -104,
723
    -104,  -104,  -104,   -43,  -104,  -104,  -103,  -104,  -104,  -104,
724
    -104
725
};
726
 
727
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
728
   positive, shift that token.  If negative, reduce the rule which
729
   number is the opposite.  If zero, do what YYDEFACT says.
730
   If YYTABLE_NINF, syntax error.  */
731
#define YYTABLE_NINF -83
732
static const short yytable[] =
733
{
734
      24,   121,   122,    56,    55,    96,   171,   114,    97,    59,
735
      60,   179,    35,   180,    38,    39,    48,     8,    42,    43,
736
      47,    21,   196,    35,   180,    35,    58,   107,   164,    98,
737
      99,    57,    35,    40,    41,   100,    58,    21,    88,    89,
738
      90,    93,   147,   149,   151,   152,   177,   154,    91,   156,
739
     113,    36,    92,    94,    47,    69,    70,   220,   117,   133,
740
      95,   118,    36,   198,    36,   104,   105,   165,   103,   106,
741
     127,    36,   174,   124,   111,   128,   129,   130,   132,   134,
742
     135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
743
     112,   146,   116,   119,   115,   131,   145,    82,    83,    84,
744
      85,   155,   187,    87,   188,   161,   168,   189,   153,   190,
745
     172,   157,   169,   170,   227,   173,   158,   159,   160,   170,
746
     207,     1,     2,     3,     4,     5,     6,   176,     7,     8,
747
     186,   202,     9,   -82,   -82,   -82,   -82,   175,   181,    87,
748
     -82,   211,   101,    46,   212,   213,   214,   221,   102,   185,
749
      12,   216,    13,   230,     0,   231,   162,   191,   192,   193,
750
     194,   232,     0,     0,     0,     0,   184,   199,     0,     0,
751
     170,     0,     0,   -45,     0,     0,    16,   203,    17,     0,
752
     206,     0,   204,     0,    18,     0,     0,   208,     0,     0,
753
     183,   -45,   -45,   -45,     0,    78,    79,    80,    81,   215,
754
      82,    83,    84,    85,     0,     0,    87,     0,   -48,     0,
755
       0,     0,   223,   224,   222,     0,   226,     0,   228,     0,
756
     229,   170,   -82,   -82,   -82,   -82,   -48,   -48,   -48,   -82,
757
       0,   101,     0,     0,     0,   -45,   -45,   102,   -45,   210,
758
       0,   -45,     0,     0,    78,    79,    80,    81,     0,    82,
759
      83,    84,    85,     0,     0,    87,     0,   -82,   -82,   -82,
760
     -82,     0,     0,     0,   -82,     0,   101,     0,     0,     0,
761
     -48,   -48,   102,   -48,     0,     0,   -48,     1,     2,     3,
762
       4,     5,     6,     0,     7,   123,     0,     0,     9,     1,
763
       2,     3,     4,     5,     6,     0,     7,    44,     0,     0,
764
       9,     0,     0,     0,    10,    11,    12,     0,    13,     0,
765
       0,     0,    14,    15,     0,     0,    10,    11,    12,     0,
766
      13,     0,     0,     0,    14,    15,     0,     0,     0,     0,
767
       0,     0,    16,     0,    17,     0,     0,   -24,     0,   -24,
768
      18,     0,     0,     0,    16,     0,    17,    45,     0,     0,
769
       0,     0,    18,     1,     2,     3,     4,     5,     6,     0,
770
       7,     8,     0,     0,     9,     0,   148,     0,    78,    79,
771
      80,    81,     0,    82,    83,    84,    85,     0,     0,    87,
772
      10,    11,    12,     0,    13,     0,     0,     0,    14,    15,
773
       1,     2,     3,     4,     5,     6,     0,     7,     8,     0,
774
       0,     9,   219,     0,   150,     0,     0,     0,    16,     0,
775
      17,     0,     0,     0,     0,     0,    18,    10,    11,    12,
776
       0,    13,     0,     0,     0,    14,    15,     1,     2,     3,
777
       4,     5,     6,     0,     7,     8,     0,     0,     9,     0,
778
       0,     0,     0,     0,     0,    16,     0,    17,     0,     0,
779
       0,     0,     0,    18,    10,    11,    12,     0,    13,     0,
780
       0,     0,    14,    15,     1,     2,     3,     4,     5,     6,
781
       0,     7,    44,     0,     0,     9,     0,     0,     0,     0,
782
       0,     0,    16,     0,    17,     0,     0,     0,     0,     0,
783
      18,    10,    11,    12,     0,    13,     0,     0,     0,    14,
784
      15,     1,     2,     3,     4,     5,     6,     0,     7,   205,
785
       0,     0,     9,    59,    60,     0,    61,     0,     0,    16,
786
       0,    17,     0,     0,     0,     0,     0,    18,    10,    11,
787
      12,     0,    13,    59,    60,     0,    14,    15,     0,     0,
788
       0,     0,     0,     0,     0,    62,    63,    64,    65,    66,
789
      59,    60,     0,     0,    67,    68,    16,     0,    17,    69,
790
      70,     0,     0,     0,    18,    62,    63,    64,    65,    66,
791
      59,    60,     0,     0,    67,    68,   182,     0,     0,    69,
792
      70,     0,    62,    63,    64,    65,    66,     0,     0,     0,
793
       0,    67,    68,   209,     0,     0,    69,    70,     0,     0,
794
       0,     0,    62,    63,    64,    65,    66,     0,     0,     0,
795
       0,    67,    68,     0,     0,     0,    69,    70,    78,    79,
796
      80,    81,     0,    82,    83,    84,    85,     0,     0,    87,
797
       0,     0,    71,    72,    73,   108,    74,    75,    76,    77,
798
      78,    79,    80,    81,     0,    82,    83,    84,    85,    86,
799
       0,    87,   225,   109,   110,    71,    72,    73,   178,    74,
800
      75,    76,    77,    78,    79,    80,    81,     0,    82,    83,
801
      84,    85,    86,     0,    87,    71,    72,    73,   195,    74,
802
      75,    76,    77,    78,    79,    80,    81,     0,    82,    83,
803
      84,    85,    86,     0,    87,    71,    72,    73,     0,    74,
804
      75,    76,    77,    78,    79,    80,    81,     0,    82,    83,
805
      84,    85,    86,   108,    87,     0,     0,     0,    78,    79,
806
      80,    81,     0,    82,    83,    84,    85,     0,     0,    87,
807
       0,   109,   110,    78,    79,    80,    81,     0,    82,    83,
808
      84,    85,     0,     0,    87,     0,   200,   201,    78,    79,
809
      80,    81,     0,    82,    83,    84,    85,     0,     0,    87,
810
      79,    80,    81,     0,    82,    83,    84,    85,     0,     0,
811
      87
812
};
813
 
814
static const short yycheck[] =
815
{
816
       0,    63,    64,    18,    11,    49,   109,    50,    52,    12,
817
      13,    63,     9,    65,    10,    11,    16,    11,    14,    15,
818
      16,     0,    63,     9,    65,     9,    62,    63,     9,    50,
819
      51,     0,     9,    12,    13,    56,    62,    16,    18,    19,
820
      20,    19,    88,    89,    90,    91,    43,    93,    20,    95,
821
      50,    48,    20,    19,    50,    58,    59,    43,    58,    74,
822
      18,    61,    48,   166,    48,    42,    43,    48,    11,    43,
823
      70,    48,   115,    69,    65,    71,    72,    73,    74,    75,
824
      76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
825
      63,    87,    67,    58,    65,    74,    25,    34,    35,    36,
826
      37,    16,   148,    40,   150,   101,   106,   153,    17,   155,
827
     110,    58,   108,   109,   217,    65,    58,    58,    58,   115,
828
     182,     3,     4,     5,     6,     7,     8,     3,    10,    11,
829
     145,    63,    14,    49,    50,    51,    52,   116,    68,    40,
830
      56,    63,    58,    16,    65,    65,    63,   209,    64,   145,
831
      32,    58,    34,    63,    -1,    63,   101,   157,   158,   159,
832
     160,    63,    -1,    -1,    -1,    -1,   145,   167,    -1,    -1,
833
     166,    -1,    -1,     0,    -1,    -1,    58,   177,    60,    -1,
834
     180,    -1,   178,    -1,    66,    -1,    -1,   183,    -1,    -1,
835
      24,    18,    19,    20,    -1,    29,    30,    31,    32,   195,
836
      34,    35,    36,    37,    -1,    -1,    40,    -1,     0,    -1,
837
      -1,    -1,   212,   213,   210,    -1,   216,    -1,   218,    -1,
838
     220,   217,    49,    50,    51,    52,    18,    19,    20,    56,
839
      -1,    58,    -1,    -1,    -1,    62,    63,    64,    65,    24,
840
      -1,    68,    -1,    -1,    29,    30,    31,    32,    -1,    34,
841
      35,    36,    37,    -1,    -1,    40,    -1,    49,    50,    51,
842
      52,    -1,    -1,    -1,    56,    -1,    58,    -1,    -1,    -1,
843
      62,    63,    64,    65,    -1,    -1,    68,     3,     4,     5,
844
       6,     7,     8,    -1,    10,    11,    -1,    -1,    14,     3,
845
       4,     5,     6,     7,     8,    -1,    10,    11,    -1,    -1,
846
      14,    -1,    -1,    -1,    30,    31,    32,    -1,    34,    -1,
847
      -1,    -1,    38,    39,    -1,    -1,    30,    31,    32,    -1,
848
      34,    -1,    -1,    -1,    38,    39,    -1,    -1,    -1,    -1,
849
      -1,    -1,    58,    -1,    60,    -1,    -1,    63,    -1,    65,
850
      66,    -1,    -1,    -1,    58,    -1,    60,    61,    -1,    -1,
851
      -1,    -1,    66,     3,     4,     5,     6,     7,     8,    -1,
852
      10,    11,    -1,    -1,    14,    -1,    16,    -1,    29,    30,
853
      31,    32,    -1,    34,    35,    36,    37,    -1,    -1,    40,
854
      30,    31,    32,    -1,    34,    -1,    -1,    -1,    38,    39,
855
       3,     4,     5,     6,     7,     8,    -1,    10,    11,    -1,
856
      -1,    14,    63,    -1,    17,    -1,    -1,    -1,    58,    -1,
857
      60,    -1,    -1,    -1,    -1,    -1,    66,    30,    31,    32,
858
      -1,    34,    -1,    -1,    -1,    38,    39,     3,     4,     5,
859
       6,     7,     8,    -1,    10,    11,    -1,    -1,    14,    -1,
860
      -1,    -1,    -1,    -1,    -1,    58,    -1,    60,    -1,    -1,
861
      -1,    -1,    -1,    66,    30,    31,    32,    -1,    34,    -1,
862
      -1,    -1,    38,    39,     3,     4,     5,     6,     7,     8,
863
      -1,    10,    11,    -1,    -1,    14,    -1,    -1,    -1,    -1,
864
      -1,    -1,    58,    -1,    60,    -1,    -1,    -1,    -1,    -1,
865
      66,    30,    31,    32,    -1,    34,    -1,    -1,    -1,    38,
866
      39,     3,     4,     5,     6,     7,     8,    -1,    10,    11,
867
      -1,    -1,    14,    12,    13,    -1,    15,    -1,    -1,    58,
868
      -1,    60,    -1,    -1,    -1,    -1,    -1,    66,    30,    31,
869
      32,    -1,    34,    12,    13,    -1,    38,    39,    -1,    -1,
870
      -1,    -1,    -1,    -1,    -1,    44,    45,    46,    47,    48,
871
      12,    13,    -1,    -1,    53,    54,    58,    -1,    60,    58,
872
      59,    -1,    -1,    -1,    66,    44,    45,    46,    47,    48,
873
      12,    13,    -1,    -1,    53,    54,    55,    -1,    -1,    58,
874
      59,    -1,    44,    45,    46,    47,    48,    -1,    -1,    -1,
875
      -1,    53,    54,    55,    -1,    -1,    58,    59,    -1,    -1,
876
      -1,    -1,    44,    45,    46,    47,    48,    -1,    -1,    -1,
877
      -1,    53,    54,    -1,    -1,    -1,    58,    59,    29,    30,
878
      31,    32,    -1,    34,    35,    36,    37,    -1,    -1,    40,
879
      -1,    -1,    21,    22,    23,    24,    25,    26,    27,    28,
880
      29,    30,    31,    32,    -1,    34,    35,    36,    37,    38,
881
      -1,    40,    63,    42,    43,    21,    22,    23,    24,    25,
882
      26,    27,    28,    29,    30,    31,    32,    -1,    34,    35,
883
      36,    37,    38,    -1,    40,    21,    22,    23,    24,    25,
884
      26,    27,    28,    29,    30,    31,    32,    -1,    34,    35,
885
      36,    37,    38,    -1,    40,    21,    22,    23,    -1,    25,
886
      26,    27,    28,    29,    30,    31,    32,    -1,    34,    35,
887
      36,    37,    38,    24,    40,    -1,    -1,    -1,    29,    30,
888
      31,    32,    -1,    34,    35,    36,    37,    -1,    -1,    40,
889
      -1,    42,    43,    29,    30,    31,    32,    -1,    34,    35,
890
      36,    37,    -1,    -1,    40,    -1,    42,    43,    29,    30,
891
      31,    32,    -1,    34,    35,    36,    37,    -1,    -1,    40,
892
      30,    31,    32,    -1,    34,    35,    36,    37,    -1,    -1,
893
      40
894
};
895
 
896
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
897
   symbol of state STATE-NUM.  */
898
static const unsigned char yystos[] =
899
{
900
       0,     3,     4,     5,     6,     7,     8,    10,    11,    14,
901
      30,    31,    32,    34,    38,    39,    58,    60,    66,    70,
902
      71,    72,    75,    77,    78,    79,    80,    81,    82,    83,
903
      85,    86,    87,    88,    89,     9,    48,    72,    75,    75,
904
      72,    72,    75,    75,    11,    61,    71,    75,    78,    90,
905
      91,    92,    93,    94,    95,    11,    87,     0,    62,    12,
906
      13,    15,    44,    45,    46,    47,    48,    53,    54,    58,
907
      59,    21,    22,    23,    25,    26,    27,    28,    29,    30,
908
      31,    32,    34,    35,    36,    37,    38,    40,    18,    19,
909
      20,    20,    20,    19,    19,    18,    49,    52,    50,    51,
910
      56,    58,    64,    11,    42,    43,    43,    63,    24,    42,
911
      43,    65,    63,    78,    92,    65,    67,    78,    78,    58,
912
      84,    84,    84,    11,    75,    76,    78,    78,    75,    75,
913
      75,    72,    75,    87,    75,    75,    75,    75,    75,    75,
914
      75,    75,    75,    75,    75,    25,    75,    77,    16,    77,
915
      17,    77,    77,    17,    77,    16,    77,    58,    58,    58,
916
      58,    75,    76,    74,     9,    48,    98,    96,    78,    75,
917
      75,    95,    78,    65,    92,    72,     3,    43,    24,    63,
918
      65,    68,    55,    24,    72,    75,    87,    77,    77,    77,
919
      77,    78,    78,    78,    78,    24,    63,    73,    95,    78,
920
      42,    43,    63,    78,    75,    11,    78,    84,    75,    55,
921
      24,    63,    65,    65,    63,    75,    58,    99,    97,    63,
922
      43,    84,    75,    78,    78,    63,    78,    95,    78,    78,
923
      63,    63,    63
924
};
925
 
926
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
927
# define YYSIZE_T __SIZE_TYPE__
928
#endif
929
#if ! defined (YYSIZE_T) && defined (size_t)
930
# define YYSIZE_T size_t
931
#endif
932
#if ! defined (YYSIZE_T)
933
# if defined (__STDC__) || defined (__cplusplus)
934
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
935
#  define YYSIZE_T size_t
936
# endif
937
#endif
938
#if ! defined (YYSIZE_T)
939
# define YYSIZE_T unsigned int
940
#endif
941
 
942
#define yyerrok         (yyerrstatus = 0)
943
#define yyclearin       (yychar = YYEMPTY)
944
#define YYEMPTY         (-2)
945
#define YYEOF           0
946
 
947
#define YYACCEPT        goto yyacceptlab
948
#define YYABORT         goto yyabortlab
949
#define YYERROR         goto yyerrorlab
950
 
951
 
952
/* Like YYERROR except do call yyerror.  This remains here temporarily
953
   to ease the transition to the new meaning of YYERROR, for GCC.
954
   Once GCC version 2 has supplanted version 1, this can go.  */
955
 
956
#define YYFAIL          goto yyerrlab
957
 
958
#define YYRECOVERING()  (!!yyerrstatus)
959
 
960
#define YYBACKUP(Token, Value)                                  \
961
do                                                              \
962
  if (yychar == YYEMPTY && yylen == 1)                          \
963
    {                                                           \
964
      yychar = (Token);                                         \
965
      yylval = (Value);                                         \
966
      yytoken = YYTRANSLATE (yychar);                           \
967
      YYPOPSTACK;                                               \
968
      goto yybackup;                                            \
969
    }                                                           \
970
  else                                                          \
971
    {                                                           \
972
      yyerror ("syntax error: cannot back up");\
973
      YYERROR;                                                  \
974
    }                                                           \
975
while (0)
976
 
977
#define YYTERROR        1
978
#define YYERRCODE       256
979
 
980
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
981
   are run).  */
982
 
983
#ifndef YYLLOC_DEFAULT
984
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
985
   ((Current).first_line   = (Rhs)[1].first_line,       \
986
    (Current).first_column = (Rhs)[1].first_column,     \
987
    (Current).last_line    = (Rhs)[N].last_line,        \
988
    (Current).last_column  = (Rhs)[N].last_column)
989
#endif
990
 
991
/* YYLEX -- calling `yylex' with the right arguments.  */
992
 
993
#ifdef YYLEX_PARAM
994
# define YYLEX yylex (YYLEX_PARAM)
995
#else
996
# define YYLEX yylex ()
997
#endif
998
 
999
/* Enable debugging if requested.  */
1000
#if YYDEBUG
1001
 
1002
# ifndef YYFPRINTF
1003
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1004
#  define YYFPRINTF fprintf
1005
# endif
1006
 
1007
# define YYDPRINTF(Args)                        \
1008
do {                                            \
1009
  if (yydebug)                                  \
1010
    YYFPRINTF Args;                             \
1011
} while (0)
1012
 
1013
# define YYDSYMPRINT(Args)                      \
1014
do {                                            \
1015
  if (yydebug)                                  \
1016
    yysymprint Args;                            \
1017
} while (0)
1018
 
1019
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
1020
do {                                                            \
1021
  if (yydebug)                                                  \
1022
    {                                                           \
1023
      YYFPRINTF (stderr, "%s ", Title);                         \
1024
      yysymprint (stderr,                                       \
1025
                  Token, Value);        \
1026
      YYFPRINTF (stderr, "\n");                                 \
1027
    }                                                           \
1028
} while (0)
1029
 
1030
/*------------------------------------------------------------------.
1031
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1032
| TOP (included).                                                   |
1033
`------------------------------------------------------------------*/
1034
 
1035
#if defined (__STDC__) || defined (__cplusplus)
1036
static void
1037
yy_stack_print (short *bottom, short *top)
1038
#else
1039
static void
1040
yy_stack_print (bottom, top)
1041
    short *bottom;
1042
    short *top;
1043
#endif
1044
{
1045
  YYFPRINTF (stderr, "Stack now");
1046
  for (/* Nothing. */; bottom <= top; ++bottom)
1047
    YYFPRINTF (stderr, " %d", *bottom);
1048
  YYFPRINTF (stderr, "\n");
1049
}
1050
 
1051
# define YY_STACK_PRINT(Bottom, Top)                            \
1052
do {                                                            \
1053
  if (yydebug)                                                  \
1054
    yy_stack_print ((Bottom), (Top));                           \
1055
} while (0)
1056
 
1057
 
1058
/*------------------------------------------------.
1059
| Report that the YYRULE is going to be reduced.  |
1060
`------------------------------------------------*/
1061
 
1062
#if defined (__STDC__) || defined (__cplusplus)
1063
static void
1064
yy_reduce_print (int yyrule)
1065
#else
1066
static void
1067
yy_reduce_print (yyrule)
1068
    int yyrule;
1069
#endif
1070
{
1071
  int yyi;
1072
  unsigned int yylno = yyrline[yyrule];
1073
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1074
             yyrule - 1, yylno);
1075
  /* Print the symbols being reduced, and their result.  */
1076
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1077
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1078
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1079
}
1080
 
1081
# define YY_REDUCE_PRINT(Rule)          \
1082
do {                                    \
1083
  if (yydebug)                          \
1084
    yy_reduce_print (Rule);             \
1085
} while (0)
1086
 
1087
/* Nonzero means print parse trace.  It is left uninitialized so that
1088
   multiple parsers can coexist.  */
1089
int yydebug;
1090
#else /* !YYDEBUG */
1091
# define YYDPRINTF(Args)
1092
# define YYDSYMPRINT(Args)
1093
# define YYDSYMPRINTF(Title, Token, Value, Location)
1094
# define YY_STACK_PRINT(Bottom, Top)
1095
# define YY_REDUCE_PRINT(Rule)
1096
#endif /* !YYDEBUG */
1097
 
1098
 
1099
/* YYINITDEPTH -- initial size of the parser's stacks.  */
1100
#ifndef YYINITDEPTH
1101
# define YYINITDEPTH 200
1102
#endif
1103
 
1104
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1105
   if the built-in stack extension method is used).
1106
 
1107
   Do not make this value too large; the results are undefined if
1108
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1109
   evaluated with infinite-precision integer arithmetic.  */
1110
 
1111
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1112
# undef YYMAXDEPTH
1113
#endif
1114
 
1115
#ifndef YYMAXDEPTH
1116
# define YYMAXDEPTH 10000
1117
#endif
1118
 
1119
 
1120
 
1121
#if YYERROR_VERBOSE
1122
 
1123
# ifndef yystrlen
1124
#  if defined (__GLIBC__) && defined (_STRING_H)
1125
#   define yystrlen strlen
1126
#  else
1127
/* Return the length of YYSTR.  */
1128
static YYSIZE_T
1129
#   if defined (__STDC__) || defined (__cplusplus)
1130
yystrlen (const char *yystr)
1131
#   else
1132
yystrlen (yystr)
1133
     const char *yystr;
1134
#   endif
1135
{
1136
  register const char *yys = yystr;
1137
 
1138
  while (*yys++ != '\0')
1139
    continue;
1140
 
1141
  return yys - yystr - 1;
1142
}
1143
#  endif
1144
# endif
1145
 
1146
# ifndef yystpcpy
1147
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1148
#   define yystpcpy stpcpy
1149
#  else
1150
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1151
   YYDEST.  */
1152
static char *
1153
#   if defined (__STDC__) || defined (__cplusplus)
1154
yystpcpy (char *yydest, const char *yysrc)
1155
#   else
1156
yystpcpy (yydest, yysrc)
1157
     char *yydest;
1158
     const char *yysrc;
1159
#   endif
1160
{
1161
  register char *yyd = yydest;
1162
  register const char *yys = yysrc;
1163
 
1164
  while ((*yyd++ = *yys++) != '\0')
1165
    continue;
1166
 
1167
  return yyd - 1;
1168
}
1169
#  endif
1170
# endif
1171
 
1172
#endif /* !YYERROR_VERBOSE */
1173
 
1174
 
1175
 
1176
#if YYDEBUG
1177
/*--------------------------------.
1178
| Print this symbol on YYOUTPUT.  |
1179
`--------------------------------*/
1180
 
1181
#if defined (__STDC__) || defined (__cplusplus)
1182
static void
1183
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1184
#else
1185
static void
1186
yysymprint (yyoutput, yytype, yyvaluep)
1187
    FILE *yyoutput;
1188
    int yytype;
1189
    YYSTYPE *yyvaluep;
1190
#endif
1191
{
1192
  /* Pacify ``unused variable'' warnings.  */
1193
  (void) yyvaluep;
1194
 
1195
  if (yytype < YYNTOKENS)
1196
    {
1197
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1198
# ifdef YYPRINT
1199
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1200
# endif
1201
    }
1202
  else
1203
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1204
 
1205
  switch (yytype)
1206
    {
1207
      default:
1208
        break;
1209
    }
1210
  YYFPRINTF (yyoutput, ")");
1211
}
1212
 
1213
#endif /* ! YYDEBUG */
1214
/*-----------------------------------------------.
1215
| Release the memory associated to this symbol.  |
1216
`-----------------------------------------------*/
1217
 
1218
#if defined (__STDC__) || defined (__cplusplus)
1219
static void
1220
yydestruct (int yytype, YYSTYPE *yyvaluep)
1221
#else
1222
static void
1223
yydestruct (yytype, yyvaluep)
1224
    int yytype;
1225
    YYSTYPE *yyvaluep;
1226
#endif
1227
{
1228
  /* Pacify ``unused variable'' warnings.  */
1229
  (void) yyvaluep;
1230
 
1231
  switch (yytype)
1232
    {
1233
 
1234
      default:
1235
        break;
1236
    }
1237
}
1238
 
1239
 
1240
/* Prevent warnings from -Wmissing-prototypes.  */
1241
 
1242
#ifdef YYPARSE_PARAM
1243
# if defined (__STDC__) || defined (__cplusplus)
1244
int yyparse (void *YYPARSE_PARAM);
1245
# else
1246
int yyparse ();
1247
# endif
1248
#else /* ! YYPARSE_PARAM */
1249
#if defined (__STDC__) || defined (__cplusplus)
1250
int yyparse (void);
1251
#else
1252
int yyparse ();
1253
#endif
1254
#endif /* ! YYPARSE_PARAM */
1255
 
1256
 
1257
 
1258
/* The lookahead symbol.  */
1259
int yychar;
1260
 
1261
/* The semantic value of the lookahead symbol.  */
1262
YYSTYPE yylval;
1263
 
1264
/* Number of syntax errors so far.  */
1265
int yynerrs;
1266
 
1267
 
1268
 
1269
/*----------.
1270
| yyparse.  |
1271
`----------*/
1272
 
1273
#ifdef YYPARSE_PARAM
1274
# if defined (__STDC__) || defined (__cplusplus)
1275
int yyparse (void *YYPARSE_PARAM)
1276
# else
1277
int yyparse (YYPARSE_PARAM)
1278
  void *YYPARSE_PARAM;
1279
# endif
1280
#else /* ! YYPARSE_PARAM */
1281
#if defined (__STDC__) || defined (__cplusplus)
1282
int
1283
yyparse (void)
1284
#else
1285
int
1286
yyparse ()
1287
 
1288
#endif
1289
#endif
1290
{
1291
 
1292
  register int yystate;
1293
  register int yyn;
1294
  int yyresult;
1295
  /* Number of tokens to shift before error messages enabled.  */
1296
  int yyerrstatus;
1297
  /* Lookahead token as an internal (translated) token number.  */
1298
  int yytoken = 0;
1299
 
1300
  /* Three stacks and their tools:
1301
     `yyss': related to states,
1302
     `yyvs': related to semantic values,
1303
     `yyls': related to locations.
1304
 
1305
     Refer to the stacks thru separate pointers, to allow yyoverflow
1306
     to xreallocate them elsewhere.  */
1307
 
1308
  /* The state stack.  */
1309
  short yyssa[YYINITDEPTH];
1310
  short *yyss = yyssa;
1311
  register short *yyssp;
1312
 
1313
  /* The semantic value stack.  */
1314
  YYSTYPE yyvsa[YYINITDEPTH];
1315
  YYSTYPE *yyvs = yyvsa;
1316
  register YYSTYPE *yyvsp;
1317
 
1318
 
1319
 
1320
#define YYPOPSTACK   (yyvsp--, yyssp--)
1321
 
1322
  YYSIZE_T yystacksize = YYINITDEPTH;
1323
 
1324
  /* The variables used to return semantic value and location from the
1325
     action routines.  */
1326
  YYSTYPE yyval;
1327
 
1328
 
1329
  /* When reducing, the number of symbols on the RHS of the reduced
1330
     rule.  */
1331
  int yylen;
1332
 
1333
  YYDPRINTF ((stderr, "Starting parse\n"));
1334
 
1335
  yystate = 0;
1336
  yyerrstatus = 0;
1337
  yynerrs = 0;
1338
  yychar = YYEMPTY;             /* Cause a token to be read.  */
1339
 
1340
  /* Initialize stack pointers.
1341
     Waste one element of value and location stack
1342
     so that they stay on the same level as the state stack.
1343
     The wasted elements are never initialized.  */
1344
 
1345
  yyssp = yyss;
1346
  yyvsp = yyvs;
1347
 
1348
  goto yysetstate;
1349
 
1350
/*------------------------------------------------------------.
1351
| yynewstate -- Push a new state, which is found in yystate.  |
1352
`------------------------------------------------------------*/
1353
 yynewstate:
1354
  /* In all cases, when you get here, the value and location stacks
1355
     have just been pushed. so pushing a state here evens the stacks.
1356
     */
1357
  yyssp++;
1358
 
1359
 yysetstate:
1360
  *yyssp = yystate;
1361
 
1362
  if (yyss + yystacksize - 1 <= yyssp)
1363
    {
1364
      /* Get the current used size of the three stacks, in elements.  */
1365
      YYSIZE_T yysize = yyssp - yyss + 1;
1366
 
1367
#ifdef yyoverflow
1368
      {
1369
        /* Give user a chance to xreallocate the stack. Use copies of
1370
           these so that the &'s don't force the real ones into
1371
           memory.  */
1372
        YYSTYPE *yyvs1 = yyvs;
1373
        short *yyss1 = yyss;
1374
 
1375
 
1376
        /* Each stack pointer address is followed by the size of the
1377
           data in use in that stack, in bytes.  This used to be a
1378
           conditional around just the two extra args, but that might
1379
           be undefined if yyoverflow is a macro.  */
1380
        yyoverflow ("parser stack overflow",
1381
                    &yyss1, yysize * sizeof (*yyssp),
1382
                    &yyvs1, yysize * sizeof (*yyvsp),
1383
 
1384
                    &yystacksize);
1385
 
1386
        yyss = yyss1;
1387
        yyvs = yyvs1;
1388
      }
1389
#else /* no yyoverflow */
1390
# ifndef YYSTACK_RELOCATE
1391
      goto yyoverflowlab;
1392
# else
1393
      /* Extend the stack our own way.  */
1394
      if (YYMAXDEPTH <= yystacksize)
1395
        goto yyoverflowlab;
1396
      yystacksize *= 2;
1397
      if (YYMAXDEPTH < yystacksize)
1398
        yystacksize = YYMAXDEPTH;
1399
 
1400
      {
1401
        short *yyss1 = yyss;
1402
        union yyalloc *yyptr =
1403
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1404
        if (! yyptr)
1405
          goto yyoverflowlab;
1406
        YYSTACK_RELOCATE (yyss);
1407
        YYSTACK_RELOCATE (yyvs);
1408
 
1409
#  undef YYSTACK_RELOCATE
1410
        if (yyss1 != yyssa)
1411
          YYSTACK_FREE (yyss1);
1412
      }
1413
# endif
1414
#endif /* no yyoverflow */
1415
 
1416
      yyssp = yyss + yysize - 1;
1417
      yyvsp = yyvs + yysize - 1;
1418
 
1419
 
1420
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1421
                  (unsigned long int) yystacksize));
1422
 
1423
      if (yyss + yystacksize - 1 <= yyssp)
1424
        YYABORT;
1425
    }
1426
 
1427
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1428
 
1429
  goto yybackup;
1430
 
1431
/*-----------.
1432
| yybackup.  |
1433
`-----------*/
1434
yybackup:
1435
 
1436
/* Do appropriate processing given the current state.  */
1437
/* Read a lookahead token if we need one and don't already have one.  */
1438
/* yyresume: */
1439
 
1440
  /* First try to decide what to do without reference to lookahead token.  */
1441
 
1442
  yyn = yypact[yystate];
1443
  if (yyn == YYPACT_NINF)
1444
    goto yydefault;
1445
 
1446
  /* Not known => get a lookahead token if don't already have one.  */
1447
 
1448
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1449
  if (yychar == YYEMPTY)
1450
    {
1451
      YYDPRINTF ((stderr, "Reading a token: "));
1452
      yychar = YYLEX;
1453
    }
1454
 
1455
  if (yychar <= YYEOF)
1456
    {
1457
      yychar = yytoken = YYEOF;
1458
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1459
    }
1460
  else
1461
    {
1462
      yytoken = YYTRANSLATE (yychar);
1463
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1464
    }
1465
 
1466
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1467
     detect an error, take that action.  */
1468
  yyn += yytoken;
1469
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1470
    goto yydefault;
1471
  yyn = yytable[yyn];
1472
  if (yyn <= 0)
1473
    {
1474
      if (yyn == 0 || yyn == YYTABLE_NINF)
1475
        goto yyerrlab;
1476
      yyn = -yyn;
1477
      goto yyreduce;
1478
    }
1479
 
1480
  if (yyn == YYFINAL)
1481
    YYACCEPT;
1482
 
1483
  /* Shift the lookahead token.  */
1484
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1485
 
1486
  /* Discard the token being shifted unless it is eof.  */
1487
  if (yychar != YYEOF)
1488
    yychar = YYEMPTY;
1489
 
1490
  *++yyvsp = yylval;
1491
 
1492
 
1493
  /* Count tokens shifted since error; after three, turn off error
1494
     status.  */
1495
  if (yyerrstatus)
1496
    yyerrstatus--;
1497
 
1498
  yystate = yyn;
1499
  goto yynewstate;
1500
 
1501
 
1502
/*-----------------------------------------------------------.
1503
| yydefault -- do the default action for the current state.  |
1504
`-----------------------------------------------------------*/
1505
yydefault:
1506
  yyn = yydefact[yystate];
1507
  if (yyn == 0)
1508
    goto yyerrlab;
1509
  goto yyreduce;
1510
 
1511
 
1512
/*-----------------------------.
1513
| yyreduce -- Do a reduction.  |
1514
`-----------------------------*/
1515
yyreduce:
1516
  /* yyn is the number of a rule to reduce with.  */
1517
  yylen = yyr2[yyn];
1518
 
1519
  /* If YYLEN is nonzero, implement the default value of the action:
1520
     `$$ = $1'.
1521
 
1522
     Otherwise, the following line sets YYVAL to garbage.
1523
     This behavior is undocumented and Bison
1524
     users should not rely upon it.  Assigning to YYVAL
1525
     unconditionally makes the parser a bit smaller, and it avoids a
1526
     GCC warning that YYVAL may be used uninitialized.  */
1527
  yyval = yyvsp[1-yylen];
1528
 
1529
 
1530
  YY_REDUCE_PRINT (yyn);
1531
  switch (yyn)
1532
    {
1533
        case 4:
1534
#line 234 "ada-exp.y"
1535
    { write_exp_elt_opcode (BINOP_COMMA); }
1536
    break;
1537
 
1538
  case 5:
1539
#line 236 "ada-exp.y"
1540
    { write_exp_elt_opcode (BINOP_ASSIGN); }
1541
    break;
1542
 
1543
  case 6:
1544
#line 241 "ada-exp.y"
1545
    { write_exp_elt_opcode (UNOP_IND); }
1546
    break;
1547
 
1548
  case 7:
1549
#line 245 "ada-exp.y"
1550
    { write_exp_op_with_string (STRUCTOP_STRUCT, yyvsp[0].sval); }
1551
    break;
1552
 
1553
  case 8:
1554
#line 249 "ada-exp.y"
1555
    {
1556
                          write_exp_elt_opcode (OP_FUNCALL);
1557
                          write_exp_elt_longcst (yyvsp[-1].lval);
1558
                          write_exp_elt_opcode (OP_FUNCALL);
1559
                        }
1560
    break;
1561
 
1562
  case 9:
1563
#line 255 "ada-exp.y"
1564
    {
1565
                          if (yyvsp[-3].tval != NULL)
1566
                            {
1567
                              if (yyvsp[-1].lval != 1)
1568
                                error (_("Invalid conversion"));
1569
                              write_exp_elt_opcode (UNOP_CAST);
1570
                              write_exp_elt_type (yyvsp[-3].tval);
1571
                              write_exp_elt_opcode (UNOP_CAST);
1572
                            }
1573
                          else
1574
                            {
1575
                              write_exp_elt_opcode (OP_FUNCALL);
1576
                              write_exp_elt_longcst (yyvsp[-1].lval);
1577
                              write_exp_elt_opcode (OP_FUNCALL);
1578
                            }
1579
                        }
1580
    break;
1581
 
1582
  case 10:
1583
#line 273 "ada-exp.y"
1584
    { type_qualifier = yyvsp[-2].tval; }
1585
    break;
1586
 
1587
  case 11:
1588
#line 275 "ada-exp.y"
1589
    {
1590
                          if (yyvsp[-6].tval == NULL)
1591
                            error (_("Type required for qualification"));
1592
                          write_exp_elt_opcode (UNOP_QUAL);
1593
                          write_exp_elt_type (yyvsp[-6].tval);
1594
                          write_exp_elt_opcode (UNOP_QUAL);
1595
                          type_qualifier = yyvsp[-4].tval;
1596
                        }
1597
    break;
1598
 
1599
  case 12:
1600
#line 285 "ada-exp.y"
1601
    { yyval.tval = type_qualifier; }
1602
    break;
1603
 
1604
  case 13:
1605
#line 290 "ada-exp.y"
1606
    { write_exp_elt_opcode (TERNOP_SLICE); }
1607
    break;
1608
 
1609
  case 14:
1610
#line 292 "ada-exp.y"
1611
    { if (yyvsp[-5].tval == NULL)
1612
                            write_exp_elt_opcode (TERNOP_SLICE);
1613
                          else
1614
                            error (_("Cannot slice a type"));
1615
                        }
1616
    break;
1617
 
1618
  case 15:
1619
#line 299 "ada-exp.y"
1620
    { }
1621
    break;
1622
 
1623
  case 16:
1624
#line 311 "ada-exp.y"
1625
    { if (yyvsp[0].tval != NULL)
1626
                            {
1627
                              write_exp_elt_opcode (OP_TYPE);
1628
                              write_exp_elt_type (yyvsp[0].tval);
1629
                              write_exp_elt_opcode (OP_TYPE);
1630
                            }
1631
                        }
1632
    break;
1633
 
1634
  case 17:
1635
#line 321 "ada-exp.y"
1636
    { write_dollar_variable (yyvsp[0].sval); }
1637
    break;
1638
 
1639
  case 20:
1640
#line 331 "ada-exp.y"
1641
    { write_exp_elt_opcode (UNOP_NEG); }
1642
    break;
1643
 
1644
  case 21:
1645
#line 335 "ada-exp.y"
1646
    { write_exp_elt_opcode (UNOP_PLUS); }
1647
    break;
1648
 
1649
  case 22:
1650
#line 339 "ada-exp.y"
1651
    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1652
    break;
1653
 
1654
  case 23:
1655
#line 343 "ada-exp.y"
1656
    { write_exp_elt_opcode (UNOP_ABS); }
1657
    break;
1658
 
1659
  case 24:
1660
#line 346 "ada-exp.y"
1661
    { yyval.lval = 0; }
1662
    break;
1663
 
1664
  case 25:
1665
#line 350 "ada-exp.y"
1666
    { yyval.lval = 1; }
1667
    break;
1668
 
1669
  case 26:
1670
#line 352 "ada-exp.y"
1671
    { yyval.lval = 1; }
1672
    break;
1673
 
1674
  case 27:
1675
#line 354 "ada-exp.y"
1676
    { yyval.lval = yyvsp[-2].lval + 1; }
1677
    break;
1678
 
1679
  case 28:
1680
#line 356 "ada-exp.y"
1681
    { yyval.lval = yyvsp[-4].lval + 1; }
1682
    break;
1683
 
1684
  case 29:
1685
#line 361 "ada-exp.y"
1686
    {
1687
                          if (yyvsp[-2].tval == NULL)
1688
                            error (_("Type required within braces in coercion"));
1689
                          write_exp_elt_opcode (UNOP_MEMVAL);
1690
                          write_exp_elt_type (yyvsp[-2].tval);
1691
                          write_exp_elt_opcode (UNOP_MEMVAL);
1692
                        }
1693
    break;
1694
 
1695
  case 30:
1696
#line 373 "ada-exp.y"
1697
    { write_exp_elt_opcode (BINOP_EXP); }
1698
    break;
1699
 
1700
  case 31:
1701
#line 377 "ada-exp.y"
1702
    { write_exp_elt_opcode (BINOP_MUL); }
1703
    break;
1704
 
1705
  case 32:
1706
#line 381 "ada-exp.y"
1707
    { write_exp_elt_opcode (BINOP_DIV); }
1708
    break;
1709
 
1710
  case 33:
1711
#line 385 "ada-exp.y"
1712
    { write_exp_elt_opcode (BINOP_REM); }
1713
    break;
1714
 
1715
  case 34:
1716
#line 389 "ada-exp.y"
1717
    { write_exp_elt_opcode (BINOP_MOD); }
1718
    break;
1719
 
1720
  case 35:
1721
#line 393 "ada-exp.y"
1722
    { write_exp_elt_opcode (BINOP_REPEAT); }
1723
    break;
1724
 
1725
  case 36:
1726
#line 397 "ada-exp.y"
1727
    { write_exp_elt_opcode (BINOP_ADD); }
1728
    break;
1729
 
1730
  case 37:
1731
#line 401 "ada-exp.y"
1732
    { write_exp_elt_opcode (BINOP_CONCAT); }
1733
    break;
1734
 
1735
  case 38:
1736
#line 405 "ada-exp.y"
1737
    { write_exp_elt_opcode (BINOP_SUB); }
1738
    break;
1739
 
1740
  case 40:
1741
#line 412 "ada-exp.y"
1742
    { write_exp_elt_opcode (BINOP_EQUAL); }
1743
    break;
1744
 
1745
  case 41:
1746
#line 416 "ada-exp.y"
1747
    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1748
    break;
1749
 
1750
  case 42:
1751
#line 420 "ada-exp.y"
1752
    { write_exp_elt_opcode (BINOP_LEQ); }
1753
    break;
1754
 
1755
  case 43:
1756
#line 424 "ada-exp.y"
1757
    { write_exp_elt_opcode (TERNOP_IN_RANGE); }
1758
    break;
1759
 
1760
  case 44:
1761
#line 426 "ada-exp.y"
1762
    { write_exp_elt_opcode (BINOP_IN_BOUNDS);
1763
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1764
                          write_exp_elt_opcode (BINOP_IN_BOUNDS);
1765
                        }
1766
    break;
1767
 
1768
  case 45:
1769
#line 431 "ada-exp.y"
1770
    {
1771
                          if (yyvsp[0].tval == NULL)
1772
                            error (_("Right operand of 'in' must be type"));
1773
                          write_exp_elt_opcode (UNOP_IN_RANGE);
1774
                          write_exp_elt_type (yyvsp[0].tval);
1775
                          write_exp_elt_opcode (UNOP_IN_RANGE);
1776
                        }
1777
    break;
1778
 
1779
  case 46:
1780
#line 439 "ada-exp.y"
1781
    { write_exp_elt_opcode (TERNOP_IN_RANGE);
1782
                          write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1783
                        }
1784
    break;
1785
 
1786
  case 47:
1787
#line 443 "ada-exp.y"
1788
    { write_exp_elt_opcode (BINOP_IN_BOUNDS);
1789
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1790
                          write_exp_elt_opcode (BINOP_IN_BOUNDS);
1791
                          write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1792
                        }
1793
    break;
1794
 
1795
  case 48:
1796
#line 449 "ada-exp.y"
1797
    {
1798
                          if (yyvsp[0].tval == NULL)
1799
                            error (_("Right operand of 'in' must be type"));
1800
                          write_exp_elt_opcode (UNOP_IN_RANGE);
1801
                          write_exp_elt_type (yyvsp[0].tval);
1802
                          write_exp_elt_opcode (UNOP_IN_RANGE);
1803
                          write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1804
                        }
1805
    break;
1806
 
1807
  case 49:
1808
#line 460 "ada-exp.y"
1809
    { write_exp_elt_opcode (BINOP_GEQ); }
1810
    break;
1811
 
1812
  case 50:
1813
#line 464 "ada-exp.y"
1814
    { write_exp_elt_opcode (BINOP_LESS); }
1815
    break;
1816
 
1817
  case 51:
1818
#line 468 "ada-exp.y"
1819
    { write_exp_elt_opcode (BINOP_GTR); }
1820
    break;
1821
 
1822
  case 58:
1823
#line 481 "ada-exp.y"
1824
    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1825
    break;
1826
 
1827
  case 59:
1828
#line 483 "ada-exp.y"
1829
    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1830
    break;
1831
 
1832
  case 60:
1833
#line 488 "ada-exp.y"
1834
    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1835
    break;
1836
 
1837
  case 61:
1838
#line 490 "ada-exp.y"
1839
    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1840
    break;
1841
 
1842
  case 62:
1843
#line 495 "ada-exp.y"
1844
    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1845
    break;
1846
 
1847
  case 63:
1848
#line 497 "ada-exp.y"
1849
    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1850
    break;
1851
 
1852
  case 64:
1853
#line 502 "ada-exp.y"
1854
    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1855
    break;
1856
 
1857
  case 65:
1858
#line 504 "ada-exp.y"
1859
    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1860
    break;
1861
 
1862
  case 66:
1863
#line 508 "ada-exp.y"
1864
    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1865
    break;
1866
 
1867
  case 67:
1868
#line 510 "ada-exp.y"
1869
    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1870
    break;
1871
 
1872
  case 68:
1873
#line 522 "ada-exp.y"
1874
    { write_exp_elt_opcode (UNOP_ADDR); }
1875
    break;
1876
 
1877
  case 69:
1878
#line 524 "ada-exp.y"
1879
    { write_exp_elt_opcode (UNOP_ADDR);
1880
                          write_exp_elt_opcode (UNOP_CAST);
1881
                          write_exp_elt_type (type_system_address ());
1882
                          write_exp_elt_opcode (UNOP_CAST);
1883
                        }
1884
    break;
1885
 
1886
  case 70:
1887
#line 530 "ada-exp.y"
1888
    { write_int (yyvsp[0].lval, type_int ());
1889
                          write_exp_elt_opcode (OP_ATR_FIRST); }
1890
    break;
1891
 
1892
  case 71:
1893
#line 533 "ada-exp.y"
1894
    { write_int (yyvsp[0].lval, type_int ());
1895
                          write_exp_elt_opcode (OP_ATR_LAST); }
1896
    break;
1897
 
1898
  case 72:
1899
#line 536 "ada-exp.y"
1900
    { write_int (yyvsp[0].lval, type_int ());
1901
                          write_exp_elt_opcode (OP_ATR_LENGTH); }
1902
    break;
1903
 
1904
  case 73:
1905
#line 539 "ada-exp.y"
1906
    { write_exp_elt_opcode (OP_ATR_SIZE); }
1907
    break;
1908
 
1909
  case 74:
1910
#line 541 "ada-exp.y"
1911
    { write_exp_elt_opcode (OP_ATR_TAG); }
1912
    break;
1913
 
1914
  case 75:
1915
#line 543 "ada-exp.y"
1916
    { write_exp_elt_opcode (OP_ATR_MIN); }
1917
    break;
1918
 
1919
  case 76:
1920
#line 545 "ada-exp.y"
1921
    { write_exp_elt_opcode (OP_ATR_MAX); }
1922
    break;
1923
 
1924
  case 77:
1925
#line 547 "ada-exp.y"
1926
    { write_exp_elt_opcode (OP_ATR_POS); }
1927
    break;
1928
 
1929
  case 78:
1930
#line 549 "ada-exp.y"
1931
    { write_exp_elt_opcode (OP_ATR_VAL); }
1932
    break;
1933
 
1934
  case 79:
1935
#line 551 "ada-exp.y"
1936
    { write_exp_elt_opcode (OP_ATR_MODULUS); }
1937
    break;
1938
 
1939
  case 80:
1940
#line 555 "ada-exp.y"
1941
    { yyval.lval = 1; }
1942
    break;
1943
 
1944
  case 81:
1945
#line 557 "ada-exp.y"
1946
    { yyval.lval = yyvsp[-1].typed_val.val; }
1947
    break;
1948
 
1949
  case 82:
1950
#line 562 "ada-exp.y"
1951
    {
1952
                          if (yyvsp[0].tval == NULL)
1953
                            error (_("Prefix must be type"));
1954
                          write_exp_elt_opcode (OP_TYPE);
1955
                          write_exp_elt_type (yyvsp[0].tval);
1956
                          write_exp_elt_opcode (OP_TYPE); }
1957
    break;
1958
 
1959
  case 84:
1960
#line 573 "ada-exp.y"
1961
    { write_exp_elt_opcode (OP_TYPE);
1962
                          write_exp_elt_type (parse_type->builtin_void);
1963
                          write_exp_elt_opcode (OP_TYPE); }
1964
    break;
1965
 
1966
  case 85:
1967
#line 580 "ada-exp.y"
1968
    { write_int ((LONGEST) yyvsp[0].typed_val.val, yyvsp[0].typed_val.type); }
1969
    break;
1970
 
1971
  case 86:
1972
#line 584 "ada-exp.y"
1973
    { write_int (convert_char_literal (type_qualifier, yyvsp[0].typed_val.val),
1974
                               (type_qualifier == NULL)
1975
                               ? yyvsp[0].typed_val.type : type_qualifier);
1976
                  }
1977
    break;
1978
 
1979
  case 87:
1980
#line 591 "ada-exp.y"
1981
    { write_exp_elt_opcode (OP_DOUBLE);
1982
                          write_exp_elt_type (yyvsp[0].typed_val_float.type);
1983
                          write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1984
                          write_exp_elt_opcode (OP_DOUBLE);
1985
                        }
1986
    break;
1987
 
1988
  case 88:
1989
#line 599 "ada-exp.y"
1990
    { write_int (0, type_int ()); }
1991
    break;
1992
 
1993
  case 89:
1994
#line 603 "ada-exp.y"
1995
    {
1996
                          write_exp_op_with_string (OP_STRING, yyvsp[0].sval);
1997
                        }
1998
    break;
1999
 
2000
  case 90:
2001
#line 609 "ada-exp.y"
2002
    { write_int (1, type_boolean ()); }
2003
    break;
2004
 
2005
  case 91:
2006
#line 611 "ada-exp.y"
2007
    { write_int (0, type_boolean ()); }
2008
    break;
2009
 
2010
  case 92:
2011
#line 615 "ada-exp.y"
2012
    { error (_("NEW not implemented.")); }
2013
    break;
2014
 
2015
  case 93:
2016
#line 619 "ada-exp.y"
2017
    { yyval.tval = write_var_or_type (NULL, yyvsp[0].sval); }
2018
    break;
2019
 
2020
  case 94:
2021
#line 621 "ada-exp.y"
2022
    { yyval.tval = write_var_or_type (yyvsp[-1].bval, yyvsp[0].sval); }
2023
    break;
2024
 
2025
  case 95:
2026
#line 623 "ada-exp.y"
2027
    {
2028
                          yyval.tval = write_var_or_type (NULL, yyvsp[-1].sval);
2029
                          if (yyval.tval == NULL)
2030
                            write_exp_elt_opcode (UNOP_ADDR);
2031
                          else
2032
                            yyval.tval = lookup_pointer_type (yyval.tval);
2033
                        }
2034
    break;
2035
 
2036
  case 96:
2037
#line 631 "ada-exp.y"
2038
    {
2039
                          yyval.tval = write_var_or_type (yyvsp[-2].bval, yyvsp[-1].sval);
2040
                          if (yyval.tval == NULL)
2041
                            write_exp_elt_opcode (UNOP_ADDR);
2042
                          else
2043
                            yyval.tval = lookup_pointer_type (yyval.tval);
2044
                        }
2045
    break;
2046
 
2047
  case 97:
2048
#line 642 "ada-exp.y"
2049
    { yyval.bval = block_lookup (NULL, yyvsp[-1].sval.ptr); }
2050
    break;
2051
 
2052
  case 98:
2053
#line 644 "ada-exp.y"
2054
    { yyval.bval = block_lookup (yyvsp[-2].bval, yyvsp[-1].sval.ptr); }
2055
    break;
2056
 
2057
  case 99:
2058
#line 649 "ada-exp.y"
2059
    {
2060
                          write_exp_elt_opcode (OP_AGGREGATE);
2061
                          write_exp_elt_longcst (yyvsp[-1].lval);
2062
                          write_exp_elt_opcode (OP_AGGREGATE);
2063
                        }
2064
    break;
2065
 
2066
  case 100:
2067
#line 657 "ada-exp.y"
2068
    { yyval.lval = yyvsp[0].lval; }
2069
    break;
2070
 
2071
  case 101:
2072
#line 659 "ada-exp.y"
2073
    { write_exp_elt_opcode (OP_POSITIONAL);
2074
                          write_exp_elt_longcst (yyvsp[-1].lval);
2075
                          write_exp_elt_opcode (OP_POSITIONAL);
2076
                          yyval.lval = yyvsp[-1].lval + 1;
2077
                        }
2078
    break;
2079
 
2080
  case 102:
2081
#line 665 "ada-exp.y"
2082
    { yyval.lval = yyvsp[-1].lval + yyvsp[0].lval; }
2083
    break;
2084
 
2085
  case 103:
2086
#line 670 "ada-exp.y"
2087
    { write_exp_elt_opcode (OP_POSITIONAL);
2088
                          write_exp_elt_longcst (0);
2089
                          write_exp_elt_opcode (OP_POSITIONAL);
2090
                          yyval.lval = 1;
2091
                        }
2092
    break;
2093
 
2094
  case 104:
2095
#line 676 "ada-exp.y"
2096
    { write_exp_elt_opcode (OP_POSITIONAL);
2097
                          write_exp_elt_longcst (yyvsp[-2].lval);
2098
                          write_exp_elt_opcode (OP_POSITIONAL);
2099
                          yyval.lval = yyvsp[-2].lval + 1;
2100
                        }
2101
    break;
2102
 
2103
  case 105:
2104
#line 684 "ada-exp.y"
2105
    { yyval.lval = 1; }
2106
    break;
2107
 
2108
  case 106:
2109
#line 685 "ada-exp.y"
2110
    { yyval.lval = 1; }
2111
    break;
2112
 
2113
  case 107:
2114
#line 687 "ada-exp.y"
2115
    { yyval.lval = yyvsp[0].lval + 1; }
2116
    break;
2117
 
2118
  case 108:
2119
#line 691 "ada-exp.y"
2120
    { write_exp_elt_opcode (OP_OTHERS); }
2121
    break;
2122
 
2123
  case 109:
2124
#line 696 "ada-exp.y"
2125
    {
2126
                          write_exp_elt_opcode (OP_CHOICES);
2127
                          write_exp_elt_longcst (yyvsp[0].lval);
2128
                          write_exp_elt_opcode (OP_CHOICES);
2129
                        }
2130
    break;
2131
 
2132
  case 110:
2133
#line 710 "ada-exp.y"
2134
    { write_name_assoc (yyvsp[-1].sval); }
2135
    break;
2136
 
2137
  case 111:
2138
#line 711 "ada-exp.y"
2139
    { yyval.lval = 1; }
2140
    break;
2141
 
2142
  case 112:
2143
#line 713 "ada-exp.y"
2144
    { yyval.lval = 1; }
2145
    break;
2146
 
2147
  case 113:
2148
#line 715 "ada-exp.y"
2149
    { write_exp_elt_opcode (OP_DISCRETE_RANGE);
2150
                          write_exp_op_with_string (OP_NAME, empty_stoken);
2151
                        }
2152
    break;
2153
 
2154
  case 114:
2155
#line 718 "ada-exp.y"
2156
    { yyval.lval = 1; }
2157
    break;
2158
 
2159
  case 115:
2160
#line 720 "ada-exp.y"
2161
    { write_name_assoc (yyvsp[-1].sval); }
2162
    break;
2163
 
2164
  case 116:
2165
#line 721 "ada-exp.y"
2166
    { yyval.lval = yyvsp[0].lval + 1; }
2167
    break;
2168
 
2169
  case 117:
2170
#line 723 "ada-exp.y"
2171
    { yyval.lval = yyvsp[0].lval + 1; }
2172
    break;
2173
 
2174
  case 118:
2175
#line 725 "ada-exp.y"
2176
    { write_exp_elt_opcode (OP_DISCRETE_RANGE); }
2177
    break;
2178
 
2179
  case 119:
2180
#line 726 "ada-exp.y"
2181
    { yyval.lval = yyvsp[0].lval + 1; }
2182
    break;
2183
 
2184
  case 120:
2185
#line 733 "ada-exp.y"
2186
    { write_exp_elt_opcode (UNOP_IND); }
2187
    break;
2188
 
2189
  case 121:
2190
#line 735 "ada-exp.y"
2191
    { write_exp_elt_opcode (UNOP_ADDR); }
2192
    break;
2193
 
2194
  case 122:
2195
#line 737 "ada-exp.y"
2196
    { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
2197
    break;
2198
 
2199
 
2200
    }
2201
 
2202
/* Line 1000 of yacc.c.  */
2203
#line 2204 "ada-exp.c.tmp"
2204
 
2205
  yyvsp -= yylen;
2206
  yyssp -= yylen;
2207
 
2208
 
2209
  YY_STACK_PRINT (yyss, yyssp);
2210
 
2211
  *++yyvsp = yyval;
2212
 
2213
 
2214
  /* Now `shift' the result of the reduction.  Determine what state
2215
     that goes to, based on the state we popped back to and the rule
2216
     number reduced by.  */
2217
 
2218
  yyn = yyr1[yyn];
2219
 
2220
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2221
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2222
    yystate = yytable[yystate];
2223
  else
2224
    yystate = yydefgoto[yyn - YYNTOKENS];
2225
 
2226
  goto yynewstate;
2227
 
2228
 
2229
/*------------------------------------.
2230
| yyerrlab -- here on detecting error |
2231
`------------------------------------*/
2232
yyerrlab:
2233
  /* If not already recovering from an error, report this error.  */
2234
  if (!yyerrstatus)
2235
    {
2236
      ++yynerrs;
2237
#if YYERROR_VERBOSE
2238
      yyn = yypact[yystate];
2239
 
2240
      if (YYPACT_NINF < yyn && yyn < YYLAST)
2241
        {
2242
          YYSIZE_T yysize = 0;
2243
          int yytype = YYTRANSLATE (yychar);
2244
          const char* yyprefix;
2245
          char *yymsg;
2246
          int yyx;
2247
 
2248
          /* Start YYX at -YYN if negative to avoid negative indexes in
2249
             YYCHECK.  */
2250
          int yyxbegin = yyn < 0 ? -yyn : 0;
2251
 
2252
          /* Stay within bounds of both yycheck and yytname.  */
2253
          int yychecklim = YYLAST - yyn;
2254
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2255
          int yycount = 0;
2256
 
2257
          yyprefix = ", expecting ";
2258
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2259
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2260
              {
2261
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2262
                yycount += 1;
2263
                if (yycount == 5)
2264
                  {
2265
                    yysize = 0;
2266
                    break;
2267
                  }
2268
              }
2269
          yysize += (sizeof ("syntax error, unexpected ")
2270
                     + yystrlen (yytname[yytype]));
2271
          yymsg = (char *) YYSTACK_ALLOC (yysize);
2272
          if (yymsg != 0)
2273
            {
2274
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2275
              yyp = yystpcpy (yyp, yytname[yytype]);
2276
 
2277
              if (yycount < 5)
2278
                {
2279
                  yyprefix = ", expecting ";
2280
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2281
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2282
                      {
2283
                        yyp = yystpcpy (yyp, yyprefix);
2284
                        yyp = yystpcpy (yyp, yytname[yyx]);
2285
                        yyprefix = " or ";
2286
                      }
2287
                }
2288
              yyerror (yymsg);
2289
              YYSTACK_FREE (yymsg);
2290
            }
2291
          else
2292
            yyerror ("syntax error; also virtual memory exhausted");
2293
        }
2294
      else
2295
#endif /* YYERROR_VERBOSE */
2296
        yyerror ("syntax error");
2297
    }
2298
 
2299
 
2300
 
2301
  if (yyerrstatus == 3)
2302
    {
2303
      /* If just tried and failed to reuse lookahead token after an
2304
         error, discard it.  */
2305
 
2306
      if (yychar <= YYEOF)
2307
        {
2308
          /* If at end of input, pop the error token,
2309
             then the rest of the stack, then return failure.  */
2310
          if (yychar == YYEOF)
2311
             for (;;)
2312
               {
2313
                 YYPOPSTACK;
2314
                 if (yyssp == yyss)
2315
                   YYABORT;
2316
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2317
                 yydestruct (yystos[*yyssp], yyvsp);
2318
               }
2319
        }
2320
      else
2321
        {
2322
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2323
          yydestruct (yytoken, &yylval);
2324
          yychar = YYEMPTY;
2325
 
2326
        }
2327
    }
2328
 
2329
  /* Else will try to reuse lookahead token after shifting the error
2330
     token.  */
2331
  goto yyerrlab1;
2332
 
2333
 
2334
/*---------------------------------------------------.
2335
| yyerrorlab -- error raised explicitly by YYERROR.  |
2336
`---------------------------------------------------*/
2337
yyerrorlab:
2338
 
2339
#ifdef __GNUC__
2340
  /* Pacify GCC when the user code never invokes YYERROR and the label
2341
     yyerrorlab therefore never appears in user code.  */
2342
  if (0)
2343
     goto yyerrorlab;
2344
#endif
2345
 
2346
  yyvsp -= yylen;
2347
  yyssp -= yylen;
2348
  yystate = *yyssp;
2349
  goto yyerrlab1;
2350
 
2351
 
2352
/*-------------------------------------------------------------.
2353
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2354
`-------------------------------------------------------------*/
2355
yyerrlab1:
2356
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2357
 
2358
  for (;;)
2359
    {
2360
      yyn = yypact[yystate];
2361
      if (yyn != YYPACT_NINF)
2362
        {
2363
          yyn += YYTERROR;
2364
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2365
            {
2366
              yyn = yytable[yyn];
2367
              if (0 < yyn)
2368
                break;
2369
            }
2370
        }
2371
 
2372
      /* Pop the current state because it cannot handle the error token.  */
2373
      if (yyssp == yyss)
2374
        YYABORT;
2375
 
2376
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2377
      yydestruct (yystos[yystate], yyvsp);
2378
      YYPOPSTACK;
2379
      yystate = *yyssp;
2380
      YY_STACK_PRINT (yyss, yyssp);
2381
    }
2382
 
2383
  if (yyn == YYFINAL)
2384
    YYACCEPT;
2385
 
2386
  YYDPRINTF ((stderr, "Shifting error token, "));
2387
 
2388
  *++yyvsp = yylval;
2389
 
2390
 
2391
  yystate = yyn;
2392
  goto yynewstate;
2393
 
2394
 
2395
/*-------------------------------------.
2396
| yyacceptlab -- YYACCEPT comes here.  |
2397
`-------------------------------------*/
2398
yyacceptlab:
2399
  yyresult = 0;
2400
  goto yyreturn;
2401
 
2402
/*-----------------------------------.
2403
| yyabortlab -- YYABORT comes here.  |
2404
`-----------------------------------*/
2405
yyabortlab:
2406
  yyresult = 1;
2407
  goto yyreturn;
2408
 
2409
#ifndef yyoverflow
2410
/*----------------------------------------------.
2411
| yyoverflowlab -- parser overflow comes here.  |
2412
`----------------------------------------------*/
2413
yyoverflowlab:
2414
  yyerror ("parser stack overflow");
2415
  yyresult = 2;
2416
  /* Fall through.  */
2417
#endif
2418
 
2419
yyreturn:
2420
#ifndef yyoverflow
2421
  if (yyss != yyssa)
2422
    YYSTACK_FREE (yyss);
2423
#endif
2424
  return yyresult;
2425
}
2426
 
2427
 
2428
#line 740 "ada-exp.y"
2429
 
2430
 
2431
/* yylex defined in ada-lex.c: Reads one token, getting characters */
2432
/* through lexptr.  */
2433
 
2434
/* Remap normal flex interface names (yylex) as well as gratuitiously */
2435
/* global symbol names, so we can have multiple flex-generated parsers */
2436
/* in gdb.  */
2437
 
2438
/* (See note above on previous definitions for YACC.) */
2439
 
2440
#define yy_create_buffer ada_yy_create_buffer
2441
#define yy_delete_buffer ada_yy_delete_buffer
2442
#define yy_init_buffer ada_yy_init_buffer
2443
#define yy_load_buffer_state ada_yy_load_buffer_state
2444
#define yy_switch_to_buffer ada_yy_switch_to_buffer
2445
#define yyrestart ada_yyrestart
2446
#define yytext ada_yytext
2447
#define yywrap ada_yywrap
2448
 
2449
static struct obstack temp_parse_space;
2450
 
2451
/* The following kludge was found necessary to prevent conflicts between */
2452
/* defs.h and non-standard stdlib.h files.  */
2453
#define qsort __qsort__dummy
2454
#include "ada-lex.c"
2455
 
2456
int
2457
ada_parse (void)
2458
{
2459
  lexer_init (yyin);            /* (Re-)initialize lexer.  */
2460
  type_qualifier = NULL;
2461
  obstack_free (&temp_parse_space, NULL);
2462
  obstack_init (&temp_parse_space);
2463
 
2464
  return _ada_parse ();
2465
}
2466
 
2467
void
2468
yyerror (char *msg)
2469
{
2470
  error (_("Error in expression, near `%s'."), lexptr);
2471
}
2472
 
2473
/* The operator name corresponding to operator symbol STRING (adds
2474
   quotes and maps to lower-case).  Destroys the previous contents of
2475
   the array pointed to by STRING.ptr.  Error if STRING does not match
2476
   a valid Ada operator.  Assumes that STRING.ptr points to a
2477
   null-terminated string and that, if STRING is a valid operator
2478
   symbol, the array pointed to by STRING.ptr contains at least
2479
   STRING.length+3 characters.  */
2480
 
2481
static struct stoken
2482
string_to_operator (struct stoken string)
2483
{
2484
  int i;
2485
 
2486
  for (i = 0; ada_opname_table[i].encoded != NULL; i += 1)
2487
    {
2488
      if (string.length == strlen (ada_opname_table[i].decoded)-2
2489
          && strncasecmp (string.ptr, ada_opname_table[i].decoded+1,
2490
                          string.length) == 0)
2491
        {
2492
          strncpy (string.ptr, ada_opname_table[i].decoded,
2493
                   string.length+2);
2494
          string.length += 2;
2495
          return string;
2496
        }
2497
    }
2498
  error (_("Invalid operator symbol `%s'"), string.ptr);
2499
}
2500
 
2501
/* Emit expression to access an instance of SYM, in block BLOCK (if
2502
 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT.  */
2503
static void
2504
write_var_from_sym (struct block *orig_left_context,
2505
                    struct block *block,
2506
                    struct symbol *sym)
2507
{
2508
  if (orig_left_context == NULL && symbol_read_needs_frame (sym))
2509
    {
2510
      if (innermost_block == 0
2511
          || contained_in (block, innermost_block))
2512
        innermost_block = block;
2513
    }
2514
 
2515
  write_exp_elt_opcode (OP_VAR_VALUE);
2516
  write_exp_elt_block (block);
2517
  write_exp_elt_sym (sym);
2518
  write_exp_elt_opcode (OP_VAR_VALUE);
2519
}
2520
 
2521
/* Write integer or boolean constant ARG of type TYPE.  */
2522
 
2523
static void
2524
write_int (LONGEST arg, struct type *type)
2525
{
2526
  write_exp_elt_opcode (OP_LONG);
2527
  write_exp_elt_type (type);
2528
  write_exp_elt_longcst (arg);
2529
  write_exp_elt_opcode (OP_LONG);
2530
}
2531
 
2532
/* Write an OPCODE, string, OPCODE sequence to the current expression.  */
2533
static void
2534
write_exp_op_with_string (enum exp_opcode opcode, struct stoken token)
2535
{
2536
  write_exp_elt_opcode (opcode);
2537
  write_exp_string (token);
2538
  write_exp_elt_opcode (opcode);
2539
}
2540
 
2541
/* Emit expression corresponding to the renamed object named
2542
 * designated by RENAMED_ENTITY[0 .. RENAMED_ENTITY_LEN-1] in the
2543
 * context of ORIG_LEFT_CONTEXT, to which is applied the operations
2544
 * encoded by RENAMING_EXPR.  MAX_DEPTH is the maximum number of
2545
 * cascaded renamings to allow.  If ORIG_LEFT_CONTEXT is null, it
2546
 * defaults to the currently selected block. ORIG_SYMBOL is the
2547
 * symbol that originally encoded the renaming.  It is needed only
2548
 * because its prefix also qualifies any index variables used to index
2549
 * or slice an array.  It should not be necessary once we go to the
2550
 * new encoding entirely (FIXME pnh 7/20/2007).  */
2551
 
2552
static void
2553
write_object_renaming (struct block *orig_left_context,
2554
                       const char *renamed_entity, int renamed_entity_len,
2555
                       const char *renaming_expr, int max_depth)
2556
{
2557
  char *name;
2558
  enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
2559
  struct symbol *sym;
2560
  struct block *block;
2561
 
2562
  if (max_depth <= 0)
2563
    error (_("Could not find renamed symbol"));
2564
 
2565
  if (orig_left_context == NULL)
2566
    orig_left_context = get_selected_block (NULL);
2567
 
2568
  name = obsavestring (renamed_entity, renamed_entity_len, &temp_parse_space);
2569
  sym = ada_lookup_encoded_symbol (name, orig_left_context, VAR_DOMAIN,
2570
                                   &block);
2571
  if (sym == NULL)
2572
    error (_("Could not find renamed variable: %s"), ada_decode (name));
2573
  else if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2574
    /* We have a renaming of an old-style renaming symbol.  Don't
2575
       trust the block information.  */
2576
    block = orig_left_context;
2577
 
2578
  {
2579
    const char *inner_renamed_entity;
2580
    int inner_renamed_entity_len;
2581
    const char *inner_renaming_expr;
2582
 
2583
    switch (ada_parse_renaming (sym, &inner_renamed_entity,
2584
                                &inner_renamed_entity_len,
2585
                                &inner_renaming_expr))
2586
      {
2587
      case ADA_NOT_RENAMING:
2588
        write_var_from_sym (orig_left_context, block, sym);
2589
        break;
2590
      case ADA_OBJECT_RENAMING:
2591
        write_object_renaming (block,
2592
                               inner_renamed_entity, inner_renamed_entity_len,
2593
                               inner_renaming_expr, max_depth - 1);
2594
        break;
2595
      default:
2596
        goto BadEncoding;
2597
      }
2598
  }
2599
 
2600
  slice_state = SIMPLE_INDEX;
2601
  while (*renaming_expr == 'X')
2602
    {
2603
      renaming_expr += 1;
2604
 
2605
      switch (*renaming_expr) {
2606
      case 'A':
2607
        renaming_expr += 1;
2608
        write_exp_elt_opcode (UNOP_IND);
2609
        break;
2610
      case 'L':
2611
        slice_state = LOWER_BOUND;
2612
      case 'S':
2613
        renaming_expr += 1;
2614
        if (isdigit (*renaming_expr))
2615
          {
2616
            char *next;
2617
            long val = strtol (renaming_expr, &next, 10);
2618
            if (next == renaming_expr)
2619
              goto BadEncoding;
2620
            renaming_expr = next;
2621
            write_exp_elt_opcode (OP_LONG);
2622
            write_exp_elt_type (type_int ());
2623
            write_exp_elt_longcst ((LONGEST) val);
2624
            write_exp_elt_opcode (OP_LONG);
2625
          }
2626
        else
2627
          {
2628
            const char *end;
2629
            char *index_name;
2630
            struct symbol *index_sym;
2631
 
2632
            end = strchr (renaming_expr, 'X');
2633
            if (end == NULL)
2634
              end = renaming_expr + strlen (renaming_expr);
2635
 
2636
            index_name =
2637
              obsavestring (renaming_expr, end - renaming_expr,
2638
                            &temp_parse_space);
2639
            renaming_expr = end;
2640
 
2641
            index_sym = ada_lookup_encoded_symbol (index_name, NULL,
2642
                                                   VAR_DOMAIN, &block);
2643
            if (index_sym == NULL)
2644
              error (_("Could not find %s"), index_name);
2645
            else if (SYMBOL_CLASS (index_sym) == LOC_TYPEDEF)
2646
              /* Index is an old-style renaming symbol.  */
2647
              block = orig_left_context;
2648
            write_var_from_sym (NULL, block, index_sym);
2649
          }
2650
        if (slice_state == SIMPLE_INDEX)
2651
          {
2652
            write_exp_elt_opcode (OP_FUNCALL);
2653
            write_exp_elt_longcst ((LONGEST) 1);
2654
            write_exp_elt_opcode (OP_FUNCALL);
2655
          }
2656
        else if (slice_state == LOWER_BOUND)
2657
          slice_state = UPPER_BOUND;
2658
        else if (slice_state == UPPER_BOUND)
2659
          {
2660
            write_exp_elt_opcode (TERNOP_SLICE);
2661
            slice_state = SIMPLE_INDEX;
2662
          }
2663
        break;
2664
 
2665
      case 'R':
2666
        {
2667
          struct stoken field_name;
2668
          const char *end;
2669
          renaming_expr += 1;
2670
 
2671
          if (slice_state != SIMPLE_INDEX)
2672
            goto BadEncoding;
2673
          end = strchr (renaming_expr, 'X');
2674
          if (end == NULL)
2675
            end = renaming_expr + strlen (renaming_expr);
2676
          field_name.length = end - renaming_expr;
2677
          field_name.ptr = xmalloc (end - renaming_expr + 1);
2678
          strncpy (field_name.ptr, renaming_expr, end - renaming_expr);
2679
          field_name.ptr[end - renaming_expr] = '\000';
2680
          renaming_expr = end;
2681
          write_exp_op_with_string (STRUCTOP_STRUCT, field_name);
2682
          break;
2683
        }
2684
 
2685
      default:
2686
        goto BadEncoding;
2687
      }
2688
    }
2689
  if (slice_state == SIMPLE_INDEX)
2690
    return;
2691
 
2692
 BadEncoding:
2693
  error (_("Internal error in encoding of renaming declaration"));
2694
}
2695
 
2696
static struct block*
2697
block_lookup (struct block *context, char *raw_name)
2698
{
2699
  char *name;
2700
  struct ada_symbol_info *syms;
2701
  int nsyms;
2702
  struct symtab *symtab;
2703
 
2704
  if (raw_name[0] == '\'')
2705
    {
2706
      raw_name += 1;
2707
      name = raw_name;
2708
    }
2709
  else
2710
    name = ada_encode (raw_name);
2711
 
2712
  nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms);
2713
  if (context == NULL
2714
      && (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK))
2715
    symtab = lookup_symtab (name);
2716
  else
2717
    symtab = NULL;
2718
 
2719
  if (symtab != NULL)
2720
    return BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
2721
  else if (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK)
2722
    {
2723
      if (context == NULL)
2724
        error (_("No file or function \"%s\"."), raw_name);
2725
      else
2726
        error (_("No function \"%s\" in specified context."), raw_name);
2727
    }
2728
  else
2729
    {
2730
      if (nsyms > 1)
2731
        warning (_("Function name \"%s\" ambiguous here"), raw_name);
2732
      return SYMBOL_BLOCK_VALUE (syms[0].sym);
2733
    }
2734
}
2735
 
2736
static struct symbol*
2737
select_possible_type_sym (struct ada_symbol_info *syms, int nsyms)
2738
{
2739
  int i;
2740
  int preferred_index;
2741
  struct type *preferred_type;
2742
 
2743
  preferred_index = -1; preferred_type = NULL;
2744
  for (i = 0; i < nsyms; i += 1)
2745
    switch (SYMBOL_CLASS (syms[i].sym))
2746
      {
2747
      case LOC_TYPEDEF:
2748
        if (ada_prefer_type (SYMBOL_TYPE (syms[i].sym), preferred_type))
2749
          {
2750
            preferred_index = i;
2751
            preferred_type = SYMBOL_TYPE (syms[i].sym);
2752
          }
2753
        break;
2754
      case LOC_REGISTER:
2755
      case LOC_ARG:
2756
      case LOC_REF_ARG:
2757
      case LOC_REGPARM_ADDR:
2758
      case LOC_LOCAL:
2759
      case LOC_COMPUTED:
2760
        return NULL;
2761
      default:
2762
        break;
2763
      }
2764
  if (preferred_type == NULL)
2765
    return NULL;
2766
  return syms[preferred_index].sym;
2767
}
2768
 
2769
static struct type*
2770
find_primitive_type (char *name)
2771
{
2772
  struct type *type;
2773
  type = language_lookup_primitive_type_by_name (parse_language,
2774
                                                 parse_gdbarch,
2775
                                                 name);
2776
  if (type == NULL && strcmp ("system__address", name) == 0)
2777
    type = type_system_address ();
2778
 
2779
  if (type != NULL)
2780
    {
2781
      /* Check to see if we have a regular definition of this
2782
         type that just didn't happen to have been read yet.  */
2783
      int ntypes;
2784
      struct symbol *sym;
2785
      char *expanded_name =
2786
        (char *) alloca (strlen (name) + sizeof ("standard__"));
2787
      strcpy (expanded_name, "standard__");
2788
      strcat (expanded_name, name);
2789
      sym = ada_lookup_symbol (expanded_name, NULL, VAR_DOMAIN, NULL);
2790
      if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2791
        type = SYMBOL_TYPE (sym);
2792
    }
2793
 
2794
  return type;
2795
}
2796
 
2797
static int
2798
chop_selector (char *name, int end)
2799
{
2800
  int i;
2801
  for (i = end - 1; i > 0; i -= 1)
2802
    if (name[i] == '.' || (name[i] == '_' && name[i+1] == '_'))
2803
      return i;
2804
  return -1;
2805
}
2806
 
2807
/* If NAME is a string beginning with a separator (either '__', or
2808
   '.'), chop this separator and return the result; else, return
2809
   NAME.  */
2810
 
2811
static char *
2812
chop_separator (char *name)
2813
{
2814
  if (*name == '.')
2815
   return name + 1;
2816
 
2817
  if (name[0] == '_' && name[1] == '_')
2818
    return name + 2;
2819
 
2820
  return name;
2821
}
2822
 
2823
/* Given that SELS is a string of the form (<sep><identifier>)*, where
2824
   <sep> is '__' or '.', write the indicated sequence of
2825
   STRUCTOP_STRUCT expression operators. */
2826
static void
2827
write_selectors (char *sels)
2828
{
2829
  while (*sels != '\0')
2830
    {
2831
      struct stoken field_name;
2832
      char *p = chop_separator (sels);
2833
      sels = p;
2834
      while (*sels != '\0' && *sels != '.'
2835
             && (sels[0] != '_' || sels[1] != '_'))
2836
        sels += 1;
2837
      field_name.length = sels - p;
2838
      field_name.ptr = p;
2839
      write_exp_op_with_string (STRUCTOP_STRUCT, field_name);
2840
    }
2841
}
2842
 
2843
/* Write a variable access (OP_VAR_VALUE) to ambiguous encoded name
2844
   NAME[0..LEN-1], in block context BLOCK, to be resolved later.  Writes
2845
   a temporary symbol that is valid until the next call to ada_parse.
2846
   */
2847
static void
2848
write_ambiguous_var (struct block *block, char *name, int len)
2849
{
2850
  struct symbol *sym =
2851
    obstack_alloc (&temp_parse_space, sizeof (struct symbol));
2852
  memset (sym, 0, sizeof (struct symbol));
2853
  SYMBOL_DOMAIN (sym) = UNDEF_DOMAIN;
2854
  SYMBOL_LINKAGE_NAME (sym) = obsavestring (name, len, &temp_parse_space);
2855
  SYMBOL_LANGUAGE (sym) = language_ada;
2856
 
2857
  write_exp_elt_opcode (OP_VAR_VALUE);
2858
  write_exp_elt_block (block);
2859
  write_exp_elt_sym (sym);
2860
  write_exp_elt_opcode (OP_VAR_VALUE);
2861
}
2862
 
2863
/* A convenient wrapper around ada_get_field_index that takes
2864
   a non NUL-terminated FIELD_NAME0 and a FIELD_NAME_LEN instead
2865
   of a NUL-terminated field name.  */
2866
 
2867
static int
2868
ada_nget_field_index (const struct type *type, const char *field_name0,
2869
                      int field_name_len, int maybe_missing)
2870
{
2871
  char *field_name = alloca ((field_name_len + 1) * sizeof (char));
2872
 
2873
  strncpy (field_name, field_name0, field_name_len);
2874
  field_name[field_name_len] = '\0';
2875
  return ada_get_field_index (type, field_name, maybe_missing);
2876
}
2877
 
2878
/* If encoded_field_name is the name of a field inside symbol SYM,
2879
   then return the type of that field.  Otherwise, return NULL.
2880
 
2881
   This function is actually recursive, so if ENCODED_FIELD_NAME
2882
   doesn't match one of the fields of our symbol, then try to see
2883
   if ENCODED_FIELD_NAME could not be a succession of field names
2884
   (in other words, the user entered an expression of the form
2885
   TYPE_NAME.FIELD1.FIELD2.FIELD3), in which case we evaluate
2886
   each field name sequentially to obtain the desired field type.
2887
   In case of failure, we return NULL.  */
2888
 
2889
static struct type *
2890
get_symbol_field_type (struct symbol *sym, char *encoded_field_name)
2891
{
2892
  char *field_name = encoded_field_name;
2893
  char *subfield_name;
2894
  struct type *type = SYMBOL_TYPE (sym);
2895
  int fieldno;
2896
 
2897
  if (type == NULL || field_name == NULL)
2898
    return NULL;
2899
  type = check_typedef (type);
2900
 
2901
  while (field_name[0] != '\0')
2902
    {
2903
      field_name = chop_separator (field_name);
2904
 
2905
      fieldno = ada_get_field_index (type, field_name, 1);
2906
      if (fieldno >= 0)
2907
        return TYPE_FIELD_TYPE (type, fieldno);
2908
 
2909
      subfield_name = field_name;
2910
      while (*subfield_name != '\0' && *subfield_name != '.'
2911
             && (subfield_name[0] != '_' || subfield_name[1] != '_'))
2912
        subfield_name += 1;
2913
 
2914
      if (subfield_name[0] == '\0')
2915
        return NULL;
2916
 
2917
      fieldno = ada_nget_field_index (type, field_name,
2918
                                      subfield_name - field_name, 1);
2919
      if (fieldno < 0)
2920
        return NULL;
2921
 
2922
      type = TYPE_FIELD_TYPE (type, fieldno);
2923
      field_name = subfield_name;
2924
    }
2925
 
2926
  return NULL;
2927
}
2928
 
2929
/* Look up NAME0 (an unencoded identifier or dotted name) in BLOCK (or
2930
   expression_block_context if NULL).  If it denotes a type, return
2931
   that type.  Otherwise, write expression code to evaluate it as an
2932
   object and return NULL. In this second case, NAME0 will, in general,
2933
   have the form <name>(.<selector_name>)*, where <name> is an object
2934
   or renaming encoded in the debugging data.  Calls error if no
2935
   prefix <name> matches a name in the debugging data (i.e., matches
2936
   either a complete name or, as a wild-card match, the final
2937
   identifier).  */
2938
 
2939
static struct type*
2940
write_var_or_type (struct block *block, struct stoken name0)
2941
{
2942
  int depth;
2943
  char *encoded_name;
2944
  int name_len;
2945
 
2946
  if (block == NULL)
2947
    block = expression_context_block;
2948
 
2949
  encoded_name = ada_encode (name0.ptr);
2950
  name_len = strlen (encoded_name);
2951
  encoded_name = obsavestring (encoded_name, name_len, &temp_parse_space);
2952
  for (depth = 0; depth < MAX_RENAMING_CHAIN_LENGTH; depth += 1)
2953
    {
2954
      int tail_index;
2955
 
2956
      tail_index = name_len;
2957
      while (tail_index > 0)
2958
        {
2959
          int nsyms;
2960
          struct ada_symbol_info *syms;
2961
          struct symbol *type_sym;
2962
          struct symbol *renaming_sym;
2963
          const char* renaming;
2964
          int renaming_len;
2965
          const char* renaming_expr;
2966
          int terminator = encoded_name[tail_index];
2967
 
2968
          encoded_name[tail_index] = '\0';
2969
          nsyms = ada_lookup_symbol_list (encoded_name, block,
2970
                                          VAR_DOMAIN, &syms);
2971
          encoded_name[tail_index] = terminator;
2972
 
2973
          /* A single symbol may rename a package or object. */
2974
 
2975
          /* This should go away when we move entirely to new version.
2976
             FIXME pnh 7/20/2007. */
2977
          if (nsyms == 1)
2978
            {
2979
              struct symbol *renaming =
2980
                ada_find_renaming_symbol (SYMBOL_LINKAGE_NAME (syms[0].sym),
2981
                                          syms[0].block);
2982
 
2983
              if (renaming != NULL)
2984
                syms[0].sym = renaming;
2985
            }
2986
 
2987
          type_sym = select_possible_type_sym (syms, nsyms);
2988
 
2989
          if (type_sym != NULL)
2990
            renaming_sym = type_sym;
2991
          else if (nsyms == 1)
2992
            renaming_sym = syms[0].sym;
2993
          else
2994
            renaming_sym = NULL;
2995
 
2996
          switch (ada_parse_renaming (renaming_sym, &renaming,
2997
                                      &renaming_len, &renaming_expr))
2998
            {
2999
            case ADA_NOT_RENAMING:
3000
              break;
3001
            case ADA_PACKAGE_RENAMING:
3002
            case ADA_EXCEPTION_RENAMING:
3003
            case ADA_SUBPROGRAM_RENAMING:
3004
              {
3005
                char *new_name
3006
                  = obstack_alloc (&temp_parse_space,
3007
                                   renaming_len + name_len - tail_index + 1);
3008
                strncpy (new_name, renaming, renaming_len);
3009
                strcpy (new_name + renaming_len, encoded_name + tail_index);
3010
                encoded_name = new_name;
3011
                name_len = renaming_len + name_len - tail_index;
3012
                goto TryAfterRenaming;
3013
              }
3014
            case ADA_OBJECT_RENAMING:
3015
              write_object_renaming (block, renaming, renaming_len,
3016
                                     renaming_expr, MAX_RENAMING_CHAIN_LENGTH);
3017
              write_selectors (encoded_name + tail_index);
3018
              return NULL;
3019
            default:
3020
              internal_error (__FILE__, __LINE__,
3021
                              _("impossible value from ada_parse_renaming"));
3022
            }
3023
 
3024
          if (type_sym != NULL)
3025
            {
3026
              struct type *field_type;
3027
 
3028
              if (tail_index == name_len)
3029
                return SYMBOL_TYPE (type_sym);
3030
 
3031
              /* We have some extraneous characters after the type name.
3032
                 If this is an expression "TYPE_NAME.FIELD0.[...].FIELDN",
3033
                 then try to get the type of FIELDN.  */
3034
              field_type
3035
                = get_symbol_field_type (type_sym, encoded_name + tail_index);
3036
              if (field_type != NULL)
3037
                return field_type;
3038
              else
3039
                error (_("Invalid attempt to select from type: \"%s\"."),
3040
                       name0.ptr);
3041
            }
3042
          else if (tail_index == name_len && nsyms == 0)
3043
            {
3044
              struct type *type = find_primitive_type (encoded_name);
3045
 
3046
              if (type != NULL)
3047
                return type;
3048
            }
3049
 
3050
          if (nsyms == 1)
3051
            {
3052
              write_var_from_sym (block, syms[0].block, syms[0].sym);
3053
              write_selectors (encoded_name + tail_index);
3054
              return NULL;
3055
            }
3056
          else if (nsyms == 0)
3057
            {
3058
              int i;
3059
              struct minimal_symbol *msym
3060
                = ada_lookup_simple_minsym (encoded_name);
3061
              if (msym != NULL)
3062
                {
3063
                  write_exp_msymbol (msym);
3064
                  /* Maybe cause error here rather than later? FIXME? */
3065
                  write_selectors (encoded_name + tail_index);
3066
                  return NULL;
3067
                }
3068
 
3069
              if (tail_index == name_len
3070
                  && strncmp (encoded_name, "standard__",
3071
                              sizeof ("standard__") - 1) == 0)
3072
                error (_("No definition of \"%s\" found."), name0.ptr);
3073
 
3074
              tail_index = chop_selector (encoded_name, tail_index);
3075
            }
3076
          else
3077
            {
3078
              write_ambiguous_var (block, encoded_name, tail_index);
3079
              write_selectors (encoded_name + tail_index);
3080
              return NULL;
3081
            }
3082
        }
3083
 
3084
      if (!have_full_symbols () && !have_partial_symbols () && block == NULL)
3085
        error (_("No symbol table is loaded.  Use the \"file\" command."));
3086
      if (block == expression_context_block)
3087
        error (_("No definition of \"%s\" in current context."), name0.ptr);
3088
      else
3089
        error (_("No definition of \"%s\" in specified context."), name0.ptr);
3090
 
3091
    TryAfterRenaming: ;
3092
    }
3093
 
3094
  error (_("Could not find renamed symbol \"%s\""), name0.ptr);
3095
 
3096
}
3097
 
3098
/* Write a left side of a component association (e.g., NAME in NAME =>
3099
   exp).  If NAME has the form of a selected component, write it as an
3100
   ordinary expression.  If it is a simple variable that unambiguously
3101
   corresponds to exactly one symbol that does not denote a type or an
3102
   object renaming, also write it normally as an OP_VAR_VALUE.
3103
   Otherwise, write it as an OP_NAME.
3104
 
3105
   Unfortunately, we don't know at this point whether NAME is supposed
3106
   to denote a record component name or the value of an array index.
3107
   Therefore, it is not appropriate to disambiguate an ambiguous name
3108
   as we normally would, nor to replace a renaming with its referent.
3109
   As a result, in the (one hopes) rare case that one writes an
3110
   aggregate such as (R => 42) where R renames an object or is an
3111
   ambiguous name, one must write instead ((R) => 42). */
3112
 
3113
static void
3114
write_name_assoc (struct stoken name)
3115
{
3116
  if (strchr (name.ptr, '.') == NULL)
3117
    {
3118
      struct ada_symbol_info *syms;
3119
      int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
3120
                                          VAR_DOMAIN, &syms);
3121
      if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF)
3122
        write_exp_op_with_string (OP_NAME, name);
3123
      else
3124
        write_var_from_sym (NULL, syms[0].block, syms[0].sym);
3125
    }
3126
  else
3127
    if (write_var_or_type (NULL, name) != NULL)
3128
      error (_("Invalid use of type."));
3129
}
3130
 
3131
/* Convert the character literal whose ASCII value would be VAL to the
3132
   appropriate value of type TYPE, if there is a translation.
3133
   Otherwise return VAL.  Hence, in an enumeration type ('A', 'B'),
3134
   the literal 'A' (VAL == 65), returns 0.  */
3135
 
3136
static LONGEST
3137
convert_char_literal (struct type *type, LONGEST val)
3138
{
3139
  char name[7];
3140
  int f;
3141
 
3142
  if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM)
3143
    return val;
3144
  xsnprintf (name, sizeof (name), "QU%02x", (int) val);
3145
  for (f = 0; f < TYPE_NFIELDS (type); f += 1)
3146
    {
3147
      if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0)
3148
        return TYPE_FIELD_BITPOS (type, f);
3149
    }
3150
  return val;
3151
}
3152
 
3153
static struct type *
3154
type_int (void)
3155
{
3156
  return parse_type->builtin_int;
3157
}
3158
 
3159
static struct type *
3160
type_long (void)
3161
{
3162
  return parse_type->builtin_long;
3163
}
3164
 
3165
static struct type *
3166
type_long_long (void)
3167
{
3168
  return parse_type->builtin_long_long;
3169
}
3170
 
3171
static struct type *
3172
type_float (void)
3173
{
3174
  return parse_type->builtin_float;
3175
}
3176
 
3177
static struct type *
3178
type_double (void)
3179
{
3180
  return parse_type->builtin_double;
3181
}
3182
 
3183
static struct type *
3184
type_long_double (void)
3185
{
3186
  return parse_type->builtin_long_double;
3187
}
3188
 
3189
static struct type *
3190
type_char (void)
3191
{
3192
  return language_string_char_type (parse_language, parse_gdbarch);
3193
}
3194
 
3195
static struct type *
3196
type_boolean (void)
3197
{
3198
  return parse_type->builtin_bool;
3199
}
3200
 
3201
static struct type *
3202
type_system_address (void)
3203
{
3204
  struct type *type
3205
    = language_lookup_primitive_type_by_name (parse_language,
3206
                                              parse_gdbarch,
3207
                                              "system__address");
3208
  return  type != NULL ? type : parse_type->builtin_data_ptr;
3209
}
3210
 
3211
/* Provide a prototype to silence -Wmissing-prototypes.  */
3212
extern initialize_file_ftype _initialize_ada_exp;
3213
 
3214
void
3215
_initialize_ada_exp (void)
3216
{
3217
  obstack_init (&temp_parse_space);
3218
}
3219
 
3220
/* FIXME: hilfingr/2004-10-05: Hack to remove warning.  The function
3221
   string_to_operator is supposed to be used for cases where one
3222
   calls an operator function with prefix notation, as in
3223
   "+" (a, b), but at some point, this code seems to have gone
3224
   missing. */
3225
 
3226
struct stoken (*dummy_string_to_ada_operator) (struct stoken)
3227
     = string_to_operator;
3228
 
3229
 

powered by: WebSVN 2.1.0

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