1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
59 BOOLEAN_LITERAL = 261,
67 LOGICAL_S1_KEYWORD = 269,
68 LOGICAL_S2_KEYWORD = 270,
69 LOGICAL_KEYWORD = 271,
71 REAL_S8_KEYWORD = 273,
72 REAL_S16_KEYWORD = 274,
73 COMPLEX_S8_KEYWORD = 275,
74 COMPLEX_S16_KEYWORD = 276,
75 COMPLEX_S32_KEYWORD = 277,
96 #define STRING_LITERAL 260
97 #define BOOLEAN_LITERAL 261
100 #define NAME_OR_INT 264
103 #define INT_KEYWORD 267
104 #define INT_S2_KEYWORD 268
105 #define LOGICAL_S1_KEYWORD 269
106 #define LOGICAL_S2_KEYWORD 270
107 #define LOGICAL_KEYWORD 271
108 #define REAL_KEYWORD 272
109 #define REAL_S8_KEYWORD 273
110 #define REAL_S16_KEYWORD 274
111 #define COMPLEX_S8_KEYWORD 275
112 #define COMPLEX_S16_KEYWORD 276
113 #define COMPLEX_S32_KEYWORD 277
117 #define CHARACTER 281
119 #define ASSIGN_MODIFY 283
120 #define ABOVE_COMMA 284
125 #define GREATERTHAN 289
134 /* Copy the first part of user declarations. */
139 #include "gdb_string.h"
140 #include "expression.h"
142 #include "parser-defs.h"
143 #include "language.h"
145 #include "bfd.h" /* Required by objfiles.h. */
146 #include "symfile.h" /* Required by objfiles.h. */
147 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
151 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
152 as well as gratuitiously global symbol names, so we can have multiple
153 yacc generated parsers in gdb. Note that these are only the variables
154 produced by yacc. If other parser generators (bison, byacc, etc) produce
155 additional global names that conflict at link time, then those parser
156 generators need to be fixed instead of adding those names to this list. */
158 #define yymaxdepth f_maxdepth
159 #define yyparse f_parse
161 #define yyerror f_error
162 #define yylval f_lval
163 #define yychar f_char
164 #define yydebug f_debug
165 #define yypact f_pact
172 #define yyexca f_exca
173 #define yyerrflag f_errflag
174 #define yynerrs f_nerrs
179 #define yystate f_state
184 #define yylloc f_lloc
185 #define yyreds f_reds /* With YYDEBUG defined */
186 #define yytoks f_toks /* With YYDEBUG defined */
187 #define yyname f_name /* With YYDEBUG defined */
188 #define yyrule f_rule /* With YYDEBUG defined */
189 #define yylhs f_yylhs
190 #define yylen f_yylen
191 #define yydefred f_yydefred
192 #define yydgoto f_yydgoto
193 #define yysindex f_yysindex
194 #define yyrindex f_yyrindex
195 #define yygindex f_yygindex
196 #define yytable f_yytable
197 #define yycheck f_yycheck
200 #define YYDEBUG 1 /* Default to yydebug support */
203 #define YYFPRINTF parser_fprintf
207 static int yylex (void);
209 void yyerror (char *);
211 static void growbuf_by_size (int);
213 static int match_string_literal (void);
217 /* Enabling traces. */
222 /* Enabling verbose error messages. */
223 #ifdef YYERROR_VERBOSE
224 # undef YYERROR_VERBOSE
225 # define YYERROR_VERBOSE 1
227 # define YYERROR_VERBOSE 0
230 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
232 typedef union YYSTYPE {
243 struct symtoken ssym;
246 enum exp_opcode opcode;
247 struct internalvar *ivar;
252 /* Line 191 of yacc.c. */
253 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
254 # define YYSTYPE_IS_DECLARED 1
255 # define YYSTYPE_IS_TRIVIAL 1
260 /* Copy the second part of user declarations. */
263 /* YYSTYPE gets defined by %union */
264 static int parse_number (char *, int, int, YYSTYPE *);
267 /* Line 214 of yacc.c. */
269 #if ! defined (yyoverflow) || YYERROR_VERBOSE
271 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
273 # if YYSTACK_USE_ALLOCA
274 # define YYSTACK_ALLOC alloca
276 # ifndef YYSTACK_USE_ALLOCA
277 # if defined (alloca) || defined (_ALLOCA_H)
278 # define YYSTACK_ALLOC alloca
281 # define YYSTACK_ALLOC __builtin_alloca
287 # ifdef YYSTACK_ALLOC
288 /* Pacify GCC's `empty if-body' warning. */
289 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
291 # if defined (__STDC__) || defined (__cplusplus)
292 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
293 # define YYSIZE_T size_t
295 # define YYSTACK_ALLOC xmalloc
296 # define YYSTACK_FREE free
298 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
301 #if (! defined (yyoverflow) \
302 && (! defined (__cplusplus) \
303 || (YYSTYPE_IS_TRIVIAL)))
305 /* A type that is properly aligned for any stack member. */
312 /* The size of the maximum gap between one aligned stack and the next. */
313 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
315 /* The size of an array large to enough to hold all stacks, each with
317 # define YYSTACK_BYTES(N) \
318 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
319 + YYSTACK_GAP_MAXIMUM)
321 /* Copy COUNT objects from FROM to TO. The source and destination do
325 # define YYCOPY(To, From, Count) \
326 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
328 # define YYCOPY(To, From, Count) \
331 register YYSIZE_T yyi; \
332 for (yyi = 0; yyi < (Count); yyi++) \
333 (To)[yyi] = (From)[yyi]; \
339 /* Relocate STACK from its old location to the new one. The
340 local variables YYSIZE and YYSTACKSIZE give the old and new number of
341 elements in the stack, and YYPTR gives the new location of the
342 stack. Advance YYPTR to a properly aligned location for the next
344 # define YYSTACK_RELOCATE(Stack) \
347 YYSIZE_T yynewbytes; \
348 YYCOPY (&yyptr->Stack, Stack, yysize); \
349 Stack = &yyptr->Stack; \
350 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
351 yyptr += yynewbytes / sizeof (*yyptr); \
357 #if defined (__STDC__) || defined (__cplusplus)
358 typedef signed char yysigned_char;
360 typedef short yysigned_char;
363 /* YYFINAL -- State number of the termination state. */
365 /* YYLAST -- Last index in YYTABLE. */
368 /* YYNTOKENS -- Number of terminals. */
370 /* YYNNTS -- Number of nonterminals. */
372 /* YYNRULES -- Number of rules. */
374 /* YYNRULES -- Number of states. */
375 #define YYNSTATES 125
377 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
379 #define YYMAXUTOK 293
381 #define YYTRANSLATE(YYX) \
382 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
384 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
385 static const unsigned char yytranslate[] =
387 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 2, 2, 2, 2, 49, 35, 2,
391 51, 52, 47, 45, 29, 46, 2, 48, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 54, 2,
393 2, 31, 2, 32, 44, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 34, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 33, 2, 53, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
413 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
414 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
415 25, 26, 27, 28, 30, 36, 37, 38, 39, 40,
420 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
422 static const unsigned char yyprhs[] =
424 0, 0, 3, 5, 7, 9, 13, 16, 19, 22,
425 25, 28, 31, 32, 38, 39, 41, 43, 47, 51,
426 55, 59, 64, 68, 72, 76, 80, 84, 88, 92,
427 96, 100, 104, 108, 112, 116, 120, 124, 128, 132,
428 136, 140, 144, 148, 150, 152, 154, 156, 158, 163,
429 165, 167, 169, 171, 173, 176, 178, 181, 183, 186,
430 188, 192, 195, 197, 200, 204, 206, 208, 210, 212,
431 214, 216, 218, 220, 222, 224, 226, 228, 230, 232,
435 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
436 static const yysigned_char yyrhs[] =
438 56, 0, -1, 58, -1, 57, -1, 64, -1, 51,
439 58, 52, -1, 47, 58, -1, 35, 58, -1, 46,
440 58, -1, 25, 58, -1, 53, 58, -1, 10, 58,
441 -1, -1, 58, 51, 59, 60, 52, -1, -1, 58,
442 -1, 61, -1, 60, 29, 58, -1, 58, 54, 58,
443 -1, 58, 29, 58, -1, 51, 62, 52, -1, 51,
444 64, 52, 58, -1, 58, 44, 58, -1, 58, 47,
445 58, -1, 58, 48, 58, -1, 58, 49, 58, -1,
446 58, 45, 58, -1, 58, 46, 58, -1, 58, 43,
447 58, -1, 58, 42, 58, -1, 58, 37, 58, -1,
448 58, 36, 58, -1, 58, 39, 58, -1, 58, 38,
449 58, -1, 58, 41, 58, -1, 58, 40, 58, -1,
450 58, 35, 58, -1, 58, 34, 58, -1, 58, 33,
451 58, -1, 58, 23, 58, -1, 58, 24, 58, -1,
452 58, 31, 58, -1, 58, 28, 58, -1, 3, -1,
453 9, -1, 4, -1, 63, -1, 27, -1, 10, 51,
454 64, 52, -1, 6, -1, 5, -1, 71, -1, 65,
455 -1, 69, -1, 69, 66, -1, 47, -1, 47, 66,
456 -1, 35, -1, 35, 66, -1, 67, -1, 51, 66,
457 52, -1, 67, 68, -1, 68, -1, 51, 52, -1,
458 51, 70, 52, -1, 8, -1, 12, -1, 13, -1,
459 26, -1, 16, -1, 15, -1, 14, -1, 17, -1,
460 18, -1, 19, -1, 20, -1, 21, -1, 22, -1,
461 64, -1, 70, 29, 64, -1, 7, -1
464 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
465 static const unsigned short yyrline[] =
467 0, 228, 228, 229, 232, 238, 243, 247, 251, 255,
468 259, 263, 273, 272, 280, 283, 287, 291, 295, 300,
469 304, 308, 316, 320, 324, 328, 332, 336, 340, 344,
470 348, 352, 356, 360, 364, 368, 372, 376, 380, 384,
471 389, 393, 397, 403, 410, 419, 426, 429, 432, 440,
472 447, 455, 499, 502, 503, 546, 548, 550, 552, 554,
473 557, 559, 561, 565, 567, 572, 574, 576, 578, 580,
474 582, 584, 586, 588, 590, 592, 594, 596, 604, 609,
479 #if YYDEBUG || YYERROR_VERBOSE
480 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
481 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
482 static const char *const yytname[] =
484 "$end", "error", "$undefined", "INT", "FLOAT", "STRING_LITERAL",
485 "BOOLEAN_LITERAL", "NAME", "TYPENAME", "NAME_OR_INT", "SIZEOF", "ERROR",
486 "INT_KEYWORD", "INT_S2_KEYWORD", "LOGICAL_S1_KEYWORD",
487 "LOGICAL_S2_KEYWORD", "LOGICAL_KEYWORD", "REAL_KEYWORD",
488 "REAL_S8_KEYWORD", "REAL_S16_KEYWORD", "COMPLEX_S8_KEYWORD",
489 "COMPLEX_S16_KEYWORD", "COMPLEX_S32_KEYWORD", "BOOL_AND", "BOOL_OR",
490 "BOOL_NOT", "CHARACTER", "VARIABLE", "ASSIGN_MODIFY", "','",
491 "ABOVE_COMMA", "'='", "'?'", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL",
492 "GEQ", "LEQ", "GREATERTHAN", "LESSTHAN", "RSH", "LSH", "'@'", "'+'",
493 "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'~'", "':'",
494 "$accept", "start", "type_exp", "exp", "@1", "arglist", "substring",
495 "complexnum", "variable", "type", "ptype", "abs_decl",
496 "direct_abs_decl", "func_mod", "typebase", "nonempty_typelist",
497 "name_not_typename", 0
502 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
504 static const unsigned short yytoknum[] =
506 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
507 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
508 275, 276, 277, 278, 279, 280, 281, 282, 283, 44,
509 284, 61, 63, 124, 94, 38, 285, 286, 287, 288,
510 289, 290, 291, 292, 64, 43, 45, 42, 47, 37,
515 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
516 static const unsigned char yyr1[] =
518 0, 55, 56, 56, 57, 58, 58, 58, 58, 58,
519 58, 58, 59, 58, 60, 60, 60, 60, 61, 62,
520 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
521 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
522 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
523 58, 63, 64, 65, 65, 66, 66, 66, 66, 66,
524 67, 67, 67, 68, 68, 69, 69, 69, 69, 69,
525 69, 69, 69, 69, 69, 69, 69, 69, 70, 70,
529 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
530 static const unsigned char yyr2[] =
532 0, 2, 1, 1, 1, 3, 2, 2, 2, 2,
533 2, 2, 0, 5, 0, 1, 1, 3, 3, 3,
534 3, 4, 3, 3, 3, 3, 3, 3, 3, 3,
535 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
536 3, 3, 3, 1, 1, 1, 1, 1, 4, 1,
537 1, 1, 1, 1, 2, 1, 2, 1, 2, 1,
538 3, 2, 1, 2, 3, 1, 1, 1, 1, 1,
539 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
543 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
544 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
545 means the default is an error. */
546 static const unsigned char yydefact[] =
548 0, 43, 45, 50, 49, 80, 65, 44, 0, 66,
549 67, 71, 70, 69, 72, 73, 74, 75, 76, 77,
550 0, 68, 47, 0, 0, 0, 0, 0, 0, 3,
551 2, 46, 4, 52, 53, 51, 0, 11, 9, 7,
552 8, 6, 0, 0, 0, 10, 1, 0, 0, 0,
553 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
554 0, 0, 0, 0, 0, 0, 0, 0, 12, 57,
555 55, 0, 54, 59, 62, 0, 0, 5, 20, 0,
556 39, 40, 42, 41, 38, 37, 36, 31, 30, 33,
557 32, 35, 34, 29, 28, 22, 26, 27, 23, 24,
558 25, 14, 58, 56, 63, 78, 0, 0, 0, 61,
559 48, 19, 21, 15, 0, 16, 60, 0, 64, 0,
563 /* YYDEFGOTO[NTERM-NUM]. */
564 static const yysigned_char yydefgoto[] =
566 -1, 28, 29, 42, 101, 114, 115, 43, 31, 105,
567 33, 72, 73, 74, 34, 107, 35
570 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
572 #define YYPACT_NINF -59
573 static const short yypact[] =
575 77, -59, -59, -59, -59, -59, -59, -59, 128, -59,
576 -59, -59, -59, -59, -59, -59, -59, -59, -59, -59,
577 137, -59, -59, 137, 137, 137, 77, 137, 2, -59,
578 311, -59, -59, -59, -34, -59, 77, -45, -45, -45,
579 -45, -45, 281, -43, -36, -45, -59, 137, 137, 137,
580 137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
581 137, 137, 137, 137, 137, 137, 137, 137, -59, -34,
582 -34, 208, -59, -44, -59, -33, 137, -59, -59, 137,
583 357, 338, 311, 311, 392, 409, 163, 223, 223, -10,
584 -10, -10, -10, 24, 24, 60, -37, -37, -45, -45,
585 -45, 137, -59, -59, -59, -59, -31, -26, 232, -59,
586 188, 311, -45, 252, -24, -59, -59, 399, -59, 137,
587 137, -59, -59, 311, 311
590 /* YYPGOTO[NTERM-NUM]. */
591 static const yysigned_char yypgoto[] =
593 -59, -59, -59, 0, -59, -59, -59, -59, -59, 4,
594 -59, -27, -59, -58, -59, -59, -59
597 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
598 positive, shift that token. If negative, reduce the rule which
599 number is the opposite. If zero, do what YYDEFACT says.
600 If YYTABLE_NINF, syntax error. */
601 #define YYTABLE_NINF -1
602 static const unsigned char yytable[] =
604 30, 69, 46, 117, 32, 120, 68, 108, 37, 78,
605 65, 66, 67, 70, 68, 109, 79, 71, 0, 110,
606 38, 116, 0, 39, 40, 41, 118, 45, 121, 0,
607 44, 0, 60, 61, 62, 63, 64, 65, 66, 67,
608 75, 68, 102, 103, 106, 0, 0, 80, 81, 82,
609 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
610 93, 94, 95, 96, 97, 98, 99, 100, 62, 63,
611 64, 65, 66, 67, 0, 68, 111, 0, 0, 112,
612 1, 2, 3, 4, 5, 6, 7, 8, 0, 9,
613 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
614 0, 113, 20, 21, 22, 63, 64, 65, 66, 67,
615 112, 68, 23, 0, 0, 0, 0, 0, 0, 123,
616 124, 122, 0, 24, 25, 0, 0, 0, 26, 0,
617 27, 1, 2, 3, 4, 5, 0, 7, 8, 0,
618 1, 2, 3, 4, 5, 0, 7, 8, 0, 0,
619 0, 0, 0, 20, 0, 22, 0, 0, 0, 0,
620 0, 0, 20, 23, 22, 0, 0, 0, 0, 0,
621 0, 0, 23, 0, 24, 25, 0, 0, 0, 36,
622 0, 27, 0, 24, 25, 0, 0, 0, 26, 0,
623 27, 1, 2, 3, 4, 5, 0, 7, 8, 54,
624 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
625 65, 66, 67, 20, 68, 22, 6, 0, 0, 0,
626 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
627 19, 0, 0, 0, 21, 0, 0, 0, 0, 26,
628 6, 27, 0, 69, 9, 10, 11, 12, 13, 14,
629 15, 16, 17, 18, 19, 70, 0, 0, 21, 71,
630 104, 56, 57, 58, 59, 60, 61, 62, 63, 64,
631 65, 66, 67, 0, 68, 47, 48, 0, 0, 0,
632 49, 0, 0, 50, 104, 51, 52, 53, 54, 55,
633 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
634 66, 67, 0, 68, 47, 48, 119, 0, 0, 49,
635 76, 0, 50, 0, 51, 52, 53, 54, 55, 56,
636 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
637 67, 0, 68, 77, 47, 48, 0, 0, 0, 49,
638 0, 0, 50, 0, 51, 52, 53, 54, 55, 56,
639 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
640 67, 47, 68, 0, 0, 0, 0, 0, 0, 0,
641 0, 51, 52, 53, 54, 55, 56, 57, 58, 59,
642 60, 61, 62, 63, 64, 65, 66, 67, 0, 68,
643 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
644 61, 62, 63, 64, 65, 66, 67, 6, 68, 0,
645 0, 9, 10, 11, 12, 13, 14, 15, 16, 17,
646 18, 19, 0, 0, 0, 21, 52, 53, 54, 55,
647 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
648 66, 67, 0, 68, 53, 54, 55, 56, 57, 58,
649 59, 60, 61, 62, 63, 64, 65, 66, 67, 0,
653 static const yysigned_char yycheck[] =
655 0, 35, 0, 29, 0, 29, 51, 51, 8, 52,
656 47, 48, 49, 47, 51, 73, 52, 51, -1, 52,
657 20, 52, -1, 23, 24, 25, 52, 27, 52, -1,
658 26, -1, 42, 43, 44, 45, 46, 47, 48, 49,
659 36, 51, 69, 70, 71, -1, -1, 47, 48, 49,
660 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
661 60, 61, 62, 63, 64, 65, 66, 67, 44, 45,
662 46, 47, 48, 49, -1, 51, 76, -1, -1, 79,
663 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
664 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
665 -1, 101, 25, 26, 27, 45, 46, 47, 48, 49,
666 110, 51, 35, -1, -1, -1, -1, -1, -1, 119,
667 120, 117, -1, 46, 47, -1, -1, -1, 51, -1,
668 53, 3, 4, 5, 6, 7, -1, 9, 10, -1,
669 3, 4, 5, 6, 7, -1, 9, 10, -1, -1,
670 -1, -1, -1, 25, -1, 27, -1, -1, -1, -1,
671 -1, -1, 25, 35, 27, -1, -1, -1, -1, -1,
672 -1, -1, 35, -1, 46, 47, -1, -1, -1, 51,
673 -1, 53, -1, 46, 47, -1, -1, -1, 51, -1,
674 53, 3, 4, 5, 6, 7, -1, 9, 10, 36,
675 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
676 47, 48, 49, 25, 51, 27, 8, -1, -1, -1,
677 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
678 22, -1, -1, -1, 26, -1, -1, -1, -1, 51,
679 8, 53, -1, 35, 12, 13, 14, 15, 16, 17,
680 18, 19, 20, 21, 22, 47, -1, -1, 26, 51,
681 52, 38, 39, 40, 41, 42, 43, 44, 45, 46,
682 47, 48, 49, -1, 51, 23, 24, -1, -1, -1,
683 28, -1, -1, 31, 52, 33, 34, 35, 36, 37,
684 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
685 48, 49, -1, 51, 23, 24, 54, -1, -1, 28,
686 29, -1, 31, -1, 33, 34, 35, 36, 37, 38,
687 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
688 49, -1, 51, 52, 23, 24, -1, -1, -1, 28,
689 -1, -1, 31, -1, 33, 34, 35, 36, 37, 38,
690 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
691 49, 23, 51, -1, -1, -1, -1, -1, -1, -1,
692 -1, 33, 34, 35, 36, 37, 38, 39, 40, 41,
693 42, 43, 44, 45, 46, 47, 48, 49, -1, 51,
694 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
695 43, 44, 45, 46, 47, 48, 49, 8, 51, -1,
696 -1, 12, 13, 14, 15, 16, 17, 18, 19, 20,
697 21, 22, -1, -1, -1, 26, 34, 35, 36, 37,
698 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
699 48, 49, -1, 51, 35, 36, 37, 38, 39, 40,
700 41, 42, 43, 44, 45, 46, 47, 48, 49, -1,
704 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
705 symbol of state STATE-NUM. */
706 static const unsigned char yystos[] =
708 0, 3, 4, 5, 6, 7, 8, 9, 10, 12,
709 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
710 25, 26, 27, 35, 46, 47, 51, 53, 56, 57,
711 58, 63, 64, 65, 69, 71, 51, 58, 58, 58,
712 58, 58, 58, 62, 64, 58, 0, 23, 24, 28,
713 31, 33, 34, 35, 36, 37, 38, 39, 40, 41,
714 42, 43, 44, 45, 46, 47, 48, 49, 51, 35,
715 47, 51, 66, 67, 68, 64, 29, 52, 52, 52,
716 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
717 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
718 58, 59, 66, 66, 52, 64, 66, 70, 51, 68,
719 52, 58, 58, 58, 60, 61, 52, 29, 52, 54,
723 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
724 # define YYSIZE_T __SIZE_TYPE__
726 #if ! defined (YYSIZE_T) && defined (size_t)
727 # define YYSIZE_T size_t
729 #if ! defined (YYSIZE_T)
730 # if defined (__STDC__) || defined (__cplusplus)
731 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
732 # define YYSIZE_T size_t
735 #if ! defined (YYSIZE_T)
736 # define YYSIZE_T unsigned int
739 #define yyerrok (yyerrstatus = 0)
740 #define yyclearin (yychar = YYEMPTY)
744 #define YYACCEPT goto yyacceptlab
745 #define YYABORT goto yyabortlab
746 #define YYERROR goto yyerrlab1
748 /* Like YYERROR except do call yyerror. This remains here temporarily
749 to ease the transition to the new meaning of YYERROR, for GCC.
750 Once GCC version 2 has supplanted version 1, this can go. */
752 #define YYFAIL goto yyerrlab
754 #define YYRECOVERING() (!!yyerrstatus)
756 #define YYBACKUP(Token, Value) \
758 if (yychar == YYEMPTY && yylen == 1) \
762 yytoken = YYTRANSLATE (yychar); \
768 yyerror ("syntax error: cannot back up");\
774 #define YYERRCODE 256
776 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
779 #ifndef YYLLOC_DEFAULT
780 # define YYLLOC_DEFAULT(Current, Rhs, N) \
781 Current.first_line = Rhs[1].first_line; \
782 Current.first_column = Rhs[1].first_column; \
783 Current.last_line = Rhs[N].last_line; \
784 Current.last_column = Rhs[N].last_column;
787 /* YYLEX -- calling `yylex' with the right arguments. */
790 # define YYLEX yylex (YYLEX_PARAM)
792 # define YYLEX yylex ()
795 /* Enable debugging if requested. */
799 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
800 # define YYFPRINTF fprintf
803 # define YYDPRINTF(Args) \
809 # define YYDSYMPRINT(Args) \
815 # define YYDSYMPRINTF(Title, Token, Value, Location) \
819 YYFPRINTF (stderr, "%s ", Title); \
820 yysymprint (stderr, \
822 YYFPRINTF (stderr, "\n"); \
826 /*------------------------------------------------------------------.
827 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
829 `------------------------------------------------------------------*/
831 #if defined (__STDC__) || defined (__cplusplus)
833 yy_stack_print (short *bottom, short *top)
836 yy_stack_print (bottom, top)
841 YYFPRINTF (stderr, "Stack now");
842 for (/* Nothing. */; bottom <= top; ++bottom)
843 YYFPRINTF (stderr, " %d", *bottom);
844 YYFPRINTF (stderr, "\n");
847 # define YY_STACK_PRINT(Bottom, Top) \
850 yy_stack_print ((Bottom), (Top)); \
854 /*------------------------------------------------.
855 | Report that the YYRULE is going to be reduced. |
856 `------------------------------------------------*/
858 #if defined (__STDC__) || defined (__cplusplus)
860 yy_reduce_print (int yyrule)
863 yy_reduce_print (yyrule)
868 unsigned int yylineno = yyrline[yyrule];
869 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
870 yyrule - 1, yylineno);
871 /* Print the symbols being reduced, and their result. */
872 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
873 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
874 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
877 # define YY_REDUCE_PRINT(Rule) \
880 yy_reduce_print (Rule); \
883 /* Nonzero means print parse trace. It is left uninitialized so that
884 multiple parsers can coexist. */
887 # define YYDPRINTF(Args)
888 # define YYDSYMPRINT(Args)
889 # define YYDSYMPRINTF(Title, Token, Value, Location)
890 # define YY_STACK_PRINT(Bottom, Top)
891 # define YY_REDUCE_PRINT(Rule)
892 #endif /* !YYDEBUG */
895 /* YYINITDEPTH -- initial size of the parser's stacks. */
897 # define YYINITDEPTH 200
900 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
901 if the built-in stack extension method is used).
903 Do not make this value too large; the results are undefined if
904 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
905 evaluated with infinite-precision integer arithmetic. */
912 # define YYMAXDEPTH 10000
920 # if defined (__GLIBC__) && defined (_STRING_H)
921 # define yystrlen strlen
923 /* Return the length of YYSTR. */
925 # if defined (__STDC__) || defined (__cplusplus)
926 yystrlen (const char *yystr)
932 register const char *yys = yystr;
934 while (*yys++ != '\0')
937 return yys - yystr - 1;
943 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
944 # define yystpcpy stpcpy
946 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
949 # if defined (__STDC__) || defined (__cplusplus)
950 yystpcpy (char *yydest, const char *yysrc)
952 yystpcpy (yydest, yysrc)
957 register char *yyd = yydest;
958 register const char *yys = yysrc;
960 while ((*yyd++ = *yys++) != '\0')
968 #endif /* !YYERROR_VERBOSE */
973 /*--------------------------------.
974 | Print this symbol on YYOUTPUT. |
975 `--------------------------------*/
977 #if defined (__STDC__) || defined (__cplusplus)
979 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
982 yysymprint (yyoutput, yytype, yyvaluep)
988 /* Pacify ``unused variable'' warnings. */
991 if (yytype < YYNTOKENS)
993 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
995 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
999 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1006 YYFPRINTF (yyoutput, ")");
1009 #endif /* ! YYDEBUG */
1010 /*-----------------------------------------------.
1011 | Release the memory associated to this symbol. |
1012 `-----------------------------------------------*/
1014 #if defined (__STDC__) || defined (__cplusplus)
1016 yydestruct (int yytype, YYSTYPE *yyvaluep)
1019 yydestruct (yytype, yyvaluep)
1024 /* Pacify ``unused variable'' warnings. */
1036 /* Prevent warnings from -Wmissing-prototypes. */
1038 #ifdef YYPARSE_PARAM
1039 # if defined (__STDC__) || defined (__cplusplus)
1040 int yyparse (void *YYPARSE_PARAM);
1044 #else /* ! YYPARSE_PARAM */
1045 #if defined (__STDC__) || defined (__cplusplus)
1050 #endif /* ! YYPARSE_PARAM */
1054 /* The lookahead symbol. */
1057 /* The semantic value of the lookahead symbol. */
1060 /* Number of syntax errors so far. */
1069 #ifdef YYPARSE_PARAM
1070 # if defined (__STDC__) || defined (__cplusplus)
1071 int yyparse (void *YYPARSE_PARAM)
1073 int yyparse (YYPARSE_PARAM)
1074 void *YYPARSE_PARAM;
1076 #else /* ! YYPARSE_PARAM */
1077 #if defined (__STDC__) || defined (__cplusplus)
1088 register int yystate;
1091 /* Number of tokens to shift before error messages enabled. */
1093 /* Lookahead token as an internal (translated) token number. */
1096 /* Three stacks and their tools:
1097 `yyss': related to states,
1098 `yyvs': related to semantic values,
1099 `yyls': related to locations.
1101 Refer to the stacks thru separate pointers, to allow yyoverflow
1102 to xreallocate them elsewhere. */
1104 /* The state stack. */
1105 short yyssa[YYINITDEPTH];
1106 short *yyss = yyssa;
1107 register short *yyssp;
1109 /* The semantic value stack. */
1110 YYSTYPE yyvsa[YYINITDEPTH];
1111 YYSTYPE *yyvs = yyvsa;
1112 register YYSTYPE *yyvsp;
1116 #define YYPOPSTACK (yyvsp--, yyssp--)
1118 YYSIZE_T yystacksize = YYINITDEPTH;
1120 /* The variables used to return semantic value and location from the
1125 /* When reducing, the number of symbols on the RHS of the reduced
1129 YYDPRINTF ((stderr, "Starting parse\n"));
1134 yychar = YYEMPTY; /* Cause a token to be read. */
1136 /* Initialize stack pointers.
1137 Waste one element of value and location stack
1138 so that they stay on the same level as the state stack.
1139 The wasted elements are never initialized. */
1146 /*------------------------------------------------------------.
1147 | yynewstate -- Push a new state, which is found in yystate. |
1148 `------------------------------------------------------------*/
1150 /* In all cases, when you get here, the value and location stacks
1151 have just been pushed. so pushing a state here evens the stacks.
1158 if (yyss + yystacksize - 1 <= yyssp)
1160 /* Get the current used size of the three stacks, in elements. */
1161 YYSIZE_T yysize = yyssp - yyss + 1;
1165 /* Give user a chance to xreallocate the stack. Use copies of
1166 these so that the &'s don't force the real ones into
1168 YYSTYPE *yyvs1 = yyvs;
1169 short *yyss1 = yyss;
1172 /* Each stack pointer address is followed by the size of the
1173 data in use in that stack, in bytes. This used to be a
1174 conditional around just the two extra args, but that might
1175 be undefined if yyoverflow is a macro. */
1176 yyoverflow ("parser stack overflow",
1177 &yyss1, yysize * sizeof (*yyssp),
1178 &yyvs1, yysize * sizeof (*yyvsp),
1185 #else /* no yyoverflow */
1186 # ifndef YYSTACK_RELOCATE
1189 /* Extend the stack our own way. */
1190 if (YYMAXDEPTH <= yystacksize)
1193 if (YYMAXDEPTH < yystacksize)
1194 yystacksize = YYMAXDEPTH;
1197 short *yyss1 = yyss;
1198 union yyalloc *yyptr =
1199 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1202 YYSTACK_RELOCATE (yyss);
1203 YYSTACK_RELOCATE (yyvs);
1205 # undef YYSTACK_RELOCATE
1207 YYSTACK_FREE (yyss1);
1210 #endif /* no yyoverflow */
1212 yyssp = yyss + yysize - 1;
1213 yyvsp = yyvs + yysize - 1;
1216 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1217 (unsigned long int) yystacksize));
1219 if (yyss + yystacksize - 1 <= yyssp)
1223 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1232 /* Do appropriate processing given the current state. */
1233 /* Read a lookahead token if we need one and don't already have one. */
1236 /* First try to decide what to do without reference to lookahead token. */
1238 yyn = yypact[yystate];
1239 if (yyn == YYPACT_NINF)
1242 /* Not known => get a lookahead token if don't already have one. */
1244 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1245 if (yychar == YYEMPTY)
1247 YYDPRINTF ((stderr, "Reading a token: "));
1251 if (yychar <= YYEOF)
1253 yychar = yytoken = YYEOF;
1254 YYDPRINTF ((stderr, "Now at end of input.\n"));
1258 yytoken = YYTRANSLATE (yychar);
1259 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1262 /* If the proper action on seeing token YYTOKEN is to reduce or to
1263 detect an error, take that action. */
1265 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1270 if (yyn == 0 || yyn == YYTABLE_NINF)
1279 /* Shift the lookahead token. */
1280 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1282 /* Discard the token being shifted unless it is eof. */
1283 if (yychar != YYEOF)
1289 /* Count tokens shifted since error; after three, turn off error
1298 /*-----------------------------------------------------------.
1299 | yydefault -- do the default action for the current state. |
1300 `-----------------------------------------------------------*/
1302 yyn = yydefact[yystate];
1308 /*-----------------------------.
1309 | yyreduce -- Do a reduction. |
1310 `-----------------------------*/
1312 /* yyn is the number of a rule to reduce with. */
1315 /* If YYLEN is nonzero, implement the default value of the action:
1318 Otherwise, the following line sets YYVAL to garbage.
1319 This behavior is undocumented and Bison
1320 users should not rely upon it. Assigning to YYVAL
1321 unconditionally makes the parser a bit smaller, and it avoids a
1322 GCC warning that YYVAL may be used uninitialized. */
1323 yyval = yyvsp[1-yylen];
1326 YY_REDUCE_PRINT (yyn);
1331 { write_exp_elt_opcode(OP_TYPE);
1332 write_exp_elt_type(yyvsp[0].tval);
1333 write_exp_elt_opcode(OP_TYPE); }
1343 { write_exp_elt_opcode (UNOP_IND); }
1348 { write_exp_elt_opcode (UNOP_ADDR); }
1353 { write_exp_elt_opcode (UNOP_NEG); }
1358 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1363 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1368 { write_exp_elt_opcode (UNOP_SIZEOF); }
1373 { start_arglist (); }
1378 { write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST);
1379 write_exp_elt_longcst ((LONGEST) end_arglist ());
1380 write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); }
1385 { arglist_len = 1; }
1410 { write_exp_elt_opcode(OP_COMPLEX); }
1415 { write_exp_elt_opcode (UNOP_CAST);
1416 write_exp_elt_type (yyvsp[-2].tval);
1417 write_exp_elt_opcode (UNOP_CAST); }
1422 { write_exp_elt_opcode (BINOP_REPEAT); }
1427 { write_exp_elt_opcode (BINOP_MUL); }
1432 { write_exp_elt_opcode (BINOP_DIV); }
1437 { write_exp_elt_opcode (BINOP_REM); }
1442 { write_exp_elt_opcode (BINOP_ADD); }
1447 { write_exp_elt_opcode (BINOP_SUB); }
1452 { write_exp_elt_opcode (BINOP_LSH); }
1457 { write_exp_elt_opcode (BINOP_RSH); }
1462 { write_exp_elt_opcode (BINOP_EQUAL); }
1467 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1472 { write_exp_elt_opcode (BINOP_LEQ); }
1477 { write_exp_elt_opcode (BINOP_GEQ); }
1482 { write_exp_elt_opcode (BINOP_LESS); }
1487 { write_exp_elt_opcode (BINOP_GTR); }
1492 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1497 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1502 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1507 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1512 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1517 { write_exp_elt_opcode (BINOP_ASSIGN); }
1522 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1523 write_exp_elt_opcode (yyvsp[-1].opcode);
1524 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1529 { write_exp_elt_opcode (OP_LONG);
1530 write_exp_elt_type (yyvsp[0].typed_val.type);
1531 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1532 write_exp_elt_opcode (OP_LONG); }
1538 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1539 write_exp_elt_opcode (OP_LONG);
1540 write_exp_elt_type (val.typed_val.type);
1541 write_exp_elt_longcst ((LONGEST)val.typed_val.val);
1542 write_exp_elt_opcode (OP_LONG); }
1547 { write_exp_elt_opcode (OP_DOUBLE);
1548 write_exp_elt_type (builtin_type_f_real_s8);
1549 write_exp_elt_dblcst (yyvsp[0].dval);
1550 write_exp_elt_opcode (OP_DOUBLE); }
1555 { write_exp_elt_opcode (OP_LONG);
1556 write_exp_elt_type (builtin_type_f_integer);
1557 CHECK_TYPEDEF (yyvsp[-1].tval);
1558 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1559 write_exp_elt_opcode (OP_LONG); }
1564 { write_exp_elt_opcode (OP_BOOL);
1565 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1566 write_exp_elt_opcode (OP_BOOL);
1573 write_exp_elt_opcode (OP_STRING);
1574 write_exp_string (yyvsp[0].sval);
1575 write_exp_elt_opcode (OP_STRING);
1581 { struct symbol *sym = yyvsp[0].ssym.sym;
1585 if (symbol_read_needs_frame (sym))
1587 if (innermost_block == 0 ||
1588 contained_in (block_found,
1590 innermost_block = block_found;
1592 write_exp_elt_opcode (OP_VAR_VALUE);
1593 /* We want to use the selected frame, not
1594 another more inner frame which happens to
1595 be in the same block. */
1596 write_exp_elt_block (NULL);
1597 write_exp_elt_sym (sym);
1598 write_exp_elt_opcode (OP_VAR_VALUE);
1603 struct minimal_symbol *msymbol;
1604 char *arg = copy_name (yyvsp[0].ssym.stoken);
1607 lookup_minimal_symbol (arg, NULL, NULL);
1608 if (msymbol != NULL)
1610 write_exp_msymbol (msymbol,
1611 lookup_function_type (builtin_type_int),
1614 else if (!have_full_symbols () && !have_partial_symbols ())
1615 error ("No symbol table is loaded. Use the \"file\" command.");
1617 error ("No symbol \"%s\" in current context.",
1618 copy_name (yyvsp[0].ssym.stoken));
1626 /* This is where the interesting stuff happens. */
1629 struct type *follow_type = yyvsp[-1].tval;
1630 struct type *range_type;
1633 switch (pop_type ())
1639 follow_type = lookup_pointer_type (follow_type);
1642 follow_type = lookup_reference_type (follow_type);
1645 array_size = pop_type_int ();
1646 if (array_size != -1)
1649 create_range_type ((struct type *) NULL,
1650 builtin_type_f_integer, 0,
1653 create_array_type ((struct type *) NULL,
1654 follow_type, range_type);
1657 follow_type = lookup_pointer_type (follow_type);
1660 follow_type = lookup_function_type (follow_type);
1663 yyval.tval = follow_type;
1669 { push_type (tp_pointer); yyval.voidval = 0; }
1674 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
1679 { push_type (tp_reference); yyval.voidval = 0; }
1684 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
1689 { yyval.voidval = yyvsp[-1].voidval; }
1694 { push_type (tp_function); }
1699 { push_type (tp_function); }
1704 { yyval.voidval = 0; }
1709 { free (yyvsp[-1].tvec); yyval.voidval = 0; }
1714 { yyval.tval = yyvsp[0].tsym.type; }
1719 { yyval.tval = builtin_type_f_integer; }
1724 { yyval.tval = builtin_type_f_integer_s2; }
1729 { yyval.tval = builtin_type_f_character; }
1734 { yyval.tval = builtin_type_f_logical;}
1739 { yyval.tval = builtin_type_f_logical_s2;}
1744 { yyval.tval = builtin_type_f_logical_s1;}
1749 { yyval.tval = builtin_type_f_real;}
1754 { yyval.tval = builtin_type_f_real_s8;}
1759 { yyval.tval = builtin_type_f_real_s16;}
1764 { yyval.tval = builtin_type_f_complex_s8;}
1769 { yyval.tval = builtin_type_f_complex_s16;}
1774 { yyval.tval = builtin_type_f_complex_s32;}
1779 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1780 yyval.ivec[0] = 1; /* Number of types in vector */
1781 yyval.tvec[1] = yyvsp[0].tval;
1787 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1788 yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1789 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1796 /* Line 991 of yacc.c. */
1802 YY_STACK_PRINT (yyss, yyssp);
1807 /* Now `shift' the result of the reduction. Determine what state
1808 that goes to, based on the state we popped back to and the rule
1809 number reduced by. */
1813 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1814 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1815 yystate = yytable[yystate];
1817 yystate = yydefgoto[yyn - YYNTOKENS];
1822 /*------------------------------------.
1823 | yyerrlab -- here on detecting error |
1824 `------------------------------------*/
1826 /* If not already recovering from an error, report this error. */
1831 yyn = yypact[yystate];
1833 if (YYPACT_NINF < yyn && yyn < YYLAST)
1835 YYSIZE_T yysize = 0;
1836 int yytype = YYTRANSLATE (yychar);
1841 /* Start YYX at -YYN if negative to avoid negative indexes in
1843 for (yyx = yyn < 0 ? -yyn : 0;
1844 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1845 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1846 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1847 yysize += yystrlen ("syntax error, unexpected ") + 1;
1848 yysize += yystrlen (yytname[yytype]);
1849 yymsg = (char *) YYSTACK_ALLOC (yysize);
1852 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1853 yyp = yystpcpy (yyp, yytname[yytype]);
1858 for (yyx = yyn < 0 ? -yyn : 0;
1859 yyx < (int) (sizeof (yytname) / sizeof (char *));
1861 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1863 const char *yyq = ! yycount ? ", expecting " : " or ";
1864 yyp = yystpcpy (yyp, yyq);
1865 yyp = yystpcpy (yyp, yytname[yyx]);
1870 YYSTACK_FREE (yymsg);
1873 yyerror ("syntax error; also virtual memory exhausted");
1876 #endif /* YYERROR_VERBOSE */
1877 yyerror ("syntax error");
1882 if (yyerrstatus == 3)
1884 /* If just tried and failed to reuse lookahead token after an
1885 error, discard it. */
1887 /* Return failure if at end of input. */
1888 if (yychar == YYEOF)
1890 /* Pop the error token. */
1892 /* Pop the rest of the stack. */
1893 while (yyss < yyssp)
1895 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1896 yydestruct (yystos[*yyssp], yyvsp);
1902 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1903 yydestruct (yytoken, &yylval);
1908 /* Else will try to reuse lookahead token after shifting the error
1913 /*----------------------------------------------------.
1914 | yyerrlab1 -- error raised explicitly by an action. |
1915 `----------------------------------------------------*/
1918 /* Suppress GCC warning that yyerrlab1 is unused when no action
1919 invokes YYERROR. MacOS 10.2.3's buggy "smart preprocessor"
1920 insists on the trailing semicolon. */
1921 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1922 __attribute__ ((__unused__));
1929 /*---------------------------------------------------------------.
1930 | yyerrlab2 -- pop states until the error token can be shifted. |
1931 `---------------------------------------------------------------*/
1933 yyerrstatus = 3; /* Each real token shifted decrements this. */
1937 yyn = yypact[yystate];
1938 if (yyn != YYPACT_NINF)
1941 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1949 /* Pop the current state because it cannot handle the error token. */
1953 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1954 yydestruct (yystos[yystate], yyvsp);
1958 YY_STACK_PRINT (yyss, yyssp);
1964 YYDPRINTF ((stderr, "Shifting error token, "));
1973 /*-------------------------------------.
1974 | yyacceptlab -- YYACCEPT comes here. |
1975 `-------------------------------------*/
1980 /*-----------------------------------.
1981 | yyabortlab -- YYABORT comes here. |
1982 `-----------------------------------*/
1988 /*----------------------------------------------.
1989 | yyoverflowlab -- parser overflow comes here. |
1990 `----------------------------------------------*/
1992 yyerror ("parser stack overflow");
2000 YYSTACK_FREE (yyss);
2009 /* Take care of parsing a number (anything that starts with a digit).
2010 Set yylval and return the token type; update lexptr.
2011 LEN is the number of characters in it. */
2013 /*** Needs some error checking for the float case ***/
2016 parse_number (p, len, parsed_float, putithere)
2025 int base = input_radix;
2029 struct type *signed_type;
2030 struct type *unsigned_type;
2034 /* It's a float since it contains a point or an exponent. */
2035 /* [dD] is not understood as an exponent by atof, change it to 'e'. */
2039 for (tmp2 = tmp; *tmp2; ++tmp2)
2040 if (*tmp2 == 'd' || *tmp2 == 'D')
2042 putithere->dval = atof (tmp);
2047 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2083 if (len == 0 && c == 'l')
2085 else if (len == 0 && c == 'u')
2090 if (c >= '0' && c <= '9')
2092 else if (c >= 'a' && c <= 'f')
2095 return ERROR; /* Char not a digit */
2097 return ERROR; /* Invalid digit in this base */
2101 /* Portably test for overflow (only works for nonzero values, so make
2102 a second check for zero). */
2103 if ((prevn >= n) && n != 0)
2104 unsigned_p=1; /* Try something unsigned */
2105 /* If range checking enabled, portably test for unsigned overflow. */
2106 if (RANGE_CHECK && n != 0)
2108 if ((unsigned_p && (unsigned)prevn >= (unsigned)n))
2109 range_error("Overflow on numeric constant.");
2114 /* If the number is too big to be an int, or it's got an l suffix
2115 then it's a long. Work out if this has to be a long by
2116 shifting right and and seeing if anything remains, and the
2117 target int size is different to the target long size.
2119 In the expression below, we could have tested
2120 (n >> TARGET_INT_BIT)
2121 to see if it was zero,
2122 but too many compilers warn about that, when ints and longs
2123 are the same size. So we shift it twice, with fewer bits
2124 each time, for the same result. */
2126 if ((TARGET_INT_BIT != TARGET_LONG_BIT
2127 && ((n >> 2) >> (TARGET_INT_BIT-2))) /* Avoid shift warning */
2130 high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2131 unsigned_type = builtin_type_unsigned_long;
2132 signed_type = builtin_type_long;
2136 high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2137 unsigned_type = builtin_type_unsigned_int;
2138 signed_type = builtin_type_int;
2141 putithere->typed_val.val = n;
2143 /* If the high bit of the worked out type is set then this number
2144 has to be unsigned. */
2146 if (unsigned_p || (n & high_bit))
2147 putithere->typed_val.type = unsigned_type;
2149 putithere->typed_val.type = signed_type;
2158 enum exp_opcode opcode;
2161 static const struct token dot_ops[] =
2163 { ".and.", BOOL_AND, BINOP_END },
2164 { ".AND.", BOOL_AND, BINOP_END },
2165 { ".or.", BOOL_OR, BINOP_END },
2166 { ".OR.", BOOL_OR, BINOP_END },
2167 { ".not.", BOOL_NOT, BINOP_END },
2168 { ".NOT.", BOOL_NOT, BINOP_END },
2169 { ".eq.", EQUAL, BINOP_END },
2170 { ".EQ.", EQUAL, BINOP_END },
2171 { ".eqv.", EQUAL, BINOP_END },
2172 { ".NEQV.", NOTEQUAL, BINOP_END },
2173 { ".neqv.", NOTEQUAL, BINOP_END },
2174 { ".EQV.", EQUAL, BINOP_END },
2175 { ".ne.", NOTEQUAL, BINOP_END },
2176 { ".NE.", NOTEQUAL, BINOP_END },
2177 { ".le.", LEQ, BINOP_END },
2178 { ".LE.", LEQ, BINOP_END },
2179 { ".ge.", GEQ, BINOP_END },
2180 { ".GE.", GEQ, BINOP_END },
2181 { ".gt.", GREATERTHAN, BINOP_END },
2182 { ".GT.", GREATERTHAN, BINOP_END },
2183 { ".lt.", LESSTHAN, BINOP_END },
2184 { ".LT.", LESSTHAN, BINOP_END },
2188 struct f77_boolean_val
2194 static const struct f77_boolean_val boolean_values[] =
2203 static const struct token f77_keywords[] =
2205 { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END },
2206 { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END },
2207 { "character", CHARACTER, BINOP_END },
2208 { "integer_2", INT_S2_KEYWORD, BINOP_END },
2209 { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
2210 { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
2211 { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
2212 { "integer", INT_KEYWORD, BINOP_END },
2213 { "logical", LOGICAL_KEYWORD, BINOP_END },
2214 { "real_16", REAL_S16_KEYWORD, BINOP_END },
2215 { "complex", COMPLEX_S8_KEYWORD, BINOP_END },
2216 { "sizeof", SIZEOF, BINOP_END },
2217 { "real_8", REAL_S8_KEYWORD, BINOP_END },
2218 { "real", REAL_KEYWORD, BINOP_END },
2222 /* Implementation of a dynamically expandable buffer for processing input
2223 characters acquired through lexptr and building a value to return in
2224 yylval. Ripped off from ch-exp.y */
2226 static char *tempbuf; /* Current buffer contents */
2227 static int tempbufsize; /* Size of allocated buffer */
2228 static int tempbufindex; /* Current index into buffer */
2230 #define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */
2232 #define CHECKBUF(size) \
2234 if (tempbufindex + (size) >= tempbufsize) \
2236 growbuf_by_size (size); \
2241 /* Grow the static temp buffer if necessary, including allocating the first one
2245 growbuf_by_size (count)
2250 growby = max (count, GROWBY_MIN_SIZE);
2251 tempbufsize += growby;
2252 if (tempbuf == NULL)
2253 tempbuf = (char *) xmalloc (tempbufsize);
2255 tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
2258 /* Blatantly ripped off from ch-exp.y. This routine recognizes F77
2261 Recognize a string literal. A string literal is a nonzero sequence
2262 of characters enclosed in matching single quotes, except that
2263 a single character inside single quotes is a character literal, which
2264 we reject as a string literal. To embed the terminator character inside
2265 a string, it is simply doubled (I.E. 'this''is''one''string') */
2268 match_string_literal ()
2270 char *tokptr = lexptr;
2272 for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
2275 if (*tokptr == *lexptr)
2277 if (*(tokptr + 1) == *lexptr)
2282 tempbuf[tempbufindex++] = *tokptr;
2284 if (*tokptr == '\0' /* no terminator */
2285 || tempbufindex == 0) /* no string */
2289 tempbuf[tempbufindex] = '\0';
2290 yylval.sval.ptr = tempbuf;
2291 yylval.sval.length = tempbufindex;
2293 return STRING_LITERAL;
2297 /* Read one token, getting characters through lexptr. */
2304 unsigned int i,token;
2309 prev_lexptr = lexptr;
2313 /* First of all, let us make sure we are not dealing with the
2314 special tokens .true. and .false. which evaluate to 1 and 0. */
2318 for (i = 0; boolean_values[i].name != NULL; i++)
2320 if (strncmp (tokstart, boolean_values[i].name,
2321 strlen (boolean_values[i].name)) == 0)
2323 lexptr += strlen (boolean_values[i].name);
2324 yylval.lval = boolean_values[i].value;
2325 return BOOLEAN_LITERAL;
2330 /* See if it is a special .foo. operator */
2332 for (i = 0; dot_ops[i].operator != NULL; i++)
2333 if (strncmp (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)) == 0)
2335 lexptr += strlen (dot_ops[i].operator);
2336 yylval.opcode = dot_ops[i].opcode;
2337 return dot_ops[i].token;
2340 switch (c = *tokstart)
2352 token = match_string_literal ();
2363 if (paren_depth == 0)
2370 if (comma_terminates && paren_depth == 0)
2376 /* Might be a floating point number. */
2377 if (lexptr[1] < '0' || lexptr[1] > '9')
2378 goto symbol; /* Nope, must be a symbol. */
2379 /* FALL THRU into number case. */
2392 /* It's a number. */
2393 int got_dot = 0, got_e = 0, got_d = 0, toktype;
2395 int hex = input_radix > 10;
2397 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2402 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2410 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2411 got_dot = got_e = 1;
2412 else if (!hex && !got_d && (*p == 'd' || *p == 'D'))
2413 got_dot = got_d = 1;
2414 else if (!hex && !got_dot && *p == '.')
2416 else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
2417 || (got_d && (p[-1] == 'd' || p[-1] == 'D')))
2418 && (*p == '-' || *p == '+'))
2419 /* This is the sign of the exponent, not the end of the
2422 /* We will take any letters or digits. parse_number will
2423 complain if past the radix, or if L or U are not final. */
2424 else if ((*p < '0' || *p > '9')
2425 && ((*p < 'a' || *p > 'z')
2426 && (*p < 'A' || *p > 'Z')))
2429 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d,
2431 if (toktype == ERROR)
2433 char *err_copy = (char *) alloca (p - tokstart + 1);
2435 memcpy (err_copy, tokstart, p - tokstart);
2436 err_copy[p - tokstart] = 0;
2437 error ("Invalid number \"%s\".", err_copy);
2468 if (!(c == '_' || c == '$'
2469 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2470 /* We must have come across a bad character (e.g. ';'). */
2471 error ("Invalid character '%c' in expression.", c);
2474 for (c = tokstart[namelen];
2475 (c == '_' || c == '$' || (c >= '0' && c <= '9')
2476 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2477 c = tokstart[++namelen]);
2479 /* The token "if" terminates the expression and is NOT
2480 removed from the input stream. */
2482 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2487 /* Catch specific keywords. */
2489 for (i = 0; f77_keywords[i].operator != NULL; i++)
2490 if (strncmp (tokstart, f77_keywords[i].operator,
2491 strlen(f77_keywords[i].operator)) == 0)
2493 /* lexptr += strlen(f77_keywords[i].operator); */
2494 yylval.opcode = f77_keywords[i].opcode;
2495 return f77_keywords[i].token;
2498 yylval.sval.ptr = tokstart;
2499 yylval.sval.length = namelen;
2501 if (*tokstart == '$')
2503 write_dollar_variable (yylval.sval);
2507 /* Use token-type TYPENAME for symbols that happen to be defined
2508 currently as names of types; NAME for other symbols.
2509 The caller is not constrained to care about the distinction. */
2511 char *tmp = copy_name (yylval.sval);
2513 int is_a_field_of_this = 0;
2516 sym = lookup_symbol (tmp, expression_context_block,
2518 current_language->la_language == language_cplus
2519 ? &is_a_field_of_this : NULL,
2521 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2523 yylval.tsym.type = SYMBOL_TYPE (sym);
2526 if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2529 /* Input names that aren't symbols but ARE valid hex numbers,
2530 when the input radix permits them, can be names or numbers
2531 depending on the parse. Note we support radixes > 16 here. */
2533 && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
2534 || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2536 YYSTYPE newlval; /* Its value is ignored. */
2537 hextype = parse_number (tokstart, namelen, 0, &newlval);
2540 yylval.ssym.sym = sym;
2541 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2546 /* Any other kind of symbol */
2547 yylval.ssym.sym = sym;
2548 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2558 lexptr = prev_lexptr;
2560 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);