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