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