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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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