1/* A Bison parser, made by GNU Bison 1.875.  */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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     TYPENAME = 262,
61     BLOCKNAME = 263,
62     STRING = 264,
63     NAME = 265,
64     DOT_ID = 266,
65     OBJECT_RENAMING = 267,
66     DOT_ALL = 268,
67     LAST = 269,
68     REGNAME = 270,
69     INTERNAL_VARIABLE = 271,
70     ASSIGN = 272,
71     ELSE = 273,
72     THEN = 274,
73     XOR = 275,
74     OR = 276,
75     _AND_ = 277,
76     DOTDOT = 278,
77     IN = 279,
78     GEQ = 280,
79     LEQ = 281,
80     NOTEQUAL = 282,
81     UNARY = 283,
82     REM = 284,
83     MOD = 285,
84     NOT = 286,
85     ABS = 287,
86     STARSTAR = 288,
87     TICK_LENGTH = 289,
88     TICK_LAST = 290,
89     TICK_FIRST = 291,
90     TICK_ADDRESS = 292,
91     TICK_ACCESS = 293,
92     TICK_MODULUS = 294,
93     TICK_MIN = 295,
94     TICK_MAX = 296,
95     TICK_VAL = 297,
96     TICK_TAG = 298,
97     TICK_SIZE = 299,
98     TICK_RANGE = 300,
99     TICK_POS = 301,
100     ARROW = 302,
101     NEW = 303
102   };
103#endif
104#define INT 258
105#define NULL_PTR 259
106#define CHARLIT 260
107#define FLOAT 261
108#define TYPENAME 262
109#define BLOCKNAME 263
110#define STRING 264
111#define NAME 265
112#define DOT_ID 266
113#define OBJECT_RENAMING 267
114#define DOT_ALL 268
115#define LAST 269
116#define REGNAME 270
117#define INTERNAL_VARIABLE 271
118#define ASSIGN 272
119#define ELSE 273
120#define THEN 274
121#define XOR 275
122#define OR 276
123#define _AND_ 277
124#define DOTDOT 278
125#define IN 279
126#define GEQ 280
127#define LEQ 281
128#define NOTEQUAL 282
129#define UNARY 283
130#define REM 284
131#define MOD 285
132#define NOT 286
133#define ABS 287
134#define STARSTAR 288
135#define TICK_LENGTH 289
136#define TICK_LAST 290
137#define TICK_FIRST 291
138#define TICK_ADDRESS 292
139#define TICK_ACCESS 293
140#define TICK_MODULUS 294
141#define TICK_MIN 295
142#define TICK_MAX 296
143#define TICK_VAL 297
144#define TICK_TAG 298
145#define TICK_SIZE 299
146#define TICK_RANGE 300
147#define TICK_POS 301
148#define ARROW 302
149#define NEW 303
150
151
152
153
154/* Copy the first part of user declarations.  */
155#line 38 "ada-exp.y"
156
157
158#include "defs.h"
159#include <string.h>
160#include <ctype.h>
161#include "expression.h"
162#include "value.h"
163#include "parser-defs.h"
164#include "language.h"
165#include "ada-lang.h"
166#include "bfd.h" /* Required by objfiles.h.  */
167#include "symfile.h" /* Required by objfiles.h.  */
168#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
169#include "frame.h"
170#include "block.h"
171
172/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
173   as well as gratuitiously global symbol names, so we can have multiple
174   yacc generated parsers in gdb.  These are only the variables
175   produced by yacc.  If other parser generators (bison, byacc, etc) produce
176   additional global names that conflict at link time, then those parser
177   generators need to be fixed instead of adding those names to this list. */
178
179/* NOTE: This is clumsy, especially since BISON and FLEX provide --prefix
180   options.  I presume we are maintaining it to accommodate systems
181   without BISON?  (PNH) */
182
183#define	yymaxdepth ada_maxdepth
184#define	yyparse	_ada_parse	/* ada_parse calls this after  initialization */
185#define	yylex	ada_lex
186#define	yyerror	ada_error
187#define	yylval	ada_lval
188#define	yychar	ada_char
189#define	yydebug	ada_debug
190#define	yypact	ada_pact
191#define	yyr1	ada_r1
192#define	yyr2	ada_r2
193#define	yydef	ada_def
194#define	yychk	ada_chk
195#define	yypgo	ada_pgo
196#define	yyact	ada_act
197#define	yyexca	ada_exca
198#define yyerrflag ada_errflag
199#define yynerrs	ada_nerrs
200#define	yyps	ada_ps
201#define	yypv	ada_pv
202#define	yys	ada_s
203#define	yy_yys	ada_yys
204#define	yystate	ada_state
205#define	yytmp	ada_tmp
206#define	yyv	ada_v
207#define	yy_yyv	ada_yyv
208#define	yyval	ada_val
209#define	yylloc	ada_lloc
210#define yyreds	ada_reds		/* With YYDEBUG defined */
211#define yytoks	ada_toks		/* With YYDEBUG defined */
212#define yyname	ada_name		/* With YYDEBUG defined */
213#define yyrule	ada_rule		/* With YYDEBUG defined */
214
215#ifndef YYDEBUG
216#define	YYDEBUG	1		/* Default to yydebug support */
217#endif
218
219#define YYFPRINTF parser_fprintf
220
221struct name_info {
222  struct symbol* sym;
223  struct minimal_symbol* msym;
224  struct block* block;
225  struct stoken stoken;
226};
227
228/* If expression is in the context of TYPE'(...), then TYPE, else
229 * NULL. */
230static struct type* type_qualifier;
231
232int yyparse (void);
233
234static int yylex (void);
235
236void yyerror (char *);
237
238static struct stoken string_to_operator (struct stoken);
239
240static void write_attribute_call0 (enum ada_attribute);
241
242static void write_attribute_call1 (enum ada_attribute, LONGEST);
243
244static void write_attribute_calln (enum ada_attribute, int);
245
246static void write_object_renaming (struct block*, struct symbol*);
247
248static void write_var_from_name (struct block*, struct name_info);
249
250static LONGEST
251convert_char_literal (struct type*, LONGEST);
252
253
254/* Enabling traces.  */
255#ifndef YYDEBUG
256# define YYDEBUG 0
257#endif
258
259/* Enabling verbose error messages.  */
260#ifdef YYERROR_VERBOSE
261# undef YYERROR_VERBOSE
262# define YYERROR_VERBOSE 1
263#else
264# define YYERROR_VERBOSE 0
265#endif
266
267#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
268#line 137 "ada-exp.y"
269typedef union YYSTYPE {
270    LONGEST lval;
271    struct {
272      LONGEST val;
273      struct type *type;
274    } typed_val;
275    struct {
276      DOUBLEST dval;
277      struct type *type;
278    } typed_val_float;
279    struct type *tval;
280    struct stoken sval;
281    struct name_info ssym;
282    int voidval;
283    struct block *bval;
284    struct internalvar *ivar;
285
286  } YYSTYPE;
287/* Line 191 of yacc.c.  */
288# define yystype YYSTYPE /* obsolescent; will be withdrawn */
289# define YYSTYPE_IS_DECLARED 1
290# define YYSTYPE_IS_TRIVIAL 1
291#endif
292
293
294
295/* Copy the second part of user declarations.  */
296
297
298/* Line 214 of yacc.c.  */
299
300#if ! defined (yyoverflow) || YYERROR_VERBOSE
301
302/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
303
304# if YYSTACK_USE_ALLOCA
305#  define YYSTACK_ALLOC alloca
306# else
307#  ifndef YYSTACK_USE_ALLOCA
308#   if defined (alloca) || defined (_ALLOCA_H)
309#    define YYSTACK_ALLOC alloca
310#   else
311#    ifdef __GNUC__
312#     define YYSTACK_ALLOC __builtin_alloca
313#    endif
314#   endif
315#  endif
316# endif
317
318# ifdef YYSTACK_ALLOC
319   /* Pacify GCC's `empty if-body' warning. */
320#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
321# else
322#  if defined (__STDC__) || defined (__cplusplus)
323#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
324#   define YYSIZE_T size_t
325#  endif
326#  define YYSTACK_ALLOC xmalloc
327#  define YYSTACK_FREE free
328# endif
329#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
330
331
332#if (! defined (yyoverflow) \
333     && (! defined (__cplusplus) \
334	 || (YYSTYPE_IS_TRIVIAL)))
335
336/* A type that is properly aligned for any stack member.  */
337union yyalloc
338{
339  short yyss;
340  YYSTYPE yyvs;
341  };
342
343/* The size of the maximum gap between one aligned stack and the next.  */
344# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
345
346/* The size of an array large to enough to hold all stacks, each with
347   N elements.  */
348# define YYSTACK_BYTES(N) \
349     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
350      + YYSTACK_GAP_MAXIMUM)
351
352/* Copy COUNT objects from FROM to TO.  The source and destination do
353   not overlap.  */
354# ifndef YYCOPY
355#  if 1 < __GNUC__
356#   define YYCOPY(To, From, Count) \
357      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
358#  else
359#   define YYCOPY(To, From, Count)		\
360      do					\
361	{					\
362	  register YYSIZE_T yyi;		\
363	  for (yyi = 0; yyi < (Count); yyi++)	\
364	    (To)[yyi] = (From)[yyi];		\
365	}					\
366      while (0)
367#  endif
368# endif
369
370/* Relocate STACK from its old location to the new one.  The
371   local variables YYSIZE and YYSTACKSIZE give the old and new number of
372   elements in the stack, and YYPTR gives the new location of the
373   stack.  Advance YYPTR to a properly aligned location for the next
374   stack.  */
375# define YYSTACK_RELOCATE(Stack)					\
376    do									\
377      {									\
378	YYSIZE_T yynewbytes;						\
379	YYCOPY (&yyptr->Stack, Stack, yysize);				\
380	Stack = &yyptr->Stack;						\
381	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
382	yyptr += yynewbytes / sizeof (*yyptr);				\
383      }									\
384    while (0)
385
386#endif
387
388#if defined (__STDC__) || defined (__cplusplus)
389   typedef signed char yysigned_char;
390#else
391   typedef short yysigned_char;
392#endif
393
394/* YYFINAL -- State number of the termination state. */
395#define YYFINAL  44
396/* YYLAST -- Last index in YYTABLE.  */
397#define YYLAST   1067
398
399/* YYNTOKENS -- Number of terminals. */
400#define YYNTOKENS  68
401/* YYNNTS -- Number of nonterminals. */
402#define YYNNTS  15
403/* YYNRULES -- Number of rules. */
404#define YYNRULES  98
405/* YYNRULES -- Number of states. */
406#define YYNSTATES  184
407
408/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
409#define YYUNDEFTOK  2
410#define YYMAXUTOK   303
411
412#define YYTRANSLATE(YYX) 						\
413  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
414
415/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
416static const unsigned char yytranslate[] =
417{
418       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
419       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
420       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
421       2,     2,     2,     2,     2,     2,     2,     2,    34,    63,
422      57,    62,    36,    32,    64,    33,    56,    37,     2,     2,
423       2,     2,     2,     2,     2,     2,     2,     2,     2,    61,
424      24,    23,    25,     2,    31,     2,     2,     2,     2,     2,
425       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
426       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
427       2,    58,     2,    67,     2,     2,     2,     2,     2,     2,
428       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
429       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
430       2,     2,     2,    65,     2,    66,     2,     2,     2,     2,
431       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
432       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
433       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
434       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
435       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
436       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
437       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
438       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
439       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
441       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
443       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
444       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
445      15,    16,    17,    18,    19,    20,    21,    22,    26,    27,
446      28,    29,    30,    35,    38,    39,    40,    41,    42,    43,
447      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
448      54,    55,    59,    60
449};
450
451#if YYDEBUG
452/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
453   YYRHS.  */
454static const unsigned short yyprhs[] =
455{
456       0,     0,     3,     5,     7,     9,    13,    16,    19,    24,
457      29,    30,    38,    39,    46,    50,    52,    54,    56,    58,
458      60,    64,    67,    70,    73,    76,    77,    79,    83,    87,
459      93,    98,   102,   106,   110,   114,   118,   122,   126,   130,
460     134,   138,   142,   146,   152,   158,   162,   169,   176,   181,
461     185,   189,   193,   197,   202,   206,   211,   215,   218,   221,
462     225,   229,   233,   236,   239,   247,   255,   261,   265,   269,
463     273,   279,   282,   283,   287,   289,   291,   292,   294,   296,
464     298,   300,   302,   305,   307,   310,   312,   315,   317,   319,
465     321,   323,   326,   328,   331,   334,   338,   341,   344
466};
467
468/* YYRHS -- A `-1'-separated list of the rules' RHS. */
469static const yysigned_char yyrhs[] =
470{
471      69,     0,    -1,    70,    -1,    82,    -1,    74,    -1,    70,
472      61,    74,    -1,    71,    13,    -1,    71,    11,    -1,    71,
473      57,    75,    62,    -1,    82,    57,    74,    62,    -1,    -1,
474      82,    63,    73,    72,    57,    74,    62,    -1,    -1,    71,
475      57,    74,    26,    74,    62,    -1,    57,    70,    62,    -1,
476      79,    -1,    15,    -1,    16,    -1,    71,    -1,    14,    -1,
477      74,    17,    74,    -1,    33,    74,    -1,    32,    74,    -1,
478      40,    74,    -1,    41,    74,    -1,    -1,    74,    -1,    80,
479      59,    74,    -1,    75,    64,    74,    -1,    75,    64,    80,
480      59,    74,    -1,    65,    82,    66,    74,    -1,    74,    42,
481      74,    -1,    74,    36,    74,    -1,    74,    37,    74,    -1,
482      74,    38,    74,    -1,    74,    39,    74,    -1,    74,    31,
483      74,    -1,    74,    32,    74,    -1,    74,    34,    74,    -1,
484      74,    33,    74,    -1,    74,    23,    74,    -1,    74,    30,
485      74,    -1,    74,    29,    74,    -1,    74,    27,    74,    26,
486      74,    -1,    74,    27,    74,    54,    76,    -1,    74,    27,
487       7,    -1,    74,    40,    27,    74,    26,    74,    -1,    74,
488      40,    27,    74,    54,    76,    -1,    74,    40,    27,     7,
489      -1,    74,    28,    74,    -1,    74,    24,    74,    -1,    74,
490      25,    74,    -1,    74,    22,    74,    -1,    74,    22,    19,
491      74,    -1,    74,    21,    74,    -1,    74,    21,    18,    74,
492      -1,    74,    20,    74,    -1,    71,    47,    -1,    71,    46,
493      -1,    71,    45,    76,    -1,    71,    44,    76,    -1,    71,
494      43,    76,    -1,    71,    53,    -1,    71,    52,    -1,    78,
495      49,    57,    74,    64,    74,    62,    -1,    78,    50,    57,
496      74,    64,    74,    62,    -1,    78,    55,    57,    74,    62,
497      -1,    77,    45,    76,    -1,    77,    44,    76,    -1,    77,
498      43,    76,    -1,    77,    51,    57,    74,    62,    -1,    77,
499      48,    -1,    -1,    57,     3,    62,    -1,     7,    -1,    77,
500      -1,    -1,     3,    -1,     5,    -1,     6,    -1,     4,    -1,
501       9,    -1,    60,     7,    -1,    10,    -1,    81,    10,    -1,
502      12,    -1,    81,    12,    -1,    10,    -1,     7,    -1,    12,
503      -1,     8,    -1,    81,     8,    -1,     7,    -1,    81,     7,
504      -1,     7,    47,    -1,    81,     7,    47,    -1,    36,    74,
505      -1,    34,    74,    -1,    74,    58,    74,    67,    -1
506};
507
508/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
509static const unsigned short yyrline[] =
510{
511       0,   208,   208,   209,   215,   216,   221,   225,   232,   240,
512     248,   248,   259,   263,   267,   270,   273,   280,   288,   291,
513     298,   302,   306,   310,   314,   318,   321,   323,   325,   327,
514     331,   341,   345,   349,   353,   357,   361,   365,   369,   373,
515     377,   381,   385,   389,   393,   399,   406,   411,   419,   429,
516     433,   437,   441,   445,   449,   453,   457,   461,   463,   469,
517     471,   473,   475,   477,   479,   481,   483,   485,   487,   489,
518     491,   493,   497,   499,   504,   511,   513,   519,   527,   539,
519     547,   555,   582,   586,   587,   589,   590,   594,   595,   596,
520     599,   601,   606,   607,   608,   610,   617,   619,   621
521};
522#endif
523
524#if YYDEBUG || YYERROR_VERBOSE
525/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
526   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
527static const char *const yytname[] =
528{
529  "$end", "error", "$undefined", "INT", "NULL_PTR", "CHARLIT", "FLOAT",
530  "TYPENAME", "BLOCKNAME", "STRING", "NAME", "DOT_ID", "OBJECT_RENAMING",
531  "DOT_ALL", "LAST", "REGNAME", "INTERNAL_VARIABLE", "ASSIGN", "ELSE",
532  "THEN", "XOR", "OR", "_AND_", "'='", "'<'", "'>'", "DOTDOT", "IN",
533  "GEQ", "LEQ", "NOTEQUAL", "'@'", "'+'", "'-'", "'&'", "UNARY", "'*'",
534  "'/'", "REM", "MOD", "NOT", "ABS", "STARSTAR", "TICK_LENGTH",
535  "TICK_LAST", "TICK_FIRST", "TICK_ADDRESS", "TICK_ACCESS",
536  "TICK_MODULUS", "TICK_MIN", "TICK_MAX", "TICK_VAL", "TICK_TAG",
537  "TICK_SIZE", "TICK_RANGE", "TICK_POS", "'.'", "'('", "'['", "ARROW",
538  "NEW", "';'", "')'", "'''", "','", "'{'", "'}'", "']'", "$accept",
539  "start", "exp1", "simple_exp", "@1", "save_qualifier", "exp", "arglist",
540  "tick_arglist", "type_prefix", "opt_type_prefix", "variable",
541  "any_name", "block", "type", 0
542};
543#endif
544
545# ifdef YYPRINT
546/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
547   token YYLEX-NUM.  */
548static const unsigned short yytoknum[] =
549{
550       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
551     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
552     275,   276,   277,    61,    60,    62,   278,   279,   280,   281,
553     282,    64,    43,    45,    38,   283,    42,    47,   284,   285,
554     286,   287,   288,   289,   290,   291,   292,   293,   294,   295,
555     296,   297,   298,   299,   300,   301,    46,    40,    91,   302,
556     303,    59,    41,    39,    44,   123,   125,    93
557};
558# endif
559
560/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
561static const unsigned char yyr1[] =
562{
563       0,    68,    69,    69,    70,    70,    71,    71,    71,    71,
564      72,    71,    73,    71,    71,    71,    71,    71,    74,    71,
565      74,    74,    74,    74,    74,    75,    75,    75,    75,    75,
566      74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
567      74,    74,    74,    74,    74,    74,    74,    74,    74,    74,
568      74,    74,    74,    74,    74,    74,    74,    71,    71,    71,
569      71,    71,    71,    71,    71,    71,    71,    71,    71,    71,
570      71,    71,    76,    76,    77,    78,    78,    74,    74,    74,
571      74,    74,    74,    79,    79,    79,    79,    80,    80,    80,
572      81,    81,    82,    82,    82,    82,    74,    74,    74
573};
574
575/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
576static const unsigned char yyr2[] =
577{
578       0,     2,     1,     1,     1,     3,     2,     2,     4,     4,
579       0,     7,     0,     6,     3,     1,     1,     1,     1,     1,
580       3,     2,     2,     2,     2,     0,     1,     3,     3,     5,
581       4,     3,     3,     3,     3,     3,     3,     3,     3,     3,
582       3,     3,     3,     5,     5,     3,     6,     6,     4,     3,
583       3,     3,     3,     4,     3,     4,     3,     2,     2,     3,
584       3,     3,     2,     2,     7,     7,     5,     3,     3,     3,
585       5,     2,     0,     3,     1,     1,     0,     1,     1,     1,
586       1,     1,     2,     1,     2,     1,     2,     1,     1,     1,
587       1,     2,     1,     2,     2,     3,     2,     2,     4
588};
589
590/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
591   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
592   means the default is an error.  */
593static const unsigned char yydefact[] =
594{
595      76,    77,    80,    78,    79,    74,    90,    81,    83,    85,
596      19,    16,    17,    76,    76,    76,    76,    76,    76,    76,
597       0,     0,     0,     2,    18,     4,    75,     0,    15,     0,
598       3,    94,    22,     0,    21,    97,    96,    23,    24,     0,
599      82,    92,     0,     0,     1,    76,     7,     6,    72,    72,
600      72,    58,    57,    63,    62,    76,    76,    76,    76,    76,
601      76,    76,    76,    76,    76,    76,    76,    76,    76,    76,
602      76,    76,    76,    76,    76,     0,    76,    76,    72,    72,
603      72,    71,     0,     0,     0,     0,    93,    91,    84,    86,
604      76,    12,    14,    76,     5,     0,    61,    60,    59,    74,
605      83,    85,    26,     0,     0,    20,    56,    76,    54,    76,
606      52,    40,    50,    51,    45,     0,    49,    42,    41,    36,
607      37,    39,    38,    32,    33,    34,    35,    76,    31,     0,
608      69,    68,    67,    76,    76,    76,    76,    95,     0,    10,
609      30,     0,    76,     8,    76,    76,    55,    53,    76,    72,
610      48,     0,    98,     0,     0,     0,     0,     9,     0,    73,
611       0,    28,     0,    27,    43,    44,    76,    72,    70,    76,
612      76,    66,    76,    13,    76,    46,    47,     0,     0,     0,
613      29,    64,    65,    11
614};
615
616/* YYDEFGOTO[NTERM-NUM]. */
617static const short yydefgoto[] =
618{
619      -1,    22,    23,    24,   158,   139,    25,   103,    96,    26,
620      27,    28,   104,    29,    33
621};
622
623/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
624   STATE-NUM.  */
625#define YYPACT_NINF -44
626static const short yypact[] =
627{
628     251,   -44,   -44,   -44,   -44,    15,   -44,   -44,   -44,   -44,
629     -44,   -44,   -44,   251,   251,   251,   251,   251,   251,   251,
630      17,     2,    31,    10,    55,   947,   -18,    20,   -44,   118,
631     -29,   -44,   374,   -29,   374,    18,    18,   374,   374,   -21,
632     -44,    32,    66,    16,   -44,   251,   -44,   -44,    24,    24,
633      24,   -44,   -44,   -44,   -44,   133,   251,   251,   173,   212,
634     251,   251,   251,   290,   251,   251,   251,   251,   251,   251,
635     251,   251,   251,   251,   251,    59,   251,   251,    24,    24,
636      24,   -44,    35,    38,    40,    47,    58,   -44,   -44,   -44,
637     251,   -44,   -44,   251,   947,   107,   -44,   -44,   -44,    56,
638      52,    57,   915,     3,    68,   979,  1002,   251,  1002,   251,
639    1002,   -20,   -20,   -20,  1004,   837,   -20,   -20,   -20,    51,
640     374,   374,   374,   -19,   -19,   -19,   -19,   329,   -19,   414,
641     -44,   -44,   -44,   251,   251,   251,   251,   -44,   536,   -44,
642      18,    71,   251,   -44,   368,   251,  1002,  1002,   251,    24,
643    1004,   876,   -44,   579,   446,   491,   622,   -44,    60,   -44,
644     665,   947,    75,   947,   -20,   -44,   251,    24,   -44,   251,
645     251,   -44,   251,   -44,   251,   -20,   -44,   708,   751,   794,
646     947,   -44,   -44,   -44
647};
648
649/* YYPGOTO[NTERM-NUM].  */
650static const yysigned_char yypgoto[] =
651{
652     -44,   -44,    99,   -44,   -44,   -44,   -13,   -44,   -43,   -44,
653     -44,   -44,     0,   125,     8
654};
655
656/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
657   positive, shift that token.  If negative, reduce the rule which
658   number is the opposite.  If zero, do what YYDEFACT says.
659   If YYTABLE_NINF, syntax error.  */
660#define YYTABLE_NINF -93
661static const short yytable[] =
662{
663      32,    34,    35,    36,    37,    38,    97,    98,    30,    41,
664       6,    67,    68,    69,    70,   -92,    71,    72,    73,    74,
665      75,    75,    76,    76,    40,    78,    79,    80,    90,    43,
666      81,    44,    94,    82,    91,   130,   131,   132,    77,    77,
667      45,    92,   102,   105,   106,   108,   110,   111,   112,   113,
668     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
669     125,   126,    31,   128,   129,   143,    46,   144,    47,    83,
670      84,    45,   -92,    86,    87,    85,    77,   138,   -92,    31,
671     140,    95,    93,    68,    69,    70,   127,    71,    72,    73,
672      74,    75,   133,    76,   146,   134,   147,   135,    48,    49,
673      50,    51,    52,    31,   136,   137,   165,    53,    54,    77,
674     141,   -87,    55,   -92,   151,   -88,   -89,   172,    39,   -92,
675     153,   154,   155,   156,   176,    86,    87,   145,    88,   160,
676      89,   161,   163,   159,   174,   164,     1,     2,     3,     4,
677      99,     6,     7,   100,   162,   101,    42,    10,    11,    12,
678       0,     0,     0,   175,     0,     0,   177,   178,     0,   179,
679       0,   180,     0,     0,     0,    13,    14,    15,     0,    16,
680       0,     0,     0,    17,    18,     0,     1,     2,     3,     4,
681       5,     6,     7,     8,     0,     9,     0,    10,    11,    12,
682      19,   107,     0,    20,     0,   -25,     0,   -25,    21,     0,
683       0,     0,     0,     0,     0,    13,    14,    15,     0,    16,
684       0,     0,     0,    17,    18,     1,     2,     3,     4,     5,
685       6,     7,     8,     0,     9,     0,    10,    11,    12,     0,
686      19,   109,     0,    20,     0,     0,     0,     0,    21,     0,
687       0,     0,     0,     0,    13,    14,    15,     0,    16,     0,
688       0,     0,    17,    18,     1,     2,     3,     4,     5,     6,
689       7,     8,     0,     9,     0,    10,    11,    12,     0,    19,
690       0,     0,    20,     0,     0,     0,     0,    21,     0,     0,
691       0,     0,     0,    13,    14,    15,     0,    16,     0,     0,
692       0,    17,    18,     1,     2,     3,     4,   114,     6,     7,
693       8,     0,     9,     0,    10,    11,    12,     0,    19,     0,
694       0,    20,     0,     0,     0,     0,    21,     0,     0,     0,
695       0,     0,    13,    14,    15,     0,    16,     0,     0,     0,
696      17,    18,     1,     2,     3,     4,   150,     6,     7,     8,
697       0,     9,     0,    10,    11,    12,     0,    19,     0,     0,
698      20,     0,     0,     0,     0,    21,     0,     0,     0,     0,
699       0,    13,    14,    15,     0,    16,     0,     0,     0,    17,
700      18,     1,     2,     3,     4,    99,     6,     7,   100,     0,
701     101,     0,    10,    11,    12,     0,    19,     0,     0,    20,
702       0,     0,     0,     0,    21,     0,     0,     0,     0,     0,
703      13,    14,    15,     0,    16,     0,     0,     0,    17,    18,
704      71,    72,    73,    74,    75,     0,    76,     0,     0,     0,
705       0,     0,     0,     0,     0,    19,     0,     0,    20,     0,
706       0,    56,    77,    21,    57,    58,    59,    60,    61,    62,
707       0,    63,    64,    65,    66,    67,    68,    69,    70,     0,
708      71,    72,    73,    74,    75,     0,    76,     0,     0,     0,
709       0,     0,     0,    56,     0,     0,    57,    58,    59,    60,
710      61,    62,    77,    63,    64,    65,    66,    67,    68,    69,
711      70,   152,    71,    72,    73,    74,    75,     0,    76,     0,
712       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
713       0,     0,     0,     0,    77,     0,     0,     0,    56,     0,
714     169,    57,    58,    59,    60,    61,    62,     0,    63,    64,
715      65,    66,    67,    68,    69,    70,     0,    71,    72,    73,
716      74,    75,     0,    76,     0,     0,     0,     0,     0,     0,
717       0,     0,     0,     0,     0,     0,     0,     0,     0,    77,
718       0,     0,     0,    56,     0,   170,    57,    58,    59,    60,
719      61,    62,     0,    63,    64,    65,    66,    67,    68,    69,
720      70,     0,    71,    72,    73,    74,    75,     0,    76,     0,
721       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
722       0,     0,     0,     0,    77,     0,    56,     0,   157,    57,
723      58,    59,    60,    61,    62,     0,    63,    64,    65,    66,
724      67,    68,    69,    70,     0,    71,    72,    73,    74,    75,
725       0,    76,     0,     0,     0,     0,     0,     0,     0,     0,
726       0,     0,     0,     0,     0,     0,     0,    77,     0,    56,
727       0,   168,    57,    58,    59,    60,    61,    62,     0,    63,
728      64,    65,    66,    67,    68,    69,    70,     0,    71,    72,
729      73,    74,    75,     0,    76,     0,     0,     0,     0,     0,
730       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
731      77,     0,    56,     0,   171,    57,    58,    59,    60,    61,
732      62,     0,    63,    64,    65,    66,    67,    68,    69,    70,
733       0,    71,    72,    73,    74,    75,     0,    76,     0,     0,
734       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
735       0,     0,     0,    77,     0,    56,     0,   173,    57,    58,
736      59,    60,    61,    62,     0,    63,    64,    65,    66,    67,
737      68,    69,    70,     0,    71,    72,    73,    74,    75,     0,
738      76,     0,     0,     0,     0,     0,     0,     0,     0,     0,
739       0,     0,     0,     0,     0,     0,    77,     0,    56,     0,
740     181,    57,    58,    59,    60,    61,    62,     0,    63,    64,
741      65,    66,    67,    68,    69,    70,     0,    71,    72,    73,
742      74,    75,     0,    76,     0,     0,     0,     0,     0,     0,
743       0,     0,     0,     0,     0,     0,     0,     0,     0,    77,
744       0,    56,     0,   182,    57,    58,    59,    60,    61,    62,
745       0,    63,    64,    65,    66,    67,    68,    69,    70,     0,
746      71,    72,    73,    74,    75,     0,    76,     0,     0,     0,
747       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
748       0,     0,    77,     0,    56,     0,   183,    57,    58,    59,
749      60,    61,    62,   148,    63,    64,    65,    66,    67,    68,
750      69,    70,     0,    71,    72,    73,    74,    75,     0,    76,
751       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
752       0,   149,     0,    56,     0,    77,    57,    58,    59,    60,
753      61,    62,   166,    63,    64,    65,    66,    67,    68,    69,
754      70,     0,    71,    72,    73,    74,    75,     0,    76,     0,
755       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
756     167,     0,    56,     0,    77,    57,    58,    59,    60,    61,
757      62,   142,    63,    64,    65,    66,    67,    68,    69,    70,
758       0,    71,    72,    73,    74,    75,     0,    76,     0,     0,
759       0,     0,     0,     0,    56,     0,     0,    57,    58,    59,
760      60,    61,    62,    77,    63,    64,    65,    66,    67,    68,
761      69,    70,     0,    71,    72,    73,    74,    75,     0,    76,
762       0,     0,     0,     0,     0,     0,   -93,     0,     0,    57,
763      58,    59,    60,    61,    62,    77,    63,    64,    65,    66,
764      67,    68,    69,    70,     0,    71,    72,    73,    74,    75,
765       0,    76,     0,     0,     0,    60,    61,    62,     0,    63,
766      64,    65,    66,    67,    68,    69,    70,    77,    71,    72,
767      73,    74,    75,     0,    76,     0,     0,   -74,   -74,   -74,
768       0,    31,   -74,   -74,   -74,   -74,     0,     0,     0,   -74,
769      77,   -92,     0,     0,     0,     0,     0,   -92
770};
771
772static const short yycheck[] =
773{
774      13,    14,    15,    16,    17,    18,    49,    50,     0,     7,
775       8,    31,    32,    33,    34,     0,    36,    37,    38,    39,
776      40,    40,    42,    42,     7,    43,    44,    45,    57,    21,
777      48,     0,    45,    51,    63,    78,    79,    80,    58,    58,
778      61,    62,    55,    56,    57,    58,    59,    60,    61,    62,
779      63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
780      73,    74,    47,    76,    77,    62,    11,    64,    13,    49,
781      50,    61,    57,     7,     8,    55,    58,    90,    63,    47,
782      93,    57,    66,    32,    33,    34,    27,    36,    37,    38,
783      39,    40,    57,    42,   107,    57,   109,    57,    43,    44,
784      45,    46,    47,    47,    57,    47,   149,    52,    53,    58,
785       3,    59,    57,    57,   127,    59,    59,    57,    19,    63,
786     133,   134,   135,   136,   167,     7,     8,    59,    10,   142,
787      12,   144,   145,    62,    59,   148,     3,     4,     5,     6,
788       7,     8,     9,    10,   144,    12,    21,    14,    15,    16,
789      -1,    -1,    -1,   166,    -1,    -1,   169,   170,    -1,   172,
790      -1,   174,    -1,    -1,    -1,    32,    33,    34,    -1,    36,
791      -1,    -1,    -1,    40,    41,    -1,     3,     4,     5,     6,
792       7,     8,     9,    10,    -1,    12,    -1,    14,    15,    16,
793      57,    18,    -1,    60,    -1,    62,    -1,    64,    65,    -1,
794      -1,    -1,    -1,    -1,    -1,    32,    33,    34,    -1,    36,
795      -1,    -1,    -1,    40,    41,     3,     4,     5,     6,     7,
796       8,     9,    10,    -1,    12,    -1,    14,    15,    16,    -1,
797      57,    19,    -1,    60,    -1,    -1,    -1,    -1,    65,    -1,
798      -1,    -1,    -1,    -1,    32,    33,    34,    -1,    36,    -1,
799      -1,    -1,    40,    41,     3,     4,     5,     6,     7,     8,
800       9,    10,    -1,    12,    -1,    14,    15,    16,    -1,    57,
801      -1,    -1,    60,    -1,    -1,    -1,    -1,    65,    -1,    -1,
802      -1,    -1,    -1,    32,    33,    34,    -1,    36,    -1,    -1,
803      -1,    40,    41,     3,     4,     5,     6,     7,     8,     9,
804      10,    -1,    12,    -1,    14,    15,    16,    -1,    57,    -1,
805      -1,    60,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,
806      -1,    -1,    32,    33,    34,    -1,    36,    -1,    -1,    -1,
807      40,    41,     3,     4,     5,     6,     7,     8,     9,    10,
808      -1,    12,    -1,    14,    15,    16,    -1,    57,    -1,    -1,
809      60,    -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,
810      -1,    32,    33,    34,    -1,    36,    -1,    -1,    -1,    40,
811      41,     3,     4,     5,     6,     7,     8,     9,    10,    -1,
812      12,    -1,    14,    15,    16,    -1,    57,    -1,    -1,    60,
813      -1,    -1,    -1,    -1,    65,    -1,    -1,    -1,    -1,    -1,
814      32,    33,    34,    -1,    36,    -1,    -1,    -1,    40,    41,
815      36,    37,    38,    39,    40,    -1,    42,    -1,    -1,    -1,
816      -1,    -1,    -1,    -1,    -1,    57,    -1,    -1,    60,    -1,
817      -1,    17,    58,    65,    20,    21,    22,    23,    24,    25,
818      -1,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
819      36,    37,    38,    39,    40,    -1,    42,    -1,    -1,    -1,
820      -1,    -1,    -1,    17,    -1,    -1,    20,    21,    22,    23,
821      24,    25,    58,    27,    28,    29,    30,    31,    32,    33,
822      34,    67,    36,    37,    38,    39,    40,    -1,    42,    -1,
823      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
824      -1,    -1,    -1,    -1,    58,    -1,    -1,    -1,    17,    -1,
825      64,    20,    21,    22,    23,    24,    25,    -1,    27,    28,
826      29,    30,    31,    32,    33,    34,    -1,    36,    37,    38,
827      39,    40,    -1,    42,    -1,    -1,    -1,    -1,    -1,    -1,
828      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,
829      -1,    -1,    -1,    17,    -1,    64,    20,    21,    22,    23,
830      24,    25,    -1,    27,    28,    29,    30,    31,    32,    33,
831      34,    -1,    36,    37,    38,    39,    40,    -1,    42,    -1,
832      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
833      -1,    -1,    -1,    -1,    58,    -1,    17,    -1,    62,    20,
834      21,    22,    23,    24,    25,    -1,    27,    28,    29,    30,
835      31,    32,    33,    34,    -1,    36,    37,    38,    39,    40,
836      -1,    42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
837      -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,    -1,    17,
838      -1,    62,    20,    21,    22,    23,    24,    25,    -1,    27,
839      28,    29,    30,    31,    32,    33,    34,    -1,    36,    37,
840      38,    39,    40,    -1,    42,    -1,    -1,    -1,    -1,    -1,
841      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
842      58,    -1,    17,    -1,    62,    20,    21,    22,    23,    24,
843      25,    -1,    27,    28,    29,    30,    31,    32,    33,    34,
844      -1,    36,    37,    38,    39,    40,    -1,    42,    -1,    -1,
845      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
846      -1,    -1,    -1,    58,    -1,    17,    -1,    62,    20,    21,
847      22,    23,    24,    25,    -1,    27,    28,    29,    30,    31,
848      32,    33,    34,    -1,    36,    37,    38,    39,    40,    -1,
849      42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
850      -1,    -1,    -1,    -1,    -1,    -1,    58,    -1,    17,    -1,
851      62,    20,    21,    22,    23,    24,    25,    -1,    27,    28,
852      29,    30,    31,    32,    33,    34,    -1,    36,    37,    38,
853      39,    40,    -1,    42,    -1,    -1,    -1,    -1,    -1,    -1,
854      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,
855      -1,    17,    -1,    62,    20,    21,    22,    23,    24,    25,
856      -1,    27,    28,    29,    30,    31,    32,    33,    34,    -1,
857      36,    37,    38,    39,    40,    -1,    42,    -1,    -1,    -1,
858      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
859      -1,    -1,    58,    -1,    17,    -1,    62,    20,    21,    22,
860      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
861      33,    34,    -1,    36,    37,    38,    39,    40,    -1,    42,
862      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
863      -1,    54,    -1,    17,    -1,    58,    20,    21,    22,    23,
864      24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
865      34,    -1,    36,    37,    38,    39,    40,    -1,    42,    -1,
866      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
867      54,    -1,    17,    -1,    58,    20,    21,    22,    23,    24,
868      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
869      -1,    36,    37,    38,    39,    40,    -1,    42,    -1,    -1,
870      -1,    -1,    -1,    -1,    17,    -1,    -1,    20,    21,    22,
871      23,    24,    25,    58,    27,    28,    29,    30,    31,    32,
872      33,    34,    -1,    36,    37,    38,    39,    40,    -1,    42,
873      -1,    -1,    -1,    -1,    -1,    -1,    17,    -1,    -1,    20,
874      21,    22,    23,    24,    25,    58,    27,    28,    29,    30,
875      31,    32,    33,    34,    -1,    36,    37,    38,    39,    40,
876      -1,    42,    -1,    -1,    -1,    23,    24,    25,    -1,    27,
877      28,    29,    30,    31,    32,    33,    34,    58,    36,    37,
878      38,    39,    40,    -1,    42,    -1,    -1,    43,    44,    45,
879      -1,    47,    48,    49,    50,    51,    -1,    -1,    -1,    55,
880      58,    57,    -1,    -1,    -1,    -1,    -1,    63
881};
882
883/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
884   symbol of state STATE-NUM.  */
885static const unsigned char yystos[] =
886{
887       0,     3,     4,     5,     6,     7,     8,     9,    10,    12,
888      14,    15,    16,    32,    33,    34,    36,    40,    41,    57,
889      60,    65,    69,    70,    71,    74,    77,    78,    79,    81,
890      82,    47,    74,    82,    74,    74,    74,    74,    74,    70,
891       7,     7,    81,    82,     0,    61,    11,    13,    43,    44,
892      45,    46,    47,    52,    53,    57,    17,    20,    21,    22,
893      23,    24,    25,    27,    28,    29,    30,    31,    32,    33,
894      34,    36,    37,    38,    39,    40,    42,    58,    43,    44,
895      45,    48,    51,    49,    50,    55,     7,     8,    10,    12,
896      57,    63,    62,    66,    74,    57,    76,    76,    76,     7,
897      10,    12,    74,    75,    80,    74,    74,    18,    74,    19,
898      74,    74,    74,    74,     7,    74,    74,    74,    74,    74,
899      74,    74,    74,    74,    74,    74,    74,    27,    74,    74,
900      76,    76,    76,    57,    57,    57,    57,    47,    74,    73,
901      74,     3,    26,    62,    64,    59,    74,    74,    26,    54,
902       7,    74,    67,    74,    74,    74,    74,    62,    72,    62,
903      74,    74,    80,    74,    74,    76,    26,    54,    62,    64,
904      64,    62,    57,    62,    59,    74,    76,    74,    74,    74,
905      74,    62,    62,    62
906};
907
908#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
909# define YYSIZE_T __SIZE_TYPE__
910#endif
911#if ! defined (YYSIZE_T) && defined (size_t)
912# define YYSIZE_T size_t
913#endif
914#if ! defined (YYSIZE_T)
915# if defined (__STDC__) || defined (__cplusplus)
916#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
917#  define YYSIZE_T size_t
918# endif
919#endif
920#if ! defined (YYSIZE_T)
921# define YYSIZE_T unsigned int
922#endif
923
924#define yyerrok		(yyerrstatus = 0)
925#define yyclearin	(yychar = YYEMPTY)
926#define YYEMPTY		(-2)
927#define YYEOF		0
928
929#define YYACCEPT	goto yyacceptlab
930#define YYABORT		goto yyabortlab
931#define YYERROR		goto yyerrlab1
932
933/* Like YYERROR except do call yyerror.  This remains here temporarily
934   to ease the transition to the new meaning of YYERROR, for GCC.
935   Once GCC version 2 has supplanted version 1, this can go.  */
936
937#define YYFAIL		goto yyerrlab
938
939#define YYRECOVERING()  (!!yyerrstatus)
940
941#define YYBACKUP(Token, Value)					\
942do								\
943  if (yychar == YYEMPTY && yylen == 1)				\
944    {								\
945      yychar = (Token);						\
946      yylval = (Value);						\
947      yytoken = YYTRANSLATE (yychar);				\
948      YYPOPSTACK;						\
949      goto yybackup;						\
950    }								\
951  else								\
952    { 								\
953      yyerror ("syntax error: cannot back up");\
954      YYERROR;							\
955    }								\
956while (0)
957
958#define YYTERROR	1
959#define YYERRCODE	256
960
961/* YYLLOC_DEFAULT -- Compute the default location (before the actions
962   are run).  */
963
964#ifndef YYLLOC_DEFAULT
965# define YYLLOC_DEFAULT(Current, Rhs, N)         \
966  Current.first_line   = Rhs[1].first_line;      \
967  Current.first_column = Rhs[1].first_column;    \
968  Current.last_line    = Rhs[N].last_line;       \
969  Current.last_column  = Rhs[N].last_column;
970#endif
971
972/* YYLEX -- calling `yylex' with the right arguments.  */
973
974#ifdef YYLEX_PARAM
975# define YYLEX yylex (YYLEX_PARAM)
976#else
977# define YYLEX yylex ()
978#endif
979
980/* Enable debugging if requested.  */
981#if YYDEBUG
982
983# ifndef YYFPRINTF
984#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
985#  define YYFPRINTF fprintf
986# endif
987
988# define YYDPRINTF(Args)			\
989do {						\
990  if (yydebug)					\
991    YYFPRINTF Args;				\
992} while (0)
993
994# define YYDSYMPRINT(Args)			\
995do {						\
996  if (yydebug)					\
997    yysymprint Args;				\
998} while (0)
999
1000# define YYDSYMPRINTF(Title, Token, Value, Location)		\
1001do {								\
1002  if (yydebug)							\
1003    {								\
1004      YYFPRINTF (stderr, "%s ", Title);				\
1005      yysymprint (stderr, 					\
1006                  Token, Value);	\
1007      YYFPRINTF (stderr, "\n");					\
1008    }								\
1009} while (0)
1010
1011/*------------------------------------------------------------------.
1012| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1013| TOP (cinluded).                                                   |
1014`------------------------------------------------------------------*/
1015
1016#if defined (__STDC__) || defined (__cplusplus)
1017static void
1018yy_stack_print (short *bottom, short *top)
1019#else
1020static void
1021yy_stack_print (bottom, top)
1022    short *bottom;
1023    short *top;
1024#endif
1025{
1026  YYFPRINTF (stderr, "Stack now");
1027  for (/* Nothing. */; bottom <= top; ++bottom)
1028    YYFPRINTF (stderr, " %d", *bottom);
1029  YYFPRINTF (stderr, "\n");
1030}
1031
1032# define YY_STACK_PRINT(Bottom, Top)				\
1033do {								\
1034  if (yydebug)							\
1035    yy_stack_print ((Bottom), (Top));				\
1036} while (0)
1037
1038
1039/*------------------------------------------------.
1040| Report that the YYRULE is going to be reduced.  |
1041`------------------------------------------------*/
1042
1043#if defined (__STDC__) || defined (__cplusplus)
1044static void
1045yy_reduce_print (int yyrule)
1046#else
1047static void
1048yy_reduce_print (yyrule)
1049    int yyrule;
1050#endif
1051{
1052  int yyi;
1053  unsigned int yylineno = yyrline[yyrule];
1054  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1055             yyrule - 1, yylineno);
1056  /* Print the symbols being reduced, and their result.  */
1057  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1058    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1059  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1060}
1061
1062# define YY_REDUCE_PRINT(Rule)		\
1063do {					\
1064  if (yydebug)				\
1065    yy_reduce_print (Rule);		\
1066} while (0)
1067
1068/* Nonzero means print parse trace.  It is left uninitialized so that
1069   multiple parsers can coexist.  */
1070int yydebug;
1071#else /* !YYDEBUG */
1072# define YYDPRINTF(Args)
1073# define YYDSYMPRINT(Args)
1074# define YYDSYMPRINTF(Title, Token, Value, Location)
1075# define YY_STACK_PRINT(Bottom, Top)
1076# define YY_REDUCE_PRINT(Rule)
1077#endif /* !YYDEBUG */
1078
1079
1080/* YYINITDEPTH -- initial size of the parser's stacks.  */
1081#ifndef	YYINITDEPTH
1082# define YYINITDEPTH 200
1083#endif
1084
1085/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1086   if the built-in stack extension method is used).
1087
1088   Do not make this value too large; the results are undefined if
1089   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1090   evaluated with infinite-precision integer arithmetic.  */
1091
1092#if YYMAXDEPTH == 0
1093# undef YYMAXDEPTH
1094#endif
1095
1096#ifndef YYMAXDEPTH
1097# define YYMAXDEPTH 10000
1098#endif
1099
1100
1101
1102#if YYERROR_VERBOSE
1103
1104# ifndef yystrlen
1105#  if defined (__GLIBC__) && defined (_STRING_H)
1106#   define yystrlen strlen
1107#  else
1108/* Return the length of YYSTR.  */
1109static YYSIZE_T
1110#   if defined (__STDC__) || defined (__cplusplus)
1111yystrlen (const char *yystr)
1112#   else
1113yystrlen (yystr)
1114     const char *yystr;
1115#   endif
1116{
1117  register const char *yys = yystr;
1118
1119  while (*yys++ != '\0')
1120    continue;
1121
1122  return yys - yystr - 1;
1123}
1124#  endif
1125# endif
1126
1127# ifndef yystpcpy
1128#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1129#   define yystpcpy stpcpy
1130#  else
1131/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1132   YYDEST.  */
1133static char *
1134#   if defined (__STDC__) || defined (__cplusplus)
1135yystpcpy (char *yydest, const char *yysrc)
1136#   else
1137yystpcpy (yydest, yysrc)
1138     char *yydest;
1139     const char *yysrc;
1140#   endif
1141{
1142  register char *yyd = yydest;
1143  register const char *yys = yysrc;
1144
1145  while ((*yyd++ = *yys++) != '\0')
1146    continue;
1147
1148  return yyd - 1;
1149}
1150#  endif
1151# endif
1152
1153#endif /* !YYERROR_VERBOSE */
1154
1155
1156
1157#if YYDEBUG
1158/*--------------------------------.
1159| Print this symbol on YYOUTPUT.  |
1160`--------------------------------*/
1161
1162#if defined (__STDC__) || defined (__cplusplus)
1163static void
1164yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1165#else
1166static void
1167yysymprint (yyoutput, yytype, yyvaluep)
1168    FILE *yyoutput;
1169    int yytype;
1170    YYSTYPE *yyvaluep;
1171#endif
1172{
1173  /* Pacify ``unused variable'' warnings.  */
1174  (void) yyvaluep;
1175
1176  if (yytype < YYNTOKENS)
1177    {
1178      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1179# ifdef YYPRINT
1180      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1181# endif
1182    }
1183  else
1184    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1185
1186  switch (yytype)
1187    {
1188      default:
1189        break;
1190    }
1191  YYFPRINTF (yyoutput, ")");
1192}
1193
1194#endif /* ! YYDEBUG */
1195/*-----------------------------------------------.
1196| Release the memory associated to this symbol.  |
1197`-----------------------------------------------*/
1198
1199#if defined (__STDC__) || defined (__cplusplus)
1200static void
1201yydestruct (int yytype, YYSTYPE *yyvaluep)
1202#else
1203static void
1204yydestruct (yytype, yyvaluep)
1205    int yytype;
1206    YYSTYPE *yyvaluep;
1207#endif
1208{
1209  /* Pacify ``unused variable'' warnings.  */
1210  (void) yyvaluep;
1211
1212  switch (yytype)
1213    {
1214
1215      default:
1216        break;
1217    }
1218}
1219
1220
1221/* Prevent warnings from -Wmissing-prototypes.  */
1222
1223#ifdef YYPARSE_PARAM
1224# if defined (__STDC__) || defined (__cplusplus)
1225int yyparse (void *YYPARSE_PARAM);
1226# else
1227int yyparse ();
1228# endif
1229#else /* ! YYPARSE_PARAM */
1230#if defined (__STDC__) || defined (__cplusplus)
1231int yyparse (void);
1232#else
1233int yyparse ();
1234#endif
1235#endif /* ! YYPARSE_PARAM */
1236
1237
1238
1239/* The lookahead symbol.  */
1240int yychar;
1241
1242/* The semantic value of the lookahead symbol.  */
1243YYSTYPE yylval;
1244
1245/* Number of syntax errors so far.  */
1246int yynerrs;
1247
1248
1249
1250/*----------.
1251| yyparse.  |
1252`----------*/
1253
1254#ifdef YYPARSE_PARAM
1255# if defined (__STDC__) || defined (__cplusplus)
1256int yyparse (void *YYPARSE_PARAM)
1257# else
1258int yyparse (YYPARSE_PARAM)
1259  void *YYPARSE_PARAM;
1260# endif
1261#else /* ! YYPARSE_PARAM */
1262#if defined (__STDC__) || defined (__cplusplus)
1263int
1264yyparse (void)
1265#else
1266int
1267yyparse ()
1268
1269#endif
1270#endif
1271{
1272
1273  register int yystate;
1274  register int yyn;
1275  int yyresult;
1276  /* Number of tokens to shift before error messages enabled.  */
1277  int yyerrstatus;
1278  /* Lookahead token as an internal (translated) token number.  */
1279  int yytoken = 0;
1280
1281  /* Three stacks and their tools:
1282     `yyss': related to states,
1283     `yyvs': related to semantic values,
1284     `yyls': related to locations.
1285
1286     Refer to the stacks thru separate pointers, to allow yyoverflow
1287     to xreallocate them elsewhere.  */
1288
1289  /* The state stack.  */
1290  short	yyssa[YYINITDEPTH];
1291  short *yyss = yyssa;
1292  register short *yyssp;
1293
1294  /* The semantic value stack.  */
1295  YYSTYPE yyvsa[YYINITDEPTH];
1296  YYSTYPE *yyvs = yyvsa;
1297  register YYSTYPE *yyvsp;
1298
1299
1300
1301#define YYPOPSTACK   (yyvsp--, yyssp--)
1302
1303  YYSIZE_T yystacksize = YYINITDEPTH;
1304
1305  /* The variables used to return semantic value and location from the
1306     action routines.  */
1307  YYSTYPE yyval;
1308
1309
1310  /* When reducing, the number of symbols on the RHS of the reduced
1311     rule.  */
1312  int yylen;
1313
1314  YYDPRINTF ((stderr, "Starting parse\n"));
1315
1316  yystate = 0;
1317  yyerrstatus = 0;
1318  yynerrs = 0;
1319  yychar = YYEMPTY;		/* Cause a token to be read.  */
1320
1321  /* Initialize stack pointers.
1322     Waste one element of value and location stack
1323     so that they stay on the same level as the state stack.
1324     The wasted elements are never initialized.  */
1325
1326  yyssp = yyss;
1327  yyvsp = yyvs;
1328
1329  goto yysetstate;
1330
1331/*------------------------------------------------------------.
1332| yynewstate -- Push a new state, which is found in yystate.  |
1333`------------------------------------------------------------*/
1334 yynewstate:
1335  /* In all cases, when you get here, the value and location stacks
1336     have just been pushed. so pushing a state here evens the stacks.
1337     */
1338  yyssp++;
1339
1340 yysetstate:
1341  *yyssp = yystate;
1342
1343  if (yyss + yystacksize - 1 <= yyssp)
1344    {
1345      /* Get the current used size of the three stacks, in elements.  */
1346      YYSIZE_T yysize = yyssp - yyss + 1;
1347
1348#ifdef yyoverflow
1349      {
1350	/* Give user a chance to xreallocate the stack. Use copies of
1351	   these so that the &'s don't force the real ones into
1352	   memory.  */
1353	YYSTYPE *yyvs1 = yyvs;
1354	short *yyss1 = yyss;
1355
1356
1357	/* Each stack pointer address is followed by the size of the
1358	   data in use in that stack, in bytes.  This used to be a
1359	   conditional around just the two extra args, but that might
1360	   be undefined if yyoverflow is a macro.  */
1361	yyoverflow ("parser stack overflow",
1362		    &yyss1, yysize * sizeof (*yyssp),
1363		    &yyvs1, yysize * sizeof (*yyvsp),
1364
1365		    &yystacksize);
1366
1367	yyss = yyss1;
1368	yyvs = yyvs1;
1369      }
1370#else /* no yyoverflow */
1371# ifndef YYSTACK_RELOCATE
1372      goto yyoverflowlab;
1373# else
1374      /* Extend the stack our own way.  */
1375      if (YYMAXDEPTH <= yystacksize)
1376	goto yyoverflowlab;
1377      yystacksize *= 2;
1378      if (YYMAXDEPTH < yystacksize)
1379	yystacksize = YYMAXDEPTH;
1380
1381      {
1382	short *yyss1 = yyss;
1383	union yyalloc *yyptr =
1384	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1385	if (! yyptr)
1386	  goto yyoverflowlab;
1387	YYSTACK_RELOCATE (yyss);
1388	YYSTACK_RELOCATE (yyvs);
1389
1390#  undef YYSTACK_RELOCATE
1391	if (yyss1 != yyssa)
1392	  YYSTACK_FREE (yyss1);
1393      }
1394# endif
1395#endif /* no yyoverflow */
1396
1397      yyssp = yyss + yysize - 1;
1398      yyvsp = yyvs + yysize - 1;
1399
1400
1401      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1402		  (unsigned long int) yystacksize));
1403
1404      if (yyss + yystacksize - 1 <= yyssp)
1405	YYABORT;
1406    }
1407
1408  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1409
1410  goto yybackup;
1411
1412/*-----------.
1413| yybackup.  |
1414`-----------*/
1415yybackup:
1416
1417/* Do appropriate processing given the current state.  */
1418/* Read a lookahead token if we need one and don't already have one.  */
1419/* yyresume: */
1420
1421  /* First try to decide what to do without reference to lookahead token.  */
1422
1423  yyn = yypact[yystate];
1424  if (yyn == YYPACT_NINF)
1425    goto yydefault;
1426
1427  /* Not known => get a lookahead token if don't already have one.  */
1428
1429  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1430  if (yychar == YYEMPTY)
1431    {
1432      YYDPRINTF ((stderr, "Reading a token: "));
1433      yychar = YYLEX;
1434    }
1435
1436  if (yychar <= YYEOF)
1437    {
1438      yychar = yytoken = YYEOF;
1439      YYDPRINTF ((stderr, "Now at end of input.\n"));
1440    }
1441  else
1442    {
1443      yytoken = YYTRANSLATE (yychar);
1444      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1445    }
1446
1447  /* If the proper action on seeing token YYTOKEN is to reduce or to
1448     detect an error, take that action.  */
1449  yyn += yytoken;
1450  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1451    goto yydefault;
1452  yyn = yytable[yyn];
1453  if (yyn <= 0)
1454    {
1455      if (yyn == 0 || yyn == YYTABLE_NINF)
1456	goto yyerrlab;
1457      yyn = -yyn;
1458      goto yyreduce;
1459    }
1460
1461  if (yyn == YYFINAL)
1462    YYACCEPT;
1463
1464  /* Shift the lookahead token.  */
1465  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1466
1467  /* Discard the token being shifted unless it is eof.  */
1468  if (yychar != YYEOF)
1469    yychar = YYEMPTY;
1470
1471  *++yyvsp = yylval;
1472
1473
1474  /* Count tokens shifted since error; after three, turn off error
1475     status.  */
1476  if (yyerrstatus)
1477    yyerrstatus--;
1478
1479  yystate = yyn;
1480  goto yynewstate;
1481
1482
1483/*-----------------------------------------------------------.
1484| yydefault -- do the default action for the current state.  |
1485`-----------------------------------------------------------*/
1486yydefault:
1487  yyn = yydefact[yystate];
1488  if (yyn == 0)
1489    goto yyerrlab;
1490  goto yyreduce;
1491
1492
1493/*-----------------------------.
1494| yyreduce -- Do a reduction.  |
1495`-----------------------------*/
1496yyreduce:
1497  /* yyn is the number of a rule to reduce with.  */
1498  yylen = yyr2[yyn];
1499
1500  /* If YYLEN is nonzero, implement the default value of the action:
1501     `$$ = $1'.
1502
1503     Otherwise, the following line sets YYVAL to garbage.
1504     This behavior is undocumented and Bison
1505     users should not rely upon it.  Assigning to YYVAL
1506     unconditionally makes the parser a bit smaller, and it avoids a
1507     GCC warning that YYVAL may be used uninitialized.  */
1508  yyval = yyvsp[1-yylen];
1509
1510
1511  YY_REDUCE_PRINT (yyn);
1512  switch (yyn)
1513    {
1514        case 3:
1515#line 209 "ada-exp.y"
1516    { write_exp_elt_opcode (OP_TYPE);
1517			  write_exp_elt_type (yyvsp[0].tval);
1518 			  write_exp_elt_opcode (OP_TYPE); }
1519    break;
1520
1521  case 5:
1522#line 217 "ada-exp.y"
1523    { write_exp_elt_opcode (BINOP_COMMA); }
1524    break;
1525
1526  case 6:
1527#line 222 "ada-exp.y"
1528    { write_exp_elt_opcode (UNOP_IND); }
1529    break;
1530
1531  case 7:
1532#line 226 "ada-exp.y"
1533    { write_exp_elt_opcode (STRUCTOP_STRUCT);
1534			  write_exp_string (yyvsp[0].ssym.stoken);
1535			  write_exp_elt_opcode (STRUCTOP_STRUCT);
1536			  }
1537    break;
1538
1539  case 8:
1540#line 233 "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 241 "ada-exp.y"
1550    {
1551			  write_exp_elt_opcode (UNOP_CAST);
1552			  write_exp_elt_type (yyvsp[-3].tval);
1553			  write_exp_elt_opcode (UNOP_CAST);
1554			}
1555    break;
1556
1557  case 10:
1558#line 248 "ada-exp.y"
1559    { type_qualifier = yyvsp[-2].tval; }
1560    break;
1561
1562  case 11:
1563#line 249 "ada-exp.y"
1564    {
1565			  /*			  write_exp_elt_opcode (UNOP_QUAL); */
1566			  /* FIXME: UNOP_QUAL should be defined in expression.h */
1567			  write_exp_elt_type (yyvsp[-6].tval);
1568			  /* write_exp_elt_opcode (UNOP_QUAL); */
1569			  /* FIXME: UNOP_QUAL should be defined in expression.h */
1570			  type_qualifier = yyvsp[-4].tval;
1571			}
1572    break;
1573
1574  case 12:
1575#line 259 "ada-exp.y"
1576    { yyval.tval = type_qualifier; }
1577    break;
1578
1579  case 13:
1580#line 264 "ada-exp.y"
1581    { write_exp_elt_opcode (TERNOP_SLICE); }
1582    break;
1583
1584  case 14:
1585#line 267 "ada-exp.y"
1586    { }
1587    break;
1588
1589  case 16:
1590#line 274 "ada-exp.y"
1591    { write_exp_elt_opcode (OP_REGISTER);
1592			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1593			  write_exp_elt_opcode (OP_REGISTER);
1594			}
1595    break;
1596
1597  case 17:
1598#line 281 "ada-exp.y"
1599    { write_exp_elt_opcode (OP_INTERNALVAR);
1600			  write_exp_elt_intern (yyvsp[0].ivar);
1601			  write_exp_elt_opcode (OP_INTERNALVAR);
1602			}
1603    break;
1604
1605  case 19:
1606#line 292 "ada-exp.y"
1607    { write_exp_elt_opcode (OP_LAST);
1608			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1609			  write_exp_elt_opcode (OP_LAST);
1610			 }
1611    break;
1612
1613  case 20:
1614#line 299 "ada-exp.y"
1615    { write_exp_elt_opcode (BINOP_ASSIGN); }
1616    break;
1617
1618  case 21:
1619#line 303 "ada-exp.y"
1620    { write_exp_elt_opcode (UNOP_NEG); }
1621    break;
1622
1623  case 22:
1624#line 307 "ada-exp.y"
1625    { write_exp_elt_opcode (UNOP_PLUS); }
1626    break;
1627
1628  case 23:
1629#line 311 "ada-exp.y"
1630    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1631    break;
1632
1633  case 24:
1634#line 315 "ada-exp.y"
1635    { write_exp_elt_opcode (UNOP_ABS); }
1636    break;
1637
1638  case 25:
1639#line 318 "ada-exp.y"
1640    { yyval.lval = 0; }
1641    break;
1642
1643  case 26:
1644#line 322 "ada-exp.y"
1645    { yyval.lval = 1; }
1646    break;
1647
1648  case 27:
1649#line 324 "ada-exp.y"
1650    { yyval.lval = 1; }
1651    break;
1652
1653  case 28:
1654#line 326 "ada-exp.y"
1655    { yyval.lval = yyvsp[-2].lval + 1; }
1656    break;
1657
1658  case 29:
1659#line 328 "ada-exp.y"
1660    { yyval.lval = yyvsp[-4].lval + 1; }
1661    break;
1662
1663  case 30:
1664#line 333 "ada-exp.y"
1665    { write_exp_elt_opcode (UNOP_MEMVAL);
1666			  write_exp_elt_type (yyvsp[-2].tval);
1667			  write_exp_elt_opcode (UNOP_MEMVAL);
1668			}
1669    break;
1670
1671  case 31:
1672#line 342 "ada-exp.y"
1673    { write_exp_elt_opcode (BINOP_EXP); }
1674    break;
1675
1676  case 32:
1677#line 346 "ada-exp.y"
1678    { write_exp_elt_opcode (BINOP_MUL); }
1679    break;
1680
1681  case 33:
1682#line 350 "ada-exp.y"
1683    { write_exp_elt_opcode (BINOP_DIV); }
1684    break;
1685
1686  case 34:
1687#line 354 "ada-exp.y"
1688    { write_exp_elt_opcode (BINOP_REM); }
1689    break;
1690
1691  case 35:
1692#line 358 "ada-exp.y"
1693    { write_exp_elt_opcode (BINOP_MOD); }
1694    break;
1695
1696  case 36:
1697#line 362 "ada-exp.y"
1698    { write_exp_elt_opcode (BINOP_REPEAT); }
1699    break;
1700
1701  case 37:
1702#line 366 "ada-exp.y"
1703    { write_exp_elt_opcode (BINOP_ADD); }
1704    break;
1705
1706  case 38:
1707#line 370 "ada-exp.y"
1708    { write_exp_elt_opcode (BINOP_CONCAT); }
1709    break;
1710
1711  case 39:
1712#line 374 "ada-exp.y"
1713    { write_exp_elt_opcode (BINOP_SUB); }
1714    break;
1715
1716  case 40:
1717#line 378 "ada-exp.y"
1718    { write_exp_elt_opcode (BINOP_EQUAL); }
1719    break;
1720
1721  case 41:
1722#line 382 "ada-exp.y"
1723    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1724    break;
1725
1726  case 42:
1727#line 386 "ada-exp.y"
1728    { write_exp_elt_opcode (BINOP_LEQ); }
1729    break;
1730
1731  case 43:
1732#line 390 "ada-exp.y"
1733    { /*write_exp_elt_opcode (TERNOP_MBR); */ }
1734    break;
1735
1736  case 44:
1737#line 394 "ada-exp.y"
1738    { /*write_exp_elt_opcode (BINOP_MBR); */
1739			  /* FIXME: BINOP_MBR should be defined in expression.h */
1740			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1741			  /*write_exp_elt_opcode (BINOP_MBR); */
1742			}
1743    break;
1744
1745  case 45:
1746#line 400 "ada-exp.y"
1747    { /*write_exp_elt_opcode (UNOP_MBR); */
1748			  /* FIXME: UNOP_QUAL should be defined in expression.h */
1749		          write_exp_elt_type (yyvsp[0].tval);
1750			  /*		          write_exp_elt_opcode (UNOP_MBR); */
1751			  /* FIXME: UNOP_MBR should be defined in expression.h */
1752			}
1753    break;
1754
1755  case 46:
1756#line 407 "ada-exp.y"
1757    { /*write_exp_elt_opcode (TERNOP_MBR); */
1758			  /* FIXME: TERNOP_MBR should be defined in expression.h */
1759		          write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1760			}
1761    break;
1762
1763  case 47:
1764#line 412 "ada-exp.y"
1765    { /* write_exp_elt_opcode (BINOP_MBR); */
1766			  /* FIXME: BINOP_MBR should be defined in expression.h */
1767			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1768			  /*write_exp_elt_opcode (BINOP_MBR);*/
1769			  /* FIXME: BINOP_MBR should be defined in expression.h */
1770		          write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1771			}
1772    break;
1773
1774  case 48:
1775#line 420 "ada-exp.y"
1776    { /*write_exp_elt_opcode (UNOP_MBR);*/
1777			  /* FIXME: UNOP_MBR should be defined in expression.h */
1778		          write_exp_elt_type (yyvsp[0].tval);
1779			  /*		          write_exp_elt_opcode (UNOP_MBR);*/
1780			  /* FIXME: UNOP_MBR should be defined in expression.h */
1781		          write_exp_elt_opcode (UNOP_LOGICAL_NOT);
1782			}
1783    break;
1784
1785  case 49:
1786#line 430 "ada-exp.y"
1787    { write_exp_elt_opcode (BINOP_GEQ); }
1788    break;
1789
1790  case 50:
1791#line 434 "ada-exp.y"
1792    { write_exp_elt_opcode (BINOP_LESS); }
1793    break;
1794
1795  case 51:
1796#line 438 "ada-exp.y"
1797    { write_exp_elt_opcode (BINOP_GTR); }
1798    break;
1799
1800  case 52:
1801#line 442 "ada-exp.y"
1802    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1803    break;
1804
1805  case 53:
1806#line 446 "ada-exp.y"
1807    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1808    break;
1809
1810  case 54:
1811#line 450 "ada-exp.y"
1812    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1813    break;
1814
1815  case 55:
1816#line 454 "ada-exp.y"
1817    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1818    break;
1819
1820  case 56:
1821#line 458 "ada-exp.y"
1822    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1823    break;
1824
1825  case 57:
1826#line 462 "ada-exp.y"
1827    { write_exp_elt_opcode (UNOP_ADDR); }
1828    break;
1829
1830  case 58:
1831#line 464 "ada-exp.y"
1832    { write_exp_elt_opcode (UNOP_ADDR);
1833			  write_exp_elt_opcode (UNOP_CAST);
1834			  write_exp_elt_type (builtin_type_ada_system_address);
1835			  write_exp_elt_opcode (UNOP_CAST);
1836			}
1837    break;
1838
1839  case 59:
1840#line 470 "ada-exp.y"
1841    { write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); }
1842    break;
1843
1844  case 60:
1845#line 472 "ada-exp.y"
1846    { write_attribute_call1 (ATR_LAST, yyvsp[0].lval); }
1847    break;
1848
1849  case 61:
1850#line 474 "ada-exp.y"
1851    { write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); }
1852    break;
1853
1854  case 62:
1855#line 476 "ada-exp.y"
1856    { write_attribute_call0 (ATR_SIZE); }
1857    break;
1858
1859  case 63:
1860#line 478 "ada-exp.y"
1861    { write_attribute_call0 (ATR_TAG); }
1862    break;
1863
1864  case 64:
1865#line 480 "ada-exp.y"
1866    { write_attribute_calln (ATR_MIN, 2); }
1867    break;
1868
1869  case 65:
1870#line 482 "ada-exp.y"
1871    { write_attribute_calln (ATR_MAX, 2); }
1872    break;
1873
1874  case 66:
1875#line 484 "ada-exp.y"
1876    { write_attribute_calln (ATR_POS, 1); }
1877    break;
1878
1879  case 67:
1880#line 486 "ada-exp.y"
1881    { write_attribute_call1 (ATR_FIRST, yyvsp[0].lval); }
1882    break;
1883
1884  case 68:
1885#line 488 "ada-exp.y"
1886    { write_attribute_call1 (ATR_LAST, yyvsp[0].lval); }
1887    break;
1888
1889  case 69:
1890#line 490 "ada-exp.y"
1891    { write_attribute_call1 (ATR_LENGTH, yyvsp[0].lval); }
1892    break;
1893
1894  case 70:
1895#line 492 "ada-exp.y"
1896    { write_attribute_calln (ATR_VAL, 1); }
1897    break;
1898
1899  case 71:
1900#line 494 "ada-exp.y"
1901    { write_attribute_call0 (ATR_MODULUS); }
1902    break;
1903
1904  case 72:
1905#line 498 "ada-exp.y"
1906    { yyval.lval = 1; }
1907    break;
1908
1909  case 73:
1910#line 500 "ada-exp.y"
1911    { yyval.lval = yyvsp[-1].typed_val.val; }
1912    break;
1913
1914  case 74:
1915#line 505 "ada-exp.y"
1916    { write_exp_elt_opcode (OP_TYPE);
1917			  write_exp_elt_type (yyvsp[0].tval);
1918			  write_exp_elt_opcode (OP_TYPE); }
1919    break;
1920
1921  case 76:
1922#line 513 "ada-exp.y"
1923    { write_exp_elt_opcode (OP_TYPE);
1924			  write_exp_elt_type (builtin_type_void);
1925			  write_exp_elt_opcode (OP_TYPE); }
1926    break;
1927
1928  case 77:
1929#line 520 "ada-exp.y"
1930    { write_exp_elt_opcode (OP_LONG);
1931			  write_exp_elt_type (yyvsp[0].typed_val.type);
1932			  write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1933			  write_exp_elt_opcode (OP_LONG);
1934			}
1935    break;
1936
1937  case 78:
1938#line 528 "ada-exp.y"
1939    { write_exp_elt_opcode (OP_LONG);
1940			  if (type_qualifier == NULL)
1941			    write_exp_elt_type (yyvsp[0].typed_val.type);
1942			  else
1943			    write_exp_elt_type (type_qualifier);
1944			  write_exp_elt_longcst
1945			    (convert_char_literal (type_qualifier, yyvsp[0].typed_val.val));
1946			  write_exp_elt_opcode (OP_LONG);
1947			}
1948    break;
1949
1950  case 79:
1951#line 540 "ada-exp.y"
1952    { write_exp_elt_opcode (OP_DOUBLE);
1953			  write_exp_elt_type (yyvsp[0].typed_val_float.type);
1954			  write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1955			  write_exp_elt_opcode (OP_DOUBLE);
1956			}
1957    break;
1958
1959  case 80:
1960#line 548 "ada-exp.y"
1961    { write_exp_elt_opcode (OP_LONG);
1962			  write_exp_elt_type (builtin_type_int);
1963			  write_exp_elt_longcst ((LONGEST)(0));
1964			  write_exp_elt_opcode (OP_LONG);
1965			 }
1966    break;
1967
1968  case 81:
1969#line 556 "ada-exp.y"
1970    { /* Ada strings are converted into array constants
1971			     a lower bound of 1.  Thus, the array upper bound
1972			     is the string length. */
1973			  char *sp = yyvsp[0].sval.ptr; int count;
1974			  if (yyvsp[0].sval.length == 0)
1975			    { /* One dummy character for the type */
1976			      write_exp_elt_opcode (OP_LONG);
1977			      write_exp_elt_type (builtin_type_ada_char);
1978			      write_exp_elt_longcst ((LONGEST)(0));
1979			      write_exp_elt_opcode (OP_LONG);
1980			    }
1981			  for (count = yyvsp[0].sval.length; count > 0; count -= 1)
1982			    {
1983			      write_exp_elt_opcode (OP_LONG);
1984			      write_exp_elt_type (builtin_type_ada_char);
1985			      write_exp_elt_longcst ((LONGEST)(*sp));
1986			      sp += 1;
1987			      write_exp_elt_opcode (OP_LONG);
1988			    }
1989			  write_exp_elt_opcode (OP_ARRAY);
1990			  write_exp_elt_longcst ((LONGEST) 1);
1991			  write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1992			  write_exp_elt_opcode (OP_ARRAY);
1993			 }
1994    break;
1995
1996  case 82:
1997#line 583 "ada-exp.y"
1998    { error ("NEW not implemented."); }
1999    break;
2000
2001  case 83:
2002#line 586 "ada-exp.y"
2003    { write_var_from_name (NULL, yyvsp[0].ssym); }
2004    break;
2005
2006  case 84:
2007#line 588 "ada-exp.y"
2008    { write_var_from_name (yyvsp[-1].bval, yyvsp[0].ssym); }
2009    break;
2010
2011  case 85:
2012#line 589 "ada-exp.y"
2013    { write_object_renaming (NULL, yyvsp[0].ssym.sym); }
2014    break;
2015
2016  case 86:
2017#line 591 "ada-exp.y"
2018    { write_object_renaming (yyvsp[-1].bval, yyvsp[0].ssym.sym); }
2019    break;
2020
2021  case 87:
2022#line 594 "ada-exp.y"
2023    { }
2024    break;
2025
2026  case 88:
2027#line 595 "ada-exp.y"
2028    { }
2029    break;
2030
2031  case 89:
2032#line 596 "ada-exp.y"
2033    { }
2034    break;
2035
2036  case 90:
2037#line 600 "ada-exp.y"
2038    { yyval.bval = yyvsp[0].bval; }
2039    break;
2040
2041  case 91:
2042#line 602 "ada-exp.y"
2043    { yyval.bval = yyvsp[0].bval; }
2044    break;
2045
2046  case 92:
2047#line 606 "ada-exp.y"
2048    { yyval.tval = yyvsp[0].tval; }
2049    break;
2050
2051  case 93:
2052#line 607 "ada-exp.y"
2053    { yyval.tval = yyvsp[0].tval; }
2054    break;
2055
2056  case 94:
2057#line 609 "ada-exp.y"
2058    { yyval.tval = lookup_pointer_type (yyvsp[-1].tval); }
2059    break;
2060
2061  case 95:
2062#line 611 "ada-exp.y"
2063    { yyval.tval = lookup_pointer_type (yyvsp[-1].tval); }
2064    break;
2065
2066  case 96:
2067#line 618 "ada-exp.y"
2068    { write_exp_elt_opcode (UNOP_IND); }
2069    break;
2070
2071  case 97:
2072#line 620 "ada-exp.y"
2073    { write_exp_elt_opcode (UNOP_ADDR); }
2074    break;
2075
2076  case 98:
2077#line 622 "ada-exp.y"
2078    { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
2079    break;
2080
2081
2082    }
2083
2084/* Line 991 of yacc.c.  */
2085
2086  yyvsp -= yylen;
2087  yyssp -= yylen;
2088
2089
2090  YY_STACK_PRINT (yyss, yyssp);
2091
2092  *++yyvsp = yyval;
2093
2094
2095  /* Now `shift' the result of the reduction.  Determine what state
2096     that goes to, based on the state we popped back to and the rule
2097     number reduced by.  */
2098
2099  yyn = yyr1[yyn];
2100
2101  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2102  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2103    yystate = yytable[yystate];
2104  else
2105    yystate = yydefgoto[yyn - YYNTOKENS];
2106
2107  goto yynewstate;
2108
2109
2110/*------------------------------------.
2111| yyerrlab -- here on detecting error |
2112`------------------------------------*/
2113yyerrlab:
2114  /* If not already recovering from an error, report this error.  */
2115  if (!yyerrstatus)
2116    {
2117      ++yynerrs;
2118#if YYERROR_VERBOSE
2119      yyn = yypact[yystate];
2120
2121      if (YYPACT_NINF < yyn && yyn < YYLAST)
2122	{
2123	  YYSIZE_T yysize = 0;
2124	  int yytype = YYTRANSLATE (yychar);
2125	  char *yymsg;
2126	  int yyx, yycount;
2127
2128	  yycount = 0;
2129	  /* Start YYX at -YYN if negative to avoid negative indexes in
2130	     YYCHECK.  */
2131	  for (yyx = yyn < 0 ? -yyn : 0;
2132	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2133	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2134	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2135	  yysize += yystrlen ("syntax error, unexpected ") + 1;
2136	  yysize += yystrlen (yytname[yytype]);
2137	  yymsg = (char *) YYSTACK_ALLOC (yysize);
2138	  if (yymsg != 0)
2139	    {
2140	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2141	      yyp = yystpcpy (yyp, yytname[yytype]);
2142
2143	      if (yycount < 5)
2144		{
2145		  yycount = 0;
2146		  for (yyx = yyn < 0 ? -yyn : 0;
2147		       yyx < (int) (sizeof (yytname) / sizeof (char *));
2148		       yyx++)
2149		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2150		      {
2151			const char *yyq = ! yycount ? ", expecting " : " or ";
2152			yyp = yystpcpy (yyp, yyq);
2153			yyp = yystpcpy (yyp, yytname[yyx]);
2154			yycount++;
2155		      }
2156		}
2157	      yyerror (yymsg);
2158	      YYSTACK_FREE (yymsg);
2159	    }
2160	  else
2161	    yyerror ("syntax error; also virtual memory exhausted");
2162	}
2163      else
2164#endif /* YYERROR_VERBOSE */
2165	yyerror ("syntax error");
2166    }
2167
2168
2169
2170  if (yyerrstatus == 3)
2171    {
2172      /* If just tried and failed to reuse lookahead token after an
2173	 error, discard it.  */
2174
2175      /* Return failure if at end of input.  */
2176      if (yychar == YYEOF)
2177        {
2178	  /* Pop the error token.  */
2179          YYPOPSTACK;
2180	  /* Pop the rest of the stack.  */
2181	  while (yyss < yyssp)
2182	    {
2183	      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2184	      yydestruct (yystos[*yyssp], yyvsp);
2185	      YYPOPSTACK;
2186	    }
2187	  YYABORT;
2188        }
2189
2190      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2191      yydestruct (yytoken, &yylval);
2192      yychar = YYEMPTY;
2193
2194    }
2195
2196  /* Else will try to reuse lookahead token after shifting the error
2197     token.  */
2198  goto yyerrlab2;
2199
2200
2201/*----------------------------------------------------.
2202| yyerrlab1 -- error raised explicitly by an action.  |
2203`----------------------------------------------------*/
2204yyerrlab1:
2205
2206  /* Suppress GCC warning that yyerrlab1 is unused when no action
2207     invokes YYERROR.  Doesn't work in C++ */
2208#ifndef __cplusplus
2209#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
2210  __attribute__ ((__unused__))
2211#endif
2212#endif
2213
2214
2215  goto yyerrlab2;
2216
2217
2218/*---------------------------------------------------------------.
2219| yyerrlab2 -- pop states until the error token can be shifted.  |
2220`---------------------------------------------------------------*/
2221yyerrlab2:
2222  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
2223
2224  for (;;)
2225    {
2226      yyn = yypact[yystate];
2227      if (yyn != YYPACT_NINF)
2228	{
2229	  yyn += YYTERROR;
2230	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2231	    {
2232	      yyn = yytable[yyn];
2233	      if (0 < yyn)
2234		break;
2235	    }
2236	}
2237
2238      /* Pop the current state because it cannot handle the error token.  */
2239      if (yyssp == yyss)
2240	YYABORT;
2241
2242      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2243      yydestruct (yystos[yystate], yyvsp);
2244      yyvsp--;
2245      yystate = *--yyssp;
2246
2247      YY_STACK_PRINT (yyss, yyssp);
2248    }
2249
2250  if (yyn == YYFINAL)
2251    YYACCEPT;
2252
2253  YYDPRINTF ((stderr, "Shifting error token, "));
2254
2255  *++yyvsp = yylval;
2256
2257
2258  yystate = yyn;
2259  goto yynewstate;
2260
2261
2262/*-------------------------------------.
2263| yyacceptlab -- YYACCEPT comes here.  |
2264`-------------------------------------*/
2265yyacceptlab:
2266  yyresult = 0;
2267  goto yyreturn;
2268
2269/*-----------------------------------.
2270| yyabortlab -- YYABORT comes here.  |
2271`-----------------------------------*/
2272yyabortlab:
2273  yyresult = 1;
2274  goto yyreturn;
2275
2276#ifndef yyoverflow
2277/*----------------------------------------------.
2278| yyoverflowlab -- parser overflow comes here.  |
2279`----------------------------------------------*/
2280yyoverflowlab:
2281  yyerror ("parser stack overflow");
2282  yyresult = 2;
2283  /* Fall through.  */
2284#endif
2285
2286yyreturn:
2287#ifndef yyoverflow
2288  if (yyss != yyssa)
2289    YYSTACK_FREE (yyss);
2290#endif
2291  return yyresult;
2292}
2293
2294
2295#line 625 "ada-exp.y"
2296
2297
2298/* yylex defined in ada-lex.c: Reads one token, getting characters */
2299/* through lexptr.  */
2300
2301/* Remap normal flex interface names (yylex) as well as gratuitiously */
2302/* global symbol names, so we can have multiple flex-generated parsers */
2303/* in gdb.  */
2304
2305/* (See note above on previous definitions for YACC.) */
2306
2307#define yy_create_buffer ada_yy_create_buffer
2308#define yy_delete_buffer ada_yy_delete_buffer
2309#define yy_init_buffer ada_yy_init_buffer
2310#define yy_load_buffer_state ada_yy_load_buffer_state
2311#define yy_switch_to_buffer ada_yy_switch_to_buffer
2312#define yyrestart ada_yyrestart
2313#define yytext ada_yytext
2314#define yywrap ada_yywrap
2315
2316/* The following kludge was found necessary to prevent conflicts between */
2317/* defs.h and non-standard stdlib.h files.  */
2318#define qsort __qsort__dummy
2319#include "ada-lex.c"
2320
2321int
2322ada_parse ()
2323{
2324  lexer_init (yyin);		/* (Re-)initialize lexer. */
2325  left_block_context = NULL;
2326  type_qualifier = NULL;
2327
2328  return _ada_parse ();
2329}
2330
2331void
2332yyerror (msg)
2333     char *msg;
2334{
2335  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2336}
2337
2338/* The operator name corresponding to operator symbol STRING (adds
2339   quotes and maps to lower-case).  Destroys the previous contents of
2340   the array pointed to by STRING.ptr.  Error if STRING does not match
2341   a valid Ada operator.  Assumes that STRING.ptr points to a
2342   null-terminated string and that, if STRING is a valid operator
2343   symbol, the array pointed to by STRING.ptr contains at least
2344   STRING.length+3 characters. */
2345
2346static struct stoken
2347string_to_operator (string)
2348     struct stoken string;
2349{
2350  int i;
2351
2352  for (i = 0; ada_opname_table[i].mangled != NULL; i += 1)
2353    {
2354      if (string.length == strlen (ada_opname_table[i].demangled)-2
2355	  && strncasecmp (string.ptr, ada_opname_table[i].demangled+1,
2356			  string.length) == 0)
2357	{
2358	  strncpy (string.ptr, ada_opname_table[i].demangled,
2359		   string.length+2);
2360	  string.length += 2;
2361	  return string;
2362	}
2363    }
2364  error ("Invalid operator symbol `%s'", string.ptr);
2365}
2366
2367/* Emit expression to access an instance of SYM, in block BLOCK (if
2368 * non-NULL), and with :: qualification ORIG_LEFT_CONTEXT. */
2369static void
2370write_var_from_sym (orig_left_context, block, sym)
2371     struct block* orig_left_context;
2372     struct block* block;
2373     struct symbol* sym;
2374{
2375  if (orig_left_context == NULL && symbol_read_needs_frame (sym))
2376    {
2377      if (innermost_block == 0 ||
2378	  contained_in (block, innermost_block))
2379	innermost_block = block;
2380    }
2381
2382  write_exp_elt_opcode (OP_VAR_VALUE);
2383  /* We want to use the selected frame, not another more inner frame
2384     which happens to be in the same block */
2385  write_exp_elt_block (NULL);
2386  write_exp_elt_sym (sym);
2387  write_exp_elt_opcode (OP_VAR_VALUE);
2388}
2389
2390/* Emit expression to access an instance of NAME. */
2391static void
2392write_var_from_name (orig_left_context, name)
2393     struct block* orig_left_context;
2394     struct name_info name;
2395{
2396  if (name.msym != NULL)
2397    {
2398      write_exp_msymbol (name.msym,
2399			 lookup_function_type (builtin_type_int),
2400			 builtin_type_int);
2401    }
2402  else if (name.sym == NULL)
2403    {
2404      /* Multiple matches: record name and starting block for later
2405         resolution by ada_resolve. */
2406      /*      write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
2407      /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
2408      write_exp_elt_block (name.block);
2409      /*      write_exp_elt_name (name.stoken.ptr); */
2410      /* FIXME: write_exp_elt_name should be defined in defs.h, located in parse.c */
2411      /*      write_exp_elt_opcode (OP_UNRESOLVED_VALUE); */
2412      /* FIXME: OP_UNRESOLVED_VALUE should be defined in expression.h */
2413    }
2414  else
2415    write_var_from_sym (orig_left_context, name.block, name.sym);
2416}
2417
2418/* Write a call on parameterless attribute ATR.  */
2419
2420static void
2421write_attribute_call0 (atr)
2422     enum ada_attribute atr;
2423{
2424  /*  write_exp_elt_opcode (OP_ATTRIBUTE); */
2425  /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2426  write_exp_elt_longcst ((LONGEST) 0);
2427  write_exp_elt_longcst ((LONGEST) atr);
2428  /*  write_exp_elt_opcode (OP_ATTRIBUTE); */
2429  /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2430}
2431
2432/* Write a call on an attribute ATR with one constant integer
2433 * parameter. */
2434
2435static void
2436write_attribute_call1 (atr, arg)
2437     enum ada_attribute atr;
2438     LONGEST arg;
2439{
2440  write_exp_elt_opcode (OP_LONG);
2441  write_exp_elt_type (builtin_type_int);
2442  write_exp_elt_longcst (arg);
2443  write_exp_elt_opcode (OP_LONG);
2444  /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
2445  /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2446  write_exp_elt_longcst ((LONGEST) 1);
2447  write_exp_elt_longcst ((LONGEST) atr);
2448  /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
2449  /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2450}
2451
2452/* Write a call on an attribute ATR with N parameters, whose code must have
2453 * been generated previously. */
2454
2455static void
2456write_attribute_calln (atr, n)
2457     enum ada_attribute atr;
2458     int n;
2459{
2460  /*write_exp_elt_opcode (OP_ATTRIBUTE);*/
2461  /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2462  write_exp_elt_longcst ((LONGEST) n);
2463  write_exp_elt_longcst ((LONGEST) atr);
2464  /*  write_exp_elt_opcode (OP_ATTRIBUTE);*/
2465  /* FIXME: OP_ATTRIBUTE should be defined in expression.h */
2466}
2467
2468/* Emit expression corresponding to the renamed object designated by
2469 * the type RENAMING, which must be the referent of an object renaming
2470 * type, in the context of ORIG_LEFT_CONTEXT (?). */
2471static void
2472write_object_renaming (orig_left_context, renaming)
2473     struct block* orig_left_context;
2474     struct symbol* renaming;
2475{
2476  const char* qualification = DEPRECATED_SYMBOL_NAME (renaming);
2477  const char* simple_tail;
2478  const char* expr = TYPE_FIELD_NAME (SYMBOL_TYPE (renaming), 0);
2479  const char* suffix;
2480  char* name;
2481  struct symbol* sym;
2482  enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
2483
2484  /* if orig_left_context is null, then use the currently selected
2485     block, otherwise we might fail our symbol lookup below */
2486  if (orig_left_context == NULL)
2487    orig_left_context = get_selected_block (NULL);
2488
2489  for (simple_tail = qualification + strlen (qualification);
2490       simple_tail != qualification; simple_tail -= 1)
2491    {
2492      if (*simple_tail == '.')
2493	{
2494	  simple_tail += 1;
2495	  break;
2496	}
2497      else if (DEPRECATED_STREQN (simple_tail, "__", 2))
2498	{
2499	  simple_tail += 2;
2500	  break;
2501	}
2502    }
2503
2504  suffix = strstr (expr, "___XE");
2505  if (suffix == NULL)
2506    goto BadEncoding;
2507
2508  name = (char*) xmalloc (suffix - expr + 1);
2509  /*  add_name_string_cleanup (name); */
2510  /* FIXME: add_name_string_cleanup should be defined in
2511     parser-defs.h, implemented in parse.c */
2512  strncpy (name, expr, suffix-expr);
2513  name[suffix-expr] = '\000';
2514  sym = lookup_symbol (name, orig_left_context, VAR_DOMAIN, 0, NULL);
2515  /*  if (sym == NULL)
2516    error ("Could not find renamed variable: %s", ada_demangle (name));
2517  */
2518  /* FIXME: ada_demangle should be defined in defs.h, implemented in ada-lang.c */
2519  write_var_from_sym (orig_left_context, block_found, sym);
2520
2521  suffix += 5;
2522  slice_state = SIMPLE_INDEX;
2523  while (*suffix == 'X')
2524    {
2525      suffix += 1;
2526
2527      switch (*suffix) {
2528      case 'L':
2529	slice_state = LOWER_BOUND;
2530      case 'S':
2531	suffix += 1;
2532	if (isdigit (*suffix))
2533	  {
2534	    char* next;
2535	    long val = strtol (suffix, &next, 10);
2536	    if (next == suffix)
2537	      goto BadEncoding;
2538	    suffix = next;
2539	    write_exp_elt_opcode (OP_LONG);
2540	    write_exp_elt_type (builtin_type_ada_int);
2541	    write_exp_elt_longcst ((LONGEST) val);
2542	    write_exp_elt_opcode (OP_LONG);
2543	  }
2544	else
2545	  {
2546	    const char* end;
2547	    char* index_name;
2548	    int index_len;
2549	    struct symbol* index_sym;
2550
2551	    end = strchr (suffix, 'X');
2552	    if (end == NULL)
2553	      end = suffix + strlen (suffix);
2554
2555	    index_len = simple_tail - qualification + 2 + (suffix - end) + 1;
2556	    index_name = (char*) xmalloc (index_len);
2557	    memset (index_name, '\000', index_len);
2558	    /*	    add_name_string_cleanup (index_name);*/
2559	    /* FIXME: add_name_string_cleanup should be defined in
2560	       parser-defs.h, implemented in parse.c */
2561	    strncpy (index_name, qualification, simple_tail - qualification);
2562	    index_name[simple_tail - qualification] = '\000';
2563	    strncat (index_name, suffix, suffix-end);
2564	    suffix = end;
2565
2566	    index_sym =
2567	      lookup_symbol (index_name, NULL, VAR_DOMAIN, 0, NULL);
2568	    if (index_sym == NULL)
2569	      error ("Could not find %s", index_name);
2570	    write_var_from_sym (NULL, block_found, sym);
2571	  }
2572	if (slice_state == SIMPLE_INDEX)
2573	  {
2574	    write_exp_elt_opcode (OP_FUNCALL);
2575	    write_exp_elt_longcst ((LONGEST) 1);
2576	    write_exp_elt_opcode (OP_FUNCALL);
2577	  }
2578	else if (slice_state == LOWER_BOUND)
2579	  slice_state = UPPER_BOUND;
2580	else if (slice_state == UPPER_BOUND)
2581	  {
2582	    write_exp_elt_opcode (TERNOP_SLICE);
2583	    slice_state = SIMPLE_INDEX;
2584	  }
2585	break;
2586
2587      case 'R':
2588	{
2589	  struct stoken field_name;
2590	  const char* end;
2591	  suffix += 1;
2592
2593	  if (slice_state != SIMPLE_INDEX)
2594	    goto BadEncoding;
2595	  end = strchr (suffix, 'X');
2596	  if (end == NULL)
2597	    end = suffix + strlen (suffix);
2598	  field_name.length = end - suffix;
2599	  field_name.ptr = (char*) xmalloc (end - suffix + 1);
2600	  strncpy (field_name.ptr, suffix, end - suffix);
2601	  field_name.ptr[end - suffix] = '\000';
2602	  suffix = end;
2603	  write_exp_elt_opcode (STRUCTOP_STRUCT);
2604	  write_exp_string (field_name);
2605	  write_exp_elt_opcode (STRUCTOP_STRUCT);
2606	  break;
2607	}
2608
2609      default:
2610	goto BadEncoding;
2611      }
2612    }
2613  if (slice_state == SIMPLE_INDEX)
2614    return;
2615
2616 BadEncoding:
2617  error ("Internal error in encoding of renaming declaration: %s",
2618	 DEPRECATED_SYMBOL_NAME (renaming));
2619}
2620
2621/* Convert the character literal whose ASCII value would be VAL to the
2622   appropriate value of type TYPE, if there is a translation.
2623   Otherwise return VAL.  Hence, in an enumeration type ('A', 'B'),
2624   the literal 'A' (VAL == 65), returns 0. */
2625static LONGEST
2626convert_char_literal (struct type* type, LONGEST val)
2627{
2628  char name[7];
2629  int f;
2630
2631  if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM)
2632    return val;
2633  sprintf (name, "QU%02x", (int) val);
2634  for (f = 0; f < TYPE_NFIELDS (type); f += 1)
2635    {
2636      if (DEPRECATED_STREQ (name, TYPE_FIELD_NAME (type, f)))
2637	return TYPE_FIELD_BITPOS (type, f);
2638    }
2639  return val;
2640}
2641
2642
2643