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