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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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