]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/gdb/gdb/c-exp.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / gdb / gdb / c-exp.c
1 /* A Bison parser, made by GNU Bison 1.875.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 /* As a special exception, when this file is copied by Bison into a
22    Bison output file, you may use that output file without restriction.
23    This special exception was added by the Free Software Foundation
24    in version 1.24 of Bison.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
29 /* All symbols defined below should begin with yy or YY, to avoid
30    infringing on user name space.  This should be done even for local
31    variables, as they might otherwise be expanded by user macros.
32    There are some unavoidable exceptions within include files to
33    define necessary library symbols; they are noted "INFRINGES ON
34    USER NAME SPACE" below.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Skeleton name.  */
40 #define YYSKELETON_NAME "yacc.c"
41
42 /* Pure parsers.  */
43 #define YYPURE 0
44
45 /* Using locations.  */
46 #define YYLSP_NEEDED 0
47
48
49
50 /* Tokens.  */
51 #ifndef YYTOKENTYPE
52 # define YYTOKENTYPE
53    /* Put the tokens into the symbol table, so that GDB and other debuggers
54       know about them.  */
55    enum yytokentype {
56      INT = 258,
57      FLOAT = 259,
58      STRING = 260,
59      NAME = 261,
60      TYPENAME = 262,
61      NAME_OR_INT = 263,
62      STRUCT = 264,
63      CLASS = 265,
64      UNION = 266,
65      ENUM = 267,
66      SIZEOF = 268,
67      UNSIGNED = 269,
68      COLONCOLON = 270,
69      TEMPLATE = 271,
70      ERROR = 272,
71      SIGNED_KEYWORD = 273,
72      LONG = 274,
73      SHORT = 275,
74      INT_KEYWORD = 276,
75      CONST_KEYWORD = 277,
76      VOLATILE_KEYWORD = 278,
77      DOUBLE_KEYWORD = 279,
78      VARIABLE = 280,
79      ASSIGN_MODIFY = 281,
80      TRUEKEYWORD = 282,
81      FALSEKEYWORD = 283,
82      ABOVE_COMMA = 284,
83      OROR = 285,
84      ANDAND = 286,
85      NOTEQUAL = 287,
86      EQUAL = 288,
87      GEQ = 289,
88      LEQ = 290,
89      RSH = 291,
90      LSH = 292,
91      DECREMENT = 293,
92      INCREMENT = 294,
93      UNARY = 295,
94      ARROW = 296,
95      BLOCKNAME = 297,
96      FILENAME = 298
97    };
98 #endif
99 #define INT 258
100 #define FLOAT 259
101 #define STRING 260
102 #define NAME 261
103 #define TYPENAME 262
104 #define NAME_OR_INT 263
105 #define STRUCT 264
106 #define CLASS 265
107 #define UNION 266
108 #define ENUM 267
109 #define SIZEOF 268
110 #define UNSIGNED 269
111 #define COLONCOLON 270
112 #define TEMPLATE 271
113 #define ERROR 272
114 #define SIGNED_KEYWORD 273
115 #define LONG 274
116 #define SHORT 275
117 #define INT_KEYWORD 276
118 #define CONST_KEYWORD 277
119 #define VOLATILE_KEYWORD 278
120 #define DOUBLE_KEYWORD 279
121 #define VARIABLE 280
122 #define ASSIGN_MODIFY 281
123 #define TRUEKEYWORD 282
124 #define FALSEKEYWORD 283
125 #define ABOVE_COMMA 284
126 #define OROR 285
127 #define ANDAND 286
128 #define NOTEQUAL 287
129 #define EQUAL 288
130 #define GEQ 289
131 #define LEQ 290
132 #define RSH 291
133 #define LSH 292
134 #define DECREMENT 293
135 #define INCREMENT 294
136 #define UNARY 295
137 #define ARROW 296
138 #define BLOCKNAME 297
139 #define FILENAME 298
140
141
142
143
144 /* Copy the first part of user declarations.  */
145 #line 39 "c-exp.y"
146
147
148 #include "defs.h"
149 #include "gdb_string.h"
150 #include <ctype.h>
151 #include "expression.h"
152 #include "value.h"
153 #include "parser-defs.h"
154 #include "language.h"
155 #include "c-lang.h"
156 #include "bfd.h" /* Required by objfiles.h.  */
157 #include "symfile.h" /* Required by objfiles.h.  */
158 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
159 #include "charset.h"
160 #include "block.h"
161 #include "cp-support.h"
162
163 /* Flag indicating we're dealing with HP-compiled objects */ 
164 extern int hp_som_som_object_present;
165
166 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
167    as well as gratuitiously global symbol names, so we can have multiple
168    yacc generated parsers in gdb.  Note that these are only the variables
169    produced by yacc.  If other parser generators (bison, byacc, etc) produce
170    additional global names that conflict at link time, then those parser
171    generators need to be fixed instead of adding those names to this list. */
172
173 #define yymaxdepth c_maxdepth
174 #define yyparse c_parse
175 #define yylex   c_lex
176 #define yyerror c_error
177 #define yylval  c_lval
178 #define yychar  c_char
179 #define yydebug c_debug
180 #define yypact  c_pact  
181 #define yyr1    c_r1                    
182 #define yyr2    c_r2                    
183 #define yydef   c_def           
184 #define yychk   c_chk           
185 #define yypgo   c_pgo           
186 #define yyact   c_act           
187 #define yyexca  c_exca
188 #define yyerrflag c_errflag
189 #define yynerrs c_nerrs
190 #define yyps    c_ps
191 #define yypv    c_pv
192 #define yys     c_s
193 #define yy_yys  c_yys
194 #define yystate c_state
195 #define yytmp   c_tmp
196 #define yyv     c_v
197 #define yy_yyv  c_yyv
198 #define yyval   c_val
199 #define yylloc  c_lloc
200 #define yyreds  c_reds          /* With YYDEBUG defined */
201 #define yytoks  c_toks          /* With YYDEBUG defined */
202 #define yyname  c_name          /* With YYDEBUG defined */
203 #define yyrule  c_rule          /* With YYDEBUG defined */
204 #define yylhs   c_yylhs
205 #define yylen   c_yylen
206 #define yydefred c_yydefred
207 #define yydgoto c_yydgoto
208 #define yysindex c_yysindex
209 #define yyrindex c_yyrindex
210 #define yygindex c_yygindex
211 #define yytable  c_yytable
212 #define yycheck  c_yycheck
213
214 #ifndef YYDEBUG
215 #define YYDEBUG 1               /* Default to yydebug support */
216 #endif
217
218 #define YYFPRINTF parser_fprintf
219
220 int yyparse (void);
221
222 static int yylex (void);
223
224 void yyerror (char *);
225
226
227
228 /* Enabling traces.  */
229 #ifndef YYDEBUG
230 # define YYDEBUG 0
231 #endif
232
233 /* Enabling verbose error messages.  */
234 #ifdef YYERROR_VERBOSE
235 # undef YYERROR_VERBOSE
236 # define YYERROR_VERBOSE 1
237 #else
238 # define YYERROR_VERBOSE 0
239 #endif
240
241 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
242 #line 126 "c-exp.y"
243 typedef union YYSTYPE {
244     LONGEST lval;
245     struct {
246       LONGEST val;
247       struct type *type;
248     } typed_val_int;
249     struct {
250       DOUBLEST dval;
251       struct type *type;
252     } typed_val_float;
253     struct symbol *sym;
254     struct type *tval;
255     struct stoken sval;
256     struct ttype tsym;
257     struct symtoken ssym;
258     int voidval;
259     struct block *bval;
260     enum exp_opcode opcode;
261     struct internalvar *ivar;
262
263     struct type **tvec;
264     int *ivec;
265   } YYSTYPE;
266 /* Line 191 of yacc.c.  */
267 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
268 # define YYSTYPE_IS_DECLARED 1
269 # define YYSTYPE_IS_TRIVIAL 1
270 #endif
271
272
273
274 /* Copy the second part of user declarations.  */
275 #line 150 "c-exp.y"
276
277 /* YYSTYPE gets defined by %union */
278 static int parse_number (char *, int, int, YYSTYPE *);
279
280
281 /* Line 214 of yacc.c.  */
282
283 #if ! defined (yyoverflow) || YYERROR_VERBOSE
284
285 /* The parser invokes alloca or xmalloc; define the necessary symbols.  */
286
287 # if YYSTACK_USE_ALLOCA
288 #  define YYSTACK_ALLOC alloca
289 # else
290 #  ifndef YYSTACK_USE_ALLOCA
291 #   if defined (alloca) || defined (_ALLOCA_H)
292 #    define YYSTACK_ALLOC alloca
293 #   else
294 #    ifdef __GNUC__
295 #     define YYSTACK_ALLOC __builtin_alloca
296 #    endif
297 #   endif
298 #  endif
299 # endif
300
301 # ifdef YYSTACK_ALLOC
302    /* Pacify GCC's `empty if-body' warning. */
303 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
304 # else
305 #  if defined (__STDC__) || defined (__cplusplus)
306 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
307 #   define YYSIZE_T size_t
308 #  endif
309 #  define YYSTACK_ALLOC xmalloc
310 #  define YYSTACK_FREE free
311 # endif
312 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
313
314
315 #if (! defined (yyoverflow) \
316      && (! defined (__cplusplus) \
317          || (YYSTYPE_IS_TRIVIAL)))
318
319 /* A type that is properly aligned for any stack member.  */
320 union yyalloc
321 {
322   short yyss;
323   YYSTYPE yyvs;
324   };
325
326 /* The size of the maximum gap between one aligned stack and the next.  */
327 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
328
329 /* The size of an array large to enough to hold all stacks, each with
330    N elements.  */
331 # define YYSTACK_BYTES(N) \
332      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
333       + YYSTACK_GAP_MAXIMUM)
334
335 /* Copy COUNT objects from FROM to TO.  The source and destination do
336    not overlap.  */
337 # ifndef YYCOPY
338 #  if 1 < __GNUC__
339 #   define YYCOPY(To, From, Count) \
340       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
341 #  else
342 #   define YYCOPY(To, From, Count)              \
343       do                                        \
344         {                                       \
345           register YYSIZE_T yyi;                \
346           for (yyi = 0; yyi < (Count); yyi++)   \
347             (To)[yyi] = (From)[yyi];            \
348         }                                       \
349       while (0)
350 #  endif
351 # endif
352
353 /* Relocate STACK from its old location to the new one.  The
354    local variables YYSIZE and YYSTACKSIZE give the old and new number of
355    elements in the stack, and YYPTR gives the new location of the
356    stack.  Advance YYPTR to a properly aligned location for the next
357    stack.  */
358 # define YYSTACK_RELOCATE(Stack)                                        \
359     do                                                                  \
360       {                                                                 \
361         YYSIZE_T yynewbytes;                                            \
362         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
363         Stack = &yyptr->Stack;                                          \
364         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
365         yyptr += yynewbytes / sizeof (*yyptr);                          \
366       }                                                                 \
367     while (0)
368
369 #endif
370
371 #if defined (__STDC__) || defined (__cplusplus)
372    typedef signed char yysigned_char;
373 #else
374    typedef short yysigned_char;
375 #endif
376
377 /* YYFINAL -- State number of the termination state. */
378 #define YYFINAL  94
379 /* YYLAST -- Last index in YYTABLE.  */
380 #define YYLAST   804
381
382 /* YYNTOKENS -- Number of terminals. */
383 #define YYNTOKENS  68
384 /* YYNNTS -- Number of nonterminals. */
385 #define YYNNTS  31
386 /* YYNRULES -- Number of rules. */
387 #define YYNRULES  159
388 /* YYNRULES -- Number of states. */
389 #define YYNSTATES  242
390
391 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
392 #define YYUNDEFTOK  2
393 #define YYMAXUTOK   298
394
395 #define YYTRANSLATE(YYX)                                                \
396   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
397
398 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
399 static const unsigned char yytranslate[] =
400 {
401        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
402        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
403        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
404        2,     2,     2,    61,     2,     2,     2,    51,    37,     2,
405       57,    64,    49,    47,    29,    48,    55,    50,     2,     2,
406        2,     2,     2,     2,     2,     2,     2,     2,    67,     2,
407       40,    31,    41,    32,    46,     2,     2,     2,     2,     2,
408        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
410        2,    56,     2,    63,    36,     2,     2,     2,     2,     2,
411        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
412        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
413        2,     2,     2,    65,    35,    66,    62,     2,     2,     2,
414        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
415        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
416        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
417        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
418        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
419        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
420        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
421        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
422        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
423        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
424        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
425        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
426        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
427        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
428       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
429       25,    26,    27,    28,    30,    33,    34,    38,    39,    42,
430       43,    44,    45,    52,    53,    54,    58,    59,    60
431 };
432
433 #if YYDEBUG
434 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
435    YYRHS.  */
436 static const unsigned short yyprhs[] =
437 {
438        0,     0,     3,     5,     7,     9,    11,    15,    18,    21,
439       24,    27,    30,    33,    36,    39,    42,    45,    49,    53,
440       58,    62,    66,    71,    76,    77,    83,    85,    86,    88,
441       92,    94,    98,   103,   108,   112,   116,   120,   124,   128,
442      132,   136,   140,   144,   148,   152,   156,   160,   164,   168,
443      172,   176,   180,   184,   188,   194,   198,   202,   204,   206,
444      208,   210,   212,   217,   219,   221,   223,   225,   227,   231,
445      235,   239,   244,   246,   249,   251,   254,   256,   257,   261,
446      263,   265,   267,   268,   270,   273,   275,   278,   280,   284,
447      287,   289,   292,   294,   297,   301,   304,   308,   310,   314,
448      316,   318,   320,   322,   325,   329,   332,   336,   340,   344,
449      347,   350,   354,   359,   363,   367,   372,   376,   381,   385,
450      390,   393,   397,   400,   404,   407,   411,   413,   416,   419,
451      422,   425,   428,   431,   433,   436,   438,   444,   447,   450,
452      452,   456,   458,   460,   462,   464,   466,   470,   472,   477,
453      480,   483,   485,   487,   489,   491,   493,   495,   497,   499
454 };
455
456 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
457 static const yysigned_char yyrhs[] =
458 {
459       69,     0,    -1,    71,    -1,    70,    -1,    89,    -1,    72,
460       -1,    71,    29,    72,    -1,    49,    72,    -1,    37,    72,
461       -1,    48,    72,    -1,    61,    72,    -1,    62,    72,    -1,
462       53,    72,    -1,    52,    72,    -1,    72,    53,    -1,    72,
463       52,    -1,    13,    72,    -1,    72,    58,    97,    -1,    72,
464       58,    79,    -1,    72,    58,    49,    72,    -1,    72,    55,
465       97,    -1,    72,    55,    79,    -1,    72,    55,    49,    72,
466       -1,    72,    56,    71,    63,    -1,    -1,    72,    57,    73,
467       75,    64,    -1,    65,    -1,    -1,    72,    -1,    75,    29,
468       72,    -1,    66,    -1,    74,    75,    76,    -1,    74,    89,
469       76,    72,    -1,    57,    89,    64,    72,    -1,    57,    71,
470       64,    -1,    72,    46,    72,    -1,    72,    49,    72,    -1,
471       72,    50,    72,    -1,    72,    51,    72,    -1,    72,    47,
472       72,    -1,    72,    48,    72,    -1,    72,    45,    72,    -1,
473       72,    44,    72,    -1,    72,    39,    72,    -1,    72,    38,
474       72,    -1,    72,    43,    72,    -1,    72,    42,    72,    -1,
475       72,    40,    72,    -1,    72,    41,    72,    -1,    72,    37,
476       72,    -1,    72,    36,    72,    -1,    72,    35,    72,    -1,
477       72,    34,    72,    -1,    72,    33,    72,    -1,    72,    32,
478       72,    67,    72,    -1,    72,    31,    72,    -1,    72,    26,
479       72,    -1,     3,    -1,     8,    -1,     4,    -1,    78,    -1,
480       25,    -1,    13,    57,    89,    64,    -1,     5,    -1,    27,
481       -1,    28,    -1,    59,    -1,    60,    -1,    77,    15,    97,
482       -1,    77,    15,    97,    -1,    90,    15,    97,    -1,    90,
483       15,    62,    97,    -1,    79,    -1,    15,    97,    -1,    98,
484       -1,    46,     6,    -1,    96,    -1,    -1,    81,    80,    81,
485       -1,    82,    -1,    96,    -1,    83,    -1,    -1,    49,    -1,
486       49,    85,    -1,    37,    -1,    37,    85,    -1,    86,    -1,
487       57,    85,    64,    -1,    86,    87,    -1,    87,    -1,    86,
488       88,    -1,    88,    -1,    56,    63,    -1,    56,     3,    63,
489       -1,    57,    64,    -1,    57,    93,    64,    -1,    94,    -1,
490       90,    15,    49,    -1,     7,    -1,    21,    -1,    19,    -1,
491       20,    -1,    19,    21,    -1,    19,    18,    21,    -1,    19,
492       18,    -1,    18,    19,    21,    -1,    14,    19,    21,    -1,
493       19,    14,    21,    -1,    19,    14,    -1,    19,    19,    -1,
494       19,    19,    21,    -1,    19,    19,    18,    21,    -1,    19,
495       19,    18,    -1,    18,    19,    19,    -1,    18,    19,    19,
496       21,    -1,    14,    19,    19,    -1,    14,    19,    19,    21,
497       -1,    19,    19,    14,    -1,    19,    19,    14,    21,    -1,
498       20,    21,    -1,    20,    18,    21,    -1,    20,    18,    -1,
499       14,    20,    21,    -1,    20,    14,    -1,    20,    14,    21,
500       -1,    24,    -1,    19,    24,    -1,     9,    97,    -1,    10,
501       97,    -1,    11,    97,    -1,    12,    97,    -1,    14,    92,
502       -1,    14,    -1,    18,    92,    -1,    18,    -1,    16,    97,
503       40,    89,    41,    -1,    83,    90,    -1,    90,    83,    -1,
504       91,    -1,    90,    15,    97,    -1,     7,    -1,    21,    -1,
505       19,    -1,    20,    -1,    89,    -1,    93,    29,    89,    -1,
506       90,    -1,    94,    84,    85,    84,    -1,    22,    23,    -1,
507       23,    22,    -1,    95,    -1,    22,    -1,    23,    -1,     6,
508       -1,    59,    -1,     7,    -1,     8,    -1,     6,    -1,    59,
509       -1
510 };
511
512 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
513 static const unsigned short yyrline[] =
514 {
515        0,   233,   233,   234,   237,   244,   245,   250,   254,   258,
516      262,   266,   270,   274,   278,   282,   286,   290,   296,   304,
517      308,   314,   322,   326,   333,   330,   340,   344,   347,   351,
518      355,   358,   365,   371,   377,   383,   387,   391,   395,   399,
519      403,   407,   411,   415,   419,   423,   427,   431,   435,   439,
520      443,   447,   451,   455,   459,   463,   467,   473,   480,   491,
521      498,   501,   505,   513,   538,   545,   554,   562,   568,   579,
522      595,   609,   634,   635,   669,   726,   732,   733,   736,   739,
523      740,   744,   745,   748,   750,   752,   754,   756,   759,   761,
524      766,   773,   775,   779,   781,   785,   787,   799,   800,   805,
525      807,   809,   811,   813,   815,   817,   819,   821,   823,   825,
526      827,   829,   831,   833,   835,   837,   839,   841,   843,   845,
527      847,   849,   851,   853,   855,   857,   859,   861,   863,   866,
528      869,   872,   875,   877,   879,   881,   886,   890,   892,   894,
529      942,   967,   968,   974,   980,   989,   994,  1001,  1002,  1006,
530     1007,  1010,  1014,  1016,  1020,  1021,  1022,  1023,  1026,  1027
531 };
532 #endif
533
534 #if YYDEBUG || YYERROR_VERBOSE
535 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
536    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
537 static const char *const yytname[] =
538 {
539   "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NAME", 
540   "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "UNION", "ENUM", "SIZEOF", 
541   "UNSIGNED", "COLONCOLON", "TEMPLATE", "ERROR", "SIGNED_KEYWORD", "LONG", 
542   "SHORT", "INT_KEYWORD", "CONST_KEYWORD", "VOLATILE_KEYWORD", 
543   "DOUBLE_KEYWORD", "VARIABLE", "ASSIGN_MODIFY", "TRUEKEYWORD", 
544   "FALSEKEYWORD", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND", 
545   "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ", 
546   "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT", 
547   "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "BLOCKNAME", 
548   "FILENAME", "'!'", "'~'", "']'", "')'", "'{'", "'}'", "':'", "$accept", 
549   "start", "type_exp", "exp1", "exp", "@1", "lcurly", "arglist", "rcurly", 
550   "block", "variable", "qualified_name", "space_identifier", 
551   "const_or_volatile", "cv_with_space_id", 
552   "const_or_volatile_or_space_identifier_noopt", 
553   "const_or_volatile_or_space_identifier", "abs_decl", "direct_abs_decl", 
554   "array_mod", "func_mod", "type", "typebase", "qualified_type", 
555   "typename", "nonempty_typelist", "ptype", "const_and_volatile", 
556   "const_or_volatile_noopt", "name", "name_not_typename", 0
557 };
558 #endif
559
560 # ifdef YYPRINT
561 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
562    token YYLEX-NUM.  */
563 static const unsigned short yytoknum[] =
564 {
565        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
566      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
567      275,   276,   277,   278,   279,   280,   281,   282,   283,    44,
568      284,    61,    63,   285,   286,   124,    94,    38,   287,   288,
569       60,    62,   289,   290,   291,   292,    64,    43,    45,    42,
570       47,    37,   293,   294,   295,    46,    91,    40,   296,   297,
571      298,    33,   126,    93,    41,   123,   125,    58
572 };
573 # endif
574
575 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
576 static const unsigned char yyr1[] =
577 {
578        0,    68,    69,    69,    70,    71,    71,    72,    72,    72,
579       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
580       72,    72,    72,    72,    73,    72,    74,    75,    75,    75,
581       76,    72,    72,    72,    72,    72,    72,    72,    72,    72,
582       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
583       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
584       72,    72,    72,    72,    72,    72,    77,    77,    77,    78,
585       79,    79,    78,    78,    78,    80,    81,    81,    82,    83,
586       83,    84,    84,    85,    85,    85,    85,    85,    86,    86,
587       86,    86,    86,    87,    87,    88,    88,    89,    89,    90,
588       90,    90,    90,    90,    90,    90,    90,    90,    90,    90,
589       90,    90,    90,    90,    90,    90,    90,    90,    90,    90,
590       90,    90,    90,    90,    90,    90,    90,    90,    90,    90,
591       90,    90,    90,    90,    90,    90,    90,    90,    90,    90,
592       91,    92,    92,    92,    92,    93,    93,    94,    94,    95,
593       95,    96,    96,    96,    97,    97,    97,    97,    98,    98
594 };
595
596 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
597 static const unsigned char yyr2[] =
598 {
599        0,     2,     1,     1,     1,     1,     3,     2,     2,     2,
600        2,     2,     2,     2,     2,     2,     2,     3,     3,     4,
601        3,     3,     4,     4,     0,     5,     1,     0,     1,     3,
602        1,     3,     4,     4,     3,     3,     3,     3,     3,     3,
603        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
604        3,     3,     3,     3,     5,     3,     3,     1,     1,     1,
605        1,     1,     4,     1,     1,     1,     1,     1,     3,     3,
606        3,     4,     1,     2,     1,     2,     1,     0,     3,     1,
607        1,     1,     0,     1,     2,     1,     2,     1,     3,     2,
608        1,     2,     1,     2,     3,     2,     3,     1,     3,     1,
609        1,     1,     1,     2,     3,     2,     3,     3,     3,     2,
610        2,     3,     4,     3,     3,     4,     3,     4,     3,     4,
611        2,     3,     2,     3,     2,     3,     1,     2,     2,     2,
612        2,     2,     2,     1,     2,     1,     5,     2,     2,     1,
613        3,     1,     1,     1,     1,     1,     3,     1,     4,     2,
614        2,     1,     1,     1,     1,     1,     1,     1,     1,     1
615 };
616
617 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
618    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
619    means the default is an error.  */
620 static const unsigned char yydefact[] =
621 {
622       77,    57,    59,    63,   158,    99,    58,     0,     0,     0,
623        0,    77,   133,     0,     0,   135,   101,   102,   100,   152,
624      153,   126,    61,    64,    65,    77,    77,    77,    77,    77,
625       77,   159,    67,    77,    77,    26,     0,     3,     2,     5,
626       27,     0,    60,    72,     0,    79,    77,     4,   147,   139,
627       97,   151,    80,    74,   154,   156,   157,   155,   128,   129,
628      130,   131,    77,    16,    77,   141,   143,   144,   142,   132,
629       73,     0,   143,   144,   134,   109,   105,   110,   103,   127,
630      124,   122,   120,   149,   150,     8,     9,     7,    13,    12,
631        0,     0,    10,    11,     1,    77,    77,    77,    77,    77,
632       77,    77,    77,    77,    77,    77,    77,    77,    77,    77,
633       77,    77,    77,    77,    77,    77,    77,    77,    15,    14,
634       77,    77,    24,    77,    28,     0,     0,     0,     0,    77,
635      137,     0,   138,    81,     0,     0,     0,   116,   107,   123,
636       77,   114,   106,   108,   104,   118,   113,   111,   125,   121,
637       34,    77,     6,    56,    55,     0,    53,    52,    51,    50,
638       49,    44,    43,    47,    48,    46,    45,    42,    41,    35,
639       39,    40,    36,    37,    38,   156,    77,    21,    20,     0,
640       27,    77,    18,    17,    77,    30,    31,    77,    69,    75,
641       78,    76,     0,    98,     0,    70,    85,    83,     0,    77,
642       82,    87,    90,    92,    62,   117,     0,   147,   115,   119,
643      112,    33,    77,    22,    23,     0,    19,    29,    32,   140,
644       71,    86,    84,     0,    93,    95,     0,   145,     0,   148,
645       77,    89,    91,   136,     0,    54,    25,    94,    88,    77,
646       96,   146
647 };
648
649 /* YYDEFGOTO[NTERM-NUM]. */
650 static const short yydefgoto[] =
651 {
652       -1,    36,    37,    90,    39,   180,    40,   125,   186,    41,
653       42,    43,   129,    44,    45,    46,   134,   200,   201,   202,
654      203,   227,    64,    49,    69,   228,    50,    51,    52,   195,
655       53
656 };
657
658 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
659    STATE-NUM.  */
660 #define YYPACT_NINF -101
661 static const short yypact[] =
662 {
663      320,  -101,  -101,  -101,  -101,  -101,  -101,    30,    30,    30,
664       30,   383,    45,    30,    30,   200,   152,    36,  -101,   -11,
665       17,  -101,  -101,  -101,  -101,   320,   320,   320,   320,   320,
666      320,    29,  -101,   320,   320,  -101,    84,  -101,    39,   597,
667      257,    56,  -101,  -101,    57,  -101,   172,  -101,    68,  -101,
668       55,  -101,    67,  -101,  -101,  -101,  -101,  -101,  -101,  -101,
669     -101,  -101,   320,   460,    87,  -101,    40,    95,  -101,  -101,
670     -101,    99,   190,  -101,  -101,   156,   159,   223,  -101,  -101,
671      164,   176,  -101,  -101,  -101,   460,   460,   460,   460,   460,
672      -15,   158,   460,   460,  -101,   320,   320,   320,   320,   320,
673      320,   320,   320,   320,   320,   320,   320,   320,   320,   320,
674      320,   320,   320,   320,   320,   320,   320,   320,  -101,  -101,
675      194,   320,  -101,   531,   597,   -19,   160,    30,   218,    -1,
676       71,    20,  -101,  -101,   -14,   171,    26,   215,  -101,  -101,
677      172,   217,  -101,  -101,  -101,   221,   224,  -101,  -101,  -101,
678     -101,   320,   597,   597,   597,   560,   622,   646,   669,   691,
679      712,   731,   731,   746,   746,   746,   746,   240,   240,   303,
680      366,   366,   460,   460,   460,    83,   320,  -101,  -101,   -18,
681      257,   320,  -101,  -101,   320,  -101,  -101,   320,   231,  -101,
682     -101,  -101,    30,  -101,    30,   210,   118,    63,     4,   472,
683        2,   112,  -101,  -101,   446,  -101,   206,    85,  -101,  -101,
684     -101,   460,   320,   460,  -101,   -13,   460,   597,   460,  -101,
685     -101,  -101,  -101,   185,  -101,  -101,   186,  -101,    -9,  -101,
686      114,  -101,  -101,  -101,    11,   526,  -101,  -101,  -101,   172,
687     -101,  -101
688 };
689
690 /* YYPGOTO[NTERM-NUM].  */
691 static const short yypgoto[] =
692 {
693     -101,  -101,  -101,     6,    47,  -101,  -101,    69,   126,  -101,
694     -101,   -67,  -101,   125,  -101,   -35,    58,  -100,  -101,    54,
695       73,     1,     0,  -101,   241,  -101,  -101,  -101,   128,    -5,
696     -101
697 };
698
699 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
700    positive, shift that token.  If negative, reduce the rule which
701    number is the opposite.  If zero, do what YYDEFACT says.
702    If YYTABLE_NINF, syntax error.  */
703 #define YYTABLE_NINF -141
704 static const short yytable[] =
705 {
706       48,    47,    58,    59,    60,    61,    38,   223,    70,    71,
707      184,    95,    83,   132,    95,   133,   184,    54,    55,    56,
708      239,    19,    20,   196,    19,    20,    54,    55,    56,   132,
709       48,    91,    54,    55,    56,   197,    54,    55,    56,    84,
710       48,   126,   198,   199,   -66,   214,   130,   185,   -77,   150,
711       80,   236,    65,   177,    81,   240,   182,    82,    63,   137,
712      193,   138,    48,   135,    66,    67,    68,   224,    95,   193,
713       57,   127,    85,    86,    87,    88,    89,    19,    20,    57,
714       92,    93,   194,   131,    94,    57,   192,   124,   194,    57,
715       19,    20,   -82,    19,    20,   132,   221,   222,   -99,   226,
716      234,   -77,   136,   128,   -82,   -99,   -99,    19,    20,    19,
717       20,   -82,   -82,   -76,   -77,   178,   139,   -77,   183,   198,
718      199,     5,   188,     7,     8,     9,    10,   179,    12,   -99,
719       14,   -77,    15,    16,    17,    18,    19,    20,    21,   140,
720      207,   206,   152,   153,   154,   155,   156,   157,   158,   159,
721      160,   161,   162,   163,   164,   165,   166,   167,   168,   169,
722      170,   171,   172,   173,   174,   133,    75,   197,   198,   230,
723       76,    77,   132,    78,   198,   199,    79,   143,   225,     5,
724      144,     7,     8,     9,    10,   148,    12,   219,    14,   220,
725       15,    16,    17,    18,    19,    20,    21,   149,   211,   207,
726       54,   175,    56,     7,     8,     9,    10,    65,    12,   141,
727       14,   142,    15,    16,    17,    18,    19,    20,    21,    72,
728       73,    68,   151,   213,   189,  -140,   185,   124,   216,   219,
729      207,   217,  -140,  -140,   218,   204,   205,   145,   208,   207,
730      241,   146,   209,   176,   147,   210,   -68,   233,   237,   215,
731      238,   211,   187,    57,   190,   231,    74,   191,   229,   235,
732        1,     2,     3,     4,     5,     6,     7,     8,     9,    10,
733       11,    12,    13,    14,   232,    15,    16,    17,    18,    19,
734       20,    21,    22,     0,    23,    24,   112,   113,   114,   115,
735      116,   117,   118,   119,    25,   120,   121,   122,   123,     0,
736        0,     0,     0,   -77,     0,    26,    27,     0,     0,    28,
737       29,     0,     0,     0,    30,     0,    31,    32,    33,    34,
738        0,     0,    35,     1,     2,     3,     4,     5,     6,     7,
739        8,     9,    10,    11,    12,    13,    14,     0,    15,    16,
740       17,    18,    19,    20,    21,    22,     0,    23,    24,     0,
741      113,   114,   115,   116,   117,   118,   119,    25,   120,   121,
742      122,   123,     0,     0,     0,     0,     0,     0,    26,    27,
743        0,     0,    28,    29,     0,     0,     0,    30,     0,    31,
744       32,    33,    34,     0,     0,    35,     1,     2,     3,     4,
745        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
746        0,    15,    16,    17,    18,    19,    20,    21,    22,     0,
747       23,    24,     0,     0,     0,   115,   116,   117,   118,   119,
748       25,   120,   121,   122,   123,     0,     0,     0,     0,     0,
749        0,    26,    27,     0,     0,    28,    29,     0,     0,     0,
750       62,     0,    31,    32,    33,    34,     0,     0,    35,     1,
751        2,     3,     4,     5,     6,     7,     8,     9,    10,    11,
752       12,    13,    14,     0,    15,    16,    17,    18,    19,    20,
753       21,    22,     0,    23,    24,     0,     0,     0,     0,     5,
754        0,     7,     8,     9,    10,     0,    12,     0,    14,     0,
755       15,    16,    17,    18,    19,    20,    21,     0,    28,    29,
756        0,     0,     0,    30,     0,    31,    32,    33,    34,   196,
757        0,    35,   118,   119,     0,   120,   121,   122,   123,     0,
758        0,   197,     0,     0,     0,     0,     0,     0,   198,   199,
759        0,     0,     0,     0,     0,     0,   225,    54,   175,    56,
760        7,     8,     9,    10,     0,    12,     0,    14,     0,    15,
761       16,    17,    18,    19,    20,    21,     0,     0,    98,    99,
762      100,   101,   102,   103,   104,   105,   106,   107,   108,   109,
763      110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
764      181,   120,   121,   122,   123,     0,    96,     0,     0,     0,
765       57,    97,    98,    99,   100,   101,   102,   103,   104,   105,
766      106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
767      116,   117,   118,   119,     0,   120,   121,   122,   123,     0,
768        0,     0,     0,    96,     0,     0,     0,   212,    97,    98,
769       99,   100,   101,   102,   103,   104,   105,   106,   107,   108,
770      109,   110,   111,   112,   113,   114,   115,   116,   117,   118,
771      119,     0,   120,   121,   122,   123,   100,   101,   102,   103,
772      104,   105,   106,   107,   108,   109,   110,   111,   112,   113,
773      114,   115,   116,   117,   118,   119,     0,   120,   121,   122,
774      123,   101,   102,   103,   104,   105,   106,   107,   108,   109,
775      110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
776        0,   120,   121,   122,   123,   102,   103,   104,   105,   106,
777      107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
778      117,   118,   119,     0,   120,   121,   122,   123,   103,   104,
779      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
780      115,   116,   117,   118,   119,     0,   120,   121,   122,   123,
781      104,   105,   106,   107,   108,   109,   110,   111,   112,   113,
782      114,   115,   116,   117,   118,   119,     0,   120,   121,   122,
783      123,   106,   107,   108,   109,   110,   111,   112,   113,   114,
784      115,   116,   117,   118,   119,     0,   120,   121,   122,   123,
785      110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
786        0,   120,   121,   122,   123
787 };
788
789 static const short yycheck[] =
790 {
791        0,     0,     7,     8,     9,    10,     0,     3,    13,    14,
792       29,    29,    23,    48,    29,    50,    29,     6,     7,     8,
793       29,    22,    23,    37,    22,    23,     6,     7,     8,    64,
794       30,    30,     6,     7,     8,    49,     6,     7,     8,    22,
795       40,    40,    56,    57,    15,    63,    46,    66,    46,    64,
796       14,    64,     7,   120,    18,    64,   123,    21,    11,    19,
797       49,    21,    62,    62,    19,    20,    21,    63,    29,    49,
798       59,    15,    25,    26,    27,    28,    29,    22,    23,    59,
799       33,    34,    62,    15,     0,    59,    15,    40,    62,    59,
800       22,    23,    37,    22,    23,   130,   196,   197,    15,   199,
801       15,    46,    15,    46,    49,    22,    23,    22,    23,    22,
802       23,    56,    57,    46,    46,   120,    21,    46,   123,    56,
803       57,     7,   127,     9,    10,    11,    12,   121,    14,    46,
804       16,    46,    18,    19,    20,    21,    22,    23,    24,    40,
805      140,   140,    95,    96,    97,    98,    99,   100,   101,   102,
806      103,   104,   105,   106,   107,   108,   109,   110,   111,   112,
807      113,   114,   115,   116,   117,   200,    14,    49,    56,    57,
808       18,    19,   207,    21,    56,    57,    24,    21,    64,     7,
809       21,     9,    10,    11,    12,    21,    14,   192,    16,   194,
810       18,    19,    20,    21,    22,    23,    24,    21,   151,   199,
811        6,     7,     8,     9,    10,    11,    12,     7,    14,    19,
812       16,    21,    18,    19,    20,    21,    22,    23,    24,    19,
813       20,    21,    64,   176,     6,    15,    66,   180,   181,   234,
814      230,   184,    22,    23,   187,    64,    21,    14,    21,   239,
815      239,    18,    21,    49,    21,    21,    15,    41,    63,   180,
816       64,   204,   126,    59,   129,   201,    15,   129,   200,   212,
817        3,     4,     5,     6,     7,     8,     9,    10,    11,    12,
818       13,    14,    15,    16,   201,    18,    19,    20,    21,    22,
819       23,    24,    25,    -1,    27,    28,    46,    47,    48,    49,
820       50,    51,    52,    53,    37,    55,    56,    57,    58,    -1,
821       -1,    -1,    -1,    46,    -1,    48,    49,    -1,    -1,    52,
822       53,    -1,    -1,    -1,    57,    -1,    59,    60,    61,    62,
823       -1,    -1,    65,     3,     4,     5,     6,     7,     8,     9,
824       10,    11,    12,    13,    14,    15,    16,    -1,    18,    19,
825       20,    21,    22,    23,    24,    25,    -1,    27,    28,    -1,
826       47,    48,    49,    50,    51,    52,    53,    37,    55,    56,
827       57,    58,    -1,    -1,    -1,    -1,    -1,    -1,    48,    49,
828       -1,    -1,    52,    53,    -1,    -1,    -1,    57,    -1,    59,
829       60,    61,    62,    -1,    -1,    65,     3,     4,     5,     6,
830        7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
831       -1,    18,    19,    20,    21,    22,    23,    24,    25,    -1,
832       27,    28,    -1,    -1,    -1,    49,    50,    51,    52,    53,
833       37,    55,    56,    57,    58,    -1,    -1,    -1,    -1,    -1,
834       -1,    48,    49,    -1,    -1,    52,    53,    -1,    -1,    -1,
835       57,    -1,    59,    60,    61,    62,    -1,    -1,    65,     3,
836        4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
837       14,    15,    16,    -1,    18,    19,    20,    21,    22,    23,
838       24,    25,    -1,    27,    28,    -1,    -1,    -1,    -1,     7,
839       -1,     9,    10,    11,    12,    -1,    14,    -1,    16,    -1,
840       18,    19,    20,    21,    22,    23,    24,    -1,    52,    53,
841       -1,    -1,    -1,    57,    -1,    59,    60,    61,    62,    37,
842       -1,    65,    52,    53,    -1,    55,    56,    57,    58,    -1,
843       -1,    49,    -1,    -1,    -1,    -1,    -1,    -1,    56,    57,
844       -1,    -1,    -1,    -1,    -1,    -1,    64,     6,     7,     8,
845        9,    10,    11,    12,    -1,    14,    -1,    16,    -1,    18,
846       19,    20,    21,    22,    23,    24,    -1,    -1,    32,    33,
847       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
848       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
849       49,    55,    56,    57,    58,    -1,    26,    -1,    -1,    -1,
850       59,    31,    32,    33,    34,    35,    36,    37,    38,    39,
851       40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
852       50,    51,    52,    53,    -1,    55,    56,    57,    58,    -1,
853       -1,    -1,    -1,    26,    -1,    -1,    -1,    67,    31,    32,
854       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
855       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
856       53,    -1,    55,    56,    57,    58,    34,    35,    36,    37,
857       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
858       48,    49,    50,    51,    52,    53,    -1,    55,    56,    57,
859       58,    35,    36,    37,    38,    39,    40,    41,    42,    43,
860       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
861       -1,    55,    56,    57,    58,    36,    37,    38,    39,    40,
862       41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
863       51,    52,    53,    -1,    55,    56,    57,    58,    37,    38,
864       39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
865       49,    50,    51,    52,    53,    -1,    55,    56,    57,    58,
866       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
867       48,    49,    50,    51,    52,    53,    -1,    55,    56,    57,
868       58,    40,    41,    42,    43,    44,    45,    46,    47,    48,
869       49,    50,    51,    52,    53,    -1,    55,    56,    57,    58,
870       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
871       -1,    55,    56,    57,    58
872 };
873
874 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
875    symbol of state STATE-NUM.  */
876 static const unsigned char yystos[] =
877 {
878        0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
879       12,    13,    14,    15,    16,    18,    19,    20,    21,    22,
880       23,    24,    25,    27,    28,    37,    48,    49,    52,    53,
881       57,    59,    60,    61,    62,    65,    69,    70,    71,    72,
882       74,    77,    78,    79,    81,    82,    83,    89,    90,    91,
883       94,    95,    96,    98,     6,     7,     8,    59,    97,    97,
884       97,    97,    57,    72,    90,     7,    19,    20,    21,    92,
885       97,    97,    19,    20,    92,    14,    18,    19,    21,    24,
886       14,    18,    21,    23,    22,    72,    72,    72,    72,    72,
887       71,    89,    72,    72,     0,    29,    26,    31,    32,    33,
888       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
889       44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
890       55,    56,    57,    58,    72,    75,    89,    15,    46,    80,
891       90,    15,    83,    83,    84,    89,    15,    19,    21,    21,
892       40,    19,    21,    21,    21,    14,    18,    21,    21,    21,
893       64,    64,    72,    72,    72,    72,    72,    72,    72,    72,
894       72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
895       72,    72,    72,    72,    72,     7,    49,    79,    97,    71,
896       73,    49,    79,    97,    29,    66,    76,    76,    97,     6,
897       81,    96,    15,    49,    62,    97,    37,    49,    56,    57,
898       85,    86,    87,    88,    64,    21,    89,    90,    21,    21,
899       21,    72,    67,    72,    63,    75,    72,    72,    72,    97,
900       97,    85,    85,     3,    63,    64,    85,    89,    93,    84,
901       57,    87,    88,    41,    15,    72,    64,    63,    64,    29,
902       64,    89
903 };
904
905 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
906 # define YYSIZE_T __SIZE_TYPE__
907 #endif
908 #if ! defined (YYSIZE_T) && defined (size_t)
909 # define YYSIZE_T size_t
910 #endif
911 #if ! defined (YYSIZE_T)
912 # if defined (__STDC__) || defined (__cplusplus)
913 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
914 #  define YYSIZE_T size_t
915 # endif
916 #endif
917 #if ! defined (YYSIZE_T)
918 # define YYSIZE_T unsigned int
919 #endif
920
921 #define yyerrok         (yyerrstatus = 0)
922 #define yyclearin       (yychar = YYEMPTY)
923 #define YYEMPTY         (-2)
924 #define YYEOF           0
925
926 #define YYACCEPT        goto yyacceptlab
927 #define YYABORT         goto yyabortlab
928 #define YYERROR         goto yyerrlab1
929
930 /* Like YYERROR except do call yyerror.  This remains here temporarily
931    to ease the transition to the new meaning of YYERROR, for GCC.
932    Once GCC version 2 has supplanted version 1, this can go.  */
933
934 #define YYFAIL          goto yyerrlab
935
936 #define YYRECOVERING()  (!!yyerrstatus)
937
938 #define YYBACKUP(Token, Value)                                  \
939 do                                                              \
940   if (yychar == YYEMPTY && yylen == 1)                          \
941     {                                                           \
942       yychar = (Token);                                         \
943       yylval = (Value);                                         \
944       yytoken = YYTRANSLATE (yychar);                           \
945       YYPOPSTACK;                                               \
946       goto yybackup;                                            \
947     }                                                           \
948   else                                                          \
949     {                                                           \
950       yyerror ("syntax error: cannot back up");\
951       YYERROR;                                                  \
952     }                                                           \
953 while (0)
954
955 #define YYTERROR        1
956 #define YYERRCODE       256
957
958 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
959    are run).  */
960
961 #ifndef YYLLOC_DEFAULT
962 # define YYLLOC_DEFAULT(Current, Rhs, N)         \
963   Current.first_line   = Rhs[1].first_line;      \
964   Current.first_column = Rhs[1].first_column;    \
965   Current.last_line    = Rhs[N].last_line;       \
966   Current.last_column  = Rhs[N].last_column;
967 #endif
968
969 /* YYLEX -- calling `yylex' with the right arguments.  */
970
971 #ifdef YYLEX_PARAM
972 # define YYLEX yylex (YYLEX_PARAM)
973 #else
974 # define YYLEX yylex ()
975 #endif
976
977 /* Enable debugging if requested.  */
978 #if YYDEBUG
979
980 # ifndef YYFPRINTF
981 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
982 #  define YYFPRINTF fprintf
983 # endif
984
985 # define YYDPRINTF(Args)                        \
986 do {                                            \
987   if (yydebug)                                  \
988     YYFPRINTF Args;                             \
989 } while (0)
990
991 # define YYDSYMPRINT(Args)                      \
992 do {                                            \
993   if (yydebug)                                  \
994     yysymprint Args;                            \
995 } while (0)
996
997 # define YYDSYMPRINTF(Title, Token, Value, Location)            \
998 do {                                                            \
999   if (yydebug)                                                  \
1000     {                                                           \
1001       YYFPRINTF (stderr, "%s ", Title);                         \
1002       yysymprint (stderr,                                       \
1003                   Token, Value);        \
1004       YYFPRINTF (stderr, "\n");                                 \
1005     }                                                           \
1006 } while (0)
1007
1008 /*------------------------------------------------------------------.
1009 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1010 | TOP (cinluded).                                                   |
1011 `------------------------------------------------------------------*/
1012
1013 #if defined (__STDC__) || defined (__cplusplus)
1014 static void
1015 yy_stack_print (short *bottom, short *top)
1016 #else
1017 static void
1018 yy_stack_print (bottom, top)
1019     short *bottom;
1020     short *top;
1021 #endif
1022 {
1023   YYFPRINTF (stderr, "Stack now");
1024   for (/* Nothing. */; bottom <= top; ++bottom)
1025     YYFPRINTF (stderr, " %d", *bottom);
1026   YYFPRINTF (stderr, "\n");
1027 }
1028
1029 # define YY_STACK_PRINT(Bottom, Top)                            \
1030 do {                                                            \
1031   if (yydebug)                                                  \
1032     yy_stack_print ((Bottom), (Top));                           \
1033 } while (0)
1034
1035
1036 /*------------------------------------------------.
1037 | Report that the YYRULE is going to be reduced.  |
1038 `------------------------------------------------*/
1039
1040 #if defined (__STDC__) || defined (__cplusplus)
1041 static void
1042 yy_reduce_print (int yyrule)
1043 #else
1044 static void
1045 yy_reduce_print (yyrule)
1046     int yyrule;
1047 #endif
1048 {
1049   int yyi;
1050   unsigned int yylineno = yyrline[yyrule];
1051   YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1052              yyrule - 1, yylineno);
1053   /* Print the symbols being reduced, and their result.  */
1054   for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1055     YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1056   YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1057 }
1058
1059 # define YY_REDUCE_PRINT(Rule)          \
1060 do {                                    \
1061   if (yydebug)                          \
1062     yy_reduce_print (Rule);             \
1063 } while (0)
1064
1065 /* Nonzero means print parse trace.  It is left uninitialized so that
1066    multiple parsers can coexist.  */
1067 int yydebug;
1068 #else /* !YYDEBUG */
1069 # define YYDPRINTF(Args)
1070 # define YYDSYMPRINT(Args)
1071 # define YYDSYMPRINTF(Title, Token, Value, Location)
1072 # define YY_STACK_PRINT(Bottom, Top)
1073 # define YY_REDUCE_PRINT(Rule)
1074 #endif /* !YYDEBUG */
1075
1076
1077 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1078 #ifndef YYINITDEPTH
1079 # define YYINITDEPTH 200
1080 #endif
1081
1082 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1083    if the built-in stack extension method is used).
1084
1085    Do not make this value too large; the results are undefined if
1086    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1087    evaluated with infinite-precision integer arithmetic.  */
1088
1089 #if YYMAXDEPTH == 0
1090 # undef YYMAXDEPTH
1091 #endif
1092
1093 #ifndef YYMAXDEPTH
1094 # define YYMAXDEPTH 10000
1095 #endif
1096
1097 \f
1098
1099 #if YYERROR_VERBOSE
1100
1101 # ifndef yystrlen
1102 #  if defined (__GLIBC__) && defined (_STRING_H)
1103 #   define yystrlen strlen
1104 #  else
1105 /* Return the length of YYSTR.  */
1106 static YYSIZE_T
1107 #   if defined (__STDC__) || defined (__cplusplus)
1108 yystrlen (const char *yystr)
1109 #   else
1110 yystrlen (yystr)
1111      const char *yystr;
1112 #   endif
1113 {
1114   register const char *yys = yystr;
1115
1116   while (*yys++ != '\0')
1117     continue;
1118
1119   return yys - yystr - 1;
1120 }
1121 #  endif
1122 # endif
1123
1124 # ifndef yystpcpy
1125 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1126 #   define yystpcpy stpcpy
1127 #  else
1128 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1129    YYDEST.  */
1130 static char *
1131 #   if defined (__STDC__) || defined (__cplusplus)
1132 yystpcpy (char *yydest, const char *yysrc)
1133 #   else
1134 yystpcpy (yydest, yysrc)
1135      char *yydest;
1136      const char *yysrc;
1137 #   endif
1138 {
1139   register char *yyd = yydest;
1140   register const char *yys = yysrc;
1141
1142   while ((*yyd++ = *yys++) != '\0')
1143     continue;
1144
1145   return yyd - 1;
1146 }
1147 #  endif
1148 # endif
1149
1150 #endif /* !YYERROR_VERBOSE */
1151
1152 \f
1153
1154 #if YYDEBUG
1155 /*--------------------------------.
1156 | Print this symbol on YYOUTPUT.  |
1157 `--------------------------------*/
1158
1159 #if defined (__STDC__) || defined (__cplusplus)
1160 static void
1161 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1162 #else
1163 static void
1164 yysymprint (yyoutput, yytype, yyvaluep)
1165     FILE *yyoutput;
1166     int yytype;
1167     YYSTYPE *yyvaluep;
1168 #endif
1169 {
1170   /* Pacify ``unused variable'' warnings.  */
1171   (void) yyvaluep;
1172
1173   if (yytype < YYNTOKENS)
1174     {
1175       YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1176 # ifdef YYPRINT
1177       YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1178 # endif
1179     }
1180   else
1181     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1182
1183   switch (yytype)
1184     {
1185       default:
1186         break;
1187     }
1188   YYFPRINTF (yyoutput, ")");
1189 }
1190
1191 #endif /* ! YYDEBUG */
1192 /*-----------------------------------------------.
1193 | Release the memory associated to this symbol.  |
1194 `-----------------------------------------------*/
1195
1196 #if defined (__STDC__) || defined (__cplusplus)
1197 static void
1198 yydestruct (int yytype, YYSTYPE *yyvaluep)
1199 #else
1200 static void
1201 yydestruct (yytype, yyvaluep)
1202     int yytype;
1203     YYSTYPE *yyvaluep;
1204 #endif
1205 {
1206   /* Pacify ``unused variable'' warnings.  */
1207   (void) yyvaluep;
1208
1209   switch (yytype)
1210     {
1211
1212       default:
1213         break;
1214     }
1215 }
1216 \f
1217
1218 /* Prevent warnings from -Wmissing-prototypes.  */
1219
1220 #ifdef YYPARSE_PARAM
1221 # if defined (__STDC__) || defined (__cplusplus)
1222 int yyparse (void *YYPARSE_PARAM);
1223 # else
1224 int yyparse ();
1225 # endif
1226 #else /* ! YYPARSE_PARAM */
1227 #if defined (__STDC__) || defined (__cplusplus)
1228 int yyparse (void);
1229 #else
1230 int yyparse ();
1231 #endif
1232 #endif /* ! YYPARSE_PARAM */
1233
1234
1235
1236 /* The lookahead symbol.  */
1237 int yychar;
1238
1239 /* The semantic value of the lookahead symbol.  */
1240 YYSTYPE yylval;
1241
1242 /* Number of syntax errors so far.  */
1243 int yynerrs;
1244
1245
1246
1247 /*----------.
1248 | yyparse.  |
1249 `----------*/
1250
1251 #ifdef YYPARSE_PARAM
1252 # if defined (__STDC__) || defined (__cplusplus)
1253 int yyparse (void *YYPARSE_PARAM)
1254 # else
1255 int yyparse (YYPARSE_PARAM)
1256   void *YYPARSE_PARAM;
1257 # endif
1258 #else /* ! YYPARSE_PARAM */
1259 #if defined (__STDC__) || defined (__cplusplus)
1260 int
1261 yyparse (void)
1262 #else
1263 int
1264 yyparse ()
1265
1266 #endif
1267 #endif
1268 {
1269   
1270   register int yystate;
1271   register int yyn;
1272   int yyresult;
1273   /* Number of tokens to shift before error messages enabled.  */
1274   int yyerrstatus;
1275   /* Lookahead token as an internal (translated) token number.  */
1276   int yytoken = 0;
1277
1278   /* Three stacks and their tools:
1279      `yyss': related to states,
1280      `yyvs': related to semantic values,
1281      `yyls': related to locations.
1282
1283      Refer to the stacks thru separate pointers, to allow yyoverflow
1284      to xreallocate them elsewhere.  */
1285
1286   /* The state stack.  */
1287   short yyssa[YYINITDEPTH];
1288   short *yyss = yyssa;
1289   register short *yyssp;
1290
1291   /* The semantic value stack.  */
1292   YYSTYPE yyvsa[YYINITDEPTH];
1293   YYSTYPE *yyvs = yyvsa;
1294   register YYSTYPE *yyvsp;
1295
1296
1297
1298 #define YYPOPSTACK   (yyvsp--, yyssp--)
1299
1300   YYSIZE_T yystacksize = YYINITDEPTH;
1301
1302   /* The variables used to return semantic value and location from the
1303      action routines.  */
1304   YYSTYPE yyval;
1305
1306
1307   /* When reducing, the number of symbols on the RHS of the reduced
1308      rule.  */
1309   int yylen;
1310
1311   YYDPRINTF ((stderr, "Starting parse\n"));
1312
1313   yystate = 0;
1314   yyerrstatus = 0;
1315   yynerrs = 0;
1316   yychar = YYEMPTY;             /* Cause a token to be read.  */
1317
1318   /* Initialize stack pointers.
1319      Waste one element of value and location stack
1320      so that they stay on the same level as the state stack.
1321      The wasted elements are never initialized.  */
1322
1323   yyssp = yyss;
1324   yyvsp = yyvs;
1325
1326   goto yysetstate;
1327
1328 /*------------------------------------------------------------.
1329 | yynewstate -- Push a new state, which is found in yystate.  |
1330 `------------------------------------------------------------*/
1331  yynewstate:
1332   /* In all cases, when you get here, the value and location stacks
1333      have just been pushed. so pushing a state here evens the stacks.
1334      */
1335   yyssp++;
1336
1337  yysetstate:
1338   *yyssp = yystate;
1339
1340   if (yyss + yystacksize - 1 <= yyssp)
1341     {
1342       /* Get the current used size of the three stacks, in elements.  */
1343       YYSIZE_T yysize = yyssp - yyss + 1;
1344
1345 #ifdef yyoverflow
1346       {
1347         /* Give user a chance to xreallocate the stack. Use copies of
1348            these so that the &'s don't force the real ones into
1349            memory.  */
1350         YYSTYPE *yyvs1 = yyvs;
1351         short *yyss1 = yyss;
1352
1353
1354         /* Each stack pointer address is followed by the size of the
1355            data in use in that stack, in bytes.  This used to be a
1356            conditional around just the two extra args, but that might
1357            be undefined if yyoverflow is a macro.  */
1358         yyoverflow ("parser stack overflow",
1359                     &yyss1, yysize * sizeof (*yyssp),
1360                     &yyvs1, yysize * sizeof (*yyvsp),
1361
1362                     &yystacksize);
1363
1364         yyss = yyss1;
1365         yyvs = yyvs1;
1366       }
1367 #else /* no yyoverflow */
1368 # ifndef YYSTACK_RELOCATE
1369       goto yyoverflowlab;
1370 # else
1371       /* Extend the stack our own way.  */
1372       if (YYMAXDEPTH <= yystacksize)
1373         goto yyoverflowlab;
1374       yystacksize *= 2;
1375       if (YYMAXDEPTH < yystacksize)
1376         yystacksize = YYMAXDEPTH;
1377
1378       {
1379         short *yyss1 = yyss;
1380         union yyalloc *yyptr =
1381           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1382         if (! yyptr)
1383           goto yyoverflowlab;
1384         YYSTACK_RELOCATE (yyss);
1385         YYSTACK_RELOCATE (yyvs);
1386
1387 #  undef YYSTACK_RELOCATE
1388         if (yyss1 != yyssa)
1389           YYSTACK_FREE (yyss1);
1390       }
1391 # endif
1392 #endif /* no yyoverflow */
1393
1394       yyssp = yyss + yysize - 1;
1395       yyvsp = yyvs + yysize - 1;
1396
1397
1398       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1399                   (unsigned long int) yystacksize));
1400
1401       if (yyss + yystacksize - 1 <= yyssp)
1402         YYABORT;
1403     }
1404
1405   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1406
1407   goto yybackup;
1408
1409 /*-----------.
1410 | yybackup.  |
1411 `-----------*/
1412 yybackup:
1413
1414 /* Do appropriate processing given the current state.  */
1415 /* Read a lookahead token if we need one and don't already have one.  */
1416 /* yyresume: */
1417
1418   /* First try to decide what to do without reference to lookahead token.  */
1419
1420   yyn = yypact[yystate];
1421   if (yyn == YYPACT_NINF)
1422     goto yydefault;
1423
1424   /* Not known => get a lookahead token if don't already have one.  */
1425
1426   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1427   if (yychar == YYEMPTY)
1428     {
1429       YYDPRINTF ((stderr, "Reading a token: "));
1430       yychar = YYLEX;
1431     }
1432
1433   if (yychar <= YYEOF)
1434     {
1435       yychar = yytoken = YYEOF;
1436       YYDPRINTF ((stderr, "Now at end of input.\n"));
1437     }
1438   else
1439     {
1440       yytoken = YYTRANSLATE (yychar);
1441       YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1442     }
1443
1444   /* If the proper action on seeing token YYTOKEN is to reduce or to
1445      detect an error, take that action.  */
1446   yyn += yytoken;
1447   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1448     goto yydefault;
1449   yyn = yytable[yyn];
1450   if (yyn <= 0)
1451     {
1452       if (yyn == 0 || yyn == YYTABLE_NINF)
1453         goto yyerrlab;
1454       yyn = -yyn;
1455       goto yyreduce;
1456     }
1457
1458   if (yyn == YYFINAL)
1459     YYACCEPT;
1460
1461   /* Shift the lookahead token.  */
1462   YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1463
1464   /* Discard the token being shifted unless it is eof.  */
1465   if (yychar != YYEOF)
1466     yychar = YYEMPTY;
1467
1468   *++yyvsp = yylval;
1469
1470
1471   /* Count tokens shifted since error; after three, turn off error
1472      status.  */
1473   if (yyerrstatus)
1474     yyerrstatus--;
1475
1476   yystate = yyn;
1477   goto yynewstate;
1478
1479
1480 /*-----------------------------------------------------------.
1481 | yydefault -- do the default action for the current state.  |
1482 `-----------------------------------------------------------*/
1483 yydefault:
1484   yyn = yydefact[yystate];
1485   if (yyn == 0)
1486     goto yyerrlab;
1487   goto yyreduce;
1488
1489
1490 /*-----------------------------.
1491 | yyreduce -- Do a reduction.  |
1492 `-----------------------------*/
1493 yyreduce:
1494   /* yyn is the number of a rule to reduce with.  */
1495   yylen = yyr2[yyn];
1496
1497   /* If YYLEN is nonzero, implement the default value of the action:
1498      `$$ = $1'.
1499
1500      Otherwise, the following line sets YYVAL to garbage.
1501      This behavior is undocumented and Bison
1502      users should not rely upon it.  Assigning to YYVAL
1503      unconditionally makes the parser a bit smaller, and it avoids a
1504      GCC warning that YYVAL may be used uninitialized.  */
1505   yyval = yyvsp[1-yylen];
1506
1507
1508   YY_REDUCE_PRINT (yyn);
1509   switch (yyn)
1510     {
1511         case 4:
1512 #line 238 "c-exp.y"
1513     { write_exp_elt_opcode(OP_TYPE);
1514                           write_exp_elt_type(yyvsp[0].tval);
1515                           write_exp_elt_opcode(OP_TYPE);}
1516     break;
1517
1518   case 6:
1519 #line 246 "c-exp.y"
1520     { write_exp_elt_opcode (BINOP_COMMA); }
1521     break;
1522
1523   case 7:
1524 #line 251 "c-exp.y"
1525     { write_exp_elt_opcode (UNOP_IND); }
1526     break;
1527
1528   case 8:
1529 #line 255 "c-exp.y"
1530     { write_exp_elt_opcode (UNOP_ADDR); }
1531     break;
1532
1533   case 9:
1534 #line 259 "c-exp.y"
1535     { write_exp_elt_opcode (UNOP_NEG); }
1536     break;
1537
1538   case 10:
1539 #line 263 "c-exp.y"
1540     { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1541     break;
1542
1543   case 11:
1544 #line 267 "c-exp.y"
1545     { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1546     break;
1547
1548   case 12:
1549 #line 271 "c-exp.y"
1550     { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1551     break;
1552
1553   case 13:
1554 #line 275 "c-exp.y"
1555     { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1556     break;
1557
1558   case 14:
1559 #line 279 "c-exp.y"
1560     { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1561     break;
1562
1563   case 15:
1564 #line 283 "c-exp.y"
1565     { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1566     break;
1567
1568   case 16:
1569 #line 287 "c-exp.y"
1570     { write_exp_elt_opcode (UNOP_SIZEOF); }
1571     break;
1572
1573   case 17:
1574 #line 291 "c-exp.y"
1575     { write_exp_elt_opcode (STRUCTOP_PTR);
1576                           write_exp_string (yyvsp[0].sval);
1577                           write_exp_elt_opcode (STRUCTOP_PTR); }
1578     break;
1579
1580   case 18:
1581 #line 297 "c-exp.y"
1582     { /* exp->type::name becomes exp->*(&type::name) */
1583                           /* Note: this doesn't work if name is a
1584                              static member!  FIXME */
1585                           write_exp_elt_opcode (UNOP_ADDR);
1586                           write_exp_elt_opcode (STRUCTOP_MPTR); }
1587     break;
1588
1589   case 19:
1590 #line 305 "c-exp.y"
1591     { write_exp_elt_opcode (STRUCTOP_MPTR); }
1592     break;
1593
1594   case 20:
1595 #line 309 "c-exp.y"
1596     { write_exp_elt_opcode (STRUCTOP_STRUCT);
1597                           write_exp_string (yyvsp[0].sval);
1598                           write_exp_elt_opcode (STRUCTOP_STRUCT); }
1599     break;
1600
1601   case 21:
1602 #line 315 "c-exp.y"
1603     { /* exp.type::name becomes exp.*(&type::name) */
1604                           /* Note: this doesn't work if name is a
1605                              static member!  FIXME */
1606                           write_exp_elt_opcode (UNOP_ADDR);
1607                           write_exp_elt_opcode (STRUCTOP_MEMBER); }
1608     break;
1609
1610   case 22:
1611 #line 323 "c-exp.y"
1612     { write_exp_elt_opcode (STRUCTOP_MEMBER); }
1613     break;
1614
1615   case 23:
1616 #line 327 "c-exp.y"
1617     { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1618     break;
1619
1620   case 24:
1621 #line 333 "c-exp.y"
1622     { start_arglist (); }
1623     break;
1624
1625   case 25:
1626 #line 335 "c-exp.y"
1627     { write_exp_elt_opcode (OP_FUNCALL);
1628                           write_exp_elt_longcst ((LONGEST) end_arglist ());
1629                           write_exp_elt_opcode (OP_FUNCALL); }
1630     break;
1631
1632   case 26:
1633 #line 341 "c-exp.y"
1634     { start_arglist (); }
1635     break;
1636
1637   case 28:
1638 #line 348 "c-exp.y"
1639     { arglist_len = 1; }
1640     break;
1641
1642   case 29:
1643 #line 352 "c-exp.y"
1644     { arglist_len++; }
1645     break;
1646
1647   case 30:
1648 #line 356 "c-exp.y"
1649     { yyval.lval = end_arglist () - 1; }
1650     break;
1651
1652   case 31:
1653 #line 359 "c-exp.y"
1654     { write_exp_elt_opcode (OP_ARRAY);
1655                           write_exp_elt_longcst ((LONGEST) 0);
1656                           write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1657                           write_exp_elt_opcode (OP_ARRAY); }
1658     break;
1659
1660   case 32:
1661 #line 366 "c-exp.y"
1662     { write_exp_elt_opcode (UNOP_MEMVAL);
1663                           write_exp_elt_type (yyvsp[-2].tval);
1664                           write_exp_elt_opcode (UNOP_MEMVAL); }
1665     break;
1666
1667   case 33:
1668 #line 372 "c-exp.y"
1669     { write_exp_elt_opcode (UNOP_CAST);
1670                           write_exp_elt_type (yyvsp[-2].tval);
1671                           write_exp_elt_opcode (UNOP_CAST); }
1672     break;
1673
1674   case 34:
1675 #line 378 "c-exp.y"
1676     { }
1677     break;
1678
1679   case 35:
1680 #line 384 "c-exp.y"
1681     { write_exp_elt_opcode (BINOP_REPEAT); }
1682     break;
1683
1684   case 36:
1685 #line 388 "c-exp.y"
1686     { write_exp_elt_opcode (BINOP_MUL); }
1687     break;
1688
1689   case 37:
1690 #line 392 "c-exp.y"
1691     { write_exp_elt_opcode (BINOP_DIV); }
1692     break;
1693
1694   case 38:
1695 #line 396 "c-exp.y"
1696     { write_exp_elt_opcode (BINOP_REM); }
1697     break;
1698
1699   case 39:
1700 #line 400 "c-exp.y"
1701     { write_exp_elt_opcode (BINOP_ADD); }
1702     break;
1703
1704   case 40:
1705 #line 404 "c-exp.y"
1706     { write_exp_elt_opcode (BINOP_SUB); }
1707     break;
1708
1709   case 41:
1710 #line 408 "c-exp.y"
1711     { write_exp_elt_opcode (BINOP_LSH); }
1712     break;
1713
1714   case 42:
1715 #line 412 "c-exp.y"
1716     { write_exp_elt_opcode (BINOP_RSH); }
1717     break;
1718
1719   case 43:
1720 #line 416 "c-exp.y"
1721     { write_exp_elt_opcode (BINOP_EQUAL); }
1722     break;
1723
1724   case 44:
1725 #line 420 "c-exp.y"
1726     { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1727     break;
1728
1729   case 45:
1730 #line 424 "c-exp.y"
1731     { write_exp_elt_opcode (BINOP_LEQ); }
1732     break;
1733
1734   case 46:
1735 #line 428 "c-exp.y"
1736     { write_exp_elt_opcode (BINOP_GEQ); }
1737     break;
1738
1739   case 47:
1740 #line 432 "c-exp.y"
1741     { write_exp_elt_opcode (BINOP_LESS); }
1742     break;
1743
1744   case 48:
1745 #line 436 "c-exp.y"
1746     { write_exp_elt_opcode (BINOP_GTR); }
1747     break;
1748
1749   case 49:
1750 #line 440 "c-exp.y"
1751     { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1752     break;
1753
1754   case 50:
1755 #line 444 "c-exp.y"
1756     { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1757     break;
1758
1759   case 51:
1760 #line 448 "c-exp.y"
1761     { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1762     break;
1763
1764   case 52:
1765 #line 452 "c-exp.y"
1766     { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1767     break;
1768
1769   case 53:
1770 #line 456 "c-exp.y"
1771     { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1772     break;
1773
1774   case 54:
1775 #line 460 "c-exp.y"
1776     { write_exp_elt_opcode (TERNOP_COND); }
1777     break;
1778
1779   case 55:
1780 #line 464 "c-exp.y"
1781     { write_exp_elt_opcode (BINOP_ASSIGN); }
1782     break;
1783
1784   case 56:
1785 #line 468 "c-exp.y"
1786     { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1787                           write_exp_elt_opcode (yyvsp[-1].opcode);
1788                           write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1789     break;
1790
1791   case 57:
1792 #line 474 "c-exp.y"
1793     { write_exp_elt_opcode (OP_LONG);
1794                           write_exp_elt_type (yyvsp[0].typed_val_int.type);
1795                           write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1796                           write_exp_elt_opcode (OP_LONG); }
1797     break;
1798
1799   case 58:
1800 #line 481 "c-exp.y"
1801     { YYSTYPE val;
1802                           parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1803                           write_exp_elt_opcode (OP_LONG);
1804                           write_exp_elt_type (val.typed_val_int.type);
1805                           write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1806                           write_exp_elt_opcode (OP_LONG);
1807                         }
1808     break;
1809
1810   case 59:
1811 #line 492 "c-exp.y"
1812     { write_exp_elt_opcode (OP_DOUBLE);
1813                           write_exp_elt_type (yyvsp[0].typed_val_float.type);
1814                           write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1815                           write_exp_elt_opcode (OP_DOUBLE); }
1816     break;
1817
1818   case 62:
1819 #line 506 "c-exp.y"
1820     { write_exp_elt_opcode (OP_LONG);
1821                           write_exp_elt_type (builtin_type_int);
1822                           CHECK_TYPEDEF (yyvsp[-1].tval);
1823                           write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1824                           write_exp_elt_opcode (OP_LONG); }
1825     break;
1826
1827   case 63:
1828 #line 514 "c-exp.y"
1829     { /* C strings are converted into array constants with
1830                              an explicit null byte added at the end.  Thus
1831                              the array upper bound is the string length.
1832                              There is no such thing in C as a completely empty
1833                              string. */
1834                           char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
1835                           while (count-- > 0)
1836                             {
1837                               write_exp_elt_opcode (OP_LONG);
1838                               write_exp_elt_type (builtin_type_char);
1839                               write_exp_elt_longcst ((LONGEST)(*sp++));
1840                               write_exp_elt_opcode (OP_LONG);
1841                             }
1842                           write_exp_elt_opcode (OP_LONG);
1843                           write_exp_elt_type (builtin_type_char);
1844                           write_exp_elt_longcst ((LONGEST)'\0');
1845                           write_exp_elt_opcode (OP_LONG);
1846                           write_exp_elt_opcode (OP_ARRAY);
1847                           write_exp_elt_longcst ((LONGEST) 0);
1848                           write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1849                           write_exp_elt_opcode (OP_ARRAY); }
1850     break;
1851
1852   case 64:
1853 #line 539 "c-exp.y"
1854     { write_exp_elt_opcode (OP_LONG);
1855                           write_exp_elt_type (builtin_type_bool);
1856                           write_exp_elt_longcst ((LONGEST) 1);
1857                           write_exp_elt_opcode (OP_LONG); }
1858     break;
1859
1860   case 65:
1861 #line 546 "c-exp.y"
1862     { write_exp_elt_opcode (OP_LONG);
1863                           write_exp_elt_type (builtin_type_bool);
1864                           write_exp_elt_longcst ((LONGEST) 0);
1865                           write_exp_elt_opcode (OP_LONG); }
1866     break;
1867
1868   case 66:
1869 #line 555 "c-exp.y"
1870     {
1871                           if (yyvsp[0].ssym.sym)
1872                             yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1873                           else
1874                             error ("No file or function \"%s\".",
1875                                    copy_name (yyvsp[0].ssym.stoken));
1876                         }
1877     break;
1878
1879   case 67:
1880 #line 563 "c-exp.y"
1881     {
1882                           yyval.bval = yyvsp[0].bval;
1883                         }
1884     break;
1885
1886   case 68:
1887 #line 569 "c-exp.y"
1888     { struct symbol *tem
1889                             = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1890                                              VAR_DOMAIN, (int *) NULL,
1891                                              (struct symtab **) NULL);
1892                           if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1893                             error ("No function \"%s\" in specified context.",
1894                                    copy_name (yyvsp[0].sval));
1895                           yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
1896     break;
1897
1898   case 69:
1899 #line 580 "c-exp.y"
1900     { struct symbol *sym;
1901                           sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1902                                                VAR_DOMAIN, (int *) NULL,
1903                                                (struct symtab **) NULL);
1904                           if (sym == 0)
1905                             error ("No symbol \"%s\" in specified context.",
1906                                    copy_name (yyvsp[0].sval));
1907
1908                           write_exp_elt_opcode (OP_VAR_VALUE);
1909                           /* block_found is set by lookup_symbol.  */
1910                           write_exp_elt_block (block_found);
1911                           write_exp_elt_sym (sym);
1912                           write_exp_elt_opcode (OP_VAR_VALUE); }
1913     break;
1914
1915   case 70:
1916 #line 596 "c-exp.y"
1917     {
1918                           struct type *type = yyvsp[-2].tval;
1919                           if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1920                               && TYPE_CODE (type) != TYPE_CODE_UNION
1921                               && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
1922                             error ("`%s' is not defined as an aggregate type.",
1923                                    TYPE_NAME (type));
1924
1925                           write_exp_elt_opcode (OP_SCOPE);
1926                           write_exp_elt_type (type);
1927                           write_exp_string (yyvsp[0].sval);
1928                           write_exp_elt_opcode (OP_SCOPE);
1929                         }
1930     break;
1931
1932   case 71:
1933 #line 610 "c-exp.y"
1934     {
1935                           struct type *type = yyvsp[-3].tval;
1936                           struct stoken tmp_token;
1937                           if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1938                               && TYPE_CODE (type) != TYPE_CODE_UNION
1939                               && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
1940                             error ("`%s' is not defined as an aggregate type.",
1941                                    TYPE_NAME (type));
1942
1943                           tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
1944                           tmp_token.length = yyvsp[0].sval.length + 1;
1945                           tmp_token.ptr[0] = '~';
1946                           memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
1947                           tmp_token.ptr[tmp_token.length] = 0;
1948
1949                           /* Check for valid destructor name.  */
1950                           destructor_name_p (tmp_token.ptr, type);
1951                           write_exp_elt_opcode (OP_SCOPE);
1952                           write_exp_elt_type (type);
1953                           write_exp_string (tmp_token);
1954                           write_exp_elt_opcode (OP_SCOPE);
1955                         }
1956     break;
1957
1958   case 73:
1959 #line 636 "c-exp.y"
1960     {
1961                           char *name = copy_name (yyvsp[0].sval);
1962                           struct symbol *sym;
1963                           struct minimal_symbol *msymbol;
1964
1965                           sym =
1966                             lookup_symbol (name, (const struct block *) NULL,
1967                                            VAR_DOMAIN, (int *) NULL,
1968                                            (struct symtab **) NULL);
1969                           if (sym)
1970                             {
1971                               write_exp_elt_opcode (OP_VAR_VALUE);
1972                               write_exp_elt_block (NULL);
1973                               write_exp_elt_sym (sym);
1974                               write_exp_elt_opcode (OP_VAR_VALUE);
1975                               break;
1976                             }
1977
1978                           msymbol = lookup_minimal_symbol (name, NULL, NULL);
1979                           if (msymbol != NULL)
1980                             {
1981                               write_exp_msymbol (msymbol,
1982                                                  lookup_function_type (builtin_type_int),
1983                                                  builtin_type_int);
1984                             }
1985                           else
1986                             if (!have_full_symbols () && !have_partial_symbols ())
1987                               error ("No symbol table is loaded.  Use the \"file\" command.");
1988                             else
1989                               error ("No symbol \"%s\" in current context.", name);
1990                         }
1991     break;
1992
1993   case 74:
1994 #line 670 "c-exp.y"
1995     { struct symbol *sym = yyvsp[0].ssym.sym;
1996
1997                           if (sym)
1998                             {
1999                               if (symbol_read_needs_frame (sym))
2000                                 {
2001                                   if (innermost_block == 0 ||
2002                                       contained_in (block_found, 
2003                                                     innermost_block))
2004                                     innermost_block = block_found;
2005                                 }
2006
2007                               write_exp_elt_opcode (OP_VAR_VALUE);
2008                               /* We want to use the selected frame, not
2009                                  another more inner frame which happens to
2010                                  be in the same block.  */
2011                               write_exp_elt_block (NULL);
2012                               write_exp_elt_sym (sym);
2013                               write_exp_elt_opcode (OP_VAR_VALUE);
2014                             }
2015                           else if (yyvsp[0].ssym.is_a_field_of_this)
2016                             {
2017                               /* C++: it hangs off of `this'.  Must
2018                                  not inadvertently convert from a method call
2019                                  to data ref.  */
2020                               if (innermost_block == 0 || 
2021                                   contained_in (block_found, innermost_block))
2022                                 innermost_block = block_found;
2023                               write_exp_elt_opcode (OP_THIS);
2024                               write_exp_elt_opcode (OP_THIS);
2025                               write_exp_elt_opcode (STRUCTOP_PTR);
2026                               write_exp_string (yyvsp[0].ssym.stoken);
2027                               write_exp_elt_opcode (STRUCTOP_PTR);
2028                             }
2029                           else
2030                             {
2031                               struct minimal_symbol *msymbol;
2032                               char *arg = copy_name (yyvsp[0].ssym.stoken);
2033
2034                               msymbol =
2035                                 lookup_minimal_symbol (arg, NULL, NULL);
2036                               if (msymbol != NULL)
2037                                 {
2038                                   write_exp_msymbol (msymbol,
2039                                                      lookup_function_type (builtin_type_int),
2040                                                      builtin_type_int);
2041                                 }
2042                               else if (!have_full_symbols () && !have_partial_symbols ())
2043                                 error ("No symbol table is loaded.  Use the \"file\" command.");
2044                               else
2045                                 error ("No symbol \"%s\" in current context.",
2046                                        copy_name (yyvsp[0].ssym.stoken));
2047                             }
2048                         }
2049     break;
2050
2051   case 75:
2052 #line 727 "c-exp.y"
2053     { push_type_address_space (copy_name (yyvsp[0].ssym.stoken));
2054                   push_type (tp_space_identifier);
2055                 }
2056     break;
2057
2058   case 83:
2059 #line 749 "c-exp.y"
2060     { push_type (tp_pointer); yyval.voidval = 0; }
2061     break;
2062
2063   case 84:
2064 #line 751 "c-exp.y"
2065     { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
2066     break;
2067
2068   case 85:
2069 #line 753 "c-exp.y"
2070     { push_type (tp_reference); yyval.voidval = 0; }
2071     break;
2072
2073   case 86:
2074 #line 755 "c-exp.y"
2075     { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
2076     break;
2077
2078   case 88:
2079 #line 760 "c-exp.y"
2080     { yyval.voidval = yyvsp[-1].voidval; }
2081     break;
2082
2083   case 89:
2084 #line 762 "c-exp.y"
2085     {
2086                           push_type_int (yyvsp[0].lval);
2087                           push_type (tp_array);
2088                         }
2089     break;
2090
2091   case 90:
2092 #line 767 "c-exp.y"
2093     {
2094                           push_type_int (yyvsp[0].lval);
2095                           push_type (tp_array);
2096                           yyval.voidval = 0;
2097                         }
2098     break;
2099
2100   case 91:
2101 #line 774 "c-exp.y"
2102     { push_type (tp_function); }
2103     break;
2104
2105   case 92:
2106 #line 776 "c-exp.y"
2107     { push_type (tp_function); }
2108     break;
2109
2110   case 93:
2111 #line 780 "c-exp.y"
2112     { yyval.lval = -1; }
2113     break;
2114
2115   case 94:
2116 #line 782 "c-exp.y"
2117     { yyval.lval = yyvsp[-1].typed_val_int.val; }
2118     break;
2119
2120   case 95:
2121 #line 786 "c-exp.y"
2122     { yyval.voidval = 0; }
2123     break;
2124
2125   case 96:
2126 #line 788 "c-exp.y"
2127     { free (yyvsp[-1].tvec); yyval.voidval = 0; }
2128     break;
2129
2130   case 98:
2131 #line 801 "c-exp.y"
2132     { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); }
2133     break;
2134
2135   case 99:
2136 #line 806 "c-exp.y"
2137     { yyval.tval = yyvsp[0].tsym.type; }
2138     break;
2139
2140   case 100:
2141 #line 808 "c-exp.y"
2142     { yyval.tval = builtin_type_int; }
2143     break;
2144
2145   case 101:
2146 #line 810 "c-exp.y"
2147     { yyval.tval = builtin_type_long; }
2148     break;
2149
2150   case 102:
2151 #line 812 "c-exp.y"
2152     { yyval.tval = builtin_type_short; }
2153     break;
2154
2155   case 103:
2156 #line 814 "c-exp.y"
2157     { yyval.tval = builtin_type_long; }
2158     break;
2159
2160   case 104:
2161 #line 816 "c-exp.y"
2162     { yyval.tval = builtin_type_long; }
2163     break;
2164
2165   case 105:
2166 #line 818 "c-exp.y"
2167     { yyval.tval = builtin_type_long; }
2168     break;
2169
2170   case 106:
2171 #line 820 "c-exp.y"
2172     { yyval.tval = builtin_type_long; }
2173     break;
2174
2175   case 107:
2176 #line 822 "c-exp.y"
2177     { yyval.tval = builtin_type_unsigned_long; }
2178     break;
2179
2180   case 108:
2181 #line 824 "c-exp.y"
2182     { yyval.tval = builtin_type_unsigned_long; }
2183     break;
2184
2185   case 109:
2186 #line 826 "c-exp.y"
2187     { yyval.tval = builtin_type_unsigned_long; }
2188     break;
2189
2190   case 110:
2191 #line 828 "c-exp.y"
2192     { yyval.tval = builtin_type_long_long; }
2193     break;
2194
2195   case 111:
2196 #line 830 "c-exp.y"
2197     { yyval.tval = builtin_type_long_long; }
2198     break;
2199
2200   case 112:
2201 #line 832 "c-exp.y"
2202     { yyval.tval = builtin_type_long_long; }
2203     break;
2204
2205   case 113:
2206 #line 834 "c-exp.y"
2207     { yyval.tval = builtin_type_long_long; }
2208     break;
2209
2210   case 114:
2211 #line 836 "c-exp.y"
2212     { yyval.tval = builtin_type_long_long; }
2213     break;
2214
2215   case 115:
2216 #line 838 "c-exp.y"
2217     { yyval.tval = builtin_type_long_long; }
2218     break;
2219
2220   case 116:
2221 #line 840 "c-exp.y"
2222     { yyval.tval = builtin_type_unsigned_long_long; }
2223     break;
2224
2225   case 117:
2226 #line 842 "c-exp.y"
2227     { yyval.tval = builtin_type_unsigned_long_long; }
2228     break;
2229
2230   case 118:
2231 #line 844 "c-exp.y"
2232     { yyval.tval = builtin_type_unsigned_long_long; }
2233     break;
2234
2235   case 119:
2236 #line 846 "c-exp.y"
2237     { yyval.tval = builtin_type_unsigned_long_long; }
2238     break;
2239
2240   case 120:
2241 #line 848 "c-exp.y"
2242     { yyval.tval = builtin_type_short; }
2243     break;
2244
2245   case 121:
2246 #line 850 "c-exp.y"
2247     { yyval.tval = builtin_type_short; }
2248     break;
2249
2250   case 122:
2251 #line 852 "c-exp.y"
2252     { yyval.tval = builtin_type_short; }
2253     break;
2254
2255   case 123:
2256 #line 854 "c-exp.y"
2257     { yyval.tval = builtin_type_unsigned_short; }
2258     break;
2259
2260   case 124:
2261 #line 856 "c-exp.y"
2262     { yyval.tval = builtin_type_unsigned_short; }
2263     break;
2264
2265   case 125:
2266 #line 858 "c-exp.y"
2267     { yyval.tval = builtin_type_unsigned_short; }
2268     break;
2269
2270   case 126:
2271 #line 860 "c-exp.y"
2272     { yyval.tval = builtin_type_double; }
2273     break;
2274
2275   case 127:
2276 #line 862 "c-exp.y"
2277     { yyval.tval = builtin_type_long_double; }
2278     break;
2279
2280   case 128:
2281 #line 864 "c-exp.y"
2282     { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2283                                               expression_context_block); }
2284     break;
2285
2286   case 129:
2287 #line 867 "c-exp.y"
2288     { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2289                                               expression_context_block); }
2290     break;
2291
2292   case 130:
2293 #line 870 "c-exp.y"
2294     { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
2295                                              expression_context_block); }
2296     break;
2297
2298   case 131:
2299 #line 873 "c-exp.y"
2300     { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
2301                                             expression_context_block); }
2302     break;
2303
2304   case 132:
2305 #line 876 "c-exp.y"
2306     { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
2307     break;
2308
2309   case 133:
2310 #line 878 "c-exp.y"
2311     { yyval.tval = builtin_type_unsigned_int; }
2312     break;
2313
2314   case 134:
2315 #line 880 "c-exp.y"
2316     { yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
2317     break;
2318
2319   case 135:
2320 #line 882 "c-exp.y"
2321     { yyval.tval = builtin_type_int; }
2322     break;
2323
2324   case 136:
2325 #line 887 "c-exp.y"
2326     { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
2327                                                     expression_context_block);
2328                         }
2329     break;
2330
2331   case 137:
2332 #line 891 "c-exp.y"
2333     { yyval.tval = follow_types (yyvsp[0].tval); }
2334     break;
2335
2336   case 138:
2337 #line 893 "c-exp.y"
2338     { yyval.tval = follow_types (yyvsp[-1].tval); }
2339     break;
2340
2341   case 140:
2342 #line 943 "c-exp.y"
2343     {
2344                   struct type *type = yyvsp[-2].tval;
2345                   struct type *new_type;
2346                   char *ncopy = alloca (yyvsp[0].sval.length + 1);
2347
2348                   memcpy (ncopy, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
2349                   ncopy[yyvsp[0].sval.length] = '\0';
2350
2351                   if (TYPE_CODE (type) != TYPE_CODE_STRUCT
2352                       && TYPE_CODE (type) != TYPE_CODE_UNION
2353                       && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
2354                     error ("`%s' is not defined as an aggregate type.",
2355                            TYPE_NAME (type));
2356
2357                   new_type = cp_lookup_nested_type (type, ncopy,
2358                                                     expression_context_block);
2359                   if (new_type == NULL)
2360                     error ("No type \"%s\" within class or namespace \"%s\".",
2361                            ncopy, TYPE_NAME (type));
2362                   
2363                   yyval.tval = new_type;
2364                 }
2365     break;
2366
2367   case 142:
2368 #line 969 "c-exp.y"
2369     {
2370                   yyval.tsym.stoken.ptr = "int";
2371                   yyval.tsym.stoken.length = 3;
2372                   yyval.tsym.type = builtin_type_int;
2373                 }
2374     break;
2375
2376   case 143:
2377 #line 975 "c-exp.y"
2378     {
2379                   yyval.tsym.stoken.ptr = "long";
2380                   yyval.tsym.stoken.length = 4;
2381                   yyval.tsym.type = builtin_type_long;
2382                 }
2383     break;
2384
2385   case 144:
2386 #line 981 "c-exp.y"
2387     {
2388                   yyval.tsym.stoken.ptr = "short";
2389                   yyval.tsym.stoken.length = 5;
2390                   yyval.tsym.type = builtin_type_short;
2391                 }
2392     break;
2393
2394   case 145:
2395 #line 990 "c-exp.y"
2396     { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
2397                   yyval.ivec[0] = 1;    /* Number of types in vector */
2398                   yyval.tvec[1] = yyvsp[0].tval;
2399                 }
2400     break;
2401
2402   case 146:
2403 #line 995 "c-exp.y"
2404     { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
2405                   yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
2406                   yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
2407                 }
2408     break;
2409
2410   case 148:
2411 #line 1003 "c-exp.y"
2412     { yyval.tval = follow_types (yyvsp[-3].tval); }
2413     break;
2414
2415   case 151:
2416 #line 1011 "c-exp.y"
2417     { push_type (tp_const);
2418                           push_type (tp_volatile); 
2419                         }
2420     break;
2421
2422   case 152:
2423 #line 1015 "c-exp.y"
2424     { push_type (tp_const); }
2425     break;
2426
2427   case 153:
2428 #line 1017 "c-exp.y"
2429     { push_type (tp_volatile); }
2430     break;
2431
2432   case 154:
2433 #line 1020 "c-exp.y"
2434     { yyval.sval = yyvsp[0].ssym.stoken; }
2435     break;
2436
2437   case 155:
2438 #line 1021 "c-exp.y"
2439     { yyval.sval = yyvsp[0].ssym.stoken; }
2440     break;
2441
2442   case 156:
2443 #line 1022 "c-exp.y"
2444     { yyval.sval = yyvsp[0].tsym.stoken; }
2445     break;
2446
2447   case 157:
2448 #line 1023 "c-exp.y"
2449     { yyval.sval = yyvsp[0].ssym.stoken; }
2450     break;
2451
2452
2453     }
2454
2455 /* Line 991 of yacc.c.  */
2456 \f
2457   yyvsp -= yylen;
2458   yyssp -= yylen;
2459
2460
2461   YY_STACK_PRINT (yyss, yyssp);
2462
2463   *++yyvsp = yyval;
2464
2465
2466   /* Now `shift' the result of the reduction.  Determine what state
2467      that goes to, based on the state we popped back to and the rule
2468      number reduced by.  */
2469
2470   yyn = yyr1[yyn];
2471
2472   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2473   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2474     yystate = yytable[yystate];
2475   else
2476     yystate = yydefgoto[yyn - YYNTOKENS];
2477
2478   goto yynewstate;
2479
2480
2481 /*------------------------------------.
2482 | yyerrlab -- here on detecting error |
2483 `------------------------------------*/
2484 yyerrlab:
2485   /* If not already recovering from an error, report this error.  */
2486   if (!yyerrstatus)
2487     {
2488       ++yynerrs;
2489 #if YYERROR_VERBOSE
2490       yyn = yypact[yystate];
2491
2492       if (YYPACT_NINF < yyn && yyn < YYLAST)
2493         {
2494           YYSIZE_T yysize = 0;
2495           int yytype = YYTRANSLATE (yychar);
2496           char *yymsg;
2497           int yyx, yycount;
2498
2499           yycount = 0;
2500           /* Start YYX at -YYN if negative to avoid negative indexes in
2501              YYCHECK.  */
2502           for (yyx = yyn < 0 ? -yyn : 0;
2503                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2504             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2505               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2506           yysize += yystrlen ("syntax error, unexpected ") + 1;
2507           yysize += yystrlen (yytname[yytype]);
2508           yymsg = (char *) YYSTACK_ALLOC (yysize);
2509           if (yymsg != 0)
2510             {
2511               char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2512               yyp = yystpcpy (yyp, yytname[yytype]);
2513
2514               if (yycount < 5)
2515                 {
2516                   yycount = 0;
2517                   for (yyx = yyn < 0 ? -yyn : 0;
2518                        yyx < (int) (sizeof (yytname) / sizeof (char *));
2519                        yyx++)
2520                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2521                       {
2522                         const char *yyq = ! yycount ? ", expecting " : " or ";
2523                         yyp = yystpcpy (yyp, yyq);
2524                         yyp = yystpcpy (yyp, yytname[yyx]);
2525                         yycount++;
2526                       }
2527                 }
2528               yyerror (yymsg);
2529               YYSTACK_FREE (yymsg);
2530             }
2531           else
2532             yyerror ("syntax error; also virtual memory exhausted");
2533         }
2534       else
2535 #endif /* YYERROR_VERBOSE */
2536         yyerror ("syntax error");
2537     }
2538
2539
2540
2541   if (yyerrstatus == 3)
2542     {
2543       /* If just tried and failed to reuse lookahead token after an
2544          error, discard it.  */
2545
2546       /* Return failure if at end of input.  */
2547       if (yychar == YYEOF)
2548         {
2549           /* Pop the error token.  */
2550           YYPOPSTACK;
2551           /* Pop the rest of the stack.  */
2552           while (yyss < yyssp)
2553             {
2554               YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2555               yydestruct (yystos[*yyssp], yyvsp);
2556               YYPOPSTACK;
2557             }
2558           YYABORT;
2559         }
2560
2561       YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2562       yydestruct (yytoken, &yylval);
2563       yychar = YYEMPTY;
2564
2565     }
2566
2567   /* Else will try to reuse lookahead token after shifting the error
2568      token.  */
2569   goto yyerrlab2;
2570
2571
2572 /*----------------------------------------------------.
2573 | yyerrlab1 -- error raised explicitly by an action.  |
2574 `----------------------------------------------------*/
2575 yyerrlab1:
2576
2577   /* Suppress GCC warning that yyerrlab1 is unused when no action
2578      invokes YYERROR.  Doesn't work in C++ */
2579 #ifndef __cplusplus
2580 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
2581   __attribute__ ((__unused__))
2582 #endif
2583 #endif
2584
2585
2586   goto yyerrlab2;
2587
2588
2589 /*---------------------------------------------------------------.
2590 | yyerrlab2 -- pop states until the error token can be shifted.  |
2591 `---------------------------------------------------------------*/
2592 yyerrlab2:
2593   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2594
2595   for (;;)
2596     {
2597       yyn = yypact[yystate];
2598       if (yyn != YYPACT_NINF)
2599         {
2600           yyn += YYTERROR;
2601           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2602             {
2603               yyn = yytable[yyn];
2604               if (0 < yyn)
2605                 break;
2606             }
2607         }
2608
2609       /* Pop the current state because it cannot handle the error token.  */
2610       if (yyssp == yyss)
2611         YYABORT;
2612
2613       YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2614       yydestruct (yystos[yystate], yyvsp);
2615       yyvsp--;
2616       yystate = *--yyssp;
2617
2618       YY_STACK_PRINT (yyss, yyssp);
2619     }
2620
2621   if (yyn == YYFINAL)
2622     YYACCEPT;
2623
2624   YYDPRINTF ((stderr, "Shifting error token, "));
2625
2626   *++yyvsp = yylval;
2627
2628
2629   yystate = yyn;
2630   goto yynewstate;
2631
2632
2633 /*-------------------------------------.
2634 | yyacceptlab -- YYACCEPT comes here.  |
2635 `-------------------------------------*/
2636 yyacceptlab:
2637   yyresult = 0;
2638   goto yyreturn;
2639
2640 /*-----------------------------------.
2641 | yyabortlab -- YYABORT comes here.  |
2642 `-----------------------------------*/
2643 yyabortlab:
2644   yyresult = 1;
2645   goto yyreturn;
2646
2647 #ifndef yyoverflow
2648 /*----------------------------------------------.
2649 | yyoverflowlab -- parser overflow comes here.  |
2650 `----------------------------------------------*/
2651 yyoverflowlab:
2652   yyerror ("parser stack overflow");
2653   yyresult = 2;
2654   /* Fall through.  */
2655 #endif
2656
2657 yyreturn:
2658 #ifndef yyoverflow
2659   if (yyss != yyssa)
2660     YYSTACK_FREE (yyss);
2661 #endif
2662   return yyresult;
2663 }
2664
2665
2666 #line 1037 "c-exp.y"
2667
2668
2669 /* Take care of parsing a number (anything that starts with a digit).
2670    Set yylval and return the token type; update lexptr.
2671    LEN is the number of characters in it.  */
2672
2673 /*** Needs some error checking for the float case ***/
2674
2675 static int
2676 parse_number (p, len, parsed_float, putithere)
2677      char *p;
2678      int len;
2679      int parsed_float;
2680      YYSTYPE *putithere;
2681 {
2682   /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
2683      here, and we do kind of silly things like cast to unsigned.  */
2684   LONGEST n = 0;
2685   LONGEST prevn = 0;
2686   ULONGEST un;
2687
2688   int i = 0;
2689   int c;
2690   int base = input_radix;
2691   int unsigned_p = 0;
2692
2693   /* Number of "L" suffixes encountered.  */
2694   int long_p = 0;
2695
2696   /* We have found a "L" or "U" suffix.  */
2697   int found_suffix = 0;
2698
2699   ULONGEST high_bit;
2700   struct type *signed_type;
2701   struct type *unsigned_type;
2702
2703   if (parsed_float)
2704     {
2705       /* It's a float since it contains a point or an exponent.  */
2706       char c;
2707       int num = 0;      /* number of tokens scanned by scanf */
2708       char saved_char = p[len];
2709
2710       p[len] = 0;       /* null-terminate the token */
2711       if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
2712         num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
2713       else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2714         num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
2715       else
2716         {
2717 #ifdef SCANF_HAS_LONG_DOUBLE
2718           num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
2719 #else
2720           /* Scan it into a double, then assign it to the long double.
2721              This at least wins with values representable in the range
2722              of doubles. */
2723           double temp;
2724           num = sscanf (p, "%lg%c", &temp,&c);
2725           putithere->typed_val_float.dval = temp;
2726 #endif
2727         }
2728       p[len] = saved_char;      /* restore the input stream */
2729       if (num != 1)             /* check scanf found ONLY a float ... */
2730         return ERROR;
2731       /* See if it has `f' or `l' suffix (float or long double).  */
2732
2733       c = tolower (p[len - 1]);
2734
2735       if (c == 'f')
2736         putithere->typed_val_float.type = builtin_type_float;
2737       else if (c == 'l')
2738         putithere->typed_val_float.type = builtin_type_long_double;
2739       else if (isdigit (c) || c == '.')
2740         putithere->typed_val_float.type = builtin_type_double;
2741       else
2742         return ERROR;
2743
2744       return FLOAT;
2745     }
2746
2747   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2748   if (p[0] == '0')
2749     switch (p[1])
2750       {
2751       case 'x':
2752       case 'X':
2753         if (len >= 3)
2754           {
2755             p += 2;
2756             base = 16;
2757             len -= 2;
2758           }
2759         break;
2760
2761       case 't':
2762       case 'T':
2763       case 'd':
2764       case 'D':
2765         if (len >= 3)
2766           {
2767             p += 2;
2768             base = 10;
2769             len -= 2;
2770           }
2771         break;
2772
2773       default:
2774         base = 8;
2775         break;
2776       }
2777
2778   while (len-- > 0)
2779     {
2780       c = *p++;
2781       if (c >= 'A' && c <= 'Z')
2782         c += 'a' - 'A';
2783       if (c != 'l' && c != 'u')
2784         n *= base;
2785       if (c >= '0' && c <= '9')
2786         {
2787           if (found_suffix)
2788             return ERROR;
2789           n += i = c - '0';
2790         }
2791       else
2792         {
2793           if (base > 10 && c >= 'a' && c <= 'f')
2794             {
2795               if (found_suffix)
2796                 return ERROR;
2797               n += i = c - 'a' + 10;
2798             }
2799           else if (c == 'l')
2800             {
2801               ++long_p;
2802               found_suffix = 1;
2803             }
2804           else if (c == 'u')
2805             {
2806               unsigned_p = 1;
2807               found_suffix = 1;
2808             }
2809           else
2810             return ERROR;       /* Char not a digit */
2811         }
2812       if (i >= base)
2813         return ERROR;           /* Invalid digit in this base */
2814
2815       /* Portably test for overflow (only works for nonzero values, so make
2816          a second check for zero).  FIXME: Can't we just make n and prevn
2817          unsigned and avoid this?  */
2818       if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2819         unsigned_p = 1;         /* Try something unsigned */
2820
2821       /* Portably test for unsigned overflow.
2822          FIXME: This check is wrong; for example it doesn't find overflow
2823          on 0x123456789 when LONGEST is 32 bits.  */
2824       if (c != 'l' && c != 'u' && n != 0)
2825         {       
2826           if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2827             error ("Numeric constant too large.");
2828         }
2829       prevn = n;
2830     }
2831
2832   /* An integer constant is an int, a long, or a long long.  An L
2833      suffix forces it to be long; an LL suffix forces it to be long
2834      long.  If not forced to a larger size, it gets the first type of
2835      the above that it fits in.  To figure out whether it fits, we
2836      shift it right and see whether anything remains.  Note that we
2837      can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2838      operation, because many compilers will warn about such a shift
2839      (which always produces a zero result).  Sometimes TARGET_INT_BIT
2840      or TARGET_LONG_BIT will be that big, sometimes not.  To deal with
2841      the case where it is we just always shift the value more than
2842      once, with fewer bits each time.  */
2843
2844   un = (ULONGEST)n >> 2;
2845   if (long_p == 0
2846       && (un >> (TARGET_INT_BIT - 2)) == 0)
2847     {
2848       high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2849
2850       /* A large decimal (not hex or octal) constant (between INT_MAX
2851          and UINT_MAX) is a long or unsigned long, according to ANSI,
2852          never an unsigned int, but this code treats it as unsigned
2853          int.  This probably should be fixed.  GCC gives a warning on
2854          such constants.  */
2855
2856       unsigned_type = builtin_type_unsigned_int;
2857       signed_type = builtin_type_int;
2858     }
2859   else if (long_p <= 1
2860            && (un >> (TARGET_LONG_BIT - 2)) == 0)
2861     {
2862       high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2863       unsigned_type = builtin_type_unsigned_long;
2864       signed_type = builtin_type_long;
2865     }
2866   else
2867     {
2868       int shift;
2869       if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT)
2870         /* A long long does not fit in a LONGEST.  */
2871         shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2872       else
2873         shift = (TARGET_LONG_LONG_BIT - 1);
2874       high_bit = (ULONGEST) 1 << shift;
2875       unsigned_type = builtin_type_unsigned_long_long;
2876       signed_type = builtin_type_long_long;
2877     }
2878
2879    putithere->typed_val_int.val = n;
2880
2881    /* If the high bit of the worked out type is set then this number
2882       has to be unsigned. */
2883
2884    if (unsigned_p || (n & high_bit)) 
2885      {
2886        putithere->typed_val_int.type = unsigned_type;
2887      }
2888    else 
2889      {
2890        putithere->typed_val_int.type = signed_type;
2891      }
2892
2893    return INT;
2894 }
2895
2896 struct token
2897 {
2898   char *operator;
2899   int token;
2900   enum exp_opcode opcode;
2901 };
2902
2903 static const struct token tokentab3[] =
2904   {
2905     {">>=", ASSIGN_MODIFY, BINOP_RSH},
2906     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2907   };
2908
2909 static const struct token tokentab2[] =
2910   {
2911     {"+=", ASSIGN_MODIFY, BINOP_ADD},
2912     {"-=", ASSIGN_MODIFY, BINOP_SUB},
2913     {"*=", ASSIGN_MODIFY, BINOP_MUL},
2914     {"/=", ASSIGN_MODIFY, BINOP_DIV},
2915     {"%=", ASSIGN_MODIFY, BINOP_REM},
2916     {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2917     {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2918     {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2919     {"++", INCREMENT, BINOP_END},
2920     {"--", DECREMENT, BINOP_END},
2921     {"->", ARROW, BINOP_END},
2922     {"&&", ANDAND, BINOP_END},
2923     {"||", OROR, BINOP_END},
2924     {"::", COLONCOLON, BINOP_END},
2925     {"<<", LSH, BINOP_END},
2926     {">>", RSH, BINOP_END},
2927     {"==", EQUAL, BINOP_END},
2928     {"!=", NOTEQUAL, BINOP_END},
2929     {"<=", LEQ, BINOP_END},
2930     {">=", GEQ, BINOP_END}
2931   };
2932
2933 /* Read one token, getting characters through lexptr.  */
2934
2935 static int
2936 yylex ()
2937 {
2938   int c;
2939   int namelen;
2940   unsigned int i;
2941   char *tokstart;
2942   char *tokptr;
2943   int tempbufindex;
2944   static char *tempbuf;
2945   static int tempbufsize;
2946   struct symbol * sym_class = NULL;
2947   char * token_string = NULL;
2948   int class_prefix = 0;
2949   int unquoted_expr;
2950    
2951  retry:
2952
2953   /* Check if this is a macro invocation that we need to expand.  */
2954   if (! scanning_macro_expansion ())
2955     {
2956       char *expanded = macro_expand_next (&lexptr,
2957                                           expression_macro_lookup_func,
2958                                           expression_macro_lookup_baton);
2959
2960       if (expanded)
2961         scan_macro_expansion (expanded);
2962     }
2963
2964   prev_lexptr = lexptr;
2965   unquoted_expr = 1;
2966
2967   tokstart = lexptr;
2968   /* See if it is a special token of length 3.  */
2969   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2970     if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2971       {
2972         lexptr += 3;
2973         yylval.opcode = tokentab3[i].opcode;
2974         return tokentab3[i].token;
2975       }
2976
2977   /* See if it is a special token of length 2.  */
2978   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2979     if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2980       {
2981         lexptr += 2;
2982         yylval.opcode = tokentab2[i].opcode;
2983         return tokentab2[i].token;
2984       }
2985
2986   switch (c = *tokstart)
2987     {
2988     case 0:
2989       /* If we were just scanning the result of a macro expansion,
2990          then we need to resume scanning the original text.
2991          Otherwise, we were already scanning the original text, and
2992          we're really done.  */
2993       if (scanning_macro_expansion ())
2994         {
2995           finished_macro_expansion ();
2996           goto retry;
2997         }
2998       else
2999         return 0;
3000
3001     case ' ':
3002     case '\t':
3003     case '\n':
3004       lexptr++;
3005       goto retry;
3006
3007     case '\'':
3008       /* We either have a character constant ('0' or '\177' for example)
3009          or we have a quoted symbol reference ('foo(int,int)' in C++
3010          for example). */
3011       lexptr++;
3012       c = *lexptr++;
3013       if (c == '\\')
3014         c = parse_escape (&lexptr);
3015       else if (c == '\'')
3016         error ("Empty character constant.");
3017       else if (! host_char_to_target (c, &c))
3018         {
3019           int toklen = lexptr - tokstart + 1;
3020           char *tok = alloca (toklen + 1);
3021           memcpy (tok, tokstart, toklen);
3022           tok[toklen] = '\0';
3023           error ("There is no character corresponding to %s in the target "
3024                  "character set `%s'.", tok, target_charset ());
3025         }
3026
3027       yylval.typed_val_int.val = c;
3028       yylval.typed_val_int.type = builtin_type_char;
3029
3030       c = *lexptr++;
3031       if (c != '\'')
3032         {
3033           namelen = skip_quoted (tokstart) - tokstart;
3034           if (namelen > 2)
3035             {
3036               lexptr = tokstart + namelen;
3037               unquoted_expr = 0;
3038               if (lexptr[-1] != '\'')
3039                 error ("Unmatched single quote.");
3040               namelen -= 2;
3041               tokstart++;
3042               goto tryname;
3043             }
3044           error ("Invalid character constant.");
3045         }
3046       return INT;
3047
3048     case '(':
3049       paren_depth++;
3050       lexptr++;
3051       return c;
3052
3053     case ')':
3054       if (paren_depth == 0)
3055         return 0;
3056       paren_depth--;
3057       lexptr++;
3058       return c;
3059
3060     case ',':
3061       if (comma_terminates
3062           && paren_depth == 0
3063           && ! scanning_macro_expansion ())
3064         return 0;
3065       lexptr++;
3066       return c;
3067
3068     case '.':
3069       /* Might be a floating point number.  */
3070       if (lexptr[1] < '0' || lexptr[1] > '9')
3071         goto symbol;            /* Nope, must be a symbol. */
3072       /* FALL THRU into number case.  */
3073
3074     case '0':
3075     case '1':
3076     case '2':
3077     case '3':
3078     case '4':
3079     case '5':
3080     case '6':
3081     case '7':
3082     case '8':
3083     case '9':
3084       {
3085         /* It's a number.  */
3086         int got_dot = 0, got_e = 0, toktype;
3087         char *p = tokstart;
3088         int hex = input_radix > 10;
3089
3090         if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
3091           {
3092             p += 2;
3093             hex = 1;
3094           }
3095         else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
3096           {
3097             p += 2;
3098             hex = 0;
3099           }
3100
3101         for (;; ++p)
3102           {
3103             /* This test includes !hex because 'e' is a valid hex digit
3104                and thus does not indicate a floating point number when
3105                the radix is hex.  */
3106             if (!hex && !got_e && (*p == 'e' || *p == 'E'))
3107               got_dot = got_e = 1;
3108             /* This test does not include !hex, because a '.' always indicates
3109                a decimal floating point number regardless of the radix.  */
3110             else if (!got_dot && *p == '.')
3111               got_dot = 1;
3112             else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
3113                      && (*p == '-' || *p == '+'))
3114               /* This is the sign of the exponent, not the end of the
3115                  number.  */
3116               continue;
3117             /* We will take any letters or digits.  parse_number will
3118                complain if past the radix, or if L or U are not final.  */
3119             else if ((*p < '0' || *p > '9')
3120                      && ((*p < 'a' || *p > 'z')
3121                                   && (*p < 'A' || *p > 'Z')))
3122               break;
3123           }
3124         toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
3125         if (toktype == ERROR)
3126           {
3127             char *err_copy = (char *) alloca (p - tokstart + 1);
3128
3129             memcpy (err_copy, tokstart, p - tokstart);
3130             err_copy[p - tokstart] = 0;
3131             error ("Invalid number \"%s\".", err_copy);
3132           }
3133         lexptr = p;
3134         return toktype;
3135       }
3136
3137     case '+':
3138     case '-':
3139     case '*':
3140     case '/':
3141     case '%':
3142     case '|':
3143     case '&':
3144     case '^':
3145     case '~':
3146     case '!':
3147     case '@':
3148     case '<':
3149     case '>':
3150     case '[':
3151     case ']':
3152     case '?':
3153     case ':':
3154     case '=':
3155     case '{':
3156     case '}':
3157     symbol:
3158       lexptr++;
3159       return c;
3160
3161     case '"':
3162
3163       /* Build the gdb internal form of the input string in tempbuf,
3164          translating any standard C escape forms seen.  Note that the
3165          buffer is null byte terminated *only* for the convenience of
3166          debugging gdb itself and printing the buffer contents when
3167          the buffer contains no embedded nulls.  Gdb does not depend
3168          upon the buffer being null byte terminated, it uses the length
3169          string instead.  This allows gdb to handle C strings (as well
3170          as strings in other languages) with embedded null bytes */
3171
3172       tokptr = ++tokstart;
3173       tempbufindex = 0;
3174
3175       do {
3176         char *char_start_pos = tokptr;
3177
3178         /* Grow the static temp buffer if necessary, including allocating
3179            the first one on demand. */
3180         if (tempbufindex + 1 >= tempbufsize)
3181           {
3182             tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
3183           }
3184         switch (*tokptr)
3185           {
3186           case '\0':
3187           case '"':
3188             /* Do nothing, loop will terminate. */
3189             break;
3190           case '\\':
3191             tokptr++;
3192             c = parse_escape (&tokptr);
3193             if (c == -1)
3194               {
3195                 continue;
3196               }
3197             tempbuf[tempbufindex++] = c;
3198             break;
3199           default:
3200             c = *tokptr++;
3201             if (! host_char_to_target (c, &c))
3202               {
3203                 int len = tokptr - char_start_pos;
3204                 char *copy = alloca (len + 1);
3205                 memcpy (copy, char_start_pos, len);
3206                 copy[len] = '\0';
3207
3208                 error ("There is no character corresponding to `%s' "
3209                        "in the target character set `%s'.",
3210                        copy, target_charset ());
3211               }
3212             tempbuf[tempbufindex++] = c;
3213             break;
3214           }
3215       } while ((*tokptr != '"') && (*tokptr != '\0'));
3216       if (*tokptr++ != '"')
3217         {
3218           error ("Unterminated string in expression.");
3219         }
3220       tempbuf[tempbufindex] = '\0';     /* See note above */
3221       yylval.sval.ptr = tempbuf;
3222       yylval.sval.length = tempbufindex;
3223       lexptr = tokptr;
3224       return (STRING);
3225     }
3226
3227   if (!(c == '_' || c == '$'
3228         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
3229     /* We must have come across a bad character (e.g. ';').  */
3230     error ("Invalid character '%c' in expression.", c);
3231
3232   /* It's a name.  See how long it is.  */
3233   namelen = 0;
3234   for (c = tokstart[namelen];
3235        (c == '_' || c == '$' || (c >= '0' && c <= '9')
3236         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
3237     {
3238       /* Template parameter lists are part of the name.
3239          FIXME: This mishandles `print $a<4&&$a>3'.  */
3240
3241       if (c == '<')
3242         { 
3243                /* Scan ahead to get rest of the template specification.  Note
3244                   that we look ahead only when the '<' adjoins non-whitespace
3245                   characters; for comparison expressions, e.g. "a < b > c",
3246                   there must be spaces before the '<', etc. */
3247                
3248                char * p = find_template_name_end (tokstart + namelen);
3249                if (p)
3250                  namelen = p - tokstart;
3251                break;
3252         }
3253       c = tokstart[++namelen];
3254     }
3255
3256   /* The token "if" terminates the expression and is NOT removed from
3257      the input stream.  It doesn't count if it appears in the
3258      expansion of a macro.  */
3259   if (namelen == 2
3260       && tokstart[0] == 'i'
3261       && tokstart[1] == 'f'
3262       && ! scanning_macro_expansion ())
3263     {
3264       return 0;
3265     }
3266
3267   lexptr += namelen;
3268
3269   tryname:
3270
3271   /* Catch specific keywords.  Should be done with a data structure.  */
3272   switch (namelen)
3273     {
3274     case 8:
3275       if (strncmp (tokstart, "unsigned", 8) == 0)
3276         return UNSIGNED;
3277       if (current_language->la_language == language_cplus
3278           && strncmp (tokstart, "template", 8) == 0)
3279         return TEMPLATE;
3280       if (strncmp (tokstart, "volatile", 8) == 0)
3281         return VOLATILE_KEYWORD;
3282       break;
3283     case 6:
3284       if (strncmp (tokstart, "struct", 6) == 0)
3285         return STRUCT;
3286       if (strncmp (tokstart, "signed", 6) == 0)
3287         return SIGNED_KEYWORD;
3288       if (strncmp (tokstart, "sizeof", 6) == 0)
3289         return SIZEOF;
3290       if (strncmp (tokstart, "double", 6) == 0)
3291         return DOUBLE_KEYWORD;
3292       break;
3293     case 5:
3294       if (current_language->la_language == language_cplus)
3295         {
3296           if (strncmp (tokstart, "false", 5) == 0)
3297             return FALSEKEYWORD;
3298           if (strncmp (tokstart, "class", 5) == 0)
3299             return CLASS;
3300         }
3301       if (strncmp (tokstart, "union", 5) == 0)
3302         return UNION;
3303       if (strncmp (tokstart, "short", 5) == 0)
3304         return SHORT;
3305       if (strncmp (tokstart, "const", 5) == 0)
3306         return CONST_KEYWORD;
3307       break;
3308     case 4:
3309       if (strncmp (tokstart, "enum", 4) == 0)
3310         return ENUM;
3311       if (strncmp (tokstart, "long", 4) == 0)
3312         return LONG;
3313       if (current_language->la_language == language_cplus)
3314           {
3315             if (strncmp (tokstart, "true", 4) == 0)
3316               return TRUEKEYWORD;
3317           }
3318       break;
3319     case 3:
3320       if (strncmp (tokstart, "int", 3) == 0)
3321         return INT_KEYWORD;
3322       break;
3323     default:
3324       break;
3325     }
3326
3327   yylval.sval.ptr = tokstart;
3328   yylval.sval.length = namelen;
3329
3330   if (*tokstart == '$')
3331     {
3332       write_dollar_variable (yylval.sval);
3333       return VARIABLE;
3334     }
3335   
3336   /* Look ahead and see if we can consume more of the input
3337      string to get a reasonable class/namespace spec or a
3338      fully-qualified name.  This is a kludge to get around the
3339      HP aCC compiler's generation of symbol names with embedded
3340      colons for namespace and nested classes. */
3341
3342   /* NOTE: carlton/2003-09-24: I don't entirely understand the
3343      HP-specific code, either here or in linespec.  Having said that,
3344      I suspect that we're actually moving towards their model: we want
3345      symbols whose names are fully qualified, which matches the
3346      description above.  */
3347   if (unquoted_expr)
3348     {
3349       /* Only do it if not inside single quotes */ 
3350       sym_class = parse_nested_classes_for_hpacc (yylval.sval.ptr, yylval.sval.length,
3351                                                   &token_string, &class_prefix, &lexptr);
3352       if (sym_class)
3353         {
3354           /* Replace the current token with the bigger one we found */ 
3355           yylval.sval.ptr = token_string;
3356           yylval.sval.length = strlen (token_string);
3357         }
3358     }
3359   
3360   /* Use token-type BLOCKNAME for symbols that happen to be defined as
3361      functions or symtabs.  If this is not so, then ...
3362      Use token-type TYPENAME for symbols that happen to be defined
3363      currently as names of types; NAME for other symbols.
3364      The caller is not constrained to care about the distinction.  */
3365   {
3366     char *tmp = copy_name (yylval.sval);
3367     struct symbol *sym;
3368     int is_a_field_of_this = 0;
3369     int hextype;
3370
3371     sym = lookup_symbol (tmp, expression_context_block,
3372                          VAR_DOMAIN,
3373                          current_language->la_language == language_cplus
3374                          ? &is_a_field_of_this : (int *) NULL,
3375                          (struct symtab **) NULL);
3376     /* Call lookup_symtab, not lookup_partial_symtab, in case there are
3377        no psymtabs (coff, xcoff, or some future change to blow away the
3378        psymtabs once once symbols are read).  */
3379     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
3380       {
3381         yylval.ssym.sym = sym;
3382         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3383         return BLOCKNAME;
3384       }
3385     else if (!sym)
3386       {                         /* See if it's a file name. */
3387         struct symtab *symtab;
3388
3389         symtab = lookup_symtab (tmp);
3390
3391         if (symtab)
3392           {
3393             yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
3394             return FILENAME;
3395           }
3396       }
3397
3398     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
3399         {
3400           /* NOTE: carlton/2003-09-25: There used to be code here to
3401              handle nested types.  It didn't work very well.  See the
3402              comment before qualified_type for more info.  */
3403           yylval.tsym.type = SYMBOL_TYPE (sym);
3404           return TYPENAME;
3405         }
3406     if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
3407       return TYPENAME;
3408
3409     /* Input names that aren't symbols but ARE valid hex numbers,
3410        when the input radix permits them, can be names or numbers
3411        depending on the parse.  Note we support radixes > 16 here.  */
3412     if (!sym && 
3413         ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
3414          (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
3415       {
3416         YYSTYPE newlval;        /* Its value is ignored.  */
3417         hextype = parse_number (tokstart, namelen, 0, &newlval);
3418         if (hextype == INT)
3419           {
3420             yylval.ssym.sym = sym;
3421             yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3422             return NAME_OR_INT;
3423           }
3424       }
3425
3426     /* Any other kind of symbol */
3427     yylval.ssym.sym = sym;
3428     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3429     return NAME;
3430   }
3431 }
3432
3433 void
3434 yyerror (msg)
3435      char *msg;
3436 {
3437   if (prev_lexptr)
3438     lexptr = prev_lexptr;
3439
3440   error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
3441 }
3442
3443