packaging: Add python3-base dependency
[platform/upstream/gdb.git] / gdb / f-exp.c
1 /* A Bison parser, made by GNU Bison 3.8.2.  */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6    Inc.
7
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
20
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38    especially those whose name start with YY_ or yy_.  They are
39    private implementation details that can be changed or removed.  */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42    infringing on user name space.  This should be done even for local
43    variables, as they might otherwise be expanded by user macros.
44    There are some unavoidable exceptions within include files to
45    define necessary library symbols; they are noted "INFRINGES ON
46    USER NAME SPACE" below.  */
47
48 /* Identify Bison output, and Bison version.  */
49 #define YYBISON 30802
50
51 /* Bison version string.  */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name.  */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers.  */
58 #define YYPURE 0
59
60 /* Push parsers.  */
61 #define YYPUSH 0
62
63 /* Pull parsers.  */
64 #define YYPULL 1
65
66
67
68
69 /* First part of user prologue.  */
70 #line 43 "f-exp.y"
71
72
73 #include "defs.h"
74 #include "expression.h"
75 #include "value.h"
76 #include "parser-defs.h"
77 #include "language.h"
78 #include "f-lang.h"
79 #include "bfd.h" /* Required by objfiles.h.  */
80 #include "symfile.h" /* Required by objfiles.h.  */
81 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
82 #include "block.h"
83 #include <ctype.h>
84 #include <algorithm>
85 #include "type-stack.h"
86 #include "f-exp.h"
87
88 #define parse_type(ps) builtin_type (ps->gdbarch ())
89 #define parse_f_type(ps) builtin_f_type (ps->gdbarch ())
90
91 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
92    etc).  */
93 #define GDB_YY_REMAP_PREFIX f_
94 #include "yy-remap.h"
95
96 /* The state of the parser, used internally when we are parsing the
97    expression.  */
98
99 static struct parser_state *pstate = NULL;
100
101 /* Depth of parentheses.  */
102 static int paren_depth;
103
104 /* The current type stack.  */
105 static struct type_stack *type_stack;
106
107 int yyparse (void);
108
109 static int yylex (void);
110
111 static void yyerror (const char *);
112
113 static void growbuf_by_size (int);
114
115 static int match_string_literal (void);
116
117 static void push_kind_type (LONGEST val, struct type *type);
118
119 static struct type *convert_to_kind_type (struct type *basetype, int kind);
120
121 static void wrap_unop_intrinsic (exp_opcode opcode);
122
123 static void wrap_binop_intrinsic (exp_opcode opcode);
124
125 static void wrap_ternop_intrinsic (exp_opcode opcode);
126
127 template<typename T>
128 static void fortran_wrap2_kind (type *base_type);
129
130 template<typename T>
131 static void fortran_wrap3_kind (type *base_type);
132
133 using namespace expr;
134
135 #line 136 "f-exp.c.tmp"
136
137 # ifndef YY_CAST
138 #  ifdef __cplusplus
139 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
140 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
141 #  else
142 #   define YY_CAST(Type, Val) ((Type) (Val))
143 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
144 #  endif
145 # endif
146 # ifndef YY_NULLPTRPTR
147 #  if defined __cplusplus
148 #   if 201103L <= __cplusplus
149 #    define YY_NULLPTRPTR nullptr
150 #   else
151 #    define YY_NULLPTRPTR 0
152 #   endif
153 #  else
154 #   define YY_NULLPTRPTR ((void*)0)
155 #  endif
156 # endif
157
158
159 /* Debug traces.  */
160 #ifndef YYDEBUG
161 # define YYDEBUG 0
162 #endif
163 #if YYDEBUG
164 extern int yydebug;
165 #endif
166
167 /* Token kinds.  */
168 #ifndef YYTOKENTYPE
169 # define YYTOKENTYPE
170   enum yytokentype
171   {
172     YYEMPTY = -2,
173     YYEOF = 0,                     /* "end of file"  */
174     YYerror = 256,                 /* error  */
175     YYUNDEF = 257,                 /* "invalid token"  */
176     INT = 258,                     /* INT  */
177     FLOAT = 259,                   /* FLOAT  */
178     STRING_LITERAL = 260,          /* STRING_LITERAL  */
179     BOOLEAN_LITERAL = 261,         /* BOOLEAN_LITERAL  */
180     NAME = 262,                    /* NAME  */
181     TYPENAME = 263,                /* TYPENAME  */
182     COMPLETE = 264,                /* COMPLETE  */
183     NAME_OR_INT = 265,             /* NAME_OR_INT  */
184     SIZEOF = 266,                  /* SIZEOF  */
185     KIND = 267,                    /* KIND  */
186     ERROR = 268,                   /* ERROR  */
187     INT_S1_KEYWORD = 269,          /* INT_S1_KEYWORD  */
188     INT_S2_KEYWORD = 270,          /* INT_S2_KEYWORD  */
189     INT_KEYWORD = 271,             /* INT_KEYWORD  */
190     INT_S4_KEYWORD = 272,          /* INT_S4_KEYWORD  */
191     INT_S8_KEYWORD = 273,          /* INT_S8_KEYWORD  */
192     LOGICAL_S1_KEYWORD = 274,      /* LOGICAL_S1_KEYWORD  */
193     LOGICAL_S2_KEYWORD = 275,      /* LOGICAL_S2_KEYWORD  */
194     LOGICAL_KEYWORD = 276,         /* LOGICAL_KEYWORD  */
195     LOGICAL_S4_KEYWORD = 277,      /* LOGICAL_S4_KEYWORD  */
196     LOGICAL_S8_KEYWORD = 278,      /* LOGICAL_S8_KEYWORD  */
197     REAL_KEYWORD = 279,            /* REAL_KEYWORD  */
198     REAL_S4_KEYWORD = 280,         /* REAL_S4_KEYWORD  */
199     REAL_S8_KEYWORD = 281,         /* REAL_S8_KEYWORD  */
200     REAL_S16_KEYWORD = 282,        /* REAL_S16_KEYWORD  */
201     COMPLEX_KEYWORD = 283,         /* COMPLEX_KEYWORD  */
202     COMPLEX_S4_KEYWORD = 284,      /* COMPLEX_S4_KEYWORD  */
203     COMPLEX_S8_KEYWORD = 285,      /* COMPLEX_S8_KEYWORD  */
204     COMPLEX_S16_KEYWORD = 286,     /* COMPLEX_S16_KEYWORD  */
205     BOOL_AND = 287,                /* BOOL_AND  */
206     BOOL_OR = 288,                 /* BOOL_OR  */
207     BOOL_NOT = 289,                /* BOOL_NOT  */
208     SINGLE = 290,                  /* SINGLE  */
209     DOUBLE = 291,                  /* DOUBLE  */
210     PRECISION = 292,               /* PRECISION  */
211     CHARACTER = 293,               /* CHARACTER  */
212     DOLLAR_VARIABLE = 294,         /* DOLLAR_VARIABLE  */
213     ASSIGN_MODIFY = 295,           /* ASSIGN_MODIFY  */
214     UNOP_INTRINSIC = 296,          /* UNOP_INTRINSIC  */
215     BINOP_INTRINSIC = 297,         /* BINOP_INTRINSIC  */
216     UNOP_OR_BINOP_INTRINSIC = 298, /* UNOP_OR_BINOP_INTRINSIC  */
217     UNOP_OR_BINOP_OR_TERNOP_INTRINSIC = 299, /* UNOP_OR_BINOP_OR_TERNOP_INTRINSIC  */
218     ABOVE_COMMA = 300,             /* ABOVE_COMMA  */
219     EQUAL = 301,                   /* EQUAL  */
220     NOTEQUAL = 302,                /* NOTEQUAL  */
221     LESSTHAN = 303,                /* LESSTHAN  */
222     GREATERTHAN = 304,             /* GREATERTHAN  */
223     LEQ = 305,                     /* LEQ  */
224     GEQ = 306,                     /* GEQ  */
225     LSH = 307,                     /* LSH  */
226     RSH = 308,                     /* RSH  */
227     STARSTAR = 309,                /* STARSTAR  */
228     UNARY = 310                    /* UNARY  */
229   };
230   typedef enum yytokentype yytoken_kind_t;
231 #endif
232 /* Token kinds.  */
233 #define YYEMPTY -2
234 #define YYEOF 0
235 #define YYerror 256
236 #define YYUNDEF 257
237 #define INT 258
238 #define FLOAT 259
239 #define STRING_LITERAL 260
240 #define BOOLEAN_LITERAL 261
241 #define NAME 262
242 #define TYPENAME 263
243 #define COMPLETE 264
244 #define NAME_OR_INT 265
245 #define SIZEOF 266
246 #define KIND 267
247 #define ERROR 268
248 #define INT_S1_KEYWORD 269
249 #define INT_S2_KEYWORD 270
250 #define INT_KEYWORD 271
251 #define INT_S4_KEYWORD 272
252 #define INT_S8_KEYWORD 273
253 #define LOGICAL_S1_KEYWORD 274
254 #define LOGICAL_S2_KEYWORD 275
255 #define LOGICAL_KEYWORD 276
256 #define LOGICAL_S4_KEYWORD 277
257 #define LOGICAL_S8_KEYWORD 278
258 #define REAL_KEYWORD 279
259 #define REAL_S4_KEYWORD 280
260 #define REAL_S8_KEYWORD 281
261 #define REAL_S16_KEYWORD 282
262 #define COMPLEX_KEYWORD 283
263 #define COMPLEX_S4_KEYWORD 284
264 #define COMPLEX_S8_KEYWORD 285
265 #define COMPLEX_S16_KEYWORD 286
266 #define BOOL_AND 287
267 #define BOOL_OR 288
268 #define BOOL_NOT 289
269 #define SINGLE 290
270 #define DOUBLE 291
271 #define PRECISION 292
272 #define CHARACTER 293
273 #define DOLLAR_VARIABLE 294
274 #define ASSIGN_MODIFY 295
275 #define UNOP_INTRINSIC 296
276 #define BINOP_INTRINSIC 297
277 #define UNOP_OR_BINOP_INTRINSIC 298
278 #define UNOP_OR_BINOP_OR_TERNOP_INTRINSIC 299
279 #define ABOVE_COMMA 300
280 #define EQUAL 301
281 #define NOTEQUAL 302
282 #define LESSTHAN 303
283 #define GREATERTHAN 304
284 #define LEQ 305
285 #define GEQ 306
286 #define LSH 307
287 #define RSH 308
288 #define STARSTAR 309
289 #define UNARY 310
290
291 /* Value type.  */
292 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
293 union YYSTYPE
294 {
295 #line 113 "f-exp.y"
296
297     LONGEST lval;
298     struct {
299       LONGEST val;
300       struct type *type;
301     } typed_val;
302     struct {
303       gdb_byte val[16];
304       struct type *type;
305     } typed_val_float;
306     struct symbol *sym;
307     struct type *tval;
308     struct stoken sval;
309     struct ttype tsym;
310     struct symtoken ssym;
311     int voidval;
312     enum exp_opcode opcode;
313     struct internalvar *ivar;
314
315     struct type **tvec;
316     int *ivec;
317   
318
319 #line 320 "f-exp.c.tmp"
320
321 };
322 typedef union YYSTYPE YYSTYPE;
323 # define YYSTYPE_IS_TRIVIAL 1
324 # define YYSTYPE_IS_DECLARED 1
325 #endif
326
327
328 extern YYSTYPE yylval;
329
330
331 int yyparse (void);
332
333
334
335 /* Symbol kind.  */
336 enum yysymbol_kind_t
337 {
338   YYSYMBOL_YYEMPTY = -2,
339   YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
340   YYSYMBOL_YYerror = 1,                    /* error  */
341   YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
342   YYSYMBOL_INT = 3,                        /* INT  */
343   YYSYMBOL_FLOAT = 4,                      /* FLOAT  */
344   YYSYMBOL_STRING_LITERAL = 5,             /* STRING_LITERAL  */
345   YYSYMBOL_BOOLEAN_LITERAL = 6,            /* BOOLEAN_LITERAL  */
346   YYSYMBOL_NAME = 7,                       /* NAME  */
347   YYSYMBOL_TYPENAME = 8,                   /* TYPENAME  */
348   YYSYMBOL_COMPLETE = 9,                   /* COMPLETE  */
349   YYSYMBOL_NAME_OR_INT = 10,               /* NAME_OR_INT  */
350   YYSYMBOL_SIZEOF = 11,                    /* SIZEOF  */
351   YYSYMBOL_KIND = 12,                      /* KIND  */
352   YYSYMBOL_ERROR = 13,                     /* ERROR  */
353   YYSYMBOL_INT_S1_KEYWORD = 14,            /* INT_S1_KEYWORD  */
354   YYSYMBOL_INT_S2_KEYWORD = 15,            /* INT_S2_KEYWORD  */
355   YYSYMBOL_INT_KEYWORD = 16,               /* INT_KEYWORD  */
356   YYSYMBOL_INT_S4_KEYWORD = 17,            /* INT_S4_KEYWORD  */
357   YYSYMBOL_INT_S8_KEYWORD = 18,            /* INT_S8_KEYWORD  */
358   YYSYMBOL_LOGICAL_S1_KEYWORD = 19,        /* LOGICAL_S1_KEYWORD  */
359   YYSYMBOL_LOGICAL_S2_KEYWORD = 20,        /* LOGICAL_S2_KEYWORD  */
360   YYSYMBOL_LOGICAL_KEYWORD = 21,           /* LOGICAL_KEYWORD  */
361   YYSYMBOL_LOGICAL_S4_KEYWORD = 22,        /* LOGICAL_S4_KEYWORD  */
362   YYSYMBOL_LOGICAL_S8_KEYWORD = 23,        /* LOGICAL_S8_KEYWORD  */
363   YYSYMBOL_REAL_KEYWORD = 24,              /* REAL_KEYWORD  */
364   YYSYMBOL_REAL_S4_KEYWORD = 25,           /* REAL_S4_KEYWORD  */
365   YYSYMBOL_REAL_S8_KEYWORD = 26,           /* REAL_S8_KEYWORD  */
366   YYSYMBOL_REAL_S16_KEYWORD = 27,          /* REAL_S16_KEYWORD  */
367   YYSYMBOL_COMPLEX_KEYWORD = 28,           /* COMPLEX_KEYWORD  */
368   YYSYMBOL_COMPLEX_S4_KEYWORD = 29,        /* COMPLEX_S4_KEYWORD  */
369   YYSYMBOL_COMPLEX_S8_KEYWORD = 30,        /* COMPLEX_S8_KEYWORD  */
370   YYSYMBOL_COMPLEX_S16_KEYWORD = 31,       /* COMPLEX_S16_KEYWORD  */
371   YYSYMBOL_BOOL_AND = 32,                  /* BOOL_AND  */
372   YYSYMBOL_BOOL_OR = 33,                   /* BOOL_OR  */
373   YYSYMBOL_BOOL_NOT = 34,                  /* BOOL_NOT  */
374   YYSYMBOL_SINGLE = 35,                    /* SINGLE  */
375   YYSYMBOL_DOUBLE = 36,                    /* DOUBLE  */
376   YYSYMBOL_PRECISION = 37,                 /* PRECISION  */
377   YYSYMBOL_CHARACTER = 38,                 /* CHARACTER  */
378   YYSYMBOL_DOLLAR_VARIABLE = 39,           /* DOLLAR_VARIABLE  */
379   YYSYMBOL_ASSIGN_MODIFY = 40,             /* ASSIGN_MODIFY  */
380   YYSYMBOL_UNOP_INTRINSIC = 41,            /* UNOP_INTRINSIC  */
381   YYSYMBOL_BINOP_INTRINSIC = 42,           /* BINOP_INTRINSIC  */
382   YYSYMBOL_UNOP_OR_BINOP_INTRINSIC = 43,   /* UNOP_OR_BINOP_INTRINSIC  */
383   YYSYMBOL_UNOP_OR_BINOP_OR_TERNOP_INTRINSIC = 44, /* UNOP_OR_BINOP_OR_TERNOP_INTRINSIC  */
384   YYSYMBOL_45_ = 45,                       /* ','  */
385   YYSYMBOL_ABOVE_COMMA = 46,               /* ABOVE_COMMA  */
386   YYSYMBOL_47_ = 47,                       /* '='  */
387   YYSYMBOL_48_ = 48,                       /* '?'  */
388   YYSYMBOL_49_ = 49,                       /* '|'  */
389   YYSYMBOL_50_ = 50,                       /* '^'  */
390   YYSYMBOL_51_ = 51,                       /* '&'  */
391   YYSYMBOL_EQUAL = 52,                     /* EQUAL  */
392   YYSYMBOL_NOTEQUAL = 53,                  /* NOTEQUAL  */
393   YYSYMBOL_LESSTHAN = 54,                  /* LESSTHAN  */
394   YYSYMBOL_GREATERTHAN = 55,               /* GREATERTHAN  */
395   YYSYMBOL_LEQ = 56,                       /* LEQ  */
396   YYSYMBOL_GEQ = 57,                       /* GEQ  */
397   YYSYMBOL_LSH = 58,                       /* LSH  */
398   YYSYMBOL_RSH = 59,                       /* RSH  */
399   YYSYMBOL_60_ = 60,                       /* '@'  */
400   YYSYMBOL_61_ = 61,                       /* '+'  */
401   YYSYMBOL_62_ = 62,                       /* '-'  */
402   YYSYMBOL_63_ = 63,                       /* '*'  */
403   YYSYMBOL_64_ = 64,                       /* '/'  */
404   YYSYMBOL_STARSTAR = 65,                  /* STARSTAR  */
405   YYSYMBOL_66_ = 66,                       /* '%'  */
406   YYSYMBOL_UNARY = 67,                     /* UNARY  */
407   YYSYMBOL_68_ = 68,                       /* '('  */
408   YYSYMBOL_69_ = 69,                       /* ')'  */
409   YYSYMBOL_70_ = 70,                       /* '~'  */
410   YYSYMBOL_71_ = 71,                       /* ':'  */
411   YYSYMBOL_YYACCEPT = 72,                  /* $accept  */
412   YYSYMBOL_start = 73,                     /* start  */
413   YYSYMBOL_type_exp = 74,                  /* type_exp  */
414   YYSYMBOL_exp = 75,                       /* exp  */
415   YYSYMBOL_76_1 = 76,                      /* $@1  */
416   YYSYMBOL_77_2 = 77,                      /* $@2  */
417   YYSYMBOL_78_3 = 78,                      /* $@3  */
418   YYSYMBOL_arglist = 79,                   /* arglist  */
419   YYSYMBOL_subrange = 80,                  /* subrange  */
420   YYSYMBOL_complexnum = 81,                /* complexnum  */
421   YYSYMBOL_variable = 82,                  /* variable  */
422   YYSYMBOL_type = 83,                      /* type  */
423   YYSYMBOL_ptype = 84,                     /* ptype  */
424   YYSYMBOL_abs_decl = 85,                  /* abs_decl  */
425   YYSYMBOL_direct_abs_decl = 86,           /* direct_abs_decl  */
426   YYSYMBOL_func_mod = 87,                  /* func_mod  */
427   YYSYMBOL_typebase = 88,                  /* typebase  */
428   YYSYMBOL_nonempty_typelist = 89,         /* nonempty_typelist  */
429   YYSYMBOL_name = 90,                      /* name  */
430   YYSYMBOL_name_not_typename = 91          /* name_not_typename  */
431 };
432 typedef enum yysymbol_kind_t yysymbol_kind_t;
433
434
435 /* Second part of user prologue.  */
436 #line 136 "f-exp.y"
437
438 /* YYSTYPE gets defined by %union */
439 static int parse_number (struct parser_state *, const char *, int,
440                          int, YYSTYPE *);
441
442 #line 443 "f-exp.c.tmp"
443
444
445 #ifdef short
446 # undef short
447 #endif
448
449 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
450    <limits.h> and (if available) <stdint.h> are included
451    so that the code can choose integer types of a good width.  */
452
453 #ifndef __PTRDIFF_MAX__
454 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
455 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
456 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
457 #  define YY_STDINT_H
458 # endif
459 #endif
460
461 /* Narrow types that promote to a signed type and that can represent a
462    signed or unsigned integer of at least N bits.  In tables they can
463    save space and decrease cache pressure.  Promoting to a signed type
464    helps avoid bugs in integer arithmetic.  */
465
466 #ifdef __INT_LEAST8_MAX__
467 typedef __INT_LEAST8_TYPE__ yytype_int8;
468 #elif defined YY_STDINT_H
469 typedef int_least8_t yytype_int8;
470 #else
471 typedef signed char yytype_int8;
472 #endif
473
474 #ifdef __INT_LEAST16_MAX__
475 typedef __INT_LEAST16_TYPE__ yytype_int16;
476 #elif defined YY_STDINT_H
477 typedef int_least16_t yytype_int16;
478 #else
479 typedef short yytype_int16;
480 #endif
481
482 /* Work around bug in HP-UX 11.23, which defines these macros
483    incorrectly for preprocessor constants.  This workaround can likely
484    be removed in 2023, as HPE has promised support for HP-UX 11.23
485    (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
486    <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>.  */
487 #ifdef __hpux
488 # undef UINT_LEAST8_MAX
489 # undef UINT_LEAST16_MAX
490 # define UINT_LEAST8_MAX 255
491 # define UINT_LEAST16_MAX 65535
492 #endif
493
494 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
495 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
496 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
497        && UINT_LEAST8_MAX <= INT_MAX)
498 typedef uint_least8_t yytype_uint8;
499 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
500 typedef unsigned char yytype_uint8;
501 #else
502 typedef short yytype_uint8;
503 #endif
504
505 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
506 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
507 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
508        && UINT_LEAST16_MAX <= INT_MAX)
509 typedef uint_least16_t yytype_uint16;
510 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
511 typedef unsigned short yytype_uint16;
512 #else
513 typedef int yytype_uint16;
514 #endif
515
516 #ifndef YYPTRDIFF_T
517 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
518 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
519 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
520 # elif defined PTRDIFF_MAX
521 #  ifndef ptrdiff_t
522 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
523 #  endif
524 #  define YYPTRDIFF_T ptrdiff_t
525 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
526 # else
527 #  define YYPTRDIFF_T long
528 #  define YYPTRDIFF_MAXIMUM LONG_MAX
529 # endif
530 #endif
531
532 #ifndef YYSIZE_T
533 # ifdef __SIZE_TYPE__
534 #  define YYSIZE_T __SIZE_TYPE__
535 # elif defined size_t
536 #  define YYSIZE_T size_t
537 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
538 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
539 #  define YYSIZE_T size_t
540 # else
541 #  define YYSIZE_T unsigned
542 # endif
543 #endif
544
545 #define YYSIZE_MAXIMUM                                  \
546   YY_CAST (YYPTRDIFF_T,                                 \
547            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
548             ? YYPTRDIFF_MAXIMUM                         \
549             : YY_CAST (YYSIZE_T, -1)))
550
551 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
552
553
554 /* Stored state numbers (used for stacks). */
555 typedef yytype_uint8 yy_state_t;
556
557 /* State numbers in computations.  */
558 typedef int yy_state_fast_t;
559
560 #ifndef YY_
561 # if defined YYENABLE_NLS && YYENABLE_NLS
562 #  if ENABLE_NLS
563 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
564 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
565 #  endif
566 # endif
567 # ifndef YY_
568 #  define YY_(Msgid) Msgid
569 # endif
570 #endif
571
572
573 #ifndef YY_ATTRIBUTE_PURE
574 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
575 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
576 # else
577 #  define YY_ATTRIBUTE_PURE
578 # endif
579 #endif
580
581 #ifndef YY_ATTRIBUTE_UNUSED
582 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
583 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
584 # else
585 #  define YY_ATTRIBUTE_UNUSED
586 # endif
587 #endif
588
589 /* Suppress unused-variable warnings by "using" E.  */
590 #if ! defined lint || defined __GNUC__
591 # define YY_USE(E) ((void) (E))
592 #else
593 # define YY_USE(E) /* empty */
594 #endif
595
596 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
597 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
598 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
599 #  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
600     _Pragma ("GCC diagnostic push")                                     \
601     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
602 # else
603 #  define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                           \
604     _Pragma ("GCC diagnostic push")                                     \
605     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
606     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
607 # endif
608 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
609     _Pragma ("GCC diagnostic pop")
610 #else
611 # define YY_INITIAL_VALUE(Value) Value
612 #endif
613 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
614 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
615 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
616 #endif
617 #ifndef YY_INITIAL_VALUE
618 # define YY_INITIAL_VALUE(Value) /* Nothing. */
619 #endif
620
621 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
622 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
623     _Pragma ("GCC diagnostic push")                            \
624     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
625 # define YY_IGNORE_USELESS_CAST_END            \
626     _Pragma ("GCC diagnostic pop")
627 #endif
628 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
629 # define YY_IGNORE_USELESS_CAST_BEGIN
630 # define YY_IGNORE_USELESS_CAST_END
631 #endif
632
633
634 #define YY_ASSERT(E) ((void) (0 && (E)))
635
636 #if !defined yyoverflow
637
638 /* The parser invokes alloca or xmalloc; define the necessary symbols.  */
639
640 # ifdef YYSTACK_USE_ALLOCA
641 #  if YYSTACK_USE_ALLOCA
642 #   ifdef __GNUC__
643 #    define YYSTACK_ALLOC __builtin_alloca
644 #   elif defined __BUILTIN_VA_ARG_INCR
645 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
646 #   elif defined _AIX
647 #    define YYSTACK_ALLOC __alloca
648 #   elif defined _MSC_VER
649 #    define alloca _alloca
650 #   else
651 #    define YYSTACK_ALLOC alloca
652 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
653 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
654       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
655 #     ifndef EXIT_SUCCESS
656 #      define EXIT_SUCCESS 0
657 #     endif
658 #    endif
659 #   endif
660 #  endif
661 # endif
662
663 # ifdef YYSTACK_ALLOC
664    /* Pacify GCC's 'empty if-body' warning.  */
665 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
666 #  ifndef YYSTACK_ALLOC_MAXIMUM
667     /* The OS might guarantee only one guard page at the bottom of the stack,
668        and a page size can be as small as 4096 bytes.  So we cannot safely
669        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
670        to allow for a few compiler-allocated temporary stack slots.  */
671 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
672 #  endif
673 # else
674 #  define YYSTACK_ALLOC YYMALLOC
675 #  define YYSTACK_FREE YYFREE
676 #  ifndef YYSTACK_ALLOC_MAXIMUM
677 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
678 #  endif
679 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
680        && ! ((defined YYMALLOC || defined xmalloc) \
681              && (defined YYFREE || defined xfree)))
682 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
683 #   ifndef EXIT_SUCCESS
684 #    define EXIT_SUCCESS 0
685 #   endif
686 #  endif
687 #  ifndef YYMALLOC
688 #   define YYMALLOC xmalloc
689 #   if ! defined xmalloc && ! defined EXIT_SUCCESS
690 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
691 #   endif
692 #  endif
693 #  ifndef YYFREE
694 #   define YYFREE xfree
695 #   if ! defined xfree && ! defined EXIT_SUCCESS
696 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
697 #   endif
698 #  endif
699 # endif
700 #endif /* !defined yyoverflow */
701
702 #if (! defined yyoverflow \
703      && (! defined __cplusplus \
704          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
705
706 /* A type that is properly aligned for any stack member.  */
707 union yyalloc
708 {
709   yy_state_t yyss_alloc;
710   YYSTYPE yyvs_alloc;
711 };
712
713 /* The size of the maximum gap between one aligned stack and the next.  */
714 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
715
716 /* The size of an array large to enough to hold all stacks, each with
717    N elements.  */
718 # define YYSTACK_BYTES(N) \
719      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
720       + YYSTACK_GAP_MAXIMUM)
721
722 # define YYCOPY_NEEDED 1
723
724 /* Relocate STACK from its old location to the new one.  The
725    local variables YYSIZE and YYSTACKSIZE give the old and new number of
726    elements in the stack, and YYPTR gives the new location of the
727    stack.  Advance YYPTR to a properly aligned location for the next
728    stack.  */
729 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
730     do                                                                  \
731       {                                                                 \
732         YYPTRDIFF_T yynewbytes;                                         \
733         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
734         Stack = &yyptr->Stack_alloc;                                    \
735         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
736         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
737       }                                                                 \
738     while (0)
739
740 #endif
741
742 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
743 /* Copy COUNT objects from SRC to DST.  The source and destination do
744    not overlap.  */
745 # ifndef YYCOPY
746 #  if defined __GNUC__ && 1 < __GNUC__
747 #   define YYCOPY(Dst, Src, Count) \
748       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
749 #  else
750 #   define YYCOPY(Dst, Src, Count)              \
751       do                                        \
752         {                                       \
753           YYPTRDIFF_T yyi;                      \
754           for (yyi = 0; yyi < (Count); yyi++)   \
755             (Dst)[yyi] = (Src)[yyi];            \
756         }                                       \
757       while (0)
758 #  endif
759 # endif
760 #endif /* !YYCOPY_NEEDED */
761
762 /* YYFINAL -- State number of the termination state.  */
763 #define YYFINAL  69
764 /* YYLAST -- Last index in YYTABLE.  */
765 #define YYLAST   924
766
767 /* YYNTOKENS -- Number of terminals.  */
768 #define YYNTOKENS  72
769 /* YYNNTS -- Number of nonterminals.  */
770 #define YYNNTS  20
771 /* YYNRULES -- Number of rules.  */
772 #define YYNRULES  113
773 /* YYNSTATES -- Number of states.  */
774 #define YYNSTATES  184
775
776 /* YYMAXUTOK -- Last valid token kind.  */
777 #define YYMAXUTOK   310
778
779
780 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
781    as returned by yylex, with out-of-bounds checking.  */
782 #define YYTRANSLATE(YYX)                                \
783   (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
784    ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
785    : YYSYMBOL_YYUNDEF)
786
787 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
788    as returned by yylex.  */
789 static const yytype_int8 yytranslate[] =
790 {
791        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
792        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
793        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
794        2,     2,     2,     2,     2,     2,     2,    66,    51,     2,
795       68,    69,    63,    61,    45,    62,     2,    64,     2,     2,
796        2,     2,     2,     2,     2,     2,     2,     2,    71,     2,
797        2,    47,     2,    48,    60,     2,     2,     2,     2,     2,
798        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
799        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
800        2,     2,     2,     2,    50,     2,     2,     2,     2,     2,
801        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
802        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
803        2,     2,     2,     2,    49,     2,    70,     2,     2,     2,
804        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
805        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
806        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
807        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
808        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
809        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
810        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
811        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
812        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
813        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
814        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
815        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
816        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
817        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
818       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
819       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
820       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
821       46,    52,    53,    54,    55,    56,    57,    58,    59,    65,
822       67
823 };
824
825 #if YYDEBUG
826 /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
827 static const yytype_int16 yyrline[] =
828 {
829        0,   222,   222,   223,   226,   230,   235,   239,   243,   247,
830      251,   255,   259,   269,   268,   279,   285,   292,   291,   312,
831      311,   335,   338,   342,   346,   350,   356,   366,   375,   384,
832      395,   407,   419,   431,   443,   447,   457,   464,   471,   481,
833      493,   497,   501,   505,   509,   513,   517,   521,   525,   529,
834      533,   537,   541,   545,   549,   553,   557,   561,   566,   570,
835      574,   583,   590,   600,   609,   612,   616,   625,   629,   636,
836      644,   647,   648,   699,   701,   703,   705,   707,   710,   712,
837      714,   716,   718,   722,   724,   729,   731,   733,   735,   737,
838      739,   741,   743,   745,   747,   749,   751,   753,   755,   757,
839      759,   761,   763,   765,   767,   769,   771,   773,   775,   780,
840      785,   793,   795,   799
841 };
842 #endif
843
844 /** Accessing symbol of state STATE.  */
845 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
846
847 #if YYDEBUG || 0
848 /* The user-facing name of the symbol whose (internal) number is
849    YYSYMBOL.  No bounds checking.  */
850 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
851
852 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
853    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
854 static const char *const yytname[] =
855 {
856   "\"end of file\"", "error", "\"invalid token\"", "INT", "FLOAT",
857   "STRING_LITERAL", "BOOLEAN_LITERAL", "NAME", "TYPENAME", "COMPLETE",
858   "NAME_OR_INT", "SIZEOF", "KIND", "ERROR", "INT_S1_KEYWORD",
859   "INT_S2_KEYWORD", "INT_KEYWORD", "INT_S4_KEYWORD", "INT_S8_KEYWORD",
860   "LOGICAL_S1_KEYWORD", "LOGICAL_S2_KEYWORD", "LOGICAL_KEYWORD",
861   "LOGICAL_S4_KEYWORD", "LOGICAL_S8_KEYWORD", "REAL_KEYWORD",
862   "REAL_S4_KEYWORD", "REAL_S8_KEYWORD", "REAL_S16_KEYWORD",
863   "COMPLEX_KEYWORD", "COMPLEX_S4_KEYWORD", "COMPLEX_S8_KEYWORD",
864   "COMPLEX_S16_KEYWORD", "BOOL_AND", "BOOL_OR", "BOOL_NOT", "SINGLE",
865   "DOUBLE", "PRECISION", "CHARACTER", "DOLLAR_VARIABLE", "ASSIGN_MODIFY",
866   "UNOP_INTRINSIC", "BINOP_INTRINSIC", "UNOP_OR_BINOP_INTRINSIC",
867   "UNOP_OR_BINOP_OR_TERNOP_INTRINSIC", "','", "ABOVE_COMMA", "'='", "'?'",
868   "'|'", "'^'", "'&'", "EQUAL", "NOTEQUAL", "LESSTHAN", "GREATERTHAN",
869   "LEQ", "GEQ", "LSH", "RSH", "'@'", "'+'", "'-'", "'*'", "'/'",
870   "STARSTAR", "'%'", "UNARY", "'('", "')'", "'~'", "':'", "$accept",
871   "start", "type_exp", "exp", "$@1", "$@2", "$@3", "arglist", "subrange",
872   "complexnum", "variable", "type", "ptype", "abs_decl", "direct_abs_decl",
873   "func_mod", "typebase", "nonempty_typelist", "name", "name_not_typename", YY_NULLPTRPTR
874 };
875
876 static const char *
877 yysymbol_name (yysymbol_kind_t yysymbol)
878 {
879   return yytname[yysymbol];
880 }
881 #endif
882
883 #define YYPACT_NINF (-103)
884
885 #define yypact_value_is_default(Yyn) \
886   ((Yyn) == YYPACT_NINF)
887
888 #define YYTABLE_NINF (-1)
889
890 #define yytable_value_is_error(Yyn) \
891   0
892
893 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
894    STATE-NUM.  */
895 static const yytype_int16 yypact[] =
896 {
897      249,  -103,  -103,  -103,  -103,  -103,  -103,  -103,   291,   -62,
898     -103,  -103,  -103,  -103,  -103,  -103,  -103,  -103,  -103,  -103,
899     -103,  -103,  -103,  -103,  -103,  -103,  -103,  -103,   333,     6,
900       18,  -103,  -103,   -61,   -33,   -26,   -21,   333,   333,   333,
901      249,   333,    56,  -103,   718,  -103,  -103,  -103,    -6,  -103,
902      249,   -20,   333,   -20,  -103,  -103,  -103,  -103,   333,   333,
903     -103,  -103,   -20,   -20,   -20,   567,   -16,    -4,   -20,  -103,
904      333,   333,   333,   333,   333,   333,   333,   333,   333,   333,
905      333,   333,   333,   333,   333,   333,   333,   333,   333,   333,
906      333,    60,  -103,    -6,    -2,   432,  -103,    29,  -103,    40,
907      373,   605,   681,    88,    88,   333,  -103,  -103,   333,   802,
908      753,   718,   718,   821,   839,   856,   733,   733,    53,    53,
909       53,    53,   133,   133,    72,    38,    38,    58,    58,    58,
910     -103,  -103,  -103,    54,    88,  -103,  -103,  -103,    63,  -103,
911     -103,    59,   -40,    -5,  -103,   375,  -103,  -103,   333,   166,
912      456,   -18,  -103,    -9,   718,   -20,  -103,    51,   104,  -103,
913      812,  -103,   643,   333,   493,   180,    88,  -103,  -103,  -103,
914       75,  -103,  -103,   718,   333,   333,   530,   456,  -103,  -103,
915      718,   718,   333,   718
916 };
917
918 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
919    Performed when YYTABLE does not specify something else to do.  Zero
920    means the default is an error.  */
921 static const yytype_int8 yydefact[] =
922 {
923        0,    61,    63,    68,    67,   113,    85,    62,     0,     0,
924       86,    87,    88,    89,    90,    92,    93,    94,    95,    96,
925       97,    98,    99,   100,   101,   102,   103,   104,     0,     0,
926        0,    91,    65,     0,     0,     0,     0,     0,     0,     0,
927        0,     0,     0,     3,     2,    64,     4,    70,    71,    69,
928        0,    11,     0,     9,   107,   105,   108,   106,     0,     0,
929       17,    19,     7,     8,     6,     0,     0,     0,    10,     1,
930        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
931        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
932        0,     0,    13,    75,    73,     0,    72,    77,    82,     0,
933        0,     0,     0,    21,    21,     0,     5,    35,     0,    57,
934       58,    60,    59,    56,    55,    54,    48,    49,    52,    53,
935       50,    51,    46,    47,    40,    44,    45,    42,    43,    41,
936      111,   112,    39,    37,    21,    76,    80,    74,     0,    83,
937      109,     0,     0,     0,    81,    66,    12,    15,     0,    29,
938       22,     0,    23,     0,    34,    36,    38,     0,     0,    78,
939        0,    84,     0,     0,    28,    27,     0,    18,    20,    14,
940        0,   110,    16,    33,     0,     0,    26,    24,    25,    79,
941       32,    31,     0,    30
942 };
943
944 /* YYPGOTO[NTERM-NUM].  */
945 static const yytype_int8 yypgoto[] =
946 {
947     -103,  -103,  -103,     0,  -103,  -103,  -103,  -102,   -41,  -103,
948     -103,     4,  -103,    48,  -103,    49,  -103,  -103,  -103,  -103
949 };
950
951 /* YYDEFGOTO[NTERM-NUM].  */
952 static const yytype_uint8 yydefgoto[] =
953 {
954        0,    42,    43,   150,   134,   103,   104,   151,   152,    66,
955       45,   140,    47,    96,    97,    98,    48,   142,   133,    49
956 };
957
958 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
959    positive, shift that token.  If negative, reduce the rule whose
960    number is the opposite.  If YYTABLE_NINF, syntax error.  */
961 static const yytype_uint8 yytable[] =
962 {
963       44,   136,   153,     6,    46,   160,    52,    58,    51,    10,
964       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
965       21,    22,    23,    24,    25,    26,    27,   166,    53,   161,
966       29,    30,   157,    31,    54,    59,   166,    62,    63,    64,
967       65,    68,    60,    55,    67,    93,    56,    61,    92,    93,
968       65,   167,   100,   107,    99,    57,    69,    94,   101,   102,
969      168,    94,    95,   156,   139,   108,    95,   130,   131,   132,
970      109,   110,   111,   112,   113,   114,   115,   116,   117,   118,
971      119,   120,   121,   122,   123,   124,   125,   126,   127,   128,
972      129,     1,     2,     3,     4,     5,   166,   143,     7,     8,
973        9,    88,    89,    90,    91,   154,    92,   170,   155,   145,
974      158,    83,    84,    85,    86,    87,    88,    89,    90,    91,
975      169,    92,    28,    90,    91,   178,    92,    32,   159,    33,
976       34,    35,    36,    86,    87,    88,    89,    90,    91,    37,
977       92,   135,   137,   141,   179,   155,   144,     0,   162,   164,
978       38,    39,     0,     0,     0,     0,    40,     0,    41,   149,
979        0,     0,     0,   173,   171,   176,   177,     0,     0,     1,
980        2,     3,     4,     5,   180,   181,     7,     8,     9,     0,
981        0,     0,   183,     1,     2,     3,     4,     5,     0,     0,
982        7,     8,     9,    85,    86,    87,    88,    89,    90,    91,
983       28,    92,     0,     0,     0,    32,     0,    33,    34,    35,
984       36,     0,     0,     0,    28,     0,     0,    37,     0,    32,
985        0,    33,    34,    35,    36,     0,     0,     0,    38,    39,
986        0,    37,     0,     0,    40,     0,    41,   163,     0,     0,
987        0,     0,    38,    39,     0,     0,     0,     0,    40,     0,
988       41,   175,     1,     2,     3,     4,     5,     6,     0,     7,
989        8,     9,     0,    10,    11,    12,    13,    14,    15,    16,
990       17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
991       27,     0,     0,    28,    29,    30,     0,    31,    32,     0,
992       33,    34,    35,    36,     1,     2,     3,     4,     5,     0,
993       37,     7,     8,     9,     0,     0,     0,     0,     0,     0,
994        0,    38,    39,     0,     0,     0,     0,    40,     0,    41,
995        0,     0,     0,     0,     0,    28,     0,     0,     0,     0,
996       32,     0,    33,    34,    35,    36,     1,     2,     3,     4,
997        5,     0,    37,     7,     8,     9,     0,     0,     0,     0,
998        0,     0,     0,    38,    39,     0,     0,     0,     0,    50,
999        0,    41,     0,     0,     0,     0,     0,    28,     0,     0,
1000        0,     0,    32,     0,    33,    34,    35,    36,     1,     2,
1001        3,     4,     5,     0,    37,     7,     8,     9,     0,     0,
1002        0,     0,     0,     0,     0,    38,    39,     0,     0,     0,
1003        0,    40,     0,    41,     0,    70,    71,     0,     0,    28,
1004        0,     0,     0,    72,    32,     0,    33,    34,    35,    36,
1005       73,     0,    74,    75,    76,    77,    78,    79,    80,    81,
1006       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1007        6,    92,   146,    40,   138,    41,    10,    11,    12,    13,
1008       14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
1009       24,    25,    26,    27,     0,     0,     0,    29,    30,     0,
1010       31,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1011        0,     0,     0,    93,     0,     0,     0,     0,    70,    71,
1012        0,     0,     0,     0,     0,    94,    72,     0,     0,     0,
1013       95,   139,     0,    73,     0,    74,    75,    76,    77,    78,
1014       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
1015       89,    90,    91,     0,    92,    70,    71,   165,     0,     0,
1016        0,     0,     0,    72,     0,     0,     0,     0,     0,     0,
1017       73,     0,    74,    75,    76,    77,    78,    79,    80,    81,
1018       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1019        0,    92,    70,    71,   174,     0,     0,     0,     0,     0,
1020       72,     0,     0,     0,     0,     0,     0,    73,     0,    74,
1021       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
1022       85,    86,    87,    88,    89,    90,    91,     0,    92,    70,
1023       71,   182,     0,     0,     0,     0,     0,    72,     0,     0,
1024        0,     0,   105,     0,    73,     0,    74,    75,    76,    77,
1025       78,    79,    80,    81,    82,    83,    84,    85,    86,    87,
1026       88,    89,    90,    91,     0,    92,   106,    70,    71,     0,
1027        0,     0,     0,     0,     0,    72,     0,     0,     0,     0,
1028        0,     0,    73,     0,    74,    75,    76,    77,    78,    79,
1029       80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
1030       90,    91,     0,    92,   147,    70,    71,     0,     0,     0,
1031        0,     0,     0,    72,     0,     0,     0,     0,     0,     0,
1032       73,     0,    74,    75,    76,    77,    78,    79,    80,    81,
1033       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1034        0,    92,   172,    70,    71,     0,     0,     0,     0,     0,
1035        0,    72,     0,     0,     0,     0,   148,     0,    73,     0,
1036       74,    75,    76,    77,    78,    79,    80,    81,    82,    83,
1037       84,    85,    86,    87,    88,    89,    90,    91,     0,    92,
1038       70,    71,     0,     0,     0,     0,     0,     0,    72,     0,
1039        0,     0,     0,     0,     0,    73,     0,    74,    75,    76,
1040       77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
1041       87,    88,    89,    90,    91,    70,    92,    79,    80,    81,
1042       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1043        0,    92,    74,    75,    76,    77,    78,    79,    80,    81,
1044       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1045        6,    92,     0,     0,     0,     0,    10,    11,    12,    13,
1046       14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
1047       24,    25,    26,    27,     0,     0,     0,    29,    30,     0,
1048       31,    74,    75,    76,    77,    78,    79,    80,    81,    82,
1049       83,    84,    85,    86,    87,    88,    89,    90,    91,     0,
1050       92,    75,    76,    77,    78,    79,    80,    81,    82,    83,
1051       84,    85,    86,    87,    88,    89,    90,    91,     0,    92,
1052       76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
1053       86,    87,    88,    89,    90,    91,     0,    92,    77,    78,
1054       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
1055       89,    90,    91,     0,    92
1056 };
1057
1058 static const yytype_int16 yycheck[] =
1059 {
1060        0,     3,   104,     8,     0,    45,    68,    68,     8,    14,
1061       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1062       25,    26,    27,    28,    29,    30,    31,    45,    28,    69,
1063       35,    36,   134,    38,    28,    68,    45,    37,    38,    39,
1064       40,    41,    68,    37,    40,    51,    28,    68,    68,    51,
1065       50,    69,    52,    69,    50,    37,     0,    63,    58,    59,
1066       69,    63,    68,     9,    69,    69,    68,     7,     8,     9,
1067       70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
1068       80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
1069       90,     3,     4,     5,     6,     7,    45,    68,    10,    11,
1070       12,    63,    64,    65,    66,   105,    68,     3,   108,    69,
1071       47,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1072       69,    68,    34,    65,    66,   166,    68,    39,    69,    41,
1073       42,    43,    44,    61,    62,    63,    64,    65,    66,    51,
1074       68,    93,    94,    95,    69,   145,    97,    -1,   148,   149,
1075       62,    63,    -1,    -1,    -1,    -1,    68,    -1,    70,    71,
1076       -1,    -1,    -1,   163,   160,   165,   166,    -1,    -1,     3,
1077        4,     5,     6,     7,   174,   175,    10,    11,    12,    -1,
1078       -1,    -1,   182,     3,     4,     5,     6,     7,    -1,    -1,
1079       10,    11,    12,    60,    61,    62,    63,    64,    65,    66,
1080       34,    68,    -1,    -1,    -1,    39,    -1,    41,    42,    43,
1081       44,    -1,    -1,    -1,    34,    -1,    -1,    51,    -1,    39,
1082       -1,    41,    42,    43,    44,    -1,    -1,    -1,    62,    63,
1083       -1,    51,    -1,    -1,    68,    -1,    70,    71,    -1,    -1,
1084       -1,    -1,    62,    63,    -1,    -1,    -1,    -1,    68,    -1,
1085       70,    71,     3,     4,     5,     6,     7,     8,    -1,    10,
1086       11,    12,    -1,    14,    15,    16,    17,    18,    19,    20,
1087       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
1088       31,    -1,    -1,    34,    35,    36,    -1,    38,    39,    -1,
1089       41,    42,    43,    44,     3,     4,     5,     6,     7,    -1,
1090       51,    10,    11,    12,    -1,    -1,    -1,    -1,    -1,    -1,
1091       -1,    62,    63,    -1,    -1,    -1,    -1,    68,    -1,    70,
1092       -1,    -1,    -1,    -1,    -1,    34,    -1,    -1,    -1,    -1,
1093       39,    -1,    41,    42,    43,    44,     3,     4,     5,     6,
1094        7,    -1,    51,    10,    11,    12,    -1,    -1,    -1,    -1,
1095       -1,    -1,    -1,    62,    63,    -1,    -1,    -1,    -1,    68,
1096       -1,    70,    -1,    -1,    -1,    -1,    -1,    34,    -1,    -1,
1097       -1,    -1,    39,    -1,    41,    42,    43,    44,     3,     4,
1098        5,     6,     7,    -1,    51,    10,    11,    12,    -1,    -1,
1099       -1,    -1,    -1,    -1,    -1,    62,    63,    -1,    -1,    -1,
1100       -1,    68,    -1,    70,    -1,    32,    33,    -1,    -1,    34,
1101       -1,    -1,    -1,    40,    39,    -1,    41,    42,    43,    44,
1102       47,    -1,    49,    50,    51,    52,    53,    54,    55,    56,
1103       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1104        8,    68,    69,    68,    12,    70,    14,    15,    16,    17,
1105       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
1106       28,    29,    30,    31,    -1,    -1,    -1,    35,    36,    -1,
1107       38,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1108       -1,    -1,    -1,    51,    -1,    -1,    -1,    -1,    32,    33,
1109       -1,    -1,    -1,    -1,    -1,    63,    40,    -1,    -1,    -1,
1110       68,    69,    -1,    47,    -1,    49,    50,    51,    52,    53,
1111       54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
1112       64,    65,    66,    -1,    68,    32,    33,    71,    -1,    -1,
1113       -1,    -1,    -1,    40,    -1,    -1,    -1,    -1,    -1,    -1,
1114       47,    -1,    49,    50,    51,    52,    53,    54,    55,    56,
1115       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1116       -1,    68,    32,    33,    71,    -1,    -1,    -1,    -1,    -1,
1117       40,    -1,    -1,    -1,    -1,    -1,    -1,    47,    -1,    49,
1118       50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
1119       60,    61,    62,    63,    64,    65,    66,    -1,    68,    32,
1120       33,    71,    -1,    -1,    -1,    -1,    -1,    40,    -1,    -1,
1121       -1,    -1,    45,    -1,    47,    -1,    49,    50,    51,    52,
1122       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
1123       63,    64,    65,    66,    -1,    68,    69,    32,    33,    -1,
1124       -1,    -1,    -1,    -1,    -1,    40,    -1,    -1,    -1,    -1,
1125       -1,    -1,    47,    -1,    49,    50,    51,    52,    53,    54,
1126       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1127       65,    66,    -1,    68,    69,    32,    33,    -1,    -1,    -1,
1128       -1,    -1,    -1,    40,    -1,    -1,    -1,    -1,    -1,    -1,
1129       47,    -1,    49,    50,    51,    52,    53,    54,    55,    56,
1130       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1131       -1,    68,    69,    32,    33,    -1,    -1,    -1,    -1,    -1,
1132       -1,    40,    -1,    -1,    -1,    -1,    45,    -1,    47,    -1,
1133       49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
1134       59,    60,    61,    62,    63,    64,    65,    66,    -1,    68,
1135       32,    33,    -1,    -1,    -1,    -1,    -1,    -1,    40,    -1,
1136       -1,    -1,    -1,    -1,    -1,    47,    -1,    49,    50,    51,
1137       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1138       62,    63,    64,    65,    66,    32,    68,    54,    55,    56,
1139       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1140       -1,    68,    49,    50,    51,    52,    53,    54,    55,    56,
1141       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1142        8,    68,    -1,    -1,    -1,    -1,    14,    15,    16,    17,
1143       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
1144       28,    29,    30,    31,    -1,    -1,    -1,    35,    36,    -1,
1145       38,    49,    50,    51,    52,    53,    54,    55,    56,    57,
1146       58,    59,    60,    61,    62,    63,    64,    65,    66,    -1,
1147       68,    50,    51,    52,    53,    54,    55,    56,    57,    58,
1148       59,    60,    61,    62,    63,    64,    65,    66,    -1,    68,
1149       51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
1150       61,    62,    63,    64,    65,    66,    -1,    68,    52,    53,
1151       54,    55,    56,    57,    58,    59,    60,    61,    62,    63,
1152       64,    65,    66,    -1,    68
1153 };
1154
1155 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1156    state STATE-NUM.  */
1157 static const yytype_int8 yystos[] =
1158 {
1159        0,     3,     4,     5,     6,     7,     8,    10,    11,    12,
1160       14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
1161       24,    25,    26,    27,    28,    29,    30,    31,    34,    35,
1162       36,    38,    39,    41,    42,    43,    44,    51,    62,    63,
1163       68,    70,    73,    74,    75,    82,    83,    84,    88,    91,
1164       68,    75,    68,    75,    28,    37,    28,    37,    68,    68,
1165       68,    68,    75,    75,    75,    75,    81,    83,    75,     0,
1166       32,    33,    40,    47,    49,    50,    51,    52,    53,    54,
1167       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
1168       65,    66,    68,    51,    63,    68,    85,    86,    87,    83,
1169       75,    75,    75,    77,    78,    45,    69,    69,    69,    75,
1170       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
1171       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
1172        7,     8,     9,    90,    76,    85,     3,    85,    12,    69,
1173       83,    85,    89,    68,    87,    69,    69,    69,    45,    71,
1174       75,    79,    80,    79,    75,    75,     9,    79,    47,    69,
1175       45,    69,    75,    71,    75,    71,    45,    69,    69,    69,
1176        3,    83,    69,    75,    71,    71,    75,    75,    80,    69,
1177       75,    75,    71,    75
1178 };
1179
1180 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.  */
1181 static const yytype_int8 yyr1[] =
1182 {
1183        0,    72,    73,    73,    74,    75,    75,    75,    75,    75,
1184       75,    75,    75,    76,    75,    75,    75,    77,    75,    78,
1185       75,    79,    79,    79,    79,    79,    80,    80,    80,    80,
1186       80,    80,    80,    80,    81,    75,    75,    75,    75,    75,
1187       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
1188       75,    75,    75,    75,    75,    75,    75,    75,    75,    75,
1189       75,    75,    75,    75,    75,    75,    75,    75,    75,    82,
1190       83,    84,    84,    85,    85,    85,    85,    85,    86,    86,
1191       86,    86,    86,    87,    87,    88,    88,    88,    88,    88,
1192       88,    88,    88,    88,    88,    88,    88,    88,    88,    88,
1193       88,    88,    88,    88,    88,    88,    88,    88,    88,    89,
1194       89,    90,    90,    91
1195 };
1196
1197 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM.  */
1198 static const yytype_int8 yyr2[] =
1199 {
1200        0,     2,     1,     1,     1,     3,     2,     2,     2,     2,
1201        2,     2,     4,     0,     5,     4,     6,     0,     5,     0,
1202        5,     0,     1,     1,     3,     3,     3,     2,     2,     1,
1203        5,     4,     4,     3,     3,     3,     4,     3,     4,     3,
1204        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
1205        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
1206        3,     1,     1,     1,     1,     1,     4,     1,     1,     1,
1207        1,     1,     2,     1,     2,     1,     2,     1,     3,     5,
1208        2,     2,     1,     2,     3,     1,     1,     1,     1,     1,
1209        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1210        1,     1,     1,     1,     1,     2,     2,     2,     2,     1,
1211        3,     1,     1,     1
1212 };
1213
1214
1215 enum { YYENOMEM = -2 };
1216
1217 #define yyerrok         (yyerrstatus = 0)
1218 #define yyclearin       (yychar = YYEMPTY)
1219
1220 #define YYACCEPT        goto yyacceptlab
1221 #define YYABORT         goto yyabortlab
1222 #define YYERROR         goto yyerrorlab
1223 #define YYNOMEM         goto yyexhaustedlab
1224
1225
1226 #define YYRECOVERING()  (!!yyerrstatus)
1227
1228 #define YYBACKUP(Token, Value)                                    \
1229   do                                                              \
1230     if (yychar == YYEMPTY)                                        \
1231       {                                                           \
1232         yychar = (Token);                                         \
1233         yylval = (Value);                                         \
1234         YYPOPSTACK (yylen);                                       \
1235         yystate = *yyssp;                                         \
1236         goto yybackup;                                            \
1237       }                                                           \
1238     else                                                          \
1239       {                                                           \
1240         yyerror (YY_("syntax error: cannot back up")); \
1241         YYERROR;                                                  \
1242       }                                                           \
1243   while (0)
1244
1245 /* Backward compatibility with an undocumented macro.
1246    Use YYerror or YYUNDEF. */
1247 #define YYERRCODE YYUNDEF
1248
1249
1250 /* Enable debugging if requested.  */
1251 #if YYDEBUG
1252
1253 # ifndef YYFPRINTF
1254 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1255 #  define YYFPRINTF fprintf
1256 # endif
1257
1258 # define YYDPRINTF(Args)                        \
1259 do {                                            \
1260   if (yydebug)                                  \
1261     YYFPRINTF Args;                             \
1262 } while (0)
1263
1264
1265
1266
1267 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
1268 do {                                                                      \
1269   if (yydebug)                                                            \
1270     {                                                                     \
1271       YYFPRINTF (stderr, "%s ", Title);                                   \
1272       yy_symbol_print (stderr,                                            \
1273                   Kind, Value); \
1274       YYFPRINTF (stderr, "\n");                                           \
1275     }                                                                     \
1276 } while (0)
1277
1278
1279 /*-----------------------------------.
1280 | Print this symbol's value on YYO.  |
1281 `-----------------------------------*/
1282
1283 static void
1284 yy_symbol_value_print (FILE *yyo,
1285                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1286 {
1287   FILE *yyoutput = yyo;
1288   YY_USE (yyoutput);
1289   if (!yyvaluep)
1290     return;
1291   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1292   YY_USE (yykind);
1293   YY_IGNORE_MAYBE_UNINITIALIZED_END
1294 }
1295
1296
1297 /*---------------------------.
1298 | Print this symbol on YYO.  |
1299 `---------------------------*/
1300
1301 static void
1302 yy_symbol_print (FILE *yyo,
1303                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1304 {
1305   YYFPRINTF (yyo, "%s %s (",
1306              yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1307
1308   yy_symbol_value_print (yyo, yykind, yyvaluep);
1309   YYFPRINTF (yyo, ")");
1310 }
1311
1312 /*------------------------------------------------------------------.
1313 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1314 | TOP (included).                                                   |
1315 `------------------------------------------------------------------*/
1316
1317 static void
1318 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1319 {
1320   YYFPRINTF (stderr, "Stack now");
1321   for (; yybottom <= yytop; yybottom++)
1322     {
1323       int yybot = *yybottom;
1324       YYFPRINTF (stderr, " %d", yybot);
1325     }
1326   YYFPRINTF (stderr, "\n");
1327 }
1328
1329 # define YY_STACK_PRINT(Bottom, Top)                            \
1330 do {                                                            \
1331   if (yydebug)                                                  \
1332     yy_stack_print ((Bottom), (Top));                           \
1333 } while (0)
1334
1335
1336 /*------------------------------------------------.
1337 | Report that the YYRULE is going to be reduced.  |
1338 `------------------------------------------------*/
1339
1340 static void
1341 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1342                  int yyrule)
1343 {
1344   int yylno = yyrline[yyrule];
1345   int yynrhs = yyr2[yyrule];
1346   int yyi;
1347   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1348              yyrule - 1, yylno);
1349   /* The symbols being reduced.  */
1350   for (yyi = 0; yyi < yynrhs; yyi++)
1351     {
1352       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1353       yy_symbol_print (stderr,
1354                        YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1355                        &yyvsp[(yyi + 1) - (yynrhs)]);
1356       YYFPRINTF (stderr, "\n");
1357     }
1358 }
1359
1360 # define YY_REDUCE_PRINT(Rule)          \
1361 do {                                    \
1362   if (yydebug)                          \
1363     yy_reduce_print (yyssp, yyvsp, Rule); \
1364 } while (0)
1365
1366 /* Nonzero means print parse trace.  It is left uninitialized so that
1367    multiple parsers can coexist.  */
1368 int yydebug;
1369 #else /* !YYDEBUG */
1370 # define YYDPRINTF(Args) ((void) 0)
1371 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1372 # define YY_STACK_PRINT(Bottom, Top)
1373 # define YY_REDUCE_PRINT(Rule)
1374 #endif /* !YYDEBUG */
1375
1376
1377 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1378 #ifndef YYINITDEPTH
1379 # define YYINITDEPTH 200
1380 #endif
1381
1382 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1383    if the built-in stack extension method is used).
1384
1385    Do not make this value too large; the results are undefined if
1386    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1387    evaluated with infinite-precision integer arithmetic.  */
1388
1389 #ifndef YYMAXDEPTH
1390 # define YYMAXDEPTH 10000
1391 #endif
1392
1393
1394
1395
1396
1397
1398 /*-----------------------------------------------.
1399 | Release the memory associated to this symbol.  |
1400 `-----------------------------------------------*/
1401
1402 static void
1403 yydestruct (const char *yymsg,
1404             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1405 {
1406   YY_USE (yyvaluep);
1407   if (!yymsg)
1408     yymsg = "Deleting";
1409   YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1410
1411   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1412   YY_USE (yykind);
1413   YY_IGNORE_MAYBE_UNINITIALIZED_END
1414 }
1415
1416
1417 /* Lookahead token kind.  */
1418 int yychar;
1419
1420 /* The semantic value of the lookahead symbol.  */
1421 YYSTYPE yylval;
1422 /* Number of syntax errors so far.  */
1423 int yynerrs;
1424
1425
1426
1427
1428 /*----------.
1429 | yyparse.  |
1430 `----------*/
1431
1432 int
1433 yyparse (void)
1434 {
1435     yy_state_fast_t yystate = 0;
1436     /* Number of tokens to shift before error messages enabled.  */
1437     int yyerrstatus = 0;
1438
1439     /* Refer to the stacks through separate pointers, to allow yyoverflow
1440        to xreallocate them elsewhere.  */
1441
1442     /* Their size.  */
1443     YYPTRDIFF_T yystacksize = YYINITDEPTH;
1444
1445     /* The state stack: array, bottom, top.  */
1446     yy_state_t yyssa[YYINITDEPTH];
1447     yy_state_t *yyss = yyssa;
1448     yy_state_t *yyssp = yyss;
1449
1450     /* The semantic value stack: array, bottom, top.  */
1451     YYSTYPE yyvsa[YYINITDEPTH];
1452     YYSTYPE *yyvs = yyvsa;
1453     YYSTYPE *yyvsp = yyvs;
1454
1455   int yyn;
1456   /* The return value of yyparse.  */
1457   int yyresult;
1458   /* Lookahead symbol kind.  */
1459   yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1460   /* The variables used to return semantic value and location from the
1461      action routines.  */
1462   YYSTYPE yyval;
1463
1464
1465
1466 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1467
1468   /* The number of symbols on the RHS of the reduced rule.
1469      Keep to zero when no symbol should be popped.  */
1470   int yylen = 0;
1471
1472   YYDPRINTF ((stderr, "Starting parse\n"));
1473
1474   yychar = YYEMPTY; /* Cause a token to be read.  */
1475
1476   goto yysetstate;
1477
1478
1479 /*------------------------------------------------------------.
1480 | yynewstate -- push a new state, which is found in yystate.  |
1481 `------------------------------------------------------------*/
1482 yynewstate:
1483   /* In all cases, when you get here, the value and location stacks
1484      have just been pushed.  So pushing a state here evens the stacks.  */
1485   yyssp++;
1486
1487
1488 /*--------------------------------------------------------------------.
1489 | yysetstate -- set current state (the top of the stack) to yystate.  |
1490 `--------------------------------------------------------------------*/
1491 yysetstate:
1492   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1493   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1494   YY_IGNORE_USELESS_CAST_BEGIN
1495   *yyssp = YY_CAST (yy_state_t, yystate);
1496   YY_IGNORE_USELESS_CAST_END
1497   YY_STACK_PRINT (yyss, yyssp);
1498
1499   if (yyss + yystacksize - 1 <= yyssp)
1500 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1501     YYNOMEM;
1502 #else
1503     {
1504       /* Get the current used size of the three stacks, in elements.  */
1505       YYPTRDIFF_T yysize = yyssp - yyss + 1;
1506
1507 # if defined yyoverflow
1508       {
1509         /* Give user a chance to xreallocate the stack.  Use copies of
1510            these so that the &'s don't force the real ones into
1511            memory.  */
1512         yy_state_t *yyss1 = yyss;
1513         YYSTYPE *yyvs1 = yyvs;
1514
1515         /* Each stack pointer address is followed by the size of the
1516            data in use in that stack, in bytes.  This used to be a
1517            conditional around just the two extra args, but that might
1518            be undefined if yyoverflow is a macro.  */
1519         yyoverflow (YY_("memory exhausted"),
1520                     &yyss1, yysize * YYSIZEOF (*yyssp),
1521                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
1522                     &yystacksize);
1523         yyss = yyss1;
1524         yyvs = yyvs1;
1525       }
1526 # else /* defined YYSTACK_RELOCATE */
1527       /* Extend the stack our own way.  */
1528       if (YYMAXDEPTH <= yystacksize)
1529         YYNOMEM;
1530       yystacksize *= 2;
1531       if (YYMAXDEPTH < yystacksize)
1532         yystacksize = YYMAXDEPTH;
1533
1534       {
1535         yy_state_t *yyss1 = yyss;
1536         union yyalloc *yyptr =
1537           YY_CAST (union yyalloc *,
1538                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1539         if (! yyptr)
1540           YYNOMEM;
1541         YYSTACK_RELOCATE (yyss_alloc, yyss);
1542         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1543 #  undef YYSTACK_RELOCATE
1544         if (yyss1 != yyssa)
1545           YYSTACK_FREE (yyss1);
1546       }
1547 # endif
1548
1549       yyssp = yyss + yysize - 1;
1550       yyvsp = yyvs + yysize - 1;
1551
1552       YY_IGNORE_USELESS_CAST_BEGIN
1553       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1554                   YY_CAST (long, yystacksize)));
1555       YY_IGNORE_USELESS_CAST_END
1556
1557       if (yyss + yystacksize - 1 <= yyssp)
1558         YYABORT;
1559     }
1560 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1561
1562
1563   if (yystate == YYFINAL)
1564     YYACCEPT;
1565
1566   goto yybackup;
1567
1568
1569 /*-----------.
1570 | yybackup.  |
1571 `-----------*/
1572 yybackup:
1573   /* Do appropriate processing given the current state.  Read a
1574      lookahead token if we need one and don't already have one.  */
1575
1576   /* First try to decide what to do without reference to lookahead token.  */
1577   yyn = yypact[yystate];
1578   if (yypact_value_is_default (yyn))
1579     goto yydefault;
1580
1581   /* Not known => get a lookahead token if don't already have one.  */
1582
1583   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1584   if (yychar == YYEMPTY)
1585     {
1586       YYDPRINTF ((stderr, "Reading a token\n"));
1587       yychar = yylex ();
1588     }
1589
1590   if (yychar <= YYEOF)
1591     {
1592       yychar = YYEOF;
1593       yytoken = YYSYMBOL_YYEOF;
1594       YYDPRINTF ((stderr, "Now at end of input.\n"));
1595     }
1596   else if (yychar == YYerror)
1597     {
1598       /* The scanner already issued an error message, process directly
1599          to error recovery.  But do not keep the error token as
1600          lookahead, it is too special and may lead us to an endless
1601          loop in error recovery. */
1602       yychar = YYUNDEF;
1603       yytoken = YYSYMBOL_YYerror;
1604       goto yyerrlab1;
1605     }
1606   else
1607     {
1608       yytoken = YYTRANSLATE (yychar);
1609       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1610     }
1611
1612   /* If the proper action on seeing token YYTOKEN is to reduce or to
1613      detect an error, take that action.  */
1614   yyn += yytoken;
1615   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1616     goto yydefault;
1617   yyn = yytable[yyn];
1618   if (yyn <= 0)
1619     {
1620       if (yytable_value_is_error (yyn))
1621         goto yyerrlab;
1622       yyn = -yyn;
1623       goto yyreduce;
1624     }
1625
1626   /* Count tokens shifted since error; after three, turn off error
1627      status.  */
1628   if (yyerrstatus)
1629     yyerrstatus--;
1630
1631   /* Shift the lookahead token.  */
1632   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1633   yystate = yyn;
1634   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1635   *++yyvsp = yylval;
1636   YY_IGNORE_MAYBE_UNINITIALIZED_END
1637
1638   /* Discard the shifted token.  */
1639   yychar = YYEMPTY;
1640   goto yynewstate;
1641
1642
1643 /*-----------------------------------------------------------.
1644 | yydefault -- do the default action for the current state.  |
1645 `-----------------------------------------------------------*/
1646 yydefault:
1647   yyn = yydefact[yystate];
1648   if (yyn == 0)
1649     goto yyerrlab;
1650   goto yyreduce;
1651
1652
1653 /*-----------------------------.
1654 | yyreduce -- do a reduction.  |
1655 `-----------------------------*/
1656 yyreduce:
1657   /* yyn is the number of a rule to reduce with.  */
1658   yylen = yyr2[yyn];
1659
1660   /* If YYLEN is nonzero, implement the default value of the action:
1661      '$$ = $1'.
1662
1663      Otherwise, the following line sets YYVAL to garbage.
1664      This behavior is undocumented and Bison
1665      users should not rely upon it.  Assigning to YYVAL
1666      unconditionally makes the parser a bit smaller, and it avoids a
1667      GCC warning that YYVAL may be used uninitialized.  */
1668   yyval = yyvsp[1-yylen];
1669
1670
1671   YY_REDUCE_PRINT (yyn);
1672   switch (yyn)
1673     {
1674   case 4: /* type_exp: type  */
1675 #line 227 "f-exp.y"
1676                         { pstate->push_new<type_operation> ((yyvsp[0].tval)); }
1677 #line 1679 "f-exp.c.tmp"
1678     break;
1679
1680   case 5: /* exp: '(' exp ')'  */
1681 #line 231 "f-exp.y"
1682                         { }
1683 #line 1685 "f-exp.c.tmp"
1684     break;
1685
1686   case 6: /* exp: '*' exp  */
1687 #line 236 "f-exp.y"
1688                         { pstate->wrap<unop_ind_operation> (); }
1689 #line 1691 "f-exp.c.tmp"
1690     break;
1691
1692   case 7: /* exp: '&' exp  */
1693 #line 240 "f-exp.y"
1694                         { pstate->wrap<unop_addr_operation> (); }
1695 #line 1697 "f-exp.c.tmp"
1696     break;
1697
1698   case 8: /* exp: '-' exp  */
1699 #line 244 "f-exp.y"
1700                         { pstate->wrap<unary_neg_operation> (); }
1701 #line 1703 "f-exp.c.tmp"
1702     break;
1703
1704   case 9: /* exp: BOOL_NOT exp  */
1705 #line 248 "f-exp.y"
1706                         { pstate->wrap<unary_logical_not_operation> (); }
1707 #line 1709 "f-exp.c.tmp"
1708     break;
1709
1710   case 10: /* exp: '~' exp  */
1711 #line 252 "f-exp.y"
1712                         { pstate->wrap<unary_complement_operation> (); }
1713 #line 1715 "f-exp.c.tmp"
1714     break;
1715
1716   case 11: /* exp: SIZEOF exp  */
1717 #line 256 "f-exp.y"
1718                         { pstate->wrap<unop_sizeof_operation> (); }
1719 #line 1721 "f-exp.c.tmp"
1720     break;
1721
1722   case 12: /* exp: KIND '(' exp ')'  */
1723 #line 260 "f-exp.y"
1724                         { pstate->wrap<fortran_kind_operation> (); }
1725 #line 1727 "f-exp.c.tmp"
1726     break;
1727
1728   case 13: /* $@1: %empty  */
1729 #line 269 "f-exp.y"
1730                         { pstate->start_arglist (); }
1731 #line 1733 "f-exp.c.tmp"
1732     break;
1733
1734   case 14: /* exp: exp '(' $@1 arglist ')'  */
1735 #line 271 "f-exp.y"
1736                         {
1737                           std::vector<operation_up> args
1738                             = pstate->pop_vector (pstate->end_arglist ());
1739                           pstate->push_new<fortran_undetermined>
1740                             (pstate->pop (), std::move (args));
1741                         }
1742 #line 1744 "f-exp.c.tmp"
1743     break;
1744
1745   case 15: /* exp: UNOP_INTRINSIC '(' exp ')'  */
1746 #line 280 "f-exp.y"
1747                         {
1748                           wrap_unop_intrinsic ((yyvsp[-3].opcode));
1749                         }
1750 #line 1752 "f-exp.c.tmp"
1751     break;
1752
1753   case 16: /* exp: BINOP_INTRINSIC '(' exp ',' exp ')'  */
1754 #line 286 "f-exp.y"
1755                         {
1756                           wrap_binop_intrinsic ((yyvsp[-5].opcode));
1757                         }
1758 #line 1760 "f-exp.c.tmp"
1759     break;
1760
1761   case 17: /* $@2: %empty  */
1762 #line 292 "f-exp.y"
1763                         { pstate->start_arglist (); }
1764 #line 1766 "f-exp.c.tmp"
1765     break;
1766
1767   case 18: /* exp: UNOP_OR_BINOP_INTRINSIC '(' $@2 arglist ')'  */
1768 #line 294 "f-exp.y"
1769                         {
1770                           const int n = pstate->end_arglist ();
1771
1772                           switch (n)
1773                             {
1774                             case 1:
1775                               wrap_unop_intrinsic ((yyvsp[-4].opcode));
1776                               break;
1777                             case 2:
1778                               wrap_binop_intrinsic ((yyvsp[-4].opcode));
1779                               break;
1780                             default:
1781                               gdb_assert_not_reached
1782                                 ("wrong number of arguments for intrinsics");
1783                             }
1784                         }
1785 #line 1787 "f-exp.c.tmp"
1786     break;
1787
1788   case 19: /* $@3: %empty  */
1789 #line 312 "f-exp.y"
1790                         { pstate->start_arglist (); }
1791 #line 1793 "f-exp.c.tmp"
1792     break;
1793
1794   case 20: /* exp: UNOP_OR_BINOP_OR_TERNOP_INTRINSIC '(' $@3 arglist ')'  */
1795 #line 314 "f-exp.y"
1796                         {
1797                           const int n = pstate->end_arglist ();
1798
1799                           switch (n)
1800                             {
1801                             case 1:
1802                               wrap_unop_intrinsic ((yyvsp[-4].opcode));
1803                               break;
1804                             case 2:
1805                               wrap_binop_intrinsic ((yyvsp[-4].opcode));
1806                               break;
1807                             case 3:
1808                               wrap_ternop_intrinsic ((yyvsp[-4].opcode));
1809                               break;
1810                             default:
1811                               gdb_assert_not_reached
1812                                 ("wrong number of arguments for intrinsics");
1813                             }
1814                         }
1815 #line 1817 "f-exp.c.tmp"
1816     break;
1817
1818   case 22: /* arglist: exp  */
1819 #line 339 "f-exp.y"
1820                         { pstate->arglist_len = 1; }
1821 #line 1823 "f-exp.c.tmp"
1822     break;
1823
1824   case 23: /* arglist: subrange  */
1825 #line 343 "f-exp.y"
1826                         { pstate->arglist_len = 1; }
1827 #line 1829 "f-exp.c.tmp"
1828     break;
1829
1830   case 24: /* arglist: arglist ',' exp  */
1831 #line 347 "f-exp.y"
1832                         { pstate->arglist_len++; }
1833 #line 1835 "f-exp.c.tmp"
1834     break;
1835
1836   case 25: /* arglist: arglist ',' subrange  */
1837 #line 351 "f-exp.y"
1838                         { pstate->arglist_len++; }
1839 #line 1841 "f-exp.c.tmp"
1840     break;
1841
1842   case 26: /* subrange: exp ':' exp  */
1843 #line 357 "f-exp.y"
1844                         {
1845                           operation_up high = pstate->pop ();
1846                           operation_up low = pstate->pop ();
1847                           pstate->push_new<fortran_range_operation>
1848                             (RANGE_STANDARD, std::move (low),
1849                              std::move (high), operation_up ());
1850                         }
1851 #line 1853 "f-exp.c.tmp"
1852     break;
1853
1854   case 27: /* subrange: exp ':'  */
1855 #line 367 "f-exp.y"
1856                         {
1857                           operation_up low = pstate->pop ();
1858                           pstate->push_new<fortran_range_operation>
1859                             (RANGE_HIGH_BOUND_DEFAULT, std::move (low),
1860                              operation_up (), operation_up ());
1861                         }
1862 #line 1864 "f-exp.c.tmp"
1863     break;
1864
1865   case 28: /* subrange: ':' exp  */
1866 #line 376 "f-exp.y"
1867                         {
1868                           operation_up high = pstate->pop ();
1869                           pstate->push_new<fortran_range_operation>
1870                             (RANGE_LOW_BOUND_DEFAULT, operation_up (),
1871                              std::move (high), operation_up ());
1872                         }
1873 #line 1875 "f-exp.c.tmp"
1874     break;
1875
1876   case 29: /* subrange: ':'  */
1877 #line 385 "f-exp.y"
1878                         {
1879                           pstate->push_new<fortran_range_operation>
1880                             (RANGE_LOW_BOUND_DEFAULT
1881                              | RANGE_HIGH_BOUND_DEFAULT,
1882                              operation_up (), operation_up (),
1883                              operation_up ());
1884                         }
1885 #line 1887 "f-exp.c.tmp"
1886     break;
1887
1888   case 30: /* subrange: exp ':' exp ':' exp  */
1889 #line 396 "f-exp.y"
1890                         {
1891                           operation_up stride = pstate->pop ();
1892                           operation_up high = pstate->pop ();
1893                           operation_up low = pstate->pop ();
1894                           pstate->push_new<fortran_range_operation>
1895                             (RANGE_STANDARD | RANGE_HAS_STRIDE,
1896                              std::move (low), std::move (high),
1897                              std::move (stride));
1898                         }
1899 #line 1901 "f-exp.c.tmp"
1900     break;
1901
1902   case 31: /* subrange: exp ':' ':' exp  */
1903 #line 408 "f-exp.y"
1904                         {
1905                           operation_up stride = pstate->pop ();
1906                           operation_up low = pstate->pop ();
1907                           pstate->push_new<fortran_range_operation>
1908                             (RANGE_HIGH_BOUND_DEFAULT
1909                              | RANGE_HAS_STRIDE,
1910                              std::move (low), operation_up (),
1911                              std::move (stride));
1912                         }
1913 #line 1915 "f-exp.c.tmp"
1914     break;
1915
1916   case 32: /* subrange: ':' exp ':' exp  */
1917 #line 420 "f-exp.y"
1918                         {
1919                           operation_up stride = pstate->pop ();
1920                           operation_up high = pstate->pop ();
1921                           pstate->push_new<fortran_range_operation>
1922                             (RANGE_LOW_BOUND_DEFAULT
1923                              | RANGE_HAS_STRIDE,
1924                              operation_up (), std::move (high),
1925                              std::move (stride));
1926                         }
1927 #line 1929 "f-exp.c.tmp"
1928     break;
1929
1930   case 33: /* subrange: ':' ':' exp  */
1931 #line 432 "f-exp.y"
1932                         {
1933                           operation_up stride = pstate->pop ();
1934                           pstate->push_new<fortran_range_operation>
1935                             (RANGE_LOW_BOUND_DEFAULT
1936                              | RANGE_HIGH_BOUND_DEFAULT
1937                              | RANGE_HAS_STRIDE,
1938                              operation_up (), operation_up (),
1939                              std::move (stride));
1940                         }
1941 #line 1943 "f-exp.c.tmp"
1942     break;
1943
1944   case 34: /* complexnum: exp ',' exp  */
1945 #line 444 "f-exp.y"
1946                         { }
1947 #line 1949 "f-exp.c.tmp"
1948     break;
1949
1950   case 35: /* exp: '(' complexnum ')'  */
1951 #line 448 "f-exp.y"
1952                         {
1953                           operation_up rhs = pstate->pop ();
1954                           operation_up lhs = pstate->pop ();
1955                           pstate->push_new<complex_operation>
1956                             (std::move (lhs), std::move (rhs),
1957                              parse_f_type (pstate)->builtin_complex_s16);
1958                         }
1959 #line 1961 "f-exp.c.tmp"
1960     break;
1961
1962   case 36: /* exp: '(' type ')' exp  */
1963 #line 458 "f-exp.y"
1964                         {
1965                           pstate->push_new<unop_cast_operation>
1966                             (pstate->pop (), (yyvsp[-2].tval));
1967                         }
1968 #line 1970 "f-exp.c.tmp"
1969     break;
1970
1971   case 37: /* exp: exp '%' name  */
1972 #line 465 "f-exp.y"
1973                         {
1974                           pstate->push_new<fortran_structop_operation>
1975                             (pstate->pop (), copy_name ((yyvsp[0].sval)));
1976                         }
1977 #line 1979 "f-exp.c.tmp"
1978     break;
1979
1980   case 38: /* exp: exp '%' name COMPLETE  */
1981 #line 472 "f-exp.y"
1982                         {
1983                           structop_base_operation *op
1984                             = new fortran_structop_operation (pstate->pop (),
1985                                                               copy_name ((yyvsp[-1].sval)));
1986                           pstate->mark_struct_expression (op);
1987                           pstate->push (operation_up (op));
1988                         }
1989 #line 1991 "f-exp.c.tmp"
1990     break;
1991
1992   case 39: /* exp: exp '%' COMPLETE  */
1993 #line 482 "f-exp.y"
1994                         {
1995                           structop_base_operation *op
1996                             = new fortran_structop_operation (pstate->pop (),
1997                                                               "");
1998                           pstate->mark_struct_expression (op);
1999                           pstate->push (operation_up (op));
2000                         }
2001 #line 2003 "f-exp.c.tmp"
2002     break;
2003
2004   case 40: /* exp: exp '@' exp  */
2005 #line 494 "f-exp.y"
2006                         { pstate->wrap2<repeat_operation> (); }
2007 #line 2009 "f-exp.c.tmp"
2008     break;
2009
2010   case 41: /* exp: exp STARSTAR exp  */
2011 #line 498 "f-exp.y"
2012                         { pstate->wrap2<exp_operation> (); }
2013 #line 2015 "f-exp.c.tmp"
2014     break;
2015
2016   case 42: /* exp: exp '*' exp  */
2017 #line 502 "f-exp.y"
2018                         { pstate->wrap2<mul_operation> (); }
2019 #line 2021 "f-exp.c.tmp"
2020     break;
2021
2022   case 43: /* exp: exp '/' exp  */
2023 #line 506 "f-exp.y"
2024                         { pstate->wrap2<div_operation> (); }
2025 #line 2027 "f-exp.c.tmp"
2026     break;
2027
2028   case 44: /* exp: exp '+' exp  */
2029 #line 510 "f-exp.y"
2030                         { pstate->wrap2<add_operation> (); }
2031 #line 2033 "f-exp.c.tmp"
2032     break;
2033
2034   case 45: /* exp: exp '-' exp  */
2035 #line 514 "f-exp.y"
2036                         { pstate->wrap2<sub_operation> (); }
2037 #line 2039 "f-exp.c.tmp"
2038     break;
2039
2040   case 46: /* exp: exp LSH exp  */
2041 #line 518 "f-exp.y"
2042                         { pstate->wrap2<lsh_operation> (); }
2043 #line 2045 "f-exp.c.tmp"
2044     break;
2045
2046   case 47: /* exp: exp RSH exp  */
2047 #line 522 "f-exp.y"
2048                         { pstate->wrap2<rsh_operation> (); }
2049 #line 2051 "f-exp.c.tmp"
2050     break;
2051
2052   case 48: /* exp: exp EQUAL exp  */
2053 #line 526 "f-exp.y"
2054                         { pstate->wrap2<equal_operation> (); }
2055 #line 2057 "f-exp.c.tmp"
2056     break;
2057
2058   case 49: /* exp: exp NOTEQUAL exp  */
2059 #line 530 "f-exp.y"
2060                         { pstate->wrap2<notequal_operation> (); }
2061 #line 2063 "f-exp.c.tmp"
2062     break;
2063
2064   case 50: /* exp: exp LEQ exp  */
2065 #line 534 "f-exp.y"
2066                         { pstate->wrap2<leq_operation> (); }
2067 #line 2069 "f-exp.c.tmp"
2068     break;
2069
2070   case 51: /* exp: exp GEQ exp  */
2071 #line 538 "f-exp.y"
2072                         { pstate->wrap2<geq_operation> (); }
2073 #line 2075 "f-exp.c.tmp"
2074     break;
2075
2076   case 52: /* exp: exp LESSTHAN exp  */
2077 #line 542 "f-exp.y"
2078                         { pstate->wrap2<less_operation> (); }
2079 #line 2081 "f-exp.c.tmp"
2080     break;
2081
2082   case 53: /* exp: exp GREATERTHAN exp  */
2083 #line 546 "f-exp.y"
2084                         { pstate->wrap2<gtr_operation> (); }
2085 #line 2087 "f-exp.c.tmp"
2086     break;
2087
2088   case 54: /* exp: exp '&' exp  */
2089 #line 550 "f-exp.y"
2090                         { pstate->wrap2<bitwise_and_operation> (); }
2091 #line 2093 "f-exp.c.tmp"
2092     break;
2093
2094   case 55: /* exp: exp '^' exp  */
2095 #line 554 "f-exp.y"
2096                         { pstate->wrap2<bitwise_xor_operation> (); }
2097 #line 2099 "f-exp.c.tmp"
2098     break;
2099
2100   case 56: /* exp: exp '|' exp  */
2101 #line 558 "f-exp.y"
2102                         { pstate->wrap2<bitwise_ior_operation> (); }
2103 #line 2105 "f-exp.c.tmp"
2104     break;
2105
2106   case 57: /* exp: exp BOOL_AND exp  */
2107 #line 562 "f-exp.y"
2108                         { pstate->wrap2<logical_and_operation> (); }
2109 #line 2111 "f-exp.c.tmp"
2110     break;
2111
2112   case 58: /* exp: exp BOOL_OR exp  */
2113 #line 567 "f-exp.y"
2114                         { pstate->wrap2<logical_or_operation> (); }
2115 #line 2117 "f-exp.c.tmp"
2116     break;
2117
2118   case 59: /* exp: exp '=' exp  */
2119 #line 571 "f-exp.y"
2120                         { pstate->wrap2<assign_operation> (); }
2121 #line 2123 "f-exp.c.tmp"
2122     break;
2123
2124   case 60: /* exp: exp ASSIGN_MODIFY exp  */
2125 #line 575 "f-exp.y"
2126                         {
2127                           operation_up rhs = pstate->pop ();
2128                           operation_up lhs = pstate->pop ();
2129                           pstate->push_new<assign_modify_operation>
2130                             ((yyvsp[-1].opcode), std::move (lhs), std::move (rhs));
2131                         }
2132 #line 2134 "f-exp.c.tmp"
2133     break;
2134
2135   case 61: /* exp: INT  */
2136 #line 584 "f-exp.y"
2137                         {
2138                           pstate->push_new<long_const_operation>
2139                             ((yyvsp[0].typed_val).type, (yyvsp[0].typed_val).val);
2140                         }
2141 #line 2143 "f-exp.c.tmp"
2142     break;
2143
2144   case 62: /* exp: NAME_OR_INT  */
2145 #line 591 "f-exp.y"
2146                         { YYSTYPE val;
2147                           parse_number (pstate, (yyvsp[0].ssym).stoken.ptr,
2148                                         (yyvsp[0].ssym).stoken.length, 0, &val);
2149                           pstate->push_new<long_const_operation>
2150                             (val.typed_val.type,
2151                              val.typed_val.val);
2152                         }
2153 #line 2155 "f-exp.c.tmp"
2154     break;
2155
2156   case 63: /* exp: FLOAT  */
2157 #line 601 "f-exp.y"
2158                         {
2159                           float_data data;
2160                           std::copy (std::begin ((yyvsp[0].typed_val_float).val), std::end ((yyvsp[0].typed_val_float).val),
2161                                      std::begin (data));
2162                           pstate->push_new<float_const_operation> ((yyvsp[0].typed_val_float).type, data);
2163                         }
2164 #line 2166 "f-exp.c.tmp"
2165     break;
2166
2167   case 65: /* exp: DOLLAR_VARIABLE  */
2168 #line 613 "f-exp.y"
2169                         { pstate->push_dollar ((yyvsp[0].sval)); }
2170 #line 2172 "f-exp.c.tmp"
2171     break;
2172
2173   case 66: /* exp: SIZEOF '(' type ')'  */
2174 #line 617 "f-exp.y"
2175                         {
2176                           (yyvsp[-1].tval) = check_typedef ((yyvsp[-1].tval));
2177                           pstate->push_new<long_const_operation>
2178                             (parse_f_type (pstate)->builtin_integer,
2179                              (yyvsp[-1].tval)->length ());
2180                         }
2181 #line 2183 "f-exp.c.tmp"
2182     break;
2183
2184   case 67: /* exp: BOOLEAN_LITERAL  */
2185 #line 626 "f-exp.y"
2186                         { pstate->push_new<bool_operation> ((yyvsp[0].lval)); }
2187 #line 2189 "f-exp.c.tmp"
2188     break;
2189
2190   case 68: /* exp: STRING_LITERAL  */
2191 #line 630 "f-exp.y"
2192                         {
2193                           pstate->push_new<string_operation>
2194                             (copy_name ((yyvsp[0].sval)));
2195                         }
2196 #line 2198 "f-exp.c.tmp"
2197     break;
2198
2199   case 69: /* variable: name_not_typename  */
2200 #line 637 "f-exp.y"
2201                         { struct block_symbol sym = (yyvsp[0].ssym).sym;
2202                           std::string name = copy_name ((yyvsp[0].ssym).stoken);
2203                           pstate->push_symbol (name.c_str (), sym);
2204                         }
2205 #line 2207 "f-exp.c.tmp"
2206     break;
2207
2208   case 72: /* ptype: typebase abs_decl  */
2209 #line 649 "f-exp.y"
2210                 {
2211                   /* This is where the interesting stuff happens.  */
2212                   int done = 0;
2213                   int array_size;
2214                   struct type *follow_type = (yyvsp[-1].tval);
2215                   struct type *range_type;
2216                   
2217                   while (!done)
2218                     switch (type_stack->pop ())
2219                       {
2220                       case tp_end:
2221                         done = 1;
2222                         break;
2223                       case tp_pointer:
2224                         follow_type = lookup_pointer_type (follow_type);
2225                         break;
2226                       case tp_reference:
2227                         follow_type = lookup_lvalue_reference_type (follow_type);
2228                         break;
2229                       case tp_array:
2230                         array_size = type_stack->pop_int ();
2231                         if (array_size != -1)
2232                           {
2233                             range_type =
2234                               create_static_range_type ((struct type *) NULL,
2235                                                         parse_f_type (pstate)
2236                                                         ->builtin_integer,
2237                                                         0, array_size - 1);
2238                             follow_type =
2239                               create_array_type ((struct type *) NULL,
2240                                                  follow_type, range_type);
2241                           }
2242                         else
2243                           follow_type = lookup_pointer_type (follow_type);
2244                         break;
2245                       case tp_function:
2246                         follow_type = lookup_function_type (follow_type);
2247                         break;
2248                       case tp_kind:
2249                         {
2250                           int kind_val = type_stack->pop_int ();
2251                           follow_type
2252                             = convert_to_kind_type (follow_type, kind_val);
2253                         }
2254                         break;
2255                       }
2256                   (yyval.tval) = follow_type;
2257                 }
2258 #line 2260 "f-exp.c.tmp"
2259     break;
2260
2261   case 73: /* abs_decl: '*'  */
2262 #line 700 "f-exp.y"
2263                         { type_stack->push (tp_pointer); (yyval.voidval) = 0; }
2264 #line 2266 "f-exp.c.tmp"
2265     break;
2266
2267   case 74: /* abs_decl: '*' abs_decl  */
2268 #line 702 "f-exp.y"
2269                         { type_stack->push (tp_pointer); (yyval.voidval) = (yyvsp[0].voidval); }
2270 #line 2272 "f-exp.c.tmp"
2271     break;
2272
2273   case 75: /* abs_decl: '&'  */
2274 #line 704 "f-exp.y"
2275                         { type_stack->push (tp_reference); (yyval.voidval) = 0; }
2276 #line 2278 "f-exp.c.tmp"
2277     break;
2278
2279   case 76: /* abs_decl: '&' abs_decl  */
2280 #line 706 "f-exp.y"
2281                         { type_stack->push (tp_reference); (yyval.voidval) = (yyvsp[0].voidval); }
2282 #line 2284 "f-exp.c.tmp"
2283     break;
2284
2285   case 78: /* direct_abs_decl: '(' abs_decl ')'  */
2286 #line 711 "f-exp.y"
2287                         { (yyval.voidval) = (yyvsp[-1].voidval); }
2288 #line 2290 "f-exp.c.tmp"
2289     break;
2290
2291   case 79: /* direct_abs_decl: '(' KIND '=' INT ')'  */
2292 #line 713 "f-exp.y"
2293                         { push_kind_type ((yyvsp[-1].typed_val).val, (yyvsp[-1].typed_val).type); }
2294 #line 2296 "f-exp.c.tmp"
2295     break;
2296
2297   case 80: /* direct_abs_decl: '*' INT  */
2298 #line 715 "f-exp.y"
2299                         { push_kind_type ((yyvsp[0].typed_val).val, (yyvsp[0].typed_val).type); }
2300 #line 2302 "f-exp.c.tmp"
2301     break;
2302
2303   case 81: /* direct_abs_decl: direct_abs_decl func_mod  */
2304 #line 717 "f-exp.y"
2305                         { type_stack->push (tp_function); }
2306 #line 2308 "f-exp.c.tmp"
2307     break;
2308
2309   case 82: /* direct_abs_decl: func_mod  */
2310 #line 719 "f-exp.y"
2311                         { type_stack->push (tp_function); }
2312 #line 2314 "f-exp.c.tmp"
2313     break;
2314
2315   case 83: /* func_mod: '(' ')'  */
2316 #line 723 "f-exp.y"
2317                         { (yyval.voidval) = 0; }
2318 #line 2320 "f-exp.c.tmp"
2319     break;
2320
2321   case 84: /* func_mod: '(' nonempty_typelist ')'  */
2322 #line 725 "f-exp.y"
2323                         { xfree ((yyvsp[-1].tvec)); (yyval.voidval) = 0; }
2324 #line 2326 "f-exp.c.tmp"
2325     break;
2326
2327   case 85: /* typebase: TYPENAME  */
2328 #line 730 "f-exp.y"
2329                         { (yyval.tval) = (yyvsp[0].tsym).type; }
2330 #line 2332 "f-exp.c.tmp"
2331     break;
2332
2333   case 86: /* typebase: INT_S1_KEYWORD  */
2334 #line 732 "f-exp.y"
2335                         { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s1; }
2336 #line 2338 "f-exp.c.tmp"
2337     break;
2338
2339   case 87: /* typebase: INT_S2_KEYWORD  */
2340 #line 734 "f-exp.y"
2341                         { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s2; }
2342 #line 2344 "f-exp.c.tmp"
2343     break;
2344
2345   case 88: /* typebase: INT_KEYWORD  */
2346 #line 736 "f-exp.y"
2347                         { (yyval.tval) = parse_f_type (pstate)->builtin_integer; }
2348 #line 2350 "f-exp.c.tmp"
2349     break;
2350
2351   case 89: /* typebase: INT_S4_KEYWORD  */
2352 #line 738 "f-exp.y"
2353                         { (yyval.tval) = parse_f_type (pstate)->builtin_integer; }
2354 #line 2356 "f-exp.c.tmp"
2355     break;
2356
2357   case 90: /* typebase: INT_S8_KEYWORD  */
2358 #line 740 "f-exp.y"
2359                         { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s8; }
2360 #line 2362 "f-exp.c.tmp"
2361     break;
2362
2363   case 91: /* typebase: CHARACTER  */
2364 #line 742 "f-exp.y"
2365                         { (yyval.tval) = parse_f_type (pstate)->builtin_character; }
2366 #line 2368 "f-exp.c.tmp"
2367     break;
2368
2369   case 92: /* typebase: LOGICAL_S1_KEYWORD  */
2370 #line 744 "f-exp.y"
2371                         { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s1; }
2372 #line 2374 "f-exp.c.tmp"
2373     break;
2374
2375   case 93: /* typebase: LOGICAL_S2_KEYWORD  */
2376 #line 746 "f-exp.y"
2377                         { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s2; }
2378 #line 2380 "f-exp.c.tmp"
2379     break;
2380
2381   case 94: /* typebase: LOGICAL_KEYWORD  */
2382 #line 748 "f-exp.y"
2383                         { (yyval.tval) = parse_f_type (pstate)->builtin_logical; }
2384 #line 2386 "f-exp.c.tmp"
2385     break;
2386
2387   case 95: /* typebase: LOGICAL_S4_KEYWORD  */
2388 #line 750 "f-exp.y"
2389                         { (yyval.tval) = parse_f_type (pstate)->builtin_logical; }
2390 #line 2392 "f-exp.c.tmp"
2391     break;
2392
2393   case 96: /* typebase: LOGICAL_S8_KEYWORD  */
2394 #line 752 "f-exp.y"
2395                         { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s8; }
2396 #line 2398 "f-exp.c.tmp"
2397     break;
2398
2399   case 97: /* typebase: REAL_KEYWORD  */
2400 #line 754 "f-exp.y"
2401                         { (yyval.tval) = parse_f_type (pstate)->builtin_real; }
2402 #line 2404 "f-exp.c.tmp"
2403     break;
2404
2405   case 98: /* typebase: REAL_S4_KEYWORD  */
2406 #line 756 "f-exp.y"
2407                         { (yyval.tval) = parse_f_type (pstate)->builtin_real; }
2408 #line 2410 "f-exp.c.tmp"
2409     break;
2410
2411   case 99: /* typebase: REAL_S8_KEYWORD  */
2412 #line 758 "f-exp.y"
2413                         { (yyval.tval) = parse_f_type (pstate)->builtin_real_s8; }
2414 #line 2416 "f-exp.c.tmp"
2415     break;
2416
2417   case 100: /* typebase: REAL_S16_KEYWORD  */
2418 #line 760 "f-exp.y"
2419                         { (yyval.tval) = parse_f_type (pstate)->builtin_real_s16; }
2420 #line 2422 "f-exp.c.tmp"
2421     break;
2422
2423   case 101: /* typebase: COMPLEX_KEYWORD  */
2424 #line 762 "f-exp.y"
2425                         { (yyval.tval) = parse_f_type (pstate)->builtin_complex; }
2426 #line 2428 "f-exp.c.tmp"
2427     break;
2428
2429   case 102: /* typebase: COMPLEX_S4_KEYWORD  */
2430 #line 764 "f-exp.y"
2431                         { (yyval.tval) = parse_f_type (pstate)->builtin_complex; }
2432 #line 2434 "f-exp.c.tmp"
2433     break;
2434
2435   case 103: /* typebase: COMPLEX_S8_KEYWORD  */
2436 #line 766 "f-exp.y"
2437                         { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s8; }
2438 #line 2440 "f-exp.c.tmp"
2439     break;
2440
2441   case 104: /* typebase: COMPLEX_S16_KEYWORD  */
2442 #line 768 "f-exp.y"
2443                         { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s16; }
2444 #line 2446 "f-exp.c.tmp"
2445     break;
2446
2447   case 105: /* typebase: SINGLE PRECISION  */
2448 #line 770 "f-exp.y"
2449                         { (yyval.tval) = parse_f_type (pstate)->builtin_real;}
2450 #line 2452 "f-exp.c.tmp"
2451     break;
2452
2453   case 106: /* typebase: DOUBLE PRECISION  */
2454 #line 772 "f-exp.y"
2455                         { (yyval.tval) = parse_f_type (pstate)->builtin_real_s8;}
2456 #line 2458 "f-exp.c.tmp"
2457     break;
2458
2459   case 107: /* typebase: SINGLE COMPLEX_KEYWORD  */
2460 #line 774 "f-exp.y"
2461                         { (yyval.tval) = parse_f_type (pstate)->builtin_complex;}
2462 #line 2464 "f-exp.c.tmp"
2463     break;
2464
2465   case 108: /* typebase: DOUBLE COMPLEX_KEYWORD  */
2466 #line 776 "f-exp.y"
2467                         { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s8;}
2468 #line 2470 "f-exp.c.tmp"
2469     break;
2470
2471   case 109: /* nonempty_typelist: type  */
2472 #line 781 "f-exp.y"
2473                 { (yyval.tvec) = (struct type **) xmalloc (sizeof (struct type *) * 2);
2474                   (yyval.ivec)[0] = 1;  /* Number of types in vector */
2475                   (yyval.tvec)[1] = (yyvsp[0].tval);
2476                 }
2477 #line 2479 "f-exp.c.tmp"
2478     break;
2479
2480   case 110: /* nonempty_typelist: nonempty_typelist ',' type  */
2481 #line 786 "f-exp.y"
2482                 { int len = sizeof (struct type *) * (++((yyvsp[-2].ivec)[0]) + 1);
2483                   (yyval.tvec) = (struct type **) xrealloc ((char *) (yyvsp[-2].tvec), len);
2484                   (yyval.tvec)[(yyval.ivec)[0]] = (yyvsp[0].tval);
2485                 }
2486 #line 2488 "f-exp.c.tmp"
2487     break;
2488
2489   case 111: /* name: NAME  */
2490 #line 794 "f-exp.y"
2491                 { (yyval.sval) = (yyvsp[0].ssym).stoken; }
2492 #line 2494 "f-exp.c.tmp"
2493     break;
2494
2495   case 112: /* name: TYPENAME  */
2496 #line 796 "f-exp.y"
2497                 { (yyval.sval) = (yyvsp[0].tsym).stoken; }
2498 #line 2500 "f-exp.c.tmp"
2499     break;
2500
2501
2502 #line 2504 "f-exp.c.tmp"
2503
2504       default: break;
2505     }
2506   /* User semantic actions sometimes alter yychar, and that requires
2507      that yytoken be updated with the new translation.  We take the
2508      approach of translating immediately before every use of yytoken.
2509      One alternative is translating here after every semantic action,
2510      but that translation would be missed if the semantic action invokes
2511      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2512      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2513      incorrect destructor might then be invoked immediately.  In the
2514      case of YYERROR or YYBACKUP, subsequent parser actions might lead
2515      to an incorrect destructor call or verbose syntax error message
2516      before the lookahead is translated.  */
2517   YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2518
2519   YYPOPSTACK (yylen);
2520   yylen = 0;
2521
2522   *++yyvsp = yyval;
2523
2524   /* Now 'shift' the result of the reduction.  Determine what state
2525      that goes to, based on the state we popped back to and the rule
2526      number reduced by.  */
2527   {
2528     const int yylhs = yyr1[yyn] - YYNTOKENS;
2529     const int yyi = yypgoto[yylhs] + *yyssp;
2530     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2531                ? yytable[yyi]
2532                : yydefgoto[yylhs]);
2533   }
2534
2535   goto yynewstate;
2536
2537
2538 /*--------------------------------------.
2539 | yyerrlab -- here on detecting error.  |
2540 `--------------------------------------*/
2541 yyerrlab:
2542   /* Make sure we have latest lookahead translation.  See comments at
2543      user semantic actions for why this is necessary.  */
2544   yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2545   /* If not already recovering from an error, report this error.  */
2546   if (!yyerrstatus)
2547     {
2548       ++yynerrs;
2549       yyerror (YY_("syntax error"));
2550     }
2551
2552   if (yyerrstatus == 3)
2553     {
2554       /* If just tried and failed to reuse lookahead token after an
2555          error, discard it.  */
2556
2557       if (yychar <= YYEOF)
2558         {
2559           /* Return failure if at end of input.  */
2560           if (yychar == YYEOF)
2561             YYABORT;
2562         }
2563       else
2564         {
2565           yydestruct ("Error: discarding",
2566                       yytoken, &yylval);
2567           yychar = YYEMPTY;
2568         }
2569     }
2570
2571   /* Else will try to reuse lookahead token after shifting the error
2572      token.  */
2573   goto yyerrlab1;
2574
2575
2576 /*---------------------------------------------------.
2577 | yyerrorlab -- error raised explicitly by YYERROR.  |
2578 `---------------------------------------------------*/
2579 yyerrorlab:
2580   /* Pacify compilers when the user code never invokes YYERROR and the
2581      label yyerrorlab therefore never appears in user code.  */
2582   if (0)
2583     YYERROR;
2584   ++yynerrs;
2585
2586   /* Do not reclaim the symbols of the rule whose action triggered
2587      this YYERROR.  */
2588   YYPOPSTACK (yylen);
2589   yylen = 0;
2590   YY_STACK_PRINT (yyss, yyssp);
2591   yystate = *yyssp;
2592   goto yyerrlab1;
2593
2594
2595 /*-------------------------------------------------------------.
2596 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2597 `-------------------------------------------------------------*/
2598 yyerrlab1:
2599   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2600
2601   /* Pop stack until we find a state that shifts the error token.  */
2602   for (;;)
2603     {
2604       yyn = yypact[yystate];
2605       if (!yypact_value_is_default (yyn))
2606         {
2607           yyn += YYSYMBOL_YYerror;
2608           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2609             {
2610               yyn = yytable[yyn];
2611               if (0 < yyn)
2612                 break;
2613             }
2614         }
2615
2616       /* Pop the current state because it cannot handle the error token.  */
2617       if (yyssp == yyss)
2618         YYABORT;
2619
2620
2621       yydestruct ("Error: popping",
2622                   YY_ACCESSING_SYMBOL (yystate), yyvsp);
2623       YYPOPSTACK (1);
2624       yystate = *yyssp;
2625       YY_STACK_PRINT (yyss, yyssp);
2626     }
2627
2628   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2629   *++yyvsp = yylval;
2630   YY_IGNORE_MAYBE_UNINITIALIZED_END
2631
2632
2633   /* Shift the error token.  */
2634   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2635
2636   yystate = yyn;
2637   goto yynewstate;
2638
2639
2640 /*-------------------------------------.
2641 | yyacceptlab -- YYACCEPT comes here.  |
2642 `-------------------------------------*/
2643 yyacceptlab:
2644   yyresult = 0;
2645   goto yyreturnlab;
2646
2647
2648 /*-----------------------------------.
2649 | yyabortlab -- YYABORT comes here.  |
2650 `-----------------------------------*/
2651 yyabortlab:
2652   yyresult = 1;
2653   goto yyreturnlab;
2654
2655
2656 /*-----------------------------------------------------------.
2657 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
2658 `-----------------------------------------------------------*/
2659 yyexhaustedlab:
2660   yyerror (YY_("memory exhausted"));
2661   yyresult = 2;
2662   goto yyreturnlab;
2663
2664
2665 /*----------------------------------------------------------.
2666 | yyreturnlab -- parsing is finished, clean up and return.  |
2667 `----------------------------------------------------------*/
2668 yyreturnlab:
2669   if (yychar != YYEMPTY)
2670     {
2671       /* Make sure we have latest lookahead translation.  See comments at
2672          user semantic actions for why this is necessary.  */
2673       yytoken = YYTRANSLATE (yychar);
2674       yydestruct ("Cleanup: discarding lookahead",
2675                   yytoken, &yylval);
2676     }
2677   /* Do not reclaim the symbols of the rule whose action triggered
2678      this YYABORT or YYACCEPT.  */
2679   YYPOPSTACK (yylen);
2680   YY_STACK_PRINT (yyss, yyssp);
2681   while (yyssp != yyss)
2682     {
2683       yydestruct ("Cleanup: popping",
2684                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
2685       YYPOPSTACK (1);
2686     }
2687 #ifndef yyoverflow
2688   if (yyss != yyssa)
2689     YYSTACK_FREE (yyss);
2690 #endif
2691
2692   return yyresult;
2693 }
2694
2695 #line 809 "f-exp.y"
2696
2697
2698 /* Called to match intrinsic function calls with one argument to their
2699    respective implementation and push the operation.  */
2700
2701 static void
2702 wrap_unop_intrinsic (exp_opcode code)
2703 {
2704   switch (code)
2705     {
2706     case UNOP_ABS:
2707       pstate->wrap<fortran_abs_operation> ();
2708       break;
2709     case FORTRAN_FLOOR:
2710       pstate->wrap<fortran_floor_operation_1arg> ();
2711       break;
2712     case FORTRAN_CEILING:
2713       pstate->wrap<fortran_ceil_operation_1arg> ();
2714       break;
2715     case UNOP_FORTRAN_ALLOCATED:
2716       pstate->wrap<fortran_allocated_operation> ();
2717       break;
2718     case UNOP_FORTRAN_RANK:
2719       pstate->wrap<fortran_rank_operation> ();
2720       break;
2721     case UNOP_FORTRAN_SHAPE:
2722       pstate->wrap<fortran_array_shape_operation> ();
2723       break;
2724     case UNOP_FORTRAN_LOC:
2725       pstate->wrap<fortran_loc_operation> ();
2726       break;
2727     case FORTRAN_ASSOCIATED:
2728       pstate->wrap<fortran_associated_1arg> ();
2729       break;
2730     case FORTRAN_ARRAY_SIZE:
2731       pstate->wrap<fortran_array_size_1arg> ();
2732       break;
2733     case FORTRAN_CMPLX:
2734       pstate->wrap<fortran_cmplx_operation_1arg> ();
2735       break;
2736     case FORTRAN_LBOUND:
2737     case FORTRAN_UBOUND:
2738       pstate->push_new<fortran_bound_1arg> (code, pstate->pop ());
2739       break;
2740     default:
2741       gdb_assert_not_reached ("unhandled intrinsic");
2742     }
2743 }
2744
2745 /* Called to match intrinsic function calls with two arguments to their
2746    respective implementation and push the operation.  */
2747
2748 static void
2749 wrap_binop_intrinsic (exp_opcode code)
2750 {
2751   switch (code)
2752     {
2753     case FORTRAN_FLOOR:
2754       fortran_wrap2_kind<fortran_floor_operation_2arg>
2755         (parse_f_type (pstate)->builtin_integer);
2756       break;
2757     case FORTRAN_CEILING:
2758       fortran_wrap2_kind<fortran_ceil_operation_2arg>
2759         (parse_f_type (pstate)->builtin_integer);
2760       break;
2761     case BINOP_MOD:
2762       pstate->wrap2<fortran_mod_operation> ();
2763       break;
2764     case BINOP_FORTRAN_MODULO:
2765       pstate->wrap2<fortran_modulo_operation> ();
2766       break;
2767     case FORTRAN_CMPLX:
2768       pstate->wrap2<fortran_cmplx_operation_2arg> ();
2769       break;
2770     case FORTRAN_ASSOCIATED:
2771       pstate->wrap2<fortran_associated_2arg> ();
2772       break;
2773     case FORTRAN_ARRAY_SIZE:
2774       pstate->wrap2<fortran_array_size_2arg> ();
2775       break;
2776     case FORTRAN_LBOUND:
2777     case FORTRAN_UBOUND:
2778       {
2779         operation_up arg2 = pstate->pop ();
2780         operation_up arg1 = pstate->pop ();
2781         pstate->push_new<fortran_bound_2arg> (code, std::move (arg1),
2782                                               std::move (arg2));
2783       }
2784       break;
2785     default:
2786       gdb_assert_not_reached ("unhandled intrinsic");
2787     }
2788 }
2789
2790 /* Called to match intrinsic function calls with three arguments to their
2791    respective implementation and push the operation.  */
2792
2793 static void
2794 wrap_ternop_intrinsic (exp_opcode code)
2795 {
2796   switch (code)
2797     {
2798     case FORTRAN_LBOUND:
2799     case FORTRAN_UBOUND:
2800       {
2801         operation_up kind_arg = pstate->pop ();
2802         operation_up arg2 = pstate->pop ();
2803         operation_up arg1 = pstate->pop ();
2804
2805         value *val = kind_arg->evaluate (nullptr, pstate->expout.get (),
2806                                          EVAL_AVOID_SIDE_EFFECTS);
2807         gdb_assert (val != nullptr);
2808
2809         type *follow_type
2810           = convert_to_kind_type (parse_f_type (pstate)->builtin_integer,
2811                                   value_as_long (val));
2812
2813         pstate->push_new<fortran_bound_3arg> (code, std::move (arg1),
2814                                               std::move (arg2), follow_type);
2815       }
2816       break;
2817     case FORTRAN_ARRAY_SIZE:
2818       fortran_wrap3_kind<fortran_array_size_3arg>
2819         (parse_f_type (pstate)->builtin_integer);
2820       break;
2821     case FORTRAN_CMPLX:
2822       fortran_wrap3_kind<fortran_cmplx_operation_3arg>
2823         (parse_f_type (pstate)->builtin_complex);
2824       break;
2825     default:
2826       gdb_assert_not_reached ("unhandled intrinsic");
2827     }
2828 }
2829
2830 /* A helper that pops two operations (similar to wrap2), evaluates the last one
2831    assuming it is a kind parameter, and wraps them in some other operation
2832    pushing it to the stack.  */
2833
2834 template<typename T>
2835 static void
2836 fortran_wrap2_kind (type *base_type)
2837 {
2838   operation_up kind_arg = pstate->pop ();
2839   operation_up arg = pstate->pop ();
2840
2841   value *val = kind_arg->evaluate (nullptr, pstate->expout.get (),
2842                                    EVAL_AVOID_SIDE_EFFECTS);
2843   gdb_assert (val != nullptr);
2844
2845   type *follow_type = convert_to_kind_type (base_type, value_as_long (val));
2846
2847   pstate->push_new<T> (std::move (arg), follow_type);
2848 }
2849
2850 /* A helper that pops three operations, evaluates the last one assuming it is a
2851    kind parameter, and wraps them in some other operation pushing it to the
2852    stack.  */
2853
2854 template<typename T>
2855 static void
2856 fortran_wrap3_kind (type *base_type)
2857 {
2858   operation_up kind_arg = pstate->pop ();
2859   operation_up arg2 = pstate->pop ();
2860   operation_up arg1 = pstate->pop ();
2861
2862   value *val = kind_arg->evaluate (nullptr, pstate->expout.get (),
2863                                    EVAL_AVOID_SIDE_EFFECTS);
2864   gdb_assert (val != nullptr);
2865
2866   type *follow_type = convert_to_kind_type (base_type, value_as_long (val));
2867
2868   pstate->push_new<T> (std::move (arg1), std::move (arg2), follow_type);
2869 }
2870
2871 /* Take care of parsing a number (anything that starts with a digit).
2872    Set yylval and return the token type; update lexptr.
2873    LEN is the number of characters in it.  */
2874
2875 /*** Needs some error checking for the float case ***/
2876
2877 static int
2878 parse_number (struct parser_state *par_state,
2879               const char *p, int len, int parsed_float, YYSTYPE *putithere)
2880 {
2881   ULONGEST n = 0;
2882   ULONGEST prevn = 0;
2883   int c;
2884   int base = input_radix;
2885   int unsigned_p = 0;
2886   int long_p = 0;
2887   ULONGEST high_bit;
2888   struct type *signed_type;
2889   struct type *unsigned_type;
2890
2891   if (parsed_float)
2892     {
2893       /* It's a float since it contains a point or an exponent.  */
2894       /* [dD] is not understood as an exponent by parse_float,
2895          change it to 'e'.  */
2896       char *tmp, *tmp2;
2897
2898       tmp = xstrdup (p);
2899       for (tmp2 = tmp; *tmp2; ++tmp2)
2900         if (*tmp2 == 'd' || *tmp2 == 'D')
2901           *tmp2 = 'e';
2902
2903       /* FIXME: Should this use different types?  */
2904       putithere->typed_val_float.type = parse_f_type (pstate)->builtin_real_s8;
2905       bool parsed = parse_float (tmp, len,
2906                                  putithere->typed_val_float.type,
2907                                  putithere->typed_val_float.val);
2908       xfree (tmp);
2909       return parsed? FLOAT : ERROR;
2910     }
2911
2912   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2913   if (p[0] == '0' && len > 1)
2914     switch (p[1])
2915       {
2916       case 'x':
2917       case 'X':
2918         if (len >= 3)
2919           {
2920             p += 2;
2921             base = 16;
2922             len -= 2;
2923           }
2924         break;
2925         
2926       case 't':
2927       case 'T':
2928       case 'd':
2929       case 'D':
2930         if (len >= 3)
2931           {
2932             p += 2;
2933             base = 10;
2934             len -= 2;
2935           }
2936         break;
2937         
2938       default:
2939         base = 8;
2940         break;
2941       }
2942   
2943   while (len-- > 0)
2944     {
2945       c = *p++;
2946       if (isupper (c))
2947         c = tolower (c);
2948       if (len == 0 && c == 'l')
2949         long_p = 1;
2950       else if (len == 0 && c == 'u')
2951         unsigned_p = 1;
2952       else
2953         {
2954           int i;
2955           if (c >= '0' && c <= '9')
2956             i = c - '0';
2957           else if (c >= 'a' && c <= 'f')
2958             i = c - 'a' + 10;
2959           else
2960             return ERROR;       /* Char not a digit */
2961           if (i >= base)
2962             return ERROR;               /* Invalid digit in this base */
2963           n *= base;
2964           n += i;
2965         }
2966       /* Test for overflow.  */
2967       if (prevn == 0 && n == 0)
2968         ;
2969       else if (RANGE_CHECK && prevn >= n)
2970         range_error (_("Overflow on numeric constant."));
2971       prevn = n;
2972     }
2973   
2974   /* If the number is too big to be an int, or it's got an l suffix
2975      then it's a long.  Work out if this has to be a long by
2976      shifting right and seeing if anything remains, and the
2977      target int size is different to the target long size.
2978      
2979      In the expression below, we could have tested
2980      (n >> gdbarch_int_bit (parse_gdbarch))
2981      to see if it was zero,
2982      but too many compilers warn about that, when ints and longs
2983      are the same size.  So we shift it twice, with fewer bits
2984      each time, for the same result.  */
2985
2986   int bits_available;
2987   if ((gdbarch_int_bit (par_state->gdbarch ())
2988        != gdbarch_long_bit (par_state->gdbarch ())
2989        && ((n >> 2)
2990            >> (gdbarch_int_bit (par_state->gdbarch ())-2))) /* Avoid
2991                                                             shift warning */
2992       || long_p)
2993     {
2994       bits_available = gdbarch_long_bit (par_state->gdbarch ());
2995       unsigned_type = parse_type (par_state)->builtin_unsigned_long;
2996       signed_type = parse_type (par_state)->builtin_long;
2997   }
2998   else 
2999     {
3000       bits_available = gdbarch_int_bit (par_state->gdbarch ());
3001       unsigned_type = parse_type (par_state)->builtin_unsigned_int;
3002       signed_type = parse_type (par_state)->builtin_int;
3003     }    
3004   high_bit = ((ULONGEST)1) << (bits_available - 1);
3005   
3006   if (RANGE_CHECK
3007       && ((n >> 2) >> (bits_available - 2)))
3008     range_error (_("Overflow on numeric constant."));
3009
3010   putithere->typed_val.val = n;
3011   
3012   /* If the high bit of the worked out type is set then this number
3013      has to be unsigned.  */
3014   
3015   if (unsigned_p || (n & high_bit)) 
3016     putithere->typed_val.type = unsigned_type;
3017   else 
3018     putithere->typed_val.type = signed_type;
3019   
3020   return INT;
3021 }
3022
3023 /* Called to setup the type stack when we encounter a '(kind=N)' type
3024    modifier, performs some bounds checking on 'N' and then pushes this to
3025    the type stack followed by the 'tp_kind' marker.  */
3026 static void
3027 push_kind_type (LONGEST val, struct type *type)
3028 {
3029   int ival;
3030
3031   if (type->is_unsigned ())
3032     {
3033       ULONGEST uval = static_cast <ULONGEST> (val);
3034       if (uval > INT_MAX)
3035         error (_("kind value out of range"));
3036       ival = static_cast <int> (uval);
3037     }
3038   else
3039     {
3040       if (val > INT_MAX || val < 0)
3041         error (_("kind value out of range"));
3042       ival = static_cast <int> (val);
3043     }
3044
3045   type_stack->push (ival);
3046   type_stack->push (tp_kind);
3047 }
3048
3049 /* Called when a type has a '(kind=N)' modifier after it, for example
3050    'character(kind=1)'.  The BASETYPE is the type described by 'character'
3051    in our example, and KIND is the integer '1'.  This function returns a
3052    new type that represents the basetype of a specific kind.  */
3053 static struct type *
3054 convert_to_kind_type (struct type *basetype, int kind)
3055 {
3056   if (basetype == parse_f_type (pstate)->builtin_character)
3057     {
3058       /* Character of kind 1 is a special case, this is the same as the
3059          base character type.  */
3060       if (kind == 1)
3061         return parse_f_type (pstate)->builtin_character;
3062     }
3063   else if (basetype == parse_f_type (pstate)->builtin_complex)
3064     {
3065       if (kind == 4)
3066         return parse_f_type (pstate)->builtin_complex;
3067       else if (kind == 8)
3068         return parse_f_type (pstate)->builtin_complex_s8;
3069       else if (kind == 16)
3070         return parse_f_type (pstate)->builtin_complex_s16;
3071     }
3072   else if (basetype == parse_f_type (pstate)->builtin_real)
3073     {
3074       if (kind == 4)
3075         return parse_f_type (pstate)->builtin_real;
3076       else if (kind == 8)
3077         return parse_f_type (pstate)->builtin_real_s8;
3078       else if (kind == 16)
3079         return parse_f_type (pstate)->builtin_real_s16;
3080     }
3081   else if (basetype == parse_f_type (pstate)->builtin_logical)
3082     {
3083       if (kind == 1)
3084         return parse_f_type (pstate)->builtin_logical_s1;
3085       else if (kind == 2)
3086         return parse_f_type (pstate)->builtin_logical_s2;
3087       else if (kind == 4)
3088         return parse_f_type (pstate)->builtin_logical;
3089       else if (kind == 8)
3090         return parse_f_type (pstate)->builtin_logical_s8;
3091     }
3092   else if (basetype == parse_f_type (pstate)->builtin_integer)
3093     {
3094       if (kind == 1)
3095         return parse_f_type (pstate)->builtin_integer_s1;
3096       else if (kind == 2)
3097         return parse_f_type (pstate)->builtin_integer_s2;
3098       else if (kind == 4)
3099         return parse_f_type (pstate)->builtin_integer;
3100       else if (kind == 8)
3101         return parse_f_type (pstate)->builtin_integer_s8;
3102     }
3103
3104   error (_("unsupported kind %d for type %s"),
3105          kind, TYPE_SAFE_NAME (basetype));
3106
3107   /* Should never get here.  */
3108   return nullptr;
3109 }
3110
3111 struct token
3112 {
3113   /* The string to match against.  */
3114   const char *oper;
3115
3116   /* The lexer token to return.  */
3117   int token;
3118
3119   /* The expression opcode to embed within the token.  */
3120   enum exp_opcode opcode;
3121
3122   /* When this is true the string in OPER is matched exactly including
3123      case, when this is false OPER is matched case insensitively.  */
3124   bool case_sensitive;
3125 };
3126
3127 /* List of Fortran operators.  */
3128
3129 static const struct token fortran_operators[] =
3130 {
3131   { ".and.", BOOL_AND, OP_NULL, false },
3132   { ".or.", BOOL_OR, OP_NULL, false },
3133   { ".not.", BOOL_NOT, OP_NULL, false },
3134   { ".eq.", EQUAL, OP_NULL, false },
3135   { ".eqv.", EQUAL, OP_NULL, false },
3136   { ".neqv.", NOTEQUAL, OP_NULL, false },
3137   { ".xor.", NOTEQUAL, OP_NULL, false },
3138   { "==", EQUAL, OP_NULL, false },
3139   { ".ne.", NOTEQUAL, OP_NULL, false },
3140   { "/=", NOTEQUAL, OP_NULL, false },
3141   { ".le.", LEQ, OP_NULL, false },
3142   { "<=", LEQ, OP_NULL, false },
3143   { ".ge.", GEQ, OP_NULL, false },
3144   { ">=", GEQ, OP_NULL, false },
3145   { ".gt.", GREATERTHAN, OP_NULL, false },
3146   { ">", GREATERTHAN, OP_NULL, false },
3147   { ".lt.", LESSTHAN, OP_NULL, false },
3148   { "<", LESSTHAN, OP_NULL, false },
3149   { "**", STARSTAR, BINOP_EXP, false },
3150 };
3151
3152 /* Holds the Fortran representation of a boolean, and the integer value we
3153    substitute in when one of the matching strings is parsed.  */
3154 struct f77_boolean_val
3155 {
3156   /* The string representing a Fortran boolean.  */
3157   const char *name;
3158
3159   /* The integer value to replace it with.  */
3160   int value;
3161 };
3162
3163 /* The set of Fortran booleans.  These are matched case insensitively.  */
3164 static const struct f77_boolean_val boolean_values[]  =
3165 {
3166   { ".true.", 1 },
3167   { ".false.", 0 }
3168 };
3169
3170 static const token f_keywords[] =
3171 {
3172   /* Historically these have always been lowercase only in GDB.  */
3173   { "character", CHARACTER, OP_NULL, true },
3174   { "complex", COMPLEX_KEYWORD, OP_NULL, true },
3175   { "complex_4", COMPLEX_S4_KEYWORD, OP_NULL, true },
3176   { "complex_8", COMPLEX_S8_KEYWORD, OP_NULL, true },
3177   { "complex_16", COMPLEX_S16_KEYWORD, OP_NULL, true },
3178   { "integer_1", INT_S1_KEYWORD, OP_NULL, true },
3179   { "integer_2", INT_S2_KEYWORD, OP_NULL, true },
3180   { "integer_4", INT_S4_KEYWORD, OP_NULL, true },
3181   { "integer", INT_KEYWORD, OP_NULL, true },
3182   { "integer_8", INT_S8_KEYWORD, OP_NULL, true },
3183   { "logical_1", LOGICAL_S1_KEYWORD, OP_NULL, true },
3184   { "logical_2", LOGICAL_S2_KEYWORD, OP_NULL, true },
3185   { "logical", LOGICAL_KEYWORD, OP_NULL, true },
3186   { "logical_4", LOGICAL_S4_KEYWORD, OP_NULL, true },
3187   { "logical_8", LOGICAL_S8_KEYWORD, OP_NULL, true },
3188   { "real", REAL_KEYWORD, OP_NULL, true },
3189   { "real_4", REAL_S4_KEYWORD, OP_NULL, true },
3190   { "real_8", REAL_S8_KEYWORD, OP_NULL, true },
3191   { "real_16", REAL_S16_KEYWORD, OP_NULL, true },
3192   { "sizeof", SIZEOF, OP_NULL, true },
3193   { "single", SINGLE, OP_NULL, true },
3194   { "double", DOUBLE, OP_NULL, true },
3195   { "precision", PRECISION, OP_NULL, true },
3196   /* The following correspond to actual functions in Fortran and are case
3197      insensitive.  */
3198   { "kind", KIND, OP_NULL, false },
3199   { "abs", UNOP_INTRINSIC, UNOP_ABS, false },
3200   { "mod", BINOP_INTRINSIC, BINOP_MOD, false },
3201   { "floor", UNOP_OR_BINOP_INTRINSIC, FORTRAN_FLOOR, false },
3202   { "ceiling", UNOP_OR_BINOP_INTRINSIC, FORTRAN_CEILING, false },
3203   { "modulo", BINOP_INTRINSIC, BINOP_FORTRAN_MODULO, false },
3204   { "cmplx", UNOP_OR_BINOP_OR_TERNOP_INTRINSIC, FORTRAN_CMPLX, false },
3205   { "lbound", UNOP_OR_BINOP_OR_TERNOP_INTRINSIC, FORTRAN_LBOUND, false },
3206   { "ubound", UNOP_OR_BINOP_OR_TERNOP_INTRINSIC, FORTRAN_UBOUND, false },
3207   { "allocated", UNOP_INTRINSIC, UNOP_FORTRAN_ALLOCATED, false },
3208   { "associated", UNOP_OR_BINOP_INTRINSIC, FORTRAN_ASSOCIATED, false },
3209   { "rank", UNOP_INTRINSIC, UNOP_FORTRAN_RANK, false },
3210   { "size", UNOP_OR_BINOP_OR_TERNOP_INTRINSIC, FORTRAN_ARRAY_SIZE, false },
3211   { "shape", UNOP_INTRINSIC, UNOP_FORTRAN_SHAPE, false },
3212   { "loc", UNOP_INTRINSIC, UNOP_FORTRAN_LOC, false },
3213 };
3214
3215 /* Implementation of a dynamically expandable buffer for processing input
3216    characters acquired through lexptr and building a value to return in
3217    yylval.  Ripped off from ch-exp.y */ 
3218
3219 static char *tempbuf;           /* Current buffer contents */
3220 static int tempbufsize;         /* Size of allocated buffer */
3221 static int tempbufindex;        /* Current index into buffer */
3222
3223 #define GROWBY_MIN_SIZE 64      /* Minimum amount to grow buffer by */
3224
3225 #define CHECKBUF(size) \
3226   do { \
3227     if (tempbufindex + (size) >= tempbufsize) \
3228       { \
3229         growbuf_by_size (size); \
3230       } \
3231   } while (0);
3232
3233
3234 /* Grow the static temp buffer if necessary, including allocating the
3235    first one on demand.  */
3236
3237 static void
3238 growbuf_by_size (int count)
3239 {
3240   int growby;
3241
3242   growby = std::max (count, GROWBY_MIN_SIZE);
3243   tempbufsize += growby;
3244   if (tempbuf == NULL)
3245     tempbuf = (char *) xmalloc (tempbufsize);
3246   else
3247     tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
3248 }
3249
3250 /* Blatantly ripped off from ch-exp.y. This routine recognizes F77 
3251    string-literals.
3252    
3253    Recognize a string literal.  A string literal is a nonzero sequence
3254    of characters enclosed in matching single quotes, except that
3255    a single character inside single quotes is a character literal, which
3256    we reject as a string literal.  To embed the terminator character inside
3257    a string, it is simply doubled (I.E. 'this''is''one''string') */
3258
3259 static int
3260 match_string_literal (void)
3261 {
3262   const char *tokptr = pstate->lexptr;
3263
3264   for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
3265     {
3266       CHECKBUF (1);
3267       if (*tokptr == *pstate->lexptr)
3268         {
3269           if (*(tokptr + 1) == *pstate->lexptr)
3270             tokptr++;
3271           else
3272             break;
3273         }
3274       tempbuf[tempbufindex++] = *tokptr;
3275     }
3276   if (*tokptr == '\0'                                   /* no terminator */
3277       || tempbufindex == 0)                             /* no string */
3278     return 0;
3279   else
3280     {
3281       tempbuf[tempbufindex] = '\0';
3282       yylval.sval.ptr = tempbuf;
3283       yylval.sval.length = tempbufindex;
3284       pstate->lexptr = ++tokptr;
3285       return STRING_LITERAL;
3286     }
3287 }
3288
3289 /* This is set if a NAME token appeared at the very end of the input
3290    string, with no whitespace separating the name from the EOF.  This
3291    is used only when parsing to do field name completion.  */
3292 static bool saw_name_at_eof;
3293
3294 /* This is set if the previously-returned token was a structure
3295    operator '%'.  */
3296 static bool last_was_structop;
3297
3298 /* Read one token, getting characters through lexptr.  */
3299
3300 static int
3301 yylex (void)
3302 {
3303   int c;
3304   int namelen;
3305   unsigned int token;
3306   const char *tokstart;
3307   bool saw_structop = last_was_structop;
3308
3309   last_was_structop = false;
3310
3311  retry:
3312  
3313   pstate->prev_lexptr = pstate->lexptr;
3314  
3315   tokstart = pstate->lexptr;
3316
3317   /* First of all, let us make sure we are not dealing with the
3318      special tokens .true. and .false. which evaluate to 1 and 0.  */
3319
3320   if (*pstate->lexptr == '.')
3321     {
3322       for (const auto &candidate : boolean_values)
3323         {
3324           if (strncasecmp (tokstart, candidate.name,
3325                            strlen (candidate.name)) == 0)
3326             {
3327               pstate->lexptr += strlen (candidate.name);
3328               yylval.lval = candidate.value;
3329               return BOOLEAN_LITERAL;
3330             }
3331         }
3332     }
3333
3334   /* See if it is a Fortran operator.  */
3335   for (const auto &candidate : fortran_operators)
3336     if (strncasecmp (tokstart, candidate.oper,
3337                      strlen (candidate.oper)) == 0)
3338       {
3339         gdb_assert (!candidate.case_sensitive);
3340         pstate->lexptr += strlen (candidate.oper);
3341         yylval.opcode = candidate.opcode;
3342         return candidate.token;
3343       }
3344
3345   switch (c = *tokstart)
3346     {
3347     case 0:
3348       if (saw_name_at_eof)
3349         {
3350           saw_name_at_eof = false;
3351           return COMPLETE;
3352         }
3353       else if (pstate->parse_completion && saw_structop)
3354         return COMPLETE;
3355       return 0;
3356       
3357     case ' ':
3358     case '\t':
3359     case '\n':
3360       pstate->lexptr++;
3361       goto retry;
3362       
3363     case '\'':
3364       token = match_string_literal ();
3365       if (token != 0)
3366         return (token);
3367       break;
3368       
3369     case '(':
3370       paren_depth++;
3371       pstate->lexptr++;
3372       return c;
3373       
3374     case ')':
3375       if (paren_depth == 0)
3376         return 0;
3377       paren_depth--;
3378       pstate->lexptr++;
3379       return c;
3380       
3381     case ',':
3382       if (pstate->comma_terminates && paren_depth == 0)
3383         return 0;
3384       pstate->lexptr++;
3385       return c;
3386       
3387     case '.':
3388       /* Might be a floating point number.  */
3389       if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9')
3390         goto symbol;            /* Nope, must be a symbol.  */
3391       /* FALL THRU.  */
3392       
3393     case '0':
3394     case '1':
3395     case '2':
3396     case '3':
3397     case '4':
3398     case '5':
3399     case '6':
3400     case '7':
3401     case '8':
3402     case '9':
3403       {
3404         /* It's a number.  */
3405         int got_dot = 0, got_e = 0, got_d = 0, toktype;
3406         const char *p = tokstart;
3407         int hex = input_radix > 10;
3408         
3409         if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
3410           {
3411             p += 2;
3412             hex = 1;
3413           }
3414         else if (c == '0' && (p[1]=='t' || p[1]=='T'
3415                               || p[1]=='d' || p[1]=='D'))
3416           {
3417             p += 2;
3418             hex = 0;
3419           }
3420         
3421         for (;; ++p)
3422           {
3423             if (!hex && !got_e && (*p == 'e' || *p == 'E'))
3424               got_dot = got_e = 1;
3425             else if (!hex && !got_d && (*p == 'd' || *p == 'D'))
3426               got_dot = got_d = 1;
3427             else if (!hex && !got_dot && *p == '.')
3428               got_dot = 1;
3429             else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
3430                      || (got_d && (p[-1] == 'd' || p[-1] == 'D')))
3431                      && (*p == '-' || *p == '+'))
3432               /* This is the sign of the exponent, not the end of the
3433                  number.  */
3434               continue;
3435             /* We will take any letters or digits.  parse_number will
3436                complain if past the radix, or if L or U are not final.  */
3437             else if ((*p < '0' || *p > '9')
3438                      && ((*p < 'a' || *p > 'z')
3439                          && (*p < 'A' || *p > 'Z')))
3440               break;
3441           }
3442         toktype = parse_number (pstate, tokstart, p - tokstart,
3443                                 got_dot|got_e|got_d,
3444                                 &yylval);
3445         if (toktype == ERROR)
3446           {
3447             char *err_copy = (char *) alloca (p - tokstart + 1);
3448             
3449             memcpy (err_copy, tokstart, p - tokstart);
3450             err_copy[p - tokstart] = 0;
3451             error (_("Invalid number \"%s\"."), err_copy);
3452           }
3453         pstate->lexptr = p;
3454         return toktype;
3455       }
3456
3457     case '%':
3458       last_was_structop = true;
3459       /* Fall through.  */
3460     case '+':
3461     case '-':
3462     case '*':
3463     case '/':
3464     case '|':
3465     case '&':
3466     case '^':
3467     case '~':
3468     case '!':
3469     case '@':
3470     case '<':
3471     case '>':
3472     case '[':
3473     case ']':
3474     case '?':
3475     case ':':
3476     case '=':
3477     case '{':
3478     case '}':
3479     symbol:
3480       pstate->lexptr++;
3481       return c;
3482     }
3483   
3484   if (!(c == '_' || c == '$' || c ==':'
3485         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
3486     /* We must have come across a bad character (e.g. ';').  */
3487     error (_("Invalid character '%c' in expression."), c);
3488   
3489   namelen = 0;
3490   for (c = tokstart[namelen];
3491        (c == '_' || c == '$' || c == ':' || (c >= '0' && c <= '9')
3492         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')); 
3493        c = tokstart[++namelen]);
3494   
3495   /* The token "if" terminates the expression and is NOT 
3496      removed from the input stream.  */
3497   
3498   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
3499     return 0;
3500   
3501   pstate->lexptr += namelen;
3502   
3503   /* Catch specific keywords.  */
3504
3505   for (const auto &keyword : f_keywords)
3506     if (strlen (keyword.oper) == namelen
3507         && ((!keyword.case_sensitive
3508              && strncasecmp (tokstart, keyword.oper, namelen) == 0)
3509             || (keyword.case_sensitive
3510                 && strncmp (tokstart, keyword.oper, namelen) == 0)))
3511       {
3512         yylval.opcode = keyword.opcode;
3513         return keyword.token;
3514       }
3515
3516   yylval.sval.ptr = tokstart;
3517   yylval.sval.length = namelen;
3518   
3519   if (*tokstart == '$')
3520     return DOLLAR_VARIABLE;
3521
3522   /* Use token-type TYPENAME for symbols that happen to be defined
3523      currently as names of types; NAME for other symbols.
3524      The caller is not constrained to care about the distinction.  */
3525   {
3526     std::string tmp = copy_name (yylval.sval);
3527     struct block_symbol result;
3528     const domain_enum lookup_domains[] =
3529     {
3530       STRUCT_DOMAIN,
3531       VAR_DOMAIN,
3532       MODULE_DOMAIN
3533     };
3534     int hextype;
3535
3536     for (const auto &domain : lookup_domains)
3537       {
3538         result = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
3539                                 domain, NULL);
3540         if (result.symbol && result.symbol->aclass () == LOC_TYPEDEF)
3541           {
3542             yylval.tsym.type = result.symbol->type ();
3543             return TYPENAME;
3544           }
3545
3546         if (result.symbol)
3547           break;
3548       }
3549
3550     yylval.tsym.type
3551       = language_lookup_primitive_type (pstate->language (),
3552                                         pstate->gdbarch (), tmp.c_str ());
3553     if (yylval.tsym.type != NULL)
3554       return TYPENAME;
3555     
3556     /* Input names that aren't symbols but ARE valid hex numbers,
3557        when the input radix permits them, can be names or numbers
3558        depending on the parse.  Note we support radixes > 16 here.  */
3559     if (!result.symbol
3560         && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
3561             || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
3562       {
3563         YYSTYPE newlval;        /* Its value is ignored.  */
3564         hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
3565         if (hextype == INT)
3566           {
3567             yylval.ssym.sym = result;
3568             yylval.ssym.is_a_field_of_this = false;
3569             return NAME_OR_INT;
3570           }
3571       }
3572
3573     if (pstate->parse_completion && *pstate->lexptr == '\0')
3574       saw_name_at_eof = true;
3575
3576     /* Any other kind of symbol */
3577     yylval.ssym.sym = result;
3578     yylval.ssym.is_a_field_of_this = false;
3579     return NAME;
3580   }
3581 }
3582
3583 int
3584 f_language::parser (struct parser_state *par_state) const
3585 {
3586   /* Setting up the parser state.  */
3587   scoped_restore pstate_restore = make_scoped_restore (&pstate);
3588   scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
3589                                                         parser_debug);
3590   gdb_assert (par_state != NULL);
3591   pstate = par_state;
3592   last_was_structop = false;
3593   saw_name_at_eof = false;
3594   paren_depth = 0;
3595
3596   struct type_stack stack;
3597   scoped_restore restore_type_stack = make_scoped_restore (&type_stack,
3598                                                            &stack);
3599
3600   int result = yyparse ();
3601   if (!result)
3602     pstate->set_operation (pstate->pop ());
3603   return result;
3604 }
3605
3606 static void
3607 yyerror (const char *msg)
3608 {
3609   if (pstate->prev_lexptr)
3610     pstate->lexptr = pstate->prev_lexptr;
3611
3612   error (_("A %s in expression, near `%s'."), msg, pstate->lexptr);
3613 }