1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
40 #define YYSKELETON_NAME "yacc.c"
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
98 #define NAME_OR_INT 264
102 #define COLONCOLON 268
106 #define TRUEKEYWORD 272
107 #define FALSEKEYWORD 273
108 #define ABOVE_COMMA 274
121 #define DECREMENT 287
122 #define INCREMENT 288
125 #define BLOCKNAME 291
130 /* Copy the first part of user declarations. */
135 #include "gdb_string.h"
137 #include "expression.h"
139 #include "parser-defs.h"
140 #include "language.h"
142 #include "bfd.h" /* Required by objfiles.h. */
143 #include "symfile.h" /* Required by objfiles.h. */
144 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
147 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
148 as well as gratuitiously global symbol names, so we can have multiple
149 yacc generated parsers in gdb. Note that these are only the variables
150 produced by yacc. If other parser generators (bison, byacc, etc) produce
151 additional global names that conflict at link time, then those parser
152 generators need to be fixed instead of adding those names to this list. */
154 #define yymaxdepth pascal_maxdepth
155 #define yyparse pascal_parse
156 #define yylex pascal_lex
157 #define yyerror pascal_error
158 #define yylval pascal_lval
159 #define yychar pascal_char
160 #define yydebug pascal_debug
161 #define yypact pascal_pact
162 #define yyr1 pascal_r1
163 #define yyr2 pascal_r2
164 #define yydef pascal_def
165 #define yychk pascal_chk
166 #define yypgo pascal_pgo
167 #define yyact pascal_act
168 #define yyexca pascal_exca
169 #define yyerrflag pascal_errflag
170 #define yynerrs pascal_nerrs
171 #define yyps pascal_ps
172 #define yypv pascal_pv
174 #define yy_yys pascal_yys
175 #define yystate pascal_state
176 #define yytmp pascal_tmp
178 #define yy_yyv pascal_yyv
179 #define yyval pascal_val
180 #define yylloc pascal_lloc
181 #define yyreds pascal_reds /* With YYDEBUG defined */
182 #define yytoks pascal_toks /* With YYDEBUG defined */
183 #define yyname pascal_name /* With YYDEBUG defined */
184 #define yyrule pascal_rule /* With YYDEBUG defined */
185 #define yylhs pascal_yylhs
186 #define yylen pascal_yylen
187 #define yydefred pascal_yydefred
188 #define yydgoto pascal_yydgoto
189 #define yysindex pascal_yysindex
190 #define yyrindex pascal_yyrindex
191 #define yygindex pascal_yygindex
192 #define yytable pascal_yytable
193 #define yycheck pascal_yycheck
196 #define YYDEBUG 1 /* Default to yydebug support */
199 #define YYFPRINTF parser_fprintf
203 static int yylex (void);
208 static char * uptok (char *, int);
211 /* Enabling traces. */
216 /* Enabling verbose error messages. */
217 #ifdef YYERROR_VERBOSE
218 # undef YYERROR_VERBOSE
219 # define YYERROR_VERBOSE 1
221 # define YYERROR_VERBOSE 0
224 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
226 typedef union YYSTYPE {
240 struct symtoken ssym;
243 enum exp_opcode opcode;
244 struct internalvar *ivar;
249 /* Line 191 of yacc.c. */
250 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
251 # define YYSTYPE_IS_DECLARED 1
252 # define YYSTYPE_IS_TRIVIAL 1
257 /* Copy the second part of user declarations. */
260 /* YYSTYPE gets defined by %union */
262 parse_number (char *, int, int, YYSTYPE *);
264 static struct type *current_type;
266 static void push_current_type (void);
267 static void pop_current_type (void);
268 static int search_field;
271 /* Line 214 of yacc.c. */
273 #if ! defined (yyoverflow) || YYERROR_VERBOSE
275 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
277 # if YYSTACK_USE_ALLOCA
278 # define YYSTACK_ALLOC alloca
280 # ifndef YYSTACK_USE_ALLOCA
281 # if defined (alloca) || defined (_ALLOCA_H)
282 # define YYSTACK_ALLOC alloca
285 # define YYSTACK_ALLOC __builtin_alloca
291 # ifdef YYSTACK_ALLOC
292 /* Pacify GCC's `empty if-body' warning. */
293 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
295 # if defined (__STDC__) || defined (__cplusplus)
296 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
297 # define YYSIZE_T size_t
299 # define YYSTACK_ALLOC xmalloc
300 # define YYSTACK_FREE free
302 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
305 #if (! defined (yyoverflow) \
306 && (! defined (__cplusplus) \
307 || (YYSTYPE_IS_TRIVIAL)))
309 /* A type that is properly aligned for any stack member. */
316 /* The size of the maximum gap between one aligned stack and the next. */
317 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
319 /* The size of an array large to enough to hold all stacks, each with
321 # define YYSTACK_BYTES(N) \
322 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
323 + YYSTACK_GAP_MAXIMUM)
325 /* Copy COUNT objects from FROM to TO. The source and destination do
329 # define YYCOPY(To, From, Count) \
330 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
332 # define YYCOPY(To, From, Count) \
335 register YYSIZE_T yyi; \
336 for (yyi = 0; yyi < (Count); yyi++) \
337 (To)[yyi] = (From)[yyi]; \
343 /* Relocate STACK from its old location to the new one. The
344 local variables YYSIZE and YYSTACKSIZE give the old and new number of
345 elements in the stack, and YYPTR gives the new location of the
346 stack. Advance YYPTR to a properly aligned location for the next
348 # define YYSTACK_RELOCATE(Stack) \
351 YYSIZE_T yynewbytes; \
352 YYCOPY (&yyptr->Stack, Stack, yysize); \
353 Stack = &yyptr->Stack; \
354 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
355 yyptr += yynewbytes / sizeof (*yyptr); \
361 #if defined (__STDC__) || defined (__cplusplus)
362 typedef signed char yysigned_char;
364 typedef short yysigned_char;
367 /* YYFINAL -- State number of the termination state. */
369 /* YYLAST -- Last index in YYTABLE. */
372 /* YYNTOKENS -- Number of terminals. */
374 /* YYNNTS -- Number of nonterminals. */
376 /* YYNRULES -- Number of rules. */
378 /* YYNRULES -- Number of states. */
379 #define YYNSTATES 123
381 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
383 #define YYMAXUTOK 291
385 #define YYTRANSLATE(YYX) \
386 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
388 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
389 static const unsigned char yytranslate[] =
391 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 46, 50, 39, 37, 19, 38, 44, 40, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 28, 26, 29, 2, 36, 2, 2, 2, 2, 2,
398 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 45, 2, 51, 48, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
417 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
418 15, 16, 17, 18, 20, 21, 22, 23, 24, 25,
419 27, 30, 31, 32, 33, 34, 35, 41, 42, 43,
424 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
426 static const unsigned char yyprhs[] =
428 0, 0, 3, 4, 7, 9, 11, 13, 15, 19,
429 22, 25, 28, 31, 36, 41, 42, 47, 48, 54,
430 55, 61, 62, 64, 68, 73, 77, 81, 85, 89,
431 93, 97, 101, 105, 109, 113, 117, 121, 125, 129,
432 133, 137, 141, 145, 149, 151, 153, 155, 157, 159,
433 161, 163, 168, 170, 172, 174, 178, 182, 186, 188,
434 191, 193, 195, 197, 201, 204, 206, 209, 212, 214,
438 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
439 static const yysigned_char yyrhs[] =
441 53, 0, -1, -1, 54, 55, -1, 57, -1, 56,
442 -1, 67, -1, 58, -1, 57, 19, 58, -1, 58,
443 48, -1, 36, 58, -1, 38, 58, -1, 22, 58,
444 -1, 42, 46, 58, 50, -1, 41, 46, 58, 50,
445 -1, -1, 58, 44, 59, 6, -1, -1, 58, 45,
446 60, 57, 51, -1, -1, 58, 46, 61, 62, 50,
447 -1, -1, 58, -1, 62, 19, 58, -1, 67, 46,
448 58, 50, -1, 46, 57, 50, -1, 58, 39, 58,
449 -1, 58, 40, 58, -1, 58, 33, 58, -1, 58,
450 32, 58, -1, 58, 37, 58, -1, 58, 38, 58,
451 -1, 58, 35, 58, -1, 58, 34, 58, -1, 58,
452 26, 58, -1, 58, 27, 58, -1, 58, 31, 58,
453 -1, 58, 30, 58, -1, 58, 28, 58, -1, 58,
454 29, 58, -1, 58, 25, 58, -1, 58, 24, 58,
455 -1, 58, 23, 58, -1, 58, 21, 58, -1, 17,
456 -1, 18, -1, 3, -1, 9, -1, 4, -1, 64,
457 -1, 15, -1, 12, 46, 67, 50, -1, 5, -1,
458 16, -1, 49, -1, 63, 13, 69, -1, 63, 13,
459 69, -1, 68, 13, 69, -1, 65, -1, 13, 69,
460 -1, 70, -1, 68, -1, 66, -1, 68, 13, 39,
461 -1, 48, 68, -1, 8, -1, 10, 69, -1, 11,
462 69, -1, 7, -1, 49, -1, 8, -1, 9, -1,
466 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
467 static const unsigned short yyrline[] =
469 0, 234, 234, 234, 241, 242, 245, 252, 253, 258,
470 264, 270, 274, 278, 282, 286, 286, 301, 299, 329,
471 326, 338, 339, 341, 345, 360, 366, 370, 374, 378,
472 382, 386, 390, 394, 398, 402, 406, 410, 414, 418,
473 422, 426, 430, 434, 438, 444, 450, 457, 468, 475,
474 478, 482, 490, 515, 542, 559, 570, 586, 601, 602,
475 636, 708, 719, 720, 725, 727, 729, 732, 740, 741,
480 #if YYDEBUG || YYERROR_VERBOSE
481 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
482 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
483 static const char *const yytname[] =
485 "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "FIELDNAME",
486 "NAME", "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "SIZEOF",
487 "COLONCOLON", "ERROR", "VARIABLE", "THIS", "TRUEKEYWORD",
488 "FALSEKEYWORD", "','", "ABOVE_COMMA", "ASSIGN", "NOT", "OR", "XOR",
489 "ANDAND", "'='", "NOTEQUAL", "'<'", "'>'", "GEQ", "LEQ", "MOD", "DIV",
490 "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "DECREMENT",
491 "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "'^'", "BLOCKNAME",
492 "')'", "']'", "$accept", "start", "@1", "normal_start", "type_exp",
493 "exp1", "exp", "@2", "@3", "@4", "arglist", "block", "variable",
494 "qualified_name", "ptype", "type", "typebase", "name",
495 "name_not_typename", 0
500 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
502 static const unsigned short yytoknum[] =
504 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
505 265, 266, 267, 268, 269, 270, 271, 272, 273, 44,
506 274, 275, 276, 277, 278, 279, 61, 280, 60, 62,
507 281, 282, 283, 284, 285, 286, 64, 43, 45, 42,
508 47, 287, 288, 289, 46, 91, 40, 290, 94, 291,
513 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
514 static const unsigned char yyr1[] =
516 0, 52, 54, 53, 55, 55, 56, 57, 57, 58,
517 58, 58, 58, 58, 58, 59, 58, 60, 58, 61,
518 58, 62, 62, 62, 58, 58, 58, 58, 58, 58,
519 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
520 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
521 58, 58, 58, 58, 63, 63, 64, 65, 64, 64,
522 64, 66, 67, 67, 68, 68, 68, 68, 69, 69,
526 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
527 static const unsigned char yyr2[] =
529 0, 2, 0, 2, 1, 1, 1, 1, 3, 2,
530 2, 2, 2, 4, 4, 0, 4, 0, 5, 0,
531 5, 0, 1, 3, 4, 3, 3, 3, 3, 3,
532 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
533 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
534 1, 4, 1, 1, 1, 3, 3, 3, 1, 2,
535 1, 1, 1, 3, 2, 1, 2, 2, 1, 1,
539 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
540 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
541 means the default is an error. */
542 static const unsigned char yydefact[] =
544 2, 0, 0, 1, 46, 48, 52, 72, 65, 47,
545 0, 0, 0, 0, 50, 53, 44, 45, 0, 0,
546 0, 0, 0, 0, 0, 73, 3, 5, 4, 7,
547 0, 49, 58, 62, 6, 61, 60, 68, 70, 71,
548 69, 66, 67, 0, 59, 12, 0, 10, 11, 0,
549 0, 0, 64, 0, 0, 0, 0, 0, 0, 0,
550 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
551 0, 0, 15, 17, 19, 9, 0, 0, 0, 0,
552 61, 0, 0, 25, 8, 43, 42, 41, 40, 34,
553 35, 38, 39, 37, 36, 29, 28, 33, 32, 30,
554 31, 26, 27, 0, 0, 21, 56, 0, 63, 57,
555 51, 0, 14, 13, 16, 0, 22, 0, 24, 18,
559 /* YYDEFGOTO[NTERM-NUM]. */
560 static const yysigned_char yydefgoto[] =
562 -1, 1, 2, 26, 27, 28, 29, 103, 104, 105,
563 117, 30, 31, 32, 33, 46, 35, 41, 36
566 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
568 #define YYPACT_NINF -37
569 static const short yypact[] =
571 -37, 5, 88, -37, -37, -37, -37, -37, -37, -37,
572 6, 6, -35, 6, -37, -37, -37, -37, 88, 88,
573 88, -29, -27, 88, 10, 12, -37, -37, 8, 201,
574 16, -37, -37, -37, -13, 21, -37, -37, -37, -37,
575 -37, -37, -37, 10, -37, -36, -13, -36, -36, 88,
576 88, 11, -37, 88, 88, 88, 88, 88, 88, 88,
577 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
578 88, 88, -37, -37, -37, -37, 6, 88, 15, 20,
579 43, 117, 145, -37, 201, 201, 226, 250, 273, 294,
580 294, 311, 311, 311, 311, 28, 28, 28, 28, 68,
581 68, -36, -36, 56, 88, 88, 62, 173, -37, -37,
582 -37, 38, -37, -37, -37, 9, 201, 44, -37, -37,
586 /* YYPGOTO[NTERM-NUM]. */
587 static const yysigned_char yypgoto[] =
589 -37, -37, -37, -37, -37, -20, -18, -37, -37, -37,
590 -37, -37, -37, -37, -37, 14, -17, -7, -37
593 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
594 positive, shift that token. If negative, reduce the rule which
595 number is the opposite. If zero, do what YYDEFACT says.
596 If YYTABLE_NINF, syntax error. */
597 #define YYTABLE_NINF -56
598 static const yysigned_char yytable[] =
600 45, 47, 48, 51, 42, 3, 44, 52, 72, 73,
601 74, 43, 75, 37, 38, 39, 34, 49, 8, 50,
602 10, 11, 37, 38, 39, -54, 80, 53, 53, 76,
603 53, 81, 82, 77, 78, 84, 85, 86, 87, 88,
604 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
605 99, 100, 101, 102, 108, 40, 111, 79, 24, 107,
606 119, 83, 114, 120, 40, 68, 69, 70, 71, 106,
607 110, 109, 72, 73, 74, -55, 75, 108, 0, 0,
608 0, 0, 0, 0, 115, 0, 0, 116, 0, 0,
609 0, 4, 5, 6, 121, 7, 8, 9, 10, 11,
610 12, 13, 122, 14, 15, 16, 17, 70, 71, 0,
611 18, 0, 72, 73, 74, 0, 75, 0, 0, 0,
612 0, 0, 0, 0, 19, 0, 20, 0, 0, 21,
613 22, 0, 0, 0, 23, 0, 24, 25, 54, 0,
614 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
615 65, 66, 67, 0, 68, 69, 70, 71, 0, 0,
616 0, 72, 73, 74, 0, 75, 54, 112, 55, 56,
617 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
618 67, 0, 68, 69, 70, 71, 0, 0, 0, 72,
619 73, 74, 0, 75, 54, 113, 55, 56, 57, 58,
620 59, 60, 61, 62, 63, 64, 65, 66, 67, 0,
621 68, 69, 70, 71, 0, 0, 0, 72, 73, 74,
622 0, 75, 54, 118, 55, 56, 57, 58, 59, 60,
623 61, 62, 63, 64, 65, 66, 67, 0, 68, 69,
624 70, 71, 0, 0, 0, 72, 73, 74, 0, 75,
625 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
626 66, 67, 0, 68, 69, 70, 71, 0, 0, 0,
627 72, 73, 74, 0, 75, 57, 58, 59, 60, 61,
628 62, 63, 64, 65, 66, 67, 0, 68, 69, 70,
629 71, 0, 0, 0, 72, 73, 74, 0, 75, 58,
630 59, 60, 61, 62, 63, 64, 65, 66, 67, 0,
631 68, 69, 70, 71, 0, 0, 0, 72, 73, 74,
632 0, 75, 60, 61, 62, 63, 64, 65, 66, 67,
633 0, 68, 69, 70, 71, 0, 0, 0, 72, 73,
634 74, 0, 75, 64, 65, 66, 67, 0, 68, 69,
635 70, 71, 0, 0, 0, 72, 73, 74, 0, 75
638 static const yysigned_char yycheck[] =
640 18, 19, 20, 23, 11, 0, 13, 24, 44, 45,
641 46, 46, 48, 7, 8, 9, 2, 46, 8, 46,
642 10, 11, 7, 8, 9, 13, 43, 19, 19, 13,
643 19, 49, 50, 46, 13, 53, 54, 55, 56, 57,
644 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
645 68, 69, 70, 71, 39, 49, 13, 43, 48, 77,
646 51, 50, 6, 19, 49, 37, 38, 39, 40, 76,
647 50, 78, 44, 45, 46, 13, 48, 39, -1, -1,
648 -1, -1, -1, -1, 104, -1, -1, 105, -1, -1,
649 -1, 3, 4, 5, 50, 7, 8, 9, 10, 11,
650 12, 13, 120, 15, 16, 17, 18, 39, 40, -1,
651 22, -1, 44, 45, 46, -1, 48, -1, -1, -1,
652 -1, -1, -1, -1, 36, -1, 38, -1, -1, 41,
653 42, -1, -1, -1, 46, -1, 48, 49, 21, -1,
654 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
655 33, 34, 35, -1, 37, 38, 39, 40, -1, -1,
656 -1, 44, 45, 46, -1, 48, 21, 50, 23, 24,
657 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
658 35, -1, 37, 38, 39, 40, -1, -1, -1, 44,
659 45, 46, -1, 48, 21, 50, 23, 24, 25, 26,
660 27, 28, 29, 30, 31, 32, 33, 34, 35, -1,
661 37, 38, 39, 40, -1, -1, -1, 44, 45, 46,
662 -1, 48, 21, 50, 23, 24, 25, 26, 27, 28,
663 29, 30, 31, 32, 33, 34, 35, -1, 37, 38,
664 39, 40, -1, -1, -1, 44, 45, 46, -1, 48,
665 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
666 34, 35, -1, 37, 38, 39, 40, -1, -1, -1,
667 44, 45, 46, -1, 48, 25, 26, 27, 28, 29,
668 30, 31, 32, 33, 34, 35, -1, 37, 38, 39,
669 40, -1, -1, -1, 44, 45, 46, -1, 48, 26,
670 27, 28, 29, 30, 31, 32, 33, 34, 35, -1,
671 37, 38, 39, 40, -1, -1, -1, 44, 45, 46,
672 -1, 48, 28, 29, 30, 31, 32, 33, 34, 35,
673 -1, 37, 38, 39, 40, -1, -1, -1, 44, 45,
674 46, -1, 48, 32, 33, 34, 35, -1, 37, 38,
675 39, 40, -1, -1, -1, 44, 45, 46, -1, 48
678 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
679 symbol of state STATE-NUM. */
680 static const unsigned char yystos[] =
682 0, 53, 54, 0, 3, 4, 5, 7, 8, 9,
683 10, 11, 12, 13, 15, 16, 17, 18, 22, 36,
684 38, 41, 42, 46, 48, 49, 55, 56, 57, 58,
685 63, 64, 65, 66, 67, 68, 70, 7, 8, 9,
686 49, 69, 69, 46, 69, 58, 67, 58, 58, 46,
687 46, 57, 68, 19, 21, 23, 24, 25, 26, 27,
688 28, 29, 30, 31, 32, 33, 34, 35, 37, 38,
689 39, 40, 44, 45, 46, 48, 13, 46, 13, 67,
690 68, 58, 58, 50, 58, 58, 58, 58, 58, 58,
691 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
692 58, 58, 58, 59, 60, 61, 69, 58, 39, 69,
693 50, 13, 50, 50, 6, 57, 58, 62, 50, 51,
697 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
698 # define YYSIZE_T __SIZE_TYPE__
700 #if ! defined (YYSIZE_T) && defined (size_t)
701 # define YYSIZE_T size_t
703 #if ! defined (YYSIZE_T)
704 # if defined (__STDC__) || defined (__cplusplus)
705 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
706 # define YYSIZE_T size_t
709 #if ! defined (YYSIZE_T)
710 # define YYSIZE_T unsigned int
713 #define yyerrok (yyerrstatus = 0)
714 #define yyclearin (yychar = YYEMPTY)
718 #define YYACCEPT goto yyacceptlab
719 #define YYABORT goto yyabortlab
720 #define YYERROR goto yyerrlab1
722 /* Like YYERROR except do call yyerror. This remains here temporarily
723 to ease the transition to the new meaning of YYERROR, for GCC.
724 Once GCC version 2 has supplanted version 1, this can go. */
726 #define YYFAIL goto yyerrlab
728 #define YYRECOVERING() (!!yyerrstatus)
730 #define YYBACKUP(Token, Value) \
732 if (yychar == YYEMPTY && yylen == 1) \
736 yytoken = YYTRANSLATE (yychar); \
742 yyerror ("syntax error: cannot back up");\
748 #define YYERRCODE 256
750 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
753 #ifndef YYLLOC_DEFAULT
754 # define YYLLOC_DEFAULT(Current, Rhs, N) \
755 Current.first_line = Rhs[1].first_line; \
756 Current.first_column = Rhs[1].first_column; \
757 Current.last_line = Rhs[N].last_line; \
758 Current.last_column = Rhs[N].last_column;
761 /* YYLEX -- calling `yylex' with the right arguments. */
764 # define YYLEX yylex (YYLEX_PARAM)
766 # define YYLEX yylex ()
769 /* Enable debugging if requested. */
773 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
774 # define YYFPRINTF fprintf
777 # define YYDPRINTF(Args) \
783 # define YYDSYMPRINT(Args) \
789 # define YYDSYMPRINTF(Title, Token, Value, Location) \
793 YYFPRINTF (stderr, "%s ", Title); \
794 yysymprint (stderr, \
796 YYFPRINTF (stderr, "\n"); \
800 /*------------------------------------------------------------------.
801 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
803 `------------------------------------------------------------------*/
805 #if defined (__STDC__) || defined (__cplusplus)
807 yy_stack_print (short *bottom, short *top)
810 yy_stack_print (bottom, top)
815 YYFPRINTF (stderr, "Stack now");
816 for (/* Nothing. */; bottom <= top; ++bottom)
817 YYFPRINTF (stderr, " %d", *bottom);
818 YYFPRINTF (stderr, "\n");
821 # define YY_STACK_PRINT(Bottom, Top) \
824 yy_stack_print ((Bottom), (Top)); \
828 /*------------------------------------------------.
829 | Report that the YYRULE is going to be reduced. |
830 `------------------------------------------------*/
832 #if defined (__STDC__) || defined (__cplusplus)
834 yy_reduce_print (int yyrule)
837 yy_reduce_print (yyrule)
842 unsigned int yylineno = yyrline[yyrule];
843 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
844 yyrule - 1, yylineno);
845 /* Print the symbols being reduced, and their result. */
846 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
847 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
848 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
851 # define YY_REDUCE_PRINT(Rule) \
854 yy_reduce_print (Rule); \
857 /* Nonzero means print parse trace. It is left uninitialized so that
858 multiple parsers can coexist. */
861 # define YYDPRINTF(Args)
862 # define YYDSYMPRINT(Args)
863 # define YYDSYMPRINTF(Title, Token, Value, Location)
864 # define YY_STACK_PRINT(Bottom, Top)
865 # define YY_REDUCE_PRINT(Rule)
866 #endif /* !YYDEBUG */
869 /* YYINITDEPTH -- initial size of the parser's stacks. */
871 # define YYINITDEPTH 200
874 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
875 if the built-in stack extension method is used).
877 Do not make this value too large; the results are undefined if
878 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
879 evaluated with infinite-precision integer arithmetic. */
886 # define YYMAXDEPTH 10000
894 # if defined (__GLIBC__) && defined (_STRING_H)
895 # define yystrlen strlen
897 /* Return the length of YYSTR. */
899 # if defined (__STDC__) || defined (__cplusplus)
900 yystrlen (const char *yystr)
906 register const char *yys = yystr;
908 while (*yys++ != '\0')
911 return yys - yystr - 1;
917 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
918 # define yystpcpy stpcpy
920 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
923 # if defined (__STDC__) || defined (__cplusplus)
924 yystpcpy (char *yydest, const char *yysrc)
926 yystpcpy (yydest, yysrc)
931 register char *yyd = yydest;
932 register const char *yys = yysrc;
934 while ((*yyd++ = *yys++) != '\0')
942 #endif /* !YYERROR_VERBOSE */
947 /*--------------------------------.
948 | Print this symbol on YYOUTPUT. |
949 `--------------------------------*/
951 #if defined (__STDC__) || defined (__cplusplus)
953 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
956 yysymprint (yyoutput, yytype, yyvaluep)
962 /* Pacify ``unused variable'' warnings. */
965 if (yytype < YYNTOKENS)
967 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
969 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
973 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
980 YYFPRINTF (yyoutput, ")");
983 #endif /* ! YYDEBUG */
984 /*-----------------------------------------------.
985 | Release the memory associated to this symbol. |
986 `-----------------------------------------------*/
988 #if defined (__STDC__) || defined (__cplusplus)
990 yydestruct (int yytype, YYSTYPE *yyvaluep)
993 yydestruct (yytype, yyvaluep)
998 /* Pacify ``unused variable'' warnings. */
1010 /* Prevent warnings from -Wmissing-prototypes. */
1012 #ifdef YYPARSE_PARAM
1013 # if defined (__STDC__) || defined (__cplusplus)
1014 int yyparse (void *YYPARSE_PARAM);
1018 #else /* ! YYPARSE_PARAM */
1019 #if defined (__STDC__) || defined (__cplusplus)
1024 #endif /* ! YYPARSE_PARAM */
1028 /* The lookahead symbol. */
1031 /* The semantic value of the lookahead symbol. */
1034 /* Number of syntax errors so far. */
1043 #ifdef YYPARSE_PARAM
1044 # if defined (__STDC__) || defined (__cplusplus)
1045 int yyparse (void *YYPARSE_PARAM)
1047 int yyparse (YYPARSE_PARAM)
1048 void *YYPARSE_PARAM;
1050 #else /* ! YYPARSE_PARAM */
1051 #if defined (__STDC__) || defined (__cplusplus)
1062 register int yystate;
1065 /* Number of tokens to shift before error messages enabled. */
1067 /* Lookahead token as an internal (translated) token number. */
1070 /* Three stacks and their tools:
1071 `yyss': related to states,
1072 `yyvs': related to semantic values,
1073 `yyls': related to locations.
1075 Refer to the stacks thru separate pointers, to allow yyoverflow
1076 to xreallocate them elsewhere. */
1078 /* The state stack. */
1079 short yyssa[YYINITDEPTH];
1080 short *yyss = yyssa;
1081 register short *yyssp;
1083 /* The semantic value stack. */
1084 YYSTYPE yyvsa[YYINITDEPTH];
1085 YYSTYPE *yyvs = yyvsa;
1086 register YYSTYPE *yyvsp;
1090 #define YYPOPSTACK (yyvsp--, yyssp--)
1092 YYSIZE_T yystacksize = YYINITDEPTH;
1094 /* The variables used to return semantic value and location from the
1099 /* When reducing, the number of symbols on the RHS of the reduced
1103 YYDPRINTF ((stderr, "Starting parse\n"));
1108 yychar = YYEMPTY; /* Cause a token to be read. */
1110 /* Initialize stack pointers.
1111 Waste one element of value and location stack
1112 so that they stay on the same level as the state stack.
1113 The wasted elements are never initialized. */
1120 /*------------------------------------------------------------.
1121 | yynewstate -- Push a new state, which is found in yystate. |
1122 `------------------------------------------------------------*/
1124 /* In all cases, when you get here, the value and location stacks
1125 have just been pushed. so pushing a state here evens the stacks.
1132 if (yyss + yystacksize - 1 <= yyssp)
1134 /* Get the current used size of the three stacks, in elements. */
1135 YYSIZE_T yysize = yyssp - yyss + 1;
1139 /* Give user a chance to xreallocate the stack. Use copies of
1140 these so that the &'s don't force the real ones into
1142 YYSTYPE *yyvs1 = yyvs;
1143 short *yyss1 = yyss;
1146 /* Each stack pointer address is followed by the size of the
1147 data in use in that stack, in bytes. This used to be a
1148 conditional around just the two extra args, but that might
1149 be undefined if yyoverflow is a macro. */
1150 yyoverflow ("parser stack overflow",
1151 &yyss1, yysize * sizeof (*yyssp),
1152 &yyvs1, yysize * sizeof (*yyvsp),
1159 #else /* no yyoverflow */
1160 # ifndef YYSTACK_RELOCATE
1163 /* Extend the stack our own way. */
1164 if (YYMAXDEPTH <= yystacksize)
1167 if (YYMAXDEPTH < yystacksize)
1168 yystacksize = YYMAXDEPTH;
1171 short *yyss1 = yyss;
1172 union yyalloc *yyptr =
1173 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1176 YYSTACK_RELOCATE (yyss);
1177 YYSTACK_RELOCATE (yyvs);
1179 # undef YYSTACK_RELOCATE
1181 YYSTACK_FREE (yyss1);
1184 #endif /* no yyoverflow */
1186 yyssp = yyss + yysize - 1;
1187 yyvsp = yyvs + yysize - 1;
1190 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1191 (unsigned long int) yystacksize));
1193 if (yyss + yystacksize - 1 <= yyssp)
1197 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1206 /* Do appropriate processing given the current state. */
1207 /* Read a lookahead token if we need one and don't already have one. */
1210 /* First try to decide what to do without reference to lookahead token. */
1212 yyn = yypact[yystate];
1213 if (yyn == YYPACT_NINF)
1216 /* Not known => get a lookahead token if don't already have one. */
1218 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1219 if (yychar == YYEMPTY)
1221 YYDPRINTF ((stderr, "Reading a token: "));
1225 if (yychar <= YYEOF)
1227 yychar = yytoken = YYEOF;
1228 YYDPRINTF ((stderr, "Now at end of input.\n"));
1232 yytoken = YYTRANSLATE (yychar);
1233 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1236 /* If the proper action on seeing token YYTOKEN is to reduce or to
1237 detect an error, take that action. */
1239 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1244 if (yyn == 0 || yyn == YYTABLE_NINF)
1253 /* Shift the lookahead token. */
1254 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1256 /* Discard the token being shifted unless it is eof. */
1257 if (yychar != YYEOF)
1263 /* Count tokens shifted since error; after three, turn off error
1272 /*-----------------------------------------------------------.
1273 | yydefault -- do the default action for the current state. |
1274 `-----------------------------------------------------------*/
1276 yyn = yydefact[yystate];
1282 /*-----------------------------.
1283 | yyreduce -- Do a reduction. |
1284 `-----------------------------*/
1286 /* yyn is the number of a rule to reduce with. */
1289 /* If YYLEN is nonzero, implement the default value of the action:
1292 Otherwise, the following line sets YYVAL to garbage.
1293 This behavior is undocumented and Bison
1294 users should not rely upon it. Assigning to YYVAL
1295 unconditionally makes the parser a bit smaller, and it avoids a
1296 GCC warning that YYVAL may be used uninitialized. */
1297 yyval = yyvsp[1-yylen];
1300 YY_REDUCE_PRINT (yyn);
1305 { current_type = NULL;
1317 { write_exp_elt_opcode(OP_TYPE);
1318 write_exp_elt_type(yyvsp[0].tval);
1319 write_exp_elt_opcode(OP_TYPE);
1320 current_type = yyvsp[0].tval; }
1325 { write_exp_elt_opcode (BINOP_COMMA); }
1330 { write_exp_elt_opcode (UNOP_IND);
1332 current_type = TYPE_TARGET_TYPE (current_type); }
1337 { write_exp_elt_opcode (UNOP_ADDR);
1339 current_type = TYPE_POINTER_TYPE (current_type); }
1344 { write_exp_elt_opcode (UNOP_NEG); }
1349 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1354 { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1359 { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1364 { search_field = 1; }
1369 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1370 write_exp_string (yyvsp[0].sval);
1371 write_exp_elt_opcode (STRUCTOP_STRUCT);
1374 { while (TYPE_CODE (current_type) == TYPE_CODE_PTR)
1375 current_type = TYPE_TARGET_TYPE (current_type);
1376 current_type = lookup_struct_elt_type (
1377 current_type, yyvsp[0].sval.ptr, 0); };
1384 int arrayfieldindex;
1385 arrayfieldindex = is_pascal_string_type (
1386 current_type, NULL, NULL,
1387 NULL, NULL, &arrayname);
1388 if (arrayfieldindex)
1390 struct stoken stringsval;
1391 stringsval.ptr = alloca (strlen (arrayname) + 1);
1392 stringsval.length = strlen (arrayname);
1393 strcpy (stringsval.ptr, arrayname);
1394 current_type = TYPE_FIELD_TYPE (current_type,
1395 arrayfieldindex - 1);
1396 write_exp_elt_opcode (STRUCTOP_STRUCT);
1397 write_exp_string (stringsval);
1398 write_exp_elt_opcode (STRUCTOP_STRUCT);
1400 push_current_type (); }
1405 { pop_current_type ();
1406 write_exp_elt_opcode (BINOP_SUBSCRIPT);
1408 current_type = TYPE_TARGET_TYPE (current_type); }
1413 { push_current_type ();
1419 { write_exp_elt_opcode (OP_FUNCALL);
1420 write_exp_elt_longcst ((LONGEST) end_arglist ());
1421 write_exp_elt_opcode (OP_FUNCALL);
1422 pop_current_type (); }
1427 { arglist_len = 1; }
1439 /* Allow automatic dereference of classes. */
1440 if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
1441 && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_CLASS)
1442 && (TYPE_CODE (yyvsp[-3].tval) == TYPE_CODE_CLASS))
1443 write_exp_elt_opcode (UNOP_IND);
1445 write_exp_elt_opcode (UNOP_CAST);
1446 write_exp_elt_type (yyvsp[-3].tval);
1447 write_exp_elt_opcode (UNOP_CAST);
1448 current_type = yyvsp[-3].tval; }
1458 { write_exp_elt_opcode (BINOP_MUL); }
1463 { write_exp_elt_opcode (BINOP_DIV); }
1468 { write_exp_elt_opcode (BINOP_INTDIV); }
1473 { write_exp_elt_opcode (BINOP_REM); }
1478 { write_exp_elt_opcode (BINOP_ADD); }
1483 { write_exp_elt_opcode (BINOP_SUB); }
1488 { write_exp_elt_opcode (BINOP_LSH); }
1493 { write_exp_elt_opcode (BINOP_RSH); }
1498 { write_exp_elt_opcode (BINOP_EQUAL); }
1503 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1508 { write_exp_elt_opcode (BINOP_LEQ); }
1513 { write_exp_elt_opcode (BINOP_GEQ); }
1518 { write_exp_elt_opcode (BINOP_LESS); }
1523 { write_exp_elt_opcode (BINOP_GTR); }
1528 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1533 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1538 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1543 { write_exp_elt_opcode (BINOP_ASSIGN); }
1548 { write_exp_elt_opcode (OP_BOOL);
1549 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1550 write_exp_elt_opcode (OP_BOOL); }
1555 { write_exp_elt_opcode (OP_BOOL);
1556 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1557 write_exp_elt_opcode (OP_BOOL); }
1562 { write_exp_elt_opcode (OP_LONG);
1563 write_exp_elt_type (yyvsp[0].typed_val_int.type);
1564 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1565 write_exp_elt_opcode (OP_LONG); }
1571 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1572 write_exp_elt_opcode (OP_LONG);
1573 write_exp_elt_type (val.typed_val_int.type);
1574 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1575 write_exp_elt_opcode (OP_LONG);
1581 { write_exp_elt_opcode (OP_DOUBLE);
1582 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1583 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1584 write_exp_elt_opcode (OP_DOUBLE); }
1589 { write_exp_elt_opcode (OP_LONG);
1590 write_exp_elt_type (builtin_type_int);
1591 CHECK_TYPEDEF (yyvsp[-1].tval);
1592 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1593 write_exp_elt_opcode (OP_LONG); }
1598 { /* C strings are converted into array constants with
1599 an explicit null byte added at the end. Thus
1600 the array upper bound is the string length.
1601 There is no such thing in C as a completely empty
1603 char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
1606 write_exp_elt_opcode (OP_LONG);
1607 write_exp_elt_type (builtin_type_char);
1608 write_exp_elt_longcst ((LONGEST)(*sp++));
1609 write_exp_elt_opcode (OP_LONG);
1611 write_exp_elt_opcode (OP_LONG);
1612 write_exp_elt_type (builtin_type_char);
1613 write_exp_elt_longcst ((LONGEST)'\0');
1614 write_exp_elt_opcode (OP_LONG);
1615 write_exp_elt_opcode (OP_ARRAY);
1616 write_exp_elt_longcst ((LONGEST) 0);
1617 write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1618 write_exp_elt_opcode (OP_ARRAY); }
1624 struct value * this_val;
1625 struct type * this_type;
1626 write_exp_elt_opcode (OP_THIS);
1627 write_exp_elt_opcode (OP_THIS);
1628 /* we need type of this */
1629 this_val = value_of_this (0);
1631 this_type = this_val->type;
1636 if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
1638 this_type = TYPE_TARGET_TYPE (this_type);
1639 write_exp_elt_opcode (UNOP_IND);
1643 current_type = this_type;
1650 if (yyvsp[0].ssym.sym != 0)
1651 yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1654 struct symtab *tem =
1655 lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
1657 yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
1659 error ("No file or function \"%s\".",
1660 copy_name (yyvsp[0].ssym.stoken));
1667 { struct symbol *tem
1668 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1669 VAR_DOMAIN, (int *) NULL,
1670 (struct symtab **) NULL);
1671 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1672 error ("No function \"%s\" in specified context.",
1673 copy_name (yyvsp[0].sval));
1674 yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
1679 { struct symbol *sym;
1680 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1681 VAR_DOMAIN, (int *) NULL,
1682 (struct symtab **) NULL);
1684 error ("No symbol \"%s\" in specified context.",
1685 copy_name (yyvsp[0].sval));
1687 write_exp_elt_opcode (OP_VAR_VALUE);
1688 /* block_found is set by lookup_symbol. */
1689 write_exp_elt_block (block_found);
1690 write_exp_elt_sym (sym);
1691 write_exp_elt_opcode (OP_VAR_VALUE); }
1697 struct type *type = yyvsp[-2].tval;
1698 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1699 && TYPE_CODE (type) != TYPE_CODE_UNION)
1700 error ("`%s' is not defined as an aggregate type.",
1703 write_exp_elt_opcode (OP_SCOPE);
1704 write_exp_elt_type (type);
1705 write_exp_string (yyvsp[0].sval);
1706 write_exp_elt_opcode (OP_SCOPE);
1713 char *name = copy_name (yyvsp[0].sval);
1715 struct minimal_symbol *msymbol;
1718 lookup_symbol (name, (const struct block *) NULL,
1719 VAR_DOMAIN, (int *) NULL,
1720 (struct symtab **) NULL);
1723 write_exp_elt_opcode (OP_VAR_VALUE);
1724 write_exp_elt_block (NULL);
1725 write_exp_elt_sym (sym);
1726 write_exp_elt_opcode (OP_VAR_VALUE);
1730 msymbol = lookup_minimal_symbol (name, NULL, NULL);
1731 if (msymbol != NULL)
1733 write_exp_msymbol (msymbol,
1734 lookup_function_type (builtin_type_int),
1738 if (!have_full_symbols () && !have_partial_symbols ())
1739 error ("No symbol table is loaded. Use the \"file\" command.");
1741 error ("No symbol \"%s\" in current context.", name);
1747 { struct symbol *sym = yyvsp[0].ssym.sym;
1751 if (symbol_read_needs_frame (sym))
1753 if (innermost_block == 0 ||
1754 contained_in (block_found,
1756 innermost_block = block_found;
1759 write_exp_elt_opcode (OP_VAR_VALUE);
1760 /* We want to use the selected frame, not
1761 another more inner frame which happens to
1762 be in the same block. */
1763 write_exp_elt_block (NULL);
1764 write_exp_elt_sym (sym);
1765 write_exp_elt_opcode (OP_VAR_VALUE);
1766 current_type = sym->type; }
1767 else if (yyvsp[0].ssym.is_a_field_of_this)
1769 struct value * this_val;
1770 struct type * this_type;
1771 /* Object pascal: it hangs off of `this'. Must
1772 not inadvertently convert from a method call
1774 if (innermost_block == 0 ||
1775 contained_in (block_found, innermost_block))
1776 innermost_block = block_found;
1777 write_exp_elt_opcode (OP_THIS);
1778 write_exp_elt_opcode (OP_THIS);
1779 write_exp_elt_opcode (STRUCTOP_PTR);
1780 write_exp_string (yyvsp[0].ssym.stoken);
1781 write_exp_elt_opcode (STRUCTOP_PTR);
1782 /* we need type of this */
1783 this_val = value_of_this (0);
1785 this_type = this_val->type;
1789 current_type = lookup_struct_elt_type (
1791 copy_name (yyvsp[0].ssym.stoken), 0);
1793 current_type = NULL;
1797 struct minimal_symbol *msymbol;
1798 char *arg = copy_name (yyvsp[0].ssym.stoken);
1801 lookup_minimal_symbol (arg, NULL, NULL);
1802 if (msymbol != NULL)
1804 write_exp_msymbol (msymbol,
1805 lookup_function_type (builtin_type_int),
1808 else if (!have_full_symbols () && !have_partial_symbols ())
1809 error ("No symbol table is loaded. Use the \"file\" command.");
1811 error ("No symbol \"%s\" in current context.",
1812 copy_name (yyvsp[0].ssym.stoken));
1819 { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); }
1824 { yyval.tval = lookup_pointer_type (yyvsp[0].tval); }
1829 { yyval.tval = yyvsp[0].tsym.type; }
1834 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1835 expression_context_block); }
1840 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1841 expression_context_block); }
1846 { yyval.sval = yyvsp[0].ssym.stoken; }
1851 { yyval.sval = yyvsp[0].ssym.stoken; }
1856 { yyval.sval = yyvsp[0].tsym.stoken; }
1861 { yyval.sval = yyvsp[0].ssym.stoken; }
1867 /* Line 991 of yacc.c. */
1873 YY_STACK_PRINT (yyss, yyssp);
1878 /* Now `shift' the result of the reduction. Determine what state
1879 that goes to, based on the state we popped back to and the rule
1880 number reduced by. */
1884 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1885 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1886 yystate = yytable[yystate];
1888 yystate = yydefgoto[yyn - YYNTOKENS];
1893 /*------------------------------------.
1894 | yyerrlab -- here on detecting error |
1895 `------------------------------------*/
1897 /* If not already recovering from an error, report this error. */
1902 yyn = yypact[yystate];
1904 if (YYPACT_NINF < yyn && yyn < YYLAST)
1906 YYSIZE_T yysize = 0;
1907 int yytype = YYTRANSLATE (yychar);
1912 /* Start YYX at -YYN if negative to avoid negative indexes in
1914 for (yyx = yyn < 0 ? -yyn : 0;
1915 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1916 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1917 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1918 yysize += yystrlen ("syntax error, unexpected ") + 1;
1919 yysize += yystrlen (yytname[yytype]);
1920 yymsg = (char *) YYSTACK_ALLOC (yysize);
1923 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1924 yyp = yystpcpy (yyp, yytname[yytype]);
1929 for (yyx = yyn < 0 ? -yyn : 0;
1930 yyx < (int) (sizeof (yytname) / sizeof (char *));
1932 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1934 const char *yyq = ! yycount ? ", expecting " : " or ";
1935 yyp = yystpcpy (yyp, yyq);
1936 yyp = yystpcpy (yyp, yytname[yyx]);
1941 YYSTACK_FREE (yymsg);
1944 yyerror ("syntax error; also virtual memory exhausted");
1947 #endif /* YYERROR_VERBOSE */
1948 yyerror ("syntax error");
1953 if (yyerrstatus == 3)
1955 /* If just tried and failed to reuse lookahead token after an
1956 error, discard it. */
1958 /* Return failure if at end of input. */
1959 if (yychar == YYEOF)
1961 /* Pop the error token. */
1963 /* Pop the rest of the stack. */
1964 while (yyss < yyssp)
1966 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1967 yydestruct (yystos[*yyssp], yyvsp);
1973 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1974 yydestruct (yytoken, &yylval);
1979 /* Else will try to reuse lookahead token after shifting the error
1984 /*----------------------------------------------------.
1985 | yyerrlab1 -- error raised explicitly by an action. |
1986 `----------------------------------------------------*/
1989 /* Suppress GCC warning that yyerrlab1 is unused when no action
1990 invokes YYERROR. MacOS 10.2.3's buggy "smart preprocessor"
1991 insists on the trailing semicolon. */
1992 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1993 __attribute__ ((__unused__));
2000 /*---------------------------------------------------------------.
2001 | yyerrlab2 -- pop states until the error token can be shifted. |
2002 `---------------------------------------------------------------*/
2004 yyerrstatus = 3; /* Each real token shifted decrements this. */
2008 yyn = yypact[yystate];
2009 if (yyn != YYPACT_NINF)
2012 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2020 /* Pop the current state because it cannot handle the error token. */
2024 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2025 yydestruct (yystos[yystate], yyvsp);
2029 YY_STACK_PRINT (yyss, yyssp);
2035 YYDPRINTF ((stderr, "Shifting error token, "));
2044 /*-------------------------------------.
2045 | yyacceptlab -- YYACCEPT comes here. |
2046 `-------------------------------------*/
2051 /*-----------------------------------.
2052 | yyabortlab -- YYABORT comes here. |
2053 `-----------------------------------*/
2059 /*----------------------------------------------.
2060 | yyoverflowlab -- parser overflow comes here. |
2061 `----------------------------------------------*/
2063 yyerror ("parser stack overflow");
2071 YYSTACK_FREE (yyss);
2080 /* Take care of parsing a number (anything that starts with a digit).
2081 Set yylval and return the token type; update lexptr.
2082 LEN is the number of characters in it. */
2084 /*** Needs some error checking for the float case ***/
2087 parse_number (p, len, parsed_float, putithere)
2093 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
2094 here, and we do kind of silly things like cast to unsigned. */
2101 int base = input_radix;
2104 /* Number of "L" suffixes encountered. */
2107 /* We have found a "L" or "U" suffix. */
2108 int found_suffix = 0;
2111 struct type *signed_type;
2112 struct type *unsigned_type;
2116 /* It's a float since it contains a point or an exponent. */
2118 int num = 0; /* number of tokens scanned by scanf */
2119 char saved_char = p[len];
2121 p[len] = 0; /* null-terminate the token */
2122 if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
2123 num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
2124 else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2125 num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
2128 #ifdef SCANF_HAS_LONG_DOUBLE
2129 num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
2131 /* Scan it into a double, then assign it to the long double.
2132 This at least wins with values representable in the range
2135 num = sscanf (p, "%lg%c", &temp,&c);
2136 putithere->typed_val_float.dval = temp;
2139 p[len] = saved_char; /* restore the input stream */
2140 if (num != 1) /* check scanf found ONLY a float ... */
2142 /* See if it has `f' or `l' suffix (float or long double). */
2144 c = tolower (p[len - 1]);
2147 putithere->typed_val_float.type = builtin_type_float;
2149 putithere->typed_val_float.type = builtin_type_long_double;
2150 else if (isdigit (c) || c == '.')
2151 putithere->typed_val_float.type = builtin_type_double;
2158 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2192 if (c >= 'A' && c <= 'Z')
2194 if (c != 'l' && c != 'u')
2196 if (c >= '0' && c <= '9')
2204 if (base > 10 && c >= 'a' && c <= 'f')
2208 n += i = c - 'a' + 10;
2221 return ERROR; /* Char not a digit */
2224 return ERROR; /* Invalid digit in this base */
2226 /* Portably test for overflow (only works for nonzero values, so make
2227 a second check for zero). FIXME: Can't we just make n and prevn
2228 unsigned and avoid this? */
2229 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2230 unsigned_p = 1; /* Try something unsigned */
2232 /* Portably test for unsigned overflow.
2233 FIXME: This check is wrong; for example it doesn't find overflow
2234 on 0x123456789 when LONGEST is 32 bits. */
2235 if (c != 'l' && c != 'u' && n != 0)
2237 if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2238 error ("Numeric constant too large.");
2243 /* An integer constant is an int, a long, or a long long. An L
2244 suffix forces it to be long; an LL suffix forces it to be long
2245 long. If not forced to a larger size, it gets the first type of
2246 the above that it fits in. To figure out whether it fits, we
2247 shift it right and see whether anything remains. Note that we
2248 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2249 operation, because many compilers will warn about such a shift
2250 (which always produces a zero result). Sometimes TARGET_INT_BIT
2251 or TARGET_LONG_BIT will be that big, sometimes not. To deal with
2252 the case where it is we just always shift the value more than
2253 once, with fewer bits each time. */
2255 un = (ULONGEST)n >> 2;
2257 && (un >> (TARGET_INT_BIT - 2)) == 0)
2259 high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2261 /* A large decimal (not hex or octal) constant (between INT_MAX
2262 and UINT_MAX) is a long or unsigned long, according to ANSI,
2263 never an unsigned int, but this code treats it as unsigned
2264 int. This probably should be fixed. GCC gives a warning on
2267 unsigned_type = builtin_type_unsigned_int;
2268 signed_type = builtin_type_int;
2270 else if (long_p <= 1
2271 && (un >> (TARGET_LONG_BIT - 2)) == 0)
2273 high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2274 unsigned_type = builtin_type_unsigned_long;
2275 signed_type = builtin_type_long;
2280 if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT)
2281 /* A long long does not fit in a LONGEST. */
2282 shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2284 shift = (TARGET_LONG_LONG_BIT - 1);
2285 high_bit = (ULONGEST) 1 << shift;
2286 unsigned_type = builtin_type_unsigned_long_long;
2287 signed_type = builtin_type_long_long;
2290 putithere->typed_val_int.val = n;
2292 /* If the high bit of the worked out type is set then this number
2293 has to be unsigned. */
2295 if (unsigned_p || (n & high_bit))
2297 putithere->typed_val_int.type = unsigned_type;
2301 putithere->typed_val_int.type = signed_type;
2310 struct type *stored;
2311 struct type_push *next;
2314 static struct type_push *tp_top = NULL;
2317 push_current_type (void)
2319 struct type_push *tpnew;
2320 tpnew = (struct type_push *) xmalloc (sizeof (struct type_push));
2321 tpnew->next = tp_top;
2322 tpnew->stored = current_type;
2323 current_type = NULL;
2328 pop_current_type (void)
2330 struct type_push *tp = tp_top;
2333 current_type = tp->stored;
2343 enum exp_opcode opcode;
2346 static const struct token tokentab3[] =
2348 {"shr", RSH, BINOP_END},
2349 {"shl", LSH, BINOP_END},
2350 {"and", ANDAND, BINOP_END},
2351 {"div", DIV, BINOP_END},
2352 {"not", NOT, BINOP_END},
2353 {"mod", MOD, BINOP_END},
2354 {"inc", INCREMENT, BINOP_END},
2355 {"dec", DECREMENT, BINOP_END},
2356 {"xor", XOR, BINOP_END}
2359 static const struct token tokentab2[] =
2361 {"or", OR, BINOP_END},
2362 {"<>", NOTEQUAL, BINOP_END},
2363 {"<=", LEQ, BINOP_END},
2364 {">=", GEQ, BINOP_END},
2365 {":=", ASSIGN, BINOP_END},
2366 {"::", COLONCOLON, BINOP_END} };
2368 /* Allocate uppercased var */
2369 /* make an uppercased copy of tokstart */
2370 static char * uptok (tokstart, namelen)
2375 char *uptokstart = (char *)xmalloc(namelen+1);
2376 for (i = 0;i <= namelen;i++)
2378 if ((tokstart[i]>='a' && tokstart[i]<='z'))
2379 uptokstart[i] = tokstart[i]-('a'-'A');
2381 uptokstart[i] = tokstart[i];
2383 uptokstart[namelen]='\0';
2386 /* Read one token, getting characters through lexptr. */
2399 int explen, tempbufindex;
2400 static char *tempbuf;
2401 static int tempbufsize;
2405 prev_lexptr = lexptr;
2408 explen = strlen (lexptr);
2409 /* See if it is a special token of length 3. */
2411 for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
2412 if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
2413 && (!isalpha (tokentab3[i].operator[0]) || explen == 3
2414 || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
2417 yylval.opcode = tokentab3[i].opcode;
2418 return tokentab3[i].token;
2421 /* See if it is a special token of length 2. */
2423 for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
2424 if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
2425 && (!isalpha (tokentab2[i].operator[0]) || explen == 2
2426 || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
2429 yylval.opcode = tokentab2[i].opcode;
2430 return tokentab2[i].token;
2433 switch (c = *tokstart)
2445 /* We either have a character constant ('0' or '\177' for example)
2446 or we have a quoted symbol reference ('foo(int,int)' in object pascal
2451 c = parse_escape (&lexptr);
2453 error ("Empty character constant.");
2455 yylval.typed_val_int.val = c;
2456 yylval.typed_val_int.type = builtin_type_char;
2461 namelen = skip_quoted (tokstart) - tokstart;
2464 lexptr = tokstart + namelen;
2465 if (lexptr[-1] != '\'')
2466 error ("Unmatched single quote.");
2469 uptokstart = uptok(tokstart,namelen);
2472 error ("Invalid character constant.");
2482 if (paren_depth == 0)
2489 if (comma_terminates && paren_depth == 0)
2495 /* Might be a floating point number. */
2496 if (lexptr[1] < '0' || lexptr[1] > '9')
2497 goto symbol; /* Nope, must be a symbol. */
2498 /* FALL THRU into number case. */
2511 /* It's a number. */
2512 int got_dot = 0, got_e = 0, toktype;
2514 int hex = input_radix > 10;
2516 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2521 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2529 /* This test includes !hex because 'e' is a valid hex digit
2530 and thus does not indicate a floating point number when
2531 the radix is hex. */
2532 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2533 got_dot = got_e = 1;
2534 /* This test does not include !hex, because a '.' always indicates
2535 a decimal floating point number regardless of the radix. */
2536 else if (!got_dot && *p == '.')
2538 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2539 && (*p == '-' || *p == '+'))
2540 /* This is the sign of the exponent, not the end of the
2543 /* We will take any letters or digits. parse_number will
2544 complain if past the radix, or if L or U are not final. */
2545 else if ((*p < '0' || *p > '9')
2546 && ((*p < 'a' || *p > 'z')
2547 && (*p < 'A' || *p > 'Z')))
2550 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2551 if (toktype == ERROR)
2553 char *err_copy = (char *) alloca (p - tokstart + 1);
2555 memcpy (err_copy, tokstart, p - tokstart);
2556 err_copy[p - tokstart] = 0;
2557 error ("Invalid number \"%s\".", err_copy);
2588 /* Build the gdb internal form of the input string in tempbuf,
2589 translating any standard C escape forms seen. Note that the
2590 buffer is null byte terminated *only* for the convenience of
2591 debugging gdb itself and printing the buffer contents when
2592 the buffer contains no embedded nulls. Gdb does not depend
2593 upon the buffer being null byte terminated, it uses the length
2594 string instead. This allows gdb to handle C strings (as well
2595 as strings in other languages) with embedded null bytes */
2597 tokptr = ++tokstart;
2601 /* Grow the static temp buffer if necessary, including allocating
2602 the first one on demand. */
2603 if (tempbufindex + 1 >= tempbufsize)
2605 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2612 /* Do nothing, loop will terminate. */
2616 c = parse_escape (&tokptr);
2621 tempbuf[tempbufindex++] = c;
2624 tempbuf[tempbufindex++] = *tokptr++;
2627 } while ((*tokptr != '"') && (*tokptr != '\0'));
2628 if (*tokptr++ != '"')
2630 error ("Unterminated string in expression.");
2632 tempbuf[tempbufindex] = '\0'; /* See note above */
2633 yylval.sval.ptr = tempbuf;
2634 yylval.sval.length = tempbufindex;
2639 if (!(c == '_' || c == '$'
2640 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2641 /* We must have come across a bad character (e.g. ';'). */
2642 error ("Invalid character '%c' in expression.", c);
2644 /* It's a name. See how long it is. */
2646 for (c = tokstart[namelen];
2647 (c == '_' || c == '$' || (c >= '0' && c <= '9')
2648 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
2650 /* Template parameter lists are part of the name.
2651 FIXME: This mishandles `print $a<4&&$a>3'. */
2655 int nesting_level = 1;
2656 while (tokstart[++i])
2658 if (tokstart[i] == '<')
2660 else if (tokstart[i] == '>')
2662 if (--nesting_level == 0)
2666 if (tokstart[i] == '>')
2672 /* do NOT uppercase internals because of registers !!! */
2673 c = tokstart[++namelen];
2676 uptokstart = uptok(tokstart,namelen);
2678 /* The token "if" terminates the expression and is NOT
2679 removed from the input stream. */
2680 if (namelen == 2 && uptokstart[0] == 'I' && uptokstart[1] == 'F')
2689 /* Catch specific keywords. Should be done with a data structure. */
2693 if (DEPRECATED_STREQ (uptokstart, "OBJECT"))
2695 if (DEPRECATED_STREQ (uptokstart, "RECORD"))
2697 if (DEPRECATED_STREQ (uptokstart, "SIZEOF"))
2701 if (DEPRECATED_STREQ (uptokstart, "CLASS"))
2703 if (DEPRECATED_STREQ (uptokstart, "FALSE"))
2706 return FALSEKEYWORD;
2710 if (DEPRECATED_STREQ (uptokstart, "TRUE"))
2715 if (DEPRECATED_STREQ (uptokstart, "SELF"))
2717 /* here we search for 'this' like
2718 inserted in FPC stabs debug info */
2719 static const char this_name[] = "this";
2721 if (lookup_symbol (this_name, expression_context_block,
2722 VAR_DOMAIN, (int *) NULL,
2723 (struct symtab **) NULL))
2731 yylval.sval.ptr = tokstart;
2732 yylval.sval.length = namelen;
2734 if (*tokstart == '$')
2736 /* $ is the normal prefix for pascal hexadecimal values
2737 but this conflicts with the GDB use for debugger variables
2738 so in expression to enter hexadecimal values
2739 we still need to use C syntax with 0xff */
2740 write_dollar_variable (yylval.sval);
2744 /* Use token-type BLOCKNAME for symbols that happen to be defined as
2745 functions or symtabs. If this is not so, then ...
2746 Use token-type TYPENAME for symbols that happen to be defined
2747 currently as names of types; NAME for other symbols.
2748 The caller is not constrained to care about the distinction. */
2750 char *tmp = copy_name (yylval.sval);
2752 int is_a_field_of_this = 0;
2757 if (search_field && current_type)
2758 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
2762 sym = lookup_symbol (tmp, expression_context_block,
2764 &is_a_field_of_this,
2765 (struct symtab **) NULL);
2766 /* second chance uppercased (as Free Pascal does). */
2767 if (!sym && !is_a_field_of_this && !is_a_field)
2769 for (i = 0; i <= namelen; i++)
2771 if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
2772 tmp[i] -= ('a'-'A');
2774 if (search_field && current_type)
2775 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
2779 sym = lookup_symbol (tmp, expression_context_block,
2781 &is_a_field_of_this,
2782 (struct symtab **) NULL);
2783 if (sym || is_a_field_of_this || is_a_field)
2784 for (i = 0; i <= namelen; i++)
2786 if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
2787 tokstart[i] -= ('a'-'A');
2790 /* Third chance Capitalized (as GPC does). */
2791 if (!sym && !is_a_field_of_this && !is_a_field)
2793 for (i = 0; i <= namelen; i++)
2797 if ((tmp[i] >= 'a' && tmp[i] <= 'z'))
2798 tmp[i] -= ('a'-'A');
2801 if ((tmp[i] >= 'A' && tmp[i] <= 'Z'))
2802 tmp[i] -= ('A'-'a');
2804 if (search_field && current_type)
2805 is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
2809 sym = lookup_symbol (tmp, expression_context_block,
2811 &is_a_field_of_this,
2812 (struct symtab **) NULL);
2813 if (sym || is_a_field_of_this || is_a_field)
2814 for (i = 0; i <= namelen; i++)
2818 if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
2819 tokstart[i] -= ('a'-'A');
2822 if ((tokstart[i] >= 'A' && tokstart[i] <= 'Z'))
2823 tokstart[i] -= ('A'-'a');
2829 tempbuf = (char *) xrealloc (tempbuf, namelen + 1);
2830 strncpy (tempbuf, tokstart, namelen); tempbuf [namelen] = 0;
2831 yylval.sval.ptr = tempbuf;
2832 yylval.sval.length = namelen;
2835 /* Call lookup_symtab, not lookup_partial_symtab, in case there are
2836 no psymtabs (coff, xcoff, or some future change to blow away the
2837 psymtabs once once symbols are read). */
2838 if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
2839 lookup_symtab (tmp))
2841 yylval.ssym.sym = sym;
2842 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2845 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2848 /* Despite the following flaw, we need to keep this code enabled.
2849 Because we can get called from check_stub_method, if we don't
2850 handle nested types then it screws many operations in any
2851 program which uses nested types. */
2852 /* In "A::x", if x is a member function of A and there happens
2853 to be a type (nested or not, since the stabs don't make that
2854 distinction) named x, then this code incorrectly thinks we
2855 are dealing with nested types rather than a member function. */
2859 struct symbol *best_sym;
2861 /* Look ahead to detect nested types. This probably should be
2862 done in the grammar, but trying seemed to introduce a lot
2863 of shift/reduce and reduce/reduce conflicts. It's possible
2864 that it could be done, though. Or perhaps a non-grammar, but
2865 less ad hoc, approach would work well. */
2867 /* Since we do not currently have any way of distinguishing
2868 a nested type from a non-nested one (the stabs don't tell
2869 us whether a type is nested), we just ignore the
2876 /* Skip whitespace. */
2877 while (*p == ' ' || *p == '\t' || *p == '\n')
2879 if (*p == ':' && p[1] == ':')
2881 /* Skip the `::'. */
2883 /* Skip whitespace. */
2884 while (*p == ' ' || *p == '\t' || *p == '\n')
2887 while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
2888 || (*p >= 'a' && *p <= 'z')
2889 || (*p >= 'A' && *p <= 'Z'))
2893 struct symbol *cur_sym;
2894 /* As big as the whole rest of the expression, which is
2895 at least big enough. */
2896 char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
2900 memcpy (tmp1, tmp, strlen (tmp));
2901 tmp1 += strlen (tmp);
2902 memcpy (tmp1, "::", 2);
2904 memcpy (tmp1, namestart, p - namestart);
2905 tmp1[p - namestart] = '\0';
2906 cur_sym = lookup_symbol (ncopy, expression_context_block,
2907 VAR_DOMAIN, (int *) NULL,
2908 (struct symtab **) NULL);
2911 if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
2929 yylval.tsym.type = SYMBOL_TYPE (best_sym);
2931 yylval.tsym.type = SYMBOL_TYPE (sym);
2935 if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2938 /* Input names that aren't symbols but ARE valid hex numbers,
2939 when the input radix permits them, can be names or numbers
2940 depending on the parse. Note we support radixes > 16 here. */
2942 ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2943 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2945 YYSTYPE newlval; /* Its value is ignored. */
2946 hextype = parse_number (tokstart, namelen, 0, &newlval);
2949 yylval.ssym.sym = sym;
2950 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2956 /* Any other kind of symbol */
2957 yylval.ssym.sym = sym;
2958 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2968 lexptr = prev_lexptr;
2970 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);