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

Subversion Repositories openrisc_me

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

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

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

powered by: WebSVN 2.1.0

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