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

Subversion Repositories openrisc

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

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

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

powered by: WebSVN 2.1.0

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