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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [f-exp.tab.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
 
2
/*  A Bison parser, made from f-exp.y
3
 by  GNU Bison version 1.27
4
  */
5
 
6
#define YYBISON 1  /* Identify Bison output.  */
7
 
8
#define INT     257
9
#define FLOAT   258
10
#define STRING_LITERAL  259
11
#define BOOLEAN_LITERAL 260
12
#define NAME    261
13
#define TYPENAME        262
14
#define NAME_OR_INT     263
15
#define SIZEOF  264
16
#define ERROR   265
17
#define INT_KEYWORD     266
18
#define INT_S2_KEYWORD  267
19
#define LOGICAL_S1_KEYWORD      268
20
#define LOGICAL_S2_KEYWORD      269
21
#define LOGICAL_KEYWORD 270
22
#define REAL_KEYWORD    271
23
#define REAL_S8_KEYWORD 272
24
#define REAL_S16_KEYWORD        273
25
#define COMPLEX_S8_KEYWORD      274
26
#define COMPLEX_S16_KEYWORD     275
27
#define COMPLEX_S32_KEYWORD     276
28
#define BOOL_AND        277
29
#define BOOL_OR 278
30
#define BOOL_NOT        279
31
#define CHARACTER       280
32
#define VARIABLE        281
33
#define ASSIGN_MODIFY   282
34
#define ABOVE_COMMA     283
35
#define EQUAL   284
36
#define NOTEQUAL        285
37
#define LESSTHAN        286
38
#define GREATERTHAN     287
39
#define LEQ     288
40
#define GEQ     289
41
#define LSH     290
42
#define RSH     291
43
#define UNARY   292
44
 
45
#line 44 "f-exp.y"
46
 
47
 
48
#include "defs.h"
49
#include "gdb_string.h"
50
#include "expression.h"
51
#include "value.h"
52
#include "parser-defs.h"
53
#include "language.h"
54
#include "f-lang.h"
55
#include "bfd.h" /* Required by objfiles.h.  */
56
#include "symfile.h" /* Required by objfiles.h.  */
57
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
58
#include <ctype.h>
59
 
60
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
61
   as well as gratuitiously global symbol names, so we can have multiple
62
   yacc generated parsers in gdb.  Note that these are only the variables
63
   produced by yacc.  If other parser generators (bison, byacc, etc) produce
64
   additional global names that conflict at link time, then those parser
65
   generators need to be fixed instead of adding those names to this list. */
66
 
67
#define yymaxdepth f_maxdepth
68
#define yyparse f_parse
69
#define yylex   f_lex
70
#define yyerror f_error
71
#define yylval  f_lval
72
#define yychar  f_char
73
#define yydebug f_debug
74
#define yypact  f_pact  
75
#define yyr1    f_r1                    
76
#define yyr2    f_r2                    
77
#define yydef   f_def           
78
#define yychk   f_chk           
79
#define yypgo   f_pgo           
80
#define yyact   f_act           
81
#define yyexca  f_exca
82
#define yyerrflag f_errflag
83
#define yynerrs f_nerrs
84
#define yyps    f_ps
85
#define yypv    f_pv
86
#define yys     f_s
87
#define yy_yys  f_yys
88
#define yystate f_state
89
#define yytmp   f_tmp
90
#define yyv     f_v
91
#define yy_yyv  f_yyv
92
#define yyval   f_val
93
#define yylloc  f_lloc
94
#define yyreds  f_reds          /* With YYDEBUG defined */
95
#define yytoks  f_toks          /* With YYDEBUG defined */
96
#define yyname  f_name          /* With YYDEBUG defined */
97
#define yyrule  f_rule          /* With YYDEBUG defined */
98
#define yylhs   f_yylhs
99
#define yylen   f_yylen
100
#define yydefred f_yydefred
101
#define yydgoto f_yydgoto
102
#define yysindex f_yysindex
103
#define yyrindex f_yyrindex
104
#define yygindex f_yygindex
105
#define yytable  f_yytable
106
#define yycheck  f_yycheck
107
 
108
#ifndef YYDEBUG
109
#define YYDEBUG 1               /* Default to yydebug support */
110
#endif
111
 
112
#define YYFPRINTF parser_fprintf
113
 
114
int yyparse (void);
115
 
116
static int yylex (void);
117
 
118
void yyerror (char *);
119
 
120
static void growbuf_by_size (int);
121
 
122
static int match_string_literal (void);
123
 
124
 
125
#line 128 "f-exp.y"
126
typedef union
127
  {
128
    LONGEST lval;
129
    struct {
130
      LONGEST val;
131
      struct type *type;
132
    } typed_val;
133
    DOUBLEST dval;
134
    struct symbol *sym;
135
    struct type *tval;
136
    struct stoken sval;
137
    struct ttype tsym;
138
    struct symtoken ssym;
139
    int voidval;
140
    struct block *bval;
141
    enum exp_opcode opcode;
142
    struct internalvar *ivar;
143
 
144
    struct type **tvec;
145
    int *ivec;
146
  } YYSTYPE;
147
#line 150 "f-exp.y"
148
 
149
/* YYSTYPE gets defined by %union */
150
static int parse_number (char *, int, int, YYSTYPE *);
151
#include <stdio.h>
152
 
153
#ifndef __cplusplus
154
#ifndef __STDC__
155
#define const
156
#endif
157
#endif
158
 
159
 
160
 
161
#define YYFINAL         125
162
#define YYFLAG          -32768
163
#define YYNTBASE        55
164
 
165
#define YYTRANSLATE(x) ((unsigned)(x) <= 292 ? yytranslate[x] : 71)
166
 
167
static const char yytranslate[] = {     0,
168
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
169
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
170
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
171
     2,     2,     2,     2,     2,     2,    49,    35,     2,    51,
172
    52,    47,    45,    29,    46,     2,    48,     2,     2,     2,
173
     2,     2,     2,     2,     2,     2,     2,    54,     2,     2,
174
    31,     2,    32,    44,     2,     2,     2,     2,     2,     2,
175
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
176
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
177
     2,     2,     2,    34,     2,     2,     2,     2,     2,     2,
178
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
179
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
180
     2,     2,     2,    33,     2,    53,     2,     2,     2,     2,
181
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
182
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
183
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
184
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
185
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
186
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
187
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
188
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
189
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
190
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
191
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
192
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
193
     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
194
     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
195
    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
196
    27,    28,    30,    36,    37,    38,    39,    40,    41,    42,
197
    43,    50
198
};
199
 
200
#if YYDEBUG != 0
201
static const short yyprhs[] = {     0,
202
     0,     2,     4,     6,    10,    13,    16,    19,    22,    25,
203
    28,    29,    35,    36,    38,    40,    44,    48,    52,    56,
204
    61,    65,    69,    73,    77,    81,    85,    89,    93,    97,
205
   101,   105,   109,   113,   117,   121,   125,   129,   133,   137,
206
   141,   145,   147,   149,   151,   153,   155,   160,   162,   164,
207
   166,   168,   170,   173,   175,   178,   180,   183,   185,   189,
208
   192,   194,   197,   201,   203,   205,   207,   209,   211,   213,
209
   215,   217,   219,   221,   223,   225,   227,   229,   231,   235,
210
   237,   239,   241
211
};
212
 
213
static const short yyrhs[] = {    57,
214
     0,    56,     0,    63,     0,    51,    57,    52,     0,    47,
215
    57,     0,    35,    57,     0,    46,    57,     0,    25,    57,
216
     0,    53,    57,     0,    10,    57,     0,     0,    57,    51,
217
    58,    59,    52,     0,     0,    57,     0,    60,     0,    59,
218
    29,    57,     0,    57,    54,    57,     0,    57,    29,    57,
219
     0,    51,    61,    52,     0,    51,    63,    52,    57,     0,
220
    57,    44,    57,     0,    57,    47,    57,     0,    57,    48,
221
    57,     0,    57,    49,    57,     0,    57,    45,    57,     0,
222
    57,    46,    57,     0,    57,    42,    57,     0,    57,    43,
223
    57,     0,    57,    36,    57,     0,    57,    37,    57,     0,
224
    57,    40,    57,     0,    57,    41,    57,     0,    57,    38,
225
    57,     0,    57,    39,    57,     0,    57,    35,    57,     0,
226
    57,    34,    57,     0,    57,    33,    57,     0,    57,    23,
227
    57,     0,    57,    24,    57,     0,    57,    31,    57,     0,
228
    57,    28,    57,     0,     3,     0,     9,     0,     4,     0,
229
    62,     0,    27,     0,    10,    51,    63,    52,     0,     6,
230
     0,     5,     0,    70,     0,    64,     0,    68,     0,    68,
231
    65,     0,    47,     0,    47,    65,     0,    35,     0,    35,
232
    65,     0,    66,     0,    51,    65,    52,     0,    66,    67,
233
     0,    67,     0,    51,    52,     0,    51,    69,    52,     0,
234
     8,     0,    12,     0,    13,     0,    26,     0,    16,     0,
235
    15,     0,    14,     0,    17,     0,    18,     0,    19,     0,
236
    20,     0,    21,     0,    22,     0,     8,     0,    63,     0,
237
    69,    29,    63,     0,     7,     0,     8,     0,     9,     0,
238
     7,     0
239
};
240
 
241
#endif
242
 
243
#if YYDEBUG != 0
244
static const short yyrline[] = { 0,
245
   227,   228,   231,   237,   242,   246,   250,   254,   258,   262,
246
   271,   273,   279,   282,   286,   290,   294,   299,   303,   307,
247
   315,   319,   323,   327,   331,   335,   339,   343,   347,   351,
248
   355,   359,   363,   367,   371,   375,   379,   383,   388,   392,
249
   396,   402,   409,   418,   425,   428,   431,   439,   446,   454,
250
   498,   501,   502,   545,   547,   549,   551,   553,   556,   558,
251
   560,   564,   566,   571,   573,   575,   577,   579,   581,   583,
252
   585,   587,   589,   591,   593,   595,   599,   603,   608,   615,
253
   617,   619,   623
254
};
255
#endif
256
 
257
 
258
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
259
 
260
static const char * const yytname[] = {   "$","error","$undefined.","INT","FLOAT",
261
"STRING_LITERAL","BOOLEAN_LITERAL","NAME","TYPENAME","NAME_OR_INT","SIZEOF",
262
"ERROR","INT_KEYWORD","INT_S2_KEYWORD","LOGICAL_S1_KEYWORD","LOGICAL_S2_KEYWORD",
263
"LOGICAL_KEYWORD","REAL_KEYWORD","REAL_S8_KEYWORD","REAL_S16_KEYWORD","COMPLEX_S8_KEYWORD",
264
"COMPLEX_S16_KEYWORD","COMPLEX_S32_KEYWORD","BOOL_AND","BOOL_OR","BOOL_NOT",
265
"CHARACTER","VARIABLE","ASSIGN_MODIFY","','","ABOVE_COMMA","'='","'?'","'|'",
266
"'^'","'&'","EQUAL","NOTEQUAL","LESSTHAN","GREATERTHAN","LEQ","GEQ","LSH","RSH",
267
"'@'","'+'","'-'","'*'","'/'","'%'","UNARY","'('","')'","'~'","':'","start",
268
"type_exp","exp","@1","arglist","substring","complexnum","variable","type","ptype",
269
"abs_decl","direct_abs_decl","func_mod","typebase","nonempty_typelist","name_not_typename", NULL
270
};
271
#endif
272
 
273
static const short yyr1[] = {     0,
274
    55,    55,    56,    57,    57,    57,    57,    57,    57,    57,
275
    58,    57,    59,    59,    59,    59,    60,    61,    57,    57,
276
    57,    57,    57,    57,    57,    57,    57,    57,    57,    57,
277
    57,    57,    57,    57,    57,    57,    57,    57,    57,    57,
278
    57,    57,    57,    57,    57,    57,    57,    57,    57,    62,
279
    63,    64,    64,    65,    65,    65,    65,    65,    66,    66,
280
    66,    67,    67,    68,    68,    68,    68,    68,    68,    68,
281
    68,    68,    68,    68,    68,    68,    -1,    69,    69,    -1,
282
    -1,    -1,    70
283
};
284
 
285
static const short yyr2[] = {     0,
286
     1,     1,     1,     3,     2,     2,     2,     2,     2,     2,
287
     0,     5,     0,     1,     1,     3,     3,     3,     3,     4,
288
     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
289
     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
290
     3,     1,     1,     1,     1,     1,     4,     1,     1,     1,
291
     1,     1,     2,     1,     2,     1,     2,     1,     3,     2,
292
     1,     2,     3,     1,     1,     1,     1,     1,     1,     1,
293
     1,     1,     1,     1,     1,     1,     1,     1,     3,     1,
294
     1,     1,     1
295
};
296
 
297
static const short yydefact[] = {     0,
298
    42,    44,    49,    48,    83,    64,    43,     0,    65,    66,
299
    70,    69,    68,    71,    72,    73,    74,    75,    76,     0,
300
    67,    46,     0,     0,     0,     0,     0,     2,     1,    45,
301
     3,    51,    52,    50,     0,    10,     8,     6,     7,     5,
302
     0,     0,     0,     9,     0,     0,     0,     0,     0,     0,
303
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
304
     0,     0,     0,     0,     0,    11,    56,    54,     0,    53,
305
    58,    61,     0,     0,     4,    19,     0,    38,    39,    41,
306
    40,    37,    36,    35,    29,    30,    33,    34,    31,    32,
307
    27,    28,    21,    25,    26,    22,    23,    24,    13,    57,
308
    55,    62,    78,     0,     0,     0,    60,    47,    18,    20,
309
    14,     0,    15,    59,     0,    63,     0,     0,    12,    79,
310
    17,    16,     0,     0,     0
311
};
312
 
313
static const short yydefgoto[] = {   123,
314
    28,    41,    99,   112,   113,    42,    30,   103,    32,    70,
315
    71,    72,    33,   105,    34
316
};
317
 
318
static const short yypact[] = {    75,
319
-32768,-32768,-32768,-32768,-32768,-32768,-32768,   126,-32768,-32768,
320
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   135,
321
-32768,-32768,   135,   135,   135,    75,   135,-32768,   309,-32768,
322
-32768,-32768,   -34,-32768,    75,   -49,   -49,   -49,   -49,   -49,
323
   279,   -46,   -45,   -49,   135,   135,   135,   135,   135,   135,
324
   135,   135,   135,   135,   135,   135,   135,   135,   135,   135,
325
   135,   135,   135,   135,   135,-32768,   -34,   -34,   206,-32768,
326
   -42,-32768,   -36,   135,-32768,-32768,   135,   355,   336,   309,
327
   309,   390,   407,   161,   221,   221,   -11,   -11,   -11,   -11,
328
    22,    22,    58,   -37,   -37,   -49,   -49,   -49,   135,-32768,
329
-32768,-32768,-32768,   -33,   -26,   230,-32768,   186,   309,   -49,
330
   250,   -24,-32768,-32768,   397,-32768,   135,   135,-32768,-32768,
331
   309,   309,    15,    18,-32768
332
};
333
 
334
static const short yypgoto[] = {-32768,
335
-32768,     0,-32768,-32768,-32768,-32768,-32768,     4,-32768,   -25,
336
-32768,   -50,-32768,-32768,-32768
337
};
338
 
339
 
340
#define YYLAST          458
341
 
342
 
343
static const short yytable[] = {    29,
344
    67,    66,   115,    31,   118,    76,    77,    36,   106,    63,
345
    64,    65,    68,    66,   124,   108,    69,   125,   114,    37,
346
   107,     0,    38,    39,    40,   116,    44,   119,     0,    43,
347
    58,    59,    60,    61,    62,    63,    64,    65,    73,    66,
348
     0,   100,   101,   104,    78,    79,    80,    81,    82,    83,
349
    84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
350
    94,    95,    96,    97,    98,    60,    61,    62,    63,    64,
351
    65,     0,    66,   109,     0,     0,   110,     1,     2,     3,
352
     4,     5,     6,     7,     8,     0,     9,    10,    11,    12,
353
    13,    14,    15,    16,    17,    18,    19,     0,   111,    20,
354
    21,    22,    61,    62,    63,    64,    65,   110,    66,    23,
355
     0,     0,     0,     0,     0,     0,   121,   122,   120,     0,
356
    24,    25,     0,     0,     0,    26,     0,    27,     1,     2,
357
     3,     4,     5,     0,     7,     8,     0,     1,     2,     3,
358
     4,     5,     0,     7,     8,     0,     0,     0,     0,     0,
359
    20,     0,    22,     0,     0,     0,     0,     0,     0,    20,
360
    23,    22,     0,     0,     0,     0,     0,     0,     0,    23,
361
     0,    24,    25,     0,     0,     0,    35,     0,    27,     0,
362
    24,    25,     0,     0,     0,    26,     0,    27,     1,     2,
363
     3,     4,     5,     0,     7,     8,    52,    53,    54,    55,
364
    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
365
    20,    66,    22,     6,     0,     0,     0,     9,    10,    11,
366
    12,    13,    14,    15,    16,    17,    18,    19,     0,     0,
367
     0,    21,     0,     0,     0,     0,    26,     6,    27,     0,
368
    67,     9,    10,    11,    12,    13,    14,    15,    16,    17,
369
    18,    19,    68,     0,     0,    21,    69,   102,    54,    55,
370
    56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
371
     0,    66,    45,    46,     0,     0,     0,    47,     0,     0,
372
    48,   102,    49,    50,    51,    52,    53,    54,    55,    56,
373
    57,    58,    59,    60,    61,    62,    63,    64,    65,     0,
374
    66,    45,    46,   117,     0,     0,    47,    74,     0,    48,
375
     0,    49,    50,    51,    52,    53,    54,    55,    56,    57,
376
    58,    59,    60,    61,    62,    63,    64,    65,     0,    66,
377
    75,    45,    46,     0,     0,     0,    47,     0,     0,    48,
378
     0,    49,    50,    51,    52,    53,    54,    55,    56,    57,
379
    58,    59,    60,    61,    62,    63,    64,    65,    45,    66,
380
     0,     0,     0,     0,     0,     0,     0,     0,    49,    50,
381
    51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
382
    61,    62,    63,    64,    65,     0,    66,    49,    50,    51,
383
    52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
384
    62,    63,    64,    65,     6,    66,     0,     0,     9,    10,
385
    11,    12,    13,    14,    15,    16,    17,    18,    19,     0,
386
     0,     0,    21,    50,    51,    52,    53,    54,    55,    56,
387
    57,    58,    59,    60,    61,    62,    63,    64,    65,     0,
388
    66,    51,    52,    53,    54,    55,    56,    57,    58,    59,
389
    60,    61,    62,    63,    64,    65,     0,    66
390
};
391
 
392
static const short yycheck[] = {     0,
393
    35,    51,    29,     0,    29,    52,    52,     8,    51,    47,
394
    48,    49,    47,    51,     0,    52,    51,     0,    52,    20,
395
    71,    -1,    23,    24,    25,    52,    27,    52,    -1,    26,
396
    42,    43,    44,    45,    46,    47,    48,    49,    35,    51,
397
    -1,    67,    68,    69,    45,    46,    47,    48,    49,    50,
398
    51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
399
    61,    62,    63,    64,    65,    44,    45,    46,    47,    48,
400
    49,    -1,    51,    74,    -1,    -1,    77,     3,     4,     5,
401
     6,     7,     8,     9,    10,    -1,    12,    13,    14,    15,
402
    16,    17,    18,    19,    20,    21,    22,    -1,    99,    25,
403
    26,    27,    45,    46,    47,    48,    49,   108,    51,    35,
404
    -1,    -1,    -1,    -1,    -1,    -1,   117,   118,   115,    -1,
405
    46,    47,    -1,    -1,    -1,    51,    -1,    53,     3,     4,
406
     5,     6,     7,    -1,     9,    10,    -1,     3,     4,     5,
407
     6,     7,    -1,     9,    10,    -1,    -1,    -1,    -1,    -1,
408
    25,    -1,    27,    -1,    -1,    -1,    -1,    -1,    -1,    25,
409
    35,    27,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    35,
410
    -1,    46,    47,    -1,    -1,    -1,    51,    -1,    53,    -1,
411
    46,    47,    -1,    -1,    -1,    51,    -1,    53,     3,     4,
412
     5,     6,     7,    -1,     9,    10,    36,    37,    38,    39,
413
    40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
414
    25,    51,    27,     8,    -1,    -1,    -1,    12,    13,    14,
415
    15,    16,    17,    18,    19,    20,    21,    22,    -1,    -1,
416
    -1,    26,    -1,    -1,    -1,    -1,    51,     8,    53,    -1,
417
    35,    12,    13,    14,    15,    16,    17,    18,    19,    20,
418
    21,    22,    47,    -1,    -1,    26,    51,    52,    38,    39,
419
    40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
420
    -1,    51,    23,    24,    -1,    -1,    -1,    28,    -1,    -1,
421
    31,    52,    33,    34,    35,    36,    37,    38,    39,    40,
422
    41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
423
    51,    23,    24,    54,    -1,    -1,    28,    29,    -1,    31,
424
    -1,    33,    34,    35,    36,    37,    38,    39,    40,    41,
425
    42,    43,    44,    45,    46,    47,    48,    49,    -1,    51,
426
    52,    23,    24,    -1,    -1,    -1,    28,    -1,    -1,    31,
427
    -1,    33,    34,    35,    36,    37,    38,    39,    40,    41,
428
    42,    43,    44,    45,    46,    47,    48,    49,    23,    51,
429
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    33,    34,
430
    35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
431
    45,    46,    47,    48,    49,    -1,    51,    33,    34,    35,
432
    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
433
    46,    47,    48,    49,     8,    51,    -1,    -1,    12,    13,
434
    14,    15,    16,    17,    18,    19,    20,    21,    22,    -1,
435
    -1,    -1,    26,    34,    35,    36,    37,    38,    39,    40,
436
    41,    42,    43,    44,    45,    46,    47,    48,    49,    -1,
437
    51,    35,    36,    37,    38,    39,    40,    41,    42,    43,
438
    44,    45,    46,    47,    48,    49,    -1,    51
439
};
440
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
441
#line 3 "/usr/lib/bison.simple"
442
/* This file comes from bison-1.27.  */
443
 
444
/* Skeleton output parser for bison,
445
   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
446
 
447
   This program is free software; you can redistribute it and/or modify
448
   it under the terms of the GNU General Public License as published by
449
   the Free Software Foundation; either version 2, or (at your option)
450
   any later version.
451
 
452
   This program is distributed in the hope that it will be useful,
453
   but WITHOUT ANY WARRANTY; without even the implied warranty of
454
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
455
   GNU General Public License for more details.
456
 
457
   You should have received a copy of the GNU General Public License
458
   along with this program; if not, write to the Free Software
459
   Foundation, Inc., 59 Temple Place - Suite 330,
460
   Boston, MA 02111-1307, USA.  */
461
 
462
/* As a special exception, when this file is copied by Bison into a
463
   Bison output file, you may use that output file without restriction.
464
   This special exception was added by the Free Software Foundation
465
   in version 1.24 of Bison.  */
466
 
467
/* This is the parser code that is written into each bison parser
468
  when the %semantic_parser declaration is not specified in the grammar.
469
  It was written by Richard Stallman by simplifying the hairy parser
470
  used when %semantic_parser is specified.  */
471
 
472
#ifndef YYSTACK_USE_ALLOCA
473
#ifdef alloca
474
#define YYSTACK_USE_ALLOCA
475
#else /* alloca not defined */
476
#ifdef __GNUC__
477
#define YYSTACK_USE_ALLOCA
478
#define alloca __builtin_alloca
479
#else /* not GNU C.  */
480
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
481
#define YYSTACK_USE_ALLOCA
482
#include <alloca.h>
483
#else /* not sparc */
484
/* We think this test detects Watcom and Microsoft C.  */
485
/* This used to test MSDOS, but that is a bad idea
486
   since that symbol is in the user namespace.  */
487
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
488
#if 0 /* No need for xmalloc.h, which pollutes the namespace;
489
         instead, just don't use alloca.  */
490
#endif
491
#else /* not MSDOS, or __TURBOC__ */
492
#if defined(_AIX)
493
/* I don't know what this was needed for, but it pollutes the namespace.
494
   So I turned it off.   rms, 2 May 1997.  */
495
 #pragma alloca
496
#define YYSTACK_USE_ALLOCA
497
#else /* not MSDOS, or __TURBOC__, or _AIX */
498
#if 0
499
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
500
                 and on HPUX 10.  Eventually we can turn this on.  */
501
#define YYSTACK_USE_ALLOCA
502
#define alloca __builtin_alloca
503
#endif /* __hpux */
504
#endif
505
#endif /* not _AIX */
506
#endif /* not MSDOS, or __TURBOC__ */
507
#endif /* not sparc */
508
#endif /* not GNU C */
509
#endif /* alloca not defined */
510
#endif /* YYSTACK_USE_ALLOCA not defined */
511
 
512
#ifdef YYSTACK_USE_ALLOCA
513
#define YYSTACK_ALLOC alloca
514
#else
515
#define YYSTACK_ALLOC xmalloc
516
#endif
517
 
518
/* Note: there must be only one dollar sign in this file.
519
   It is replaced by the list of actions, each action
520
   as one case of the switch.  */
521
 
522
#define yyerrok         (yyerrstatus = 0)
523
#define yyclearin       (yychar = YYEMPTY)
524
#define YYEMPTY         -2
525
#define YYEOF           0
526
#define YYACCEPT        goto yyacceptlab
527
#define YYABORT         goto yyabortlab
528
#define YYERROR         goto yyerrlab1
529
/* Like YYERROR except do call yyerror.
530
   This remains here temporarily to ease the
531
   transition to the new meaning of YYERROR, for GCC.
532
   Once GCC version 2 has supplanted version 1, this can go.  */
533
#define YYFAIL          goto yyerrlab
534
#define YYRECOVERING()  (!!yyerrstatus)
535
#define YYBACKUP(token, value) \
536
do                                                              \
537
  if (yychar == YYEMPTY && yylen == 1)                          \
538
    { yychar = (token), yylval = (value);                       \
539
      yychar1 = YYTRANSLATE (yychar);                           \
540
      YYPOPSTACK;                                               \
541
      goto yybackup;                                            \
542
    }                                                           \
543
  else                                                          \
544
    { yyerror ("syntax error: cannot back up"); YYERROR; }      \
545
while (0)
546
 
547
#define YYTERROR        1
548
#define YYERRCODE       256
549
 
550
#ifndef YYPURE
551
#define YYLEX           yylex()
552
#endif
553
 
554
#ifdef YYPURE
555
#ifdef YYLSP_NEEDED
556
#ifdef YYLEX_PARAM
557
#define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
558
#else
559
#define YYLEX           yylex(&yylval, &yylloc)
560
#endif
561
#else /* not YYLSP_NEEDED */
562
#ifdef YYLEX_PARAM
563
#define YYLEX           yylex(&yylval, YYLEX_PARAM)
564
#else
565
#define YYLEX           yylex(&yylval)
566
#endif
567
#endif /* not YYLSP_NEEDED */
568
#endif
569
 
570
/* If nonreentrant, generate the variables here */
571
 
572
#ifndef YYPURE
573
 
574
int     yychar;                 /*  the lookahead symbol                */
575
YYSTYPE yylval;                 /*  the semantic value of the           */
576
                                /*  lookahead symbol                    */
577
 
578
#ifdef YYLSP_NEEDED
579
YYLTYPE yylloc;                 /*  location data for the lookahead     */
580
                                /*  symbol                              */
581
#endif
582
 
583
int yynerrs;                    /*  number of parse errors so far       */
584
#endif  /* not YYPURE */
585
 
586
#if YYDEBUG != 0
587
int yydebug;                    /*  nonzero means print parse trace     */
588
/* Since this is uninitialized, it does not stop multiple parsers
589
   from coexisting.  */
590
#endif
591
 
592
/*  YYINITDEPTH indicates the initial size of the parser's stacks       */
593
 
594
#ifndef YYINITDEPTH
595
#define YYINITDEPTH 200
596
#endif
597
 
598
/*  YYMAXDEPTH is the maximum size the stacks can grow to
599
    (effective only if the built-in stack extension method is used).  */
600
 
601
#if YYMAXDEPTH == 0
602
#undef YYMAXDEPTH
603
#endif
604
 
605
#ifndef YYMAXDEPTH
606
#define YYMAXDEPTH 10000
607
#endif
608
 
609
/* Define __yy_memcpy.  Note that the size argument
610
   should be passed with type unsigned int, because that is what the non-GCC
611
   definitions require.  With GCC, __builtin_memcpy takes an arg
612
   of type size_t, but it can handle unsigned int.  */
613
 
614
#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
615
#define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
616
#else                           /* not GNU C or C++ */
617
#ifndef __cplusplus
618
 
619
/* This is the most reliable way to avoid incompatibilities
620
   in available built-in functions on various systems.  */
621
static void
622
__yy_memcpy (to, from, count)
623
     char *to;
624
     char *from;
625
     unsigned int count;
626
{
627
  register char *f = from;
628
  register char *t = to;
629
  register int i = count;
630
 
631
  while (i-- > 0)
632
    *t++ = *f++;
633
}
634
 
635
#else /* __cplusplus */
636
 
637
/* This is the most reliable way to avoid incompatibilities
638
   in available built-in functions on various systems.  */
639
static void
640
__yy_memcpy (char *to, char *from, unsigned int count)
641
{
642
  register char *t = to;
643
  register char *f = from;
644
  register int i = count;
645
 
646
  while (i-- > 0)
647
    *t++ = *f++;
648
}
649
 
650
#endif
651
#endif
652
 
653
#line 216 "/usr/lib/bison.simple"
654
 
655
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
656
   into yyparse.  The argument should have type void *.
657
   It should actually point to an object.
658
   Grammar actions can access the variable by casting it
659
   to the proper pointer type.  */
660
 
661
#ifdef YYPARSE_PARAM
662
#ifdef __cplusplus
663
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
664
#define YYPARSE_PARAM_DECL
665
#else /* not __cplusplus */
666
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
667
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
668
#endif /* not __cplusplus */
669
#else /* not YYPARSE_PARAM */
670
#define YYPARSE_PARAM_ARG
671
#define YYPARSE_PARAM_DECL
672
#endif /* not YYPARSE_PARAM */
673
 
674
/* Prevent warning if -Wstrict-prototypes.  */
675
#ifdef __GNUC__
676
#ifdef YYPARSE_PARAM
677
int yyparse (void *);
678
#else
679
int yyparse (void);
680
#endif
681
#endif
682
 
683
int
684
yyparse(YYPARSE_PARAM_ARG)
685
     YYPARSE_PARAM_DECL
686
{
687
  register int yystate;
688
  register int yyn;
689
  register short *yyssp;
690
  register YYSTYPE *yyvsp;
691
  int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
692
  int yychar1 = 0;               /*  lookahead token as an internal (translated) token number */
693
 
694
  short yyssa[YYINITDEPTH];     /*  the state stack                     */
695
  YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
696
 
697
  short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
698
  YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to xreallocate them elsewhere */
699
 
700
#ifdef YYLSP_NEEDED
701
  YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
702
  YYLTYPE *yyls = yylsa;
703
  YYLTYPE *yylsp;
704
 
705
#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
706
#else
707
#define YYPOPSTACK   (yyvsp--, yyssp--)
708
#endif
709
 
710
  int yystacksize = YYINITDEPTH;
711
  int yyfree_stacks = 0;
712
 
713
#ifdef YYPURE
714
  int yychar;
715
  YYSTYPE yylval;
716
  int yynerrs;
717
#ifdef YYLSP_NEEDED
718
  YYLTYPE yylloc;
719
#endif
720
#endif
721
 
722
  YYSTYPE yyval;                /*  the variable used to return         */
723
                                /*  semantic values from the action     */
724
                                /*  routines                            */
725
 
726
  int yylen;
727
 
728
#if YYDEBUG != 0
729
  if (yydebug)
730
    fprintf(stderr, "Starting parse\n");
731
#endif
732
 
733
  yystate = 0;
734
  yyerrstatus = 0;
735
  yynerrs = 0;
736
  yychar = YYEMPTY;             /* Cause a token to be read.  */
737
 
738
  /* Initialize stack pointers.
739
     Waste one element of value and location stack
740
     so that they stay on the same level as the state stack.
741
     The wasted elements are never initialized.  */
742
 
743
  yyssp = yyss - 1;
744
  yyvsp = yyvs;
745
#ifdef YYLSP_NEEDED
746
  yylsp = yyls;
747
#endif
748
 
749
/* Push a new state, which is found in  yystate  .  */
750
/* In all cases, when you get here, the value and location stacks
751
   have just been pushed. so pushing a state here evens the stacks.  */
752
yynewstate:
753
 
754
  *++yyssp = yystate;
755
 
756
  if (yyssp >= yyss + yystacksize - 1)
757
    {
758
      /* Give user a chance to xreallocate the stack */
759
      /* Use copies of these so that the &'s don't force the real ones into memory. */
760
      YYSTYPE *yyvs1 = yyvs;
761
      short *yyss1 = yyss;
762
#ifdef YYLSP_NEEDED
763
      YYLTYPE *yyls1 = yyls;
764
#endif
765
 
766
      /* Get the current used size of the three stacks, in elements.  */
767
      int size = yyssp - yyss + 1;
768
 
769
#ifdef yyoverflow
770
      /* Each stack pointer address is followed by the size of
771
         the data in use in that stack, in bytes.  */
772
#ifdef YYLSP_NEEDED
773
      /* This used to be a conditional around just the two extra args,
774
         but that might be undefined if yyoverflow is a macro.  */
775
      yyoverflow("parser stack overflow",
776
                 &yyss1, size * sizeof (*yyssp),
777
                 &yyvs1, size * sizeof (*yyvsp),
778
                 &yyls1, size * sizeof (*yylsp),
779
                 &yystacksize);
780
#else
781
      yyoverflow("parser stack overflow",
782
                 &yyss1, size * sizeof (*yyssp),
783
                 &yyvs1, size * sizeof (*yyvsp),
784
                 &yystacksize);
785
#endif
786
 
787
      yyss = yyss1; yyvs = yyvs1;
788
#ifdef YYLSP_NEEDED
789
      yyls = yyls1;
790
#endif
791
#else /* no yyoverflow */
792
      /* Extend the stack our own way.  */
793
      if (yystacksize >= YYMAXDEPTH)
794
        {
795
          yyerror("parser stack overflow");
796
          if (yyfree_stacks)
797
            {
798
              free (yyss);
799
              free (yyvs);
800
#ifdef YYLSP_NEEDED
801
              free (yyls);
802
#endif
803
            }
804
          return 2;
805
        }
806
      yystacksize *= 2;
807
      if (yystacksize > YYMAXDEPTH)
808
        yystacksize = YYMAXDEPTH;
809
#ifndef YYSTACK_USE_ALLOCA
810
      yyfree_stacks = 1;
811
#endif
812
      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
813
      __yy_memcpy ((char *)yyss, (char *)yyss1,
814
                   size * (unsigned int) sizeof (*yyssp));
815
      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
816
      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
817
                   size * (unsigned int) sizeof (*yyvsp));
818
#ifdef YYLSP_NEEDED
819
      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
820
      __yy_memcpy ((char *)yyls, (char *)yyls1,
821
                   size * (unsigned int) sizeof (*yylsp));
822
#endif
823
#endif /* no yyoverflow */
824
 
825
      yyssp = yyss + size - 1;
826
      yyvsp = yyvs + size - 1;
827
#ifdef YYLSP_NEEDED
828
      yylsp = yyls + size - 1;
829
#endif
830
 
831
#if YYDEBUG != 0
832
      if (yydebug)
833
        fprintf(stderr, "Stack size increased to %d\n", yystacksize);
834
#endif
835
 
836
      if (yyssp >= yyss + yystacksize - 1)
837
        YYABORT;
838
    }
839
 
840
#if YYDEBUG != 0
841
  if (yydebug)
842
    fprintf(stderr, "Entering state %d\n", yystate);
843
#endif
844
 
845
  goto yybackup;
846
 yybackup:
847
 
848
/* Do appropriate processing given the current state.  */
849
/* Read a lookahead token if we need one and don't already have one.  */
850
/* yyresume: */
851
 
852
  /* First try to decide what to do without reference to lookahead token.  */
853
 
854
  yyn = yypact[yystate];
855
  if (yyn == YYFLAG)
856
    goto yydefault;
857
 
858
  /* Not known => get a lookahead token if don't already have one.  */
859
 
860
  /* yychar is either YYEMPTY or YYEOF
861
     or a valid token in external form.  */
862
 
863
  if (yychar == YYEMPTY)
864
    {
865
#if YYDEBUG != 0
866
      if (yydebug)
867
        fprintf(stderr, "Reading a token: ");
868
#endif
869
      yychar = YYLEX;
870
    }
871
 
872
  /* Convert token to internal form (in yychar1) for indexing tables with */
873
 
874
  if (yychar <= 0)               /* This means end of input. */
875
    {
876
      yychar1 = 0;
877
      yychar = YYEOF;           /* Don't call YYLEX any more */
878
 
879
#if YYDEBUG != 0
880
      if (yydebug)
881
        fprintf(stderr, "Now at end of input.\n");
882
#endif
883
    }
884
  else
885
    {
886
      yychar1 = YYTRANSLATE(yychar);
887
 
888
#if YYDEBUG != 0
889
      if (yydebug)
890
        {
891
          fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
892
          /* Give the individual parser a way to print the precise meaning
893
             of a token, for further debugging info.  */
894
#ifdef YYPRINT
895
          YYPRINT (stderr, yychar, yylval);
896
#endif
897
          fprintf (stderr, ")\n");
898
        }
899
#endif
900
    }
901
 
902
  yyn += yychar1;
903
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
904
    goto yydefault;
905
 
906
  yyn = yytable[yyn];
907
 
908
  /* yyn is what to do for this token type in this state.
909
     Negative => reduce, -yyn is rule number.
910
     Positive => shift, yyn is new state.
911
       New state is final state => don't bother to shift,
912
       just return success.
913
     0, or most negative number => error.  */
914
 
915
  if (yyn < 0)
916
    {
917
      if (yyn == YYFLAG)
918
        goto yyerrlab;
919
      yyn = -yyn;
920
      goto yyreduce;
921
    }
922
  else if (yyn == 0)
923
    goto yyerrlab;
924
 
925
  if (yyn == YYFINAL)
926
    YYACCEPT;
927
 
928
  /* Shift the lookahead token.  */
929
 
930
#if YYDEBUG != 0
931
  if (yydebug)
932
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
933
#endif
934
 
935
  /* Discard the token being shifted unless it is eof.  */
936
  if (yychar != YYEOF)
937
    yychar = YYEMPTY;
938
 
939
  *++yyvsp = yylval;
940
#ifdef YYLSP_NEEDED
941
  *++yylsp = yylloc;
942
#endif
943
 
944
  /* count tokens shifted since error; after three, turn off error status.  */
945
  if (yyerrstatus) yyerrstatus--;
946
 
947
  yystate = yyn;
948
  goto yynewstate;
949
 
950
/* Do the default action for the current state.  */
951
yydefault:
952
 
953
  yyn = yydefact[yystate];
954
  if (yyn == 0)
955
    goto yyerrlab;
956
 
957
/* Do a reduction.  yyn is the number of a rule to reduce with.  */
958
yyreduce:
959
  yylen = yyr2[yyn];
960
  if (yylen > 0)
961
    yyval = yyvsp[1-yylen]; /* implement default value of the action */
962
 
963
#if YYDEBUG != 0
964
  if (yydebug)
965
    {
966
      int i;
967
 
968
      fprintf (stderr, "Reducing via rule %d (line %d), ",
969
               yyn, yyrline[yyn]);
970
 
971
      /* Print the symbols being reduced, and their result.  */
972
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
973
        fprintf (stderr, "%s ", yytname[yyrhs[i]]);
974
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
975
    }
976
#endif
977
 
978
 
979
  switch (yyn) {
980
 
981
case 3:
982
#line 232 "f-exp.y"
983
{ write_exp_elt_opcode(OP_TYPE);
984
                          write_exp_elt_type(yyvsp[0].tval);
985
                          write_exp_elt_opcode(OP_TYPE); ;
986
    break;}
987
case 4:
988
#line 238 "f-exp.y"
989
{ ;
990
    break;}
991
case 5:
992
#line 243 "f-exp.y"
993
{ write_exp_elt_opcode (UNOP_IND); ;
994
    break;}
995
case 6:
996
#line 247 "f-exp.y"
997
{ write_exp_elt_opcode (UNOP_ADDR); ;
998
    break;}
999
case 7:
1000
#line 251 "f-exp.y"
1001
{ write_exp_elt_opcode (UNOP_NEG); ;
1002
    break;}
1003
case 8:
1004
#line 255 "f-exp.y"
1005
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1006
    break;}
1007
case 9:
1008
#line 259 "f-exp.y"
1009
{ write_exp_elt_opcode (UNOP_COMPLEMENT); ;
1010
    break;}
1011
case 10:
1012
#line 263 "f-exp.y"
1013
{ write_exp_elt_opcode (UNOP_SIZEOF); ;
1014
    break;}
1015
case 11:
1016
#line 272 "f-exp.y"
1017
{ start_arglist (); ;
1018
    break;}
1019
case 12:
1020
#line 274 "f-exp.y"
1021
{ write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST);
1022
                          write_exp_elt_longcst ((LONGEST) end_arglist ());
1023
                          write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); ;
1024
    break;}
1025
case 14:
1026
#line 283 "f-exp.y"
1027
{ arglist_len = 1; ;
1028
    break;}
1029
case 15:
1030
#line 287 "f-exp.y"
1031
{ arglist_len = 2;;
1032
    break;}
1033
case 16:
1034
#line 291 "f-exp.y"
1035
{ arglist_len++; ;
1036
    break;}
1037
case 17:
1038
#line 295 "f-exp.y"
1039
{ ;
1040
    break;}
1041
case 18:
1042
#line 300 "f-exp.y"
1043
{ ;
1044
    break;}
1045
case 19:
1046
#line 304 "f-exp.y"
1047
{ write_exp_elt_opcode(OP_COMPLEX); ;
1048
    break;}
1049
case 20:
1050
#line 308 "f-exp.y"
1051
{ write_exp_elt_opcode (UNOP_CAST);
1052
                          write_exp_elt_type (yyvsp[-2].tval);
1053
                          write_exp_elt_opcode (UNOP_CAST); ;
1054
    break;}
1055
case 21:
1056
#line 316 "f-exp.y"
1057
{ write_exp_elt_opcode (BINOP_REPEAT); ;
1058
    break;}
1059
case 22:
1060
#line 320 "f-exp.y"
1061
{ write_exp_elt_opcode (BINOP_MUL); ;
1062
    break;}
1063
case 23:
1064
#line 324 "f-exp.y"
1065
{ write_exp_elt_opcode (BINOP_DIV); ;
1066
    break;}
1067
case 24:
1068
#line 328 "f-exp.y"
1069
{ write_exp_elt_opcode (BINOP_REM); ;
1070
    break;}
1071
case 25:
1072
#line 332 "f-exp.y"
1073
{ write_exp_elt_opcode (BINOP_ADD); ;
1074
    break;}
1075
case 26:
1076
#line 336 "f-exp.y"
1077
{ write_exp_elt_opcode (BINOP_SUB); ;
1078
    break;}
1079
case 27:
1080
#line 340 "f-exp.y"
1081
{ write_exp_elt_opcode (BINOP_LSH); ;
1082
    break;}
1083
case 28:
1084
#line 344 "f-exp.y"
1085
{ write_exp_elt_opcode (BINOP_RSH); ;
1086
    break;}
1087
case 29:
1088
#line 348 "f-exp.y"
1089
{ write_exp_elt_opcode (BINOP_EQUAL); ;
1090
    break;}
1091
case 30:
1092
#line 352 "f-exp.y"
1093
{ write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1094
    break;}
1095
case 31:
1096
#line 356 "f-exp.y"
1097
{ write_exp_elt_opcode (BINOP_LEQ); ;
1098
    break;}
1099
case 32:
1100
#line 360 "f-exp.y"
1101
{ write_exp_elt_opcode (BINOP_GEQ); ;
1102
    break;}
1103
case 33:
1104
#line 364 "f-exp.y"
1105
{ write_exp_elt_opcode (BINOP_LESS); ;
1106
    break;}
1107
case 34:
1108
#line 368 "f-exp.y"
1109
{ write_exp_elt_opcode (BINOP_GTR); ;
1110
    break;}
1111
case 35:
1112
#line 372 "f-exp.y"
1113
{ write_exp_elt_opcode (BINOP_BITWISE_AND); ;
1114
    break;}
1115
case 36:
1116
#line 376 "f-exp.y"
1117
{ write_exp_elt_opcode (BINOP_BITWISE_XOR); ;
1118
    break;}
1119
case 37:
1120
#line 380 "f-exp.y"
1121
{ write_exp_elt_opcode (BINOP_BITWISE_IOR); ;
1122
    break;}
1123
case 38:
1124
#line 384 "f-exp.y"
1125
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1126
    break;}
1127
case 39:
1128
#line 389 "f-exp.y"
1129
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1130
    break;}
1131
case 40:
1132
#line 393 "f-exp.y"
1133
{ write_exp_elt_opcode (BINOP_ASSIGN); ;
1134
    break;}
1135
case 41:
1136
#line 397 "f-exp.y"
1137
{ write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1138
                          write_exp_elt_opcode (yyvsp[-1].opcode);
1139
                          write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
1140
    break;}
1141
case 42:
1142
#line 403 "f-exp.y"
1143
{ write_exp_elt_opcode (OP_LONG);
1144
                          write_exp_elt_type (yyvsp[0].typed_val.type);
1145
                          write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1146
                          write_exp_elt_opcode (OP_LONG); ;
1147
    break;}
1148
case 43:
1149
#line 410 "f-exp.y"
1150
{ YYSTYPE val;
1151
                          parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1152
                          write_exp_elt_opcode (OP_LONG);
1153
                          write_exp_elt_type (val.typed_val.type);
1154
                          write_exp_elt_longcst ((LONGEST)val.typed_val.val);
1155
                          write_exp_elt_opcode (OP_LONG); ;
1156
    break;}
1157
case 44:
1158
#line 419 "f-exp.y"
1159
{ write_exp_elt_opcode (OP_DOUBLE);
1160
                          write_exp_elt_type (builtin_type_f_real_s8);
1161
                          write_exp_elt_dblcst (yyvsp[0].dval);
1162
                          write_exp_elt_opcode (OP_DOUBLE); ;
1163
    break;}
1164
case 47:
1165
#line 432 "f-exp.y"
1166
{ write_exp_elt_opcode (OP_LONG);
1167
                          write_exp_elt_type (builtin_type_f_integer);
1168
                          CHECK_TYPEDEF (yyvsp[-1].tval);
1169
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1170
                          write_exp_elt_opcode (OP_LONG); ;
1171
    break;}
1172
case 48:
1173
#line 440 "f-exp.y"
1174
{ write_exp_elt_opcode (OP_BOOL);
1175
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1176
                          write_exp_elt_opcode (OP_BOOL);
1177
                        ;
1178
    break;}
1179
case 49:
1180
#line 447 "f-exp.y"
1181
{
1182
                          write_exp_elt_opcode (OP_STRING);
1183
                          write_exp_string (yyvsp[0].sval);
1184
                          write_exp_elt_opcode (OP_STRING);
1185
                        ;
1186
    break;}
1187
case 50:
1188
#line 455 "f-exp.y"
1189
{ struct symbol *sym = yyvsp[0].ssym.sym;
1190
 
1191
                          if (sym)
1192
                            {
1193
                              if (symbol_read_needs_frame (sym))
1194
                                {
1195
                                  if (innermost_block == 0 ||
1196
                                      contained_in (block_found,
1197
                                                    innermost_block))
1198
                                    innermost_block = block_found;
1199
                                }
1200
                              write_exp_elt_opcode (OP_VAR_VALUE);
1201
                              /* We want to use the selected frame, not
1202
                                 another more inner frame which happens to
1203
                                 be in the same block.  */
1204
                              write_exp_elt_block (NULL);
1205
                              write_exp_elt_sym (sym);
1206
                              write_exp_elt_opcode (OP_VAR_VALUE);
1207
                              break;
1208
                            }
1209
                          else
1210
                            {
1211
                              struct minimal_symbol *msymbol;
1212
                              register char *arg = copy_name (yyvsp[0].ssym.stoken);
1213
 
1214
                              msymbol =
1215
                                lookup_minimal_symbol (arg, NULL, NULL);
1216
                              if (msymbol != NULL)
1217
                                {
1218
                                  write_exp_msymbol (msymbol,
1219
                                                     lookup_function_type (builtin_type_int),
1220
                                                     builtin_type_int);
1221
                                }
1222
                              else if (!have_full_symbols () && !have_partial_symbols ())
1223
                                error ("No symbol table is loaded.  Use the \"file\" command.");
1224
                              else
1225
                                error ("No symbol \"%s\" in current context.",
1226
                                       copy_name (yyvsp[0].ssym.stoken));
1227
                            }
1228
                        ;
1229
    break;}
1230
case 53:
1231
#line 503 "f-exp.y"
1232
{
1233
                  /* This is where the interesting stuff happens.  */
1234
                  int done = 0;
1235
                  int array_size;
1236
                  struct type *follow_type = yyvsp[-1].tval;
1237
                  struct type *range_type;
1238
 
1239
                  while (!done)
1240
                    switch (pop_type ())
1241
                      {
1242
                      case tp_end:
1243
                        done = 1;
1244
                        break;
1245
                      case tp_pointer:
1246
                        follow_type = lookup_pointer_type (follow_type);
1247
                        break;
1248
                      case tp_reference:
1249
                        follow_type = lookup_reference_type (follow_type);
1250
                        break;
1251
                      case tp_array:
1252
                        array_size = pop_type_int ();
1253
                        if (array_size != -1)
1254
                          {
1255
                            range_type =
1256
                              create_range_type ((struct type *) NULL,
1257
                                                 builtin_type_f_integer, 0,
1258
                                                 array_size - 1);
1259
                            follow_type =
1260
                              create_array_type ((struct type *) NULL,
1261
                                                 follow_type, range_type);
1262
                          }
1263
                        else
1264
                          follow_type = lookup_pointer_type (follow_type);
1265
                        break;
1266
                      case tp_function:
1267
                        follow_type = lookup_function_type (follow_type);
1268
                        break;
1269
                      }
1270
                  yyval.tval = follow_type;
1271
                ;
1272
    break;}
1273
case 54:
1274
#line 546 "f-exp.y"
1275
{ push_type (tp_pointer); yyval.voidval = 0; ;
1276
    break;}
1277
case 55:
1278
#line 548 "f-exp.y"
1279
{ push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ;
1280
    break;}
1281
case 56:
1282
#line 550 "f-exp.y"
1283
{ push_type (tp_reference); yyval.voidval = 0; ;
1284
    break;}
1285
case 57:
1286
#line 552 "f-exp.y"
1287
{ push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ;
1288
    break;}
1289
case 59:
1290
#line 557 "f-exp.y"
1291
{ yyval.voidval = yyvsp[-1].voidval; ;
1292
    break;}
1293
case 60:
1294
#line 559 "f-exp.y"
1295
{ push_type (tp_function); ;
1296
    break;}
1297
case 61:
1298
#line 561 "f-exp.y"
1299
{ push_type (tp_function); ;
1300
    break;}
1301
case 62:
1302
#line 565 "f-exp.y"
1303
{ yyval.voidval = 0; ;
1304
    break;}
1305
case 63:
1306
#line 567 "f-exp.y"
1307
{ free ((PTR)yyvsp[-1].tvec); yyval.voidval = 0; ;
1308
    break;}
1309
case 64:
1310
#line 572 "f-exp.y"
1311
{ yyval.tval = yyvsp[0].tsym.type; ;
1312
    break;}
1313
case 65:
1314
#line 574 "f-exp.y"
1315
{ yyval.tval = builtin_type_f_integer; ;
1316
    break;}
1317
case 66:
1318
#line 576 "f-exp.y"
1319
{ yyval.tval = builtin_type_f_integer_s2; ;
1320
    break;}
1321
case 67:
1322
#line 578 "f-exp.y"
1323
{ yyval.tval = builtin_type_f_character; ;
1324
    break;}
1325
case 68:
1326
#line 580 "f-exp.y"
1327
{ yyval.tval = builtin_type_f_logical;;
1328
    break;}
1329
case 69:
1330
#line 582 "f-exp.y"
1331
{ yyval.tval = builtin_type_f_logical_s2;;
1332
    break;}
1333
case 70:
1334
#line 584 "f-exp.y"
1335
{ yyval.tval = builtin_type_f_logical_s1;;
1336
    break;}
1337
case 71:
1338
#line 586 "f-exp.y"
1339
{ yyval.tval = builtin_type_f_real;;
1340
    break;}
1341
case 72:
1342
#line 588 "f-exp.y"
1343
{ yyval.tval = builtin_type_f_real_s8;;
1344
    break;}
1345
case 73:
1346
#line 590 "f-exp.y"
1347
{ yyval.tval = builtin_type_f_real_s16;;
1348
    break;}
1349
case 74:
1350
#line 592 "f-exp.y"
1351
{ yyval.tval = builtin_type_f_complex_s8;;
1352
    break;}
1353
case 75:
1354
#line 594 "f-exp.y"
1355
{ yyval.tval = builtin_type_f_complex_s16;;
1356
    break;}
1357
case 76:
1358
#line 596 "f-exp.y"
1359
{ yyval.tval = builtin_type_f_complex_s32;;
1360
    break;}
1361
case 78:
1362
#line 604 "f-exp.y"
1363
{ yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1364
                  yyval.ivec[0] = 1;     /* Number of types in vector */
1365
                  yyval.tvec[1] = yyvsp[0].tval;
1366
                ;
1367
    break;}
1368
case 79:
1369
#line 609 "f-exp.y"
1370
{ int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1371
                  yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1372
                  yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1373
                ;
1374
    break;}
1375
case 80:
1376
#line 616 "f-exp.y"
1377
{ yyval.sval = yyvsp[0].ssym.stoken; ;
1378
    break;}
1379
case 81:
1380
#line 618 "f-exp.y"
1381
{ yyval.sval = yyvsp[0].tsym.stoken; ;
1382
    break;}
1383
case 82:
1384
#line 620 "f-exp.y"
1385
{ yyval.sval = yyvsp[0].ssym.stoken; ;
1386
    break;}
1387
}
1388
   /* the action file gets copied in in place of this dollarsign */
1389
#line 542 "/usr/lib/bison.simple"
1390
 
1391
  yyvsp -= yylen;
1392
  yyssp -= yylen;
1393
#ifdef YYLSP_NEEDED
1394
  yylsp -= yylen;
1395
#endif
1396
 
1397
#if YYDEBUG != 0
1398
  if (yydebug)
1399
    {
1400
      short *ssp1 = yyss - 1;
1401
      fprintf (stderr, "state stack now");
1402
      while (ssp1 != yyssp)
1403
        fprintf (stderr, " %d", *++ssp1);
1404
      fprintf (stderr, "\n");
1405
    }
1406
#endif
1407
 
1408
  *++yyvsp = yyval;
1409
 
1410
#ifdef YYLSP_NEEDED
1411
  yylsp++;
1412
  if (yylen == 0)
1413
    {
1414
      yylsp->first_line = yylloc.first_line;
1415
      yylsp->first_column = yylloc.first_column;
1416
      yylsp->last_line = (yylsp-1)->last_line;
1417
      yylsp->last_column = (yylsp-1)->last_column;
1418
      yylsp->text = 0;
1419
    }
1420
  else
1421
    {
1422
      yylsp->last_line = (yylsp+yylen-1)->last_line;
1423
      yylsp->last_column = (yylsp+yylen-1)->last_column;
1424
    }
1425
#endif
1426
 
1427
  /* Now "shift" the result of the reduction.
1428
     Determine what state that goes to,
1429
     based on the state we popped back to
1430
     and the rule number reduced by.  */
1431
 
1432
  yyn = yyr1[yyn];
1433
 
1434
  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1435
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1436
    yystate = yytable[yystate];
1437
  else
1438
    yystate = yydefgoto[yyn - YYNTBASE];
1439
 
1440
  goto yynewstate;
1441
 
1442
yyerrlab:   /* here on detecting error */
1443
 
1444
  if (! yyerrstatus)
1445
    /* If not already recovering from an error, report this error.  */
1446
    {
1447
      ++yynerrs;
1448
 
1449
#ifdef YYERROR_VERBOSE
1450
      yyn = yypact[yystate];
1451
 
1452
      if (yyn > YYFLAG && yyn < YYLAST)
1453
        {
1454
          int size = 0;
1455
          char *msg;
1456
          int x, count;
1457
 
1458
          count = 0;
1459
          /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1460
          for (x = (yyn < 0 ? -yyn : 0);
1461
               x < (sizeof(yytname) / sizeof(char *)); x++)
1462
            if (yycheck[x + yyn] == x)
1463
              size += strlen(yytname[x]) + 15, count++;
1464
          msg = (char *) xmalloc(size + 15);
1465
          if (msg != 0)
1466
            {
1467
              strcpy(msg, "parse error");
1468
 
1469
              if (count < 5)
1470
                {
1471
                  count = 0;
1472
                  for (x = (yyn < 0 ? -yyn : 0);
1473
                       x < (sizeof(yytname) / sizeof(char *)); x++)
1474
                    if (yycheck[x + yyn] == x)
1475
                      {
1476
                        strcat(msg, count == 0 ? ", expecting `" : " or `");
1477
                        strcat(msg, yytname[x]);
1478
                        strcat(msg, "'");
1479
                        count++;
1480
                      }
1481
                }
1482
              yyerror(msg);
1483
              free(msg);
1484
            }
1485
          else
1486
            yyerror ("parse error; also virtual memory exceeded");
1487
        }
1488
      else
1489
#endif /* YYERROR_VERBOSE */
1490
        yyerror("parse error");
1491
    }
1492
 
1493
  goto yyerrlab1;
1494
yyerrlab1:   /* here on error raised explicitly by an action */
1495
 
1496
  if (yyerrstatus == 3)
1497
    {
1498
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1499
 
1500
      /* return failure if at end of input */
1501
      if (yychar == YYEOF)
1502
        YYABORT;
1503
 
1504
#if YYDEBUG != 0
1505
      if (yydebug)
1506
        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1507
#endif
1508
 
1509
      yychar = YYEMPTY;
1510
    }
1511
 
1512
  /* Else will try to reuse lookahead token
1513
     after shifting the error token.  */
1514
 
1515
  yyerrstatus = 3;              /* Each real token shifted decrements this */
1516
 
1517
  goto yyerrhandle;
1518
 
1519
yyerrdefault:  /* current state does not do anything special for the error token. */
1520
 
1521
#if 0
1522
  /* This is wrong; only states that explicitly want error tokens
1523
     should shift them.  */
1524
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1525
  if (yyn) goto yydefault;
1526
#endif
1527
 
1528
yyerrpop:   /* pop the current state because it cannot handle the error token */
1529
 
1530
  if (yyssp == yyss) YYABORT;
1531
  yyvsp--;
1532
  yystate = *--yyssp;
1533
#ifdef YYLSP_NEEDED
1534
  yylsp--;
1535
#endif
1536
 
1537
#if YYDEBUG != 0
1538
  if (yydebug)
1539
    {
1540
      short *ssp1 = yyss - 1;
1541
      fprintf (stderr, "Error: state stack now");
1542
      while (ssp1 != yyssp)
1543
        fprintf (stderr, " %d", *++ssp1);
1544
      fprintf (stderr, "\n");
1545
    }
1546
#endif
1547
 
1548
yyerrhandle:
1549
 
1550
  yyn = yypact[yystate];
1551
  if (yyn == YYFLAG)
1552
    goto yyerrdefault;
1553
 
1554
  yyn += YYTERROR;
1555
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1556
    goto yyerrdefault;
1557
 
1558
  yyn = yytable[yyn];
1559
  if (yyn < 0)
1560
    {
1561
      if (yyn == YYFLAG)
1562
        goto yyerrpop;
1563
      yyn = -yyn;
1564
      goto yyreduce;
1565
    }
1566
  else if (yyn == 0)
1567
    goto yyerrpop;
1568
 
1569
  if (yyn == YYFINAL)
1570
    YYACCEPT;
1571
 
1572
#if YYDEBUG != 0
1573
  if (yydebug)
1574
    fprintf(stderr, "Shifting error token, ");
1575
#endif
1576
 
1577
  *++yyvsp = yylval;
1578
#ifdef YYLSP_NEEDED
1579
  *++yylsp = yylloc;
1580
#endif
1581
 
1582
  yystate = yyn;
1583
  goto yynewstate;
1584
 
1585
 yyacceptlab:
1586
  /* YYACCEPT comes here.  */
1587
  if (yyfree_stacks)
1588
    {
1589
      free (yyss);
1590
      free (yyvs);
1591
#ifdef YYLSP_NEEDED
1592
      free (yyls);
1593
#endif
1594
    }
1595
  return 0;
1596
 
1597
 yyabortlab:
1598
  /* YYABORT comes here.  */
1599
  if (yyfree_stacks)
1600
    {
1601
      free (yyss);
1602
      free (yyvs);
1603
#ifdef YYLSP_NEEDED
1604
      free (yyls);
1605
#endif
1606
    }
1607
  return 1;
1608
}
1609
#line 633 "f-exp.y"
1610
 
1611
 
1612
/* Take care of parsing a number (anything that starts with a digit).
1613
   Set yylval and return the token type; update lexptr.
1614
   LEN is the number of characters in it.  */
1615
 
1616
/*** Needs some error checking for the float case ***/
1617
 
1618
static int
1619
parse_number (p, len, parsed_float, putithere)
1620
     register char *p;
1621
     register int len;
1622
     int parsed_float;
1623
     YYSTYPE *putithere;
1624
{
1625
  register LONGEST n = 0;
1626
  register LONGEST prevn = 0;
1627
  register int c;
1628
  register int base = input_radix;
1629
  int unsigned_p = 0;
1630
  int long_p = 0;
1631
  ULONGEST high_bit;
1632
  struct type *signed_type;
1633
  struct type *unsigned_type;
1634
 
1635
  if (parsed_float)
1636
    {
1637
      /* It's a float since it contains a point or an exponent.  */
1638
      /* [dD] is not understood as an exponent by atof, change it to 'e'.  */
1639
      char *tmp, *tmp2;
1640
 
1641
      tmp = xstrdup (p);
1642
      for (tmp2 = tmp; *tmp2; ++tmp2)
1643
        if (*tmp2 == 'd' || *tmp2 == 'D')
1644
          *tmp2 = 'e';
1645
      putithere->dval = atof (tmp);
1646
      free (tmp);
1647
      return FLOAT;
1648
    }
1649
 
1650
  /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
1651
  if (p[0] == '0')
1652
    switch (p[1])
1653
      {
1654
      case 'x':
1655
      case 'X':
1656
        if (len >= 3)
1657
          {
1658
            p += 2;
1659
            base = 16;
1660
            len -= 2;
1661
          }
1662
        break;
1663
 
1664
      case 't':
1665
      case 'T':
1666
      case 'd':
1667
      case 'D':
1668
        if (len >= 3)
1669
          {
1670
            p += 2;
1671
            base = 10;
1672
            len -= 2;
1673
          }
1674
        break;
1675
 
1676
      default:
1677
        base = 8;
1678
        break;
1679
      }
1680
 
1681
  while (len-- > 0)
1682
    {
1683
      c = *p++;
1684
      if (isupper (c))
1685
        c = tolower (c);
1686
      if (len == 0 && c == 'l')
1687
        long_p = 1;
1688
      else if (len == 0 && c == 'u')
1689
        unsigned_p = 1;
1690
      else
1691
        {
1692
          int i;
1693
          if (c >= '0' && c <= '9')
1694
            i = c - '0';
1695
          else if (c >= 'a' && c <= 'f')
1696
            i = c - 'a' + 10;
1697
          else
1698
            return ERROR;       /* Char not a digit */
1699
          if (i >= base)
1700
            return ERROR;               /* Invalid digit in this base */
1701
          n *= base;
1702
          n += i;
1703
        }
1704
      /* Portably test for overflow (only works for nonzero values, so make
1705
         a second check for zero).  */
1706
      if ((prevn >= n) && n != 0)
1707
        unsigned_p=1;           /* Try something unsigned */
1708
      /* If range checking enabled, portably test for unsigned overflow.  */
1709
      if (RANGE_CHECK && n != 0)
1710
        {
1711
          if ((unsigned_p && (unsigned)prevn >= (unsigned)n))
1712
            range_error("Overflow on numeric constant.");
1713
        }
1714
      prevn = n;
1715
    }
1716
 
1717
  /* If the number is too big to be an int, or it's got an l suffix
1718
     then it's a long.  Work out if this has to be a long by
1719
     shifting right and and seeing if anything remains, and the
1720
     target int size is different to the target long size.
1721
 
1722
     In the expression below, we could have tested
1723
     (n >> TARGET_INT_BIT)
1724
     to see if it was zero,
1725
     but too many compilers warn about that, when ints and longs
1726
     are the same size.  So we shift it twice, with fewer bits
1727
     each time, for the same result.  */
1728
 
1729
  if ((TARGET_INT_BIT != TARGET_LONG_BIT
1730
       && ((n >> 2) >> (TARGET_INT_BIT-2)))   /* Avoid shift warning */
1731
      || long_p)
1732
    {
1733
      high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
1734
      unsigned_type = builtin_type_unsigned_long;
1735
      signed_type = builtin_type_long;
1736
    }
1737
  else
1738
    {
1739
      high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
1740
      unsigned_type = builtin_type_unsigned_int;
1741
      signed_type = builtin_type_int;
1742
    }
1743
 
1744
  putithere->typed_val.val = n;
1745
 
1746
  /* If the high bit of the worked out type is set then this number
1747
     has to be unsigned. */
1748
 
1749
  if (unsigned_p || (n & high_bit))
1750
    putithere->typed_val.type = unsigned_type;
1751
  else
1752
    putithere->typed_val.type = signed_type;
1753
 
1754
  return INT;
1755
}
1756
 
1757
struct token
1758
{
1759
  char *operator;
1760
  int token;
1761
  enum exp_opcode opcode;
1762
};
1763
 
1764
static const struct token dot_ops[] =
1765
{
1766
  { ".and.", BOOL_AND, BINOP_END },
1767
  { ".AND.", BOOL_AND, BINOP_END },
1768
  { ".or.", BOOL_OR, BINOP_END },
1769
  { ".OR.", BOOL_OR, BINOP_END },
1770
  { ".not.", BOOL_NOT, BINOP_END },
1771
  { ".NOT.", BOOL_NOT, BINOP_END },
1772
  { ".eq.", EQUAL, BINOP_END },
1773
  { ".EQ.", EQUAL, BINOP_END },
1774
  { ".eqv.", EQUAL, BINOP_END },
1775
  { ".NEQV.", NOTEQUAL, BINOP_END },
1776
  { ".neqv.", NOTEQUAL, BINOP_END },
1777
  { ".EQV.", EQUAL, BINOP_END },
1778
  { ".ne.", NOTEQUAL, BINOP_END },
1779
  { ".NE.", NOTEQUAL, BINOP_END },
1780
  { ".le.", LEQ, BINOP_END },
1781
  { ".LE.", LEQ, BINOP_END },
1782
  { ".ge.", GEQ, BINOP_END },
1783
  { ".GE.", GEQ, BINOP_END },
1784
  { ".gt.", GREATERTHAN, BINOP_END },
1785
  { ".GT.", GREATERTHAN, BINOP_END },
1786
  { ".lt.", LESSTHAN, BINOP_END },
1787
  { ".LT.", LESSTHAN, BINOP_END },
1788
  { NULL, 0, 0 }
1789
};
1790
 
1791
struct f77_boolean_val
1792
{
1793
  char *name;
1794
  int value;
1795
};
1796
 
1797
static const struct f77_boolean_val boolean_values[]  =
1798
{
1799
  { ".true.", 1 },
1800
  { ".TRUE.", 1 },
1801
  { ".false.", 0 },
1802
  { ".FALSE.", 0 },
1803
  { NULL, 0 }
1804
};
1805
 
1806
static const struct token f77_keywords[] =
1807
{
1808
  { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END },
1809
  { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END },
1810
  { "character", CHARACTER, BINOP_END },
1811
  { "integer_2", INT_S2_KEYWORD, BINOP_END },
1812
  { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
1813
  { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
1814
  { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
1815
  { "integer", INT_KEYWORD, BINOP_END },
1816
  { "logical", LOGICAL_KEYWORD, BINOP_END },
1817
  { "real_16", REAL_S16_KEYWORD, BINOP_END },
1818
  { "complex", COMPLEX_S8_KEYWORD, BINOP_END },
1819
  { "sizeof", SIZEOF, BINOP_END },
1820
  { "real_8", REAL_S8_KEYWORD, BINOP_END },
1821
  { "real", REAL_KEYWORD, BINOP_END },
1822
  { NULL, 0, 0 }
1823
};
1824
 
1825
/* Implementation of a dynamically expandable buffer for processing input
1826
   characters acquired through lexptr and building a value to return in
1827
   yylval. Ripped off from ch-exp.y */
1828
 
1829
static char *tempbuf;           /* Current buffer contents */
1830
static int tempbufsize;         /* Size of allocated buffer */
1831
static int tempbufindex;        /* Current index into buffer */
1832
 
1833
#define GROWBY_MIN_SIZE 64      /* Minimum amount to grow buffer by */
1834
 
1835
#define CHECKBUF(size) \
1836
  do { \
1837
    if (tempbufindex + (size) >= tempbufsize) \
1838
      { \
1839
        growbuf_by_size (size); \
1840
      } \
1841
  } while (0);
1842
 
1843
 
1844
/* Grow the static temp buffer if necessary, including allocating the first one
1845
   on demand. */
1846
 
1847
static void
1848
growbuf_by_size (count)
1849
     int count;
1850
{
1851
  int growby;
1852
 
1853
  growby = max (count, GROWBY_MIN_SIZE);
1854
  tempbufsize += growby;
1855
  if (tempbuf == NULL)
1856
    tempbuf = (char *) xmalloc (tempbufsize);
1857
  else
1858
    tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
1859
}
1860
 
1861
/* Blatantly ripped off from ch-exp.y. This routine recognizes F77
1862
   string-literals.
1863
 
1864
   Recognize a string literal.  A string literal is a nonzero sequence
1865
   of characters enclosed in matching single quotes, except that
1866
   a single character inside single quotes is a character literal, which
1867
   we reject as a string literal.  To embed the terminator character inside
1868
   a string, it is simply doubled (I.E. 'this''is''one''string') */
1869
 
1870
static int
1871
match_string_literal ()
1872
{
1873
  char *tokptr = lexptr;
1874
 
1875
  for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
1876
    {
1877
      CHECKBUF (1);
1878
      if (*tokptr == *lexptr)
1879
        {
1880
          if (*(tokptr + 1) == *lexptr)
1881
            tokptr++;
1882
          else
1883
            break;
1884
        }
1885
      tempbuf[tempbufindex++] = *tokptr;
1886
    }
1887
  if (*tokptr == '\0'                                   /* no terminator */
1888
      || tempbufindex == 0)                              /* no string */
1889
    return 0;
1890
  else
1891
    {
1892
      tempbuf[tempbufindex] = '\0';
1893
      yylval.sval.ptr = tempbuf;
1894
      yylval.sval.length = tempbufindex;
1895
      lexptr = ++tokptr;
1896
      return STRING_LITERAL;
1897
    }
1898
}
1899
 
1900
/* Read one token, getting characters through lexptr.  */
1901
 
1902
static int
1903
yylex ()
1904
{
1905
  int c;
1906
  int namelen;
1907
  unsigned int i,token;
1908
  char *tokstart;
1909
 
1910
 retry:
1911
 
1912
  prev_lexptr = lexptr;
1913
 
1914
  tokstart = lexptr;
1915
 
1916
  /* First of all, let us make sure we are not dealing with the
1917
     special tokens .true. and .false. which evaluate to 1 and 0.  */
1918
 
1919
  if (*lexptr == '.')
1920
    {
1921
      for (i = 0; boolean_values[i].name != NULL; i++)
1922
        {
1923
          if STREQN (tokstart, boolean_values[i].name,
1924
                    strlen (boolean_values[i].name))
1925
            {
1926
              lexptr += strlen (boolean_values[i].name);
1927
              yylval.lval = boolean_values[i].value;
1928
              return BOOLEAN_LITERAL;
1929
            }
1930
        }
1931
    }
1932
 
1933
  /* See if it is a special .foo. operator */
1934
 
1935
  for (i = 0; dot_ops[i].operator != NULL; i++)
1936
    if (STREQN (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)))
1937
      {
1938
        lexptr += strlen (dot_ops[i].operator);
1939
        yylval.opcode = dot_ops[i].opcode;
1940
        return dot_ops[i].token;
1941
      }
1942
 
1943
  switch (c = *tokstart)
1944
    {
1945
    case 0:
1946
      return 0;
1947
 
1948
    case ' ':
1949
    case '\t':
1950
    case '\n':
1951
      lexptr++;
1952
      goto retry;
1953
 
1954
    case '\'':
1955
      token = match_string_literal ();
1956
      if (token != 0)
1957
        return (token);
1958
      break;
1959
 
1960
    case '(':
1961
      paren_depth++;
1962
      lexptr++;
1963
      return c;
1964
 
1965
    case ')':
1966
      if (paren_depth == 0)
1967
        return 0;
1968
      paren_depth--;
1969
      lexptr++;
1970
      return c;
1971
 
1972
    case ',':
1973
      if (comma_terminates && paren_depth == 0)
1974
        return 0;
1975
      lexptr++;
1976
      return c;
1977
 
1978
    case '.':
1979
      /* Might be a floating point number.  */
1980
      if (lexptr[1] < '0' || lexptr[1] > '9')
1981
        goto symbol;            /* Nope, must be a symbol. */
1982
      /* FALL THRU into number case.  */
1983
 
1984
    case '0':
1985
    case '1':
1986
    case '2':
1987
    case '3':
1988
    case '4':
1989
    case '5':
1990
    case '6':
1991
    case '7':
1992
    case '8':
1993
    case '9':
1994
      {
1995
        /* It's a number.  */
1996
        int got_dot = 0, got_e = 0, got_d = 0, toktype;
1997
        register char *p = tokstart;
1998
        int hex = input_radix > 10;
1999
 
2000
        if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2001
          {
2002
            p += 2;
2003
            hex = 1;
2004
          }
2005
        else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2006
          {
2007
            p += 2;
2008
            hex = 0;
2009
          }
2010
 
2011
        for (;; ++p)
2012
          {
2013
            if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2014
              got_dot = got_e = 1;
2015
            else if (!hex && !got_d && (*p == 'd' || *p == 'D'))
2016
              got_dot = got_d = 1;
2017
            else if (!hex && !got_dot && *p == '.')
2018
              got_dot = 1;
2019
            else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
2020
                     || (got_d && (p[-1] == 'd' || p[-1] == 'D')))
2021
                     && (*p == '-' || *p == '+'))
2022
              /* This is the sign of the exponent, not the end of the
2023
                 number.  */
2024
              continue;
2025
            /* We will take any letters or digits.  parse_number will
2026
               complain if past the radix, or if L or U are not final.  */
2027
            else if ((*p < '0' || *p > '9')
2028
                     && ((*p < 'a' || *p > 'z')
2029
                         && (*p < 'A' || *p > 'Z')))
2030
              break;
2031
          }
2032
        toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d,
2033
                                &yylval);
2034
        if (toktype == ERROR)
2035
          {
2036
            char *err_copy = (char *) alloca (p - tokstart + 1);
2037
 
2038
            memcpy (err_copy, tokstart, p - tokstart);
2039
            err_copy[p - tokstart] = 0;
2040
            error ("Invalid number \"%s\".", err_copy);
2041
          }
2042
        lexptr = p;
2043
        return toktype;
2044
      }
2045
 
2046
    case '+':
2047
    case '-':
2048
    case '*':
2049
    case '/':
2050
    case '%':
2051
    case '|':
2052
    case '&':
2053
    case '^':
2054
    case '~':
2055
    case '!':
2056
    case '@':
2057
    case '<':
2058
    case '>':
2059
    case '[':
2060
    case ']':
2061
    case '?':
2062
    case ':':
2063
    case '=':
2064
    case '{':
2065
    case '}':
2066
    symbol:
2067
      lexptr++;
2068
      return c;
2069
    }
2070
 
2071
  if (!(c == '_' || c == '$'
2072
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2073
    /* We must have come across a bad character (e.g. ';').  */
2074
    error ("Invalid character '%c' in expression.", c);
2075
 
2076
  namelen = 0;
2077
  for (c = tokstart[namelen];
2078
       (c == '_' || c == '$' || (c >= '0' && c <= '9')
2079
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2080
       c = tokstart[++namelen]);
2081
 
2082
  /* The token "if" terminates the expression and is NOT
2083
     removed from the input stream.  */
2084
 
2085
  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2086
    return 0;
2087
 
2088
  lexptr += namelen;
2089
 
2090
  /* Catch specific keywords.  */
2091
 
2092
  for (i = 0; f77_keywords[i].operator != NULL; i++)
2093
    if (STREQN(tokstart, f77_keywords[i].operator,
2094
               strlen(f77_keywords[i].operator)))
2095
      {
2096
        /*      lexptr += strlen(f77_keywords[i].operator); */
2097
        yylval.opcode = f77_keywords[i].opcode;
2098
        return f77_keywords[i].token;
2099
      }
2100
 
2101
  yylval.sval.ptr = tokstart;
2102
  yylval.sval.length = namelen;
2103
 
2104
  if (*tokstart == '$')
2105
    {
2106
      write_dollar_variable (yylval.sval);
2107
      return VARIABLE;
2108
    }
2109
 
2110
  /* Use token-type TYPENAME for symbols that happen to be defined
2111
     currently as names of types; NAME for other symbols.
2112
     The caller is not constrained to care about the distinction.  */
2113
  {
2114
    char *tmp = copy_name (yylval.sval);
2115
    struct symbol *sym;
2116
    int is_a_field_of_this = 0;
2117
    int hextype;
2118
 
2119
    sym = lookup_symbol (tmp, expression_context_block,
2120
                         VAR_NAMESPACE,
2121
                         current_language->la_language == language_cplus
2122
                         ? &is_a_field_of_this : NULL,
2123
                         NULL);
2124
    if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2125
      {
2126
        yylval.tsym.type = SYMBOL_TYPE (sym);
2127
        return TYPENAME;
2128
      }
2129
    if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2130
      return TYPENAME;
2131
 
2132
    /* Input names that aren't symbols but ARE valid hex numbers,
2133
       when the input radix permits them, can be names or numbers
2134
       depending on the parse.  Note we support radixes > 16 here.  */
2135
    if (!sym
2136
        && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
2137
            || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2138
      {
2139
        YYSTYPE newlval;        /* Its value is ignored.  */
2140
        hextype = parse_number (tokstart, namelen, 0, &newlval);
2141
        if (hextype == INT)
2142
          {
2143
            yylval.ssym.sym = sym;
2144
            yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2145
            return NAME_OR_INT;
2146
          }
2147
      }
2148
 
2149
    /* Any other kind of symbol */
2150
    yylval.ssym.sym = sym;
2151
    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2152
    return NAME;
2153
  }
2154
}
2155
 
2156
void
2157
yyerror (msg)
2158
     char *msg;
2159
{
2160
  if (prev_lexptr)
2161
    lexptr = prev_lexptr;
2162
 
2163
  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2164
}

powered by: WebSVN 2.1.0

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