GDB (xrefs)
/tmp/gdb-8.1/gdb/go-exp.c
Go to the documentation of this file.
1 /* A Bison parser, made by GNU Bison 3.0.4. */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5  Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6 
7  This program is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 
20 /* As a special exception, you may create a larger work that contains
21  part or all of the Bison parser skeleton and distribute that work
22  under terms of your choice, so long as that work isn't itself a
23  parser generator using the skeleton or a modified version thereof
24  as a parser skeleton. Alternatively, if you modify or redistribute
25  the parser skeleton itself, you may (at your option) remove this
26  special exception, which will cause the skeleton and the resulting
27  Bison output files to be licensed under the GNU General Public
28  License without this special exception.
29 
30  This special exception was added by the Free Software Foundation in
31  version 2.2 of Bison. */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34  simplifying the original so-called "semantic" parser. */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37  infringing on user name space. This should be done even for local
38  variables, as they might otherwise be expanded by user macros.
39  There are some unavoidable exceptions within include files to
40  define necessary library symbols; they are noted "INFRINGES ON
41  USER NAME SPACE" below. */
42 
43 /* Identify Bison output. */
44 #define YYBISON 1
45 
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48 
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers. */
53 #define YYPURE 0
54 
55 /* Push parsers. */
56 #define YYPUSH 0
57 
58 /* Pull parsers. */
59 #define YYPULL 1
60 
61 
62 
63 
64 /* Copy the first part of user declarations. */
65 #line 52 "go-exp.y" /* yacc.c:339 */
66 
67 
68 #include "defs.h"
69 #include <ctype.h>
70 #include "expression.h"
71 #include "value.h"
72 #include "parser-defs.h"
73 #include "language.h"
74 #include "c-lang.h"
75 #include "go-lang.h"
76 #include "bfd.h" /* Required by objfiles.h. */
77 #include "symfile.h" /* Required by objfiles.h. */
78 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
79 #include "charset.h"
80 #include "block.h"
81 
82 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
83 
84 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
85  etc). */
86 #define GDB_YY_REMAP_PREFIX go_
87 #include "yy-remap.h"
88 
89 /* The state of the parser, used internally when we are parsing the
90  expression. */
91 
92 static struct parser_state *pstate = NULL;
93 
94 int yyparse (void);
95 
96 static int yylex (void);
97 
98 void yyerror (const char *);
99 
100 
101 #line 102 "go-exp.c" /* yacc.c:339 */
102 
103 # ifndef YY_NULLPTRPTR
104 # if defined __cplusplus && 201103L <= __cplusplus
105 # define YY_NULLPTRPTR nullptr
106 # else
107 # define YY_NULLPTRPTR 0
108 # endif
109 # endif
110 
111 /* Enabling verbose error messages. */
112 #ifdef YYERROR_VERBOSE
113 # undef YYERROR_VERBOSE
114 # define YYERROR_VERBOSE 1
115 #else
116 # define YYERROR_VERBOSE 0
117 #endif
118 
119 
120 /* Debug traces. */
121 #ifndef YYDEBUG
122 # define YYDEBUG 0
123 #endif
124 #if YYDEBUG
125 extern int yydebug;
126 #endif
127 
128 /* Token type. */
129 #ifndef YYTOKENTYPE
130 # define YYTOKENTYPE
132  {
133  INT = 258,
134  FLOAT = 259,
135  RAW_STRING = 260,
136  STRING = 261,
137  CHAR = 262,
138  NAME = 263,
139  TYPENAME = 264,
140  COMPLETE = 265,
141  NAME_OR_INT = 266,
149  LEN_KEYWORD = 274,
150  CAP_KEYWORD = 275,
151  NEW_KEYWORD = 276,
153  NIL_KEYWORD = 278,
155  DOTDOTDOT = 280,
156  ENTRY = 281,
157  ERROR = 282,
161  ABOVE_COMMA = 286,
162  OROR = 287,
163  ANDAND = 288,
164  ANDNOT = 289,
165  EQUAL = 290,
166  NOTEQUAL = 291,
167  LEQ = 292,
168  GEQ = 293,
169  LSH = 294,
170  RSH = 295,
171  UNARY = 296,
172  INCREMENT = 297,
173  DECREMENT = 298,
175  };
176 #endif
177 /* Tokens. */
178 #define INT 258
179 #define FLOAT 259
180 #define RAW_STRING 260
181 #define STRING 261
182 #define CHAR 262
183 #define NAME 263
184 #define TYPENAME 264
185 #define COMPLETE 265
186 #define NAME_OR_INT 266
187 #define TRUE_KEYWORD 267
188 #define FALSE_KEYWORD 268
189 #define STRUCT_KEYWORD 269
190 #define INTERFACE_KEYWORD 270
191 #define TYPE_KEYWORD 271
192 #define CHAN_KEYWORD 272
193 #define SIZEOF_KEYWORD 273
194 #define LEN_KEYWORD 274
195 #define CAP_KEYWORD 275
196 #define NEW_KEYWORD 276
197 #define IOTA_KEYWORD 277
198 #define NIL_KEYWORD 278
199 #define CONST_KEYWORD 279
200 #define DOTDOTDOT 280
201 #define ENTRY 281
202 #define ERROR 282
203 #define BYTE_KEYWORD 283
204 #define DOLLAR_VARIABLE 284
205 #define ASSIGN_MODIFY 285
206 #define ABOVE_COMMA 286
207 #define OROR 287
208 #define ANDAND 288
209 #define ANDNOT 289
210 #define EQUAL 290
211 #define NOTEQUAL 291
212 #define LEQ 292
213 #define GEQ 293
214 #define LSH 294
215 #define RSH 295
216 #define UNARY 296
217 #define INCREMENT 297
218 #define DECREMENT 298
219 #define LEFT_ARROW 299
220 
221 /* Value type. */
222 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
223 
224 union YYSTYPE
225 {
226 #line 93 "go-exp.y" /* yacc.c:355 */
227 
228  LONGEST lval;
229  struct {
230  LONGEST val;
231  struct type *type;
232  } typed_val_int;
233  struct {
234  gdb_byte val[16];
235  struct type *type;
236  } typed_val_float;
237  struct stoken sval;
238  struct symtoken ssym;
239  struct type *tval;
240  struct typed_stoken tsval;
241  struct ttype tsym;
242  int voidval;
243  enum exp_opcode opcode;
244  struct internalvar *ivar;
245  struct stoken_vector svec;
246 
247 
248 #line 249 "go-exp.c" /* yacc.c:355 */
249 };
250 
251 typedef union YYSTYPE YYSTYPE;
252 # define YYSTYPE_IS_TRIVIAL 1
253 # define YYSTYPE_IS_DECLARED 1
254 #endif
255 
256 
257 extern YYSTYPE yylval;
258 
259 int yyparse (void);
260 
261 
262 
263 /* Copy the second part of user declarations. */
264 #line 114 "go-exp.y" /* yacc.c:358 */
265 
266 /* YYSTYPE gets defined by %union. */
267 static int parse_number (struct parser_state *,
268  const char *, int, int, YYSTYPE *);
269 
270 #line 271 "go-exp.c" /* yacc.c:358 */
271 
272 #ifdef short
273 # undef short
274 #endif
275 
276 #ifdef YYTYPE_UINT8
277 typedef YYTYPE_UINT8 yytype_uint8;
278 #else
279 typedef unsigned char yytype_uint8;
280 #endif
281 
282 #ifdef YYTYPE_INT8
283 typedef YYTYPE_INT8 yytype_int8;
284 #else
285 typedef signed char yytype_int8;
286 #endif
287 
288 #ifdef YYTYPE_UINT16
289 typedef YYTYPE_UINT16 yytype_uint16;
290 #else
291 typedef unsigned short int yytype_uint16;
292 #endif
293 
294 #ifdef YYTYPE_INT16
295 typedef YYTYPE_INT16 yytype_int16;
296 #else
297 typedef short int yytype_int16;
298 #endif
299 
300 #ifndef YYSIZE_T
301 # ifdef __SIZE_TYPE__
302 # define YYSIZE_T __SIZE_TYPE__
303 # elif defined size_t
304 # define YYSIZE_T size_t
305 # elif ! defined YYSIZE_T
306 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
307 # define YYSIZE_T size_t
308 # else
309 # define YYSIZE_T unsigned int
310 # endif
311 #endif
312 
313 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
314 
315 #ifndef YY_
316 # if defined YYENABLE_NLS && YYENABLE_NLS
317 # if ENABLE_NLS
318 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
319 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
320 # endif
321 # endif
322 # ifndef YY_
323 # define YY_(Msgid) Msgid
324 # endif
325 #endif
326 
327 #ifndef YY_ATTRIBUTE
328 # if (defined __GNUC__ \
329  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
330  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
331 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
332 # else
333 # define YY_ATTRIBUTE(Spec) /* empty */
334 # endif
335 #endif
336 
337 #ifndef YY_ATTRIBUTE_PURE
338 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
339 #endif
340 
341 #ifndef YY_ATTRIBUTE_UNUSED
342 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
343 #endif
344 
345 #if !defined _Noreturn \
346  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
347 # if defined _MSC_VER && 1200 <= _MSC_VER
348 # define _Noreturn __declspec (noreturn)
349 # else
350 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
351 # endif
352 #endif
353 
354 /* Suppress unused-variable warnings by "using" E. */
355 #if ! defined lint || defined __GNUC__
356 # define YYUSE(E) ((void) (E))
357 #else
358 # define YYUSE(E) /* empty */
359 #endif
360 
361 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
362 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
363 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
364  _Pragma ("GCC diagnostic push") \
365  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
366  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
367 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
368  _Pragma ("GCC diagnostic pop")
369 #else
370 # define YY_INITIAL_VALUE(Value) Value
371 #endif
372 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
373 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
374 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
375 #endif
376 #ifndef YY_INITIAL_VALUE
377 # define YY_INITIAL_VALUE(Value) /* Nothing. */
378 #endif
379 
380 
381 #if ! defined yyoverflow || YYERROR_VERBOSE
382 
383 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
384 
385 # ifdef YYSTACK_USE_ALLOCA
386 # if YYSTACK_USE_ALLOCA
387 # ifdef __GNUC__
388 # define YYSTACK_ALLOC __builtin_alloca
389 # elif defined __BUILTIN_VA_ARG_INCR
390 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
391 # elif defined _AIX
392 # define YYSTACK_ALLOC __alloca
393 # elif defined _MSC_VER
394 # define alloca _alloca
395 # else
396 # define YYSTACK_ALLOC alloca
397 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
398 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
399  /* Use EXIT_SUCCESS as a witness for stdlib.h. */
400 # ifndef EXIT_SUCCESS
401 # define EXIT_SUCCESS 0
402 # endif
403 # endif
404 # endif
405 # endif
406 # endif
407 
408 # ifdef YYSTACK_ALLOC
409  /* Pacify GCC's 'empty if-body' warning. */
410 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
411 # ifndef YYSTACK_ALLOC_MAXIMUM
412  /* The OS might guarantee only one guard page at the bottom of the stack,
413  and a page size can be as small as 4096 bytes. So we cannot safely
414  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
415  to allow for a few compiler-allocated temporary stack slots. */
416 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
417 # endif
418 # else
419 # define YYSTACK_ALLOC YYMALLOC
420 # define YYSTACK_FREE YYFREE
421 # ifndef YYSTACK_ALLOC_MAXIMUM
422 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
423 # endif
424 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
425  && ! ((defined YYMALLOC || defined xmalloc) \
426  && (defined YYFREE || defined xfree)))
427 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
428 # ifndef EXIT_SUCCESS
429 # define EXIT_SUCCESS 0
430 # endif
431 # endif
432 # ifndef YYMALLOC
433 # define YYMALLOC xmalloc
434 # if ! defined xmalloc && ! defined EXIT_SUCCESS
435 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
436 # endif
437 # endif
438 # ifndef YYFREE
439 # define YYFREE xfree
440 # if ! defined xfree && ! defined EXIT_SUCCESS
441 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
442 # endif
443 # endif
444 # endif
445 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
446 
447 
448 #if (! defined yyoverflow \
449  && (! defined __cplusplus \
450  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
451 
452 /* A type that is properly aligned for any stack member. */
453 union yyalloc
454 {
457 };
458 
459 /* The size of the maximum gap between one aligned stack and the next. */
460 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
461 
462 /* The size of an array large to enough to hold all stacks, each with
463  N elements. */
464 # define YYSTACK_BYTES(N) \
465  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
466  + YYSTACK_GAP_MAXIMUM)
467 
468 # define YYCOPY_NEEDED 1
469 
470 /* Relocate STACK from its old location to the new one. The
471  local variables YYSIZE and YYSTACKSIZE give the old and new number of
472  elements in the stack, and YYPTR gives the new location of the
473  stack. Advance YYPTR to a properly aligned location for the next
474  stack. */
475 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
476  do \
477  { \
478  YYSIZE_T yynewbytes; \
479  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
480  Stack = &yyptr->Stack_alloc; \
481  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
482  yyptr += yynewbytes / sizeof (*yyptr); \
483  } \
484  while (0)
485 
486 #endif
487 
488 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
489 /* Copy COUNT objects from SRC to DST. The source and destination do
490  not overlap. */
491 # ifndef YYCOPY
492 # if defined __GNUC__ && 1 < __GNUC__
493 # define YYCOPY(Dst, Src, Count) \
494  __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
495 # else
496 # define YYCOPY(Dst, Src, Count) \
497  do \
498  { \
499  YYSIZE_T yyi; \
500  for (yyi = 0; yyi < (Count); yyi++) \
501  (Dst)[yyi] = (Src)[yyi]; \
502  } \
503  while (0)
504 # endif
505 # endif
506 #endif /* !YYCOPY_NEEDED */
507 
508 /* YYFINAL -- State number of the termination state. */
509 #define YYFINAL 40
510 /* YYLAST -- Last index in YYTABLE. */
511 #define YYLAST 451
512 
513 /* YYNTOKENS -- Number of terminals. */
514 #define YYNTOKENS 68
515 /* YYNNTS -- Number of nonterminals. */
516 #define YYNNTS 13
517 /* YYNRULES -- Number of rules. */
518 #define YYNRULES 69
519 /* YYNSTATES -- Number of states. */
520 #define YYNSTATES 122
521 
522 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
523  by yylex, with out-of-bounds checking. */
524 #define YYUNDEFTOK 2
525 #define YYMAXUTOK 299
526 
527 #define YYTRANSLATE(YYX) \
528  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
529 
530 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
531  as returned by yylex, without out-of-bounds checking. */
532 static const yytype_uint8 yytranslate[] =
533 {
534  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537  2, 2, 2, 62, 2, 2, 2, 54, 39, 2,
538  61, 64, 52, 50, 31, 51, 59, 53, 2, 2,
539  2, 2, 2, 2, 2, 2, 2, 2, 67, 2,
540  43, 33, 44, 34, 49, 2, 2, 2, 2, 2,
541  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543  2, 60, 2, 63, 38, 2, 2, 2, 2, 2,
544  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546  2, 2, 2, 65, 37, 66, 2, 2, 2, 2,
547  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
549  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556  2, 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, 2, 2, 2, 1, 2, 3, 4,
560  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
561  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
562  25, 26, 27, 28, 29, 30, 32, 35, 36, 40,
563  41, 42, 45, 46, 47, 48, 55, 56, 57, 58
564 };
565 
566 #if YYDEBUG
567  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
568 static const yytype_uint16 yyrline[] =
569 {
570  0, 191, 191, 192, 195, 202, 203, 208, 212, 216,
571  220, 224, 228, 232, 236, 242, 248, 255, 265, 272,
572  269, 280, 284, 287, 291, 295, 299, 305, 311, 317,
573  321, 325, 329, 333, 337, 341, 345, 349, 353, 357,
574  361, 365, 369, 373, 377, 381, 385, 389, 393, 397,
575  401, 407, 414, 423, 436, 443, 446, 452, 467, 474,
576  491, 509, 521, 527, 533, 549, 601, 603, 610, 623
577 };
578 #endif
579 
580 #if YYDEBUG || YYERROR_VERBOSE || 0
581 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
582  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
583 static const char *const yytname[] =
584 {
585  "$end", "error", "$undefined", "INT", "FLOAT", "RAW_STRING", "STRING",
586  "CHAR", "NAME", "TYPENAME", "COMPLETE", "NAME_OR_INT", "TRUE_KEYWORD",
587  "FALSE_KEYWORD", "STRUCT_KEYWORD", "INTERFACE_KEYWORD", "TYPE_KEYWORD",
588  "CHAN_KEYWORD", "SIZEOF_KEYWORD", "LEN_KEYWORD", "CAP_KEYWORD",
589  "NEW_KEYWORD", "IOTA_KEYWORD", "NIL_KEYWORD", "CONST_KEYWORD",
590  "DOTDOTDOT", "ENTRY", "ERROR", "BYTE_KEYWORD", "DOLLAR_VARIABLE",
591  "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND",
592  "'|'", "'^'", "'&'", "ANDNOT", "EQUAL", "NOTEQUAL", "'<'", "'>'", "LEQ",
593  "GEQ", "LSH", "RSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY",
594  "INCREMENT", "DECREMENT", "LEFT_ARROW", "'.'", "'['", "'('", "'!'",
595  "']'", "')'", "'{'", "'}'", "':'", "$accept", "start", "type_exp",
596  "exp1", "exp", "$@1", "lcurly", "arglist", "rcurly", "string_exp",
597  "variable", "type", "name_not_typename", YY_NULLPTRPTR
598 };
599 #endif
600 
601 # ifdef YYPRINT
602 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
603  (internal) symbol number NUM (which must be that of a token). */
604 static const yytype_uint16 yytoknum[] =
605 {
606  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
607  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
608  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
609  285, 44, 286, 61, 63, 287, 288, 124, 94, 38,
610  289, 290, 291, 60, 62, 292, 293, 294, 295, 64,
611  43, 45, 42, 47, 37, 296, 297, 298, 299, 46,
612  91, 40, 33, 93, 41, 123, 125, 58
613 };
614 # endif
615 
616 #define YYPACT_NINF -42
617 
618 #define yypact_value_is_default(Yystate) \
619  (!!((Yystate) == (-42)))
620 
621 #define YYTABLE_NINF -1
622 
623 #define yytable_value_is_error(Yytable_value) \
624  0
625 
626  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
627  STATE-NUM. */
628 static const yytype_int16 yypact[] =
629 {
630  49, -42, -42, -42, -42, -42, -42, -42, -42, -42,
631  -38, -42, -42, 49, 49, 49, 49, 49, 49, 49,
632  -42, 27, -42, 34, 187, 45, 16, -42, 11, 53,
633  49, -35, 11, -35, -35, -35, -35, 11, 38, -35,
634  -42, 49, 49, 49, 49, 49, 49, 49, 49, 49,
635  49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
636  49, 49, 49, 49, -42, -42, -3, 49, -42, 45,
637  9, 74, 49, -42, 123, 10, -42, 187, 187, 187,
638  88, 241, 266, 290, 313, 334, 353, 353, 368, 368,
639  368, 368, -41, -41, 380, 390, 390, -35, -35, -35,
640  -42, 72, 33, 49, -42, -42, 49, -42, 155, -42,
641  -42, 49, -42, -42, 187, 39, -35, -42, 215, 49,
642  -42, 187
643 };
644 
645  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
646  Performed when YYTABLE does not specify something else to do. Zero
647  means the default is an error. */
648 static const yytype_uint8 yydefact[] =
649 {
650  0, 51, 54, 59, 52, 69, 67, 53, 62, 63,
651  0, 68, 56, 0, 0, 0, 0, 0, 0, 0,
652  21, 0, 3, 2, 5, 0, 61, 55, 4, 65,
653  0, 12, 0, 8, 10, 9, 7, 66, 0, 11,
654  1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
655  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
656  0, 0, 0, 0, 13, 14, 0, 0, 19, 0,
657  0, 0, 0, 64, 0, 0, 28, 6, 50, 49,
658  0, 47, 46, 45, 44, 43, 37, 38, 41, 42,
659  39, 40, 35, 36, 29, 33, 34, 30, 31, 32,
660  17, 15, 0, 22, 66, 25, 0, 60, 0, 58,
661  57, 0, 16, 18, 23, 0, 26, 27, 48, 0,
662  20, 24
663 };
664 
665  /* YYPGOTO[NTERM-NUM]. */
666 static const yytype_int8 yypgoto[] =
667 {
668  -42, -42, -42, -4, -13, -42, -42, -42, -42, -42,
669  -42, 51, 17
670 };
671 
672  /* YYDEFGOTO[NTERM-NUM]. */
673 static const yytype_int8 yydefgoto[] =
674 {
675  -1, 21, 22, 23, 24, 103, 25, 115, 106, 26,
676  27, 32, 29
677 };
678 
679  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
680  positive, shift that token. If negative, reduce the rule whose
681  number is the opposite. If YYTABLE_NINF, syntax error. */
682 static const yytype_uint8 yytable[] =
683 {
684  31, 33, 34, 35, 36, 5, 39, 100, 58, 59,
685  60, 61, 62, 63, 38, 64, 65, 74, 66, 67,
686  68, 64, 65, 30, 66, 67, 68, 40, 77, 78,
687  79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
688  89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
689  99, 28, 1, 2, 6, 3, 4, 5, 6, 108,
690  7, 8, 9, 102, 41, 41, 71, 10, 37, 41,
691  119, 72, 72, 11, 110, 105, 70, 11, 12, 73,
692  107, 75, 112, 101, 0, 0, 0, 13, 14, 0,
693  114, 0, 0, 116, 0, 0, 113, 69, 118, 15,
694  16, 17, 76, 120, 0, 0, 121, 0, 0, 0,
695  18, 19, 0, 0, 20, 0, 0, 0, 42, 0,
696  104, 43, 44, 45, 46, 47, 48, 49, 0, 50,
697  51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
698  61, 62, 63, 0, 64, 65, 0, 66, 67, 68,
699  0, 0, 0, 42, 0, 111, 43, 44, 45, 46,
700  47, 48, 49, 0, 50, 51, 52, 53, 54, 55,
701  56, 57, 58, 59, 60, 61, 62, 63, 0, 64,
702  65, 0, 66, 67, 68, 42, 0, 109, 43, 44,
703  45, 46, 47, 48, 49, 0, 50, 51, 52, 53,
704  54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
705  0, 64, 65, 0, 66, 67, 68, 42, 0, 117,
706  43, 44, 45, 46, 47, 48, 49, 0, 50, 51,
707  52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
708  62, 63, 0, 64, 65, 0, 66, 67, 68, 44,
709  45, 46, 47, 48, 49, 0, 50, 51, 52, 53,
710  54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
711  0, 64, 65, 0, 66, 67, 68, 46, 47, 48,
712  49, 0, 50, 51, 52, 53, 54, 55, 56, 57,
713  58, 59, 60, 61, 62, 63, 0, 64, 65, 0,
714  66, 67, 68, 47, 48, 49, 0, 50, 51, 52,
715  53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
716  63, 0, 64, 65, 0, 66, 67, 68, 48, 49,
717  0, 50, 51, 52, 53, 54, 55, 56, 57, 58,
718  59, 60, 61, 62, 63, 0, 64, 65, 0, 66,
719  67, 68, 49, 0, 50, 51, 52, 53, 54, 55,
720  56, 57, 58, 59, 60, 61, 62, 63, 0, 64,
721  65, 0, 66, 67, 68, 50, 51, 52, 53, 54,
722  55, 56, 57, 58, 59, 60, 61, 62, 63, 0,
723  64, 65, 0, 66, 67, 68, 52, 53, 54, 55,
724  56, 57, 58, 59, 60, 61, 62, 63, 0, 64,
725  65, 0, 66, 67, 68, 56, 57, 58, 59, 60,
726  61, 62, 63, 0, 64, 65, 0, 66, 67, 68,
727  59, 60, 61, 62, 63, 0, 64, 65, 0, 66,
728  67, 68, 61, 62, 63, 0, 64, 65, 0, 66,
729  67, 68
730 };
731 
732 static const yytype_int8 yycheck[] =
733 {
734  13, 14, 15, 16, 17, 8, 19, 10, 49, 50,
735  51, 52, 53, 54, 18, 56, 57, 30, 59, 60,
736  61, 56, 57, 61, 59, 60, 61, 0, 41, 42,
737  43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
738  53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
739  63, 0, 3, 4, 9, 6, 7, 8, 9, 72,
740  11, 12, 13, 67, 31, 31, 50, 18, 17, 31,
741  31, 61, 61, 28, 64, 66, 25, 28, 29, 26,
742  6, 30, 10, 66, -1, -1, -1, 38, 39, -1,
743  103, -1, -1, 106, -1, -1, 63, 52, 111, 50,
744  51, 52, 64, 64, -1, -1, 119, -1, -1, -1,
745  61, 62, -1, -1, 65, -1, -1, -1, 30, -1,
746  69, 33, 34, 35, 36, 37, 38, 39, -1, 41,
747  42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
748  52, 53, 54, -1, 56, 57, -1, 59, 60, 61,
749  -1, -1, -1, 30, -1, 67, 33, 34, 35, 36,
750  37, 38, 39, -1, 41, 42, 43, 44, 45, 46,
751  47, 48, 49, 50, 51, 52, 53, 54, -1, 56,
752  57, -1, 59, 60, 61, 30, -1, 64, 33, 34,
753  35, 36, 37, 38, 39, -1, 41, 42, 43, 44,
754  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
755  -1, 56, 57, -1, 59, 60, 61, 30, -1, 64,
756  33, 34, 35, 36, 37, 38, 39, -1, 41, 42,
757  43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
758  53, 54, -1, 56, 57, -1, 59, 60, 61, 34,
759  35, 36, 37, 38, 39, -1, 41, 42, 43, 44,
760  45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
761  -1, 56, 57, -1, 59, 60, 61, 36, 37, 38,
762  39, -1, 41, 42, 43, 44, 45, 46, 47, 48,
763  49, 50, 51, 52, 53, 54, -1, 56, 57, -1,
764  59, 60, 61, 37, 38, 39, -1, 41, 42, 43,
765  44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
766  54, -1, 56, 57, -1, 59, 60, 61, 38, 39,
767  -1, 41, 42, 43, 44, 45, 46, 47, 48, 49,
768  50, 51, 52, 53, 54, -1, 56, 57, -1, 59,
769  60, 61, 39, -1, 41, 42, 43, 44, 45, 46,
770  47, 48, 49, 50, 51, 52, 53, 54, -1, 56,
771  57, -1, 59, 60, 61, 41, 42, 43, 44, 45,
772  46, 47, 48, 49, 50, 51, 52, 53, 54, -1,
773  56, 57, -1, 59, 60, 61, 43, 44, 45, 46,
774  47, 48, 49, 50, 51, 52, 53, 54, -1, 56,
775  57, -1, 59, 60, 61, 47, 48, 49, 50, 51,
776  52, 53, 54, -1, 56, 57, -1, 59, 60, 61,
777  50, 51, 52, 53, 54, -1, 56, 57, -1, 59,
778  60, 61, 52, 53, 54, -1, 56, 57, -1, 59,
779  60, 61
780 };
781 
782  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
783  symbol of state STATE-NUM. */
784 static const yytype_uint8 yystos[] =
785 {
786  0, 3, 4, 6, 7, 8, 9, 11, 12, 13,
787  18, 28, 29, 38, 39, 50, 51, 52, 61, 62,
788  65, 69, 70, 71, 72, 74, 77, 78, 79, 80,
789  61, 72, 79, 72, 72, 72, 72, 79, 71, 72,
790  0, 31, 30, 33, 34, 35, 36, 37, 38, 39,
791  41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
792  51, 52, 53, 54, 56, 57, 59, 60, 61, 52,
793  79, 50, 61, 26, 72, 79, 64, 72, 72, 72,
794  72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
795  72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
796  10, 80, 71, 73, 79, 66, 76, 6, 72, 64,
797  64, 67, 10, 63, 72, 75, 72, 64, 72, 31,
798  64, 72
799 };
800 
801  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
802 static const yytype_uint8 yyr1[] =
803 {
804  0, 68, 69, 69, 70, 71, 71, 72, 72, 72,
805  72, 72, 72, 72, 72, 72, 72, 72, 72, 73,
806  72, 74, 75, 75, 75, 76, 72, 72, 72, 72,
807  72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
808  72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
809  72, 72, 72, 72, 72, 72, 72, 72, 72, 77,
810  77, 72, 72, 72, 78, 78, 79, 79, 79, 80
811 };
812 
813  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
814 static const yytype_uint8 yyr2[] =
815 {
816  0, 2, 1, 1, 1, 1, 3, 2, 2, 2,
817  2, 2, 2, 2, 2, 3, 4, 3, 4, 0,
818  5, 1, 0, 1, 3, 1, 4, 4, 3, 3,
819  3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
820  3, 3, 3, 3, 3, 3, 3, 3, 5, 3,
821  3, 1, 1, 1, 1, 1, 1, 4, 4, 1,
822  3, 1, 1, 1, 2, 1, 2, 1, 1, 1
823 };
824 
825 
826 #define yyerrok (yyerrstatus = 0)
827 #define yyclearin (yychar = YYEMPTY)
828 #define YYEMPTY (-2)
829 #define YYEOF 0
830 
831 #define YYACCEPT goto yyacceptlab
832 #define YYABORT goto yyabortlab
833 #define YYERROR goto yyerrorlab
834 
835 
836 #define YYRECOVERING() (!!yyerrstatus)
837 
838 #define YYBACKUP(Token, Value) \
839 do \
840  if (yychar == YYEMPTY) \
841  { \
842  yychar = (Token); \
843  yylval = (Value); \
844  YYPOPSTACK (yylen); \
845  yystate = *yyssp; \
846  goto yybackup; \
847  } \
848  else \
849  { \
850  yyerror (YY_("syntax error: cannot back up")); \
851  YYERROR; \
852  } \
853 while (0)
854 
855 /* Error token number */
856 #define YYTERROR 1
857 #define YYERRCODE 256
858 
859 
860 
861 /* Enable debugging if requested. */
862 #if YYDEBUG
863 
864 # ifndef YYFPRINTF
865 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
866 # define YYFPRINTF fprintf
867 # endif
868 
869 # define YYDPRINTF(Args) \
870 do { \
871  if (yydebug) \
872  YYFPRINTF Args; \
873 } while (0)
874 
875 /* This macro is provided for backward compatibility. */
876 #ifndef YY_LOCATION_PRINT
877 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
878 #endif
879 
880 
881 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
882 do { \
883  if (yydebug) \
884  { \
885  YYFPRINTF (stderr, "%s ", Title); \
886  yy_symbol_print (stderr, \
887  Type, Value); \
888  YYFPRINTF (stderr, "\n"); \
889  } \
890 } while (0)
891 
892 
893 /*----------------------------------------.
894 | Print this symbol's value on YYOUTPUT. |
895 `----------------------------------------*/
896 
897 static void
898 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
899 {
900  FILE *yyo = yyoutput;
901  YYUSE (yyo);
902  if (!yyvaluep)
903  return;
904 # ifdef YYPRINT
905  if (yytype < YYNTOKENS)
906  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
907 # endif
908  YYUSE (yytype);
909 }
910 
911 
912 /*--------------------------------.
913 | Print this symbol on YYOUTPUT. |
914 `--------------------------------*/
915 
916 static void
917 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
918 {
919  YYFPRINTF (yyoutput, "%s %s (",
920  yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
921 
922  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
923  YYFPRINTF (yyoutput, ")");
924 }
925 
926 /*------------------------------------------------------------------.
927 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
928 | TOP (included). |
929 `------------------------------------------------------------------*/
930 
931 static void
933 {
934  YYFPRINTF (stderr, "Stack now");
935  for (; yybottom <= yytop; yybottom++)
936  {
937  int yybot = *yybottom;
938  YYFPRINTF (stderr, " %d", yybot);
939  }
940  YYFPRINTF (stderr, "\n");
941 }
942 
943 # define YY_STACK_PRINT(Bottom, Top) \
944 do { \
945  if (yydebug) \
946  yy_stack_print ((Bottom), (Top)); \
947 } while (0)
948 
949 
950 /*------------------------------------------------.
951 | Report that the YYRULE is going to be reduced. |
952 `------------------------------------------------*/
953 
954 static void
956 {
957  unsigned long int yylno = yyrline[yyrule];
958  int yynrhs = yyr2[yyrule];
959  int yyi;
960  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
961  yyrule - 1, yylno);
962  /* The symbols being reduced. */
963  for (yyi = 0; yyi < yynrhs; yyi++)
964  {
965  YYFPRINTF (stderr, " $%d = ", yyi + 1);
966  yy_symbol_print (stderr,
967  yystos[yyssp[yyi + 1 - yynrhs]],
968  &(yyvsp[(yyi + 1) - (yynrhs)])
969  );
970  YYFPRINTF (stderr, "\n");
971  }
972 }
973 
974 # define YY_REDUCE_PRINT(Rule) \
975 do { \
976  if (yydebug) \
977  yy_reduce_print (yyssp, yyvsp, Rule); \
978 } while (0)
979 
980 /* Nonzero means print parse trace. It is left uninitialized so that
981  multiple parsers can coexist. */
983 #else /* !YYDEBUG */
984 # define YYDPRINTF(Args)
985 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
986 # define YY_STACK_PRINT(Bottom, Top)
987 # define YY_REDUCE_PRINT(Rule)
988 #endif /* !YYDEBUG */
989 
990 
991 /* YYINITDEPTH -- initial size of the parser's stacks. */
992 #ifndef YYINITDEPTH
993 # define YYINITDEPTH 200
994 #endif
995 
996 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
997  if the built-in stack extension method is used).
998 
999  Do not make this value too large; the results are undefined if
1000  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1001  evaluated with infinite-precision integer arithmetic. */
1002 
1003 #ifndef YYMAXDEPTH
1004 # define YYMAXDEPTH 10000
1005 #endif
1006 
1007 
1008 #if YYERROR_VERBOSE
1009 
1010 # ifndef yystrlen
1011 # if defined __GLIBC__ && defined _STRING_H
1012 # define yystrlen strlen
1013 # else
1014 /* Return the length of YYSTR. */
1015 static YYSIZE_T
1016 yystrlen (const char *yystr)
1017 {
1018  YYSIZE_T yylen;
1019  for (yylen = 0; yystr[yylen]; yylen++)
1020  continue;
1021  return yylen;
1022 }
1023 # endif
1024 # endif
1025 
1026 # ifndef yystpcpy
1027 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1028 # define yystpcpy stpcpy
1029 # else
1030 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1031  YYDEST. */
1032 static char *
1033 yystpcpy (char *yydest, const char *yysrc)
1034 {
1035  char *yyd = yydest;
1036  const char *yys = yysrc;
1037 
1038  while ((*yyd++ = *yys++) != '\0')
1039  continue;
1040 
1041  return yyd - 1;
1042 }
1043 # endif
1044 # endif
1045 
1046 # ifndef yytnamerr
1047 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1048  quotes and backslashes, so that it's suitable for yyerror. The
1049  heuristic is that double-quoting is unnecessary unless the string
1050  contains an apostrophe, a comma, or backslash (other than
1051  backslash-backslash). YYSTR is taken from yytname. If YYRES is
1052  null, do not copy; instead, return the length of what the result
1053  would have been. */
1054 static YYSIZE_T
1055 yytnamerr (char *yyres, const char *yystr)
1056 {
1057  if (*yystr == '"')
1058  {
1059  YYSIZE_T yyn = 0;
1060  char const *yyp = yystr;
1061 
1062  for (;;)
1063  switch (*++yyp)
1064  {
1065  case '\'':
1066  case ',':
1067  goto do_not_strip_quotes;
1068 
1069  case '\\':
1070  if (*++yyp != '\\')
1071  goto do_not_strip_quotes;
1072  /* Fall through. */
1073  default:
1074  if (yyres)
1075  yyres[yyn] = *yyp;
1076  yyn++;
1077  break;
1078 
1079  case '"':
1080  if (yyres)
1081  yyres[yyn] = '\0';
1082  return yyn;
1083  }
1084  do_not_strip_quotes: ;
1085  }
1086 
1087  if (! yyres)
1088  return yystrlen (yystr);
1089 
1090  return yystpcpy (yyres, yystr) - yyres;
1091 }
1092 # endif
1093 
1094 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1095  about the unexpected token YYTOKEN for the state stack whose top is
1096  YYSSP.
1097 
1098  Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1099  not large enough to hold the message. In that case, also set
1100  *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1101  required number of bytes is too large to store. */
1102 static int
1103 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1104  yytype_int16 *yyssp, int yytoken)
1105 {
1106  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]);
1107  YYSIZE_T yysize = yysize0;
1108  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1109  /* Internationalized format string. */
1110  const char *yyformat = YY_NULLPTRPTR;
1111  /* Arguments of yyformat. */
1112  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1113  /* Number of reported tokens (one for the "unexpected", one per
1114  "expected"). */
1115  int yycount = 0;
1116 
1117  /* There are many possibilities here to consider:
1118  - If this state is a consistent state with a default action, then
1119  the only way this function was invoked is if the default action
1120  is an error action. In that case, don't check for expected
1121  tokens because there are none.
1122  - The only way there can be no lookahead present (in yychar) is if
1123  this state is a consistent state with a default action. Thus,
1124  detecting the absence of a lookahead is sufficient to determine
1125  that there is no unexpected or expected token to report. In that
1126  case, just report a simple "syntax error".
1127  - Don't assume there isn't a lookahead just because this state is a
1128  consistent state with a default action. There might have been a
1129  previous inconsistent state, consistent state with a non-default
1130  action, or user semantic action that manipulated yychar.
1131  - Of course, the expected token list depends on states to have
1132  correct lookahead information, and it depends on the parser not
1133  to perform extra reductions after fetching a lookahead from the
1134  scanner and before detecting a syntax error. Thus, state merging
1135  (from LALR or IELR) and default reductions corrupt the expected
1136  token list. However, the list is correct for canonical LR with
1137  one exception: it will still contain any token that will not be
1138  accepted due to an error action in a later state.
1139  */
1140  if (yytoken != YYEMPTY)
1141  {
1142  int yyn = yypact[*yyssp];
1143  yyarg[yycount++] = yytname[yytoken];
1144  if (!yypact_value_is_default (yyn))
1145  {
1146  /* Start YYX at -YYN if negative to avoid negative indexes in
1147  YYCHECK. In other words, skip the first -YYN actions for
1148  this state because they are default actions. */
1149  int yyxbegin = yyn < 0 ? -yyn : 0;
1150  /* Stay within bounds of both yycheck and yytname. */
1151  int yychecklim = YYLAST - yyn + 1;
1152  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1153  int yyx;
1154 
1155  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1156  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1157  && !yytable_value_is_error (yytable[yyx + yyn]))
1158  {
1159  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1160  {
1161  yycount = 1;
1162  yysize = yysize0;
1163  break;
1164  }
1165  yyarg[yycount++] = yytname[yyx];
1166  {
1167  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]);
1168  if (! (yysize <= yysize1
1169  && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1170  return 2;
1171  yysize = yysize1;
1172  }
1173  }
1174  }
1175  }
1176 
1177  switch (yycount)
1178  {
1179 # define YYCASE_(N, S) \
1180  case N: \
1181  yyformat = S; \
1182  break
1183  YYCASE_(0, YY_("syntax error"));
1184  YYCASE_(1, YY_("syntax error, unexpected %s"));
1185  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1186  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1187  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1188  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1189 # undef YYCASE_
1190  }
1191 
1192  {
1193  YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1194  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1195  return 2;
1196  yysize = yysize1;
1197  }
1198 
1199  if (*yymsg_alloc < yysize)
1200  {
1201  *yymsg_alloc = 2 * yysize;
1202  if (! (yysize <= *yymsg_alloc
1203  && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1204  *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1205  return 1;
1206  }
1207 
1208  /* Avoid sprintf, as that infringes on the user's name space.
1209  Don't have undefined behavior even if the translation
1210  produced a string with the wrong number of "%s"s. */
1211  {
1212  char *yyp = *yymsg;
1213  int yyi = 0;
1214  while ((*yyp = *yyformat) != '\0')
1215  if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1216  {
1217  yyp += yytnamerr (yyp, yyarg[yyi++]);
1218  yyformat += 2;
1219  }
1220  else
1221  {
1222  yyp++;
1223  yyformat++;
1224  }
1225  }
1226  return 0;
1227 }
1228 #endif /* YYERROR_VERBOSE */
1229 
1230 /*-----------------------------------------------.
1231 | Release the memory associated to this symbol. |
1232 `-----------------------------------------------*/
1233 
1234 static void
1235 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1236 {
1237  YYUSE (yyvaluep);
1238  if (!yymsg)
1239  yymsg = "Deleting";
1240  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1241 
1243  YYUSE (yytype);
1245 }
1246 
1247 
1248 
1249 
1250 /* The lookahead symbol. */
1252 
1253 /* The semantic value of the lookahead symbol. */
1255 /* Number of syntax errors so far. */
1257 
1258 
1259 /*----------.
1260 | yyparse. |
1261 `----------*/
1262 
1263 int
1264 yyparse (void)
1265 {
1266  int yystate;
1267  /* Number of tokens to shift before error messages enabled. */
1268  int yyerrstatus;
1269 
1270  /* The stacks and their tools:
1271  'yyss': related to states.
1272  'yyvs': related to semantic values.
1273 
1274  Refer to the stacks through separate pointers, to allow yyoverflow
1275  to xreallocate them elsewhere. */
1276 
1277  /* The state stack. */
1278  yytype_int16 yyssa[YYINITDEPTH];
1279  yytype_int16 *yyss;
1281 
1282  /* The semantic value stack. */
1283  YYSTYPE yyvsa[YYINITDEPTH];
1284  YYSTYPE *yyvs;
1285  YYSTYPE *yyvsp;
1286 
1288 
1289  int yyn;
1290  int yyresult;
1291  /* Lookahead token as an internal (translated) token number. */
1292  int yytoken = 0;
1293  /* The variables used to return semantic value and location from the
1294  action routines. */
1295  YYSTYPE yyval;
1296 
1297 #if YYERROR_VERBOSE
1298  /* Buffer for error messages, and its allocated size. */
1299  char yymsgbuf[128];
1300  char *yymsg = yymsgbuf;
1301  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1302 #endif
1303 
1304 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1305 
1306  /* The number of symbols on the RHS of the reduced rule.
1307  Keep to zero when no symbol should be popped. */
1308  int yylen = 0;
1309 
1310  yyssp = yyss = yyssa;
1311  yyvsp = yyvs = yyvsa;
1313 
1314  YYDPRINTF ((stderr, "Starting parse\n"));
1315 
1316  yystate = 0;
1317  yyerrstatus = 0;
1318  yynerrs = 0;
1319  yychar = YYEMPTY; /* Cause a token to be read. */
1320  goto yysetstate;
1321 
1322 /*------------------------------------------------------------.
1323 | yynewstate -- Push a new state, which is found in yystate. |
1324 `------------------------------------------------------------*/
1325  yynewstate:
1326  /* In all cases, when you get here, the value and location stacks
1327  have just been pushed. So pushing a state here evens the stacks. */
1328  yyssp++;
1329 
1330  yysetstate:
1331  *yyssp = yystate;
1332 
1333  if (yyss + yystacksize - 1 <= yyssp)
1334  {
1335  /* Get the current used size of the three stacks, in elements. */
1336  YYSIZE_T yysize = yyssp - yyss + 1;
1337 
1338 #ifdef yyoverflow
1339  {
1340  /* Give user a chance to xreallocate the stack. Use copies of
1341  these so that the &'s don't force the real ones into
1342  memory. */
1343  YYSTYPE *yyvs1 = yyvs;
1344  yytype_int16 *yyss1 = yyss;
1345 
1346  /* Each stack pointer address is followed by the size of the
1347  data in use in that stack, in bytes. This used to be a
1348  conditional around just the two extra args, but that might
1349  be undefined if yyoverflow is a macro. */
1350  yyoverflow (YY_("memory exhausted"),
1351  &yyss1, yysize * sizeof (*yyssp),
1352  &yyvs1, yysize * sizeof (*yyvsp),
1353  &yystacksize);
1354 
1355  yyss = yyss1;
1356  yyvs = yyvs1;
1357  }
1358 #else /* no yyoverflow */
1359 # ifndef YYSTACK_RELOCATE
1360  goto yyexhaustedlab;
1361 # else
1362  /* Extend the stack our own way. */
1363  if (YYMAXDEPTH <= yystacksize)
1364  goto yyexhaustedlab;
1365  yystacksize *= 2;
1366  if (YYMAXDEPTH < yystacksize)
1368 
1369  {
1370  yytype_int16 *yyss1 = yyss;
1371  union yyalloc *yyptr =
1373  if (! yyptr)
1374  goto yyexhaustedlab;
1377 # undef YYSTACK_RELOCATE
1378  if (yyss1 != yyssa)
1379  YYSTACK_FREE (yyss1);
1380  }
1381 # endif
1382 #endif /* no yyoverflow */
1383 
1384  yyssp = yyss + yysize - 1;
1385  yyvsp = yyvs + yysize - 1;
1386 
1387  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1388  (unsigned long int) yystacksize));
1389 
1390  if (yyss + yystacksize - 1 <= yyssp)
1391  YYABORT;
1392  }
1393 
1394  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1395 
1396  if (yystate == YYFINAL)
1397  YYACCEPT;
1398 
1399  goto yybackup;
1400 
1401 /*-----------.
1402 | yybackup. |
1403 `-----------*/
1404 yybackup:
1405 
1406  /* Do appropriate processing given the current state. Read a
1407  lookahead token if we need one and don't already have one. */
1408 
1409  /* First try to decide what to do without reference to lookahead token. */
1410  yyn = yypact[yystate];
1411  if (yypact_value_is_default (yyn))
1412  goto yydefault;
1413 
1414  /* Not known => get a lookahead token if don't already have one. */
1415 
1416  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1417  if (yychar == YYEMPTY)
1418  {
1419  YYDPRINTF ((stderr, "Reading a token: "));
1420  yychar = yylex ();
1421  }
1422 
1423  if (yychar <= YYEOF)
1424  {
1425  yychar = yytoken = YYEOF;
1426  YYDPRINTF ((stderr, "Now at end of input.\n"));
1427  }
1428  else
1429  {
1430  yytoken = YYTRANSLATE (yychar);
1431  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1432  }
1433 
1434  /* If the proper action on seeing token YYTOKEN is to reduce or to
1435  detect an error, take that action. */
1436  yyn += yytoken;
1437  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1438  goto yydefault;
1439  yyn = yytable[yyn];
1440  if (yyn <= 0)
1441  {
1442  if (yytable_value_is_error (yyn))
1443  goto yyerrlab;
1444  yyn = -yyn;
1445  goto yyreduce;
1446  }
1447 
1448  /* Count tokens shifted since error; after three, turn off error
1449  status. */
1450  if (yyerrstatus)
1451  yyerrstatus--;
1452 
1453  /* Shift the lookahead token. */
1454  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1455 
1456  /* Discard the shifted token. */
1457  yychar = YYEMPTY;
1458 
1459  yystate = yyn;
1461  *++yyvsp = yylval;
1463 
1464  goto yynewstate;
1465 
1466 
1467 /*-----------------------------------------------------------.
1468 | yydefault -- do the default action for the current state. |
1469 `-----------------------------------------------------------*/
1470 yydefault:
1471  yyn = yydefact[yystate];
1472  if (yyn == 0)
1473  goto yyerrlab;
1474  goto yyreduce;
1475 
1476 
1477 /*-----------------------------.
1478 | yyreduce -- Do a reduction. |
1479 `-----------------------------*/
1480 yyreduce:
1481  /* yyn is the number of a rule to reduce with. */
1482  yylen = yyr2[yyn];
1483 
1484  /* If YYLEN is nonzero, implement the default value of the action:
1485  '$$ = $1'.
1486 
1487  Otherwise, the following line sets YYVAL to garbage.
1488  This behavior is undocumented and Bison
1489  users should not rely upon it. Assigning to YYVAL
1490  unconditionally makes the parser a bit smaller, and it avoids a
1491  GCC warning that YYVAL may be used uninitialized. */
1492  yyval = yyvsp[1-yylen];
1493 
1494 
1495  YY_REDUCE_PRINT (yyn);
1496  switch (yyn)
1497  {
1498  case 4:
1499 #line 196 "go-exp.y" /* yacc.c:1646 */
1500  { write_exp_elt_opcode (pstate, OP_TYPE);
1501  write_exp_elt_type (pstate, (yyvsp[0].tval));
1502  write_exp_elt_opcode (pstate, OP_TYPE); }
1503 #line 1505 "go-exp.c" /* yacc.c:1646 */
1504  break;
1505 
1506  case 6:
1507 #line 204 "go-exp.y" /* yacc.c:1646 */
1508  { write_exp_elt_opcode (pstate, BINOP_COMMA); }
1509 #line 1511 "go-exp.c" /* yacc.c:1646 */
1510  break;
1511 
1512  case 7:
1513 #line 209 "go-exp.y" /* yacc.c:1646 */
1514  { write_exp_elt_opcode (pstate, UNOP_IND); }
1515 #line 1517 "go-exp.c" /* yacc.c:1646 */
1516  break;
1517 
1518  case 8:
1519 #line 213 "go-exp.y" /* yacc.c:1646 */
1520  { write_exp_elt_opcode (pstate, UNOP_ADDR); }
1521 #line 1523 "go-exp.c" /* yacc.c:1646 */
1522  break;
1523 
1524  case 9:
1525 #line 217 "go-exp.y" /* yacc.c:1646 */
1526  { write_exp_elt_opcode (pstate, UNOP_NEG); }
1527 #line 1529 "go-exp.c" /* yacc.c:1646 */
1528  break;
1529 
1530  case 10:
1531 #line 221 "go-exp.y" /* yacc.c:1646 */
1532  { write_exp_elt_opcode (pstate, UNOP_PLUS); }
1533 #line 1535 "go-exp.c" /* yacc.c:1646 */
1534  break;
1535 
1536  case 11:
1537 #line 225 "go-exp.y" /* yacc.c:1646 */
1538  { write_exp_elt_opcode (pstate, UNOP_LOGICAL_NOT); }
1539 #line 1541 "go-exp.c" /* yacc.c:1646 */
1540  break;
1541 
1542  case 12:
1543 #line 229 "go-exp.y" /* yacc.c:1646 */
1544  { write_exp_elt_opcode (pstate, UNOP_COMPLEMENT); }
1545 #line 1547 "go-exp.c" /* yacc.c:1646 */
1546  break;
1547 
1548  case 13:
1549 #line 233 "go-exp.y" /* yacc.c:1646 */
1550  { write_exp_elt_opcode (pstate, UNOP_POSTINCREMENT); }
1551 #line 1553 "go-exp.c" /* yacc.c:1646 */
1552  break;
1553 
1554  case 14:
1555 #line 237 "go-exp.y" /* yacc.c:1646 */
1556  { write_exp_elt_opcode (pstate, UNOP_POSTDECREMENT); }
1557 #line 1559 "go-exp.c" /* yacc.c:1646 */
1558  break;
1559 
1560  case 15:
1561 #line 243 "go-exp.y" /* yacc.c:1646 */
1562  { write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
1563  write_exp_string (pstate, (yyvsp[0].ssym).stoken);
1564  write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
1565 #line 1567 "go-exp.c" /* yacc.c:1646 */
1566  break;
1567 
1568  case 16:
1569 #line 249 "go-exp.y" /* yacc.c:1646 */
1571  write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
1572  write_exp_string (pstate, (yyvsp[-1].ssym).stoken);
1573  write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
1574 #line 1576 "go-exp.c" /* yacc.c:1646 */
1575  break;
1576 
1577  case 17:
1578 #line 256 "go-exp.y" /* yacc.c:1646 */
1579  { struct stoken s;
1581  write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
1582  s.ptr = "";
1583  s.length = 0;
1584  write_exp_string (pstate, s);
1585  write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
1586 #line 1588 "go-exp.c" /* yacc.c:1646 */
1587  break;
1588 
1589  case 18:
1590 #line 266 "go-exp.y" /* yacc.c:1646 */
1591  { write_exp_elt_opcode (pstate, BINOP_SUBSCRIPT); }
1592 #line 1594 "go-exp.c" /* yacc.c:1646 */
1593  break;
1594 
1595  case 19:
1596 #line 272 "go-exp.y" /* yacc.c:1646 */
1597  { start_arglist (); }
1598 #line 1600 "go-exp.c" /* yacc.c:1646 */
1599  break;
1600 
1601  case 20:
1602 #line 274 "go-exp.y" /* yacc.c:1646 */
1603  { write_exp_elt_opcode (pstate, OP_FUNCALL);
1605  (LONGEST) end_arglist ());
1606  write_exp_elt_opcode (pstate, OP_FUNCALL); }
1607 #line 1609 "go-exp.c" /* yacc.c:1646 */
1608  break;
1609 
1610  case 21:
1611 #line 281 "go-exp.y" /* yacc.c:1646 */
1612  { start_arglist (); }
1613 #line 1615 "go-exp.c" /* yacc.c:1646 */
1614  break;
1615 
1616  case 23:
1617 #line 288 "go-exp.y" /* yacc.c:1646 */
1618  { arglist_len = 1; }
1619 #line 1621 "go-exp.c" /* yacc.c:1646 */
1620  break;
1621 
1622  case 24:
1623 #line 292 "go-exp.y" /* yacc.c:1646 */
1624  { arglist_len++; }
1625 #line 1627 "go-exp.c" /* yacc.c:1646 */
1626  break;
1627 
1628  case 25:
1629 #line 296 "go-exp.y" /* yacc.c:1646 */
1630  { (yyval.lval) = end_arglist () - 1; }
1631 #line 1633 "go-exp.c" /* yacc.c:1646 */
1632  break;
1633 
1634  case 26:
1635 #line 300 "go-exp.y" /* yacc.c:1646 */
1636  { write_exp_elt_opcode (pstate, UNOP_MEMVAL);
1637  write_exp_elt_type (pstate, (yyvsp[-2].tval));
1638  write_exp_elt_opcode (pstate, UNOP_MEMVAL); }
1639 #line 1641 "go-exp.c" /* yacc.c:1646 */
1640  break;
1641 
1642  case 27:
1643 #line 306 "go-exp.y" /* yacc.c:1646 */
1644  { write_exp_elt_opcode (pstate, UNOP_CAST);
1645  write_exp_elt_type (pstate, (yyvsp[-3].tval));
1646  write_exp_elt_opcode (pstate, UNOP_CAST); }
1647 #line 1649 "go-exp.c" /* yacc.c:1646 */
1648  break;
1649 
1650  case 28:
1651 #line 312 "go-exp.y" /* yacc.c:1646 */
1652  { }
1653 #line 1655 "go-exp.c" /* yacc.c:1646 */
1654  break;
1655 
1656  case 29:
1657 #line 318 "go-exp.y" /* yacc.c:1646 */
1658  { write_exp_elt_opcode (pstate, BINOP_REPEAT); }
1659 #line 1661 "go-exp.c" /* yacc.c:1646 */
1660  break;
1661 
1662  case 30:
1663 #line 322 "go-exp.y" /* yacc.c:1646 */
1664  { write_exp_elt_opcode (pstate, BINOP_MUL); }
1665 #line 1667 "go-exp.c" /* yacc.c:1646 */
1666  break;
1667 
1668  case 31:
1669 #line 326 "go-exp.y" /* yacc.c:1646 */
1670  { write_exp_elt_opcode (pstate, BINOP_DIV); }
1671 #line 1673 "go-exp.c" /* yacc.c:1646 */
1672  break;
1673 
1674  case 32:
1675 #line 330 "go-exp.y" /* yacc.c:1646 */
1676  { write_exp_elt_opcode (pstate, BINOP_REM); }
1677 #line 1679 "go-exp.c" /* yacc.c:1646 */
1678  break;
1679 
1680  case 33:
1681 #line 334 "go-exp.y" /* yacc.c:1646 */
1682  { write_exp_elt_opcode (pstate, BINOP_ADD); }
1683 #line 1685 "go-exp.c" /* yacc.c:1646 */
1684  break;
1685 
1686  case 34:
1687 #line 338 "go-exp.y" /* yacc.c:1646 */
1688  { write_exp_elt_opcode (pstate, BINOP_SUB); }
1689 #line 1691 "go-exp.c" /* yacc.c:1646 */
1690  break;
1691 
1692  case 35:
1693 #line 342 "go-exp.y" /* yacc.c:1646 */
1694  { write_exp_elt_opcode (pstate, BINOP_LSH); }
1695 #line 1697 "go-exp.c" /* yacc.c:1646 */
1696  break;
1697 
1698  case 36:
1699 #line 346 "go-exp.y" /* yacc.c:1646 */
1700  { write_exp_elt_opcode (pstate, BINOP_RSH); }
1701 #line 1703 "go-exp.c" /* yacc.c:1646 */
1702  break;
1703 
1704  case 37:
1705 #line 350 "go-exp.y" /* yacc.c:1646 */
1706  { write_exp_elt_opcode (pstate, BINOP_EQUAL); }
1707 #line 1709 "go-exp.c" /* yacc.c:1646 */
1708  break;
1709 
1710  case 38:
1711 #line 354 "go-exp.y" /* yacc.c:1646 */
1712  { write_exp_elt_opcode (pstate, BINOP_NOTEQUAL); }
1713 #line 1715 "go-exp.c" /* yacc.c:1646 */
1714  break;
1715 
1716  case 39:
1717 #line 358 "go-exp.y" /* yacc.c:1646 */
1718  { write_exp_elt_opcode (pstate, BINOP_LEQ); }
1719 #line 1721 "go-exp.c" /* yacc.c:1646 */
1720  break;
1721 
1722  case 40:
1723 #line 362 "go-exp.y" /* yacc.c:1646 */
1724  { write_exp_elt_opcode (pstate, BINOP_GEQ); }
1725 #line 1727 "go-exp.c" /* yacc.c:1646 */
1726  break;
1727 
1728  case 41:
1729 #line 366 "go-exp.y" /* yacc.c:1646 */
1730  { write_exp_elt_opcode (pstate, BINOP_LESS); }
1731 #line 1733 "go-exp.c" /* yacc.c:1646 */
1732  break;
1733 
1734  case 42:
1735 #line 370 "go-exp.y" /* yacc.c:1646 */
1736  { write_exp_elt_opcode (pstate, BINOP_GTR); }
1737 #line 1739 "go-exp.c" /* yacc.c:1646 */
1738  break;
1739 
1740  case 43:
1741 #line 374 "go-exp.y" /* yacc.c:1646 */
1742  { write_exp_elt_opcode (pstate, BINOP_BITWISE_AND); }
1743 #line 1745 "go-exp.c" /* yacc.c:1646 */
1744  break;
1745 
1746  case 44:
1747 #line 378 "go-exp.y" /* yacc.c:1646 */
1748  { write_exp_elt_opcode (pstate, BINOP_BITWISE_XOR); }
1749 #line 1751 "go-exp.c" /* yacc.c:1646 */
1750  break;
1751 
1752  case 45:
1753 #line 382 "go-exp.y" /* yacc.c:1646 */
1754  { write_exp_elt_opcode (pstate, BINOP_BITWISE_IOR); }
1755 #line 1757 "go-exp.c" /* yacc.c:1646 */
1756  break;
1757 
1758  case 46:
1759 #line 386 "go-exp.y" /* yacc.c:1646 */
1760  { write_exp_elt_opcode (pstate, BINOP_LOGICAL_AND); }
1761 #line 1763 "go-exp.c" /* yacc.c:1646 */
1762  break;
1763 
1764  case 47:
1765 #line 390 "go-exp.y" /* yacc.c:1646 */
1766  { write_exp_elt_opcode (pstate, BINOP_LOGICAL_OR); }
1767 #line 1769 "go-exp.c" /* yacc.c:1646 */
1768  break;
1769 
1770  case 48:
1771 #line 394 "go-exp.y" /* yacc.c:1646 */
1772  { write_exp_elt_opcode (pstate, TERNOP_COND); }
1773 #line 1775 "go-exp.c" /* yacc.c:1646 */
1774  break;
1775 
1776  case 49:
1777 #line 398 "go-exp.y" /* yacc.c:1646 */
1778  { write_exp_elt_opcode (pstate, BINOP_ASSIGN); }
1779 #line 1781 "go-exp.c" /* yacc.c:1646 */
1780  break;
1781 
1782  case 50:
1783 #line 402 "go-exp.y" /* yacc.c:1646 */
1784  { write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY);
1785  write_exp_elt_opcode (pstate, (yyvsp[-1].opcode));
1786  write_exp_elt_opcode (pstate, BINOP_ASSIGN_MODIFY); }
1787 #line 1789 "go-exp.c" /* yacc.c:1646 */
1788  break;
1789 
1790  case 51:
1791 #line 408 "go-exp.y" /* yacc.c:1646 */
1792  { write_exp_elt_opcode (pstate, OP_LONG);
1795  write_exp_elt_opcode (pstate, OP_LONG); }
1796 #line 1798 "go-exp.c" /* yacc.c:1646 */
1797  break;
1798 
1799  case 52:
1800 #line 415 "go-exp.y" /* yacc.c:1646 */
1801  {
1802  struct stoken_vector vec;
1803  vec.len = 1;
1804  vec.tokens = &(yyvsp[0].tsval);
1805  write_exp_string_vector (pstate, (yyvsp[0].tsval).type, &vec);
1806  }
1807 #line 1809 "go-exp.c" /* yacc.c:1646 */
1808  break;
1809 
1810  case 53:
1811 #line 424 "go-exp.y" /* yacc.c:1646 */
1812  { YYSTYPE val;
1813  parse_number (pstate, (yyvsp[0].ssym).stoken.ptr,
1814  (yyvsp[0].ssym).stoken.length, 0, &val);
1815  write_exp_elt_opcode (pstate, OP_LONG);
1818  val.typed_val_int.val);
1819  write_exp_elt_opcode (pstate, OP_LONG);
1820  }
1821 #line 1823 "go-exp.c" /* yacc.c:1646 */
1822  break;
1823 
1824  case 54:
1825 #line 437 "go-exp.y" /* yacc.c:1646 */
1826  { write_exp_elt_opcode (pstate, OP_FLOAT);
1829  write_exp_elt_opcode (pstate, OP_FLOAT); }
1830 #line 1832 "go-exp.c" /* yacc.c:1646 */
1831  break;
1832 
1833  case 56:
1834 #line 447 "go-exp.y" /* yacc.c:1646 */
1835  {
1836  write_dollar_variable (pstate, (yyvsp[0].sval));
1837  }
1838 #line 1840 "go-exp.c" /* yacc.c:1646 */
1839  break;
1840 
1841  case 57:
1842 #line 453 "go-exp.y" /* yacc.c:1646 */
1843  {
1844  /* TODO(dje): Go objects in structs. */
1845  write_exp_elt_opcode (pstate, OP_LONG);
1846  /* TODO(dje): What's the right type here? */
1848  (pstate,
1849  parse_type (pstate)->builtin_unsigned_int);
1850  (yyvsp[-1].tval) = check_typedef ((yyvsp[-1].tval));
1852  (LONGEST) TYPE_LENGTH ((yyvsp[-1].tval)));
1853  write_exp_elt_opcode (pstate, OP_LONG);
1854  }
1855 #line 1857 "go-exp.c" /* yacc.c:1646 */
1856  break;
1857 
1858  case 58:
1859 #line 468 "go-exp.y" /* yacc.c:1646 */
1860  {
1861  /* TODO(dje): Go objects in structs. */
1862  write_exp_elt_opcode (pstate, UNOP_SIZEOF);
1863  }
1864 #line 1866 "go-exp.c" /* yacc.c:1646 */
1865  break;
1866 
1867  case 59:
1868 #line 475 "go-exp.y" /* yacc.c:1646 */
1869  {
1870  /* We copy the string here, and not in the
1871  lexer, to guarantee that we do not leak a
1872  string. */
1873  /* Note that we NUL-terminate here, but just
1874  for convenience. */
1875  struct typed_stoken *vec = XNEW (struct typed_stoken);
1876  (yyval.svec).len = 1;
1877  (yyval.svec).tokens = vec;
1878 
1879  vec->type = (yyvsp[0].tsval).type;
1880  vec->length = (yyvsp[0].tsval).length;
1881  vec->ptr = (char *) xmalloc ((yyvsp[0].tsval).length + 1);
1882  memcpy (vec->ptr, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1);
1883  }
1884 #line 1886 "go-exp.c" /* yacc.c:1646 */
1885  break;
1886 
1887  case 60:
1888 #line 492 "go-exp.y" /* yacc.c:1646 */
1889  {
1890  /* Note that we NUL-terminate here, but just
1891  for convenience. */
1892  char *p;
1893  ++(yyval.svec).len;
1894  (yyval.svec).tokens = XRESIZEVEC (struct typed_stoken,
1895  (yyval.svec).tokens, (yyval.svec).len);
1896 
1897  p = (char *) xmalloc ((yyvsp[0].tsval).length + 1);
1898  memcpy (p, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1);
1899 
1900  (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[0].tsval).type;
1901  (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[0].tsval).length;
1902  (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p;
1903  }
1904 #line 1906 "go-exp.c" /* yacc.c:1646 */
1905  break;
1906 
1907  case 61:
1908 #line 510 "go-exp.y" /* yacc.c:1646 */
1909  {
1910  int i;
1911 
1912  write_exp_string_vector (pstate, 0 /*always utf8*/,
1913  &(yyvsp[0].svec));
1914  for (i = 0; i < (yyvsp[0].svec).len; ++i)
1915  xfree ((yyvsp[0].svec).tokens[i].ptr);
1916  xfree ((yyvsp[0].svec).tokens);
1917  }
1918 #line 1920 "go-exp.c" /* yacc.c:1646 */
1919  break;
1920 
1921  case 62:
1922 #line 522 "go-exp.y" /* yacc.c:1646 */
1923  { write_exp_elt_opcode (pstate, OP_BOOL);
1924  write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval));
1925  write_exp_elt_opcode (pstate, OP_BOOL); }
1926 #line 1928 "go-exp.c" /* yacc.c:1646 */
1927  break;
1928 
1929  case 63:
1930 #line 528 "go-exp.y" /* yacc.c:1646 */
1931  { write_exp_elt_opcode (pstate, OP_BOOL);
1932  write_exp_elt_longcst (pstate, (LONGEST) (yyvsp[0].lval));
1933  write_exp_elt_opcode (pstate, OP_BOOL); }
1934 #line 1936 "go-exp.c" /* yacc.c:1646 */
1935  break;
1936 
1937  case 64:
1938 #line 534 "go-exp.y" /* yacc.c:1646 */
1939  { struct symbol *sym = (yyvsp[-1].ssym).sym.symbol;
1940 
1941  if (sym == NULL
1942  || !SYMBOL_IS_ARGUMENT (sym)
1943  || !symbol_read_needs_frame (sym))
1944  error (_("@entry can be used only for function "
1945  "parameters, not for \"%s\""),
1946  copy_name ((yyvsp[-1].ssym).stoken));
1947 
1948  write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE);
1949  write_exp_elt_sym (pstate, sym);
1950  write_exp_elt_opcode (pstate, OP_VAR_ENTRY_VALUE);
1951  }
1952 #line 1954 "go-exp.c" /* yacc.c:1646 */
1953  break;
1954 
1955  case 65:
1956 #line 550 "go-exp.y" /* yacc.c:1646 */
1957  { struct block_symbol sym = (yyvsp[0].ssym).sym;
1958 
1959  if (sym.symbol)
1960  {
1961  if (symbol_read_needs_frame (sym.symbol))
1962  {
1963  if (innermost_block == 0
1964  || contained_in (sym.block,
1965  innermost_block))
1966  innermost_block = sym.block;
1967  }
1968 
1969  write_exp_elt_opcode (pstate, OP_VAR_VALUE);
1972  write_exp_elt_opcode (pstate, OP_VAR_VALUE);
1973  }
1974  else if ((yyvsp[0].ssym).is_a_field_of_this)
1975  {
1976  /* TODO(dje): Can we get here?
1977  E.g., via a mix of c++ and go? */
1978  gdb_assert_not_reached ("go with `this' field");
1979  }
1980  else
1981  {
1982  struct bound_minimal_symbol msymbol;
1983  char *arg = copy_name ((yyvsp[0].ssym).stoken);
1984 
1985  msymbol =
1987  if (msymbol.minsym != NULL)
1988  write_exp_msymbol (pstate, msymbol);
1989  else if (!have_full_symbols ()
1990  && !have_partial_symbols ())
1991  error (_("No symbol table is loaded. "
1992  "Use the \"file\" command."));
1993  else
1994  error (_("No symbol \"%s\" in current context."),
1995  copy_name ((yyvsp[0].ssym).stoken));
1996  }
1997  }
1998 #line 2000 "go-exp.c" /* yacc.c:1646 */
1999  break;
2000 
2001  case 66:
2002 #line 602 "go-exp.y" /* yacc.c:1646 */
2003  { (yyval.tval) = lookup_pointer_type ((yyvsp[0].tval)); }
2004 #line 2006 "go-exp.c" /* yacc.c:1646 */
2005  break;
2006 
2007  case 67:
2008 #line 604 "go-exp.y" /* yacc.c:1646 */
2009  { (yyval.tval) = (yyvsp[0].tsym).type; }
2010 #line 2012 "go-exp.c" /* yacc.c:1646 */
2011  break;
2012 
2013  case 68:
2014 #line 611 "go-exp.y" /* yacc.c:1646 */
2015  { (yyval.tval) = builtin_go_type (parse_gdbarch (pstate))
2016  ->builtin_uint8; }
2017 #line 2019 "go-exp.c" /* yacc.c:1646 */
2018  break;
2019 
2020 
2021 #line 2023 "go-exp.c" /* yacc.c:1646 */
2022  default: break;
2023  }
2024  /* User semantic actions sometimes alter yychar, and that requires
2025  that yytoken be updated with the new translation. We take the
2026  approach of translating immediately before every use of yytoken.
2027  One alternative is translating here after every semantic action,
2028  but that translation would be missed if the semantic action invokes
2029  YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2030  if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2031  incorrect destructor might then be invoked immediately. In the
2032  case of YYERROR or YYBACKUP, subsequent parser actions might lead
2033  to an incorrect destructor call or verbose syntax error message
2034  before the lookahead is translated. */
2035  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2036 
2037  YYPOPSTACK (yylen);
2038  yylen = 0;
2040 
2041  *++yyvsp = yyval;
2042 
2043  /* Now 'shift' the result of the reduction. Determine what state
2044  that goes to, based on the state we popped back to and the rule
2045  number reduced by. */
2046 
2047  yyn = yyr1[yyn];
2048 
2049  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2050  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2051  yystate = yytable[yystate];
2052  else
2053  yystate = yydefgoto[yyn - YYNTOKENS];
2054 
2055  goto yynewstate;
2056 
2057 
2058 /*--------------------------------------.
2059 | yyerrlab -- here on detecting error. |
2060 `--------------------------------------*/
2061 yyerrlab:
2062  /* Make sure we have latest lookahead translation. See comments at
2063  user semantic actions for why this is necessary. */
2064  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2065 
2066  /* If not already recovering from an error, report this error. */
2067  if (!yyerrstatus)
2068  {
2069  ++yynerrs;
2070 #if ! YYERROR_VERBOSE
2071  yyerror (YY_("syntax error"));
2072 #else
2073 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2074  yyssp, yytoken)
2075  {
2076  char const *yymsgp = YY_("syntax error");
2077  int yysyntax_error_status;
2078  yysyntax_error_status = YYSYNTAX_ERROR;
2079  if (yysyntax_error_status == 0)
2080  yymsgp = yymsg;
2081  else if (yysyntax_error_status == 1)
2082  {
2083  if (yymsg != yymsgbuf)
2084  YYSTACK_FREE (yymsg);
2085  yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2086  if (!yymsg)
2087  {
2088  yymsg = yymsgbuf;
2089  yymsg_alloc = sizeof yymsgbuf;
2090  yysyntax_error_status = 2;
2091  }
2092  else
2093  {
2094  yysyntax_error_status = YYSYNTAX_ERROR;
2095  yymsgp = yymsg;
2096  }
2097  }
2098  yyerror (yymsgp);
2099  if (yysyntax_error_status == 2)
2100  goto yyexhaustedlab;
2101  }
2102 # undef YYSYNTAX_ERROR
2103 #endif
2104  }
2105 
2106 
2107 
2108  if (yyerrstatus == 3)
2109  {
2110  /* If just tried and failed to reuse lookahead token after an
2111  error, discard it. */
2112 
2113  if (yychar <= YYEOF)
2114  {
2115  /* Return failure if at end of input. */
2116  if (yychar == YYEOF)
2117  YYABORT;
2118  }
2119  else
2120  {
2121  yydestruct ("Error: discarding",
2122  yytoken, &yylval);
2123  yychar = YYEMPTY;
2124  }
2125  }
2126 
2127  /* Else will try to reuse lookahead token after shifting the error
2128  token. */
2129  goto yyerrlab1;
2130 
2131 
2132 /*---------------------------------------------------.
2133 | yyerrorlab -- error raised explicitly by YYERROR. |
2134 `---------------------------------------------------*/
2135 yyerrorlab:
2136 
2137  /* Pacify compilers like GCC when the user code never invokes
2138  YYERROR and the label yyerrorlab therefore never appears in user
2139  code. */
2140  if (/*CONSTCOND*/ 0)
2141  goto yyerrorlab;
2142 
2143  /* Do not reclaim the symbols of the rule whose action triggered
2144  this YYERROR. */
2145  YYPOPSTACK (yylen);
2146  yylen = 0;
2148  yystate = *yyssp;
2149  goto yyerrlab1;
2150 
2151 
2152 /*-------------------------------------------------------------.
2153 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2154 `-------------------------------------------------------------*/
2155 yyerrlab1:
2156  yyerrstatus = 3; /* Each real token shifted decrements this. */
2157 
2158  for (;;)
2159  {
2160  yyn = yypact[yystate];
2161  if (!yypact_value_is_default (yyn))
2162  {
2163  yyn += YYTERROR;
2164  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2165  {
2166  yyn = yytable[yyn];
2167  if (0 < yyn)
2168  break;
2169  }
2170  }
2171 
2172  /* Pop the current state because it cannot handle the error token. */
2173  if (yyssp == yyss)
2174  YYABORT;
2175 
2176 
2177  yydestruct ("Error: popping",
2178  yystos[yystate], yyvsp);
2179  YYPOPSTACK (1);
2180  yystate = *yyssp;
2182  }
2183 
2185  *++yyvsp = yylval;
2187 
2188 
2189  /* Shift the error token. */
2190  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2191 
2192  yystate = yyn;
2193  goto yynewstate;
2194 
2195 
2196 /*-------------------------------------.
2197 | yyacceptlab -- YYACCEPT comes here. |
2198 `-------------------------------------*/
2199 yyacceptlab:
2200  yyresult = 0;
2201  goto yyreturn;
2202 
2203 /*-----------------------------------.
2204 | yyabortlab -- YYABORT comes here. |
2205 `-----------------------------------*/
2206 yyabortlab:
2207  yyresult = 1;
2208  goto yyreturn;
2209 
2210 #if !defined yyoverflow || YYERROR_VERBOSE
2211 /*-------------------------------------------------.
2212 | yyexhaustedlab -- memory exhaustion comes here. |
2213 `-------------------------------------------------*/
2214 yyexhaustedlab:
2215  yyerror (YY_("memory exhausted"));
2216  yyresult = 2;
2217  /* Fall through. */
2218 #endif
2219 
2220 yyreturn:
2221  if (yychar != YYEMPTY)
2222  {
2223  /* Make sure we have latest lookahead translation. See comments at
2224  user semantic actions for why this is necessary. */
2225  yytoken = YYTRANSLATE (yychar);
2226  yydestruct ("Cleanup: discarding lookahead",
2227  yytoken, &yylval);
2228  }
2229  /* Do not reclaim the symbols of the rule whose action triggered
2230  this YYABORT or YYACCEPT. */
2231  YYPOPSTACK (yylen);
2233  while (yyssp != yyss)
2234  {
2235  yydestruct ("Cleanup: popping",
2236  yystos[*yyssp], yyvsp);
2237  YYPOPSTACK (1);
2238  }
2239 #ifndef yyoverflow
2240  if (yyss != yyssa)
2241  YYSTACK_FREE (yyss);
2242 #endif
2243 #if YYERROR_VERBOSE
2244  if (yymsg != yymsgbuf)
2245  YYSTACK_FREE (yymsg);
2246 #endif
2247  return yyresult;
2248 }
2249 #line 633 "go-exp.y" /* yacc.c:1906 */
2250 
2251 
2252 /* Take care of parsing a number (anything that starts with a digit).
2253  Set yylval and return the token type; update lexptr.
2254  LEN is the number of characters in it. */
2255 
2256 /* FIXME: Needs some error checking for the float case. */
2257 /* FIXME(dje): IWBN to use c-exp.y's parse_number if we could.
2258  That will require moving the guts into a function that we both call
2259  as our YYSTYPE is different than c-exp.y's */
2260 
2261 static int
2262 parse_number (struct parser_state *par_state,
2263  const char *p, int len, int parsed_float, YYSTYPE *putithere)
2264 {
2265  /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
2266  here, and we do kind of silly things like cast to unsigned. */
2267  LONGEST n = 0;
2268  LONGEST prevn = 0;
2269  ULONGEST un;
2270 
2271  int i = 0;
2272  int c;
2273  int base = input_radix;
2274  int unsigned_p = 0;
2275 
2276  /* Number of "L" suffixes encountered. */
2277  int long_p = 0;
2278 
2279  /* We have found a "L" or "U" suffix. */
2280  int found_suffix = 0;
2281 
2282  ULONGEST high_bit;
2283  struct type *signed_type;
2284  struct type *unsigned_type;
2285 
2286  if (parsed_float)
2287  {
2288  const struct builtin_go_type *builtin_go_types
2289  = builtin_go_type (parse_gdbarch (par_state));
2290 
2291  /* Handle suffixes: 'f' for float32, 'l' for long double.
2292  FIXME: This appears to be an extension -- do we want this? */
2293  if (len >= 1 && tolower (p[len - 1]) == 'f')
2294  {
2295  putithere->typed_val_float.type
2296  = builtin_go_types->builtin_float32;
2297  len--;
2298  }
2299  else if (len >= 1 && tolower (p[len - 1]) == 'l')
2300  {
2301  putithere->typed_val_float.type
2302  = parse_type (par_state)->builtin_long_double;
2303  len--;
2304  }
2305  /* Default type for floating-point literals is float64. */
2306  else
2307  {
2308  putithere->typed_val_float.type
2309  = builtin_go_types->builtin_float64;
2310  }
2311 
2312  if (!parse_float (p, len,
2313  putithere->typed_val_float.type,
2314  putithere->typed_val_float.val))
2315  return ERROR;
2316  return FLOAT;
2317  }
2318 
2319  /* Handle base-switching prefixes 0x, 0t, 0d, 0. */
2320  if (p[0] == '0')
2321  switch (p[1])
2322  {
2323  case 'x':
2324  case 'X':
2325  if (len >= 3)
2326  {
2327  p += 2;
2328  base = 16;
2329  len -= 2;
2330  }
2331  break;
2332 
2333  case 'b':
2334  case 'B':
2335  if (len >= 3)
2336  {
2337  p += 2;
2338  base = 2;
2339  len -= 2;
2340  }
2341  break;
2342 
2343  case 't':
2344  case 'T':
2345  case 'd':
2346  case 'D':
2347  if (len >= 3)
2348  {
2349  p += 2;
2350  base = 10;
2351  len -= 2;
2352  }
2353  break;
2354 
2355  default:
2356  base = 8;
2357  break;
2358  }
2359 
2360  while (len-- > 0)
2361  {
2362  c = *p++;
2363  if (c >= 'A' && c <= 'Z')
2364  c += 'a' - 'A';
2365  if (c != 'l' && c != 'u')
2366  n *= base;
2367  if (c >= '0' && c <= '9')
2368  {
2369  if (found_suffix)
2370  return ERROR;
2371  n += i = c - '0';
2372  }
2373  else
2374  {
2375  if (base > 10 && c >= 'a' && c <= 'f')
2376  {
2377  if (found_suffix)
2378  return ERROR;
2379  n += i = c - 'a' + 10;
2380  }
2381  else if (c == 'l')
2382  {
2383  ++long_p;
2384  found_suffix = 1;
2385  }
2386  else if (c == 'u')
2387  {
2388  unsigned_p = 1;
2389  found_suffix = 1;
2390  }
2391  else
2392  return ERROR; /* Char not a digit */
2393  }
2394  if (i >= base)
2395  return ERROR; /* Invalid digit in this base. */
2396 
2397  /* Portably test for overflow (only works for nonzero values, so make
2398  a second check for zero). FIXME: Can't we just make n and prevn
2399  unsigned and avoid this? */
2400  if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2401  unsigned_p = 1; /* Try something unsigned. */
2402 
2403  /* Portably test for unsigned overflow.
2404  FIXME: This check is wrong; for example it doesn't find overflow
2405  on 0x123456789 when LONGEST is 32 bits. */
2406  if (c != 'l' && c != 'u' && n != 0)
2407  {
2408  if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2409  error (_("Numeric constant too large."));
2410  }
2411  prevn = n;
2412  }
2413 
2414  /* An integer constant is an int, a long, or a long long. An L
2415  suffix forces it to be long; an LL suffix forces it to be long
2416  long. If not forced to a larger size, it gets the first type of
2417  the above that it fits in. To figure out whether it fits, we
2418  shift it right and see whether anything remains. Note that we
2419  can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2420  operation, because many compilers will warn about such a shift
2421  (which always produces a zero result). Sometimes gdbarch_int_bit
2422  or gdbarch_long_bit will be that big, sometimes not. To deal with
2423  the case where it is we just always shift the value more than
2424  once, with fewer bits each time. */
2425 
2426  un = (ULONGEST)n >> 2;
2427  if (long_p == 0
2428  && (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0)
2429  {
2430  high_bit
2431  = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1);
2432 
2433  /* A large decimal (not hex or octal) constant (between INT_MAX
2434  and UINT_MAX) is a long or unsigned long, according to ANSI,
2435  never an unsigned int, but this code treats it as unsigned
2436  int. This probably should be fixed. GCC gives a warning on
2437  such constants. */
2438 
2439  unsigned_type = parse_type (par_state)->builtin_unsigned_int;
2440  signed_type = parse_type (par_state)->builtin_int;
2441  }
2442  else if (long_p <= 1
2443  && (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0)
2444  {
2445  high_bit
2446  = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1);
2447  unsigned_type = parse_type (par_state)->builtin_unsigned_long;
2448  signed_type = parse_type (par_state)->builtin_long;
2449  }
2450  else
2451  {
2452  int shift;
2453  if (sizeof (ULONGEST) * HOST_CHAR_BIT
2454  < gdbarch_long_long_bit (parse_gdbarch (par_state)))
2455  /* A long long does not fit in a LONGEST. */
2456  shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2457  else
2458  shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1);
2459  high_bit = (ULONGEST) 1 << shift;
2460  unsigned_type = parse_type (par_state)->builtin_unsigned_long_long;
2461  signed_type = parse_type (par_state)->builtin_long_long;
2462  }
2463 
2464  putithere->typed_val_int.val = n;
2465 
2466  /* If the high bit of the worked out type is set then this number
2467  has to be unsigned. */
2468 
2469  if (unsigned_p || (n & high_bit))
2470  {
2471  putithere->typed_val_int.type = unsigned_type;
2472  }
2473  else
2474  {
2475  putithere->typed_val_int.type = signed_type;
2476  }
2477 
2478  return INT;
2479 }
2480 
2481 /* Temporary obstack used for holding strings. */
2482 static struct obstack tempbuf;
2483 static int tempbuf_init;
2484 
2485 /* Parse a string or character literal from TOKPTR. The string or
2486  character may be wide or unicode. *OUTPTR is set to just after the
2487  end of the literal in the input string. The resulting token is
2488  stored in VALUE. This returns a token value, either STRING or
2489  CHAR, depending on what was parsed. *HOST_CHARS is set to the
2490  number of host characters in the literal. */
2491 
2492 static int
2493 parse_string_or_char (const char *tokptr, const char **outptr,
2494  struct typed_stoken *value, int *host_chars)
2495 {
2496  int quote;
2497 
2498  /* Build the gdb internal form of the input string in tempbuf. Note
2499  that the buffer is null byte terminated *only* for the
2500  convenience of debugging gdb itself and printing the buffer
2501  contents when the buffer contains no embedded nulls. Gdb does
2502  not depend upon the buffer being null byte terminated, it uses
2503  the length string instead. This allows gdb to handle C strings
2504  (as well as strings in other languages) with embedded null
2505  bytes */
2506 
2507  if (!tempbuf_init)
2508  tempbuf_init = 1;
2509  else
2510  obstack_free (&tempbuf, NULL);
2511  obstack_init (&tempbuf);
2512 
2513  /* Skip the quote. */
2514  quote = *tokptr;
2515  ++tokptr;
2516 
2517  *host_chars = 0;
2518 
2519  while (*tokptr)
2520  {
2521  char c = *tokptr;
2522  if (c == '\\')
2523  {
2524  ++tokptr;
2525  *host_chars += c_parse_escape (&tokptr, &tempbuf);
2526  }
2527  else if (c == quote)
2528  break;
2529  else
2530  {
2531  obstack_1grow (&tempbuf, c);
2532  ++tokptr;
2533  /* FIXME: this does the wrong thing with multi-byte host
2534  characters. We could use mbrlen here, but that would
2535  make "set host-charset" a bit less useful. */
2536  ++*host_chars;
2537  }
2538  }
2539 
2540  if (*tokptr != quote)
2541  {
2542  if (quote == '"')
2543  error (_("Unterminated string in expression."));
2544  else
2545  error (_("Unmatched single quote."));
2546  }
2547  ++tokptr;
2548 
2549  value->type = C_STRING | (quote == '\'' ? C_CHAR : 0); /*FIXME*/
2550  value->ptr = (char *) obstack_base (&tempbuf);
2551  value->length = obstack_object_size (&tempbuf);
2552 
2553  *outptr = tokptr;
2554 
2555  return quote == '\'' ? CHAR : STRING;
2556 }
2557 
2558 struct token
2559 {
2560  const char *oper;
2561  int token;
2562  enum exp_opcode opcode;
2563 };
2564 
2565 static const struct token tokentab3[] =
2566  {
2567  {">>=", ASSIGN_MODIFY, BINOP_RSH},
2568  {"<<=", ASSIGN_MODIFY, BINOP_LSH},
2569  /*{"&^=", ASSIGN_MODIFY, BINOP_BITWISE_ANDNOT}, TODO */
2570  {"...", DOTDOTDOT, OP_NULL},
2571  };
2572 
2573 static const struct token tokentab2[] =
2574  {
2575  {"+=", ASSIGN_MODIFY, BINOP_ADD},
2576  {"-=", ASSIGN_MODIFY, BINOP_SUB},
2577  {"*=", ASSIGN_MODIFY, BINOP_MUL},
2578  {"/=", ASSIGN_MODIFY, BINOP_DIV},
2579  {"%=", ASSIGN_MODIFY, BINOP_REM},
2580  {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2581  {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2582  {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2583  {"++", INCREMENT, BINOP_END},
2584  {"--", DECREMENT, BINOP_END},
2585  /*{"->", RIGHT_ARROW, BINOP_END}, Doesn't exist in Go. */
2586  {"<-", LEFT_ARROW, BINOP_END},
2587  {"&&", ANDAND, BINOP_END},
2588  {"||", OROR, BINOP_END},
2589  {"<<", LSH, BINOP_END},
2590  {">>", RSH, BINOP_END},
2591  {"==", EQUAL, BINOP_END},
2592  {"!=", NOTEQUAL, BINOP_END},
2593  {"<=", LEQ, BINOP_END},
2594  {">=", GEQ, BINOP_END},
2595  /*{"&^", ANDNOT, BINOP_END}, TODO */
2596  };
2597 
2598 /* Identifier-like tokens. */
2599 static const struct token ident_tokens[] =
2600  {
2601  {"true", TRUE_KEYWORD, OP_NULL},
2602  {"false", FALSE_KEYWORD, OP_NULL},
2603  {"nil", NIL_KEYWORD, OP_NULL},
2604  {"const", CONST_KEYWORD, OP_NULL},
2605  {"struct", STRUCT_KEYWORD, OP_NULL},
2606  {"type", TYPE_KEYWORD, OP_NULL},
2607  {"interface", INTERFACE_KEYWORD, OP_NULL},
2608  {"chan", CHAN_KEYWORD, OP_NULL},
2609  {"byte", BYTE_KEYWORD, OP_NULL}, /* An alias of uint8. */
2610  {"len", LEN_KEYWORD, OP_NULL},
2611  {"cap", CAP_KEYWORD, OP_NULL},
2612  {"new", NEW_KEYWORD, OP_NULL},
2613  {"iota", IOTA_KEYWORD, OP_NULL},
2614  };
2615 
2616 /* This is set if a NAME token appeared at the very end of the input
2617  string, with no whitespace separating the name from the EOF. This
2618  is used only when parsing to do field name completion. */
2619 static int saw_name_at_eof;
2620 
2621 /* This is set if the previously-returned token was a structure
2622  operator -- either '.' or ARROW. This is used only when parsing to
2623  do field name completion. */
2625 
2626 /* Read one token, getting characters through lexptr. */
2627 
2628 static int
2629 lex_one_token (struct parser_state *par_state)
2630 {
2631  int c;
2632  int namelen;
2633  unsigned int i;
2634  const char *tokstart;
2635  int saw_structop = last_was_structop;
2636  char *copy;
2637 
2638  last_was_structop = 0;
2639 
2640  retry:
2641 
2642  prev_lexptr = lexptr;
2643 
2644  tokstart = lexptr;
2645  /* See if it is a special token of length 3. */
2646  for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
2647  if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
2648  {
2649  lexptr += 3;
2651  return tokentab3[i].token;
2652  }
2653 
2654  /* See if it is a special token of length 2. */
2655  for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
2656  if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
2657  {
2658  lexptr += 2;
2660  /* NOTE: -> doesn't exist in Go, so we don't need to watch for
2661  setting last_was_structop here. */
2662  return tokentab2[i].token;
2663  }
2664 
2665  switch (c = *tokstart)
2666  {
2667  case 0:
2668  if (saw_name_at_eof)
2669  {
2670  saw_name_at_eof = 0;
2671  return COMPLETE;
2672  }
2673  else if (saw_structop)
2674  return COMPLETE;
2675  else
2676  return 0;
2677 
2678  case ' ':
2679  case '\t':
2680  case '\n':
2681  lexptr++;
2682  goto retry;
2683 
2684  case '[':
2685  case '(':
2686  paren_depth++;
2687  lexptr++;
2688  return c;
2689 
2690  case ']':
2691  case ')':
2692  if (paren_depth == 0)
2693  return 0;
2694  paren_depth--;
2695  lexptr++;
2696  return c;
2697 
2698  case ',':
2699  if (comma_terminates
2700  && paren_depth == 0)
2701  return 0;
2702  lexptr++;
2703  return c;
2704 
2705  case '.':
2706  /* Might be a floating point number. */
2707  if (lexptr[1] < '0' || lexptr[1] > '9')
2708  {
2709  if (parse_completion)
2710  last_was_structop = 1;
2711  goto symbol; /* Nope, must be a symbol. */
2712  }
2713  /* FALL THRU into number case. */
2714 
2715  case '0':
2716  case '1':
2717  case '2':
2718  case '3':
2719  case '4':
2720  case '5':
2721  case '6':
2722  case '7':
2723  case '8':
2724  case '9':
2725  {
2726  /* It's a number. */
2727  int got_dot = 0, got_e = 0, toktype;
2728  const char *p = tokstart;
2729  int hex = input_radix > 10;
2730 
2731  if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2732  {
2733  p += 2;
2734  hex = 1;
2735  }
2736 
2737  for (;; ++p)
2738  {
2739  /* This test includes !hex because 'e' is a valid hex digit
2740  and thus does not indicate a floating point number when
2741  the radix is hex. */
2742  if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2743  got_dot = got_e = 1;
2744  /* This test does not include !hex, because a '.' always indicates
2745  a decimal floating point number regardless of the radix. */
2746  else if (!got_dot && *p == '.')
2747  got_dot = 1;
2748  else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2749  && (*p == '-' || *p == '+'))
2750  /* This is the sign of the exponent, not the end of the
2751  number. */
2752  continue;
2753  /* We will take any letters or digits. parse_number will
2754  complain if past the radix, or if L or U are not final. */
2755  else if ((*p < '0' || *p > '9')
2756  && ((*p < 'a' || *p > 'z')
2757  && (*p < 'A' || *p > 'Z')))
2758  break;
2759  }
2760  toktype = parse_number (par_state, tokstart, p - tokstart,
2761  got_dot|got_e, &yylval);
2762  if (toktype == ERROR)
2763  {
2764  char *err_copy = (char *) alloca (p - tokstart + 1);
2765 
2766  memcpy (err_copy, tokstart, p - tokstart);
2767  err_copy[p - tokstart] = 0;
2768  error (_("Invalid number \"%s\"."), err_copy);
2769  }
2770  lexptr = p;
2771  return toktype;
2772  }
2773 
2774  case '@':
2775  {
2776  const char *p = &tokstart[1];
2777  size_t len = strlen ("entry");
2778 
2779  while (isspace (*p))
2780  p++;
2781  if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
2782  && p[len] != '_')
2783  {
2784  lexptr = &p[len];
2785  return ENTRY;
2786  }
2787  }
2788  /* FALLTHRU */
2789  case '+':
2790  case '-':
2791  case '*':
2792  case '/':
2793  case '%':
2794  case '|':
2795  case '&':
2796  case '^':
2797  case '~':
2798  case '!':
2799  case '<':
2800  case '>':
2801  case '?':
2802  case ':':
2803  case '=':
2804  case '{':
2805  case '}':
2806  symbol:
2807  lexptr++;
2808  return c;
2809 
2810  case '\'':
2811  case '"':
2812  case '`':
2813  {
2814  int host_len;
2815  int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
2816  &host_len);
2817  if (result == CHAR)
2818  {
2819  if (host_len == 0)
2820  error (_("Empty character constant."));
2821  else if (host_len > 2 && c == '\'')
2822  {
2823  ++tokstart;
2824  namelen = lexptr - tokstart - 1;
2825  goto tryname;
2826  }
2827  else if (host_len > 1)
2828  error (_("Invalid character constant."));
2829  }
2830  return result;
2831  }
2832  }
2833 
2834  if (!(c == '_' || c == '$'
2835  || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2836  /* We must have come across a bad character (e.g. ';'). */
2837  error (_("Invalid character '%c' in expression."), c);
2838 
2839  /* It's a name. See how long it is. */
2840  namelen = 0;
2841  for (c = tokstart[namelen];
2842  (c == '_' || c == '$' || (c >= '0' && c <= '9')
2843  || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));)
2844  {
2845  c = tokstart[++namelen];
2846  }
2847 
2848  /* The token "if" terminates the expression and is NOT removed from
2849  the input stream. It doesn't count if it appears in the
2850  expansion of a macro. */
2851  if (namelen == 2
2852  && tokstart[0] == 'i'
2853  && tokstart[1] == 'f')
2854  {
2855  return 0;
2856  }
2857 
2858  /* For the same reason (breakpoint conditions), "thread N"
2859  terminates the expression. "thread" could be an identifier, but
2860  an identifier is never followed by a number without intervening
2861  punctuation.
2862  Handle abbreviations of these, similarly to
2863  breakpoint.c:find_condition_and_thread.
2864  TODO: Watch for "goroutine" here? */
2865  if (namelen >= 1
2866  && strncmp (tokstart, "thread", namelen) == 0
2867  && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t'))
2868  {
2869  const char *p = tokstart + namelen + 1;
2870 
2871  while (*p == ' ' || *p == '\t')
2872  p++;
2873  if (*p >= '0' && *p <= '9')
2874  return 0;
2875  }
2876 
2877  lexptr += namelen;
2878 
2879  tryname:
2880 
2881  yylval.sval.ptr = tokstart;
2882  yylval.sval.length = namelen;
2883 
2884  /* Catch specific keywords. */
2885  copy = copy_name (yylval.sval);
2886  for (i = 0; i < sizeof (ident_tokens) / sizeof (ident_tokens[0]); i++)
2887  if (strcmp (copy, ident_tokens[i].oper) == 0)
2888  {
2889  /* It is ok to always set this, even though we don't always
2890  strictly need to. */
2892  return ident_tokens[i].token;
2893  }
2894 
2895  if (*tokstart == '$')
2896  return DOLLAR_VARIABLE;
2897 
2898  if (parse_completion && *lexptr == '\0')
2899  saw_name_at_eof = 1;
2900  return NAME;
2901 }
2902 
2903 /* An object of this type is pushed on a FIFO by the "outer" lexer. */
2904 typedef struct
2905 {
2906  int token;
2907  YYSTYPE value;
2908 } token_and_value;
2909 
2911 
2912 /* A FIFO of tokens that have been read but not yet returned to the
2913  parser. */
2914 static VEC (token_and_value) *token_fifo;
2915 
2916 /* Non-zero if the lexer should return tokens from the FIFO. */
2917 static int popping;
2918 
2919 /* Temporary storage for yylex; this holds symbol names as they are
2920  built up. */
2921 static auto_obstack name_obstack;
2922 
2923 /* Build "package.name" in name_obstack.
2924  For convenience of the caller, the name is NUL-terminated,
2925  but the NUL is not included in the recorded length. */
2926 
2927 static struct stoken
2928 build_packaged_name (const char *package, int package_len,
2929  const char *name, int name_len)
2930 {
2931  struct stoken result;
2932 
2933  name_obstack.clear ();
2934  obstack_grow (&name_obstack, package, package_len);
2935  obstack_grow_str (&name_obstack, ".");
2936  obstack_grow (&name_obstack, name, name_len);
2937  obstack_grow (&name_obstack, "", 1);
2938  result.ptr = (char *) obstack_base (&name_obstack);
2939  result.length = obstack_object_size (&name_obstack) - 1;
2940 
2941  return result;
2942 }
2943 
2944 /* Return non-zero if NAME is a package name.
2945  BLOCK is the scope in which to interpret NAME; this can be NULL
2946  to mean the global scope. */
2947 
2948 static int
2949 package_name_p (const char *name, const struct block *block)
2950 {
2951  struct symbol *sym;
2952  struct field_of_this_result is_a_field_of_this;
2953 
2954  sym = lookup_symbol (name, block, STRUCT_DOMAIN, &is_a_field_of_this).symbol;
2955 
2956  if (sym
2957  && SYMBOL_CLASS (sym) == LOC_TYPEDEF
2958  && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_MODULE)
2959  return 1;
2960 
2961  return 0;
2962 }
2963 
2964 /* Classify a (potential) function in the "unsafe" package.
2965  We fold these into "keywords" to keep things simple, at least until
2966  something more complex is warranted. */
2967 
2968 static int
2969 classify_unsafe_function (struct stoken function_name)
2970 {
2971  char *copy = copy_name (function_name);
2972 
2973  if (strcmp (copy, "Sizeof") == 0)
2974  {
2975  yylval.sval = function_name;
2976  return SIZEOF_KEYWORD;
2977  }
2978 
2979  error (_("Unknown function in `unsafe' package: %s"), copy);
2980 }
2981 
2982 /* Classify token(s) "name1.name2" where name1 is known to be a package.
2983  The contents of the token are in `yylval'.
2984  Updates yylval and returns the new token type.
2985 
2986  The result is one of NAME, NAME_OR_INT, or TYPENAME. */
2987 
2988 static int
2990 {
2991  char *copy;
2992  struct block_symbol sym;
2993  struct field_of_this_result is_a_field_of_this;
2994 
2995  copy = copy_name (yylval.sval);
2996 
2997  sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
2998 
2999  if (sym.symbol)
3000  {
3001  yylval.ssym.sym = sym;
3002  yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
3003  }
3004 
3005  return NAME;
3006 }
3007 
3008 /* Classify a NAME token.
3009  The contents of the token are in `yylval'.
3010  Updates yylval and returns the new token type.
3011  BLOCK is the block in which lookups start; this can be NULL
3012  to mean the global scope.
3013 
3014  The result is one of NAME, NAME_OR_INT, or TYPENAME. */
3015 
3016 static int
3017 classify_name (struct parser_state *par_state, const struct block *block)
3018 {
3019  struct type *type;
3020  struct block_symbol sym;
3021  char *copy;
3022  struct field_of_this_result is_a_field_of_this;
3023 
3024  copy = copy_name (yylval.sval);
3025 
3026  /* Try primitive types first so they win over bad/weird debug info. */
3028  parse_gdbarch (par_state),
3029  copy);
3030  if (type != NULL)
3031  {
3032  /* NOTE: We take advantage of the fact that yylval coming in was a
3033  NAME, and that struct ttype is a compatible extension of struct
3034  stoken, so yylval.tsym.stoken is already filled in. */
3035  yylval.tsym.type = type;
3036  return TYPENAME;
3037  }
3038 
3039  /* TODO: What about other types? */
3040 
3041  sym = lookup_symbol (copy, block, VAR_DOMAIN, &is_a_field_of_this);
3042 
3043  if (sym.symbol)
3044  {
3045  yylval.ssym.sym = sym;
3046  yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
3047  return NAME;
3048  }
3049 
3050  /* If we didn't find a symbol, look again in the current package.
3051  This is to, e.g., make "p global_var" work without having to specify
3052  the package name. We intentionally only looks for objects in the
3053  current package. */
3054 
3055  {
3056  char *current_package_name = go_block_package_name (block);
3057 
3058  if (current_package_name != NULL)
3059  {
3060  struct stoken sval =
3061  build_packaged_name (current_package_name,
3062  strlen (current_package_name),
3063  copy, strlen (copy));
3064 
3065  xfree (current_package_name);
3066  sym = lookup_symbol (sval.ptr, block, VAR_DOMAIN,
3067  &is_a_field_of_this);
3068  if (sym.symbol)
3069  {
3070  yylval.ssym.stoken = sval;
3071  yylval.ssym.sym = sym;
3072  yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
3073  return NAME;
3074  }
3075  }
3076  }
3077 
3078  /* Input names that aren't symbols but ARE valid hex numbers, when
3079  the input radix permits them, can be names or numbers depending
3080  on the parse. Note we support radixes > 16 here. */
3081  if ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
3082  || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10))
3083  {
3084  YYSTYPE newlval; /* Its value is ignored. */
3085  int hextype = parse_number (par_state, copy, yylval.sval.length,
3086  0, &newlval);
3087  if (hextype == INT)
3088  {
3089  yylval.ssym.sym.symbol = NULL;
3090  yylval.ssym.sym.block = NULL;
3092  return NAME_OR_INT;
3093  }
3094  }
3095 
3096  yylval.ssym.sym.symbol = NULL;
3097  yylval.ssym.sym.block = NULL;
3099  return NAME;
3100 }
3101 
3102 /* This is taken from c-exp.y mostly to get something working.
3103  The basic structure has been kept because we may yet need some of it. */
3104 
3105 static int
3106 yylex (void)
3107 {
3108  token_and_value current, next;
3109 
3110  if (popping && !VEC_empty (token_and_value, token_fifo))
3111  {
3112  token_and_value tv = *VEC_index (token_and_value, token_fifo, 0);
3113  VEC_ordered_remove (token_and_value, token_fifo, 0);
3114  yylval = tv.value;
3115  /* There's no need to fall through to handle package.name
3116  as that can never happen here. In theory. */
3117  return tv.token;
3118  }
3119  popping = 0;
3120 
3121  current.token = lex_one_token (pstate);
3122 
3123  /* TODO: Need a way to force specifying name1 as a package.
3124  .name1.name2 ? */
3125 
3126  if (current.token != NAME)
3127  return current.token;
3128 
3129  /* See if we have "name1 . name2". */
3130 
3131  current.value = yylval;
3132  next.token = lex_one_token (pstate);
3133  next.value = yylval;
3134 
3135  if (next.token == '.')
3136  {
3137  token_and_value name2;
3138 
3139  name2.token = lex_one_token (pstate);
3140  name2.value = yylval;
3141 
3142  if (name2.token == NAME)
3143  {
3144  /* Ok, we have "name1 . name2". */
3145  char *copy;
3146 
3147  copy = copy_name (current.value.sval);
3148 
3149  if (strcmp (copy, "unsafe") == 0)
3150  {
3151  popping = 1;
3152  return classify_unsafe_function (name2.value.sval);
3153  }
3154 
3156  {
3157  popping = 1;
3158  yylval.sval = build_packaged_name (current.value.sval.ptr,
3159  current.value.sval.length,
3160  name2.value.sval.ptr,
3161  name2.value.sval.length);
3163  }
3164  }
3165 
3166  VEC_safe_push (token_and_value, token_fifo, &next);
3167  VEC_safe_push (token_and_value, token_fifo, &name2);
3168  }
3169  else
3170  {
3171  VEC_safe_push (token_and_value, token_fifo, &next);
3172  }
3173 
3174  /* If we arrive here we don't have a package-qualified name. */
3175 
3176  popping = 1;
3177  yylval = current.value;
3179 }
3180 
3181 int
3182 go_parse (struct parser_state *par_state)
3183 {
3184  /* Setting up the parser state. */
3185  scoped_restore pstate_restore = make_scoped_restore (&pstate);
3186  gdb_assert (par_state != NULL);
3187  pstate = par_state;
3188 
3189  scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
3190  parser_debug);
3191 
3192  /* Initialize some state used by the lexer. */
3193  last_was_structop = 0;
3194  saw_name_at_eof = 0;
3195 
3196  VEC_free (token_and_value, token_fifo);
3197  popping = 0;
3198  name_obstack.clear ();
3199 
3200  return yyparse ();
3201 }
3202 
3203 void
3204 yyerror (const char *msg)
3205 {
3206  if (prev_lexptr)
3207  lexptr = prev_lexptr;
3208 
3209  error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);
3210 }
unsigned int length
Definition: gdbtypes.h:803
struct internalvar * ivar
Definition: ada-exp.c:295
struct type * type
Definition: parser-defs.h:115
#define OROR
Definition: go-exp.c:207
#define YYFPRINTF
Definition: yy-remap.h:92
#define LEQ
Definition: go-exp.c:212
#define yylen
char * go_block_package_name(const struct block *block)
Definition: go-lang.c:430
#define RSH
Definition: go-exp.c:215
#define EQUAL
Definition: go-exp.c:210
void write_exp_elt_sym(struct parser_state *ps, struct symbol *expelt)
Definition: parse.c:215
#define parse_language(ps)
Definition: parser-defs.h:36
#define NAME
Definition: go-exp.c:183
signed char yytype_int8
Definition: ada-exp.c:330
struct YYSTYPE::@18 typed_val_int
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Definition: go-exp.c:1235
#define parse_gdbarch(ps)
Definition: parser-defs.h:35
struct type * type
Definition: value.c:266
bool parse_float(const char *p, int len, const struct type *type, gdb_byte *data)
Definition: parse.c:1331
#define yyvs
static int saw_name_at_eof
Definition: go-exp.c:2619
#define YY_REDUCE_PRINT(Rule)
Definition: go-exp.c:974
#define yylloc
const char * ptr
Definition: parser-defs.h:91
void * xmalloc(YYSIZE_T)
#define CHAR
Definition: go-exp.c:182
#define yyssp
int comma_terminates
Definition: parse.c:77
int gdbarch_int_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1579
if(!(yy_init))
Definition: ada-lex.c:1075
static const yytype_int8 yypgoto[]
Definition: go-exp.c:666
static struct parser_state * pstate
Definition: go-exp.c:92
Definition: c-lang.h:51
int parse_completion
Definition: parse.c:80
void xfree(void *)
#define yyvsp
void yyerror(const char *)
Definition: go-exp.c:3204
#define ERROR
Definition: go-exp.c:202
int end_arglist(void)
Definition: parse.c:143
int arglist_len
Definition: parse.c:72
#define CAP_KEYWORD
Definition: go-exp.c:195
#define SYMBOL_CLASS(symbol)
Definition: symtab.h:1155
static const yytype_int8 yydefgoto[]
Definition: go-exp.c:673
static void yy_reduce_print(yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
Definition: go-exp.c:955
#define ABOVE_COMMA
Definition: go-exp.c:206
static VEC(token_and_value)
Definition: go-exp.c:2914
struct symtoken ssym
Definition: c-exp.c:287
int yydebug
Definition: go-exp.c:982
int gdbarch_long_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1596
#define ANDAND
Definition: go-exp.c:208
const struct block * innermost_block
Definition: parse.c:71
int have_partial_symbols(void)
Definition: objfiles.c:1023
Definition: c-exp.c:4864
#define VEC_safe_push(T, V, O)
Definition: vec.h:276
static struct obstack tempbuf
Definition: go-exp.c:2482
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
Definition: symtab.c:1893
int token
Definition: c-exp.c:4867
int c_parse_escape(const char **ptr, struct obstack *output)
Definition: c-exp.c:4591
#define _(String)
Definition: gdb_locale.h:35
#define yypact_value_is_default(Yystate)
Definition: go-exp.c:618
int yynerrs
Definition: go-exp.c:1256
static const yytype_uint8 yyr2[]
Definition: go-exp.c:814
static const char *const yytname[]
Definition: go-exp.c:583
#define CHAN_KEYWORD
Definition: go-exp.c:192
#define YYPRINT(FILE, TYPE, VALUE)
Definition: c-exp.c:328
#define YY_STACK_PRINT(Bottom, Top)
Definition: go-exp.c:943
#define YYABORT
Definition: go-exp.c:832
static const yytype_uint8 yydefact[]
Definition: go-exp.c:648
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition: go-exp.c:475
#define YYEOF
Definition: go-exp.c:829
static const struct token ident_tokens[]
Definition: go-exp.c:2599
#define XNEW(T)
Definition: poison.h:109
unsigned input_radix
Definition: valprint.c:157
#define UNARY
Definition: go-exp.c:216
scoped_restore_tmpl< T > make_scoped_restore(T *var)
static const yytype_uint16 yyrline[]
Definition: go-exp.c:568
#define LEFT_ARROW
Definition: go-exp.c:219
static int classify_unsafe_function(struct stoken function_name)
Definition: go-exp.c:2969
static const yytype_uint8 yytable[]
Definition: go-exp.c:682
#define YYDPRINTF(Args)
Definition: go-exp.c:869
#define NEW_KEYWORD
Definition: go-exp.c:196
struct typed_stoken tsval
Definition: c-exp.c:285
static int parse_number(struct parser_state *, const char *, int, int, YYSTYPE *)
Definition: go-exp.c:2262
const char *const name
Definition: aarch64-tdep.c:76
void write_exp_elt_block(struct parser_state *ps, const struct block *b)
Definition: parse.c:235
void write_exp_elt_longcst(struct parser_state *ps, LONGEST expelt)
Definition: parse.c:255
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition: go-exp.c:374
static const yytype_uint8 yyr1[]
Definition: go-exp.c:802
int yyparse(void)
Definition: go-exp.c:1264
struct type * check_typedef(struct type *type)
Definition: gdbtypes.c:2421
int contained_in(const struct block *a, const struct block *b)
Definition: block.c:73
#define ENTRY
Definition: go-exp.c:201
#define YYSIZE_T
Definition: go-exp.c:307
struct block_symbol sym
Definition: parser-defs.h:121
#define yyss
#define RAW_STRING
Definition: go-exp.c:180
#define TYPENAME
Definition: go-exp.c:184
#define CONST_KEYWORD
Definition: go-exp.c:199
struct stoken_vector svec
Definition: c-exp.c:292
const char * oper
Definition: c-exp.c:4866
int yychar
Definition: go-exp.c:1251
const struct block * block
Definition: symtab.h:1140
#define YYLAST
Definition: go-exp.c:511
struct YYSTYPE::@2 typed_val_float
#define NAME_OR_INT
Definition: go-exp.c:186
#define ANDNOT
Definition: go-exp.c:209
int symbol_read_needs_frame(struct symbol *sym)
Definition: findvar.c:392
#define NOTEQUAL
Definition: go-exp.c:211
#define IOTA_KEYWORD
Definition: go-exp.c:197
#define gdb_assert_not_reached(message)
Definition: gdb_assert.h:55
#define YY_NULLPTRPTR
Definition: go-exp.c:107
const struct builtin_go_type * builtin_go_type(struct gdbarch *gdbarch)
Definition: go-lang.c:669
static const struct token tokentab3[]
Definition: go-exp.c:2565
static const yytype_uint8 yytranslate[]
Definition: go-exp.c:532
yytype_int16 yyss_alloc
Definition: ada-exp.c:500
unsigned short int yytype_uint16
Definition: go-exp.c:291
YYSTYPE yylval
Definition: go-exp.c:1254
Definition: gdbtypes.h:749
#define TYPE_KEYWORD
Definition: go-exp.c:191
#define VEC_index(T, V, I)
Definition: vec.h:167
int voidval
Definition: c-exp.c:288
yytokentype
Definition: ada-exp.c:178
static const yytype_uint16 yytoknum[]
Definition: c-exp.c:699
#define YYACCEPT
Definition: go-exp.c:831
void write_dollar_variable(struct parser_state *ps, struct stoken str)
Definition: parse.c:594
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition: go-exp.c:881
#define parse_type(ps)
Definition: go-exp.c:82
static const char * type
Definition: language.c:113
void mark_struct_expression(struct parser_state *ps)
Definition: parse.c:544
YYSTYPE value
Definition: c-exp.c:5441
static int classify_packaged_name(const struct block *block)
Definition: go-exp.c:2989
YYSTYPE yyvs_alloc
Definition: ada-exp.c:501
#define yyrule
int go_parse(struct parser_state *par_state)
Definition: go-exp.c:3182
unsigned short int yytype_uint16
Definition: ada-exp.c:336
int token
Definition: m2-exp.c:2527
LONGEST lval
Definition: ada-exp.c:283
#define YYINITDEPTH
Definition: go-exp.c:993
#define FLOAT
Definition: go-exp.c:179
static int classify_name(struct parser_state *par_state, const struct block *block)
Definition: go-exp.c:3017
#define YYMAXDEPTH
Definition: go-exp.c:1004
#define XRESIZEVEC(T, P, N)
Definition: poison.h:169
#define LSH
Definition: go-exp.c:214
int parser_debug
Definition: parse.c:104
int is_a_field_of_this
Definition: parser-defs.h:122
struct type * builtin_float64
Definition: go-lang.h:48
void write_exp_msymbol(struct parser_state *ps, struct bound_minimal_symbol bound_msym)
Definition: parse.c:531
int paren_depth
Definition: parse.c:76
#define STRING
Definition: go-exp.c:181
struct symbol * symbol
Definition: symtab.h:1136
#define gdb_assert(expr)
Definition: gdb_assert.h:32
Definition: block.h:60
struct type * type
Definition: symtab.h:1535
#define VEC_empty(T, V)
Definition: vec.h:148
Definition: value.c:169
static int parse_string_or_char(const char *tokptr, const char **outptr, struct typed_stoken *value, int *host_chars)
Definition: go-exp.c:2493
static const struct token tokentab2[]
Definition: go-exp.c:2573
#define TRUE_KEYWORD
Definition: go-exp.c:187
#define YYSTACK_ALLOC
Definition: go-exp.c:419
LONGEST val
Definition: ada-exp.c:285
void write_exp_elt_opcode(struct parser_state *ps, enum exp_opcode expelt)
Definition: parse.c:205
static const char * lexptr
#define NIL_KEYWORD
Definition: go-exp.c:198
bfd_byte gdb_byte
Definition: common-types.h:38
#define YYSTACK_BYTES(N)
Definition: go-exp.c:464
static void yy_symbol_value_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
Definition: go-exp.c:898
unsigned char yytype_uint8
Definition: ada-exp.c:324
#define COMPLETE
Definition: go-exp.c:185
static const yytype_uint8 yystos[]
Definition: go-exp.c:784
static int last_was_structop
Definition: go-exp.c:2624
struct ttype tsym
Definition: c-exp.c:286
#define yys
#define TYPE_CODE(thistype)
Definition: gdbtypes.h:1238
#define YYFINAL
Definition: go-exp.c:509
static void yy_stack_print(yytype_int16 *yybottom, yytype_int16 *yytop)
Definition: go-exp.c:932
struct minimal_symbol * minsym
Definition: minsyms.h:34
int gdbarch_long_long_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1613
const char * symbol
Definition: signals.c:48
#define YYPOPSTACK(N)
struct type * tval
Definition: ada-exp.c:292
#define INT
Definition: go-exp.c:178
struct bound_minimal_symbol lookup_bound_minimal_symbol(const char *name)
Definition: minsyms.c:430
static const yytype_int16 yypact[]
Definition: go-exp.c:628
#define YYTRANSLATE(YYX)
Definition: go-exp.c:527
#define FALSE_KEYWORD
Definition: go-exp.c:188
#define VEC_free(T, V)
Definition: vec.h:196
static int yylex(void)
Definition: go-exp.c:3106
#define yystate
exp_opcode
Definition: expression.h:42
#define DECREMENT
Definition: go-exp.c:218
enum exp_opcode opcode
Definition: c-exp.c:290
#define obstack_grow_str(OBSTACK, STRING)
Definition: gdb_obstack.h:46
static const yytype_int8 yycheck[]
Definition: go-exp.c:732
#define DOTDOTDOT
Definition: go-exp.c:200
#define DOLLAR_VARIABLE
Definition: go-exp.c:204
#define ASSIGN_MODIFY
Definition: go-exp.c:205
int have_full_symbols(void)
Definition: objfiles.c:1040
#define BYTE_KEYWORD
Definition: go-exp.c:203
static int package_name_p(const char *name, const struct block *block)
Definition: go-exp.c:2949
static int lex_one_token(struct parser_state *par_state)
Definition: go-exp.c:2629
const struct block * expression_context_block
Definition: parse.c:69
struct type * type
Definition: ada-exp.c:286
unsigned long long ULONGEST
Definition: common-types.h:53
struct typed_stoken * tokens
Definition: parser-defs.h:109
#define SYMBOL_TYPE(symbol)
Definition: symtab.h:1161
#define yyval
static void yy_symbol_print(FILE *yyoutput, int yytype, YYSTYPE const *const yyvaluep)
Definition: go-exp.c:917
#define INCREMENT
Definition: go-exp.c:217
void start_arglist(void)
Definition: parse.c:133
#define YYEMPTY
Definition: go-exp.c:828
#define INTERFACE_KEYWORD
Definition: go-exp.c:190
#define TYPE_LENGTH(thistype)
Definition: gdbtypes.h:1235
short int yytype_int16
Definition: ada-exp.c:342
struct type * language_lookup_primitive_type(const struct language_defn *la, struct gdbarch *gdbarch, const char *name)
Definition: language.c:1025
#define HOST_CHAR_BIT
Definition: host-defs.h:40
unsigned char yytype_uint8
Definition: go-exp.c:279
#define YYSTACK_ALLOC_MAXIMUM
Definition: go-exp.c:422
signed char yytype_int8
Definition: go-exp.c:285
DEF_VEC_O(token_and_value)
struct stoken sval
Definition: ada-exp.c:293
#define YYTERROR
Definition: go-exp.c:856
#define LEN_KEYWORD
Definition: go-exp.c:194
static const char * prev_lexptr
void write_exp_elt_floatcst(struct parser_state *ps, const gdb_byte expelt[16])
Definition: parse.c:265
struct type * builtin_float32
Definition: go-lang.h:47
#define SIZEOF_KEYWORD
Definition: go-exp.c:193
short int yytype_int16
Definition: go-exp.c:297
#define YYSTACK_FREE
Definition: go-exp.c:420
void write_exp_string(struct parser_state *ps, struct stoken str)
Definition: parse.c:318
void write_exp_elt_type(struct parser_state *ps, struct type *expelt)
Definition: parse.c:277
void clear()
Definition: gdb_obstack.h:77
#define yystacksize
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition: go-exp.c:373
void error(const char *fmt,...)
Definition: errors.c:38
#define YY_(Msgid)
Definition: go-exp.c:323
#define GEQ
Definition: go-exp.c:213
#define yytable_value_is_error(Yytable_value)
Definition: go-exp.c:623
void write_exp_string_vector(struct parser_state *ps, int type, struct stoken_vector *vec)
Definition: parse.c:360
struct type * lookup_pointer_type(struct type *type)
Definition: gdbtypes.c:381
struct stoken stoken
Definition: parser-defs.h:120
#define YYUSE(E)
Definition: go-exp.c:356
long long LONGEST
Definition: common-types.h:52
#define YYNTOKENS
Definition: go-exp.c:514
#define SYMBOL_IS_ARGUMENT(symbol)
Definition: symtab.h:1157
int length
Definition: parser-defs.h:93
char * copy_name(struct stoken token)
Definition: parse.c:761
static int tempbuf_init
Definition: go-exp.c:2483
#define STRUCT_KEYWORD
Definition: go-exp.c:189
#define VEC_ordered_remove(T, V, I)
Definition: vec.h:355
enum exp_opcode opcode
Definition: c-exp.c:4868