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