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