1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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
76 VOLATILE_KEYWORD
= 278,
104 #define NAME_OR_INT 263
111 #define COLONCOLON 270
114 #define SIGNED_KEYWORD 273
117 #define INT_KEYWORD 276
118 #define CONST_KEYWORD 277
119 #define VOLATILE_KEYWORD 278
120 #define DOUBLE_KEYWORD 279
122 #define ASSIGN_MODIFY 281
123 #define TRUEKEYWORD 282
124 #define FALSEKEYWORD 283
125 #define ABOVE_COMMA 284
134 #define DECREMENT 293
135 #define INCREMENT 294
138 #define BLOCKNAME 297
144 /* Copy the first part of user declarations. */
149 #include "gdb_string.h"
151 #include "expression.h"
153 #include "parser-defs.h"
154 #include "language.h"
156 #include "bfd.h" /* Required by objfiles.h. */
157 #include "symfile.h" /* Required by objfiles.h. */
158 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
161 #include "cp-support.h"
163 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
164 as well as gratuitiously global symbol names, so we can have multiple
165 yacc generated parsers in gdb. Note that these are only the variables
166 produced by yacc. If other parser generators (bison, byacc, etc) produce
167 additional global names that conflict at link time, then those parser
168 generators need to be fixed instead of adding those names to this list. */
170 #define yymaxdepth c_maxdepth
171 #define yyparse c_parse
173 #define yyerror c_error
174 #define yylval c_lval
175 #define yychar c_char
176 #define yydebug c_debug
177 #define yypact c_pact
184 #define yyexca c_exca
185 #define yyerrflag c_errflag
186 #define yynerrs c_nerrs
191 #define yystate c_state
196 #define yylloc c_lloc
197 #define yyreds c_reds /* With YYDEBUG defined */
198 #define yytoks c_toks /* With YYDEBUG defined */
199 #define yyname c_name /* With YYDEBUG defined */
200 #define yyrule c_rule /* With YYDEBUG defined */
201 #define yylhs c_yylhs
202 #define yylen c_yylen
203 #define yydefred c_yydefred
204 #define yydgoto c_yydgoto
205 #define yysindex c_yysindex
206 #define yyrindex c_yyrindex
207 #define yygindex c_yygindex
208 #define yytable c_yytable
209 #define yycheck c_yycheck
212 #define YYDEBUG 1 /* Default to yydebug support */
215 #define YYFPRINTF parser_fprintf
219 static int yylex (void);
221 void yyerror (char *);
225 /* Enabling traces. */
230 /* Enabling verbose error messages. */
231 #ifdef YYERROR_VERBOSE
232 # undef YYERROR_VERBOSE
233 # define YYERROR_VERBOSE 1
235 # define YYERROR_VERBOSE 0
238 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
240 typedef union YYSTYPE
{
254 struct symtoken ssym
;
257 enum exp_opcode opcode
;
258 struct internalvar
*ivar
;
263 /* Line 191 of yacc.c. */
264 #line 265 "c-exp.c.tmp"
265 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
266 # define YYSTYPE_IS_DECLARED 1
267 # define YYSTYPE_IS_TRIVIAL 1
272 /* Copy the second part of user declarations. */
275 /* YYSTYPE gets defined by %union */
276 static int parse_number (char *, int, int, YYSTYPE
*);
279 /* Line 214 of yacc.c. */
280 #line 281 "c-exp.c.tmp"
282 #if ! defined (yyoverflow) || YYERROR_VERBOSE
288 # define YYMALLOC xmalloc
291 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
293 # ifdef YYSTACK_USE_ALLOCA
294 # if YYSTACK_USE_ALLOCA
295 # define YYSTACK_ALLOC alloca
298 # if defined (alloca) || defined (_ALLOCA_H)
299 # define YYSTACK_ALLOC alloca
302 # define YYSTACK_ALLOC __builtin_alloca
307 # ifdef YYSTACK_ALLOC
308 /* Pacify GCC's `empty if-body' warning. */
309 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
311 # if defined (__STDC__) || defined (__cplusplus)
312 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
313 # define YYSIZE_T size_t
315 # define YYSTACK_ALLOC YYMALLOC
316 # define YYSTACK_FREE YYFREE
318 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
321 #if (! defined (yyoverflow) \
322 && (! defined (__cplusplus) \
323 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
325 /* A type that is properly aligned for any stack member. */
332 /* The size of the maximum gap between one aligned stack and the next. */
333 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
335 /* The size of an array large to enough to hold all stacks, each with
337 # define YYSTACK_BYTES(N) \
338 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
339 + YYSTACK_GAP_MAXIMUM)
341 /* Copy COUNT objects from FROM to TO. The source and destination do
344 # if defined (__GNUC__) && 1 < __GNUC__
345 # define YYCOPY(To, From, Count) \
346 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
348 # define YYCOPY(To, From, Count) \
351 register YYSIZE_T yyi; \
352 for (yyi = 0; yyi < (Count); yyi++) \
353 (To)[yyi] = (From)[yyi]; \
359 /* Relocate STACK from its old location to the new one. The
360 local variables YYSIZE and YYSTACKSIZE give the old and new number of
361 elements in the stack, and YYPTR gives the new location of the
362 stack. Advance YYPTR to a properly aligned location for the next
364 # define YYSTACK_RELOCATE(Stack) \
367 YYSIZE_T yynewbytes; \
368 YYCOPY (&yyptr->Stack, Stack, yysize); \
369 Stack = &yyptr->Stack; \
370 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
371 yyptr += yynewbytes / sizeof (*yyptr); \
377 #if defined (__STDC__) || defined (__cplusplus)
378 typedef signed char yysigned_char
;
380 typedef short yysigned_char
;
383 /* YYFINAL -- State number of the termination state. */
385 /* YYLAST -- Last index in YYTABLE. */
388 /* YYNTOKENS -- Number of terminals. */
390 /* YYNNTS -- Number of nonterminals. */
392 /* YYNRULES -- Number of rules. */
394 /* YYNRULES -- Number of states. */
395 #define YYNSTATES 244
397 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
399 #define YYMAXUTOK 298
401 #define YYTRANSLATE(YYX) \
402 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
404 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
405 static const unsigned char yytranslate
[] =
407 0, 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, 61, 2, 2, 2, 51, 37, 2,
411 57, 64, 49, 47, 29, 48, 55, 50, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 67, 2,
413 40, 31, 41, 32, 46, 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, 56, 2, 63, 36, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 65, 35, 66, 62, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
433 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
434 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
435 25, 26, 27, 28, 30, 33, 34, 38, 39, 42,
436 43, 44, 45, 52, 53, 54, 58, 59, 60
440 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
442 static const unsigned short yyprhs
[] =
444 0, 0, 3, 5, 7, 9, 11, 15, 18, 21,
445 24, 27, 30, 33, 36, 39, 42, 45, 48, 52,
446 56, 61, 65, 69, 74, 79, 80, 86, 88, 89,
447 91, 95, 97, 101, 106, 111, 115, 119, 123, 127,
448 131, 135, 139, 143, 147, 151, 155, 159, 163, 167,
449 171, 175, 179, 183, 187, 191, 197, 201, 205, 207,
450 209, 211, 213, 215, 220, 222, 224, 226, 228, 230,
451 234, 238, 242, 247, 249, 252, 254, 257, 259, 260,
452 264, 266, 268, 270, 271, 273, 276, 278, 281, 283,
453 287, 290, 292, 295, 297, 300, 304, 307, 311, 313,
454 317, 319, 321, 323, 325, 328, 332, 335, 339, 343,
455 347, 350, 353, 357, 362, 366, 370, 375, 379, 384,
456 388, 393, 396, 400, 403, 407, 410, 414, 416, 419,
457 422, 425, 428, 431, 434, 436, 439, 441, 447, 450,
458 453, 455, 459, 461, 463, 465, 467, 469, 473, 475,
459 480, 483, 486, 488, 490, 492, 494, 496, 498, 500,
463 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
464 static const yysigned_char yyrhs
[] =
466 69, 0, -1, 71, -1, 70, -1, 89, -1, 72,
467 -1, 71, 29, 72, -1, 49, 72, -1, 37, 72,
468 -1, 48, 72, -1, 47, 72, -1, 61, 72, -1,
469 62, 72, -1, 53, 72, -1, 52, 72, -1, 72,
470 53, -1, 72, 52, -1, 13, 72, -1, 72, 58,
471 97, -1, 72, 58, 79, -1, 72, 58, 49, 72,
472 -1, 72, 55, 97, -1, 72, 55, 79, -1, 72,
473 55, 49, 72, -1, 72, 56, 71, 63, -1, -1,
474 72, 57, 73, 75, 64, -1, 65, -1, -1, 72,
475 -1, 75, 29, 72, -1, 66, -1, 74, 75, 76,
476 -1, 74, 89, 76, 72, -1, 57, 89, 64, 72,
477 -1, 57, 71, 64, -1, 72, 46, 72, -1, 72,
478 49, 72, -1, 72, 50, 72, -1, 72, 51, 72,
479 -1, 72, 47, 72, -1, 72, 48, 72, -1, 72,
480 45, 72, -1, 72, 44, 72, -1, 72, 39, 72,
481 -1, 72, 38, 72, -1, 72, 43, 72, -1, 72,
482 42, 72, -1, 72, 40, 72, -1, 72, 41, 72,
483 -1, 72, 37, 72, -1, 72, 36, 72, -1, 72,
484 35, 72, -1, 72, 34, 72, -1, 72, 33, 72,
485 -1, 72, 32, 72, 67, 72, -1, 72, 31, 72,
486 -1, 72, 26, 72, -1, 3, -1, 8, -1, 4,
487 -1, 78, -1, 25, -1, 13, 57, 89, 64, -1,
488 5, -1, 27, -1, 28, -1, 59, -1, 60, -1,
489 77, 15, 97, -1, 77, 15, 97, -1, 90, 15,
490 97, -1, 90, 15, 62, 97, -1, 79, -1, 15,
491 97, -1, 98, -1, 46, 6, -1, 96, -1, -1,
492 81, 80, 81, -1, 82, -1, 96, -1, 83, -1,
493 -1, 49, -1, 49, 85, -1, 37, -1, 37, 85,
494 -1, 86, -1, 57, 85, 64, -1, 86, 87, -1,
495 87, -1, 86, 88, -1, 88, -1, 56, 63, -1,
496 56, 3, 63, -1, 57, 64, -1, 57, 93, 64,
497 -1, 94, -1, 90, 15, 49, -1, 7, -1, 21,
498 -1, 19, -1, 20, -1, 19, 21, -1, 19, 18,
499 21, -1, 19, 18, -1, 18, 19, 21, -1, 14,
500 19, 21, -1, 19, 14, 21, -1, 19, 14, -1,
501 19, 19, -1, 19, 19, 21, -1, 19, 19, 18,
502 21, -1, 19, 19, 18, -1, 18, 19, 19, -1,
503 18, 19, 19, 21, -1, 14, 19, 19, -1, 14,
504 19, 19, 21, -1, 19, 19, 14, -1, 19, 19,
505 14, 21, -1, 20, 21, -1, 20, 18, 21, -1,
506 20, 18, -1, 14, 20, 21, -1, 20, 14, -1,
507 20, 14, 21, -1, 24, -1, 19, 24, -1, 9,
508 97, -1, 10, 97, -1, 11, 97, -1, 12, 97,
509 -1, 14, 92, -1, 14, -1, 18, 92, -1, 18,
510 -1, 16, 97, 40, 89, 41, -1, 83, 90, -1,
511 90, 83, -1, 91, -1, 90, 15, 97, -1, 7,
512 -1, 21, -1, 19, -1, 20, -1, 89, -1, 93,
513 29, 89, -1, 90, -1, 94, 84, 85, 84, -1,
514 22, 23, -1, 23, 22, -1, 95, -1, 22, -1,
515 23, -1, 6, -1, 59, -1, 7, -1, 8, -1,
519 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
520 static const unsigned short yyrline
[] =
522 0, 231, 231, 232, 235, 242, 243, 248, 252, 256,
523 260, 264, 268, 272, 276, 280, 284, 288, 292, 298,
524 306, 310, 316, 324, 328, 335, 332, 342, 346, 349,
525 353, 357, 360, 367, 373, 379, 385, 389, 393, 397,
526 401, 405, 409, 413, 417, 421, 425, 429, 433, 437,
527 441, 445, 449, 453, 457, 461, 465, 469, 475, 482,
528 493, 500, 503, 507, 515, 540, 547, 556, 564, 570,
529 581, 597, 611, 636, 637, 671, 728, 734, 735, 738,
530 741, 742, 746, 747, 750, 752, 754, 756, 758, 761,
531 763, 768, 775, 777, 781, 783, 787, 789, 801, 802,
532 807, 809, 811, 813, 815, 817, 819, 821, 823, 825,
533 827, 829, 831, 833, 835, 837, 839, 841, 843, 845,
534 847, 849, 851, 853, 855, 857, 859, 861, 863, 865,
535 868, 871, 874, 877, 879, 881, 883, 888, 892, 894,
536 896, 944, 969, 970, 976, 982, 991, 996, 1003, 1004,
537 1008, 1009, 1012, 1016, 1018, 1022, 1023, 1024, 1025, 1028,
542 #if YYDEBUG || YYERROR_VERBOSE
543 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
544 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
545 static const char *const yytname
[] =
547 "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NAME",
548 "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "UNION", "ENUM", "SIZEOF",
549 "UNSIGNED", "COLONCOLON", "TEMPLATE", "ERROR", "SIGNED_KEYWORD", "LONG",
550 "SHORT", "INT_KEYWORD", "CONST_KEYWORD", "VOLATILE_KEYWORD",
551 "DOUBLE_KEYWORD", "VARIABLE", "ASSIGN_MODIFY", "TRUEKEYWORD",
552 "FALSEKEYWORD", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND",
553 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ",
554 "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT",
555 "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "BLOCKNAME",
556 "FILENAME", "'!'", "'~'", "']'", "')'", "'{'", "'}'", "':'", "$accept",
557 "start", "type_exp", "exp1", "exp", "@1", "lcurly", "arglist", "rcurly",
558 "block", "variable", "qualified_name", "space_identifier",
559 "const_or_volatile", "cv_with_space_id",
560 "const_or_volatile_or_space_identifier_noopt",
561 "const_or_volatile_or_space_identifier", "abs_decl", "direct_abs_decl",
562 "array_mod", "func_mod", "type", "typebase", "qualified_type",
563 "typename", "nonempty_typelist", "ptype", "const_and_volatile",
564 "const_or_volatile_noopt", "name", "name_not_typename", 0
569 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
571 static const unsigned short yytoknum
[] =
573 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
574 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
575 275, 276, 277, 278, 279, 280, 281, 282, 283, 44,
576 284, 61, 63, 285, 286, 124, 94, 38, 287, 288,
577 60, 62, 289, 290, 291, 292, 64, 43, 45, 42,
578 47, 37, 293, 294, 295, 46, 91, 40, 296, 297,
579 298, 33, 126, 93, 41, 123, 125, 58
583 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
584 static const unsigned char yyr1
[] =
586 0, 68, 69, 69, 70, 71, 71, 72, 72, 72,
587 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
588 72, 72, 72, 72, 72, 73, 72, 74, 75, 75,
589 75, 76, 72, 72, 72, 72, 72, 72, 72, 72,
590 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
591 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
592 72, 72, 72, 72, 72, 72, 72, 77, 77, 77,
593 78, 79, 79, 78, 78, 78, 80, 81, 81, 82,
594 83, 83, 84, 84, 85, 85, 85, 85, 85, 86,
595 86, 86, 86, 86, 87, 87, 88, 88, 89, 89,
596 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
597 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
598 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
599 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
600 90, 91, 92, 92, 92, 92, 93, 93, 94, 94,
601 95, 95, 96, 96, 96, 97, 97, 97, 97, 98,
605 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
606 static const unsigned char yyr2
[] =
608 0, 2, 1, 1, 1, 1, 3, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
610 4, 3, 3, 4, 4, 0, 5, 1, 0, 1,
611 3, 1, 3, 4, 4, 3, 3, 3, 3, 3,
612 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
613 3, 3, 3, 3, 3, 5, 3, 3, 1, 1,
614 1, 1, 1, 4, 1, 1, 1, 1, 1, 3,
615 3, 3, 4, 1, 2, 1, 2, 1, 0, 3,
616 1, 1, 1, 0, 1, 2, 1, 2, 1, 3,
617 2, 1, 2, 1, 2, 3, 2, 3, 1, 3,
618 1, 1, 1, 1, 2, 3, 2, 3, 3, 3,
619 2, 2, 3, 4, 3, 3, 4, 3, 4, 3,
620 4, 2, 3, 2, 3, 2, 3, 1, 2, 2,
621 2, 2, 2, 2, 1, 2, 1, 5, 2, 2,
622 1, 3, 1, 1, 1, 1, 1, 3, 1, 4,
623 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
627 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
628 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
629 means the default is an error. */
630 static const unsigned char yydefact
[] =
632 78, 58, 60, 64, 159, 100, 59, 0, 0, 0,
633 0, 78, 134, 0, 0, 136, 102, 103, 101, 153,
634 154, 127, 62, 65, 66, 78, 78, 78, 78, 78,
635 78, 78, 160, 68, 78, 78, 27, 0, 3, 2,
636 5, 28, 0, 61, 73, 0, 80, 78, 4, 148,
637 140, 98, 152, 81, 75, 155, 157, 158, 156, 129,
638 130, 131, 132, 78, 17, 78, 142, 144, 145, 143,
639 133, 74, 0, 144, 145, 135, 110, 106, 111, 104,
640 128, 125, 123, 121, 150, 151, 8, 10, 9, 7,
641 14, 13, 0, 0, 11, 12, 1, 78, 78, 78,
642 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
643 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
644 16, 15, 78, 78, 25, 78, 29, 0, 0, 0,
645 0, 78, 138, 0, 139, 82, 0, 0, 0, 117,
646 108, 124, 78, 115, 107, 109, 105, 119, 114, 112,
647 126, 122, 35, 78, 6, 57, 56, 0, 54, 53,
648 52, 51, 50, 45, 44, 48, 49, 47, 46, 43,
649 42, 36, 40, 41, 37, 38, 39, 157, 78, 22,
650 21, 0, 28, 78, 19, 18, 78, 31, 32, 78,
651 70, 76, 79, 77, 0, 99, 0, 71, 86, 84,
652 0, 78, 83, 88, 91, 93, 63, 118, 0, 148,
653 116, 120, 113, 34, 78, 23, 24, 0, 20, 30,
654 33, 141, 72, 87, 85, 0, 94, 96, 0, 146,
655 0, 149, 78, 90, 92, 137, 0, 55, 26, 95,
659 /* YYDEFGOTO[NTERM-NUM]. */
660 static const short yydefgoto
[] =
662 -1, 37, 38, 92, 40, 182, 41, 127, 188, 42,
663 43, 44, 131, 45, 46, 47, 136, 202, 203, 204,
664 205, 229, 65, 50, 70, 230, 51, 52, 53, 197,
668 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
670 #define YYPACT_NINF -58
671 static const short yypact
[] =
673 322, -58, -58, -58, -58, -58, -58, 31, 31, 31,
674 31, 385, 92, 31, 31, 202, 154, 48, -58, -10,
675 29, -58, -58, -58, -58, 322, 322, 322, 322, 322,
676 322, 322, 2, -58, 322, 322, -58, 53, -58, 28,
677 599, 259, 64, -58, -58, 39, -58, 174, -58, 69,
678 -58, 3, -58, 55, -58, -58, -58, -58, -58, -58,
679 -58, -58, -58, 322, 462, 81, -58, 150, 95, -58,
680 -58, -58, 79, 192, -58, -58, 120, 149, 225, -58,
681 -58, 161, 166, -58, -58, -58, 462, 462, 462, 462,
682 462, 462, -19, 135, 462, 462, -58, 322, 322, 322,
683 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
684 322, 322, 322, 322, 322, 322, 322, 322, 322, 322,
685 -58, -58, 196, 322, -58, 533, 599, -18, 158, 31,
686 222, 204, 72, 21, -58, -58, -13, 173, 27, 217,
687 -58, -58, 174, 219, -58, -58, -58, 223, 226, -58,
688 -58, -58, -58, 322, 599, 599, 599, 562, 624, 648,
689 671, 693, 714, 733, 733, 748, 748, 748, 748, 242,
690 242, 305, 368, 368, 462, 462, 462, 85, 322, -58,
691 -58, -17, 259, 322, -58, -58, 322, -58, -58, 322,
692 78, -58, -58, -58, 31, -58, 31, 83, 65, -34,
693 4, 474, 32, 178, -58, -58, 448, -58, 207, 87,
694 -58, -58, -58, 462, 322, 462, -58, -14, 462, 599,
695 462, -58, -58, -58, -58, 186, -58, -58, 187, -58,
696 -8, -58, 116, -58, -58, -58, 12, 528, -58, -58,
700 /* YYPGOTO[NTERM-NUM]. */
701 static const short yypgoto
[] =
703 -58, -58, -58, 6, 47, -58, -58, 68, 124, -58,
704 -58, -57, -58, 123, -58, -35, 54, -22, -58, 56,
705 57, 1, 0, -58, 243, -58, -58, -58, 126, -5,
709 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
710 positive, shift that token. If negative, reduce the rule which
711 number is the opposite. If zero, do what YYDEFACT says.
712 If YYTABLE_NINF, syntax error. */
713 #define YYTABLE_NINF -142
714 static const short yytable
[] =
716 49, 48, 59, 60, 61, 62, 39, 225, 71, 72,
717 97, 186, 97, 84, 134, 186, 135, -67, 55, 56,
718 57, 241, 200, 201, 198, 19, 20, 55, 56, 57,
719 134, 49, 93, 55, 56, 57, 199, 55, 56, 57,
720 -83, 49, 128, 200, 201, 152, 216, 132, 187, -78,
721 238, 85, -83, 96, 19, 20, 242, 97, 64, -83,
722 -83, 195, 81, 49, 137, 179, 82, 226, 184, 83,
723 195, 58, 86, 87, 88, 89, 90, 91, -78, 129,
724 58, 94, 95, 196, 133, 130, 58, 194, 126, 196,
725 58, 19, 20, -69, 19, 20, 138, 134, -141, 66,
726 -100, -77, 236, 19, 20, -141, -141, -100, -100, 19,
727 20, 67, 68, 69, 199, -78, 141, 180, -78, 142,
728 185, 200, 201, 5, 190, 7, 8, 9, 10, 181,
729 12, -100, 14, -78, 15, 16, 17, 18, 19, 20,
730 21, 145, 209, 208, 154, 155, 156, 157, 158, 159,
731 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
732 170, 171, 172, 173, 174, 175, 176, 135, 76, 139,
733 146, 140, 77, 78, 134, 79, 223, 224, 80, 228,
734 227, 5, 150, 7, 8, 9, 10, 151, 12, 221,
735 14, 222, 15, 16, 17, 18, 19, 20, 21, 153,
736 213, 209, 55, 177, 57, 7, 8, 9, 10, 66,
737 12, 143, 14, 144, 15, 16, 17, 18, 19, 20,
738 21, 73, 74, 69, 187, 215, 19, 20, 191, 126,
739 218, 221, 209, 219, 200, 232, 220, 206, 207, 147,
740 210, 209, 243, 148, 211, 178, 149, 212, 235, 239,
741 217, 240, 189, 213, 192, 58, 231, 193, 75, 233,
742 234, 237, 1, 2, 3, 4, 5, 6, 7, 8,
743 9, 10, 11, 12, 13, 14, 0, 15, 16, 17,
744 18, 19, 20, 21, 22, 0, 23, 24, 114, 115,
745 116, 117, 118, 119, 120, 121, 25, 122, 123, 124,
746 125, 0, 0, 0, 0, -78, 26, 27, 28, 0,
747 0, 29, 30, 0, 0, 0, 31, 0, 32, 33,
748 34, 35, 0, 0, 36, 1, 2, 3, 4, 5,
749 6, 7, 8, 9, 10, 11, 12, 13, 14, 0,
750 15, 16, 17, 18, 19, 20, 21, 22, 0, 23,
751 24, 0, 115, 116, 117, 118, 119, 120, 121, 25,
752 122, 123, 124, 125, 0, 0, 0, 0, 0, 26,
753 27, 28, 0, 0, 29, 30, 0, 0, 0, 31,
754 0, 32, 33, 34, 35, 0, 0, 36, 1, 2,
755 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
756 13, 14, 0, 15, 16, 17, 18, 19, 20, 21,
757 22, 0, 23, 24, 0, 0, 0, 117, 118, 119,
758 120, 121, 25, 122, 123, 124, 125, 0, 0, 0,
759 0, 0, 26, 27, 28, 0, 0, 29, 30, 0,
760 0, 0, 63, 0, 32, 33, 34, 35, 0, 0,
761 36, 1, 2, 3, 4, 5, 6, 7, 8, 9,
762 10, 11, 12, 13, 14, 0, 15, 16, 17, 18,
763 19, 20, 21, 22, 0, 23, 24, 0, 0, 0,
764 0, 5, 0, 7, 8, 9, 10, 0, 12, 0,
765 14, 0, 15, 16, 17, 18, 19, 20, 21, 0,
766 29, 30, 0, 0, 0, 31, 0, 32, 33, 34,
767 35, 198, 0, 36, 120, 121, 0, 122, 123, 124,
768 125, 0, 0, 199, 0, 0, 0, 0, 0, 0,
769 200, 201, 0, 0, 0, 0, 0, 0, 227, 55,
770 177, 57, 7, 8, 9, 10, 0, 12, 0, 14,
771 0, 15, 16, 17, 18, 19, 20, 21, 0, 0,
772 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
773 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
774 120, 121, 183, 122, 123, 124, 125, 0, 98, 0,
775 0, 0, 58, 99, 100, 101, 102, 103, 104, 105,
776 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
777 116, 117, 118, 119, 120, 121, 0, 122, 123, 124,
778 125, 0, 0, 0, 0, 98, 0, 0, 0, 214,
779 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
780 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
781 119, 120, 121, 0, 122, 123, 124, 125, 102, 103,
782 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
783 114, 115, 116, 117, 118, 119, 120, 121, 0, 122,
784 123, 124, 125, 103, 104, 105, 106, 107, 108, 109,
785 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
786 120, 121, 0, 122, 123, 124, 125, 104, 105, 106,
787 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
788 117, 118, 119, 120, 121, 0, 122, 123, 124, 125,
789 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
790 115, 116, 117, 118, 119, 120, 121, 0, 122, 123,
791 124, 125, 106, 107, 108, 109, 110, 111, 112, 113,
792 114, 115, 116, 117, 118, 119, 120, 121, 0, 122,
793 123, 124, 125, 108, 109, 110, 111, 112, 113, 114,
794 115, 116, 117, 118, 119, 120, 121, 0, 122, 123,
795 124, 125, 112, 113, 114, 115, 116, 117, 118, 119,
796 120, 121, 0, 122, 123, 124, 125
799 static const short yycheck
[] =
801 0, 0, 7, 8, 9, 10, 0, 3, 13, 14,
802 29, 29, 29, 23, 49, 29, 51, 15, 6, 7,
803 8, 29, 56, 57, 37, 22, 23, 6, 7, 8,
804 65, 31, 31, 6, 7, 8, 49, 6, 7, 8,
805 37, 41, 41, 56, 57, 64, 63, 47, 66, 46,
806 64, 22, 49, 0, 22, 23, 64, 29, 11, 56,
807 57, 49, 14, 63, 63, 122, 18, 63, 125, 21,
808 49, 59, 25, 26, 27, 28, 29, 30, 46, 15,
809 59, 34, 35, 62, 15, 46, 59, 15, 41, 62,
810 59, 22, 23, 15, 22, 23, 15, 132, 15, 7,
811 15, 46, 15, 22, 23, 22, 23, 22, 23, 22,
812 23, 19, 20, 21, 49, 46, 21, 122, 46, 40,
813 125, 56, 57, 7, 129, 9, 10, 11, 12, 123,
814 14, 46, 16, 46, 18, 19, 20, 21, 22, 23,
815 24, 21, 142, 142, 97, 98, 99, 100, 101, 102,
816 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
817 113, 114, 115, 116, 117, 118, 119, 202, 14, 19,
818 21, 21, 18, 19, 209, 21, 198, 199, 24, 201,
819 64, 7, 21, 9, 10, 11, 12, 21, 14, 194,
820 16, 196, 18, 19, 20, 21, 22, 23, 24, 64,
821 153, 201, 6, 7, 8, 9, 10, 11, 12, 7,
822 14, 19, 16, 21, 18, 19, 20, 21, 22, 23,
823 24, 19, 20, 21, 66, 178, 22, 23, 6, 182,
824 183, 236, 232, 186, 56, 57, 189, 64, 21, 14,
825 21, 241, 241, 18, 21, 49, 21, 21, 41, 63,
826 182, 64, 128, 206, 131, 59, 202, 131, 15, 203,
827 203, 214, 3, 4, 5, 6, 7, 8, 9, 10,
828 11, 12, 13, 14, 15, 16, -1, 18, 19, 20,
829 21, 22, 23, 24, 25, -1, 27, 28, 46, 47,
830 48, 49, 50, 51, 52, 53, 37, 55, 56, 57,
831 58, -1, -1, -1, -1, 46, 47, 48, 49, -1,
832 -1, 52, 53, -1, -1, -1, 57, -1, 59, 60,
833 61, 62, -1, -1, 65, 3, 4, 5, 6, 7,
834 8, 9, 10, 11, 12, 13, 14, 15, 16, -1,
835 18, 19, 20, 21, 22, 23, 24, 25, -1, 27,
836 28, -1, 47, 48, 49, 50, 51, 52, 53, 37,
837 55, 56, 57, 58, -1, -1, -1, -1, -1, 47,
838 48, 49, -1, -1, 52, 53, -1, -1, -1, 57,
839 -1, 59, 60, 61, 62, -1, -1, 65, 3, 4,
840 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
841 15, 16, -1, 18, 19, 20, 21, 22, 23, 24,
842 25, -1, 27, 28, -1, -1, -1, 49, 50, 51,
843 52, 53, 37, 55, 56, 57, 58, -1, -1, -1,
844 -1, -1, 47, 48, 49, -1, -1, 52, 53, -1,
845 -1, -1, 57, -1, 59, 60, 61, 62, -1, -1,
846 65, 3, 4, 5, 6, 7, 8, 9, 10, 11,
847 12, 13, 14, 15, 16, -1, 18, 19, 20, 21,
848 22, 23, 24, 25, -1, 27, 28, -1, -1, -1,
849 -1, 7, -1, 9, 10, 11, 12, -1, 14, -1,
850 16, -1, 18, 19, 20, 21, 22, 23, 24, -1,
851 52, 53, -1, -1, -1, 57, -1, 59, 60, 61,
852 62, 37, -1, 65, 52, 53, -1, 55, 56, 57,
853 58, -1, -1, 49, -1, -1, -1, -1, -1, -1,
854 56, 57, -1, -1, -1, -1, -1, -1, 64, 6,
855 7, 8, 9, 10, 11, 12, -1, 14, -1, 16,
856 -1, 18, 19, 20, 21, 22, 23, 24, -1, -1,
857 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
858 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
859 52, 53, 49, 55, 56, 57, 58, -1, 26, -1,
860 -1, -1, 59, 31, 32, 33, 34, 35, 36, 37,
861 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
862 48, 49, 50, 51, 52, 53, -1, 55, 56, 57,
863 58, -1, -1, -1, -1, 26, -1, -1, -1, 67,
864 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
865 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
866 51, 52, 53, -1, 55, 56, 57, 58, 34, 35,
867 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
868 46, 47, 48, 49, 50, 51, 52, 53, -1, 55,
869 56, 57, 58, 35, 36, 37, 38, 39, 40, 41,
870 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
871 52, 53, -1, 55, 56, 57, 58, 36, 37, 38,
872 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
873 49, 50, 51, 52, 53, -1, 55, 56, 57, 58,
874 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
875 47, 48, 49, 50, 51, 52, 53, -1, 55, 56,
876 57, 58, 38, 39, 40, 41, 42, 43, 44, 45,
877 46, 47, 48, 49, 50, 51, 52, 53, -1, 55,
878 56, 57, 58, 40, 41, 42, 43, 44, 45, 46,
879 47, 48, 49, 50, 51, 52, 53, -1, 55, 56,
880 57, 58, 44, 45, 46, 47, 48, 49, 50, 51,
881 52, 53, -1, 55, 56, 57, 58
884 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
885 symbol of state STATE-NUM. */
886 static const unsigned char yystos
[] =
888 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
889 12, 13, 14, 15, 16, 18, 19, 20, 21, 22,
890 23, 24, 25, 27, 28, 37, 47, 48, 49, 52,
891 53, 57, 59, 60, 61, 62, 65, 69, 70, 71,
892 72, 74, 77, 78, 79, 81, 82, 83, 89, 90,
893 91, 94, 95, 96, 98, 6, 7, 8, 59, 97,
894 97, 97, 97, 57, 72, 90, 7, 19, 20, 21,
895 92, 97, 97, 19, 20, 92, 14, 18, 19, 21,
896 24, 14, 18, 21, 23, 22, 72, 72, 72, 72,
897 72, 72, 71, 89, 72, 72, 0, 29, 26, 31,
898 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
899 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
900 52, 53, 55, 56, 57, 58, 72, 75, 89, 15,
901 46, 80, 90, 15, 83, 83, 84, 89, 15, 19,
902 21, 21, 40, 19, 21, 21, 21, 14, 18, 21,
903 21, 21, 64, 64, 72, 72, 72, 72, 72, 72,
904 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
905 72, 72, 72, 72, 72, 72, 72, 7, 49, 79,
906 97, 71, 73, 49, 79, 97, 29, 66, 76, 76,
907 97, 6, 81, 96, 15, 49, 62, 97, 37, 49,
908 56, 57, 85, 86, 87, 88, 64, 21, 89, 90,
909 21, 21, 21, 72, 67, 72, 63, 75, 72, 72,
910 72, 97, 97, 85, 85, 3, 63, 64, 85, 89,
911 93, 84, 57, 87, 88, 41, 15, 72, 64, 63,
915 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
916 # define YYSIZE_T __SIZE_TYPE__
918 #if ! defined (YYSIZE_T) && defined (size_t)
919 # define YYSIZE_T size_t
921 #if ! defined (YYSIZE_T)
922 # if defined (__STDC__) || defined (__cplusplus)
923 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
924 # define YYSIZE_T size_t
927 #if ! defined (YYSIZE_T)
928 # define YYSIZE_T unsigned int
931 #define yyerrok (yyerrstatus = 0)
932 #define yyclearin (yychar = YYEMPTY)
936 #define YYACCEPT goto yyacceptlab
937 #define YYABORT goto yyabortlab
938 #define YYERROR goto yyerrorlab
941 /* Like YYERROR except do call yyerror. This remains here temporarily
942 to ease the transition to the new meaning of YYERROR, for GCC.
943 Once GCC version 2 has supplanted version 1, this can go. */
945 #define YYFAIL goto yyerrlab
947 #define YYRECOVERING() (!!yyerrstatus)
949 #define YYBACKUP(Token, Value) \
951 if (yychar == YYEMPTY && yylen == 1) \
955 yytoken = YYTRANSLATE (yychar); \
961 yyerror ("syntax error: cannot back up");\
967 #define YYERRCODE 256
969 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
972 #ifndef YYLLOC_DEFAULT
973 # define YYLLOC_DEFAULT(Current, Rhs, N) \
974 ((Current).first_line = (Rhs)[1].first_line, \
975 (Current).first_column = (Rhs)[1].first_column, \
976 (Current).last_line = (Rhs)[N].last_line, \
977 (Current).last_column = (Rhs)[N].last_column)
980 /* YYLEX -- calling `yylex' with the right arguments. */
983 # define YYLEX yylex (YYLEX_PARAM)
985 # define YYLEX yylex ()
988 /* Enable debugging if requested. */
992 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
993 # define YYFPRINTF fprintf
996 # define YYDPRINTF(Args) \
1002 # define YYDSYMPRINT(Args) \
1008 # define YYDSYMPRINTF(Title, Token, Value, Location) \
1012 YYFPRINTF (stderr, "%s ", Title); \
1013 yysymprint (stderr, \
1015 YYFPRINTF (stderr, "\n"); \
1019 /*------------------------------------------------------------------.
1020 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1022 `------------------------------------------------------------------*/
1024 #if defined (__STDC__) || defined (__cplusplus)
1026 yy_stack_print (short *bottom
, short *top
)
1029 yy_stack_print (bottom
, top
)
1034 YYFPRINTF (stderr
, "Stack now");
1035 for (/* Nothing. */; bottom
<= top
; ++bottom
)
1036 YYFPRINTF (stderr
, " %d", *bottom
);
1037 YYFPRINTF (stderr
, "\n");
1040 # define YY_STACK_PRINT(Bottom, Top) \
1043 yy_stack_print ((Bottom), (Top)); \
1047 /*------------------------------------------------.
1048 | Report that the YYRULE is going to be reduced. |
1049 `------------------------------------------------*/
1051 #if defined (__STDC__) || defined (__cplusplus)
1053 yy_reduce_print (int yyrule
)
1056 yy_reduce_print (yyrule
)
1061 unsigned int yylno
= yyrline
[yyrule
];
1062 YYFPRINTF (stderr
, "Reducing stack by rule %d (line %u), ",
1064 /* Print the symbols being reduced, and their result. */
1065 for (yyi
= yyprhs
[yyrule
]; 0 <= yyrhs
[yyi
]; yyi
++)
1066 YYFPRINTF (stderr
, "%s ", yytname
[yyrhs
[yyi
]]);
1067 YYFPRINTF (stderr
, "-> %s\n", yytname
[yyr1
[yyrule
]]);
1070 # define YY_REDUCE_PRINT(Rule) \
1073 yy_reduce_print (Rule); \
1076 /* Nonzero means print parse trace. It is left uninitialized so that
1077 multiple parsers can coexist. */
1079 #else /* !YYDEBUG */
1080 # define YYDPRINTF(Args)
1081 # define YYDSYMPRINT(Args)
1082 # define YYDSYMPRINTF(Title, Token, Value, Location)
1083 # define YY_STACK_PRINT(Bottom, Top)
1084 # define YY_REDUCE_PRINT(Rule)
1085 #endif /* !YYDEBUG */
1088 /* YYINITDEPTH -- initial size of the parser's stacks. */
1090 # define YYINITDEPTH 200
1093 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1094 if the built-in stack extension method is used).
1096 Do not make this value too large; the results are undefined if
1097 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1098 evaluated with infinite-precision integer arithmetic. */
1100 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1105 # define YYMAXDEPTH 10000
1113 # if defined (__GLIBC__) && defined (_STRING_H)
1114 # define yystrlen strlen
1116 /* Return the length of YYSTR. */
1118 # if defined (__STDC__) || defined (__cplusplus)
1119 yystrlen (const char *yystr
)
1125 register const char *yys
= yystr
;
1127 while (*yys
++ != '\0')
1130 return yys
- yystr
- 1;
1136 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1137 # define yystpcpy stpcpy
1139 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1142 # if defined (__STDC__) || defined (__cplusplus)
1143 yystpcpy (char *yydest
, const char *yysrc
)
1145 yystpcpy (yydest
, yysrc
)
1150 register char *yyd
= yydest
;
1151 register const char *yys
= yysrc
;
1153 while ((*yyd
++ = *yys
++) != '\0')
1161 #endif /* !YYERROR_VERBOSE */
1166 /*--------------------------------.
1167 | Print this symbol on YYOUTPUT. |
1168 `--------------------------------*/
1170 #if defined (__STDC__) || defined (__cplusplus)
1172 yysymprint (FILE *yyoutput
, int yytype
, YYSTYPE
*yyvaluep
)
1175 yysymprint (yyoutput
, yytype
, yyvaluep
)
1181 /* Pacify ``unused variable'' warnings. */
1184 if (yytype
< YYNTOKENS
)
1186 YYFPRINTF (yyoutput
, "token %s (", yytname
[yytype
]);
1188 YYPRINT (yyoutput
, yytoknum
[yytype
], *yyvaluep
);
1192 YYFPRINTF (yyoutput
, "nterm %s (", yytname
[yytype
]);
1199 YYFPRINTF (yyoutput
, ")");
1202 #endif /* ! YYDEBUG */
1203 /*-----------------------------------------------.
1204 | Release the memory associated to this symbol. |
1205 `-----------------------------------------------*/
1207 #if defined (__STDC__) || defined (__cplusplus)
1209 yydestruct (int yytype
, YYSTYPE
*yyvaluep
)
1212 yydestruct (yytype
, yyvaluep
)
1217 /* Pacify ``unused variable'' warnings. */
1229 /* Prevent warnings from -Wmissing-prototypes. */
1231 #ifdef YYPARSE_PARAM
1232 # if defined (__STDC__) || defined (__cplusplus)
1233 int yyparse (void *YYPARSE_PARAM
);
1237 #else /* ! YYPARSE_PARAM */
1238 #if defined (__STDC__) || defined (__cplusplus)
1243 #endif /* ! YYPARSE_PARAM */
1247 /* The lookahead symbol. */
1250 /* The semantic value of the lookahead symbol. */
1253 /* Number of syntax errors so far. */
1262 #ifdef YYPARSE_PARAM
1263 # if defined (__STDC__) || defined (__cplusplus)
1264 int yyparse (void *YYPARSE_PARAM
)
1266 int yyparse (YYPARSE_PARAM
)
1267 void *YYPARSE_PARAM
;
1269 #else /* ! YYPARSE_PARAM */
1270 #if defined (__STDC__) || defined (__cplusplus)
1281 register int yystate
;
1284 /* Number of tokens to shift before error messages enabled. */
1286 /* Lookahead token as an internal (translated) token number. */
1289 /* Three stacks and their tools:
1290 `yyss': related to states,
1291 `yyvs': related to semantic values,
1292 `yyls': related to locations.
1294 Refer to the stacks thru separate pointers, to allow yyoverflow
1295 to xreallocate them elsewhere. */
1297 /* The state stack. */
1298 short yyssa
[YYINITDEPTH
];
1299 short *yyss
= yyssa
;
1300 register short *yyssp
;
1302 /* The semantic value stack. */
1303 YYSTYPE yyvsa
[YYINITDEPTH
];
1304 YYSTYPE
*yyvs
= yyvsa
;
1305 register YYSTYPE
*yyvsp
;
1309 #define YYPOPSTACK (yyvsp--, yyssp--)
1311 YYSIZE_T yystacksize
= YYINITDEPTH
;
1313 /* The variables used to return semantic value and location from the
1318 /* When reducing, the number of symbols on the RHS of the reduced
1322 YYDPRINTF ((stderr
, "Starting parse\n"));
1327 yychar
= YYEMPTY
; /* Cause a token to be read. */
1329 /* Initialize stack pointers.
1330 Waste one element of value and location stack
1331 so that they stay on the same level as the state stack.
1332 The wasted elements are never initialized. */
1339 /*------------------------------------------------------------.
1340 | yynewstate -- Push a new state, which is found in yystate. |
1341 `------------------------------------------------------------*/
1343 /* In all cases, when you get here, the value and location stacks
1344 have just been pushed. so pushing a state here evens the stacks.
1351 if (yyss
+ yystacksize
- 1 <= yyssp
)
1353 /* Get the current used size of the three stacks, in elements. */
1354 YYSIZE_T yysize
= yyssp
- yyss
+ 1;
1358 /* Give user a chance to xreallocate the stack. Use copies of
1359 these so that the &'s don't force the real ones into
1361 YYSTYPE
*yyvs1
= yyvs
;
1362 short *yyss1
= yyss
;
1365 /* Each stack pointer address is followed by the size of the
1366 data in use in that stack, in bytes. This used to be a
1367 conditional around just the two extra args, but that might
1368 be undefined if yyoverflow is a macro. */
1369 yyoverflow ("parser stack overflow",
1370 &yyss1
, yysize
* sizeof (*yyssp
),
1371 &yyvs1
, yysize
* sizeof (*yyvsp
),
1378 #else /* no yyoverflow */
1379 # ifndef YYSTACK_RELOCATE
1382 /* Extend the stack our own way. */
1383 if (YYMAXDEPTH
<= yystacksize
)
1386 if (YYMAXDEPTH
< yystacksize
)
1387 yystacksize
= YYMAXDEPTH
;
1390 short *yyss1
= yyss
;
1391 union yyalloc
*yyptr
=
1392 (union yyalloc
*) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize
));
1395 YYSTACK_RELOCATE (yyss
);
1396 YYSTACK_RELOCATE (yyvs
);
1398 # undef YYSTACK_RELOCATE
1400 YYSTACK_FREE (yyss1
);
1403 #endif /* no yyoverflow */
1405 yyssp
= yyss
+ yysize
- 1;
1406 yyvsp
= yyvs
+ yysize
- 1;
1409 YYDPRINTF ((stderr
, "Stack size increased to %lu\n",
1410 (unsigned long int) yystacksize
));
1412 if (yyss
+ yystacksize
- 1 <= yyssp
)
1416 YYDPRINTF ((stderr
, "Entering state %d\n", yystate
));
1425 /* Do appropriate processing given the current state. */
1426 /* Read a lookahead token if we need one and don't already have one. */
1429 /* First try to decide what to do without reference to lookahead token. */
1431 yyn
= yypact
[yystate
];
1432 if (yyn
== YYPACT_NINF
)
1435 /* Not known => get a lookahead token if don't already have one. */
1437 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1438 if (yychar
== YYEMPTY
)
1440 YYDPRINTF ((stderr
, "Reading a token: "));
1444 if (yychar
<= YYEOF
)
1446 yychar
= yytoken
= YYEOF
;
1447 YYDPRINTF ((stderr
, "Now at end of input.\n"));
1451 yytoken
= YYTRANSLATE (yychar
);
1452 YYDSYMPRINTF ("Next token is", yytoken
, &yylval
, &yylloc
);
1455 /* If the proper action on seeing token YYTOKEN is to reduce or to
1456 detect an error, take that action. */
1458 if (yyn
< 0 || YYLAST
< yyn
|| yycheck
[yyn
] != yytoken
)
1463 if (yyn
== 0 || yyn
== YYTABLE_NINF
)
1472 /* Shift the lookahead token. */
1473 YYDPRINTF ((stderr
, "Shifting token %s, ", yytname
[yytoken
]));
1475 /* Discard the token being shifted unless it is eof. */
1476 if (yychar
!= YYEOF
)
1482 /* Count tokens shifted since error; after three, turn off error
1491 /*-----------------------------------------------------------.
1492 | yydefault -- do the default action for the current state. |
1493 `-----------------------------------------------------------*/
1495 yyn
= yydefact
[yystate
];
1501 /*-----------------------------.
1502 | yyreduce -- Do a reduction. |
1503 `-----------------------------*/
1505 /* yyn is the number of a rule to reduce with. */
1508 /* If YYLEN is nonzero, implement the default value of the action:
1511 Otherwise, the following line sets YYVAL to garbage.
1512 This behavior is undocumented and Bison
1513 users should not rely upon it. Assigning to YYVAL
1514 unconditionally makes the parser a bit smaller, and it avoids a
1515 GCC warning that YYVAL may be used uninitialized. */
1516 yyval
= yyvsp
[1-yylen
];
1519 YY_REDUCE_PRINT (yyn
);
1524 { write_exp_elt_opcode(OP_TYPE
);
1525 write_exp_elt_type(yyvsp
[0].tval
);
1526 write_exp_elt_opcode(OP_TYPE
);}
1531 { write_exp_elt_opcode (BINOP_COMMA
); }
1536 { write_exp_elt_opcode (UNOP_IND
); }
1541 { write_exp_elt_opcode (UNOP_ADDR
); }
1546 { write_exp_elt_opcode (UNOP_NEG
); }
1551 { write_exp_elt_opcode (UNOP_PLUS
); }
1556 { write_exp_elt_opcode (UNOP_LOGICAL_NOT
); }
1561 { write_exp_elt_opcode (UNOP_COMPLEMENT
); }
1566 { write_exp_elt_opcode (UNOP_PREINCREMENT
); }
1571 { write_exp_elt_opcode (UNOP_PREDECREMENT
); }
1576 { write_exp_elt_opcode (UNOP_POSTINCREMENT
); }
1581 { write_exp_elt_opcode (UNOP_POSTDECREMENT
); }
1586 { write_exp_elt_opcode (UNOP_SIZEOF
); }
1591 { write_exp_elt_opcode (STRUCTOP_PTR
);
1592 write_exp_string (yyvsp
[0].sval
);
1593 write_exp_elt_opcode (STRUCTOP_PTR
); }
1598 { /* exp->type::name becomes exp->*(&type::name) */
1599 /* Note: this doesn't work if name is a
1600 static member! FIXME */
1601 write_exp_elt_opcode (UNOP_ADDR
);
1602 write_exp_elt_opcode (STRUCTOP_MPTR
); }
1607 { write_exp_elt_opcode (STRUCTOP_MPTR
); }
1612 { write_exp_elt_opcode (STRUCTOP_STRUCT
);
1613 write_exp_string (yyvsp
[0].sval
);
1614 write_exp_elt_opcode (STRUCTOP_STRUCT
); }
1619 { /* exp.type::name becomes exp.*(&type::name) */
1620 /* Note: this doesn't work if name is a
1621 static member! FIXME */
1622 write_exp_elt_opcode (UNOP_ADDR
);
1623 write_exp_elt_opcode (STRUCTOP_MEMBER
); }
1628 { write_exp_elt_opcode (STRUCTOP_MEMBER
); }
1633 { write_exp_elt_opcode (BINOP_SUBSCRIPT
); }
1638 { start_arglist (); }
1643 { write_exp_elt_opcode (OP_FUNCALL
);
1644 write_exp_elt_longcst ((LONGEST
) end_arglist ());
1645 write_exp_elt_opcode (OP_FUNCALL
); }
1650 { start_arglist (); }
1655 { arglist_len
= 1; }
1665 { yyval
.lval
= end_arglist () - 1; }
1670 { write_exp_elt_opcode (OP_ARRAY
);
1671 write_exp_elt_longcst ((LONGEST
) 0);
1672 write_exp_elt_longcst ((LONGEST
) yyvsp
[0].lval
);
1673 write_exp_elt_opcode (OP_ARRAY
); }
1678 { write_exp_elt_opcode (UNOP_MEMVAL
);
1679 write_exp_elt_type (yyvsp
[-2].tval
);
1680 write_exp_elt_opcode (UNOP_MEMVAL
); }
1685 { write_exp_elt_opcode (UNOP_CAST
);
1686 write_exp_elt_type (yyvsp
[-2].tval
);
1687 write_exp_elt_opcode (UNOP_CAST
); }
1697 { write_exp_elt_opcode (BINOP_REPEAT
); }
1702 { write_exp_elt_opcode (BINOP_MUL
); }
1707 { write_exp_elt_opcode (BINOP_DIV
); }
1712 { write_exp_elt_opcode (BINOP_REM
); }
1717 { write_exp_elt_opcode (BINOP_ADD
); }
1722 { write_exp_elt_opcode (BINOP_SUB
); }
1727 { write_exp_elt_opcode (BINOP_LSH
); }
1732 { write_exp_elt_opcode (BINOP_RSH
); }
1737 { write_exp_elt_opcode (BINOP_EQUAL
); }
1742 { write_exp_elt_opcode (BINOP_NOTEQUAL
); }
1747 { write_exp_elt_opcode (BINOP_LEQ
); }
1752 { write_exp_elt_opcode (BINOP_GEQ
); }
1757 { write_exp_elt_opcode (BINOP_LESS
); }
1762 { write_exp_elt_opcode (BINOP_GTR
); }
1767 { write_exp_elt_opcode (BINOP_BITWISE_AND
); }
1772 { write_exp_elt_opcode (BINOP_BITWISE_XOR
); }
1777 { write_exp_elt_opcode (BINOP_BITWISE_IOR
); }
1782 { write_exp_elt_opcode (BINOP_LOGICAL_AND
); }
1787 { write_exp_elt_opcode (BINOP_LOGICAL_OR
); }
1792 { write_exp_elt_opcode (TERNOP_COND
); }
1797 { write_exp_elt_opcode (BINOP_ASSIGN
); }
1802 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY
);
1803 write_exp_elt_opcode (yyvsp
[-1].opcode
);
1804 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY
); }
1809 { write_exp_elt_opcode (OP_LONG
);
1810 write_exp_elt_type (yyvsp
[0].typed_val_int
.type
);
1811 write_exp_elt_longcst ((LONGEST
)(yyvsp
[0].typed_val_int
.val
));
1812 write_exp_elt_opcode (OP_LONG
); }
1818 parse_number (yyvsp
[0].ssym
.stoken
.ptr
, yyvsp
[0].ssym
.stoken
.length
, 0, &val
);
1819 write_exp_elt_opcode (OP_LONG
);
1820 write_exp_elt_type (val
.typed_val_int
.type
);
1821 write_exp_elt_longcst ((LONGEST
)val
.typed_val_int
.val
);
1822 write_exp_elt_opcode (OP_LONG
);
1828 { write_exp_elt_opcode (OP_DOUBLE
);
1829 write_exp_elt_type (yyvsp
[0].typed_val_float
.type
);
1830 write_exp_elt_dblcst (yyvsp
[0].typed_val_float
.dval
);
1831 write_exp_elt_opcode (OP_DOUBLE
); }
1836 { write_exp_elt_opcode (OP_LONG
);
1837 write_exp_elt_type (builtin_type (current_gdbarch
)->builtin_int
);
1838 CHECK_TYPEDEF (yyvsp
[-1].tval
);
1839 write_exp_elt_longcst ((LONGEST
) TYPE_LENGTH (yyvsp
[-1].tval
));
1840 write_exp_elt_opcode (OP_LONG
); }
1845 { /* C strings are converted into array constants with
1846 an explicit null byte added at the end. Thus
1847 the array upper bound is the string length.
1848 There is no such thing in C as a completely empty
1850 char *sp
= yyvsp
[0].sval
.ptr
; int count
= yyvsp
[0].sval
.length
;
1853 write_exp_elt_opcode (OP_LONG
);
1854 write_exp_elt_type (builtin_type (current_gdbarch
)->builtin_char
);
1855 write_exp_elt_longcst ((LONGEST
)(*sp
++));
1856 write_exp_elt_opcode (OP_LONG
);
1858 write_exp_elt_opcode (OP_LONG
);
1859 write_exp_elt_type (builtin_type (current_gdbarch
)->builtin_char
);
1860 write_exp_elt_longcst ((LONGEST
)'\0');
1861 write_exp_elt_opcode (OP_LONG
);
1862 write_exp_elt_opcode (OP_ARRAY
);
1863 write_exp_elt_longcst ((LONGEST
) 0);
1864 write_exp_elt_longcst ((LONGEST
) (yyvsp
[0].sval
.length
));
1865 write_exp_elt_opcode (OP_ARRAY
); }
1870 { write_exp_elt_opcode (OP_LONG
);
1871 write_exp_elt_type (builtin_type (current_gdbarch
)->builtin_bool
);
1872 write_exp_elt_longcst ((LONGEST
) 1);
1873 write_exp_elt_opcode (OP_LONG
); }
1878 { write_exp_elt_opcode (OP_LONG
);
1879 write_exp_elt_type (builtin_type (current_gdbarch
)->builtin_bool
);
1880 write_exp_elt_longcst ((LONGEST
) 0);
1881 write_exp_elt_opcode (OP_LONG
); }
1887 if (yyvsp
[0].ssym
.sym
)
1888 yyval
.bval
= SYMBOL_BLOCK_VALUE (yyvsp
[0].ssym
.sym
);
1890 error ("No file or function \"%s\".",
1891 copy_name (yyvsp
[0].ssym
.stoken
));
1898 yyval
.bval
= yyvsp
[0].bval
;
1904 { struct symbol
*tem
1905 = lookup_symbol (copy_name (yyvsp
[0].sval
), yyvsp
[-2].bval
,
1906 VAR_DOMAIN
, (int *) NULL
,
1907 (struct symtab
**) NULL
);
1908 if (!tem
|| SYMBOL_CLASS (tem
) != LOC_BLOCK
)
1909 error ("No function \"%s\" in specified context.",
1910 copy_name (yyvsp
[0].sval
));
1911 yyval
.bval
= SYMBOL_BLOCK_VALUE (tem
); }
1916 { struct symbol
*sym
;
1917 sym
= lookup_symbol (copy_name (yyvsp
[0].sval
), yyvsp
[-2].bval
,
1918 VAR_DOMAIN
, (int *) NULL
,
1919 (struct symtab
**) NULL
);
1921 error ("No symbol \"%s\" in specified context.",
1922 copy_name (yyvsp
[0].sval
));
1924 write_exp_elt_opcode (OP_VAR_VALUE
);
1925 /* block_found is set by lookup_symbol. */
1926 write_exp_elt_block (block_found
);
1927 write_exp_elt_sym (sym
);
1928 write_exp_elt_opcode (OP_VAR_VALUE
); }
1934 struct type
*type
= yyvsp
[-2].tval
;
1935 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1936 && TYPE_CODE (type
) != TYPE_CODE_UNION
1937 && TYPE_CODE (type
) != TYPE_CODE_NAMESPACE
)
1938 error ("`%s' is not defined as an aggregate type.",
1941 write_exp_elt_opcode (OP_SCOPE
);
1942 write_exp_elt_type (type
);
1943 write_exp_string (yyvsp
[0].sval
);
1944 write_exp_elt_opcode (OP_SCOPE
);
1951 struct type
*type
= yyvsp
[-3].tval
;
1952 struct stoken tmp_token
;
1953 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
1954 && TYPE_CODE (type
) != TYPE_CODE_UNION
1955 && TYPE_CODE (type
) != TYPE_CODE_NAMESPACE
)
1956 error ("`%s' is not defined as an aggregate type.",
1959 tmp_token
.ptr
= (char*) alloca (yyvsp
[0].sval
.length
+ 2);
1960 tmp_token
.length
= yyvsp
[0].sval
.length
+ 1;
1961 tmp_token
.ptr
[0] = '~';
1962 memcpy (tmp_token
.ptr
+1, yyvsp
[0].sval
.ptr
, yyvsp
[0].sval
.length
);
1963 tmp_token
.ptr
[tmp_token
.length
] = 0;
1965 /* Check for valid destructor name. */
1966 destructor_name_p (tmp_token
.ptr
, type
);
1967 write_exp_elt_opcode (OP_SCOPE
);
1968 write_exp_elt_type (type
);
1969 write_exp_string (tmp_token
);
1970 write_exp_elt_opcode (OP_SCOPE
);
1977 char *name
= copy_name (yyvsp
[0].sval
);
1979 struct minimal_symbol
*msymbol
;
1982 lookup_symbol (name
, (const struct block
*) NULL
,
1983 VAR_DOMAIN
, (int *) NULL
,
1984 (struct symtab
**) NULL
);
1987 write_exp_elt_opcode (OP_VAR_VALUE
);
1988 write_exp_elt_block (NULL
);
1989 write_exp_elt_sym (sym
);
1990 write_exp_elt_opcode (OP_VAR_VALUE
);
1994 msymbol
= lookup_minimal_symbol (name
, NULL
, NULL
);
1995 if (msymbol
!= NULL
)
1997 write_exp_msymbol (msymbol
,
1998 lookup_function_type (builtin_type (current_gdbarch
)->builtin_int
),
1999 builtin_type (current_gdbarch
)->builtin_int
);
2002 if (!have_full_symbols () && !have_partial_symbols ())
2003 error ("No symbol table is loaded. Use the \"file\" command.");
2005 error ("No symbol \"%s\" in current context.", name
);
2011 { struct symbol
*sym
= yyvsp
[0].ssym
.sym
;
2015 if (symbol_read_needs_frame (sym
))
2017 if (innermost_block
== 0 ||
2018 contained_in (block_found
,
2020 innermost_block
= block_found
;
2023 write_exp_elt_opcode (OP_VAR_VALUE
);
2024 /* We want to use the selected frame, not
2025 another more inner frame which happens to
2026 be in the same block. */
2027 write_exp_elt_block (NULL
);
2028 write_exp_elt_sym (sym
);
2029 write_exp_elt_opcode (OP_VAR_VALUE
);
2031 else if (yyvsp
[0].ssym
.is_a_field_of_this
)
2033 /* C++: it hangs off of `this'. Must
2034 not inadvertently convert from a method call
2036 if (innermost_block
== 0 ||
2037 contained_in (block_found
, innermost_block
))
2038 innermost_block
= block_found
;
2039 write_exp_elt_opcode (OP_THIS
);
2040 write_exp_elt_opcode (OP_THIS
);
2041 write_exp_elt_opcode (STRUCTOP_PTR
);
2042 write_exp_string (yyvsp
[0].ssym
.stoken
);
2043 write_exp_elt_opcode (STRUCTOP_PTR
);
2047 struct minimal_symbol
*msymbol
;
2048 char *arg
= copy_name (yyvsp
[0].ssym
.stoken
);
2051 lookup_minimal_symbol (arg
, NULL
, NULL
);
2052 if (msymbol
!= NULL
)
2054 write_exp_msymbol (msymbol
,
2055 lookup_function_type (builtin_type (current_gdbarch
)->builtin_int
),
2056 builtin_type (current_gdbarch
)->builtin_int
);
2058 else if (!have_full_symbols () && !have_partial_symbols ())
2059 error ("No symbol table is loaded. Use the \"file\" command.");
2061 error ("No symbol \"%s\" in current context.",
2062 copy_name (yyvsp
[0].ssym
.stoken
));
2069 { push_type_address_space (copy_name (yyvsp
[0].ssym
.stoken
));
2070 push_type (tp_space_identifier
);
2076 { push_type (tp_pointer
); yyval
.voidval
= 0; }
2081 { push_type (tp_pointer
); yyval
.voidval
= yyvsp
[0].voidval
; }
2086 { push_type (tp_reference
); yyval
.voidval
= 0; }
2091 { push_type (tp_reference
); yyval
.voidval
= yyvsp
[0].voidval
; }
2096 { yyval
.voidval
= yyvsp
[-1].voidval
; }
2102 push_type_int (yyvsp
[0].lval
);
2103 push_type (tp_array
);
2110 push_type_int (yyvsp
[0].lval
);
2111 push_type (tp_array
);
2118 { push_type (tp_function
); }
2123 { push_type (tp_function
); }
2128 { yyval
.lval
= -1; }
2133 { yyval
.lval
= yyvsp
[-1].typed_val_int
.val
; }
2138 { yyval
.voidval
= 0; }
2143 { free (yyvsp
[-1].tvec
); yyval
.voidval
= 0; }
2148 { yyval
.tval
= lookup_member_type (builtin_type (current_gdbarch
)->builtin_int
, yyvsp
[-2].tval
); }
2153 { yyval
.tval
= yyvsp
[0].tsym
.type
; }
2158 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_int
; }
2163 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long
; }
2168 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_short
; }
2173 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long
; }
2178 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long
; }
2183 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long
; }
2188 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long
; }
2193 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long
; }
2198 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long
; }
2203 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long
; }
2208 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_long
; }
2213 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_long
; }
2218 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_long
; }
2223 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_long
; }
2228 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_long
; }
2233 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_long
; }
2238 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long_long
; }
2243 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long_long
; }
2248 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long_long
; }
2253 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_long_long
; }
2258 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_short
; }
2263 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_short
; }
2268 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_short
; }
2273 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_short
; }
2278 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_short
; }
2283 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_short
; }
2288 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_double
; }
2293 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_long_double
; }
2298 { yyval
.tval
= lookup_struct (copy_name (yyvsp
[0].sval
),
2299 expression_context_block
); }
2304 { yyval
.tval
= lookup_struct (copy_name (yyvsp
[0].sval
),
2305 expression_context_block
); }
2310 { yyval
.tval
= lookup_union (copy_name (yyvsp
[0].sval
),
2311 expression_context_block
); }
2316 { yyval
.tval
= lookup_enum (copy_name (yyvsp
[0].sval
),
2317 expression_context_block
); }
2322 { yyval
.tval
= lookup_unsigned_typename (TYPE_NAME(yyvsp
[0].tsym
.type
)); }
2327 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_unsigned_int
; }
2332 { yyval
.tval
= lookup_signed_typename (TYPE_NAME(yyvsp
[0].tsym
.type
)); }
2337 { yyval
.tval
= builtin_type (current_gdbarch
)->builtin_int
; }
2342 { yyval
.tval
= lookup_template_type(copy_name(yyvsp
[-3].sval
), yyvsp
[-1].tval
,
2343 expression_context_block
);
2349 { yyval
.tval
= follow_types (yyvsp
[0].tval
); }
2354 { yyval
.tval
= follow_types (yyvsp
[-1].tval
); }
2360 struct type
*type
= yyvsp
[-2].tval
;
2361 struct type
*new_type
;
2362 char *ncopy
= alloca (yyvsp
[0].sval
.length
+ 1);
2364 memcpy (ncopy
, yyvsp
[0].sval
.ptr
, yyvsp
[0].sval
.length
);
2365 ncopy
[yyvsp
[0].sval
.length
] = '\0';
2367 if (TYPE_CODE (type
) != TYPE_CODE_STRUCT
2368 && TYPE_CODE (type
) != TYPE_CODE_UNION
2369 && TYPE_CODE (type
) != TYPE_CODE_NAMESPACE
)
2370 error ("`%s' is not defined as an aggregate type.",
2373 new_type
= cp_lookup_nested_type (type
, ncopy
,
2374 expression_context_block
);
2375 if (new_type
== NULL
)
2376 error ("No type \"%s\" within class or namespace \"%s\".",
2377 ncopy
, TYPE_NAME (type
));
2379 yyval
.tval
= new_type
;
2386 yyval
.tsym
.stoken
.ptr
= "int";
2387 yyval
.tsym
.stoken
.length
= 3;
2388 yyval
.tsym
.type
= builtin_type (current_gdbarch
)->builtin_int
;
2395 yyval
.tsym
.stoken
.ptr
= "long";
2396 yyval
.tsym
.stoken
.length
= 4;
2397 yyval
.tsym
.type
= builtin_type (current_gdbarch
)->builtin_long
;
2404 yyval
.tsym
.stoken
.ptr
= "short";
2405 yyval
.tsym
.stoken
.length
= 5;
2406 yyval
.tsym
.type
= builtin_type (current_gdbarch
)->builtin_short
;
2412 { yyval
.tvec
= (struct type
**) xmalloc (sizeof (struct type
*) * 2);
2413 yyval
.ivec
[0] = 1; /* Number of types in vector */
2414 yyval
.tvec
[1] = yyvsp
[0].tval
;
2420 { int len
= sizeof (struct type
*) * (++(yyvsp
[-2].ivec
[0]) + 1);
2421 yyval
.tvec
= (struct type
**) xrealloc ((char *) yyvsp
[-2].tvec
, len
);
2422 yyval
.tvec
[yyval
.ivec
[0]] = yyvsp
[0].tval
;
2427 #line 1005 "c-exp.y"
2428 { yyval
.tval
= follow_types (yyvsp
[-3].tval
); }
2432 #line 1013 "c-exp.y"
2433 { push_type (tp_const
);
2434 push_type (tp_volatile
);
2439 #line 1017 "c-exp.y"
2440 { push_type (tp_const
); }
2444 #line 1019 "c-exp.y"
2445 { push_type (tp_volatile
); }
2449 #line 1022 "c-exp.y"
2450 { yyval
.sval
= yyvsp
[0].ssym
.stoken
; }
2454 #line 1023 "c-exp.y"
2455 { yyval
.sval
= yyvsp
[0].ssym
.stoken
; }
2459 #line 1024 "c-exp.y"
2460 { yyval
.sval
= yyvsp
[0].tsym
.stoken
; }
2464 #line 1025 "c-exp.y"
2465 { yyval
.sval
= yyvsp
[0].ssym
.stoken
; }
2471 /* Line 1000 of yacc.c. */
2472 #line 2473 "c-exp.c.tmp"
2478 YY_STACK_PRINT (yyss
, yyssp
);
2483 /* Now `shift' the result of the reduction. Determine what state
2484 that goes to, based on the state we popped back to and the rule
2485 number reduced by. */
2489 yystate
= yypgoto
[yyn
- YYNTOKENS
] + *yyssp
;
2490 if (0 <= yystate
&& yystate
<= YYLAST
&& yycheck
[yystate
] == *yyssp
)
2491 yystate
= yytable
[yystate
];
2493 yystate
= yydefgoto
[yyn
- YYNTOKENS
];
2498 /*------------------------------------.
2499 | yyerrlab -- here on detecting error |
2500 `------------------------------------*/
2502 /* If not already recovering from an error, report this error. */
2507 yyn
= yypact
[yystate
];
2509 if (YYPACT_NINF
< yyn
&& yyn
< YYLAST
)
2511 YYSIZE_T yysize
= 0;
2512 int yytype
= YYTRANSLATE (yychar
);
2513 const char* yyprefix
;
2517 /* Start YYX at -YYN if negative to avoid negative indexes in
2519 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
2521 /* Stay within bounds of both yycheck and yytname. */
2522 int yychecklim
= YYLAST
- yyn
;
2523 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
2526 yyprefix
= ", expecting ";
2527 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2528 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
2530 yysize
+= yystrlen (yyprefix
) + yystrlen (yytname
[yyx
]);
2538 yysize
+= (sizeof ("syntax error, unexpected ")
2539 + yystrlen (yytname
[yytype
]));
2540 yymsg
= (char *) YYSTACK_ALLOC (yysize
);
2543 char *yyp
= yystpcpy (yymsg
, "syntax error, unexpected ");
2544 yyp
= yystpcpy (yyp
, yytname
[yytype
]);
2548 yyprefix
= ", expecting ";
2549 for (yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
2550 if (yycheck
[yyx
+ yyn
] == yyx
&& yyx
!= YYTERROR
)
2552 yyp
= yystpcpy (yyp
, yyprefix
);
2553 yyp
= yystpcpy (yyp
, yytname
[yyx
]);
2558 YYSTACK_FREE (yymsg
);
2561 yyerror ("syntax error; also virtual memory exhausted");
2564 #endif /* YYERROR_VERBOSE */
2565 yyerror ("syntax error");
2570 if (yyerrstatus
== 3)
2572 /* If just tried and failed to reuse lookahead token after an
2573 error, discard it. */
2575 if (yychar
<= YYEOF
)
2577 /* If at end of input, pop the error token,
2578 then the rest of the stack, then return failure. */
2579 if (yychar
== YYEOF
)
2585 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
2586 yydestruct (yystos
[*yyssp
], yyvsp
);
2591 YYDSYMPRINTF ("Error: discarding", yytoken
, &yylval
, &yylloc
);
2592 yydestruct (yytoken
, &yylval
);
2598 /* Else will try to reuse lookahead token after shifting the error
2603 /*---------------------------------------------------.
2604 | yyerrorlab -- error raised explicitly by YYERROR. |
2605 `---------------------------------------------------*/
2609 /* Pacify GCC when the user code never invokes YYERROR and the label
2610 yyerrorlab therefore never appears in user code. */
2621 /*-------------------------------------------------------------.
2622 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2623 `-------------------------------------------------------------*/
2625 yyerrstatus
= 3; /* Each real token shifted decrements this. */
2629 yyn
= yypact
[yystate
];
2630 if (yyn
!= YYPACT_NINF
)
2633 if (0 <= yyn
&& yyn
<= YYLAST
&& yycheck
[yyn
] == YYTERROR
)
2641 /* Pop the current state because it cannot handle the error token. */
2645 YYDSYMPRINTF ("Error: popping", yystos
[*yyssp
], yyvsp
, yylsp
);
2646 yydestruct (yystos
[yystate
], yyvsp
);
2649 YY_STACK_PRINT (yyss
, yyssp
);
2655 YYDPRINTF ((stderr
, "Shifting error token, "));
2664 /*-------------------------------------.
2665 | yyacceptlab -- YYACCEPT comes here. |
2666 `-------------------------------------*/
2671 /*-----------------------------------.
2672 | yyabortlab -- YYABORT comes here. |
2673 `-----------------------------------*/
2679 /*----------------------------------------------.
2680 | yyoverflowlab -- parser overflow comes here. |
2681 `----------------------------------------------*/
2683 yyerror ("parser stack overflow");
2691 YYSTACK_FREE (yyss
);
2697 #line 1039 "c-exp.y"
2700 /* Take care of parsing a number (anything that starts with a digit).
2701 Set yylval and return the token type; update lexptr.
2702 LEN is the number of characters in it. */
2704 /*** Needs some error checking for the float case ***/
2707 parse_number (p
, len
, parsed_float
, putithere
)
2713 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
2714 here, and we do kind of silly things like cast to unsigned. */
2721 int base
= input_radix
;
2724 /* Number of "L" suffixes encountered. */
2727 /* We have found a "L" or "U" suffix. */
2728 int found_suffix
= 0;
2731 struct type
*signed_type
;
2732 struct type
*unsigned_type
;
2736 /* It's a float since it contains a point or an exponent. */
2737 char *s
= xmalloc (len
);
2738 int num
= 0; /* number of tokens scanned by scanf */
2739 char saved_char
= p
[len
];
2741 p
[len
] = 0; /* null-terminate the token */
2742 num
= sscanf (p
, DOUBLEST_SCAN_FORMAT
"%s",
2743 &putithere
->typed_val_float
.dval
, s
);
2744 p
[len
] = saved_char
; /* restore the input stream */
2747 putithere
->typed_val_float
.type
=
2748 builtin_type (current_gdbarch
)->builtin_double
;
2752 /* See if it has any float suffix: 'f' for float, 'l' for long
2754 if (!strcasecmp (s
, "f"))
2755 putithere
->typed_val_float
.type
=
2756 builtin_type (current_gdbarch
)->builtin_float
;
2757 else if (!strcasecmp (s
, "l"))
2758 putithere
->typed_val_float
.type
=
2759 builtin_type (current_gdbarch
)->builtin_long_double
;
2767 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2801 if (c
>= 'A' && c
<= 'Z')
2803 if (c
!= 'l' && c
!= 'u')
2805 if (c
>= '0' && c
<= '9')
2813 if (base
> 10 && c
>= 'a' && c
<= 'f')
2817 n
+= i
= c
- 'a' + 10;
2830 return ERROR
; /* Char not a digit */
2833 return ERROR
; /* Invalid digit in this base */
2835 /* Portably test for overflow (only works for nonzero values, so make
2836 a second check for zero). FIXME: Can't we just make n and prevn
2837 unsigned and avoid this? */
2838 if (c
!= 'l' && c
!= 'u' && (prevn
>= n
) && n
!= 0)
2839 unsigned_p
= 1; /* Try something unsigned */
2841 /* Portably test for unsigned overflow.
2842 FIXME: This check is wrong; for example it doesn't find overflow
2843 on 0x123456789 when LONGEST is 32 bits. */
2844 if (c
!= 'l' && c
!= 'u' && n
!= 0)
2846 if ((unsigned_p
&& (ULONGEST
) prevn
>= (ULONGEST
) n
))
2847 error ("Numeric constant too large.");
2852 /* An integer constant is an int, a long, or a long long. An L
2853 suffix forces it to be long; an LL suffix forces it to be long
2854 long. If not forced to a larger size, it gets the first type of
2855 the above that it fits in. To figure out whether it fits, we
2856 shift it right and see whether anything remains. Note that we
2857 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2858 operation, because many compilers will warn about such a shift
2859 (which always produces a zero result). Sometimes TARGET_INT_BIT
2860 or TARGET_LONG_BIT will be that big, sometimes not. To deal with
2861 the case where it is we just always shift the value more than
2862 once, with fewer bits each time. */
2864 un
= (ULONGEST
)n
>> 2;
2866 && (un
>> (TARGET_INT_BIT
- 2)) == 0)
2868 high_bit
= ((ULONGEST
)1) << (TARGET_INT_BIT
-1);
2870 /* A large decimal (not hex or octal) constant (between INT_MAX
2871 and UINT_MAX) is a long or unsigned long, according to ANSI,
2872 never an unsigned int, but this code treats it as unsigned
2873 int. This probably should be fixed. GCC gives a warning on
2876 unsigned_type
= builtin_type (current_gdbarch
)->builtin_unsigned_int
;
2877 signed_type
= builtin_type (current_gdbarch
)->builtin_int
;
2879 else if (long_p
<= 1
2880 && (un
>> (TARGET_LONG_BIT
- 2)) == 0)
2882 high_bit
= ((ULONGEST
)1) << (TARGET_LONG_BIT
-1);
2883 unsigned_type
= builtin_type (current_gdbarch
)->builtin_unsigned_long
;
2884 signed_type
= builtin_type (current_gdbarch
)->builtin_long
;
2889 if (sizeof (ULONGEST
) * HOST_CHAR_BIT
< TARGET_LONG_LONG_BIT
)
2890 /* A long long does not fit in a LONGEST. */
2891 shift
= (sizeof (ULONGEST
) * HOST_CHAR_BIT
- 1);
2893 shift
= (TARGET_LONG_LONG_BIT
- 1);
2894 high_bit
= (ULONGEST
) 1 << shift
;
2895 unsigned_type
= builtin_type (current_gdbarch
)->builtin_unsigned_long_long
;
2896 signed_type
= builtin_type (current_gdbarch
)->builtin_long_long
;
2899 putithere
->typed_val_int
.val
= n
;
2901 /* If the high bit of the worked out type is set then this number
2902 has to be unsigned. */
2904 if (unsigned_p
|| (n
& high_bit
))
2906 putithere
->typed_val_int
.type
= unsigned_type
;
2910 putithere
->typed_val_int
.type
= signed_type
;
2920 enum exp_opcode opcode
;
2923 static const struct token tokentab3
[] =
2925 {">>=", ASSIGN_MODIFY
, BINOP_RSH
},
2926 {"<<=", ASSIGN_MODIFY
, BINOP_LSH
}
2929 static const struct token tokentab2
[] =
2931 {"+=", ASSIGN_MODIFY
, BINOP_ADD
},
2932 {"-=", ASSIGN_MODIFY
, BINOP_SUB
},
2933 {"*=", ASSIGN_MODIFY
, BINOP_MUL
},
2934 {"/=", ASSIGN_MODIFY
, BINOP_DIV
},
2935 {"%=", ASSIGN_MODIFY
, BINOP_REM
},
2936 {"|=", ASSIGN_MODIFY
, BINOP_BITWISE_IOR
},
2937 {"&=", ASSIGN_MODIFY
, BINOP_BITWISE_AND
},
2938 {"^=", ASSIGN_MODIFY
, BINOP_BITWISE_XOR
},
2939 {"++", INCREMENT
, BINOP_END
},
2940 {"--", DECREMENT
, BINOP_END
},
2941 {"->", ARROW
, BINOP_END
},
2942 {"&&", ANDAND
, BINOP_END
},
2943 {"||", OROR
, BINOP_END
},
2944 {"::", COLONCOLON
, BINOP_END
},
2945 {"<<", LSH
, BINOP_END
},
2946 {">>", RSH
, BINOP_END
},
2947 {"==", EQUAL
, BINOP_END
},
2948 {"!=", NOTEQUAL
, BINOP_END
},
2949 {"<=", LEQ
, BINOP_END
},
2950 {">=", GEQ
, BINOP_END
}
2953 /* Read one token, getting characters through lexptr. */
2964 static char *tempbuf
;
2965 static int tempbufsize
;
2966 struct symbol
* sym_class
= NULL
;
2967 char * token_string
= NULL
;
2968 int class_prefix
= 0;
2973 /* Check if this is a macro invocation that we need to expand. */
2974 if (! scanning_macro_expansion ())
2976 char *expanded
= macro_expand_next (&lexptr
,
2977 expression_macro_lookup_func
,
2978 expression_macro_lookup_baton
);
2981 scan_macro_expansion (expanded
);
2984 prev_lexptr
= lexptr
;
2988 /* See if it is a special token of length 3. */
2989 for (i
= 0; i
< sizeof tokentab3
/ sizeof tokentab3
[0]; i
++)
2990 if (strncmp (tokstart
, tokentab3
[i
].operator, 3) == 0)
2993 yylval
.opcode
= tokentab3
[i
].opcode
;
2994 return tokentab3
[i
].token
;
2997 /* See if it is a special token of length 2. */
2998 for (i
= 0; i
< sizeof tokentab2
/ sizeof tokentab2
[0]; i
++)
2999 if (strncmp (tokstart
, tokentab2
[i
].operator, 2) == 0)
3002 yylval
.opcode
= tokentab2
[i
].opcode
;
3003 return tokentab2
[i
].token
;
3006 switch (c
= *tokstart
)
3009 /* If we were just scanning the result of a macro expansion,
3010 then we need to resume scanning the original text.
3011 Otherwise, we were already scanning the original text, and
3012 we're really done. */
3013 if (scanning_macro_expansion ())
3015 finished_macro_expansion ();
3028 /* We either have a character constant ('0' or '\177' for example)
3029 or we have a quoted symbol reference ('foo(int,int)' in C++
3034 c
= parse_escape (&lexptr
);
3036 error ("Empty character constant.");
3037 else if (! host_char_to_target (c
, &c
))
3039 int toklen
= lexptr
- tokstart
+ 1;
3040 char *tok
= alloca (toklen
+ 1);
3041 memcpy (tok
, tokstart
, toklen
);
3043 error ("There is no character corresponding to %s in the target "
3044 "character set `%s'.", tok
, target_charset ());
3047 yylval
.typed_val_int
.val
= c
;
3048 yylval
.typed_val_int
.type
= builtin_type (current_gdbarch
)->builtin_char
;
3053 namelen
= skip_quoted (tokstart
) - tokstart
;
3056 lexptr
= tokstart
+ namelen
;
3058 if (lexptr
[-1] != '\'')
3059 error ("Unmatched single quote.");
3064 error ("Invalid character constant.");
3074 if (paren_depth
== 0)
3081 if (comma_terminates
3083 && ! scanning_macro_expansion ())
3089 /* Might be a floating point number. */
3090 if (lexptr
[1] < '0' || lexptr
[1] > '9')
3091 goto symbol
; /* Nope, must be a symbol. */
3092 /* FALL THRU into number case. */
3105 /* It's a number. */
3106 int got_dot
= 0, got_e
= 0, toktype
;
3108 int hex
= input_radix
> 10;
3110 if (c
== '0' && (p
[1] == 'x' || p
[1] == 'X'))
3115 else if (c
== '0' && (p
[1]=='t' || p
[1]=='T' || p
[1]=='d' || p
[1]=='D'))
3123 /* This test includes !hex because 'e' is a valid hex digit
3124 and thus does not indicate a floating point number when
3125 the radix is hex. */
3126 if (!hex
&& !got_e
&& (*p
== 'e' || *p
== 'E'))
3127 got_dot
= got_e
= 1;
3128 /* This test does not include !hex, because a '.' always indicates
3129 a decimal floating point number regardless of the radix. */
3130 else if (!got_dot
&& *p
== '.')
3132 else if (got_e
&& (p
[-1] == 'e' || p
[-1] == 'E')
3133 && (*p
== '-' || *p
== '+'))
3134 /* This is the sign of the exponent, not the end of the
3137 /* We will take any letters or digits. parse_number will
3138 complain if past the radix, or if L or U are not final. */
3139 else if ((*p
< '0' || *p
> '9')
3140 && ((*p
< 'a' || *p
> 'z')
3141 && (*p
< 'A' || *p
> 'Z')))
3144 toktype
= parse_number (tokstart
, p
- tokstart
, got_dot
|got_e
, &yylval
);
3145 if (toktype
== ERROR
)
3147 char *err_copy
= (char *) alloca (p
- tokstart
+ 1);
3149 memcpy (err_copy
, tokstart
, p
- tokstart
);
3150 err_copy
[p
- tokstart
] = 0;
3151 error ("Invalid number \"%s\".", err_copy
);
3183 /* Build the gdb internal form of the input string in tempbuf,
3184 translating any standard C escape forms seen. Note that the
3185 buffer is null byte terminated *only* for the convenience of
3186 debugging gdb itself and printing the buffer contents when
3187 the buffer contains no embedded nulls. Gdb does not depend
3188 upon the buffer being null byte terminated, it uses the length
3189 string instead. This allows gdb to handle C strings (as well
3190 as strings in other languages) with embedded null bytes */
3192 tokptr
= ++tokstart
;
3196 char *char_start_pos
= tokptr
;
3198 /* Grow the static temp buffer if necessary, including allocating
3199 the first one on demand. */
3200 if (tempbufindex
+ 1 >= tempbufsize
)
3202 tempbuf
= (char *) xrealloc (tempbuf
, tempbufsize
+= 64);
3208 /* Do nothing, loop will terminate. */
3212 c
= parse_escape (&tokptr
);
3217 tempbuf
[tempbufindex
++] = c
;
3221 if (! host_char_to_target (c
, &c
))
3223 int len
= tokptr
- char_start_pos
;
3224 char *copy
= alloca (len
+ 1);
3225 memcpy (copy
, char_start_pos
, len
);
3228 error ("There is no character corresponding to `%s' "
3229 "in the target character set `%s'.",
3230 copy
, target_charset ());
3232 tempbuf
[tempbufindex
++] = c
;
3235 } while ((*tokptr
!= '"') && (*tokptr
!= '\0'));
3236 if (*tokptr
++ != '"')
3238 error ("Unterminated string in expression.");
3240 tempbuf
[tempbufindex
] = '\0'; /* See note above */
3241 yylval
.sval
.ptr
= tempbuf
;
3242 yylval
.sval
.length
= tempbufindex
;
3247 if (!(c
== '_' || c
== '$'
3248 || (c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z')))
3249 /* We must have come across a bad character (e.g. ';'). */
3250 error ("Invalid character '%c' in expression.", c
);
3252 /* It's a name. See how long it is. */
3254 for (c
= tokstart
[namelen
];
3255 (c
== '_' || c
== '$' || (c
>= '0' && c
<= '9')
3256 || (c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z') || c
== '<');)
3258 /* Template parameter lists are part of the name.
3259 FIXME: This mishandles `print $a<4&&$a>3'. */
3263 /* Scan ahead to get rest of the template specification. Note
3264 that we look ahead only when the '<' adjoins non-whitespace
3265 characters; for comparison expressions, e.g. "a < b > c",
3266 there must be spaces before the '<', etc. */
3268 char * p
= find_template_name_end (tokstart
+ namelen
);
3270 namelen
= p
- tokstart
;
3273 c
= tokstart
[++namelen
];
3276 /* The token "if" terminates the expression and is NOT removed from
3277 the input stream. It doesn't count if it appears in the
3278 expansion of a macro. */
3280 && tokstart
[0] == 'i'
3281 && tokstart
[1] == 'f'
3282 && ! scanning_macro_expansion ())
3291 /* Catch specific keywords. Should be done with a data structure. */
3295 if (strncmp (tokstart
, "unsigned", 8) == 0)
3297 if (current_language
->la_language
== language_cplus
3298 && strncmp (tokstart
, "template", 8) == 0)
3300 if (strncmp (tokstart
, "volatile", 8) == 0)
3301 return VOLATILE_KEYWORD
;
3304 if (strncmp (tokstart
, "struct", 6) == 0)
3306 if (strncmp (tokstart
, "signed", 6) == 0)
3307 return SIGNED_KEYWORD
;
3308 if (strncmp (tokstart
, "sizeof", 6) == 0)
3310 if (strncmp (tokstart
, "double", 6) == 0)
3311 return DOUBLE_KEYWORD
;
3314 if (current_language
->la_language
== language_cplus
)
3316 if (strncmp (tokstart
, "false", 5) == 0)
3317 return FALSEKEYWORD
;
3318 if (strncmp (tokstart
, "class", 5) == 0)
3321 if (strncmp (tokstart
, "union", 5) == 0)
3323 if (strncmp (tokstart
, "short", 5) == 0)
3325 if (strncmp (tokstart
, "const", 5) == 0)
3326 return CONST_KEYWORD
;
3329 if (strncmp (tokstart
, "enum", 4) == 0)
3331 if (strncmp (tokstart
, "long", 4) == 0)
3333 if (current_language
->la_language
== language_cplus
)
3335 if (strncmp (tokstart
, "true", 4) == 0)
3340 if (strncmp (tokstart
, "int", 3) == 0)
3347 yylval
.sval
.ptr
= tokstart
;
3348 yylval
.sval
.length
= namelen
;
3350 if (*tokstart
== '$')
3352 write_dollar_variable (yylval
.sval
);
3356 /* Look ahead and see if we can consume more of the input
3357 string to get a reasonable class/namespace spec or a
3358 fully-qualified name. This is a kludge to get around the
3359 HP aCC compiler's generation of symbol names with embedded
3360 colons for namespace and nested classes. */
3362 /* NOTE: carlton/2003-09-24: I don't entirely understand the
3363 HP-specific code, either here or in linespec. Having said that,
3364 I suspect that we're actually moving towards their model: we want
3365 symbols whose names are fully qualified, which matches the
3366 description above. */
3369 /* Only do it if not inside single quotes */
3370 sym_class
= parse_nested_classes_for_hpacc (yylval
.sval
.ptr
, yylval
.sval
.length
,
3371 &token_string
, &class_prefix
, &lexptr
);
3374 /* Replace the current token with the bigger one we found */
3375 yylval
.sval
.ptr
= token_string
;
3376 yylval
.sval
.length
= strlen (token_string
);
3380 /* Use token-type BLOCKNAME for symbols that happen to be defined as
3381 functions or symtabs. If this is not so, then ...
3382 Use token-type TYPENAME for symbols that happen to be defined
3383 currently as names of types; NAME for other symbols.
3384 The caller is not constrained to care about the distinction. */
3386 char *tmp
= copy_name (yylval
.sval
);
3388 int is_a_field_of_this
= 0;
3391 sym
= lookup_symbol (tmp
, expression_context_block
,
3393 current_language
->la_language
== language_cplus
3394 ? &is_a_field_of_this
: (int *) NULL
,
3395 (struct symtab
**) NULL
);
3396 /* Call lookup_symtab, not lookup_partial_symtab, in case there are
3397 no psymtabs (coff, xcoff, or some future change to blow away the
3398 psymtabs once once symbols are read). */
3399 if (sym
&& SYMBOL_CLASS (sym
) == LOC_BLOCK
)
3401 yylval
.ssym
.sym
= sym
;
3402 yylval
.ssym
.is_a_field_of_this
= is_a_field_of_this
;
3406 { /* See if it's a file name. */
3407 struct symtab
*symtab
;
3409 symtab
= lookup_symtab (tmp
);
3413 yylval
.bval
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab
), STATIC_BLOCK
);
3418 if (sym
&& SYMBOL_CLASS (sym
) == LOC_TYPEDEF
)
3420 /* NOTE: carlton/2003-09-25: There used to be code here to
3421 handle nested types. It didn't work very well. See the
3422 comment before qualified_type for more info. */
3423 yylval
.tsym
.type
= SYMBOL_TYPE (sym
);
3427 = language_lookup_primitive_type_by_name (current_language
,
3428 current_gdbarch
, tmp
);
3429 if (yylval
.tsym
.type
!= NULL
)
3432 /* Input names that aren't symbols but ARE valid hex numbers,
3433 when the input radix permits them, can be names or numbers
3434 depending on the parse. Note we support radixes > 16 here. */
3436 ((tokstart
[0] >= 'a' && tokstart
[0] < 'a' + input_radix
- 10) ||
3437 (tokstart
[0] >= 'A' && tokstart
[0] < 'A' + input_radix
- 10)))
3439 YYSTYPE newlval
; /* Its value is ignored. */
3440 hextype
= parse_number (tokstart
, namelen
, 0, &newlval
);
3443 yylval
.ssym
.sym
= sym
;
3444 yylval
.ssym
.is_a_field_of_this
= is_a_field_of_this
;
3449 /* Any other kind of symbol */
3450 yylval
.ssym
.sym
= sym
;
3451 yylval
.ssym
.is_a_field_of_this
= is_a_field_of_this
;
3461 lexptr
= prev_lexptr
;
3463 error ("A %s in expression, near `%s'.", (msg
? msg
: "error"), lexptr
);