1/* A Bison parser, made by GNU Bison 1.875c.  */
2
3/* Skeleton parser for Yacc-like parsing with Bison,
4   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place - Suite 330,
19   Boston, MA 02111-1307, USA.  */
20
21/* As a special exception, when this file is copied by Bison into a
22   Bison output file, you may use that output file without restriction.
23   This special exception was added by the Free Software Foundation
24   in version 1.24 of Bison.  */
25
26/* Written by Richard Stallman by simplifying the original so called
27   ``semantic'' parser.  */
28
29/* All symbols defined below should begin with yy or YY, to avoid
30   infringing on user name space.  This should be done even for local
31   variables, as they might otherwise be expanded by user macros.
32   There are some unavoidable exceptions within include files to
33   define necessary library symbols; they are noted "INFRINGES ON
34   USER NAME SPACE" below.  */
35
36/* Identify Bison output.  */
37#define YYBISON 1
38
39/* Skeleton name.  */
40#define YYSKELETON_NAME "yacc.c"
41
42/* Pure parsers.  */
43#define YYPURE 0
44
45/* Using locations.  */
46#define YYLSP_NEEDED 0
47
48
49
50/* Tokens.  */
51#ifndef YYTOKENTYPE
52# define YYTOKENTYPE
53   /* Put the tokens into the symbol table, so that GDB and other debuggers
54      know about them.  */
55   enum yytokentype {
56     INT = 258,
57     FLOAT = 259,
58     DECFLOAT = 260,
59     STRING = 261,
60     CHAR = 262,
61     NAME = 263,
62     UNKNOWN_CPP_NAME = 264,
63     COMPLETE = 265,
64     TYPENAME = 266,
65     NAME_OR_INT = 267,
66     OPERATOR = 268,
67     STRUCT = 269,
68     CLASS = 270,
69     UNION = 271,
70     ENUM = 272,
71     SIZEOF = 273,
72     UNSIGNED = 274,
73     COLONCOLON = 275,
74     TEMPLATE = 276,
75     ERROR = 277,
76     NEW = 278,
77     DELETE = 279,
78     REINTERPRET_CAST = 280,
79     DYNAMIC_CAST = 281,
80     STATIC_CAST = 282,
81     CONST_CAST = 283,
82     SIGNED_KEYWORD = 284,
83     LONG = 285,
84     SHORT = 286,
85     INT_KEYWORD = 287,
86     CONST_KEYWORD = 288,
87     VOLATILE_KEYWORD = 289,
88     DOUBLE_KEYWORD = 290,
89     VARIABLE = 291,
90     ASSIGN_MODIFY = 292,
91     TRUEKEYWORD = 293,
92     FALSEKEYWORD = 294,
93     ABOVE_COMMA = 295,
94     OROR = 296,
95     ANDAND = 297,
96     NOTEQUAL = 298,
97     EQUAL = 299,
98     GEQ = 300,
99     LEQ = 301,
100     RSH = 302,
101     LSH = 303,
102     DECREMENT = 304,
103     INCREMENT = 305,
104     UNARY = 306,
105     DOT_STAR = 307,
106     ARROW_STAR = 308,
107     ARROW = 309,
108     BLOCKNAME = 310,
109     FILENAME = 311
110   };
111#endif
112#define INT 258
113#define FLOAT 259
114#define DECFLOAT 260
115#define STRING 261
116#define CHAR 262
117#define NAME 263
118#define UNKNOWN_CPP_NAME 264
119#define COMPLETE 265
120#define TYPENAME 266
121#define NAME_OR_INT 267
122#define OPERATOR 268
123#define STRUCT 269
124#define CLASS 270
125#define UNION 271
126#define ENUM 272
127#define SIZEOF 273
128#define UNSIGNED 274
129#define COLONCOLON 275
130#define TEMPLATE 276
131#define ERROR 277
132#define NEW 278
133#define DELETE 279
134#define REINTERPRET_CAST 280
135#define DYNAMIC_CAST 281
136#define STATIC_CAST 282
137#define CONST_CAST 283
138#define SIGNED_KEYWORD 284
139#define LONG 285
140#define SHORT 286
141#define INT_KEYWORD 287
142#define CONST_KEYWORD 288
143#define VOLATILE_KEYWORD 289
144#define DOUBLE_KEYWORD 290
145#define VARIABLE 291
146#define ASSIGN_MODIFY 292
147#define TRUEKEYWORD 293
148#define FALSEKEYWORD 294
149#define ABOVE_COMMA 295
150#define OROR 296
151#define ANDAND 297
152#define NOTEQUAL 298
153#define EQUAL 299
154#define GEQ 300
155#define LEQ 301
156#define RSH 302
157#define LSH 303
158#define DECREMENT 304
159#define INCREMENT 305
160#define UNARY 306
161#define DOT_STAR 307
162#define ARROW_STAR 308
163#define ARROW 309
164#define BLOCKNAME 310
165#define FILENAME 311
166
167
168
169
170/* Copy the first part of user declarations.  */
171#line 38 "c-exp.y"
172
173
174#include "defs.h"
175#include "gdb_string.h"
176#include <ctype.h>
177#include "expression.h"
178#include "value.h"
179#include "parser-defs.h"
180#include "language.h"
181#include "c-lang.h"
182#include "bfd.h" /* Required by objfiles.h.  */
183#include "symfile.h" /* Required by objfiles.h.  */
184#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
185#include "charset.h"
186#include "block.h"
187#include "cp-support.h"
188#include "dfp.h"
189#include "gdb_assert.h"
190#include "macroscope.h"
191
192#define parse_type builtin_type (parse_gdbarch)
193
194/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
195   as well as gratuitiously global symbol names, so we can have multiple
196   yacc generated parsers in gdb.  Note that these are only the variables
197   produced by yacc.  If other parser generators (bison, byacc, etc) produce
198   additional global names that conflict at link time, then those parser
199   generators need to be fixed instead of adding those names to this list. */
200
201#define	yymaxdepth c_maxdepth
202#define	yyparse	c_parse_internal
203#define	yylex	c_lex
204#define	yyerror	c_error
205#define	yylval	c_lval
206#define	yychar	c_char
207#define	yydebug	c_debug
208#define	yypact	c_pact
209#define	yyr1	c_r1
210#define	yyr2	c_r2
211#define	yydef	c_def
212#define	yychk	c_chk
213#define	yypgo	c_pgo
214#define	yyact	c_act
215#define	yyexca	c_exca
216#define yyerrflag c_errflag
217#define yynerrs	c_nerrs
218#define	yyps	c_ps
219#define	yypv	c_pv
220#define	yys	c_s
221#define	yy_yys	c_yys
222#define	yystate	c_state
223#define	yytmp	c_tmp
224#define	yyv	c_v
225#define	yy_yyv	c_yyv
226#define	yyval	c_val
227#define	yylloc	c_lloc
228#define yyreds	c_reds		/* With YYDEBUG defined */
229#define yytoks	c_toks		/* With YYDEBUG defined */
230#define yyname	c_name		/* With YYDEBUG defined */
231#define yyrule	c_rule		/* With YYDEBUG defined */
232#define yylhs	c_yylhs
233#define yylen	c_yylen
234#define yydefred c_yydefred
235#define yydgoto	c_yydgoto
236#define yysindex c_yysindex
237#define yyrindex c_yyrindex
238#define yygindex c_yygindex
239#define yytable	 c_yytable
240#define yycheck	 c_yycheck
241
242#ifndef YYDEBUG
243#define	YYDEBUG 1		/* Default to yydebug support */
244#endif
245
246#define YYFPRINTF parser_fprintf
247
248int yyparse (void);
249
250static int yylex (void);
251
252void yyerror (char *);
253
254
255
256/* Enabling traces.  */
257#ifndef YYDEBUG
258# define YYDEBUG 0
259#endif
260
261/* Enabling verbose error messages.  */
262#ifdef YYERROR_VERBOSE
263# undef YYERROR_VERBOSE
264# define YYERROR_VERBOSE 1
265#else
266# define YYERROR_VERBOSE 0
267#endif
268
269#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
270#line 127 "c-exp.y"
271typedef union YYSTYPE {
272    LONGEST lval;
273    struct {
274      LONGEST val;
275      struct type *type;
276    } typed_val_int;
277    struct {
278      DOUBLEST dval;
279      struct type *type;
280    } typed_val_float;
281    struct {
282      gdb_byte val[16];
283      struct type *type;
284    } typed_val_decfloat;
285    struct symbol *sym;
286    struct type *tval;
287    struct stoken sval;
288    struct typed_stoken tsval;
289    struct ttype tsym;
290    struct symtoken ssym;
291    int voidval;
292    struct block *bval;
293    enum exp_opcode opcode;
294    struct internalvar *ivar;
295
296    struct stoken_vector svec;
297    struct type **tvec;
298    int *ivec;
299  } YYSTYPE;
300/* Line 191 of yacc.c.  */
301#line 302 "c-exp.c"
302# define yystype YYSTYPE /* obsolescent; will be withdrawn */
303# define YYSTYPE_IS_DECLARED 1
304# define YYSTYPE_IS_TRIVIAL 1
305#endif
306
307
308
309/* Copy the second part of user declarations.  */
310#line 157 "c-exp.y"
311
312/* YYSTYPE gets defined by %union */
313static int parse_number (char *, int, int, YYSTYPE *);
314static struct stoken operator_stoken (const char *);
315
316
317/* Line 214 of yacc.c.  */
318#line 319 "c-exp.c"
319
320#if ! defined (yyoverflow) || YYERROR_VERBOSE
321
322# ifndef YYFREE
323#  define YYFREE xfree
324# endif
325# ifndef YYMALLOC
326#  define YYMALLOC xmalloc
327# endif
328
329/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
330
331# ifdef YYSTACK_USE_ALLOCA
332#  if YYSTACK_USE_ALLOCA
333#   define YYSTACK_ALLOC alloca
334#  endif
335# else
336#  if defined (alloca) || defined (_ALLOCA_H)
337#   define YYSTACK_ALLOC alloca
338#  else
339#   ifdef __GNUC__
340#    define YYSTACK_ALLOC __builtin_alloca
341#   endif
342#  endif
343# endif
344
345# ifdef YYSTACK_ALLOC
346   /* Pacify GCC's `empty if-body' warning. */
347#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
348# else
349#  if defined (__STDC__) || defined (__cplusplus)
350#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
351#   define YYSIZE_T size_t
352#  endif
353#  define YYSTACK_ALLOC YYMALLOC
354#  define YYSTACK_FREE YYFREE
355# endif
356#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
357
358
359#if (! defined (yyoverflow) \
360     && (! defined (__cplusplus) \
361	 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
362
363/* A type that is properly aligned for any stack member.  */
364union yyalloc
365{
366  short yyss;
367  YYSTYPE yyvs;
368  };
369
370/* The size of the maximum gap between one aligned stack and the next.  */
371# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
372
373/* The size of an array large to enough to hold all stacks, each with
374   N elements.  */
375# define YYSTACK_BYTES(N) \
376     ((N) * (sizeof (short) + sizeof (YYSTYPE))				\
377      + YYSTACK_GAP_MAXIMUM)
378
379/* Copy COUNT objects from FROM to TO.  The source and destination do
380   not overlap.  */
381# ifndef YYCOPY
382#  if defined (__GNUC__) && 1 < __GNUC__
383#   define YYCOPY(To, From, Count) \
384      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
385#  else
386#   define YYCOPY(To, From, Count)		\
387      do					\
388	{					\
389	  register YYSIZE_T yyi;		\
390	  for (yyi = 0; yyi < (Count); yyi++)	\
391	    (To)[yyi] = (From)[yyi];		\
392	}					\
393      while (0)
394#  endif
395# endif
396
397/* Relocate STACK from its old location to the new one.  The
398   local variables YYSIZE and YYSTACKSIZE give the old and new number of
399   elements in the stack, and YYPTR gives the new location of the
400   stack.  Advance YYPTR to a properly aligned location for the next
401   stack.  */
402# define YYSTACK_RELOCATE(Stack)					\
403    do									\
404      {									\
405	YYSIZE_T yynewbytes;						\
406	YYCOPY (&yyptr->Stack, Stack, yysize);				\
407	Stack = &yyptr->Stack;						\
408	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
409	yyptr += yynewbytes / sizeof (*yyptr);				\
410      }									\
411    while (0)
412
413#endif
414
415#if defined (__STDC__) || defined (__cplusplus)
416   typedef signed char yysigned_char;
417#else
418   typedef short yysigned_char;
419#endif
420
421/* YYFINAL -- State number of the termination state. */
422#define YYFINAL  148
423/* YYLAST -- Last index in YYTABLE.  */
424#define YYLAST   1170
425
426/* YYNTOKENS -- Number of terminals. */
427#define YYNTOKENS  81
428/* YYNNTS -- Number of nonterminals. */
429#define YYNNTS  33
430/* YYNRULES -- Number of rules. */
431#define YYNRULES  211
432/* YYNRULES -- Number of states. */
433#define YYNSTATES  328
434
435/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
436#define YYUNDEFTOK  2
437#define YYMAXUTOK   311
438
439#define YYTRANSLATE(YYX) 						\
440  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
441
442/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
443static const unsigned char yytranslate[] =
444{
445       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
446       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
447       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
448       2,     2,     2,    74,     2,     2,     2,    62,    48,     2,
449      68,    77,    60,    58,    40,    59,    66,    61,     2,     2,
450       2,     2,     2,     2,     2,     2,     2,     2,    80,     2,
451      51,    42,    52,    43,    57,     2,     2,     2,     2,     2,
452       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
453       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
454       2,    67,     2,    76,    47,     2,     2,     2,     2,     2,
455       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
457       2,     2,     2,    78,    46,    79,    75,     2,     2,     2,
458       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
459       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
460       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
461       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
462       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
463       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
464       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
465       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
466       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
467       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
468       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
469       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
470       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
471       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
472      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
473      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
474      35,    36,    37,    38,    39,    41,    44,    45,    49,    50,
475      53,    54,    55,    56,    63,    64,    65,    69,    70,    71,
476      72,    73
477};
478
479#if YYDEBUG
480/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
481   YYRHS.  */
482static const unsigned short yyprhs[] =
483{
484       0,     0,     3,     5,     7,     9,    11,    15,    18,    21,
485      24,    27,    30,    33,    36,    39,    42,    45,    48,    52,
486      57,    61,    65,    69,    73,    78,    82,    86,    90,    95,
487      96,   102,   103,   109,   111,   112,   114,   118,   124,   126,
488     130,   135,   140,   144,   148,   152,   156,   160,   164,   168,
489     172,   176,   180,   184,   188,   192,   196,   200,   204,   208,
490     212,   216,   220,   226,   230,   234,   236,   238,   240,   242,
491     244,   246,   248,   253,   261,   269,   277,   285,   287,   290,
492     292,   294,   296,   298,   300,   304,   308,   312,   317,   323,
493     325,   328,   330,   333,   335,   336,   340,   342,   344,   346,
494     347,   349,   352,   354,   357,   359,   363,   366,   368,   371,
495     373,   376,   380,   383,   387,   389,   391,   393,   395,   397,
496     400,   404,   407,   411,   415,   419,   422,   425,   429,   434,
497     438,   442,   447,   451,   456,   460,   465,   468,   472,   475,
498     479,   482,   486,   488,   491,   494,   497,   500,   503,   506,
499     508,   511,   513,   519,   522,   525,   527,   529,   531,   533,
500     535,   539,   541,   546,   549,   552,   554,   556,   558,   561,
501     564,   569,   574,   577,   580,   583,   586,   589,   592,   595,
502     598,   601,   604,   607,   610,   613,   616,   619,   622,   625,
503     628,   631,   634,   637,   640,   643,   646,   649,   652,   655,
504     659,   663,   666,   668,   670,   672,   674,   676,   678,   680,
505     682,   684
506};
507
508/* YYRHS -- A `-1'-separated list of the rules' RHS. */
509static const yysigned_char yyrhs[] =
510{
511      82,     0,    -1,    84,    -1,    83,    -1,   104,    -1,    85,
512      -1,    84,    40,    85,    -1,    60,    85,    -1,    48,    85,
513      -1,    59,    85,    -1,    58,    85,    -1,    74,    85,    -1,
514      75,    85,    -1,    64,    85,    -1,    63,    85,    -1,    85,
515      64,    -1,    85,    63,    -1,    18,    85,    -1,    85,    71,
516     112,    -1,    85,    71,   112,    10,    -1,    85,    71,    10,
517      -1,    85,    71,    94,    -1,    85,    70,    85,    -1,    85,
518      66,   112,    -1,    85,    66,   112,    10,    -1,    85,    66,
519      10,    -1,    85,    66,    94,    -1,    85,    69,    85,    -1,
520      85,    67,    84,    76,    -1,    -1,    85,    68,    86,    89,
521      77,    -1,    -1,     9,    68,    87,    89,    77,    -1,    78,
522      -1,    -1,    85,    -1,    89,    40,    85,    -1,    85,    68,
523     107,    77,    96,    -1,    79,    -1,    88,    89,    90,    -1,
524      88,   104,    90,    85,    -1,    68,   104,    77,    85,    -1,
525      68,    84,    77,    -1,    85,    57,    85,    -1,    85,    60,
526      85,    -1,    85,    61,    85,    -1,    85,    62,    85,    -1,
527      85,    58,    85,    -1,    85,    59,    85,    -1,    85,    56,
528      85,    -1,    85,    55,    85,    -1,    85,    50,    85,    -1,
529      85,    49,    85,    -1,    85,    54,    85,    -1,    85,    53,
530      85,    -1,    85,    51,    85,    -1,    85,    52,    85,    -1,
531      85,    48,    85,    -1,    85,    47,    85,    -1,    85,    46,
532      85,    -1,    85,    45,    85,    -1,    85,    44,    85,    -1,
533      85,    43,    85,    80,    85,    -1,    85,    42,    85,    -1,
534      85,    37,    85,    -1,     3,    -1,     7,    -1,    12,    -1,
535       4,    -1,     5,    -1,    93,    -1,    36,    -1,    18,    68,
536     104,    77,    -1,    25,    51,   104,    52,    68,    85,    77,
537      -1,    27,    51,   104,    52,    68,    85,    77,    -1,    26,
538      51,   104,    52,    68,    85,    77,    -1,    28,    51,   104,
539      52,    68,    85,    77,    -1,     6,    -1,    91,     6,    -1,
540      91,    -1,    38,    -1,    39,    -1,    72,    -1,    73,    -1,
541      92,    20,   112,    -1,    92,    20,   112,    -1,    11,    20,
542     112,    -1,    11,    20,    75,   112,    -1,    11,    20,   112,
543      20,   112,    -1,    94,    -1,    20,   113,    -1,   113,    -1,
544      57,     8,    -1,   110,    -1,    -1,    96,    95,    96,    -1,
545      97,    -1,   110,    -1,    98,    -1,    -1,    60,    -1,    60,
546     100,    -1,    48,    -1,    48,   100,    -1,   101,    -1,    68,
547     100,    77,    -1,   101,   102,    -1,   102,    -1,   101,   103,
548      -1,   103,    -1,    67,    76,    -1,    67,     3,    76,    -1,
549      68,    77,    -1,    68,   107,    77,    -1,   108,    -1,    11,
550      -1,    32,    -1,    30,    -1,    31,    -1,    30,    32,    -1,
551      30,    29,    32,    -1,    30,    29,    -1,    29,    30,    32,
552      -1,    19,    30,    32,    -1,    30,    19,    32,    -1,    30,
553      19,    -1,    30,    30,    -1,    30,    30,    32,    -1,    30,
554      30,    29,    32,    -1,    30,    30,    29,    -1,    29,    30,
555      30,    -1,    29,    30,    30,    32,    -1,    19,    30,    30,
556      -1,    19,    30,    30,    32,    -1,    30,    30,    19,    -1,
557      30,    30,    19,    32,    -1,    31,    32,    -1,    31,    29,
558      32,    -1,    31,    29,    -1,    19,    31,    32,    -1,    31,
559      19,    -1,    31,    19,    32,    -1,    35,    -1,    30,    35,
560      -1,    14,   112,    -1,    15,   112,    -1,    16,   112,    -1,
561      17,   112,    -1,    19,   106,    -1,    19,    -1,    29,   106,
562      -1,    29,    -1,    21,   112,    51,   104,    52,    -1,    98,
563     105,    -1,   105,    98,    -1,    11,    -1,    32,    -1,    30,
564      -1,    31,    -1,   104,    -1,   107,    40,   104,    -1,   105,
565      -1,   108,    99,   100,    99,    -1,    33,    34,    -1,    34,
566      33,    -1,   109,    -1,    33,    -1,    34,    -1,    13,    23,
567      -1,    13,    24,    -1,    13,    23,    67,    76,    -1,    13,
568      24,    67,    76,    -1,    13,    58,    -1,    13,    59,    -1,
569      13,    60,    -1,    13,    61,    -1,    13,    62,    -1,    13,
570      47,    -1,    13,    48,    -1,    13,    46,    -1,    13,    75,
571      -1,    13,    74,    -1,    13,    42,    -1,    13,    51,    -1,
572      13,    52,    -1,    13,    37,    -1,    13,    56,    -1,    13,
573      55,    -1,    13,    50,    -1,    13,    49,    -1,    13,    54,
574      -1,    13,    53,    -1,    13,    45,    -1,    13,    44,    -1,
575      13,    64,    -1,    13,    63,    -1,    13,    40,    -1,    13,
576      70,    -1,    13,    71,    -1,    13,    68,    77,    -1,    13,
577      67,    76,    -1,    13,   108,    -1,     8,    -1,    72,    -1,
578      11,    -1,    12,    -1,     9,    -1,   111,    -1,     8,    -1,
579      72,    -1,   111,    -1,     9,    -1
580};
581
582/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
583static const unsigned short yyrline[] =
584{
585       0,   250,   250,   251,   254,   261,   262,   267,   271,   275,
586     279,   283,   287,   291,   295,   299,   303,   307,   311,   317,
587     324,   334,   342,   346,   352,   359,   369,   377,   381,   388,
588     385,   396,   395,   418,   422,   425,   429,   433,   445,   448,
589     455,   461,   467,   473,   477,   481,   485,   489,   493,   497,
590     501,   505,   509,   513,   517,   521,   525,   529,   533,   537,
591     541,   545,   549,   553,   557,   563,   570,   579,   590,   597,
592     604,   607,   613,   623,   629,   635,   641,   650,   667,   685,
593     719,   726,   735,   743,   749,   759,   774,   789,   813,   822,
594     823,   851,   905,   911,   912,   915,   918,   919,   923,   924,
595     927,   929,   931,   933,   935,   938,   940,   945,   952,   954,
596     958,   960,   964,   966,   978,   982,   984,   988,   992,   996,
597    1000,  1004,  1008,  1012,  1016,  1020,  1024,  1028,  1032,  1036,
598    1040,  1044,  1048,  1052,  1056,  1060,  1064,  1068,  1072,  1076,
599    1080,  1084,  1088,  1092,  1096,  1099,  1102,  1105,  1108,  1112,
600    1116,  1120,  1127,  1131,  1133,  1137,  1138,  1146,  1154,  1165,
601    1170,  1177,  1178,  1182,  1183,  1186,  1190,  1192,  1196,  1198,
602    1200,  1202,  1204,  1206,  1208,  1210,  1212,  1214,  1216,  1218,
603    1220,  1222,  1224,  1226,  1228,  1230,  1270,  1272,  1274,  1276,
604    1278,  1280,  1282,  1284,  1286,  1288,  1290,  1292,  1294,  1296,
605    1298,  1300,  1315,  1316,  1317,  1318,  1319,  1320,  1323,  1324,
606    1332,  1340
607};
608#endif
609
610#if YYDEBUG || YYERROR_VERBOSE
611/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
612   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
613static const char *const yytname[] =
614{
615  "$end", "error", "$undefined", "INT", "FLOAT", "DECFLOAT", "STRING",
616  "CHAR", "NAME", "UNKNOWN_CPP_NAME", "COMPLETE", "TYPENAME",
617  "NAME_OR_INT", "OPERATOR", "STRUCT", "CLASS", "UNION", "ENUM", "SIZEOF",
618  "UNSIGNED", "COLONCOLON", "TEMPLATE", "ERROR", "NEW", "DELETE",
619  "REINTERPRET_CAST", "DYNAMIC_CAST", "STATIC_CAST", "CONST_CAST",
620  "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD", "CONST_KEYWORD",
621  "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "VARIABLE", "ASSIGN_MODIFY",
622  "TRUEKEYWORD", "FALSEKEYWORD", "','", "ABOVE_COMMA", "'='", "'?'",
623  "OROR", "ANDAND", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'",
624  "GEQ", "LEQ", "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'",
625  "DECREMENT", "INCREMENT", "UNARY", "'.'", "'['", "'('", "DOT_STAR",
626  "ARROW_STAR", "ARROW", "BLOCKNAME", "FILENAME", "'!'", "'~'", "']'",
627  "')'", "'{'", "'}'", "':'", "$accept", "start", "type_exp", "exp1",
628  "exp", "@1", "@2", "lcurly", "arglist", "rcurly", "string_exp", "block",
629  "variable", "qualified_name", "space_identifier", "const_or_volatile",
630  "cv_with_space_id", "const_or_volatile_or_space_identifier_noopt",
631  "const_or_volatile_or_space_identifier", "abs_decl", "direct_abs_decl",
632  "array_mod", "func_mod", "type", "typebase", "typename",
633  "nonempty_typelist", "ptype", "const_and_volatile",
634  "const_or_volatile_noopt", "operator", "name", "name_not_typename", 0
635};
636#endif
637
638# ifdef YYPRINT
639/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
640   token YYLEX-NUM.  */
641static const unsigned short yytoknum[] =
642{
643       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
644     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
645     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
646     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
647      44,   295,    61,    63,   296,   297,   124,    94,    38,   298,
648     299,    60,    62,   300,   301,   302,   303,    64,    43,    45,
649      42,    47,    37,   304,   305,   306,    46,    91,    40,   307,
650     308,   309,   310,   311,    33,   126,    93,    41,   123,   125,
651      58
652};
653# endif
654
655/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
656static const unsigned char yyr1[] =
657{
658       0,    81,    82,    82,    83,    84,    84,    85,    85,    85,
659      85,    85,    85,    85,    85,    85,    85,    85,    85,    85,
660      85,    85,    85,    85,    85,    85,    85,    85,    85,    86,
661      85,    87,    85,    88,    89,    89,    89,    85,    90,    85,
662      85,    85,    85,    85,    85,    85,    85,    85,    85,    85,
663      85,    85,    85,    85,    85,    85,    85,    85,    85,    85,
664      85,    85,    85,    85,    85,    85,    85,    85,    85,    85,
665      85,    85,    85,    85,    85,    85,    85,    91,    91,    85,
666      85,    85,    92,    92,    92,    93,    94,    94,    94,    93,
667      93,    93,    95,    96,    96,    97,    98,    98,    99,    99,
668     100,   100,   100,   100,   100,   101,   101,   101,   101,   101,
669     102,   102,   103,   103,   104,   105,   105,   105,   105,   105,
670     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
671     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
672     105,   105,   105,   105,   105,   105,   105,   105,   105,   105,
673     105,   105,   105,   105,   105,   106,   106,   106,   106,   107,
674     107,   108,   108,   109,   109,   110,   110,   110,   111,   111,
675     111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
676     111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
677     111,   111,   111,   111,   111,   111,   111,   111,   111,   111,
678     111,   111,   112,   112,   112,   112,   112,   112,   113,   113,
679     113,   113
680};
681
682/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
683static const unsigned char yyr2[] =
684{
685       0,     2,     1,     1,     1,     1,     3,     2,     2,     2,
686       2,     2,     2,     2,     2,     2,     2,     2,     3,     4,
687       3,     3,     3,     3,     4,     3,     3,     3,     4,     0,
688       5,     0,     5,     1,     0,     1,     3,     5,     1,     3,
689       4,     4,     3,     3,     3,     3,     3,     3,     3,     3,
690       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
691       3,     3,     5,     3,     3,     1,     1,     1,     1,     1,
692       1,     1,     4,     7,     7,     7,     7,     1,     2,     1,
693       1,     1,     1,     1,     3,     3,     3,     4,     5,     1,
694       2,     1,     2,     1,     0,     3,     1,     1,     1,     0,
695       1,     2,     1,     2,     1,     3,     2,     1,     2,     1,
696       2,     3,     2,     3,     1,     1,     1,     1,     1,     2,
697       3,     2,     3,     3,     3,     2,     2,     3,     4,     3,
698       3,     4,     3,     4,     3,     4,     2,     3,     2,     3,
699       2,     3,     1,     2,     2,     2,     2,     2,     2,     1,
700       2,     1,     5,     2,     2,     1,     1,     1,     1,     1,
701       3,     1,     4,     2,     2,     1,     1,     1,     2,     2,
702       4,     4,     2,     2,     2,     2,     2,     2,     2,     2,
703       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
704       2,     2,     2,     2,     2,     2,     2,     2,     2,     3,
705       3,     2,     1,     1,     1,     1,     1,     1,     1,     1,
706       1,     1
707};
708
709/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
710   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
711   means the default is an error.  */
712static const unsigned char yydefact[] =
713{
714      94,    65,    68,    69,    77,    66,   208,   211,   115,    67,
715      94,     0,     0,     0,     0,     0,   149,     0,     0,     0,
716       0,     0,     0,   151,   117,   118,   116,   166,   167,   142,
717      71,    80,    81,     0,     0,     0,     0,     0,     0,    94,
718     209,    83,     0,     0,    33,     0,     3,     2,     5,    34,
719      79,     0,    70,    89,     0,    96,    94,     4,   161,   114,
720     165,    97,   210,    91,    31,     0,   115,   168,   169,   185,
721     196,   182,   193,   192,   179,   177,   178,   189,   188,   183,
722     184,   191,   190,   187,   186,   172,   173,   174,   175,   176,
723     195,   194,     0,     0,   197,   198,   181,   180,   201,   202,
724     206,   204,   205,   203,   207,   144,   145,   146,   147,     0,
725      94,    17,   155,   157,   158,   156,   148,   211,   209,    90,
726       0,    94,    94,    94,    94,   157,   158,   150,   125,   121,
727     126,   119,   143,   140,   138,   136,   163,   164,     8,    10,
728       9,     7,    14,    13,     0,     0,    11,    12,     1,     0,
729       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
730       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
731       0,     0,    16,    15,     0,     0,    29,     0,     0,     0,
732      35,     0,     0,    78,     0,     0,    94,   153,   154,    98,
733       0,    34,     0,    86,     0,     0,   200,   199,     0,   132,
734     123,   139,    94,     0,     0,     0,     0,   130,   122,   124,
735     120,   134,   129,   127,   141,   137,    42,     0,     6,    64,
736      63,     0,    61,    60,    59,    58,    57,    52,    51,    55,
737      56,    54,    53,    50,    49,    43,    47,    48,    44,    45,
738      46,    25,   204,    26,    23,     0,    34,   159,     0,    27,
739      22,    20,    21,    18,     0,    38,    39,     0,    85,    92,
740      95,    93,   102,   100,     0,    94,    99,   104,   107,   109,
741       0,    87,     0,   170,   171,    72,   133,     0,     0,     0,
742       0,     0,   131,   135,   128,    41,     0,    24,    28,     0,
743      94,    94,    19,    36,    40,   103,   101,     0,   110,   112,
744       0,     0,   162,    94,   106,   108,    32,    88,   152,     0,
745       0,     0,     0,    62,    30,   160,    37,   111,   105,   113,
746       0,     0,     0,     0,    73,    75,    74,    76
747};
748
749/* YYDEFGOTO[NTERM-NUM]. */
750static const short yydefgoto[] =
751{
752      -1,    45,    46,   144,    48,   246,   191,    49,   181,   256,
753      50,    51,    52,    53,   186,    54,    55,    56,   190,   266,
754     267,   268,   269,   247,    58,   116,   301,    59,    60,    61,
755      62,   105,    63
756};
757
758/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
759   STATE-NUM.  */
760#define YYPACT_NINF -177
761static const short yypact[] =
762{
763     371,  -177,  -177,  -177,  -177,  -177,  -177,   -43,    21,  -177,
764     664,   210,   210,   210,   210,   447,    96,    85,   210,    17,
765      23,    26,    34,    99,    54,    59,  -177,    18,    12,  -177,
766    -177,  -177,  -177,   523,   523,   523,   523,   523,   523,   371,
767      77,  -177,   523,   523,  -177,   108,  -177,    72,   882,   295,
768     109,    97,  -177,  -177,    64,  -177,  1050,  -177,    38,   201,
769    -177,   102,  -177,  -177,  -177,    24,  -177,   110,   114,  -177,
770    -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,
771    -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,
772    -177,  -177,   106,   107,  -177,  -177,  -177,  -177,   201,  -177,
773    -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,  -177,    21,
774     371,   430,  -177,    50,   156,  -177,  -177,  -177,  -177,  -177,
775     138,  1050,  1050,  1050,  1050,    60,  -177,  -177,   162,   164,
776     142,  -177,  -177,   166,   167,  -177,  -177,  -177,   430,   430,
777     430,   430,   430,   430,   -23,   123,   430,   430,  -177,   523,
778     523,   523,   523,   523,   523,   523,   523,   523,   523,   523,
779     523,   523,   523,   523,   523,   523,   523,   523,   523,   523,
780     523,   523,  -177,  -177,    92,   523,   625,   523,   523,   204,
781     882,   -24,   122,  -177,   210,   196,    86,    38,  -177,  -177,
782     112,   523,   210,   200,   157,   165,  -177,  -177,   155,   206,
783    -177,  -177,  1050,   188,   193,   194,   195,   216,  -177,  -177,
784    -177,   218,   219,  -177,  -177,  -177,  -177,   523,   882,   882,
785     882,   699,   938,   964,   989,  1038,  1061,  1082,  1082,  1099,
786    1099,  1099,  1099,   278,   278,   354,   217,   217,   430,   430,
787     430,  -177,    21,  -177,   242,   -16,   523,  -177,    -2,   159,
788     159,  -177,  -177,   244,   523,  -177,  -177,   523,   235,  -177,
789    -177,  -177,    46,   -10,    11,   176,    38,    65,  -177,  -177,
790      -1,  -177,   210,  -177,  -177,   599,  -177,   205,   191,   197,
791     199,   202,  -177,  -177,  -177,   430,   523,  -177,  -177,     2,
792    1050,    86,  -177,   882,   430,  -177,  -177,   180,  -177,  -177,
793     185,     4,  -177,    32,  -177,  -177,  -177,  -177,  -177,   523,
794     523,   523,   523,   911,  -177,  -177,  -177,  -177,  -177,  -177,
795     738,   774,   810,   846,  -177,  -177,  -177,  -177
796};
797
798/* YYPGOTO[NTERM-NUM].  */
799static const short yypgoto[] =
800{
801    -177,  -177,  -177,    10,   -15,  -177,  -177,  -177,  -176,    82,
802    -177,  -177,  -177,  -148,  -177,  -175,  -177,   -29,     6,   -96,
803    -177,     7,     8,     1,   233,   250,   116,   280,  -177,  -173,
804      -9,    -6,   276
805};
806
807/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
808   positive, shift that token.  If negative, reduce the rule which
809   number is the opposite.  If zero, do what YYDEFACT says.
810   If YYTABLE_NINF, syntax error.  */
811#define YYTABLE_NINF -100
812static const short yytable[] =
813{
814     111,    57,   104,   104,   104,   104,   106,   107,   108,   104,
815      47,   260,   120,   261,   297,   270,   254,   149,   138,   139,
816     140,   141,   142,   143,   149,    64,   243,   146,   147,   188,
817     189,   252,    99,   100,   180,   101,   102,    10,   290,   254,
818     145,    65,   254,    66,   290,   137,    11,    12,    13,    14,
819     182,    16,   136,    18,   216,   255,   104,   264,   265,   193,
820     288,    23,    24,    25,    26,    27,    28,    29,   121,   189,
821     289,    27,    28,   128,   122,   291,   306,   123,   133,   314,
822     199,   319,   200,   129,   130,   124,   131,   298,   134,   132,
823     207,   135,   208,     6,   117,   -94,   103,   -82,    10,   192,
824      99,   100,   241,   242,   102,    10,   263,   112,   148,   299,
825     112,   198,   149,   264,   265,   183,   316,   184,   261,    27,
826      28,   185,   203,   204,   205,   206,   113,   114,   115,   125,
827     126,   115,   264,   303,   218,   219,   220,   221,   222,   223,
828     224,   225,   226,   227,   228,   229,   230,   231,   232,   233,
829     234,   235,   236,   237,   238,   239,   240,   118,   188,   -93,
830     262,   211,   249,   250,   103,   104,   295,   296,   244,   300,
831     104,   212,   263,   253,   213,   104,   180,   194,   258,   264,
832     265,   195,   196,   104,   197,   245,   271,    66,   201,   202,
833      11,    12,    13,    14,   209,    16,   210,    18,   214,   215,
834     217,   255,   285,   277,   259,    23,    24,    25,    26,    27,
835      28,    29,    99,   100,   251,   242,   102,    10,    99,   100,
836     272,   101,   102,    10,   262,   174,   175,   176,   177,   178,
837     179,   180,   275,   273,    27,    28,   263,   189,   276,   293,
838     278,   274,   294,   264,   265,   279,   280,   281,   282,   -99,
839     283,   284,   287,   299,   292,   -84,   317,   308,   -94,   309,
840     285,   -99,   318,   104,   257,   310,   307,   311,   -99,   -99,
841     312,   313,   302,   127,   304,   305,   103,   169,   170,   171,
842     172,   173,   103,   174,   175,   176,   177,   178,   179,   187,
843      98,   315,   248,   119,   320,   321,   322,   323,     1,     2,
844       3,     4,     5,     6,     7,     0,     8,     9,    10,    11,
845      12,    13,    14,    15,    16,    17,    18,     0,     0,     0,
846      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
847      29,    30,     0,    31,    32,   166,   167,   168,   169,   170,
848     171,   172,   173,    33,   174,   175,   176,   177,   178,   179,
849       0,     0,   -94,    34,    35,    36,     0,     0,    37,    38,
850       0,     0,     0,    39,     0,     0,     0,    40,    41,    42,
851      43,     0,     0,    44,     1,     2,     3,     4,     5,     6,
852       7,     0,     8,     9,    10,    11,    12,    13,    14,    15,
853      16,    17,    18,     0,     0,     0,    19,    20,    21,    22,
854      23,    24,    25,    26,    27,    28,    29,    30,     0,    31,
855      32,     0,   167,   168,   169,   170,   171,   172,   173,    33,
856     174,   175,   176,   177,   178,   179,     0,     0,     0,    34,
857      35,    36,     0,     0,    37,    38,     0,     0,     0,    39,
858       0,     0,     0,    40,    41,    42,    43,     0,     0,    44,
859       1,     2,     3,     4,     5,     6,     7,     0,   109,     9,
860      10,     0,     0,     0,     0,    15,     0,    17,     0,     0,
861       0,     0,    19,    20,    21,    22,     0,     0,     0,     0,
862       0,     0,     0,    30,     0,    31,    32,     0,     0,     0,
863       0,     0,     0,   172,   173,    33,   174,   175,   176,   177,
864     178,   179,     0,     0,     0,    34,    35,    36,     0,     0,
865      37,    38,     0,     0,     0,   110,     0,     0,     0,    40,
866      41,    42,    43,     0,     0,    44,     1,     2,     3,     4,
867       5,     6,     7,     0,   109,     9,    10,     0,     0,     0,
868       0,    15,     0,    17,     0,     0,     0,     0,    19,    20,
869      21,    22,     0,     0,     0,     0,     0,     0,     0,    30,
870       0,    31,    32,     0,     0,     0,     0,     0,     0,     0,
871       0,    33,     0,     0,     0,     0,     0,     0,     0,     0,
872       0,    34,    35,    36,     0,     0,    37,    38,     0,     0,
873       0,    39,     0,     0,     0,    40,    41,    42,    43,     0,
874       0,    44,     1,     2,     3,     4,     5,     6,     7,     0,
875     109,     9,    10,     0,     0,     0,     0,    15,     0,    17,
876       0,     0,     0,     0,    19,    20,    21,    22,     0,     0,
877       0,     0,     0,     0,     0,    30,    66,    31,    32,    11,
878      12,    13,    14,     0,    16,     0,    18,     0,     0,     0,
879       0,     0,     0,     0,    23,    24,    25,    26,    27,    28,
880      29,     0,    37,    38,     0,     0,     0,    39,     0,     0,
881       0,    40,    41,    42,    43,    66,     0,    44,    11,    12,
882      13,    14,   -94,    16,     0,    18,     0,    67,    68,     0,
883       0,     0,     0,    23,    24,    25,    26,    27,    28,    29,
884       0,    69,     0,     0,    70,     0,    71,     0,    72,    73,
885      74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
886      84,     0,    85,    86,    87,    88,    89,    90,    91,     0,
887       0,    92,    93,     0,    94,    95,   150,     0,    96,    97,
888       0,   151,   152,   153,   154,   155,   156,   157,   158,   159,
889     160,   161,   162,   163,   164,   165,   166,   167,   168,   169,
890     170,   171,   172,   173,     0,   174,   175,   176,   177,   178,
891     179,     0,     0,     0,     0,   150,     0,     0,     0,   286,
892     151,   152,   153,   154,   155,   156,   157,   158,   159,   160,
893     161,   162,   163,   164,   165,   166,   167,   168,   169,   170,
894     171,   172,   173,     0,   174,   175,   176,   177,   178,   179,
895       0,   150,     0,     0,     0,   324,   151,   152,   153,   154,
896     155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
897     165,   166,   167,   168,   169,   170,   171,   172,   173,     0,
898     174,   175,   176,   177,   178,   179,     0,   150,     0,     0,
899       0,   325,   151,   152,   153,   154,   155,   156,   157,   158,
900     159,   160,   161,   162,   163,   164,   165,   166,   167,   168,
901     169,   170,   171,   172,   173,     0,   174,   175,   176,   177,
902     178,   179,     0,   150,     0,     0,     0,   326,   151,   152,
903     153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
904     163,   164,   165,   166,   167,   168,   169,   170,   171,   172,
905     173,     0,   174,   175,   176,   177,   178,   179,     0,   150,
906       0,     0,     0,   327,   151,   152,   153,   154,   155,   156,
907     157,   158,   159,   160,   161,   162,   163,   164,   165,   166,
908     167,   168,   169,   170,   171,   172,   173,     0,   174,   175,
909     176,   177,   178,   179,   152,   153,   154,   155,   156,   157,
910     158,   159,   160,   161,   162,   163,   164,   165,   166,   167,
911     168,   169,   170,   171,   172,   173,     0,   174,   175,   176,
912     177,   178,   179,   154,   155,   156,   157,   158,   159,   160,
913     161,   162,   163,   164,   165,   166,   167,   168,   169,   170,
914     171,   172,   173,     0,   174,   175,   176,   177,   178,   179,
915     155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
916     165,   166,   167,   168,   169,   170,   171,   172,   173,     0,
917     174,   175,   176,   177,   178,   179,   156,   157,   158,   159,
918     160,   161,   162,   163,   164,   165,   166,   167,   168,   169,
919     170,   171,   172,   173,     0,   174,   175,   176,   177,   178,
920     179,    66,     0,     0,    11,    12,    13,    14,     0,    16,
921       0,    18,     0,     0,     0,     0,     0,     0,     0,    23,
922      24,    25,    26,    27,    28,    29,   157,   158,   159,   160,
923     161,   162,   163,   164,   165,   166,   167,   168,   169,   170,
924     171,   172,   173,     0,   174,   175,   176,   177,   178,   179,
925     158,   159,   160,   161,   162,   163,   164,   165,   166,   167,
926     168,   169,   170,   171,   172,   173,     0,   174,   175,   176,
927     177,   178,   179,   160,   161,   162,   163,   164,   165,   166,
928     167,   168,   169,   170,   171,   172,   173,     0,   174,   175,
929     176,   177,   178,   179,   164,   165,   166,   167,   168,   169,
930     170,   171,   172,   173,     0,   174,   175,   176,   177,   178,
931     179
932};
933
934static const short yycheck[] =
935{
936      15,     0,    11,    12,    13,    14,    12,    13,    14,    18,
937       0,   186,    18,   186,     3,   191,    40,    40,    33,    34,
938      35,    36,    37,    38,    40,    68,   174,    42,    43,    58,
939      59,   179,     8,     9,    49,    11,    12,    13,    40,    40,
940      39,    20,    40,    11,    40,    33,    14,    15,    16,    17,
941      49,    19,    34,    21,    77,    79,    65,    67,    68,    65,
942      76,    29,    30,    31,    32,    33,    34,    35,    51,    98,
943     246,    33,    34,    19,    51,    77,    77,    51,    19,    77,
944      30,    77,    32,    29,    30,    51,    32,    76,    29,    35,
945      30,    32,    32,     8,     9,    57,    72,    20,    13,    75,
946       8,     9,    10,    11,    12,    13,    60,    11,     0,    77,
947      11,   110,    40,    67,    68,     6,   291,    20,   291,    33,
948      34,    57,   121,   122,   123,   124,    30,    31,    32,    30,
949      31,    32,    67,    68,   149,   150,   151,   152,   153,   154,
950     155,   156,   157,   158,   159,   160,   161,   162,   163,   164,
951     165,   166,   167,   168,   169,   170,   171,    72,   187,    57,
952      48,    19,   177,   178,    72,   174,   262,   263,   174,   265,
953     179,    29,    60,   179,    32,   184,   191,    67,   184,    67,
954      68,    67,    76,   192,    77,   175,   192,    11,    32,    51,
955      14,    15,    16,    17,    32,    19,    32,    21,    32,    32,
956      77,    79,   217,   202,     8,    29,    30,    31,    32,    33,
957      34,    35,     8,     9,    10,    11,    12,    13,     8,     9,
958      20,    11,    12,    13,    48,    66,    67,    68,    69,    70,
959      71,   246,    77,    76,    33,    34,    60,   266,    32,   254,
960      52,    76,   257,    67,    68,    52,    52,    52,    32,    48,
961      32,    32,    10,    77,    10,    20,    76,    52,    57,    68,
962     275,    60,    77,   272,   182,    68,   272,    68,    67,    68,
963      68,   286,   266,    23,   267,   267,    72,    60,    61,    62,
964      63,    64,    72,    66,    67,    68,    69,    70,    71,    56,
965      10,   290,   176,    17,   309,   310,   311,   312,     3,     4,
966       5,     6,     7,     8,     9,    -1,    11,    12,    13,    14,
967      15,    16,    17,    18,    19,    20,    21,    -1,    -1,    -1,
968      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
969      35,    36,    -1,    38,    39,    57,    58,    59,    60,    61,
970      62,    63,    64,    48,    66,    67,    68,    69,    70,    71,
971      -1,    -1,    57,    58,    59,    60,    -1,    -1,    63,    64,
972      -1,    -1,    -1,    68,    -1,    -1,    -1,    72,    73,    74,
973      75,    -1,    -1,    78,     3,     4,     5,     6,     7,     8,
974       9,    -1,    11,    12,    13,    14,    15,    16,    17,    18,
975      19,    20,    21,    -1,    -1,    -1,    25,    26,    27,    28,
976      29,    30,    31,    32,    33,    34,    35,    36,    -1,    38,
977      39,    -1,    58,    59,    60,    61,    62,    63,    64,    48,
978      66,    67,    68,    69,    70,    71,    -1,    -1,    -1,    58,
979      59,    60,    -1,    -1,    63,    64,    -1,    -1,    -1,    68,
980      -1,    -1,    -1,    72,    73,    74,    75,    -1,    -1,    78,
981       3,     4,     5,     6,     7,     8,     9,    -1,    11,    12,
982      13,    -1,    -1,    -1,    -1,    18,    -1,    20,    -1,    -1,
983      -1,    -1,    25,    26,    27,    28,    -1,    -1,    -1,    -1,
984      -1,    -1,    -1,    36,    -1,    38,    39,    -1,    -1,    -1,
985      -1,    -1,    -1,    63,    64,    48,    66,    67,    68,    69,
986      70,    71,    -1,    -1,    -1,    58,    59,    60,    -1,    -1,
987      63,    64,    -1,    -1,    -1,    68,    -1,    -1,    -1,    72,
988      73,    74,    75,    -1,    -1,    78,     3,     4,     5,     6,
989       7,     8,     9,    -1,    11,    12,    13,    -1,    -1,    -1,
990      -1,    18,    -1,    20,    -1,    -1,    -1,    -1,    25,    26,
991      27,    28,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    36,
992      -1,    38,    39,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
993      -1,    48,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
994      -1,    58,    59,    60,    -1,    -1,    63,    64,    -1,    -1,
995      -1,    68,    -1,    -1,    -1,    72,    73,    74,    75,    -1,
996      -1,    78,     3,     4,     5,     6,     7,     8,     9,    -1,
997      11,    12,    13,    -1,    -1,    -1,    -1,    18,    -1,    20,
998      -1,    -1,    -1,    -1,    25,    26,    27,    28,    -1,    -1,
999      -1,    -1,    -1,    -1,    -1,    36,    11,    38,    39,    14,
1000      15,    16,    17,    -1,    19,    -1,    21,    -1,    -1,    -1,
1001      -1,    -1,    -1,    -1,    29,    30,    31,    32,    33,    34,
1002      35,    -1,    63,    64,    -1,    -1,    -1,    68,    -1,    -1,
1003      -1,    72,    73,    74,    75,    11,    -1,    78,    14,    15,
1004      16,    17,    57,    19,    -1,    21,    -1,    23,    24,    -1,
1005      -1,    -1,    -1,    29,    30,    31,    32,    33,    34,    35,
1006      -1,    37,    -1,    -1,    40,    -1,    42,    -1,    44,    45,
1007      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
1008      56,    -1,    58,    59,    60,    61,    62,    63,    64,    -1,
1009      -1,    67,    68,    -1,    70,    71,    37,    -1,    74,    75,
1010      -1,    42,    43,    44,    45,    46,    47,    48,    49,    50,
1011      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
1012      61,    62,    63,    64,    -1,    66,    67,    68,    69,    70,
1013      71,    -1,    -1,    -1,    -1,    37,    -1,    -1,    -1,    80,
1014      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
1015      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1016      62,    63,    64,    -1,    66,    67,    68,    69,    70,    71,
1017      -1,    37,    -1,    -1,    -1,    77,    42,    43,    44,    45,
1018      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
1019      56,    57,    58,    59,    60,    61,    62,    63,    64,    -1,
1020      66,    67,    68,    69,    70,    71,    -1,    37,    -1,    -1,
1021      -1,    77,    42,    43,    44,    45,    46,    47,    48,    49,
1022      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
1023      60,    61,    62,    63,    64,    -1,    66,    67,    68,    69,
1024      70,    71,    -1,    37,    -1,    -1,    -1,    77,    42,    43,
1025      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
1026      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
1027      64,    -1,    66,    67,    68,    69,    70,    71,    -1,    37,
1028      -1,    -1,    -1,    77,    42,    43,    44,    45,    46,    47,
1029      48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
1030      58,    59,    60,    61,    62,    63,    64,    -1,    66,    67,
1031      68,    69,    70,    71,    43,    44,    45,    46,    47,    48,
1032      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
1033      59,    60,    61,    62,    63,    64,    -1,    66,    67,    68,
1034      69,    70,    71,    45,    46,    47,    48,    49,    50,    51,
1035      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1036      62,    63,    64,    -1,    66,    67,    68,    69,    70,    71,
1037      46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
1038      56,    57,    58,    59,    60,    61,    62,    63,    64,    -1,
1039      66,    67,    68,    69,    70,    71,    47,    48,    49,    50,
1040      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
1041      61,    62,    63,    64,    -1,    66,    67,    68,    69,    70,
1042      71,    11,    -1,    -1,    14,    15,    16,    17,    -1,    19,
1043      -1,    21,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    29,
1044      30,    31,    32,    33,    34,    35,    48,    49,    50,    51,
1045      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1046      62,    63,    64,    -1,    66,    67,    68,    69,    70,    71,
1047      49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
1048      59,    60,    61,    62,    63,    64,    -1,    66,    67,    68,
1049      69,    70,    71,    51,    52,    53,    54,    55,    56,    57,
1050      58,    59,    60,    61,    62,    63,    64,    -1,    66,    67,
1051      68,    69,    70,    71,    55,    56,    57,    58,    59,    60,
1052      61,    62,    63,    64,    -1,    66,    67,    68,    69,    70,
1053      71
1054};
1055
1056/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1057   symbol of state STATE-NUM.  */
1058static const unsigned char yystos[] =
1059{
1060       0,     3,     4,     5,     6,     7,     8,     9,    11,    12,
1061      13,    14,    15,    16,    17,    18,    19,    20,    21,    25,
1062      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
1063      36,    38,    39,    48,    58,    59,    60,    63,    64,    68,
1064      72,    73,    74,    75,    78,    82,    83,    84,    85,    88,
1065      91,    92,    93,    94,    96,    97,    98,   104,   105,   108,
1066     109,   110,   111,   113,    68,    20,    11,    23,    24,    37,
1067      40,    42,    44,    45,    46,    47,    48,    49,    50,    51,
1068      52,    53,    54,    55,    56,    58,    59,    60,    61,    62,
1069      63,    64,    67,    68,    70,    71,    74,    75,   108,     8,
1070       9,    11,    12,    72,   111,   112,   112,   112,   112,    11,
1071      68,    85,    11,    30,    31,    32,   106,     9,    72,   113,
1072     112,    51,    51,    51,    51,    30,    31,   106,    19,    29,
1073      30,    32,    35,    19,    29,    32,    34,    33,    85,    85,
1074      85,    85,    85,    85,    84,   104,    85,    85,     0,    40,
1075      37,    42,    43,    44,    45,    46,    47,    48,    49,    50,
1076      51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
1077      61,    62,    63,    64,    66,    67,    68,    69,    70,    71,
1078      85,    89,   104,     6,    20,    57,    95,   105,    98,    98,
1079      99,    87,    75,   112,    67,    67,    76,    77,   104,    30,
1080      32,    32,    51,   104,   104,   104,   104,    30,    32,    32,
1081      32,    19,    29,    32,    32,    32,    77,    77,    85,    85,
1082      85,    85,    85,    85,    85,    85,    85,    85,    85,    85,
1083      85,    85,    85,    85,    85,    85,    85,    85,    85,    85,
1084      85,    10,    11,    94,   112,    84,    86,   104,   107,    85,
1085      85,    10,    94,   112,    40,    79,    90,    90,   112,     8,
1086      96,   110,    48,    60,    67,    68,   100,   101,   102,   103,
1087      89,   112,    20,    76,    76,    77,    32,   104,    52,    52,
1088      52,    52,    32,    32,    32,    85,    80,    10,    76,    89,
1089      40,    77,    10,    85,    85,   100,   100,     3,    76,    77,
1090     100,   107,    99,    68,   102,   103,    77,   112,    52,    68,
1091      68,    68,    68,    85,    77,   104,    96,    76,    77,    77,
1092      85,    85,    85,    85,    77,    77,    77,    77
1093};
1094
1095#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1096# define YYSIZE_T __SIZE_TYPE__
1097#endif
1098#if ! defined (YYSIZE_T) && defined (size_t)
1099# define YYSIZE_T size_t
1100#endif
1101#if ! defined (YYSIZE_T)
1102# if defined (__STDC__) || defined (__cplusplus)
1103#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1104#  define YYSIZE_T size_t
1105# endif
1106#endif
1107#if ! defined (YYSIZE_T)
1108# define YYSIZE_T unsigned int
1109#endif
1110
1111#define yyerrok		(yyerrstatus = 0)
1112#define yyclearin	(yychar = YYEMPTY)
1113#define YYEMPTY		(-2)
1114#define YYEOF		0
1115
1116#define YYACCEPT	goto yyacceptlab
1117#define YYABORT		goto yyabortlab
1118#define YYERROR		goto yyerrorlab
1119
1120
1121/* Like YYERROR except do call yyerror.  This remains here temporarily
1122   to ease the transition to the new meaning of YYERROR, for GCC.
1123   Once GCC version 2 has supplanted version 1, this can go.  */
1124
1125#define YYFAIL		goto yyerrlab
1126
1127#define YYRECOVERING()  (!!yyerrstatus)
1128
1129#define YYBACKUP(Token, Value)					\
1130do								\
1131  if (yychar == YYEMPTY && yylen == 1)				\
1132    {								\
1133      yychar = (Token);						\
1134      yylval = (Value);						\
1135      yytoken = YYTRANSLATE (yychar);				\
1136      YYPOPSTACK;						\
1137      goto yybackup;						\
1138    }								\
1139  else								\
1140    { 								\
1141      yyerror ("syntax error: cannot back up");\
1142      YYERROR;							\
1143    }								\
1144while (0)
1145
1146#define YYTERROR	1
1147#define YYERRCODE	256
1148
1149/* YYLLOC_DEFAULT -- Compute the default location (before the actions
1150   are run).  */
1151
1152#ifndef YYLLOC_DEFAULT
1153# define YYLLOC_DEFAULT(Current, Rhs, N)		\
1154   ((Current).first_line   = (Rhs)[1].first_line,	\
1155    (Current).first_column = (Rhs)[1].first_column,	\
1156    (Current).last_line    = (Rhs)[N].last_line,	\
1157    (Current).last_column  = (Rhs)[N].last_column)
1158#endif
1159
1160/* YYLEX -- calling `yylex' with the right arguments.  */
1161
1162#ifdef YYLEX_PARAM
1163# define YYLEX yylex (YYLEX_PARAM)
1164#else
1165# define YYLEX yylex ()
1166#endif
1167
1168/* Enable debugging if requested.  */
1169#if YYDEBUG
1170
1171# ifndef YYFPRINTF
1172#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1173#  define YYFPRINTF fprintf
1174# endif
1175
1176# define YYDPRINTF(Args)			\
1177do {						\
1178  if (yydebug)					\
1179    YYFPRINTF Args;				\
1180} while (0)
1181
1182# define YYDSYMPRINT(Args)			\
1183do {						\
1184  if (yydebug)					\
1185    yysymprint Args;				\
1186} while (0)
1187
1188# define YYDSYMPRINTF(Title, Token, Value, Location)		\
1189do {								\
1190  if (yydebug)							\
1191    {								\
1192      YYFPRINTF (stderr, "%s ", Title);				\
1193      yysymprint (stderr, 					\
1194                  Token, Value);	\
1195      YYFPRINTF (stderr, "\n");					\
1196    }								\
1197} while (0)
1198
1199/*------------------------------------------------------------------.
1200| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1201| TOP (included).                                                   |
1202`------------------------------------------------------------------*/
1203
1204#if defined (__STDC__) || defined (__cplusplus)
1205static void
1206yy_stack_print (short *bottom, short *top)
1207#else
1208static void
1209yy_stack_print (bottom, top)
1210    short *bottom;
1211    short *top;
1212#endif
1213{
1214  YYFPRINTF (stderr, "Stack now");
1215  for (/* Nothing. */; bottom <= top; ++bottom)
1216    YYFPRINTF (stderr, " %d", *bottom);
1217  YYFPRINTF (stderr, "\n");
1218}
1219
1220# define YY_STACK_PRINT(Bottom, Top)				\
1221do {								\
1222  if (yydebug)							\
1223    yy_stack_print ((Bottom), (Top));				\
1224} while (0)
1225
1226
1227/*------------------------------------------------.
1228| Report that the YYRULE is going to be reduced.  |
1229`------------------------------------------------*/
1230
1231#if defined (__STDC__) || defined (__cplusplus)
1232static void
1233yy_reduce_print (int yyrule)
1234#else
1235static void
1236yy_reduce_print (yyrule)
1237    int yyrule;
1238#endif
1239{
1240  int yyi;
1241  unsigned int yylno = yyrline[yyrule];
1242  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1243             yyrule - 1, yylno);
1244  /* Print the symbols being reduced, and their result.  */
1245  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1246    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1247  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1248}
1249
1250# define YY_REDUCE_PRINT(Rule)		\
1251do {					\
1252  if (yydebug)				\
1253    yy_reduce_print (Rule);		\
1254} while (0)
1255
1256/* Nonzero means print parse trace.  It is left uninitialized so that
1257   multiple parsers can coexist.  */
1258int yydebug;
1259#else /* !YYDEBUG */
1260# define YYDPRINTF(Args)
1261# define YYDSYMPRINT(Args)
1262# define YYDSYMPRINTF(Title, Token, Value, Location)
1263# define YY_STACK_PRINT(Bottom, Top)
1264# define YY_REDUCE_PRINT(Rule)
1265#endif /* !YYDEBUG */
1266
1267
1268/* YYINITDEPTH -- initial size of the parser's stacks.  */
1269#ifndef	YYINITDEPTH
1270# define YYINITDEPTH 200
1271#endif
1272
1273/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1274   if the built-in stack extension method is used).
1275
1276   Do not make this value too large; the results are undefined if
1277   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1278   evaluated with infinite-precision integer arithmetic.  */
1279
1280#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1281# undef YYMAXDEPTH
1282#endif
1283
1284#ifndef YYMAXDEPTH
1285# define YYMAXDEPTH 10000
1286#endif
1287
1288
1289
1290#if YYERROR_VERBOSE
1291
1292# ifndef yystrlen
1293#  if defined (__GLIBC__) && defined (_STRING_H)
1294#   define yystrlen strlen
1295#  else
1296/* Return the length of YYSTR.  */
1297static YYSIZE_T
1298#   if defined (__STDC__) || defined (__cplusplus)
1299yystrlen (const char *yystr)
1300#   else
1301yystrlen (yystr)
1302     const char *yystr;
1303#   endif
1304{
1305  register const char *yys = yystr;
1306
1307  while (*yys++ != '\0')
1308    continue;
1309
1310  return yys - yystr - 1;
1311}
1312#  endif
1313# endif
1314
1315# ifndef yystpcpy
1316#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1317#   define yystpcpy stpcpy
1318#  else
1319/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1320   YYDEST.  */
1321static char *
1322#   if defined (__STDC__) || defined (__cplusplus)
1323yystpcpy (char *yydest, const char *yysrc)
1324#   else
1325yystpcpy (yydest, yysrc)
1326     char *yydest;
1327     const char *yysrc;
1328#   endif
1329{
1330  register char *yyd = yydest;
1331  register const char *yys = yysrc;
1332
1333  while ((*yyd++ = *yys++) != '\0')
1334    continue;
1335
1336  return yyd - 1;
1337}
1338#  endif
1339# endif
1340
1341#endif /* !YYERROR_VERBOSE */
1342
1343
1344
1345#if YYDEBUG
1346/*--------------------------------.
1347| Print this symbol on YYOUTPUT.  |
1348`--------------------------------*/
1349
1350#if defined (__STDC__) || defined (__cplusplus)
1351static void
1352yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1353#else
1354static void
1355yysymprint (yyoutput, yytype, yyvaluep)
1356    FILE *yyoutput;
1357    int yytype;
1358    YYSTYPE *yyvaluep;
1359#endif
1360{
1361  /* Pacify ``unused variable'' warnings.  */
1362  (void) yyvaluep;
1363
1364  if (yytype < YYNTOKENS)
1365    {
1366      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1367# ifdef YYPRINT
1368      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1369# endif
1370    }
1371  else
1372    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1373
1374  switch (yytype)
1375    {
1376      default:
1377        break;
1378    }
1379  YYFPRINTF (yyoutput, ")");
1380}
1381
1382#endif /* ! YYDEBUG */
1383/*-----------------------------------------------.
1384| Release the memory associated to this symbol.  |
1385`-----------------------------------------------*/
1386
1387#if defined (__STDC__) || defined (__cplusplus)
1388static void
1389yydestruct (int yytype, YYSTYPE *yyvaluep)
1390#else
1391static void
1392yydestruct (yytype, yyvaluep)
1393    int yytype;
1394    YYSTYPE *yyvaluep;
1395#endif
1396{
1397  /* Pacify ``unused variable'' warnings.  */
1398  (void) yyvaluep;
1399
1400  switch (yytype)
1401    {
1402
1403      default:
1404        break;
1405    }
1406}
1407
1408
1409/* Prevent warnings from -Wmissing-prototypes.  */
1410
1411#ifdef YYPARSE_PARAM
1412# if defined (__STDC__) || defined (__cplusplus)
1413int yyparse (void *YYPARSE_PARAM);
1414# else
1415int yyparse ();
1416# endif
1417#else /* ! YYPARSE_PARAM */
1418#if defined (__STDC__) || defined (__cplusplus)
1419int yyparse (void);
1420#else
1421int yyparse ();
1422#endif
1423#endif /* ! YYPARSE_PARAM */
1424
1425
1426
1427/* The lookahead symbol.  */
1428int yychar;
1429
1430/* The semantic value of the lookahead symbol.  */
1431YYSTYPE yylval;
1432
1433/* Number of syntax errors so far.  */
1434int yynerrs;
1435
1436
1437
1438/*----------.
1439| yyparse.  |
1440`----------*/
1441
1442#ifdef YYPARSE_PARAM
1443# if defined (__STDC__) || defined (__cplusplus)
1444int yyparse (void *YYPARSE_PARAM)
1445# else
1446int yyparse (YYPARSE_PARAM)
1447  void *YYPARSE_PARAM;
1448# endif
1449#else /* ! YYPARSE_PARAM */
1450#if defined (__STDC__) || defined (__cplusplus)
1451int
1452yyparse (void)
1453#else
1454int
1455yyparse ()
1456
1457#endif
1458#endif
1459{
1460
1461  register int yystate;
1462  register int yyn;
1463  int yyresult;
1464  /* Number of tokens to shift before error messages enabled.  */
1465  int yyerrstatus;
1466  /* Lookahead token as an internal (translated) token number.  */
1467  int yytoken = 0;
1468
1469  /* Three stacks and their tools:
1470     `yyss': related to states,
1471     `yyvs': related to semantic values,
1472     `yyls': related to locations.
1473
1474     Refer to the stacks thru separate pointers, to allow yyoverflow
1475     to xreallocate them elsewhere.  */
1476
1477  /* The state stack.  */
1478  short	yyssa[YYINITDEPTH];
1479  short *yyss = yyssa;
1480  register short *yyssp;
1481
1482  /* The semantic value stack.  */
1483  YYSTYPE yyvsa[YYINITDEPTH];
1484  YYSTYPE *yyvs = yyvsa;
1485  register YYSTYPE *yyvsp;
1486
1487
1488
1489#define YYPOPSTACK   (yyvsp--, yyssp--)
1490
1491  YYSIZE_T yystacksize = YYINITDEPTH;
1492
1493  /* The variables used to return semantic value and location from the
1494     action routines.  */
1495  YYSTYPE yyval;
1496
1497
1498  /* When reducing, the number of symbols on the RHS of the reduced
1499     rule.  */
1500  int yylen;
1501
1502  YYDPRINTF ((stderr, "Starting parse\n"));
1503
1504  yystate = 0;
1505  yyerrstatus = 0;
1506  yynerrs = 0;
1507  yychar = YYEMPTY;		/* Cause a token to be read.  */
1508
1509  /* Initialize stack pointers.
1510     Waste one element of value and location stack
1511     so that they stay on the same level as the state stack.
1512     The wasted elements are never initialized.  */
1513
1514  yyssp = yyss;
1515  yyvsp = yyvs;
1516
1517  goto yysetstate;
1518
1519/*------------------------------------------------------------.
1520| yynewstate -- Push a new state, which is found in yystate.  |
1521`------------------------------------------------------------*/
1522 yynewstate:
1523  /* In all cases, when you get here, the value and location stacks
1524     have just been pushed. so pushing a state here evens the stacks.
1525     */
1526  yyssp++;
1527
1528 yysetstate:
1529  *yyssp = yystate;
1530
1531  if (yyss + yystacksize - 1 <= yyssp)
1532    {
1533      /* Get the current used size of the three stacks, in elements.  */
1534      YYSIZE_T yysize = yyssp - yyss + 1;
1535
1536#ifdef yyoverflow
1537      {
1538	/* Give user a chance to xreallocate the stack. Use copies of
1539	   these so that the &'s don't force the real ones into
1540	   memory.  */
1541	YYSTYPE *yyvs1 = yyvs;
1542	short *yyss1 = yyss;
1543
1544
1545	/* Each stack pointer address is followed by the size of the
1546	   data in use in that stack, in bytes.  This used to be a
1547	   conditional around just the two extra args, but that might
1548	   be undefined if yyoverflow is a macro.  */
1549	yyoverflow ("parser stack overflow",
1550		    &yyss1, yysize * sizeof (*yyssp),
1551		    &yyvs1, yysize * sizeof (*yyvsp),
1552
1553		    &yystacksize);
1554
1555	yyss = yyss1;
1556	yyvs = yyvs1;
1557      }
1558#else /* no yyoverflow */
1559# ifndef YYSTACK_RELOCATE
1560      goto yyoverflowlab;
1561# else
1562      /* Extend the stack our own way.  */
1563      if (YYMAXDEPTH <= yystacksize)
1564	goto yyoverflowlab;
1565      yystacksize *= 2;
1566      if (YYMAXDEPTH < yystacksize)
1567	yystacksize = YYMAXDEPTH;
1568
1569      {
1570	short *yyss1 = yyss;
1571	union yyalloc *yyptr =
1572	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1573	if (! yyptr)
1574	  goto yyoverflowlab;
1575	YYSTACK_RELOCATE (yyss);
1576	YYSTACK_RELOCATE (yyvs);
1577
1578#  undef YYSTACK_RELOCATE
1579	if (yyss1 != yyssa)
1580	  YYSTACK_FREE (yyss1);
1581      }
1582# endif
1583#endif /* no yyoverflow */
1584
1585      yyssp = yyss + yysize - 1;
1586      yyvsp = yyvs + yysize - 1;
1587
1588
1589      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1590		  (unsigned long int) yystacksize));
1591
1592      if (yyss + yystacksize - 1 <= yyssp)
1593	YYABORT;
1594    }
1595
1596  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1597
1598  goto yybackup;
1599
1600/*-----------.
1601| yybackup.  |
1602`-----------*/
1603yybackup:
1604
1605/* Do appropriate processing given the current state.  */
1606/* Read a lookahead token if we need one and don't already have one.  */
1607/* yyresume: */
1608
1609  /* First try to decide what to do without reference to lookahead token.  */
1610
1611  yyn = yypact[yystate];
1612  if (yyn == YYPACT_NINF)
1613    goto yydefault;
1614
1615  /* Not known => get a lookahead token if don't already have one.  */
1616
1617  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1618  if (yychar == YYEMPTY)
1619    {
1620      YYDPRINTF ((stderr, "Reading a token: "));
1621      yychar = YYLEX;
1622    }
1623
1624  if (yychar <= YYEOF)
1625    {
1626      yychar = yytoken = YYEOF;
1627      YYDPRINTF ((stderr, "Now at end of input.\n"));
1628    }
1629  else
1630    {
1631      yytoken = YYTRANSLATE (yychar);
1632      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1633    }
1634
1635  /* If the proper action on seeing token YYTOKEN is to reduce or to
1636     detect an error, take that action.  */
1637  yyn += yytoken;
1638  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1639    goto yydefault;
1640  yyn = yytable[yyn];
1641  if (yyn <= 0)
1642    {
1643      if (yyn == 0 || yyn == YYTABLE_NINF)
1644	goto yyerrlab;
1645      yyn = -yyn;
1646      goto yyreduce;
1647    }
1648
1649  if (yyn == YYFINAL)
1650    YYACCEPT;
1651
1652  /* Shift the lookahead token.  */
1653  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1654
1655  /* Discard the token being shifted unless it is eof.  */
1656  if (yychar != YYEOF)
1657    yychar = YYEMPTY;
1658
1659  *++yyvsp = yylval;
1660
1661
1662  /* Count tokens shifted since error; after three, turn off error
1663     status.  */
1664  if (yyerrstatus)
1665    yyerrstatus--;
1666
1667  yystate = yyn;
1668  goto yynewstate;
1669
1670
1671/*-----------------------------------------------------------.
1672| yydefault -- do the default action for the current state.  |
1673`-----------------------------------------------------------*/
1674yydefault:
1675  yyn = yydefact[yystate];
1676  if (yyn == 0)
1677    goto yyerrlab;
1678  goto yyreduce;
1679
1680
1681/*-----------------------------.
1682| yyreduce -- Do a reduction.  |
1683`-----------------------------*/
1684yyreduce:
1685  /* yyn is the number of a rule to reduce with.  */
1686  yylen = yyr2[yyn];
1687
1688  /* If YYLEN is nonzero, implement the default value of the action:
1689     `$$ = $1'.
1690
1691     Otherwise, the following line sets YYVAL to garbage.
1692     This behavior is undocumented and Bison
1693     users should not rely upon it.  Assigning to YYVAL
1694     unconditionally makes the parser a bit smaller, and it avoids a
1695     GCC warning that YYVAL may be used uninitialized.  */
1696  yyval = yyvsp[1-yylen];
1697
1698
1699  YY_REDUCE_PRINT (yyn);
1700  switch (yyn)
1701    {
1702        case 4:
1703#line 255 "c-exp.y"
1704    { write_exp_elt_opcode(OP_TYPE);
1705			  write_exp_elt_type(yyvsp[0].tval);
1706			  write_exp_elt_opcode(OP_TYPE);}
1707    break;
1708
1709  case 6:
1710#line 263 "c-exp.y"
1711    { write_exp_elt_opcode (BINOP_COMMA); }
1712    break;
1713
1714  case 7:
1715#line 268 "c-exp.y"
1716    { write_exp_elt_opcode (UNOP_IND); }
1717    break;
1718
1719  case 8:
1720#line 272 "c-exp.y"
1721    { write_exp_elt_opcode (UNOP_ADDR); }
1722    break;
1723
1724  case 9:
1725#line 276 "c-exp.y"
1726    { write_exp_elt_opcode (UNOP_NEG); }
1727    break;
1728
1729  case 10:
1730#line 280 "c-exp.y"
1731    { write_exp_elt_opcode (UNOP_PLUS); }
1732    break;
1733
1734  case 11:
1735#line 284 "c-exp.y"
1736    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1737    break;
1738
1739  case 12:
1740#line 288 "c-exp.y"
1741    { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1742    break;
1743
1744  case 13:
1745#line 292 "c-exp.y"
1746    { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1747    break;
1748
1749  case 14:
1750#line 296 "c-exp.y"
1751    { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1752    break;
1753
1754  case 15:
1755#line 300 "c-exp.y"
1756    { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1757    break;
1758
1759  case 16:
1760#line 304 "c-exp.y"
1761    { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1762    break;
1763
1764  case 17:
1765#line 308 "c-exp.y"
1766    { write_exp_elt_opcode (UNOP_SIZEOF); }
1767    break;
1768
1769  case 18:
1770#line 312 "c-exp.y"
1771    { write_exp_elt_opcode (STRUCTOP_PTR);
1772			  write_exp_string (yyvsp[0].sval);
1773			  write_exp_elt_opcode (STRUCTOP_PTR); }
1774    break;
1775
1776  case 19:
1777#line 318 "c-exp.y"
1778    { mark_struct_expression ();
1779			  write_exp_elt_opcode (STRUCTOP_PTR);
1780			  write_exp_string (yyvsp[-1].sval);
1781			  write_exp_elt_opcode (STRUCTOP_PTR); }
1782    break;
1783
1784  case 20:
1785#line 325 "c-exp.y"
1786    { struct stoken s;
1787			  mark_struct_expression ();
1788			  write_exp_elt_opcode (STRUCTOP_PTR);
1789			  s.ptr = "";
1790			  s.length = 0;
1791			  write_exp_string (s);
1792			  write_exp_elt_opcode (STRUCTOP_PTR); }
1793    break;
1794
1795  case 21:
1796#line 335 "c-exp.y"
1797    { /* exp->type::name becomes exp->*(&type::name) */
1798			  /* Note: this doesn't work if name is a
1799			     static member!  FIXME */
1800			  write_exp_elt_opcode (UNOP_ADDR);
1801			  write_exp_elt_opcode (STRUCTOP_MPTR); }
1802    break;
1803
1804  case 22:
1805#line 343 "c-exp.y"
1806    { write_exp_elt_opcode (STRUCTOP_MPTR); }
1807    break;
1808
1809  case 23:
1810#line 347 "c-exp.y"
1811    { write_exp_elt_opcode (STRUCTOP_STRUCT);
1812			  write_exp_string (yyvsp[0].sval);
1813			  write_exp_elt_opcode (STRUCTOP_STRUCT); }
1814    break;
1815
1816  case 24:
1817#line 353 "c-exp.y"
1818    { mark_struct_expression ();
1819			  write_exp_elt_opcode (STRUCTOP_STRUCT);
1820			  write_exp_string (yyvsp[-1].sval);
1821			  write_exp_elt_opcode (STRUCTOP_STRUCT); }
1822    break;
1823
1824  case 25:
1825#line 360 "c-exp.y"
1826    { struct stoken s;
1827			  mark_struct_expression ();
1828			  write_exp_elt_opcode (STRUCTOP_STRUCT);
1829			  s.ptr = "";
1830			  s.length = 0;
1831			  write_exp_string (s);
1832			  write_exp_elt_opcode (STRUCTOP_STRUCT); }
1833    break;
1834
1835  case 26:
1836#line 370 "c-exp.y"
1837    { /* exp.type::name becomes exp.*(&type::name) */
1838			  /* Note: this doesn't work if name is a
1839			     static member!  FIXME */
1840			  write_exp_elt_opcode (UNOP_ADDR);
1841			  write_exp_elt_opcode (STRUCTOP_MEMBER); }
1842    break;
1843
1844  case 27:
1845#line 378 "c-exp.y"
1846    { write_exp_elt_opcode (STRUCTOP_MEMBER); }
1847    break;
1848
1849  case 28:
1850#line 382 "c-exp.y"
1851    { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1852    break;
1853
1854  case 29:
1855#line 388 "c-exp.y"
1856    { start_arglist (); }
1857    break;
1858
1859  case 30:
1860#line 390 "c-exp.y"
1861    { write_exp_elt_opcode (OP_FUNCALL);
1862			  write_exp_elt_longcst ((LONGEST) end_arglist ());
1863			  write_exp_elt_opcode (OP_FUNCALL); }
1864    break;
1865
1866  case 31:
1867#line 396 "c-exp.y"
1868    {
1869			  /* This could potentially be a an argument defined
1870			     lookup function (Koenig).  */
1871			  write_exp_elt_opcode (OP_ADL_FUNC);
1872			  write_exp_elt_block (expression_context_block);
1873			  write_exp_elt_sym (NULL); /* Placeholder.  */
1874			  write_exp_string (yyvsp[-1].ssym.stoken);
1875			  write_exp_elt_opcode (OP_ADL_FUNC);
1876
1877			/* This is to save the value of arglist_len
1878			   being accumulated by an outer function call.  */
1879
1880			  start_arglist ();
1881			}
1882    break;
1883
1884  case 32:
1885#line 411 "c-exp.y"
1886    {
1887			  write_exp_elt_opcode (OP_FUNCALL);
1888			  write_exp_elt_longcst ((LONGEST) end_arglist ());
1889			  write_exp_elt_opcode (OP_FUNCALL);
1890			}
1891    break;
1892
1893  case 33:
1894#line 419 "c-exp.y"
1895    { start_arglist (); }
1896    break;
1897
1898  case 35:
1899#line 426 "c-exp.y"
1900    { arglist_len = 1; }
1901    break;
1902
1903  case 36:
1904#line 430 "c-exp.y"
1905    { arglist_len++; }
1906    break;
1907
1908  case 37:
1909#line 434 "c-exp.y"
1910    { int i;
1911			  write_exp_elt_opcode (TYPE_INSTANCE);
1912			  write_exp_elt_longcst ((LONGEST) yyvsp[-2].ivec[0]);
1913			  for (i = 0; i < yyvsp[-2].ivec[0]; ++i)
1914			    write_exp_elt_type (yyvsp[-2].tvec[i + 1]);
1915			  write_exp_elt_longcst((LONGEST) yyvsp[-2].ivec[0]);
1916			  write_exp_elt_opcode (TYPE_INSTANCE);
1917			  xfree (yyvsp[-2].tvec);
1918			}
1919    break;
1920
1921  case 38:
1922#line 446 "c-exp.y"
1923    { yyval.lval = end_arglist () - 1; }
1924    break;
1925
1926  case 39:
1927#line 449 "c-exp.y"
1928    { write_exp_elt_opcode (OP_ARRAY);
1929			  write_exp_elt_longcst ((LONGEST) 0);
1930			  write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1931			  write_exp_elt_opcode (OP_ARRAY); }
1932    break;
1933
1934  case 40:
1935#line 456 "c-exp.y"
1936    { write_exp_elt_opcode (UNOP_MEMVAL);
1937			  write_exp_elt_type (yyvsp[-2].tval);
1938			  write_exp_elt_opcode (UNOP_MEMVAL); }
1939    break;
1940
1941  case 41:
1942#line 462 "c-exp.y"
1943    { write_exp_elt_opcode (UNOP_CAST);
1944			  write_exp_elt_type (yyvsp[-2].tval);
1945			  write_exp_elt_opcode (UNOP_CAST); }
1946    break;
1947
1948  case 42:
1949#line 468 "c-exp.y"
1950    { }
1951    break;
1952
1953  case 43:
1954#line 474 "c-exp.y"
1955    { write_exp_elt_opcode (BINOP_REPEAT); }
1956    break;
1957
1958  case 44:
1959#line 478 "c-exp.y"
1960    { write_exp_elt_opcode (BINOP_MUL); }
1961    break;
1962
1963  case 45:
1964#line 482 "c-exp.y"
1965    { write_exp_elt_opcode (BINOP_DIV); }
1966    break;
1967
1968  case 46:
1969#line 486 "c-exp.y"
1970    { write_exp_elt_opcode (BINOP_REM); }
1971    break;
1972
1973  case 47:
1974#line 490 "c-exp.y"
1975    { write_exp_elt_opcode (BINOP_ADD); }
1976    break;
1977
1978  case 48:
1979#line 494 "c-exp.y"
1980    { write_exp_elt_opcode (BINOP_SUB); }
1981    break;
1982
1983  case 49:
1984#line 498 "c-exp.y"
1985    { write_exp_elt_opcode (BINOP_LSH); }
1986    break;
1987
1988  case 50:
1989#line 502 "c-exp.y"
1990    { write_exp_elt_opcode (BINOP_RSH); }
1991    break;
1992
1993  case 51:
1994#line 506 "c-exp.y"
1995    { write_exp_elt_opcode (BINOP_EQUAL); }
1996    break;
1997
1998  case 52:
1999#line 510 "c-exp.y"
2000    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
2001    break;
2002
2003  case 53:
2004#line 514 "c-exp.y"
2005    { write_exp_elt_opcode (BINOP_LEQ); }
2006    break;
2007
2008  case 54:
2009#line 518 "c-exp.y"
2010    { write_exp_elt_opcode (BINOP_GEQ); }
2011    break;
2012
2013  case 55:
2014#line 522 "c-exp.y"
2015    { write_exp_elt_opcode (BINOP_LESS); }
2016    break;
2017
2018  case 56:
2019#line 526 "c-exp.y"
2020    { write_exp_elt_opcode (BINOP_GTR); }
2021    break;
2022
2023  case 57:
2024#line 530 "c-exp.y"
2025    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
2026    break;
2027
2028  case 58:
2029#line 534 "c-exp.y"
2030    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
2031    break;
2032
2033  case 59:
2034#line 538 "c-exp.y"
2035    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
2036    break;
2037
2038  case 60:
2039#line 542 "c-exp.y"
2040    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
2041    break;
2042
2043  case 61:
2044#line 546 "c-exp.y"
2045    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
2046    break;
2047
2048  case 62:
2049#line 550 "c-exp.y"
2050    { write_exp_elt_opcode (TERNOP_COND); }
2051    break;
2052
2053  case 63:
2054#line 554 "c-exp.y"
2055    { write_exp_elt_opcode (BINOP_ASSIGN); }
2056    break;
2057
2058  case 64:
2059#line 558 "c-exp.y"
2060    { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
2061			  write_exp_elt_opcode (yyvsp[-1].opcode);
2062			  write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
2063    break;
2064
2065  case 65:
2066#line 564 "c-exp.y"
2067    { write_exp_elt_opcode (OP_LONG);
2068			  write_exp_elt_type (yyvsp[0].typed_val_int.type);
2069			  write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
2070			  write_exp_elt_opcode (OP_LONG); }
2071    break;
2072
2073  case 66:
2074#line 571 "c-exp.y"
2075    {
2076			  struct stoken_vector vec;
2077			  vec.len = 1;
2078			  vec.tokens = &yyvsp[0].tsval;
2079			  write_exp_string_vector (yyvsp[0].tsval.type, &vec);
2080			}
2081    break;
2082
2083  case 67:
2084#line 580 "c-exp.y"
2085    { YYSTYPE val;
2086			  parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
2087			  write_exp_elt_opcode (OP_LONG);
2088			  write_exp_elt_type (val.typed_val_int.type);
2089			  write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
2090			  write_exp_elt_opcode (OP_LONG);
2091			}
2092    break;
2093
2094  case 68:
2095#line 591 "c-exp.y"
2096    { write_exp_elt_opcode (OP_DOUBLE);
2097			  write_exp_elt_type (yyvsp[0].typed_val_float.type);
2098			  write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
2099			  write_exp_elt_opcode (OP_DOUBLE); }
2100    break;
2101
2102  case 69:
2103#line 598 "c-exp.y"
2104    { write_exp_elt_opcode (OP_DECFLOAT);
2105			  write_exp_elt_type (yyvsp[0].typed_val_decfloat.type);
2106			  write_exp_elt_decfloatcst (yyvsp[0].typed_val_decfloat.val);
2107			  write_exp_elt_opcode (OP_DECFLOAT); }
2108    break;
2109
2110  case 71:
2111#line 608 "c-exp.y"
2112    {
2113			  write_dollar_variable (yyvsp[0].sval);
2114			}
2115    break;
2116
2117  case 72:
2118#line 614 "c-exp.y"
2119    { write_exp_elt_opcode (OP_LONG);
2120			  write_exp_elt_type (lookup_signed_typename
2121					      (parse_language, parse_gdbarch,
2122					       "int"));
2123			  CHECK_TYPEDEF (yyvsp[-1].tval);
2124			  write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
2125			  write_exp_elt_opcode (OP_LONG); }
2126    break;
2127
2128  case 73:
2129#line 624 "c-exp.y"
2130    { write_exp_elt_opcode (UNOP_REINTERPRET_CAST);
2131			  write_exp_elt_type (yyvsp[-4].tval);
2132			  write_exp_elt_opcode (UNOP_REINTERPRET_CAST); }
2133    break;
2134
2135  case 74:
2136#line 630 "c-exp.y"
2137    { write_exp_elt_opcode (UNOP_CAST);
2138			  write_exp_elt_type (yyvsp[-4].tval);
2139			  write_exp_elt_opcode (UNOP_CAST); }
2140    break;
2141
2142  case 75:
2143#line 636 "c-exp.y"
2144    { write_exp_elt_opcode (UNOP_DYNAMIC_CAST);
2145			  write_exp_elt_type (yyvsp[-4].tval);
2146			  write_exp_elt_opcode (UNOP_DYNAMIC_CAST); }
2147    break;
2148
2149  case 76:
2150#line 642 "c-exp.y"
2151    { /* We could do more error checking here, but
2152			     it doesn't seem worthwhile.  */
2153			  write_exp_elt_opcode (UNOP_CAST);
2154			  write_exp_elt_type (yyvsp[-4].tval);
2155			  write_exp_elt_opcode (UNOP_CAST); }
2156    break;
2157
2158  case 77:
2159#line 651 "c-exp.y"
2160    {
2161			  /* We copy the string here, and not in the
2162			     lexer, to guarantee that we do not leak a
2163			     string.  Note that we follow the
2164			     NUL-termination convention of the
2165			     lexer.  */
2166			  struct typed_stoken *vec = XNEW (struct typed_stoken);
2167			  yyval.svec.len = 1;
2168			  yyval.svec.tokens = vec;
2169
2170			  vec->type = yyvsp[0].tsval.type;
2171			  vec->length = yyvsp[0].tsval.length;
2172			  vec->ptr = xmalloc (yyvsp[0].tsval.length + 1);
2173			  memcpy (vec->ptr, yyvsp[0].tsval.ptr, yyvsp[0].tsval.length + 1);
2174			}
2175    break;
2176
2177  case 78:
2178#line 668 "c-exp.y"
2179    {
2180			  /* Note that we NUL-terminate here, but just
2181			     for convenience.  */
2182			  char *p;
2183			  ++yyval.svec.len;
2184			  yyval.svec.tokens = xrealloc (yyval.svec.tokens,
2185					       yyval.svec.len * sizeof (struct typed_stoken));
2186
2187			  p = xmalloc (yyvsp[0].tsval.length + 1);
2188			  memcpy (p, yyvsp[0].tsval.ptr, yyvsp[0].tsval.length + 1);
2189
2190			  yyval.svec.tokens[yyval.svec.len - 1].type = yyvsp[0].tsval.type;
2191			  yyval.svec.tokens[yyval.svec.len - 1].length = yyvsp[0].tsval.length;
2192			  yyval.svec.tokens[yyval.svec.len - 1].ptr = p;
2193			}
2194    break;
2195
2196  case 79:
2197#line 686 "c-exp.y"
2198    {
2199			  int i;
2200			  enum c_string_type type = C_STRING;
2201
2202			  for (i = 0; i < yyvsp[0].svec.len; ++i)
2203			    {
2204			      switch (yyvsp[0].svec.tokens[i].type)
2205				{
2206				case C_STRING:
2207				  break;
2208				case C_WIDE_STRING:
2209				case C_STRING_16:
2210				case C_STRING_32:
2211				  if (type != C_STRING
2212				      && type != yyvsp[0].svec.tokens[i].type)
2213				    error (_("Undefined string concatenation."));
2214				  type = yyvsp[0].svec.tokens[i].type;
2215				  break;
2216				default:
2217				  /* internal error */
2218				  internal_error (__FILE__, __LINE__,
2219						  "unrecognized type in string concatenation");
2220				}
2221			    }
2222
2223			  write_exp_string_vector (type, &yyvsp[0].svec);
2224			  for (i = 0; i < yyvsp[0].svec.len; ++i)
2225			    xfree (yyvsp[0].svec.tokens[i].ptr);
2226			  xfree (yyvsp[0].svec.tokens);
2227			}
2228    break;
2229
2230  case 80:
2231#line 720 "c-exp.y"
2232    { write_exp_elt_opcode (OP_LONG);
2233                          write_exp_elt_type (parse_type->builtin_bool);
2234                          write_exp_elt_longcst ((LONGEST) 1);
2235                          write_exp_elt_opcode (OP_LONG); }
2236    break;
2237
2238  case 81:
2239#line 727 "c-exp.y"
2240    { write_exp_elt_opcode (OP_LONG);
2241                          write_exp_elt_type (parse_type->builtin_bool);
2242                          write_exp_elt_longcst ((LONGEST) 0);
2243                          write_exp_elt_opcode (OP_LONG); }
2244    break;
2245
2246  case 82:
2247#line 736 "c-exp.y"
2248    {
2249			  if (yyvsp[0].ssym.sym)
2250			    yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
2251			  else
2252			    error (_("No file or function \"%s\"."),
2253				   copy_name (yyvsp[0].ssym.stoken));
2254			}
2255    break;
2256
2257  case 83:
2258#line 744 "c-exp.y"
2259    {
2260			  yyval.bval = yyvsp[0].bval;
2261			}
2262    break;
2263
2264  case 84:
2265#line 750 "c-exp.y"
2266    { struct symbol *tem
2267			    = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
2268					     VAR_DOMAIN, (int *) NULL);
2269			  if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
2270			    error (_("No function \"%s\" in specified context."),
2271				   copy_name (yyvsp[0].sval));
2272			  yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
2273    break;
2274
2275  case 85:
2276#line 760 "c-exp.y"
2277    { struct symbol *sym;
2278			  sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
2279					       VAR_DOMAIN, (int *) NULL);
2280			  if (sym == 0)
2281			    error (_("No symbol \"%s\" in specified context."),
2282				   copy_name (yyvsp[0].sval));
2283
2284			  write_exp_elt_opcode (OP_VAR_VALUE);
2285			  /* block_found is set by lookup_symbol.  */
2286			  write_exp_elt_block (block_found);
2287			  write_exp_elt_sym (sym);
2288			  write_exp_elt_opcode (OP_VAR_VALUE); }
2289    break;
2290
2291  case 86:
2292#line 775 "c-exp.y"
2293    {
2294			  struct type *type = yyvsp[-2].tsym.type;
2295			  CHECK_TYPEDEF (type);
2296			  if (TYPE_CODE (type) != TYPE_CODE_STRUCT
2297			      && TYPE_CODE (type) != TYPE_CODE_UNION
2298			      && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
2299			    error (_("`%s' is not defined as an aggregate type."),
2300				   TYPE_NAME (type));
2301
2302			  write_exp_elt_opcode (OP_SCOPE);
2303			  write_exp_elt_type (type);
2304			  write_exp_string (yyvsp[0].sval);
2305			  write_exp_elt_opcode (OP_SCOPE);
2306			}
2307    break;
2308
2309  case 87:
2310#line 790 "c-exp.y"
2311    {
2312			  struct type *type = yyvsp[-3].tsym.type;
2313			  struct stoken tmp_token;
2314			  CHECK_TYPEDEF (type);
2315			  if (TYPE_CODE (type) != TYPE_CODE_STRUCT
2316			      && TYPE_CODE (type) != TYPE_CODE_UNION
2317			      && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
2318			    error (_("`%s' is not defined as an aggregate type."),
2319				   TYPE_NAME (type));
2320
2321			  tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
2322			  tmp_token.length = yyvsp[0].sval.length + 1;
2323			  tmp_token.ptr[0] = '~';
2324			  memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
2325			  tmp_token.ptr[tmp_token.length] = 0;
2326
2327			  /* Check for valid destructor name.  */
2328			  destructor_name_p (tmp_token.ptr, type);
2329			  write_exp_elt_opcode (OP_SCOPE);
2330			  write_exp_elt_type (type);
2331			  write_exp_string (tmp_token);
2332			  write_exp_elt_opcode (OP_SCOPE);
2333			}
2334    break;
2335
2336  case 88:
2337#line 814 "c-exp.y"
2338    {
2339			  char *copy = copy_name (yyvsp[-2].sval);
2340			  error (_("No type \"%s\" within class "
2341				   "or namespace \"%s\"."),
2342				 copy, TYPE_NAME (yyvsp[-4].tsym.type));
2343			}
2344    break;
2345
2346  case 90:
2347#line 824 "c-exp.y"
2348    {
2349			  char *name = copy_name (yyvsp[0].ssym.stoken);
2350			  struct symbol *sym;
2351			  struct minimal_symbol *msymbol;
2352
2353			  sym =
2354			    lookup_symbol (name, (const struct block *) NULL,
2355					   VAR_DOMAIN, (int *) NULL);
2356			  if (sym)
2357			    {
2358			      write_exp_elt_opcode (OP_VAR_VALUE);
2359			      write_exp_elt_block (NULL);
2360			      write_exp_elt_sym (sym);
2361			      write_exp_elt_opcode (OP_VAR_VALUE);
2362			      break;
2363			    }
2364
2365			  msymbol = lookup_minimal_symbol (name, NULL, NULL);
2366			  if (msymbol != NULL)
2367			    write_exp_msymbol (msymbol);
2368			  else if (!have_full_symbols () && !have_partial_symbols ())
2369			    error (_("No symbol table is loaded.  Use the \"file\" command."));
2370			  else
2371			    error (_("No symbol \"%s\" in current context."), name);
2372			}
2373    break;
2374
2375  case 91:
2376#line 852 "c-exp.y"
2377    { struct symbol *sym = yyvsp[0].ssym.sym;
2378
2379			  if (sym)
2380			    {
2381			      if (symbol_read_needs_frame (sym))
2382				{
2383				  if (innermost_block == 0
2384				      || contained_in (block_found,
2385						       innermost_block))
2386				    innermost_block = block_found;
2387				}
2388
2389			      write_exp_elt_opcode (OP_VAR_VALUE);
2390			      /* We want to use the selected frame, not
2391				 another more inner frame which happens to
2392				 be in the same block.  */
2393			      write_exp_elt_block (NULL);
2394			      write_exp_elt_sym (sym);
2395			      write_exp_elt_opcode (OP_VAR_VALUE);
2396			    }
2397			  else if (yyvsp[0].ssym.is_a_field_of_this)
2398			    {
2399			      /* C++: it hangs off of `this'.  Must
2400			         not inadvertently convert from a method call
2401				 to data ref.  */
2402			      if (innermost_block == 0
2403				  || contained_in (block_found,
2404						   innermost_block))
2405				innermost_block = block_found;
2406			      write_exp_elt_opcode (OP_THIS);
2407			      write_exp_elt_opcode (OP_THIS);
2408			      write_exp_elt_opcode (STRUCTOP_PTR);
2409			      write_exp_string (yyvsp[0].ssym.stoken);
2410			      write_exp_elt_opcode (STRUCTOP_PTR);
2411			    }
2412			  else
2413			    {
2414			      struct minimal_symbol *msymbol;
2415			      char *arg = copy_name (yyvsp[0].ssym.stoken);
2416
2417			      msymbol =
2418				lookup_minimal_symbol (arg, NULL, NULL);
2419			      if (msymbol != NULL)
2420				write_exp_msymbol (msymbol);
2421			      else if (!have_full_symbols () && !have_partial_symbols ())
2422				error (_("No symbol table is loaded.  Use the \"file\" command."));
2423			      else
2424				error (_("No symbol \"%s\" in current context."),
2425				       copy_name (yyvsp[0].ssym.stoken));
2426			    }
2427			}
2428    break;
2429
2430  case 92:
2431#line 906 "c-exp.y"
2432    { push_type_address_space (copy_name (yyvsp[0].ssym.stoken));
2433		  push_type (tp_space_identifier);
2434		}
2435    break;
2436
2437  case 100:
2438#line 928 "c-exp.y"
2439    { push_type (tp_pointer); yyval.voidval = 0; }
2440    break;
2441
2442  case 101:
2443#line 930 "c-exp.y"
2444    { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
2445    break;
2446
2447  case 102:
2448#line 932 "c-exp.y"
2449    { push_type (tp_reference); yyval.voidval = 0; }
2450    break;
2451
2452  case 103:
2453#line 934 "c-exp.y"
2454    { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
2455    break;
2456
2457  case 105:
2458#line 939 "c-exp.y"
2459    { yyval.voidval = yyvsp[-1].voidval; }
2460    break;
2461
2462  case 106:
2463#line 941 "c-exp.y"
2464    {
2465			  push_type_int (yyvsp[0].lval);
2466			  push_type (tp_array);
2467			}
2468    break;
2469
2470  case 107:
2471#line 946 "c-exp.y"
2472    {
2473			  push_type_int (yyvsp[0].lval);
2474			  push_type (tp_array);
2475			  yyval.voidval = 0;
2476			}
2477    break;
2478
2479  case 108:
2480#line 953 "c-exp.y"
2481    { push_type (tp_function); }
2482    break;
2483
2484  case 109:
2485#line 955 "c-exp.y"
2486    { push_type (tp_function); }
2487    break;
2488
2489  case 110:
2490#line 959 "c-exp.y"
2491    { yyval.lval = -1; }
2492    break;
2493
2494  case 111:
2495#line 961 "c-exp.y"
2496    { yyval.lval = yyvsp[-1].typed_val_int.val; }
2497    break;
2498
2499  case 112:
2500#line 965 "c-exp.y"
2501    { yyval.voidval = 0; }
2502    break;
2503
2504  case 113:
2505#line 967 "c-exp.y"
2506    { xfree (yyvsp[-1].tvec); yyval.voidval = 0; }
2507    break;
2508
2509  case 115:
2510#line 983 "c-exp.y"
2511    { yyval.tval = yyvsp[0].tsym.type; }
2512    break;
2513
2514  case 116:
2515#line 985 "c-exp.y"
2516    { yyval.tval = lookup_signed_typename (parse_language,
2517						       parse_gdbarch,
2518						       "int"); }
2519    break;
2520
2521  case 117:
2522#line 989 "c-exp.y"
2523    { yyval.tval = lookup_signed_typename (parse_language,
2524						       parse_gdbarch,
2525						       "long"); }
2526    break;
2527
2528  case 118:
2529#line 993 "c-exp.y"
2530    { yyval.tval = lookup_signed_typename (parse_language,
2531						       parse_gdbarch,
2532						       "short"); }
2533    break;
2534
2535  case 119:
2536#line 997 "c-exp.y"
2537    { yyval.tval = lookup_signed_typename (parse_language,
2538						       parse_gdbarch,
2539						       "long"); }
2540    break;
2541
2542  case 120:
2543#line 1001 "c-exp.y"
2544    { yyval.tval = lookup_signed_typename (parse_language,
2545						       parse_gdbarch,
2546						       "long"); }
2547    break;
2548
2549  case 121:
2550#line 1005 "c-exp.y"
2551    { yyval.tval = lookup_signed_typename (parse_language,
2552						       parse_gdbarch,
2553						       "long"); }
2554    break;
2555
2556  case 122:
2557#line 1009 "c-exp.y"
2558    { yyval.tval = lookup_signed_typename (parse_language,
2559						       parse_gdbarch,
2560						       "long"); }
2561    break;
2562
2563  case 123:
2564#line 1013 "c-exp.y"
2565    { yyval.tval = lookup_unsigned_typename (parse_language,
2566							 parse_gdbarch,
2567							 "long"); }
2568    break;
2569
2570  case 124:
2571#line 1017 "c-exp.y"
2572    { yyval.tval = lookup_unsigned_typename (parse_language,
2573							 parse_gdbarch,
2574							 "long"); }
2575    break;
2576
2577  case 125:
2578#line 1021 "c-exp.y"
2579    { yyval.tval = lookup_unsigned_typename (parse_language,
2580							 parse_gdbarch,
2581							 "long"); }
2582    break;
2583
2584  case 126:
2585#line 1025 "c-exp.y"
2586    { yyval.tval = lookup_signed_typename (parse_language,
2587						       parse_gdbarch,
2588						       "long long"); }
2589    break;
2590
2591  case 127:
2592#line 1029 "c-exp.y"
2593    { yyval.tval = lookup_signed_typename (parse_language,
2594						       parse_gdbarch,
2595						       "long long"); }
2596    break;
2597
2598  case 128:
2599#line 1033 "c-exp.y"
2600    { yyval.tval = lookup_signed_typename (parse_language,
2601						       parse_gdbarch,
2602						       "long long"); }
2603    break;
2604
2605  case 129:
2606#line 1037 "c-exp.y"
2607    { yyval.tval = lookup_signed_typename (parse_language,
2608						       parse_gdbarch,
2609						       "long long"); }
2610    break;
2611
2612  case 130:
2613#line 1041 "c-exp.y"
2614    { yyval.tval = lookup_signed_typename (parse_language,
2615						       parse_gdbarch,
2616						       "long long"); }
2617    break;
2618
2619  case 131:
2620#line 1045 "c-exp.y"
2621    { yyval.tval = lookup_signed_typename (parse_language,
2622						       parse_gdbarch,
2623						       "long long"); }
2624    break;
2625
2626  case 132:
2627#line 1049 "c-exp.y"
2628    { yyval.tval = lookup_unsigned_typename (parse_language,
2629							 parse_gdbarch,
2630							 "long long"); }
2631    break;
2632
2633  case 133:
2634#line 1053 "c-exp.y"
2635    { yyval.tval = lookup_unsigned_typename (parse_language,
2636							 parse_gdbarch,
2637							 "long long"); }
2638    break;
2639
2640  case 134:
2641#line 1057 "c-exp.y"
2642    { yyval.tval = lookup_unsigned_typename (parse_language,
2643							 parse_gdbarch,
2644							 "long long"); }
2645    break;
2646
2647  case 135:
2648#line 1061 "c-exp.y"
2649    { yyval.tval = lookup_unsigned_typename (parse_language,
2650							 parse_gdbarch,
2651							 "long long"); }
2652    break;
2653
2654  case 136:
2655#line 1065 "c-exp.y"
2656    { yyval.tval = lookup_signed_typename (parse_language,
2657						       parse_gdbarch,
2658						       "short"); }
2659    break;
2660
2661  case 137:
2662#line 1069 "c-exp.y"
2663    { yyval.tval = lookup_signed_typename (parse_language,
2664						       parse_gdbarch,
2665						       "short"); }
2666    break;
2667
2668  case 138:
2669#line 1073 "c-exp.y"
2670    { yyval.tval = lookup_signed_typename (parse_language,
2671						       parse_gdbarch,
2672						       "short"); }
2673    break;
2674
2675  case 139:
2676#line 1077 "c-exp.y"
2677    { yyval.tval = lookup_unsigned_typename (parse_language,
2678							 parse_gdbarch,
2679							 "short"); }
2680    break;
2681
2682  case 140:
2683#line 1081 "c-exp.y"
2684    { yyval.tval = lookup_unsigned_typename (parse_language,
2685							 parse_gdbarch,
2686							 "short"); }
2687    break;
2688
2689  case 141:
2690#line 1085 "c-exp.y"
2691    { yyval.tval = lookup_unsigned_typename (parse_language,
2692							 parse_gdbarch,
2693							 "short"); }
2694    break;
2695
2696  case 142:
2697#line 1089 "c-exp.y"
2698    { yyval.tval = lookup_typename (parse_language, parse_gdbarch,
2699						"double", (struct block *) NULL,
2700						0); }
2701    break;
2702
2703  case 143:
2704#line 1093 "c-exp.y"
2705    { yyval.tval = lookup_typename (parse_language, parse_gdbarch,
2706						"long double",
2707						(struct block *) NULL, 0); }
2708    break;
2709
2710  case 144:
2711#line 1097 "c-exp.y"
2712    { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2713					      expression_context_block); }
2714    break;
2715
2716  case 145:
2717#line 1100 "c-exp.y"
2718    { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2719					      expression_context_block); }
2720    break;
2721
2722  case 146:
2723#line 1103 "c-exp.y"
2724    { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
2725					     expression_context_block); }
2726    break;
2727
2728  case 147:
2729#line 1106 "c-exp.y"
2730    { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
2731					    expression_context_block); }
2732    break;
2733
2734  case 148:
2735#line 1109 "c-exp.y"
2736    { yyval.tval = lookup_unsigned_typename (parse_language,
2737							 parse_gdbarch,
2738							 TYPE_NAME(yyvsp[0].tsym.type)); }
2739    break;
2740
2741  case 149:
2742#line 1113 "c-exp.y"
2743    { yyval.tval = lookup_unsigned_typename (parse_language,
2744							 parse_gdbarch,
2745							 "int"); }
2746    break;
2747
2748  case 150:
2749#line 1117 "c-exp.y"
2750    { yyval.tval = lookup_signed_typename (parse_language,
2751						       parse_gdbarch,
2752						       TYPE_NAME(yyvsp[0].tsym.type)); }
2753    break;
2754
2755  case 151:
2756#line 1121 "c-exp.y"
2757    { yyval.tval = lookup_signed_typename (parse_language,
2758						       parse_gdbarch,
2759						       "int"); }
2760    break;
2761
2762  case 152:
2763#line 1128 "c-exp.y"
2764    { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
2765						    expression_context_block);
2766			}
2767    break;
2768
2769  case 153:
2770#line 1132 "c-exp.y"
2771    { yyval.tval = follow_types (yyvsp[0].tval); }
2772    break;
2773
2774  case 154:
2775#line 1134 "c-exp.y"
2776    { yyval.tval = follow_types (yyvsp[-1].tval); }
2777    break;
2778
2779  case 156:
2780#line 1139 "c-exp.y"
2781    {
2782		  yyval.tsym.stoken.ptr = "int";
2783		  yyval.tsym.stoken.length = 3;
2784		  yyval.tsym.type = lookup_signed_typename (parse_language,
2785						    parse_gdbarch,
2786						    "int");
2787		}
2788    break;
2789
2790  case 157:
2791#line 1147 "c-exp.y"
2792    {
2793		  yyval.tsym.stoken.ptr = "long";
2794		  yyval.tsym.stoken.length = 4;
2795		  yyval.tsym.type = lookup_signed_typename (parse_language,
2796						    parse_gdbarch,
2797						    "long");
2798		}
2799    break;
2800
2801  case 158:
2802#line 1155 "c-exp.y"
2803    {
2804		  yyval.tsym.stoken.ptr = "short";
2805		  yyval.tsym.stoken.length = 5;
2806		  yyval.tsym.type = lookup_signed_typename (parse_language,
2807						    parse_gdbarch,
2808						    "short");
2809		}
2810    break;
2811
2812  case 159:
2813#line 1166 "c-exp.y"
2814    { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
2815		  yyval.ivec[0] = 1;	/* Number of types in vector */
2816		  yyval.tvec[1] = yyvsp[0].tval;
2817		}
2818    break;
2819
2820  case 160:
2821#line 1171 "c-exp.y"
2822    { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
2823		  yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
2824		  yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
2825		}
2826    break;
2827
2828  case 162:
2829#line 1179 "c-exp.y"
2830    { yyval.tval = follow_types (yyvsp[-3].tval); }
2831    break;
2832
2833  case 165:
2834#line 1187 "c-exp.y"
2835    { push_type (tp_const);
2836			  push_type (tp_volatile);
2837			}
2838    break;
2839
2840  case 166:
2841#line 1191 "c-exp.y"
2842    { push_type (tp_const); }
2843    break;
2844
2845  case 167:
2846#line 1193 "c-exp.y"
2847    { push_type (tp_volatile); }
2848    break;
2849
2850  case 168:
2851#line 1197 "c-exp.y"
2852    { yyval.sval = operator_stoken (" new"); }
2853    break;
2854
2855  case 169:
2856#line 1199 "c-exp.y"
2857    { yyval.sval = operator_stoken (" delete"); }
2858    break;
2859
2860  case 170:
2861#line 1201 "c-exp.y"
2862    { yyval.sval = operator_stoken (" new[]"); }
2863    break;
2864
2865  case 171:
2866#line 1203 "c-exp.y"
2867    { yyval.sval = operator_stoken (" delete[]"); }
2868    break;
2869
2870  case 172:
2871#line 1205 "c-exp.y"
2872    { yyval.sval = operator_stoken ("+"); }
2873    break;
2874
2875  case 173:
2876#line 1207 "c-exp.y"
2877    { yyval.sval = operator_stoken ("-"); }
2878    break;
2879
2880  case 174:
2881#line 1209 "c-exp.y"
2882    { yyval.sval = operator_stoken ("*"); }
2883    break;
2884
2885  case 175:
2886#line 1211 "c-exp.y"
2887    { yyval.sval = operator_stoken ("/"); }
2888    break;
2889
2890  case 176:
2891#line 1213 "c-exp.y"
2892    { yyval.sval = operator_stoken ("%"); }
2893    break;
2894
2895  case 177:
2896#line 1215 "c-exp.y"
2897    { yyval.sval = operator_stoken ("^"); }
2898    break;
2899
2900  case 178:
2901#line 1217 "c-exp.y"
2902    { yyval.sval = operator_stoken ("&"); }
2903    break;
2904
2905  case 179:
2906#line 1219 "c-exp.y"
2907    { yyval.sval = operator_stoken ("|"); }
2908    break;
2909
2910  case 180:
2911#line 1221 "c-exp.y"
2912    { yyval.sval = operator_stoken ("~"); }
2913    break;
2914
2915  case 181:
2916#line 1223 "c-exp.y"
2917    { yyval.sval = operator_stoken ("!"); }
2918    break;
2919
2920  case 182:
2921#line 1225 "c-exp.y"
2922    { yyval.sval = operator_stoken ("="); }
2923    break;
2924
2925  case 183:
2926#line 1227 "c-exp.y"
2927    { yyval.sval = operator_stoken ("<"); }
2928    break;
2929
2930  case 184:
2931#line 1229 "c-exp.y"
2932    { yyval.sval = operator_stoken (">"); }
2933    break;
2934
2935  case 185:
2936#line 1231 "c-exp.y"
2937    { const char *op = "unknown";
2938			  switch (yyvsp[0].opcode)
2939			    {
2940			    case BINOP_RSH:
2941			      op = ">>=";
2942			      break;
2943			    case BINOP_LSH:
2944			      op = "<<=";
2945			      break;
2946			    case BINOP_ADD:
2947			      op = "+=";
2948			      break;
2949			    case BINOP_SUB:
2950			      op = "-=";
2951			      break;
2952			    case BINOP_MUL:
2953			      op = "*=";
2954			      break;
2955			    case BINOP_DIV:
2956			      op = "/=";
2957			      break;
2958			    case BINOP_REM:
2959			      op = "%=";
2960			      break;
2961			    case BINOP_BITWISE_IOR:
2962			      op = "|=";
2963			      break;
2964			    case BINOP_BITWISE_AND:
2965			      op = "&=";
2966			      break;
2967			    case BINOP_BITWISE_XOR:
2968			      op = "^=";
2969			      break;
2970			    default:
2971			      break;
2972			    }
2973
2974			  yyval.sval = operator_stoken (op);
2975			}
2976    break;
2977
2978  case 186:
2979#line 1271 "c-exp.y"
2980    { yyval.sval = operator_stoken ("<<"); }
2981    break;
2982
2983  case 187:
2984#line 1273 "c-exp.y"
2985    { yyval.sval = operator_stoken (">>"); }
2986    break;
2987
2988  case 188:
2989#line 1275 "c-exp.y"
2990    { yyval.sval = operator_stoken ("=="); }
2991    break;
2992
2993  case 189:
2994#line 1277 "c-exp.y"
2995    { yyval.sval = operator_stoken ("!="); }
2996    break;
2997
2998  case 190:
2999#line 1279 "c-exp.y"
3000    { yyval.sval = operator_stoken ("<="); }
3001    break;
3002
3003  case 191:
3004#line 1281 "c-exp.y"
3005    { yyval.sval = operator_stoken (">="); }
3006    break;
3007
3008  case 192:
3009#line 1283 "c-exp.y"
3010    { yyval.sval = operator_stoken ("&&"); }
3011    break;
3012
3013  case 193:
3014#line 1285 "c-exp.y"
3015    { yyval.sval = operator_stoken ("||"); }
3016    break;
3017
3018  case 194:
3019#line 1287 "c-exp.y"
3020    { yyval.sval = operator_stoken ("++"); }
3021    break;
3022
3023  case 195:
3024#line 1289 "c-exp.y"
3025    { yyval.sval = operator_stoken ("--"); }
3026    break;
3027
3028  case 196:
3029#line 1291 "c-exp.y"
3030    { yyval.sval = operator_stoken (","); }
3031    break;
3032
3033  case 197:
3034#line 1293 "c-exp.y"
3035    { yyval.sval = operator_stoken ("->*"); }
3036    break;
3037
3038  case 198:
3039#line 1295 "c-exp.y"
3040    { yyval.sval = operator_stoken ("->"); }
3041    break;
3042
3043  case 199:
3044#line 1297 "c-exp.y"
3045    { yyval.sval = operator_stoken ("()"); }
3046    break;
3047
3048  case 200:
3049#line 1299 "c-exp.y"
3050    { yyval.sval = operator_stoken ("[]"); }
3051    break;
3052
3053  case 201:
3054#line 1301 "c-exp.y"
3055    { char *name;
3056			  long length;
3057			  struct ui_file *buf = mem_fileopen ();
3058
3059			  c_print_type (yyvsp[0].tval, NULL, buf, -1, 0);
3060			  name = ui_file_xstrdup (buf, &length);
3061			  ui_file_delete (buf);
3062			  yyval.sval = operator_stoken (name);
3063			  xfree (name);
3064			}
3065    break;
3066
3067  case 202:
3068#line 1315 "c-exp.y"
3069    { yyval.sval = yyvsp[0].ssym.stoken; }
3070    break;
3071
3072  case 203:
3073#line 1316 "c-exp.y"
3074    { yyval.sval = yyvsp[0].ssym.stoken; }
3075    break;
3076
3077  case 204:
3078#line 1317 "c-exp.y"
3079    { yyval.sval = yyvsp[0].tsym.stoken; }
3080    break;
3081
3082  case 205:
3083#line 1318 "c-exp.y"
3084    { yyval.sval = yyvsp[0].ssym.stoken; }
3085    break;
3086
3087  case 206:
3088#line 1319 "c-exp.y"
3089    { yyval.sval = yyvsp[0].ssym.stoken; }
3090    break;
3091
3092  case 207:
3093#line 1320 "c-exp.y"
3094    { yyval.sval = yyvsp[0].sval; }
3095    break;
3096
3097  case 210:
3098#line 1333 "c-exp.y"
3099    {
3100			  yyval.ssym.stoken = yyvsp[0].sval;
3101			  yyval.ssym.sym = lookup_symbol (yyvsp[0].sval.ptr,
3102						  expression_context_block,
3103						  VAR_DOMAIN,
3104						  &yyval.ssym.is_a_field_of_this);
3105			}
3106    break;
3107
3108
3109    }
3110
3111/* Line 1000 of yacc.c.  */
3112#line 3113 "c-exp.c"
3113
3114  yyvsp -= yylen;
3115  yyssp -= yylen;
3116
3117
3118  YY_STACK_PRINT (yyss, yyssp);
3119
3120  *++yyvsp = yyval;
3121
3122
3123  /* Now `shift' the result of the reduction.  Determine what state
3124     that goes to, based on the state we popped back to and the rule
3125     number reduced by.  */
3126
3127  yyn = yyr1[yyn];
3128
3129  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
3130  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3131    yystate = yytable[yystate];
3132  else
3133    yystate = yydefgoto[yyn - YYNTOKENS];
3134
3135  goto yynewstate;
3136
3137
3138/*------------------------------------.
3139| yyerrlab -- here on detecting error |
3140`------------------------------------*/
3141yyerrlab:
3142  /* If not already recovering from an error, report this error.  */
3143  if (!yyerrstatus)
3144    {
3145      ++yynerrs;
3146#if YYERROR_VERBOSE
3147      yyn = yypact[yystate];
3148
3149      if (YYPACT_NINF < yyn && yyn < YYLAST)
3150	{
3151	  YYSIZE_T yysize = 0;
3152	  int yytype = YYTRANSLATE (yychar);
3153	  const char* yyprefix;
3154	  char *yymsg;
3155	  int yyx;
3156
3157	  /* Start YYX at -YYN if negative to avoid negative indexes in
3158	     YYCHECK.  */
3159	  int yyxbegin = yyn < 0 ? -yyn : 0;
3160
3161	  /* Stay within bounds of both yycheck and yytname.  */
3162	  int yychecklim = YYLAST - yyn;
3163	  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
3164	  int yycount = 0;
3165
3166	  yyprefix = ", expecting ";
3167	  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3168	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3169	      {
3170		yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
3171		yycount += 1;
3172		if (yycount == 5)
3173		  {
3174		    yysize = 0;
3175		    break;
3176		  }
3177	      }
3178	  yysize += (sizeof ("syntax error, unexpected ")
3179		     + yystrlen (yytname[yytype]));
3180	  yymsg = (char *) YYSTACK_ALLOC (yysize);
3181	  if (yymsg != 0)
3182	    {
3183	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
3184	      yyp = yystpcpy (yyp, yytname[yytype]);
3185
3186	      if (yycount < 5)
3187		{
3188		  yyprefix = ", expecting ";
3189		  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
3190		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
3191		      {
3192			yyp = yystpcpy (yyp, yyprefix);
3193			yyp = yystpcpy (yyp, yytname[yyx]);
3194			yyprefix = " or ";
3195		      }
3196		}
3197	      yyerror (yymsg);
3198	      YYSTACK_FREE (yymsg);
3199	    }
3200	  else
3201	    yyerror ("syntax error; also virtual memory exhausted");
3202	}
3203      else
3204#endif /* YYERROR_VERBOSE */
3205	yyerror ("syntax error");
3206    }
3207
3208
3209
3210  if (yyerrstatus == 3)
3211    {
3212      /* If just tried and failed to reuse lookahead token after an
3213	 error, discard it.  */
3214
3215      if (yychar <= YYEOF)
3216        {
3217          /* If at end of input, pop the error token,
3218	     then the rest of the stack, then return failure.  */
3219	  if (yychar == YYEOF)
3220	     for (;;)
3221	       {
3222		 YYPOPSTACK;
3223		 if (yyssp == yyss)
3224		   YYABORT;
3225		 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
3226		 yydestruct (yystos[*yyssp], yyvsp);
3227	       }
3228        }
3229      else
3230	{
3231	  YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
3232	  yydestruct (yytoken, &yylval);
3233	  yychar = YYEMPTY;
3234
3235	}
3236    }
3237
3238  /* Else will try to reuse lookahead token after shifting the error
3239     token.  */
3240  goto yyerrlab1;
3241
3242
3243/*---------------------------------------------------.
3244| yyerrorlab -- error raised explicitly by YYERROR.  |
3245`---------------------------------------------------*/
3246yyerrorlab:
3247
3248#ifdef __GNUC__
3249  /* Pacify GCC when the user code never invokes YYERROR and the label
3250     yyerrorlab therefore never appears in user code.  */
3251  if (0)
3252     goto yyerrorlab;
3253#endif
3254
3255  yyvsp -= yylen;
3256  yyssp -= yylen;
3257  yystate = *yyssp;
3258  goto yyerrlab1;
3259
3260
3261/*-------------------------------------------------------------.
3262| yyerrlab1 -- common code for both syntax error and YYERROR.  |
3263`-------------------------------------------------------------*/
3264yyerrlab1:
3265  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
3266
3267  for (;;)
3268    {
3269      yyn = yypact[yystate];
3270      if (yyn != YYPACT_NINF)
3271	{
3272	  yyn += YYTERROR;
3273	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3274	    {
3275	      yyn = yytable[yyn];
3276	      if (0 < yyn)
3277		break;
3278	    }
3279	}
3280
3281      /* Pop the current state because it cannot handle the error token.  */
3282      if (yyssp == yyss)
3283	YYABORT;
3284
3285      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
3286      yydestruct (yystos[yystate], yyvsp);
3287      YYPOPSTACK;
3288      yystate = *yyssp;
3289      YY_STACK_PRINT (yyss, yyssp);
3290    }
3291
3292  if (yyn == YYFINAL)
3293    YYACCEPT;
3294
3295  YYDPRINTF ((stderr, "Shifting error token, "));
3296
3297  *++yyvsp = yylval;
3298
3299
3300  yystate = yyn;
3301  goto yynewstate;
3302
3303
3304/*-------------------------------------.
3305| yyacceptlab -- YYACCEPT comes here.  |
3306`-------------------------------------*/
3307yyacceptlab:
3308  yyresult = 0;
3309  goto yyreturn;
3310
3311/*-----------------------------------.
3312| yyabortlab -- YYABORT comes here.  |
3313`-----------------------------------*/
3314yyabortlab:
3315  yyresult = 1;
3316  goto yyreturn;
3317
3318#ifndef yyoverflow
3319/*----------------------------------------------.
3320| yyoverflowlab -- parser overflow comes here.  |
3321`----------------------------------------------*/
3322yyoverflowlab:
3323  yyerror ("parser stack overflow");
3324  yyresult = 2;
3325  /* Fall through.  */
3326#endif
3327
3328yyreturn:
3329#ifndef yyoverflow
3330  if (yyss != yyssa)
3331    YYSTACK_FREE (yyss);
3332#endif
3333  return yyresult;
3334}
3335
3336
3337#line 1343 "c-exp.y"
3338
3339
3340/* Returns a stoken of the operator name given by OP (which does not
3341   include the string "operator").  */
3342static struct stoken
3343operator_stoken (const char *op)
3344{
3345  static const char *operator_string = "operator";
3346  struct stoken st = { NULL, 0 };
3347  st.length = strlen (operator_string) + strlen (op);
3348  st.ptr = xmalloc (st.length + 1);
3349  strcpy (st.ptr, operator_string);
3350  strcat (st.ptr, op);
3351
3352  /* The toplevel (c_parse) will free the memory allocated here.  */
3353  make_cleanup (xfree, st.ptr);
3354  return st;
3355};
3356
3357/* Take care of parsing a number (anything that starts with a digit).
3358   Set yylval and return the token type; update lexptr.
3359   LEN is the number of characters in it.  */
3360
3361/*** Needs some error checking for the float case ***/
3362
3363static int
3364parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
3365{
3366  /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
3367     here, and we do kind of silly things like cast to unsigned.  */
3368  LONGEST n = 0;
3369  LONGEST prevn = 0;
3370  ULONGEST un;
3371
3372  int i = 0;
3373  int c;
3374  int base = input_radix;
3375  int unsigned_p = 0;
3376
3377  /* Number of "L" suffixes encountered.  */
3378  int long_p = 0;
3379
3380  /* We have found a "L" or "U" suffix.  */
3381  int found_suffix = 0;
3382
3383  ULONGEST high_bit;
3384  struct type *signed_type;
3385  struct type *unsigned_type;
3386
3387  if (parsed_float)
3388    {
3389      const char *suffix;
3390      int suffix_len;
3391
3392      /* If it ends at "df", "dd" or "dl", take it as type of decimal floating
3393         point.  Return DECFLOAT.  */
3394
3395      if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'f')
3396	{
3397	  p[len - 2] = '\0';
3398	  putithere->typed_val_decfloat.type
3399	    = parse_type->builtin_decfloat;
3400	  decimal_from_string (putithere->typed_val_decfloat.val, 4,
3401			       gdbarch_byte_order (parse_gdbarch), p);
3402	  p[len - 2] = 'd';
3403	  return DECFLOAT;
3404	}
3405
3406      if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'd')
3407	{
3408	  p[len - 2] = '\0';
3409	  putithere->typed_val_decfloat.type
3410	    = parse_type->builtin_decdouble;
3411	  decimal_from_string (putithere->typed_val_decfloat.val, 8,
3412			       gdbarch_byte_order (parse_gdbarch), p);
3413	  p[len - 2] = 'd';
3414	  return DECFLOAT;
3415	}
3416
3417      if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'l')
3418	{
3419	  p[len - 2] = '\0';
3420	  putithere->typed_val_decfloat.type
3421	    = parse_type->builtin_declong;
3422	  decimal_from_string (putithere->typed_val_decfloat.val, 16,
3423			       gdbarch_byte_order (parse_gdbarch), p);
3424	  p[len - 2] = 'd';
3425	  return DECFLOAT;
3426	}
3427
3428      if (! parse_c_float (parse_gdbarch, p, len,
3429			   &putithere->typed_val_float.dval,
3430			   &putithere->typed_val_float.type))
3431	return ERROR;
3432      return FLOAT;
3433    }
3434
3435  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
3436  if (p[0] == '0')
3437    switch (p[1])
3438      {
3439      case 'x':
3440      case 'X':
3441	if (len >= 3)
3442	  {
3443	    p += 2;
3444	    base = 16;
3445	    len -= 2;
3446	  }
3447	break;
3448
3449      case 'b':
3450      case 'B':
3451	if (len >= 3)
3452	  {
3453	    p += 2;
3454	    base = 2;
3455	    len -= 2;
3456	  }
3457	break;
3458
3459      case 't':
3460      case 'T':
3461      case 'd':
3462      case 'D':
3463	if (len >= 3)
3464	  {
3465	    p += 2;
3466	    base = 10;
3467	    len -= 2;
3468	  }
3469	break;
3470
3471      default:
3472	base = 8;
3473	break;
3474      }
3475
3476  while (len-- > 0)
3477    {
3478      c = *p++;
3479      if (c >= 'A' && c <= 'Z')
3480	c += 'a' - 'A';
3481      if (c != 'l' && c != 'u')
3482	n *= base;
3483      if (c >= '0' && c <= '9')
3484	{
3485	  if (found_suffix)
3486	    return ERROR;
3487	  n += i = c - '0';
3488	}
3489      else
3490	{
3491	  if (base > 10 && c >= 'a' && c <= 'f')
3492	    {
3493	      if (found_suffix)
3494		return ERROR;
3495	      n += i = c - 'a' + 10;
3496	    }
3497	  else if (c == 'l')
3498	    {
3499	      ++long_p;
3500	      found_suffix = 1;
3501	    }
3502	  else if (c == 'u')
3503	    {
3504	      unsigned_p = 1;
3505	      found_suffix = 1;
3506	    }
3507	  else
3508	    return ERROR;	/* Char not a digit */
3509	}
3510      if (i >= base)
3511	return ERROR;		/* Invalid digit in this base */
3512
3513      /* Portably test for overflow (only works for nonzero values, so make
3514	 a second check for zero).  FIXME: Can't we just make n and prevn
3515	 unsigned and avoid this?  */
3516      if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
3517	unsigned_p = 1;		/* Try something unsigned */
3518
3519      /* Portably test for unsigned overflow.
3520	 FIXME: This check is wrong; for example it doesn't find overflow
3521	 on 0x123456789 when LONGEST is 32 bits.  */
3522      if (c != 'l' && c != 'u' && n != 0)
3523	{
3524	  if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
3525	    error (_("Numeric constant too large."));
3526	}
3527      prevn = n;
3528    }
3529
3530  /* An integer constant is an int, a long, or a long long.  An L
3531     suffix forces it to be long; an LL suffix forces it to be long
3532     long.  If not forced to a larger size, it gets the first type of
3533     the above that it fits in.  To figure out whether it fits, we
3534     shift it right and see whether anything remains.  Note that we
3535     can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
3536     operation, because many compilers will warn about such a shift
3537     (which always produces a zero result).  Sometimes gdbarch_int_bit
3538     or gdbarch_long_bit will be that big, sometimes not.  To deal with
3539     the case where it is we just always shift the value more than
3540     once, with fewer bits each time.  */
3541
3542  un = (ULONGEST)n >> 2;
3543  if (long_p == 0
3544      && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
3545    {
3546      high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
3547
3548      /* A large decimal (not hex or octal) constant (between INT_MAX
3549	 and UINT_MAX) is a long or unsigned long, according to ANSI,
3550	 never an unsigned int, but this code treats it as unsigned
3551	 int.  This probably should be fixed.  GCC gives a warning on
3552	 such constants.  */
3553
3554      unsigned_type = parse_type->builtin_unsigned_int;
3555      signed_type = parse_type->builtin_int;
3556    }
3557  else if (long_p <= 1
3558	   && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
3559    {
3560      high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
3561      unsigned_type = parse_type->builtin_unsigned_long;
3562      signed_type = parse_type->builtin_long;
3563    }
3564  else
3565    {
3566      int shift;
3567      if (sizeof (ULONGEST) * HOST_CHAR_BIT
3568	  < gdbarch_long_long_bit (parse_gdbarch))
3569	/* A long long does not fit in a LONGEST.  */
3570	shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
3571      else
3572	shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
3573      high_bit = (ULONGEST) 1 << shift;
3574      unsigned_type = parse_type->builtin_unsigned_long_long;
3575      signed_type = parse_type->builtin_long_long;
3576    }
3577
3578   putithere->typed_val_int.val = n;
3579
3580   /* If the high bit of the worked out type is set then this number
3581      has to be unsigned. */
3582
3583   if (unsigned_p || (n & high_bit))
3584     {
3585       putithere->typed_val_int.type = unsigned_type;
3586     }
3587   else
3588     {
3589       putithere->typed_val_int.type = signed_type;
3590     }
3591
3592   return INT;
3593}
3594
3595/* Temporary obstack used for holding strings.  */
3596static struct obstack tempbuf;
3597static int tempbuf_init;
3598
3599/* Parse a C escape sequence.  The initial backslash of the sequence
3600   is at (*PTR)[-1].  *PTR will be updated to point to just after the
3601   last character of the sequence.  If OUTPUT is not NULL, the
3602   translated form of the escape sequence will be written there.  If
3603   OUTPUT is NULL, no output is written and the call will only affect
3604   *PTR.  If an escape sequence is expressed in target bytes, then the
3605   entire sequence will simply be copied to OUTPUT.  Return 1 if any
3606   character was emitted, 0 otherwise.  */
3607
3608int
3609c_parse_escape (char **ptr, struct obstack *output)
3610{
3611  char *tokptr = *ptr;
3612  int result = 1;
3613
3614  /* Some escape sequences undergo character set conversion.  Those we
3615     translate here.  */
3616  switch (*tokptr)
3617    {
3618      /* Hex escapes do not undergo character set conversion, so keep
3619	 the escape sequence for later.  */
3620    case 'x':
3621      if (output)
3622	obstack_grow_str (output, "\\x");
3623      ++tokptr;
3624      if (!isxdigit (*tokptr))
3625	error (_("\\x escape without a following hex digit"));
3626      while (isxdigit (*tokptr))
3627	{
3628	  if (output)
3629	    obstack_1grow (output, *tokptr);
3630	  ++tokptr;
3631	}
3632      break;
3633
3634      /* Octal escapes do not undergo character set conversion, so
3635	 keep the escape sequence for later.  */
3636    case '0':
3637    case '1':
3638    case '2':
3639    case '3':
3640    case '4':
3641    case '5':
3642    case '6':
3643    case '7':
3644      {
3645	int i;
3646	if (output)
3647	  obstack_grow_str (output, "\\");
3648	for (i = 0;
3649	     i < 3 && isdigit (*tokptr) && *tokptr != '8' && *tokptr != '9';
3650	     ++i)
3651	  {
3652	    if (output)
3653	      obstack_1grow (output, *tokptr);
3654	    ++tokptr;
3655	  }
3656      }
3657      break;
3658
3659      /* We handle UCNs later.  We could handle them here, but that
3660	 would mean a spurious error in the case where the UCN could
3661	 be converted to the target charset but not the host
3662	 charset.  */
3663    case 'u':
3664    case 'U':
3665      {
3666	char c = *tokptr;
3667	int i, len = c == 'U' ? 8 : 4;
3668	if (output)
3669	  {
3670	    obstack_1grow (output, '\\');
3671	    obstack_1grow (output, *tokptr);
3672	  }
3673	++tokptr;
3674	if (!isxdigit (*tokptr))
3675	  error (_("\\%c escape without a following hex digit"), c);
3676	for (i = 0; i < len && isxdigit (*tokptr); ++i)
3677	  {
3678	    if (output)
3679	      obstack_1grow (output, *tokptr);
3680	    ++tokptr;
3681	  }
3682      }
3683      break;
3684
3685      /* We must pass backslash through so that it does not
3686	 cause quoting during the second expansion.  */
3687    case '\\':
3688      if (output)
3689	obstack_grow_str (output, "\\\\");
3690      ++tokptr;
3691      break;
3692
3693      /* Escapes which undergo conversion.  */
3694    case 'a':
3695      if (output)
3696	obstack_1grow (output, '\a');
3697      ++tokptr;
3698      break;
3699    case 'b':
3700      if (output)
3701	obstack_1grow (output, '\b');
3702      ++tokptr;
3703      break;
3704    case 'f':
3705      if (output)
3706	obstack_1grow (output, '\f');
3707      ++tokptr;
3708      break;
3709    case 'n':
3710      if (output)
3711	obstack_1grow (output, '\n');
3712      ++tokptr;
3713      break;
3714    case 'r':
3715      if (output)
3716	obstack_1grow (output, '\r');
3717      ++tokptr;
3718      break;
3719    case 't':
3720      if (output)
3721	obstack_1grow (output, '\t');
3722      ++tokptr;
3723      break;
3724    case 'v':
3725      if (output)
3726	obstack_1grow (output, '\v');
3727      ++tokptr;
3728      break;
3729
3730      /* GCC extension.  */
3731    case 'e':
3732      if (output)
3733	obstack_1grow (output, HOST_ESCAPE_CHAR);
3734      ++tokptr;
3735      break;
3736
3737      /* Backslash-newline expands to nothing at all.  */
3738    case '\n':
3739      ++tokptr;
3740      result = 0;
3741      break;
3742
3743      /* A few escapes just expand to the character itself.  */
3744    case '\'':
3745    case '\"':
3746    case '?':
3747      /* GCC extensions.  */
3748    case '(':
3749    case '{':
3750    case '[':
3751    case '%':
3752      /* Unrecognized escapes turn into the character itself.  */
3753    default:
3754      if (output)
3755	obstack_1grow (output, *tokptr);
3756      ++tokptr;
3757      break;
3758    }
3759  *ptr = tokptr;
3760  return result;
3761}
3762
3763/* Parse a string or character literal from TOKPTR.  The string or
3764   character may be wide or unicode.  *OUTPTR is set to just after the
3765   end of the literal in the input string.  The resulting token is
3766   stored in VALUE.  This returns a token value, either STRING or
3767   CHAR, depending on what was parsed.  *HOST_CHARS is set to the
3768   number of host characters in the literal.  */
3769static int
3770parse_string_or_char (char *tokptr, char **outptr, struct typed_stoken *value,
3771		      int *host_chars)
3772{
3773  int quote;
3774  enum c_string_type type;
3775
3776  /* Build the gdb internal form of the input string in tempbuf.  Note
3777     that the buffer is null byte terminated *only* for the
3778     convenience of debugging gdb itself and printing the buffer
3779     contents when the buffer contains no embedded nulls.  Gdb does
3780     not depend upon the buffer being null byte terminated, it uses
3781     the length string instead.  This allows gdb to handle C strings
3782     (as well as strings in other languages) with embedded null
3783     bytes */
3784
3785  if (!tempbuf_init)
3786    tempbuf_init = 1;
3787  else
3788    obstack_free (&tempbuf, NULL);
3789  obstack_init (&tempbuf);
3790
3791  /* Record the string type.  */
3792  if (*tokptr == 'L')
3793    {
3794      type = C_WIDE_STRING;
3795      ++tokptr;
3796    }
3797  else if (*tokptr == 'u')
3798    {
3799      type = C_STRING_16;
3800      ++tokptr;
3801    }
3802  else if (*tokptr == 'U')
3803    {
3804      type = C_STRING_32;
3805      ++tokptr;
3806    }
3807  else
3808    type = C_STRING;
3809
3810  /* Skip the quote.  */
3811  quote = *tokptr;
3812  if (quote == '\'')
3813    type |= C_CHAR;
3814  ++tokptr;
3815
3816  *host_chars = 0;
3817
3818  while (*tokptr)
3819    {
3820      char c = *tokptr;
3821      if (c == '\\')
3822	{
3823	  ++tokptr;
3824	  *host_chars += c_parse_escape (&tokptr, &tempbuf);
3825	}
3826      else if (c == quote)
3827	break;
3828      else
3829	{
3830	  obstack_1grow (&tempbuf, c);
3831	  ++tokptr;
3832	  /* FIXME: this does the wrong thing with multi-byte host
3833	     characters.  We could use mbrlen here, but that would
3834	     make "set host-charset" a bit less useful.  */
3835	  ++*host_chars;
3836	}
3837    }
3838
3839  if (*tokptr != quote)
3840    {
3841      if (quote == '"')
3842	error (_("Unterminated string in expression."));
3843      else
3844	error (_("Unmatched single quote."));
3845    }
3846  ++tokptr;
3847
3848  value->type = type;
3849  value->ptr = obstack_base (&tempbuf);
3850  value->length = obstack_object_size (&tempbuf);
3851
3852  *outptr = tokptr;
3853
3854  return quote == '"' ? STRING : CHAR;
3855}
3856
3857struct token
3858{
3859  char *operator;
3860  int token;
3861  enum exp_opcode opcode;
3862  int cxx_only;
3863};
3864
3865static const struct token tokentab3[] =
3866  {
3867    {">>=", ASSIGN_MODIFY, BINOP_RSH, 0},
3868    {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0},
3869    {"->*", ARROW_STAR, BINOP_END, 1}
3870  };
3871
3872static const struct token tokentab2[] =
3873  {
3874    {"+=", ASSIGN_MODIFY, BINOP_ADD, 0},
3875    {"-=", ASSIGN_MODIFY, BINOP_SUB, 0},
3876    {"*=", ASSIGN_MODIFY, BINOP_MUL, 0},
3877    {"/=", ASSIGN_MODIFY, BINOP_DIV, 0},
3878    {"%=", ASSIGN_MODIFY, BINOP_REM, 0},
3879    {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR, 0},
3880    {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND, 0},
3881    {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR, 0},
3882    {"++", INCREMENT, BINOP_END, 0},
3883    {"--", DECREMENT, BINOP_END, 0},
3884    {"->", ARROW, BINOP_END, 0},
3885    {"&&", ANDAND, BINOP_END, 0},
3886    {"||", OROR, BINOP_END, 0},
3887    /* "::" is *not* only C++: gdb overrides its meaning in several
3888       different ways, e.g., 'filename'::func, function::variable.  */
3889    {"::", COLONCOLON, BINOP_END, 0},
3890    {"<<", LSH, BINOP_END, 0},
3891    {">>", RSH, BINOP_END, 0},
3892    {"==", EQUAL, BINOP_END, 0},
3893    {"!=", NOTEQUAL, BINOP_END, 0},
3894    {"<=", LEQ, BINOP_END, 0},
3895    {">=", GEQ, BINOP_END, 0},
3896    {".*", DOT_STAR, BINOP_END, 1}
3897  };
3898
3899/* Identifier-like tokens.  */
3900static const struct token ident_tokens[] =
3901  {
3902    {"unsigned", UNSIGNED, OP_NULL, 0},
3903    {"template", TEMPLATE, OP_NULL, 1},
3904    {"volatile", VOLATILE_KEYWORD, OP_NULL, 0},
3905    {"struct", STRUCT, OP_NULL, 0},
3906    {"signed", SIGNED_KEYWORD, OP_NULL, 0},
3907    {"sizeof", SIZEOF, OP_NULL, 0},
3908    {"double", DOUBLE_KEYWORD, OP_NULL, 0},
3909    {"false", FALSEKEYWORD, OP_NULL, 1},
3910    {"class", CLASS, OP_NULL, 1},
3911    {"union", UNION, OP_NULL, 0},
3912    {"short", SHORT, OP_NULL, 0},
3913    {"const", CONST_KEYWORD, OP_NULL, 0},
3914    {"enum", ENUM, OP_NULL, 0},
3915    {"long", LONG, OP_NULL, 0},
3916    {"true", TRUEKEYWORD, OP_NULL, 1},
3917    {"int", INT_KEYWORD, OP_NULL, 0},
3918    {"new", NEW, OP_NULL, 1},
3919    {"delete", DELETE, OP_NULL, 1},
3920    {"operator", OPERATOR, OP_NULL, 1},
3921
3922    {"and", ANDAND, BINOP_END, 1},
3923    {"and_eq", ASSIGN_MODIFY, BINOP_BITWISE_AND, 1},
3924    {"bitand", '&', OP_NULL, 1},
3925    {"bitor", '|', OP_NULL, 1},
3926    {"compl", '~', OP_NULL, 1},
3927    {"not", '!', OP_NULL, 1},
3928    {"not_eq", NOTEQUAL, BINOP_END, 1},
3929    {"or", OROR, BINOP_END, 1},
3930    {"or_eq", ASSIGN_MODIFY, BINOP_BITWISE_IOR, 1},
3931    {"xor", '^', OP_NULL, 1},
3932    {"xor_eq", ASSIGN_MODIFY, BINOP_BITWISE_XOR, 1},
3933
3934    {"const_cast", CONST_CAST, OP_NULL, 1 },
3935    {"dynamic_cast", DYNAMIC_CAST, OP_NULL, 1 },
3936    {"static_cast", STATIC_CAST, OP_NULL, 1 },
3937    {"reinterpret_cast", REINTERPRET_CAST, OP_NULL, 1 }
3938  };
3939
3940/* When we find that lexptr (the global var defined in parse.c) is
3941   pointing at a macro invocation, we expand the invocation, and call
3942   scan_macro_expansion to save the old lexptr here and point lexptr
3943   into the expanded text.  When we reach the end of that, we call
3944   end_macro_expansion to pop back to the value we saved here.  The
3945   macro expansion code promises to return only fully-expanded text,
3946   so we don't need to "push" more than one level.
3947
3948   This is disgusting, of course.  It would be cleaner to do all macro
3949   expansion beforehand, and then hand that to lexptr.  But we don't
3950   really know where the expression ends.  Remember, in a command like
3951
3952     (gdb) break *ADDRESS if CONDITION
3953
3954   we evaluate ADDRESS in the scope of the current frame, but we
3955   evaluate CONDITION in the scope of the breakpoint's location.  So
3956   it's simply wrong to try to macro-expand the whole thing at once.  */
3957static char *macro_original_text;
3958
3959/* We save all intermediate macro expansions on this obstack for the
3960   duration of a single parse.  The expansion text may sometimes have
3961   to live past the end of the expansion, due to yacc lookahead.
3962   Rather than try to be clever about saving the data for a single
3963   token, we simply keep it all and delete it after parsing has
3964   completed.  */
3965static struct obstack expansion_obstack;
3966
3967static void
3968scan_macro_expansion (char *expansion)
3969{
3970  char *copy;
3971
3972  /* We'd better not be trying to push the stack twice.  */
3973  gdb_assert (! macro_original_text);
3974
3975  /* Copy to the obstack, and then free the intermediate
3976     expansion.  */
3977  copy = obstack_copy0 (&expansion_obstack, expansion, strlen (expansion));
3978  xfree (expansion);
3979
3980  /* Save the old lexptr value, so we can return to it when we're done
3981     parsing the expanded text.  */
3982  macro_original_text = lexptr;
3983  lexptr = copy;
3984}
3985
3986
3987static int
3988scanning_macro_expansion (void)
3989{
3990  return macro_original_text != 0;
3991}
3992
3993
3994static void
3995finished_macro_expansion (void)
3996{
3997  /* There'd better be something to pop back to.  */
3998  gdb_assert (macro_original_text);
3999
4000  /* Pop back to the original text.  */
4001  lexptr = macro_original_text;
4002  macro_original_text = 0;
4003}
4004
4005
4006static void
4007scan_macro_cleanup (void *dummy)
4008{
4009  if (macro_original_text)
4010    finished_macro_expansion ();
4011
4012  obstack_free (&expansion_obstack, NULL);
4013}
4014
4015/* Return true iff the token represents a C++ cast operator.  */
4016
4017static int
4018is_cast_operator (const char *token, int len)
4019{
4020  return (! strncmp (token, "dynamic_cast", len)
4021	  || ! strncmp (token, "static_cast", len)
4022	  || ! strncmp (token, "reinterpret_cast", len)
4023	  || ! strncmp (token, "const_cast", len));
4024}
4025
4026/* The scope used for macro expansion.  */
4027static struct macro_scope *expression_macro_scope;
4028
4029/* This is set if a NAME token appeared at the very end of the input
4030   string, with no whitespace separating the name from the EOF.  This
4031   is used only when parsing to do field name completion.  */
4032static int saw_name_at_eof;
4033
4034/* This is set if the previously-returned token was a structure
4035   operator -- either '.' or ARROW.  This is used only when parsing to
4036   do field name completion.  */
4037static int last_was_structop;
4038
4039/* Read one token, getting characters through lexptr.  */
4040
4041static int
4042lex_one_token (void)
4043{
4044  int c;
4045  int namelen;
4046  unsigned int i;
4047  char *tokstart;
4048  int saw_structop = last_was_structop;
4049  char *copy;
4050
4051  last_was_structop = 0;
4052
4053 retry:
4054
4055  /* Check if this is a macro invocation that we need to expand.  */
4056  if (! scanning_macro_expansion ())
4057    {
4058      char *expanded = macro_expand_next (&lexptr,
4059                                          standard_macro_lookup,
4060                                          expression_macro_scope);
4061
4062      if (expanded)
4063        scan_macro_expansion (expanded);
4064    }
4065
4066  prev_lexptr = lexptr;
4067
4068  tokstart = lexptr;
4069  /* See if it is a special token of length 3.  */
4070  for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
4071    if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
4072      {
4073	if (tokentab3[i].cxx_only
4074	    && parse_language->la_language != language_cplus)
4075	  break;
4076
4077	lexptr += 3;
4078	yylval.opcode = tokentab3[i].opcode;
4079	return tokentab3[i].token;
4080      }
4081
4082  /* See if it is a special token of length 2.  */
4083  for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
4084    if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
4085      {
4086	if (tokentab2[i].cxx_only
4087	    && parse_language->la_language != language_cplus)
4088	  break;
4089
4090	lexptr += 2;
4091	yylval.opcode = tokentab2[i].opcode;
4092	if (in_parse_field && tokentab2[i].token == ARROW)
4093	  last_was_structop = 1;
4094	return tokentab2[i].token;
4095      }
4096
4097  switch (c = *tokstart)
4098    {
4099    case 0:
4100      /* If we were just scanning the result of a macro expansion,
4101         then we need to resume scanning the original text.
4102	 If we're parsing for field name completion, and the previous
4103	 token allows such completion, return a COMPLETE token.
4104         Otherwise, we were already scanning the original text, and
4105         we're really done.  */
4106      if (scanning_macro_expansion ())
4107        {
4108          finished_macro_expansion ();
4109          goto retry;
4110        }
4111      else if (saw_name_at_eof)
4112	{
4113	  saw_name_at_eof = 0;
4114	  return COMPLETE;
4115	}
4116      else if (saw_structop)
4117	return COMPLETE;
4118      else
4119        return 0;
4120
4121    case ' ':
4122    case '\t':
4123    case '\n':
4124      lexptr++;
4125      goto retry;
4126
4127    case '[':
4128    case '(':
4129      paren_depth++;
4130      lexptr++;
4131      return c;
4132
4133    case ']':
4134    case ')':
4135      if (paren_depth == 0)
4136	return 0;
4137      paren_depth--;
4138      lexptr++;
4139      return c;
4140
4141    case ',':
4142      if (comma_terminates
4143          && paren_depth == 0
4144          && ! scanning_macro_expansion ())
4145	return 0;
4146      lexptr++;
4147      return c;
4148
4149    case '.':
4150      /* Might be a floating point number.  */
4151      if (lexptr[1] < '0' || lexptr[1] > '9')
4152	{
4153	  if (in_parse_field)
4154	    last_was_structop = 1;
4155	  goto symbol;		/* Nope, must be a symbol. */
4156	}
4157      /* FALL THRU into number case.  */
4158
4159    case '0':
4160    case '1':
4161    case '2':
4162    case '3':
4163    case '4':
4164    case '5':
4165    case '6':
4166    case '7':
4167    case '8':
4168    case '9':
4169      {
4170	/* It's a number.  */
4171	int got_dot = 0, got_e = 0, toktype;
4172	char *p = tokstart;
4173	int hex = input_radix > 10;
4174
4175	if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
4176	  {
4177	    p += 2;
4178	    hex = 1;
4179	  }
4180	else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
4181	  {
4182	    p += 2;
4183	    hex = 0;
4184	  }
4185
4186	for (;; ++p)
4187	  {
4188	    /* This test includes !hex because 'e' is a valid hex digit
4189	       and thus does not indicate a floating point number when
4190	       the radix is hex.  */
4191	    if (!hex && !got_e && (*p == 'e' || *p == 'E'))
4192	      got_dot = got_e = 1;
4193	    /* This test does not include !hex, because a '.' always indicates
4194	       a decimal floating point number regardless of the radix.  */
4195	    else if (!got_dot && *p == '.')
4196	      got_dot = 1;
4197	    else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
4198		     && (*p == '-' || *p == '+'))
4199	      /* This is the sign of the exponent, not the end of the
4200		 number.  */
4201	      continue;
4202	    /* We will take any letters or digits.  parse_number will
4203	       complain if past the radix, or if L or U are not final.  */
4204	    else if ((*p < '0' || *p > '9')
4205		     && ((*p < 'a' || *p > 'z')
4206				  && (*p < 'A' || *p > 'Z')))
4207	      break;
4208	  }
4209	toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
4210        if (toktype == ERROR)
4211	  {
4212	    char *err_copy = (char *) alloca (p - tokstart + 1);
4213
4214	    memcpy (err_copy, tokstart, p - tokstart);
4215	    err_copy[p - tokstart] = 0;
4216	    error (_("Invalid number \"%s\"."), err_copy);
4217	  }
4218	lexptr = p;
4219	return toktype;
4220      }
4221
4222    case '+':
4223    case '-':
4224    case '*':
4225    case '/':
4226    case '%':
4227    case '|':
4228    case '&':
4229    case '^':
4230    case '~':
4231    case '!':
4232    case '@':
4233    case '<':
4234    case '>':
4235    case '?':
4236    case ':':
4237    case '=':
4238    case '{':
4239    case '}':
4240    symbol:
4241      lexptr++;
4242      return c;
4243
4244    case 'L':
4245    case 'u':
4246    case 'U':
4247      if (tokstart[1] != '"' && tokstart[1] != '\'')
4248	break;
4249      /* Fall through.  */
4250    case '\'':
4251    case '"':
4252      {
4253	int host_len;
4254	int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
4255					   &host_len);
4256	if (result == CHAR)
4257	  {
4258	    if (host_len == 0)
4259	      error (_("Empty character constant."));
4260	    else if (host_len > 2 && c == '\'')
4261	      {
4262		++tokstart;
4263		namelen = lexptr - tokstart - 1;
4264		goto tryname;
4265	      }
4266	    else if (host_len > 1)
4267	      error (_("Invalid character constant."));
4268	  }
4269	return result;
4270      }
4271    }
4272
4273  if (!(c == '_' || c == '$'
4274	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
4275    /* We must have come across a bad character (e.g. ';').  */
4276    error (_("Invalid character '%c' in expression."), c);
4277
4278  /* It's a name.  See how long it is.  */
4279  namelen = 0;
4280  for (c = tokstart[namelen];
4281       (c == '_' || c == '$' || (c >= '0' && c <= '9')
4282	|| (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
4283    {
4284      /* Template parameter lists are part of the name.
4285	 FIXME: This mishandles `print $a<4&&$a>3'.  */
4286
4287      if (c == '<')
4288	{
4289	  if (! is_cast_operator (tokstart, namelen))
4290	    {
4291	      /* Scan ahead to get rest of the template specification.  Note
4292		 that we look ahead only when the '<' adjoins non-whitespace
4293		 characters; for comparison expressions, e.g. "a < b > c",
4294		 there must be spaces before the '<', etc. */
4295
4296	      char * p = find_template_name_end (tokstart + namelen);
4297	      if (p)
4298		namelen = p - tokstart;
4299	    }
4300	  break;
4301	}
4302      c = tokstart[++namelen];
4303    }
4304
4305  /* The token "if" terminates the expression and is NOT removed from
4306     the input stream.  It doesn't count if it appears in the
4307     expansion of a macro.  */
4308  if (namelen == 2
4309      && tokstart[0] == 'i'
4310      && tokstart[1] == 'f'
4311      && ! scanning_macro_expansion ())
4312    {
4313      return 0;
4314    }
4315
4316  /* For the same reason (breakpoint conditions), "thread N"
4317     terminates the expression.  "thread" could be an identifier, but
4318     an identifier is never followed by a number without intervening
4319     punctuation.  "task" is similar.  Handle abbreviations of these,
4320     similarly to breakpoint.c:find_condition_and_thread.  */
4321  if (namelen >= 1
4322      && (strncmp (tokstart, "thread", namelen) == 0
4323	  || strncmp (tokstart, "task", namelen) == 0)
4324      && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t')
4325      && ! scanning_macro_expansion ())
4326    {
4327      char *p = tokstart + namelen + 1;
4328      while (*p == ' ' || *p == '\t')
4329	p++;
4330      if (*p >= '0' && *p <= '9')
4331	return 0;
4332    }
4333
4334  lexptr += namelen;
4335
4336  tryname:
4337
4338  yylval.sval.ptr = tokstart;
4339  yylval.sval.length = namelen;
4340
4341  /* Catch specific keywords.  */
4342  copy = copy_name (yylval.sval);
4343  for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
4344    if (strcmp (copy, ident_tokens[i].operator) == 0)
4345      {
4346	if (ident_tokens[i].cxx_only
4347	    && parse_language->la_language != language_cplus)
4348	  break;
4349
4350	/* It is ok to always set this, even though we don't always
4351	   strictly need to.  */
4352	yylval.opcode = ident_tokens[i].opcode;
4353	return ident_tokens[i].token;
4354      }
4355
4356  if (*tokstart == '$')
4357    return VARIABLE;
4358
4359  if (in_parse_field && *lexptr == '\0')
4360    saw_name_at_eof = 1;
4361  return NAME;
4362}
4363
4364/* An object of this type is pushed on a FIFO by the "outer" lexer.  */
4365typedef struct
4366{
4367  int token;
4368  YYSTYPE value;
4369} token_and_value;
4370
4371DEF_VEC_O (token_and_value);
4372
4373/* A FIFO of tokens that have been read but not yet returned to the
4374   parser.  */
4375static VEC (token_and_value) *token_fifo;
4376
4377/* Non-zero if the lexer should return tokens from the FIFO.  */
4378static int popping;
4379
4380/* Temporary storage for c_lex; this holds symbol names as they are
4381   built up.  */
4382static struct obstack name_obstack;
4383
4384/* Classify a NAME token.  The contents of the token are in `yylval'.
4385   Updates yylval and returns the new token type.  BLOCK is the block
4386   in which lookups start; this can be NULL to mean the global
4387   scope.  */
4388static int
4389classify_name (struct block *block)
4390{
4391  struct symbol *sym;
4392  char *copy;
4393  int is_a_field_of_this = 0;
4394
4395  copy = copy_name (yylval.sval);
4396
4397  sym = lookup_symbol (copy, block, VAR_DOMAIN,
4398		       parse_language->la_language == language_cplus
4399		       ? &is_a_field_of_this : (int *) NULL);
4400
4401  if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
4402    {
4403      yylval.ssym.sym = sym;
4404      yylval.ssym.is_a_field_of_this = is_a_field_of_this;
4405      return BLOCKNAME;
4406    }
4407  else if (!sym)
4408    {
4409      /* See if it's a file name. */
4410      struct symtab *symtab;
4411
4412      symtab = lookup_symtab (copy);
4413      if (symtab)
4414	{
4415	  yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
4416	  return FILENAME;
4417	}
4418    }
4419
4420  if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
4421    {
4422      yylval.tsym.type = SYMBOL_TYPE (sym);
4423      return TYPENAME;
4424    }
4425
4426  yylval.tsym.type
4427    = language_lookup_primitive_type_by_name (parse_language,
4428					      parse_gdbarch, copy);
4429  if (yylval.tsym.type != NULL)
4430    return TYPENAME;
4431
4432  /* Input names that aren't symbols but ARE valid hex numbers, when
4433     the input radix permits them, can be names or numbers depending
4434     on the parse.  Note we support radixes > 16 here.  */
4435  if (!sym
4436      && ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
4437	  || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10)))
4438    {
4439      YYSTYPE newlval;	/* Its value is ignored.  */
4440      int hextype = parse_number (copy, yylval.sval.length, 0, &newlval);
4441      if (hextype == INT)
4442	{
4443	  yylval.ssym.sym = sym;
4444	  yylval.ssym.is_a_field_of_this = is_a_field_of_this;
4445	  return NAME_OR_INT;
4446	}
4447    }
4448
4449  /* Any other kind of symbol */
4450  yylval.ssym.sym = sym;
4451  yylval.ssym.is_a_field_of_this = is_a_field_of_this;
4452
4453  if (sym == NULL
4454      && parse_language->la_language == language_cplus
4455      && !is_a_field_of_this
4456      && !lookup_minimal_symbol (copy, NULL, NULL))
4457    return UNKNOWN_CPP_NAME;
4458
4459  return NAME;
4460}
4461
4462/* Like classify_name, but used by the inner loop of the lexer, when a
4463   name might have already been seen.  FIRST_NAME is true if the token
4464   in `yylval' is the first component of a name, false otherwise.  If
4465   this function returns NAME, it might not have updated `yylval'.
4466   This is ok because the caller only cares about TYPENAME.  */
4467static int
4468classify_inner_name (struct block *block, int first_name)
4469{
4470  struct type *type, *new_type;
4471  char *copy;
4472
4473  if (first_name)
4474    return classify_name (block);
4475
4476  type = check_typedef (yylval.tsym.type);
4477  if (TYPE_CODE (type) != TYPE_CODE_STRUCT
4478      && TYPE_CODE (type) != TYPE_CODE_UNION
4479      && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
4480    /* We know the caller won't expect us to update yylval.  */
4481    return NAME;
4482
4483  copy = copy_name (yylval.tsym.stoken);
4484  new_type = cp_lookup_nested_type (type, copy, block);
4485
4486  if (new_type == NULL)
4487    /* We know the caller won't expect us to update yylval.  */
4488    return NAME;
4489
4490  yylval.tsym.type = new_type;
4491  return TYPENAME;
4492}
4493
4494/* The outer level of a two-level lexer.  This calls the inner lexer
4495   to return tokens.  It then either returns these tokens, or
4496   aggregates them into a larger token.  This lets us work around a
4497   problem in our parsing approach, where the parser could not
4498   distinguish between qualified names and qualified types at the
4499   right point.
4500
4501   This approach is still not ideal, because it mishandles template
4502   types.  See the comment in lex_one_token for an example.  However,
4503   this is still an improvement over the earlier approach, and will
4504   suffice until we move to better parsing technology.  */
4505static int
4506yylex (void)
4507{
4508  token_and_value current;
4509  int first_was_coloncolon, last_was_coloncolon, first_iter;
4510
4511  if (popping && !VEC_empty (token_and_value, token_fifo))
4512    {
4513      token_and_value tv = *VEC_index (token_and_value, token_fifo, 0);
4514      VEC_ordered_remove (token_and_value, token_fifo, 0);
4515      yylval = tv.value;
4516      return tv.token;
4517    }
4518  popping = 0;
4519
4520  current.token = lex_one_token ();
4521  if (current.token == NAME)
4522    current.token = classify_name (expression_context_block);
4523  if (parse_language->la_language != language_cplus
4524      || (current.token != TYPENAME && current.token != COLONCOLON))
4525    return current.token;
4526
4527  first_was_coloncolon = current.token == COLONCOLON;
4528  last_was_coloncolon = first_was_coloncolon;
4529  obstack_free (&name_obstack, obstack_base (&name_obstack));
4530  if (!last_was_coloncolon)
4531    obstack_grow (&name_obstack, yylval.sval.ptr, yylval.sval.length);
4532  current.value = yylval;
4533  first_iter = 1;
4534  while (1)
4535    {
4536      token_and_value next;
4537
4538      next.token = lex_one_token ();
4539      next.value = yylval;
4540
4541      if (next.token == NAME && last_was_coloncolon)
4542	{
4543	  int classification;
4544
4545	  classification = classify_inner_name (first_was_coloncolon
4546						? NULL
4547						: expression_context_block,
4548						first_iter);
4549	  /* We keep going until we either run out of names, or until
4550	     we have a qualified name which is not a type.  */
4551	  if (classification != TYPENAME)
4552	    {
4553	      /* Push the final component and leave the loop.  */
4554	      VEC_safe_push (token_and_value, token_fifo, &next);
4555	      break;
4556	    }
4557
4558	  /* Update the partial name we are constructing.  */
4559	  if (!first_iter)
4560	    {
4561	      /* We don't want to put a leading "::" into the name.  */
4562	      obstack_grow_str (&name_obstack, "::");
4563	    }
4564	  obstack_grow (&name_obstack, next.value.sval.ptr,
4565			next.value.sval.length);
4566
4567	  yylval.sval.ptr = obstack_base (&name_obstack);
4568	  yylval.sval.length = obstack_object_size (&name_obstack);
4569	  current.value = yylval;
4570	  current.token = classification;
4571
4572	  last_was_coloncolon = 0;
4573	}
4574      else if (next.token == COLONCOLON && !last_was_coloncolon)
4575	last_was_coloncolon = 1;
4576      else
4577	{
4578	  /* We've reached the end of the name.  */
4579	  VEC_safe_push (token_and_value, token_fifo, &next);
4580	  break;
4581	}
4582
4583      first_iter = 0;
4584    }
4585
4586  popping = 1;
4587
4588  /* If we ended with a "::", insert it too.  */
4589  if (last_was_coloncolon)
4590    {
4591      token_and_value cc;
4592      memset (&cc, 0, sizeof (token_and_value));
4593      if (first_was_coloncolon && first_iter)
4594	{
4595	  yylval = cc.value;
4596	  return COLONCOLON;
4597	}
4598      cc.token = COLONCOLON;
4599      VEC_safe_insert (token_and_value, token_fifo, 0, &cc);
4600    }
4601
4602  yylval = current.value;
4603  yylval.sval.ptr = obstack_copy0 (&expansion_obstack,
4604				   yylval.sval.ptr,
4605				   yylval.sval.length);
4606  return current.token;
4607}
4608
4609int
4610c_parse (void)
4611{
4612  int result;
4613  struct cleanup *back_to = make_cleanup (free_current_contents,
4614					  &expression_macro_scope);
4615
4616  /* Set up the scope for macro expansion.  */
4617  expression_macro_scope = NULL;
4618
4619  if (expression_context_block)
4620    expression_macro_scope
4621      = sal_macro_scope (find_pc_line (expression_context_pc, 0));
4622  else
4623    expression_macro_scope = default_macro_scope ();
4624  if (! expression_macro_scope)
4625    expression_macro_scope = user_macro_scope ();
4626
4627  /* Initialize macro expansion code.  */
4628  obstack_init (&expansion_obstack);
4629  gdb_assert (! macro_original_text);
4630  make_cleanup (scan_macro_cleanup, 0);
4631
4632  make_cleanup_restore_integer (&yydebug);
4633  yydebug = parser_debug;
4634
4635  /* Initialize some state used by the lexer.  */
4636  last_was_structop = 0;
4637  saw_name_at_eof = 0;
4638
4639  VEC_free (token_and_value, token_fifo);
4640  popping = 0;
4641  obstack_init (&name_obstack);
4642  make_cleanup_obstack_free (&name_obstack);
4643
4644  result = yyparse ();
4645  do_cleanups (back_to);
4646  return result;
4647}
4648
4649
4650void
4651yyerror (char *msg)
4652{
4653  if (prev_lexptr)
4654    lexptr = prev_lexptr;
4655
4656  error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);
4657}
4658
4659
4660