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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [c-exp.c] - Blame information for rev 438

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

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

powered by: WebSVN 2.1.0

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