No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / objc-exp.c
blob799832dc4766fffca2abe0c2dbf653a933cc9c49
1 /* A Bison parser, made by GNU Bison 1.875c. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
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 NSSTRING = 261,
60 SELECTOR = 262,
61 NAME = 263,
62 TYPENAME = 264,
63 CLASSNAME = 265,
64 NAME_OR_INT = 266,
65 STRUCT = 267,
66 CLASS = 268,
67 UNION = 269,
68 ENUM = 270,
69 SIZEOF = 271,
70 UNSIGNED = 272,
71 COLONCOLON = 273,
72 TEMPLATE = 274,
73 ERROR = 275,
74 SIGNED_KEYWORD = 276,
75 LONG = 277,
76 SHORT = 278,
77 INT_KEYWORD = 279,
78 CONST_KEYWORD = 280,
79 VOLATILE_KEYWORD = 281,
80 DOUBLE_KEYWORD = 282,
81 VARIABLE = 283,
82 ASSIGN_MODIFY = 284,
83 ABOVE_COMMA = 285,
84 OROR = 286,
85 ANDAND = 287,
86 NOTEQUAL = 288,
87 EQUAL = 289,
88 GEQ = 290,
89 LEQ = 291,
90 RSH = 292,
91 LSH = 293,
92 DECREMENT = 294,
93 INCREMENT = 295,
94 UNARY = 296,
95 ARROW = 297,
96 BLOCKNAME = 298
98 #endif
99 #define INT 258
100 #define FLOAT 259
101 #define STRING 260
102 #define NSSTRING 261
103 #define SELECTOR 262
104 #define NAME 263
105 #define TYPENAME 264
106 #define CLASSNAME 265
107 #define NAME_OR_INT 266
108 #define STRUCT 267
109 #define CLASS 268
110 #define UNION 269
111 #define ENUM 270
112 #define SIZEOF 271
113 #define UNSIGNED 272
114 #define COLONCOLON 273
115 #define TEMPLATE 274
116 #define ERROR 275
117 #define SIGNED_KEYWORD 276
118 #define LONG 277
119 #define SHORT 278
120 #define INT_KEYWORD 279
121 #define CONST_KEYWORD 280
122 #define VOLATILE_KEYWORD 281
123 #define DOUBLE_KEYWORD 282
124 #define VARIABLE 283
125 #define ASSIGN_MODIFY 284
126 #define ABOVE_COMMA 285
127 #define OROR 286
128 #define ANDAND 287
129 #define NOTEQUAL 288
130 #define EQUAL 289
131 #define GEQ 290
132 #define LEQ 291
133 #define RSH 292
134 #define LSH 293
135 #define DECREMENT 294
136 #define INCREMENT 295
137 #define UNARY 296
138 #define ARROW 297
139 #define BLOCKNAME 298
144 /* Copy the first part of user declarations. */
145 #line 37 "objc-exp.y"
148 #include "defs.h"
149 #include "gdb_string.h"
150 #include <ctype.h>
151 #include "expression.h"
153 #include "objc-lang.h" /* For objc language constructs. */
155 #include "value.h"
156 #include "parser-defs.h"
157 #include "language.h"
158 #include "c-lang.h"
159 #include "bfd.h" /* Required by objfiles.h. */
160 #include "symfile.h" /* Required by objfiles.h. */
161 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols. */
162 #include "top.h"
163 #include "completer.h" /* For skip_quoted(). */
164 #include "block.h"
166 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
167 etc), as well as gratuitiously global symbol names, so we can have
168 multiple yacc generated parsers in gdb. Note that these are only
169 the variables produced by yacc. If other parser generators (bison,
170 byacc, etc) produce additional global names that conflict at link
171 time, then those parser generators need to be fixed instead of
172 adding those names to this list. */
174 #define yymaxdepth objc_maxdepth
175 #define yyparse objc_parse
176 #define yylex objc_lex
177 #define yyerror objc_error
178 #define yylval objc_lval
179 #define yychar objc_char
180 #define yydebug objc_debug
181 #define yypact objc_pact
182 #define yyr1 objc_r1
183 #define yyr2 objc_r2
184 #define yydef objc_def
185 #define yychk objc_chk
186 #define yypgo objc_pgo
187 #define yyact objc_act
188 #define yyexca objc_exca
189 #define yyerrflag objc_errflag
190 #define yynerrs objc_nerrs
191 #define yyps objc_ps
192 #define yypv objc_pv
193 #define yys objc_s
194 #define yy_yys objc_yys
195 #define yystate objc_state
196 #define yytmp objc_tmp
197 #define yyv objc_v
198 #define yy_yyv objc_yyv
199 #define yyval objc_val
200 #define yylloc objc_lloc
201 #define yyreds objc_reds /* With YYDEBUG defined */
202 #define yytoks objc_toks /* With YYDEBUG defined */
203 #define yyname objc_name /* With YYDEBUG defined */
204 #define yyrule objc_rule /* With YYDEBUG defined */
205 #define yylhs objc_yylhs
206 #define yylen objc_yylen
207 #define yydefred objc_yydefred
208 #define yydgoto objc_yydgoto
209 #define yysindex objc_yysindex
210 #define yyrindex objc_yyrindex
211 #define yygindex objc_yygindex
212 #define yytable objc_yytable
213 #define yycheck objc_yycheck
215 #ifndef YYDEBUG
216 #define YYDEBUG 0 /* Default to no yydebug support. */
217 #endif
220 yyparse PARAMS ((void));
222 static int
223 yylex PARAMS ((void));
225 void
226 yyerror PARAMS ((char *));
230 /* Enabling traces. */
231 #ifndef YYDEBUG
232 # define YYDEBUG 0
233 #endif
235 /* Enabling verbose error messages. */
236 #ifdef YYERROR_VERBOSE
237 # undef YYERROR_VERBOSE
238 # define YYERROR_VERBOSE 1
239 #else
240 # define YYERROR_VERBOSE 0
241 #endif
243 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
244 #line 126 "objc-exp.y"
245 typedef union YYSTYPE {
246 LONGEST lval;
247 struct {
248 LONGEST val;
249 struct type *type;
250 } typed_val_int;
251 struct {
252 DOUBLEST dval;
253 struct type *type;
254 } typed_val_float;
255 struct symbol *sym;
256 struct type *tval;
257 struct stoken sval;
258 struct ttype tsym;
259 struct symtoken ssym;
260 int voidval;
261 struct block *bval;
262 enum exp_opcode opcode;
263 struct internalvar *ivar;
264 struct objc_class_str class;
266 struct type **tvec;
267 int *ivec;
268 } YYSTYPE;
269 /* Line 191 of yacc.c. */
270 #line 271 "objc-exp.c.tmp"
271 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
272 # define YYSTYPE_IS_DECLARED 1
273 # define YYSTYPE_IS_TRIVIAL 1
274 #endif
278 /* Copy the second part of user declarations. */
279 #line 151 "objc-exp.y"
281 /* YYSTYPE gets defined by %union. */
282 static int
283 parse_number PARAMS ((char *, int, int, YYSTYPE *));
286 /* Line 214 of yacc.c. */
287 #line 288 "objc-exp.c.tmp"
289 #if ! defined (yyoverflow) || YYERROR_VERBOSE
291 # ifndef YYFREE
292 # define YYFREE free
293 # endif
294 # ifndef YYMALLOC
295 # define YYMALLOC xmalloc
296 # endif
298 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
300 # ifdef YYSTACK_USE_ALLOCA
301 # if YYSTACK_USE_ALLOCA
302 # define YYSTACK_ALLOC alloca
303 # endif
304 # else
305 # if defined (alloca) || defined (_ALLOCA_H)
306 # define YYSTACK_ALLOC alloca
307 # else
308 # ifdef __GNUC__
309 # define YYSTACK_ALLOC __builtin_alloca
310 # endif
311 # endif
312 # endif
314 # ifdef YYSTACK_ALLOC
315 /* Pacify GCC's `empty if-body' warning. */
316 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
317 # else
318 # if defined (__STDC__) || defined (__cplusplus)
319 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
320 # define YYSIZE_T size_t
321 # endif
322 # define YYSTACK_ALLOC YYMALLOC
323 # define YYSTACK_FREE YYFREE
324 # endif
325 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
328 #if (! defined (yyoverflow) \
329 && (! defined (__cplusplus) \
330 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
332 /* A type that is properly aligned for any stack member. */
333 union yyalloc
335 short yyss;
336 YYSTYPE yyvs;
339 /* The size of the maximum gap between one aligned stack and the next. */
340 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
342 /* The size of an array large to enough to hold all stacks, each with
343 N elements. */
344 # define YYSTACK_BYTES(N) \
345 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
346 + YYSTACK_GAP_MAXIMUM)
348 /* Copy COUNT objects from FROM to TO. The source and destination do
349 not overlap. */
350 # ifndef YYCOPY
351 # if defined (__GNUC__) && 1 < __GNUC__
352 # define YYCOPY(To, From, Count) \
353 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
354 # else
355 # define YYCOPY(To, From, Count) \
356 do \
358 register YYSIZE_T yyi; \
359 for (yyi = 0; yyi < (Count); yyi++) \
360 (To)[yyi] = (From)[yyi]; \
362 while (0)
363 # endif
364 # endif
366 /* Relocate STACK from its old location to the new one. The
367 local variables YYSIZE and YYSTACKSIZE give the old and new number of
368 elements in the stack, and YYPTR gives the new location of the
369 stack. Advance YYPTR to a properly aligned location for the next
370 stack. */
371 # define YYSTACK_RELOCATE(Stack) \
372 do \
374 YYSIZE_T yynewbytes; \
375 YYCOPY (&yyptr->Stack, Stack, yysize); \
376 Stack = &yyptr->Stack; \
377 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
378 yyptr += yynewbytes / sizeof (*yyptr); \
380 while (0)
382 #endif
384 #if defined (__STDC__) || defined (__cplusplus)
385 typedef signed char yysigned_char;
386 #else
387 typedef short yysigned_char;
388 #endif
390 /* YYFINAL -- State number of the termination state. */
391 #define YYFINAL 89
392 /* YYLAST -- Last index in YYTABLE. */
393 #define YYLAST 772
395 /* YYNTOKENS -- Number of terminals. */
396 #define YYNTOKENS 68
397 /* YYNNTS -- Number of nonterminals. */
398 #define YYNNTS 29
399 /* YYNRULES -- Number of rules. */
400 #define YYNRULES 147
401 /* YYNRULES -- Number of states. */
402 #define YYNSTATES 239
404 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
405 #define YYUNDEFTOK 2
406 #define YYMAXUTOK 298
408 #define YYTRANSLATE(YYX) \
409 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
411 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
412 static const unsigned char yytranslate[] =
414 0, 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, 61, 2, 2, 2, 52, 38, 2,
418 58, 65, 50, 48, 30, 49, 56, 51, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 64, 2,
420 41, 32, 42, 33, 47, 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, 57, 2, 63, 37, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 66, 36, 67, 62, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
440 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
441 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
442 25, 26, 27, 28, 29, 31, 34, 35, 39, 40,
443 43, 44, 45, 46, 53, 54, 55, 59, 60
446 #if YYDEBUG
447 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
448 YYRHS. */
449 static const unsigned short yyprhs[] =
451 0, 0, 3, 5, 7, 9, 11, 15, 18, 21,
452 24, 27, 30, 33, 36, 39, 42, 45, 49, 53,
453 58, 62, 66, 71, 76, 77, 83, 84, 90, 91,
454 97, 99, 101, 103, 106, 110, 113, 116, 117, 123,
455 125, 126, 128, 132, 134, 138, 143, 148, 152, 156,
456 160, 164, 168, 172, 176, 180, 184, 188, 192, 196,
457 200, 204, 208, 212, 216, 220, 224, 228, 234, 238,
458 242, 244, 246, 248, 250, 252, 254, 259, 261, 263,
459 265, 269, 273, 277, 282, 284, 287, 289, 291, 294,
460 297, 300, 304, 308, 310, 313, 315, 318, 320, 324,
461 327, 329, 332, 334, 337, 341, 344, 348, 350, 354,
462 356, 358, 360, 362, 364, 367, 371, 374, 378, 382,
463 387, 390, 394, 396, 399, 402, 405, 408, 411, 414,
464 416, 419, 421, 427, 430, 433, 435, 437, 439, 441,
465 443, 447, 449, 451, 453, 455, 457, 459
468 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
469 static const yysigned_char yyrhs[] =
471 69, 0, -1, 71, -1, 70, -1, 91, -1, 72,
472 -1, 71, 30, 72, -1, 50, 72, -1, 38, 72,
473 -1, 49, 72, -1, 61, 72, -1, 62, 72, -1,
474 54, 72, -1, 53, 72, -1, 72, 54, -1, 72,
475 53, -1, 16, 72, -1, 72, 59, 95, -1, 72,
476 59, 85, -1, 72, 59, 50, 72, -1, 72, 56,
477 95, -1, 72, 56, 85, -1, 72, 56, 50, 72,
478 -1, 72, 57, 71, 63, -1, -1, 57, 9, 73,
479 76, 63, -1, -1, 57, 10, 74, 76, 63, -1,
480 -1, 57, 72, 75, 76, 63, -1, 95, -1, 77,
481 -1, 78, -1, 77, 78, -1, 95, 64, 72, -1,
482 64, 72, -1, 30, 72, -1, -1, 72, 58, 79,
483 81, 65, -1, 66, -1, -1, 72, -1, 81, 30,
484 72, -1, 67, -1, 80, 81, 82, -1, 80, 91,
485 82, 72, -1, 58, 91, 65, 72, -1, 58, 71,
486 65, -1, 72, 47, 72, -1, 72, 50, 72, -1,
487 72, 51, 72, -1, 72, 52, 72, -1, 72, 48,
488 72, -1, 72, 49, 72, -1, 72, 46, 72, -1,
489 72, 45, 72, -1, 72, 40, 72, -1, 72, 39,
490 72, -1, 72, 44, 72, -1, 72, 43, 72, -1,
491 72, 41, 72, -1, 72, 42, 72, -1, 72, 38,
492 72, -1, 72, 37, 72, -1, 72, 36, 72, -1,
493 72, 35, 72, -1, 72, 34, 72, -1, 72, 33,
494 72, 64, 72, -1, 72, 32, 72, -1, 72, 29,
495 72, -1, 3, -1, 11, -1, 4, -1, 84, -1,
496 28, -1, 7, -1, 16, 58, 91, 65, -1, 5,
497 -1, 6, -1, 60, -1, 83, 18, 95, -1, 83,
498 18, 95, -1, 92, 18, 95, -1, 92, 18, 62,
499 95, -1, 85, -1, 18, 95, -1, 96, -1, 92,
500 -1, 92, 25, -1, 92, 26, -1, 92, 87, -1,
501 92, 25, 87, -1, 92, 26, 87, -1, 50, -1,
502 50, 87, -1, 38, -1, 38, 87, -1, 88, -1,
503 58, 87, 65, -1, 88, 89, -1, 89, -1, 88,
504 90, -1, 90, -1, 57, 63, -1, 57, 3, 63,
505 -1, 58, 65, -1, 58, 94, 65, -1, 86, -1,
506 92, 18, 50, -1, 9, -1, 10, -1, 24, -1,
507 22, -1, 23, -1, 22, 24, -1, 17, 22, 24,
508 -1, 22, 22, -1, 22, 22, 24, -1, 17, 22,
509 22, -1, 17, 22, 22, 24, -1, 23, 24, -1,
510 17, 23, 24, -1, 27, -1, 22, 27, -1, 12,
511 95, -1, 13, 95, -1, 14, 95, -1, 15, 95,
512 -1, 17, 93, -1, 17, -1, 21, 93, -1, 21,
513 -1, 19, 95, 41, 91, 42, -1, 25, 92, -1,
514 26, 92, -1, 9, -1, 24, -1, 22, -1, 23,
515 -1, 91, -1, 94, 30, 91, -1, 8, -1, 60,
516 -1, 9, -1, 10, -1, 11, -1, 8, -1, 60,
520 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
521 static const unsigned short yyrline[] =
523 0, 231, 231, 232, 235, 242, 243, 248, 252, 256,
524 260, 264, 268, 272, 276, 280, 284, 288, 294, 301,
525 305, 312, 320, 324, 333, 332, 354, 353, 369, 368,
526 377, 379, 382, 383, 386, 388, 390, 397, 394, 404,
527 408, 411, 415, 419, 422, 429, 435, 441, 447, 451,
528 455, 459, 463, 467, 471, 475, 479, 483, 487, 491,
529 495, 499, 503, 507, 511, 515, 519, 523, 527, 531,
530 537, 544, 555, 562, 565, 569, 576, 584, 609, 617,
531 634, 645, 661, 674, 699, 700, 734, 793, 799, 800,
532 801, 803, 805, 809, 811, 813, 815, 817, 820, 822,
533 827, 834, 836, 840, 842, 846, 848, 860, 861, 866,
534 868, 876, 878, 880, 882, 884, 886, 888, 890, 892,
535 894, 896, 898, 900, 902, 905, 908, 911, 914, 916,
536 918, 920, 922, 929, 930, 933, 934, 940, 946, 955,
537 960, 967, 968, 969, 970, 971, 974, 975
539 #endif
541 #if YYDEBUG || YYERROR_VERBOSE
542 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
543 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
544 static const char *const yytname[] =
546 "$end", "error", "$undefined", "INT", "FLOAT", "STRING", "NSSTRING",
547 "SELECTOR", "NAME", "TYPENAME", "CLASSNAME", "NAME_OR_INT", "STRUCT",
548 "CLASS", "UNION", "ENUM", "SIZEOF", "UNSIGNED", "COLONCOLON", "TEMPLATE",
549 "ERROR", "SIGNED_KEYWORD", "LONG", "SHORT", "INT_KEYWORD",
550 "CONST_KEYWORD", "VOLATILE_KEYWORD", "DOUBLE_KEYWORD", "VARIABLE",
551 "ASSIGN_MODIFY", "','", "ABOVE_COMMA", "'='", "'?'", "OROR", "ANDAND",
552 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ",
553 "RSH", "LSH", "'@'", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT",
554 "INCREMENT", "UNARY", "'.'", "'['", "'('", "ARROW", "BLOCKNAME", "'!'",
555 "'~'", "']'", "':'", "')'", "'{'", "'}'", "$accept", "start", "type_exp",
556 "exp1", "exp", "@1", "@2", "@3", "msglist", "msgarglist", "msgarg", "@4",
557 "lcurly", "arglist", "rcurly", "block", "variable", "qualified_name",
558 "ptype", "abs_decl", "direct_abs_decl", "array_mod", "func_mod", "type",
559 "typebase", "typename", "nonempty_typelist", "name", "name_not_typename", 0
561 #endif
563 # ifdef YYPRINT
564 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
565 token YYLEX-NUM. */
566 static const unsigned short yytoknum[] =
568 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
569 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
570 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
571 44, 285, 61, 63, 286, 287, 124, 94, 38, 288,
572 289, 60, 62, 290, 291, 292, 293, 64, 43, 45,
573 42, 47, 37, 294, 295, 296, 46, 91, 40, 297,
574 298, 33, 126, 93, 58, 41, 123, 125
576 # endif
578 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
579 static const unsigned char yyr1[] =
581 0, 68, 69, 69, 70, 71, 71, 72, 72, 72,
582 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
583 72, 72, 72, 72, 73, 72, 74, 72, 75, 72,
584 76, 76, 77, 77, 78, 78, 78, 79, 72, 80,
585 81, 81, 81, 82, 72, 72, 72, 72, 72, 72,
586 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
587 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
588 72, 72, 72, 72, 72, 72, 72, 72, 72, 83,
589 83, 84, 85, 85, 84, 84, 84, 86, 86, 86,
590 86, 86, 86, 87, 87, 87, 87, 87, 88, 88,
591 88, 88, 88, 89, 89, 90, 90, 91, 91, 92,
592 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
593 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
594 92, 92, 92, 92, 92, 93, 93, 93, 93, 94,
595 94, 95, 95, 95, 95, 95, 96, 96
598 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
599 static const unsigned char yyr2[] =
601 0, 2, 1, 1, 1, 1, 3, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 3, 3, 4,
603 3, 3, 4, 4, 0, 5, 0, 5, 0, 5,
604 1, 1, 1, 2, 3, 2, 2, 0, 5, 1,
605 0, 1, 3, 1, 3, 4, 4, 3, 3, 3,
606 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
607 3, 3, 3, 3, 3, 3, 3, 5, 3, 3,
608 1, 1, 1, 1, 1, 1, 4, 1, 1, 1,
609 3, 3, 3, 4, 1, 2, 1, 1, 2, 2,
610 2, 3, 3, 1, 2, 1, 2, 1, 3, 2,
611 1, 2, 1, 2, 3, 2, 3, 1, 3, 1,
612 1, 1, 1, 1, 2, 3, 2, 3, 3, 4,
613 2, 3, 1, 2, 2, 2, 2, 2, 2, 1,
614 2, 1, 5, 2, 2, 1, 1, 1, 1, 1,
615 3, 1, 1, 1, 1, 1, 1, 1
618 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
619 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
620 means the default is an error. */
621 static const unsigned char yydefact[] =
623 0, 70, 72, 77, 78, 75, 146, 109, 110, 71,
624 0, 0, 0, 0, 0, 129, 0, 0, 131, 112,
625 113, 111, 0, 0, 122, 74, 0, 0, 0, 0,
626 0, 0, 0, 147, 0, 0, 39, 0, 3, 2,
627 5, 40, 0, 73, 84, 107, 4, 87, 86, 141,
628 143, 144, 145, 142, 124, 125, 126, 127, 0, 16,
629 0, 135, 137, 138, 136, 128, 85, 0, 137, 138,
630 130, 116, 114, 123, 120, 133, 134, 8, 9, 7,
631 13, 12, 24, 26, 28, 0, 0, 10, 11, 1,
632 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
633 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
634 0, 0, 0, 15, 14, 0, 0, 37, 0, 41,
635 0, 0, 0, 0, 88, 89, 95, 93, 0, 0,
636 90, 97, 100, 102, 0, 0, 118, 115, 121, 0,
637 117, 0, 0, 0, 47, 0, 6, 69, 68, 0,
638 66, 65, 64, 63, 62, 57, 56, 60, 61, 59,
639 58, 55, 54, 48, 52, 53, 49, 50, 51, 143,
640 144, 0, 21, 20, 0, 40, 0, 18, 17, 0,
641 43, 44, 0, 81, 108, 0, 82, 91, 92, 96,
642 94, 0, 103, 105, 0, 139, 87, 0, 0, 99,
643 101, 76, 119, 0, 0, 0, 0, 31, 32, 30,
644 0, 0, 46, 0, 22, 23, 0, 19, 42, 45,
645 83, 104, 98, 0, 0, 106, 132, 36, 35, 25,
646 33, 0, 0, 27, 29, 67, 38, 140, 34
649 /* YYDEFGOTO[NTERM-NUM]. */
650 static const short yydefgoto[] =
652 -1, 37, 38, 85, 40, 141, 142, 143, 206, 207,
653 208, 175, 41, 120, 181, 42, 43, 44, 45, 130,
654 131, 132, 133, 195, 60, 65, 197, 209, 48
657 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
658 STATE-NUM. */
659 #define YYPACT_NINF -90
660 static const short yypact[] =
662 223, -90, -90, -90, -90, -90, -90, -90, -90, -90,
663 19, 19, 19, 19, 287, 195, 19, 19, 234, 82,
664 -9, -90, 307, 307, -90, -90, 223, 223, 223, 223,
665 223, 351, 223, 8, 223, 223, -90, 39, -90, 13,
666 542, 223, 32, -90, -90, -90, -90, 149, -90, -90,
667 -90, -90, -90, -90, -90, -90, -90, -90, 223, 212,
668 38, -90, 33, 45, -90, -90, -90, 30, -90, -90,
669 -90, 83, -90, -90, -90, -90, -90, 212, 212, 212,
670 212, 212, 107, 108, 542, -20, 66, 212, 212, -90,
671 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
672 223, 223, 223, 223, 223, 223, 223, 223, 223, 223,
673 223, 223, 223, -90, -90, 436, 223, -90, 480, 542,
674 -21, 65, 19, 202, 70, 70, 70, 70, -1, 132,
675 -90, 54, -90, -90, 68, 43, 110, -90, -90, 307,
676 -90, 113, 113, 113, -90, 223, 542, 542, 542, 509,
677 567, 591, 614, 636, 657, 676, 676, 691, 691, 691,
678 691, 334, 334, 703, 713, 713, 212, 212, 212, 107,
679 108, 223, -90, -90, 4, 223, 223, -90, -90, 223,
680 -90, -90, 223, 118, -90, 19, -90, -90, -90, -90,
681 -90, 74, -90, -90, 73, -90, 158, -17, 51, -90,
682 -90, 415, -90, 106, 223, 223, 87, 113, -90, 88,
683 97, 99, 212, 223, 212, -90, -16, 212, 542, 212,
684 -90, -90, -90, 114, 307, -90, -90, 542, 542, -90,
685 -90, 88, 223, -90, -90, 475, -90, -90, 542
688 /* YYPGOTO[NTERM-NUM]. */
689 static const short yypgoto[] =
691 -90, -90, -90, 3, -10, -90, -90, -90, -28, -90,
692 -44, -90, -90, -7, 50, -90, -90, -71, -90, -89,
693 -90, 47, 48, 1, 0, 163, -90, -5, -90
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 -111
701 static const short yytable[] =
703 47, 46, 191, 39, 59, 54, 55, 56, 57, 179,
704 90, 66, 67, 224, 179, 74, 77, 78, 79, 80,
705 81, 84, 75, 76, 87, 88, -79, 49, 50, 51,
706 52, 119, 47, 86, 90, 187, 188, 189, 190, 89,
707 194, 47, 121, 90, 172, 144, 180, 177, 225, 236,
708 122, 49, 50, 51, 52, 136, 135, 137, 47, 134,
709 7, 8, 192, 10, 11, 12, 13, 215, 15, 138,
710 17, 139, 18, 19, 20, 21, 22, 23, 24, 53,
711 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
712 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
713 166, 167, 168, 53, 71, 185, 72, 140, 126, 73,
714 173, 128, 198, 178, 210, 211, 193, 183, 186, 174,
715 127, 49, 50, 51, 52, -109, -110, 128, 129, 196,
716 186, 145, 180, 201, 202, 212, -80, 221, 222, 196,
717 203, 7, 8, 204, 10, 11, 12, 13, 226, 15,
718 229, 17, 232, 18, 19, 20, 21, 22, 23, 24,
719 233, 214, 234, 230, 184, 119, 217, 123, 216, 218,
720 126, 182, 219, 53, 124, 125, 223, 205, 199, 200,
721 220, 70, 127, 124, 125, 0, 0, 126, 0, 128,
722 129, 212, 0, 0, 227, 228, 126, 193, 196, 127,
723 0, 0, 231, 235, 61, 0, 128, 129, 127, 0,
724 49, 50, 51, 52, 0, 128, 129, 62, 63, 64,
725 0, 0, 238, 0, 196, 237, 1, 2, 3, 4,
726 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
727 15, 16, 17, 61, 18, 19, 20, 21, 22, 23,
728 24, 25, 184, 0, 0, 0, 68, 69, 64, 0,
729 0, 26, 53, 0, 185, 113, 114, 0, 115, 116,
730 117, 118, 27, 28, 0, 0, 29, 30, 0, 0,
731 31, 32, 0, 33, 34, 35, 0, 0, 0, 36,
732 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
733 11, 12, 13, 14, 15, 16, 17, 0, 18, 19,
734 20, 21, 22, 23, 24, 25, 7, 8, 0, 10,
735 11, 12, 13, 0, 15, 26, 17, 0, 18, 19,
736 20, 21, 22, 23, 24, 0, 27, 28, 0, 0,
737 29, 30, 0, 0, 31, 58, 0, 33, 34, 35,
738 0, 0, 0, 36, 1, 2, 3, 4, 5, 6,
739 82, 83, 9, 10, 11, 12, 13, 14, 15, 16,
740 17, 0, 18, 19, 20, 21, 22, 23, 24, 25,
741 0, 107, 108, 109, 110, 111, 112, 113, 114, 26,
742 115, 116, 117, 118, 0, 0, 0, 0, 0, 0,
743 27, 28, 0, 0, 29, 30, 0, 0, 31, 32,
744 0, 33, 34, 35, 0, 0, 0, 36, 1, 2,
745 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
746 13, 14, 15, 16, 17, 0, 18, 19, 20, 21,
747 22, 23, 24, 25, 49, 169, 170, 52, 10, 11,
748 12, 13, 0, 15, 0, 17, 0, 18, 19, 20,
749 21, 22, 23, 24, 0, 0, 0, 0, 29, 30,
750 0, 0, 31, 32, 0, 33, 34, 35, 0, 0,
751 0, 36, 0, 0, 0, 0, 171, 0, 49, 169,
752 170, 52, 10, 11, 12, 13, 53, 15, 0, 17,
753 0, 18, 19, 20, 21, 22, 23, 24, 93, 94,
754 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
755 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
756 176, 115, 116, 117, 118, 0, 0, 0, 91, 0,
757 53, 92, 93, 94, 95, 96, 97, 98, 99, 100,
758 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
759 111, 112, 113, 114, 0, 115, 116, 117, 118, 0,
760 0, 91, 0, 213, 92, 93, 94, 95, 96, 97,
761 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
762 108, 109, 110, 111, 112, 113, 114, 0, 115, 116,
763 117, 118, 95, 96, 97, 98, 99, 100, 101, 102,
764 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
765 113, 114, 0, 115, 116, 117, 118, 96, 97, 98,
766 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
767 109, 110, 111, 112, 113, 114, 0, 115, 116, 117,
768 118, 97, 98, 99, 100, 101, 102, 103, 104, 105,
769 106, 107, 108, 109, 110, 111, 112, 113, 114, 0,
770 115, 116, 117, 118, 98, 99, 100, 101, 102, 103,
771 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
772 114, 0, 115, 116, 117, 118, 99, 100, 101, 102,
773 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
774 113, 114, 0, 115, 116, 117, 118, 101, 102, 103,
775 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
776 114, 0, 115, 116, 117, 118, 105, 106, 107, 108,
777 109, 110, 111, 112, 113, 114, 0, 115, 116, 117,
778 118, 108, 109, 110, 111, 112, 113, 114, 0, 115,
779 116, 117, 118, 110, 111, 112, 113, 114, 0, 115,
780 116, 117, 118
783 static const short yycheck[] =
785 0, 0, 3, 0, 14, 10, 11, 12, 13, 30,
786 30, 16, 17, 30, 30, 24, 26, 27, 28, 29,
787 30, 31, 22, 23, 34, 35, 18, 8, 9, 10,
788 11, 41, 32, 32, 30, 124, 125, 126, 127, 0,
789 129, 41, 41, 30, 115, 65, 67, 118, 65, 65,
790 18, 8, 9, 10, 11, 22, 18, 24, 58, 58,
791 9, 10, 63, 12, 13, 14, 15, 63, 17, 24,
792 19, 41, 21, 22, 23, 24, 25, 26, 27, 60,
793 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
794 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
795 110, 111, 112, 60, 22, 62, 24, 24, 38, 27,
796 115, 57, 58, 118, 142, 143, 65, 122, 123, 116,
797 50, 8, 9, 10, 11, 18, 18, 57, 58, 129,
798 135, 65, 67, 65, 24, 145, 18, 63, 65, 139,
799 139, 9, 10, 30, 12, 13, 14, 15, 42, 17,
800 63, 19, 64, 21, 22, 23, 24, 25, 26, 27,
801 63, 171, 63, 207, 50, 175, 176, 18, 175, 179,
802 38, 121, 182, 60, 25, 26, 18, 64, 131, 131,
803 185, 18, 50, 25, 26, -1, -1, 38, -1, 57,
804 58, 201, -1, -1, 204, 205, 38, 65, 198, 50,
805 -1, -1, 207, 213, 9, -1, 57, 58, 50, -1,
806 8, 9, 10, 11, -1, 57, 58, 22, 23, 24,
807 -1, -1, 232, -1, 224, 224, 3, 4, 5, 6,
808 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
809 17, 18, 19, 9, 21, 22, 23, 24, 25, 26,
810 27, 28, 50, -1, -1, -1, 22, 23, 24, -1,
811 -1, 38, 60, -1, 62, 53, 54, -1, 56, 57,
812 58, 59, 49, 50, -1, -1, 53, 54, -1, -1,
813 57, 58, -1, 60, 61, 62, -1, -1, -1, 66,
814 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
815 13, 14, 15, 16, 17, 18, 19, -1, 21, 22,
816 23, 24, 25, 26, 27, 28, 9, 10, -1, 12,
817 13, 14, 15, -1, 17, 38, 19, -1, 21, 22,
818 23, 24, 25, 26, 27, -1, 49, 50, -1, -1,
819 53, 54, -1, -1, 57, 58, -1, 60, 61, 62,
820 -1, -1, -1, 66, 3, 4, 5, 6, 7, 8,
821 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
822 19, -1, 21, 22, 23, 24, 25, 26, 27, 28,
823 -1, 47, 48, 49, 50, 51, 52, 53, 54, 38,
824 56, 57, 58, 59, -1, -1, -1, -1, -1, -1,
825 49, 50, -1, -1, 53, 54, -1, -1, 57, 58,
826 -1, 60, 61, 62, -1, -1, -1, 66, 3, 4,
827 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
828 15, 16, 17, 18, 19, -1, 21, 22, 23, 24,
829 25, 26, 27, 28, 8, 9, 10, 11, 12, 13,
830 14, 15, -1, 17, -1, 19, -1, 21, 22, 23,
831 24, 25, 26, 27, -1, -1, -1, -1, 53, 54,
832 -1, -1, 57, 58, -1, 60, 61, 62, -1, -1,
833 -1, 66, -1, -1, -1, -1, 50, -1, 8, 9,
834 10, 11, 12, 13, 14, 15, 60, 17, -1, 19,
835 -1, 21, 22, 23, 24, 25, 26, 27, 33, 34,
836 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
837 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
838 50, 56, 57, 58, 59, -1, -1, -1, 29, -1,
839 60, 32, 33, 34, 35, 36, 37, 38, 39, 40,
840 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
841 51, 52, 53, 54, -1, 56, 57, 58, 59, -1,
842 -1, 29, -1, 64, 32, 33, 34, 35, 36, 37,
843 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
844 48, 49, 50, 51, 52, 53, 54, -1, 56, 57,
845 58, 59, 35, 36, 37, 38, 39, 40, 41, 42,
846 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
847 53, 54, -1, 56, 57, 58, 59, 36, 37, 38,
848 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
849 49, 50, 51, 52, 53, 54, -1, 56, 57, 58,
850 59, 37, 38, 39, 40, 41, 42, 43, 44, 45,
851 46, 47, 48, 49, 50, 51, 52, 53, 54, -1,
852 56, 57, 58, 59, 38, 39, 40, 41, 42, 43,
853 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
854 54, -1, 56, 57, 58, 59, 39, 40, 41, 42,
855 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
856 53, 54, -1, 56, 57, 58, 59, 41, 42, 43,
857 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
858 54, -1, 56, 57, 58, 59, 45, 46, 47, 48,
859 49, 50, 51, 52, 53, 54, -1, 56, 57, 58,
860 59, 48, 49, 50, 51, 52, 53, 54, -1, 56,
861 57, 58, 59, 50, 51, 52, 53, 54, -1, 56,
862 57, 58, 59
865 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
866 symbol of state STATE-NUM. */
867 static const unsigned char yystos[] =
869 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
870 12, 13, 14, 15, 16, 17, 18, 19, 21, 22,
871 23, 24, 25, 26, 27, 28, 38, 49, 50, 53,
872 54, 57, 58, 60, 61, 62, 66, 69, 70, 71,
873 72, 80, 83, 84, 85, 86, 91, 92, 96, 8,
874 9, 10, 11, 60, 95, 95, 95, 95, 58, 72,
875 92, 9, 22, 23, 24, 93, 95, 95, 22, 23,
876 93, 22, 24, 27, 24, 92, 92, 72, 72, 72,
877 72, 72, 9, 10, 72, 71, 91, 72, 72, 0,
878 30, 29, 32, 33, 34, 35, 36, 37, 38, 39,
879 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
880 50, 51, 52, 53, 54, 56, 57, 58, 59, 72,
881 81, 91, 18, 18, 25, 26, 38, 50, 57, 58,
882 87, 88, 89, 90, 91, 18, 22, 24, 24, 41,
883 24, 73, 74, 75, 65, 65, 72, 72, 72, 72,
884 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
885 72, 72, 72, 72, 72, 72, 72, 72, 72, 9,
886 10, 50, 85, 95, 71, 79, 50, 85, 95, 30,
887 67, 82, 82, 95, 50, 62, 95, 87, 87, 87,
888 87, 3, 63, 65, 87, 91, 92, 94, 58, 89,
889 90, 65, 24, 91, 30, 64, 76, 77, 78, 95,
890 76, 76, 72, 64, 72, 63, 81, 72, 72, 72,
891 95, 63, 65, 18, 30, 65, 42, 72, 72, 63,
892 78, 95, 64, 63, 63, 72, 65, 91, 72
895 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
896 # define YYSIZE_T __SIZE_TYPE__
897 #endif
898 #if ! defined (YYSIZE_T) && defined (size_t)
899 # define YYSIZE_T size_t
900 #endif
901 #if ! defined (YYSIZE_T)
902 # if defined (__STDC__) || defined (__cplusplus)
903 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
904 # define YYSIZE_T size_t
905 # endif
906 #endif
907 #if ! defined (YYSIZE_T)
908 # define YYSIZE_T unsigned int
909 #endif
911 #define yyerrok (yyerrstatus = 0)
912 #define yyclearin (yychar = YYEMPTY)
913 #define YYEMPTY (-2)
914 #define YYEOF 0
916 #define YYACCEPT goto yyacceptlab
917 #define YYABORT goto yyabortlab
918 #define YYERROR goto yyerrorlab
921 /* Like YYERROR except do call yyerror. This remains here temporarily
922 to ease the transition to the new meaning of YYERROR, for GCC.
923 Once GCC version 2 has supplanted version 1, this can go. */
925 #define YYFAIL goto yyerrlab
927 #define YYRECOVERING() (!!yyerrstatus)
929 #define YYBACKUP(Token, Value) \
930 do \
931 if (yychar == YYEMPTY && yylen == 1) \
933 yychar = (Token); \
934 yylval = (Value); \
935 yytoken = YYTRANSLATE (yychar); \
936 YYPOPSTACK; \
937 goto yybackup; \
939 else \
941 yyerror ("syntax error: cannot back up");\
942 YYERROR; \
944 while (0)
946 #define YYTERROR 1
947 #define YYERRCODE 256
949 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
950 are run). */
952 #ifndef YYLLOC_DEFAULT
953 # define YYLLOC_DEFAULT(Current, Rhs, N) \
954 ((Current).first_line = (Rhs)[1].first_line, \
955 (Current).first_column = (Rhs)[1].first_column, \
956 (Current).last_line = (Rhs)[N].last_line, \
957 (Current).last_column = (Rhs)[N].last_column)
958 #endif
960 /* YYLEX -- calling `yylex' with the right arguments. */
962 #ifdef YYLEX_PARAM
963 # define YYLEX yylex (YYLEX_PARAM)
964 #else
965 # define YYLEX yylex ()
966 #endif
968 /* Enable debugging if requested. */
969 #if YYDEBUG
971 # ifndef YYFPRINTF
972 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
973 # define YYFPRINTF fprintf
974 # endif
976 # define YYDPRINTF(Args) \
977 do { \
978 if (yydebug) \
979 YYFPRINTF Args; \
980 } while (0)
982 # define YYDSYMPRINT(Args) \
983 do { \
984 if (yydebug) \
985 yysymprint Args; \
986 } while (0)
988 # define YYDSYMPRINTF(Title, Token, Value, Location) \
989 do { \
990 if (yydebug) \
992 YYFPRINTF (stderr, "%s ", Title); \
993 yysymprint (stderr, \
994 Token, Value); \
995 YYFPRINTF (stderr, "\n"); \
997 } while (0)
999 /*------------------------------------------------------------------.
1000 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1001 | TOP (included). |
1002 `------------------------------------------------------------------*/
1004 #if defined (__STDC__) || defined (__cplusplus)
1005 static void
1006 yy_stack_print (short *bottom, short *top)
1007 #else
1008 static void
1009 yy_stack_print (bottom, top)
1010 short *bottom;
1011 short *top;
1012 #endif
1014 YYFPRINTF (stderr, "Stack now");
1015 for (/* Nothing. */; bottom <= top; ++bottom)
1016 YYFPRINTF (stderr, " %d", *bottom);
1017 YYFPRINTF (stderr, "\n");
1020 # define YY_STACK_PRINT(Bottom, Top) \
1021 do { \
1022 if (yydebug) \
1023 yy_stack_print ((Bottom), (Top)); \
1024 } while (0)
1027 /*------------------------------------------------.
1028 | Report that the YYRULE is going to be reduced. |
1029 `------------------------------------------------*/
1031 #if defined (__STDC__) || defined (__cplusplus)
1032 static void
1033 yy_reduce_print (int yyrule)
1034 #else
1035 static void
1036 yy_reduce_print (yyrule)
1037 int yyrule;
1038 #endif
1040 int yyi;
1041 unsigned int yylno = yyrline[yyrule];
1042 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1043 yyrule - 1, yylno);
1044 /* Print the symbols being reduced, and their result. */
1045 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1046 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1047 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1050 # define YY_REDUCE_PRINT(Rule) \
1051 do { \
1052 if (yydebug) \
1053 yy_reduce_print (Rule); \
1054 } while (0)
1056 /* Nonzero means print parse trace. It is left uninitialized so that
1057 multiple parsers can coexist. */
1058 int yydebug;
1059 #else /* !YYDEBUG */
1060 # define YYDPRINTF(Args)
1061 # define YYDSYMPRINT(Args)
1062 # define YYDSYMPRINTF(Title, Token, Value, Location)
1063 # define YY_STACK_PRINT(Bottom, Top)
1064 # define YY_REDUCE_PRINT(Rule)
1065 #endif /* !YYDEBUG */
1068 /* YYINITDEPTH -- initial size of the parser's stacks. */
1069 #ifndef YYINITDEPTH
1070 # define YYINITDEPTH 200
1071 #endif
1073 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1074 if the built-in stack extension method is used).
1076 Do not make this value too large; the results are undefined if
1077 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1078 evaluated with infinite-precision integer arithmetic. */
1080 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1081 # undef YYMAXDEPTH
1082 #endif
1084 #ifndef YYMAXDEPTH
1085 # define YYMAXDEPTH 10000
1086 #endif
1090 #if YYERROR_VERBOSE
1092 # ifndef yystrlen
1093 # if defined (__GLIBC__) && defined (_STRING_H)
1094 # define yystrlen strlen
1095 # else
1096 /* Return the length of YYSTR. */
1097 static YYSIZE_T
1098 # if defined (__STDC__) || defined (__cplusplus)
1099 yystrlen (const char *yystr)
1100 # else
1101 yystrlen (yystr)
1102 const char *yystr;
1103 # endif
1105 register const char *yys = yystr;
1107 while (*yys++ != '\0')
1108 continue;
1110 return yys - yystr - 1;
1112 # endif
1113 # endif
1115 # ifndef yystpcpy
1116 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1117 # define yystpcpy stpcpy
1118 # else
1119 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1120 YYDEST. */
1121 static char *
1122 # if defined (__STDC__) || defined (__cplusplus)
1123 yystpcpy (char *yydest, const char *yysrc)
1124 # else
1125 yystpcpy (yydest, yysrc)
1126 char *yydest;
1127 const char *yysrc;
1128 # endif
1130 register char *yyd = yydest;
1131 register const char *yys = yysrc;
1133 while ((*yyd++ = *yys++) != '\0')
1134 continue;
1136 return yyd - 1;
1138 # endif
1139 # endif
1141 #endif /* !YYERROR_VERBOSE */
1145 #if YYDEBUG
1146 /*--------------------------------.
1147 | Print this symbol on YYOUTPUT. |
1148 `--------------------------------*/
1150 #if defined (__STDC__) || defined (__cplusplus)
1151 static void
1152 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1153 #else
1154 static void
1155 yysymprint (yyoutput, yytype, yyvaluep)
1156 FILE *yyoutput;
1157 int yytype;
1158 YYSTYPE *yyvaluep;
1159 #endif
1161 /* Pacify ``unused variable'' warnings. */
1162 (void) yyvaluep;
1164 if (yytype < YYNTOKENS)
1166 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1167 # ifdef YYPRINT
1168 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1169 # endif
1171 else
1172 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1174 switch (yytype)
1176 default:
1177 break;
1179 YYFPRINTF (yyoutput, ")");
1182 #endif /* ! YYDEBUG */
1183 /*-----------------------------------------------.
1184 | Release the memory associated to this symbol. |
1185 `-----------------------------------------------*/
1187 #if defined (__STDC__) || defined (__cplusplus)
1188 static void
1189 yydestruct (int yytype, YYSTYPE *yyvaluep)
1190 #else
1191 static void
1192 yydestruct (yytype, yyvaluep)
1193 int yytype;
1194 YYSTYPE *yyvaluep;
1195 #endif
1197 /* Pacify ``unused variable'' warnings. */
1198 (void) yyvaluep;
1200 switch (yytype)
1203 default:
1204 break;
1209 /* Prevent warnings from -Wmissing-prototypes. */
1211 #ifdef YYPARSE_PARAM
1212 # if defined (__STDC__) || defined (__cplusplus)
1213 int yyparse (void *YYPARSE_PARAM);
1214 # else
1215 int yyparse ();
1216 # endif
1217 #else /* ! YYPARSE_PARAM */
1218 #if defined (__STDC__) || defined (__cplusplus)
1219 int yyparse (void);
1220 #else
1221 int yyparse ();
1222 #endif
1223 #endif /* ! YYPARSE_PARAM */
1227 /* The lookahead symbol. */
1228 int yychar;
1230 /* The semantic value of the lookahead symbol. */
1231 YYSTYPE yylval;
1233 /* Number of syntax errors so far. */
1234 int yynerrs;
1238 /*----------.
1239 | yyparse. |
1240 `----------*/
1242 #ifdef YYPARSE_PARAM
1243 # if defined (__STDC__) || defined (__cplusplus)
1244 int yyparse (void *YYPARSE_PARAM)
1245 # else
1246 int yyparse (YYPARSE_PARAM)
1247 void *YYPARSE_PARAM;
1248 # endif
1249 #else /* ! YYPARSE_PARAM */
1250 #if defined (__STDC__) || defined (__cplusplus)
1252 yyparse (void)
1253 #else
1255 yyparse ()
1257 #endif
1258 #endif
1261 register int yystate;
1262 register int yyn;
1263 int yyresult;
1264 /* Number of tokens to shift before error messages enabled. */
1265 int yyerrstatus;
1266 /* Lookahead token as an internal (translated) token number. */
1267 int yytoken = 0;
1269 /* Three stacks and their tools:
1270 `yyss': related to states,
1271 `yyvs': related to semantic values,
1272 `yyls': related to locations.
1274 Refer to the stacks thru separate pointers, to allow yyoverflow
1275 to xreallocate them elsewhere. */
1277 /* The state stack. */
1278 short yyssa[YYINITDEPTH];
1279 short *yyss = yyssa;
1280 register short *yyssp;
1282 /* The semantic value stack. */
1283 YYSTYPE yyvsa[YYINITDEPTH];
1284 YYSTYPE *yyvs = yyvsa;
1285 register YYSTYPE *yyvsp;
1289 #define YYPOPSTACK (yyvsp--, yyssp--)
1291 YYSIZE_T yystacksize = YYINITDEPTH;
1293 /* The variables used to return semantic value and location from the
1294 action routines. */
1295 YYSTYPE yyval;
1298 /* When reducing, the number of symbols on the RHS of the reduced
1299 rule. */
1300 int yylen;
1302 YYDPRINTF ((stderr, "Starting parse\n"));
1304 yystate = 0;
1305 yyerrstatus = 0;
1306 yynerrs = 0;
1307 yychar = YYEMPTY; /* Cause a token to be read. */
1309 /* Initialize stack pointers.
1310 Waste one element of value and location stack
1311 so that they stay on the same level as the state stack.
1312 The wasted elements are never initialized. */
1314 yyssp = yyss;
1315 yyvsp = yyvs;
1317 goto yysetstate;
1319 /*------------------------------------------------------------.
1320 | yynewstate -- Push a new state, which is found in yystate. |
1321 `------------------------------------------------------------*/
1322 yynewstate:
1323 /* In all cases, when you get here, the value and location stacks
1324 have just been pushed. so pushing a state here evens the stacks.
1326 yyssp++;
1328 yysetstate:
1329 *yyssp = yystate;
1331 if (yyss + yystacksize - 1 <= yyssp)
1333 /* Get the current used size of the three stacks, in elements. */
1334 YYSIZE_T yysize = yyssp - yyss + 1;
1336 #ifdef yyoverflow
1338 /* Give user a chance to xreallocate the stack. Use copies of
1339 these so that the &'s don't force the real ones into
1340 memory. */
1341 YYSTYPE *yyvs1 = yyvs;
1342 short *yyss1 = yyss;
1345 /* Each stack pointer address is followed by the size of the
1346 data in use in that stack, in bytes. This used to be a
1347 conditional around just the two extra args, but that might
1348 be undefined if yyoverflow is a macro. */
1349 yyoverflow ("parser stack overflow",
1350 &yyss1, yysize * sizeof (*yyssp),
1351 &yyvs1, yysize * sizeof (*yyvsp),
1353 &yystacksize);
1355 yyss = yyss1;
1356 yyvs = yyvs1;
1358 #else /* no yyoverflow */
1359 # ifndef YYSTACK_RELOCATE
1360 goto yyoverflowlab;
1361 # else
1362 /* Extend the stack our own way. */
1363 if (YYMAXDEPTH <= yystacksize)
1364 goto yyoverflowlab;
1365 yystacksize *= 2;
1366 if (YYMAXDEPTH < yystacksize)
1367 yystacksize = YYMAXDEPTH;
1370 short *yyss1 = yyss;
1371 union yyalloc *yyptr =
1372 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1373 if (! yyptr)
1374 goto yyoverflowlab;
1375 YYSTACK_RELOCATE (yyss);
1376 YYSTACK_RELOCATE (yyvs);
1378 # undef YYSTACK_RELOCATE
1379 if (yyss1 != yyssa)
1380 YYSTACK_FREE (yyss1);
1382 # endif
1383 #endif /* no yyoverflow */
1385 yyssp = yyss + yysize - 1;
1386 yyvsp = yyvs + yysize - 1;
1389 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1390 (unsigned long int) yystacksize));
1392 if (yyss + yystacksize - 1 <= yyssp)
1393 YYABORT;
1396 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1398 goto yybackup;
1400 /*-----------.
1401 | yybackup. |
1402 `-----------*/
1403 yybackup:
1405 /* Do appropriate processing given the current state. */
1406 /* Read a lookahead token if we need one and don't already have one. */
1407 /* yyresume: */
1409 /* First try to decide what to do without reference to lookahead token. */
1411 yyn = yypact[yystate];
1412 if (yyn == YYPACT_NINF)
1413 goto yydefault;
1415 /* Not known => get a lookahead token if don't already have one. */
1417 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1418 if (yychar == YYEMPTY)
1420 YYDPRINTF ((stderr, "Reading a token: "));
1421 yychar = YYLEX;
1424 if (yychar <= YYEOF)
1426 yychar = yytoken = YYEOF;
1427 YYDPRINTF ((stderr, "Now at end of input.\n"));
1429 else
1431 yytoken = YYTRANSLATE (yychar);
1432 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1435 /* If the proper action on seeing token YYTOKEN is to reduce or to
1436 detect an error, take that action. */
1437 yyn += yytoken;
1438 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1439 goto yydefault;
1440 yyn = yytable[yyn];
1441 if (yyn <= 0)
1443 if (yyn == 0 || yyn == YYTABLE_NINF)
1444 goto yyerrlab;
1445 yyn = -yyn;
1446 goto yyreduce;
1449 if (yyn == YYFINAL)
1450 YYACCEPT;
1452 /* Shift the lookahead token. */
1453 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1455 /* Discard the token being shifted unless it is eof. */
1456 if (yychar != YYEOF)
1457 yychar = YYEMPTY;
1459 *++yyvsp = yylval;
1462 /* Count tokens shifted since error; after three, turn off error
1463 status. */
1464 if (yyerrstatus)
1465 yyerrstatus--;
1467 yystate = yyn;
1468 goto yynewstate;
1471 /*-----------------------------------------------------------.
1472 | yydefault -- do the default action for the current state. |
1473 `-----------------------------------------------------------*/
1474 yydefault:
1475 yyn = yydefact[yystate];
1476 if (yyn == 0)
1477 goto yyerrlab;
1478 goto yyreduce;
1481 /*-----------------------------.
1482 | yyreduce -- Do a reduction. |
1483 `-----------------------------*/
1484 yyreduce:
1485 /* yyn is the number of a rule to reduce with. */
1486 yylen = yyr2[yyn];
1488 /* If YYLEN is nonzero, implement the default value of the action:
1489 `$$ = $1'.
1491 Otherwise, the following line sets YYVAL to garbage.
1492 This behavior is undocumented and Bison
1493 users should not rely upon it. Assigning to YYVAL
1494 unconditionally makes the parser a bit smaller, and it avoids a
1495 GCC warning that YYVAL may be used uninitialized. */
1496 yyval = yyvsp[1-yylen];
1499 YY_REDUCE_PRINT (yyn);
1500 switch (yyn)
1502 case 4:
1503 #line 236 "objc-exp.y"
1504 { write_exp_elt_opcode(OP_TYPE);
1505 write_exp_elt_type(yyvsp[0].tval);
1506 write_exp_elt_opcode(OP_TYPE);}
1507 break;
1509 case 6:
1510 #line 244 "objc-exp.y"
1511 { write_exp_elt_opcode (BINOP_COMMA); }
1512 break;
1514 case 7:
1515 #line 249 "objc-exp.y"
1516 { write_exp_elt_opcode (UNOP_IND); }
1517 break;
1519 case 8:
1520 #line 253 "objc-exp.y"
1521 { write_exp_elt_opcode (UNOP_ADDR); }
1522 break;
1524 case 9:
1525 #line 257 "objc-exp.y"
1526 { write_exp_elt_opcode (UNOP_NEG); }
1527 break;
1529 case 10:
1530 #line 261 "objc-exp.y"
1531 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1532 break;
1534 case 11:
1535 #line 265 "objc-exp.y"
1536 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1537 break;
1539 case 12:
1540 #line 269 "objc-exp.y"
1541 { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1542 break;
1544 case 13:
1545 #line 273 "objc-exp.y"
1546 { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1547 break;
1549 case 14:
1550 #line 277 "objc-exp.y"
1551 { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1552 break;
1554 case 15:
1555 #line 281 "objc-exp.y"
1556 { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1557 break;
1559 case 16:
1560 #line 285 "objc-exp.y"
1561 { write_exp_elt_opcode (UNOP_SIZEOF); }
1562 break;
1564 case 17:
1565 #line 289 "objc-exp.y"
1566 { write_exp_elt_opcode (STRUCTOP_PTR);
1567 write_exp_string (yyvsp[0].sval);
1568 write_exp_elt_opcode (STRUCTOP_PTR); }
1569 break;
1571 case 18:
1572 #line 295 "objc-exp.y"
1573 { /* exp->type::name becomes exp->*(&type::name) */
1574 /* Note: this doesn't work if name is a
1575 static member! FIXME */
1576 write_exp_elt_opcode (UNOP_ADDR);
1577 write_exp_elt_opcode (STRUCTOP_MPTR); }
1578 break;
1580 case 19:
1581 #line 302 "objc-exp.y"
1582 { write_exp_elt_opcode (STRUCTOP_MPTR); }
1583 break;
1585 case 20:
1586 #line 306 "objc-exp.y"
1587 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1588 write_exp_string (yyvsp[0].sval);
1589 write_exp_elt_opcode (STRUCTOP_STRUCT); }
1590 break;
1592 case 21:
1593 #line 313 "objc-exp.y"
1594 { /* exp.type::name becomes exp.*(&type::name) */
1595 /* Note: this doesn't work if name is a
1596 static member! FIXME */
1597 write_exp_elt_opcode (UNOP_ADDR);
1598 write_exp_elt_opcode (STRUCTOP_MEMBER); }
1599 break;
1601 case 22:
1602 #line 321 "objc-exp.y"
1603 { write_exp_elt_opcode (STRUCTOP_MEMBER); }
1604 break;
1606 case 23:
1607 #line 325 "objc-exp.y"
1608 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1609 break;
1611 case 24:
1612 #line 333 "objc-exp.y"
1614 CORE_ADDR class;
1616 class = lookup_objc_class (copy_name (yyvsp[0].tsym.stoken));
1617 if (class == 0)
1618 error ("%s is not an ObjC Class",
1619 copy_name (yyvsp[0].tsym.stoken));
1620 write_exp_elt_opcode (OP_LONG);
1621 write_exp_elt_type (builtin_type_int);
1622 write_exp_elt_longcst ((LONGEST) class);
1623 write_exp_elt_opcode (OP_LONG);
1624 start_msglist();
1626 break;
1628 case 25:
1629 #line 347 "objc-exp.y"
1630 { write_exp_elt_opcode (OP_OBJC_MSGCALL);
1631 end_msglist();
1632 write_exp_elt_opcode (OP_OBJC_MSGCALL);
1634 break;
1636 case 26:
1637 #line 354 "objc-exp.y"
1639 write_exp_elt_opcode (OP_LONG);
1640 write_exp_elt_type (builtin_type_int);
1641 write_exp_elt_longcst ((LONGEST) yyvsp[0].class.class);
1642 write_exp_elt_opcode (OP_LONG);
1643 start_msglist();
1645 break;
1647 case 27:
1648 #line 362 "objc-exp.y"
1649 { write_exp_elt_opcode (OP_OBJC_MSGCALL);
1650 end_msglist();
1651 write_exp_elt_opcode (OP_OBJC_MSGCALL);
1653 break;
1655 case 28:
1656 #line 369 "objc-exp.y"
1657 { start_msglist(); }
1658 break;
1660 case 29:
1661 #line 371 "objc-exp.y"
1662 { write_exp_elt_opcode (OP_OBJC_MSGCALL);
1663 end_msglist();
1664 write_exp_elt_opcode (OP_OBJC_MSGCALL);
1666 break;
1668 case 30:
1669 #line 378 "objc-exp.y"
1670 { add_msglist(&yyvsp[0].sval, 0); }
1671 break;
1673 case 34:
1674 #line 387 "objc-exp.y"
1675 { add_msglist(&yyvsp[-2].sval, 1); }
1676 break;
1678 case 35:
1679 #line 389 "objc-exp.y"
1680 { add_msglist(0, 1); }
1681 break;
1683 case 36:
1684 #line 391 "objc-exp.y"
1685 { add_msglist(0, 0); }
1686 break;
1688 case 37:
1689 #line 397 "objc-exp.y"
1690 { start_arglist (); }
1691 break;
1693 case 38:
1694 #line 399 "objc-exp.y"
1695 { write_exp_elt_opcode (OP_FUNCALL);
1696 write_exp_elt_longcst ((LONGEST) end_arglist ());
1697 write_exp_elt_opcode (OP_FUNCALL); }
1698 break;
1700 case 39:
1701 #line 405 "objc-exp.y"
1702 { start_arglist (); }
1703 break;
1705 case 41:
1706 #line 412 "objc-exp.y"
1707 { arglist_len = 1; }
1708 break;
1710 case 42:
1711 #line 416 "objc-exp.y"
1712 { arglist_len++; }
1713 break;
1715 case 43:
1716 #line 420 "objc-exp.y"
1717 { yyval.lval = end_arglist () - 1; }
1718 break;
1720 case 44:
1721 #line 423 "objc-exp.y"
1722 { write_exp_elt_opcode (OP_ARRAY);
1723 write_exp_elt_longcst ((LONGEST) 0);
1724 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1725 write_exp_elt_opcode (OP_ARRAY); }
1726 break;
1728 case 45:
1729 #line 430 "objc-exp.y"
1730 { write_exp_elt_opcode (UNOP_MEMVAL);
1731 write_exp_elt_type (yyvsp[-2].tval);
1732 write_exp_elt_opcode (UNOP_MEMVAL); }
1733 break;
1735 case 46:
1736 #line 436 "objc-exp.y"
1737 { write_exp_elt_opcode (UNOP_CAST);
1738 write_exp_elt_type (yyvsp[-2].tval);
1739 write_exp_elt_opcode (UNOP_CAST); }
1740 break;
1742 case 47:
1743 #line 442 "objc-exp.y"
1745 break;
1747 case 48:
1748 #line 448 "objc-exp.y"
1749 { write_exp_elt_opcode (BINOP_REPEAT); }
1750 break;
1752 case 49:
1753 #line 452 "objc-exp.y"
1754 { write_exp_elt_opcode (BINOP_MUL); }
1755 break;
1757 case 50:
1758 #line 456 "objc-exp.y"
1759 { write_exp_elt_opcode (BINOP_DIV); }
1760 break;
1762 case 51:
1763 #line 460 "objc-exp.y"
1764 { write_exp_elt_opcode (BINOP_REM); }
1765 break;
1767 case 52:
1768 #line 464 "objc-exp.y"
1769 { write_exp_elt_opcode (BINOP_ADD); }
1770 break;
1772 case 53:
1773 #line 468 "objc-exp.y"
1774 { write_exp_elt_opcode (BINOP_SUB); }
1775 break;
1777 case 54:
1778 #line 472 "objc-exp.y"
1779 { write_exp_elt_opcode (BINOP_LSH); }
1780 break;
1782 case 55:
1783 #line 476 "objc-exp.y"
1784 { write_exp_elt_opcode (BINOP_RSH); }
1785 break;
1787 case 56:
1788 #line 480 "objc-exp.y"
1789 { write_exp_elt_opcode (BINOP_EQUAL); }
1790 break;
1792 case 57:
1793 #line 484 "objc-exp.y"
1794 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1795 break;
1797 case 58:
1798 #line 488 "objc-exp.y"
1799 { write_exp_elt_opcode (BINOP_LEQ); }
1800 break;
1802 case 59:
1803 #line 492 "objc-exp.y"
1804 { write_exp_elt_opcode (BINOP_GEQ); }
1805 break;
1807 case 60:
1808 #line 496 "objc-exp.y"
1809 { write_exp_elt_opcode (BINOP_LESS); }
1810 break;
1812 case 61:
1813 #line 500 "objc-exp.y"
1814 { write_exp_elt_opcode (BINOP_GTR); }
1815 break;
1817 case 62:
1818 #line 504 "objc-exp.y"
1819 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1820 break;
1822 case 63:
1823 #line 508 "objc-exp.y"
1824 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1825 break;
1827 case 64:
1828 #line 512 "objc-exp.y"
1829 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1830 break;
1832 case 65:
1833 #line 516 "objc-exp.y"
1834 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1835 break;
1837 case 66:
1838 #line 520 "objc-exp.y"
1839 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1840 break;
1842 case 67:
1843 #line 524 "objc-exp.y"
1844 { write_exp_elt_opcode (TERNOP_COND); }
1845 break;
1847 case 68:
1848 #line 528 "objc-exp.y"
1849 { write_exp_elt_opcode (BINOP_ASSIGN); }
1850 break;
1852 case 69:
1853 #line 532 "objc-exp.y"
1854 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1855 write_exp_elt_opcode (yyvsp[-1].opcode);
1856 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1857 break;
1859 case 70:
1860 #line 538 "objc-exp.y"
1861 { write_exp_elt_opcode (OP_LONG);
1862 write_exp_elt_type (yyvsp[0].typed_val_int.type);
1863 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1864 write_exp_elt_opcode (OP_LONG); }
1865 break;
1867 case 71:
1868 #line 545 "objc-exp.y"
1869 { YYSTYPE val;
1870 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1871 write_exp_elt_opcode (OP_LONG);
1872 write_exp_elt_type (val.typed_val_int.type);
1873 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1874 write_exp_elt_opcode (OP_LONG);
1876 break;
1878 case 72:
1879 #line 556 "objc-exp.y"
1880 { write_exp_elt_opcode (OP_DOUBLE);
1881 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1882 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1883 write_exp_elt_opcode (OP_DOUBLE); }
1884 break;
1886 case 75:
1887 #line 570 "objc-exp.y"
1889 write_exp_elt_opcode (OP_OBJC_SELECTOR);
1890 write_exp_string (yyvsp[0].sval);
1891 write_exp_elt_opcode (OP_OBJC_SELECTOR); }
1892 break;
1894 case 76:
1895 #line 577 "objc-exp.y"
1896 { write_exp_elt_opcode (OP_LONG);
1897 write_exp_elt_type (builtin_type_int);
1898 CHECK_TYPEDEF (yyvsp[-1].tval);
1899 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1900 write_exp_elt_opcode (OP_LONG); }
1901 break;
1903 case 77:
1904 #line 585 "objc-exp.y"
1905 { /* C strings are converted into array
1906 constants with an explicit null byte
1907 added at the end. Thus the array upper
1908 bound is the string length. There is no
1909 such thing in C as a completely empty
1910 string. */
1911 char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
1912 while (count-- > 0)
1914 write_exp_elt_opcode (OP_LONG);
1915 write_exp_elt_type (builtin_type_char);
1916 write_exp_elt_longcst ((LONGEST)(*sp++));
1917 write_exp_elt_opcode (OP_LONG);
1919 write_exp_elt_opcode (OP_LONG);
1920 write_exp_elt_type (builtin_type_char);
1921 write_exp_elt_longcst ((LONGEST)'\0');
1922 write_exp_elt_opcode (OP_LONG);
1923 write_exp_elt_opcode (OP_ARRAY);
1924 write_exp_elt_longcst ((LONGEST) 0);
1925 write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1926 write_exp_elt_opcode (OP_ARRAY); }
1927 break;
1929 case 78:
1930 #line 612 "objc-exp.y"
1931 { write_exp_elt_opcode (OP_OBJC_NSSTRING);
1932 write_exp_string (yyvsp[0].sval);
1933 write_exp_elt_opcode (OP_OBJC_NSSTRING); }
1934 break;
1936 case 79:
1937 #line 618 "objc-exp.y"
1939 if (yyvsp[0].ssym.sym != 0)
1940 yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1941 else
1943 struct symtab *tem =
1944 lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
1945 if (tem)
1946 yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
1947 else
1948 error ("No file or function \"%s\".",
1949 copy_name (yyvsp[0].ssym.stoken));
1952 break;
1954 case 80:
1955 #line 635 "objc-exp.y"
1956 { struct symbol *tem
1957 = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1958 VAR_DOMAIN, (int *) NULL,
1959 (struct symtab **) NULL);
1960 if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1961 error ("No function \"%s\" in specified context.",
1962 copy_name (yyvsp[0].sval));
1963 yyval.bval = SYMBOL_BLOCK_VALUE (tem); }
1964 break;
1966 case 81:
1967 #line 646 "objc-exp.y"
1968 { struct symbol *sym;
1969 sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1970 VAR_DOMAIN, (int *) NULL,
1971 (struct symtab **) NULL);
1972 if (sym == 0)
1973 error ("No symbol \"%s\" in specified context.",
1974 copy_name (yyvsp[0].sval));
1976 write_exp_elt_opcode (OP_VAR_VALUE);
1977 /* block_found is set by lookup_symbol. */
1978 write_exp_elt_block (block_found);
1979 write_exp_elt_sym (sym);
1980 write_exp_elt_opcode (OP_VAR_VALUE); }
1981 break;
1983 case 82:
1984 #line 662 "objc-exp.y"
1986 struct type *type = yyvsp[-2].tval;
1987 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1988 && TYPE_CODE (type) != TYPE_CODE_UNION)
1989 error ("`%s' is not defined as an aggregate type.",
1990 TYPE_NAME (type));
1992 write_exp_elt_opcode (OP_SCOPE);
1993 write_exp_elt_type (type);
1994 write_exp_string (yyvsp[0].sval);
1995 write_exp_elt_opcode (OP_SCOPE);
1997 break;
1999 case 83:
2000 #line 675 "objc-exp.y"
2002 struct type *type = yyvsp[-3].tval;
2003 struct stoken tmp_token;
2004 if (TYPE_CODE (type) != TYPE_CODE_STRUCT
2005 && TYPE_CODE (type) != TYPE_CODE_UNION)
2006 error ("`%s' is not defined as an aggregate type.",
2007 TYPE_NAME (type));
2009 if (!DEPRECATED_STREQ (type_name_no_tag (type), yyvsp[0].sval.ptr))
2010 error ("invalid destructor `%s::~%s'",
2011 type_name_no_tag (type), yyvsp[0].sval.ptr);
2013 tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
2014 tmp_token.length = yyvsp[0].sval.length + 1;
2015 tmp_token.ptr[0] = '~';
2016 memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
2017 tmp_token.ptr[tmp_token.length] = 0;
2018 write_exp_elt_opcode (OP_SCOPE);
2019 write_exp_elt_type (type);
2020 write_exp_string (tmp_token);
2021 write_exp_elt_opcode (OP_SCOPE);
2023 break;
2025 case 85:
2026 #line 701 "objc-exp.y"
2028 char *name = copy_name (yyvsp[0].sval);
2029 struct symbol *sym;
2030 struct minimal_symbol *msymbol;
2032 sym =
2033 lookup_symbol (name, (const struct block *) NULL,
2034 VAR_DOMAIN, (int *) NULL,
2035 (struct symtab **) NULL);
2036 if (sym)
2038 write_exp_elt_opcode (OP_VAR_VALUE);
2039 write_exp_elt_block (NULL);
2040 write_exp_elt_sym (sym);
2041 write_exp_elt_opcode (OP_VAR_VALUE);
2042 break;
2045 msymbol = lookup_minimal_symbol (name, NULL, NULL);
2046 if (msymbol != NULL)
2048 write_exp_msymbol (msymbol,
2049 lookup_function_type (builtin_type_int),
2050 builtin_type_int);
2052 else
2053 if (!have_full_symbols () && !have_partial_symbols ())
2054 error ("No symbol table is loaded. Use the \"file\" command.");
2055 else
2056 error ("No symbol \"%s\" in current context.", name);
2058 break;
2060 case 86:
2061 #line 735 "objc-exp.y"
2062 { struct symbol *sym = yyvsp[0].ssym.sym;
2064 if (sym)
2066 if (symbol_read_needs_frame (sym))
2068 if (innermost_block == 0 ||
2069 contained_in (block_found,
2070 innermost_block))
2071 innermost_block = block_found;
2074 write_exp_elt_opcode (OP_VAR_VALUE);
2075 /* We want to use the selected frame, not
2076 another more inner frame which happens to
2077 be in the same block. */
2078 write_exp_elt_block (NULL);
2079 write_exp_elt_sym (sym);
2080 write_exp_elt_opcode (OP_VAR_VALUE);
2082 else if (yyvsp[0].ssym.is_a_field_of_this)
2084 /* C++/ObjC: it hangs off of `this'/'self'.
2085 Must not inadvertently convert from a
2086 method call to data ref. */
2087 if (innermost_block == 0 ||
2088 contained_in (block_found, innermost_block))
2089 innermost_block = block_found;
2090 write_exp_elt_opcode (OP_OBJC_SELF);
2091 write_exp_elt_opcode (OP_OBJC_SELF);
2092 write_exp_elt_opcode (STRUCTOP_PTR);
2093 write_exp_string (yyvsp[0].ssym.stoken);
2094 write_exp_elt_opcode (STRUCTOP_PTR);
2096 else
2098 struct minimal_symbol *msymbol;
2099 char *arg = copy_name (yyvsp[0].ssym.stoken);
2101 msymbol =
2102 lookup_minimal_symbol (arg, NULL, NULL);
2103 if (msymbol != NULL)
2105 write_exp_msymbol (msymbol,
2106 lookup_function_type (builtin_type_int),
2107 builtin_type_int);
2109 else if (!have_full_symbols () &&
2110 !have_partial_symbols ())
2111 error ("No symbol table is loaded. Use the \"file\" command.");
2112 else
2113 error ("No symbol \"%s\" in current context.",
2114 copy_name (yyvsp[0].ssym.stoken));
2117 break;
2119 case 90:
2120 #line 802 "objc-exp.y"
2121 { yyval.tval = follow_types (yyvsp[-1].tval); }
2122 break;
2124 case 91:
2125 #line 804 "objc-exp.y"
2126 { yyval.tval = follow_types (yyvsp[-2].tval); }
2127 break;
2129 case 92:
2130 #line 806 "objc-exp.y"
2131 { yyval.tval = follow_types (yyvsp[-2].tval); }
2132 break;
2134 case 93:
2135 #line 810 "objc-exp.y"
2136 { push_type (tp_pointer); yyval.voidval = 0; }
2137 break;
2139 case 94:
2140 #line 812 "objc-exp.y"
2141 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
2142 break;
2144 case 95:
2145 #line 814 "objc-exp.y"
2146 { push_type (tp_reference); yyval.voidval = 0; }
2147 break;
2149 case 96:
2150 #line 816 "objc-exp.y"
2151 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
2152 break;
2154 case 98:
2155 #line 821 "objc-exp.y"
2156 { yyval.voidval = yyvsp[-1].voidval; }
2157 break;
2159 case 99:
2160 #line 823 "objc-exp.y"
2162 push_type_int (yyvsp[0].lval);
2163 push_type (tp_array);
2165 break;
2167 case 100:
2168 #line 828 "objc-exp.y"
2170 push_type_int (yyvsp[0].lval);
2171 push_type (tp_array);
2172 yyval.voidval = 0;
2174 break;
2176 case 101:
2177 #line 835 "objc-exp.y"
2178 { push_type (tp_function); }
2179 break;
2181 case 102:
2182 #line 837 "objc-exp.y"
2183 { push_type (tp_function); }
2184 break;
2186 case 103:
2187 #line 841 "objc-exp.y"
2188 { yyval.lval = -1; }
2189 break;
2191 case 104:
2192 #line 843 "objc-exp.y"
2193 { yyval.lval = yyvsp[-1].typed_val_int.val; }
2194 break;
2196 case 105:
2197 #line 847 "objc-exp.y"
2198 { yyval.voidval = 0; }
2199 break;
2201 case 106:
2202 #line 849 "objc-exp.y"
2203 { free (yyvsp[-1].tvec); yyval.voidval = 0; }
2204 break;
2206 case 108:
2207 #line 862 "objc-exp.y"
2208 { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); }
2209 break;
2211 case 109:
2212 #line 867 "objc-exp.y"
2213 { yyval.tval = yyvsp[0].tsym.type; }
2214 break;
2216 case 110:
2217 #line 869 "objc-exp.y"
2219 if (yyvsp[0].class.type == NULL)
2220 error ("No symbol \"%s\" in current context.",
2221 copy_name(yyvsp[0].class.stoken));
2222 else
2223 yyval.tval = yyvsp[0].class.type;
2225 break;
2227 case 111:
2228 #line 877 "objc-exp.y"
2229 { yyval.tval = builtin_type_int; }
2230 break;
2232 case 112:
2233 #line 879 "objc-exp.y"
2234 { yyval.tval = builtin_type_long; }
2235 break;
2237 case 113:
2238 #line 881 "objc-exp.y"
2239 { yyval.tval = builtin_type_short; }
2240 break;
2242 case 114:
2243 #line 883 "objc-exp.y"
2244 { yyval.tval = builtin_type_long; }
2245 break;
2247 case 115:
2248 #line 885 "objc-exp.y"
2249 { yyval.tval = builtin_type_unsigned_long; }
2250 break;
2252 case 116:
2253 #line 887 "objc-exp.y"
2254 { yyval.tval = builtin_type_long_long; }
2255 break;
2257 case 117:
2258 #line 889 "objc-exp.y"
2259 { yyval.tval = builtin_type_long_long; }
2260 break;
2262 case 118:
2263 #line 891 "objc-exp.y"
2264 { yyval.tval = builtin_type_unsigned_long_long; }
2265 break;
2267 case 119:
2268 #line 893 "objc-exp.y"
2269 { yyval.tval = builtin_type_unsigned_long_long; }
2270 break;
2272 case 120:
2273 #line 895 "objc-exp.y"
2274 { yyval.tval = builtin_type_short; }
2275 break;
2277 case 121:
2278 #line 897 "objc-exp.y"
2279 { yyval.tval = builtin_type_unsigned_short; }
2280 break;
2282 case 122:
2283 #line 899 "objc-exp.y"
2284 { yyval.tval = builtin_type_double; }
2285 break;
2287 case 123:
2288 #line 901 "objc-exp.y"
2289 { yyval.tval = builtin_type_long_double; }
2290 break;
2292 case 124:
2293 #line 903 "objc-exp.y"
2294 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2295 expression_context_block); }
2296 break;
2298 case 125:
2299 #line 906 "objc-exp.y"
2300 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
2301 expression_context_block); }
2302 break;
2304 case 126:
2305 #line 909 "objc-exp.y"
2306 { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
2307 expression_context_block); }
2308 break;
2310 case 127:
2311 #line 912 "objc-exp.y"
2312 { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
2313 expression_context_block); }
2314 break;
2316 case 128:
2317 #line 915 "objc-exp.y"
2318 { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
2319 break;
2321 case 129:
2322 #line 917 "objc-exp.y"
2323 { yyval.tval = builtin_type_unsigned_int; }
2324 break;
2326 case 130:
2327 #line 919 "objc-exp.y"
2328 { yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); }
2329 break;
2331 case 131:
2332 #line 921 "objc-exp.y"
2333 { yyval.tval = builtin_type_int; }
2334 break;
2336 case 132:
2337 #line 923 "objc-exp.y"
2338 { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
2339 expression_context_block);
2341 break;
2343 case 133:
2344 #line 929 "objc-exp.y"
2345 { yyval.tval = yyvsp[0].tval; }
2346 break;
2348 case 134:
2349 #line 930 "objc-exp.y"
2350 { yyval.tval = yyvsp[0].tval; }
2351 break;
2353 case 136:
2354 #line 935 "objc-exp.y"
2356 yyval.tsym.stoken.ptr = "int";
2357 yyval.tsym.stoken.length = 3;
2358 yyval.tsym.type = builtin_type_int;
2360 break;
2362 case 137:
2363 #line 941 "objc-exp.y"
2365 yyval.tsym.stoken.ptr = "long";
2366 yyval.tsym.stoken.length = 4;
2367 yyval.tsym.type = builtin_type_long;
2369 break;
2371 case 138:
2372 #line 947 "objc-exp.y"
2374 yyval.tsym.stoken.ptr = "short";
2375 yyval.tsym.stoken.length = 5;
2376 yyval.tsym.type = builtin_type_short;
2378 break;
2380 case 139:
2381 #line 956 "objc-exp.y"
2382 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
2383 yyval.ivec[0] = 1; /* Number of types in vector. */
2384 yyval.tvec[1] = yyvsp[0].tval;
2386 break;
2388 case 140:
2389 #line 961 "objc-exp.y"
2390 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
2391 yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
2392 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
2394 break;
2396 case 141:
2397 #line 967 "objc-exp.y"
2398 { yyval.sval = yyvsp[0].ssym.stoken; }
2399 break;
2401 case 142:
2402 #line 968 "objc-exp.y"
2403 { yyval.sval = yyvsp[0].ssym.stoken; }
2404 break;
2406 case 143:
2407 #line 969 "objc-exp.y"
2408 { yyval.sval = yyvsp[0].tsym.stoken; }
2409 break;
2411 case 144:
2412 #line 970 "objc-exp.y"
2413 { yyval.sval = yyvsp[0].class.stoken; }
2414 break;
2416 case 145:
2417 #line 971 "objc-exp.y"
2418 { yyval.sval = yyvsp[0].ssym.stoken; }
2419 break;
2424 /* Line 1000 of yacc.c. */
2425 #line 2426 "objc-exp.c.tmp"
2427 yyvsp -= yylen;
2428 yyssp -= yylen;
2431 YY_STACK_PRINT (yyss, yyssp);
2433 *++yyvsp = yyval;
2436 /* Now `shift' the result of the reduction. Determine what state
2437 that goes to, based on the state we popped back to and the rule
2438 number reduced by. */
2440 yyn = yyr1[yyn];
2442 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2443 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2444 yystate = yytable[yystate];
2445 else
2446 yystate = yydefgoto[yyn - YYNTOKENS];
2448 goto yynewstate;
2451 /*------------------------------------.
2452 | yyerrlab -- here on detecting error |
2453 `------------------------------------*/
2454 yyerrlab:
2455 /* If not already recovering from an error, report this error. */
2456 if (!yyerrstatus)
2458 ++yynerrs;
2459 #if YYERROR_VERBOSE
2460 yyn = yypact[yystate];
2462 if (YYPACT_NINF < yyn && yyn < YYLAST)
2464 YYSIZE_T yysize = 0;
2465 int yytype = YYTRANSLATE (yychar);
2466 const char* yyprefix;
2467 char *yymsg;
2468 int yyx;
2470 /* Start YYX at -YYN if negative to avoid negative indexes in
2471 YYCHECK. */
2472 int yyxbegin = yyn < 0 ? -yyn : 0;
2474 /* Stay within bounds of both yycheck and yytname. */
2475 int yychecklim = YYLAST - yyn;
2476 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2477 int yycount = 0;
2479 yyprefix = ", expecting ";
2480 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2481 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2483 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2484 yycount += 1;
2485 if (yycount == 5)
2487 yysize = 0;
2488 break;
2491 yysize += (sizeof ("syntax error, unexpected ")
2492 + yystrlen (yytname[yytype]));
2493 yymsg = (char *) YYSTACK_ALLOC (yysize);
2494 if (yymsg != 0)
2496 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2497 yyp = yystpcpy (yyp, yytname[yytype]);
2499 if (yycount < 5)
2501 yyprefix = ", expecting ";
2502 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2503 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2505 yyp = yystpcpy (yyp, yyprefix);
2506 yyp = yystpcpy (yyp, yytname[yyx]);
2507 yyprefix = " or ";
2510 yyerror (yymsg);
2511 YYSTACK_FREE (yymsg);
2513 else
2514 yyerror ("syntax error; also virtual memory exhausted");
2516 else
2517 #endif /* YYERROR_VERBOSE */
2518 yyerror ("syntax error");
2523 if (yyerrstatus == 3)
2525 /* If just tried and failed to reuse lookahead token after an
2526 error, discard it. */
2528 if (yychar <= YYEOF)
2530 /* If at end of input, pop the error token,
2531 then the rest of the stack, then return failure. */
2532 if (yychar == YYEOF)
2533 for (;;)
2535 YYPOPSTACK;
2536 if (yyssp == yyss)
2537 YYABORT;
2538 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2539 yydestruct (yystos[*yyssp], yyvsp);
2542 else
2544 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2545 yydestruct (yytoken, &yylval);
2546 yychar = YYEMPTY;
2551 /* Else will try to reuse lookahead token after shifting the error
2552 token. */
2553 goto yyerrlab1;
2556 /*---------------------------------------------------.
2557 | yyerrorlab -- error raised explicitly by YYERROR. |
2558 `---------------------------------------------------*/
2559 yyerrorlab:
2561 #ifdef __GNUC__
2562 /* Pacify GCC when the user code never invokes YYERROR and the label
2563 yyerrorlab therefore never appears in user code. */
2564 if (0)
2565 goto yyerrorlab;
2566 #endif
2568 yyvsp -= yylen;
2569 yyssp -= yylen;
2570 yystate = *yyssp;
2571 goto yyerrlab1;
2574 /*-------------------------------------------------------------.
2575 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2576 `-------------------------------------------------------------*/
2577 yyerrlab1:
2578 yyerrstatus = 3; /* Each real token shifted decrements this. */
2580 for (;;)
2582 yyn = yypact[yystate];
2583 if (yyn != YYPACT_NINF)
2585 yyn += YYTERROR;
2586 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2588 yyn = yytable[yyn];
2589 if (0 < yyn)
2590 break;
2594 /* Pop the current state because it cannot handle the error token. */
2595 if (yyssp == yyss)
2596 YYABORT;
2598 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2599 yydestruct (yystos[yystate], yyvsp);
2600 YYPOPSTACK;
2601 yystate = *yyssp;
2602 YY_STACK_PRINT (yyss, yyssp);
2605 if (yyn == YYFINAL)
2606 YYACCEPT;
2608 YYDPRINTF ((stderr, "Shifting error token, "));
2610 *++yyvsp = yylval;
2613 yystate = yyn;
2614 goto yynewstate;
2617 /*-------------------------------------.
2618 | yyacceptlab -- YYACCEPT comes here. |
2619 `-------------------------------------*/
2620 yyacceptlab:
2621 yyresult = 0;
2622 goto yyreturn;
2624 /*-----------------------------------.
2625 | yyabortlab -- YYABORT comes here. |
2626 `-----------------------------------*/
2627 yyabortlab:
2628 yyresult = 1;
2629 goto yyreturn;
2631 #ifndef yyoverflow
2632 /*----------------------------------------------.
2633 | yyoverflowlab -- parser overflow comes here. |
2634 `----------------------------------------------*/
2635 yyoverflowlab:
2636 yyerror ("parser stack overflow");
2637 yyresult = 2;
2638 /* Fall through. */
2639 #endif
2641 yyreturn:
2642 #ifndef yyoverflow
2643 if (yyss != yyssa)
2644 YYSTACK_FREE (yyss);
2645 #endif
2646 return yyresult;
2650 #line 985 "objc-exp.y"
2653 /* Take care of parsing a number (anything that starts with a digit).
2654 Set yylval and return the token type; update lexptr. LEN is the
2655 number of characters in it. */
2657 /*** Needs some error checking for the float case. ***/
2659 static int
2660 parse_number (p, len, parsed_float, putithere)
2661 char *p;
2662 int len;
2663 int parsed_float;
2664 YYSTYPE *putithere;
2666 /* FIXME: Shouldn't these be unsigned? We don't deal with negative
2667 values here, and we do kind of silly things like cast to
2668 unsigned. */
2669 LONGEST n = 0;
2670 LONGEST prevn = 0;
2671 unsigned LONGEST un;
2673 int i = 0;
2674 int c;
2675 int base = input_radix;
2676 int unsigned_p = 0;
2678 /* Number of "L" suffixes encountered. */
2679 int long_p = 0;
2681 /* We have found a "L" or "U" suffix. */
2682 int found_suffix = 0;
2684 unsigned LONGEST high_bit;
2685 struct type *signed_type;
2686 struct type *unsigned_type;
2688 if (parsed_float)
2690 char c;
2692 /* It's a float since it contains a point or an exponent. */
2694 sscanf (p, DOUBLEST_SCAN_FORMAT "%c",
2695 &putithere->typed_val_float.dval, &c);
2697 /* See if it has `f' or `l' suffix (float or long double). */
2699 c = tolower (p[len - 1]);
2701 if (c == 'f')
2702 putithere->typed_val_float.type = builtin_type_float;
2703 else if (c == 'l')
2704 putithere->typed_val_float.type = builtin_type_long_double;
2705 else if (isdigit (c) || c == '.')
2706 putithere->typed_val_float.type = builtin_type_double;
2707 else
2708 return ERROR;
2710 return FLOAT;
2713 /* Handle base-switching prefixes 0x, 0t, 0d, and 0. */
2714 if (p[0] == '0')
2715 switch (p[1])
2717 case 'x':
2718 case 'X':
2719 if (len >= 3)
2721 p += 2;
2722 base = 16;
2723 len -= 2;
2725 break;
2727 case 't':
2728 case 'T':
2729 case 'd':
2730 case 'D':
2731 if (len >= 3)
2733 p += 2;
2734 base = 10;
2735 len -= 2;
2737 break;
2739 default:
2740 base = 8;
2741 break;
2744 while (len-- > 0)
2746 c = *p++;
2747 if (c >= 'A' && c <= 'Z')
2748 c += 'a' - 'A';
2749 if (c != 'l' && c != 'u')
2750 n *= base;
2751 if (c >= '0' && c <= '9')
2753 if (found_suffix)
2754 return ERROR;
2755 n += i = c - '0';
2757 else
2759 if (base > 10 && c >= 'a' && c <= 'f')
2761 if (found_suffix)
2762 return ERROR;
2763 n += i = c - 'a' + 10;
2765 else if (c == 'l')
2767 ++long_p;
2768 found_suffix = 1;
2770 else if (c == 'u')
2772 unsigned_p = 1;
2773 found_suffix = 1;
2775 else
2776 return ERROR; /* Char not a digit. */
2778 if (i >= base)
2779 return ERROR; /* Invalid digit in this base. */
2781 /* Portably test for overflow (only works for nonzero values, so
2782 make a second check for zero). FIXME: Can't we just make n
2783 and prevn unsigned and avoid this? */
2784 if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2785 unsigned_p = 1; /* Try something unsigned. */
2787 /* Portably test for unsigned overflow.
2788 FIXME: This check is wrong; for example it doesn't find
2789 overflow on 0x123456789 when LONGEST is 32 bits. */
2790 if (c != 'l' && c != 'u' && n != 0)
2792 if ((unsigned_p && (unsigned LONGEST) prevn >= (unsigned LONGEST) n))
2793 error ("Numeric constant too large.");
2795 prevn = n;
2798 /* An integer constant is an int, a long, or a long long. An L
2799 suffix forces it to be long; an LL suffix forces it to be long
2800 long. If not forced to a larger size, it gets the first type of
2801 the above that it fits in. To figure out whether it fits, we
2802 shift it right and see whether anything remains. Note that we
2803 can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2804 operation, because many compilers will warn about such a shift
2805 (which always produces a zero result). Sometimes TARGET_INT_BIT
2806 or TARGET_LONG_BIT will be that big, sometimes not. To deal with
2807 the case where it is we just always shift the value more than
2808 once, with fewer bits each time. */
2810 un = (unsigned LONGEST)n >> 2;
2811 if (long_p == 0
2812 && (un >> (TARGET_INT_BIT - 2)) == 0)
2814 high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
2816 /* A large decimal (not hex or octal) constant (between INT_MAX
2817 and UINT_MAX) is a long or unsigned long, according to ANSI,
2818 never an unsigned int, but this code treats it as unsigned
2819 int. This probably should be fixed. GCC gives a warning on
2820 such constants. */
2822 unsigned_type = builtin_type_unsigned_int;
2823 signed_type = builtin_type_int;
2825 else if (long_p <= 1
2826 && (un >> (TARGET_LONG_BIT - 2)) == 0)
2828 high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
2829 unsigned_type = builtin_type_unsigned_long;
2830 signed_type = builtin_type_long;
2832 else
2834 high_bit = (((unsigned LONGEST)1)
2835 << (TARGET_LONG_LONG_BIT - 32 - 1)
2836 << 16
2837 << 16);
2838 if (high_bit == 0)
2839 /* A long long does not fit in a LONGEST. */
2840 high_bit =
2841 (unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
2842 unsigned_type = builtin_type_unsigned_long_long;
2843 signed_type = builtin_type_long_long;
2846 putithere->typed_val_int.val = n;
2848 /* If the high bit of the worked out type is set then this number
2849 has to be unsigned. */
2851 if (unsigned_p || (n & high_bit))
2853 putithere->typed_val_int.type = unsigned_type;
2855 else
2857 putithere->typed_val_int.type = signed_type;
2860 return INT;
2863 struct token
2865 char *operator;
2866 int token;
2867 enum exp_opcode opcode;
2870 static const struct token tokentab3[] =
2872 {">>=", ASSIGN_MODIFY, BINOP_RSH},
2873 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2876 static const struct token tokentab2[] =
2878 {"+=", ASSIGN_MODIFY, BINOP_ADD},
2879 {"-=", ASSIGN_MODIFY, BINOP_SUB},
2880 {"*=", ASSIGN_MODIFY, BINOP_MUL},
2881 {"/=", ASSIGN_MODIFY, BINOP_DIV},
2882 {"%=", ASSIGN_MODIFY, BINOP_REM},
2883 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2884 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2885 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2886 {"++", INCREMENT, BINOP_END},
2887 {"--", DECREMENT, BINOP_END},
2888 {"->", ARROW, BINOP_END},
2889 {"&&", ANDAND, BINOP_END},
2890 {"||", OROR, BINOP_END},
2891 {"::", COLONCOLON, BINOP_END},
2892 {"<<", LSH, BINOP_END},
2893 {">>", RSH, BINOP_END},
2894 {"==", EQUAL, BINOP_END},
2895 {"!=", NOTEQUAL, BINOP_END},
2896 {"<=", LEQ, BINOP_END},
2897 {">=", GEQ, BINOP_END}
2900 /* Read one token, getting characters through lexptr. */
2902 static int
2903 yylex ()
2905 int c, tokchr;
2906 int namelen;
2907 unsigned int i;
2908 char *tokstart;
2909 char *tokptr;
2910 int tempbufindex;
2911 static char *tempbuf;
2912 static int tempbufsize;
2914 retry:
2916 tokstart = lexptr;
2917 /* See if it is a special token of length 3. */
2918 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2919 if (DEPRECATED_STREQN (tokstart, tokentab3[i].operator, 3))
2921 lexptr += 3;
2922 yylval.opcode = tokentab3[i].opcode;
2923 return tokentab3[i].token;
2926 /* See if it is a special token of length 2. */
2927 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2928 if (DEPRECATED_STREQN (tokstart, tokentab2[i].operator, 2))
2930 lexptr += 2;
2931 yylval.opcode = tokentab2[i].opcode;
2932 return tokentab2[i].token;
2935 c = 0;
2936 switch (tokchr = *tokstart)
2938 case 0:
2939 return 0;
2941 case ' ':
2942 case '\t':
2943 case '\n':
2944 lexptr++;
2945 goto retry;
2947 case '\'':
2948 /* We either have a character constant ('0' or '\177' for
2949 example) or we have a quoted symbol reference ('foo(int,int)'
2950 in C++ for example). */
2951 lexptr++;
2952 c = *lexptr++;
2953 if (c == '\\')
2954 c = parse_escape (&lexptr);
2955 else if (c == '\'')
2956 error ("Empty character constant.");
2958 yylval.typed_val_int.val = c;
2959 yylval.typed_val_int.type = builtin_type_char;
2961 c = *lexptr++;
2962 if (c != '\'')
2964 namelen = skip_quoted (tokstart) - tokstart;
2965 if (namelen > 2)
2967 lexptr = tokstart + namelen;
2968 if (lexptr[-1] != '\'')
2969 error ("Unmatched single quote.");
2970 namelen -= 2;
2971 tokstart++;
2972 goto tryname;
2974 error ("Invalid character constant.");
2976 return INT;
2978 case '(':
2979 paren_depth++;
2980 lexptr++;
2981 return '(';
2983 case ')':
2984 if (paren_depth == 0)
2985 return 0;
2986 paren_depth--;
2987 lexptr++;
2988 return ')';
2990 case ',':
2991 if (comma_terminates && paren_depth == 0)
2992 return 0;
2993 lexptr++;
2994 return ',';
2996 case '.':
2997 /* Might be a floating point number. */
2998 if (lexptr[1] < '0' || lexptr[1] > '9')
2999 goto symbol; /* Nope, must be a symbol. */
3000 /* FALL THRU into number case. */
3002 case '0':
3003 case '1':
3004 case '2':
3005 case '3':
3006 case '4':
3007 case '5':
3008 case '6':
3009 case '7':
3010 case '8':
3011 case '9':
3013 /* It's a number. */
3014 int got_dot = 0, got_e = 0, toktype = FLOAT;
3015 /* Initialize toktype to anything other than ERROR. */
3016 char *p = tokstart;
3017 int hex = input_radix > 10;
3018 int local_radix = input_radix;
3019 if (tokchr == '0' && (p[1] == 'x' || p[1] == 'X'))
3021 p += 2;
3022 hex = 1;
3023 local_radix = 16;
3025 else if (tokchr == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
3027 p += 2;
3028 hex = 0;
3029 local_radix = 10;
3032 for (;; ++p)
3034 /* This test includes !hex because 'e' is a valid hex digit
3035 and thus does not indicate a floating point number when
3036 the radix is hex. */
3038 if (!hex && (*p == 'e' || *p == 'E'))
3039 if (got_e)
3040 toktype = ERROR; /* Only one 'e' in a float. */
3041 else
3042 got_e = 1;
3043 /* This test does not include !hex, because a '.' always
3044 indicates a decimal floating point number regardless of
3045 the radix. */
3046 else if (*p == '.')
3047 if (got_dot)
3048 toktype = ERROR; /* Only one '.' in a float. */
3049 else
3050 got_dot = 1;
3051 else if (got_e && (p[-1] == 'e' || p[-1] == 'E') &&
3052 (*p == '-' || *p == '+'))
3053 /* This is the sign of the exponent, not the end of the
3054 number. */
3055 continue;
3056 /* Always take decimal digits; parse_number handles radix
3057 error. */
3058 else if (*p >= '0' && *p <= '9')
3059 continue;
3060 /* We will take letters only if hex is true, and only up
3061 to what the input radix would permit. FSF was content
3062 to rely on parse_number to validate; but it leaks. */
3063 else if (*p >= 'a' && *p <= 'z')
3065 if (!hex || *p >= ('a' + local_radix - 10))
3066 toktype = ERROR;
3068 else if (*p >= 'A' && *p <= 'Z')
3070 if (!hex || *p >= ('A' + local_radix - 10))
3071 toktype = ERROR;
3073 else break;
3075 if (toktype != ERROR)
3076 toktype = parse_number (tokstart, p - tokstart,
3077 got_dot | got_e, &yylval);
3078 if (toktype == ERROR)
3080 char *err_copy = (char *) alloca (p - tokstart + 1);
3082 memcpy (err_copy, tokstart, p - tokstart);
3083 err_copy[p - tokstart] = 0;
3084 error ("Invalid number \"%s\".", err_copy);
3086 lexptr = p;
3087 return toktype;
3090 case '+':
3091 case '-':
3092 case '*':
3093 case '/':
3094 case '%':
3095 case '|':
3096 case '&':
3097 case '^':
3098 case '~':
3099 case '!':
3100 #if 0
3101 case '@': /* Moved out below. */
3102 #endif
3103 case '<':
3104 case '>':
3105 case '[':
3106 case ']':
3107 case '?':
3108 case ':':
3109 case '=':
3110 case '{':
3111 case '}':
3112 symbol:
3113 lexptr++;
3114 return tokchr;
3116 case '@':
3117 if (strncmp(tokstart, "@selector", 9) == 0)
3119 tokptr = strchr(tokstart, '(');
3120 if (tokptr == NULL)
3122 error ("Missing '(' in @selector(...)");
3124 tempbufindex = 0;
3125 tokptr++; /* Skip the '('. */
3126 do {
3127 /* Grow the static temp buffer if necessary, including
3128 allocating the first one on demand. */
3129 if (tempbufindex + 1 >= tempbufsize)
3131 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
3133 tempbuf[tempbufindex++] = *tokptr++;
3134 } while ((*tokptr != ')') && (*tokptr != '\0'));
3135 if (*tokptr++ != ')')
3137 error ("Missing ')' in @selector(...)");
3139 tempbuf[tempbufindex] = '\0';
3140 yylval.sval.ptr = tempbuf;
3141 yylval.sval.length = tempbufindex;
3142 lexptr = tokptr;
3143 return SELECTOR;
3145 if (tokstart[1] != '"')
3147 lexptr++;
3148 return tokchr;
3150 /* ObjC NextStep NSString constant: fall thru and parse like
3151 STRING. */
3152 tokstart++;
3154 case '"':
3156 /* Build the gdb internal form of the input string in tempbuf,
3157 translating any standard C escape forms seen. Note that the
3158 buffer is null byte terminated *only* for the convenience of
3159 debugging gdb itself and printing the buffer contents when
3160 the buffer contains no embedded nulls. Gdb does not depend
3161 upon the buffer being null byte terminated, it uses the
3162 length string instead. This allows gdb to handle C strings
3163 (as well as strings in other languages) with embedded null
3164 bytes. */
3166 tokptr = ++tokstart;
3167 tempbufindex = 0;
3169 do {
3170 /* Grow the static temp buffer if necessary, including
3171 allocating the first one on demand. */
3172 if (tempbufindex + 1 >= tempbufsize)
3174 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
3176 switch (*tokptr)
3178 case '\0':
3179 case '"':
3180 /* Do nothing, loop will terminate. */
3181 break;
3182 case '\\':
3183 tokptr++;
3184 c = parse_escape (&tokptr);
3185 if (c == -1)
3187 continue;
3189 tempbuf[tempbufindex++] = c;
3190 break;
3191 default:
3192 tempbuf[tempbufindex++] = *tokptr++;
3193 break;
3195 } while ((*tokptr != '"') && (*tokptr != '\0'));
3196 if (*tokptr++ != '"')
3198 error ("Unterminated string in expression.");
3200 tempbuf[tempbufindex] = '\0'; /* See note above. */
3201 yylval.sval.ptr = tempbuf;
3202 yylval.sval.length = tempbufindex;
3203 lexptr = tokptr;
3204 return (tokchr == '@' ? NSSTRING : STRING);
3207 if (!(tokchr == '_' || tokchr == '$' ||
3208 (tokchr >= 'a' && tokchr <= 'z') || (tokchr >= 'A' && tokchr <= 'Z')))
3209 /* We must have come across a bad character (e.g. ';'). */
3210 error ("Invalid character '%c' in expression.", c);
3212 /* It's a name. See how long it is. */
3213 namelen = 0;
3214 for (c = tokstart[namelen];
3215 (c == '_' || c == '$' || (c >= '0' && c <= '9')
3216 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
3218 if (c == '<')
3220 int i = namelen;
3221 while (tokstart[++i] && tokstart[i] != '>');
3222 if (tokstart[i] == '>')
3223 namelen = i;
3225 c = tokstart[++namelen];
3228 /* The token "if" terminates the expression and is NOT
3229 removed from the input stream. */
3230 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
3232 return 0;
3235 lexptr += namelen;
3237 tryname:
3239 /* Catch specific keywords. Should be done with a data structure. */
3240 switch (namelen)
3242 case 8:
3243 if (DEPRECATED_STREQN (tokstart, "unsigned", 8))
3244 return UNSIGNED;
3245 if (current_language->la_language == language_cplus
3246 && strncmp (tokstart, "template", 8) == 0)
3247 return TEMPLATE;
3248 if (DEPRECATED_STREQN (tokstart, "volatile", 8))
3249 return VOLATILE_KEYWORD;
3250 break;
3251 case 6:
3252 if (DEPRECATED_STREQN (tokstart, "struct", 6))
3253 return STRUCT;
3254 if (DEPRECATED_STREQN (tokstart, "signed", 6))
3255 return SIGNED_KEYWORD;
3256 if (DEPRECATED_STREQN (tokstart, "sizeof", 6))
3257 return SIZEOF;
3258 if (DEPRECATED_STREQN (tokstart, "double", 6))
3259 return DOUBLE_KEYWORD;
3260 break;
3261 case 5:
3262 if ((current_language->la_language == language_cplus)
3263 && strncmp (tokstart, "class", 5) == 0)
3264 return CLASS;
3265 if (DEPRECATED_STREQN (tokstart, "union", 5))
3266 return UNION;
3267 if (DEPRECATED_STREQN (tokstart, "short", 5))
3268 return SHORT;
3269 if (DEPRECATED_STREQN (tokstart, "const", 5))
3270 return CONST_KEYWORD;
3271 break;
3272 case 4:
3273 if (DEPRECATED_STREQN (tokstart, "enum", 4))
3274 return ENUM;
3275 if (DEPRECATED_STREQN (tokstart, "long", 4))
3276 return LONG;
3277 break;
3278 case 3:
3279 if (DEPRECATED_STREQN (tokstart, "int", 3))
3280 return INT_KEYWORD;
3281 break;
3282 default:
3283 break;
3286 yylval.sval.ptr = tokstart;
3287 yylval.sval.length = namelen;
3289 if (*tokstart == '$')
3291 write_dollar_variable (yylval.sval);
3292 return VARIABLE;
3295 /* Use token-type BLOCKNAME for symbols that happen to be defined as
3296 functions or symtabs. If this is not so, then ...
3297 Use token-type TYPENAME for symbols that happen to be defined
3298 currently as names of types; NAME for other symbols.
3299 The caller is not constrained to care about the distinction. */
3301 char *tmp = copy_name (yylval.sval);
3302 struct symbol *sym;
3303 int is_a_field_of_this = 0, *need_this;
3304 int hextype;
3306 if (current_language->la_language == language_cplus ||
3307 current_language->la_language == language_objc)
3308 need_this = &is_a_field_of_this;
3309 else
3310 need_this = (int *) NULL;
3312 sym = lookup_symbol (tmp, expression_context_block,
3313 VAR_DOMAIN,
3314 need_this,
3315 (struct symtab **) NULL);
3316 /* Call lookup_symtab, not lookup_partial_symtab, in case there
3317 are no psymtabs (coff, xcoff, or some future change to blow
3318 away the psymtabs once symbols are read). */
3319 if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
3320 lookup_symtab (tmp))
3322 yylval.ssym.sym = sym;
3323 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3324 return BLOCKNAME;
3326 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
3328 #if 1
3329 /* Despite the following flaw, we need to keep this code
3330 enabled. Because we can get called from
3331 check_stub_method, if we don't handle nested types then
3332 it screws many operations in any program which uses
3333 nested types. */
3334 /* In "A::x", if x is a member function of A and there
3335 happens to be a type (nested or not, since the stabs
3336 don't make that distinction) named x, then this code
3337 incorrectly thinks we are dealing with nested types
3338 rather than a member function. */
3340 char *p;
3341 char *namestart;
3342 struct symbol *best_sym;
3344 /* Look ahead to detect nested types. This probably should
3345 be done in the grammar, but trying seemed to introduce a
3346 lot of shift/reduce and reduce/reduce conflicts. It's
3347 possible that it could be done, though. Or perhaps a
3348 non-grammar, but less ad hoc, approach would work well. */
3350 /* Since we do not currently have any way of distinguishing
3351 a nested type from a non-nested one (the stabs don't tell
3352 us whether a type is nested), we just ignore the
3353 containing type. */
3355 p = lexptr;
3356 best_sym = sym;
3357 while (1)
3359 /* Skip whitespace. */
3360 while (*p == ' ' || *p == '\t' || *p == '\n')
3361 ++p;
3362 if (*p == ':' && p[1] == ':')
3364 /* Skip the `::'. */
3365 p += 2;
3366 /* Skip whitespace. */
3367 while (*p == ' ' || *p == '\t' || *p == '\n')
3368 ++p;
3369 namestart = p;
3370 while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
3371 || (*p >= 'a' && *p <= 'z')
3372 || (*p >= 'A' && *p <= 'Z'))
3373 ++p;
3374 if (p != namestart)
3376 struct symbol *cur_sym;
3377 /* As big as the whole rest of the expression,
3378 which is at least big enough. */
3379 char *ncopy = alloca (strlen (tmp) +
3380 strlen (namestart) + 3);
3381 char *tmp1;
3383 tmp1 = ncopy;
3384 memcpy (tmp1, tmp, strlen (tmp));
3385 tmp1 += strlen (tmp);
3386 memcpy (tmp1, "::", 2);
3387 tmp1 += 2;
3388 memcpy (tmp1, namestart, p - namestart);
3389 tmp1[p - namestart] = '\0';
3390 cur_sym = lookup_symbol (ncopy,
3391 expression_context_block,
3392 VAR_DOMAIN, (int *) NULL,
3393 (struct symtab **) NULL);
3394 if (cur_sym)
3396 if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
3398 best_sym = cur_sym;
3399 lexptr = p;
3401 else
3402 break;
3404 else
3405 break;
3407 else
3408 break;
3410 else
3411 break;
3414 yylval.tsym.type = SYMBOL_TYPE (best_sym);
3415 #else /* not 0 */
3416 yylval.tsym.type = SYMBOL_TYPE (sym);
3417 #endif /* not 0 */
3418 return TYPENAME;
3420 yylval.tsym.type
3421 = language_lookup_primitive_type_by_name (current_language,
3422 current_gdbarch, tmp);
3423 if (yylval.tsym.type != NULL)
3424 return TYPENAME;
3426 /* See if it's an ObjC classname. */
3427 if (!sym)
3429 CORE_ADDR Class = lookup_objc_class(tmp);
3430 if (Class)
3432 yylval.class.class = Class;
3433 if ((sym = lookup_struct_typedef (tmp,
3434 expression_context_block,
3435 1)))
3436 yylval.class.type = SYMBOL_TYPE (sym);
3437 return CLASSNAME;
3441 /* Input names that aren't symbols but ARE valid hex numbers,
3442 when the input radix permits them, can be names or numbers
3443 depending on the parse. Note we support radixes > 16 here. */
3444 if (!sym &&
3445 ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
3446 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
3448 YYSTYPE newlval; /* Its value is ignored. */
3449 hextype = parse_number (tokstart, namelen, 0, &newlval);
3450 if (hextype == INT)
3452 yylval.ssym.sym = sym;
3453 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3454 return NAME_OR_INT;
3458 /* Any other kind of symbol. */
3459 yylval.ssym.sym = sym;
3460 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
3461 return NAME;
3465 void
3466 yyerror (msg)
3467 char *msg;
3469 if (*lexptr == '\0')
3470 error("A %s near end of expression.", (msg ? msg : "error"));
3471 else
3472 error ("A %s in expression, near `%s'.", (msg ? msg : "error"),
3473 lexptr);