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