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