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