1 /* A Bison parser, made by GNU Bison 3.5.1. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 <http://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 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47 /* Identify Bison output. */
48 #define YYBISON 1
49
50 /* Bison version. */
51 #define YYBISON_VERSION "3.5.1"
52
53 /* Skeleton name. */
54 #define YYSKELETON_NAME "yacc.c"
55
56 /* Pure parsers. */
57 #define YYPURE 0
58
59 /* Push parsers. */
60 #define YYPUSH 0
61
62 /* Pull parsers. */
63 #define YYPULL 1
64
65
66
67
68 /* First part of user prologue. */
69 #line 36 "c-exp.y"
70
71
72 #include "defs.h"
73 #include <ctype.h>
74 #include "expression.h"
75 #include "value.h"
76 #include "parser-defs.h"
77 #include "language.h"
78 #include "c-lang.h"
79 #include "c-support.h"
80 #include "bfd.h" /* Required by objfiles.h. */
81 #include "symfile.h" /* Required by objfiles.h. */
82 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
83 #include "charset.h"
84 #include "block.h"
85 #include "cp-support.h"
86 #include "macroscope.h"
87 #include "objc-lang.h"
88 #include "typeprint.h"
89 #include "cp-abi.h"
90 #include "type-stack.h"
91 #include "target-float.h"
92 #include "c-exp.h"
93
94 #define parse_type(ps) builtin_type (ps->gdbarch ())
95
96 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
97 etc). */
98 #define GDB_YY_REMAP_PREFIX c_
99 #include "yy-remap.h"
100
101 /* The state of the parser, used internally when we are parsing the
102 expression. */
103
104 static struct parser_state *pstate = NULL;
105
106 /* Data that must be held for the duration of a parse. */
107
108 struct c_parse_state
109 {
110 /* These are used to hold type lists and type stacks that are
111 allocated during the parse. */
112 std::vector<std::unique_ptr<std::vector<struct type *>>> type_lists;
113 std::vector<std::unique_ptr<struct type_stack>> type_stacks;
114
115 /* Storage for some strings allocated during the parse. */
116 std::vector<gdb::unique_xmalloc_ptr<char>> strings;
117
118 /* When we find that lexptr (the global var defined in parse.c) is
119 pointing at a macro invocation, we expand the invocation, and call
120 scan_macro_expansion to save the old lexptr here and point lexptr
121 into the expanded text. When we reach the end of that, we call
122 end_macro_expansion to pop back to the value we saved here. The
123 macro expansion code promises to return only fully-expanded text,
124 so we don't need to "push" more than one level.
125
126 This is disgusting, of course. It would be cleaner to do all macro
127 expansion beforehand, and then hand that to lexptr. But we don't
128 really know where the expression ends. Remember, in a command like
129
130 (gdb) break *ADDRESS if CONDITION
131
132 we evaluate ADDRESS in the scope of the current frame, but we
133 evaluate CONDITION in the scope of the breakpoint's location. So
134 it's simply wrong to try to macro-expand the whole thing at once. */
135 const char *macro_original_text = nullptr;
136
137 /* We save all intermediate macro expansions on this obstack for the
138 duration of a single parse. The expansion text may sometimes have
139 to live past the end of the expansion, due to yacc lookahead.
140 Rather than try to be clever about saving the data for a single
141 token, we simply keep it all and delete it after parsing has
142 completed. */
143 auto_obstack expansion_obstack;
144
145 /* The type stack. */
146 struct type_stack type_stack;
147 };
148
149 /* This is set and cleared in c_parse. */
150
151 static struct c_parse_state *cpstate;
152
153 int yyparse (void);
154
155 static int yylex (void);
156
157 static void yyerror (const char *);
158
159 static int type_aggregate_p (struct type *);
160
161 using namespace expr;
162
163 #line 164 "c-exp.c.tmp"
164
165 # ifndef YY_CAST
166 # ifdef __cplusplus
167 # define YY_CAST(Type, Val) static_cast<Type> (Val)
168 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
169 # else
170 # define YY_CAST(Type, Val) ((Type) (Val))
171 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
172 # endif
173 # endif
174 # ifndef YY_NULLPTRPTR
175 # if defined __cplusplus
176 # if 201103L <= __cplusplus
177 # define YY_NULLPTRPTR nullptr
178 # else
179 # define YY_NULLPTRPTR 0
180 # endif
181 # else
182 # define YY_NULLPTRPTR ((void*)0)
183 # endif
184 # endif
185
186 /* Enabling verbose error messages. */
187 #ifdef YYERROR_VERBOSE
188 # undef YYERROR_VERBOSE
189 # define YYERROR_VERBOSE 1
190 #else
191 # define YYERROR_VERBOSE 0
192 #endif
193
194
195 /* Debug traces. */
196 #ifndef YYDEBUG
197 # define YYDEBUG 0
198 #endif
199 #if YYDEBUG
200 extern int yydebug;
201 #endif
202
203 /* Token type. */
204 #ifndef YYTOKENTYPE
205 # define YYTOKENTYPE
206 enum yytokentype
207 {
208 INT = 258,
209 COMPLEX_INT = 259,
210 FLOAT = 260,
211 COMPLEX_FLOAT = 261,
212 STRING = 262,
213 NSSTRING = 263,
214 SELECTOR = 264,
215 CHAR = 265,
216 NAME = 266,
217 UNKNOWN_CPP_NAME = 267,
218 COMPLETE = 268,
219 TYPENAME = 269,
220 CLASSNAME = 270,
221 OBJC_LBRAC = 271,
222 NAME_OR_INT = 272,
223 OPERATOR = 273,
224 STRUCT = 274,
225 CLASS = 275,
226 UNION = 276,
227 ENUM = 277,
228 SIZEOF = 278,
229 ALIGNOF = 279,
230 UNSIGNED = 280,
231 COLONCOLON = 281,
232 TEMPLATE = 282,
233 ERROR = 283,
234 NEW = 284,
235 DELETE = 285,
236 REINTERPRET_CAST = 286,
237 DYNAMIC_CAST = 287,
238 STATIC_CAST = 288,
239 CONST_CAST = 289,
240 ENTRY = 290,
241 TYPEOF = 291,
242 DECLTYPE = 292,
243 TYPEID = 293,
244 SIGNED_KEYWORD = 294,
245 LONG = 295,
246 SHORT = 296,
247 INT_KEYWORD = 297,
248 CONST_KEYWORD = 298,
249 VOLATILE_KEYWORD = 299,
250 DOUBLE_KEYWORD = 300,
251 RESTRICT = 301,
252 ATOMIC = 302,
253 FLOAT_KEYWORD = 303,
254 COMPLEX = 304,
255 DOLLAR_VARIABLE = 305,
256 ASSIGN_MODIFY = 306,
257 TRUEKEYWORD = 307,
258 FALSEKEYWORD = 308,
259 ABOVE_COMMA = 309,
260 OROR = 310,
261 ANDAND = 311,
262 EQUAL = 312,
263 NOTEQUAL = 313,
264 LEQ = 314,
265 GEQ = 315,
266 LSH = 316,
267 RSH = 317,
268 UNARY = 318,
269 INCREMENT = 319,
270 DECREMENT = 320,
271 ARROW = 321,
272 ARROW_STAR = 322,
273 DOT_STAR = 323,
274 BLOCKNAME = 324,
275 FILENAME = 325,
276 DOTDOTDOT = 326
277 };
278 #endif
279 /* Tokens. */
280 #define INT 258
281 #define COMPLEX_INT 259
282 #define FLOAT 260
283 #define COMPLEX_FLOAT 261
284 #define STRING 262
285 #define NSSTRING 263
286 #define SELECTOR 264
287 #define CHAR 265
288 #define NAME 266
289 #define UNKNOWN_CPP_NAME 267
290 #define COMPLETE 268
291 #define TYPENAME 269
292 #define CLASSNAME 270
293 #define OBJC_LBRAC 271
294 #define NAME_OR_INT 272
295 #define OPERATOR 273
296 #define STRUCT 274
297 #define CLASS 275
298 #define UNION 276
299 #define ENUM 277
300 #define SIZEOF 278
301 #define ALIGNOF 279
302 #define UNSIGNED 280
303 #define COLONCOLON 281
304 #define TEMPLATE 282
305 #define ERROR 283
306 #define NEW 284
307 #define DELETE 285
308 #define REINTERPRET_CAST 286
309 #define DYNAMIC_CAST 287
310 #define STATIC_CAST 288
311 #define CONST_CAST 289
312 #define ENTRY 290
313 #define TYPEOF 291
314 #define DECLTYPE 292
315 #define TYPEID 293
316 #define SIGNED_KEYWORD 294
317 #define LONG 295
318 #define SHORT 296
319 #define INT_KEYWORD 297
320 #define CONST_KEYWORD 298
321 #define VOLATILE_KEYWORD 299
322 #define DOUBLE_KEYWORD 300
323 #define RESTRICT 301
324 #define ATOMIC 302
325 #define FLOAT_KEYWORD 303
326 #define COMPLEX 304
327 #define DOLLAR_VARIABLE 305
328 #define ASSIGN_MODIFY 306
329 #define TRUEKEYWORD 307
330 #define FALSEKEYWORD 308
331 #define ABOVE_COMMA 309
332 #define OROR 310
333 #define ANDAND 311
334 #define EQUAL 312
335 #define NOTEQUAL 313
336 #define LEQ 314
337 #define GEQ 315
338 #define LSH 316
339 #define RSH 317
340 #define UNARY 318
341 #define INCREMENT 319
342 #define DECREMENT 320
343 #define ARROW 321
344 #define ARROW_STAR 322
345 #define DOT_STAR 323
346 #define BLOCKNAME 324
347 #define FILENAME 325
348 #define DOTDOTDOT 326
349
350 /* Value type. */
351 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
352 union YYSTYPE
353 {
354 #line 135 "c-exp.y"
355
356 LONGEST lval;
357 struct {
358 LONGEST val;
359 struct type *type;
360 } typed_val_int;
361 struct {
362 gdb_byte val[16];
363 struct type *type;
364 } typed_val_float;
365 struct type *tval;
366 struct stoken sval;
367 struct typed_stoken tsval;
368 struct ttype tsym;
369 struct symtoken ssym;
370 int voidval;
371 const struct block *bval;
372 enum exp_opcode opcode;
373
374 struct stoken_vector svec;
375 std::vector<struct type *> *tvec;
376
377 struct type_stack *type_stack;
378
379 struct objc_class_str theclass;
380
381
382 #line 383 "c-exp.c.tmp"
383
384 };
385 typedef union YYSTYPE YYSTYPE;
386 # define YYSTYPE_IS_TRIVIAL 1
387 # define YYSTYPE_IS_DECLARED 1
388 #endif
389
390
391 extern YYSTYPE yylval;
392
393 int yyparse (void);
394
395
396
397 /* Second part of user prologue. */
398 #line 162 "c-exp.y"
399
400 /* YYSTYPE gets defined by %union */
401 static int parse_number (struct parser_state *par_state,
402 const char *, int, int, YYSTYPE *);
403 static struct stoken operator_stoken (const char *);
404 static struct stoken typename_stoken (const char *);
405 static void check_parameter_typelist (std::vector<struct type *> *);
406
407 #ifdef YYBISON
408 static void c_print_token (FILE *file, int type, YYSTYPE value);
409 #define YYPRINT(FILE, TYPE, VALUE) c_print_token (FILE, TYPE, VALUE)
410 #endif
411
412 #line 413 "c-exp.c.tmp"
413
414
415 #ifdef short
416 # undef short
417 #endif
418
419 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
420 <limits.h> and (if available) <stdint.h> are included
421 so that the code can choose integer types of a good width. */
422
423 #ifndef __PTRDIFF_MAX__
424 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
425 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
426 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
427 # define YY_STDINT_H
428 # endif
429 #endif
430
431 /* Narrow types that promote to a signed type and that can represent a
432 signed or unsigned integer of at least N bits. In tables they can
433 save space and decrease cache pressure. Promoting to a signed type
434 helps avoid bugs in integer arithmetic. */
435
436 #ifdef __INT_LEAST8_MAX__
437 typedef __INT_LEAST8_TYPE__ yytype_int8;
438 #elif defined YY_STDINT_H
439 typedef int_least8_t yytype_int8;
440 #else
441 typedef signed char yytype_int8;
442 #endif
443
444 #ifdef __INT_LEAST16_MAX__
445 typedef __INT_LEAST16_TYPE__ yytype_int16;
446 #elif defined YY_STDINT_H
447 typedef int_least16_t yytype_int16;
448 #else
449 typedef short yytype_int16;
450 #endif
451
452 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
453 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
454 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
455 && UINT_LEAST8_MAX <= INT_MAX)
456 typedef uint_least8_t yytype_uint8;
457 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
458 typedef unsigned char yytype_uint8;
459 #else
460 typedef short yytype_uint8;
461 #endif
462
463 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
464 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
465 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
466 && UINT_LEAST16_MAX <= INT_MAX)
467 typedef uint_least16_t yytype_uint16;
468 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
469 typedef unsigned short yytype_uint16;
470 #else
471 typedef int yytype_uint16;
472 #endif
473
474 #ifndef YYPTRDIFF_T
475 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
476 # define YYPTRDIFF_T __PTRDIFF_TYPE__
477 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
478 # elif defined PTRDIFF_MAX
479 # ifndef ptrdiff_t
480 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
481 # endif
482 # define YYPTRDIFF_T ptrdiff_t
483 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
484 # else
485 # define YYPTRDIFF_T long
486 # define YYPTRDIFF_MAXIMUM LONG_MAX
487 # endif
488 #endif
489
490 #ifndef YYSIZE_T
491 # ifdef __SIZE_TYPE__
492 # define YYSIZE_T __SIZE_TYPE__
493 # elif defined size_t
494 # define YYSIZE_T size_t
495 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
496 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
497 # define YYSIZE_T size_t
498 # else
499 # define YYSIZE_T unsigned
500 # endif
501 #endif
502
503 #define YYSIZE_MAXIMUM \
504 YY_CAST (YYPTRDIFF_T, \
505 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
506 ? YYPTRDIFF_MAXIMUM \
507 : YY_CAST (YYSIZE_T, -1)))
508
509 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
510
511 /* Stored state numbers (used for stacks). */
512 typedef yytype_int16 yy_state_t;
513
514 /* State numbers in computations. */
515 typedef int yy_state_fast_t;
516
517 #ifndef YY_
518 # if defined YYENABLE_NLS && YYENABLE_NLS
519 # if ENABLE_NLS
520 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
521 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
522 # endif
523 # endif
524 # ifndef YY_
525 # define YY_(Msgid) Msgid
526 # endif
527 #endif
528
529 #ifndef YY_ATTRIBUTE_PURE
530 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
531 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
532 # else
533 # define YY_ATTRIBUTE_PURE
534 # endif
535 #endif
536
537 #ifndef YY_ATTRIBUTE_UNUSED
538 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
539 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
540 # else
541 # define YY_ATTRIBUTE_UNUSED
542 # endif
543 #endif
544
545 /* Suppress unused-variable warnings by "using" E. */
546 #if ! defined lint || defined __GNUC__
547 # define YYUSE(E) ((void) (E))
548 #else
549 # define YYUSE(E) /* empty */
550 #endif
551
552 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
553 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
554 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
555 _Pragma ("GCC diagnostic push") \
556 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
557 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
558 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
559 _Pragma ("GCC diagnostic pop")
560 #else
561 # define YY_INITIAL_VALUE(Value) Value
562 #endif
563 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
564 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
565 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
566 #endif
567 #ifndef YY_INITIAL_VALUE
568 # define YY_INITIAL_VALUE(Value) /* Nothing. */
569 #endif
570
571 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
572 # define YY_IGNORE_USELESS_CAST_BEGIN \
573 _Pragma ("GCC diagnostic push") \
574 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
575 # define YY_IGNORE_USELESS_CAST_END \
576 _Pragma ("GCC diagnostic pop")
577 #endif
578 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
579 # define YY_IGNORE_USELESS_CAST_BEGIN
580 # define YY_IGNORE_USELESS_CAST_END
581 #endif
582
583
584 #define YY_ASSERT(E) ((void) (0 && (E)))
585
586 #if ! defined yyoverflow || YYERROR_VERBOSE
587
588 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
589
590 # ifdef YYSTACK_USE_ALLOCA
591 # if YYSTACK_USE_ALLOCA
592 # ifdef __GNUC__
593 # define YYSTACK_ALLOC __builtin_alloca
594 # elif defined __BUILTIN_VA_ARG_INCR
595 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
596 # elif defined _AIX
597 # define YYSTACK_ALLOC __alloca
598 # elif defined _MSC_VER
599 # define alloca _alloca
600 # else
601 # define YYSTACK_ALLOC alloca
602 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
603 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
604 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
605 # ifndef EXIT_SUCCESS
606 # define EXIT_SUCCESS 0
607 # endif
608 # endif
609 # endif
610 # endif
611 # endif
612
613 # ifdef YYSTACK_ALLOC
614 /* Pacify GCC's 'empty if-body' warning. */
615 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
616 # ifndef YYSTACK_ALLOC_MAXIMUM
617 /* The OS might guarantee only one guard page at the bottom of the stack,
618 and a page size can be as small as 4096 bytes. So we cannot safely
619 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
620 to allow for a few compiler-allocated temporary stack slots. */
621 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
622 # endif
623 # else
624 # define YYSTACK_ALLOC YYMALLOC
625 # define YYSTACK_FREE YYFREE
626 # ifndef YYSTACK_ALLOC_MAXIMUM
627 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
628 # endif
629 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
630 && ! ((defined YYMALLOC || defined xmalloc) \
631 && (defined YYFREE || defined xfree)))
632 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
633 # ifndef EXIT_SUCCESS
634 # define EXIT_SUCCESS 0
635 # endif
636 # endif
637 # ifndef YYMALLOC
638 # define YYMALLOC xmalloc
639 # if ! defined xmalloc && ! defined EXIT_SUCCESS
640 void *xmalloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
641 # endif
642 # endif
643 # ifndef YYFREE
644 # define YYFREE xfree
645 # if ! defined xfree && ! defined EXIT_SUCCESS
646 void xfree (void *); /* INFRINGES ON USER NAME SPACE */
647 # endif
648 # endif
649 # endif
650 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
651
652
653 #if (! defined yyoverflow \
654 && (! defined __cplusplus \
655 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
656
657 /* A type that is properly aligned for any stack member. */
658 union yyalloc
659 {
660 yy_state_t yyss_alloc;
661 YYSTYPE yyvs_alloc;
662 };
663
664 /* The size of the maximum gap between one aligned stack and the next. */
665 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
666
667 /* The size of an array large to enough to hold all stacks, each with
668 N elements. */
669 # define YYSTACK_BYTES(N) \
670 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
671 + YYSTACK_GAP_MAXIMUM)
672
673 # define YYCOPY_NEEDED 1
674
675 /* Relocate STACK from its old location to the new one. The
676 local variables YYSIZE and YYSTACKSIZE give the old and new number of
677 elements in the stack, and YYPTR gives the new location of the
678 stack. Advance YYPTR to a properly aligned location for the next
679 stack. */
680 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
681 do \
682 { \
683 YYPTRDIFF_T yynewbytes; \
684 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
685 Stack = &yyptr->Stack_alloc; \
686 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
687 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
688 } \
689 while (0)
690
691 #endif
692
693 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
694 /* Copy COUNT objects from SRC to DST. The source and destination do
695 not overlap. */
696 # ifndef YYCOPY
697 # if defined __GNUC__ && 1 < __GNUC__
698 # define YYCOPY(Dst, Src, Count) \
699 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
700 # else
701 # define YYCOPY(Dst, Src, Count) \
702 do \
703 { \
704 YYPTRDIFF_T yyi; \
705 for (yyi = 0; yyi < (Count); yyi++) \
706 (Dst)[yyi] = (Src)[yyi]; \
707 } \
708 while (0)
709 # endif
710 # endif
711 #endif /* !YYCOPY_NEEDED */
712
713 /* YYFINAL -- State number of the termination state. */
714 #define YYFINAL 177
715 /* YYLAST -- Last index in YYTABLE. */
716 #define YYLAST 1742
717
718 /* YYNTOKENS -- Number of terminals. */
719 #define YYNTOKENS 96
720 /* YYNNTS -- Number of nonterminals. */
721 #define YYNNTS 50
722 /* YYNRULES -- Number of rules. */
723 #define YYNRULES 285
724 /* YYNSTATES -- Number of states. */
725 #define YYNSTATES 442
726
727 #define YYUNDEFTOK 2
728 #define YYMAXUTOK 326
729
730
731 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
732 as returned by yylex, with out-of-bounds checking. */
733 #define YYTRANSLATE(YYX) \
734 (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
735
736 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
737 as returned by yylex. */
738 static const yytype_int8 yytranslate[] =
739 {
740 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
741 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
742 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
743 2, 2, 2, 90, 2, 2, 2, 76, 62, 2,
744 85, 89, 74, 72, 54, 73, 82, 75, 2, 2,
745 2, 2, 2, 2, 2, 2, 2, 2, 93, 2,
746 65, 56, 66, 57, 71, 2, 2, 2, 2, 2,
747 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
748 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
749 2, 84, 2, 92, 61, 2, 2, 2, 2, 2,
750 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
751 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
752 2, 2, 2, 94, 60, 95, 91, 2, 2, 2,
753 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
754 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
755 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
756 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
757 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
758 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
759 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
760 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
761 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
762 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
763 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
764 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
765 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
766 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
767 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
768 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
769 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
770 45, 46, 47, 48, 49, 50, 51, 52, 53, 55,
771 58, 59, 63, 64, 67, 68, 69, 70, 77, 78,
772 79, 80, 81, 83, 86, 87, 88
773 };
774
775 #if YYDEBUG
776 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
777 static const yytype_int16 yyrline[] =
778 {
779 0, 280, 280, 281, 284, 288, 292, 296, 303, 304,
780 309, 313, 317, 321, 325, 335, 339, 343, 347, 351,
781 355, 359, 363, 367, 371, 378, 388, 397, 404, 414,
782 422, 426, 438, 448, 457, 464, 474, 482, 486, 490,
783 500, 499, 519, 518, 530, 529, 535, 537, 540, 541,
784 544, 546, 548, 555, 552, 568, 577, 576, 595, 599,
785 602, 606, 610, 625, 635, 642, 643, 646, 653, 656,
786 665, 669, 679, 685, 689, 693, 697, 701, 705, 709,
787 713, 717, 727, 737, 747, 757, 767, 777, 781, 785,
788 789, 805, 821, 838, 848, 857, 864, 877, 886, 897,
789 906, 930, 933, 939, 946, 964, 968, 972, 976, 983,
790 1000, 1018, 1051, 1061, 1067, 1075, 1083, 1089, 1102, 1115,
791 1132, 1143, 1159, 1168, 1169, 1180, 1252, 1253, 1257, 1259,
792 1261, 1263, 1265, 1270, 1278, 1279, 1283, 1284, 1289, 1288,
793 1292, 1291, 1294, 1296, 1298, 1300, 1304, 1311, 1313, 1314,
794 1317, 1319, 1327, 1335, 1342, 1350, 1352, 1354, 1356, 1360,
795 1365, 1377, 1384, 1387, 1390, 1393, 1396, 1399, 1402, 1405,
796 1408, 1411, 1414, 1417, 1420, 1423, 1426, 1429, 1432, 1435,
797 1438, 1441, 1444, 1447, 1450, 1453, 1456, 1459, 1462, 1467,
798 1472, 1477, 1480, 1483, 1486, 1502, 1504, 1506, 1510, 1515,
799 1521, 1527, 1532, 1538, 1544, 1549, 1555, 1561, 1565, 1570,
800 1579, 1584, 1586, 1590, 1591, 1598, 1605, 1615, 1617, 1626,
801 1635, 1642, 1643, 1650, 1654, 1655, 1658, 1659, 1662, 1666,
802 1668, 1672, 1674, 1676, 1678, 1680, 1682, 1684, 1686, 1688,
803 1690, 1692, 1694, 1696, 1698, 1700, 1702, 1704, 1706, 1708,
804 1710, 1750, 1752, 1754, 1756, 1758, 1760, 1762, 1764, 1766,
805 1768, 1770, 1772, 1774, 1776, 1778, 1780, 1782, 1804, 1805,
806 1806, 1807, 1808, 1809, 1810, 1811, 1814, 1815, 1816, 1817,
807 1818, 1819, 1822, 1823, 1831, 1844
808 };
809 #endif
810
811 #if YYDEBUG || YYERROR_VERBOSE || 0
812 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
813 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
814 static const char *const yytname[] =
815 {
816 "$end", "error", "$undefined", "INT", "COMPLEX_INT", "FLOAT",
817 "COMPLEX_FLOAT", "STRING", "NSSTRING", "SELECTOR", "CHAR", "NAME",
818 "UNKNOWN_CPP_NAME", "COMPLETE", "TYPENAME", "CLASSNAME", "OBJC_LBRAC",
819 "NAME_OR_INT", "OPERATOR", "STRUCT", "CLASS", "UNION", "ENUM", "SIZEOF",
820 "ALIGNOF", "UNSIGNED", "COLONCOLON", "TEMPLATE", "ERROR", "NEW",
821 "DELETE", "REINTERPRET_CAST", "DYNAMIC_CAST", "STATIC_CAST",
822 "CONST_CAST", "ENTRY", "TYPEOF", "DECLTYPE", "TYPEID", "SIGNED_KEYWORD",
823 "LONG", "SHORT", "INT_KEYWORD", "CONST_KEYWORD", "VOLATILE_KEYWORD",
824 "DOUBLE_KEYWORD", "RESTRICT", "ATOMIC", "FLOAT_KEYWORD", "COMPLEX",
825 "DOLLAR_VARIABLE", "ASSIGN_MODIFY", "TRUEKEYWORD", "FALSEKEYWORD", "','",
826 "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND", "'|'", "'^'", "'&'",
827 "EQUAL", "NOTEQUAL", "'<'", "'>'", "LEQ", "GEQ", "LSH", "RSH", "'@'",
828 "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "INCREMENT", "DECREMENT",
829 "ARROW", "ARROW_STAR", "'.'", "DOT_STAR", "'['", "'('", "BLOCKNAME",
830 "FILENAME", "DOTDOTDOT", "')'", "'!'", "'~'", "']'", "':'", "'{'", "'}'",
831 "$accept", "start", "type_exp", "exp1", "exp", "$@1", "$@2", "$@3",
832 "msglist", "msgarglist", "msgarg", "$@4", "$@5", "lcurly", "arglist",
833 "function_method", "function_method_void",
834 "function_method_void_or_typelist", "rcurly", "string_exp", "block",
835 "variable", "qualified_name", "const_or_volatile", "single_qualifier",
836 "qualifier_seq_noopt", "qualifier_seq", "ptr_operator", "$@6", "$@7",
837 "ptr_operator_ts", "abs_decl", "direct_abs_decl", "array_mod",
838 "func_mod", "type", "scalar_type", "typebase", "type_name",
839 "parameter_typelist", "nonempty_typelist", "ptype", "conversion_type_id",
840 "conversion_declarator", "const_and_volatile", "const_or_volatile_noopt",
841 "oper", "field_name", "name", "name_not_typename", YY_NULLPTRPTR
842 };
843 #endif
844
845 # ifdef YYPRINT
846 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
847 (internal) symbol number NUM (which must be that of a token). */
848 static const yytype_int16 yytoknum[] =
849 {
850 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
851 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
852 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
853 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
854 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
855 305, 306, 307, 308, 44, 309, 61, 63, 310, 311,
856 124, 94, 38, 312, 313, 60, 62, 314, 315, 316,
857 317, 64, 43, 45, 42, 47, 37, 318, 319, 320,
858 321, 322, 46, 323, 91, 40, 324, 325, 326, 41,
859 33, 126, 93, 58, 123, 125
860 };
861 # endif
862
863 #define YYPACT_NINF (-225)
864
865 #define yypact_value_is_default(Yyn) \
866 ((Yyn) == YYPACT_NINF)
867
868 #define YYTABLE_NINF (-128)
869
870 #define yytable_value_is_error(Yyn) \
871 0
872
873 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
874 STATE-NUM. */
875 static const yytype_int16 yypact[] =
876 {
877 408, -225, -225, -225, -225, -225, -225, -24, -225, -225,
878 -11, 30, 592, -225, 855, 241, 270, 278, 288, 684,
879 4, 87, 29, 208, 35, 44, 53, 59, 45, 46,
880 49, 199, 589, 83, -225, -225, -225, -225, -225, -225,
881 -225, 312, -225, -225, -225, 776, 68, 776, 776, 776,
882 776, 776, 408, 117, -225, 776, 776, -225, 149, -225,
883 101, 1380, 408, 130, -225, 141, 184, 170, -225, -225,
884 -225, 1671, -225, -225, 73, 201, -225, 163, 208, -225,
885 147, 30, -225, 1380, -225, 118, -2, 11, -225, -225,
886 -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,
887 -225, -225, -225, -225, -225, -225, -225, -225, -225, -225,
888 -225, -225, -225, 119, 123, -225, -225, 772, -225, -225,
889 -225, -225, -225, -225, -225, -225, 202, -225, 215, -225,
890 219, -225, 221, 30, 408, 647, 1635, -225, 6, 172,
891 -225, -225, -225, -225, -225, 171, 1635, 1635, 1635, 1635,
892 500, 776, 408, 150, -225, -225, 193, 200, 121, -225,
893 -225, 205, 206, -225, -225, 647, -225, -225, 647, 647,
894 647, 647, 647, 162, -30, 647, 647, -225, 776, 776,
895 776, 776, 776, 776, 776, 776, 776, 776, 776, 776,
896 776, 776, 776, 776, 776, 776, 776, 776, 776, 776,
897 776, 776, -225, -225, 51, 776, 232, 776, 776, 1022,
898 161, 1380, -29, 208, -225, 208, -225, 73, 73, 19,
899 -32, 187, -225, 20, 966, 188, 1, -225, 13, -225,
900 -225, -225, 176, 776, 208, 242, 40, 40, 40, -225,
901 175, 177, 178, 186, -225, -225, 88, -225, -225, -225,
902 -225, -225, 190, 204, 255, -225, -225, 1671, 243, 246,
903 247, 249, 1128, 209, 1164, 218, 1200, 266, -225, -225,
904 -225, 277, 279, -225, -225, -225, 776, -225, 1380, -22,
905 1380, 1380, 891, 317, 1441, 1475, 1502, 1536, 1563, 1563,
906 485, 485, 485, 485, 577, 577, 669, 287, 287, 647,
907 647, 647, -225, 30, -225, -225, -225, -225, -225, -225,
908 -225, 208, -225, 309, -225, 120, -225, 208, -225, 311,
909 120, -20, 34, 776, -225, 236, 272, -225, 776, 776,
910 -225, -225, 302, -225, 237, -225, 188, 188, 73, 238,
911 -225, -225, 245, 250, -225, 13, 1058, -225, -225, -225,
912 -5, -225, 208, 776, 776, 239, 40, -225, 251, 244,
913 248, -225, -225, -225, -225, -225, -225, -225, -225, -225,
914 280, 253, 258, 262, 263, -225, -225, -225, -225, -225,
915 -225, -225, -225, 647, -225, 776, 337, -225, 345, -225,
916 -225, 331, 351, -225, -225, -225, 21, 61, 1094, 647,
917 1380, -225, 73, -225, -225, -225, -225, 73, -225, -225,
918 1380, 1380, -225, -225, 251, 776, -225, -225, -225, 776,
919 776, 776, 776, 1414, -225, -225, -225, -225, -225, -225,
920 -225, -225, -225, 1380, 1236, 1272, 1308, 1344, -225, -225,
921 -225, -225
922 };
923
924 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
925 Performed when YYTABLE does not specify something else to do. Zero
926 means the default is an error. */
927 static const yytype_int16 yydefact[] =
928 {
929 0, 95, 96, 99, 100, 109, 112, 0, 97, 282,
930 285, 195, 0, 98, 0, 0, 0, 0, 0, 0,
931 0, 192, 0, 0, 0, 0, 0, 0, 0, 0,
932 0, 194, 163, 164, 162, 128, 129, 188, 131, 130,
933 189, 0, 102, 113, 114, 0, 0, 0, 0, 0,
934 0, 0, 0, 283, 116, 0, 0, 58, 0, 3,
935 2, 8, 59, 64, 66, 0, 111, 0, 101, 123,
936 134, 0, 4, 196, 221, 161, 284, 125, 0, 56,
937 0, 40, 42, 44, 195, 0, 231, 232, 250, 261,
938 247, 258, 257, 244, 242, 243, 253, 254, 248, 249,
939 255, 256, 251, 252, 237, 238, 239, 240, 241, 259,
940 260, 263, 262, 0, 0, 246, 245, 224, 267, 276,
941 280, 199, 278, 279, 277, 281, 198, 202, 201, 205,
942 204, 208, 207, 0, 0, 22, 0, 213, 215, 216,
943 214, 191, 285, 283, 124, 0, 0, 0, 0, 0,
944 0, 0, 0, 215, 216, 193, 171, 167, 172, 165,
945 190, 186, 184, 182, 197, 11, 132, 133, 13, 12,
946 10, 16, 17, 0, 0, 14, 15, 1, 0, 0,
947 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
948 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
949 0, 0, 18, 19, 0, 0, 0, 0, 0, 53,
950 0, 60, 0, 0, 110, 0, 134, 211, 212, 0,
951 144, 142, 140, 0, 0, 146, 148, 222, 149, 152,
952 154, 118, 0, 59, 0, 120, 0, 0, 0, 266,
953 0, 0, 0, 0, 265, 264, 224, 223, 200, 203,
954 206, 209, 0, 0, 178, 169, 185, 0, 0, 0,
955 0, 0, 0, 0, 0, 0, 0, 176, 168, 170,
956 166, 180, 175, 173, 187, 183, 0, 72, 9, 0,
957 94, 93, 0, 91, 90, 89, 88, 87, 81, 82,
958 85, 86, 83, 84, 79, 80, 73, 77, 78, 74,
959 75, 76, 26, 278, 275, 274, 272, 273, 271, 269,
960 270, 0, 29, 24, 268, 30, 33, 0, 36, 31,
961 37, 0, 55, 59, 219, 0, 217, 68, 0, 0,
962 69, 67, 119, 135, 0, 156, 145, 143, 137, 0,
963 155, 159, 0, 0, 138, 147, 0, 151, 153, 103,
964 0, 121, 0, 0, 0, 0, 47, 48, 46, 0,
965 0, 235, 233, 236, 234, 138, 225, 104, 23, 179,
966 0, 0, 0, 0, 0, 5, 6, 7, 21, 20,
967 177, 181, 174, 71, 39, 0, 27, 25, 34, 32,
968 38, 229, 230, 63, 228, 126, 0, 127, 0, 70,
969 61, 158, 136, 141, 157, 150, 160, 137, 57, 122,
970 52, 51, 41, 49, 0, 0, 43, 45, 210, 0,
971 0, 0, 0, 92, 28, 35, 226, 227, 54, 62,
972 218, 220, 139, 50, 0, 0, 0, 0, 105, 107,
973 106, 108
974 };
975
976 /* YYPGOTO[NTERM-NUM]. */
977 static const yytype_int16 yypgoto[] =
978 {
979 -225, -225, 5, 15, -12, -225, -225, -225, -124, -225,
980 48, -225, -225, -225, -220, -225, -225, -225, 194, -225,
981 -225, -225, -151, 8, -70, -72, 14, -114, -225, -225,
982 -225, 212, 197, -224, -222, -122, 396, 17, 407, 234,
983 -225, -225, -225, 213, -225, -225, -7, 256, 3, 441
984 };
985
986 /* YYDEFGOTO[NTERM-NUM]. */
987 static const yytype_int16 yydefgoto[] =
988 {
989 -1, 58, 173, 174, 61, 236, 237, 238, 355, 356,
990 357, 323, 233, 62, 212, 63, 64, 65, 328, 66,
991 67, 68, 69, 393, 70, 71, 403, 225, 407, 338,
992 226, 227, 228, 229, 230, 72, 73, 74, 141, 343,
993 326, 75, 118, 247, 394, 395, 76, 313, 358, 77
994 };
995
996 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
997 positive, shift that token. If negative, reduce the rule whose
998 number is the opposite. If YYTABLE_NINF, syntax error. */
999 static const yytype_int16 yytable[] =
1000 {
1001 83, 216, 218, 246, 347, 59, 348, 135, 125, 125,
1002 125, 125, 252, 350, 240, 60, 125, 219, 126, 128,
1003 130, 132, 334, 339, 178, 329, 145, 242, 263, 219,
1004 221, 117, 178, 165, 178, 168, 169, 170, 171, 172,
1005 9, 142, 222, 175, 176, 218, 254, 14, 255, 329,
1006 211, 119, 120, 312, 122, 318, 80, 123, 14, 277,
1007 -127, 78, 119, 120, 302, 303, 327, 210, 123, 14,
1008 384, 125, 390, 125, 79, 329, 304, 391, 392, 166,
1009 167, 232, 241, 235, 408, 223, 224, 324, 217, 136,
1010 305, 306, 307, 308, 353, 243, 309, 223, 346, 310,
1011 146, 137, 324, 396, 391, 392, 336, 337, 161, 147,
1012 428, 335, 340, 359, 360, 143, 35, 36, 148, 38,
1013 39, 347, 162, 348, 149, 163, 124, 138, 139, 140,
1014 150, 151, 246, 354, 152, 370, 179, 124, 262, 264,
1015 266, 253, 311, -115, 46, 218, 271, 220, 333, 177,
1016 221, 258, 259, 260, 261, 178, -65, 265, 119, 120,
1017 272, 122, 365, 273, 123, 14, 278, 213, 280, 281,
1018 282, 283, 284, 285, 286, 287, 288, 289, 290, 291,
1019 292, 293, 294, 295, 296, 297, 298, 299, 300, 301,
1020 267, 214, 268, 315, 279, 320, 215, 125, 231, 125,
1021 204, 205, 206, 207, 208, 209, 125, 314, 125, 314,
1022 239, 244, 245, 137, 256, 248, 331, 219, 332, 119,
1023 120, 211, 122, 321, 324, 123, 14, 125, 249, 125,
1024 125, 125, 250, 124, 251, 269, 257, 351, 234, 153,
1025 154, 140, 270, 119, 120, 316, 303, 274, 275, 123,
1026 14, 276, 119, 120, 121, 122, 327, 304, 123, 14,
1027 220, 222, 344, 221, 383, 349, 402, 361, 352, 362,
1028 363, 305, 306, 307, 308, 222, 431, 309, 364, 367,
1029 310, 119, 120, 127, 122, 223, 224, 123, 14, 119,
1030 120, 129, 122, 368, 124, 123, 14, 369, 376, 119,
1031 120, 131, 122, 179, 125, 123, 14, 378, 380, 371,
1032 125, 211, 372, 373, 386, 374, 399, 400, 124, 381,
1033 388, 382, 387, 317, 389, 397, 398, 124, -117, 401,
1034 404, 412, 333, 179, 405, 402, 416, 21, 419, 406,
1035 417, 410, 411, 420, 415, 125, 418, 421, 422, 125,
1036 424, 31, 32, 33, 34, 409, 124, 37, 425, 414,
1037 40, 199, 200, 201, 124, 202, 203, 204, 205, 206,
1038 207, 208, 209, 423, 124, 426, 184, 185, 186, 187,
1039 188, 189, 190, 191, 192, 193, 194, 195, 196, 197,
1040 198, 199, 200, 201, 427, 202, 203, 204, 205, 206,
1041 207, 208, 209, 433, 413, 429, 330, 434, 435, 436,
1042 437, 1, 2, 3, 4, 5, 6, 7, 8, 9,
1043 10, 432, 11, 345, 12, 13, 14, 15, 16, 17,
1044 18, 19, 20, 21, 22, 23, 342, 164, 155, 24,
1045 25, 26, 27, 325, 28, 29, 30, 31, 32, 33,
1046 34, 35, 36, 37, 38, 39, 40, 41, 42, 366,
1047 43, 44, 319, 144, 0, 0, 0, 0, 0, 0,
1048 45, 0, 0, 0, 0, 0, 0, 0, 0, 46,
1049 47, 48, 49, 0, 0, 0, 50, 51, 0, 0,
1050 0, 0, 0, 52, 53, 54, 0, 0, 55, 56,
1051 0, 179, 57, 1, 2, 3, 4, 5, 6, 7,
1052 8, 9, 10, 0, 11, 0, 12, 13, 14, 15,
1053 16, 17, 18, 19, 20, 21, 22, 23, 0, 0,
1054 0, 24, 25, 26, 27, 0, 0, 0, 30, 31,
1055 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1056 42, 0, 43, 44, 194, 195, 196, 197, 198, 199,
1057 200, 201, 45, 202, 203, 204, 205, 206, 207, 208,
1058 209, 46, 47, 48, 49, 0, 0, 0, 50, 51,
1059 0, 0, 0, 0, 0, 52, 53, 54, 0, 0,
1060 55, 56, 0, 179, 57, 1, 2, 3, 4, 5,
1061 6, 7, 8, 9, 10, 0, 81, 82, 12, 13,
1062 14, 0, 0, 0, 156, 19, 20, 0, 22, 0,
1063 0, 0, 0, 24, 25, 26, 27, 0, 157, 158,
1064 30, 159, 0, 0, 160, 0, 0, 0, 0, 0,
1065 0, 0, 42, 0, 43, 44, 0, 0, 196, 197,
1066 198, 199, 200, 201, 45, 202, 203, 204, 205, 206,
1067 207, 208, 209, 179, 47, 48, 49, 0, 0, 0,
1068 50, 51, 0, 0, 0, 0, 0, 52, 53, 54,
1069 0, 0, 55, 56, 0, 179, 57, 1, 2, 3,
1070 4, 5, 6, 7, 8, 9, 10, 0, 133, 0,
1071 12, 13, 14, 0, 0, 0, 0, 19, 20, 0,
1072 22, 0, 0, 0, 0, 24, 25, 26, 27, 0,
1073 0, 0, 30, 0, 0, 202, 203, 204, 205, 206,
1074 207, 208, 209, 0, 42, 0, 43, 44, 0, 0,
1075 0, 197, 198, 199, 200, 201, 45, 202, 203, 204,
1076 205, 206, 207, 208, 209, 0, 47, 48, 49, 0,
1077 0, 0, 50, 51, 0, 0, 0, 0, 0, 134,
1078 53, 54, 0, 0, 55, 56, 0, 0, 57, 1,
1079 2, 3, 4, 5, 6, 7, 8, 9, 10, 0,
1080 133, 0, 12, 13, 14, 0, 0, 0, 0, 19,
1081 20, 0, 22, 0, 0, 0, 0, 24, 25, 26,
1082 27, 0, 0, 0, 30, 35, 36, 0, 38, 39,
1083 0, 0, 0, 0, 0, 0, 42, 0, 43, 44,
1084 0, 220, 0, 0, 221, 0, 0, 0, 45, 0,
1085 0, 0, 0, 46, 0, 0, 222, 0, 47, 48,
1086 49, 0, 0, 0, 50, 51, 0, 0, 0, 0,
1087 0, 52, 53, 54, 0, 0, 55, 56, 0, 84,
1088 57, 85, 0, 0, 15, 16, 17, 18, 0, 0,
1089 21, 0, 23, 0, 86, 87, 0, 0, 0, 0,
1090 0, 0, 0, 0, 31, 32, 33, 34, 35, 36,
1091 37, 38, 39, 40, 41, 0, 88, 179, 0, 89,
1092 0, 90, 0, 91, 92, 93, 94, 95, 96, 97,
1093 98, 99, 100, 101, 102, 103, 46, 104, 105, 106,
1094 107, 108, 0, 109, 110, 111, 112, 0, 0, 113,
1095 114, 0, 180, 0, 0, 115, 116, 181, 182, 183,
1096 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
1097 194, 195, 196, 197, 198, 199, 200, 201, 0, 202,
1098 203, 204, 205, 206, 207, 208, 209, 0, 0, 0,
1099 84, 0, 219, 0, 385, 15, 16, 17, 18, 0,
1100 0, 21, 0, 23, 0, 0, 0, 0, 0, 0,
1101 0, 0, 0, 0, 0, 31, 32, 33, 34, 35,
1102 36, 37, 38, 39, 40, 41, 0, 0, 0, 0,
1103 0, 0, 0, 0, 0, 220, 0, 0, 221, 0,
1104 0, 0, 0, 0, 0, 0, 84, 46, 0, 0,
1105 222, 15, 16, 17, 18, 0, 0, 21, 0, 23,
1106 223, 224, 0, 0, 0, 341, 0, 0, 0, 0,
1107 0, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1108 40, 41, 84, 0, 0, 0, 0, 15, 16, 17,
1109 18, 0, 0, 21, 0, 23, 0, 0, 0, 0,
1110 0, 0, 0, 46, 0, 0, 0, 31, 32, 33,
1111 34, 35, 36, 37, 38, 39, 40, 41, 84, 0,
1112 0, 322, 0, 15, 16, 17, 18, 0, 0, 21,
1113 0, 23, 0, 0, 0, 0, 0, 0, 0, 46,
1114 0, 0, 0, 31, 32, 33, 34, 35, 36, 37,
1115 38, 39, 40, 41, 179, 0, 0, 341, 0, 0,
1116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1117 0, 0, 0, 0, 0, 46, 0, 0, 0, 0,
1118 0, 0, 0, 0, 0, 0, 0, 0, 0, 180,
1119 179, 0, 430, 0, 181, 182, 183, 184, 185, 186,
1120 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
1121 197, 198, 199, 200, 201, 0, 202, 203, 204, 205,
1122 206, 207, 208, 209, 0, 180, 179, 375, 0, 0,
1123 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
1124 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
1125 201, 0, 202, 203, 204, 205, 206, 207, 208, 209,
1126 0, 180, 179, 377, 0, 0, 181, 182, 183, 184,
1127 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
1128 195, 196, 197, 198, 199, 200, 201, 0, 202, 203,
1129 204, 205, 206, 207, 208, 209, 0, 180, 179, 379,
1130 0, 0, 181, 182, 183, 184, 185, 186, 187, 188,
1131 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
1132 199, 200, 201, 0, 202, 203, 204, 205, 206, 207,
1133 208, 209, 0, 180, 179, 438, 0, 0, 181, 182,
1134 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
1135 193, 194, 195, 196, 197, 198, 199, 200, 201, 0,
1136 202, 203, 204, 205, 206, 207, 208, 209, 0, 180,
1137 179, 439, 0, 0, 181, 182, 183, 184, 185, 186,
1138 187, 188, 189, 190, 191, 192, 193, 194, 195, 196,
1139 197, 198, 199, 200, 201, 0, 202, 203, 204, 205,
1140 206, 207, 208, 209, 0, 180, 179, 440, 0, 0,
1141 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
1142 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
1143 201, 0, 202, 203, 204, 205, 206, 207, 208, 209,
1144 179, 180, 0, 441, 0, 0, 181, 182, 183, 184,
1145 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
1146 195, 196, 197, 198, 199, 200, 201, 179, 202, 203,
1147 204, 205, 206, 207, 208, 209, 0, 0, 0, 0,
1148 0, 182, 183, 184, 185, 186, 187, 188, 189, 190,
1149 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
1150 201, 179, 202, 203, 204, 205, 206, 207, 208, 209,
1151 0, 185, 186, 187, 188, 189, 190, 191, 192, 193,
1152 194, 195, 196, 197, 198, 199, 200, 201, 179, 202,
1153 203, 204, 205, 206, 207, 208, 209, 0, 0, 0,
1154 0, 0, 0, 0, 0, 0, 186, 187, 188, 189,
1155 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
1156 200, 201, 179, 202, 203, 204, 205, 206, 207, 208,
1157 209, 0, 0, 0, 187, 188, 189, 190, 191, 192,
1158 193, 194, 195, 196, 197, 198, 199, 200, 201, 179,
1159 202, 203, 204, 205, 206, 207, 208, 209, 0, 0,
1160 0, 0, 0, 0, 0, 0, 0, 0, 0, 188,
1161 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
1162 199, 200, 201, 0, 202, 203, 204, 205, 206, 207,
1163 208, 209, 0, 0, 0, 0, 0, 0, 190, 191,
1164 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
1165 0, 202, 203, 204, 205, 206, 207, 208, 209, 84,
1166 0, 0, 0, 0, 15, 16, 17, 18, 0, 0,
1167 21, 0, 23, 0, 0, 0, 0, 0, 0, 0,
1168 0, 28, 29, 0, 31, 32, 33, 34, 35, 36,
1169 37, 38, 39, 40, 41, 84, 0, 0, 0, 0,
1170 15, 16, 17, 18, 0, 0, 21, 0, 23, 0,
1171 0, 0, 0, 0, 0, 0, 46, 0, 0, 0,
1172 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1173 41, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1174 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1175 0, 0, 46
1176 };
1177
1178 static const yytype_int16 yycheck[] =
1179 {
1180 12, 71, 74, 117, 228, 0, 228, 19, 15, 16,
1181 17, 18, 134, 233, 16, 0, 23, 16, 15, 16,
1182 17, 18, 3, 3, 54, 54, 23, 16, 150, 16,
1183 62, 14, 54, 45, 54, 47, 48, 49, 50, 51,
1184 11, 12, 74, 55, 56, 117, 40, 18, 42, 54,
1185 62, 11, 12, 204, 14, 206, 26, 17, 18, 89,
1186 26, 85, 11, 12, 13, 14, 95, 62, 17, 18,
1187 92, 78, 92, 80, 85, 54, 25, 43, 44, 11,
1188 12, 78, 84, 80, 89, 84, 85, 209, 71, 85,
1189 39, 40, 41, 42, 54, 84, 45, 84, 85, 48,
1190 65, 14, 224, 323, 43, 44, 220, 221, 25, 65,
1191 89, 92, 92, 237, 238, 86, 43, 44, 65, 46,
1192 47, 345, 39, 345, 65, 42, 86, 40, 41, 42,
1193 85, 85, 246, 93, 85, 257, 16, 86, 150, 151,
1194 152, 136, 91, 26, 71, 217, 25, 59, 218, 0,
1195 62, 146, 147, 148, 149, 54, 26, 152, 11, 12,
1196 39, 14, 74, 42, 17, 18, 178, 26, 180, 181,
1197 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
1198 192, 193, 194, 195, 196, 197, 198, 199, 200, 201,
1199 40, 7, 42, 205, 179, 207, 26, 204, 35, 206,
1200 80, 81, 82, 83, 84, 85, 213, 204, 215, 206,
1201 92, 92, 89, 14, 42, 13, 213, 16, 215, 11,
1202 12, 233, 14, 208, 346, 17, 18, 234, 13, 236,
1203 237, 238, 13, 86, 13, 42, 65, 234, 91, 40,
1204 41, 42, 42, 11, 12, 13, 14, 42, 42, 17,
1205 18, 89, 11, 12, 13, 14, 95, 25, 17, 18,
1206 59, 74, 74, 62, 276, 89, 338, 92, 26, 92,
1207 92, 39, 40, 41, 42, 74, 398, 45, 92, 89,
1208 48, 11, 12, 13, 14, 84, 85, 17, 18, 11,
1209 12, 13, 14, 89, 86, 17, 18, 42, 89, 11,
1210 12, 13, 14, 16, 311, 17, 18, 89, 42, 66,
1211 317, 323, 66, 66, 311, 66, 328, 329, 86, 42,
1212 317, 42, 13, 91, 13, 89, 54, 86, 26, 92,
1213 92, 92, 402, 16, 89, 407, 92, 25, 85, 89,
1214 92, 353, 354, 85, 93, 352, 66, 85, 85, 356,
1215 13, 39, 40, 41, 42, 352, 86, 45, 13, 356,
1216 48, 74, 75, 76, 86, 78, 79, 80, 81, 82,
1217 83, 84, 85, 385, 86, 44, 59, 60, 61, 62,
1218 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1219 73, 74, 75, 76, 43, 78, 79, 80, 81, 82,
1220 83, 84, 85, 415, 356, 397, 212, 419, 420, 421,
1221 422, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1222 12, 407, 14, 226, 16, 17, 18, 19, 20, 21,
1223 22, 23, 24, 25, 26, 27, 224, 41, 31, 31,
1224 32, 33, 34, 209, 36, 37, 38, 39, 40, 41,
1225 42, 43, 44, 45, 46, 47, 48, 49, 50, 246,
1226 52, 53, 206, 22, -1, -1, -1, -1, -1, -1,
1227 62, -1, -1, -1, -1, -1, -1, -1, -1, 71,
1228 72, 73, 74, -1, -1, -1, 78, 79, -1, -1,
1229 -1, -1, -1, 85, 86, 87, -1, -1, 90, 91,
1230 -1, 16, 94, 3, 4, 5, 6, 7, 8, 9,
1231 10, 11, 12, -1, 14, -1, 16, 17, 18, 19,
1232 20, 21, 22, 23, 24, 25, 26, 27, -1, -1,
1233 -1, 31, 32, 33, 34, -1, -1, -1, 38, 39,
1234 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
1235 50, -1, 52, 53, 69, 70, 71, 72, 73, 74,
1236 75, 76, 62, 78, 79, 80, 81, 82, 83, 84,
1237 85, 71, 72, 73, 74, -1, -1, -1, 78, 79,
1238 -1, -1, -1, -1, -1, 85, 86, 87, -1, -1,
1239 90, 91, -1, 16, 94, 3, 4, 5, 6, 7,
1240 8, 9, 10, 11, 12, -1, 14, 15, 16, 17,
1241 18, -1, -1, -1, 25, 23, 24, -1, 26, -1,
1242 -1, -1, -1, 31, 32, 33, 34, -1, 39, 40,
1243 38, 42, -1, -1, 45, -1, -1, -1, -1, -1,
1244 -1, -1, 50, -1, 52, 53, -1, -1, 71, 72,
1245 73, 74, 75, 76, 62, 78, 79, 80, 81, 82,
1246 83, 84, 85, 16, 72, 73, 74, -1, -1, -1,
1247 78, 79, -1, -1, -1, -1, -1, 85, 86, 87,
1248 -1, -1, 90, 91, -1, 16, 94, 3, 4, 5,
1249 6, 7, 8, 9, 10, 11, 12, -1, 14, -1,
1250 16, 17, 18, -1, -1, -1, -1, 23, 24, -1,
1251 26, -1, -1, -1, -1, 31, 32, 33, 34, -1,
1252 -1, -1, 38, -1, -1, 78, 79, 80, 81, 82,
1253 83, 84, 85, -1, 50, -1, 52, 53, -1, -1,
1254 -1, 72, 73, 74, 75, 76, 62, 78, 79, 80,
1255 81, 82, 83, 84, 85, -1, 72, 73, 74, -1,
1256 -1, -1, 78, 79, -1, -1, -1, -1, -1, 85,
1257 86, 87, -1, -1, 90, 91, -1, -1, 94, 3,
1258 4, 5, 6, 7, 8, 9, 10, 11, 12, -1,
1259 14, -1, 16, 17, 18, -1, -1, -1, -1, 23,
1260 24, -1, 26, -1, -1, -1, -1, 31, 32, 33,
1261 34, -1, -1, -1, 38, 43, 44, -1, 46, 47,
1262 -1, -1, -1, -1, -1, -1, 50, -1, 52, 53,
1263 -1, 59, -1, -1, 62, -1, -1, -1, 62, -1,
1264 -1, -1, -1, 71, -1, -1, 74, -1, 72, 73,
1265 74, -1, -1, -1, 78, 79, -1, -1, -1, -1,
1266 -1, 85, 86, 87, -1, -1, 90, 91, -1, 14,
1267 94, 16, -1, -1, 19, 20, 21, 22, -1, -1,
1268 25, -1, 27, -1, 29, 30, -1, -1, -1, -1,
1269 -1, -1, -1, -1, 39, 40, 41, 42, 43, 44,
1270 45, 46, 47, 48, 49, -1, 51, 16, -1, 54,
1271 -1, 56, -1, 58, 59, 60, 61, 62, 63, 64,
1272 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1273 75, 76, -1, 78, 79, 80, 81, -1, -1, 84,
1274 85, -1, 51, -1, -1, 90, 91, 56, 57, 58,
1275 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
1276 69, 70, 71, 72, 73, 74, 75, 76, -1, 78,
1277 79, 80, 81, 82, 83, 84, 85, -1, -1, -1,
1278 14, -1, 16, -1, 93, 19, 20, 21, 22, -1,
1279 -1, 25, -1, 27, -1, -1, -1, -1, -1, -1,
1280 -1, -1, -1, -1, -1, 39, 40, 41, 42, 43,
1281 44, 45, 46, 47, 48, 49, -1, -1, -1, -1,
1282 -1, -1, -1, -1, -1, 59, -1, -1, 62, -1,
1283 -1, -1, -1, -1, -1, -1, 14, 71, -1, -1,
1284 74, 19, 20, 21, 22, -1, -1, 25, -1, 27,
1285 84, 85, -1, -1, -1, 89, -1, -1, -1, -1,
1286 -1, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1287 48, 49, 14, -1, -1, -1, -1, 19, 20, 21,
1288 22, -1, -1, 25, -1, 27, -1, -1, -1, -1,
1289 -1, -1, -1, 71, -1, -1, -1, 39, 40, 41,
1290 42, 43, 44, 45, 46, 47, 48, 49, 14, -1,
1291 -1, 89, -1, 19, 20, 21, 22, -1, -1, 25,
1292 -1, 27, -1, -1, -1, -1, -1, -1, -1, 71,
1293 -1, -1, -1, 39, 40, 41, 42, 43, 44, 45,
1294 46, 47, 48, 49, 16, -1, -1, 89, -1, -1,
1295 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1296 -1, -1, -1, -1, -1, 71, -1, -1, -1, -1,
1297 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51,
1298 16, -1, 88, -1, 56, 57, 58, 59, 60, 61,
1299 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1300 72, 73, 74, 75, 76, -1, 78, 79, 80, 81,
1301 82, 83, 84, 85, -1, 51, 16, 89, -1, -1,
1302 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1303 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1304 76, -1, 78, 79, 80, 81, 82, 83, 84, 85,
1305 -1, 51, 16, 89, -1, -1, 56, 57, 58, 59,
1306 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1307 70, 71, 72, 73, 74, 75, 76, -1, 78, 79,
1308 80, 81, 82, 83, 84, 85, -1, 51, 16, 89,
1309 -1, -1, 56, 57, 58, 59, 60, 61, 62, 63,
1310 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1311 74, 75, 76, -1, 78, 79, 80, 81, 82, 83,
1312 84, 85, -1, 51, 16, 89, -1, -1, 56, 57,
1313 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
1314 68, 69, 70, 71, 72, 73, 74, 75, 76, -1,
1315 78, 79, 80, 81, 82, 83, 84, 85, -1, 51,
1316 16, 89, -1, -1, 56, 57, 58, 59, 60, 61,
1317 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
1318 72, 73, 74, 75, 76, -1, 78, 79, 80, 81,
1319 82, 83, 84, 85, -1, 51, 16, 89, -1, -1,
1320 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1321 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1322 76, -1, 78, 79, 80, 81, 82, 83, 84, 85,
1323 16, 51, -1, 89, -1, -1, 56, 57, 58, 59,
1324 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
1325 70, 71, 72, 73, 74, 75, 76, 16, 78, 79,
1326 80, 81, 82, 83, 84, 85, -1, -1, -1, -1,
1327 -1, 57, 58, 59, 60, 61, 62, 63, 64, 65,
1328 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
1329 76, 16, 78, 79, 80, 81, 82, 83, 84, 85,
1330 -1, 60, 61, 62, 63, 64, 65, 66, 67, 68,
1331 69, 70, 71, 72, 73, 74, 75, 76, 16, 78,
1332 79, 80, 81, 82, 83, 84, 85, -1, -1, -1,
1333 -1, -1, -1, -1, -1, -1, 61, 62, 63, 64,
1334 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1335 75, 76, 16, 78, 79, 80, 81, 82, 83, 84,
1336 85, -1, -1, -1, 62, 63, 64, 65, 66, 67,
1337 68, 69, 70, 71, 72, 73, 74, 75, 76, 16,
1338 78, 79, 80, 81, 82, 83, 84, 85, -1, -1,
1339 -1, -1, -1, -1, -1, -1, -1, -1, -1, 63,
1340 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1341 74, 75, 76, -1, 78, 79, 80, 81, 82, 83,
1342 84, 85, -1, -1, -1, -1, -1, -1, 65, 66,
1343 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
1344 -1, 78, 79, 80, 81, 82, 83, 84, 85, 14,
1345 -1, -1, -1, -1, 19, 20, 21, 22, -1, -1,
1346 25, -1, 27, -1, -1, -1, -1, -1, -1, -1,
1347 -1, 36, 37, -1, 39, 40, 41, 42, 43, 44,
1348 45, 46, 47, 48, 49, 14, -1, -1, -1, -1,
1349 19, 20, 21, 22, -1, -1, 25, -1, 27, -1,
1350 -1, -1, -1, -1, -1, -1, 71, -1, -1, -1,
1351 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
1352 49, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1353 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1354 -1, -1, 71
1355 };
1356
1357 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1358 symbol of state STATE-NUM. */
1359 static const yytype_uint8 yystos[] =
1360 {
1361 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1362 12, 14, 16, 17, 18, 19, 20, 21, 22, 23,
1363 24, 25, 26, 27, 31, 32, 33, 34, 36, 37,
1364 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
1365 48, 49, 50, 52, 53, 62, 71, 72, 73, 74,
1366 78, 79, 85, 86, 87, 90, 91, 94, 97, 98,
1367 99, 100, 109, 111, 112, 113, 115, 116, 117, 118,
1368 120, 121, 131, 132, 133, 137, 142, 145, 85, 85,
1369 26, 14, 15, 100, 14, 16, 29, 30, 51, 54,
1370 56, 58, 59, 60, 61, 62, 63, 64, 65, 66,
1371 67, 68, 69, 70, 72, 73, 74, 75, 76, 78,
1372 79, 80, 81, 84, 85, 90, 91, 133, 138, 11,
1373 12, 13, 14, 17, 86, 142, 144, 13, 144, 13,
1374 144, 13, 144, 14, 85, 100, 85, 14, 40, 41,
1375 42, 134, 12, 86, 145, 144, 65, 65, 65, 65,
1376 85, 85, 85, 40, 41, 134, 25, 39, 40, 42,
1377 45, 25, 39, 42, 132, 100, 11, 12, 100, 100,
1378 100, 100, 100, 98, 99, 100, 100, 0, 54, 16,
1379 51, 56, 57, 58, 59, 60, 61, 62, 63, 64,
1380 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
1381 75, 76, 78, 79, 80, 81, 82, 83, 84, 85,
1382 98, 100, 110, 26, 7, 26, 120, 133, 121, 16,
1383 59, 62, 74, 84, 85, 123, 126, 127, 128, 129,
1384 130, 35, 144, 108, 91, 144, 101, 102, 103, 92,
1385 16, 84, 16, 84, 92, 89, 123, 139, 13, 13,
1386 13, 13, 131, 98, 40, 42, 42, 65, 98, 98,
1387 98, 98, 100, 131, 100, 98, 100, 40, 42, 42,
1388 42, 25, 39, 42, 42, 42, 89, 89, 100, 99,
1389 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1390 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1391 100, 100, 13, 14, 25, 39, 40, 41, 42, 45,
1392 48, 91, 118, 143, 144, 100, 13, 91, 118, 143,
1393 100, 99, 89, 107, 131, 135, 136, 95, 114, 54,
1394 114, 144, 144, 120, 3, 92, 123, 123, 125, 3,
1395 92, 89, 127, 135, 74, 128, 85, 129, 130, 89,
1396 110, 144, 26, 54, 93, 104, 105, 106, 144, 104,
1397 104, 92, 92, 92, 92, 74, 139, 89, 89, 42,
1398 131, 66, 66, 66, 66, 89, 89, 89, 89, 89,
1399 42, 42, 42, 100, 92, 93, 144, 13, 144, 13,
1400 92, 43, 44, 119, 140, 141, 110, 89, 54, 100,
1401 100, 92, 121, 122, 92, 89, 89, 124, 89, 144,
1402 100, 100, 92, 106, 144, 93, 92, 92, 66, 85,
1403 85, 85, 85, 100, 13, 13, 44, 43, 89, 119,
1404 88, 131, 122, 100, 100, 100, 100, 100, 89, 89,
1405 89, 89
1406 };
1407
1408 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1409 static const yytype_uint8 yyr1[] =
1410 {
1411 0, 96, 97, 97, 98, 98, 98, 98, 99, 99,
1412 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1413 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1414 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1415 101, 100, 102, 100, 103, 100, 104, 104, 105, 105,
1416 106, 106, 106, 107, 100, 100, 108, 100, 109, 110,
1417 110, 110, 111, 112, 100, 113, 113, 100, 114, 100,
1418 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1419 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1420 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
1421 100, 100, 100, 100, 100, 100, 100, 100, 100, 115,
1422 115, 100, 100, 100, 100, 116, 116, 116, 117, 117,
1423 118, 118, 118, 117, 117, 117, 119, 119, 120, 120,
1424 120, 120, 120, 120, 121, 121, 122, 122, 124, 123,
1425 125, 123, 123, 123, 123, 123, 126, 127, 127, 127,
1426 128, 128, 128, 128, 128, 129, 129, 129, 129, 130,
1427 130, 131, 132, 132, 132, 132, 132, 132, 132, 132,
1428 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
1429 132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
1430 132, 132, 132, 132, 132, 133, 133, 133, 133, 133,
1431 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1432 133, 133, 133, 134, 134, 134, 134, 135, 135, 136,
1433 136, 137, 137, 138, 139, 139, 140, 140, 141, 141,
1434 141, 142, 142, 142, 142, 142, 142, 142, 142, 142,
1435 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
1436 142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
1437 142, 142, 142, 142, 142, 142, 142, 142, 143, 143,
1438 143, 143, 143, 143, 143, 143, 144, 144, 144, 144,
1439 144, 144, 145, 145, 145, 145
1440 };
1441
1442 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1443 static const yytype_int8 yyr2[] =
1444 {
1445 0, 2, 1, 1, 1, 4, 4, 4, 1, 3,
1446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1447 4, 4, 2, 4, 3, 4, 3, 4, 5, 3,
1448 3, 3, 4, 3, 4, 5, 3, 3, 4, 4,
1449 0, 5, 0, 5, 0, 5, 1, 1, 1, 2,
1450 3, 2, 2, 0, 5, 3, 0, 5, 1, 0,
1451 1, 3, 5, 4, 1, 1, 1, 3, 1, 3,
1452 4, 4, 3, 3, 3, 3, 3, 3, 3, 3,
1453 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1454 3, 3, 5, 3, 3, 1, 1, 1, 1, 1,
1455 1, 1, 1, 4, 4, 7, 7, 7, 7, 1,
1456 2, 1, 1, 1, 1, 1, 1, 3, 2, 3,
1457 3, 4, 5, 1, 2, 1, 1, 0, 1, 1,
1458 1, 1, 2, 2, 1, 2, 1, 0, 0, 4,
1459 0, 3, 1, 2, 1, 2, 1, 2, 1, 1,
1460 3, 2, 1, 2, 1, 2, 2, 3, 3, 2,
1461 3, 1, 1, 1, 1, 2, 3, 2, 3, 3,
1462 3, 2, 2, 3, 4, 3, 3, 4, 3, 4,
1463 3, 4, 2, 3, 2, 3, 2, 3, 1, 1,
1464 2, 2, 1, 2, 1, 1, 1, 2, 2, 2,
1465 3, 2, 2, 3, 2, 2, 3, 2, 2, 3,
1466 5, 2, 2, 1, 1, 1, 1, 1, 3, 1,
1467 3, 1, 2, 2, 0, 2, 2, 2, 1, 1,
1468 1, 2, 2, 4, 4, 4, 4, 2, 2, 2,
1469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1471 2, 2, 2, 2, 3, 3, 3, 2, 1, 1,
1472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1473 1, 1, 1, 1, 1, 1
1474 };
1475
1476
1477 #define yyerrok (yyerrstatus = 0)
1478 #define yyclearin (yychar = YYEMPTY)
1479 #define YYEMPTY (-2)
1480 #define YYEOF 0
1481
1482 #define YYACCEPT goto yyacceptlab
1483 #define YYABORT goto yyabortlab
1484 #define YYERROR goto yyerrorlab
1485
1486
1487 #define YYRECOVERING() (!!yyerrstatus)
1488
1489 #define YYBACKUP(Token, Value) \
1490 do \
1491 if (yychar == YYEMPTY) \
1492 { \
1493 yychar = (Token); \
1494 yylval = (Value); \
1495 YYPOPSTACK (yylen); \
1496 yystate = *yyssp; \
1497 goto yybackup; \
1498 } \
1499 else \
1500 { \
1501 yyerror (YY_("syntax error: cannot back up")); \
1502 YYERROR; \
1503 } \
1504 while (0)
1505
1506 /* Error token number */
1507 #define YYTERROR 1
1508 #define YYERRCODE 256
1509
1510
1511
1512 /* Enable debugging if requested. */
1513 #if YYDEBUG
1514
1515 # ifndef YYFPRINTF
1516 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1517 # define YYFPRINTF fprintf
1518 # endif
1519
1520 # define YYDPRINTF(Args) \
1521 do { \
1522 if (yydebug) \
1523 YYFPRINTF Args; \
1524 } while (0)
1525
1526 /* This macro is provided for backward compatibility. */
1527 #ifndef YY_LOCATION_PRINT
1528 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1529 #endif
1530
1531
1532 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1533 do { \
1534 if (yydebug) \
1535 { \
1536 YYFPRINTF (stderr, "%s ", Title); \
1537 yy_symbol_print (stderr, \
1538 Type, Value); \
1539 YYFPRINTF (stderr, "\n"); \
1540 } \
1541 } while (0)
1542
1543
1544 /*-----------------------------------.
1545 | Print this symbol's value on YYO. |
1546 `-----------------------------------*/
1547
1548 static void
yy_symbol_value_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)1549 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1550 {
1551 FILE *yyoutput = yyo;
1552 YYUSE (yyoutput);
1553 if (!yyvaluep)
1554 return;
1555 # ifdef YYPRINT
1556 if (yytype < YYNTOKENS)
1557 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1558 # endif
1559 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1560 YYUSE (yytype);
1561 YY_IGNORE_MAYBE_UNINITIALIZED_END
1562 }
1563
1564
1565 /*---------------------------.
1566 | Print this symbol on YYO. |
1567 `---------------------------*/
1568
1569 static void
yy_symbol_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep)1570 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1571 {
1572 YYFPRINTF (yyo, "%s %s (",
1573 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1574
1575 yy_symbol_value_print (yyo, yytype, yyvaluep);
1576 YYFPRINTF (yyo, ")");
1577 }
1578
1579 /*------------------------------------------------------------------.
1580 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1581 | TOP (included). |
1582 `------------------------------------------------------------------*/
1583
1584 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)1585 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1586 {
1587 YYFPRINTF (stderr, "Stack now");
1588 for (; yybottom <= yytop; yybottom++)
1589 {
1590 int yybot = *yybottom;
1591 YYFPRINTF (stderr, " %d", yybot);
1592 }
1593 YYFPRINTF (stderr, "\n");
1594 }
1595
1596 # define YY_STACK_PRINT(Bottom, Top) \
1597 do { \
1598 if (yydebug) \
1599 yy_stack_print ((Bottom), (Top)); \
1600 } while (0)
1601
1602
1603 /*------------------------------------------------.
1604 | Report that the YYRULE is going to be reduced. |
1605 `------------------------------------------------*/
1606
1607 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule)1608 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
1609 {
1610 int yylno = yyrline[yyrule];
1611 int yynrhs = yyr2[yyrule];
1612 int yyi;
1613 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1614 yyrule - 1, yylno);
1615 /* The symbols being reduced. */
1616 for (yyi = 0; yyi < yynrhs; yyi++)
1617 {
1618 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1619 yy_symbol_print (stderr,
1620 yystos[+yyssp[yyi + 1 - yynrhs]],
1621 &yyvsp[(yyi + 1) - (yynrhs)]
1622 );
1623 YYFPRINTF (stderr, "\n");
1624 }
1625 }
1626
1627 # define YY_REDUCE_PRINT(Rule) \
1628 do { \
1629 if (yydebug) \
1630 yy_reduce_print (yyssp, yyvsp, Rule); \
1631 } while (0)
1632
1633 /* Nonzero means print parse trace. It is left uninitialized so that
1634 multiple parsers can coexist. */
1635 int yydebug;
1636 #else /* !YYDEBUG */
1637 # define YYDPRINTF(Args)
1638 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1639 # define YY_STACK_PRINT(Bottom, Top)
1640 # define YY_REDUCE_PRINT(Rule)
1641 #endif /* !YYDEBUG */
1642
1643
1644 /* YYINITDEPTH -- initial size of the parser's stacks. */
1645 #ifndef YYINITDEPTH
1646 # define YYINITDEPTH 200
1647 #endif
1648
1649 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1650 if the built-in stack extension method is used).
1651
1652 Do not make this value too large; the results are undefined if
1653 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1654 evaluated with infinite-precision integer arithmetic. */
1655
1656 #ifndef YYMAXDEPTH
1657 # define YYMAXDEPTH 10000
1658 #endif
1659
1660
1661 #if YYERROR_VERBOSE
1662
1663 # ifndef yystrlen
1664 # if defined __GLIBC__ && defined _STRING_H
1665 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1666 # else
1667 /* Return the length of YYSTR. */
1668 static YYPTRDIFF_T
yystrlen(const char * yystr)1669 yystrlen (const char *yystr)
1670 {
1671 YYPTRDIFF_T yylen;
1672 for (yylen = 0; yystr[yylen]; yylen++)
1673 continue;
1674 return yylen;
1675 }
1676 # endif
1677 # endif
1678
1679 # ifndef yystpcpy
1680 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1681 # define yystpcpy stpcpy
1682 # else
1683 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1684 YYDEST. */
1685 static char *
yystpcpy(char * yydest,const char * yysrc)1686 yystpcpy (char *yydest, const char *yysrc)
1687 {
1688 char *yyd = yydest;
1689 const char *yys = yysrc;
1690
1691 while ((*yyd++ = *yys++) != '\0')
1692 continue;
1693
1694 return yyd - 1;
1695 }
1696 # endif
1697 # endif
1698
1699 # ifndef yytnamerr
1700 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1701 quotes and backslashes, so that it's suitable for yyerror. The
1702 heuristic is that double-quoting is unnecessary unless the string
1703 contains an apostrophe, a comma, or backslash (other than
1704 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1705 null, do not copy; instead, return the length of what the result
1706 would have been. */
1707 static YYPTRDIFF_T
yytnamerr(char * yyres,const char * yystr)1708 yytnamerr (char *yyres, const char *yystr)
1709 {
1710 if (*yystr == '"')
1711 {
1712 YYPTRDIFF_T yyn = 0;
1713 char const *yyp = yystr;
1714
1715 for (;;)
1716 switch (*++yyp)
1717 {
1718 case '\'':
1719 case ',':
1720 goto do_not_strip_quotes;
1721
1722 case '\\':
1723 if (*++yyp != '\\')
1724 goto do_not_strip_quotes;
1725 else
1726 goto append;
1727
1728 append:
1729 default:
1730 if (yyres)
1731 yyres[yyn] = *yyp;
1732 yyn++;
1733 break;
1734
1735 case '"':
1736 if (yyres)
1737 yyres[yyn] = '\0';
1738 return yyn;
1739 }
1740 do_not_strip_quotes: ;
1741 }
1742
1743 if (yyres)
1744 return yystpcpy (yyres, yystr) - yyres;
1745 else
1746 return yystrlen (yystr);
1747 }
1748 # endif
1749
1750 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1751 about the unexpected token YYTOKEN for the state stack whose top is
1752 YYSSP.
1753
1754 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1755 not large enough to hold the message. In that case, also set
1756 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1757 required number of bytes is too large to store. */
1758 static int
yysyntax_error(YYPTRDIFF_T * yymsg_alloc,char ** yymsg,yy_state_t * yyssp,int yytoken)1759 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1760 yy_state_t *yyssp, int yytoken)
1761 {
1762 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1763 /* Internationalized format string. */
1764 const char *yyformat = YY_NULLPTRPTR;
1765 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1766 one per "expected"). */
1767 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1768 /* Actual size of YYARG. */
1769 int yycount = 0;
1770 /* Cumulated lengths of YYARG. */
1771 YYPTRDIFF_T yysize = 0;
1772
1773 /* There are many possibilities here to consider:
1774 - If this state is a consistent state with a default action, then
1775 the only way this function was invoked is if the default action
1776 is an error action. In that case, don't check for expected
1777 tokens because there are none.
1778 - The only way there can be no lookahead present (in yychar) is if
1779 this state is a consistent state with a default action. Thus,
1780 detecting the absence of a lookahead is sufficient to determine
1781 that there is no unexpected or expected token to report. In that
1782 case, just report a simple "syntax error".
1783 - Don't assume there isn't a lookahead just because this state is a
1784 consistent state with a default action. There might have been a
1785 previous inconsistent state, consistent state with a non-default
1786 action, or user semantic action that manipulated yychar.
1787 - Of course, the expected token list depends on states to have
1788 correct lookahead information, and it depends on the parser not
1789 to perform extra reductions after fetching a lookahead from the
1790 scanner and before detecting a syntax error. Thus, state merging
1791 (from LALR or IELR) and default reductions corrupt the expected
1792 token list. However, the list is correct for canonical LR with
1793 one exception: it will still contain any token that will not be
1794 accepted due to an error action in a later state.
1795 */
1796 if (yytoken != YYEMPTY)
1797 {
1798 int yyn = yypact[+*yyssp];
1799 YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTRPTR, yytname[yytoken]);
1800 yysize = yysize0;
1801 yyarg[yycount++] = yytname[yytoken];
1802 if (!yypact_value_is_default (yyn))
1803 {
1804 /* Start YYX at -YYN if negative to avoid negative indexes in
1805 YYCHECK. In other words, skip the first -YYN actions for
1806 this state because they are default actions. */
1807 int yyxbegin = yyn < 0 ? -yyn : 0;
1808 /* Stay within bounds of both yycheck and yytname. */
1809 int yychecklim = YYLAST - yyn + 1;
1810 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1811 int yyx;
1812
1813 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1814 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1815 && !yytable_value_is_error (yytable[yyx + yyn]))
1816 {
1817 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1818 {
1819 yycount = 1;
1820 yysize = yysize0;
1821 break;
1822 }
1823 yyarg[yycount++] = yytname[yyx];
1824 {
1825 YYPTRDIFF_T yysize1
1826 = yysize + yytnamerr (YY_NULLPTRPTR, yytname[yyx]);
1827 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1828 yysize = yysize1;
1829 else
1830 return 2;
1831 }
1832 }
1833 }
1834 }
1835
1836 switch (yycount)
1837 {
1838 # define YYCASE_(N, S) \
1839 case N: \
1840 yyformat = S; \
1841 break
1842 default: /* Avoid compiler warnings. */
1843 YYCASE_(0, YY_("syntax error"));
1844 YYCASE_(1, YY_("syntax error, unexpected %s"));
1845 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1846 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1847 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1848 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1849 # undef YYCASE_
1850 }
1851
1852 {
1853 /* Don't count the "%s"s in the final size, but reserve room for
1854 the terminator. */
1855 YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
1856 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1857 yysize = yysize1;
1858 else
1859 return 2;
1860 }
1861
1862 if (*yymsg_alloc < yysize)
1863 {
1864 *yymsg_alloc = 2 * yysize;
1865 if (! (yysize <= *yymsg_alloc
1866 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1867 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1868 return 1;
1869 }
1870
1871 /* Avoid sprintf, as that infringes on the user's name space.
1872 Don't have undefined behavior even if the translation
1873 produced a string with the wrong number of "%s"s. */
1874 {
1875 char *yyp = *yymsg;
1876 int yyi = 0;
1877 while ((*yyp = *yyformat) != '\0')
1878 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1879 {
1880 yyp += yytnamerr (yyp, yyarg[yyi++]);
1881 yyformat += 2;
1882 }
1883 else
1884 {
1885 ++yyp;
1886 ++yyformat;
1887 }
1888 }
1889 return 0;
1890 }
1891 #endif /* YYERROR_VERBOSE */
1892
1893 /*-----------------------------------------------.
1894 | Release the memory associated to this symbol. |
1895 `-----------------------------------------------*/
1896
1897 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1898 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1899 {
1900 YYUSE (yyvaluep);
1901 if (!yymsg)
1902 yymsg = "Deleting";
1903 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1904
1905 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1906 YYUSE (yytype);
1907 YY_IGNORE_MAYBE_UNINITIALIZED_END
1908 }
1909
1910
1911
1912
1913 /* The lookahead symbol. */
1914 int yychar;
1915
1916 /* The semantic value of the lookahead symbol. */
1917 YYSTYPE yylval;
1918 /* Number of syntax errors so far. */
1919 int yynerrs;
1920
1921
1922 /*----------.
1923 | yyparse. |
1924 `----------*/
1925
1926 int
yyparse(void)1927 yyparse (void)
1928 {
1929 yy_state_fast_t yystate;
1930 /* Number of tokens to shift before error messages enabled. */
1931 int yyerrstatus;
1932
1933 /* The stacks and their tools:
1934 'yyss': related to states.
1935 'yyvs': related to semantic values.
1936
1937 Refer to the stacks through separate pointers, to allow yyoverflow
1938 to xreallocate them elsewhere. */
1939
1940 /* The state stack. */
1941 yy_state_t yyssa[YYINITDEPTH];
1942 yy_state_t *yyss;
1943 yy_state_t *yyssp;
1944
1945 /* The semantic value stack. */
1946 YYSTYPE yyvsa[YYINITDEPTH];
1947 YYSTYPE *yyvs;
1948 YYSTYPE *yyvsp;
1949
1950 YYPTRDIFF_T yystacksize;
1951
1952 int yyn;
1953 int yyresult;
1954 /* Lookahead token as an internal (translated) token number. */
1955 int yytoken = 0;
1956 /* The variables used to return semantic value and location from the
1957 action routines. */
1958 YYSTYPE yyval;
1959
1960 #if YYERROR_VERBOSE
1961 /* Buffer for error messages, and its allocated size. */
1962 char yymsgbuf[128];
1963 char *yymsg = yymsgbuf;
1964 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1965 #endif
1966
1967 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1968
1969 /* The number of symbols on the RHS of the reduced rule.
1970 Keep to zero when no symbol should be popped. */
1971 int yylen = 0;
1972
1973 yyssp = yyss = yyssa;
1974 yyvsp = yyvs = yyvsa;
1975 yystacksize = YYINITDEPTH;
1976
1977 YYDPRINTF ((stderr, "Starting parse\n"));
1978
1979 yystate = 0;
1980 yyerrstatus = 0;
1981 yynerrs = 0;
1982 yychar = YYEMPTY; /* Cause a token to be read. */
1983 goto yysetstate;
1984
1985
1986 /*------------------------------------------------------------.
1987 | yynewstate -- push a new state, which is found in yystate. |
1988 `------------------------------------------------------------*/
1989 yynewstate:
1990 /* In all cases, when you get here, the value and location stacks
1991 have just been pushed. So pushing a state here evens the stacks. */
1992 yyssp++;
1993
1994
1995 /*--------------------------------------------------------------------.
1996 | yysetstate -- set current state (the top of the stack) to yystate. |
1997 `--------------------------------------------------------------------*/
1998 yysetstate:
1999 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2000 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
2001 YY_IGNORE_USELESS_CAST_BEGIN
2002 *yyssp = YY_CAST (yy_state_t, yystate);
2003 YY_IGNORE_USELESS_CAST_END
2004
2005 if (yyss + yystacksize - 1 <= yyssp)
2006 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
2007 goto yyexhaustedlab;
2008 #else
2009 {
2010 /* Get the current used size of the three stacks, in elements. */
2011 YYPTRDIFF_T yysize = yyssp - yyss + 1;
2012
2013 # if defined yyoverflow
2014 {
2015 /* Give user a chance to xreallocate the stack. Use copies of
2016 these so that the &'s don't force the real ones into
2017 memory. */
2018 yy_state_t *yyss1 = yyss;
2019 YYSTYPE *yyvs1 = yyvs;
2020
2021 /* Each stack pointer address is followed by the size of the
2022 data in use in that stack, in bytes. This used to be a
2023 conditional around just the two extra args, but that might
2024 be undefined if yyoverflow is a macro. */
2025 yyoverflow (YY_("memory exhausted"),
2026 &yyss1, yysize * YYSIZEOF (*yyssp),
2027 &yyvs1, yysize * YYSIZEOF (*yyvsp),
2028 &yystacksize);
2029 yyss = yyss1;
2030 yyvs = yyvs1;
2031 }
2032 # else /* defined YYSTACK_RELOCATE */
2033 /* Extend the stack our own way. */
2034 if (YYMAXDEPTH <= yystacksize)
2035 goto yyexhaustedlab;
2036 yystacksize *= 2;
2037 if (YYMAXDEPTH < yystacksize)
2038 yystacksize = YYMAXDEPTH;
2039
2040 {
2041 yy_state_t *yyss1 = yyss;
2042 union yyalloc *yyptr =
2043 YY_CAST (union yyalloc *,
2044 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
2045 if (! yyptr)
2046 goto yyexhaustedlab;
2047 YYSTACK_RELOCATE (yyss_alloc, yyss);
2048 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
2049 # undef YYSTACK_RELOCATE
2050 if (yyss1 != yyssa)
2051 YYSTACK_FREE (yyss1);
2052 }
2053 # endif
2054
2055 yyssp = yyss + yysize - 1;
2056 yyvsp = yyvs + yysize - 1;
2057
2058 YY_IGNORE_USELESS_CAST_BEGIN
2059 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
2060 YY_CAST (long, yystacksize)));
2061 YY_IGNORE_USELESS_CAST_END
2062
2063 if (yyss + yystacksize - 1 <= yyssp)
2064 YYABORT;
2065 }
2066 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
2067
2068 if (yystate == YYFINAL)
2069 YYACCEPT;
2070
2071 goto yybackup;
2072
2073
2074 /*-----------.
2075 | yybackup. |
2076 `-----------*/
2077 yybackup:
2078 /* Do appropriate processing given the current state. Read a
2079 lookahead token if we need one and don't already have one. */
2080
2081 /* First try to decide what to do without reference to lookahead token. */
2082 yyn = yypact[yystate];
2083 if (yypact_value_is_default (yyn))
2084 goto yydefault;
2085
2086 /* Not known => get a lookahead token if don't already have one. */
2087
2088 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
2089 if (yychar == YYEMPTY)
2090 {
2091 YYDPRINTF ((stderr, "Reading a token: "));
2092 yychar = yylex ();
2093 }
2094
2095 if (yychar <= YYEOF)
2096 {
2097 yychar = yytoken = YYEOF;
2098 YYDPRINTF ((stderr, "Now at end of input.\n"));
2099 }
2100 else
2101 {
2102 yytoken = YYTRANSLATE (yychar);
2103 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2104 }
2105
2106 /* If the proper action on seeing token YYTOKEN is to reduce or to
2107 detect an error, take that action. */
2108 yyn += yytoken;
2109 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2110 goto yydefault;
2111 yyn = yytable[yyn];
2112 if (yyn <= 0)
2113 {
2114 if (yytable_value_is_error (yyn))
2115 goto yyerrlab;
2116 yyn = -yyn;
2117 goto yyreduce;
2118 }
2119
2120 /* Count tokens shifted since error; after three, turn off error
2121 status. */
2122 if (yyerrstatus)
2123 yyerrstatus--;
2124
2125 /* Shift the lookahead token. */
2126 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2127 yystate = yyn;
2128 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2129 *++yyvsp = yylval;
2130 YY_IGNORE_MAYBE_UNINITIALIZED_END
2131
2132 /* Discard the shifted token. */
2133 yychar = YYEMPTY;
2134 goto yynewstate;
2135
2136
2137 /*-----------------------------------------------------------.
2138 | yydefault -- do the default action for the current state. |
2139 `-----------------------------------------------------------*/
2140 yydefault:
2141 yyn = yydefact[yystate];
2142 if (yyn == 0)
2143 goto yyerrlab;
2144 goto yyreduce;
2145
2146
2147 /*-----------------------------.
2148 | yyreduce -- do a reduction. |
2149 `-----------------------------*/
2150 yyreduce:
2151 /* yyn is the number of a rule to reduce with. */
2152 yylen = yyr2[yyn];
2153
2154 /* If YYLEN is nonzero, implement the default value of the action:
2155 '$$ = $1'.
2156
2157 Otherwise, the following line sets YYVAL to garbage.
2158 This behavior is undocumented and Bison
2159 users should not rely upon it. Assigning to YYVAL
2160 unconditionally makes the parser a bit smaller, and it avoids a
2161 GCC warning that YYVAL may be used uninitialized. */
2162 yyval = yyvsp[1-yylen];
2163
2164
2165 YY_REDUCE_PRINT (yyn);
2166 switch (yyn)
2167 {
2168 case 4:
2169 #line 285 "c-exp.y"
2170 {
2171 pstate->push_new<type_operation> ((yyvsp[0].tval));
2172 }
2173 #line 2175 "c-exp.c.tmp"
2174 break;
2175
2176 case 5:
2177 #line 289 "c-exp.y"
2178 {
2179 pstate->wrap<typeof_operation> ();
2180 }
2181 #line 2183 "c-exp.c.tmp"
2182 break;
2183
2184 case 6:
2185 #line 293 "c-exp.y"
2186 {
2187 pstate->push_new<type_operation> ((yyvsp[-1].tval));
2188 }
2189 #line 2191 "c-exp.c.tmp"
2190 break;
2191
2192 case 7:
2193 #line 297 "c-exp.y"
2194 {
2195 pstate->wrap<decltype_operation> ();
2196 }
2197 #line 2199 "c-exp.c.tmp"
2198 break;
2199
2200 case 9:
2201 #line 305 "c-exp.y"
2202 { pstate->wrap2<comma_operation> (); }
2203 #line 2205 "c-exp.c.tmp"
2204 break;
2205
2206 case 10:
2207 #line 310 "c-exp.y"
2208 { pstate->wrap<unop_ind_operation> (); }
2209 #line 2211 "c-exp.c.tmp"
2210 break;
2211
2212 case 11:
2213 #line 314 "c-exp.y"
2214 { pstate->wrap<unop_addr_operation> (); }
2215 #line 2217 "c-exp.c.tmp"
2216 break;
2217
2218 case 12:
2219 #line 318 "c-exp.y"
2220 { pstate->wrap<unary_neg_operation> (); }
2221 #line 2223 "c-exp.c.tmp"
2222 break;
2223
2224 case 13:
2225 #line 322 "c-exp.y"
2226 { pstate->wrap<unary_plus_operation> (); }
2227 #line 2229 "c-exp.c.tmp"
2228 break;
2229
2230 case 14:
2231 #line 326 "c-exp.y"
2232 {
2233 if (pstate->language ()->la_language
2234 == language_opencl)
2235 pstate->wrap<opencl_not_operation> ();
2236 else
2237 pstate->wrap<unary_logical_not_operation> ();
2238 }
2239 #line 2241 "c-exp.c.tmp"
2240 break;
2241
2242 case 15:
2243 #line 336 "c-exp.y"
2244 { pstate->wrap<unary_complement_operation> (); }
2245 #line 2247 "c-exp.c.tmp"
2246 break;
2247
2248 case 16:
2249 #line 340 "c-exp.y"
2250 { pstate->wrap<preinc_operation> (); }
2251 #line 2253 "c-exp.c.tmp"
2252 break;
2253
2254 case 17:
2255 #line 344 "c-exp.y"
2256 { pstate->wrap<predec_operation> (); }
2257 #line 2259 "c-exp.c.tmp"
2258 break;
2259
2260 case 18:
2261 #line 348 "c-exp.y"
2262 { pstate->wrap<postinc_operation> (); }
2263 #line 2265 "c-exp.c.tmp"
2264 break;
2265
2266 case 19:
2267 #line 352 "c-exp.y"
2268 { pstate->wrap<postdec_operation> (); }
2269 #line 2271 "c-exp.c.tmp"
2270 break;
2271
2272 case 20:
2273 #line 356 "c-exp.y"
2274 { pstate->wrap<typeid_operation> (); }
2275 #line 2277 "c-exp.c.tmp"
2276 break;
2277
2278 case 21:
2279 #line 360 "c-exp.y"
2280 { pstate->wrap<typeid_operation> (); }
2281 #line 2283 "c-exp.c.tmp"
2282 break;
2283
2284 case 22:
2285 #line 364 "c-exp.y"
2286 { pstate->wrap<unop_sizeof_operation> (); }
2287 #line 2289 "c-exp.c.tmp"
2288 break;
2289
2290 case 23:
2291 #line 368 "c-exp.y"
2292 { pstate->wrap<unop_alignof_operation> (); }
2293 #line 2295 "c-exp.c.tmp"
2294 break;
2295
2296 case 24:
2297 #line 372 "c-exp.y"
2298 {
2299 pstate->push_new<structop_ptr_operation>
2300 (pstate->pop (), copy_name ((yyvsp[0].sval)));
2301 }
2302 #line 2304 "c-exp.c.tmp"
2303 break;
2304
2305 case 25:
2306 #line 379 "c-exp.y"
2307 {
2308 structop_base_operation *op
2309 = new structop_ptr_operation (pstate->pop (),
2310 copy_name ((yyvsp[-1].sval)));
2311 pstate->mark_struct_expression (op);
2312 pstate->push (operation_up (op));
2313 }
2314 #line 2316 "c-exp.c.tmp"
2315 break;
2316
2317 case 26:
2318 #line 389 "c-exp.y"
2319 {
2320 structop_base_operation *op
2321 = new structop_ptr_operation (pstate->pop (), "");
2322 pstate->mark_struct_expression (op);
2323 pstate->push (operation_up (op));
2324 }
2325 #line 2327 "c-exp.c.tmp"
2326 break;
2327
2328 case 27:
2329 #line 398 "c-exp.y"
2330 {
2331 pstate->push_new<structop_ptr_operation>
2332 (pstate->pop (), "~" + copy_name ((yyvsp[0].sval)));
2333 }
2334 #line 2336 "c-exp.c.tmp"
2335 break;
2336
2337 case 28:
2338 #line 405 "c-exp.y"
2339 {
2340 structop_base_operation *op
2341 = new structop_ptr_operation (pstate->pop (),
2342 "~" + copy_name ((yyvsp[-1].sval)));
2343 pstate->mark_struct_expression (op);
2344 pstate->push (operation_up (op));
2345 }
2346 #line 2348 "c-exp.c.tmp"
2347 break;
2348
2349 case 29:
2350 #line 415 "c-exp.y"
2351 { /* exp->type::name becomes exp->*(&type::name) */
2352 /* Note: this doesn't work if name is a
2353 static member! FIXME */
2354 pstate->wrap<unop_addr_operation> ();
2355 pstate->wrap2<structop_mptr_operation> (); }
2356 #line 2358 "c-exp.c.tmp"
2357 break;
2358
2359 case 30:
2360 #line 423 "c-exp.y"
2361 { pstate->wrap2<structop_mptr_operation> (); }
2362 #line 2364 "c-exp.c.tmp"
2363 break;
2364
2365 case 31:
2366 #line 427 "c-exp.y"
2367 {
2368 if (pstate->language ()->la_language
2369 == language_opencl)
2370 pstate->push_new<opencl_structop_operation>
2371 (pstate->pop (), copy_name ((yyvsp[0].sval)));
2372 else
2373 pstate->push_new<structop_operation>
2374 (pstate->pop (), copy_name ((yyvsp[0].sval)));
2375 }
2376 #line 2378 "c-exp.c.tmp"
2377 break;
2378
2379 case 32:
2380 #line 439 "c-exp.y"
2381 {
2382 structop_base_operation *op
2383 = new structop_operation (pstate->pop (),
2384 copy_name ((yyvsp[-1].sval)));
2385 pstate->mark_struct_expression (op);
2386 pstate->push (operation_up (op));
2387 }
2388 #line 2390 "c-exp.c.tmp"
2389 break;
2390
2391 case 33:
2392 #line 449 "c-exp.y"
2393 {
2394 structop_base_operation *op
2395 = new structop_operation (pstate->pop (), "");
2396 pstate->mark_struct_expression (op);
2397 pstate->push (operation_up (op));
2398 }
2399 #line 2401 "c-exp.c.tmp"
2400 break;
2401
2402 case 34:
2403 #line 458 "c-exp.y"
2404 {
2405 pstate->push_new<structop_operation>
2406 (pstate->pop (), "~" + copy_name ((yyvsp[0].sval)));
2407 }
2408 #line 2410 "c-exp.c.tmp"
2409 break;
2410
2411 case 35:
2412 #line 465 "c-exp.y"
2413 {
2414 structop_base_operation *op
2415 = new structop_operation (pstate->pop (),
2416 "~" + copy_name ((yyvsp[-1].sval)));
2417 pstate->mark_struct_expression (op);
2418 pstate->push (operation_up (op));
2419 }
2420 #line 2422 "c-exp.c.tmp"
2421 break;
2422
2423 case 36:
2424 #line 475 "c-exp.y"
2425 { /* exp.type::name becomes exp.*(&type::name) */
2426 /* Note: this doesn't work if name is a
2427 static member! FIXME */
2428 pstate->wrap<unop_addr_operation> ();
2429 pstate->wrap2<structop_member_operation> (); }
2430 #line 2432 "c-exp.c.tmp"
2431 break;
2432
2433 case 37:
2434 #line 483 "c-exp.y"
2435 { pstate->wrap2<structop_member_operation> (); }
2436 #line 2438 "c-exp.c.tmp"
2437 break;
2438
2439 case 38:
2440 #line 487 "c-exp.y"
2441 { pstate->wrap2<subscript_operation> (); }
2442 #line 2444 "c-exp.c.tmp"
2443 break;
2444
2445 case 39:
2446 #line 491 "c-exp.y"
2447 { pstate->wrap2<subscript_operation> (); }
2448 #line 2450 "c-exp.c.tmp"
2449 break;
2450
2451 case 40:
2452 #line 500 "c-exp.y"
2453 {
2454 CORE_ADDR theclass;
2455
2456 std::string copy = copy_name ((yyvsp[0].tsym).stoken);
2457 theclass = lookup_objc_class (pstate->gdbarch (),
2458 copy.c_str ());
2459 if (theclass == 0)
2460 error (_("%s is not an ObjC Class"),
2461 copy.c_str ());
2462 pstate->push_new<long_const_operation>
2463 (parse_type (pstate)->builtin_int,
2464 (LONGEST) theclass);
2465 start_msglist();
2466 }
2467 #line 2469 "c-exp.c.tmp"
2468 break;
2469
2470 case 41:
2471 #line 515 "c-exp.y"
2472 { end_msglist (pstate); }
2473 #line 2475 "c-exp.c.tmp"
2474 break;
2475
2476 case 42:
2477 #line 519 "c-exp.y"
2478 {
2479 pstate->push_new<long_const_operation>
2480 (parse_type (pstate)->builtin_int,
2481 (LONGEST) (yyvsp[0].theclass).theclass);
2482 start_msglist();
2483 }
2484 #line 2486 "c-exp.c.tmp"
2485 break;
2486
2487 case 43:
2488 #line 526 "c-exp.y"
2489 { end_msglist (pstate); }
2490 #line 2492 "c-exp.c.tmp"
2491 break;
2492
2493 case 44:
2494 #line 530 "c-exp.y"
2495 { start_msglist(); }
2496 #line 2498 "c-exp.c.tmp"
2497 break;
2498
2499 case 45:
2500 #line 532 "c-exp.y"
2501 { end_msglist (pstate); }
2502 #line 2504 "c-exp.c.tmp"
2503 break;
2504
2505 case 46:
2506 #line 536 "c-exp.y"
2507 { add_msglist(&(yyvsp[0].sval), 0); }
2508 #line 2510 "c-exp.c.tmp"
2509 break;
2510
2511 case 50:
2512 #line 545 "c-exp.y"
2513 { add_msglist(&(yyvsp[-2].sval), 1); }
2514 #line 2516 "c-exp.c.tmp"
2515 break;
2516
2517 case 51:
2518 #line 547 "c-exp.y"
2519 { add_msglist(0, 1); }
2520 #line 2522 "c-exp.c.tmp"
2521 break;
2522
2523 case 52:
2524 #line 549 "c-exp.y"
2525 { add_msglist(0, 0); }
2526 #line 2528 "c-exp.c.tmp"
2527 break;
2528
2529 case 53:
2530 #line 555 "c-exp.y"
2531 { pstate->start_arglist (); }
2532 #line 2534 "c-exp.c.tmp"
2533 break;
2534
2535 case 54:
2536 #line 557 "c-exp.y"
2537 {
2538 std::vector<operation_up> args
2539 = pstate->pop_vector (pstate->end_arglist ());
2540 pstate->push_new<funcall_operation>
2541 (pstate->pop (), std::move (args));
2542 }
2543 #line 2545 "c-exp.c.tmp"
2544 break;
2545
2546 case 55:
2547 #line 569 "c-exp.y"
2548 {
2549 pstate->push_new<funcall_operation>
2550 (pstate->pop (), std::vector<operation_up> ());
2551 }
2552 #line 2554 "c-exp.c.tmp"
2553 break;
2554
2555 case 56:
2556 #line 577 "c-exp.y"
2557 {
2558 /* This could potentially be a an argument defined
2559 lookup function (Koenig). */
2560 /* This is to save the value of arglist_len
2561 being accumulated by an outer function call. */
2562 pstate->start_arglist ();
2563 }
2564 #line 2566 "c-exp.c.tmp"
2565 break;
2566
2567 case 57:
2568 #line 585 "c-exp.y"
2569 {
2570 std::vector<operation_up> args
2571 = pstate->pop_vector (pstate->end_arglist ());
2572 pstate->push_new<adl_func_operation>
2573 (copy_name ((yyvsp[-4].ssym).stoken),
2574 pstate->expression_context_block,
2575 std::move (args));
2576 }
2577 #line 2579 "c-exp.c.tmp"
2578 break;
2579
2580 case 58:
2581 #line 596 "c-exp.y"
2582 { pstate->start_arglist (); }
2583 #line 2585 "c-exp.c.tmp"
2584 break;
2585
2586 case 60:
2587 #line 603 "c-exp.y"
2588 { pstate->arglist_len = 1; }
2589 #line 2591 "c-exp.c.tmp"
2590 break;
2591
2592 case 61:
2593 #line 607 "c-exp.y"
2594 { pstate->arglist_len++; }
2595 #line 2597 "c-exp.c.tmp"
2596 break;
2597
2598 case 62:
2599 #line 611 "c-exp.y"
2600 {
2601 std::vector<struct type *> *type_list = (yyvsp[-2].tvec);
2602 /* Save the const/volatile qualifiers as
2603 recorded by the const_or_volatile
2604 production's actions. */
2605 type_instance_flags flags
2606 = (cpstate->type_stack
2607 .follow_type_instance_flags ());
2608 pstate->push_new<type_instance_operation>
2609 (flags, std::move (*type_list),
2610 pstate->pop ());
2611 }
2612 #line 2614 "c-exp.c.tmp"
2613 break;
2614
2615 case 63:
2616 #line 626 "c-exp.y"
2617 {
2618 type_instance_flags flags
2619 = (cpstate->type_stack
2620 .follow_type_instance_flags ());
2621 pstate->push_new<type_instance_operation>
2622 (flags, std::vector<type *> (), pstate->pop ());
2623 }
2624 #line 2626 "c-exp.c.tmp"
2625 break;
2626
2627 case 67:
2628 #line 647 "c-exp.y"
2629 {
2630 pstate->push_new<func_static_var_operation>
2631 (pstate->pop (), copy_name ((yyvsp[0].sval)));
2632 }
2633 #line 2635 "c-exp.c.tmp"
2634 break;
2635
2636 case 68:
2637 #line 654 "c-exp.y"
2638 { (yyval.lval) = pstate->end_arglist () - 1; }
2639 #line 2641 "c-exp.c.tmp"
2640 break;
2641
2642 case 69:
2643 #line 657 "c-exp.y"
2644 {
2645 std::vector<operation_up> args
2646 = pstate->pop_vector ((yyvsp[0].lval) + 1);
2647 pstate->push_new<array_operation> (0, (yyvsp[0].lval),
2648 std::move (args));
2649 }
2650 #line 2652 "c-exp.c.tmp"
2651 break;
2652
2653 case 70:
2654 #line 666 "c-exp.y"
2655 { pstate->wrap2<unop_memval_type_operation> (); }
2656 #line 2658 "c-exp.c.tmp"
2657 break;
2658
2659 case 71:
2660 #line 670 "c-exp.y"
2661 {
2662 if (pstate->language ()->la_language
2663 == language_opencl)
2664 pstate->wrap2<opencl_cast_type_operation> ();
2665 else
2666 pstate->wrap2<unop_cast_type_operation> ();
2667 }
2668 #line 2670 "c-exp.c.tmp"
2669 break;
2670
2671 case 72:
2672 #line 680 "c-exp.y"
2673 { }
2674 #line 2676 "c-exp.c.tmp"
2675 break;
2676
2677 case 73:
2678 #line 686 "c-exp.y"
2679 { pstate->wrap2<repeat_operation> (); }
2680 #line 2682 "c-exp.c.tmp"
2681 break;
2682
2683 case 74:
2684 #line 690 "c-exp.y"
2685 { pstate->wrap2<mul_operation> (); }
2686 #line 2688 "c-exp.c.tmp"
2687 break;
2688
2689 case 75:
2690 #line 694 "c-exp.y"
2691 { pstate->wrap2<div_operation> (); }
2692 #line 2694 "c-exp.c.tmp"
2693 break;
2694
2695 case 76:
2696 #line 698 "c-exp.y"
2697 { pstate->wrap2<rem_operation> (); }
2698 #line 2700 "c-exp.c.tmp"
2699 break;
2700
2701 case 77:
2702 #line 702 "c-exp.y"
2703 { pstate->wrap2<add_operation> (); }
2704 #line 2706 "c-exp.c.tmp"
2705 break;
2706
2707 case 78:
2708 #line 706 "c-exp.y"
2709 { pstate->wrap2<sub_operation> (); }
2710 #line 2712 "c-exp.c.tmp"
2711 break;
2712
2713 case 79:
2714 #line 710 "c-exp.y"
2715 { pstate->wrap2<lsh_operation> (); }
2716 #line 2718 "c-exp.c.tmp"
2717 break;
2718
2719 case 80:
2720 #line 714 "c-exp.y"
2721 { pstate->wrap2<rsh_operation> (); }
2722 #line 2724 "c-exp.c.tmp"
2723 break;
2724
2725 case 81:
2726 #line 718 "c-exp.y"
2727 {
2728 if (pstate->language ()->la_language
2729 == language_opencl)
2730 pstate->wrap2<opencl_equal_operation> ();
2731 else
2732 pstate->wrap2<equal_operation> ();
2733 }
2734 #line 2736 "c-exp.c.tmp"
2735 break;
2736
2737 case 82:
2738 #line 728 "c-exp.y"
2739 {
2740 if (pstate->language ()->la_language
2741 == language_opencl)
2742 pstate->wrap2<opencl_notequal_operation> ();
2743 else
2744 pstate->wrap2<notequal_operation> ();
2745 }
2746 #line 2748 "c-exp.c.tmp"
2747 break;
2748
2749 case 83:
2750 #line 738 "c-exp.y"
2751 {
2752 if (pstate->language ()->la_language
2753 == language_opencl)
2754 pstate->wrap2<opencl_leq_operation> ();
2755 else
2756 pstate->wrap2<leq_operation> ();
2757 }
2758 #line 2760 "c-exp.c.tmp"
2759 break;
2760
2761 case 84:
2762 #line 748 "c-exp.y"
2763 {
2764 if (pstate->language ()->la_language
2765 == language_opencl)
2766 pstate->wrap2<opencl_geq_operation> ();
2767 else
2768 pstate->wrap2<geq_operation> ();
2769 }
2770 #line 2772 "c-exp.c.tmp"
2771 break;
2772
2773 case 85:
2774 #line 758 "c-exp.y"
2775 {
2776 if (pstate->language ()->la_language
2777 == language_opencl)
2778 pstate->wrap2<opencl_less_operation> ();
2779 else
2780 pstate->wrap2<less_operation> ();
2781 }
2782 #line 2784 "c-exp.c.tmp"
2783 break;
2784
2785 case 86:
2786 #line 768 "c-exp.y"
2787 {
2788 if (pstate->language ()->la_language
2789 == language_opencl)
2790 pstate->wrap2<opencl_gtr_operation> ();
2791 else
2792 pstate->wrap2<gtr_operation> ();
2793 }
2794 #line 2796 "c-exp.c.tmp"
2795 break;
2796
2797 case 87:
2798 #line 778 "c-exp.y"
2799 { pstate->wrap2<bitwise_and_operation> (); }
2800 #line 2802 "c-exp.c.tmp"
2801 break;
2802
2803 case 88:
2804 #line 782 "c-exp.y"
2805 { pstate->wrap2<bitwise_xor_operation> (); }
2806 #line 2808 "c-exp.c.tmp"
2807 break;
2808
2809 case 89:
2810 #line 786 "c-exp.y"
2811 { pstate->wrap2<bitwise_ior_operation> (); }
2812 #line 2814 "c-exp.c.tmp"
2813 break;
2814
2815 case 90:
2816 #line 790 "c-exp.y"
2817 {
2818 if (pstate->language ()->la_language
2819 == language_opencl)
2820 {
2821 operation_up rhs = pstate->pop ();
2822 operation_up lhs = pstate->pop ();
2823 pstate->push_new<opencl_logical_binop_operation>
2824 (BINOP_LOGICAL_AND, std::move (lhs),
2825 std::move (rhs));
2826 }
2827 else
2828 pstate->wrap2<logical_and_operation> ();
2829 }
2830 #line 2832 "c-exp.c.tmp"
2831 break;
2832
2833 case 91:
2834 #line 806 "c-exp.y"
2835 {
2836 if (pstate->language ()->la_language
2837 == language_opencl)
2838 {
2839 operation_up rhs = pstate->pop ();
2840 operation_up lhs = pstate->pop ();
2841 pstate->push_new<opencl_logical_binop_operation>
2842 (BINOP_LOGICAL_OR, std::move (lhs),
2843 std::move (rhs));
2844 }
2845 else
2846 pstate->wrap2<logical_or_operation> ();
2847 }
2848 #line 2850 "c-exp.c.tmp"
2849 break;
2850
2851 case 92:
2852 #line 822 "c-exp.y"
2853 {
2854 operation_up last = pstate->pop ();
2855 operation_up mid = pstate->pop ();
2856 operation_up first = pstate->pop ();
2857 if (pstate->language ()->la_language
2858 == language_opencl)
2859 pstate->push_new<opencl_ternop_cond_operation>
2860 (std::move (first), std::move (mid),
2861 std::move (last));
2862 else
2863 pstate->push_new<ternop_cond_operation>
2864 (std::move (first), std::move (mid),
2865 std::move (last));
2866 }
2867 #line 2869 "c-exp.c.tmp"
2868 break;
2869
2870 case 93:
2871 #line 839 "c-exp.y"
2872 {
2873 if (pstate->language ()->la_language
2874 == language_opencl)
2875 pstate->wrap2<opencl_assign_operation> ();
2876 else
2877 pstate->wrap2<assign_operation> ();
2878 }
2879 #line 2881 "c-exp.c.tmp"
2880 break;
2881
2882 case 94:
2883 #line 849 "c-exp.y"
2884 {
2885 operation_up rhs = pstate->pop ();
2886 operation_up lhs = pstate->pop ();
2887 pstate->push_new<assign_modify_operation>
2888 ((yyvsp[-1].opcode), std::move (lhs), std::move (rhs));
2889 }
2890 #line 2892 "c-exp.c.tmp"
2891 break;
2892
2893 case 95:
2894 #line 858 "c-exp.y"
2895 {
2896 pstate->push_new<long_const_operation>
2897 ((yyvsp[0].typed_val_int).type, (yyvsp[0].typed_val_int).val);
2898 }
2899 #line 2901 "c-exp.c.tmp"
2900 break;
2901
2902 case 96:
2903 #line 865 "c-exp.y"
2904 {
2905 operation_up real
2906 = (make_operation<long_const_operation>
2907 (TYPE_TARGET_TYPE ((yyvsp[0].typed_val_int).type), 0));
2908 operation_up imag
2909 = (make_operation<long_const_operation>
2910 (TYPE_TARGET_TYPE ((yyvsp[0].typed_val_int).type), (yyvsp[0].typed_val_int).val));
2911 pstate->push_new<complex_operation>
2912 (std::move (real), std::move (imag), (yyvsp[0].typed_val_int).type);
2913 }
2914 #line 2916 "c-exp.c.tmp"
2915 break;
2916
2917 case 97:
2918 #line 878 "c-exp.y"
2919 {
2920 struct stoken_vector vec;
2921 vec.len = 1;
2922 vec.tokens = &(yyvsp[0].tsval);
2923 pstate->push_c_string ((yyvsp[0].tsval).type, &vec);
2924 }
2925 #line 2927 "c-exp.c.tmp"
2926 break;
2927
2928 case 98:
2929 #line 887 "c-exp.y"
2930 { YYSTYPE val;
2931 parse_number (pstate, (yyvsp[0].ssym).stoken.ptr,
2932 (yyvsp[0].ssym).stoken.length, 0, &val);
2933 pstate->push_new<long_const_operation>
2934 (val.typed_val_int.type,
2935 val.typed_val_int.val);
2936 }
2937 #line 2939 "c-exp.c.tmp"
2938 break;
2939
2940 case 99:
2941 #line 898 "c-exp.y"
2942 {
2943 float_data data;
2944 std::copy (std::begin ((yyvsp[0].typed_val_float).val), std::end ((yyvsp[0].typed_val_float).val),
2945 std::begin (data));
2946 pstate->push_new<float_const_operation> ((yyvsp[0].typed_val_float).type, data);
2947 }
2948 #line 2950 "c-exp.c.tmp"
2949 break;
2950
2951 case 100:
2952 #line 907 "c-exp.y"
2953 {
2954 struct type *underlying
2955 = TYPE_TARGET_TYPE ((yyvsp[0].typed_val_float).type);
2956
2957 float_data val;
2958 target_float_from_host_double (val.data (),
2959 underlying, 0);
2960 operation_up real
2961 = (make_operation<float_const_operation>
2962 (underlying, val));
2963
2964 std::copy (std::begin ((yyvsp[0].typed_val_float).val), std::end ((yyvsp[0].typed_val_float).val),
2965 std::begin (val));
2966 operation_up imag
2967 = (make_operation<float_const_operation>
2968 (underlying, val));
2969
2970 pstate->push_new<complex_operation>
2971 (std::move (real), std::move (imag),
2972 (yyvsp[0].typed_val_float).type);
2973 }
2974 #line 2976 "c-exp.c.tmp"
2975 break;
2976
2977 case 102:
2978 #line 934 "c-exp.y"
2979 {
2980 pstate->push_dollar ((yyvsp[0].sval));
2981 }
2982 #line 2984 "c-exp.c.tmp"
2983 break;
2984
2985 case 103:
2986 #line 940 "c-exp.y"
2987 {
2988 pstate->push_new<objc_selector_operation>
2989 (copy_name ((yyvsp[-1].sval)));
2990 }
2991 #line 2993 "c-exp.c.tmp"
2992 break;
2993
2994 case 104:
2995 #line 947 "c-exp.y"
2996 { struct type *type = (yyvsp[-1].tval);
2997 struct type *int_type
2998 = lookup_signed_typename (pstate->language (),
2999 "int");
3000 type = check_typedef (type);
3001
3002 /* $5.3.3/2 of the C++ Standard (n3290 draft)
3003 says of sizeof: "When applied to a reference
3004 or a reference type, the result is the size of
3005 the referenced type." */
3006 if (TYPE_IS_REFERENCE (type))
3007 type = check_typedef (TYPE_TARGET_TYPE (type));
3008 pstate->push_new<long_const_operation>
3009 (int_type, TYPE_LENGTH (type));
3010 }
3011 #line 3013 "c-exp.c.tmp"
3012 break;
3013
3014 case 105:
3015 #line 965 "c-exp.y"
3016 { pstate->wrap2<reinterpret_cast_operation> (); }
3017 #line 3019 "c-exp.c.tmp"
3018 break;
3019
3020 case 106:
3021 #line 969 "c-exp.y"
3022 { pstate->wrap2<unop_cast_type_operation> (); }
3023 #line 3025 "c-exp.c.tmp"
3024 break;
3025
3026 case 107:
3027 #line 973 "c-exp.y"
3028 { pstate->wrap2<dynamic_cast_operation> (); }
3029 #line 3031 "c-exp.c.tmp"
3030 break;
3031
3032 case 108:
3033 #line 977 "c-exp.y"
3034 { /* We could do more error checking here, but
3035 it doesn't seem worthwhile. */
3036 pstate->wrap2<unop_cast_type_operation> (); }
3037 #line 3039 "c-exp.c.tmp"
3038 break;
3039
3040 case 109:
3041 #line 984 "c-exp.y"
3042 {
3043 /* We copy the string here, and not in the
3044 lexer, to guarantee that we do not leak a
3045 string. Note that we follow the
3046 NUL-termination convention of the
3047 lexer. */
3048 struct typed_stoken *vec = XNEW (struct typed_stoken);
3049 (yyval.svec).len = 1;
3050 (yyval.svec).tokens = vec;
3051
3052 vec->type = (yyvsp[0].tsval).type;
3053 vec->length = (yyvsp[0].tsval).length;
3054 vec->ptr = (char *) xmalloc ((yyvsp[0].tsval).length + 1);
3055 memcpy (vec->ptr, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1);
3056 }
3057 #line 3059 "c-exp.c.tmp"
3058 break;
3059
3060 case 110:
3061 #line 1001 "c-exp.y"
3062 {
3063 /* Note that we NUL-terminate here, but just
3064 for convenience. */
3065 char *p;
3066 ++(yyval.svec).len;
3067 (yyval.svec).tokens = XRESIZEVEC (struct typed_stoken,
3068 (yyval.svec).tokens, (yyval.svec).len);
3069
3070 p = (char *) xmalloc ((yyvsp[0].tsval).length + 1);
3071 memcpy (p, (yyvsp[0].tsval).ptr, (yyvsp[0].tsval).length + 1);
3072
3073 (yyval.svec).tokens[(yyval.svec).len - 1].type = (yyvsp[0].tsval).type;
3074 (yyval.svec).tokens[(yyval.svec).len - 1].length = (yyvsp[0].tsval).length;
3075 (yyval.svec).tokens[(yyval.svec).len - 1].ptr = p;
3076 }
3077 #line 3079 "c-exp.c.tmp"
3078 break;
3079
3080 case 111:
3081 #line 1019 "c-exp.y"
3082 {
3083 int i;
3084 c_string_type type = C_STRING;
3085
3086 for (i = 0; i < (yyvsp[0].svec).len; ++i)
3087 {
3088 switch ((yyvsp[0].svec).tokens[i].type)
3089 {
3090 case C_STRING:
3091 break;
3092 case C_WIDE_STRING:
3093 case C_STRING_16:
3094 case C_STRING_32:
3095 if (type != C_STRING
3096 && type != (yyvsp[0].svec).tokens[i].type)
3097 error (_("Undefined string concatenation."));
3098 type = (enum c_string_type_values) (yyvsp[0].svec).tokens[i].type;
3099 break;
3100 default:
3101 /* internal error */
3102 internal_error (__FILE__, __LINE__,
3103 "unrecognized type in string concatenation");
3104 }
3105 }
3106
3107 pstate->push_c_string (type, &(yyvsp[0].svec));
3108 for (i = 0; i < (yyvsp[0].svec).len; ++i)
3109 xfree ((yyvsp[0].svec).tokens[i].ptr);
3110 xfree ((yyvsp[0].svec).tokens);
3111 }
3112 #line 3114 "c-exp.c.tmp"
3113 break;
3114
3115 case 112:
3116 #line 1054 "c-exp.y"
3117 {
3118 pstate->push_new<objc_nsstring_operation>
3119 (copy_name ((yyvsp[0].sval)));
3120 }
3121 #line 3123 "c-exp.c.tmp"
3122 break;
3123
3124 case 113:
3125 #line 1062 "c-exp.y"
3126 { pstate->push_new<long_const_operation>
3127 (parse_type (pstate)->builtin_bool, 1);
3128 }
3129 #line 3131 "c-exp.c.tmp"
3130 break;
3131
3132 case 114:
3133 #line 1068 "c-exp.y"
3134 { pstate->push_new<long_const_operation>
3135 (parse_type (pstate)->builtin_bool, 0);
3136 }
3137 #line 3139 "c-exp.c.tmp"
3138 break;
3139
3140 case 115:
3141 #line 1076 "c-exp.y"
3142 {
3143 if ((yyvsp[0].ssym).sym.symbol)
3144 (yyval.bval) = SYMBOL_BLOCK_VALUE ((yyvsp[0].ssym).sym.symbol);
3145 else
3146 error (_("No file or function \"%s\"."),
3147 copy_name ((yyvsp[0].ssym).stoken).c_str ());
3148 }
3149 #line 3151 "c-exp.c.tmp"
3150 break;
3151
3152 case 116:
3153 #line 1084 "c-exp.y"
3154 {
3155 (yyval.bval) = (yyvsp[0].bval);
3156 }
3157 #line 3159 "c-exp.c.tmp"
3158 break;
3159
3160 case 117:
3161 #line 1090 "c-exp.y"
3162 {
3163 std::string copy = copy_name ((yyvsp[0].sval));
3164 struct symbol *tem
3165 = lookup_symbol (copy.c_str (), (yyvsp[-2].bval),
3166 VAR_DOMAIN, NULL).symbol;
3167
3168 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
3169 error (_("No function \"%s\" in specified context."),
3170 copy.c_str ());
3171 (yyval.bval) = SYMBOL_BLOCK_VALUE (tem); }
3172 #line 3174 "c-exp.c.tmp"
3173 break;
3174
3175 case 118:
3176 #line 1103 "c-exp.y"
3177 { struct symbol *sym = (yyvsp[-1].ssym).sym.symbol;
3178
3179 if (sym == NULL || !SYMBOL_IS_ARGUMENT (sym)
3180 || !symbol_read_needs_frame (sym))
3181 error (_("@entry can be used only for function "
3182 "parameters, not for \"%s\""),
3183 copy_name ((yyvsp[-1].ssym).stoken).c_str ());
3184
3185 pstate->push_new<var_entry_value_operation> (sym);
3186 }
3187 #line 3189 "c-exp.c.tmp"
3188 break;
3189
3190 case 119:
3191 #line 1116 "c-exp.y"
3192 {
3193 std::string copy = copy_name ((yyvsp[0].sval));
3194 struct block_symbol sym
3195 = lookup_symbol (copy.c_str (), (yyvsp[-2].bval),
3196 VAR_DOMAIN, NULL);
3197
3198 if (sym.symbol == 0)
3199 error (_("No symbol \"%s\" in specified context."),
3200 copy.c_str ());
3201 if (symbol_read_needs_frame (sym.symbol))
3202 pstate->block_tracker->update (sym);
3203
3204 pstate->push_new<var_value_operation> (sym);
3205 }
3206 #line 3208 "c-exp.c.tmp"
3207 break;
3208
3209 case 120:
3210 #line 1133 "c-exp.y"
3211 {
3212 struct type *type = (yyvsp[-2].tsym).type;
3213 type = check_typedef (type);
3214 if (!type_aggregate_p (type))
3215 error (_("`%s' is not defined as an aggregate type."),
3216 TYPE_SAFE_NAME (type));
3217
3218 pstate->push_new<scope_operation> (type,
3219 copy_name ((yyvsp[0].sval)));
3220 }
3221 #line 3223 "c-exp.c.tmp"
3222 break;
3223
3224 case 121:
3225 #line 1144 "c-exp.y"
3226 {
3227 struct type *type = (yyvsp[-3].tsym).type;
3228
3229 type = check_typedef (type);
3230 if (!type_aggregate_p (type))
3231 error (_("`%s' is not defined as an aggregate type."),
3232 TYPE_SAFE_NAME (type));
3233 std::string name = "~" + std::string ((yyvsp[0].sval).ptr,
3234 (yyvsp[0].sval).length);
3235
3236 /* Check for valid destructor name. */
3237 destructor_name_p (name.c_str (), (yyvsp[-3].tsym).type);
3238 pstate->push_new<scope_operation> (type,
3239 std::move (name));
3240 }
3241 #line 3243 "c-exp.c.tmp"
3242 break;
3243
3244 case 122:
3245 #line 1160 "c-exp.y"
3246 {
3247 std::string copy = copy_name ((yyvsp[-2].sval));
3248 error (_("No type \"%s\" within class "
3249 "or namespace \"%s\"."),
3250 copy.c_str (), TYPE_SAFE_NAME ((yyvsp[-4].tsym).type));
3251 }
3252 #line 3254 "c-exp.c.tmp"
3253 break;
3254
3255 case 124:
3256 #line 1170 "c-exp.y"
3257 {
3258 std::string name = copy_name ((yyvsp[0].ssym).stoken);
3259 struct block_symbol sym
3260 = lookup_symbol (name.c_str (),
3261 (const struct block *) NULL,
3262 VAR_DOMAIN, NULL);
3263 pstate->push_symbol (name.c_str (), sym);
3264 }
3265 #line 3267 "c-exp.c.tmp"
3266 break;
3267
3268 case 125:
3269 #line 1181 "c-exp.y"
3270 { struct block_symbol sym = (yyvsp[0].ssym).sym;
3271
3272 if (sym.symbol)
3273 {
3274 if (symbol_read_needs_frame (sym.symbol))
3275 pstate->block_tracker->update (sym);
3276
3277 /* If we found a function, see if it's
3278 an ifunc resolver that has the same
3279 address as the ifunc symbol itself.
3280 If so, prefer the ifunc symbol. */
3281
3282 bound_minimal_symbol resolver
3283 = find_gnu_ifunc (sym.symbol);
3284 if (resolver.minsym != NULL)
3285 pstate->push_new<var_msym_value_operation>
3286 (resolver);
3287 else
3288 pstate->push_new<var_value_operation> (sym);
3289 }
3290 else if ((yyvsp[0].ssym).is_a_field_of_this)
3291 {
3292 /* C++: it hangs off of `this'. Must
3293 not inadvertently convert from a method call
3294 to data ref. */
3295 pstate->block_tracker->update (sym);
3296 operation_up thisop
3297 = make_operation<op_this_operation> ();
3298 pstate->push_new<structop_ptr_operation>
3299 (std::move (thisop), copy_name ((yyvsp[0].ssym).stoken));
3300 }
3301 else
3302 {
3303 std::string arg = copy_name ((yyvsp[0].ssym).stoken);
3304
3305 bound_minimal_symbol msymbol
3306 = lookup_bound_minimal_symbol (arg.c_str ());
3307 if (msymbol.minsym == NULL)
3308 {
3309 if (!have_full_symbols () && !have_partial_symbols ())
3310 error (_("No symbol table is loaded. Use the \"file\" command."));
3311 else
3312 error (_("No symbol \"%s\" in current context."),
3313 arg.c_str ());
3314 }
3315
3316 /* This minsym might be an alias for
3317 another function. See if we can find
3318 the debug symbol for the target, and
3319 if so, use it instead, since it has
3320 return type / prototype info. This
3321 is important for example for "p
3322 *__errno_location()". */
3323 symbol *alias_target
3324 = ((msymbol.minsym->type != mst_text_gnu_ifunc
3325 && msymbol.minsym->type != mst_data_gnu_ifunc)
3326 ? find_function_alias_target (msymbol)
3327 : NULL);
3328 if (alias_target != NULL)
3329 {
3330 block_symbol bsym { alias_target,
3331 SYMBOL_BLOCK_VALUE (alias_target) };
3332 pstate->push_new<var_value_operation> (bsym);
3333 }
3334 else
3335 pstate->push_new<var_msym_value_operation>
3336 (msymbol);
3337 }
3338 }
3339 #line 3341 "c-exp.c.tmp"
3340 break;
3341
3342 case 128:
3343 #line 1258 "c-exp.y"
3344 { cpstate->type_stack.insert (tp_const); }
3345 #line 3347 "c-exp.c.tmp"
3346 break;
3347
3348 case 129:
3349 #line 1260 "c-exp.y"
3350 { cpstate->type_stack.insert (tp_volatile); }
3351 #line 3353 "c-exp.c.tmp"
3352 break;
3353
3354 case 130:
3355 #line 1262 "c-exp.y"
3356 { cpstate->type_stack.insert (tp_atomic); }
3357 #line 3359 "c-exp.c.tmp"
3358 break;
3359
3360 case 131:
3361 #line 1264 "c-exp.y"
3362 { cpstate->type_stack.insert (tp_restrict); }
3363 #line 3365 "c-exp.c.tmp"
3364 break;
3365
3366 case 132:
3367 #line 1266 "c-exp.y"
3368 {
3369 cpstate->type_stack.insert (pstate,
3370 copy_name ((yyvsp[0].ssym).stoken).c_str ());
3371 }
3372 #line 3374 "c-exp.c.tmp"
3373 break;
3374
3375 case 133:
3376 #line 1271 "c-exp.y"
3377 {
3378 cpstate->type_stack.insert (pstate,
3379 copy_name ((yyvsp[0].ssym).stoken).c_str ());
3380 }
3381 #line 3383 "c-exp.c.tmp"
3382 break;
3383
3384 case 138:
3385 #line 1289 "c-exp.y"
3386 { cpstate->type_stack.insert (tp_pointer); }
3387 #line 3389 "c-exp.c.tmp"
3388 break;
3389
3390 case 140:
3391 #line 1292 "c-exp.y"
3392 { cpstate->type_stack.insert (tp_pointer); }
3393 #line 3395 "c-exp.c.tmp"
3394 break;
3395
3396 case 142:
3397 #line 1295 "c-exp.y"
3398 { cpstate->type_stack.insert (tp_reference); }
3399 #line 3401 "c-exp.c.tmp"
3400 break;
3401
3402 case 143:
3403 #line 1297 "c-exp.y"
3404 { cpstate->type_stack.insert (tp_reference); }
3405 #line 3407 "c-exp.c.tmp"
3406 break;
3407
3408 case 144:
3409 #line 1299 "c-exp.y"
3410 { cpstate->type_stack.insert (tp_rvalue_reference); }
3411 #line 3413 "c-exp.c.tmp"
3412 break;
3413
3414 case 145:
3415 #line 1301 "c-exp.y"
3416 { cpstate->type_stack.insert (tp_rvalue_reference); }
3417 #line 3419 "c-exp.c.tmp"
3418 break;
3419
3420 case 146:
3421 #line 1305 "c-exp.y"
3422 {
3423 (yyval.type_stack) = cpstate->type_stack.create ();
3424 cpstate->type_stacks.emplace_back ((yyval.type_stack));
3425 }
3426 #line 3428 "c-exp.c.tmp"
3427 break;
3428
3429 case 147:
3430 #line 1312 "c-exp.y"
3431 { (yyval.type_stack) = (yyvsp[0].type_stack)->append ((yyvsp[-1].type_stack)); }
3432 #line 3434 "c-exp.c.tmp"
3433 break;
3434
3435 case 150:
3436 #line 1318 "c-exp.y"
3437 { (yyval.type_stack) = (yyvsp[-1].type_stack); }
3438 #line 3440 "c-exp.c.tmp"
3439 break;
3440
3441 case 151:
3442 #line 1320 "c-exp.y"
3443 {
3444 cpstate->type_stack.push ((yyvsp[-1].type_stack));
3445 cpstate->type_stack.push ((yyvsp[0].lval));
3446 cpstate->type_stack.push (tp_array);
3447 (yyval.type_stack) = cpstate->type_stack.create ();
3448 cpstate->type_stacks.emplace_back ((yyval.type_stack));
3449 }
3450 #line 3452 "c-exp.c.tmp"
3451 break;
3452
3453 case 152:
3454 #line 1328 "c-exp.y"
3455 {
3456 cpstate->type_stack.push ((yyvsp[0].lval));
3457 cpstate->type_stack.push (tp_array);
3458 (yyval.type_stack) = cpstate->type_stack.create ();
3459 cpstate->type_stacks.emplace_back ((yyval.type_stack));
3460 }
3461 #line 3463 "c-exp.c.tmp"
3462 break;
3463
3464 case 153:
3465 #line 1336 "c-exp.y"
3466 {
3467 cpstate->type_stack.push ((yyvsp[-1].type_stack));
3468 cpstate->type_stack.push ((yyvsp[0].tvec));
3469 (yyval.type_stack) = cpstate->type_stack.create ();
3470 cpstate->type_stacks.emplace_back ((yyval.type_stack));
3471 }
3472 #line 3474 "c-exp.c.tmp"
3473 break;
3474
3475 case 154:
3476 #line 1343 "c-exp.y"
3477 {
3478 cpstate->type_stack.push ((yyvsp[0].tvec));
3479 (yyval.type_stack) = cpstate->type_stack.create ();
3480 cpstate->type_stacks.emplace_back ((yyval.type_stack));
3481 }
3482 #line 3484 "c-exp.c.tmp"
3483 break;
3484
3485 case 155:
3486 #line 1351 "c-exp.y"
3487 { (yyval.lval) = -1; }
3488 #line 3490 "c-exp.c.tmp"
3489 break;
3490
3491 case 156:
3492 #line 1353 "c-exp.y"
3493 { (yyval.lval) = -1; }
3494 #line 3496 "c-exp.c.tmp"
3495 break;
3496
3497 case 157:
3498 #line 1355 "c-exp.y"
3499 { (yyval.lval) = (yyvsp[-1].typed_val_int).val; }
3500 #line 3502 "c-exp.c.tmp"
3501 break;
3502
3503 case 158:
3504 #line 1357 "c-exp.y"
3505 { (yyval.lval) = (yyvsp[-1].typed_val_int).val; }
3506 #line 3508 "c-exp.c.tmp"
3507 break;
3508
3509 case 159:
3510 #line 1361 "c-exp.y"
3511 {
3512 (yyval.tvec) = new std::vector<struct type *>;
3513 cpstate->type_lists.emplace_back ((yyval.tvec));
3514 }
3515 #line 3517 "c-exp.c.tmp"
3516 break;
3517
3518 case 160:
3519 #line 1366 "c-exp.y"
3520 { (yyval.tvec) = (yyvsp[-1].tvec); }
3521 #line 3523 "c-exp.c.tmp"
3522 break;
3523
3524 case 162:
3525 #line 1385 "c-exp.y"
3526 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3527 "int"); }
3528 #line 3530 "c-exp.c.tmp"
3529 break;
3530
3531 case 163:
3532 #line 1388 "c-exp.y"
3533 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3534 "long"); }
3535 #line 3537 "c-exp.c.tmp"
3536 break;
3537
3538 case 164:
3539 #line 1391 "c-exp.y"
3540 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3541 "short"); }
3542 #line 3544 "c-exp.c.tmp"
3543 break;
3544
3545 case 165:
3546 #line 1394 "c-exp.y"
3547 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3548 "long"); }
3549 #line 3551 "c-exp.c.tmp"
3550 break;
3551
3552 case 166:
3553 #line 1397 "c-exp.y"
3554 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3555 "long"); }
3556 #line 3558 "c-exp.c.tmp"
3557 break;
3558
3559 case 167:
3560 #line 1400 "c-exp.y"
3561 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3562 "long"); }
3563 #line 3565 "c-exp.c.tmp"
3564 break;
3565
3566 case 168:
3567 #line 1403 "c-exp.y"
3568 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3569 "long"); }
3570 #line 3572 "c-exp.c.tmp"
3571 break;
3572
3573 case 169:
3574 #line 1406 "c-exp.y"
3575 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3576 "long"); }
3577 #line 3579 "c-exp.c.tmp"
3578 break;
3579
3580 case 170:
3581 #line 1409 "c-exp.y"
3582 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3583 "long"); }
3584 #line 3586 "c-exp.c.tmp"
3585 break;
3586
3587 case 171:
3588 #line 1412 "c-exp.y"
3589 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3590 "long"); }
3591 #line 3593 "c-exp.c.tmp"
3592 break;
3593
3594 case 172:
3595 #line 1415 "c-exp.y"
3596 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3597 "long long"); }
3598 #line 3600 "c-exp.c.tmp"
3599 break;
3600
3601 case 173:
3602 #line 1418 "c-exp.y"
3603 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3604 "long long"); }
3605 #line 3607 "c-exp.c.tmp"
3606 break;
3607
3608 case 174:
3609 #line 1421 "c-exp.y"
3610 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3611 "long long"); }
3612 #line 3614 "c-exp.c.tmp"
3613 break;
3614
3615 case 175:
3616 #line 1424 "c-exp.y"
3617 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3618 "long long"); }
3619 #line 3621 "c-exp.c.tmp"
3620 break;
3621
3622 case 176:
3623 #line 1427 "c-exp.y"
3624 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3625 "long long"); }
3626 #line 3628 "c-exp.c.tmp"
3627 break;
3628
3629 case 177:
3630 #line 1430 "c-exp.y"
3631 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3632 "long long"); }
3633 #line 3635 "c-exp.c.tmp"
3634 break;
3635
3636 case 178:
3637 #line 1433 "c-exp.y"
3638 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3639 "long long"); }
3640 #line 3642 "c-exp.c.tmp"
3641 break;
3642
3643 case 179:
3644 #line 1436 "c-exp.y"
3645 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3646 "long long"); }
3647 #line 3649 "c-exp.c.tmp"
3648 break;
3649
3650 case 180:
3651 #line 1439 "c-exp.y"
3652 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3653 "long long"); }
3654 #line 3656 "c-exp.c.tmp"
3655 break;
3656
3657 case 181:
3658 #line 1442 "c-exp.y"
3659 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3660 "long long"); }
3661 #line 3663 "c-exp.c.tmp"
3662 break;
3663
3664 case 182:
3665 #line 1445 "c-exp.y"
3666 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3667 "short"); }
3668 #line 3670 "c-exp.c.tmp"
3669 break;
3670
3671 case 183:
3672 #line 1448 "c-exp.y"
3673 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3674 "short"); }
3675 #line 3677 "c-exp.c.tmp"
3676 break;
3677
3678 case 184:
3679 #line 1451 "c-exp.y"
3680 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3681 "short"); }
3682 #line 3684 "c-exp.c.tmp"
3683 break;
3684
3685 case 185:
3686 #line 1454 "c-exp.y"
3687 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3688 "short"); }
3689 #line 3691 "c-exp.c.tmp"
3690 break;
3691
3692 case 186:
3693 #line 1457 "c-exp.y"
3694 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3695 "short"); }
3696 #line 3698 "c-exp.c.tmp"
3697 break;
3698
3699 case 187:
3700 #line 1460 "c-exp.y"
3701 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3702 "short"); }
3703 #line 3705 "c-exp.c.tmp"
3704 break;
3705
3706 case 188:
3707 #line 1463 "c-exp.y"
3708 { (yyval.tval) = lookup_typename (pstate->language (),
3709 "double",
3710 NULL,
3711 0); }
3712 #line 3714 "c-exp.c.tmp"
3713 break;
3714
3715 case 189:
3716 #line 1468 "c-exp.y"
3717 { (yyval.tval) = lookup_typename (pstate->language (),
3718 "float",
3719 NULL,
3720 0); }
3721 #line 3723 "c-exp.c.tmp"
3722 break;
3723
3724 case 190:
3725 #line 1473 "c-exp.y"
3726 { (yyval.tval) = lookup_typename (pstate->language (),
3727 "long double",
3728 NULL,
3729 0); }
3730 #line 3732 "c-exp.c.tmp"
3731 break;
3732
3733 case 191:
3734 #line 1478 "c-exp.y"
3735 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3736 (yyvsp[0].tsym).type->name ()); }
3737 #line 3739 "c-exp.c.tmp"
3738 break;
3739
3740 case 192:
3741 #line 1481 "c-exp.y"
3742 { (yyval.tval) = lookup_unsigned_typename (pstate->language (),
3743 "int"); }
3744 #line 3746 "c-exp.c.tmp"
3745 break;
3746
3747 case 193:
3748 #line 1484 "c-exp.y"
3749 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3750 (yyvsp[0].tsym).type->name ()); }
3751 #line 3753 "c-exp.c.tmp"
3752 break;
3753
3754 case 194:
3755 #line 1487 "c-exp.y"
3756 { (yyval.tval) = lookup_signed_typename (pstate->language (),
3757 "int"); }
3758 #line 3760 "c-exp.c.tmp"
3759 break;
3760
3761 case 195:
3762 #line 1503 "c-exp.y"
3763 { (yyval.tval) = (yyvsp[0].tsym).type; }
3764 #line 3766 "c-exp.c.tmp"
3765 break;
3766
3767 case 196:
3768 #line 1505 "c-exp.y"
3769 { (yyval.tval) = (yyvsp[0].tval); }
3770 #line 3772 "c-exp.c.tmp"
3771 break;
3772
3773 case 197:
3774 #line 1507 "c-exp.y"
3775 {
3776 (yyval.tval) = init_complex_type (nullptr, (yyvsp[0].tval));
3777 }
3778 #line 3780 "c-exp.c.tmp"
3779 break;
3780
3781 case 198:
3782 #line 1511 "c-exp.y"
3783 { (yyval.tval)
3784 = lookup_struct (copy_name ((yyvsp[0].sval)).c_str (),
3785 pstate->expression_context_block);
3786 }
3787 #line 3789 "c-exp.c.tmp"
3788 break;
3789
3790 case 199:
3791 #line 1516 "c-exp.y"
3792 {
3793 pstate->mark_completion_tag (TYPE_CODE_STRUCT,
3794 "", 0);
3795 (yyval.tval) = NULL;
3796 }
3797 #line 3799 "c-exp.c.tmp"
3798 break;
3799
3800 case 200:
3801 #line 1522 "c-exp.y"
3802 {
3803 pstate->mark_completion_tag (TYPE_CODE_STRUCT,
3804 (yyvsp[-1].sval).ptr, (yyvsp[-1].sval).length);
3805 (yyval.tval) = NULL;
3806 }
3807 #line 3809 "c-exp.c.tmp"
3808 break;
3809
3810 case 201:
3811 #line 1528 "c-exp.y"
3812 { (yyval.tval) = lookup_struct
3813 (copy_name ((yyvsp[0].sval)).c_str (),
3814 pstate->expression_context_block);
3815 }
3816 #line 3818 "c-exp.c.tmp"
3817 break;
3818
3819 case 202:
3820 #line 1533 "c-exp.y"
3821 {
3822 pstate->mark_completion_tag (TYPE_CODE_STRUCT,
3823 "", 0);
3824 (yyval.tval) = NULL;
3825 }
3826 #line 3828 "c-exp.c.tmp"
3827 break;
3828
3829 case 203:
3830 #line 1539 "c-exp.y"
3831 {
3832 pstate->mark_completion_tag (TYPE_CODE_STRUCT,
3833 (yyvsp[-1].sval).ptr, (yyvsp[-1].sval).length);
3834 (yyval.tval) = NULL;
3835 }
3836 #line 3838 "c-exp.c.tmp"
3837 break;
3838
3839 case 204:
3840 #line 1545 "c-exp.y"
3841 { (yyval.tval)
3842 = lookup_union (copy_name ((yyvsp[0].sval)).c_str (),
3843 pstate->expression_context_block);
3844 }
3845 #line 3847 "c-exp.c.tmp"
3846 break;
3847
3848 case 205:
3849 #line 1550 "c-exp.y"
3850 {
3851 pstate->mark_completion_tag (TYPE_CODE_UNION,
3852 "", 0);
3853 (yyval.tval) = NULL;
3854 }
3855 #line 3857 "c-exp.c.tmp"
3856 break;
3857
3858 case 206:
3859 #line 1556 "c-exp.y"
3860 {
3861 pstate->mark_completion_tag (TYPE_CODE_UNION,
3862 (yyvsp[-1].sval).ptr, (yyvsp[-1].sval).length);
3863 (yyval.tval) = NULL;
3864 }
3865 #line 3867 "c-exp.c.tmp"
3866 break;
3867
3868 case 207:
3869 #line 1562 "c-exp.y"
3870 { (yyval.tval) = lookup_enum (copy_name ((yyvsp[0].sval)).c_str (),
3871 pstate->expression_context_block);
3872 }
3873 #line 3875 "c-exp.c.tmp"
3874 break;
3875
3876 case 208:
3877 #line 1566 "c-exp.y"
3878 {
3879 pstate->mark_completion_tag (TYPE_CODE_ENUM, "", 0);
3880 (yyval.tval) = NULL;
3881 }
3882 #line 3884 "c-exp.c.tmp"
3883 break;
3884
3885 case 209:
3886 #line 1571 "c-exp.y"
3887 {
3888 pstate->mark_completion_tag (TYPE_CODE_ENUM, (yyvsp[-1].sval).ptr,
3889 (yyvsp[-1].sval).length);
3890 (yyval.tval) = NULL;
3891 }
3892 #line 3894 "c-exp.c.tmp"
3893 break;
3894
3895 case 210:
3896 #line 1580 "c-exp.y"
3897 { (yyval.tval) = lookup_template_type
3898 (copy_name((yyvsp[-3].sval)).c_str (), (yyvsp[-1].tval),
3899 pstate->expression_context_block);
3900 }
3901 #line 3903 "c-exp.c.tmp"
3902 break;
3903
3904 case 211:
3905 #line 1585 "c-exp.y"
3906 { (yyval.tval) = cpstate->type_stack.follow_types ((yyvsp[0].tval)); }
3907 #line 3909 "c-exp.c.tmp"
3908 break;
3909
3910 case 212:
3911 #line 1587 "c-exp.y"
3912 { (yyval.tval) = cpstate->type_stack.follow_types ((yyvsp[-1].tval)); }
3913 #line 3915 "c-exp.c.tmp"
3914 break;
3915
3916 case 214:
3917 #line 1592 "c-exp.y"
3918 {
3919 (yyval.tsym).stoken.ptr = "int";
3920 (yyval.tsym).stoken.length = 3;
3921 (yyval.tsym).type = lookup_signed_typename (pstate->language (),
3922 "int");
3923 }
3924 #line 3926 "c-exp.c.tmp"
3925 break;
3926
3927 case 215:
3928 #line 1599 "c-exp.y"
3929 {
3930 (yyval.tsym).stoken.ptr = "long";
3931 (yyval.tsym).stoken.length = 4;
3932 (yyval.tsym).type = lookup_signed_typename (pstate->language (),
3933 "long");
3934 }
3935 #line 3937 "c-exp.c.tmp"
3936 break;
3937
3938 case 216:
3939 #line 1606 "c-exp.y"
3940 {
3941 (yyval.tsym).stoken.ptr = "short";
3942 (yyval.tsym).stoken.length = 5;
3943 (yyval.tsym).type = lookup_signed_typename (pstate->language (),
3944 "short");
3945 }
3946 #line 3948 "c-exp.c.tmp"
3947 break;
3948
3949 case 217:
3950 #line 1616 "c-exp.y"
3951 { check_parameter_typelist ((yyvsp[0].tvec)); }
3952 #line 3954 "c-exp.c.tmp"
3953 break;
3954
3955 case 218:
3956 #line 1618 "c-exp.y"
3957 {
3958 (yyvsp[-2].tvec)->push_back (NULL);
3959 check_parameter_typelist ((yyvsp[-2].tvec));
3960 (yyval.tvec) = (yyvsp[-2].tvec);
3961 }
3962 #line 3964 "c-exp.c.tmp"
3963 break;
3964
3965 case 219:
3966 #line 1627 "c-exp.y"
3967 {
3968 std::vector<struct type *> *typelist
3969 = new std::vector<struct type *>;
3970 cpstate->type_lists.emplace_back (typelist);
3971
3972 typelist->push_back ((yyvsp[0].tval));
3973 (yyval.tvec) = typelist;
3974 }
3975 #line 3977 "c-exp.c.tmp"
3976 break;
3977
3978 case 220:
3979 #line 1636 "c-exp.y"
3980 {
3981 (yyvsp[-2].tvec)->push_back ((yyvsp[0].tval));
3982 (yyval.tvec) = (yyvsp[-2].tvec);
3983 }
3984 #line 3986 "c-exp.c.tmp"
3985 break;
3986
3987 case 222:
3988 #line 1644 "c-exp.y"
3989 {
3990 cpstate->type_stack.push ((yyvsp[0].type_stack));
3991 (yyval.tval) = cpstate->type_stack.follow_types ((yyvsp[-1].tval));
3992 }
3993 #line 3995 "c-exp.c.tmp"
3994 break;
3995
3996 case 223:
3997 #line 1651 "c-exp.y"
3998 { (yyval.tval) = cpstate->type_stack.follow_types ((yyvsp[-1].tval)); }
3999 #line 4001 "c-exp.c.tmp"
4000 break;
4001
4002 case 228:
4003 #line 1663 "c-exp.y"
4004 { cpstate->type_stack.insert (tp_const);
4005 cpstate->type_stack.insert (tp_volatile);
4006 }
4007 #line 4009 "c-exp.c.tmp"
4008 break;
4009
4010 case 229:
4011 #line 1667 "c-exp.y"
4012 { cpstate->type_stack.insert (tp_const); }
4013 #line 4015 "c-exp.c.tmp"
4014 break;
4015
4016 case 230:
4017 #line 1669 "c-exp.y"
4018 { cpstate->type_stack.insert (tp_volatile); }
4019 #line 4021 "c-exp.c.tmp"
4020 break;
4021
4022 case 231:
4023 #line 1673 "c-exp.y"
4024 { (yyval.sval) = operator_stoken (" new"); }
4025 #line 4027 "c-exp.c.tmp"
4026 break;
4027
4028 case 232:
4029 #line 1675 "c-exp.y"
4030 { (yyval.sval) = operator_stoken (" delete"); }
4031 #line 4033 "c-exp.c.tmp"
4032 break;
4033
4034 case 233:
4035 #line 1677 "c-exp.y"
4036 { (yyval.sval) = operator_stoken (" new[]"); }
4037 #line 4039 "c-exp.c.tmp"
4038 break;
4039
4040 case 234:
4041 #line 1679 "c-exp.y"
4042 { (yyval.sval) = operator_stoken (" delete[]"); }
4043 #line 4045 "c-exp.c.tmp"
4044 break;
4045
4046 case 235:
4047 #line 1681 "c-exp.y"
4048 { (yyval.sval) = operator_stoken (" new[]"); }
4049 #line 4051 "c-exp.c.tmp"
4050 break;
4051
4052 case 236:
4053 #line 1683 "c-exp.y"
4054 { (yyval.sval) = operator_stoken (" delete[]"); }
4055 #line 4057 "c-exp.c.tmp"
4056 break;
4057
4058 case 237:
4059 #line 1685 "c-exp.y"
4060 { (yyval.sval) = operator_stoken ("+"); }
4061 #line 4063 "c-exp.c.tmp"
4062 break;
4063
4064 case 238:
4065 #line 1687 "c-exp.y"
4066 { (yyval.sval) = operator_stoken ("-"); }
4067 #line 4069 "c-exp.c.tmp"
4068 break;
4069
4070 case 239:
4071 #line 1689 "c-exp.y"
4072 { (yyval.sval) = operator_stoken ("*"); }
4073 #line 4075 "c-exp.c.tmp"
4074 break;
4075
4076 case 240:
4077 #line 1691 "c-exp.y"
4078 { (yyval.sval) = operator_stoken ("/"); }
4079 #line 4081 "c-exp.c.tmp"
4080 break;
4081
4082 case 241:
4083 #line 1693 "c-exp.y"
4084 { (yyval.sval) = operator_stoken ("%"); }
4085 #line 4087 "c-exp.c.tmp"
4086 break;
4087
4088 case 242:
4089 #line 1695 "c-exp.y"
4090 { (yyval.sval) = operator_stoken ("^"); }
4091 #line 4093 "c-exp.c.tmp"
4092 break;
4093
4094 case 243:
4095 #line 1697 "c-exp.y"
4096 { (yyval.sval) = operator_stoken ("&"); }
4097 #line 4099 "c-exp.c.tmp"
4098 break;
4099
4100 case 244:
4101 #line 1699 "c-exp.y"
4102 { (yyval.sval) = operator_stoken ("|"); }
4103 #line 4105 "c-exp.c.tmp"
4104 break;
4105
4106 case 245:
4107 #line 1701 "c-exp.y"
4108 { (yyval.sval) = operator_stoken ("~"); }
4109 #line 4111 "c-exp.c.tmp"
4110 break;
4111
4112 case 246:
4113 #line 1703 "c-exp.y"
4114 { (yyval.sval) = operator_stoken ("!"); }
4115 #line 4117 "c-exp.c.tmp"
4116 break;
4117
4118 case 247:
4119 #line 1705 "c-exp.y"
4120 { (yyval.sval) = operator_stoken ("="); }
4121 #line 4123 "c-exp.c.tmp"
4122 break;
4123
4124 case 248:
4125 #line 1707 "c-exp.y"
4126 { (yyval.sval) = operator_stoken ("<"); }
4127 #line 4129 "c-exp.c.tmp"
4128 break;
4129
4130 case 249:
4131 #line 1709 "c-exp.y"
4132 { (yyval.sval) = operator_stoken (">"); }
4133 #line 4135 "c-exp.c.tmp"
4134 break;
4135
4136 case 250:
4137 #line 1711 "c-exp.y"
4138 { const char *op = " unknown";
4139 switch ((yyvsp[0].opcode))
4140 {
4141 case BINOP_RSH:
4142 op = ">>=";
4143 break;
4144 case BINOP_LSH:
4145 op = "<<=";
4146 break;
4147 case BINOP_ADD:
4148 op = "+=";
4149 break;
4150 case BINOP_SUB:
4151 op = "-=";
4152 break;
4153 case BINOP_MUL:
4154 op = "*=";
4155 break;
4156 case BINOP_DIV:
4157 op = "/=";
4158 break;
4159 case BINOP_REM:
4160 op = "%=";
4161 break;
4162 case BINOP_BITWISE_IOR:
4163 op = "|=";
4164 break;
4165 case BINOP_BITWISE_AND:
4166 op = "&=";
4167 break;
4168 case BINOP_BITWISE_XOR:
4169 op = "^=";
4170 break;
4171 default:
4172 break;
4173 }
4174
4175 (yyval.sval) = operator_stoken (op);
4176 }
4177 #line 4179 "c-exp.c.tmp"
4178 break;
4179
4180 case 251:
4181 #line 1751 "c-exp.y"
4182 { (yyval.sval) = operator_stoken ("<<"); }
4183 #line 4185 "c-exp.c.tmp"
4184 break;
4185
4186 case 252:
4187 #line 1753 "c-exp.y"
4188 { (yyval.sval) = operator_stoken (">>"); }
4189 #line 4191 "c-exp.c.tmp"
4190 break;
4191
4192 case 253:
4193 #line 1755 "c-exp.y"
4194 { (yyval.sval) = operator_stoken ("=="); }
4195 #line 4197 "c-exp.c.tmp"
4196 break;
4197
4198 case 254:
4199 #line 1757 "c-exp.y"
4200 { (yyval.sval) = operator_stoken ("!="); }
4201 #line 4203 "c-exp.c.tmp"
4202 break;
4203
4204 case 255:
4205 #line 1759 "c-exp.y"
4206 { (yyval.sval) = operator_stoken ("<="); }
4207 #line 4209 "c-exp.c.tmp"
4208 break;
4209
4210 case 256:
4211 #line 1761 "c-exp.y"
4212 { (yyval.sval) = operator_stoken (">="); }
4213 #line 4215 "c-exp.c.tmp"
4214 break;
4215
4216 case 257:
4217 #line 1763 "c-exp.y"
4218 { (yyval.sval) = operator_stoken ("&&"); }
4219 #line 4221 "c-exp.c.tmp"
4220 break;
4221
4222 case 258:
4223 #line 1765 "c-exp.y"
4224 { (yyval.sval) = operator_stoken ("||"); }
4225 #line 4227 "c-exp.c.tmp"
4226 break;
4227
4228 case 259:
4229 #line 1767 "c-exp.y"
4230 { (yyval.sval) = operator_stoken ("++"); }
4231 #line 4233 "c-exp.c.tmp"
4232 break;
4233
4234 case 260:
4235 #line 1769 "c-exp.y"
4236 { (yyval.sval) = operator_stoken ("--"); }
4237 #line 4239 "c-exp.c.tmp"
4238 break;
4239
4240 case 261:
4241 #line 1771 "c-exp.y"
4242 { (yyval.sval) = operator_stoken (","); }
4243 #line 4245 "c-exp.c.tmp"
4244 break;
4245
4246 case 262:
4247 #line 1773 "c-exp.y"
4248 { (yyval.sval) = operator_stoken ("->*"); }
4249 #line 4251 "c-exp.c.tmp"
4250 break;
4251
4252 case 263:
4253 #line 1775 "c-exp.y"
4254 { (yyval.sval) = operator_stoken ("->"); }
4255 #line 4257 "c-exp.c.tmp"
4256 break;
4257
4258 case 264:
4259 #line 1777 "c-exp.y"
4260 { (yyval.sval) = operator_stoken ("()"); }
4261 #line 4263 "c-exp.c.tmp"
4262 break;
4263
4264 case 265:
4265 #line 1779 "c-exp.y"
4266 { (yyval.sval) = operator_stoken ("[]"); }
4267 #line 4269 "c-exp.c.tmp"
4268 break;
4269
4270 case 266:
4271 #line 1781 "c-exp.y"
4272 { (yyval.sval) = operator_stoken ("[]"); }
4273 #line 4275 "c-exp.c.tmp"
4274 break;
4275
4276 case 267:
4277 #line 1783 "c-exp.y"
4278 { string_file buf;
4279
4280 c_print_type ((yyvsp[0].tval), NULL, &buf, -1, 0,
4281 &type_print_raw_options);
4282 std::string name = std::move (buf.string ());
4283
4284 /* This also needs canonicalization. */
4285 gdb::unique_xmalloc_ptr<char> canon
4286 = cp_canonicalize_string (name.c_str ());
4287 if (canon != nullptr)
4288 name = canon.get ();
4289 (yyval.sval) = operator_stoken ((" " + name).c_str ());
4290 }
4291 #line 4293 "c-exp.c.tmp"
4292 break;
4293
4294 case 269:
4295 #line 1805 "c-exp.y"
4296 { (yyval.sval) = typename_stoken ("double"); }
4297 #line 4299 "c-exp.c.tmp"
4298 break;
4299
4300 case 270:
4301 #line 1806 "c-exp.y"
4302 { (yyval.sval) = typename_stoken ("float"); }
4303 #line 4305 "c-exp.c.tmp"
4304 break;
4305
4306 case 271:
4307 #line 1807 "c-exp.y"
4308 { (yyval.sval) = typename_stoken ("int"); }
4309 #line 4311 "c-exp.c.tmp"
4310 break;
4311
4312 case 272:
4313 #line 1808 "c-exp.y"
4314 { (yyval.sval) = typename_stoken ("long"); }
4315 #line 4317 "c-exp.c.tmp"
4316 break;
4317
4318 case 273:
4319 #line 1809 "c-exp.y"
4320 { (yyval.sval) = typename_stoken ("short"); }
4321 #line 4323 "c-exp.c.tmp"
4322 break;
4323
4324 case 274:
4325 #line 1810 "c-exp.y"
4326 { (yyval.sval) = typename_stoken ("signed"); }
4327 #line 4329 "c-exp.c.tmp"
4328 break;
4329
4330 case 275:
4331 #line 1811 "c-exp.y"
4332 { (yyval.sval) = typename_stoken ("unsigned"); }
4333 #line 4335 "c-exp.c.tmp"
4334 break;
4335
4336 case 276:
4337 #line 1814 "c-exp.y"
4338 { (yyval.sval) = (yyvsp[0].ssym).stoken; }
4339 #line 4341 "c-exp.c.tmp"
4340 break;
4341
4342 case 277:
4343 #line 1815 "c-exp.y"
4344 { (yyval.sval) = (yyvsp[0].ssym).stoken; }
4345 #line 4347 "c-exp.c.tmp"
4346 break;
4347
4348 case 278:
4349 #line 1816 "c-exp.y"
4350 { (yyval.sval) = (yyvsp[0].tsym).stoken; }
4351 #line 4353 "c-exp.c.tmp"
4352 break;
4353
4354 case 279:
4355 #line 1817 "c-exp.y"
4356 { (yyval.sval) = (yyvsp[0].ssym).stoken; }
4357 #line 4359 "c-exp.c.tmp"
4358 break;
4359
4360 case 280:
4361 #line 1818 "c-exp.y"
4362 { (yyval.sval) = (yyvsp[0].ssym).stoken; }
4363 #line 4365 "c-exp.c.tmp"
4364 break;
4365
4366 case 281:
4367 #line 1819 "c-exp.y"
4368 { (yyval.sval) = (yyvsp[0].sval); }
4369 #line 4371 "c-exp.c.tmp"
4370 break;
4371
4372 case 284:
4373 #line 1832 "c-exp.y"
4374 {
4375 struct field_of_this_result is_a_field_of_this;
4376
4377 (yyval.ssym).stoken = (yyvsp[0].sval);
4378 (yyval.ssym).sym
4379 = lookup_symbol ((yyvsp[0].sval).ptr,
4380 pstate->expression_context_block,
4381 VAR_DOMAIN,
4382 &is_a_field_of_this);
4383 (yyval.ssym).is_a_field_of_this
4384 = is_a_field_of_this.type != NULL;
4385 }
4386 #line 4388 "c-exp.c.tmp"
4387 break;
4388
4389
4390 #line 4392 "c-exp.c.tmp"
4391
4392 default: break;
4393 }
4394 /* User semantic actions sometimes alter yychar, and that requires
4395 that yytoken be updated with the new translation. We take the
4396 approach of translating immediately before every use of yytoken.
4397 One alternative is translating here after every semantic action,
4398 but that translation would be missed if the semantic action invokes
4399 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
4400 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
4401 incorrect destructor might then be invoked immediately. In the
4402 case of YYERROR or YYBACKUP, subsequent parser actions might lead
4403 to an incorrect destructor call or verbose syntax error message
4404 before the lookahead is translated. */
4405 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
4406
4407 YYPOPSTACK (yylen);
4408 yylen = 0;
4409 YY_STACK_PRINT (yyss, yyssp);
4410
4411 *++yyvsp = yyval;
4412
4413 /* Now 'shift' the result of the reduction. Determine what state
4414 that goes to, based on the state we popped back to and the rule
4415 number reduced by. */
4416 {
4417 const int yylhs = yyr1[yyn] - YYNTOKENS;
4418 const int yyi = yypgoto[yylhs] + *yyssp;
4419 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
4420 ? yytable[yyi]
4421 : yydefgoto[yylhs]);
4422 }
4423
4424 goto yynewstate;
4425
4426
4427 /*--------------------------------------.
4428 | yyerrlab -- here on detecting error. |
4429 `--------------------------------------*/
4430 yyerrlab:
4431 /* Make sure we have latest lookahead translation. See comments at
4432 user semantic actions for why this is necessary. */
4433 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
4434
4435 /* If not already recovering from an error, report this error. */
4436 if (!yyerrstatus)
4437 {
4438 ++yynerrs;
4439 #if ! YYERROR_VERBOSE
4440 yyerror (YY_("syntax error"));
4441 #else
4442 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
4443 yyssp, yytoken)
4444 {
4445 char const *yymsgp = YY_("syntax error");
4446 int yysyntax_error_status;
4447 yysyntax_error_status = YYSYNTAX_ERROR;
4448 if (yysyntax_error_status == 0)
4449 yymsgp = yymsg;
4450 else if (yysyntax_error_status == 1)
4451 {
4452 if (yymsg != yymsgbuf)
4453 YYSTACK_FREE (yymsg);
4454 yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
4455 if (!yymsg)
4456 {
4457 yymsg = yymsgbuf;
4458 yymsg_alloc = sizeof yymsgbuf;
4459 yysyntax_error_status = 2;
4460 }
4461 else
4462 {
4463 yysyntax_error_status = YYSYNTAX_ERROR;
4464 yymsgp = yymsg;
4465 }
4466 }
4467 yyerror (yymsgp);
4468 if (yysyntax_error_status == 2)
4469 goto yyexhaustedlab;
4470 }
4471 # undef YYSYNTAX_ERROR
4472 #endif
4473 }
4474
4475
4476
4477 if (yyerrstatus == 3)
4478 {
4479 /* If just tried and failed to reuse lookahead token after an
4480 error, discard it. */
4481
4482 if (yychar <= YYEOF)
4483 {
4484 /* Return failure if at end of input. */
4485 if (yychar == YYEOF)
4486 YYABORT;
4487 }
4488 else
4489 {
4490 yydestruct ("Error: discarding",
4491 yytoken, &yylval);
4492 yychar = YYEMPTY;
4493 }
4494 }
4495
4496 /* Else will try to reuse lookahead token after shifting the error
4497 token. */
4498 goto yyerrlab1;
4499
4500
4501 /*---------------------------------------------------.
4502 | yyerrorlab -- error raised explicitly by YYERROR. |
4503 `---------------------------------------------------*/
4504 yyerrorlab:
4505 /* Pacify compilers when the user code never invokes YYERROR and the
4506 label yyerrorlab therefore never appears in user code. */
4507 if (0)
4508 YYERROR;
4509
4510 /* Do not reclaim the symbols of the rule whose action triggered
4511 this YYERROR. */
4512 YYPOPSTACK (yylen);
4513 yylen = 0;
4514 YY_STACK_PRINT (yyss, yyssp);
4515 yystate = *yyssp;
4516 goto yyerrlab1;
4517
4518
4519 /*-------------------------------------------------------------.
4520 | yyerrlab1 -- common code for both syntax error and YYERROR. |
4521 `-------------------------------------------------------------*/
4522 yyerrlab1:
4523 yyerrstatus = 3; /* Each real token shifted decrements this. */
4524
4525 for (;;)
4526 {
4527 yyn = yypact[yystate];
4528 if (!yypact_value_is_default (yyn))
4529 {
4530 yyn += YYTERROR;
4531 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
4532 {
4533 yyn = yytable[yyn];
4534 if (0 < yyn)
4535 break;
4536 }
4537 }
4538
4539 /* Pop the current state because it cannot handle the error token. */
4540 if (yyssp == yyss)
4541 YYABORT;
4542
4543
4544 yydestruct ("Error: popping",
4545 yystos[yystate], yyvsp);
4546 YYPOPSTACK (1);
4547 yystate = *yyssp;
4548 YY_STACK_PRINT (yyss, yyssp);
4549 }
4550
4551 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
4552 *++yyvsp = yylval;
4553 YY_IGNORE_MAYBE_UNINITIALIZED_END
4554
4555
4556 /* Shift the error token. */
4557 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
4558
4559 yystate = yyn;
4560 goto yynewstate;
4561
4562
4563 /*-------------------------------------.
4564 | yyacceptlab -- YYACCEPT comes here. |
4565 `-------------------------------------*/
4566 yyacceptlab:
4567 yyresult = 0;
4568 goto yyreturn;
4569
4570
4571 /*-----------------------------------.
4572 | yyabortlab -- YYABORT comes here. |
4573 `-----------------------------------*/
4574 yyabortlab:
4575 yyresult = 1;
4576 goto yyreturn;
4577
4578
4579 #if !defined yyoverflow || YYERROR_VERBOSE
4580 /*-------------------------------------------------.
4581 | yyexhaustedlab -- memory exhaustion comes here. |
4582 `-------------------------------------------------*/
4583 yyexhaustedlab:
4584 yyerror (YY_("memory exhausted"));
4585 yyresult = 2;
4586 /* Fall through. */
4587 #endif
4588
4589
4590 /*-----------------------------------------------------.
4591 | yyreturn -- parsing is finished, return the result. |
4592 `-----------------------------------------------------*/
4593 yyreturn:
4594 if (yychar != YYEMPTY)
4595 {
4596 /* Make sure we have latest lookahead translation. See comments at
4597 user semantic actions for why this is necessary. */
4598 yytoken = YYTRANSLATE (yychar);
4599 yydestruct ("Cleanup: discarding lookahead",
4600 yytoken, &yylval);
4601 }
4602 /* Do not reclaim the symbols of the rule whose action triggered
4603 this YYABORT or YYACCEPT. */
4604 YYPOPSTACK (yylen);
4605 YY_STACK_PRINT (yyss, yyssp);
4606 while (yyssp != yyss)
4607 {
4608 yydestruct ("Cleanup: popping",
4609 yystos[+*yyssp], yyvsp);
4610 YYPOPSTACK (1);
4611 }
4612 #ifndef yyoverflow
4613 if (yyss != yyssa)
4614 YYSTACK_FREE (yyss);
4615 #endif
4616 #if YYERROR_VERBOSE
4617 if (yymsg != yymsgbuf)
4618 YYSTACK_FREE (yymsg);
4619 #endif
4620 return yyresult;
4621 }
4622 #line 1847 "c-exp.y"
4623
4624
4625 /* Returns a stoken of the operator name given by OP (which does not
4626 include the string "operator"). */
4627
4628 static struct stoken
operator_stoken(const char * op)4629 operator_stoken (const char *op)
4630 {
4631 struct stoken st = { NULL, 0 };
4632 char *buf;
4633
4634 st.length = CP_OPERATOR_LEN + strlen (op);
4635 buf = (char *) xmalloc (st.length + 1);
4636 strcpy (buf, CP_OPERATOR_STR);
4637 strcat (buf, op);
4638 st.ptr = buf;
4639
4640 /* The toplevel (c_parse) will free the memory allocated here. */
4641 cpstate->strings.emplace_back (buf);
4642 return st;
4643 };
4644
4645 /* Returns a stoken of the type named TYPE. */
4646
4647 static struct stoken
typename_stoken(const char * type)4648 typename_stoken (const char *type)
4649 {
4650 struct stoken st = { type, 0 };
4651 st.length = strlen (type);
4652 return st;
4653 };
4654
4655 /* Return true if the type is aggregate-like. */
4656
4657 static int
type_aggregate_p(struct type * type)4658 type_aggregate_p (struct type *type)
4659 {
4660 return (type->code () == TYPE_CODE_STRUCT
4661 || type->code () == TYPE_CODE_UNION
4662 || type->code () == TYPE_CODE_NAMESPACE
4663 || (type->code () == TYPE_CODE_ENUM
4664 && type->is_declared_class ()));
4665 }
4666
4667 /* Validate a parameter typelist. */
4668
4669 static void
check_parameter_typelist(std::vector<struct type * > * params)4670 check_parameter_typelist (std::vector<struct type *> *params)
4671 {
4672 struct type *type;
4673 int ix;
4674
4675 for (ix = 0; ix < params->size (); ++ix)
4676 {
4677 type = (*params)[ix];
4678 if (type != NULL && check_typedef (type)->code () == TYPE_CODE_VOID)
4679 {
4680 if (ix == 0)
4681 {
4682 if (params->size () == 1)
4683 {
4684 /* Ok. */
4685 break;
4686 }
4687 error (_("parameter types following 'void'"));
4688 }
4689 else
4690 error (_("'void' invalid as parameter type"));
4691 }
4692 }
4693 }
4694
4695 /* Take care of parsing a number (anything that starts with a digit).
4696 Set yylval and return the token type; update lexptr.
4697 LEN is the number of characters in it. */
4698
4699 /*** Needs some error checking for the float case ***/
4700
4701 static int
parse_number(struct parser_state * par_state,const char * buf,int len,int parsed_float,YYSTYPE * putithere)4702 parse_number (struct parser_state *par_state,
4703 const char *buf, int len, int parsed_float, YYSTYPE *putithere)
4704 {
4705 ULONGEST n = 0;
4706 ULONGEST prevn = 0;
4707 ULONGEST un;
4708
4709 int i = 0;
4710 int c;
4711 int base = input_radix;
4712 int unsigned_p = 0;
4713
4714 /* Number of "L" suffixes encountered. */
4715 int long_p = 0;
4716
4717 /* Imaginary number. */
4718 bool imaginary_p = false;
4719
4720 /* We have found a "L" or "U" (or "i") suffix. */
4721 int found_suffix = 0;
4722
4723 ULONGEST high_bit;
4724 struct type *signed_type;
4725 struct type *unsigned_type;
4726 char *p;
4727
4728 p = (char *) alloca (len);
4729 memcpy (p, buf, len);
4730
4731 if (parsed_float)
4732 {
4733 if (len >= 1 && p[len - 1] == 'i')
4734 {
4735 imaginary_p = true;
4736 --len;
4737 }
4738
4739 /* Handle suffixes for decimal floating-point: "df", "dd" or "dl". */
4740 if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'f')
4741 {
4742 putithere->typed_val_float.type
4743 = parse_type (par_state)->builtin_decfloat;
4744 len -= 2;
4745 }
4746 else if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'd')
4747 {
4748 putithere->typed_val_float.type
4749 = parse_type (par_state)->builtin_decdouble;
4750 len -= 2;
4751 }
4752 else if (len >= 2 && p[len - 2] == 'd' && p[len - 1] == 'l')
4753 {
4754 putithere->typed_val_float.type
4755 = parse_type (par_state)->builtin_declong;
4756 len -= 2;
4757 }
4758 /* Handle suffixes: 'f' for float, 'l' for long double. */
4759 else if (len >= 1 && TOLOWER (p[len - 1]) == 'f')
4760 {
4761 putithere->typed_val_float.type
4762 = parse_type (par_state)->builtin_float;
4763 len -= 1;
4764 }
4765 else if (len >= 1 && TOLOWER (p[len - 1]) == 'l')
4766 {
4767 putithere->typed_val_float.type
4768 = parse_type (par_state)->builtin_long_double;
4769 len -= 1;
4770 }
4771 /* Default type for floating-point literals is double. */
4772 else
4773 {
4774 putithere->typed_val_float.type
4775 = parse_type (par_state)->builtin_double;
4776 }
4777
4778 if (!parse_float (p, len,
4779 putithere->typed_val_float.type,
4780 putithere->typed_val_float.val))
4781 return ERROR;
4782
4783 if (imaginary_p)
4784 putithere->typed_val_float.type
4785 = init_complex_type (nullptr, putithere->typed_val_float.type);
4786
4787 return imaginary_p ? COMPLEX_FLOAT : FLOAT;
4788 }
4789
4790 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
4791 if (p[0] == '0' && len > 1)
4792 switch (p[1])
4793 {
4794 case 'x':
4795 case 'X':
4796 if (len >= 3)
4797 {
4798 p += 2;
4799 base = 16;
4800 len -= 2;
4801 }
4802 break;
4803
4804 case 'b':
4805 case 'B':
4806 if (len >= 3)
4807 {
4808 p += 2;
4809 base = 2;
4810 len -= 2;
4811 }
4812 break;
4813
4814 case 't':
4815 case 'T':
4816 case 'd':
4817 case 'D':
4818 if (len >= 3)
4819 {
4820 p += 2;
4821 base = 10;
4822 len -= 2;
4823 }
4824 break;
4825
4826 default:
4827 base = 8;
4828 break;
4829 }
4830
4831 while (len-- > 0)
4832 {
4833 c = *p++;
4834 if (c >= 'A' && c <= 'Z')
4835 c += 'a' - 'A';
4836 if (c != 'l' && c != 'u' && c != 'i')
4837 n *= base;
4838 if (c >= '0' && c <= '9')
4839 {
4840 if (found_suffix)
4841 return ERROR;
4842 n += i = c - '0';
4843 }
4844 else
4845 {
4846 if (base > 10 && c >= 'a' && c <= 'f')
4847 {
4848 if (found_suffix)
4849 return ERROR;
4850 n += i = c - 'a' + 10;
4851 }
4852 else if (c == 'l')
4853 {
4854 ++long_p;
4855 found_suffix = 1;
4856 }
4857 else if (c == 'u')
4858 {
4859 unsigned_p = 1;
4860 found_suffix = 1;
4861 }
4862 else if (c == 'i')
4863 {
4864 imaginary_p = true;
4865 found_suffix = 1;
4866 }
4867 else
4868 return ERROR; /* Char not a digit */
4869 }
4870 if (i >= base)
4871 return ERROR; /* Invalid digit in this base */
4872
4873 /* Portably test for overflow (only works for nonzero values, so make
4874 a second check for zero). FIXME: Can't we just make n and prevn
4875 unsigned and avoid this? */
4876 if (c != 'l' && c != 'u' && c != 'i' && (prevn >= n) && n != 0)
4877 unsigned_p = 1; /* Try something unsigned */
4878
4879 /* Portably test for unsigned overflow.
4880 FIXME: This check is wrong; for example it doesn't find overflow
4881 on 0x123456789 when LONGEST is 32 bits. */
4882 if (c != 'l' && c != 'u' && c != 'i' && n != 0)
4883 {
4884 if (unsigned_p && prevn >= n)
4885 error (_("Numeric constant too large."));
4886 }
4887 prevn = n;
4888 }
4889
4890 /* An integer constant is an int, a long, or a long long. An L
4891 suffix forces it to be long; an LL suffix forces it to be long
4892 long. If not forced to a larger size, it gets the first type of
4893 the above that it fits in. To figure out whether it fits, we
4894 shift it right and see whether anything remains. Note that we
4895 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
4896 operation, because many compilers will warn about such a shift
4897 (which always produces a zero result). Sometimes gdbarch_int_bit
4898 or gdbarch_long_bit will be that big, sometimes not. To deal with
4899 the case where it is we just always shift the value more than
4900 once, with fewer bits each time. */
4901
4902 un = n >> 2;
4903 if (long_p == 0
4904 && (un >> (gdbarch_int_bit (par_state->gdbarch ()) - 2)) == 0)
4905 {
4906 high_bit
4907 = ((ULONGEST)1) << (gdbarch_int_bit (par_state->gdbarch ()) - 1);
4908
4909 /* A large decimal (not hex or octal) constant (between INT_MAX
4910 and UINT_MAX) is a long or unsigned long, according to ANSI,
4911 never an unsigned int, but this code treats it as unsigned
4912 int. This probably should be fixed. GCC gives a warning on
4913 such constants. */
4914
4915 unsigned_type = parse_type (par_state)->builtin_unsigned_int;
4916 signed_type = parse_type (par_state)->builtin_int;
4917 }
4918 else if (long_p <= 1
4919 && (un >> (gdbarch_long_bit (par_state->gdbarch ()) - 2)) == 0)
4920 {
4921 high_bit
4922 = ((ULONGEST)1) << (gdbarch_long_bit (par_state->gdbarch ()) - 1);
4923 unsigned_type = parse_type (par_state)->builtin_unsigned_long;
4924 signed_type = parse_type (par_state)->builtin_long;
4925 }
4926 else
4927 {
4928 int shift;
4929 if (sizeof (ULONGEST) * HOST_CHAR_BIT
4930 < gdbarch_long_long_bit (par_state->gdbarch ()))
4931 /* A long long does not fit in a LONGEST. */
4932 shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
4933 else
4934 shift = (gdbarch_long_long_bit (par_state->gdbarch ()) - 1);
4935 high_bit = (ULONGEST) 1 << shift;
4936 unsigned_type = parse_type (par_state)->builtin_unsigned_long_long;
4937 signed_type = parse_type (par_state)->builtin_long_long;
4938 }
4939
4940 putithere->typed_val_int.val = n;
4941
4942 /* If the high bit of the worked out type is set then this number
4943 has to be unsigned. */
4944
4945 if (unsigned_p || (n & high_bit))
4946 {
4947 putithere->typed_val_int.type = unsigned_type;
4948 }
4949 else
4950 {
4951 putithere->typed_val_int.type = signed_type;
4952 }
4953
4954 if (imaginary_p)
4955 putithere->typed_val_int.type
4956 = init_complex_type (nullptr, putithere->typed_val_int.type);
4957
4958 return imaginary_p ? COMPLEX_INT : INT;
4959 }
4960
4961 /* Temporary obstack used for holding strings. */
4962 static struct obstack tempbuf;
4963 static int tempbuf_init;
4964
4965 /* Parse a C escape sequence. The initial backslash of the sequence
4966 is at (*PTR)[-1]. *PTR will be updated to point to just after the
4967 last character of the sequence. If OUTPUT is not NULL, the
4968 translated form of the escape sequence will be written there. If
4969 OUTPUT is NULL, no output is written and the call will only affect
4970 *PTR. If an escape sequence is expressed in target bytes, then the
4971 entire sequence will simply be copied to OUTPUT. Return 1 if any
4972 character was emitted, 0 otherwise. */
4973
4974 int
c_parse_escape(const char ** ptr,struct obstack * output)4975 c_parse_escape (const char **ptr, struct obstack *output)
4976 {
4977 const char *tokptr = *ptr;
4978 int result = 1;
4979
4980 /* Some escape sequences undergo character set conversion. Those we
4981 translate here. */
4982 switch (*tokptr)
4983 {
4984 /* Hex escapes do not undergo character set conversion, so keep
4985 the escape sequence for later. */
4986 case 'x':
4987 if (output)
4988 obstack_grow_str (output, "\\x");
4989 ++tokptr;
4990 if (!ISXDIGIT (*tokptr))
4991 error (_("\\x escape without a following hex digit"));
4992 while (ISXDIGIT (*tokptr))
4993 {
4994 if (output)
4995 obstack_1grow (output, *tokptr);
4996 ++tokptr;
4997 }
4998 break;
4999
5000 /* Octal escapes do not undergo character set conversion, so
5001 keep the escape sequence for later. */
5002 case '0':
5003 case '1':
5004 case '2':
5005 case '3':
5006 case '4':
5007 case '5':
5008 case '6':
5009 case '7':
5010 {
5011 int i;
5012 if (output)
5013 obstack_grow_str (output, "\\");
5014 for (i = 0;
5015 i < 3 && ISDIGIT (*tokptr) && *tokptr != '8' && *tokptr != '9';
5016 ++i)
5017 {
5018 if (output)
5019 obstack_1grow (output, *tokptr);
5020 ++tokptr;
5021 }
5022 }
5023 break;
5024
5025 /* We handle UCNs later. We could handle them here, but that
5026 would mean a spurious error in the case where the UCN could
5027 be converted to the target charset but not the host
5028 charset. */
5029 case 'u':
5030 case 'U':
5031 {
5032 char c = *tokptr;
5033 int i, len = c == 'U' ? 8 : 4;
5034 if (output)
5035 {
5036 obstack_1grow (output, '\\');
5037 obstack_1grow (output, *tokptr);
5038 }
5039 ++tokptr;
5040 if (!ISXDIGIT (*tokptr))
5041 error (_("\\%c escape without a following hex digit"), c);
5042 for (i = 0; i < len && ISXDIGIT (*tokptr); ++i)
5043 {
5044 if (output)
5045 obstack_1grow (output, *tokptr);
5046 ++tokptr;
5047 }
5048 }
5049 break;
5050
5051 /* We must pass backslash through so that it does not
5052 cause quoting during the second expansion. */
5053 case '\\':
5054 if (output)
5055 obstack_grow_str (output, "\\\\");
5056 ++tokptr;
5057 break;
5058
5059 /* Escapes which undergo conversion. */
5060 case 'a':
5061 if (output)
5062 obstack_1grow (output, '\a');
5063 ++tokptr;
5064 break;
5065 case 'b':
5066 if (output)
5067 obstack_1grow (output, '\b');
5068 ++tokptr;
5069 break;
5070 case 'f':
5071 if (output)
5072 obstack_1grow (output, '\f');
5073 ++tokptr;
5074 break;
5075 case 'n':
5076 if (output)
5077 obstack_1grow (output, '\n');
5078 ++tokptr;
5079 break;
5080 case 'r':
5081 if (output)
5082 obstack_1grow (output, '\r');
5083 ++tokptr;
5084 break;
5085 case 't':
5086 if (output)
5087 obstack_1grow (output, '\t');
5088 ++tokptr;
5089 break;
5090 case 'v':
5091 if (output)
5092 obstack_1grow (output, '\v');
5093 ++tokptr;
5094 break;
5095
5096 /* GCC extension. */
5097 case 'e':
5098 if (output)
5099 obstack_1grow (output, HOST_ESCAPE_CHAR);
5100 ++tokptr;
5101 break;
5102
5103 /* Backslash-newline expands to nothing at all. */
5104 case '\n':
5105 ++tokptr;
5106 result = 0;
5107 break;
5108
5109 /* A few escapes just expand to the character itself. */
5110 case '\'':
5111 case '\"':
5112 case '?':
5113 /* GCC extensions. */
5114 case '(':
5115 case '{':
5116 case '[':
5117 case '%':
5118 /* Unrecognized escapes turn into the character itself. */
5119 default:
5120 if (output)
5121 obstack_1grow (output, *tokptr);
5122 ++tokptr;
5123 break;
5124 }
5125 *ptr = tokptr;
5126 return result;
5127 }
5128
5129 /* Parse a string or character literal from TOKPTR. The string or
5130 character may be wide or unicode. *OUTPTR is set to just after the
5131 end of the literal in the input string. The resulting token is
5132 stored in VALUE. This returns a token value, either STRING or
5133 CHAR, depending on what was parsed. *HOST_CHARS is set to the
5134 number of host characters in the literal. */
5135
5136 static int
parse_string_or_char(const char * tokptr,const char ** outptr,struct typed_stoken * value,int * host_chars)5137 parse_string_or_char (const char *tokptr, const char **outptr,
5138 struct typed_stoken *value, int *host_chars)
5139 {
5140 int quote;
5141 c_string_type type;
5142 int is_objc = 0;
5143
5144 /* Build the gdb internal form of the input string in tempbuf. Note
5145 that the buffer is null byte terminated *only* for the
5146 convenience of debugging gdb itself and printing the buffer
5147 contents when the buffer contains no embedded nulls. Gdb does
5148 not depend upon the buffer being null byte terminated, it uses
5149 the length string instead. This allows gdb to handle C strings
5150 (as well as strings in other languages) with embedded null
5151 bytes */
5152
5153 if (!tempbuf_init)
5154 tempbuf_init = 1;
5155 else
5156 obstack_free (&tempbuf, NULL);
5157 obstack_init (&tempbuf);
5158
5159 /* Record the string type. */
5160 if (*tokptr == 'L')
5161 {
5162 type = C_WIDE_STRING;
5163 ++tokptr;
5164 }
5165 else if (*tokptr == 'u')
5166 {
5167 type = C_STRING_16;
5168 ++tokptr;
5169 }
5170 else if (*tokptr == 'U')
5171 {
5172 type = C_STRING_32;
5173 ++tokptr;
5174 }
5175 else if (*tokptr == '@')
5176 {
5177 /* An Objective C string. */
5178 is_objc = 1;
5179 type = C_STRING;
5180 ++tokptr;
5181 }
5182 else
5183 type = C_STRING;
5184
5185 /* Skip the quote. */
5186 quote = *tokptr;
5187 if (quote == '\'')
5188 type |= C_CHAR;
5189 ++tokptr;
5190
5191 *host_chars = 0;
5192
5193 while (*tokptr)
5194 {
5195 char c = *tokptr;
5196 if (c == '\\')
5197 {
5198 ++tokptr;
5199 *host_chars += c_parse_escape (&tokptr, &tempbuf);
5200 }
5201 else if (c == quote)
5202 break;
5203 else
5204 {
5205 obstack_1grow (&tempbuf, c);
5206 ++tokptr;
5207 /* FIXME: this does the wrong thing with multi-byte host
5208 characters. We could use mbrlen here, but that would
5209 make "set host-charset" a bit less useful. */
5210 ++*host_chars;
5211 }
5212 }
5213
5214 if (*tokptr != quote)
5215 {
5216 if (quote == '"')
5217 error (_("Unterminated string in expression."));
5218 else
5219 error (_("Unmatched single quote."));
5220 }
5221 ++tokptr;
5222
5223 value->type = type;
5224 value->ptr = (char *) obstack_base (&tempbuf);
5225 value->length = obstack_object_size (&tempbuf);
5226
5227 *outptr = tokptr;
5228
5229 return quote == '"' ? (is_objc ? NSSTRING : STRING) : CHAR;
5230 }
5231
5232 /* This is used to associate some attributes with a token. */
5233
5234 enum token_flag
5235 {
5236 /* If this bit is set, the token is C++-only. */
5237
5238 FLAG_CXX = 1,
5239
5240 /* If this bit is set, the token is C-only. */
5241
5242 FLAG_C = 2,
5243
5244 /* If this bit is set, the token is conditional: if there is a
5245 symbol of the same name, then the token is a symbol; otherwise,
5246 the token is a keyword. */
5247
5248 FLAG_SHADOW = 4
5249 };
5250 DEF_ENUM_FLAGS_TYPE (enum token_flag, token_flags);
5251
5252 struct token
5253 {
5254 const char *oper;
5255 int token;
5256 enum exp_opcode opcode;
5257 token_flags flags;
5258 };
5259
5260 static const struct token tokentab3[] =
5261 {
5262 {">>=", ASSIGN_MODIFY, BINOP_RSH, 0},
5263 {"<<=", ASSIGN_MODIFY, BINOP_LSH, 0},
5264 {"->*", ARROW_STAR, OP_NULL, FLAG_CXX},
5265 {"...", DOTDOTDOT, OP_NULL, 0}
5266 };
5267
5268 static const struct token tokentab2[] =
5269 {
5270 {"+=", ASSIGN_MODIFY, BINOP_ADD, 0},
5271 {"-=", ASSIGN_MODIFY, BINOP_SUB, 0},
5272 {"*=", ASSIGN_MODIFY, BINOP_MUL, 0},
5273 {"/=", ASSIGN_MODIFY, BINOP_DIV, 0},
5274 {"%=", ASSIGN_MODIFY, BINOP_REM, 0},
5275 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR, 0},
5276 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND, 0},
5277 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR, 0},
5278 {"++", INCREMENT, OP_NULL, 0},
5279 {"--", DECREMENT, OP_NULL, 0},
5280 {"->", ARROW, OP_NULL, 0},
5281 {"&&", ANDAND, OP_NULL, 0},
5282 {"||", OROR, OP_NULL, 0},
5283 /* "::" is *not* only C++: gdb overrides its meaning in several
5284 different ways, e.g., 'filename'::func, function::variable. */
5285 {"::", COLONCOLON, OP_NULL, 0},
5286 {"<<", LSH, OP_NULL, 0},
5287 {">>", RSH, OP_NULL, 0},
5288 {"==", EQUAL, OP_NULL, 0},
5289 {"!=", NOTEQUAL, OP_NULL, 0},
5290 {"<=", LEQ, OP_NULL, 0},
5291 {">=", GEQ, OP_NULL, 0},
5292 {".*", DOT_STAR, OP_NULL, FLAG_CXX}
5293 };
5294
5295 /* Identifier-like tokens. Only type-specifiers than can appear in
5296 multi-word type names (for example 'double' can appear in 'long
5297 double') need to be listed here. type-specifiers that are only ever
5298 single word (like 'char') are handled by the classify_name function. */
5299 static const struct token ident_tokens[] =
5300 {
5301 {"unsigned", UNSIGNED, OP_NULL, 0},
5302 {"template", TEMPLATE, OP_NULL, FLAG_CXX},
5303 {"volatile", VOLATILE_KEYWORD, OP_NULL, 0},
5304 {"struct", STRUCT, OP_NULL, 0},
5305 {"signed", SIGNED_KEYWORD, OP_NULL, 0},
5306 {"sizeof", SIZEOF, OP_NULL, 0},
5307 {"_Alignof", ALIGNOF, OP_NULL, 0},
5308 {"alignof", ALIGNOF, OP_NULL, FLAG_CXX},
5309 {"double", DOUBLE_KEYWORD, OP_NULL, 0},
5310 {"float", FLOAT_KEYWORD, OP_NULL, 0},
5311 {"false", FALSEKEYWORD, OP_NULL, FLAG_CXX},
5312 {"class", CLASS, OP_NULL, FLAG_CXX},
5313 {"union", UNION, OP_NULL, 0},
5314 {"short", SHORT, OP_NULL, 0},
5315 {"const", CONST_KEYWORD, OP_NULL, 0},
5316 {"restrict", RESTRICT, OP_NULL, FLAG_C | FLAG_SHADOW},
5317 {"__restrict__", RESTRICT, OP_NULL, 0},
5318 {"__restrict", RESTRICT, OP_NULL, 0},
5319 {"_Atomic", ATOMIC, OP_NULL, 0},
5320 {"enum", ENUM, OP_NULL, 0},
5321 {"long", LONG, OP_NULL, 0},
5322 {"_Complex", COMPLEX, OP_NULL, 0},
5323 {"__complex__", COMPLEX, OP_NULL, 0},
5324
5325 {"true", TRUEKEYWORD, OP_NULL, FLAG_CXX},
5326 {"int", INT_KEYWORD, OP_NULL, 0},
5327 {"new", NEW, OP_NULL, FLAG_CXX},
5328 {"delete", DELETE, OP_NULL, FLAG_CXX},
5329 {"operator", OPERATOR, OP_NULL, FLAG_CXX},
5330
5331 {"and", ANDAND, OP_NULL, FLAG_CXX},
5332 {"and_eq", ASSIGN_MODIFY, BINOP_BITWISE_AND, FLAG_CXX},
5333 {"bitand", '&', OP_NULL, FLAG_CXX},
5334 {"bitor", '|', OP_NULL, FLAG_CXX},
5335 {"compl", '~', OP_NULL, FLAG_CXX},
5336 {"not", '!', OP_NULL, FLAG_CXX},
5337 {"not_eq", NOTEQUAL, OP_NULL, FLAG_CXX},
5338 {"or", OROR, OP_NULL, FLAG_CXX},
5339 {"or_eq", ASSIGN_MODIFY, BINOP_BITWISE_IOR, FLAG_CXX},
5340 {"xor", '^', OP_NULL, FLAG_CXX},
5341 {"xor_eq", ASSIGN_MODIFY, BINOP_BITWISE_XOR, FLAG_CXX},
5342
5343 {"const_cast", CONST_CAST, OP_NULL, FLAG_CXX },
5344 {"dynamic_cast", DYNAMIC_CAST, OP_NULL, FLAG_CXX },
5345 {"static_cast", STATIC_CAST, OP_NULL, FLAG_CXX },
5346 {"reinterpret_cast", REINTERPRET_CAST, OP_NULL, FLAG_CXX },
5347
5348 {"__typeof__", TYPEOF, OP_TYPEOF, 0 },
5349 {"__typeof", TYPEOF, OP_TYPEOF, 0 },
5350 {"typeof", TYPEOF, OP_TYPEOF, FLAG_SHADOW },
5351 {"__decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX },
5352 {"decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX | FLAG_SHADOW },
5353
5354 {"typeid", TYPEID, OP_TYPEID, FLAG_CXX}
5355 };
5356
5357
5358 static void
scan_macro_expansion(const char * expansion)5359 scan_macro_expansion (const char *expansion)
5360 {
5361 /* We'd better not be trying to push the stack twice. */
5362 gdb_assert (! cpstate->macro_original_text);
5363
5364 /* Copy to the obstack. */
5365 const char *copy = obstack_strdup (&cpstate->expansion_obstack, expansion);
5366
5367 /* Save the old lexptr value, so we can return to it when we're done
5368 parsing the expanded text. */
5369 cpstate->macro_original_text = pstate->lexptr;
5370 pstate->lexptr = copy;
5371 }
5372
5373 static int
scanning_macro_expansion(void)5374 scanning_macro_expansion (void)
5375 {
5376 return cpstate->macro_original_text != 0;
5377 }
5378
5379 static void
finished_macro_expansion(void)5380 finished_macro_expansion (void)
5381 {
5382 /* There'd better be something to pop back to. */
5383 gdb_assert (cpstate->macro_original_text);
5384
5385 /* Pop back to the original text. */
5386 pstate->lexptr = cpstate->macro_original_text;
5387 cpstate->macro_original_text = 0;
5388 }
5389
5390 /* Return true iff the token represents a C++ cast operator. */
5391
5392 static int
is_cast_operator(const char * token,int len)5393 is_cast_operator (const char *token, int len)
5394 {
5395 return (! strncmp (token, "dynamic_cast", len)
5396 || ! strncmp (token, "static_cast", len)
5397 || ! strncmp (token, "reinterpret_cast", len)
5398 || ! strncmp (token, "const_cast", len));
5399 }
5400
5401 /* The scope used for macro expansion. */
5402 static struct macro_scope *expression_macro_scope;
5403
5404 /* This is set if a NAME token appeared at the very end of the input
5405 string, with no whitespace separating the name from the EOF. This
5406 is used only when parsing to do field name completion. */
5407 static int saw_name_at_eof;
5408
5409 /* This is set if the previously-returned token was a structure
5410 operator -- either '.' or ARROW. */
5411 static bool last_was_structop;
5412
5413 /* Depth of parentheses. */
5414 static int paren_depth;
5415
5416 /* Read one token, getting characters through lexptr. */
5417
5418 static int
lex_one_token(struct parser_state * par_state,bool * is_quoted_name)5419 lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
5420 {
5421 int c;
5422 int namelen;
5423 unsigned int i;
5424 const char *tokstart;
5425 bool saw_structop = last_was_structop;
5426
5427 last_was_structop = false;
5428 *is_quoted_name = false;
5429
5430 retry:
5431
5432 /* Check if this is a macro invocation that we need to expand. */
5433 if (! scanning_macro_expansion ())
5434 {
5435 gdb::unique_xmalloc_ptr<char> expanded
5436 = macro_expand_next (&pstate->lexptr, *expression_macro_scope);
5437
5438 if (expanded != nullptr)
5439 scan_macro_expansion (expanded.get ());
5440 }
5441
5442 pstate->prev_lexptr = pstate->lexptr;
5443
5444 tokstart = pstate->lexptr;
5445 /* See if it is a special token of length 3. */
5446 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
5447 if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
5448 {
5449 if ((tokentab3[i].flags & FLAG_CXX) != 0
5450 && par_state->language ()->la_language != language_cplus)
5451 break;
5452 gdb_assert ((tokentab3[i].flags & FLAG_C) == 0);
5453
5454 pstate->lexptr += 3;
5455 yylval.opcode = tokentab3[i].opcode;
5456 return tokentab3[i].token;
5457 }
5458
5459 /* See if it is a special token of length 2. */
5460 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
5461 if (strncmp (tokstart, tokentab2[i].oper, 2) == 0)
5462 {
5463 if ((tokentab2[i].flags & FLAG_CXX) != 0
5464 && par_state->language ()->la_language != language_cplus)
5465 break;
5466 gdb_assert ((tokentab2[i].flags & FLAG_C) == 0);
5467
5468 pstate->lexptr += 2;
5469 yylval.opcode = tokentab2[i].opcode;
5470 if (tokentab2[i].token == ARROW)
5471 last_was_structop = 1;
5472 return tokentab2[i].token;
5473 }
5474
5475 switch (c = *tokstart)
5476 {
5477 case 0:
5478 /* If we were just scanning the result of a macro expansion,
5479 then we need to resume scanning the original text.
5480 If we're parsing for field name completion, and the previous
5481 token allows such completion, return a COMPLETE token.
5482 Otherwise, we were already scanning the original text, and
5483 we're really done. */
5484 if (scanning_macro_expansion ())
5485 {
5486 finished_macro_expansion ();
5487 goto retry;
5488 }
5489 else if (saw_name_at_eof)
5490 {
5491 saw_name_at_eof = 0;
5492 return COMPLETE;
5493 }
5494 else if (par_state->parse_completion && saw_structop)
5495 return COMPLETE;
5496 else
5497 return 0;
5498
5499 case ' ':
5500 case '\t':
5501 case '\n':
5502 pstate->lexptr++;
5503 goto retry;
5504
5505 case '[':
5506 case '(':
5507 paren_depth++;
5508 pstate->lexptr++;
5509 if (par_state->language ()->la_language == language_objc
5510 && c == '[')
5511 return OBJC_LBRAC;
5512 return c;
5513
5514 case ']':
5515 case ')':
5516 if (paren_depth == 0)
5517 return 0;
5518 paren_depth--;
5519 pstate->lexptr++;
5520 return c;
5521
5522 case ',':
5523 if (pstate->comma_terminates
5524 && paren_depth == 0
5525 && ! scanning_macro_expansion ())
5526 return 0;
5527 pstate->lexptr++;
5528 return c;
5529
5530 case '.':
5531 /* Might be a floating point number. */
5532 if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9')
5533 {
5534 last_was_structop = true;
5535 goto symbol; /* Nope, must be a symbol. */
5536 }
5537 /* FALL THRU. */
5538
5539 case '0':
5540 case '1':
5541 case '2':
5542 case '3':
5543 case '4':
5544 case '5':
5545 case '6':
5546 case '7':
5547 case '8':
5548 case '9':
5549 {
5550 /* It's a number. */
5551 int got_dot = 0, got_e = 0, got_p = 0, toktype;
5552 const char *p = tokstart;
5553 int hex = input_radix > 10;
5554
5555 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
5556 {
5557 p += 2;
5558 hex = 1;
5559 }
5560 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
5561 {
5562 p += 2;
5563 hex = 0;
5564 }
5565
5566 for (;; ++p)
5567 {
5568 /* This test includes !hex because 'e' is a valid hex digit
5569 and thus does not indicate a floating point number when
5570 the radix is hex. */
5571 if (!hex && !got_e && !got_p && (*p == 'e' || *p == 'E'))
5572 got_dot = got_e = 1;
5573 else if (!got_e && !got_p && (*p == 'p' || *p == 'P'))
5574 got_dot = got_p = 1;
5575 /* This test does not include !hex, because a '.' always indicates
5576 a decimal floating point number regardless of the radix. */
5577 else if (!got_dot && *p == '.')
5578 got_dot = 1;
5579 else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
5580 || (got_p && (p[-1] == 'p' || p[-1] == 'P')))
5581 && (*p == '-' || *p == '+'))
5582 /* This is the sign of the exponent, not the end of the
5583 number. */
5584 continue;
5585 /* We will take any letters or digits. parse_number will
5586 complain if past the radix, or if L or U are not final. */
5587 else if ((*p < '0' || *p > '9')
5588 && ((*p < 'a' || *p > 'z')
5589 && (*p < 'A' || *p > 'Z')))
5590 break;
5591 }
5592 toktype = parse_number (par_state, tokstart, p - tokstart,
5593 got_dot | got_e | got_p, &yylval);
5594 if (toktype == ERROR)
5595 {
5596 char *err_copy = (char *) alloca (p - tokstart + 1);
5597
5598 memcpy (err_copy, tokstart, p - tokstart);
5599 err_copy[p - tokstart] = 0;
5600 error (_("Invalid number \"%s\"."), err_copy);
5601 }
5602 pstate->lexptr = p;
5603 return toktype;
5604 }
5605
5606 case '@':
5607 {
5608 const char *p = &tokstart[1];
5609
5610 if (par_state->language ()->la_language == language_objc)
5611 {
5612 size_t len = strlen ("selector");
5613
5614 if (strncmp (p, "selector", len) == 0
5615 && (p[len] == '\0' || ISSPACE (p[len])))
5616 {
5617 pstate->lexptr = p + len;
5618 return SELECTOR;
5619 }
5620 else if (*p == '"')
5621 goto parse_string;
5622 }
5623
5624 while (ISSPACE (*p))
5625 p++;
5626 size_t len = strlen ("entry");
5627 if (strncmp (p, "entry", len) == 0 && !c_ident_is_alnum (p[len])
5628 && p[len] != '_')
5629 {
5630 pstate->lexptr = &p[len];
5631 return ENTRY;
5632 }
5633 }
5634 /* FALLTHRU */
5635 case '+':
5636 case '-':
5637 case '*':
5638 case '/':
5639 case '%':
5640 case '|':
5641 case '&':
5642 case '^':
5643 case '~':
5644 case '!':
5645 case '<':
5646 case '>':
5647 case '?':
5648 case ':':
5649 case '=':
5650 case '{':
5651 case '}':
5652 symbol:
5653 pstate->lexptr++;
5654 return c;
5655
5656 case 'L':
5657 case 'u':
5658 case 'U':
5659 if (tokstart[1] != '"' && tokstart[1] != '\'')
5660 break;
5661 /* Fall through. */
5662 case '\'':
5663 case '"':
5664
5665 parse_string:
5666 {
5667 int host_len;
5668 int result = parse_string_or_char (tokstart, &pstate->lexptr,
5669 &yylval.tsval, &host_len);
5670 if (result == CHAR)
5671 {
5672 if (host_len == 0)
5673 error (_("Empty character constant."));
5674 else if (host_len > 2 && c == '\'')
5675 {
5676 ++tokstart;
5677 namelen = pstate->lexptr - tokstart - 1;
5678 *is_quoted_name = true;
5679
5680 goto tryname;
5681 }
5682 else if (host_len > 1)
5683 error (_("Invalid character constant."));
5684 }
5685 return result;
5686 }
5687 }
5688
5689 if (!(c == '_' || c == '$' || c_ident_is_alpha (c)))
5690 /* We must have come across a bad character (e.g. ';'). */
5691 error (_("Invalid character '%c' in expression."), c);
5692
5693 /* It's a name. See how long it is. */
5694 namelen = 0;
5695 for (c = tokstart[namelen];
5696 (c == '_' || c == '$' || c_ident_is_alnum (c) || c == '<');)
5697 {
5698 /* Template parameter lists are part of the name.
5699 FIXME: This mishandles `print $a<4&&$a>3'. */
5700
5701 if (c == '<')
5702 {
5703 if (! is_cast_operator (tokstart, namelen))
5704 {
5705 /* Scan ahead to get rest of the template specification. Note
5706 that we look ahead only when the '<' adjoins non-whitespace
5707 characters; for comparison expressions, e.g. "a < b > c",
5708 there must be spaces before the '<', etc. */
5709 const char *p = find_template_name_end (tokstart + namelen);
5710
5711 if (p)
5712 namelen = p - tokstart;
5713 }
5714 break;
5715 }
5716 c = tokstart[++namelen];
5717 }
5718
5719 /* The token "if" terminates the expression and is NOT removed from
5720 the input stream. It doesn't count if it appears in the
5721 expansion of a macro. */
5722 if (namelen == 2
5723 && tokstart[0] == 'i'
5724 && tokstart[1] == 'f'
5725 && ! scanning_macro_expansion ())
5726 {
5727 return 0;
5728 }
5729
5730 /* For the same reason (breakpoint conditions), "thread N"
5731 terminates the expression. "thread" could be an identifier, but
5732 an identifier is never followed by a number without intervening
5733 punctuation. "task" is similar. Handle abbreviations of these,
5734 similarly to breakpoint.c:find_condition_and_thread. */
5735 if (namelen >= 1
5736 && (strncmp (tokstart, "thread", namelen) == 0
5737 || strncmp (tokstart, "task", namelen) == 0)
5738 && (tokstart[namelen] == ' ' || tokstart[namelen] == '\t')
5739 && ! scanning_macro_expansion ())
5740 {
5741 const char *p = tokstart + namelen + 1;
5742
5743 while (*p == ' ' || *p == '\t')
5744 p++;
5745 if (*p >= '0' && *p <= '9')
5746 return 0;
5747 }
5748
5749 pstate->lexptr += namelen;
5750
5751 tryname:
5752
5753 yylval.sval.ptr = tokstart;
5754 yylval.sval.length = namelen;
5755
5756 /* Catch specific keywords. */
5757 std::string copy = copy_name (yylval.sval);
5758 for (i = 0; i < sizeof ident_tokens / sizeof ident_tokens[0]; i++)
5759 if (copy == ident_tokens[i].oper)
5760 {
5761 if ((ident_tokens[i].flags & FLAG_CXX) != 0
5762 && par_state->language ()->la_language != language_cplus)
5763 break;
5764 if ((ident_tokens[i].flags & FLAG_C) != 0
5765 && par_state->language ()->la_language != language_c
5766 && par_state->language ()->la_language != language_objc)
5767 break;
5768
5769 if ((ident_tokens[i].flags & FLAG_SHADOW) != 0)
5770 {
5771 struct field_of_this_result is_a_field_of_this;
5772
5773 if (lookup_symbol (copy.c_str (),
5774 pstate->expression_context_block,
5775 VAR_DOMAIN,
5776 (par_state->language ()->la_language
5777 == language_cplus ? &is_a_field_of_this
5778 : NULL)).symbol
5779 != NULL)
5780 {
5781 /* The keyword is shadowed. */
5782 break;
5783 }
5784 }
5785
5786 /* It is ok to always set this, even though we don't always
5787 strictly need to. */
5788 yylval.opcode = ident_tokens[i].opcode;
5789 return ident_tokens[i].token;
5790 }
5791
5792 if (*tokstart == '$')
5793 return DOLLAR_VARIABLE;
5794
5795 if (pstate->parse_completion && *pstate->lexptr == '\0')
5796 saw_name_at_eof = 1;
5797
5798 yylval.ssym.stoken = yylval.sval;
5799 yylval.ssym.sym.symbol = NULL;
5800 yylval.ssym.sym.block = NULL;
5801 yylval.ssym.is_a_field_of_this = 0;
5802 return NAME;
5803 }
5804
5805 /* An object of this type is pushed on a FIFO by the "outer" lexer. */
5806 struct token_and_value
5807 {
5808 int token;
5809 YYSTYPE value;
5810 };
5811
5812 /* A FIFO of tokens that have been read but not yet returned to the
5813 parser. */
5814 static std::vector<token_and_value> token_fifo;
5815
5816 /* Non-zero if the lexer should return tokens from the FIFO. */
5817 static int popping;
5818
5819 /* Temporary storage for c_lex; this holds symbol names as they are
5820 built up. */
5821 static auto_obstack name_obstack;
5822
5823 /* Classify a NAME token. The contents of the token are in `yylval'.
5824 Updates yylval and returns the new token type. BLOCK is the block
5825 in which lookups start; this can be NULL to mean the global scope.
5826 IS_QUOTED_NAME is non-zero if the name token was originally quoted
5827 in single quotes. IS_AFTER_STRUCTOP is true if this name follows
5828 a structure operator -- either '.' or ARROW */
5829
5830 static int
classify_name(struct parser_state * par_state,const struct block * block,bool is_quoted_name,bool is_after_structop)5831 classify_name (struct parser_state *par_state, const struct block *block,
5832 bool is_quoted_name, bool is_after_structop)
5833 {
5834 struct block_symbol bsym;
5835 struct field_of_this_result is_a_field_of_this;
5836
5837 std::string copy = copy_name (yylval.sval);
5838
5839 /* Initialize this in case we *don't* use it in this call; that way
5840 we can refer to it unconditionally below. */
5841 memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
5842
5843 bsym = lookup_symbol (copy.c_str (), block, VAR_DOMAIN,
5844 par_state->language ()->name_of_this ()
5845 ? &is_a_field_of_this : NULL);
5846
5847 if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_BLOCK)
5848 {
5849 yylval.ssym.sym = bsym;
5850 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
5851 return BLOCKNAME;
5852 }
5853 else if (!bsym.symbol)
5854 {
5855 /* If we found a field of 'this', we might have erroneously
5856 found a constructor where we wanted a type name. Handle this
5857 case by noticing that we found a constructor and then look up
5858 the type tag instead. */
5859 if (is_a_field_of_this.type != NULL
5860 && is_a_field_of_this.fn_field != NULL
5861 && TYPE_FN_FIELD_CONSTRUCTOR (is_a_field_of_this.fn_field->fn_fields,
5862 0))
5863 {
5864 struct field_of_this_result inner_is_a_field_of_this;
5865
5866 bsym = lookup_symbol (copy.c_str (), block, STRUCT_DOMAIN,
5867 &inner_is_a_field_of_this);
5868 if (bsym.symbol != NULL)
5869 {
5870 yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
5871 return TYPENAME;
5872 }
5873 }
5874
5875 /* If we found a field on the "this" object, or we are looking
5876 up a field on a struct, then we want to prefer it over a
5877 filename. However, if the name was quoted, then it is better
5878 to check for a filename or a block, since this is the only
5879 way the user has of requiring the extension to be used. */
5880 if ((is_a_field_of_this.type == NULL && !is_after_structop)
5881 || is_quoted_name)
5882 {
5883 /* See if it's a file name. */
5884 struct symtab *symtab;
5885
5886 symtab = lookup_symtab (copy.c_str ());
5887 if (symtab)
5888 {
5889 yylval.bval = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symtab),
5890 STATIC_BLOCK);
5891 return FILENAME;
5892 }
5893 }
5894 }
5895
5896 if (bsym.symbol && SYMBOL_CLASS (bsym.symbol) == LOC_TYPEDEF)
5897 {
5898 yylval.tsym.type = SYMBOL_TYPE (bsym.symbol);
5899 return TYPENAME;
5900 }
5901
5902 /* See if it's an ObjC classname. */
5903 if (par_state->language ()->la_language == language_objc && !bsym.symbol)
5904 {
5905 CORE_ADDR Class = lookup_objc_class (par_state->gdbarch (),
5906 copy.c_str ());
5907 if (Class)
5908 {
5909 struct symbol *sym;
5910
5911 yylval.theclass.theclass = Class;
5912 sym = lookup_struct_typedef (copy.c_str (),
5913 par_state->expression_context_block, 1);
5914 if (sym)
5915 yylval.theclass.type = SYMBOL_TYPE (sym);
5916 return CLASSNAME;
5917 }
5918 }
5919
5920 /* Input names that aren't symbols but ARE valid hex numbers, when
5921 the input radix permits them, can be names or numbers depending
5922 on the parse. Note we support radixes > 16 here. */
5923 if (!bsym.symbol
5924 && ((copy[0] >= 'a' && copy[0] < 'a' + input_radix - 10)
5925 || (copy[0] >= 'A' && copy[0] < 'A' + input_radix - 10)))
5926 {
5927 YYSTYPE newlval; /* Its value is ignored. */
5928 int hextype = parse_number (par_state, copy.c_str (), yylval.sval.length,
5929 0, &newlval);
5930
5931 if (hextype == INT)
5932 {
5933 yylval.ssym.sym = bsym;
5934 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
5935 return NAME_OR_INT;
5936 }
5937 }
5938
5939 /* Any other kind of symbol */
5940 yylval.ssym.sym = bsym;
5941 yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
5942
5943 if (bsym.symbol == NULL
5944 && par_state->language ()->la_language == language_cplus
5945 && is_a_field_of_this.type == NULL
5946 && lookup_minimal_symbol (copy.c_str (), NULL, NULL).minsym == NULL)
5947 return UNKNOWN_CPP_NAME;
5948
5949 return NAME;
5950 }
5951
5952 /* Like classify_name, but used by the inner loop of the lexer, when a
5953 name might have already been seen. CONTEXT is the context type, or
5954 NULL if this is the first component of a name. */
5955
5956 static int
classify_inner_name(struct parser_state * par_state,const struct block * block,struct type * context)5957 classify_inner_name (struct parser_state *par_state,
5958 const struct block *block, struct type *context)
5959 {
5960 struct type *type;
5961
5962 if (context == NULL)
5963 return classify_name (par_state, block, false, false);
5964
5965 type = check_typedef (context);
5966 if (!type_aggregate_p (type))
5967 return ERROR;
5968
5969 std::string copy = copy_name (yylval.ssym.stoken);
5970 /* N.B. We assume the symbol can only be in VAR_DOMAIN. */
5971 yylval.ssym.sym = cp_lookup_nested_symbol (type, copy.c_str (), block,
5972 VAR_DOMAIN);
5973
5974 /* If no symbol was found, search for a matching base class named
5975 COPY. This will allow users to enter qualified names of class members
5976 relative to the `this' pointer. */
5977 if (yylval.ssym.sym.symbol == NULL)
5978 {
5979 struct type *base_type = cp_find_type_baseclass_by_name (type,
5980 copy.c_str ());
5981
5982 if (base_type != NULL)
5983 {
5984 yylval.tsym.type = base_type;
5985 return TYPENAME;
5986 }
5987
5988 return ERROR;
5989 }
5990
5991 switch (SYMBOL_CLASS (yylval.ssym.sym.symbol))
5992 {
5993 case LOC_BLOCK:
5994 case LOC_LABEL:
5995 /* cp_lookup_nested_symbol might have accidentally found a constructor
5996 named COPY when we really wanted a base class of the same name.
5997 Double-check this case by looking for a base class. */
5998 {
5999 struct type *base_type
6000 = cp_find_type_baseclass_by_name (type, copy.c_str ());
6001
6002 if (base_type != NULL)
6003 {
6004 yylval.tsym.type = base_type;
6005 return TYPENAME;
6006 }
6007 }
6008 return ERROR;
6009
6010 case LOC_TYPEDEF:
6011 yylval.tsym.type = SYMBOL_TYPE (yylval.ssym.sym.symbol);
6012 return TYPENAME;
6013
6014 default:
6015 return NAME;
6016 }
6017 internal_error (__FILE__, __LINE__, _("not reached"));
6018 }
6019
6020 /* The outer level of a two-level lexer. This calls the inner lexer
6021 to return tokens. It then either returns these tokens, or
6022 aggregates them into a larger token. This lets us work around a
6023 problem in our parsing approach, where the parser could not
6024 distinguish between qualified names and qualified types at the
6025 right point.
6026
6027 This approach is still not ideal, because it mishandles template
6028 types. See the comment in lex_one_token for an example. However,
6029 this is still an improvement over the earlier approach, and will
6030 suffice until we move to better parsing technology. */
6031
6032 static int
yylex(void)6033 yylex (void)
6034 {
6035 token_and_value current;
6036 int first_was_coloncolon, last_was_coloncolon;
6037 struct type *context_type = NULL;
6038 int last_to_examine, next_to_examine, checkpoint;
6039 const struct block *search_block;
6040 bool is_quoted_name, last_lex_was_structop;
6041
6042 if (popping && !token_fifo.empty ())
6043 goto do_pop;
6044 popping = 0;
6045
6046 last_lex_was_structop = last_was_structop;
6047
6048 /* Read the first token and decide what to do. Most of the
6049 subsequent code is C++-only; but also depends on seeing a "::" or
6050 name-like token. */
6051 current.token = lex_one_token (pstate, &is_quoted_name);
6052 if (current.token == NAME)
6053 current.token = classify_name (pstate, pstate->expression_context_block,
6054 is_quoted_name, last_lex_was_structop);
6055 if (pstate->language ()->la_language != language_cplus
6056 || (current.token != TYPENAME && current.token != COLONCOLON
6057 && current.token != FILENAME))
6058 return current.token;
6059
6060 /* Read any sequence of alternating "::" and name-like tokens into
6061 the token FIFO. */
6062 current.value = yylval;
6063 token_fifo.push_back (current);
6064 last_was_coloncolon = current.token == COLONCOLON;
6065 while (1)
6066 {
6067 bool ignore;
6068
6069 /* We ignore quoted names other than the very first one.
6070 Subsequent ones do not have any special meaning. */
6071 current.token = lex_one_token (pstate, &ignore);
6072 current.value = yylval;
6073 token_fifo.push_back (current);
6074
6075 if ((last_was_coloncolon && current.token != NAME)
6076 || (!last_was_coloncolon && current.token != COLONCOLON))
6077 break;
6078 last_was_coloncolon = !last_was_coloncolon;
6079 }
6080 popping = 1;
6081
6082 /* We always read one extra token, so compute the number of tokens
6083 to examine accordingly. */
6084 last_to_examine = token_fifo.size () - 2;
6085 next_to_examine = 0;
6086
6087 current = token_fifo[next_to_examine];
6088 ++next_to_examine;
6089
6090 name_obstack.clear ();
6091 checkpoint = 0;
6092 if (current.token == FILENAME)
6093 search_block = current.value.bval;
6094 else if (current.token == COLONCOLON)
6095 search_block = NULL;
6096 else
6097 {
6098 gdb_assert (current.token == TYPENAME);
6099 search_block = pstate->expression_context_block;
6100 obstack_grow (&name_obstack, current.value.sval.ptr,
6101 current.value.sval.length);
6102 context_type = current.value.tsym.type;
6103 checkpoint = 1;
6104 }
6105
6106 first_was_coloncolon = current.token == COLONCOLON;
6107 last_was_coloncolon = first_was_coloncolon;
6108
6109 while (next_to_examine <= last_to_examine)
6110 {
6111 token_and_value next;
6112
6113 next = token_fifo[next_to_examine];
6114 ++next_to_examine;
6115
6116 if (next.token == NAME && last_was_coloncolon)
6117 {
6118 int classification;
6119
6120 yylval = next.value;
6121 classification = classify_inner_name (pstate, search_block,
6122 context_type);
6123 /* We keep going until we either run out of names, or until
6124 we have a qualified name which is not a type. */
6125 if (classification != TYPENAME && classification != NAME)
6126 break;
6127
6128 /* Accept up to this token. */
6129 checkpoint = next_to_examine;
6130
6131 /* Update the partial name we are constructing. */
6132 if (context_type != NULL)
6133 {
6134 /* We don't want to put a leading "::" into the name. */
6135 obstack_grow_str (&name_obstack, "::");
6136 }
6137 obstack_grow (&name_obstack, next.value.sval.ptr,
6138 next.value.sval.length);
6139
6140 yylval.sval.ptr = (const char *) obstack_base (&name_obstack);
6141 yylval.sval.length = obstack_object_size (&name_obstack);
6142 current.value = yylval;
6143 current.token = classification;
6144
6145 last_was_coloncolon = 0;
6146
6147 if (classification == NAME)
6148 break;
6149
6150 context_type = yylval.tsym.type;
6151 }
6152 else if (next.token == COLONCOLON && !last_was_coloncolon)
6153 last_was_coloncolon = 1;
6154 else
6155 {
6156 /* We've reached the end of the name. */
6157 break;
6158 }
6159 }
6160
6161 /* If we have a replacement token, install it as the first token in
6162 the FIFO, and delete the other constituent tokens. */
6163 if (checkpoint > 0)
6164 {
6165 current.value.sval.ptr
6166 = obstack_strndup (&cpstate->expansion_obstack,
6167 current.value.sval.ptr,
6168 current.value.sval.length);
6169
6170 token_fifo[0] = current;
6171 if (checkpoint > 1)
6172 token_fifo.erase (token_fifo.begin () + 1,
6173 token_fifo.begin () + checkpoint);
6174 }
6175
6176 do_pop:
6177 current = token_fifo[0];
6178 token_fifo.erase (token_fifo.begin ());
6179 yylval = current.value;
6180 return current.token;
6181 }
6182
6183 int
c_parse(struct parser_state * par_state)6184 c_parse (struct parser_state *par_state)
6185 {
6186 /* Setting up the parser state. */
6187 scoped_restore pstate_restore = make_scoped_restore (&pstate);
6188 gdb_assert (par_state != NULL);
6189 pstate = par_state;
6190
6191 c_parse_state cstate;
6192 scoped_restore cstate_restore = make_scoped_restore (&cpstate, &cstate);
6193
6194 gdb::unique_xmalloc_ptr<struct macro_scope> macro_scope;
6195
6196 if (par_state->expression_context_block)
6197 macro_scope
6198 = sal_macro_scope (find_pc_line (par_state->expression_context_pc, 0));
6199 else
6200 macro_scope = default_macro_scope ();
6201 if (! macro_scope)
6202 macro_scope = user_macro_scope ();
6203
6204 scoped_restore restore_macro_scope
6205 = make_scoped_restore (&expression_macro_scope, macro_scope.get ());
6206
6207 scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
6208 parser_debug);
6209
6210 /* Initialize some state used by the lexer. */
6211 last_was_structop = false;
6212 saw_name_at_eof = 0;
6213 paren_depth = 0;
6214
6215 token_fifo.clear ();
6216 popping = 0;
6217 name_obstack.clear ();
6218
6219 int result = yyparse ();
6220 if (!result)
6221 pstate->set_operation (pstate->pop ());
6222 return result;
6223 }
6224
6225 #ifdef YYBISON
6226
6227 /* This is called via the YYPRINT macro when parser debugging is
6228 enabled. It prints a token's value. */
6229
6230 static void
c_print_token(FILE * file,int type,YYSTYPE value)6231 c_print_token (FILE *file, int type, YYSTYPE value)
6232 {
6233 switch (type)
6234 {
6235 case INT:
6236 parser_fprintf (file, "typed_val_int<%s, %s>",
6237 TYPE_SAFE_NAME (value.typed_val_int.type),
6238 pulongest (value.typed_val_int.val));
6239 break;
6240
6241 case CHAR:
6242 case STRING:
6243 {
6244 char *copy = (char *) alloca (value.tsval.length + 1);
6245
6246 memcpy (copy, value.tsval.ptr, value.tsval.length);
6247 copy[value.tsval.length] = '\0';
6248
6249 parser_fprintf (file, "tsval<type=%d, %s>", value.tsval.type, copy);
6250 }
6251 break;
6252
6253 case NSSTRING:
6254 case DOLLAR_VARIABLE:
6255 parser_fprintf (file, "sval<%s>", copy_name (value.sval).c_str ());
6256 break;
6257
6258 case TYPENAME:
6259 parser_fprintf (file, "tsym<type=%s, name=%s>",
6260 TYPE_SAFE_NAME (value.tsym.type),
6261 copy_name (value.tsym.stoken).c_str ());
6262 break;
6263
6264 case NAME:
6265 case UNKNOWN_CPP_NAME:
6266 case NAME_OR_INT:
6267 case BLOCKNAME:
6268 parser_fprintf (file, "ssym<name=%s, sym=%s, field_of_this=%d>",
6269 copy_name (value.ssym.stoken).c_str (),
6270 (value.ssym.sym.symbol == NULL
6271 ? "(null)" : value.ssym.sym.symbol->print_name ()),
6272 value.ssym.is_a_field_of_this);
6273 break;
6274
6275 case FILENAME:
6276 parser_fprintf (file, "bval<%s>", host_address_to_string (value.bval));
6277 break;
6278 }
6279 }
6280
6281 #endif
6282
6283 static void
yyerror(const char * msg)6284 yyerror (const char *msg)
6285 {
6286 if (pstate->prev_lexptr)
6287 pstate->lexptr = pstate->prev_lexptr;
6288
6289 error (_("A %s in expression, near `%s'."), msg, pstate->lexptr);
6290 }
6291