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

Subversion Repositories openrisc_me

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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