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

Subversion Repositories openrisc

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

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

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