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

Subversion Repositories or1k

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

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

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

powered by: WebSVN 2.1.0

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