2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* As a special exception, you may create a larger work that contains
23 part or all of the Bison parser skeleton and distribute that work
24 under terms of your choice, so long as that work isn't itself a
25 parser generator using the skeleton or a modified version thereof
26 as a parser skeleton. Alternatively, if you modify or redistribute
27 the parser skeleton itself, you may (at your option) remove this
28 special exception, which will cause the skeleton and the resulting
29 Bison output files to be licensed under the GNU General Public
30 License without this special exception.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
38 /* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
68 /* Copy the first part of user declarations. */
70 /* Line 189 of yacc.c */
75 #include "gdb_string.h"
77 #include "expression.h"
79 #include "parser-defs.h"
83 #include "bfd.h" /* Required by objfiles.h. */
84 #include "symfile.h" /* Required by objfiles.h. */
85 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
89 #define parse_type builtin_type (parse_gdbarch)
91 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
92 as well as gratuitiously global symbol names, so we can have multiple
93 yacc generated parsers in gdb. Note that these are only the variables
94 produced by yacc. If other parser generators (bison, byacc, etc) produce
95 additional global names that conflict at link time, then those parser
96 generators need to be fixed instead of adding those names to this list. */
98 #define yymaxdepth go_maxdepth
99 #define yyparse go_parse_internal
101 #define yyerror go_error
102 #define yylval go_lval
103 #define yychar go_char
104 #define yydebug go_debug
105 #define yypact go_pact
112 #define yyexca go_exca
113 #define yyerrflag go_errflag
114 #define yynerrs go_nerrs
118 #define yy_yys go_yys
119 #define yystate go_state
122 #define yy_yyv go_yyv
124 #define yylloc go_lloc
125 #define yyreds go_reds /* With YYDEBUG defined */
126 #define yytoks go_toks /* With YYDEBUG defined */
127 #define yyname go_name /* With YYDEBUG defined */
128 #define yyrule go_rule /* With YYDEBUG defined */
129 #define yylhs go_yylhs
130 #define yylen go_yylen
131 #define yydefred go_yydefred
132 #define yydgoto go_yydgoto
133 #define yysindex go_yysindex
134 #define yyrindex go_yyrindex
135 #define yygindex go_yygindex
136 #define yytable go_yytable
137 #define yycheck go_yycheck
140 #define YYDEBUG 1 /* Default to yydebug support */
143 #define YYFPRINTF parser_fprintf
147 static int yylex (void);
149 void yyerror (char *);
153 /* Line 189 of yacc.c */
156 /* Enabling traces. */
161 /* Enabling verbose error messages. */
162 #ifdef YYERROR_VERBOSE
163 # undef YYERROR_VERBOSE
164 # define YYERROR_VERBOSE 1
166 # define YYERROR_VERBOSE 0
169 /* Enabling the token table. */
170 #ifndef YYTOKEN_TABLE
171 # define YYTOKEN_TABLE 0
178 /* Put the tokens into the symbol table, so that GDB and other debuggers
192 STRUCT_KEYWORD = 269,
193 INTERFACE_KEYWORD = 270,
196 SIZEOF_KEYWORD = 273,
207 DOLLAR_VARIABLE = 284,
228 #define RAW_STRING 260
234 #define NAME_OR_INT 266
235 #define TRUE_KEYWORD 267
236 #define FALSE_KEYWORD 268
237 #define STRUCT_KEYWORD 269
238 #define INTERFACE_KEYWORD 270
239 #define TYPE_KEYWORD 271
240 #define CHAN_KEYWORD 272
241 #define SIZEOF_KEYWORD 273
242 #define LEN_KEYWORD 274
243 #define CAP_KEYWORD 275
244 #define NEW_KEYWORD 276
245 #define IOTA_KEYWORD 277
246 #define NIL_KEYWORD 278
247 #define CONST_KEYWORD 279
248 #define DOTDOTDOT 280
251 #define BYTE_KEYWORD 283
252 #define DOLLAR_VARIABLE 284
253 #define ASSIGN_MODIFY 285
254 #define ABOVE_COMMA 286
264 #define DECREMENT 296
265 #define INCREMENT 297
267 #define LEFT_ARROW 299
272 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
273 typedef union YYSTYPE
276 /* Line 214 of yacc.c */
289 struct symtoken ssym;
291 struct typed_stoken tsval;
294 enum exp_opcode opcode;
295 struct internalvar *ivar;
296 struct stoken_vector svec;
300 /* Line 214 of yacc.c */
303 # define YYSTYPE_IS_TRIVIAL 1
304 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
305 # define YYSTYPE_IS_DECLARED 1
309 /* Copy the second part of user declarations. */
311 /* Line 264 of yacc.c */
314 /* YYSTYPE gets defined by %union. */
315 static int parse_number (char *, int, int, YYSTYPE *);
316 static int parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
317 DOUBLEST *d, struct type **t);
320 /* Line 264 of yacc.c */
328 typedef YYTYPE_UINT8 yytype_uint8;
330 typedef unsigned char yytype_uint8;
334 typedef YYTYPE_INT8 yytype_int8;
335 #elif (defined __STDC__ || defined __C99__FUNC__ \
336 || defined __cplusplus || defined _MSC_VER)
337 typedef signed char yytype_int8;
339 typedef short int yytype_int8;
343 typedef YYTYPE_UINT16 yytype_uint16;
345 typedef unsigned short int yytype_uint16;
349 typedef YYTYPE_INT16 yytype_int16;
351 typedef short int yytype_int16;
355 # ifdef __SIZE_TYPE__
356 # define YYSIZE_T __SIZE_TYPE__
357 # elif defined size_t
358 # define YYSIZE_T size_t
359 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
360 || defined __cplusplus || defined _MSC_VER)
361 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
362 # define YYSIZE_T size_t
364 # define YYSIZE_T unsigned int
368 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
373 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
374 # define YY_(msgid) dgettext ("bison-runtime", msgid)
378 # define YY_(msgid) msgid
382 /* Suppress unused-variable warnings by "using" E. */
383 #if ! defined lint || defined __GNUC__
384 # define YYUSE(e) ((void) (e))
386 # define YYUSE(e) /* empty */
389 /* Identity function, used to suppress warnings about constant conditions. */
393 #if (defined __STDC__ || defined __C99__FUNC__ \
394 || defined __cplusplus || defined _MSC_VER)
407 #if ! defined yyoverflow || YYERROR_VERBOSE
409 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
411 # ifdef YYSTACK_USE_ALLOCA
412 # if YYSTACK_USE_ALLOCA
414 # define YYSTACK_ALLOC __builtin_alloca
415 # elif defined __BUILTIN_VA_ARG_INCR
416 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
418 # define YYSTACK_ALLOC __alloca
419 # elif defined _MSC_VER
420 # define alloca _alloca
422 # define YYSTACK_ALLOC alloca
423 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
424 || defined __cplusplus || defined _MSC_VER)
425 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
434 # ifdef YYSTACK_ALLOC
435 /* Pacify GCC's `empty if-body' warning. */
436 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
437 # ifndef YYSTACK_ALLOC_MAXIMUM
438 /* The OS might guarantee only one guard page at the bottom of the stack,
439 and a page size can be as small as 4096 bytes. So we cannot safely
440 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
441 to allow for a few compiler-allocated temporary stack slots. */
442 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
445 # define YYSTACK_ALLOC YYMALLOC
446 # define YYSTACK_FREE YYFREE
447 # ifndef YYSTACK_ALLOC_MAXIMUM
448 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
450 # if (defined __cplusplus && ! defined _STDLIB_H \
451 && ! ((defined YYMALLOC || defined xmalloc) \
452 && (defined YYFREE || defined xfree)))
453 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
459 # define YYMALLOC xmalloc
460 # if ! defined xmalloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
461 || defined __cplusplus || defined _MSC_VER)
462 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
466 # define YYFREE xfree
467 # if ! defined xfree && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
468 || defined __cplusplus || defined _MSC_VER)
469 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
473 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
476 #if (! defined yyoverflow \
477 && (! defined __cplusplus \
478 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
480 /* A type that is properly aligned for any stack member. */
483 yytype_int16 yyss_alloc;
487 /* The size of the maximum gap between one aligned stack and the next. */
488 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
490 /* The size of an array large to enough to hold all stacks, each with
492 # define YYSTACK_BYTES(N) \
493 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
494 + YYSTACK_GAP_MAXIMUM)
496 /* Copy COUNT objects from FROM to TO. The source and destination do
499 # if defined __GNUC__ && 1 < __GNUC__
500 # define YYCOPY(To, From, Count) \
501 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
503 # define YYCOPY(To, From, Count) \
507 for (yyi = 0; yyi < (Count); yyi++) \
508 (To)[yyi] = (From)[yyi]; \
514 /* Relocate STACK from its old location to the new one. The
515 local variables YYSIZE and YYSTACKSIZE give the old and new number of
516 elements in the stack, and YYPTR gives the new location of the
517 stack. Advance YYPTR to a properly aligned location for the next
519 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
522 YYSIZE_T yynewbytes; \
523 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
524 Stack = &yyptr->Stack_alloc; \
525 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
526 yyptr += yynewbytes / sizeof (*yyptr); \
532 /* YYFINAL -- State number of the termination state. */
534 /* YYLAST -- Last index in YYTABLE. */
537 /* YYNTOKENS -- Number of terminals. */
539 /* YYNNTS -- Number of nonterminals. */
541 /* YYNRULES -- Number of rules. */
543 /* YYNRULES -- Number of states. */
544 #define YYNSTATES 122
546 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
548 #define YYMAXUTOK 299
550 #define YYTRANSLATE(YYX) \
551 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
553 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
554 static const yytype_uint8 yytranslate[] =
556 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 62, 2, 2, 2, 54, 39, 2,
560 60, 64, 52, 50, 31, 51, 58, 53, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 67, 2,
562 43, 33, 44, 34, 49, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 59, 2, 63, 38, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 65, 37, 66, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
582 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
583 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
584 25, 26, 27, 28, 29, 30, 32, 35, 36, 40,
585 41, 42, 45, 46, 47, 48, 55, 56, 57, 61
589 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
591 static const yytype_uint8 yyprhs[] =
593 0, 0, 3, 5, 7, 9, 11, 15, 18, 21,
594 24, 27, 30, 33, 36, 39, 43, 48, 52, 57,
595 58, 64, 66, 67, 69, 73, 75, 80, 85, 89,
596 93, 97, 101, 105, 109, 113, 117, 121, 125, 129,
597 133, 137, 141, 145, 149, 153, 157, 161, 165, 171,
598 175, 179, 181, 183, 185, 187, 189, 191, 196, 201,
599 203, 207, 209, 211, 213, 216, 218, 221, 223, 225
602 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
603 static const yytype_int8 yyrhs[] =
605 69, 0, -1, 71, -1, 70, -1, 79, -1, 72,
606 -1, 71, 31, 72, -1, 52, 72, -1, 39, 72,
607 -1, 51, 72, -1, 50, 72, -1, 62, 72, -1,
608 38, 72, -1, 72, 56, -1, 72, 55, -1, 72,
609 58, 80, -1, 72, 58, 80, 10, -1, 72, 58,
610 10, -1, 72, 59, 71, 63, -1, -1, 72, 60,
611 73, 75, 64, -1, 65, -1, -1, 72, -1, 75,
612 31, 72, -1, 66, -1, 74, 79, 76, 72, -1,
613 79, 60, 72, 64, -1, 60, 71, 64, -1, 72,
614 49, 72, -1, 72, 52, 72, -1, 72, 53, 72,
615 -1, 72, 54, 72, -1, 72, 50, 72, -1, 72,
616 51, 72, -1, 72, 48, 72, -1, 72, 47, 72,
617 -1, 72, 42, 72, -1, 72, 41, 72, -1, 72,
618 46, 72, -1, 72, 45, 72, -1, 72, 43, 72,
619 -1, 72, 44, 72, -1, 72, 39, 72, -1, 72,
620 38, 72, -1, 72, 37, 72, -1, 72, 36, 72,
621 -1, 72, 35, 72, -1, 72, 34, 72, 67, 72,
622 -1, 72, 33, 72, -1, 72, 30, 72, -1, 3,
623 -1, 7, -1, 11, -1, 4, -1, 78, -1, 29,
624 -1, 18, 60, 79, 64, -1, 18, 60, 72, 64,
625 -1, 6, -1, 77, 50, 6, -1, 77, -1, 12,
626 -1, 13, -1, 80, 26, -1, 80, -1, 52, 79,
627 -1, 9, -1, 28, -1, 8, -1
630 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
631 static const yytype_uint16 yyrline[] =
633 0, 237, 237, 238, 241, 248, 249, 254, 258, 262,
634 266, 270, 274, 278, 282, 288, 294, 301, 311, 318,
635 315, 325, 329, 332, 336, 340, 344, 350, 356, 362,
636 366, 370, 374, 378, 382, 386, 390, 394, 398, 402,
637 406, 410, 414, 418, 422, 426, 430, 434, 438, 442,
638 446, 452, 459, 468, 481, 488, 491, 497, 509, 516,
639 533, 551, 562, 568, 574, 590, 645, 647, 654, 667
643 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
644 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
645 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
646 static const char *const yytname[] =
648 "$end", "error", "$undefined", "INT", "FLOAT", "RAW_STRING", "STRING",
649 "CHAR", "NAME", "TYPENAME", "COMPLETE", "NAME_OR_INT", "TRUE_KEYWORD",
650 "FALSE_KEYWORD", "STRUCT_KEYWORD", "INTERFACE_KEYWORD", "TYPE_KEYWORD",
651 "CHAN_KEYWORD", "SIZEOF_KEYWORD", "LEN_KEYWORD", "CAP_KEYWORD",
652 "NEW_KEYWORD", "IOTA_KEYWORD", "NIL_KEYWORD", "CONST_KEYWORD",
653 "DOTDOTDOT", "ENTRY", "ERROR", "BYTE_KEYWORD", "DOLLAR_VARIABLE",
654 "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND",
655 "'|'", "'^'", "'&'", "ANDNOT", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ",
656 "LEQ", "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'",
657 "DECREMENT", "INCREMENT", "UNARY", "'.'", "'['", "'('", "LEFT_ARROW",
658 "'!'", "']'", "')'", "'{'", "'}'", "':'", "$accept", "start", "type_exp",
659 "exp1", "exp", "$@1", "lcurly", "arglist", "rcurly", "string_exp",
660 "variable", "type", "name_not_typename", 0
665 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
667 static const yytype_uint16 yytoknum[] =
669 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
670 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
671 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
672 285, 44, 286, 61, 63, 287, 288, 124, 94, 38,
673 289, 290, 291, 60, 62, 292, 293, 294, 295, 64,
674 43, 45, 42, 47, 37, 296, 297, 298, 46, 91,
675 40, 299, 33, 93, 41, 123, 125, 58
679 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
680 static const yytype_uint8 yyr1[] =
682 0, 68, 69, 69, 70, 71, 71, 72, 72, 72,
683 72, 72, 72, 72, 72, 72, 72, 72, 72, 73,
684 72, 74, 75, 75, 75, 76, 72, 72, 72, 72,
685 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
686 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
687 72, 72, 72, 72, 72, 72, 72, 72, 72, 77,
688 77, 72, 72, 72, 78, 78, 79, 79, 79, 80
691 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
692 static const yytype_uint8 yyr2[] =
694 0, 2, 1, 1, 1, 1, 3, 2, 2, 2,
695 2, 2, 2, 2, 2, 3, 4, 3, 4, 0,
696 5, 1, 0, 1, 3, 1, 4, 4, 3, 3,
697 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
698 3, 3, 3, 3, 3, 3, 3, 3, 5, 3,
699 3, 1, 1, 1, 1, 1, 1, 4, 4, 1,
700 3, 1, 1, 1, 2, 1, 2, 1, 1, 1
703 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
704 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
705 means the default is an error. */
706 static const yytype_uint8 yydefact[] =
708 0, 51, 54, 59, 52, 69, 67, 53, 62, 63,
709 0, 68, 56, 0, 0, 0, 0, 0, 0, 0,
710 21, 0, 3, 2, 5, 0, 61, 55, 4, 65,
711 0, 12, 0, 8, 10, 9, 7, 66, 0, 11,
712 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
713 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
714 0, 0, 0, 0, 14, 13, 0, 0, 19, 0,
715 0, 0, 0, 64, 0, 0, 28, 6, 50, 49,
716 0, 47, 46, 45, 44, 43, 38, 37, 41, 42,
717 40, 39, 36, 35, 29, 33, 34, 30, 31, 32,
718 17, 15, 0, 22, 66, 25, 0, 60, 0, 58,
719 57, 0, 16, 18, 23, 0, 26, 27, 48, 0,
723 /* YYDEFGOTO[NTERM-NUM]. */
724 static const yytype_int8 yydefgoto[] =
726 -1, 21, 22, 23, 24, 103, 25, 115, 106, 26,
730 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
732 #define YYPACT_NINF -56
733 static const yytype_int16 yypact[] =
735 49, -56, -56, -56, -56, -56, -56, -56, -56, -56,
736 -44, -56, -56, 49, 49, 49, 49, 49, 49, 49,
737 -56, 23, -56, 34, 187, 45, -23, -56, 6, 46,
738 49, -48, 6, -48, -48, -48, -48, 6, 38, -48,
739 -56, 49, 49, 49, 49, 49, 49, 49, 49, 49,
740 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
741 49, 49, 49, 49, -56, -56, 5, 49, -56, 45,
742 8, 65, 49, -56, 123, -55, -56, 187, 187, 187,
743 88, 239, 263, 286, 308, 328, 346, 346, 360, 360,
744 360, 360, 372, 372, 383, -34, -34, -48, -48, -48,
745 -56, 69, 33, 49, -56, -56, 49, -56, 155, -56,
746 -56, 49, -56, -56, 187, 39, -48, -56, 214, 49,
750 /* YYPGOTO[NTERM-NUM]. */
751 static const yytype_int8 yypgoto[] =
753 -56, -56, -56, -4, -13, -56, -56, -56, -56, -56,
757 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
758 positive, shift that token. If negative, reduce the rule which
759 number is the opposite. If zero, do what YYDEFACT says.
760 If YYTABLE_NINF, syntax error. */
761 #define YYTABLE_NINF -1
762 static const yytype_uint8 yytable[] =
764 31, 33, 34, 35, 36, 72, 39, 64, 65, 110,
765 66, 67, 68, 5, 38, 100, 30, 74, 61, 62,
766 63, 64, 65, 40, 66, 67, 68, 71, 77, 78,
767 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
768 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
769 99, 28, 1, 2, 6, 3, 4, 5, 6, 108,
770 7, 8, 9, 102, 41, 41, 72, 10, 37, 41,
771 119, 107, 73, 11, 105, 101, 70, 11, 12, 112,
772 0, 75, 0, 0, 0, 0, 0, 13, 14, 0,
773 114, 0, 0, 116, 0, 0, 113, 69, 118, 15,
774 16, 17, 76, 120, 0, 0, 121, 0, 0, 18,
775 0, 19, 0, 0, 20, 0, 0, 0, 42, 0,
776 104, 43, 44, 45, 46, 47, 48, 49, 0, 50,
777 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
778 61, 62, 63, 64, 65, 0, 66, 67, 68, 0,
779 0, 0, 0, 42, 0, 111, 43, 44, 45, 46,
780 47, 48, 49, 0, 50, 51, 52, 53, 54, 55,
781 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
782 0, 66, 67, 68, 0, 42, 0, 109, 43, 44,
783 45, 46, 47, 48, 49, 0, 50, 51, 52, 53,
784 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
785 64, 65, 0, 66, 67, 68, 0, 42, 0, 117,
786 43, 44, 45, 46, 47, 48, 49, 0, 50, 51,
787 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
788 62, 63, 64, 65, 0, 66, 67, 68, 44, 45,
789 46, 47, 48, 49, 0, 50, 51, 52, 53, 54,
790 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
791 65, 0, 66, 67, 68, 46, 47, 48, 49, 0,
792 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
793 60, 61, 62, 63, 64, 65, 0, 66, 67, 68,
794 47, 48, 49, 0, 50, 51, 52, 53, 54, 55,
795 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
796 0, 66, 67, 68, 48, 49, 0, 50, 51, 52,
797 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
798 63, 64, 65, 0, 66, 67, 68, 49, 0, 50,
799 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
800 61, 62, 63, 64, 65, 0, 66, 67, 68, 50,
801 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
802 61, 62, 63, 64, 65, 0, 66, 67, 68, 52,
803 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
804 63, 64, 65, 0, 66, 67, 68, 56, 57, 58,
805 59, 60, 61, 62, 63, 64, 65, 0, 66, 67,
806 68, 58, 59, 60, 61, 62, 63, 64, 65, 0,
807 66, 67, 68, 59, 60, 61, 62, 63, 64, 65,
811 static const yytype_int8 yycheck[] =
813 13, 14, 15, 16, 17, 60, 19, 55, 56, 64,
814 58, 59, 60, 8, 18, 10, 60, 30, 52, 53,
815 54, 55, 56, 0, 58, 59, 60, 50, 41, 42,
816 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
817 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
818 63, 0, 3, 4, 9, 6, 7, 8, 9, 72,
819 11, 12, 13, 67, 31, 31, 60, 18, 17, 31,
820 31, 6, 26, 28, 66, 66, 25, 28, 29, 10,
821 -1, 30, -1, -1, -1, -1, -1, 38, 39, -1,
822 103, -1, -1, 106, -1, -1, 63, 52, 111, 50,
823 51, 52, 64, 64, -1, -1, 119, -1, -1, 60,
824 -1, 62, -1, -1, 65, -1, -1, -1, 30, -1,
825 69, 33, 34, 35, 36, 37, 38, 39, -1, 41,
826 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
827 52, 53, 54, 55, 56, -1, 58, 59, 60, -1,
828 -1, -1, -1, 30, -1, 67, 33, 34, 35, 36,
829 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
830 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
831 -1, 58, 59, 60, -1, 30, -1, 64, 33, 34,
832 35, 36, 37, 38, 39, -1, 41, 42, 43, 44,
833 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
834 55, 56, -1, 58, 59, 60, -1, 30, -1, 64,
835 33, 34, 35, 36, 37, 38, 39, -1, 41, 42,
836 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
837 53, 54, 55, 56, -1, 58, 59, 60, 34, 35,
838 36, 37, 38, 39, -1, 41, 42, 43, 44, 45,
839 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
840 56, -1, 58, 59, 60, 36, 37, 38, 39, -1,
841 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
842 51, 52, 53, 54, 55, 56, -1, 58, 59, 60,
843 37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
844 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
845 -1, 58, 59, 60, 38, 39, -1, 41, 42, 43,
846 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
847 54, 55, 56, -1, 58, 59, 60, 39, -1, 41,
848 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
849 52, 53, 54, 55, 56, -1, 58, 59, 60, 41,
850 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
851 52, 53, 54, 55, 56, -1, 58, 59, 60, 43,
852 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
853 54, 55, 56, -1, 58, 59, 60, 47, 48, 49,
854 50, 51, 52, 53, 54, 55, 56, -1, 58, 59,
855 60, 49, 50, 51, 52, 53, 54, 55, 56, -1,
856 58, 59, 60, 50, 51, 52, 53, 54, 55, 56,
860 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
861 symbol of state STATE-NUM. */
862 static const yytype_uint8 yystos[] =
864 0, 3, 4, 6, 7, 8, 9, 11, 12, 13,
865 18, 28, 29, 38, 39, 50, 51, 52, 60, 62,
866 65, 69, 70, 71, 72, 74, 77, 78, 79, 80,
867 60, 72, 79, 72, 72, 72, 72, 79, 71, 72,
868 0, 31, 30, 33, 34, 35, 36, 37, 38, 39,
869 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
870 51, 52, 53, 54, 55, 56, 58, 59, 60, 52,
871 79, 50, 60, 26, 72, 79, 64, 72, 72, 72,
872 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
873 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
874 10, 80, 71, 73, 79, 66, 76, 6, 72, 64,
875 64, 67, 10, 63, 72, 75, 72, 64, 72, 31,
879 #define yyerrok (yyerrstatus = 0)
880 #define yyclearin (yychar = YYEMPTY)
884 #define YYACCEPT goto yyacceptlab
885 #define YYABORT goto yyabortlab
886 #define YYERROR goto yyerrorlab
889 /* Like YYERROR except do call yyerror. This remains here temporarily
890 to ease the transition to the new meaning of YYERROR, for GCC.
891 Once GCC version 2 has supplanted version 1, this can go. */
893 #define YYFAIL goto yyerrlab
895 #define YYRECOVERING() (!!yyerrstatus)
897 #define YYBACKUP(Token, Value) \
899 if (yychar == YYEMPTY && yylen == 1) \
903 yytoken = YYTRANSLATE (yychar); \
909 yyerror (YY_("syntax error: cannot back up")); \
916 #define YYERRCODE 256
919 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
920 If N is 0, then set CURRENT to the empty location which ends
921 the previous symbol: RHS[0] (always defined). */
923 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
924 #ifndef YYLLOC_DEFAULT
925 # define YYLLOC_DEFAULT(Current, Rhs, N) \
929 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
930 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
931 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
932 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
936 (Current).first_line = (Current).last_line = \
937 YYRHSLOC (Rhs, 0).last_line; \
938 (Current).first_column = (Current).last_column = \
939 YYRHSLOC (Rhs, 0).last_column; \
945 /* YY_LOCATION_PRINT -- Print the location on the stream.
946 This macro was not mandated originally: define only if we know
947 we won't break user code: when these are the locations we know. */
949 #ifndef YY_LOCATION_PRINT
950 # if YYLTYPE_IS_TRIVIAL
951 # define YY_LOCATION_PRINT(File, Loc) \
952 fprintf (File, "%d.%d-%d.%d", \
953 (Loc).first_line, (Loc).first_column, \
954 (Loc).last_line, (Loc).last_column)
956 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
961 /* YYLEX -- calling `yylex' with the right arguments. */
964 # define YYLEX yylex (YYLEX_PARAM)
966 # define YYLEX yylex ()
969 /* Enable debugging if requested. */
973 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
974 # define YYFPRINTF fprintf
977 # define YYDPRINTF(Args) \
983 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
987 YYFPRINTF (stderr, "%s ", Title); \
988 yy_symbol_print (stderr, \
990 YYFPRINTF (stderr, "\n"); \
995 /*--------------------------------.
996 | Print this symbol on YYOUTPUT. |
997 `--------------------------------*/
1000 #if (defined __STDC__ || defined __C99__FUNC__ \
1001 || defined __cplusplus || defined _MSC_VER)
1003 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1006 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
1009 YYSTYPE const * const yyvaluep;
1015 if (yytype < YYNTOKENS)
1016 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1028 /*--------------------------------.
1029 | Print this symbol on YYOUTPUT. |
1030 `--------------------------------*/
1032 #if (defined __STDC__ || defined __C99__FUNC__ \
1033 || defined __cplusplus || defined _MSC_VER)
1035 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1038 yy_symbol_print (yyoutput, yytype, yyvaluep)
1041 YYSTYPE const * const yyvaluep;
1044 if (yytype < YYNTOKENS)
1045 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1047 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1049 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1050 YYFPRINTF (yyoutput, ")");
1053 /*------------------------------------------------------------------.
1054 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1056 `------------------------------------------------------------------*/
1058 #if (defined __STDC__ || defined __C99__FUNC__ \
1059 || defined __cplusplus || defined _MSC_VER)
1061 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1064 yy_stack_print (yybottom, yytop)
1065 yytype_int16 *yybottom;
1066 yytype_int16 *yytop;
1069 YYFPRINTF (stderr, "Stack now");
1070 for (; yybottom <= yytop; yybottom++)
1072 int yybot = *yybottom;
1073 YYFPRINTF (stderr, " %d", yybot);
1075 YYFPRINTF (stderr, "\n");
1078 # define YY_STACK_PRINT(Bottom, Top) \
1081 yy_stack_print ((Bottom), (Top)); \
1085 /*------------------------------------------------.
1086 | Report that the YYRULE is going to be reduced. |
1087 `------------------------------------------------*/
1089 #if (defined __STDC__ || defined __C99__FUNC__ \
1090 || defined __cplusplus || defined _MSC_VER)
1092 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1095 yy_reduce_print (yyvsp, yyrule)
1100 int yynrhs = yyr2[yyrule];
1102 unsigned long int yylno = yyrline[yyrule];
1103 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1105 /* The symbols being reduced. */
1106 for (yyi = 0; yyi < yynrhs; yyi++)
1108 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1109 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1110 &(yyvsp[(yyi + 1) - (yynrhs)])
1112 YYFPRINTF (stderr, "\n");
1116 # define YY_REDUCE_PRINT(Rule) \
1119 yy_reduce_print (yyvsp, Rule); \
1122 /* Nonzero means print parse trace. It is left uninitialized so that
1123 multiple parsers can coexist. */
1125 #else /* !YYDEBUG */
1126 # define YYDPRINTF(Args)
1127 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1128 # define YY_STACK_PRINT(Bottom, Top)
1129 # define YY_REDUCE_PRINT(Rule)
1130 #endif /* !YYDEBUG */
1133 /* YYINITDEPTH -- initial size of the parser's stacks. */
1135 # define YYINITDEPTH 200
1138 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1139 if the built-in stack extension method is used).
1141 Do not make this value too large; the results are undefined if
1142 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1143 evaluated with infinite-precision integer arithmetic. */
1146 # define YYMAXDEPTH 10000
1154 # if defined __GLIBC__ && defined _STRING_H
1155 # define yystrlen strlen
1157 /* Return the length of YYSTR. */
1158 #if (defined __STDC__ || defined __C99__FUNC__ \
1159 || defined __cplusplus || defined _MSC_VER)
1161 yystrlen (const char *yystr)
1169 for (yylen = 0; yystr[yylen]; yylen++)
1177 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1178 # define yystpcpy stpcpy
1180 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1182 #if (defined __STDC__ || defined __C99__FUNC__ \
1183 || defined __cplusplus || defined _MSC_VER)
1185 yystpcpy (char *yydest, const char *yysrc)
1188 yystpcpy (yydest, yysrc)
1194 const char *yys = yysrc;
1196 while ((*yyd++ = *yys++) != '\0')
1205 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1206 quotes and backslashes, so that it's suitable for yyerror. The
1207 heuristic is that double-quoting is unnecessary unless the string
1208 contains an apostrophe, a comma, or backslash (other than
1209 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1210 null, do not copy; instead, return the length of what the result
1213 yytnamerr (char *yyres, const char *yystr)
1218 char const *yyp = yystr;
1225 goto do_not_strip_quotes;
1229 goto do_not_strip_quotes;
1242 do_not_strip_quotes: ;
1246 return yystrlen (yystr);
1248 return yystpcpy (yyres, yystr) - yyres;
1252 /* Copy into YYRESULT an error message about the unexpected token
1253 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1254 including the terminating null byte. If YYRESULT is null, do not
1255 copy anything; just return the number of bytes that would be
1256 copied. As a special case, return 0 if an ordinary "syntax error"
1257 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1258 size calculation. */
1260 yysyntax_error (char *yyresult, int yystate, int yychar)
1262 int yyn = yypact[yystate];
1264 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1268 int yytype = YYTRANSLATE (yychar);
1269 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1270 YYSIZE_T yysize = yysize0;
1272 int yysize_overflow = 0;
1273 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1274 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1278 /* This is so xgettext sees the translatable formats that are
1279 constructed on the fly. */
1280 YY_("syntax error, unexpected %s");
1281 YY_("syntax error, unexpected %s, expecting %s");
1282 YY_("syntax error, unexpected %s, expecting %s or %s");
1283 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1284 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1288 static char const yyunexpected[] = "syntax error, unexpected %s";
1289 static char const yyexpecting[] = ", expecting %s";
1290 static char const yyor[] = " or %s";
1291 char yyformat[sizeof yyunexpected
1292 + sizeof yyexpecting - 1
1293 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1294 * (sizeof yyor - 1))];
1295 char const *yyprefix = yyexpecting;
1297 /* Start YYX at -YYN if negative to avoid negative indexes in
1299 int yyxbegin = yyn < 0 ? -yyn : 0;
1301 /* Stay within bounds of both yycheck and yytname. */
1302 int yychecklim = YYLAST - yyn + 1;
1303 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1306 yyarg[0] = yytname[yytype];
1307 yyfmt = yystpcpy (yyformat, yyunexpected);
1309 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1310 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1312 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1316 yyformat[sizeof yyunexpected - 1] = '\0';
1319 yyarg[yycount++] = yytname[yyx];
1320 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1321 yysize_overflow |= (yysize1 < yysize);
1323 yyfmt = yystpcpy (yyfmt, yyprefix);
1327 yyf = YY_(yyformat);
1328 yysize1 = yysize + yystrlen (yyf);
1329 yysize_overflow |= (yysize1 < yysize);
1332 if (yysize_overflow)
1333 return YYSIZE_MAXIMUM;
1337 /* Avoid sprintf, as that infringes on the user's name space.
1338 Don't have undefined behavior even if the translation
1339 produced a string with the wrong number of "%s"s. */
1340 char *yyp = yyresult;
1342 while ((*yyp = *yyf) != '\0')
1344 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1346 yyp += yytnamerr (yyp, yyarg[yyi++]);
1359 #endif /* YYERROR_VERBOSE */
1362 /*-----------------------------------------------.
1363 | Release the memory associated to this symbol. |
1364 `-----------------------------------------------*/
1367 #if (defined __STDC__ || defined __C99__FUNC__ \
1368 || defined __cplusplus || defined _MSC_VER)
1370 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1373 yydestruct (yymsg, yytype, yyvaluep)
1383 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1393 /* Prevent warnings from -Wmissing-prototypes. */
1394 #ifdef YYPARSE_PARAM
1395 #if defined __STDC__ || defined __cplusplus
1396 int yyparse (void *YYPARSE_PARAM);
1400 #else /* ! YYPARSE_PARAM */
1401 #if defined __STDC__ || defined __cplusplus
1406 #endif /* ! YYPARSE_PARAM */
1409 /* The lookahead symbol. */
1412 /* The semantic value of the lookahead symbol. */
1415 /* Number of syntax errors so far. */
1420 /*-------------------------.
1421 | yyparse or yypush_parse. |
1422 `-------------------------*/
1424 #ifdef YYPARSE_PARAM
1425 #if (defined __STDC__ || defined __C99__FUNC__ \
1426 || defined __cplusplus || defined _MSC_VER)
1428 yyparse (void *YYPARSE_PARAM)
1431 yyparse (YYPARSE_PARAM)
1432 void *YYPARSE_PARAM;
1434 #else /* ! YYPARSE_PARAM */
1435 #if (defined __STDC__ || defined __C99__FUNC__ \
1436 || defined __cplusplus || defined _MSC_VER)
1449 /* Number of tokens to shift before error messages enabled. */
1452 /* The stacks and their tools:
1453 `yyss': related to states.
1454 `yyvs': related to semantic values.
1456 Refer to the stacks thru separate pointers, to allow yyoverflow
1457 to xreallocate them elsewhere. */
1459 /* The state stack. */
1460 yytype_int16 yyssa[YYINITDEPTH];
1462 yytype_int16 *yyssp;
1464 /* The semantic value stack. */
1465 YYSTYPE yyvsa[YYINITDEPTH];
1469 YYSIZE_T yystacksize;
1473 /* Lookahead token as an internal (translated) token number. */
1475 /* The variables used to return semantic value and location from the
1480 /* Buffer for error messages, and its allocated size. */
1482 char *yymsg = yymsgbuf;
1483 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1486 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1488 /* The number of symbols on the RHS of the reduced rule.
1489 Keep to zero when no symbol should be popped. */
1495 yystacksize = YYINITDEPTH;
1497 YYDPRINTF ((stderr, "Starting parse\n"));
1502 yychar = YYEMPTY; /* Cause a token to be read. */
1504 /* Initialize stack pointers.
1505 Waste one element of value and location stack
1506 so that they stay on the same level as the state stack.
1507 The wasted elements are never initialized. */
1513 /*------------------------------------------------------------.
1514 | yynewstate -- Push a new state, which is found in yystate. |
1515 `------------------------------------------------------------*/
1517 /* In all cases, when you get here, the value and location stacks
1518 have just been pushed. So pushing a state here evens the stacks. */
1524 if (yyss + yystacksize - 1 <= yyssp)
1526 /* Get the current used size of the three stacks, in elements. */
1527 YYSIZE_T yysize = yyssp - yyss + 1;
1531 /* Give user a chance to xreallocate the stack. Use copies of
1532 these so that the &'s don't force the real ones into
1534 YYSTYPE *yyvs1 = yyvs;
1535 yytype_int16 *yyss1 = yyss;
1537 /* Each stack pointer address is followed by the size of the
1538 data in use in that stack, in bytes. This used to be a
1539 conditional around just the two extra args, but that might
1540 be undefined if yyoverflow is a macro. */
1541 yyoverflow (YY_("memory exhausted"),
1542 &yyss1, yysize * sizeof (*yyssp),
1543 &yyvs1, yysize * sizeof (*yyvsp),
1549 #else /* no yyoverflow */
1550 # ifndef YYSTACK_RELOCATE
1551 goto yyexhaustedlab;
1553 /* Extend the stack our own way. */
1554 if (YYMAXDEPTH <= yystacksize)
1555 goto yyexhaustedlab;
1557 if (YYMAXDEPTH < yystacksize)
1558 yystacksize = YYMAXDEPTH;
1561 yytype_int16 *yyss1 = yyss;
1562 union yyalloc *yyptr =
1563 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1565 goto yyexhaustedlab;
1566 YYSTACK_RELOCATE (yyss_alloc, yyss);
1567 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1568 # undef YYSTACK_RELOCATE
1570 YYSTACK_FREE (yyss1);
1573 #endif /* no yyoverflow */
1575 yyssp = yyss + yysize - 1;
1576 yyvsp = yyvs + yysize - 1;
1578 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1579 (unsigned long int) yystacksize));
1581 if (yyss + yystacksize - 1 <= yyssp)
1585 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1587 if (yystate == YYFINAL)
1597 /* Do appropriate processing given the current state. Read a
1598 lookahead token if we need one and don't already have one. */
1600 /* First try to decide what to do without reference to lookahead token. */
1601 yyn = yypact[yystate];
1602 if (yyn == YYPACT_NINF)
1605 /* Not known => get a lookahead token if don't already have one. */
1607 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1608 if (yychar == YYEMPTY)
1610 YYDPRINTF ((stderr, "Reading a token: "));
1614 if (yychar <= YYEOF)
1616 yychar = yytoken = YYEOF;
1617 YYDPRINTF ((stderr, "Now at end of input.\n"));
1621 yytoken = YYTRANSLATE (yychar);
1622 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1625 /* If the proper action on seeing token YYTOKEN is to reduce or to
1626 detect an error, take that action. */
1628 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1633 if (yyn == 0 || yyn == YYTABLE_NINF)
1639 /* Count tokens shifted since error; after three, turn off error
1644 /* Shift the lookahead token. */
1645 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1647 /* Discard the shifted token. */
1656 /*-----------------------------------------------------------.
1657 | yydefault -- do the default action for the current state. |
1658 `-----------------------------------------------------------*/
1660 yyn = yydefact[yystate];
1666 /*-----------------------------.
1667 | yyreduce -- Do a reduction. |
1668 `-----------------------------*/
1670 /* yyn is the number of a rule to reduce with. */
1673 /* If YYLEN is nonzero, implement the default value of the action:
1676 Otherwise, the following line sets YYVAL to garbage.
1677 This behavior is undocumented and Bison
1678 users should not rely upon it. Assigning to YYVAL
1679 unconditionally makes the parser a bit smaller, and it avoids a
1680 GCC warning that YYVAL may be used uninitialized. */
1681 yyval = yyvsp[1-yylen];
1684 YY_REDUCE_PRINT (yyn);
1689 /* Line 1455 of yacc.c */
1690 #line 242 "go-exp.y"
1691 { write_exp_elt_opcode(OP_TYPE);
1692 write_exp_elt_type((yyvsp[(1) - (1)].tval));
1693 write_exp_elt_opcode(OP_TYPE); }
1698 /* Line 1455 of yacc.c */
1699 #line 250 "go-exp.y"
1700 { write_exp_elt_opcode (BINOP_COMMA); }
1705 /* Line 1455 of yacc.c */
1706 #line 255 "go-exp.y"
1707 { write_exp_elt_opcode (UNOP_IND); }
1712 /* Line 1455 of yacc.c */
1713 #line 259 "go-exp.y"
1714 { write_exp_elt_opcode (UNOP_ADDR); }
1719 /* Line 1455 of yacc.c */
1720 #line 263 "go-exp.y"
1721 { write_exp_elt_opcode (UNOP_NEG); }
1726 /* Line 1455 of yacc.c */
1727 #line 267 "go-exp.y"
1728 { write_exp_elt_opcode (UNOP_PLUS); }
1733 /* Line 1455 of yacc.c */
1734 #line 271 "go-exp.y"
1735 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1740 /* Line 1455 of yacc.c */
1741 #line 275 "go-exp.y"
1742 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1747 /* Line 1455 of yacc.c */
1748 #line 279 "go-exp.y"
1749 { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1754 /* Line 1455 of yacc.c */
1755 #line 283 "go-exp.y"
1756 { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1761 /* Line 1455 of yacc.c */
1762 #line 289 "go-exp.y"
1763 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1764 write_exp_string ((yyvsp[(3) - (3)].ssym).stoken);
1765 write_exp_elt_opcode (STRUCTOP_STRUCT); }
1770 /* Line 1455 of yacc.c */
1771 #line 295 "go-exp.y"
1772 { mark_struct_expression ();
1773 write_exp_elt_opcode (STRUCTOP_STRUCT);
1774 write_exp_string ((yyvsp[(3) - (4)].ssym).stoken);
1775 write_exp_elt_opcode (STRUCTOP_STRUCT); }
1780 /* Line 1455 of yacc.c */
1781 #line 302 "go-exp.y"
1783 mark_struct_expression ();
1784 write_exp_elt_opcode (STRUCTOP_STRUCT);
1787 write_exp_string (s);
1788 write_exp_elt_opcode (STRUCTOP_STRUCT); }
1793 /* Line 1455 of yacc.c */
1794 #line 312 "go-exp.y"
1795 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1800 /* Line 1455 of yacc.c */
1801 #line 318 "go-exp.y"
1802 { start_arglist (); }
1807 /* Line 1455 of yacc.c */
1808 #line 320 "go-exp.y"
1809 { write_exp_elt_opcode (OP_FUNCALL);
1810 write_exp_elt_longcst ((LONGEST) end_arglist ());
1811 write_exp_elt_opcode (OP_FUNCALL); }
1816 /* Line 1455 of yacc.c */
1817 #line 326 "go-exp.y"
1818 { start_arglist (); }
1823 /* Line 1455 of yacc.c */
1824 #line 333 "go-exp.y"
1825 { arglist_len = 1; }
1830 /* Line 1455 of yacc.c */
1831 #line 337 "go-exp.y"
1837 /* Line 1455 of yacc.c */
1838 #line 341 "go-exp.y"
1839 { (yyval.lval) = end_arglist () - 1; }
1844 /* Line 1455 of yacc.c */
1845 #line 345 "go-exp.y"
1846 { write_exp_elt_opcode (UNOP_MEMVAL);
1847 write_exp_elt_type ((yyvsp[(2) - (4)].tval));
1848 write_exp_elt_opcode (UNOP_MEMVAL); }
1853 /* Line 1455 of yacc.c */
1854 #line 351 "go-exp.y"
1855 { write_exp_elt_opcode (UNOP_CAST);
1856 write_exp_elt_type ((yyvsp[(1) - (4)].tval));
1857 write_exp_elt_opcode (UNOP_CAST); }
1862 /* Line 1455 of yacc.c */
1863 #line 357 "go-exp.y"
1869 /* Line 1455 of yacc.c */
1870 #line 363 "go-exp.y"
1871 { write_exp_elt_opcode (BINOP_REPEAT); }
1876 /* Line 1455 of yacc.c */
1877 #line 367 "go-exp.y"
1878 { write_exp_elt_opcode (BINOP_MUL); }
1883 /* Line 1455 of yacc.c */
1884 #line 371 "go-exp.y"
1885 { write_exp_elt_opcode (BINOP_DIV); }
1890 /* Line 1455 of yacc.c */
1891 #line 375 "go-exp.y"
1892 { write_exp_elt_opcode (BINOP_REM); }
1897 /* Line 1455 of yacc.c */
1898 #line 379 "go-exp.y"
1899 { write_exp_elt_opcode (BINOP_ADD); }
1904 /* Line 1455 of yacc.c */
1905 #line 383 "go-exp.y"
1906 { write_exp_elt_opcode (BINOP_SUB); }
1911 /* Line 1455 of yacc.c */
1912 #line 387 "go-exp.y"
1913 { write_exp_elt_opcode (BINOP_LSH); }
1918 /* Line 1455 of yacc.c */
1919 #line 391 "go-exp.y"
1920 { write_exp_elt_opcode (BINOP_RSH); }
1925 /* Line 1455 of yacc.c */
1926 #line 395 "go-exp.y"
1927 { write_exp_elt_opcode (BINOP_EQUAL); }
1932 /* Line 1455 of yacc.c */
1933 #line 399 "go-exp.y"
1934 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1939 /* Line 1455 of yacc.c */
1940 #line 403 "go-exp.y"
1941 { write_exp_elt_opcode (BINOP_LEQ); }
1946 /* Line 1455 of yacc.c */
1947 #line 407 "go-exp.y"
1948 { write_exp_elt_opcode (BINOP_GEQ); }
1953 /* Line 1455 of yacc.c */
1954 #line 411 "go-exp.y"
1955 { write_exp_elt_opcode (BINOP_LESS); }
1960 /* Line 1455 of yacc.c */
1961 #line 415 "go-exp.y"
1962 { write_exp_elt_opcode (BINOP_GTR); }
1967 /* Line 1455 of yacc.c */
1968 #line 419 "go-exp.y"
1969 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1974 /* Line 1455 of yacc.c */
1975 #line 423 "go-exp.y"
1976 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1981 /* Line 1455 of yacc.c */
1982 #line 427 "go-exp.y"
1983 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1988 /* Line 1455 of yacc.c */
1989 #line 431 "go-exp.y"
1990 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1995 /* Line 1455 of yacc.c */
1996 #line 435 "go-exp.y"
1997 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
2002 /* Line 1455 of yacc.c */
2003 #line 439 "go-exp.y"
2004 { write_exp_elt_opcode (TERNOP_COND); }
2009 /* Line 1455 of yacc.c */
2010 #line 443 "go-exp.y"
2011 { write_exp_elt_opcode (BINOP_ASSIGN); }
2016 /* Line 1455 of yacc.c */
2017 #line 447 "go-exp.y"
2018 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
2019 write_exp_elt_opcode ((yyvsp[(2) - (3)].opcode));
2020 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
2025 /* Line 1455 of yacc.c */
2026 #line 453 "go-exp.y"
2027 { write_exp_elt_opcode (OP_LONG);
2028 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_int).type);
2029 write_exp_elt_longcst ((LONGEST)((yyvsp[(1) - (1)].typed_val_int).val));
2030 write_exp_elt_opcode (OP_LONG); }
2035 /* Line 1455 of yacc.c */
2036 #line 460 "go-exp.y"
2038 struct stoken_vector vec;
2040 vec.tokens = &(yyvsp[(1) - (1)].tsval);
2041 write_exp_string_vector ((yyvsp[(1) - (1)].tsval).type, &vec);
2047 /* Line 1455 of yacc.c */
2048 #line 469 "go-exp.y"
2050 parse_number ((yyvsp[(1) - (1)].ssym).stoken.ptr, (yyvsp[(1) - (1)].ssym).stoken.length,
2052 write_exp_elt_opcode (OP_LONG);
2053 write_exp_elt_type (val.typed_val_int.type);
2054 write_exp_elt_longcst ((LONGEST)
2055 val.typed_val_int.val);
2056 write_exp_elt_opcode (OP_LONG);
2062 /* Line 1455 of yacc.c */
2063 #line 482 "go-exp.y"
2064 { write_exp_elt_opcode (OP_DOUBLE);
2065 write_exp_elt_type ((yyvsp[(1) - (1)].typed_val_float).type);
2066 write_exp_elt_dblcst ((yyvsp[(1) - (1)].typed_val_float).dval);
2067 write_exp_elt_opcode (OP_DOUBLE); }
2072 /* Line 1455 of yacc.c */
2073 #line 492 "go-exp.y"
2075 write_dollar_variable ((yyvsp[(1) - (1)].sval));
2081 /* Line 1455 of yacc.c */
2082 #line 498 "go-exp.y"
2084 /* TODO(dje): Go objects in structs. */
2085 write_exp_elt_opcode (OP_LONG);
2086 /* TODO(dje): What's the right type here? */
2087 write_exp_elt_type (parse_type->builtin_unsigned_int);
2088 CHECK_TYPEDEF ((yyvsp[(3) - (4)].tval));
2089 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH ((yyvsp[(3) - (4)].tval)));
2090 write_exp_elt_opcode (OP_LONG);
2096 /* Line 1455 of yacc.c */
2097 #line 510 "go-exp.y"
2099 /* TODO(dje): Go objects in structs. */
2100 write_exp_elt_opcode (UNOP_SIZEOF);
2106 /* Line 1455 of yacc.c */
2107 #line 517 "go-exp.y"
2109 /* We copy the string here, and not in the
2110 lexer, to guarantee that we do not leak a
2112 /* Note that we NUL-terminate here, but just
2114 struct typed_stoken *vec = XNEW (struct typed_stoken);
2115 (yyval.svec).len = 1;
2116 (yyval.svec).tokens = vec;
2118 vec->type = (yyvsp[(1) - (1)].tsval).type;
2119 vec->length = (yyvsp[(1) - (1)].tsval).length;
2120 vec->ptr = xmalloc ((yyvsp[(1) - (1)].tsval).length + 1);
2121 memcpy (vec->ptr, (yyvsp[(1) - (1)].tsval).ptr, (yyvsp[(1) - (1)].tsval).length + 1);
2127 /* Line 1455 of yacc.c */
2128 #line 534 "go-exp.y"
2130 /* Note that we NUL-terminate here, but just
2134 (yyval.svec).tokens = xrealloc ((yyval.svec).tokens,
2135 (yyval.svec).len * sizeof (struct typed_stoken));
2137 p = xmalloc ((yyvsp[(3) - (3)].tsval).length + 1);
2138 memcpy (p, (yyvsp[(3) - (3)].tsval).ptr, (yyvsp[(3) - (3)].tsval).length + 1);
2140 (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[(3) - (3)].tsval).type;
2141 (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[(3) - (3)].tsval).length;
2142 (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p;
2148 /* Line 1455 of yacc.c */
2149 #line 552 "go-exp.y"
2153 write_exp_string_vector (0 /*always utf8*/, &(yyvsp[(1) - (1)].svec));
2154 for (i = 0; i < (yyvsp[(1) - (1)].svec).len; ++i)
2155 xfree ((yyvsp[(1) - (1)].svec).tokens[i].ptr);
2156 xfree ((yyvsp[(1) - (1)].svec).tokens);
2162 /* Line 1455 of yacc.c */
2163 #line 563 "go-exp.y"
2164 { write_exp_elt_opcode (OP_BOOL);
2165 write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval));
2166 write_exp_elt_opcode (OP_BOOL); }
2171 /* Line 1455 of yacc.c */
2172 #line 569 "go-exp.y"
2173 { write_exp_elt_opcode (OP_BOOL);
2174 write_exp_elt_longcst ((LONGEST) (yyvsp[(1) - (1)].lval));
2175 write_exp_elt_opcode (OP_BOOL); }
2180 /* Line 1455 of yacc.c */
2181 #line 575 "go-exp.y"
2182 { struct symbol *sym = (yyvsp[(1) - (2)].ssym).sym;
2185 || !SYMBOL_IS_ARGUMENT (sym)
2186 || !symbol_read_needs_frame (sym))
2187 error (_("@entry can be used only for function "
2188 "parameters, not for \"%s\""),
2189 copy_name ((yyvsp[(1) - (2)].ssym).stoken));
2191 write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
2192 write_exp_elt_sym (sym);
2193 write_exp_elt_opcode (OP_VAR_ENTRY_VALUE);
2199 /* Line 1455 of yacc.c */
2200 #line 591 "go-exp.y"
2201 { struct symbol *sym = (yyvsp[(1) - (1)].ssym).sym;
2205 if (symbol_read_needs_frame (sym))
2207 if (innermost_block == 0
2208 || contained_in (block_found,
2210 innermost_block = block_found;
2213 write_exp_elt_opcode (OP_VAR_VALUE);
2214 /* We want to use the selected frame, not
2215 another more inner frame which happens to
2216 be in the same block. */
2217 write_exp_elt_block (NULL);
2218 write_exp_elt_sym (sym);
2219 write_exp_elt_opcode (OP_VAR_VALUE);
2221 else if ((yyvsp[(1) - (1)].ssym).is_a_field_of_this)
2223 /* TODO(dje): Can we get here?
2224 E.g., via a mix of c++ and go? */
2225 gdb_assert_not_reached ("go with `this' field");
2229 struct minimal_symbol *msymbol;
2230 char *arg = copy_name ((yyvsp[(1) - (1)].ssym).stoken);
2233 lookup_minimal_symbol (arg, NULL, NULL);
2234 if (msymbol != NULL)
2235 write_exp_msymbol (msymbol);
2236 else if (!have_full_symbols ()
2237 && !have_partial_symbols ())
2238 error (_("No symbol table is loaded. "
2239 "Use the \"file\" command."));
2241 error (_("No symbol \"%s\" in current context."),
2242 copy_name ((yyvsp[(1) - (1)].ssym).stoken));
2249 /* Line 1455 of yacc.c */
2250 #line 646 "go-exp.y"
2251 { (yyval.tval) = lookup_pointer_type ((yyvsp[(2) - (2)].tval)); }
2256 /* Line 1455 of yacc.c */
2257 #line 648 "go-exp.y"
2258 { (yyval.tval) = (yyvsp[(1) - (1)].tsym).type; }
2263 /* Line 1455 of yacc.c */
2264 #line 655 "go-exp.y"
2265 { (yyval.tval) = builtin_go_type (parse_gdbarch)
2271 /* Line 1455 of yacc.c */
2272 #line 2274 "go-exp.c"
2275 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2279 YY_STACK_PRINT (yyss, yyssp);
2283 /* Now `shift' the result of the reduction. Determine what state
2284 that goes to, based on the state we popped back to and the rule
2285 number reduced by. */
2289 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2290 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2291 yystate = yytable[yystate];
2293 yystate = yydefgoto[yyn - YYNTOKENS];
2298 /*------------------------------------.
2299 | yyerrlab -- here on detecting error |
2300 `------------------------------------*/
2302 /* If not already recovering from an error, report this error. */
2306 #if ! YYERROR_VERBOSE
2307 yyerror (YY_("syntax error"));
2310 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2311 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2313 YYSIZE_T yyalloc = 2 * yysize;
2314 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2315 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2316 if (yymsg != yymsgbuf)
2317 YYSTACK_FREE (yymsg);
2318 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2320 yymsg_alloc = yyalloc;
2324 yymsg_alloc = sizeof yymsgbuf;
2328 if (0 < yysize && yysize <= yymsg_alloc)
2330 (void) yysyntax_error (yymsg, yystate, yychar);
2335 yyerror (YY_("syntax error"));
2337 goto yyexhaustedlab;
2345 if (yyerrstatus == 3)
2347 /* If just tried and failed to reuse lookahead token after an
2348 error, discard it. */
2350 if (yychar <= YYEOF)
2352 /* Return failure if at end of input. */
2353 if (yychar == YYEOF)
2358 yydestruct ("Error: discarding",
2364 /* Else will try to reuse lookahead token after shifting the error
2369 /*---------------------------------------------------.
2370 | yyerrorlab -- error raised explicitly by YYERROR. |
2371 `---------------------------------------------------*/
2374 /* Pacify compilers like GCC when the user code never invokes
2375 YYERROR and the label yyerrorlab therefore never appears in user
2377 if (/*CONSTCOND*/ 0)
2380 /* Do not reclaim the symbols of the rule which action triggered
2384 YY_STACK_PRINT (yyss, yyssp);
2389 /*-------------------------------------------------------------.
2390 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2391 `-------------------------------------------------------------*/
2393 yyerrstatus = 3; /* Each real token shifted decrements this. */
2397 yyn = yypact[yystate];
2398 if (yyn != YYPACT_NINF)
2401 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2409 /* Pop the current state because it cannot handle the error token. */
2414 yydestruct ("Error: popping",
2415 yystos[yystate], yyvsp);
2418 YY_STACK_PRINT (yyss, yyssp);
2424 /* Shift the error token. */
2425 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2431 /*-------------------------------------.
2432 | yyacceptlab -- YYACCEPT comes here. |
2433 `-------------------------------------*/
2438 /*-----------------------------------.
2439 | yyabortlab -- YYABORT comes here. |
2440 `-----------------------------------*/
2445 #if !defined(yyoverflow) || YYERROR_VERBOSE
2446 /*-------------------------------------------------.
2447 | yyexhaustedlab -- memory exhaustion comes here. |
2448 `-------------------------------------------------*/
2450 yyerror (YY_("memory exhausted"));
2456 if (yychar != YYEMPTY)
2457 yydestruct ("Cleanup: discarding lookahead",
2459 /* Do not reclaim the symbols of the rule which action triggered
2460 this YYABORT or YYACCEPT. */
2462 YY_STACK_PRINT (yyss, yyssp);
2463 while (yyssp != yyss)
2465 yydestruct ("Cleanup: popping",
2466 yystos[*yyssp], yyvsp);
2471 YYSTACK_FREE (yyss);
2474 if (yymsg != yymsgbuf)
2475 YYSTACK_FREE (yymsg);
2477 /* Make sure YYID is used. */
2478 return YYID (yyresult);
2483 /* Line 1675 of yacc.c */
2484 #line 677 "go-exp.y"
2487 /* Wrapper on parse_c_float to get the type right for Go. */
2490 parse_go_float (struct gdbarch *gdbarch, const char *p, int len,
2491 DOUBLEST *d, struct type **t)
2493 int result = parse_c_float (gdbarch, p, len, d, t);
2494 const struct builtin_type *builtin_types = builtin_type (gdbarch);
2495 const struct builtin_go_type *builtin_go_types = builtin_go_type (gdbarch);
2497 if (*t == builtin_types->builtin_float)
2498 *t = builtin_go_types->builtin_float32;
2499 else if (*t == builtin_types->builtin_double)
2500 *t = builtin_go_types->builtin_float64;
2505 /* Take care of parsing a number (anything that starts with a digit).
2506 Set yylval and return the token type; update lexptr.
2507 LEN is the number of characters in it. */
2509 /* FIXME: Needs some error checking for the float case. */
2510 /* FIXME(dje): IWBN to use c-exp.y's parse_number if we could.
2511 That will require moving the guts into a function that we both call
2512 as our YYSTYPE is different than c-exp.y's */
2515 parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
2517 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
2518 here, and we do kind of silly things like cast to unsigned. */
2525 int base = input_radix;
2528 /* Number of "L" suffixes encountered. */
2531 /* We have found a "L" or "U" suffix. */
2532 int found_suffix = 0;
2535 struct type *signed_type;
2536 struct type *unsigned_type;
2540 if (! parse_go_float (parse_gdbarch, p, len,
2541 &putithere->typed_val_float.dval,
2542 &putithere->typed_val_float.type))
2547 /* Handle base-switching prefixes 0x, 0t, 0d, 0. */
2591 if (c >= 'A' && c <= 'Z')
2593 if (c != 'l' && c != 'u')
2595 if (c >= '0' && c <= '9')
2603 if (base > 10 && c >= 'a' && c <= 'f')
2607 n += i = c - 'a' + 10;
2620 return ERROR; /* Char not a digit */
2623 return ERROR; /* Invalid digit in this base. */
2625 /* Portably test for overflow (only works for nonzero values, so make
2626 a second check for zero). FIXME: Can't we just make n and prevn
2627 unsigned and avoid this? */
2628 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2629 unsigned_p = 1; /* Try something unsigned. */
2631 /* Portably test for unsigned overflow.
2632 FIXME: This check is wrong; for example it doesn't find overflow
2633 on 0x123456789 when LONGEST is 32 bits. */
2634 if (c != 'l' && c != 'u' && n != 0)
2636 if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2637 error (_("Numeric constant too large."));
2642 /* An integer constant is an int, a long, or a long long. An L
2643 suffix forces it to be long; an LL suffix forces it to be long
2644 long. If not forced to a larger size, it gets the first type of
2645 the above that it fits in. To figure out whether it fits, we
2646 shift it right and see whether anything remains. Note that we
2647 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2648 operation, because many compilers will warn about such a shift
2649 (which always produces a zero result). Sometimes gdbarch_int_bit
2650 or gdbarch_long_bit will be that big, sometimes not. To deal with
2651 the case where it is we just always shift the value more than
2652 once, with fewer bits each time. */
2654 un = (ULONGEST)n >> 2;
2656 && (un >> (gdbarch_int_bit (parse_gdbarch) - 2)) == 0)
2658 high_bit = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch) - 1);
2660 /* A large decimal (not hex or octal) constant (between INT_MAX
2661 and UINT_MAX) is a long or unsigned long, according to ANSI,
2662 never an unsigned int, but this code treats it as unsigned
2663 int. This probably should be fixed. GCC gives a warning on
2666 unsigned_type = parse_type->builtin_unsigned_int;
2667 signed_type = parse_type->builtin_int;
2669 else if (long_p <= 1
2670 && (un >> (gdbarch_long_bit (parse_gdbarch) - 2)) == 0)
2672 high_bit = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch) - 1);
2673 unsigned_type = parse_type->builtin_unsigned_long;
2674 signed_type = parse_type->builtin_long;
2679 if (sizeof (ULONGEST) * HOST_CHAR_BIT
2680 < gdbarch_long_long_bit (parse_gdbarch))
2681 /* A long long does not fit in a LONGEST. */
2682 shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2684 shift = (gdbarch_long_long_bit (parse_gdbarch) - 1);
2685 high_bit = (ULONGEST) 1 << shift;
2686 unsigned_type = parse_type->builtin_unsigned_long_long;
2687 signed_type = parse_type->builtin_long_long;
2690 putithere->typed_val_int.val = n;
2692 /* If the high bit of the worked out type is set then this number
2693 has to be unsigned. */
2695 if (unsigned_p || (n & high_bit))
2697 putithere->typed_val_int.type = unsigned_type;
2701 putithere->typed_val_int.type = signed_type;
2707 /* Temporary obstack used for holding strings. */
2708 static struct obstack tempbuf;
2709 static int tempbuf_init;
2711 /* Parse a string or character literal from TOKPTR. The string or
2712 character may be wide or unicode. *OUTPTR is set to just after the
2713 end of the literal in the input string. The resulting token is
2714 stored in VALUE. This returns a token value, either STRING or
2715 CHAR, depending on what was parsed. *HOST_CHARS is set to the
2716 number of host characters in the literal. */
2719 parse_string_or_char (char *tokptr, char **outptr, struct typed_stoken *value,
2724 /* Build the gdb internal form of the input string in tempbuf. Note
2725 that the buffer is null byte terminated *only* for the
2726 convenience of debugging gdb itself and printing the buffer
2727 contents when the buffer contains no embedded nulls. Gdb does
2728 not depend upon the buffer being null byte terminated, it uses
2729 the length string instead. This allows gdb to handle C strings
2730 (as well as strings in other languages) with embedded null
2736 obstack_free (&tempbuf, NULL);
2737 obstack_init (&tempbuf);
2739 /* Skip the quote. */
2751 *host_chars += c_parse_escape (&tokptr, &tempbuf);
2753 else if (c == quote)
2757 obstack_1grow (&tempbuf, c);
2759 /* FIXME: this does the wrong thing with multi-byte host
2760 characters. We could use mbrlen here, but that would
2761 make "set host-charset" a bit less useful. */
2766 if (*tokptr != quote)
2769 error (_("Unterminated string in expression."));
2771 error (_("Unmatched single quote."));
2775 value->type = C_STRING | (quote == '\'' ? C_CHAR : 0); /*FIXME*/
2776 value->ptr = obstack_base (&tempbuf);
2777 value->length = obstack_object_size (&tempbuf);
2781 return quote == '\'' ? CHAR : STRING;
2788 enum exp_opcode opcode;
2791 static const struct token tokentab3[] =
2793 {">>=", ASSIGN_MODIFY, BINOP_RSH},
2794 {"<<=", ASSIGN_MODIFY, BINOP_LSH},
2795 /*{"&^=", ASSIGN_MODIFY, BINOP_BITWISE_ANDNOT}, TODO */
2796 {"...", DOTDOTDOT, OP_NULL},
2799 static const struct token tokentab2[] =
2801 {"+=", ASSIGN_MODIFY, BINOP_ADD},
2802 {"-=", ASSIGN_MODIFY, BINOP_SUB},
2803 {"*=", ASSIGN_MODIFY, BINOP_MUL},
2804 {"/=", ASSIGN_MODIFY, BINOP_DIV},
2805 {"%=", ASSIGN_MODIFY, BINOP_REM},
2806 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2807 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2808 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2809 {"++", INCREMENT, BINOP_END},
2810 {"--", DECREMENT, BINOP_END},
2811 /*{"->", RIGHT_ARROW, BINOP_END}, Doesn't exist in Go. */
2812 {"<-", LEFT_ARROW, BINOP_END},
2813 {"&&", ANDAND, BINOP_END},
2814 {"||", OROR, BINOP_END},
2815 {"<<", LSH, BINOP_END},
2816 {">>", RSH, BINOP_END},
2817 {"==", EQUAL, BINOP_END},
2818 {"!=", NOTEQUAL, BINOP_END},
2819 {"<=", LEQ, BINOP_END},
2820 {">=", GEQ, BINOP_END},
2821 /*{"&^", ANDNOT, BINOP_END}, TODO */
2824 /* Identifier-like tokens. */
2825 static const struct token ident_tokens[] =
2827 {"true", TRUE_KEYWORD, OP_NULL},
2828 {"false", FALSE_KEYWORD, OP_NULL},
2829 {"nil", NIL_KEYWORD, OP_NULL},
2830 {"const", CONST_KEYWORD, OP_NULL},
2831 {"struct", STRUCT_KEYWORD, OP_NULL},
2832 {"type", TYPE_KEYWORD, OP_NULL},
2833 {"interface", INTERFACE_KEYWORD, OP_NULL},
2834 {"chan", CHAN_KEYWORD, OP_NULL},
2835 {"byte", BYTE_KEYWORD, OP_NULL}, /* An alias of uint8. */
2836 {"len", LEN_KEYWORD, OP_NULL},
2837 {"cap", CAP_KEYWORD, OP_NULL},
2838 {"new", NEW_KEYWORD, OP_NULL},
2839 {"iota", IOTA_KEYWORD, OP_NULL},
2842 /* This is set if a NAME token appeared at the very end of the input
2843 string, with no whitespace separating the name from the EOF. This
2844 is used only when parsing to do field name completion. */
2845 static int saw_name_at_eof;
2847 /* This is set if the previously-returned token was a structure
2848 operator -- either '.' or ARROW. This is used only when parsing to
2849 do field name completion. */
2850 static int last_was_structop;
2852 /* Read one token, getting characters through lexptr. */
2855 lex_one_token (void)
2861 int saw_structop = last_was_structop;
2864 last_was_structop = 0;
2868 prev_lexptr = lexptr;
2871 /* See if it is a special token of length 3. */
2872 for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
2873 if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2876 yylval.opcode = tokentab3[i].opcode;
2877 return tokentab3[i].token;
2880 /* See if it is a special token of length 2. */
2881 for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
2882 if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2885 yylval.opcode = tokentab2[i].opcode;
2886 /* NOTE: -> doesn't exist in Go, so we don't need to watch for
2887 setting last_was_structop here. */
2888 return tokentab2[i].token;
2891 switch (c = *tokstart)
2894 if (saw_name_at_eof)
2896 saw_name_at_eof = 0;
2899 else if (saw_structop)
2918 if (paren_depth == 0)
2925 if (comma_terminates
2926 && paren_depth == 0)
2932 /* Might be a floating point number. */
2933 if (lexptr[1] < '0' || lexptr[1] > '9')
2935 if (parse_completion)
2936 last_was_structop = 1;
2937 goto symbol; /* Nope, must be a symbol. */
2939 /* FALL THRU into number case. */
2952 /* It's a number. */
2953 int got_dot = 0, got_e = 0, toktype;
2955 int hex = input_radix > 10;
2957 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2965 /* This test includes !hex because 'e' is a valid hex digit
2966 and thus does not indicate a floating point number when
2967 the radix is hex. */
2968 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2969 got_dot = got_e = 1;
2970 /* This test does not include !hex, because a '.' always indicates
2971 a decimal floating point number regardless of the radix. */
2972 else if (!got_dot && *p == '.')
2974 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2975 && (*p == '-' || *p == '+'))
2976 /* This is the sign of the exponent, not the end of the
2979 /* We will take any letters or digits. parse_number will
2980 complain if past the radix, or if L or U are not final. */
2981 else if ((*p < '0' || *p > '9')
2982 && ((*p < 'a' || *p > 'z')
2983 && (*p < 'A' || *p > 'Z')))
2986 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2987 if (toktype == ERROR)
2989 char *err_copy = (char *) alloca (p - tokstart + 1);
2991 memcpy (err_copy, tokstart, p - tokstart);
2992 err_copy[p - tokstart] = 0;
2993 error (_("Invalid number \"%s\"."), err_copy);
3001 char *p = &tokstart[1];
3002 size_t len = strlen ("entry");
3004 while (isspace (*p))
3006 if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
3040 int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
3045 error (_("Empty character constant."));
3046 else if (host_len > 2 && c == '\'')
3049 namelen = lexptr - tokstart - 1;
3052 else if (host_len > 1)
3053 error (_("Invalid character constant."));
3059 if (!(c == '_' || c == '$'
3060 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
3061 /* We must have come across a bad character (e.g. ';'). */
3062 error (_("Invalid character '%c' in expression."), c);
3064 /* It's a name. See how long it is. */
3066 for (c = tokstart[namelen];
3067 (c == '_' || c == '$' || (c >= '0' && c <= '9')
3068 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));)
3070 c = tokstart[++namelen];
3073 /* The token "if" terminates the expression and is NOT removed from
3074 the input stream. It doesn't count if it appears in the
3075 expansion of a macro. */
3077 && tokstart[0] == 'i'
3078 && tokstart[1] == 'f')
3083 /* For the same reason (breakpoint conditions), "thread N"
3084 terminates the expression. "thread" could be an identifier, but
3085 an identifier is never followed by a number without intervening
3087 Handle abbreviations of these, similarly to
3088 breakpoint.c:find_condition_and_thread.
3089 TODO: Watch for "goroutine" here? */
3091 && strncmp (tokstart, "thread", namelen) == 0
3092 && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t'))
3094 char *p = tokstart + namelen + 1;
3095 while (*p == ' ' || *p == '\t')
3097 if (*p >= '0' && *p <= '9')
3105 yylval.sval.ptr = tokstart;
3106 yylval.sval.length = namelen;
3108 /* Catch specific keywords. */
3109 copy = copy_name (yylval.sval);
3110 for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
3111 if (strcmp (copy, ident_tokens[i].operator) == 0)
3113 /* It is ok to always set this, even though we don't always
3114 strictly need to. */
3115 yylval.opcode = ident_tokens[i].opcode;
3116 return ident_tokens[i].token;
3119 if (*tokstart == '$')
3120 return DOLLAR_VARIABLE;
3122 if (parse_completion && *lexptr == '\0')
3123 saw_name_at_eof = 1;
3127 /* An object of this type is pushed on a FIFO by the "outer" lexer. */
3134 DEF_VEC_O (token_and_value);
3136 /* A FIFO of tokens that have been read but not yet returned to the
3138 static VEC (token_and_value) *token_fifo;
3140 /* Non-zero if the lexer should return tokens from the FIFO. */
3143 /* Temporary storage for yylex; this holds symbol names as they are
3145 static struct obstack name_obstack;
3147 /* Build "package.name" in name_obstack.
3148 For convenience of the caller, the name is NUL-terminated,
3149 but the NUL is not included in the recorded length. */
3151 static struct stoken
3152 build_packaged_name (const char *package, int package_len,
3153 const char *name, int name_len)
3155 struct stoken result;
3157 obstack_free (&name_obstack, obstack_base (&name_obstack));
3158 obstack_grow (&name_obstack, package, package_len);
3159 obstack_grow_str (&name_obstack, ".");
3160 obstack_grow (&name_obstack, name, name_len);
3161 obstack_grow (&name_obstack, "", 1);
3162 result.ptr = obstack_base (&name_obstack);
3163 result.length = obstack_object_size (&name_obstack) - 1;
3168 /* Return non-zero if NAME is a package name.
3169 BLOCK is the scope in which to interpret NAME; this can be NULL
3170 to mean the global scope. */
3173 package_name_p (const char *name, const struct block *block)
3176 struct field_of_this_result is_a_field_of_this;
3178 sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this);
3181 && SYMBOL_CLASS (sym) == LOC_TYPEDEF
3182 && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_MODULE)
3188 /* Classify a (potential) function in the "unsafe" package.
3189 We fold these into "keywords" to keep things simple, at least until
3190 something more complex is warranted. */
3193 classify_unsafe_function (struct stoken function_name)
3195 char *copy = copy_name (function_name);
3197 if (strcmp (copy, "Sizeof") == 0)
3199 yylval.sval = function_name;
3200 return SIZEOF_KEYWORD;
3203 error (_("Unknown function in `unsafe' package: %s"), copy);
3206 /* Classify token(s) "name1.name2" where name1 is known to be a package.
3207 The contents of the token are in `yylval'.
3208 Updates yylval and returns the new token type.
3210 The result is one of NAME, NAME_OR_INT, or TYPENAME. */
3213 classify_packaged_name (const struct block *block)
3217 struct field_of_this_result is_a_field_of_this;
3219 copy = copy_name (yylval.sval);
3221 sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
3225 yylval.ssym.sym = sym;
3226 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
3232 /* Classify a NAME token.
3233 The contents of the token are in `yylval'.
3234 Updates yylval and returns the new token type.
3235 BLOCK is the block in which lookups start; this can be NULL
3236 to mean the global scope.
3238 The result is one of NAME, NAME_OR_INT, or TYPENAME. */
3241 classify_name (const struct block *block)
3246 struct field_of_this_result is_a_field_of_this;
3248 copy = copy_name (yylval.sval);
3250 /* Try primitive types first so they win over bad/weird debug info. */
3251 type = language_lookup_primitive_type_by_name (parse_language,
3252 parse_gdbarch, copy);
3255 /* NOTE: We take advantage of the fact that yylval coming in was a
3256 NAME, and that struct ttype is a compatible extension of struct
3257 stoken, so yylval.tsym.stoken is already filled in. */
3258 yylval.tsym.type = type;
3262 /* TODO: What about other types? */
3264 sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
3268 yylval.ssym.sym = sym;
3269 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
3273 /* If we didn't find a symbol, look again in the current package.
3274 This is to, e.g., make "p global_var" work without having to specify
3275 the package name. We intentionally only looks for objects in the
3279 char *current_package_name = go_block_package_name (block);
3281 if (current_package_name != NULL)
3283 struct stoken sval =
3284 build_packaged_name (current_package_name,
3285 strlen (current_package_name),
3286 copy, strlen (copy));
3288 xfree (current_package_name);
3289 sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
3290 &is_a_field_of_this);
3293 yylval.ssym.stoken = sval;
3294 yylval.ssym.sym = sym;
3295 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
3301 /* Input names that aren't symbols but ARE valid hex numbers, when
3302 the input radix permits them, can be names or numbers depending
3303 on the parse. Note we support radixes > 16 here. */
3304 if ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
3305 || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10))
3307 YYSTYPE newlval; /* Its value is ignored. */
3308 int hextype = parse_number (copy, yylval.sval.length, 0, &newlval);
3311 yylval.ssym.sym = NULL;
3312 yylval.ssym.is_a_field_of_this = 0;
3317 yylval.ssym.sym = NULL;
3318 yylval.ssym.is_a_field_of_this = 0;
3322 /* This is taken from c-exp.y mostly to get something working.
3323 The basic structure has been kept because we may yet need some of it. */
3328 token_and_value current, next;
3330 if (popping && !VEC_empty (token_and_value, token_fifo))
3332 token_and_value tv = *VEC_index (token_and_value, token_fifo, 0);
3333 VEC_ordered_remove (token_and_value, token_fifo, 0);
3335 /* There's no need to fall through to handle package.name
3336 as that can never happen here. In theory. */
3341 current.token = lex_one_token ();
3343 /* TODO: Need a way to force specifying name1 as a package.
3346 if (current.token != NAME)
3347 return current.token;
3349 /* See if we have "name1 . name2". */
3351 current.value = yylval;
3352 next.token = lex_one_token ();
3353 next.value = yylval;
3355 if (next.token == '.')
3357 token_and_value name2;
3359 name2.token = lex_one_token ();
3360 name2.value = yylval;
3362 if (name2.token == NAME)
3364 /* Ok, we have "name1 . name2". */
3367 copy = copy_name (current.value.sval);
3369 if (strcmp (copy, "unsafe") == 0)
3372 return classify_unsafe_function (name2.value.sval);
3375 if (package_name_p (copy, expression_context_block))
3378 yylval.sval = build_packaged_name (current.value.sval.ptr,
3379 current.value.sval.length,
3380 name2.value.sval.ptr,
3381 name2.value.sval.length);
3382 return classify_packaged_name (expression_context_block);
3386 VEC_safe_push (token_and_value, token_fifo, &next);
3387 VEC_safe_push (token_and_value, token_fifo, &name2);
3391 VEC_safe_push (token_and_value, token_fifo, &next);
3394 /* If we arrive here we don't have a package-qualified name. */
3397 yylval = current.value;
3398 return classify_name (expression_context_block);
3405 struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
3407 make_cleanup_restore_integer (&yydebug);
3408 yydebug = parser_debug;
3410 /* Initialize some state used by the lexer. */
3411 last_was_structop = 0;
3412 saw_name_at_eof = 0;
3414 VEC_free (token_and_value, token_fifo);
3416 obstack_init (&name_obstack);
3417 make_cleanup_obstack_free (&name_obstack);
3419 result = yyparse ();
3420 do_cleanups (back_to);
3428 lexptr = prev_lexptr;
3430 error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);