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