dma: beautify queue listing output
[dragonfly.git] / contrib / gdb-6.2.1 / gdb / c-exp.c
blobfdddb80f96db76b3e16f78f9651feee9a53c1f0f
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)
9 any later version.
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. */
37 #define YYBISON 1
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
42 /* Pure parsers. */
43 #define YYPURE 0
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
50 /* Tokens. */
51 #ifndef YYTOKENTYPE
52 # define YYTOKENTYPE
53 /* Put the tokens into the symbol table, so that GDB and other debuggers
54 know about them. */
55 enum yytokentype {
56 INT = 258,
57 FLOAT = 259,
58 STRING = 260,
59 NAME = 261,
60 TYPENAME = 262,
61 NAME_OR_INT = 263,
62 STRUCT = 264,
63 CLASS = 265,
64 UNION = 266,
65 ENUM = 267,
66 SIZEOF = 268,
67 UNSIGNED = 269,
68 COLONCOLON = 270,
69 TEMPLATE = 271,
70 ERROR = 272,
71 SIGNED_KEYWORD = 273,
72 LONG = 274,
73 SHORT = 275,
74 INT_KEYWORD = 276,
75 CONST_KEYWORD = 277,
76 VOLATILE_KEYWORD = 278,
77 DOUBLE_KEYWORD = 279,
78 VARIABLE = 280,
79 ASSIGN_MODIFY = 281,
80 TRUEKEYWORD = 282,
81 FALSEKEYWORD = 283,
82 ABOVE_COMMA = 284,
83 OROR = 285,
84 ANDAND = 286,
85 NOTEQUAL = 287,
86 EQUAL = 288,
87 GEQ = 289,
88 LEQ = 290,
89 RSH = 291,
90 LSH = 292,
91 DECREMENT = 293,
92 INCREMENT = 294,
93 UNARY = 295,
94 ARROW = 296,
95 BLOCKNAME = 297,
96 FILENAME = 298
98 #endif
99 #define INT 258
100 #define FLOAT 259
101 #define STRING 260
102 #define NAME 261
103 #define TYPENAME 262
104 #define NAME_OR_INT 263
105 #define STRUCT 264
106 #define CLASS 265
107 #define UNION 266
108 #define ENUM 267
109 #define SIZEOF 268
110 #define UNSIGNED 269
111 #define COLONCOLON 270
112 #define TEMPLATE 271
113 #define ERROR 272
114 #define SIGNED_KEYWORD 273
115 #define LONG 274
116 #define SHORT 275
117 #define INT_KEYWORD 276
118 #define CONST_KEYWORD 277
119 #define VOLATILE_KEYWORD 278
120 #define DOUBLE_KEYWORD 279
121 #define VARIABLE 280
122 #define ASSIGN_MODIFY 281
123 #define TRUEKEYWORD 282
124 #define FALSEKEYWORD 283
125 #define ABOVE_COMMA 284
126 #define OROR 285
127 #define ANDAND 286
128 #define NOTEQUAL 287
129 #define EQUAL 288
130 #define GEQ 289
131 #define LEQ 290
132 #define RSH 291
133 #define LSH 292
134 #define DECREMENT 293
135 #define INCREMENT 294
136 #define UNARY 295
137 #define ARROW 296
138 #define BLOCKNAME 297
139 #define FILENAME 298
144 /* Copy the first part of user declarations. */
145 #line 39 "c-exp.y"
148 #include "defs.h"
149 #include "gdb_string.h"
150 #include <ctype.h>
151 #include "expression.h"
152 #include "value.h"
153 #include "parser-defs.h"
154 #include "language.h"
155 #include "c-lang.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 */
159 #include "charset.h"
160 #include "block.h"
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
172 #define yylex c_lex
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
178 #define yyr1 c_r1
179 #define yyr2 c_r2
180 #define yydef c_def
181 #define yychk c_chk
182 #define yypgo c_pgo
183 #define yyact c_act
184 #define yyexca c_exca
185 #define yyerrflag c_errflag
186 #define yynerrs c_nerrs
187 #define yyps c_ps
188 #define yypv c_pv
189 #define yys c_s
190 #define yy_yys c_yys
191 #define yystate c_state
192 #define yytmp c_tmp
193 #define yyv c_v
194 #define yy_yyv c_yyv
195 #define yyval c_val
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
211 #ifndef YYDEBUG
212 #define YYDEBUG 1 /* Default to yydebug support */
213 #endif
215 #define YYFPRINTF parser_fprintf
217 int yyparse (void);
219 static int yylex (void);
221 void yyerror (char *);
225 /* Enabling traces. */
226 #ifndef YYDEBUG
227 # define YYDEBUG 0
228 #endif
230 /* Enabling verbose error messages. */
231 #ifdef YYERROR_VERBOSE
232 # undef YYERROR_VERBOSE
233 # define YYERROR_VERBOSE 1
234 #else
235 # define YYERROR_VERBOSE 0
236 #endif
238 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
239 #line 123 "c-exp.y"
240 typedef union YYSTYPE {
241 LONGEST lval;
242 struct {
243 LONGEST val;
244 struct type *type;
245 } typed_val_int;
246 struct {
247 DOUBLEST dval;
248 struct type *type;
249 } typed_val_float;
250 struct symbol *sym;
251 struct type *tval;
252 struct stoken sval;
253 struct ttype tsym;
254 struct symtoken ssym;
255 int voidval;
256 struct block *bval;
257 enum exp_opcode opcode;
258 struct internalvar *ivar;
260 struct type **tvec;
261 int *ivec;
262 } YYSTYPE;
263 /* Line 191 of yacc.c. */
264 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
265 # define YYSTYPE_IS_DECLARED 1
266 # define YYSTYPE_IS_TRIVIAL 1
267 #endif
271 /* Copy the second part of user declarations. */
272 #line 147 "c-exp.y"
274 /* YYSTYPE gets defined by %union */
275 static int parse_number (char *, int, int, YYSTYPE *);
278 /* Line 214 of yacc.c. */
280 #if ! defined (yyoverflow) || YYERROR_VERBOSE
282 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
284 # if YYSTACK_USE_ALLOCA
285 # define YYSTACK_ALLOC alloca
286 # else
287 # ifndef YYSTACK_USE_ALLOCA
288 # if defined (alloca) || defined (_ALLOCA_H)
289 # define YYSTACK_ALLOC alloca
290 # else
291 # ifdef __GNUC__
292 # define YYSTACK_ALLOC __builtin_alloca
293 # endif
294 # endif
295 # endif
296 # endif
298 # ifdef YYSTACK_ALLOC
299 /* Pacify GCC's `empty if-body' warning. */
300 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
301 # else
302 # if defined (__STDC__) || defined (__cplusplus)
303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
304 # define YYSIZE_T size_t
305 # endif
306 # define YYSTACK_ALLOC xmalloc
307 # define YYSTACK_FREE free
308 # endif
309 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
312 #if (! defined (yyoverflow) \
313 && (! defined (__cplusplus) \
314 || (YYSTYPE_IS_TRIVIAL)))
316 /* A type that is properly aligned for any stack member. */
317 union yyalloc
319 short yyss;
320 YYSTYPE yyvs;
323 /* The size of the maximum gap between one aligned stack and the next. */
324 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
326 /* The size of an array large to enough to hold all stacks, each with
327 N elements. */
328 # define YYSTACK_BYTES(N) \
329 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
330 + YYSTACK_GAP_MAXIMUM)
332 /* Copy COUNT objects from FROM to TO. The source and destination do
333 not overlap. */
334 # ifndef YYCOPY
335 # if 1 < __GNUC__
336 # define YYCOPY(To, From, Count) \
337 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
338 # else
339 # define YYCOPY(To, From, Count) \
340 do \
342 register YYSIZE_T yyi; \
343 for (yyi = 0; yyi < (Count); yyi++) \
344 (To)[yyi] = (From)[yyi]; \
346 while (0)
347 # endif
348 # endif
350 /* Relocate STACK from its old location to the new one. The
351 local variables YYSIZE and YYSTACKSIZE give the old and new number of
352 elements in the stack, and YYPTR gives the new location of the
353 stack. Advance YYPTR to a properly aligned location for the next
354 stack. */
355 # define YYSTACK_RELOCATE(Stack) \
356 do \
358 YYSIZE_T yynewbytes; \
359 YYCOPY (&yyptr->Stack, Stack, yysize); \
360 Stack = &yyptr->Stack; \
361 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
362 yyptr += yynewbytes / sizeof (*yyptr); \
364 while (0)
366 #endif
368 #if defined (__STDC__) || defined (__cplusplus)
369 typedef signed char yysigned_char;
370 #else
371 typedef short yysigned_char;
372 #endif
374 /* YYFINAL -- State number of the termination state. */
375 #define YYFINAL 94
376 /* YYLAST -- Last index in YYTABLE. */
377 #define YYLAST 804
379 /* YYNTOKENS -- Number of terminals. */
380 #define YYNTOKENS 68
381 /* YYNNTS -- Number of nonterminals. */
382 #define YYNNTS 31
383 /* YYNRULES -- Number of rules. */
384 #define YYNRULES 159
385 /* YYNRULES -- Number of states. */
386 #define YYNSTATES 242
388 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
389 #define YYUNDEFTOK 2
390 #define YYMAXUTOK 298
392 #define YYTRANSLATE(YYX) \
393 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
395 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
396 static const unsigned char yytranslate[] =
398 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 61, 2, 2, 2, 51, 37, 2,
402 57, 64, 49, 47, 29, 48, 55, 50, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 67, 2,
404 40, 31, 41, 32, 46, 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, 56, 2, 63, 36, 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, 65, 35, 66, 62, 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, 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, 2, 2, 2, 2, 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, 1, 2, 3, 4,
424 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
425 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
426 25, 26, 27, 28, 30, 33, 34, 38, 39, 42,
427 43, 44, 45, 52, 53, 54, 58, 59, 60
430 #if YYDEBUG
431 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
432 YYRHS. */
433 static const unsigned short yyprhs[] =
435 0, 0, 3, 5, 7, 9, 11, 15, 18, 21,
436 24, 27, 30, 33, 36, 39, 42, 45, 49, 53,
437 58, 62, 66, 71, 76, 77, 83, 85, 86, 88,
438 92, 94, 98, 103, 108, 112, 116, 120, 124, 128,
439 132, 136, 140, 144, 148, 152, 156, 160, 164, 168,
440 172, 176, 180, 184, 188, 194, 198, 202, 204, 206,
441 208, 210, 212, 217, 219, 221, 223, 225, 227, 231,
442 235, 239, 244, 246, 249, 251, 254, 256, 257, 261,
443 263, 265, 267, 268, 270, 273, 275, 278, 280, 284,
444 287, 289, 292, 294, 297, 301, 304, 308, 310, 314,
445 316, 318, 320, 322, 325, 329, 332, 336, 340, 344,
446 347, 350, 354, 359, 363, 367, 372, 376, 381, 385,
447 390, 393, 397, 400, 404, 407, 411, 413, 416, 419,
448 422, 425, 428, 431, 433, 436, 438, 444, 447, 450,
449 452, 456, 458, 460, 462, 464, 466, 470, 472, 477,
450 480, 483, 485, 487, 489, 491, 493, 495, 497, 499
453 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
454 static const yysigned_char yyrhs[] =
456 69, 0, -1, 71, -1, 70, -1, 89, -1, 72,
457 -1, 71, 29, 72, -1, 49, 72, -1, 37, 72,
458 -1, 48, 72, -1, 61, 72, -1, 62, 72, -1,
459 53, 72, -1, 52, 72, -1, 72, 53, -1, 72,
460 52, -1, 13, 72, -1, 72, 58, 97, -1, 72,
461 58, 79, -1, 72, 58, 49, 72, -1, 72, 55,
462 97, -1, 72, 55, 79, -1, 72, 55, 49, 72,
463 -1, 72, 56, 71, 63, -1, -1, 72, 57, 73,
464 75, 64, -1, 65, -1, -1, 72, -1, 75, 29,
465 72, -1, 66, -1, 74, 75, 76, -1, 74, 89,
466 76, 72, -1, 57, 89, 64, 72, -1, 57, 71,
467 64, -1, 72, 46, 72, -1, 72, 49, 72, -1,
468 72, 50, 72, -1, 72, 51, 72, -1, 72, 47,
469 72, -1, 72, 48, 72, -1, 72, 45, 72, -1,
470 72, 44, 72, -1, 72, 39, 72, -1, 72, 38,
471 72, -1, 72, 43, 72, -1, 72, 42, 72, -1,
472 72, 40, 72, -1, 72, 41, 72, -1, 72, 37,
473 72, -1, 72, 36, 72, -1, 72, 35, 72, -1,
474 72, 34, 72, -1, 72, 33, 72, -1, 72, 32,
475 72, 67, 72, -1, 72, 31, 72, -1, 72, 26,
476 72, -1, 3, -1, 8, -1, 4, -1, 78, -1,
477 25, -1, 13, 57, 89, 64, -1, 5, -1, 27,
478 -1, 28, -1, 59, -1, 60, -1, 77, 15, 97,
479 -1, 77, 15, 97, -1, 90, 15, 97, -1, 90,
480 15, 62, 97, -1, 79, -1, 15, 97, -1, 98,
481 -1, 46, 6, -1, 96, -1, -1, 81, 80, 81,
482 -1, 82, -1, 96, -1, 83, -1, -1, 49, -1,
483 49, 85, -1, 37, -1, 37, 85, -1, 86, -1,
484 57, 85, 64, -1, 86, 87, -1, 87, -1, 86,
485 88, -1, 88, -1, 56, 63, -1, 56, 3, 63,
486 -1, 57, 64, -1, 57, 93, 64, -1, 94, -1,
487 90, 15, 49, -1, 7, -1, 21, -1, 19, -1,
488 20, -1, 19, 21, -1, 19, 18, 21, -1, 19,
489 18, -1, 18, 19, 21, -1, 14, 19, 21, -1,
490 19, 14, 21, -1, 19, 14, -1, 19, 19, -1,
491 19, 19, 21, -1, 19, 19, 18, 21, -1, 19,
492 19, 18, -1, 18, 19, 19, -1, 18, 19, 19,
493 21, -1, 14, 19, 19, -1, 14, 19, 19, 21,
494 -1, 19, 19, 14, -1, 19, 19, 14, 21, -1,
495 20, 21, -1, 20, 18, 21, -1, 20, 18, -1,
496 14, 20, 21, -1, 20, 14, -1, 20, 14, 21,
497 -1, 24, -1, 19, 24, -1, 9, 97, -1, 10,
498 97, -1, 11, 97, -1, 12, 97, -1, 14, 92,
499 -1, 14, -1, 18, 92, -1, 18, -1, 16, 97,
500 40, 89, 41, -1, 83, 90, -1, 90, 83, -1,
501 91, -1, 90, 15, 97, -1, 7, -1, 21, -1,
502 19, -1, 20, -1, 89, -1, 93, 29, 89, -1,
503 90, -1, 94, 84, 85, 84, -1, 22, 23, -1,
504 23, 22, -1, 95, -1, 22, -1, 23, -1, 6,
505 -1, 59, -1, 7, -1, 8, -1, 6, -1, 59,
509 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
510 static const unsigned short yyrline[] =
512 0, 230, 230, 231, 234, 241, 242, 247, 251, 255,
513 259, 263, 267, 271, 275, 279, 283, 287, 293, 301,
514 305, 311, 319, 323, 330, 327, 337, 341, 344, 348,
515 352, 355, 362, 368, 374, 380, 384, 388, 392, 396,
516 400, 404, 408, 412, 416, 420, 424, 428, 432, 436,
517 440, 444, 448, 452, 456, 460, 464, 470, 477, 488,
518 495, 498, 502, 510, 535, 542, 551, 559, 565, 576,
519 592, 606, 631, 632, 666, 723, 729, 730, 733, 736,
520 737, 741, 742, 745, 747, 749, 751, 753, 756, 758,
521 763, 770, 772, 776, 778, 782, 784, 796, 797, 802,
522 804, 806, 808, 810, 812, 814, 816, 818, 820, 822,
523 824, 826, 828, 830, 832, 834, 836, 838, 840, 842,
524 844, 846, 848, 850, 852, 854, 856, 858, 860, 863,
525 866, 869, 872, 874, 876, 878, 883, 887, 889, 891,
526 939, 964, 965, 971, 977, 986, 991, 998, 999, 1003,
527 1004, 1007, 1011, 1013, 1017, 1018, 1019, 1020, 1023, 1024
529 #endif
531 #if YYDEBUG || YYERROR_VERBOSE
532 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
533 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
534 static const char *const yytname[] =
536 "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NAME",
537 "TYPENAME", "NAME_OR_INT", "STRUCT", "CLASS", "UNION", "ENUM", "SIZEOF",
538 "UNSIGNED", "COLONCOLON", "TEMPLATE", "ERROR", "SIGNED_KEYWORD", "LONG",
539 "SHORT", "INT_KEYWORD", "CONST_KEYWORD", "VOLATILE_KEYWORD",
540 "DOUBLE_KEYWORD", "VARIABLE", "ASSIGN_MODIFY", "TRUEKEYWORD",
541 "FALSEKEYWORD", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND",
542 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ",
543 "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT",
544 "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "BLOCKNAME",
545 "FILENAME", "'!'", "'~'", "']'", "')'", "'{'", "'}'", "':'", "$accept",
546 "start", "type_exp", "exp1", "exp", "@1", "lcurly", "arglist", "rcurly",
547 "block", "variable", "qualified_name", "space_identifier",
548 "const_or_volatile", "cv_with_space_id",
549 "const_or_volatile_or_space_identifier_noopt",
550 "const_or_volatile_or_space_identifier", "abs_decl", "direct_abs_decl",
551 "array_mod", "func_mod", "type", "typebase", "qualified_type",
552 "typename", "nonempty_typelist", "ptype", "const_and_volatile",
553 "const_or_volatile_noopt", "name", "name_not_typename", 0
555 #endif
557 # ifdef YYPRINT
558 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
559 token YYLEX-NUM. */
560 static const unsigned short yytoknum[] =
562 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
563 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
564 275, 276, 277, 278, 279, 280, 281, 282, 283, 44,
565 284, 61, 63, 285, 286, 124, 94, 38, 287, 288,
566 60, 62, 289, 290, 291, 292, 64, 43, 45, 42,
567 47, 37, 293, 294, 295, 46, 91, 40, 296, 297,
568 298, 33, 126, 93, 41, 123, 125, 58
570 # endif
572 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
573 static const unsigned char yyr1[] =
575 0, 68, 69, 69, 70, 71, 71, 72, 72, 72,
576 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
577 72, 72, 72, 72, 73, 72, 74, 75, 75, 75,
578 76, 72, 72, 72, 72, 72, 72, 72, 72, 72,
579 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
580 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
581 72, 72, 72, 72, 72, 72, 77, 77, 77, 78,
582 79, 79, 78, 78, 78, 80, 81, 81, 82, 83,
583 83, 84, 84, 85, 85, 85, 85, 85, 86, 86,
584 86, 86, 86, 87, 87, 88, 88, 89, 89, 90,
585 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
586 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
587 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
588 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
589 91, 92, 92, 92, 92, 93, 93, 94, 94, 95,
590 95, 96, 96, 96, 97, 97, 97, 97, 98, 98
593 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
594 static const unsigned char yyr2[] =
596 0, 2, 1, 1, 1, 1, 3, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 3, 3, 4,
598 3, 3, 4, 4, 0, 5, 1, 0, 1, 3,
599 1, 3, 4, 4, 3, 3, 3, 3, 3, 3,
600 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
601 3, 3, 3, 3, 5, 3, 3, 1, 1, 1,
602 1, 1, 4, 1, 1, 1, 1, 1, 3, 3,
603 3, 4, 1, 2, 1, 2, 1, 0, 3, 1,
604 1, 1, 0, 1, 2, 1, 2, 1, 3, 2,
605 1, 2, 1, 2, 3, 2, 3, 1, 3, 1,
606 1, 1, 1, 2, 3, 2, 3, 3, 3, 2,
607 2, 3, 4, 3, 3, 4, 3, 4, 3, 4,
608 2, 3, 2, 3, 2, 3, 1, 2, 2, 2,
609 2, 2, 2, 1, 2, 1, 5, 2, 2, 1,
610 3, 1, 1, 1, 1, 1, 3, 1, 4, 2,
611 2, 1, 1, 1, 1, 1, 1, 1, 1, 1
614 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
615 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
616 means the default is an error. */
617 static const unsigned char yydefact[] =
619 77, 57, 59, 63, 158, 99, 58, 0, 0, 0,
620 0, 77, 133, 0, 0, 135, 101, 102, 100, 152,
621 153, 126, 61, 64, 65, 77, 77, 77, 77, 77,
622 77, 159, 67, 77, 77, 26, 0, 3, 2, 5,
623 27, 0, 60, 72, 0, 79, 77, 4, 147, 139,
624 97, 151, 80, 74, 154, 156, 157, 155, 128, 129,
625 130, 131, 77, 16, 77, 141, 143, 144, 142, 132,
626 73, 0, 143, 144, 134, 109, 105, 110, 103, 127,
627 124, 122, 120, 149, 150, 8, 9, 7, 13, 12,
628 0, 0, 10, 11, 1, 77, 77, 77, 77, 77,
629 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
630 77, 77, 77, 77, 77, 77, 77, 77, 15, 14,
631 77, 77, 24, 77, 28, 0, 0, 0, 0, 77,
632 137, 0, 138, 81, 0, 0, 0, 116, 107, 123,
633 77, 114, 106, 108, 104, 118, 113, 111, 125, 121,
634 34, 77, 6, 56, 55, 0, 53, 52, 51, 50,
635 49, 44, 43, 47, 48, 46, 45, 42, 41, 35,
636 39, 40, 36, 37, 38, 156, 77, 21, 20, 0,
637 27, 77, 18, 17, 77, 30, 31, 77, 69, 75,
638 78, 76, 0, 98, 0, 70, 85, 83, 0, 77,
639 82, 87, 90, 92, 62, 117, 0, 147, 115, 119,
640 112, 33, 77, 22, 23, 0, 19, 29, 32, 140,
641 71, 86, 84, 0, 93, 95, 0, 145, 0, 148,
642 77, 89, 91, 136, 0, 54, 25, 94, 88, 77,
643 96, 146
646 /* YYDEFGOTO[NTERM-NUM]. */
647 static const short yydefgoto[] =
649 -1, 36, 37, 90, 39, 180, 40, 125, 186, 41,
650 42, 43, 129, 44, 45, 46, 134, 200, 201, 202,
651 203, 227, 64, 49, 69, 228, 50, 51, 52, 195,
655 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
656 STATE-NUM. */
657 #define YYPACT_NINF -101
658 static const short yypact[] =
660 320, -101, -101, -101, -101, -101, -101, 30, 30, 30,
661 30, 383, 45, 30, 30, 200, 152, 36, -101, -11,
662 17, -101, -101, -101, -101, 320, 320, 320, 320, 320,
663 320, 29, -101, 320, 320, -101, 84, -101, 39, 597,
664 257, 56, -101, -101, 57, -101, 172, -101, 68, -101,
665 55, -101, 67, -101, -101, -101, -101, -101, -101, -101,
666 -101, -101, 320, 460, 87, -101, 40, 95, -101, -101,
667 -101, 99, 190, -101, -101, 156, 159, 223, -101, -101,
668 164, 176, -101, -101, -101, 460, 460, 460, 460, 460,
669 -15, 158, 460, 460, -101, 320, 320, 320, 320, 320,
670 320, 320, 320, 320, 320, 320, 320, 320, 320, 320,
671 320, 320, 320, 320, 320, 320, 320, 320, -101, -101,
672 194, 320, -101, 531, 597, -19, 160, 30, 218, -1,
673 71, 20, -101, -101, -14, 171, 26, 215, -101, -101,
674 172, 217, -101, -101, -101, 221, 224, -101, -101, -101,
675 -101, 320, 597, 597, 597, 560, 622, 646, 669, 691,
676 712, 731, 731, 746, 746, 746, 746, 240, 240, 303,
677 366, 366, 460, 460, 460, 83, 320, -101, -101, -18,
678 257, 320, -101, -101, 320, -101, -101, 320, 231, -101,
679 -101, -101, 30, -101, 30, 210, 118, 63, 4, 472,
680 2, 112, -101, -101, 446, -101, 206, 85, -101, -101,
681 -101, 460, 320, 460, -101, -13, 460, 597, 460, -101,
682 -101, -101, -101, 185, -101, -101, 186, -101, -9, -101,
683 114, -101, -101, -101, 11, 526, -101, -101, -101, 172,
684 -101, -101
687 /* YYPGOTO[NTERM-NUM]. */
688 static const short yypgoto[] =
690 -101, -101, -101, 6, 47, -101, -101, 69, 126, -101,
691 -101, -67, -101, 125, -101, -35, 58, -100, -101, 54,
692 73, 1, 0, -101, 241, -101, -101, -101, 128, -5,
693 -101
696 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
697 positive, shift that token. If negative, reduce the rule which
698 number is the opposite. If zero, do what YYDEFACT says.
699 If YYTABLE_NINF, syntax error. */
700 #define YYTABLE_NINF -141
701 static const short yytable[] =
703 48, 47, 58, 59, 60, 61, 38, 223, 70, 71,
704 184, 95, 83, 132, 95, 133, 184, 54, 55, 56,
705 239, 19, 20, 196, 19, 20, 54, 55, 56, 132,
706 48, 91, 54, 55, 56, 197, 54, 55, 56, 84,
707 48, 126, 198, 199, -66, 214, 130, 185, -77, 150,
708 80, 236, 65, 177, 81, 240, 182, 82, 63, 137,
709 193, 138, 48, 135, 66, 67, 68, 224, 95, 193,
710 57, 127, 85, 86, 87, 88, 89, 19, 20, 57,
711 92, 93, 194, 131, 94, 57, 192, 124, 194, 57,
712 19, 20, -82, 19, 20, 132, 221, 222, -99, 226,
713 234, -77, 136, 128, -82, -99, -99, 19, 20, 19,
714 20, -82, -82, -76, -77, 178, 139, -77, 183, 198,
715 199, 5, 188, 7, 8, 9, 10, 179, 12, -99,
716 14, -77, 15, 16, 17, 18, 19, 20, 21, 140,
717 207, 206, 152, 153, 154, 155, 156, 157, 158, 159,
718 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
719 170, 171, 172, 173, 174, 133, 75, 197, 198, 230,
720 76, 77, 132, 78, 198, 199, 79, 143, 225, 5,
721 144, 7, 8, 9, 10, 148, 12, 219, 14, 220,
722 15, 16, 17, 18, 19, 20, 21, 149, 211, 207,
723 54, 175, 56, 7, 8, 9, 10, 65, 12, 141,
724 14, 142, 15, 16, 17, 18, 19, 20, 21, 72,
725 73, 68, 151, 213, 189, -140, 185, 124, 216, 219,
726 207, 217, -140, -140, 218, 204, 205, 145, 208, 207,
727 241, 146, 209, 176, 147, 210, -68, 233, 237, 215,
728 238, 211, 187, 57, 190, 231, 74, 191, 229, 235,
729 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
730 11, 12, 13, 14, 232, 15, 16, 17, 18, 19,
731 20, 21, 22, 0, 23, 24, 112, 113, 114, 115,
732 116, 117, 118, 119, 25, 120, 121, 122, 123, 0,
733 0, 0, 0, -77, 0, 26, 27, 0, 0, 28,
734 29, 0, 0, 0, 30, 0, 31, 32, 33, 34,
735 0, 0, 35, 1, 2, 3, 4, 5, 6, 7,
736 8, 9, 10, 11, 12, 13, 14, 0, 15, 16,
737 17, 18, 19, 20, 21, 22, 0, 23, 24, 0,
738 113, 114, 115, 116, 117, 118, 119, 25, 120, 121,
739 122, 123, 0, 0, 0, 0, 0, 0, 26, 27,
740 0, 0, 28, 29, 0, 0, 0, 30, 0, 31,
741 32, 33, 34, 0, 0, 35, 1, 2, 3, 4,
742 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
743 0, 15, 16, 17, 18, 19, 20, 21, 22, 0,
744 23, 24, 0, 0, 0, 115, 116, 117, 118, 119,
745 25, 120, 121, 122, 123, 0, 0, 0, 0, 0,
746 0, 26, 27, 0, 0, 28, 29, 0, 0, 0,
747 62, 0, 31, 32, 33, 34, 0, 0, 35, 1,
748 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
749 12, 13, 14, 0, 15, 16, 17, 18, 19, 20,
750 21, 22, 0, 23, 24, 0, 0, 0, 0, 5,
751 0, 7, 8, 9, 10, 0, 12, 0, 14, 0,
752 15, 16, 17, 18, 19, 20, 21, 0, 28, 29,
753 0, 0, 0, 30, 0, 31, 32, 33, 34, 196,
754 0, 35, 118, 119, 0, 120, 121, 122, 123, 0,
755 0, 197, 0, 0, 0, 0, 0, 0, 198, 199,
756 0, 0, 0, 0, 0, 0, 225, 54, 175, 56,
757 7, 8, 9, 10, 0, 12, 0, 14, 0, 15,
758 16, 17, 18, 19, 20, 21, 0, 0, 98, 99,
759 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
760 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
761 181, 120, 121, 122, 123, 0, 96, 0, 0, 0,
762 57, 97, 98, 99, 100, 101, 102, 103, 104, 105,
763 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
764 116, 117, 118, 119, 0, 120, 121, 122, 123, 0,
765 0, 0, 0, 96, 0, 0, 0, 212, 97, 98,
766 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
767 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
768 119, 0, 120, 121, 122, 123, 100, 101, 102, 103,
769 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
770 114, 115, 116, 117, 118, 119, 0, 120, 121, 122,
771 123, 101, 102, 103, 104, 105, 106, 107, 108, 109,
772 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
773 0, 120, 121, 122, 123, 102, 103, 104, 105, 106,
774 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
775 117, 118, 119, 0, 120, 121, 122, 123, 103, 104,
776 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
777 115, 116, 117, 118, 119, 0, 120, 121, 122, 123,
778 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
779 114, 115, 116, 117, 118, 119, 0, 120, 121, 122,
780 123, 106, 107, 108, 109, 110, 111, 112, 113, 114,
781 115, 116, 117, 118, 119, 0, 120, 121, 122, 123,
782 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
783 0, 120, 121, 122, 123
786 static const short yycheck[] =
788 0, 0, 7, 8, 9, 10, 0, 3, 13, 14,
789 29, 29, 23, 48, 29, 50, 29, 6, 7, 8,
790 29, 22, 23, 37, 22, 23, 6, 7, 8, 64,
791 30, 30, 6, 7, 8, 49, 6, 7, 8, 22,
792 40, 40, 56, 57, 15, 63, 46, 66, 46, 64,
793 14, 64, 7, 120, 18, 64, 123, 21, 11, 19,
794 49, 21, 62, 62, 19, 20, 21, 63, 29, 49,
795 59, 15, 25, 26, 27, 28, 29, 22, 23, 59,
796 33, 34, 62, 15, 0, 59, 15, 40, 62, 59,
797 22, 23, 37, 22, 23, 130, 196, 197, 15, 199,
798 15, 46, 15, 46, 49, 22, 23, 22, 23, 22,
799 23, 56, 57, 46, 46, 120, 21, 46, 123, 56,
800 57, 7, 127, 9, 10, 11, 12, 121, 14, 46,
801 16, 46, 18, 19, 20, 21, 22, 23, 24, 40,
802 140, 140, 95, 96, 97, 98, 99, 100, 101, 102,
803 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
804 113, 114, 115, 116, 117, 200, 14, 49, 56, 57,
805 18, 19, 207, 21, 56, 57, 24, 21, 64, 7,
806 21, 9, 10, 11, 12, 21, 14, 192, 16, 194,
807 18, 19, 20, 21, 22, 23, 24, 21, 151, 199,
808 6, 7, 8, 9, 10, 11, 12, 7, 14, 19,
809 16, 21, 18, 19, 20, 21, 22, 23, 24, 19,
810 20, 21, 64, 176, 6, 15, 66, 180, 181, 234,
811 230, 184, 22, 23, 187, 64, 21, 14, 21, 239,
812 239, 18, 21, 49, 21, 21, 15, 41, 63, 180,
813 64, 204, 126, 59, 129, 201, 15, 129, 200, 212,
814 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
815 13, 14, 15, 16, 201, 18, 19, 20, 21, 22,
816 23, 24, 25, -1, 27, 28, 46, 47, 48, 49,
817 50, 51, 52, 53, 37, 55, 56, 57, 58, -1,
818 -1, -1, -1, 46, -1, 48, 49, -1, -1, 52,
819 53, -1, -1, -1, 57, -1, 59, 60, 61, 62,
820 -1, -1, 65, 3, 4, 5, 6, 7, 8, 9,
821 10, 11, 12, 13, 14, 15, 16, -1, 18, 19,
822 20, 21, 22, 23, 24, 25, -1, 27, 28, -1,
823 47, 48, 49, 50, 51, 52, 53, 37, 55, 56,
824 57, 58, -1, -1, -1, -1, -1, -1, 48, 49,
825 -1, -1, 52, 53, -1, -1, -1, 57, -1, 59,
826 60, 61, 62, -1, -1, 65, 3, 4, 5, 6,
827 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
828 -1, 18, 19, 20, 21, 22, 23, 24, 25, -1,
829 27, 28, -1, -1, -1, 49, 50, 51, 52, 53,
830 37, 55, 56, 57, 58, -1, -1, -1, -1, -1,
831 -1, 48, 49, -1, -1, 52, 53, -1, -1, -1,
832 57, -1, 59, 60, 61, 62, -1, -1, 65, 3,
833 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
834 14, 15, 16, -1, 18, 19, 20, 21, 22, 23,
835 24, 25, -1, 27, 28, -1, -1, -1, -1, 7,
836 -1, 9, 10, 11, 12, -1, 14, -1, 16, -1,
837 18, 19, 20, 21, 22, 23, 24, -1, 52, 53,
838 -1, -1, -1, 57, -1, 59, 60, 61, 62, 37,
839 -1, 65, 52, 53, -1, 55, 56, 57, 58, -1,
840 -1, 49, -1, -1, -1, -1, -1, -1, 56, 57,
841 -1, -1, -1, -1, -1, -1, 64, 6, 7, 8,
842 9, 10, 11, 12, -1, 14, -1, 16, -1, 18,
843 19, 20, 21, 22, 23, 24, -1, -1, 32, 33,
844 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
845 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
846 49, 55, 56, 57, 58, -1, 26, -1, -1, -1,
847 59, 31, 32, 33, 34, 35, 36, 37, 38, 39,
848 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
849 50, 51, 52, 53, -1, 55, 56, 57, 58, -1,
850 -1, -1, -1, 26, -1, -1, -1, 67, 31, 32,
851 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
852 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
853 53, -1, 55, 56, 57, 58, 34, 35, 36, 37,
854 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
855 48, 49, 50, 51, 52, 53, -1, 55, 56, 57,
856 58, 35, 36, 37, 38, 39, 40, 41, 42, 43,
857 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
858 -1, 55, 56, 57, 58, 36, 37, 38, 39, 40,
859 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
860 51, 52, 53, -1, 55, 56, 57, 58, 37, 38,
861 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
862 49, 50, 51, 52, 53, -1, 55, 56, 57, 58,
863 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
864 48, 49, 50, 51, 52, 53, -1, 55, 56, 57,
865 58, 40, 41, 42, 43, 44, 45, 46, 47, 48,
866 49, 50, 51, 52, 53, -1, 55, 56, 57, 58,
867 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
868 -1, 55, 56, 57, 58
871 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
872 symbol of state STATE-NUM. */
873 static const unsigned char yystos[] =
875 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
876 12, 13, 14, 15, 16, 18, 19, 20, 21, 22,
877 23, 24, 25, 27, 28, 37, 48, 49, 52, 53,
878 57, 59, 60, 61, 62, 65, 69, 70, 71, 72,
879 74, 77, 78, 79, 81, 82, 83, 89, 90, 91,
880 94, 95, 96, 98, 6, 7, 8, 59, 97, 97,
881 97, 97, 57, 72, 90, 7, 19, 20, 21, 92,
882 97, 97, 19, 20, 92, 14, 18, 19, 21, 24,
883 14, 18, 21, 23, 22, 72, 72, 72, 72, 72,
884 71, 89, 72, 72, 0, 29, 26, 31, 32, 33,
885 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
886 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
887 55, 56, 57, 58, 72, 75, 89, 15, 46, 80,
888 90, 15, 83, 83, 84, 89, 15, 19, 21, 21,
889 40, 19, 21, 21, 21, 14, 18, 21, 21, 21,
890 64, 64, 72, 72, 72, 72, 72, 72, 72, 72,
891 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
892 72, 72, 72, 72, 72, 7, 49, 79, 97, 71,
893 73, 49, 79, 97, 29, 66, 76, 76, 97, 6,
894 81, 96, 15, 49, 62, 97, 37, 49, 56, 57,
895 85, 86, 87, 88, 64, 21, 89, 90, 21, 21,
896 21, 72, 67, 72, 63, 75, 72, 72, 72, 97,
897 97, 85, 85, 3, 63, 64, 85, 89, 93, 84,
898 57, 87, 88, 41, 15, 72, 64, 63, 64, 29,
899 64, 89
902 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
903 # define YYSIZE_T __SIZE_TYPE__
904 #endif
905 #if ! defined (YYSIZE_T) && defined (size_t)
906 # define YYSIZE_T size_t
907 #endif
908 #if ! defined (YYSIZE_T)
909 # if defined (__STDC__) || defined (__cplusplus)
910 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
911 # define YYSIZE_T size_t
912 # endif
913 #endif
914 #if ! defined (YYSIZE_T)
915 # define YYSIZE_T unsigned int
916 #endif
918 #define yyerrok (yyerrstatus = 0)
919 #define yyclearin (yychar = YYEMPTY)
920 #define YYEMPTY (-2)
921 #define YYEOF 0
923 #define YYACCEPT goto yyacceptlab
924 #define YYABORT goto yyabortlab
925 #define YYERROR goto yyerrlab1
927 /* Like YYERROR except do call yyerror. This remains here temporarily
928 to ease the transition to the new meaning of YYERROR, for GCC.
929 Once GCC version 2 has supplanted version 1, this can go. */
931 #define YYFAIL goto yyerrlab
933 #define YYRECOVERING() (!!yyerrstatus)
935 #define YYBACKUP(Token, Value) \
936 do \
937 if (yychar == YYEMPTY && yylen == 1) \
939 yychar = (Token); \
940 yylval = (Value); \
941 yytoken = YYTRANSLATE (yychar); \
942 YYPOPSTACK; \
943 goto yybackup; \
945 else \
947 yyerror ("syntax error: cannot back up");\
948 YYERROR; \
950 while (0)
952 #define YYTERROR 1
953 #define YYERRCODE 256
955 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
956 are run). */
958 #ifndef YYLLOC_DEFAULT
959 # define YYLLOC_DEFAULT(Current, Rhs, N) \
960 Current.first_line = Rhs[1].first_line; \
961 Current.first_column = Rhs[1].first_column; \
962 Current.last_line = Rhs[N].last_line; \
963 Current.last_column = Rhs[N].last_column;
964 #endif
966 /* YYLEX -- calling `yylex' with the right arguments. */
968 #ifdef YYLEX_PARAM
969 # define YYLEX yylex (YYLEX_PARAM)
970 #else
971 # define YYLEX yylex ()
972 #endif
974 /* Enable debugging if requested. */
975 #if YYDEBUG
977 # ifndef YYFPRINTF
978 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
979 # define YYFPRINTF fprintf
980 # endif
982 # define YYDPRINTF(Args) \
983 do { \
984 if (yydebug) \
985 YYFPRINTF Args; \
986 } while (0)
988 # define YYDSYMPRINT(Args) \
989 do { \
990 if (yydebug) \
991 yysymprint Args; \
992 } while (0)
994 # define YYDSYMPRINTF(Title, Token, Value, Location) \
995 do { \
996 if (yydebug) \
998 YYFPRINTF (stderr, "%s ", Title); \
999 yysymprint (stderr, \
1000 Token, Value); \
1001 YYFPRINTF (stderr, "\n"); \
1003 } while (0)
1005 /*------------------------------------------------------------------.
1006 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1007 | TOP (cinluded). |
1008 `------------------------------------------------------------------*/
1010 #if defined (__STDC__) || defined (__cplusplus)
1011 static void
1012 yy_stack_print (short *bottom, short *top)
1013 #else
1014 static void
1015 yy_stack_print (bottom, top)
1016 short *bottom;
1017 short *top;
1018 #endif
1020 YYFPRINTF (stderr, "Stack now");
1021 for (/* Nothing. */; bottom <= top; ++bottom)
1022 YYFPRINTF (stderr, " %d", *bottom);
1023 YYFPRINTF (stderr, "\n");
1026 # define YY_STACK_PRINT(Bottom, Top) \
1027 do { \
1028 if (yydebug) \
1029 yy_stack_print ((Bottom), (Top)); \
1030 } while (0)
1033 /*------------------------------------------------.
1034 | Report that the YYRULE is going to be reduced. |
1035 `------------------------------------------------*/
1037 #if defined (__STDC__) || defined (__cplusplus)
1038 static void
1039 yy_reduce_print (int yyrule)
1040 #else
1041 static void
1042 yy_reduce_print (yyrule)
1043 int yyrule;
1044 #endif
1046 int yyi;
1047 unsigned int yylineno = yyrline[yyrule];
1048 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1049 yyrule - 1, yylineno);
1050 /* Print the symbols being reduced, and their result. */
1051 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1052 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1053 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1056 # define YY_REDUCE_PRINT(Rule) \
1057 do { \
1058 if (yydebug) \
1059 yy_reduce_print (Rule); \
1060 } while (0)
1062 /* Nonzero means print parse trace. It is left uninitialized so that
1063 multiple parsers can coexist. */
1064 int yydebug;
1065 #else /* !YYDEBUG */
1066 # define YYDPRINTF(Args)
1067 # define YYDSYMPRINT(Args)
1068 # define YYDSYMPRINTF(Title, Token, Value, Location)
1069 # define YY_STACK_PRINT(Bottom, Top)
1070 # define YY_REDUCE_PRINT(Rule)
1071 #endif /* !YYDEBUG */
1074 /* YYINITDEPTH -- initial size of the parser's stacks. */
1075 #ifndef YYINITDEPTH
1076 # define YYINITDEPTH 200
1077 #endif
1079 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1080 if the built-in stack extension method is used).
1082 Do not make this value too large; the results are undefined if
1083 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1084 evaluated with infinite-precision integer arithmetic. */
1086 #if YYMAXDEPTH == 0
1087 # undef YYMAXDEPTH
1088 #endif
1090 #ifndef YYMAXDEPTH
1091 # define YYMAXDEPTH 10000
1092 #endif
1096 #if YYERROR_VERBOSE
1098 # ifndef yystrlen
1099 # if defined (__GLIBC__) && defined (_STRING_H)
1100 # define yystrlen strlen
1101 # else
1102 /* Return the length of YYSTR. */
1103 static YYSIZE_T
1104 # if defined (__STDC__) || defined (__cplusplus)
1105 yystrlen (const char *yystr)
1106 # else
1107 yystrlen (yystr)
1108 const char *yystr;
1109 # endif
1111 register const char *yys = yystr;
1113 while (*yys++ != '\0')
1114 continue;
1116 return yys - yystr - 1;
1118 # endif
1119 # endif
1121 # ifndef yystpcpy
1122 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1123 # define yystpcpy stpcpy
1124 # else
1125 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1126 YYDEST. */
1127 static char *
1128 # if defined (__STDC__) || defined (__cplusplus)
1129 yystpcpy (char *yydest, const char *yysrc)
1130 # else
1131 yystpcpy (yydest, yysrc)
1132 char *yydest;
1133 const char *yysrc;
1134 # endif
1136 register char *yyd = yydest;
1137 register const char *yys = yysrc;
1139 while ((*yyd++ = *yys++) != '\0')
1140 continue;
1142 return yyd - 1;
1144 # endif
1145 # endif
1147 #endif /* !YYERROR_VERBOSE */
1151 #if YYDEBUG
1152 /*--------------------------------.
1153 | Print this symbol on YYOUTPUT. |
1154 `--------------------------------*/
1156 #if defined (__STDC__) || defined (__cplusplus)
1157 static void
1158 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1159 #else
1160 static void
1161 yysymprint (yyoutput, yytype, yyvaluep)
1162 FILE *yyoutput;
1163 int yytype;
1164 YYSTYPE *yyvaluep;
1165 #endif
1167 /* Pacify ``unused variable'' warnings. */
1168 (void) yyvaluep;
1170 if (yytype < YYNTOKENS)
1172 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1173 # ifdef YYPRINT
1174 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1175 # endif
1177 else
1178 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1180 switch (yytype)
1182 default:
1183 break;
1185 YYFPRINTF (yyoutput, ")");
1188 #endif /* ! YYDEBUG */
1189 /*-----------------------------------------------.
1190 | Release the memory associated to this symbol. |
1191 `-----------------------------------------------*/
1193 #if defined (__STDC__) || defined (__cplusplus)
1194 static void
1195 yydestruct (int yytype, YYSTYPE *yyvaluep)
1196 #else
1197 static void
1198 yydestruct (yytype, yyvaluep)
1199 int yytype;
1200 YYSTYPE *yyvaluep;
1201 #endif
1203 /* Pacify ``unused variable'' warnings. */
1204 (void) yyvaluep;
1206 switch (yytype)
1209 default:
1210 break;
1215 /* Prevent warnings from -Wmissing-prototypes. */
1217 #ifdef YYPARSE_PARAM
1218 # if defined (__STDC__) || defined (__cplusplus)
1219 int yyparse (void *YYPARSE_PARAM);
1220 # else
1221 int yyparse ();
1222 # endif
1223 #else /* ! YYPARSE_PARAM */
1224 #if defined (__STDC__) || defined (__cplusplus)
1225 int yyparse (void);
1226 #else
1227 int yyparse ();
1228 #endif
1229 #endif /* ! YYPARSE_PARAM */
1233 /* The lookahead symbol. */
1234 int yychar;
1236 /* The semantic value of the lookahead symbol. */
1237 YYSTYPE yylval;
1239 /* Number of syntax errors so far. */
1240 int yynerrs;
1244 /*----------.
1245 | yyparse. |
1246 `----------*/
1248 #ifdef YYPARSE_PARAM
1249 # if defined (__STDC__) || defined (__cplusplus)
1250 int yyparse (void *YYPARSE_PARAM)
1251 # else
1252 int yyparse (YYPARSE_PARAM)
1253 void *YYPARSE_PARAM;
1254 # endif
1255 #else /* ! YYPARSE_PARAM */
1256 #if defined (__STDC__) || defined (__cplusplus)
1258 yyparse (void)
1259 #else
1261 yyparse ()
1263 #endif
1264 #endif
1267 register int yystate;
1268 register int yyn;
1269 int yyresult;
1270 /* Number of tokens to shift before error messages enabled. */
1271 int yyerrstatus;
1272 /* Lookahead token as an internal (translated) token number. */
1273 int yytoken = 0;
1275 /* Three stacks and their tools:
1276 `yyss': related to states,
1277 `yyvs': related to semantic values,
1278 `yyls': related to locations.
1280 Refer to the stacks thru separate pointers, to allow yyoverflow
1281 to xreallocate them elsewhere. */
1283 /* The state stack. */
1284 short yyssa[YYINITDEPTH];
1285 short *yyss = yyssa;
1286 register short *yyssp;
1288 /* The semantic value stack. */
1289 YYSTYPE yyvsa[YYINITDEPTH];
1290 YYSTYPE *yyvs = yyvsa;
1291 register YYSTYPE *yyvsp;
1295 #define YYPOPSTACK (yyvsp--, yyssp--)
1297 YYSIZE_T yystacksize = YYINITDEPTH;
1299 /* The variables used to return semantic value and location from the
1300 action routines. */
1301 YYSTYPE yyval;
1304 /* When reducing, the number of symbols on the RHS of the reduced
1305 rule. */
1306 int yylen;
1308 YYDPRINTF ((stderr, "Starting parse\n"));
1310 yystate = 0;
1311 yyerrstatus = 0;
1312 yynerrs = 0;
1313 yychar = YYEMPTY; /* Cause a token to be read. */
1315 /* Initialize stack pointers.
1316 Waste one element of value and location stack
1317 so that they stay on the same level as the state stack.
1318 The wasted elements are never initialized. */
1320 yyssp = yyss;
1321 yyvsp = yyvs;
1323 goto yysetstate;
1325 /*------------------------------------------------------------.
1326 | yynewstate -- Push a new state, which is found in yystate. |
1327 `------------------------------------------------------------*/
1328 yynewstate:
1329 /* In all cases, when you get here, the value and location stacks
1330 have just been pushed. so pushing a state here evens the stacks.
1332 yyssp++;
1334 yysetstate:
1335 *yyssp = yystate;
1337 if (yyss + yystacksize - 1 <= yyssp)
1339 /* Get the current used size of the three stacks, in elements. */
1340 YYSIZE_T yysize = yyssp - yyss + 1;
1342 #ifdef yyoverflow
1344 /* Give user a chance to xreallocate the stack. Use copies of
1345 these so that the &'s don't force the real ones into
1346 memory. */
1347 YYSTYPE *yyvs1 = yyvs;
1348 short *yyss1 = yyss;
1351 /* Each stack pointer address is followed by the size of the
1352 data in use in that stack, in bytes. This used to be a
1353 conditional around just the two extra args, but that might
1354 be undefined if yyoverflow is a macro. */
1355 yyoverflow ("parser stack overflow",
1356 &yyss1, yysize * sizeof (*yyssp),
1357 &yyvs1, yysize * sizeof (*yyvsp),
1359 &yystacksize);
1361 yyss = yyss1;
1362 yyvs = yyvs1;
1364 #else /* no yyoverflow */
1365 # ifndef YYSTACK_RELOCATE
1366 goto yyoverflowlab;
1367 # else
1368 /* Extend the stack our own way. */
1369 if (YYMAXDEPTH <= yystacksize)
1370 goto yyoverflowlab;
1371 yystacksize *= 2;
1372 if (YYMAXDEPTH < yystacksize)
1373 yystacksize = YYMAXDEPTH;
1376 short *yyss1 = yyss;
1377 union yyalloc *yyptr =
1378 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1379 if (! yyptr)
1380 goto yyoverflowlab;
1381 YYSTACK_RELOCATE (yyss);
1382 YYSTACK_RELOCATE (yyvs);
1384 # undef YYSTACK_RELOCATE
1385 if (yyss1 != yyssa)
1386 YYSTACK_FREE (yyss1);
1388 # endif
1389 #endif /* no yyoverflow */
1391 yyssp = yyss + yysize - 1;
1392 yyvsp = yyvs + yysize - 1;
1395 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1396 (unsigned long int) yystacksize));
1398 if (yyss + yystacksize - 1 <= yyssp)
1399 YYABORT;
1402 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1404 goto yybackup;
1406 /*-----------.
1407 | yybackup. |
1408 `-----------*/
1409 yybackup:
1411 /* Do appropriate processing given the current state. */
1412 /* Read a lookahead token if we need one and don't already have one. */
1413 /* yyresume: */
1415 /* First try to decide what to do without reference to lookahead token. */
1417 yyn = yypact[yystate];
1418 if (yyn == YYPACT_NINF)
1419 goto yydefault;
1421 /* Not known => get a lookahead token if don't already have one. */
1423 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1424 if (yychar == YYEMPTY)
1426 YYDPRINTF ((stderr, "Reading a token: "));
1427 yychar = YYLEX;
1430 if (yychar <= YYEOF)
1432 yychar = yytoken = YYEOF;
1433 YYDPRINTF ((stderr, "Now at end of input.\n"));
1435 else
1437 yytoken = YYTRANSLATE (yychar);
1438 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1441 /* If the proper action on seeing token YYTOKEN is to reduce or to
1442 detect an error, take that action. */
1443 yyn += yytoken;
1444 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1445 goto yydefault;
1446 yyn = yytable[yyn];
1447 if (yyn <= 0)
1449 if (yyn == 0 || yyn == YYTABLE_NINF)
1450 goto yyerrlab;
1451 yyn = -yyn;
1452 goto yyreduce;
1455 if (yyn == YYFINAL)
1456 YYACCEPT;
1458 /* Shift the lookahead token. */
1459 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1461 /* Discard the token being shifted unless it is eof. */
1462 if (yychar != YYEOF)
1463 yychar = YYEMPTY;
1465 *++yyvsp = yylval;
1468 /* Count tokens shifted since error; after three, turn off error
1469 status. */
1470 if (yyerrstatus)
1471 yyerrstatus--;
1473 yystate = yyn;
1474 goto yynewstate;
1477 /*-----------------------------------------------------------.
1478 | yydefault -- do the default action for the current state. |
1479 `-----------------------------------------------------------*/
1480 yydefault:
1481 yyn = yydefact[yystate];
1482 if (yyn == 0)
1483 goto yyerrlab;
1484 goto yyreduce;
1487 /*-----------------------------.
1488 | yyreduce -- Do a reduction. |
1489 `-----------------------------*/
1490 yyreduce:
1491 /* yyn is the number of a rule to reduce with. */
1492 yylen = yyr2[yyn];
1494 /* If YYLEN is nonzero, implement the default value of the action:
1495 `$$ = $1'.
1497 Otherwise, the following line sets YYVAL to garbage.
1498 This behavior is undocumented and Bison
1499 users should not rely upon it. Assigning to YYVAL
1500 unconditionally makes the parser a bit smaller, and it avoids a
1501 GCC warning that YYVAL may be used uninitialized. */
1502 yyval = yyvsp[1-yylen];
1505 YY_REDUCE_PRINT (yyn);
1506 switch (yyn)
1508 case 4:
1509 #line 235 "c-exp.y"
1510 { write_exp_elt_opcode(OP_TYPE);
1511 write_exp_elt_type(yyvsp[0].tval);
1512 write_exp_elt_opcode(OP_TYPE);}
1513 break;
1515 case 6:
1516 #line 243 "c-exp.y"
1517 { write_exp_elt_opcode (BINOP_COMMA); }
1518 break;
1520 case 7:
1521 #line 248 "c-exp.y"
1522 { write_exp_elt_opcode (UNOP_IND); }
1523 break;
1525 case 8:
1526 #line 252 "c-exp.y"
1527 { write_exp_elt_opcode (UNOP_ADDR); }
1528 break;
1530 case 9:
1531 #line 256 "c-exp.y"
1532 { write_exp_elt_opcode (UNOP_NEG); }
1533 break;
1535 case 10:
1536 #line 260 "c-exp.y"
1537 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1538 break;
1540 case 11:
1541 #line 264 "c-exp.y"
1542 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1543 break;
1545 case 12:
1546 #line 268 "c-exp.y"
1547 { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1548 break;
1550 case 13:
1551 #line 272 "c-exp.y"
1552 { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1553 break;
1555 case 14:
1556 #line 276 "c-exp.y"
1557 { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1558 break;
1560 case 15:
1561 #line 280 "c-exp.y"
1562 { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1563 break;
1565 case 16:
1566 #line 284 "c-exp.y"
1567 { write_exp_elt_opcode (UNOP_SIZEOF); }
1568 break;
1570 case 17:
1571 #line 288 "c-exp.y"
1572 { write_exp_elt_opcode (STRUCTOP_PTR);
1573 write_exp_string (yyvsp[0].sval);
1574 write_exp_elt_opcode (STRUCTOP_PTR); }
1575 break;
1577 case 18:
1578 #line 294 "c-exp.y"
1579 { /* exp->type::name becomes exp->*(&type::name) */
1580 /* Note: this doesn't work if name is a
1581 static member! FIXME */
1582 write_exp_elt_opcode (UNOP_ADDR);
1583 write_exp_elt_opcode (STRUCTOP_MPTR); }
1584 break;
1586 case 19:
1587 #line 302 "c-exp.y"
1588 { write_exp_elt_opcode (STRUCTOP_MPTR); }
1589 break;
1591 case 20:
1592 #line 306 "c-exp.y"
1593 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1594 write_exp_string (yyvsp[0].sval);
1595 write_exp_elt_opcode (STRUCTOP_STRUCT); }
1596 break;
1598 case 21:
1599 #line 312 "c-exp.y"
1600 { /* exp.type::name becomes exp.*(&type::name) */
1601 /* Note: this doesn't work if name is a
1602 static member! FIXME */
1603 write_exp_elt_opcode (UNOP_ADDR);
1604 write_exp_elt_opcode (STRUCTOP_MEMBER); }
1605 break;
1607 case 22:
1608 #line 320 "c-exp.y"
1609 { write_exp_elt_opcode (STRUCTOP_MEMBER); }
1610 break;
1612 case 23:
1613 #line 324 "c-exp.y"
1614 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1615 break;
1617 case 24:
1618 #line 330 "c-exp.y"
1619 { start_arglist (); }
1620 break;
1622 case 25:
1623 #line 332 "c-exp.y"
1624 { write_exp_elt_opcode (OP_FUNCALL);
1625 write_exp_elt_longcst ((LONGEST) end_arglist ());
1626 write_exp_elt_opcode (OP_FUNCALL); }
1627 break;
1629 case 26:
1630 #line 338 "c-exp.y"
1631 { start_arglist (); }
1632 break;
1634 case 28:
1635 #line 345 "c-exp.y"
1636 { arglist_len = 1; }
1637 break;
1639 case 29:
1640 #line 349 "c-exp.y"
1641 { arglist_len++; }
1642 break;
1644 case 30:
1645 #line 353 "c-exp.y"
1646 { yyval.lval = end_arglist () - 1; }
1647 break;
1649 case 31:
1650 #line 356 "c-exp.y"
1651 { write_exp_elt_opcode (OP_ARRAY);
1652 write_exp_elt_longcst ((LONGEST) 0);
1653 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1654 write_exp_elt_opcode (OP_ARRAY); }
1655 break;
1657 case 32:
1658 #line 363 "c-exp.y"
1659 { write_exp_elt_opcode (UNOP_MEMVAL);
1660 write_exp_elt_type (yyvsp[-2].tval);
1661 write_exp_elt_opcode (UNOP_MEMVAL); }
1662 break;
1664 case 33:
1665 #line 369 "c-exp.y"
1666 { write_exp_elt_opcode (UNOP_CAST);
1667 write_exp_elt_type (yyvsp[-2].tval);
1668 write_exp_elt_opcode (UNOP_CAST); }
1669 break;
1671 case 34:
1672 #line 375 "c-exp.y"
1674 break;
1676 case 35:
1677 #line 381 "c-exp.y"
1678 { write_exp_elt_opcode (BINOP_REPEAT); }
1679 break;
1681 case 36:
1682 #line 385 "c-exp.y"
1683 { write_exp_elt_opcode (BINOP_MUL); }
1684 break;
1686 case 37:
1687 #line 389 "c-exp.y"
1688 { write_exp_elt_opcode (BINOP_DIV); }
1689 break;
1691 case 38:
1692 #line 393 "c-exp.y"
1693 { write_exp_elt_opcode (BINOP_REM); }
1694 break;
1696 case 39:
1697 #line 397 "c-exp.y"
1698 { write_exp_elt_opcode (BINOP_ADD); }
1699 break;
1701 case 40:
1702 #line 401 "c-exp.y"
1703 { write_exp_elt_opcode (BINOP_SUB); }
1704 break;
1706 case 41:
1707 #line 405 "c-exp.y"
1708 { write_exp_elt_opcode (BINOP_LSH); }
1709 break;
1711 case 42:
1712 #line 409 "c-exp.y"
1713 { write_exp_elt_opcode (BINOP_RSH); }
1714 break;
1716 case 43:
1717 #line 413 "c-exp.y"
1718 { write_exp_elt_opcode (BINOP_EQUAL); }
1719 break;
1721 case 44:
1722 #line 417 "c-exp.y"
1723 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1724 break;
1726 case 45:
1727 #line 421 "c-exp.y"
1728 { write_exp_elt_opcode (BINOP_LEQ); }
1729 break;
1731 case 46:
1732 #line 425 "c-exp.y"
1733 { write_exp_elt_opcode (BINOP_GEQ); }
1734 break;
1736 case 47:
1737 #line 429 "c-exp.y"
1738 { write_exp_elt_opcode (BINOP_LESS); }
1739 break;
1741 case 48:
1742 #line 433 "c-exp.y"
1743 { write_exp_elt_opcode (BINOP_GTR); }
1744 break;
1746 case 49:
1747 #line 437 "c-exp.y"
1748 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1749 break;
1751 case 50:
1752 #line 441 "c-exp.y"
1753 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1754 break;
1756 case 51:
1757 #line 445 "c-exp.y"
1758 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1759 break;
1761 case 52:
1762 #line 449 "c-exp.y"
1763 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1764 break;
1766 case 53:
1767 #line 453 "c-exp.y"
1768 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1769 break;
1771 case 54:
1772 #line 457 "c-exp.y"
1773 { write_exp_elt_opcode (TERNOP_COND); }
1774 break;
1776 case 55:
1777 #line 461 "c-exp.y"
1778 { write_exp_elt_opcode (BINOP_ASSIGN); }
1779 break;
1781 case 56:
1782 #line 465 "c-exp.y"
1783 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1784 write_exp_elt_opcode (yyvsp[-1].opcode);
1785 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1786 break;
1788 case 57:
1789 #line 471 "c-exp.y"
1790 { write_exp_elt_opcode (OP_LONG);
1791 write_exp_elt_type (yyvsp[0].typed_val_int.type);
1792 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1793 write_exp_elt_opcode (OP_LONG); }
1794 break;
1796 case 58:
1797 #line 478 "c-exp.y"
1798 { YYSTYPE val;
1799 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1800 write_exp_elt_opcode (OP_LONG);
1801 write_exp_elt_type (val.typed_val_int.type);
1802 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1803 write_exp_elt_opcode (OP_LONG);
1805 break;
1807 case 59:
1808 #line 489 "c-exp.y"
1809 { write_exp_elt_opcode (OP_DOUBLE);
1810 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1811 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1812 write_exp_elt_opcode (OP_DOUBLE); }
1813 break;
1815 case 62:
1816 #line 503 "c-exp.y"
1817 { write_exp_elt_opcode (OP_LONG);
1818 write_exp_elt_type (builtin_type_int);
1819 CHECK_TYPEDEF (yyvsp[-1].tval);
1820 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1821 write_exp_elt_opcode (OP_LONG); }
1822 break;
1824 case 63:
1825 #line 511 "c-exp.y"
1826 { /* C strings are converted into array constants with
1827 an explicit null byte added at the end. Thus
1828 the array upper bound is the string length.
1829 There is no such thing in C as a completely empty
1830 string. */
1831 char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
1832 while (count-- > 0)
1834 write_exp_elt_opcode (OP_LONG);
1835 write_exp_elt_type (builtin_type_char);
1836 write_exp_elt_longcst ((LONGEST)(*sp++));
1837 write_exp_elt_opcode (OP_LONG);
1839 write_exp_elt_opcode (OP_LONG);
1840 write_exp_elt_type (builtin_type_char);
1841 write_exp_elt_longcst ((LONGEST)'\0');
1842 write_exp_elt_opcode (OP_LONG);
1843 write_exp_elt_opcode (OP_ARRAY);
1844 write_exp_elt_longcst ((LONGEST) 0);
1845 write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1846 write_exp_elt_opcode (OP_ARRAY); }
1847 break;
1849 case 64:
1850 #line 536 "c-exp.y"
1851 { write_exp_elt_opcode (OP_LONG);
1852 write_exp_elt_type (builtin_type_bool);
1853 write_exp_elt_longcst ((LONGEST) 1);
1854 write_exp_elt_opcode (OP_LONG); }
1855 break;
1857 case 65:
1858 #line 543 "c-exp.y"
1859 { write_exp_elt_opcode (OP_LONG);
1860 write_exp_elt_type (builtin_type_bool);
1861 write_exp_elt_longcst ((LONGEST) 0);
1862 write_exp_elt_opcode (OP_LONG); }
1863 break;
1865 case 66:
1866 #line 552 "c-exp.y"
1868 if (yyvsp[0].ssym.sym)
1869 yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1870 else
1871 error ("No file or function \"%s\".",
1872 copy_name (yyvsp[0].ssym.stoken));
1874 break;
1876 case 67:
1877 #line 560 "c-exp.y"
1879 yyval.bval = yyvsp[0].bval;
1881 break;
1883 case 68:
1884 #line 566 "c-exp.y"
1885 { struct symbol *tem
1886 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1887 VAR_DOMAIN, (int *) NULL,
1888 (struct symtab **) NULL);
1889 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1890 error ("No function \"%s\" in specified context.",
1891 copy_name (yyvsp[0].sval));
1892 yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
1893 break;
1895 case 69:
1896 #line 577 "c-exp.y"
1897 { struct symbol *sym;
1898 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1899 VAR_DOMAIN, (int *) NULL,
1900 (struct symtab **) NULL);
1901 if (sym == 0)
1902 error ("No symbol \"%s\" in specified context.",
1903 copy_name (yyvsp[0].sval));
1905 write_exp_elt_opcode (OP_VAR_VALUE);
1906 /* block_found is set by lookup_symbol. */
1907 write_exp_elt_block (block_found);
1908 write_exp_elt_sym (sym);
1909 write_exp_elt_opcode (OP_VAR_VALUE); }
1910 break;
1912 case 70:
1913 #line 593 "c-exp.y"
1915 struct type *type = yyvsp[-2].tval;
1916 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1917 && TYPE_CODE (type) != TYPE_CODE_UNION
1918 && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
1919 error ("`%s' is not defined as an aggregate type.",
1920 TYPE_NAME (type));
1922 write_exp_elt_opcode (OP_SCOPE);
1923 write_exp_elt_type (type);
1924 write_exp_string (yyvsp[0].sval);
1925 write_exp_elt_opcode (OP_SCOPE);
1927 break;
1929 case 71:
1930 #line 607 "c-exp.y"
1932 struct type *type = yyvsp[-3].tval;
1933 struct stoken tmp_token;
1934 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1935 && TYPE_CODE (type) != TYPE_CODE_UNION
1936 && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
1937 error ("`%s' is not defined as an aggregate type.",
1938 TYPE_NAME (type));
1940 tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
1941 tmp_token.length = yyvsp[0].sval.length + 1;
1942 tmp_token.ptr[0] = '~';
1943 memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
1944 tmp_token.ptr[tmp_token.length] = 0;
1946 /* Check for valid destructor name. */
1947 destructor_name_p (tmp_token.ptr, type);
1948 write_exp_elt_opcode (OP_SCOPE);
1949 write_exp_elt_type (type);
1950 write_exp_string (tmp_token);
1951 write_exp_elt_opcode (OP_SCOPE);
1953 break;
1955 case 73:
1956 #line 633 "c-exp.y"
1958 char *name = copy_name (yyvsp[0].sval);
1959 struct symbol *sym;
1960 struct minimal_symbol *msymbol;
1962 sym =
1963 lookup_symbol (name, (const struct block *) NULL,
1964 VAR_DOMAIN, (int *) NULL,
1965 (struct symtab **) NULL);
1966 if (sym)
1968 write_exp_elt_opcode (OP_VAR_VALUE);
1969 write_exp_elt_block (NULL);
1970 write_exp_elt_sym (sym);
1971 write_exp_elt_opcode (OP_VAR_VALUE);
1972 break;
1975 msymbol = lookup_minimal_symbol (name, NULL, NULL);
1976 if (msymbol != NULL)
1978 write_exp_msymbol (msymbol,
1979 lookup_function_type (builtin_type_int),
1980 builtin_type_int);
1982 else
1983 if (!have_full_symbols () && !have_partial_symbols ())
1984 error ("No symbol table is loaded. Use the \"file\" command.");
1985 else
1986 error ("No symbol \"%s\" in current context.", name);
1988 break;
1990 case 74:
1991 #line 667 "c-exp.y"
1992 { struct symbol *sym = yyvsp[0].ssym.sym;
1994 if (sym)
1996 if (symbol_read_needs_frame (sym))
1998 if (innermost_block == 0 ||
1999 contained_in (block_found,
2000 innermost_block))
2001 innermost_block = block_found;
2004 write_exp_elt_opcode (OP_VAR_VALUE);
2005 /* We want to use the selected frame, not
2006 another more inner frame which happens to
2007 be in the same block. */
2008 write_exp_elt_block (NULL);
2009 write_exp_elt_sym (sym);
2010 write_exp_elt_opcode (OP_VAR_VALUE);
2012 else if (yyvsp[0].ssym.is_a_field_of_this)
2014 /* C++: it hangs off of `this'. Must
2015 not inadvertently convert from a method call
2016 to data ref. */
2017 if (innermost_block == 0 ||
2018 contained_in (block_found, innermost_block))
2019 innermost_block = block_found;
2020 write_exp_elt_opcode (OP_THIS);
2021 write_exp_elt_opcode (OP_THIS);
2022 write_exp_elt_opcode (STRUCTOP_PTR);
2023 write_exp_string (yyvsp[0].ssym.stoken);
2024 write_exp_elt_opcode (STRUCTOP_PTR);
2026 else
2028 struct minimal_symbol *msymbol;
2029 char *arg = copy_name (yyvsp[0].ssym.stoken);
2031 msymbol =
2032 lookup_minimal_symbol (arg, NULL, NULL);
2033 if (msymbol != NULL)
2035 write_exp_msymbol (msymbol,
2036 lookup_function_type (builtin_type_int),
2037 builtin_type_int);
2039 else if (!have_full_symbols () && !have_partial_symbols ())
2040 error ("No symbol table is loaded. Use the \"file\" command.");
2041 else
2042 error ("No symbol \"%s\" in current context.",
2043 copy_name (yyvsp[0].ssym.stoken));
2046 break;
2048 case 75:
2049 #line 724 "c-exp.y"
2050 { push_type_address_space (copy_name (yyvsp[0].ssym.stoken));
2051 push_type (tp_space_identifier);
2053 break;
2055 case 83:
2056 #line 746 "c-exp.y"
2057 { push_type (tp_pointer); yyval.voidval = 0; }
2058 break;
2060 case 84:
2061 #line 748 "c-exp.y"
2062 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
2063 break;
2065 case 85:
2066 #line 750 "c-exp.y"
2067 { push_type (tp_reference); yyval.voidval = 0; }
2068 break;
2070 case 86:
2071 #line 752 "c-exp.y"
2072 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
2073 break;
2075 case 88:
2076 #line 757 "c-exp.y"
2077 { yyval.voidval = yyvsp[-1].voidval; }
2078 break;
2080 case 89:
2081 #line 759 "c-exp.y"
2083 push_type_int (yyvsp[0].lval);
2084 push_type (tp_array);
2086 break;
2088 case 90:
2089 #line 764 "c-exp.y"
2091 push_type_int (yyvsp[0].lval);
2092 push_type (tp_array);
2093 yyval.voidval = 0;
2095 break;
2097 case 91:
2098 #line 771 "c-exp.y"
2099 { push_type (tp_function); }
2100 break;
2102 case 92:
2103 #line 773 "c-exp.y"
2104 { push_type (tp_function); }
2105 break;
2107 case 93:
2108 #line 777 "c-exp.y"
2109 { yyval.lval = -1; }
2110 break;
2112 case 94:
2113 #line 779 "c-exp.y"
2114 { yyval.lval = yyvsp[-1].typed_val_int.val; }
2115 break;
2117 case 95:
2118 #line 783 "c-exp.y"
2119 { yyval.voidval = 0; }
2120 break;
2122 case 96:
2123 #line 785 "c-exp.y"
2124 { free (yyvsp[-1].tvec); yyval.voidval = 0; }
2125 break;
2127 case 98:
2128 #line 798 "c-exp.y"
2129 { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); }
2130 break;
2132 case 99:
2133 #line 803 "c-exp.y"
2134 { yyval.tval = yyvsp[0].tsym.type; }
2135 break;
2137 case 100:
2138 #line 805 "c-exp.y"
2139 { yyval.tval = builtin_type_int; }
2140 break;
2142 case 101:
2143 #line 807 "c-exp.y"
2144 { yyval.tval = builtin_type_long; }
2145 break;
2147 case 102:
2148 #line 809 "c-exp.y"
2149 { yyval.tval = builtin_type_short; }
2150 break;
2152 case 103:
2153 #line 811 "c-exp.y"
2154 { yyval.tval = builtin_type_long; }
2155 break;
2157 case 104:
2158 #line 813 "c-exp.y"
2159 { yyval.tval = builtin_type_long; }
2160 break;
2162 case 105:
2163 #line 815 "c-exp.y"
2164 { yyval.tval = builtin_type_long; }
2165 break;
2167 case 106:
2168 #line 817 "c-exp.y"
2169 { yyval.tval = builtin_type_long; }
2170 break;
2172 case 107:
2173 #line 819 "c-exp.y"
2174 { yyval.tval = builtin_type_unsigned_long; }
2175 break;
2177 case 108:
2178 #line 821 "c-exp.y"
2179 { yyval.tval = builtin_type_unsigned_long; }
2180 break;
2182 case 109:
2183 #line 823 "c-exp.y"
2184 { yyval.tval = builtin_type_unsigned_long; }
2185 break;
2187 case 110:
2188 #line 825 "c-exp.y"
2189 { yyval.tval = builtin_type_long_long; }
2190 break;
2192 case 111:
2193 #line 827 "c-exp.y"
2194 { yyval.tval = builtin_type_long_long; }
2195 break;
2197 case 112:
2198 #line 829 "c-exp.y"
2199 { yyval.tval = builtin_type_long_long; }
2200 break;
2202 case 113:
2203 #line 831 "c-exp.y"
2204 { yyval.tval = builtin_type_long_long; }
2205 break;
2207 case 114:
2208 #line 833 "c-exp.y"
2209 { yyval.tval = builtin_type_long_long; }
2210 break;
2212 case 115:
2213 #line 835 "c-exp.y"
2214 { yyval.tval = builtin_type_long_long; }
2215 break;
2217 case 116:
2218 #line 837 "c-exp.y"
2219 { yyval.tval = builtin_type_unsigned_long_long; }
2220 break;
2222 case 117:
2223 #line 839 "c-exp.y"
2224 { yyval.tval = builtin_type_unsigned_long_long; }
2225 break;
2227 case 118:
2228 #line 841 "c-exp.y"
2229 { yyval.tval = builtin_type_unsigned_long_long; }
2230 break;
2232 case 119:
2233 #line 843 "c-exp.y"
2234 { yyval.tval = builtin_type_unsigned_long_long; }
2235 break;
2237 case 120:
2238 #line 845 "c-exp.y"
2239 { yyval.tval = builtin_type_short; }
2240 break;
2242 case 121:
2243 #line 847 "c-exp.y"
2244 { yyval.tval = builtin_type_short; }
2245 break;
2247 case 122:
2248 #line 849 "c-exp.y"
2249 { yyval.tval = builtin_type_short; }
2250 break;
2252 case 123:
2253 #line 851 "c-exp.y"
2254 { yyval.tval = builtin_type_unsigned_short; }
2255 break;
2257 case 124:
2258 #line 853 "c-exp.y"
2259 { yyval.tval = builtin_type_unsigned_short; }
2260 break;
2262 case 125:
2263 #line 855 "c-exp.y"
2264 { yyval.tval = builtin_type_unsigned_short; }
2265 break;
2267 case 126:
2268 #line 857 "c-exp.y"
2269 { yyval.tval = builtin_type_double; }
2270 break;
2272 case 127:
2273 #line 859 "c-exp.y"
2274 { yyval.tval = builtin_type_long_double; }
2275 break;
2277 case 128:
2278 #line 861 "c-exp.y"
2279 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2280 expression_context_block); }
2281 break;
2283 case 129:
2284 #line 864 "c-exp.y"
2285 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2286 expression_context_block); }
2287 break;
2289 case 130:
2290 #line 867 "c-exp.y"
2291 { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
2292 expression_context_block); }
2293 break;
2295 case 131:
2296 #line 870 "c-exp.y"
2297 { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
2298 expression_context_block); }
2299 break;
2301 case 132:
2302 #line 873 "c-exp.y"
2303 { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
2304 break;
2306 case 133:
2307 #line 875 "c-exp.y"
2308 { yyval.tval = builtin_type_unsigned_int; }
2309 break;
2311 case 134:
2312 #line 877 "c-exp.y"
2313 { yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
2314 break;
2316 case 135:
2317 #line 879 "c-exp.y"
2318 { yyval.tval = builtin_type_int; }
2319 break;
2321 case 136:
2322 #line 884 "c-exp.y"
2323 { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
2324 expression_context_block);
2326 break;
2328 case 137:
2329 #line 888 "c-exp.y"
2330 { yyval.tval = follow_types (yyvsp[0].tval); }
2331 break;
2333 case 138:
2334 #line 890 "c-exp.y"
2335 { yyval.tval = follow_types (yyvsp[-1].tval); }
2336 break;
2338 case 140:
2339 #line 940 "c-exp.y"
2341 struct type *type = yyvsp[-2].tval;
2342 struct type *new_type;
2343 char *ncopy = alloca (yyvsp[0].sval.length + 1);
2345 memcpy (ncopy, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
2346 ncopy[yyvsp[0].sval.length] = '\0';
2348 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
2349 && TYPE_CODE (type) != TYPE_CODE_UNION
2350 && TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
2351 error ("`%s' is not defined as an aggregate type.",
2352 TYPE_NAME (type));
2354 new_type = cp_lookup_nested_type (type, ncopy,
2355 expression_context_block);
2356 if (new_type == NULL)
2357 error ("No type \"%s\" within class or namespace \"%s\".",
2358 ncopy, TYPE_NAME (type));
2360 yyval.tval = new_type;
2362 break;
2364 case 142:
2365 #line 966 "c-exp.y"
2367 yyval.tsym.stoken.ptr = "int";
2368 yyval.tsym.stoken.length = 3;
2369 yyval.tsym.type = builtin_type_int;
2371 break;
2373 case 143:
2374 #line 972 "c-exp.y"
2376 yyval.tsym.stoken.ptr = "long";
2377 yyval.tsym.stoken.length = 4;
2378 yyval.tsym.type = builtin_type_long;
2380 break;
2382 case 144:
2383 #line 978 "c-exp.y"
2385 yyval.tsym.stoken.ptr = "short";
2386 yyval.tsym.stoken.length = 5;
2387 yyval.tsym.type = builtin_type_short;
2389 break;
2391 case 145:
2392 #line 987 "c-exp.y"
2393 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
2394 yyval.ivec[0] = 1; /* Number of types in vector */
2395 yyval.tvec[1] = yyvsp[0].tval;
2397 break;
2399 case 146:
2400 #line 992 "c-exp.y"
2401 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
2402 yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
2403 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
2405 break;
2407 case 148:
2408 #line 1000 "c-exp.y"
2409 { yyval.tval = follow_types (yyvsp[-3].tval); }
2410 break;
2412 case 151:
2413 #line 1008 "c-exp.y"
2414 { push_type (tp_const);
2415 push_type (tp_volatile);
2417 break;
2419 case 152:
2420 #line 1012 "c-exp.y"
2421 { push_type (tp_const); }
2422 break;
2424 case 153:
2425 #line 1014 "c-exp.y"
2426 { push_type (tp_volatile); }
2427 break;
2429 case 154:
2430 #line 1017 "c-exp.y"
2431 { yyval.sval = yyvsp[0].ssym.stoken; }
2432 break;
2434 case 155:
2435 #line 1018 "c-exp.y"
2436 { yyval.sval = yyvsp[0].ssym.stoken; }
2437 break;
2439 case 156:
2440 #line 1019 "c-exp.y"
2441 { yyval.sval = yyvsp[0].tsym.stoken; }
2442 break;
2444 case 157:
2445 #line 1020 "c-exp.y"
2446 { yyval.sval = yyvsp[0].ssym.stoken; }
2447 break;
2452 /* Line 991 of yacc.c. */
2454 yyvsp -= yylen;
2455 yyssp -= yylen;
2458 YY_STACK_PRINT (yyss, yyssp);
2460 *++yyvsp = yyval;
2463 /* Now `shift' the result of the reduction. Determine what state
2464 that goes to, based on the state we popped back to and the rule
2465 number reduced by. */
2467 yyn = yyr1[yyn];
2469 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2470 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2471 yystate = yytable[yystate];
2472 else
2473 yystate = yydefgoto[yyn - YYNTOKENS];
2475 goto yynewstate;
2478 /*------------------------------------.
2479 | yyerrlab -- here on detecting error |
2480 `------------------------------------*/
2481 yyerrlab:
2482 /* If not already recovering from an error, report this error. */
2483 if (!yyerrstatus)
2485 ++yynerrs;
2486 #if YYERROR_VERBOSE
2487 yyn = yypact[yystate];
2489 if (YYPACT_NINF < yyn && yyn < YYLAST)
2491 YYSIZE_T yysize = 0;
2492 int yytype = YYTRANSLATE (yychar);
2493 char *yymsg;
2494 int yyx, yycount;
2496 yycount = 0;
2497 /* Start YYX at -YYN if negative to avoid negative indexes in
2498 YYCHECK. */
2499 for (yyx = yyn < 0 ? -yyn : 0;
2500 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
2501 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2502 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
2503 yysize += yystrlen ("syntax error, unexpected ") + 1;
2504 yysize += yystrlen (yytname[yytype]);
2505 yymsg = (char *) YYSTACK_ALLOC (yysize);
2506 if (yymsg != 0)
2508 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2509 yyp = yystpcpy (yyp, yytname[yytype]);
2511 if (yycount < 5)
2513 yycount = 0;
2514 for (yyx = yyn < 0 ? -yyn : 0;
2515 yyx < (int) (sizeof (yytname) / sizeof (char *));
2516 yyx++)
2517 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2519 const char *yyq = ! yycount ? ", expecting " : " or ";
2520 yyp = yystpcpy (yyp, yyq);
2521 yyp = yystpcpy (yyp, yytname[yyx]);
2522 yycount++;
2525 yyerror (yymsg);
2526 YYSTACK_FREE (yymsg);
2528 else
2529 yyerror ("syntax error; also virtual memory exhausted");
2531 else
2532 #endif /* YYERROR_VERBOSE */
2533 yyerror ("syntax error");
2538 if (yyerrstatus == 3)
2540 /* If just tried and failed to reuse lookahead token after an
2541 error, discard it. */
2543 /* Return failure if at end of input. */
2544 if (yychar == YYEOF)
2546 /* Pop the error token. */
2547 YYPOPSTACK;
2548 /* Pop the rest of the stack. */
2549 while (yyss < yyssp)
2551 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2552 yydestruct (yystos[*yyssp], yyvsp);
2553 YYPOPSTACK;
2555 YYABORT;
2558 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2559 yydestruct (yytoken, &yylval);
2560 yychar = YYEMPTY;
2564 /* Else will try to reuse lookahead token after shifting the error
2565 token. */
2566 goto yyerrlab2;
2569 /*----------------------------------------------------.
2570 | yyerrlab1 -- error raised explicitly by an action. |
2571 `----------------------------------------------------*/
2572 yyerrlab1:
2574 /* Suppress GCC warning that yyerrlab1 is unused when no action
2575 invokes YYERROR. MacOS 10.2.3's buggy "smart preprocessor"
2576 insists on the trailing semicolon. */
2577 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
2578 __attribute__ ((__unused__));
2579 #endif
2582 goto yyerrlab2;
2585 /*---------------------------------------------------------------.
2586 | yyerrlab2 -- pop states until the error token can be shifted. |
2587 `---------------------------------------------------------------*/
2588 yyerrlab2:
2589 yyerrstatus = 3; /* Each real token shifted decrements this. */
2591 for (;;)
2593 yyn = yypact[yystate];
2594 if (yyn != YYPACT_NINF)
2596 yyn += YYTERROR;
2597 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2599 yyn = yytable[yyn];
2600 if (0 < yyn)
2601 break;
2605 /* Pop the current state because it cannot handle the error token. */
2606 if (yyssp == yyss)
2607 YYABORT;
2609 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2610 yydestruct (yystos[yystate], yyvsp);
2611 yyvsp--;
2612 yystate = *--yyssp;
2614 YY_STACK_PRINT (yyss, yyssp);
2617 if (yyn == YYFINAL)
2618 YYACCEPT;
2620 YYDPRINTF ((stderr, "Shifting error token, "));
2622 *++yyvsp = yylval;
2625 yystate = yyn;
2626 goto yynewstate;
2629 /*-------------------------------------.
2630 | yyacceptlab -- YYACCEPT comes here. |
2631 `-------------------------------------*/
2632 yyacceptlab:
2633 yyresult = 0;
2634 goto yyreturn;
2636 /*-----------------------------------.
2637 | yyabortlab -- YYABORT comes here. |
2638 `-----------------------------------*/
2639 yyabortlab:
2640 yyresult = 1;
2641 goto yyreturn;
2643 #ifndef yyoverflow
2644 /*----------------------------------------------.
2645 | yyoverflowlab -- parser overflow comes here. |
2646 `----------------------------------------------*/
2647 yyoverflowlab:
2648 yyerror ("parser stack overflow");
2649 yyresult = 2;
2650 /* Fall through. */
2651 #endif
2653 yyreturn:
2654 #ifndef yyoverflow
2655 if (yyss != yyssa)
2656 YYSTACK_FREE (yyss);
2657 #endif
2658 return yyresult;
2662 #line 1034 "c-exp.y"
2665 /* Take care of parsing a number (anything that starts with a digit).
2666 Set yylval and return the token type; update lexptr.
2667 LEN is the number of characters in it. */
2669 /*** Needs some error checking for the float case ***/
2671 static int
2672 parse_number (p, len, parsed_float, putithere)
2673 char *p;
2674 int len;
2675 int parsed_float;
2676 YYSTYPE *putithere;
2678 /* FIXME: Shouldn't these be unsigned? We don't deal with negative values
2679 here, and we do kind of silly things like cast to unsigned. */
2680 LONGEST n = 0;
2681 LONGEST prevn = 0;
2682 ULONGEST un;
2684 int i = 0;
2685 int c;
2686 int base = input_radix;
2687 int unsigned_p = 0;
2689 /* Number of "L" suffixes encountered. */
2690 int long_p = 0;
2692 /* We have found a "L" or "U" suffix. */
2693 int found_suffix = 0;
2695 ULONGEST high_bit;
2696 struct type *signed_type;
2697 struct type *unsigned_type;
2699 if (parsed_float)
2701 /* It's a float since it contains a point or an exponent. */
2702 char c;
2703 int num = 0; /* number of tokens scanned by scanf */
2704 char saved_char = p[len];
2706 p[len] = 0; /* null-terminate the token */
2707 if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
2708 num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval,&c);
2709 else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2710 num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval,&c);
2711 else
2713 #ifdef SCANF_HAS_LONG_DOUBLE
2714 num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval,&c);
2715 #else
2716 /* Scan it into a double, then assign it to the long double.
2717 This at least wins with values representable in the range
2718 of doubles. */
2719 double temp;
2720 num = sscanf (p, "%lg%c", &temp,&c);
2721 putithere->typed_val_float.dval = temp;
2722 #endif
2724 p[len] = saved_char; /* restore the input stream */
2725 if (num != 1) /* check scanf found ONLY a float ... */
2726 return ERROR;
2727 /* See if it has `f' or `l' suffix (float or long double). */
2729 c = tolower (p[len - 1]);
2731 if (c == 'f')
2732 putithere->typed_val_float.type = builtin_type_float;
2733 else if (c == 'l')
2734 putithere->typed_val_float.type = builtin_type_long_double;
2735 else if (isdigit (c) || c == '.')
2736 putithere->typed_val_float.type = builtin_type_double;
2737 else
2738 return ERROR;
2740 return FLOAT;
2743 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2744 if (p[0] == '0')
2745 switch (p[1])
2747 case 'x':
2748 case 'X':
2749 if (len >= 3)
2751 p += 2;
2752 base = 16;
2753 len -= 2;
2755 break;
2757 case 't':
2758 case 'T':
2759 case 'd':
2760 case 'D':
2761 if (len >= 3)
2763 p += 2;
2764 base = 10;
2765 len -= 2;
2767 break;
2769 default:
2770 base = 8;
2771 break;
2774 while (len-- > 0)
2776 c = *p++;
2777 if (c >= 'A' && c <= 'Z')
2778 c += 'a' - 'A';
2779 if (c != 'l' && c != 'u')
2780 n *= base;
2781 if (c >= '0' && c <= '9')
2783 if (found_suffix)
2784 return ERROR;
2785 n += i = c - '0';
2787 else
2789 if (base > 10 && c >= 'a' && c <= 'f')
2791 if (found_suffix)
2792 return ERROR;
2793 n += i = c - 'a' + 10;
2795 else if (c == 'l')
2797 ++long_p;
2798 found_suffix = 1;
2800 else if (c == 'u')
2802 unsigned_p = 1;
2803 found_suffix = 1;
2805 else
2806 return ERROR; /* Char not a digit */
2808 if (i >= base)
2809 return ERROR; /* Invalid digit in this base */
2811 /* Portably test for overflow (only works for nonzero values, so make
2812 a second check for zero). FIXME: Can't we just make n and prevn
2813 unsigned and avoid this? */
2814 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2815 unsigned_p = 1; /* Try something unsigned */
2817 /* Portably test for unsigned overflow.
2818 FIXME: This check is wrong; for example it doesn't find overflow
2819 on 0x123456789 when LONGEST is 32 bits. */
2820 if (c != 'l' && c != 'u' && n != 0)
2822 if ((unsigned_p && (ULONGEST) prevn >= (ULONGEST) n))
2823 error ("Numeric constant too large.");
2825 prevn = n;
2828 /* An integer constant is an int, a long, or a long long. An L
2829 suffix forces it to be long; an LL suffix forces it to be long
2830 long. If not forced to a larger size, it gets the first type of
2831 the above that it fits in. To figure out whether it fits, we
2832 shift it right and see whether anything remains. Note that we
2833 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2834 operation, because many compilers will warn about such a shift
2835 (which always produces a zero result). Sometimes TARGET_INT_BIT
2836 or TARGET_LONG_BIT will be that big, sometimes not. To deal with
2837 the case where it is we just always shift the value more than
2838 once, with fewer bits each time. */
2840 un = (ULONGEST)n >> 2;
2841 if (long_p == 0
2842 && (un >> (TARGET_INT_BIT - 2)) == 0)
2844 high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2846 /* A large decimal (not hex or octal) constant (between INT_MAX
2847 and UINT_MAX) is a long or unsigned long, according to ANSI,
2848 never an unsigned int, but this code treats it as unsigned
2849 int. This probably should be fixed. GCC gives a warning on
2850 such constants. */
2852 unsigned_type = builtin_type_unsigned_int;
2853 signed_type = builtin_type_int;
2855 else if (long_p <= 1
2856 && (un >> (TARGET_LONG_BIT - 2)) == 0)
2858 high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2859 unsigned_type = builtin_type_unsigned_long;
2860 signed_type = builtin_type_long;
2862 else
2864 int shift;
2865 if (sizeof (ULONGEST) * HOST_CHAR_BIT < TARGET_LONG_LONG_BIT)
2866 /* A long long does not fit in a LONGEST. */
2867 shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1);
2868 else
2869 shift = (TARGET_LONG_LONG_BIT - 1);
2870 high_bit = (ULONGEST) 1 << shift;
2871 unsigned_type = builtin_type_unsigned_long_long;
2872 signed_type = builtin_type_long_long;
2875 putithere->typed_val_int.val = n;
2877 /* If the high bit of the worked out type is set then this number
2878 has to be unsigned. */
2880 if (unsigned_p || (n & high_bit))
2882 putithere->typed_val_int.type = unsigned_type;
2884 else
2886 putithere->typed_val_int.type = signed_type;
2889 return INT;
2892 struct token
2894 char *operator;
2895 int token;
2896 enum exp_opcode opcode;
2899 static const struct token tokentab3[] =
2901 {">>=", ASSIGN_MODIFY, BINOP_RSH},
2902 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2905 static const struct token tokentab2[] =
2907 {"+=", ASSIGN_MODIFY, BINOP_ADD},
2908 {"-=", ASSIGN_MODIFY, BINOP_SUB},
2909 {"*=", ASSIGN_MODIFY, BINOP_MUL},
2910 {"/=", ASSIGN_MODIFY, BINOP_DIV},
2911 {"%=", ASSIGN_MODIFY, BINOP_REM},
2912 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2913 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2914 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2915 {"++", INCREMENT, BINOP_END},
2916 {"--", DECREMENT, BINOP_END},
2917 {"->", ARROW, BINOP_END},
2918 {"&&", ANDAND, BINOP_END},
2919 {"||", OROR, BINOP_END},
2920 {"::", COLONCOLON, BINOP_END},
2921 {"<<", LSH, BINOP_END},
2922 {">>", RSH, BINOP_END},
2923 {"==", EQUAL, BINOP_END},
2924 {"!=", NOTEQUAL, BINOP_END},
2925 {"<=", LEQ, BINOP_END},
2926 {">=", GEQ, BINOP_END}
2929 /* Read one token, getting characters through lexptr. */
2931 static int
2932 yylex ()
2934 int c;
2935 int namelen;
2936 unsigned int i;
2937 char *tokstart;
2938 char *tokptr;
2939 int tempbufindex;
2940 static char *tempbuf;
2941 static int tempbufsize;
2942 struct symbol * sym_class = NULL;
2943 char * token_string = NULL;
2944 int class_prefix = 0;
2945 int unquoted_expr;
2947 retry:
2949 /* Check if this is a macro invocation that we need to expand. */
2950 if (! scanning_macro_expansion ())
2952 char *expanded = macro_expand_next (&lexptr,
2953 expression_macro_lookup_func,
2954 expression_macro_lookup_baton);
2956 if (expanded)
2957 scan_macro_expansion (expanded);
2960 prev_lexptr = lexptr;
2961 unquoted_expr = 1;
2963 tokstart = lexptr;
2964 /* See if it is a special token of length 3. */
2965 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2966 if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2968 lexptr += 3;
2969 yylval.opcode = tokentab3[i].opcode;
2970 return tokentab3[i].token;
2973 /* See if it is a special token of length 2. */
2974 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2975 if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2977 lexptr += 2;
2978 yylval.opcode = tokentab2[i].opcode;
2979 return tokentab2[i].token;
2982 switch (c = *tokstart)
2984 case 0:
2985 /* If we were just scanning the result of a macro expansion,
2986 then we need to resume scanning the original text.
2987 Otherwise, we were already scanning the original text, and
2988 we're really done. */
2989 if (scanning_macro_expansion ())
2991 finished_macro_expansion ();
2992 goto retry;
2994 else
2995 return 0;
2997 case ' ':
2998 case '\t':
2999 case '\n':
3000 lexptr++;
3001 goto retry;
3003 case '\'':
3004 /* We either have a character constant ('0' or '\177' for example)
3005 or we have a quoted symbol reference ('foo(int,int)' in C++
3006 for example). */
3007 lexptr++;
3008 c = *lexptr++;
3009 if (c == '\\')
3010 c = parse_escape (&lexptr);
3011 else if (c == '\'')
3012 error ("Empty character constant.");
3013 else if (! host_char_to_target (c, &c))
3015 int toklen = lexptr - tokstart + 1;
3016 char *tok = alloca (toklen + 1);
3017 memcpy (tok, tokstart, toklen);
3018 tok[toklen] = '\0';
3019 error ("There is no character corresponding to %s in the target "
3020 "character set `%s'.", tok, target_charset ());
3023 yylval.typed_val_int.val = c;
3024 yylval.typed_val_int.type = builtin_type_char;
3026 c = *lexptr++;
3027 if (c != '\'')
3029 namelen = skip_quoted (tokstart) - tokstart;
3030 if (namelen > 2)
3032 lexptr = tokstart + namelen;
3033 unquoted_expr = 0;
3034 if (lexptr[-1] != '\'')
3035 error ("Unmatched single quote.");
3036 namelen -= 2;
3037 tokstart++;
3038 goto tryname;
3040 error ("Invalid character constant.");
3042 return INT;
3044 case '(':
3045 paren_depth++;
3046 lexptr++;
3047 return c;
3049 case ')':
3050 if (paren_depth == 0)
3051 return 0;
3052 paren_depth--;
3053 lexptr++;
3054 return c;
3056 case ',':
3057 if (comma_terminates
3058 && paren_depth == 0
3059 && ! scanning_macro_expansion ())
3060 return 0;
3061 lexptr++;
3062 return c;
3064 case '.':
3065 /* Might be a floating point number. */
3066 if (lexptr[1] < '0' || lexptr[1] > '9')
3067 goto symbol; /* Nope, must be a symbol. */
3068 /* FALL THRU into number case. */
3070 case '0':
3071 case '1':
3072 case '2':
3073 case '3':
3074 case '4':
3075 case '5':
3076 case '6':
3077 case '7':
3078 case '8':
3079 case '9':
3081 /* It's a number. */
3082 int got_dot = 0, got_e = 0, toktype;
3083 char *p = tokstart;
3084 int hex = input_radix > 10;
3086 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
3088 p += 2;
3089 hex = 1;
3091 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
3093 p += 2;
3094 hex = 0;
3097 for (;; ++p)
3099 /* This test includes !hex because 'e' is a valid hex digit
3100 and thus does not indicate a floating point number when
3101 the radix is hex. */
3102 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
3103 got_dot = got_e = 1;
3104 /* This test does not include !hex, because a '.' always indicates
3105 a decimal floating point number regardless of the radix. */
3106 else if (!got_dot && *p == '.')
3107 got_dot = 1;
3108 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
3109 && (*p == '-' || *p == '+'))
3110 /* This is the sign of the exponent, not the end of the
3111 number. */
3112 continue;
3113 /* We will take any letters or digits. parse_number will
3114 complain if past the radix, or if L or U are not final. */
3115 else if ((*p < '0' || *p > '9')
3116 && ((*p < 'a' || *p > 'z')
3117 && (*p < 'A' || *p > 'Z')))
3118 break;
3120 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
3121 if (toktype == ERROR)
3123 char *err_copy = (char *) alloca (p - tokstart + 1);
3125 memcpy (err_copy, tokstart, p - tokstart);
3126 err_copy[p - tokstart] = 0;
3127 error ("Invalid number \"%s\".", err_copy);
3129 lexptr = p;
3130 return toktype;
3133 case '+':
3134 case '-':
3135 case '*':
3136 case '/':
3137 case '%':
3138 case '|':
3139 case '&':
3140 case '^':
3141 case '~':
3142 case '!':
3143 case '@':
3144 case '<':
3145 case '>':
3146 case '[':
3147 case ']':
3148 case '?':
3149 case ':':
3150 case '=':
3151 case '{':
3152 case '}':
3153 symbol:
3154 lexptr++;
3155 return c;
3157 case '"':
3159 /* Build the gdb internal form of the input string in tempbuf,
3160 translating any standard C escape forms seen. Note that the
3161 buffer is null byte terminated *only* for the convenience of
3162 debugging gdb itself and printing the buffer contents when
3163 the buffer contains no embedded nulls. Gdb does not depend
3164 upon the buffer being null byte terminated, it uses the length
3165 string instead. This allows gdb to handle C strings (as well
3166 as strings in other languages) with embedded null bytes */
3168 tokptr = ++tokstart;
3169 tempbufindex = 0;
3171 do {
3172 char *char_start_pos = tokptr;
3174 /* Grow the static temp buffer if necessary, including allocating
3175 the first one on demand. */
3176 if (tempbufindex + 1 >= tempbufsize)
3178 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
3180 switch (*tokptr)
3182 case '\0':
3183 case '"':
3184 /* Do nothing, loop will terminate. */
3185 break;
3186 case '\\':
3187 tokptr++;
3188 c = parse_escape (&tokptr);
3189 if (c == -1)
3191 continue;
3193 tempbuf[tempbufindex++] = c;
3194 break;
3195 default:
3196 c = *tokptr++;
3197 if (! host_char_to_target (c, &c))
3199 int len = tokptr - char_start_pos;
3200 char *copy = alloca (len + 1);
3201 memcpy (copy, char_start_pos, len);
3202 copy[len] = '\0';
3204 error ("There is no character corresponding to `%s' "
3205 "in the target character set `%s'.",
3206 copy, target_charset ());
3208 tempbuf[tempbufindex++] = c;
3209 break;
3211 } while ((*tokptr != '"') && (*tokptr != '\0'));
3212 if (*tokptr++ != '"')
3214 error ("Unterminated string in expression.");
3216 tempbuf[tempbufindex] = '\0'; /* See note above */
3217 yylval.sval.ptr = tempbuf;
3218 yylval.sval.length = tempbufindex;
3219 lexptr = tokptr;
3220 return (STRING);
3223 if (!(c == '_' || c == '$'
3224 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
3225 /* We must have come across a bad character (e.g. ';'). */
3226 error ("Invalid character '%c' in expression.", c);
3228 /* It's a name. See how long it is. */
3229 namelen = 0;
3230 for (c = tokstart[namelen];
3231 (c == '_' || c == '$' || (c >= '0' && c <= '9')
3232 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
3234 /* Template parameter lists are part of the name.
3235 FIXME: This mishandles `print $a<4&&$a>3'. */
3237 if (c == '<')
3239 /* Scan ahead to get rest of the template specification. Note
3240 that we look ahead only when the '<' adjoins non-whitespace
3241 characters; for comparison expressions, e.g. "a < b > c",
3242 there must be spaces before the '<', etc. */
3244 char * p = find_template_name_end (tokstart + namelen);
3245 if (p)
3246 namelen = p - tokstart;
3247 break;
3249 c = tokstart[++namelen];
3252 /* The token "if" terminates the expression and is NOT removed from
3253 the input stream. It doesn't count if it appears in the
3254 expansion of a macro. */
3255 if (namelen == 2
3256 && tokstart[0] == 'i'
3257 && tokstart[1] == 'f'
3258 && ! scanning_macro_expansion ())
3260 return 0;
3263 lexptr += namelen;
3265 tryname:
3267 /* Catch specific keywords. Should be done with a data structure. */
3268 switch (namelen)
3270 case 8:
3271 if (strncmp (tokstart, "unsigned", 8) == 0)
3272 return UNSIGNED;
3273 if (current_language->la_language == language_cplus
3274 && strncmp (tokstart, "template", 8) == 0)
3275 return TEMPLATE;
3276 if (strncmp (tokstart, "volatile", 8) == 0)
3277 return VOLATILE_KEYWORD;
3278 break;
3279 case 6:
3280 if (strncmp (tokstart, "struct", 6) == 0)
3281 return STRUCT;
3282 if (strncmp (tokstart, "signed", 6) == 0)
3283 return SIGNED_KEYWORD;
3284 if (strncmp (tokstart, "sizeof", 6) == 0)
3285 return SIZEOF;
3286 if (strncmp (tokstart, "double", 6) == 0)
3287 return DOUBLE_KEYWORD;
3288 break;
3289 case 5:
3290 if (current_language->la_language == language_cplus)
3292 if (strncmp (tokstart, "false", 5) == 0)
3293 return FALSEKEYWORD;
3294 if (strncmp (tokstart, "class", 5) == 0)
3295 return CLASS;
3297 if (strncmp (tokstart, "union", 5) == 0)
3298 return UNION;
3299 if (strncmp (tokstart, "short", 5) == 0)
3300 return SHORT;
3301 if (strncmp (tokstart, "const", 5) == 0)
3302 return CONST_KEYWORD;
3303 break;
3304 case 4:
3305 if (strncmp (tokstart, "enum", 4) == 0)
3306 return ENUM;
3307 if (strncmp (tokstart, "long", 4) == 0)
3308 return LONG;
3309 if (current_language->la_language == language_cplus)
3311 if (strncmp (tokstart, "true", 4) == 0)
3312 return TRUEKEYWORD;
3314 break;
3315 case 3:
3316 if (strncmp (tokstart, "int", 3) == 0)
3317 return INT_KEYWORD;
3318 break;
3319 default:
3320 break;
3323 yylval.sval.ptr = tokstart;
3324 yylval.sval.length = namelen;
3326 if (*tokstart == '$')
3328 write_dollar_variable (yylval.sval);
3329 return VARIABLE;
3332 /* Look ahead and see if we can consume more of the input
3333 string to get a reasonable class/namespace spec or a
3334 fully-qualified name. This is a kludge to get around the
3335 HP aCC compiler's generation of symbol names with embedded
3336 colons for namespace and nested classes. */
3338 /* NOTE: carlton/2003-09-24: I don't entirely understand the
3339 HP-specific code, either here or in linespec. Having said that,
3340 I suspect that we're actually moving towards their model: we want
3341 symbols whose names are fully qualified, which matches the
3342 description above. */
3343 if (unquoted_expr)
3345 /* Only do it if not inside single quotes */
3346 sym_class = parse_nested_classes_for_hpacc (yylval.sval.ptr, yylval.sval.length,
3347 &token_string, &class_prefix, &lexptr);
3348 if (sym_class)
3350 /* Replace the current token with the bigger one we found */
3351 yylval.sval.ptr = token_string;
3352 yylval.sval.length = strlen (token_string);
3356 /* Use token-type BLOCKNAME for symbols that happen to be defined as
3357 functions or symtabs. If this is not so, then ...
3358 Use token-type TYPENAME for symbols that happen to be defined
3359 currently as names of types; NAME for other symbols.
3360 The caller is not constrained to care about the distinction. */
3362 char *tmp = copy_name (yylval.sval);
3363 struct symbol *sym;
3364 int is_a_field_of_this = 0;
3365 int hextype;
3367 sym = lookup_symbol (tmp, expression_context_block,
3368 VAR_DOMAIN,
3369 current_language->la_language == language_cplus
3370 ? &is_a_field_of_this : (int *) NULL,
3371 (struct symtab **) NULL);
3372 /* Call lookup_symtab, not lookup_partial_symtab, in case there are
3373 no psymtabs (coff, xcoff, or some future change to blow away the
3374 psymtabs once once symbols are read). */
3375 if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
3377 yylval.ssym.sym = sym;
3378 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3379 return BLOCKNAME;
3381 else if (!sym)
3382 { /* See if it's a file name. */
3383 struct symtab *symtab;
3385 symtab = lookup_symtab (tmp);
3387 if (symtab)
3389 yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
3390 return FILENAME;
3394 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
3396 /* NOTE: carlton/2003-09-25: There used to be code here to
3397 handle nested types. It didn't work very well. See the
3398 comment before qualified_type for more info. */
3399 yylval.tsym.type = SYMBOL_TYPE (sym);
3400 return TYPENAME;
3402 if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
3403 return TYPENAME;
3405 /* Input names that aren't symbols but ARE valid hex numbers,
3406 when the input radix permits them, can be names or numbers
3407 depending on the parse. Note we support radixes > 16 here. */
3408 if (!sym &&
3409 ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
3410 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
3412 YYSTYPE newlval; /* Its value is ignored. */
3413 hextype = parse_number (tokstart, namelen, 0, &newlval);
3414 if (hextype == INT)
3416 yylval.ssym.sym = sym;
3417 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3418 return NAME_OR_INT;
3422 /* Any other kind of symbol */
3423 yylval.ssym.sym = sym;
3424 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3425 return NAME;
3429 void
3430 yyerror (msg)
3431 char *msg;
3433 if (prev_lexptr)
3434 lexptr = prev_lexptr;
3436 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);