OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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_LITERAL = 260,
59
     BOOLEAN_LITERAL = 261,
60
     NAME = 262,
61
     TYPENAME = 263,
62
     NAME_OR_INT = 264,
63
     SIZEOF = 265,
64
     ERROR = 266,
65
     INT_KEYWORD = 267,
66
     INT_S2_KEYWORD = 268,
67
     LOGICAL_S1_KEYWORD = 269,
68
     LOGICAL_S2_KEYWORD = 270,
69
     LOGICAL_KEYWORD = 271,
70
     REAL_KEYWORD = 272,
71
     REAL_S8_KEYWORD = 273,
72
     REAL_S16_KEYWORD = 274,
73
     COMPLEX_S8_KEYWORD = 275,
74
     COMPLEX_S16_KEYWORD = 276,
75
     COMPLEX_S32_KEYWORD = 277,
76
     BOOL_AND = 278,
77
     BOOL_OR = 279,
78
     BOOL_NOT = 280,
79
     CHARACTER = 281,
80
     VARIABLE = 282,
81
     ASSIGN_MODIFY = 283,
82
     ABOVE_COMMA = 284,
83
     NOTEQUAL = 285,
84
     EQUAL = 286,
85
     GEQ = 287,
86
     LEQ = 288,
87
     GREATERTHAN = 289,
88
     LESSTHAN = 290,
89
     RSH = 291,
90
     LSH = 292,
91
     STARSTAR = 293,
92
     UNARY = 294
93
   };
94
#endif
95
#define INT 258
96
#define FLOAT 259
97
#define STRING_LITERAL 260
98
#define BOOLEAN_LITERAL 261
99
#define NAME 262
100
#define TYPENAME 263
101
#define NAME_OR_INT 264
102
#define SIZEOF 265
103
#define ERROR 266
104
#define INT_KEYWORD 267
105
#define INT_S2_KEYWORD 268
106
#define LOGICAL_S1_KEYWORD 269
107
#define LOGICAL_S2_KEYWORD 270
108
#define LOGICAL_KEYWORD 271
109
#define REAL_KEYWORD 272
110
#define REAL_S8_KEYWORD 273
111
#define REAL_S16_KEYWORD 274
112
#define COMPLEX_S8_KEYWORD 275
113
#define COMPLEX_S16_KEYWORD 276
114
#define COMPLEX_S32_KEYWORD 277
115
#define BOOL_AND 278
116
#define BOOL_OR 279
117
#define BOOL_NOT 280
118
#define CHARACTER 281
119
#define VARIABLE 282
120
#define ASSIGN_MODIFY 283
121
#define ABOVE_COMMA 284
122
#define NOTEQUAL 285
123
#define EQUAL 286
124
#define GEQ 287
125
#define LEQ 288
126
#define GREATERTHAN 289
127
#define LESSTHAN 290
128
#define RSH 291
129
#define LSH 292
130
#define STARSTAR 293
131
#define UNARY 294
132
 
133
 
134
 
135
 
136
/* Copy the first part of user declarations.  */
137
#line 45 "f-exp.y"
138
 
139
 
140
#include "defs.h"
141
#include "gdb_string.h"
142
#include "expression.h"
143
#include "value.h"
144
#include "parser-defs.h"
145
#include "language.h"
146
#include "f-lang.h"
147
#include "bfd.h" /* Required by objfiles.h.  */
148
#include "symfile.h" /* Required by objfiles.h.  */
149
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
150
#include "block.h"
151
#include <ctype.h>
152
 
153
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
154
   as well as gratuitiously global symbol names, so we can have multiple
155
   yacc generated parsers in gdb.  Note that these are only the variables
156
   produced by yacc.  If other parser generators (bison, byacc, etc) produce
157
   additional global names that conflict at link time, then those parser
158
   generators need to be fixed instead of adding those names to this list. */
159
 
160
#define yymaxdepth f_maxdepth
161
#define yyparse f_parse
162
#define yylex   f_lex
163
#define yyerror f_error
164
#define yylval  f_lval
165
#define yychar  f_char
166
#define yydebug f_debug
167
#define yypact  f_pact  
168
#define yyr1    f_r1                    
169
#define yyr2    f_r2                    
170
#define yydef   f_def           
171
#define yychk   f_chk           
172
#define yypgo   f_pgo           
173
#define yyact   f_act           
174
#define yyexca  f_exca
175
#define yyerrflag f_errflag
176
#define yynerrs f_nerrs
177
#define yyps    f_ps
178
#define yypv    f_pv
179
#define yys     f_s
180
#define yy_yys  f_yys
181
#define yystate f_state
182
#define yytmp   f_tmp
183
#define yyv     f_v
184
#define yy_yyv  f_yyv
185
#define yyval   f_val
186
#define yylloc  f_lloc
187
#define yyreds  f_reds          /* With YYDEBUG defined */
188
#define yytoks  f_toks          /* With YYDEBUG defined */
189
#define yyname  f_name          /* With YYDEBUG defined */
190
#define yyrule  f_rule          /* With YYDEBUG defined */
191
#define yylhs   f_yylhs
192
#define yylen   f_yylen
193
#define yydefred f_yydefred
194
#define yydgoto f_yydgoto
195
#define yysindex f_yysindex
196
#define yyrindex f_yyrindex
197
#define yygindex f_yygindex
198
#define yytable  f_yytable
199
#define yycheck  f_yycheck
200
 
201
#ifndef YYDEBUG
202
#define YYDEBUG 1               /* Default to yydebug support */
203
#endif
204
 
205
#define YYFPRINTF parser_fprintf
206
 
207
int yyparse (void);
208
 
209
static int yylex (void);
210
 
211
void yyerror (char *);
212
 
213
static void growbuf_by_size (int);
214
 
215
static int match_string_literal (void);
216
 
217
 
218
 
219
/* Enabling traces.  */
220
#ifndef YYDEBUG
221
# define YYDEBUG 0
222
#endif
223
 
224
/* Enabling verbose error messages.  */
225
#ifdef YYERROR_VERBOSE
226
# undef YYERROR_VERBOSE
227
# define YYERROR_VERBOSE 1
228
#else
229
# define YYERROR_VERBOSE 0
230
#endif
231
 
232
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
233
#line 131 "f-exp.y"
234
typedef union YYSTYPE {
235
    LONGEST lval;
236
    struct {
237
      LONGEST val;
238
      struct type *type;
239
    } typed_val;
240
    DOUBLEST dval;
241
    struct symbol *sym;
242
    struct type *tval;
243
    struct stoken sval;
244
    struct ttype tsym;
245
    struct symtoken ssym;
246
    int voidval;
247
    struct block *bval;
248
    enum exp_opcode opcode;
249
    struct internalvar *ivar;
250
 
251
    struct type **tvec;
252
    int *ivec;
253
  } YYSTYPE;
254
/* Line 191 of yacc.c.  */
255
#line 256 "f-exp.c.tmp"
256
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
257
# define YYSTYPE_IS_DECLARED 1
258
# define YYSTYPE_IS_TRIVIAL 1
259
#endif
260
 
261
 
262
 
263
/* Copy the second part of user declarations.  */
264
#line 152 "f-exp.y"
265
 
266
/* YYSTYPE gets defined by %union */
267
static int parse_number (char *, int, int, YYSTYPE *);
268
 
269
 
270
/* Line 214 of yacc.c.  */
271
#line 272 "f-exp.c.tmp"
272
 
273
#if ! defined (yyoverflow) || YYERROR_VERBOSE
274
 
275
# ifndef YYFREE
276
#  define YYFREE free
277
# endif
278
# ifndef YYMALLOC
279
#  define YYMALLOC xmalloc
280
# endif
281
 
282
/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
283
 
284
# ifdef YYSTACK_USE_ALLOCA
285
#  if YYSTACK_USE_ALLOCA
286
#   define YYSTACK_ALLOC alloca
287
#  endif
288
# else
289
#  if defined (alloca) || defined (_ALLOCA_H)
290
#   define YYSTACK_ALLOC alloca
291
#  else
292
#   ifdef __GNUC__
293
#    define YYSTACK_ALLOC __builtin_alloca
294
#   endif
295
#  endif
296
# endif
297
 
298
# ifdef YYSTACK_ALLOC
299
   /* Pacify GCC's `empty if-body' warning. */
300
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
301
# else
302
#  if defined (__STDC__) || defined (__cplusplus)
303
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
304
#   define YYSIZE_T size_t
305
#  endif
306
#  define YYSTACK_ALLOC YYMALLOC
307
#  define YYSTACK_FREE YYFREE
308
# endif
309
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
310
 
311
 
312
#if (! defined (yyoverflow) \
313
     && (! defined (__cplusplus) \
314
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
315
 
316
/* A type that is properly aligned for any stack member.  */
317
union yyalloc
318
{
319
  short yyss;
320
  YYSTYPE yyvs;
321
  };
322
 
323
/* The size of the maximum gap between one aligned stack and the next.  */
324
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
325
 
326
/* The size of an array large to enough to hold all stacks, each with
327
   N elements.  */
328
# define YYSTACK_BYTES(N) \
329
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
330
      + YYSTACK_GAP_MAXIMUM)
331
 
332
/* Copy COUNT objects from FROM to TO.  The source and destination do
333
   not overlap.  */
334
# ifndef YYCOPY
335
#  if defined (__GNUC__) && 1 < __GNUC__
336
#   define YYCOPY(To, From, Count) \
337
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
338
#  else
339
#   define YYCOPY(To, From, Count)              \
340
      do                                        \
341
        {                                       \
342
          register YYSIZE_T yyi;                \
343
          for (yyi = 0; yyi < (Count); yyi++)    \
344
            (To)[yyi] = (From)[yyi];            \
345
        }                                       \
346
      while (0)
347
#  endif
348
# endif
349
 
350
/* Relocate STACK from its old location to the new one.  The
351
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
352
   elements in the stack, and YYPTR gives the new location of the
353
   stack.  Advance YYPTR to a properly aligned location for the next
354
   stack.  */
355
# define YYSTACK_RELOCATE(Stack)                                        \
356
    do                                                                  \
357
      {                                                                 \
358
        YYSIZE_T yynewbytes;                                            \
359
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
360
        Stack = &yyptr->Stack;                                          \
361
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
362
        yyptr += yynewbytes / sizeof (*yyptr);                          \
363
      }                                                                 \
364
    while (0)
365
 
366
#endif
367
 
368
#if defined (__STDC__) || defined (__cplusplus)
369
   typedef signed char yysigned_char;
370
#else
371
   typedef short yysigned_char;
372
#endif
373
 
374
/* YYFINAL -- State number of the termination state. */
375
#define YYFINAL  46
376
/* YYLAST -- Last index in YYTABLE.  */
377
#define YYLAST   531
378
 
379
/* YYNTOKENS -- Number of terminals. */
380
#define YYNTOKENS  56
381
/* YYNNTS -- Number of nonterminals. */
382
#define YYNNTS  18
383
/* YYNRULES -- Number of rules. */
384
#define YYNRULES  85
385
/* YYNRULES -- Number of states. */
386
#define YYNSTATES  130
387
 
388
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
389
#define YYUNDEFTOK  2
390
#define YYMAXUTOK   294
391
 
392
#define YYTRANSLATE(YYX)                                                \
393
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
394
 
395
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
396
static const unsigned char yytranslate[] =
397
{
398
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
399
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
400
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
401
       2,     2,     2,     2,     2,     2,     2,    50,    35,     2,
402
      52,    53,    47,    45,    29,    46,     2,    48,     2,     2,
403
       2,     2,     2,     2,     2,     2,     2,     2,    55,     2,
404
       2,    31,     2,    32,    44,     2,     2,     2,     2,     2,
405
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
406
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
407
       2,     2,     2,     2,    34,     2,     2,     2,     2,     2,
408
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
409
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
410
       2,     2,     2,     2,    33,     2,    54,     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,     1,     2,     3,     4,
424
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
425
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
426
      25,    26,    27,    28,    30,    36,    37,    38,    39,    40,
427
      41,    42,    43,    49,    51
428
};
429
 
430
#if YYDEBUG
431
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
432
   YYRHS.  */
433
static const unsigned char yyprhs[] =
434
{
435
       0,     0,     3,     5,     7,     9,    13,    16,    19,    22,
436
      25,    28,    31,    32,    38,    39,    41,    43,    47,    51,
437
      54,    57,    59,    63,    67,    72,    76,    80,    84,    88,
438
      92,    96,   100,   104,   108,   112,   116,   120,   124,   128,
439
     132,   136,   140,   144,   148,   152,   156,   160,   162,   164,
440
     166,   168,   170,   175,   177,   179,   181,   183,   185,   188,
441
     190,   193,   195,   198,   200,   204,   207,   209,   212,   216,
442
     218,   220,   222,   224,   226,   228,   230,   232,   234,   236,
443
     238,   240,   242,   244,   248,   250
444
};
445
 
446
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
447
static const yysigned_char yyrhs[] =
448
{
449
      57,     0,    -1,    59,    -1,    58,    -1,    65,    -1,    52,
450
      59,    53,    -1,    47,    59,    -1,    35,    59,    -1,    46,
451
      59,    -1,    25,    59,    -1,    54,    59,    -1,    10,    59,
452
      -1,    -1,    59,    52,    60,    61,    53,    -1,    -1,    59,
453
      -1,    62,    -1,    61,    29,    59,    -1,    59,    55,    59,
454
      -1,    59,    55,    -1,    55,    59,    -1,    55,    -1,    59,
455
      29,    59,    -1,    52,    63,    53,    -1,    52,    65,    53,
456
      59,    -1,    59,    50,    72,    -1,    59,    44,    59,    -1,
457
      59,    49,    59,    -1,    59,    47,    59,    -1,    59,    48,
458
      59,    -1,    59,    45,    59,    -1,    59,    46,    59,    -1,
459
      59,    43,    59,    -1,    59,    42,    59,    -1,    59,    37,
460
      59,    -1,    59,    36,    59,    -1,    59,    39,    59,    -1,
461
      59,    38,    59,    -1,    59,    41,    59,    -1,    59,    40,
462
      59,    -1,    59,    35,    59,    -1,    59,    34,    59,    -1,
463
      59,    33,    59,    -1,    59,    23,    59,    -1,    59,    24,
464
      59,    -1,    59,    31,    59,    -1,    59,    28,    59,    -1,
465
       3,    -1,     9,    -1,     4,    -1,    64,    -1,    27,    -1,
466
      10,    52,    65,    53,    -1,     6,    -1,     5,    -1,    73,
467
      -1,    66,    -1,    70,    -1,    70,    67,    -1,    47,    -1,
468
      47,    67,    -1,    35,    -1,    35,    67,    -1,    68,    -1,
469
      52,    67,    53,    -1,    68,    69,    -1,    69,    -1,    52,
470
      53,    -1,    52,    71,    53,    -1,     8,    -1,    12,    -1,
471
      13,    -1,    26,    -1,    16,    -1,    15,    -1,    14,    -1,
472
      17,    -1,    18,    -1,    19,    -1,    20,    -1,    21,    -1,
473
      22,    -1,    65,    -1,    71,    29,    65,    -1,     7,    -1,
474
       7,    -1
475
};
476
 
477
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
478
static const unsigned short yyrline[] =
479
{
480
       0,   230,   230,   231,   234,   240,   245,   249,   253,   257,
481
     261,   265,   275,   274,   282,   285,   289,   293,   299,   305,
482
     311,   317,   323,   327,   331,   337,   345,   349,   353,   357,
483
     361,   365,   369,   373,   377,   381,   385,   389,   393,   397,
484
     401,   405,   409,   413,   418,   422,   426,   432,   439,   448,
485
     455,   458,   461,   469,   476,   484,   528,   531,   532,   575,
486
     577,   579,   581,   583,   586,   588,   590,   594,   596,   601,
487
     603,   605,   607,   609,   611,   613,   615,   617,   619,   621,
488
     623,   625,   630,   635,   642,   646
489
};
490
#endif
491
 
492
#if YYDEBUG || YYERROR_VERBOSE
493
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
494
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
495
static const char *const yytname[] =
496
{
497
  "$end", "error", "$undefined", "INT", "FLOAT", "STRING_LITERAL",
498
  "BOOLEAN_LITERAL", "NAME", "TYPENAME", "NAME_OR_INT", "SIZEOF", "ERROR",
499
  "INT_KEYWORD", "INT_S2_KEYWORD", "LOGICAL_S1_KEYWORD",
500
  "LOGICAL_S2_KEYWORD", "LOGICAL_KEYWORD", "REAL_KEYWORD",
501
  "REAL_S8_KEYWORD", "REAL_S16_KEYWORD", "COMPLEX_S8_KEYWORD",
502
  "COMPLEX_S16_KEYWORD", "COMPLEX_S32_KEYWORD", "BOOL_AND", "BOOL_OR",
503
  "BOOL_NOT", "CHARACTER", "VARIABLE", "ASSIGN_MODIFY", "','",
504
  "ABOVE_COMMA", "'='", "'?'", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL",
505
  "GEQ", "LEQ", "GREATERTHAN", "LESSTHAN", "RSH", "LSH", "'@'", "'+'",
506
  "'-'", "'*'", "'/'", "STARSTAR", "'%'", "UNARY", "'('", "')'", "'~'",
507
  "':'", "$accept", "start", "type_exp", "exp", "@1", "arglist",
508
  "subrange", "complexnum", "variable", "type", "ptype", "abs_decl",
509
  "direct_abs_decl", "func_mod", "typebase", "nonempty_typelist", "name",
510
  "name_not_typename", 0
511
};
512
#endif
513
 
514
# ifdef YYPRINT
515
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
516
   token YYLEX-NUM.  */
517
static const unsigned short yytoknum[] =
518
{
519
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
520
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
521
     275,   276,   277,   278,   279,   280,   281,   282,   283,    44,
522
     284,    61,    63,   124,    94,    38,   285,   286,   287,   288,
523
     289,   290,   291,   292,    64,    43,    45,    42,    47,   293,
524
      37,   294,    40,    41,   126,    58
525
};
526
# endif
527
 
528
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
529
static const unsigned char yyr1[] =
530
{
531
       0,    56,    57,    57,    58,    59,    59,    59,    59,    59,
532
      59,    59,    60,    59,    61,    61,    61,    61,    62,    62,
533
      62,    62,    63,    59,    59,    59,    59,    59,    59,    59,
534
      59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
535
      59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
536
      59,    59,    59,    59,    59,    64,    65,    66,    66,    67,
537
      67,    67,    67,    67,    68,    68,    68,    69,    69,    70,
538
      70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
539
      70,    70,    71,    71,    72,    73
540
};
541
 
542
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
543
static const unsigned char yyr2[] =
544
{
545
       0,     2,     1,     1,     1,     3,     2,     2,     2,     2,
546
       2,     2,     0,     5,     0,     1,     1,     3,     3,     2,
547
       2,     1,     3,     3,     4,     3,     3,     3,     3,     3,
548
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
549
       3,     3,     3,     3,     3,     3,     3,     1,     1,     1,
550
       1,     1,     4,     1,     1,     1,     1,     1,     2,     1,
551
       2,     1,     2,     1,     3,     2,     1,     2,     3,     1,
552
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
553
       1,     1,     1,     3,     1,     1
554
};
555
 
556
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
557
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
558
   means the default is an error.  */
559
static const unsigned char yydefact[] =
560
{
561
       0,    47,    49,    54,    53,    85,    69,    48,     0,    70,
562
      71,    75,    74,    73,    76,    77,    78,    79,    80,    81,
563
       0,    72,    51,     0,     0,     0,     0,     0,     0,     3,
564
       2,    50,     4,    56,    57,    55,     0,    11,     9,     7,
565
       8,     6,     0,     0,     0,    10,     1,     0,     0,     0,
566
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
567
       0,     0,     0,     0,     0,     0,     0,     0,     0,    12,
568
      61,    59,     0,    58,    63,    66,     0,     0,     5,    23,
569
       0,    43,    44,    46,    45,    42,    41,    40,    35,    34,
570
      37,    36,    39,    38,    33,    32,    26,    30,    31,    28,
571
      29,    27,    84,    25,    14,    62,    60,    67,    82,     0,
572
       0,     0,    65,    52,    22,    24,    21,    15,     0,    16,
573
      64,     0,    68,    20,    19,     0,    13,    83,    18,    17
574
};
575
 
576
/* YYDEFGOTO[NTERM-NUM]. */
577
static const yysigned_char yydefgoto[] =
578
{
579
      -1,    28,    29,    42,   104,   118,   119,    43,    31,   108,
580
      33,    73,    74,    75,    34,   110,   103,    35
581
};
582
 
583
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
584
   STATE-NUM.  */
585
#define YYPACT_NINF -49
586
static const short yypact[] =
587
{
588
     123,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   156,   -49,
589
     -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,   -49,
590
     189,   -49,   -49,   189,   189,   189,   123,   189,     3,   -49,
591
     362,   -49,   -49,   -49,   -34,   -49,   123,   -48,   -48,   -48,
592
     -48,   -48,   331,   -46,   -32,   -48,   -49,   189,   189,   189,
593
     189,   189,   189,   189,   189,   189,   189,   189,   189,   189,
594
     189,   189,   189,   189,   189,   189,   189,   189,     8,   -49,
595
     -34,   -34,   238,   -49,   -26,   -49,   -31,   189,   -49,   -49,
596
     189,   410,   390,   362,   362,   429,   447,   464,   479,   479,
597
      39,    39,    39,    39,   -13,   -13,    49,   -38,   -38,   -33,
598
     -33,   -33,   -49,   -49,    65,   -49,   -49,   -49,   -49,   -10,
599
     -24,   280,   -49,   222,   362,   -48,   189,   301,   -23,   -49,
600
     -49,   295,   -49,   362,   189,   189,   -49,   -49,   362,   362
601
};
602
 
603
/* YYPGOTO[NTERM-NUM].  */
604
static const yysigned_char yypgoto[] =
605
{
606
     -49,   -49,   -49,     0,   -49,   -49,   -49,   -49,   -49,     2,
607
     -49,   -30,   -49,   -29,   -49,   -49,   -49,   -49
608
};
609
 
610
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
611
   positive, shift that token.  If negative, reduce the rule which
612
   number is the opposite.  If zero, do what YYDEFACT says.
613
   If YYTABLE_NINF, syntax error.  */
614
#define YYTABLE_NINF -1
615
static const unsigned char yytable[] =
616
{
617
      30,    70,    32,    46,    69,   121,   125,    79,    37,    65,
618
      66,    67,    68,    71,    69,   102,    67,    68,    72,    69,
619
      38,    80,   113,    39,    40,    41,   111,    45,    44,   122,
620
     126,    62,    63,    64,    65,    66,    67,    68,    76,    69,
621
     105,   106,   109,   120,     0,   112,     0,    81,    82,    83,
622
      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
623
      94,    95,    96,    97,    98,    99,   100,   101,     1,     2,
624
       3,     4,     5,     0,     7,     8,     0,   114,     0,     0,
625
     115,    60,    61,    62,    63,    64,    65,    66,    67,    68,
626
      20,    69,    22,     0,    63,    64,    65,    66,    67,    68,
627
      23,    69,     0,     0,   117,     0,     0,     0,     0,     0,
628
       0,    24,    25,   115,     0,     0,   123,    26,     0,    27,
629
     116,     0,     0,   127,   128,   129,     1,     2,     3,     4,
630
       5,     6,     7,     8,     0,     9,    10,    11,    12,    13,
631
      14,    15,    16,    17,    18,    19,     0,     0,    20,    21,
632
      22,     0,     0,     0,     0,     0,     0,     0,    23,     1,
633
       2,     3,     4,     5,     0,     7,     8,     0,     0,    24,
634
      25,     0,     0,     0,     0,    26,     0,    27,     0,     0,
635
       0,    20,     0,    22,     0,     0,     0,     0,     0,     0,
636
       0,    23,     1,     2,     3,     4,     5,     0,     7,     8,
637
       0,     0,    24,    25,     0,     0,     0,     0,    36,     0,
638
      27,     0,     0,     0,    20,     0,    22,     0,     0,     0,
639
       0,     0,     0,     0,    23,     1,     2,     3,     4,     5,
640
       0,     7,     8,     0,     0,    24,    25,     0,     0,     0,
641
       0,    26,     0,    27,     0,     0,     6,    20,     0,    22,
642
       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
643
      19,     0,     0,     0,    21,     0,     0,     0,     0,     0,
644
       0,     0,     0,    70,    26,     0,    27,     0,     0,     0,
645
       0,     0,     0,     0,     0,    71,     0,     0,     6,     0,
646
      72,   107,     9,    10,    11,    12,    13,    14,    15,    16,
647
      17,    18,    19,     6,     0,     0,    21,     9,    10,    11,
648
      12,    13,    14,    15,    16,    17,    18,    19,     0,     0,
649
       0,    21,     0,     0,    47,    48,     0,     0,     0,    49,
650
       0,     0,    50,   107,    51,    52,    53,    54,    55,    56,
651
      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
652
      67,    68,     0,    69,    47,    48,   124,     0,     0,    49,
653
      77,     0,    50,     0,    51,    52,    53,    54,    55,    56,
654
      57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
655
      67,    68,     0,    69,    78,    47,    48,     0,     0,     0,
656
      49,     0,     0,    50,     0,    51,    52,    53,    54,    55,
657
      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
658
      66,    67,    68,    47,    69,     0,     0,     0,     0,     0,
659
       0,     0,     0,    51,    52,    53,    54,    55,    56,    57,
660
      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
661
      68,     0,    69,    51,    52,    53,    54,    55,    56,    57,
662
      58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
663
      68,     0,    69,    52,    53,    54,    55,    56,    57,    58,
664
      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
665
       0,    69,    53,    54,    55,    56,    57,    58,    59,    60,
666
      61,    62,    63,    64,    65,    66,    67,    68,     0,    69,
667
      54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
668
      64,    65,    66,    67,    68,     0,    69,    56,    57,    58,
669
      59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
670
       0,    69
671
};
672
 
673
static const yysigned_char yycheck[] =
674
{
675
       0,    35,     0,     0,    52,    29,    29,    53,     8,    47,
676
      48,    49,    50,    47,    52,     7,    49,    50,    52,    52,
677
      20,    53,    53,    23,    24,    25,    52,    27,    26,    53,
678
      53,    44,    45,    46,    47,    48,    49,    50,    36,    52,
679
      70,    71,    72,    53,    -1,    74,    -1,    47,    48,    49,
680
      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
681
      60,    61,    62,    63,    64,    65,    66,    67,     3,     4,
682
       5,     6,     7,    -1,     9,    10,    -1,    77,    -1,    -1,
683
      80,    42,    43,    44,    45,    46,    47,    48,    49,    50,
684
      25,    52,    27,    -1,    45,    46,    47,    48,    49,    50,
685
      35,    52,    -1,    -1,   104,    -1,    -1,    -1,    -1,    -1,
686
      -1,    46,    47,   113,    -1,    -1,   116,    52,    -1,    54,
687
      55,    -1,    -1,   121,   124,   125,     3,     4,     5,     6,
688
       7,     8,     9,    10,    -1,    12,    13,    14,    15,    16,
689
      17,    18,    19,    20,    21,    22,    -1,    -1,    25,    26,
690
      27,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    35,     3,
691
       4,     5,     6,     7,    -1,     9,    10,    -1,    -1,    46,
692
      47,    -1,    -1,    -1,    -1,    52,    -1,    54,    -1,    -1,
693
      -1,    25,    -1,    27,    -1,    -1,    -1,    -1,    -1,    -1,
694
      -1,    35,     3,     4,     5,     6,     7,    -1,     9,    10,
695
      -1,    -1,    46,    47,    -1,    -1,    -1,    -1,    52,    -1,
696
      54,    -1,    -1,    -1,    25,    -1,    27,    -1,    -1,    -1,
697
      -1,    -1,    -1,    -1,    35,     3,     4,     5,     6,     7,
698
      -1,     9,    10,    -1,    -1,    46,    47,    -1,    -1,    -1,
699
      -1,    52,    -1,    54,    -1,    -1,     8,    25,    -1,    27,
700
      12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
701
      22,    -1,    -1,    -1,    26,    -1,    -1,    -1,    -1,    -1,
702
      -1,    -1,    -1,    35,    52,    -1,    54,    -1,    -1,    -1,
703
      -1,    -1,    -1,    -1,    -1,    47,    -1,    -1,     8,    -1,
704
      52,    53,    12,    13,    14,    15,    16,    17,    18,    19,
705
      20,    21,    22,     8,    -1,    -1,    26,    12,    13,    14,
706
      15,    16,    17,    18,    19,    20,    21,    22,    -1,    -1,
707
      -1,    26,    -1,    -1,    23,    24,    -1,    -1,    -1,    28,
708
      -1,    -1,    31,    53,    33,    34,    35,    36,    37,    38,
709
      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
710
      49,    50,    -1,    52,    23,    24,    55,    -1,    -1,    28,
711
      29,    -1,    31,    -1,    33,    34,    35,    36,    37,    38,
712
      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
713
      49,    50,    -1,    52,    53,    23,    24,    -1,    -1,    -1,
714
      28,    -1,    -1,    31,    -1,    33,    34,    35,    36,    37,
715
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
716
      48,    49,    50,    23,    52,    -1,    -1,    -1,    -1,    -1,
717
      -1,    -1,    -1,    33,    34,    35,    36,    37,    38,    39,
718
      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
719
      50,    -1,    52,    33,    34,    35,    36,    37,    38,    39,
720
      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
721
      50,    -1,    52,    34,    35,    36,    37,    38,    39,    40,
722
      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
723
      -1,    52,    35,    36,    37,    38,    39,    40,    41,    42,
724
      43,    44,    45,    46,    47,    48,    49,    50,    -1,    52,
725
      36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
726
      46,    47,    48,    49,    50,    -1,    52,    38,    39,    40,
727
      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
728
      -1,    52
729
};
730
 
731
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
732
   symbol of state STATE-NUM.  */
733
static const unsigned char yystos[] =
734
{
735
       0,     3,     4,     5,     6,     7,     8,     9,    10,    12,
736
      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
737
      25,    26,    27,    35,    46,    47,    52,    54,    57,    58,
738
      59,    64,    65,    66,    70,    73,    52,    59,    59,    59,
739
      59,    59,    59,    63,    65,    59,     0,    23,    24,    28,
740
      31,    33,    34,    35,    36,    37,    38,    39,    40,    41,
741
      42,    43,    44,    45,    46,    47,    48,    49,    50,    52,
742
      35,    47,    52,    67,    68,    69,    65,    29,    53,    53,
743
      53,    59,    59,    59,    59,    59,    59,    59,    59,    59,
744
      59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
745
      59,    59,     7,    72,    60,    67,    67,    53,    65,    67,
746
      71,    52,    69,    53,    59,    59,    55,    59,    61,    62,
747
      53,    29,    53,    59,    55,    29,    53,    65,    59,    59
748
};
749
 
750
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
751
# define YYSIZE_T __SIZE_TYPE__
752
#endif
753
#if ! defined (YYSIZE_T) && defined (size_t)
754
# define YYSIZE_T size_t
755
#endif
756
#if ! defined (YYSIZE_T)
757
# if defined (__STDC__) || defined (__cplusplus)
758
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
759
#  define YYSIZE_T size_t
760
# endif
761
#endif
762
#if ! defined (YYSIZE_T)
763
# define YYSIZE_T unsigned int
764
#endif
765
 
766
#define yyerrok         (yyerrstatus = 0)
767
#define yyclearin       (yychar = YYEMPTY)
768
#define YYEMPTY         (-2)
769
#define YYEOF           0
770
 
771
#define YYACCEPT        goto yyacceptlab
772
#define YYABORT         goto yyabortlab
773
#define YYERROR         goto yyerrorlab
774
 
775
 
776
/* Like YYERROR except do call yyerror.  This remains here temporarily
777
   to ease the transition to the new meaning of YYERROR, for GCC.
778
   Once GCC version 2 has supplanted version 1, this can go.  */
779
 
780
#define YYFAIL          goto yyerrlab
781
 
782
#define YYRECOVERING()  (!!yyerrstatus)
783
 
784
#define YYBACKUP(Token, Value)                                  \
785
do                                                              \
786
  if (yychar == YYEMPTY && yylen == 1)                          \
787
    {                                                           \
788
      yychar = (Token);                                         \
789
      yylval = (Value);                                         \
790
      yytoken = YYTRANSLATE (yychar);                           \
791
      YYPOPSTACK;                                               \
792
      goto yybackup;                                            \
793
    }                                                           \
794
  else                                                          \
795
    {                                                           \
796
      yyerror ("syntax error: cannot back up");\
797
      YYERROR;                                                  \
798
    }                                                           \
799
while (0)
800
 
801
#define YYTERROR        1
802
#define YYERRCODE       256
803
 
804
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
805
   are run).  */
806
 
807
#ifndef YYLLOC_DEFAULT
808
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
809
   ((Current).first_line   = (Rhs)[1].first_line,       \
810
    (Current).first_column = (Rhs)[1].first_column,     \
811
    (Current).last_line    = (Rhs)[N].last_line,        \
812
    (Current).last_column  = (Rhs)[N].last_column)
813
#endif
814
 
815
/* YYLEX -- calling `yylex' with the right arguments.  */
816
 
817
#ifdef YYLEX_PARAM
818
# define YYLEX yylex (YYLEX_PARAM)
819
#else
820
# define YYLEX yylex ()
821
#endif
822
 
823
/* Enable debugging if requested.  */
824
#if YYDEBUG
825
 
826
# ifndef YYFPRINTF
827
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
828
#  define YYFPRINTF fprintf
829
# endif
830
 
831
# define YYDPRINTF(Args)                        \
832
do {                                            \
833
  if (yydebug)                                  \
834
    YYFPRINTF Args;                             \
835
} while (0)
836
 
837
# define YYDSYMPRINT(Args)                      \
838
do {                                            \
839
  if (yydebug)                                  \
840
    yysymprint Args;                            \
841
} while (0)
842
 
843
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
844
do {                                                            \
845
  if (yydebug)                                                  \
846
    {                                                           \
847
      YYFPRINTF (stderr, "%s ", Title);                         \
848
      yysymprint (stderr,                                       \
849
                  Token, Value);        \
850
      YYFPRINTF (stderr, "\n");                                 \
851
    }                                                           \
852
} while (0)
853
 
854
/*------------------------------------------------------------------.
855
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
856
| TOP (included).                                                   |
857
`------------------------------------------------------------------*/
858
 
859
#if defined (__STDC__) || defined (__cplusplus)
860
static void
861
yy_stack_print (short *bottom, short *top)
862
#else
863
static void
864
yy_stack_print (bottom, top)
865
    short *bottom;
866
    short *top;
867
#endif
868
{
869
  YYFPRINTF (stderr, "Stack now");
870
  for (/* Nothing. */; bottom <= top; ++bottom)
871
    YYFPRINTF (stderr, " %d", *bottom);
872
  YYFPRINTF (stderr, "\n");
873
}
874
 
875
# define YY_STACK_PRINT(Bottom, Top)                            \
876
do {                                                            \
877
  if (yydebug)                                                  \
878
    yy_stack_print ((Bottom), (Top));                           \
879
} while (0)
880
 
881
 
882
/*------------------------------------------------.
883
| Report that the YYRULE is going to be reduced.  |
884
`------------------------------------------------*/
885
 
886
#if defined (__STDC__) || defined (__cplusplus)
887
static void
888
yy_reduce_print (int yyrule)
889
#else
890
static void
891
yy_reduce_print (yyrule)
892
    int yyrule;
893
#endif
894
{
895
  int yyi;
896
  unsigned int yylno = yyrline[yyrule];
897
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
898
             yyrule - 1, yylno);
899
  /* Print the symbols being reduced, and their result.  */
900
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
901
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
902
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
903
}
904
 
905
# define YY_REDUCE_PRINT(Rule)          \
906
do {                                    \
907
  if (yydebug)                          \
908
    yy_reduce_print (Rule);             \
909
} while (0)
910
 
911
/* Nonzero means print parse trace.  It is left uninitialized so that
912
   multiple parsers can coexist.  */
913
int yydebug;
914
#else /* !YYDEBUG */
915
# define YYDPRINTF(Args)
916
# define YYDSYMPRINT(Args)
917
# define YYDSYMPRINTF(Title, Token, Value, Location)
918
# define YY_STACK_PRINT(Bottom, Top)
919
# define YY_REDUCE_PRINT(Rule)
920
#endif /* !YYDEBUG */
921
 
922
 
923
/* YYINITDEPTH -- initial size of the parser's stacks.  */
924
#ifndef YYINITDEPTH
925
# define YYINITDEPTH 200
926
#endif
927
 
928
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
929
   if the built-in stack extension method is used).
930
 
931
   Do not make this value too large; the results are undefined if
932
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
933
   evaluated with infinite-precision integer arithmetic.  */
934
 
935
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
936
# undef YYMAXDEPTH
937
#endif
938
 
939
#ifndef YYMAXDEPTH
940
# define YYMAXDEPTH 10000
941
#endif
942
 
943
 
944
 
945
#if YYERROR_VERBOSE
946
 
947
# ifndef yystrlen
948
#  if defined (__GLIBC__) && defined (_STRING_H)
949
#   define yystrlen strlen
950
#  else
951
/* Return the length of YYSTR.  */
952
static YYSIZE_T
953
#   if defined (__STDC__) || defined (__cplusplus)
954
yystrlen (const char *yystr)
955
#   else
956
yystrlen (yystr)
957
     const char *yystr;
958
#   endif
959
{
960
  register const char *yys = yystr;
961
 
962
  while (*yys++ != '\0')
963
    continue;
964
 
965
  return yys - yystr - 1;
966
}
967
#  endif
968
# endif
969
 
970
# ifndef yystpcpy
971
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
972
#   define yystpcpy stpcpy
973
#  else
974
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
975
   YYDEST.  */
976
static char *
977
#   if defined (__STDC__) || defined (__cplusplus)
978
yystpcpy (char *yydest, const char *yysrc)
979
#   else
980
yystpcpy (yydest, yysrc)
981
     char *yydest;
982
     const char *yysrc;
983
#   endif
984
{
985
  register char *yyd = yydest;
986
  register const char *yys = yysrc;
987
 
988
  while ((*yyd++ = *yys++) != '\0')
989
    continue;
990
 
991
  return yyd - 1;
992
}
993
#  endif
994
# endif
995
 
996
#endif /* !YYERROR_VERBOSE */
997
 
998
 
999
 
1000
#if YYDEBUG
1001
/*--------------------------------.
1002
| Print this symbol on YYOUTPUT.  |
1003
`--------------------------------*/
1004
 
1005
#if defined (__STDC__) || defined (__cplusplus)
1006
static void
1007
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1008
#else
1009
static void
1010
yysymprint (yyoutput, yytype, yyvaluep)
1011
    FILE *yyoutput;
1012
    int yytype;
1013
    YYSTYPE *yyvaluep;
1014
#endif
1015
{
1016
  /* Pacify ``unused variable'' warnings.  */
1017
  (void) yyvaluep;
1018
 
1019
  if (yytype < YYNTOKENS)
1020
    {
1021
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1022
# ifdef YYPRINT
1023
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1024
# endif
1025
    }
1026
  else
1027
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1028
 
1029
  switch (yytype)
1030
    {
1031
      default:
1032
        break;
1033
    }
1034
  YYFPRINTF (yyoutput, ")");
1035
}
1036
 
1037
#endif /* ! YYDEBUG */
1038
/*-----------------------------------------------.
1039
| Release the memory associated to this symbol.  |
1040
`-----------------------------------------------*/
1041
 
1042
#if defined (__STDC__) || defined (__cplusplus)
1043
static void
1044
yydestruct (int yytype, YYSTYPE *yyvaluep)
1045
#else
1046
static void
1047
yydestruct (yytype, yyvaluep)
1048
    int yytype;
1049
    YYSTYPE *yyvaluep;
1050
#endif
1051
{
1052
  /* Pacify ``unused variable'' warnings.  */
1053
  (void) yyvaluep;
1054
 
1055
  switch (yytype)
1056
    {
1057
 
1058
      default:
1059
        break;
1060
    }
1061
}
1062
 
1063
 
1064
/* Prevent warnings from -Wmissing-prototypes.  */
1065
 
1066
#ifdef YYPARSE_PARAM
1067
# if defined (__STDC__) || defined (__cplusplus)
1068
int yyparse (void *YYPARSE_PARAM);
1069
# else
1070
int yyparse ();
1071
# endif
1072
#else /* ! YYPARSE_PARAM */
1073
#if defined (__STDC__) || defined (__cplusplus)
1074
int yyparse (void);
1075
#else
1076
int yyparse ();
1077
#endif
1078
#endif /* ! YYPARSE_PARAM */
1079
 
1080
 
1081
 
1082
/* The lookahead symbol.  */
1083
int yychar;
1084
 
1085
/* The semantic value of the lookahead symbol.  */
1086
YYSTYPE yylval;
1087
 
1088
/* Number of syntax errors so far.  */
1089
int yynerrs;
1090
 
1091
 
1092
 
1093
/*----------.
1094
| yyparse.  |
1095
`----------*/
1096
 
1097
#ifdef YYPARSE_PARAM
1098
# if defined (__STDC__) || defined (__cplusplus)
1099
int yyparse (void *YYPARSE_PARAM)
1100
# else
1101
int yyparse (YYPARSE_PARAM)
1102
  void *YYPARSE_PARAM;
1103
# endif
1104
#else /* ! YYPARSE_PARAM */
1105
#if defined (__STDC__) || defined (__cplusplus)
1106
int
1107
yyparse (void)
1108
#else
1109
int
1110
yyparse ()
1111
 
1112
#endif
1113
#endif
1114
{
1115
 
1116
  register int yystate;
1117
  register int yyn;
1118
  int yyresult;
1119
  /* Number of tokens to shift before error messages enabled.  */
1120
  int yyerrstatus;
1121
  /* Lookahead token as an internal (translated) token number.  */
1122
  int yytoken = 0;
1123
 
1124
  /* Three stacks and their tools:
1125
     `yyss': related to states,
1126
     `yyvs': related to semantic values,
1127
     `yyls': related to locations.
1128
 
1129
     Refer to the stacks thru separate pointers, to allow yyoverflow
1130
     to xreallocate them elsewhere.  */
1131
 
1132
  /* The state stack.  */
1133
  short yyssa[YYINITDEPTH];
1134
  short *yyss = yyssa;
1135
  register short *yyssp;
1136
 
1137
  /* The semantic value stack.  */
1138
  YYSTYPE yyvsa[YYINITDEPTH];
1139
  YYSTYPE *yyvs = yyvsa;
1140
  register YYSTYPE *yyvsp;
1141
 
1142
 
1143
 
1144
#define YYPOPSTACK   (yyvsp--, yyssp--)
1145
 
1146
  YYSIZE_T yystacksize = YYINITDEPTH;
1147
 
1148
  /* The variables used to return semantic value and location from the
1149
     action routines.  */
1150
  YYSTYPE yyval;
1151
 
1152
 
1153
  /* When reducing, the number of symbols on the RHS of the reduced
1154
     rule.  */
1155
  int yylen;
1156
 
1157
  YYDPRINTF ((stderr, "Starting parse\n"));
1158
 
1159
  yystate = 0;
1160
  yyerrstatus = 0;
1161
  yynerrs = 0;
1162
  yychar = YYEMPTY;             /* Cause a token to be read.  */
1163
 
1164
  /* Initialize stack pointers.
1165
     Waste one element of value and location stack
1166
     so that they stay on the same level as the state stack.
1167
     The wasted elements are never initialized.  */
1168
 
1169
  yyssp = yyss;
1170
  yyvsp = yyvs;
1171
 
1172
  goto yysetstate;
1173
 
1174
/*------------------------------------------------------------.
1175
| yynewstate -- Push a new state, which is found in yystate.  |
1176
`------------------------------------------------------------*/
1177
 yynewstate:
1178
  /* In all cases, when you get here, the value and location stacks
1179
     have just been pushed. so pushing a state here evens the stacks.
1180
     */
1181
  yyssp++;
1182
 
1183
 yysetstate:
1184
  *yyssp = yystate;
1185
 
1186
  if (yyss + yystacksize - 1 <= yyssp)
1187
    {
1188
      /* Get the current used size of the three stacks, in elements.  */
1189
      YYSIZE_T yysize = yyssp - yyss + 1;
1190
 
1191
#ifdef yyoverflow
1192
      {
1193
        /* Give user a chance to xreallocate the stack. Use copies of
1194
           these so that the &'s don't force the real ones into
1195
           memory.  */
1196
        YYSTYPE *yyvs1 = yyvs;
1197
        short *yyss1 = yyss;
1198
 
1199
 
1200
        /* Each stack pointer address is followed by the size of the
1201
           data in use in that stack, in bytes.  This used to be a
1202
           conditional around just the two extra args, but that might
1203
           be undefined if yyoverflow is a macro.  */
1204
        yyoverflow ("parser stack overflow",
1205
                    &yyss1, yysize * sizeof (*yyssp),
1206
                    &yyvs1, yysize * sizeof (*yyvsp),
1207
 
1208
                    &yystacksize);
1209
 
1210
        yyss = yyss1;
1211
        yyvs = yyvs1;
1212
      }
1213
#else /* no yyoverflow */
1214
# ifndef YYSTACK_RELOCATE
1215
      goto yyoverflowlab;
1216
# else
1217
      /* Extend the stack our own way.  */
1218
      if (YYMAXDEPTH <= yystacksize)
1219
        goto yyoverflowlab;
1220
      yystacksize *= 2;
1221
      if (YYMAXDEPTH < yystacksize)
1222
        yystacksize = YYMAXDEPTH;
1223
 
1224
      {
1225
        short *yyss1 = yyss;
1226
        union yyalloc *yyptr =
1227
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1228
        if (! yyptr)
1229
          goto yyoverflowlab;
1230
        YYSTACK_RELOCATE (yyss);
1231
        YYSTACK_RELOCATE (yyvs);
1232
 
1233
#  undef YYSTACK_RELOCATE
1234
        if (yyss1 != yyssa)
1235
          YYSTACK_FREE (yyss1);
1236
      }
1237
# endif
1238
#endif /* no yyoverflow */
1239
 
1240
      yyssp = yyss + yysize - 1;
1241
      yyvsp = yyvs + yysize - 1;
1242
 
1243
 
1244
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1245
                  (unsigned long int) yystacksize));
1246
 
1247
      if (yyss + yystacksize - 1 <= yyssp)
1248
        YYABORT;
1249
    }
1250
 
1251
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1252
 
1253
  goto yybackup;
1254
 
1255
/*-----------.
1256
| yybackup.  |
1257
`-----------*/
1258
yybackup:
1259
 
1260
/* Do appropriate processing given the current state.  */
1261
/* Read a lookahead token if we need one and don't already have one.  */
1262
/* yyresume: */
1263
 
1264
  /* First try to decide what to do without reference to lookahead token.  */
1265
 
1266
  yyn = yypact[yystate];
1267
  if (yyn == YYPACT_NINF)
1268
    goto yydefault;
1269
 
1270
  /* Not known => get a lookahead token if don't already have one.  */
1271
 
1272
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1273
  if (yychar == YYEMPTY)
1274
    {
1275
      YYDPRINTF ((stderr, "Reading a token: "));
1276
      yychar = YYLEX;
1277
    }
1278
 
1279
  if (yychar <= YYEOF)
1280
    {
1281
      yychar = yytoken = YYEOF;
1282
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1283
    }
1284
  else
1285
    {
1286
      yytoken = YYTRANSLATE (yychar);
1287
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1288
    }
1289
 
1290
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1291
     detect an error, take that action.  */
1292
  yyn += yytoken;
1293
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1294
    goto yydefault;
1295
  yyn = yytable[yyn];
1296
  if (yyn <= 0)
1297
    {
1298
      if (yyn == 0 || yyn == YYTABLE_NINF)
1299
        goto yyerrlab;
1300
      yyn = -yyn;
1301
      goto yyreduce;
1302
    }
1303
 
1304
  if (yyn == YYFINAL)
1305
    YYACCEPT;
1306
 
1307
  /* Shift the lookahead token.  */
1308
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1309
 
1310
  /* Discard the token being shifted unless it is eof.  */
1311
  if (yychar != YYEOF)
1312
    yychar = YYEMPTY;
1313
 
1314
  *++yyvsp = yylval;
1315
 
1316
 
1317
  /* Count tokens shifted since error; after three, turn off error
1318
     status.  */
1319
  if (yyerrstatus)
1320
    yyerrstatus--;
1321
 
1322
  yystate = yyn;
1323
  goto yynewstate;
1324
 
1325
 
1326
/*-----------------------------------------------------------.
1327
| yydefault -- do the default action for the current state.  |
1328
`-----------------------------------------------------------*/
1329
yydefault:
1330
  yyn = yydefact[yystate];
1331
  if (yyn == 0)
1332
    goto yyerrlab;
1333
  goto yyreduce;
1334
 
1335
 
1336
/*-----------------------------.
1337
| yyreduce -- Do a reduction.  |
1338
`-----------------------------*/
1339
yyreduce:
1340
  /* yyn is the number of a rule to reduce with.  */
1341
  yylen = yyr2[yyn];
1342
 
1343
  /* If YYLEN is nonzero, implement the default value of the action:
1344
     `$$ = $1'.
1345
 
1346
     Otherwise, the following line sets YYVAL to garbage.
1347
     This behavior is undocumented and Bison
1348
     users should not rely upon it.  Assigning to YYVAL
1349
     unconditionally makes the parser a bit smaller, and it avoids a
1350
     GCC warning that YYVAL may be used uninitialized.  */
1351
  yyval = yyvsp[1-yylen];
1352
 
1353
 
1354
  YY_REDUCE_PRINT (yyn);
1355
  switch (yyn)
1356
    {
1357
        case 4:
1358
#line 235 "f-exp.y"
1359
    { write_exp_elt_opcode(OP_TYPE);
1360
                          write_exp_elt_type(yyvsp[0].tval);
1361
                          write_exp_elt_opcode(OP_TYPE); }
1362
    break;
1363
 
1364
  case 5:
1365
#line 241 "f-exp.y"
1366
    { }
1367
    break;
1368
 
1369
  case 6:
1370
#line 246 "f-exp.y"
1371
    { write_exp_elt_opcode (UNOP_IND); }
1372
    break;
1373
 
1374
  case 7:
1375
#line 250 "f-exp.y"
1376
    { write_exp_elt_opcode (UNOP_ADDR); }
1377
    break;
1378
 
1379
  case 8:
1380
#line 254 "f-exp.y"
1381
    { write_exp_elt_opcode (UNOP_NEG); }
1382
    break;
1383
 
1384
  case 9:
1385
#line 258 "f-exp.y"
1386
    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1387
    break;
1388
 
1389
  case 10:
1390
#line 262 "f-exp.y"
1391
    { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1392
    break;
1393
 
1394
  case 11:
1395
#line 266 "f-exp.y"
1396
    { write_exp_elt_opcode (UNOP_SIZEOF); }
1397
    break;
1398
 
1399
  case 12:
1400
#line 275 "f-exp.y"
1401
    { start_arglist (); }
1402
    break;
1403
 
1404
  case 13:
1405
#line 277 "f-exp.y"
1406
    { write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST);
1407
                          write_exp_elt_longcst ((LONGEST) end_arglist ());
1408
                          write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); }
1409
    break;
1410
 
1411
  case 15:
1412
#line 286 "f-exp.y"
1413
    { arglist_len = 1; }
1414
    break;
1415
 
1416
  case 16:
1417
#line 290 "f-exp.y"
1418
    { arglist_len = 1; }
1419
    break;
1420
 
1421
  case 17:
1422
#line 294 "f-exp.y"
1423
    { arglist_len++; }
1424
    break;
1425
 
1426
  case 18:
1427
#line 300 "f-exp.y"
1428
    { write_exp_elt_opcode (OP_F90_RANGE);
1429
                          write_exp_elt_longcst (NONE_BOUND_DEFAULT);
1430
                          write_exp_elt_opcode (OP_F90_RANGE); }
1431
    break;
1432
 
1433
  case 19:
1434
#line 306 "f-exp.y"
1435
    { write_exp_elt_opcode (OP_F90_RANGE);
1436
                          write_exp_elt_longcst (HIGH_BOUND_DEFAULT);
1437
                          write_exp_elt_opcode (OP_F90_RANGE); }
1438
    break;
1439
 
1440
  case 20:
1441
#line 312 "f-exp.y"
1442
    { write_exp_elt_opcode (OP_F90_RANGE);
1443
                          write_exp_elt_longcst (LOW_BOUND_DEFAULT);
1444
                          write_exp_elt_opcode (OP_F90_RANGE); }
1445
    break;
1446
 
1447
  case 21:
1448
#line 318 "f-exp.y"
1449
    { write_exp_elt_opcode (OP_F90_RANGE);
1450
                          write_exp_elt_longcst (BOTH_BOUND_DEFAULT);
1451
                          write_exp_elt_opcode (OP_F90_RANGE); }
1452
    break;
1453
 
1454
  case 22:
1455
#line 324 "f-exp.y"
1456
    { }
1457
    break;
1458
 
1459
  case 23:
1460
#line 328 "f-exp.y"
1461
    { write_exp_elt_opcode(OP_COMPLEX); }
1462
    break;
1463
 
1464
  case 24:
1465
#line 332 "f-exp.y"
1466
    { write_exp_elt_opcode (UNOP_CAST);
1467
                          write_exp_elt_type (yyvsp[-2].tval);
1468
                          write_exp_elt_opcode (UNOP_CAST); }
1469
    break;
1470
 
1471
  case 25:
1472
#line 338 "f-exp.y"
1473
    { write_exp_elt_opcode (STRUCTOP_STRUCT);
1474
                          write_exp_string (yyvsp[0].sval);
1475
                          write_exp_elt_opcode (STRUCTOP_STRUCT); }
1476
    break;
1477
 
1478
  case 26:
1479
#line 346 "f-exp.y"
1480
    { write_exp_elt_opcode (BINOP_REPEAT); }
1481
    break;
1482
 
1483
  case 27:
1484
#line 350 "f-exp.y"
1485
    { write_exp_elt_opcode (BINOP_EXP); }
1486
    break;
1487
 
1488
  case 28:
1489
#line 354 "f-exp.y"
1490
    { write_exp_elt_opcode (BINOP_MUL); }
1491
    break;
1492
 
1493
  case 29:
1494
#line 358 "f-exp.y"
1495
    { write_exp_elt_opcode (BINOP_DIV); }
1496
    break;
1497
 
1498
  case 30:
1499
#line 362 "f-exp.y"
1500
    { write_exp_elt_opcode (BINOP_ADD); }
1501
    break;
1502
 
1503
  case 31:
1504
#line 366 "f-exp.y"
1505
    { write_exp_elt_opcode (BINOP_SUB); }
1506
    break;
1507
 
1508
  case 32:
1509
#line 370 "f-exp.y"
1510
    { write_exp_elt_opcode (BINOP_LSH); }
1511
    break;
1512
 
1513
  case 33:
1514
#line 374 "f-exp.y"
1515
    { write_exp_elt_opcode (BINOP_RSH); }
1516
    break;
1517
 
1518
  case 34:
1519
#line 378 "f-exp.y"
1520
    { write_exp_elt_opcode (BINOP_EQUAL); }
1521
    break;
1522
 
1523
  case 35:
1524
#line 382 "f-exp.y"
1525
    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1526
    break;
1527
 
1528
  case 36:
1529
#line 386 "f-exp.y"
1530
    { write_exp_elt_opcode (BINOP_LEQ); }
1531
    break;
1532
 
1533
  case 37:
1534
#line 390 "f-exp.y"
1535
    { write_exp_elt_opcode (BINOP_GEQ); }
1536
    break;
1537
 
1538
  case 38:
1539
#line 394 "f-exp.y"
1540
    { write_exp_elt_opcode (BINOP_LESS); }
1541
    break;
1542
 
1543
  case 39:
1544
#line 398 "f-exp.y"
1545
    { write_exp_elt_opcode (BINOP_GTR); }
1546
    break;
1547
 
1548
  case 40:
1549
#line 402 "f-exp.y"
1550
    { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1551
    break;
1552
 
1553
  case 41:
1554
#line 406 "f-exp.y"
1555
    { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1556
    break;
1557
 
1558
  case 42:
1559
#line 410 "f-exp.y"
1560
    { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1561
    break;
1562
 
1563
  case 43:
1564
#line 414 "f-exp.y"
1565
    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1566
    break;
1567
 
1568
  case 44:
1569
#line 419 "f-exp.y"
1570
    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1571
    break;
1572
 
1573
  case 45:
1574
#line 423 "f-exp.y"
1575
    { write_exp_elt_opcode (BINOP_ASSIGN); }
1576
    break;
1577
 
1578
  case 46:
1579
#line 427 "f-exp.y"
1580
    { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1581
                          write_exp_elt_opcode (yyvsp[-1].opcode);
1582
                          write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1583
    break;
1584
 
1585
  case 47:
1586
#line 433 "f-exp.y"
1587
    { write_exp_elt_opcode (OP_LONG);
1588
                          write_exp_elt_type (yyvsp[0].typed_val.type);
1589
                          write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1590
                          write_exp_elt_opcode (OP_LONG); }
1591
    break;
1592
 
1593
  case 48:
1594
#line 440 "f-exp.y"
1595
    { YYSTYPE val;
1596
                          parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1597
                          write_exp_elt_opcode (OP_LONG);
1598
                          write_exp_elt_type (val.typed_val.type);
1599
                          write_exp_elt_longcst ((LONGEST)val.typed_val.val);
1600
                          write_exp_elt_opcode (OP_LONG); }
1601
    break;
1602
 
1603
  case 49:
1604
#line 449 "f-exp.y"
1605
    { write_exp_elt_opcode (OP_DOUBLE);
1606
                          write_exp_elt_type (builtin_type_f_real_s8);
1607
                          write_exp_elt_dblcst (yyvsp[0].dval);
1608
                          write_exp_elt_opcode (OP_DOUBLE); }
1609
    break;
1610
 
1611
  case 52:
1612
#line 462 "f-exp.y"
1613
    { write_exp_elt_opcode (OP_LONG);
1614
                          write_exp_elt_type (builtin_type_f_integer);
1615
                          CHECK_TYPEDEF (yyvsp[-1].tval);
1616
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1617
                          write_exp_elt_opcode (OP_LONG); }
1618
    break;
1619
 
1620
  case 53:
1621
#line 470 "f-exp.y"
1622
    { write_exp_elt_opcode (OP_BOOL);
1623
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1624
                          write_exp_elt_opcode (OP_BOOL);
1625
                        }
1626
    break;
1627
 
1628
  case 54:
1629
#line 477 "f-exp.y"
1630
    {
1631
                          write_exp_elt_opcode (OP_STRING);
1632
                          write_exp_string (yyvsp[0].sval);
1633
                          write_exp_elt_opcode (OP_STRING);
1634
                        }
1635
    break;
1636
 
1637
  case 55:
1638
#line 485 "f-exp.y"
1639
    { struct symbol *sym = yyvsp[0].ssym.sym;
1640
 
1641
                          if (sym)
1642
                            {
1643
                              if (symbol_read_needs_frame (sym))
1644
                                {
1645
                                  if (innermost_block == 0 ||
1646
                                      contained_in (block_found,
1647
                                                    innermost_block))
1648
                                    innermost_block = block_found;
1649
                                }
1650
                              write_exp_elt_opcode (OP_VAR_VALUE);
1651
                              /* We want to use the selected frame, not
1652
                                 another more inner frame which happens to
1653
                                 be in the same block.  */
1654
                              write_exp_elt_block (NULL);
1655
                              write_exp_elt_sym (sym);
1656
                              write_exp_elt_opcode (OP_VAR_VALUE);
1657
                              break;
1658
                            }
1659
                          else
1660
                            {
1661
                              struct minimal_symbol *msymbol;
1662
                              char *arg = copy_name (yyvsp[0].ssym.stoken);
1663
 
1664
                              msymbol =
1665
                                lookup_minimal_symbol (arg, NULL, NULL);
1666
                              if (msymbol != NULL)
1667
                                {
1668
                                  write_exp_msymbol (msymbol,
1669
                                                     lookup_function_type (builtin_type_int),
1670
                                                     builtin_type_int);
1671
                                }
1672
                              else if (!have_full_symbols () && !have_partial_symbols ())
1673
                                error ("No symbol table is loaded.  Use the \"file\" command.");
1674
                              else
1675
                                error ("No symbol \"%s\" in current context.",
1676
                                       copy_name (yyvsp[0].ssym.stoken));
1677
                            }
1678
                        }
1679
    break;
1680
 
1681
  case 58:
1682
#line 533 "f-exp.y"
1683
    {
1684
                  /* This is where the interesting stuff happens.  */
1685
                  int done = 0;
1686
                  int array_size;
1687
                  struct type *follow_type = yyvsp[-1].tval;
1688
                  struct type *range_type;
1689
 
1690
                  while (!done)
1691
                    switch (pop_type ())
1692
                      {
1693
                      case tp_end:
1694
                        done = 1;
1695
                        break;
1696
                      case tp_pointer:
1697
                        follow_type = lookup_pointer_type (follow_type);
1698
                        break;
1699
                      case tp_reference:
1700
                        follow_type = lookup_reference_type (follow_type);
1701
                        break;
1702
                      case tp_array:
1703
                        array_size = pop_type_int ();
1704
                        if (array_size != -1)
1705
                          {
1706
                            range_type =
1707
                              create_range_type ((struct type *) NULL,
1708
                                                 builtin_type_f_integer, 0,
1709
                                                 array_size - 1);
1710
                            follow_type =
1711
                              create_array_type ((struct type *) NULL,
1712
                                                 follow_type, range_type);
1713
                          }
1714
                        else
1715
                          follow_type = lookup_pointer_type (follow_type);
1716
                        break;
1717
                      case tp_function:
1718
                        follow_type = lookup_function_type (follow_type);
1719
                        break;
1720
                      }
1721
                  yyval.tval = follow_type;
1722
                }
1723
    break;
1724
 
1725
  case 59:
1726
#line 576 "f-exp.y"
1727
    { push_type (tp_pointer); yyval.voidval = 0; }
1728
    break;
1729
 
1730
  case 60:
1731
#line 578 "f-exp.y"
1732
    { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
1733
    break;
1734
 
1735
  case 61:
1736
#line 580 "f-exp.y"
1737
    { push_type (tp_reference); yyval.voidval = 0; }
1738
    break;
1739
 
1740
  case 62:
1741
#line 582 "f-exp.y"
1742
    { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
1743
    break;
1744
 
1745
  case 64:
1746
#line 587 "f-exp.y"
1747
    { yyval.voidval = yyvsp[-1].voidval; }
1748
    break;
1749
 
1750
  case 65:
1751
#line 589 "f-exp.y"
1752
    { push_type (tp_function); }
1753
    break;
1754
 
1755
  case 66:
1756
#line 591 "f-exp.y"
1757
    { push_type (tp_function); }
1758
    break;
1759
 
1760
  case 67:
1761
#line 595 "f-exp.y"
1762
    { yyval.voidval = 0; }
1763
    break;
1764
 
1765
  case 68:
1766
#line 597 "f-exp.y"
1767
    { free (yyvsp[-1].tvec); yyval.voidval = 0; }
1768
    break;
1769
 
1770
  case 69:
1771
#line 602 "f-exp.y"
1772
    { yyval.tval = yyvsp[0].tsym.type; }
1773
    break;
1774
 
1775
  case 70:
1776
#line 604 "f-exp.y"
1777
    { yyval.tval = builtin_type_f_integer; }
1778
    break;
1779
 
1780
  case 71:
1781
#line 606 "f-exp.y"
1782
    { yyval.tval = builtin_type_f_integer_s2; }
1783
    break;
1784
 
1785
  case 72:
1786
#line 608 "f-exp.y"
1787
    { yyval.tval = builtin_type_f_character; }
1788
    break;
1789
 
1790
  case 73:
1791
#line 610 "f-exp.y"
1792
    { yyval.tval = builtin_type_f_logical;}
1793
    break;
1794
 
1795
  case 74:
1796
#line 612 "f-exp.y"
1797
    { yyval.tval = builtin_type_f_logical_s2;}
1798
    break;
1799
 
1800
  case 75:
1801
#line 614 "f-exp.y"
1802
    { yyval.tval = builtin_type_f_logical_s1;}
1803
    break;
1804
 
1805
  case 76:
1806
#line 616 "f-exp.y"
1807
    { yyval.tval = builtin_type_f_real;}
1808
    break;
1809
 
1810
  case 77:
1811
#line 618 "f-exp.y"
1812
    { yyval.tval = builtin_type_f_real_s8;}
1813
    break;
1814
 
1815
  case 78:
1816
#line 620 "f-exp.y"
1817
    { yyval.tval = builtin_type_f_real_s16;}
1818
    break;
1819
 
1820
  case 79:
1821
#line 622 "f-exp.y"
1822
    { yyval.tval = builtin_type_f_complex_s8;}
1823
    break;
1824
 
1825
  case 80:
1826
#line 624 "f-exp.y"
1827
    { yyval.tval = builtin_type_f_complex_s16;}
1828
    break;
1829
 
1830
  case 81:
1831
#line 626 "f-exp.y"
1832
    { yyval.tval = builtin_type_f_complex_s32;}
1833
    break;
1834
 
1835
  case 82:
1836
#line 631 "f-exp.y"
1837
    { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1838
                  yyval.ivec[0] = 1;     /* Number of types in vector */
1839
                  yyval.tvec[1] = yyvsp[0].tval;
1840
                }
1841
    break;
1842
 
1843
  case 83:
1844
#line 636 "f-exp.y"
1845
    { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1846
                  yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1847
                  yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1848
                }
1849
    break;
1850
 
1851
  case 84:
1852
#line 643 "f-exp.y"
1853
    {  yyval.sval = yyvsp[0].ssym.stoken; }
1854
    break;
1855
 
1856
 
1857
    }
1858
 
1859
/* Line 1000 of yacc.c.  */
1860
#line 1861 "f-exp.c.tmp"
1861
 
1862
  yyvsp -= yylen;
1863
  yyssp -= yylen;
1864
 
1865
 
1866
  YY_STACK_PRINT (yyss, yyssp);
1867
 
1868
  *++yyvsp = yyval;
1869
 
1870
 
1871
  /* Now `shift' the result of the reduction.  Determine what state
1872
     that goes to, based on the state we popped back to and the rule
1873
     number reduced by.  */
1874
 
1875
  yyn = yyr1[yyn];
1876
 
1877
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1878
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1879
    yystate = yytable[yystate];
1880
  else
1881
    yystate = yydefgoto[yyn - YYNTOKENS];
1882
 
1883
  goto yynewstate;
1884
 
1885
 
1886
/*------------------------------------.
1887
| yyerrlab -- here on detecting error |
1888
`------------------------------------*/
1889
yyerrlab:
1890
  /* If not already recovering from an error, report this error.  */
1891
  if (!yyerrstatus)
1892
    {
1893
      ++yynerrs;
1894
#if YYERROR_VERBOSE
1895
      yyn = yypact[yystate];
1896
 
1897
      if (YYPACT_NINF < yyn && yyn < YYLAST)
1898
        {
1899
          YYSIZE_T yysize = 0;
1900
          int yytype = YYTRANSLATE (yychar);
1901
          const char* yyprefix;
1902
          char *yymsg;
1903
          int yyx;
1904
 
1905
          /* Start YYX at -YYN if negative to avoid negative indexes in
1906
             YYCHECK.  */
1907
          int yyxbegin = yyn < 0 ? -yyn : 0;
1908
 
1909
          /* Stay within bounds of both yycheck and yytname.  */
1910
          int yychecklim = YYLAST - yyn;
1911
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1912
          int yycount = 0;
1913
 
1914
          yyprefix = ", expecting ";
1915
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1916
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1917
              {
1918
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1919
                yycount += 1;
1920
                if (yycount == 5)
1921
                  {
1922
                    yysize = 0;
1923
                    break;
1924
                  }
1925
              }
1926
          yysize += (sizeof ("syntax error, unexpected ")
1927
                     + yystrlen (yytname[yytype]));
1928
          yymsg = (char *) YYSTACK_ALLOC (yysize);
1929
          if (yymsg != 0)
1930
            {
1931
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1932
              yyp = yystpcpy (yyp, yytname[yytype]);
1933
 
1934
              if (yycount < 5)
1935
                {
1936
                  yyprefix = ", expecting ";
1937
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1938
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1939
                      {
1940
                        yyp = yystpcpy (yyp, yyprefix);
1941
                        yyp = yystpcpy (yyp, yytname[yyx]);
1942
                        yyprefix = " or ";
1943
                      }
1944
                }
1945
              yyerror (yymsg);
1946
              YYSTACK_FREE (yymsg);
1947
            }
1948
          else
1949
            yyerror ("syntax error; also virtual memory exhausted");
1950
        }
1951
      else
1952
#endif /* YYERROR_VERBOSE */
1953
        yyerror ("syntax error");
1954
    }
1955
 
1956
 
1957
 
1958
  if (yyerrstatus == 3)
1959
    {
1960
      /* If just tried and failed to reuse lookahead token after an
1961
         error, discard it.  */
1962
 
1963
      if (yychar <= YYEOF)
1964
        {
1965
          /* If at end of input, pop the error token,
1966
             then the rest of the stack, then return failure.  */
1967
          if (yychar == YYEOF)
1968
             for (;;)
1969
               {
1970
                 YYPOPSTACK;
1971
                 if (yyssp == yyss)
1972
                   YYABORT;
1973
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1974
                 yydestruct (yystos[*yyssp], yyvsp);
1975
               }
1976
        }
1977
      else
1978
        {
1979
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1980
          yydestruct (yytoken, &yylval);
1981
          yychar = YYEMPTY;
1982
 
1983
        }
1984
    }
1985
 
1986
  /* Else will try to reuse lookahead token after shifting the error
1987
     token.  */
1988
  goto yyerrlab1;
1989
 
1990
 
1991
/*---------------------------------------------------.
1992
| yyerrorlab -- error raised explicitly by YYERROR.  |
1993
`---------------------------------------------------*/
1994
yyerrorlab:
1995
 
1996
#ifdef __GNUC__
1997
  /* Pacify GCC when the user code never invokes YYERROR and the label
1998
     yyerrorlab therefore never appears in user code.  */
1999
  if (0)
2000
     goto yyerrorlab;
2001
#endif
2002
 
2003
  yyvsp -= yylen;
2004
  yyssp -= yylen;
2005
  yystate = *yyssp;
2006
  goto yyerrlab1;
2007
 
2008
 
2009
/*-------------------------------------------------------------.
2010
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2011
`-------------------------------------------------------------*/
2012
yyerrlab1:
2013
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2014
 
2015
  for (;;)
2016
    {
2017
      yyn = yypact[yystate];
2018
      if (yyn != YYPACT_NINF)
2019
        {
2020
          yyn += YYTERROR;
2021
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2022
            {
2023
              yyn = yytable[yyn];
2024
              if (0 < yyn)
2025
                break;
2026
            }
2027
        }
2028
 
2029
      /* Pop the current state because it cannot handle the error token.  */
2030
      if (yyssp == yyss)
2031
        YYABORT;
2032
 
2033
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2034
      yydestruct (yystos[yystate], yyvsp);
2035
      YYPOPSTACK;
2036
      yystate = *yyssp;
2037
      YY_STACK_PRINT (yyss, yyssp);
2038
    }
2039
 
2040
  if (yyn == YYFINAL)
2041
    YYACCEPT;
2042
 
2043
  YYDPRINTF ((stderr, "Shifting error token, "));
2044
 
2045
  *++yyvsp = yylval;
2046
 
2047
 
2048
  yystate = yyn;
2049
  goto yynewstate;
2050
 
2051
 
2052
/*-------------------------------------.
2053
| yyacceptlab -- YYACCEPT comes here.  |
2054
`-------------------------------------*/
2055
yyacceptlab:
2056
  yyresult = 0;
2057
  goto yyreturn;
2058
 
2059
/*-----------------------------------.
2060
| yyabortlab -- YYABORT comes here.  |
2061
`-----------------------------------*/
2062
yyabortlab:
2063
  yyresult = 1;
2064
  goto yyreturn;
2065
 
2066
#ifndef yyoverflow
2067
/*----------------------------------------------.
2068
| yyoverflowlab -- parser overflow comes here.  |
2069
`----------------------------------------------*/
2070
yyoverflowlab:
2071
  yyerror ("parser stack overflow");
2072
  yyresult = 2;
2073
  /* Fall through.  */
2074
#endif
2075
 
2076
yyreturn:
2077
#ifndef yyoverflow
2078
  if (yyss != yyssa)
2079
    YYSTACK_FREE (yyss);
2080
#endif
2081
  return yyresult;
2082
}
2083
 
2084
 
2085
#line 656 "f-exp.y"
2086
 
2087
 
2088
/* Take care of parsing a number (anything that starts with a digit).
2089
   Set yylval and return the token type; update lexptr.
2090
   LEN is the number of characters in it.  */
2091
 
2092
/*** Needs some error checking for the float case ***/
2093
 
2094
static int
2095
parse_number (p, len, parsed_float, putithere)
2096
     char *p;
2097
     int len;
2098
     int parsed_float;
2099
     YYSTYPE *putithere;
2100
{
2101
  LONGEST n = 0;
2102
  LONGEST prevn = 0;
2103
  int c;
2104
  int base = input_radix;
2105
  int unsigned_p = 0;
2106
  int long_p = 0;
2107
  ULONGEST high_bit;
2108
  struct type *signed_type;
2109
  struct type *unsigned_type;
2110
 
2111
  if (parsed_float)
2112
    {
2113
      /* It's a float since it contains a point or an exponent.  */
2114
      /* [dD] is not understood as an exponent by atof, change it to 'e'.  */
2115
      char *tmp, *tmp2;
2116
 
2117
      tmp = xstrdup (p);
2118
      for (tmp2 = tmp; *tmp2; ++tmp2)
2119
        if (*tmp2 == 'd' || *tmp2 == 'D')
2120
          *tmp2 = 'e';
2121
      putithere->dval = atof (tmp);
2122
      free (tmp);
2123
      return FLOAT;
2124
    }
2125
 
2126
  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2127
  if (p[0] == '0')
2128
    switch (p[1])
2129
      {
2130
      case 'x':
2131
      case 'X':
2132
        if (len >= 3)
2133
          {
2134
            p += 2;
2135
            base = 16;
2136
            len -= 2;
2137
          }
2138
        break;
2139
 
2140
      case 't':
2141
      case 'T':
2142
      case 'd':
2143
      case 'D':
2144
        if (len >= 3)
2145
          {
2146
            p += 2;
2147
            base = 10;
2148
            len -= 2;
2149
          }
2150
        break;
2151
 
2152
      default:
2153
        base = 8;
2154
        break;
2155
      }
2156
 
2157
  while (len-- > 0)
2158
    {
2159
      c = *p++;
2160
      if (isupper (c))
2161
        c = tolower (c);
2162
      if (len == 0 && c == 'l')
2163
        long_p = 1;
2164
      else if (len == 0 && c == 'u')
2165
        unsigned_p = 1;
2166
      else
2167
        {
2168
          int i;
2169
          if (c >= '0' && c <= '9')
2170
            i = c - '0';
2171
          else if (c >= 'a' && c <= 'f')
2172
            i = c - 'a' + 10;
2173
          else
2174
            return ERROR;       /* Char not a digit */
2175
          if (i >= base)
2176
            return ERROR;               /* Invalid digit in this base */
2177
          n *= base;
2178
          n += i;
2179
        }
2180
      /* Portably test for overflow (only works for nonzero values, so make
2181
         a second check for zero).  */
2182
      if ((prevn >= n) && n != 0)
2183
        unsigned_p=1;           /* Try something unsigned */
2184
      /* If range checking enabled, portably test for unsigned overflow.  */
2185
      if (RANGE_CHECK && n != 0)
2186
        {
2187
          if ((unsigned_p && (unsigned)prevn >= (unsigned)n))
2188
            range_error("Overflow on numeric constant.");
2189
        }
2190
      prevn = n;
2191
    }
2192
 
2193
  /* If the number is too big to be an int, or it's got an l suffix
2194
     then it's a long.  Work out if this has to be a long by
2195
     shifting right and and seeing if anything remains, and the
2196
     target int size is different to the target long size.
2197
 
2198
     In the expression below, we could have tested
2199
     (n >> gdbarch_int_bit (current_gdbarch))
2200
     to see if it was zero,
2201
     but too many compilers warn about that, when ints and longs
2202
     are the same size.  So we shift it twice, with fewer bits
2203
     each time, for the same result.  */
2204
 
2205
  if ((gdbarch_int_bit (current_gdbarch) != gdbarch_long_bit (current_gdbarch)
2206
       && ((n >> 2)
2207
           >> (gdbarch_int_bit (current_gdbarch)-2))) /* Avoid shift warning */
2208
      || long_p)
2209
    {
2210
      high_bit = ((ULONGEST)1) << (gdbarch_long_bit (current_gdbarch)-1);
2211
      unsigned_type = builtin_type_unsigned_long;
2212
      signed_type = builtin_type_long;
2213
    }
2214
  else
2215
    {
2216
      high_bit = ((ULONGEST)1) << (gdbarch_int_bit (current_gdbarch)-1);
2217
      unsigned_type = builtin_type_unsigned_int;
2218
      signed_type = builtin_type_int;
2219
    }
2220
 
2221
  putithere->typed_val.val = n;
2222
 
2223
  /* If the high bit of the worked out type is set then this number
2224
     has to be unsigned. */
2225
 
2226
  if (unsigned_p || (n & high_bit))
2227
    putithere->typed_val.type = unsigned_type;
2228
  else
2229
    putithere->typed_val.type = signed_type;
2230
 
2231
  return INT;
2232
}
2233
 
2234
struct token
2235
{
2236
  char *operator;
2237
  int token;
2238
  enum exp_opcode opcode;
2239
};
2240
 
2241
static const struct token dot_ops[] =
2242
{
2243
  { ".and.", BOOL_AND, BINOP_END },
2244
  { ".AND.", BOOL_AND, BINOP_END },
2245
  { ".or.", BOOL_OR, BINOP_END },
2246
  { ".OR.", BOOL_OR, BINOP_END },
2247
  { ".not.", BOOL_NOT, BINOP_END },
2248
  { ".NOT.", BOOL_NOT, BINOP_END },
2249
  { ".eq.", EQUAL, BINOP_END },
2250
  { ".EQ.", EQUAL, BINOP_END },
2251
  { ".eqv.", EQUAL, BINOP_END },
2252
  { ".NEQV.", NOTEQUAL, BINOP_END },
2253
  { ".neqv.", NOTEQUAL, BINOP_END },
2254
  { ".EQV.", EQUAL, BINOP_END },
2255
  { ".ne.", NOTEQUAL, BINOP_END },
2256
  { ".NE.", NOTEQUAL, BINOP_END },
2257
  { ".le.", LEQ, BINOP_END },
2258
  { ".LE.", LEQ, BINOP_END },
2259
  { ".ge.", GEQ, BINOP_END },
2260
  { ".GE.", GEQ, BINOP_END },
2261
  { ".gt.", GREATERTHAN, BINOP_END },
2262
  { ".GT.", GREATERTHAN, BINOP_END },
2263
  { ".lt.", LESSTHAN, BINOP_END },
2264
  { ".LT.", LESSTHAN, BINOP_END },
2265
  { NULL, 0, 0 }
2266
};
2267
 
2268
struct f77_boolean_val
2269
{
2270
  char *name;
2271
  int value;
2272
};
2273
 
2274
static const struct f77_boolean_val boolean_values[]  =
2275
{
2276
  { ".true.", 1 },
2277
  { ".TRUE.", 1 },
2278
  { ".false.", 0 },
2279
  { ".FALSE.", 0 },
2280
  { NULL, 0 }
2281
};
2282
 
2283
static const struct token f77_keywords[] =
2284
{
2285
  { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END },
2286
  { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END },
2287
  { "character", CHARACTER, BINOP_END },
2288
  { "integer_2", INT_S2_KEYWORD, BINOP_END },
2289
  { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
2290
  { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
2291
  { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
2292
  { "integer", INT_KEYWORD, BINOP_END },
2293
  { "logical", LOGICAL_KEYWORD, BINOP_END },
2294
  { "real_16", REAL_S16_KEYWORD, BINOP_END },
2295
  { "complex", COMPLEX_S8_KEYWORD, BINOP_END },
2296
  { "sizeof", SIZEOF, BINOP_END },
2297
  { "real_8", REAL_S8_KEYWORD, BINOP_END },
2298
  { "real", REAL_KEYWORD, BINOP_END },
2299
  { NULL, 0, 0 }
2300
};
2301
 
2302
/* Implementation of a dynamically expandable buffer for processing input
2303
   characters acquired through lexptr and building a value to return in
2304
   yylval. Ripped off from ch-exp.y */
2305
 
2306
static char *tempbuf;           /* Current buffer contents */
2307
static int tempbufsize;         /* Size of allocated buffer */
2308
static int tempbufindex;        /* Current index into buffer */
2309
 
2310
#define GROWBY_MIN_SIZE 64      /* Minimum amount to grow buffer by */
2311
 
2312
#define CHECKBUF(size) \
2313
  do { \
2314
    if (tempbufindex + (size) >= tempbufsize) \
2315
      { \
2316
        growbuf_by_size (size); \
2317
      } \
2318
  } while (0);
2319
 
2320
 
2321
/* Grow the static temp buffer if necessary, including allocating the first one
2322
   on demand. */
2323
 
2324
static void
2325
growbuf_by_size (count)
2326
     int count;
2327
{
2328
  int growby;
2329
 
2330
  growby = max (count, GROWBY_MIN_SIZE);
2331
  tempbufsize += growby;
2332
  if (tempbuf == NULL)
2333
    tempbuf = (char *) xmalloc (tempbufsize);
2334
  else
2335
    tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
2336
}
2337
 
2338
/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
2339
   string-literals.
2340
 
2341
   Recognize a string literal.  A string literal is a nonzero sequence
2342
   of characters enclosed in matching single quotes, except that
2343
   a single character inside single quotes is a character literal, which
2344
   we reject as a string literal.  To embed the terminator character inside
2345
   a string, it is simply doubled (I.E. 'this''is''one''string') */
2346
 
2347
static int
2348
match_string_literal ()
2349
{
2350
  char *tokptr = lexptr;
2351
 
2352
  for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
2353
    {
2354
      CHECKBUF (1);
2355
      if (*tokptr == *lexptr)
2356
        {
2357
          if (*(tokptr + 1) == *lexptr)
2358
            tokptr++;
2359
          else
2360
            break;
2361
        }
2362
      tempbuf[tempbufindex++] = *tokptr;
2363
    }
2364
  if (*tokptr == '\0'                                   /* no terminator */
2365
      || tempbufindex == 0)                              /* no string */
2366
    return 0;
2367
  else
2368
    {
2369
      tempbuf[tempbufindex] = '\0';
2370
      yylval.sval.ptr = tempbuf;
2371
      yylval.sval.length = tempbufindex;
2372
      lexptr = ++tokptr;
2373
      return STRING_LITERAL;
2374
    }
2375
}
2376
 
2377
/* Read one token, getting characters through lexptr.  */
2378
 
2379
static int
2380
yylex ()
2381
{
2382
  int c;
2383
  int namelen;
2384
  unsigned int i,token;
2385
  char *tokstart;
2386
 
2387
 retry:
2388
 
2389
  prev_lexptr = lexptr;
2390
 
2391
  tokstart = lexptr;
2392
 
2393
  /* First of all, let us make sure we are not dealing with the
2394
     special tokens .true. and .false. which evaluate to 1 and 0.  */
2395
 
2396
  if (*lexptr == '.')
2397
    {
2398
      for (i = 0; boolean_values[i].name != NULL; i++)
2399
        {
2400
          if (strncmp (tokstart, boolean_values[i].name,
2401
                       strlen (boolean_values[i].name)) == 0)
2402
            {
2403
              lexptr += strlen (boolean_values[i].name);
2404
              yylval.lval = boolean_values[i].value;
2405
              return BOOLEAN_LITERAL;
2406
            }
2407
        }
2408
    }
2409
 
2410
  /* See if it is a special .foo. operator.  */
2411
 
2412
  for (i = 0; dot_ops[i].operator != NULL; i++)
2413
    if (strncmp (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)) == 0)
2414
      {
2415
        lexptr += strlen (dot_ops[i].operator);
2416
        yylval.opcode = dot_ops[i].opcode;
2417
        return dot_ops[i].token;
2418
      }
2419
 
2420
  /* See if it is an exponentiation operator.  */
2421
 
2422
  if (strncmp (tokstart, "**", 2) == 0)
2423
    {
2424
      lexptr += 2;
2425
      yylval.opcode = BINOP_EXP;
2426
      return STARSTAR;
2427
    }
2428
 
2429
  switch (c = *tokstart)
2430
    {
2431
    case 0:
2432
      return 0;
2433
 
2434
    case ' ':
2435
    case '\t':
2436
    case '\n':
2437
      lexptr++;
2438
      goto retry;
2439
 
2440
    case '\'':
2441
      token = match_string_literal ();
2442
      if (token != 0)
2443
        return (token);
2444
      break;
2445
 
2446
    case '(':
2447
      paren_depth++;
2448
      lexptr++;
2449
      return c;
2450
 
2451
    case ')':
2452
      if (paren_depth == 0)
2453
        return 0;
2454
      paren_depth--;
2455
      lexptr++;
2456
      return c;
2457
 
2458
    case ',':
2459
      if (comma_terminates && paren_depth == 0)
2460
        return 0;
2461
      lexptr++;
2462
      return c;
2463
 
2464
    case '.':
2465
      /* Might be a floating point number.  */
2466
      if (lexptr[1] < '0' || lexptr[1] > '9')
2467
        goto symbol;            /* Nope, must be a symbol. */
2468
      /* FALL THRU into number case.  */
2469
 
2470
    case '0':
2471
    case '1':
2472
    case '2':
2473
    case '3':
2474
    case '4':
2475
    case '5':
2476
    case '6':
2477
    case '7':
2478
    case '8':
2479
    case '9':
2480
      {
2481
        /* It's a number.  */
2482
        int got_dot = 0, got_e = 0, got_d = 0, toktype;
2483
        char *p = tokstart;
2484
        int hex = input_radix > 10;
2485
 
2486
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2487
          {
2488
            p += 2;
2489
            hex = 1;
2490
          }
2491
        else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2492
          {
2493
            p += 2;
2494
            hex = 0;
2495
          }
2496
 
2497
        for (;; ++p)
2498
          {
2499
            if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2500
              got_dot = got_e = 1;
2501
            else if (!hex && !got_d && (*p == 'd' || *p == 'D'))
2502
              got_dot = got_d = 1;
2503
            else if (!hex && !got_dot && *p == '.')
2504
              got_dot = 1;
2505
            else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
2506
                     || (got_d && (p[-1] == 'd' || p[-1] == 'D')))
2507
                     && (*p == '-' || *p == '+'))
2508
              /* This is the sign of the exponent, not the end of the
2509
                 number.  */
2510
              continue;
2511
            /* We will take any letters or digits.  parse_number will
2512
               complain if past the radix, or if L or U are not final.  */
2513
            else if ((*p < '0' || *p > '9')
2514
                     && ((*p < 'a' || *p > 'z')
2515
                         && (*p < 'A' || *p > 'Z')))
2516
              break;
2517
          }
2518
        toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d,
2519
                                &yylval);
2520
        if (toktype == ERROR)
2521
          {
2522
            char *err_copy = (char *) alloca (p - tokstart + 1);
2523
 
2524
            memcpy (err_copy, tokstart, p - tokstart);
2525
            err_copy[p - tokstart] = 0;
2526
            error ("Invalid number \"%s\".", err_copy);
2527
          }
2528
        lexptr = p;
2529
        return toktype;
2530
      }
2531
 
2532
    case '+':
2533
    case '-':
2534
    case '*':
2535
    case '/':
2536
    case '%':
2537
    case '|':
2538
    case '&':
2539
    case '^':
2540
    case '~':
2541
    case '!':
2542
    case '@':
2543
    case '<':
2544
    case '>':
2545
    case '[':
2546
    case ']':
2547
    case '?':
2548
    case ':':
2549
    case '=':
2550
    case '{':
2551
    case '}':
2552
    symbol:
2553
      lexptr++;
2554
      return c;
2555
    }
2556
 
2557
  if (!(c == '_' || c == '$'
2558
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2559
    /* We must have come across a bad character (e.g. ';').  */
2560
    error ("Invalid character '%c' in expression.", c);
2561
 
2562
  namelen = 0;
2563
  for (c = tokstart[namelen];
2564
       (c == '_' || c == '$' || (c >= '0' && c <= '9')
2565
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2566
       c = tokstart[++namelen]);
2567
 
2568
  /* The token "if" terminates the expression and is NOT
2569
     removed from the input stream.  */
2570
 
2571
  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2572
    return 0;
2573
 
2574
  lexptr += namelen;
2575
 
2576
  /* Catch specific keywords.  */
2577
 
2578
  for (i = 0; f77_keywords[i].operator != NULL; i++)
2579
    if (strncmp (tokstart, f77_keywords[i].operator,
2580
                 strlen(f77_keywords[i].operator)) == 0)
2581
      {
2582
        /*      lexptr += strlen(f77_keywords[i].operator); */
2583
        yylval.opcode = f77_keywords[i].opcode;
2584
        return f77_keywords[i].token;
2585
      }
2586
 
2587
  yylval.sval.ptr = tokstart;
2588
  yylval.sval.length = namelen;
2589
 
2590
  if (*tokstart == '$')
2591
    {
2592
      write_dollar_variable (yylval.sval);
2593
      return VARIABLE;
2594
    }
2595
 
2596
  /* Use token-type TYPENAME for symbols that happen to be defined
2597
     currently as names of types; NAME for other symbols.
2598
     The caller is not constrained to care about the distinction.  */
2599
  {
2600
    char *tmp = copy_name (yylval.sval);
2601
    struct symbol *sym;
2602
    int is_a_field_of_this = 0;
2603
    int hextype;
2604
 
2605
    sym = lookup_symbol (tmp, expression_context_block,
2606
                         VAR_DOMAIN,
2607
                         current_language->la_language == language_cplus
2608
                         ? &is_a_field_of_this : NULL,
2609
                         NULL);
2610
    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2611
      {
2612
        yylval.tsym.type = SYMBOL_TYPE (sym);
2613
        return TYPENAME;
2614
      }
2615
    yylval.tsym.type
2616
      = language_lookup_primitive_type_by_name (current_language,
2617
                                                current_gdbarch, tmp);
2618
    if (yylval.tsym.type != NULL)
2619
      return TYPENAME;
2620
 
2621
    /* Input names that aren't symbols but ARE valid hex numbers,
2622
       when the input radix permits them, can be names or numbers
2623
       depending on the parse.  Note we support radixes > 16 here.  */
2624
    if (!sym
2625
        && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
2626
            || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2627
      {
2628
        YYSTYPE newlval;        /* Its value is ignored.  */
2629
        hextype = parse_number (tokstart, namelen, 0, &newlval);
2630
        if (hextype == INT)
2631
          {
2632
            yylval.ssym.sym = sym;
2633
            yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2634
            return NAME_OR_INT;
2635
          }
2636
      }
2637
 
2638
    /* Any other kind of symbol */
2639
    yylval.ssym.sym = sym;
2640
    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2641
    return NAME;
2642
  }
2643
}
2644
 
2645
void
2646
yyerror (msg)
2647
     char *msg;
2648
{
2649
  if (prev_lexptr)
2650
    lexptr = prev_lexptr;
2651
 
2652
  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2653
}
2654
 
2655
 

powered by: WebSVN 2.1.0

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