1 /* A Bison parser, made by GNU Bison 3.8.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
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.
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.
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/>. */
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.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
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. */
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. */
48 /* Identify Bison output, and Bison version. */
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
55 #define YYSKELETON_NAME "yacc.c"
69 /* First part of user prologue. */
74 #include "expression.h"
76 #include "parser-defs.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 */
85 #include "type-stack.h"
88 #define parse_type(ps) builtin_type (ps->gdbarch ())
89 #define parse_f_type(ps) builtin_f_type (ps->gdbarch ())
91 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
93 #define GDB_YY_REMAP_PREFIX f_
96 /* The state of the parser, used internally when we are parsing the
99 static struct parser_state *pstate = NULL;
101 /* Depth of parentheses. */
102 static int paren_depth;
104 /* The current type stack. */
105 static struct type_stack *type_stack;
109 static int yylex (void);
111 static void yyerror (const char *);
113 static void growbuf_by_size (int);
115 static int match_string_literal (void);
117 static void push_kind_type (LONGEST val, struct type *type);
119 static struct type *convert_to_kind_type (struct type *basetype, int kind);
121 static void wrap_unop_intrinsic (exp_opcode opcode);
123 static void wrap_binop_intrinsic (exp_opcode opcode);
125 static void wrap_ternop_intrinsic (exp_opcode opcode);
128 static void fortran_wrap2_kind (type *base_type);
131 static void fortran_wrap3_kind (type *base_type);
133 using namespace expr;
135 #line 136 "f-exp.c.tmp"
139 # define YY_CAST(Type, Val) static_cast<Type> (Val)
140 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
142 # define YY_CAST(Type, Val) ((Type) (Val))
143 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
146 # ifndef YY_NULLPTRPTR
147 # if defined __cplusplus
148 # if 201103L <= __cplusplus
149 # define YY_NULLPTRPTR nullptr
151 # define YY_NULLPTRPTR 0
154 # define YY_NULLPTRPTR ((void*)0)
173 YYEOF = 0, /* "end of file" */
174 YYerror = 256, /* error */
175 YYUNDEF = 257, /* "invalid token" */
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 */
227 STARSTAR = 309, /* STARSTAR */
228 UNARY = 310 /* UNARY */
230 typedef enum yytokentype yytoken_kind_t;
239 #define STRING_LITERAL 260
240 #define BOOLEAN_LITERAL 261
244 #define NAME_OR_INT 265
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
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
283 #define GREATERTHAN 304
292 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
310 struct symtoken ssym;
312 enum exp_opcode opcode;
313 struct internalvar *ivar;
319 #line 320 "f-exp.c.tmp"
322 typedef union YYSTYPE YYSTYPE;
323 # define YYSTYPE_IS_TRIVIAL 1
324 # define YYSTYPE_IS_DECLARED 1
328 extern YYSTYPE yylval;
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 */
432 typedef enum yysymbol_kind_t yysymbol_kind_t;
435 /* Second part of user prologue. */
438 /* YYSTYPE gets defined by %union */
439 static int parse_number (struct parser_state *, const char *, int,
442 #line 443 "f-exp.c.tmp"
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. */
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 */
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. */
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;
471 typedef signed char yytype_int8;
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;
479 typedef short yytype_int16;
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>. */
488 # undef UINT_LEAST8_MAX
489 # undef UINT_LEAST16_MAX
490 # define UINT_LEAST8_MAX 255
491 # define UINT_LEAST16_MAX 65535
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;
502 typedef short yytype_uint8;
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;
513 typedef int yytype_uint16;
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
522 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
524 # define YYPTRDIFF_T ptrdiff_t
525 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
527 # define YYPTRDIFF_T long
528 # define YYPTRDIFF_MAXIMUM LONG_MAX
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
541 # define YYSIZE_T unsigned
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)))
551 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
554 /* Stored state numbers (used for stacks). */
555 typedef yytype_uint8 yy_state_t;
557 /* State numbers in computations. */
558 typedef int yy_state_fast_t;
561 # if defined YYENABLE_NLS && YYENABLE_NLS
563 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
564 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
568 # define YY_(Msgid) Msgid
573 #ifndef YY_ATTRIBUTE_PURE
574 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
575 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
577 # define YY_ATTRIBUTE_PURE
581 #ifndef YY_ATTRIBUTE_UNUSED
582 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
583 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
585 # define YY_ATTRIBUTE_UNUSED
589 /* Suppress unused-variable warnings by "using" E. */
590 #if ! defined lint || defined __GNUC__
591 # define YY_USE(E) ((void) (E))
593 # define YY_USE(E) /* empty */
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\"")
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\"")
608 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
609 _Pragma ("GCC diagnostic pop")
611 # define YY_INITIAL_VALUE(Value) Value
613 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
614 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
615 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
617 #ifndef YY_INITIAL_VALUE
618 # define YY_INITIAL_VALUE(Value) /* Nothing. */
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")
628 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
629 # define YY_IGNORE_USELESS_CAST_BEGIN
630 # define YY_IGNORE_USELESS_CAST_END
634 #define YY_ASSERT(E) ((void) (0 && (E)))
636 #if !defined yyoverflow
638 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
640 # ifdef YYSTACK_USE_ALLOCA
641 # if YYSTACK_USE_ALLOCA
643 # define YYSTACK_ALLOC __builtin_alloca
644 # elif defined __BUILTIN_VA_ARG_INCR
645 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
647 # define YYSTACK_ALLOC __alloca
648 # elif defined _MSC_VER
649 # define alloca _alloca
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
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 */
674 # define YYSTACK_ALLOC YYMALLOC
675 # define YYSTACK_FREE YYFREE
676 # ifndef YYSTACK_ALLOC_MAXIMUM
677 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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
688 # define YYMALLOC xmalloc
689 # if ! defined xmalloc && ! defined EXIT_SUCCESS
690 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
694 # define YYFREE xfree
695 # if ! defined xfree && ! defined EXIT_SUCCESS
696 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
700 #endif /* !defined yyoverflow */
702 #if (! defined yyoverflow \
703 && (! defined __cplusplus \
704 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
706 /* A type that is properly aligned for any stack member. */
709 yy_state_t yyss_alloc;
713 /* The size of the maximum gap between one aligned stack and the next. */
714 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
716 /* The size of an array large to enough to hold all stacks, each with
718 # define YYSTACK_BYTES(N) \
719 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
720 + YYSTACK_GAP_MAXIMUM)
722 # define YYCOPY_NEEDED 1
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
729 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
742 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
743 /* Copy COUNT objects from SRC to DST. The source and destination do
746 # if defined __GNUC__ && 1 < __GNUC__
747 # define YYCOPY(Dst, Src, Count) \
748 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
750 # define YYCOPY(Dst, Src, Count) \
754 for (yyi = 0; yyi < (Count); yyi++) \
755 (Dst)[yyi] = (Src)[yyi]; \
760 #endif /* !YYCOPY_NEEDED */
762 /* YYFINAL -- State number of the termination state. */
764 /* YYLAST -- Last index in YYTABLE. */
767 /* YYNTOKENS -- Number of terminals. */
769 /* YYNNTS -- Number of nonterminals. */
771 /* YYNRULES -- Number of rules. */
773 /* YYNSTATES -- Number of states. */
774 #define YYNSTATES 184
776 /* YYMAXUTOK -- Last valid token kind. */
777 #define YYMAXUTOK 310
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]) \
787 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
788 as returned by yylex. */
789 static const yytype_int8 yytranslate[] =
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,
826 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
827 static const yytype_int16 yyrline[] =
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,
844 /** Accessing symbol of state STATE. */
845 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
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;
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[] =
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
877 yysymbol_name (yysymbol_kind_t yysymbol)
879 return yytname[yysymbol];
883 #define YYPACT_NINF (-103)
885 #define yypact_value_is_default(Yyn) \
886 ((Yyn) == YYPACT_NINF)
888 #define YYTABLE_NINF (-1)
890 #define yytable_value_is_error(Yyn) \
893 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
895 static const yytype_int16 yypact[] =
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,
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[] =
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,
944 /* YYPGOTO[NTERM-NUM]. */
945 static const yytype_int8 yypgoto[] =
947 -103, -103, -103, 0, -103, -103, -103, -102, -41, -103,
948 -103, 4, -103, 48, -103, 49, -103, -103, -103, -103
951 /* YYDEFGOTO[NTERM-NUM]. */
952 static const yytype_uint8 yydefgoto[] =
954 0, 42, 43, 150, 134, 103, 104, 151, 152, 66,
955 45, 140, 47, 96, 97, 98, 48, 142, 133, 49
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[] =
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,
1058 static const yytype_int16 yycheck[] =
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,
1155 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1157 static const yytype_int8 yystos[] =
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,
1180 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
1181 static const yytype_int8 yyr1[] =
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,
1197 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
1198 static const yytype_int8 yyr2[] =
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,
1215 enum { YYENOMEM = -2 };
1217 #define yyerrok (yyerrstatus = 0)
1218 #define yyclearin (yychar = YYEMPTY)
1220 #define YYACCEPT goto yyacceptlab
1221 #define YYABORT goto yyabortlab
1222 #define YYERROR goto yyerrorlab
1223 #define YYNOMEM goto yyexhaustedlab
1226 #define YYRECOVERING() (!!yyerrstatus)
1228 #define YYBACKUP(Token, Value) \
1230 if (yychar == YYEMPTY) \
1234 YYPOPSTACK (yylen); \
1240 yyerror (YY_("syntax error: cannot back up")); \
1245 /* Backward compatibility with an undocumented macro.
1246 Use YYerror or YYUNDEF. */
1247 #define YYERRCODE YYUNDEF
1250 /* Enable debugging if requested. */
1254 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1255 # define YYFPRINTF fprintf
1258 # define YYDPRINTF(Args) \
1267 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1271 YYFPRINTF (stderr, "%s ", Title); \
1272 yy_symbol_print (stderr, \
1274 YYFPRINTF (stderr, "\n"); \
1279 /*-----------------------------------.
1280 | Print this symbol's value on YYO. |
1281 `-----------------------------------*/
1284 yy_symbol_value_print (FILE *yyo,
1285 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1287 FILE *yyoutput = yyo;
1291 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1293 YY_IGNORE_MAYBE_UNINITIALIZED_END
1297 /*---------------------------.
1298 | Print this symbol on YYO. |
1299 `---------------------------*/
1302 yy_symbol_print (FILE *yyo,
1303 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1305 YYFPRINTF (yyo, "%s %s (",
1306 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1308 yy_symbol_value_print (yyo, yykind, yyvaluep);
1309 YYFPRINTF (yyo, ")");
1312 /*------------------------------------------------------------------.
1313 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1315 `------------------------------------------------------------------*/
1318 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1320 YYFPRINTF (stderr, "Stack now");
1321 for (; yybottom <= yytop; yybottom++)
1323 int yybot = *yybottom;
1324 YYFPRINTF (stderr, " %d", yybot);
1326 YYFPRINTF (stderr, "\n");
1329 # define YY_STACK_PRINT(Bottom, Top) \
1332 yy_stack_print ((Bottom), (Top)); \
1336 /*------------------------------------------------.
1337 | Report that the YYRULE is going to be reduced. |
1338 `------------------------------------------------*/
1341 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1344 int yylno = yyrline[yyrule];
1345 int yynrhs = yyr2[yyrule];
1347 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1349 /* The symbols being reduced. */
1350 for (yyi = 0; yyi < yynrhs; yyi++)
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");
1360 # define YY_REDUCE_PRINT(Rule) \
1363 yy_reduce_print (yyssp, yyvsp, Rule); \
1366 /* Nonzero means print parse trace. It is left uninitialized so that
1367 multiple parsers can coexist. */
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 */
1377 /* YYINITDEPTH -- initial size of the parser's stacks. */
1379 # define YYINITDEPTH 200
1382 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1383 if the built-in stack extension method is used).
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. */
1390 # define YYMAXDEPTH 10000
1398 /*-----------------------------------------------.
1399 | Release the memory associated to this symbol. |
1400 `-----------------------------------------------*/
1403 yydestruct (const char *yymsg,
1404 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1409 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1411 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1413 YY_IGNORE_MAYBE_UNINITIALIZED_END
1417 /* Lookahead token kind. */
1420 /* The semantic value of the lookahead symbol. */
1422 /* Number of syntax errors so far. */
1435 yy_state_fast_t yystate = 0;
1436 /* Number of tokens to shift before error messages enabled. */
1437 int yyerrstatus = 0;
1439 /* Refer to the stacks through separate pointers, to allow yyoverflow
1440 to xreallocate them elsewhere. */
1443 YYPTRDIFF_T yystacksize = YYINITDEPTH;
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;
1450 /* The semantic value stack: array, bottom, top. */
1451 YYSTYPE yyvsa[YYINITDEPTH];
1452 YYSTYPE *yyvs = yyvsa;
1453 YYSTYPE *yyvsp = yyvs;
1456 /* The return value of yyparse. */
1458 /* Lookahead symbol kind. */
1459 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1460 /* The variables used to return semantic value and location from the
1466 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1468 /* The number of symbols on the RHS of the reduced rule.
1469 Keep to zero when no symbol should be popped. */
1472 YYDPRINTF ((stderr, "Starting parse\n"));
1474 yychar = YYEMPTY; /* Cause a token to be read. */
1479 /*------------------------------------------------------------.
1480 | yynewstate -- push a new state, which is found in yystate. |
1481 `------------------------------------------------------------*/
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. */
1488 /*--------------------------------------------------------------------.
1489 | yysetstate -- set current state (the top of the stack) to yystate. |
1490 `--------------------------------------------------------------------*/
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);
1499 if (yyss + yystacksize - 1 <= yyssp)
1500 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1504 /* Get the current used size of the three stacks, in elements. */
1505 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1507 # if defined yyoverflow
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
1512 yy_state_t *yyss1 = yyss;
1513 YYSTYPE *yyvs1 = yyvs;
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),
1526 # else /* defined YYSTACK_RELOCATE */
1527 /* Extend the stack our own way. */
1528 if (YYMAXDEPTH <= yystacksize)
1531 if (YYMAXDEPTH < yystacksize)
1532 yystacksize = YYMAXDEPTH;
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))));
1541 YYSTACK_RELOCATE (yyss_alloc, yyss);
1542 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1543 # undef YYSTACK_RELOCATE
1545 YYSTACK_FREE (yyss1);
1549 yyssp = yyss + yysize - 1;
1550 yyvsp = yyvs + yysize - 1;
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
1557 if (yyss + yystacksize - 1 <= yyssp)
1560 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1563 if (yystate == YYFINAL)
1573 /* Do appropriate processing given the current state. Read a
1574 lookahead token if we need one and don't already have one. */
1576 /* First try to decide what to do without reference to lookahead token. */
1577 yyn = yypact[yystate];
1578 if (yypact_value_is_default (yyn))
1581 /* Not known => get a lookahead token if don't already have one. */
1583 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1584 if (yychar == YYEMPTY)
1586 YYDPRINTF ((stderr, "Reading a token\n"));
1590 if (yychar <= YYEOF)
1593 yytoken = YYSYMBOL_YYEOF;
1594 YYDPRINTF ((stderr, "Now at end of input.\n"));
1596 else if (yychar == YYerror)
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. */
1603 yytoken = YYSYMBOL_YYerror;
1608 yytoken = YYTRANSLATE (yychar);
1609 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1612 /* If the proper action on seeing token YYTOKEN is to reduce or to
1613 detect an error, take that action. */
1615 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1620 if (yytable_value_is_error (yyn))
1626 /* Count tokens shifted since error; after three, turn off error
1631 /* Shift the lookahead token. */
1632 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1634 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1636 YY_IGNORE_MAYBE_UNINITIALIZED_END
1638 /* Discard the shifted token. */
1643 /*-----------------------------------------------------------.
1644 | yydefault -- do the default action for the current state. |
1645 `-----------------------------------------------------------*/
1647 yyn = yydefact[yystate];
1653 /*-----------------------------.
1654 | yyreduce -- do a reduction. |
1655 `-----------------------------*/
1657 /* yyn is the number of a rule to reduce with. */
1660 /* If YYLEN is nonzero, implement the default value of the action:
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];
1671 YY_REDUCE_PRINT (yyn);
1674 case 4: /* type_exp: type */
1676 { pstate->push_new<type_operation> ((yyvsp[0].tval)); }
1677 #line 1679 "f-exp.c.tmp"
1680 case 5: /* exp: '(' exp ')' */
1683 #line 1685 "f-exp.c.tmp"
1686 case 6: /* exp: '*' exp */
1688 { pstate->wrap<unop_ind_operation> (); }
1689 #line 1691 "f-exp.c.tmp"
1692 case 7: /* exp: '&' exp */
1694 { pstate->wrap<unop_addr_operation> (); }
1695 #line 1697 "f-exp.c.tmp"
1698 case 8: /* exp: '-' exp */
1700 { pstate->wrap<unary_neg_operation> (); }
1701 #line 1703 "f-exp.c.tmp"
1704 case 9: /* exp: BOOL_NOT exp */
1706 { pstate->wrap<unary_logical_not_operation> (); }
1707 #line 1709 "f-exp.c.tmp"
1710 case 10: /* exp: '~' exp */
1712 { pstate->wrap<unary_complement_operation> (); }
1713 #line 1715 "f-exp.c.tmp"
1716 case 11: /* exp: SIZEOF exp */
1718 { pstate->wrap<unop_sizeof_operation> (); }
1719 #line 1721 "f-exp.c.tmp"
1722 case 12: /* exp: KIND '(' exp ')' */
1724 { pstate->wrap<fortran_kind_operation> (); }
1725 #line 1727 "f-exp.c.tmp"
1728 case 13: /* $@1: %empty */
1730 { pstate->start_arglist (); }
1731 #line 1733 "f-exp.c.tmp"
1734 case 14: /* exp: exp '(' $@1 arglist ')' */
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));
1742 #line 1744 "f-exp.c.tmp"
1745 case 15: /* exp: UNOP_INTRINSIC '(' exp ')' */
1748 wrap_unop_intrinsic ((yyvsp[-3].opcode));
1750 #line 1752 "f-exp.c.tmp"
1753 case 16: /* exp: BINOP_INTRINSIC '(' exp ',' exp ')' */
1756 wrap_binop_intrinsic ((yyvsp[-5].opcode));
1758 #line 1760 "f-exp.c.tmp"
1761 case 17: /* $@2: %empty */
1763 { pstate->start_arglist (); }
1764 #line 1766 "f-exp.c.tmp"
1767 case 18: /* exp: UNOP_OR_BINOP_INTRINSIC '(' $@2 arglist ')' */
1770 const int n = pstate->end_arglist ();
1775 wrap_unop_intrinsic ((yyvsp[-4].opcode));
1778 wrap_binop_intrinsic ((yyvsp[-4].opcode));
1781 gdb_assert_not_reached
1782 ("wrong number of arguments for intrinsics");
1785 #line 1787 "f-exp.c.tmp"
1788 case 19: /* $@3: %empty */
1790 { pstate->start_arglist (); }
1791 #line 1793 "f-exp.c.tmp"
1794 case 20: /* exp: UNOP_OR_BINOP_OR_TERNOP_INTRINSIC '(' $@3 arglist ')' */
1797 const int n = pstate->end_arglist ();
1802 wrap_unop_intrinsic ((yyvsp[-4].opcode));
1805 wrap_binop_intrinsic ((yyvsp[-4].opcode));
1808 wrap_ternop_intrinsic ((yyvsp[-4].opcode));
1811 gdb_assert_not_reached
1812 ("wrong number of arguments for intrinsics");
1815 #line 1817 "f-exp.c.tmp"
1818 case 22: /* arglist: exp */
1820 { pstate->arglist_len = 1; }
1821 #line 1823 "f-exp.c.tmp"
1824 case 23: /* arglist: subrange */
1826 { pstate->arglist_len = 1; }
1827 #line 1829 "f-exp.c.tmp"
1830 case 24: /* arglist: arglist ',' exp */
1832 { pstate->arglist_len++; }
1833 #line 1835 "f-exp.c.tmp"
1836 case 25: /* arglist: arglist ',' subrange */
1838 { pstate->arglist_len++; }
1839 #line 1841 "f-exp.c.tmp"
1842 case 26: /* subrange: exp ':' exp */
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 ());
1851 #line 1853 "f-exp.c.tmp"
1854 case 27: /* subrange: exp ':' */
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 ());
1862 #line 1864 "f-exp.c.tmp"
1865 case 28: /* subrange: ':' exp */
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 ());
1873 #line 1875 "f-exp.c.tmp"
1876 case 29: /* subrange: ':' */
1879 pstate->push_new<fortran_range_operation>
1880 (RANGE_LOW_BOUND_DEFAULT
1881 | RANGE_HIGH_BOUND_DEFAULT,
1882 operation_up (), operation_up (),
1885 #line 1887 "f-exp.c.tmp"
1888 case 30: /* subrange: exp ':' exp ':' exp */
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));
1899 #line 1901 "f-exp.c.tmp"
1902 case 31: /* subrange: exp ':' ':' exp */
1905 operation_up stride = pstate->pop ();
1906 operation_up low = pstate->pop ();
1907 pstate->push_new<fortran_range_operation>
1908 (RANGE_HIGH_BOUND_DEFAULT
1910 std::move (low), operation_up (),
1911 std::move (stride));
1913 #line 1915 "f-exp.c.tmp"
1916 case 32: /* subrange: ':' exp ':' exp */
1919 operation_up stride = pstate->pop ();
1920 operation_up high = pstate->pop ();
1921 pstate->push_new<fortran_range_operation>
1922 (RANGE_LOW_BOUND_DEFAULT
1924 operation_up (), std::move (high),
1925 std::move (stride));
1927 #line 1929 "f-exp.c.tmp"
1930 case 33: /* subrange: ':' ':' exp */
1933 operation_up stride = pstate->pop ();
1934 pstate->push_new<fortran_range_operation>
1935 (RANGE_LOW_BOUND_DEFAULT
1936 | RANGE_HIGH_BOUND_DEFAULT
1938 operation_up (), operation_up (),
1939 std::move (stride));
1941 #line 1943 "f-exp.c.tmp"
1944 case 34: /* complexnum: exp ',' exp */
1947 #line 1949 "f-exp.c.tmp"
1950 case 35: /* exp: '(' complexnum ')' */
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);
1959 #line 1961 "f-exp.c.tmp"
1962 case 36: /* exp: '(' type ')' exp */
1965 pstate->push_new<unop_cast_operation>
1966 (pstate->pop (), (yyvsp[-2].tval));
1968 #line 1970 "f-exp.c.tmp"
1971 case 37: /* exp: exp '%' name */
1974 pstate->push_new<fortran_structop_operation>
1975 (pstate->pop (), copy_name ((yyvsp[0].sval)));
1977 #line 1979 "f-exp.c.tmp"
1980 case 38: /* exp: exp '%' name COMPLETE */
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));
1989 #line 1991 "f-exp.c.tmp"
1992 case 39: /* exp: exp '%' COMPLETE */
1995 structop_base_operation *op
1996 = new fortran_structop_operation (pstate->pop (),
1998 pstate->mark_struct_expression (op);
1999 pstate->push (operation_up (op));
2001 #line 2003 "f-exp.c.tmp"
2004 case 40: /* exp: exp '@' exp */
2006 { pstate->wrap2<repeat_operation> (); }
2007 #line 2009 "f-exp.c.tmp"
2010 case 41: /* exp: exp STARSTAR exp */
2012 { pstate->wrap2<exp_operation> (); }
2013 #line 2015 "f-exp.c.tmp"
2016 case 42: /* exp: exp '*' exp */
2018 { pstate->wrap2<mul_operation> (); }
2019 #line 2021 "f-exp.c.tmp"
2022 case 43: /* exp: exp '/' exp */
2024 { pstate->wrap2<div_operation> (); }
2025 #line 2027 "f-exp.c.tmp"
2028 case 44: /* exp: exp '+' exp */
2030 { pstate->wrap2<add_operation> (); }
2031 #line 2033 "f-exp.c.tmp"
2034 case 45: /* exp: exp '-' exp */
2036 { pstate->wrap2<sub_operation> (); }
2037 #line 2039 "f-exp.c.tmp"
2040 case 46: /* exp: exp LSH exp */
2042 { pstate->wrap2<lsh_operation> (); }
2043 #line 2045 "f-exp.c.tmp"
2046 case 47: /* exp: exp RSH exp */
2048 { pstate->wrap2<rsh_operation> (); }
2049 #line 2051 "f-exp.c.tmp"
2052 case 48: /* exp: exp EQUAL exp */
2054 { pstate->wrap2<equal_operation> (); }
2055 #line 2057 "f-exp.c.tmp"
2058 case 49: /* exp: exp NOTEQUAL exp */
2060 { pstate->wrap2<notequal_operation> (); }
2061 #line 2063 "f-exp.c.tmp"
2064 case 50: /* exp: exp LEQ exp */
2066 { pstate->wrap2<leq_operation> (); }
2067 #line 2069 "f-exp.c.tmp"
2070 case 51: /* exp: exp GEQ exp */
2072 { pstate->wrap2<geq_operation> (); }
2073 #line 2075 "f-exp.c.tmp"
2076 case 52: /* exp: exp LESSTHAN exp */
2078 { pstate->wrap2<less_operation> (); }
2079 #line 2081 "f-exp.c.tmp"
2082 case 53: /* exp: exp GREATERTHAN exp */
2084 { pstate->wrap2<gtr_operation> (); }
2085 #line 2087 "f-exp.c.tmp"
2088 case 54: /* exp: exp '&' exp */
2090 { pstate->wrap2<bitwise_and_operation> (); }
2091 #line 2093 "f-exp.c.tmp"
2094 case 55: /* exp: exp '^' exp */
2096 { pstate->wrap2<bitwise_xor_operation> (); }
2097 #line 2099 "f-exp.c.tmp"
2100 case 56: /* exp: exp '|' exp */
2102 { pstate->wrap2<bitwise_ior_operation> (); }
2103 #line 2105 "f-exp.c.tmp"
2106 case 57: /* exp: exp BOOL_AND exp */
2108 { pstate->wrap2<logical_and_operation> (); }
2109 #line 2111 "f-exp.c.tmp"
2112 case 58: /* exp: exp BOOL_OR exp */
2114 { pstate->wrap2<logical_or_operation> (); }
2115 #line 2117 "f-exp.c.tmp"
2118 case 59: /* exp: exp '=' exp */
2120 { pstate->wrap2<assign_operation> (); }
2121 #line 2123 "f-exp.c.tmp"
2124 case 60: /* exp: exp ASSIGN_MODIFY exp */
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));
2132 #line 2134 "f-exp.c.tmp"
2135 case 61: /* exp: INT */
2138 pstate->push_new<long_const_operation>
2139 ((yyvsp[0].typed_val).type, (yyvsp[0].typed_val).val);
2141 #line 2143 "f-exp.c.tmp"
2144 case 62: /* exp: NAME_OR_INT */
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,
2153 #line 2155 "f-exp.c.tmp"
2156 case 63: /* exp: FLOAT */
2160 std::copy (std::begin ((yyvsp[0].typed_val_float).val), std::end ((yyvsp[0].typed_val_float).val),
2162 pstate->push_new<float_const_operation> ((yyvsp[0].typed_val_float).type, data);
2164 #line 2166 "f-exp.c.tmp"
2167 case 65: /* exp: DOLLAR_VARIABLE */
2169 { pstate->push_dollar ((yyvsp[0].sval)); }
2170 #line 2172 "f-exp.c.tmp"
2173 case 66: /* exp: SIZEOF '(' type ')' */
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 ());
2181 #line 2183 "f-exp.c.tmp"
2184 case 67: /* exp: BOOLEAN_LITERAL */
2186 { pstate->push_new<bool_operation> ((yyvsp[0].lval)); }
2187 #line 2189 "f-exp.c.tmp"
2190 case 68: /* exp: STRING_LITERAL */
2193 pstate->push_new<string_operation>
2194 (copy_name ((yyvsp[0].sval)));
2196 #line 2198 "f-exp.c.tmp"
2199 case 69: /* variable: name_not_typename */
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);
2205 #line 2207 "f-exp.c.tmp"
2208 case 72: /* ptype: typebase abs_decl */
2211 /* This is where the interesting stuff happens. */
2214 struct type *follow_type = (yyvsp[-1].tval);
2215 struct type *range_type;
2218 switch (type_stack->pop ())
2224 follow_type = lookup_pointer_type (follow_type);
2227 follow_type = lookup_lvalue_reference_type (follow_type);
2230 array_size = type_stack->pop_int ();
2231 if (array_size != -1)
2234 create_static_range_type ((struct type *) NULL,
2235 parse_f_type (pstate)
2239 create_array_type ((struct type *) NULL,
2240 follow_type, range_type);
2243 follow_type = lookup_pointer_type (follow_type);
2246 follow_type = lookup_function_type (follow_type);
2250 int kind_val = type_stack->pop_int ();
2252 = convert_to_kind_type (follow_type, kind_val);
2256 (yyval.tval) = follow_type;
2258 #line 2260 "f-exp.c.tmp"
2261 case 73: /* abs_decl: '*' */
2263 { type_stack->push (tp_pointer); (yyval.voidval) = 0; }
2264 #line 2266 "f-exp.c.tmp"
2267 case 74: /* abs_decl: '*' abs_decl */
2269 { type_stack->push (tp_pointer); (yyval.voidval) = (yyvsp[0].voidval); }
2270 #line 2272 "f-exp.c.tmp"
2273 case 75: /* abs_decl: '&' */
2275 { type_stack->push (tp_reference); (yyval.voidval) = 0; }
2276 #line 2278 "f-exp.c.tmp"
2279 case 76: /* abs_decl: '&' abs_decl */
2281 { type_stack->push (tp_reference); (yyval.voidval) = (yyvsp[0].voidval); }
2282 #line 2284 "f-exp.c.tmp"
2285 case 78: /* direct_abs_decl: '(' abs_decl ')' */
2287 { (yyval.voidval) = (yyvsp[-1].voidval); }
2288 #line 2290 "f-exp.c.tmp"
2291 case 79: /* direct_abs_decl: '(' KIND '=' INT ')' */
2293 { push_kind_type ((yyvsp[-1].typed_val).val, (yyvsp[-1].typed_val).type); }
2294 #line 2296 "f-exp.c.tmp"
2297 case 80: /* direct_abs_decl: '*' INT */
2299 { push_kind_type ((yyvsp[0].typed_val).val, (yyvsp[0].typed_val).type); }
2300 #line 2302 "f-exp.c.tmp"
2303 case 81: /* direct_abs_decl: direct_abs_decl func_mod */
2305 { type_stack->push (tp_function); }
2306 #line 2308 "f-exp.c.tmp"
2309 case 82: /* direct_abs_decl: func_mod */
2311 { type_stack->push (tp_function); }
2312 #line 2314 "f-exp.c.tmp"
2315 case 83: /* func_mod: '(' ')' */
2317 { (yyval.voidval) = 0; }
2318 #line 2320 "f-exp.c.tmp"
2321 case 84: /* func_mod: '(' nonempty_typelist ')' */
2323 { xfree ((yyvsp[-1].tvec)); (yyval.voidval) = 0; }
2324 #line 2326 "f-exp.c.tmp"
2327 case 85: /* typebase: TYPENAME */
2329 { (yyval.tval) = (yyvsp[0].tsym).type; }
2330 #line 2332 "f-exp.c.tmp"
2333 case 86: /* typebase: INT_S1_KEYWORD */
2335 { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s1; }
2336 #line 2338 "f-exp.c.tmp"
2339 case 87: /* typebase: INT_S2_KEYWORD */
2341 { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s2; }
2342 #line 2344 "f-exp.c.tmp"
2345 case 88: /* typebase: INT_KEYWORD */
2347 { (yyval.tval) = parse_f_type (pstate)->builtin_integer; }
2348 #line 2350 "f-exp.c.tmp"
2351 case 89: /* typebase: INT_S4_KEYWORD */
2353 { (yyval.tval) = parse_f_type (pstate)->builtin_integer; }
2354 #line 2356 "f-exp.c.tmp"
2357 case 90: /* typebase: INT_S8_KEYWORD */
2359 { (yyval.tval) = parse_f_type (pstate)->builtin_integer_s8; }
2360 #line 2362 "f-exp.c.tmp"
2363 case 91: /* typebase: CHARACTER */
2365 { (yyval.tval) = parse_f_type (pstate)->builtin_character; }
2366 #line 2368 "f-exp.c.tmp"
2369 case 92: /* typebase: LOGICAL_S1_KEYWORD */
2371 { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s1; }
2372 #line 2374 "f-exp.c.tmp"
2375 case 93: /* typebase: LOGICAL_S2_KEYWORD */
2377 { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s2; }
2378 #line 2380 "f-exp.c.tmp"
2381 case 94: /* typebase: LOGICAL_KEYWORD */
2383 { (yyval.tval) = parse_f_type (pstate)->builtin_logical; }
2384 #line 2386 "f-exp.c.tmp"
2387 case 95: /* typebase: LOGICAL_S4_KEYWORD */
2389 { (yyval.tval) = parse_f_type (pstate)->builtin_logical; }
2390 #line 2392 "f-exp.c.tmp"
2393 case 96: /* typebase: LOGICAL_S8_KEYWORD */
2395 { (yyval.tval) = parse_f_type (pstate)->builtin_logical_s8; }
2396 #line 2398 "f-exp.c.tmp"
2399 case 97: /* typebase: REAL_KEYWORD */
2401 { (yyval.tval) = parse_f_type (pstate)->builtin_real; }
2402 #line 2404 "f-exp.c.tmp"
2405 case 98: /* typebase: REAL_S4_KEYWORD */
2407 { (yyval.tval) = parse_f_type (pstate)->builtin_real; }
2408 #line 2410 "f-exp.c.tmp"
2411 case 99: /* typebase: REAL_S8_KEYWORD */
2413 { (yyval.tval) = parse_f_type (pstate)->builtin_real_s8; }
2414 #line 2416 "f-exp.c.tmp"
2417 case 100: /* typebase: REAL_S16_KEYWORD */
2419 { (yyval.tval) = parse_f_type (pstate)->builtin_real_s16; }
2420 #line 2422 "f-exp.c.tmp"
2423 case 101: /* typebase: COMPLEX_KEYWORD */
2425 { (yyval.tval) = parse_f_type (pstate)->builtin_complex; }
2426 #line 2428 "f-exp.c.tmp"
2429 case 102: /* typebase: COMPLEX_S4_KEYWORD */
2431 { (yyval.tval) = parse_f_type (pstate)->builtin_complex; }
2432 #line 2434 "f-exp.c.tmp"
2435 case 103: /* typebase: COMPLEX_S8_KEYWORD */
2437 { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s8; }
2438 #line 2440 "f-exp.c.tmp"
2441 case 104: /* typebase: COMPLEX_S16_KEYWORD */
2443 { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s16; }
2444 #line 2446 "f-exp.c.tmp"
2447 case 105: /* typebase: SINGLE PRECISION */
2449 { (yyval.tval) = parse_f_type (pstate)->builtin_real;}
2450 #line 2452 "f-exp.c.tmp"
2453 case 106: /* typebase: DOUBLE PRECISION */
2455 { (yyval.tval) = parse_f_type (pstate)->builtin_real_s8;}
2456 #line 2458 "f-exp.c.tmp"
2459 case 107: /* typebase: SINGLE COMPLEX_KEYWORD */
2461 { (yyval.tval) = parse_f_type (pstate)->builtin_complex;}
2462 #line 2464 "f-exp.c.tmp"
2465 case 108: /* typebase: DOUBLE COMPLEX_KEYWORD */
2467 { (yyval.tval) = parse_f_type (pstate)->builtin_complex_s8;}
2468 #line 2470 "f-exp.c.tmp"
2471 case 109: /* nonempty_typelist: type */
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);
2477 #line 2479 "f-exp.c.tmp"
2480 case 110: /* nonempty_typelist: nonempty_typelist ',' type */
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);
2486 #line 2488 "f-exp.c.tmp"
2489 case 111: /* name: NAME */
2491 { (yyval.sval) = (yyvsp[0].ssym).stoken; }
2492 #line 2494 "f-exp.c.tmp"
2495 case 112: /* name: TYPENAME */
2497 { (yyval.sval) = (yyvsp[0].tsym).stoken; }
2498 #line 2500 "f-exp.c.tmp"
2502 #line 2504 "f-exp.c.tmp"
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);
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. */
2528 const int yylhs = yyr1[yyn] - YYNTOKENS;
2529 const int yyi = yypgoto[yylhs] + *yyssp;
2530 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2532 : yydefgoto[yylhs]);
2538 /*--------------------------------------.
2539 | yyerrlab -- here on detecting error. |
2540 `--------------------------------------*/
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. */
2549 yyerror (YY_("syntax error"));
2552 if (yyerrstatus == 3)
2554 /* If just tried and failed to reuse lookahead token after an
2555 error, discard it. */
2557 if (yychar <= YYEOF)
2559 /* Return failure if at end of input. */
2560 if (yychar == YYEOF)
2565 yydestruct ("Error: discarding",
2571 /* Else will try to reuse lookahead token after shifting the error
2576 /*---------------------------------------------------.
2577 | yyerrorlab -- error raised explicitly by YYERROR. |
2578 `---------------------------------------------------*/
2580 /* Pacify compilers when the user code never invokes YYERROR and the
2581 label yyerrorlab therefore never appears in user code. */
2586 /* Do not reclaim the symbols of the rule whose action triggered
2590 YY_STACK_PRINT (yyss, yyssp);
2595 /*-------------------------------------------------------------.
2596 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2597 `-------------------------------------------------------------*/
2599 yyerrstatus = 3; /* Each real token shifted decrements this. */
2601 /* Pop stack until we find a state that shifts the error token. */
2604 yyn = yypact[yystate];
2605 if (!yypact_value_is_default (yyn))
2607 yyn += YYSYMBOL_YYerror;
2608 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2616 /* Pop the current state because it cannot handle the error token. */
2621 yydestruct ("Error: popping",
2622 YY_ACCESSING_SYMBOL (yystate), yyvsp);
2625 YY_STACK_PRINT (yyss, yyssp);
2628 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2630 YY_IGNORE_MAYBE_UNINITIALIZED_END
2633 /* Shift the error token. */
2634 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2640 /*-------------------------------------.
2641 | yyacceptlab -- YYACCEPT comes here. |
2642 `-------------------------------------*/
2648 /*-----------------------------------.
2649 | yyabortlab -- YYABORT comes here. |
2650 `-----------------------------------*/
2656 /*-----------------------------------------------------------.
2657 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2658 `-----------------------------------------------------------*/
2660 yyerror (YY_("memory exhausted"));
2665 /*----------------------------------------------------------.
2666 | yyreturnlab -- parsing is finished, clean up and return. |
2667 `----------------------------------------------------------*/
2669 if (yychar != YYEMPTY)
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",
2677 /* Do not reclaim the symbols of the rule whose action triggered
2678 this YYABORT or YYACCEPT. */
2680 YY_STACK_PRINT (yyss, yyssp);
2681 while (yyssp != yyss)
2683 yydestruct ("Cleanup: popping",
2684 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
2689 YYSTACK_FREE (yyss);
2698 /* Called to match intrinsic function calls with one argument to their
2699 respective implementation and push the operation. */
2702 wrap_unop_intrinsic (exp_opcode code)
2707 pstate->wrap<fortran_abs_operation> ();
2710 pstate->wrap<fortran_floor_operation_1arg> ();
2712 case FORTRAN_CEILING:
2713 pstate->wrap<fortran_ceil_operation_1arg> ();
2715 case UNOP_FORTRAN_ALLOCATED:
2716 pstate->wrap<fortran_allocated_operation> ();
2718 case UNOP_FORTRAN_RANK:
2719 pstate->wrap<fortran_rank_operation> ();
2721 case UNOP_FORTRAN_SHAPE:
2722 pstate->wrap<fortran_array_shape_operation> ();
2724 case UNOP_FORTRAN_LOC:
2725 pstate->wrap<fortran_loc_operation> ();
2727 case FORTRAN_ASSOCIATED:
2728 pstate->wrap<fortran_associated_1arg> ();
2730 case FORTRAN_ARRAY_SIZE:
2731 pstate->wrap<fortran_array_size_1arg> ();
2734 pstate->wrap<fortran_cmplx_operation_1arg> ();
2736 case FORTRAN_LBOUND:
2737 case FORTRAN_UBOUND:
2738 pstate->push_new<fortran_bound_1arg> (code, pstate->pop ());
2741 gdb_assert_not_reached ("unhandled intrinsic");
2745 /* Called to match intrinsic function calls with two arguments to their
2746 respective implementation and push the operation. */
2749 wrap_binop_intrinsic (exp_opcode code)
2754 fortran_wrap2_kind<fortran_floor_operation_2arg>
2755 (parse_f_type (pstate)->builtin_integer);
2757 case FORTRAN_CEILING:
2758 fortran_wrap2_kind<fortran_ceil_operation_2arg>
2759 (parse_f_type (pstate)->builtin_integer);
2762 pstate->wrap2<fortran_mod_operation> ();
2764 case BINOP_FORTRAN_MODULO:
2765 pstate->wrap2<fortran_modulo_operation> ();
2768 pstate->wrap2<fortran_cmplx_operation_2arg> ();
2770 case FORTRAN_ASSOCIATED:
2771 pstate->wrap2<fortran_associated_2arg> ();
2773 case FORTRAN_ARRAY_SIZE:
2774 pstate->wrap2<fortran_array_size_2arg> ();
2776 case FORTRAN_LBOUND:
2777 case FORTRAN_UBOUND:
2779 operation_up arg2 = pstate->pop ();
2780 operation_up arg1 = pstate->pop ();
2781 pstate->push_new<fortran_bound_2arg> (code, std::move (arg1),
2786 gdb_assert_not_reached ("unhandled intrinsic");
2790 /* Called to match intrinsic function calls with three arguments to their
2791 respective implementation and push the operation. */
2794 wrap_ternop_intrinsic (exp_opcode code)
2798 case FORTRAN_LBOUND:
2799 case FORTRAN_UBOUND:
2801 operation_up kind_arg = pstate->pop ();
2802 operation_up arg2 = pstate->pop ();
2803 operation_up arg1 = pstate->pop ();
2805 value *val = kind_arg->evaluate (nullptr, pstate->expout.get (),
2806 EVAL_AVOID_SIDE_EFFECTS);
2807 gdb_assert (val != nullptr);
2810 = convert_to_kind_type (parse_f_type (pstate)->builtin_integer,
2811 value_as_long (val));
2813 pstate->push_new<fortran_bound_3arg> (code, std::move (arg1),
2814 std::move (arg2), follow_type);
2817 case FORTRAN_ARRAY_SIZE:
2818 fortran_wrap3_kind<fortran_array_size_3arg>
2819 (parse_f_type (pstate)->builtin_integer);
2822 fortran_wrap3_kind<fortran_cmplx_operation_3arg>
2823 (parse_f_type (pstate)->builtin_complex);
2826 gdb_assert_not_reached ("unhandled intrinsic");
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. */
2834 template<typename T>
2836 fortran_wrap2_kind (type *base_type)
2838 operation_up kind_arg = pstate->pop ();
2839 operation_up arg = pstate->pop ();
2841 value *val = kind_arg->evaluate (nullptr, pstate->expout.get (),
2842 EVAL_AVOID_SIDE_EFFECTS);
2843 gdb_assert (val != nullptr);
2845 type *follow_type = convert_to_kind_type (base_type, value_as_long (val));
2847 pstate->push_new<T> (std::move (arg), follow_type);
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
2854 template<typename T>
2856 fortran_wrap3_kind (type *base_type)
2858 operation_up kind_arg = pstate->pop ();
2859 operation_up arg2 = pstate->pop ();
2860 operation_up arg1 = pstate->pop ();
2862 value *val = kind_arg->evaluate (nullptr, pstate->expout.get (),
2863 EVAL_AVOID_SIDE_EFFECTS);
2864 gdb_assert (val != nullptr);
2866 type *follow_type = convert_to_kind_type (base_type, value_as_long (val));
2868 pstate->push_new<T> (std::move (arg1), std::move (arg2), follow_type);
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. */
2875 /*** Needs some error checking for the float case ***/
2878 parse_number (struct parser_state *par_state,
2879 const char *p, int len, int parsed_float, YYSTYPE *putithere)
2884 int base = input_radix;
2888 struct type *signed_type;
2889 struct type *unsigned_type;
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'. */
2899 for (tmp2 = tmp; *tmp2; ++tmp2)
2900 if (*tmp2 == 'd' || *tmp2 == 'D')
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);
2909 return parsed? FLOAT : ERROR;
2912 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2913 if (p[0] == '0' && len > 1)
2948 if (len == 0 && c == 'l')
2950 else if (len == 0 && c == 'u')
2955 if (c >= '0' && c <= '9')
2957 else if (c >= 'a' && c <= 'f')
2960 return ERROR; /* Char not a digit */
2962 return ERROR; /* Invalid digit in this base */
2966 /* Test for overflow. */
2967 if (prevn == 0 && n == 0)
2969 else if (RANGE_CHECK && prevn >= n)
2970 range_error (_("Overflow on numeric constant."));
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.
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. */
2987 if ((gdbarch_int_bit (par_state->gdbarch ())
2988 != gdbarch_long_bit (par_state->gdbarch ())
2990 >> (gdbarch_int_bit (par_state->gdbarch ())-2))) /* Avoid
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;
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;
3004 high_bit = ((ULONGEST)1) << (bits_available - 1);
3007 && ((n >> 2) >> (bits_available - 2)))
3008 range_error (_("Overflow on numeric constant."));
3010 putithere->typed_val.val = n;
3012 /* If the high bit of the worked out type is set then this number
3013 has to be unsigned. */
3015 if (unsigned_p || (n & high_bit))
3016 putithere->typed_val.type = unsigned_type;
3018 putithere->typed_val.type = signed_type;
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. */
3027 push_kind_type (LONGEST val, struct type *type)
3031 if (type->is_unsigned ())
3033 ULONGEST uval = static_cast <ULONGEST> (val);
3035 error (_("kind value out of range"));
3036 ival = static_cast <int> (uval);
3040 if (val > INT_MAX || val < 0)
3041 error (_("kind value out of range"));
3042 ival = static_cast <int> (val);
3045 type_stack->push (ival);
3046 type_stack->push (tp_kind);
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)
3056 if (basetype == parse_f_type (pstate)->builtin_character)
3058 /* Character of kind 1 is a special case, this is the same as the
3059 base character type. */
3061 return parse_f_type (pstate)->builtin_character;
3063 else if (basetype == parse_f_type (pstate)->builtin_complex)
3066 return parse_f_type (pstate)->builtin_complex;
3068 return parse_f_type (pstate)->builtin_complex_s8;
3069 else if (kind == 16)
3070 return parse_f_type (pstate)->builtin_complex_s16;
3072 else if (basetype == parse_f_type (pstate)->builtin_real)
3075 return parse_f_type (pstate)->builtin_real;
3077 return parse_f_type (pstate)->builtin_real_s8;
3078 else if (kind == 16)
3079 return parse_f_type (pstate)->builtin_real_s16;
3081 else if (basetype == parse_f_type (pstate)->builtin_logical)
3084 return parse_f_type (pstate)->builtin_logical_s1;
3086 return parse_f_type (pstate)->builtin_logical_s2;
3088 return parse_f_type (pstate)->builtin_logical;
3090 return parse_f_type (pstate)->builtin_logical_s8;
3092 else if (basetype == parse_f_type (pstate)->builtin_integer)
3095 return parse_f_type (pstate)->builtin_integer_s1;
3097 return parse_f_type (pstate)->builtin_integer_s2;
3099 return parse_f_type (pstate)->builtin_integer;
3101 return parse_f_type (pstate)->builtin_integer_s8;
3104 error (_("unsupported kind %d for type %s"),
3105 kind, TYPE_SAFE_NAME (basetype));
3107 /* Should never get here. */
3113 /* The string to match against. */
3116 /* The lexer token to return. */
3119 /* The expression opcode to embed within the token. */
3120 enum exp_opcode opcode;
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;
3127 /* List of Fortran operators. */
3129 static const struct token fortran_operators[] =
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 },
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
3156 /* The string representing a Fortran boolean. */
3159 /* The integer value to replace it with. */
3163 /* The set of Fortran booleans. These are matched case insensitively. */
3164 static const struct f77_boolean_val boolean_values[] =
3170 static const token f_keywords[] =
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
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 },
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 */
3219 static char *tempbuf; /* Current buffer contents */
3220 static int tempbufsize; /* Size of allocated buffer */
3221 static int tempbufindex; /* Current index into buffer */
3223 #define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */
3225 #define CHECKBUF(size) \
3227 if (tempbufindex + (size) >= tempbufsize) \
3229 growbuf_by_size (size); \
3234 /* Grow the static temp buffer if necessary, including allocating the
3235 first one on demand. */
3238 growbuf_by_size (int count)
3242 growby = std::max (count, GROWBY_MIN_SIZE);
3243 tempbufsize += growby;
3244 if (tempbuf == NULL)
3245 tempbuf = (char *) xmalloc (tempbufsize);
3247 tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
3250 /* Blatantly ripped off from ch-exp.y. This routine recognizes F77
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') */
3260 match_string_literal (void)
3262 const char *tokptr = pstate->lexptr;
3264 for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
3267 if (*tokptr == *pstate->lexptr)
3269 if (*(tokptr + 1) == *pstate->lexptr)
3274 tempbuf[tempbufindex++] = *tokptr;
3276 if (*tokptr == '\0' /* no terminator */
3277 || tempbufindex == 0) /* no string */
3281 tempbuf[tempbufindex] = '\0';
3282 yylval.sval.ptr = tempbuf;
3283 yylval.sval.length = tempbufindex;
3284 pstate->lexptr = ++tokptr;
3285 return STRING_LITERAL;
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;
3294 /* This is set if the previously-returned token was a structure
3296 static bool last_was_structop;
3298 /* Read one token, getting characters through lexptr. */
3306 const char *tokstart;
3307 bool saw_structop = last_was_structop;
3309 last_was_structop = false;
3313 pstate->prev_lexptr = pstate->lexptr;
3315 tokstart = pstate->lexptr;
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. */
3320 if (*pstate->lexptr == '.')
3322 for (const auto &candidate : boolean_values)
3324 if (strncasecmp (tokstart, candidate.name,
3325 strlen (candidate.name)) == 0)
3327 pstate->lexptr += strlen (candidate.name);
3328 yylval.lval = candidate.value;
3329 return BOOLEAN_LITERAL;
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)
3339 gdb_assert (!candidate.case_sensitive);
3340 pstate->lexptr += strlen (candidate.oper);
3341 yylval.opcode = candidate.opcode;
3342 return candidate.token;
3345 switch (c = *tokstart)
3348 if (saw_name_at_eof)
3350 saw_name_at_eof = false;
3353 else if (pstate->parse_completion && saw_structop)
3364 token = match_string_literal ();
3375 if (paren_depth == 0)
3382 if (pstate->comma_terminates && paren_depth == 0)
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. */
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;
3409 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
3414 else if (c == '0' && (p[1]=='t' || p[1]=='T'
3415 || p[1]=='d' || p[1]=='D'))
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 == '.')
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
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')))
3442 toktype = parse_number (pstate, tokstart, p - tokstart,
3443 got_dot|got_e|got_d,
3445 if (toktype == ERROR)
3447 char *err_copy = (char *) alloca (p - tokstart + 1);
3449 memcpy (err_copy, tokstart, p - tokstart);
3450 err_copy[p - tokstart] = 0;
3451 error (_("Invalid number \"%s\"."), err_copy);
3458 last_was_structop = true;
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);
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]);
3495 /* The token "if" terminates the expression and is NOT
3496 removed from the input stream. */
3498 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
3501 pstate->lexptr += namelen;
3503 /* Catch specific keywords. */
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)))
3512 yylval.opcode = keyword.opcode;
3513 return keyword.token;
3516 yylval.sval.ptr = tokstart;
3517 yylval.sval.length = namelen;
3519 if (*tokstart == '$')
3520 return DOLLAR_VARIABLE;
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. */
3526 std::string tmp = copy_name (yylval.sval);
3527 struct block_symbol result;
3528 const domain_enum lookup_domains[] =
3536 for (const auto &domain : lookup_domains)
3538 result = lookup_symbol (tmp.c_str (), pstate->expression_context_block,
3540 if (result.symbol && result.symbol->aclass () == LOC_TYPEDEF)
3542 yylval.tsym.type = result.symbol->type ();
3551 = language_lookup_primitive_type (pstate->language (),
3552 pstate->gdbarch (), tmp.c_str ());
3553 if (yylval.tsym.type != NULL)
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. */
3560 && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
3561 || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
3563 YYSTYPE newlval; /* Its value is ignored. */
3564 hextype = parse_number (pstate, tokstart, namelen, 0, &newlval);
3567 yylval.ssym.sym = result;
3568 yylval.ssym.is_a_field_of_this = false;
3573 if (pstate->parse_completion && *pstate->lexptr == '\0')
3574 saw_name_at_eof = true;
3576 /* Any other kind of symbol */
3577 yylval.ssym.sym = result;
3578 yylval.ssym.is_a_field_of_this = false;
3584 f_language::parser (struct parser_state *par_state) const
3586 /* Setting up the parser state. */
3587 scoped_restore pstate_restore = make_scoped_restore (&pstate);
3588 scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
3590 gdb_assert (par_state != NULL);
3592 last_was_structop = false;
3593 saw_name_at_eof = false;
3596 struct type_stack stack;
3597 scoped_restore restore_type_stack = make_scoped_restore (&type_stack,
3600 int result = yyparse ();
3602 pstate->set_operation (pstate->pop ());
3607 yyerror (const char *msg)
3609 if (pstate->prev_lexptr)
3610 pstate->lexptr = pstate->prev_lexptr;
3612 error (_("A %s in expression, near `%s'."), msg, pstate->lexptr);