]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/gdb/gdb/c-exp.tab.c
Import GDB in its full glory (all 25mb). We'll put it on a diet once it's
[FreeBSD/FreeBSD.git] / contrib / gdb / gdb / c-exp.tab.c
1
2 /*  A Bison parser, made from ./c-exp.y with Bison version GNU Bison version 1.24
3   */
4
5 #define YYBISON 1  /* Identify Bison output.  */
6
7 #define INT     258
8 #define FLOAT   259
9 #define STRING  260
10 #define NAME    261
11 #define TYPENAME        262
12 #define NAME_OR_INT     263
13 #define STRUCT  264
14 #define CLASS   265
15 #define UNION   266
16 #define ENUM    267
17 #define SIZEOF  268
18 #define UNSIGNED        269
19 #define COLONCOLON      270
20 #define TEMPLATE        271
21 #define ERROR   272
22 #define SIGNED_KEYWORD  273
23 #define LONG    274
24 #define SHORT   275
25 #define INT_KEYWORD     276
26 #define CONST_KEYWORD   277
27 #define VOLATILE_KEYWORD        278
28 #define DOUBLE_KEYWORD  279
29 #define VARIABLE        280
30 #define ASSIGN_MODIFY   281
31 #define THIS    282
32 #define ABOVE_COMMA     283
33 #define OROR    284
34 #define ANDAND  285
35 #define EQUAL   286
36 #define NOTEQUAL        287
37 #define LEQ     288
38 #define GEQ     289
39 #define LSH     290
40 #define RSH     291
41 #define UNARY   292
42 #define INCREMENT       293
43 #define DECREMENT       294
44 #define ARROW   295
45 #define BLOCKNAME       296
46
47 #line 38 "./c-exp.y"
48
49
50 #include "defs.h"
51 #include "gdb_string.h"
52 #include <ctype.h>
53 #include "expression.h"
54 #include "value.h"
55 #include "parser-defs.h"
56 #include "language.h"
57 #include "c-lang.h"
58 #include "bfd.h" /* Required by objfiles.h.  */
59 #include "symfile.h" /* Required by objfiles.h.  */
60 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
61
62 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
63    as well as gratuitiously global symbol names, so we can have multiple
64    yacc generated parsers in gdb.  Note that these are only the variables
65    produced by yacc.  If other parser generators (bison, byacc, etc) produce
66    additional global names that conflict at link time, then those parser
67    generators need to be fixed instead of adding those names to this list. */
68
69 #define yymaxdepth c_maxdepth
70 #define yyparse c_parse
71 #define yylex   c_lex
72 #define yyerror c_error
73 #define yylval  c_lval
74 #define yychar  c_char
75 #define yydebug c_debug
76 #define yypact  c_pact  
77 #define yyr1    c_r1                    
78 #define yyr2    c_r2                    
79 #define yydef   c_def           
80 #define yychk   c_chk           
81 #define yypgo   c_pgo           
82 #define yyact   c_act           
83 #define yyexca  c_exca
84 #define yyerrflag c_errflag
85 #define yynerrs c_nerrs
86 #define yyps    c_ps
87 #define yypv    c_pv
88 #define yys     c_s
89 #define yy_yys  c_yys
90 #define yystate c_state
91 #define yytmp   c_tmp
92 #define yyv     c_v
93 #define yy_yyv  c_yyv
94 #define yyval   c_val
95 #define yylloc  c_lloc
96 #define yyreds  c_reds          /* With YYDEBUG defined */
97 #define yytoks  c_toks          /* With YYDEBUG defined */
98 #define yylhs   c_yylhs
99 #define yylen   c_yylen
100 #define yydefred c_yydefred
101 #define yydgoto c_yydgoto
102 #define yysindex c_yysindex
103 #define yyrindex c_yyrindex
104 #define yygindex c_yygindex
105 #define yytable  c_yytable
106 #define yycheck  c_yycheck
107
108 #ifndef YYDEBUG
109 #define YYDEBUG 0               /* Default to no yydebug support */
110 #endif
111
112 int
113 yyparse PARAMS ((void));
114
115 static int
116 yylex PARAMS ((void));
117
118 void
119 yyerror PARAMS ((char *));
120
121
122 #line 117 "./c-exp.y"
123 typedef union
124   {
125     LONGEST lval;
126     struct {
127       LONGEST val;
128       struct type *type;
129     } typed_val_int;
130     struct {
131       DOUBLEST dval;
132       struct type *type;
133     } typed_val_float;
134     struct symbol *sym;
135     struct type *tval;
136     struct stoken sval;
137     struct ttype tsym;
138     struct symtoken ssym;
139     int voidval;
140     struct block *bval;
141     enum exp_opcode opcode;
142     struct internalvar *ivar;
143
144     struct type **tvec;
145     int *ivec;
146   } YYSTYPE;
147 #line 142 "./c-exp.y"
148
149 /* YYSTYPE gets defined by %union */
150 static int
151 parse_number PARAMS ((char *, int, int, YYSTYPE *));
152
153 #ifndef YYLTYPE
154 typedef
155   struct yyltype
156     {
157       int timestamp;
158       int first_line;
159       int first_column;
160       int last_line;
161       int last_column;
162       char *text;
163    }
164   yyltype;
165
166 #define YYLTYPE yyltype
167 #endif
168
169 #include <stdio.h>
170
171 #ifndef __cplusplus
172 #ifndef __STDC__
173 #define const
174 #endif
175 #endif
176
177
178
179 #define YYFINAL         211
180 #define YYFLAG          -32768
181 #define YYNTBASE        66
182
183 #define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 88)
184
185 static const char yytranslate[] = {     0,
186      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
187      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
188      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
189      2,     2,    59,     2,     2,     2,    50,    36,     2,    57,
190     62,    48,    46,    28,    47,    55,    49,     2,     2,     2,
191      2,     2,     2,     2,     2,     2,     2,    65,     2,    39,
192     30,    40,    31,    45,     2,     2,     2,     2,     2,     2,
193      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
194      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
195     56,     2,    61,    35,     2,     2,     2,     2,     2,     2,
196      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
197      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
198      2,     2,    63,    34,    64,    60,     2,     2,     2,     2,
199      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
200      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
201      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
202      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
203      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
204      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
205      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
206      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
207      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
208      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
209      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
210      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
211      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
212      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
213     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
214     26,    27,    29,    32,    33,    37,    38,    41,    42,    43,
215     44,    51,    52,    53,    54,    58
216 };
217
218 #if YYDEBUG != 0
219 static const short yyprhs[] = {     0,
220      0,     2,     4,     6,     8,    12,    15,    18,    21,    24,
221     27,    30,    33,    36,    39,    42,    46,    50,    55,    59,
222     63,    68,    73,    74,    80,    82,    83,    85,    89,    91,
223     95,   100,   105,   109,   113,   117,   121,   125,   129,   133,
224    137,   141,   145,   149,   153,   157,   161,   165,   169,   173,
225    177,   181,   185,   191,   195,   199,   201,   203,   205,   207,
226    209,   214,   216,   218,   220,   224,   228,   232,   237,   239,
227    242,   244,   246,   249,   252,   255,   259,   263,   265,   268,
228    270,   273,   275,   279,   282,   284,   287,   289,   292,   296,
229    299,   303,   305,   309,   311,   313,   315,   317,   320,   324,
230    327,   331,   335,   340,   343,   347,   349,   352,   355,   358,
231    361,   364,   367,   369,   372,   374,   380,   383,   386,   388,
232    390,   392,   394,   396,   400,   402,   404,   406,   408,   410
233 };
234
235 static const short yyrhs[] = {    68,
236      0,    67,     0,    82,     0,    69,     0,    68,    28,    69,
237      0,    48,    69,     0,    36,    69,     0,    47,    69,     0,
238     59,    69,     0,    60,    69,     0,    52,    69,     0,    53,
239     69,     0,    69,    52,     0,    69,    53,     0,    13,    69,
240      0,    69,    54,    86,     0,    69,    54,    76,     0,    69,
241     54,    48,    69,     0,    69,    55,    86,     0,    69,    55,
242     76,     0,    69,    55,    48,    69,     0,    69,    56,    68,
243     61,     0,     0,    69,    57,    70,    72,    62,     0,    63,
244      0,     0,    69,     0,    72,    28,    69,     0,    64,     0,
245     71,    72,    73,     0,    71,    82,    73,    69,     0,    57,
246     82,    62,    69,     0,    57,    68,    62,     0,    69,    45,
247     69,     0,    69,    48,    69,     0,    69,    49,    69,     0,
248     69,    50,    69,     0,    69,    46,    69,     0,    69,    47,
249     69,     0,    69,    43,    69,     0,    69,    44,    69,     0,
250     69,    37,    69,     0,    69,    38,    69,     0,    69,    41,
251     69,     0,    69,    42,    69,     0,    69,    39,    69,     0,
252     69,    40,    69,     0,    69,    36,    69,     0,    69,    35,
253     69,     0,    69,    34,    69,     0,    69,    33,    69,     0,
254     69,    32,    69,     0,    69,    31,    69,    65,    69,     0,
255     69,    30,    69,     0,    69,    26,    69,     0,     3,     0,
256      8,     0,     4,     0,    75,     0,    25,     0,    13,    57,
257     82,    62,     0,     5,     0,    27,     0,    58,     0,    74,
258     15,    86,     0,    74,    15,    86,     0,    83,    15,    86,
259      0,    83,    15,    60,    86,     0,    76,     0,    15,    86,
260      0,    87,     0,    83,     0,    83,    22,     0,    83,    23,
261      0,    83,    78,     0,    83,    22,    78,     0,    83,    23,
262     78,     0,    48,     0,    48,    78,     0,    36,     0,    36,
263     78,     0,    79,     0,    57,    78,    62,     0,    79,    80,
264      0,    80,     0,    79,    81,     0,    81,     0,    56,    61,
265      0,    56,     3,    61,     0,    57,    62,     0,    57,    85,
266     62,     0,    77,     0,    83,    15,    48,     0,     7,     0,
267     21,     0,    19,     0,    20,     0,    19,    21,     0,    14,
268     19,    21,     0,    19,    19,     0,    19,    19,    21,     0,
269     14,    19,    19,     0,    14,    19,    19,    21,     0,    20,
270     21,     0,    14,    20,    21,     0,    24,     0,    19,    24,
271      0,     9,    86,     0,    10,    86,     0,    11,    86,     0,
272     12,    86,     0,    14,    84,     0,    14,     0,    18,    84,
273      0,    18,     0,    16,    86,    39,    82,    40,     0,    22,
274     83,     0,    23,    83,     0,     7,     0,    21,     0,    19,
275      0,    20,     0,    82,     0,    85,    28,    82,     0,     6,
276      0,    58,     0,     7,     0,     8,     0,     6,     0,    58,
277      0
278 };
279
280 #endif
281
282 #if YYDEBUG != 0
283 static const short yyrline[] = { 0,
284    223,   224,   227,   234,   235,   240,   243,   246,   250,   254,
285    258,   262,   266,   270,   274,   278,   284,   291,   295,   302,
286    310,   314,   318,   322,   328,   332,   335,   339,   343,   346,
287    353,   359,   365,   371,   375,   379,   383,   387,   391,   395,
288    399,   403,   407,   411,   415,   419,   423,   427,   431,   435,
289    439,   443,   447,   451,   455,   461,   468,   479,   486,   489,
290    493,   501,   526,   533,   550,   561,   577,   590,   615,   616,
291    650,   708,   714,   715,   716,   718,   720,   724,   726,   728,
292    730,   732,   735,   737,   742,   749,   751,   755,   757,   761,
293    763,   775,   776,   781,   783,   785,   787,   789,   791,   793,
294    795,   797,   799,   801,   803,   805,   807,   809,   812,   815,
295    818,   821,   823,   825,   827,   829,   836,   837,   840,   841,
296    847,   853,   862,   867,   874,   875,   876,   877,   880,   881
297 };
298
299 static const char * const yytname[] = {   "$","error","$undefined.","INT","FLOAT",
300 "STRING","NAME","TYPENAME","NAME_OR_INT","STRUCT","CLASS","UNION","ENUM","SIZEOF",
301 "UNSIGNED","COLONCOLON","TEMPLATE","ERROR","SIGNED_KEYWORD","LONG","SHORT","INT_KEYWORD",
302 "CONST_KEYWORD","VOLATILE_KEYWORD","DOUBLE_KEYWORD","VARIABLE","ASSIGN_MODIFY",
303 "THIS","','","ABOVE_COMMA","'='","'?'","OROR","ANDAND","'|'","'^'","'&'","EQUAL",
304 "NOTEQUAL","'<'","'>'","LEQ","GEQ","LSH","RSH","'@'","'+'","'-'","'*'","'/'",
305 "'%'","UNARY","INCREMENT","DECREMENT","ARROW","'.'","'['","'('","BLOCKNAME",
306 "'!'","'~'","']'","')'","'{'","'}'","':'","start","type_exp","exp1","exp","@1",
307 "lcurly","arglist","rcurly","block","variable","qualified_name","ptype","abs_decl",
308 "direct_abs_decl","array_mod","func_mod","type","typebase","typename","nonempty_typelist",
309 "name","name_not_typename",""
310 };
311 #endif
312
313 static const short yyr1[] = {     0,
314     66,    66,    67,    68,    68,    69,    69,    69,    69,    69,
315     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
316     69,    69,    70,    69,    71,    72,    72,    72,    73,    69,
317     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
318     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
319     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
320     69,    69,    69,    74,    74,    75,    76,    76,    75,    75,
321     75,    77,    77,    77,    77,    77,    77,    78,    78,    78,
322     78,    78,    79,    79,    79,    79,    79,    80,    80,    81,
323     81,    82,    82,    83,    83,    83,    83,    83,    83,    83,
324     83,    83,    83,    83,    83,    83,    83,    83,    83,    83,
325     83,    83,    83,    83,    83,    83,    83,    83,    84,    84,
326     84,    84,    85,    85,    86,    86,    86,    86,    87,    87
327 };
328
329 static const short yyr2[] = {     0,
330      1,     1,     1,     1,     3,     2,     2,     2,     2,     2,
331      2,     2,     2,     2,     2,     3,     3,     4,     3,     3,
332      4,     4,     0,     5,     1,     0,     1,     3,     1,     3,
333      4,     4,     3,     3,     3,     3,     3,     3,     3,     3,
334      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
335      3,     3,     5,     3,     3,     1,     1,     1,     1,     1,
336      4,     1,     1,     1,     3,     3,     3,     4,     1,     2,
337      1,     1,     2,     2,     2,     3,     3,     1,     2,     1,
338      2,     1,     3,     2,     1,     2,     1,     2,     3,     2,
339      3,     1,     3,     1,     1,     1,     1,     2,     3,     2,
340      3,     3,     4,     2,     3,     1,     2,     2,     2,     2,
341      2,     2,     1,     2,     1,     5,     2,     2,     1,     1,
342      1,     1,     1,     3,     1,     1,     1,     1,     1,     1
343 };
344
345 static const short yydefact[] = {     0,
346     56,    58,    62,   129,    94,    57,     0,     0,     0,     0,
347      0,   113,     0,     0,   115,    96,    97,    95,     0,     0,
348    106,    60,    63,     0,     0,     0,     0,     0,     0,   130,
349      0,     0,    25,     2,     1,     4,    26,     0,    59,    69,
350     92,     3,    72,    71,   125,   127,   128,   126,   108,   109,
351    110,   111,     0,    15,     0,   119,   121,   122,   120,   112,
352     70,     0,   121,   122,   114,   100,    98,   107,   104,   117,
353    118,     7,     8,     6,    11,    12,     0,     0,     9,    10,
354      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
355      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
356      0,     0,     0,    13,    14,     0,     0,     0,    23,    27,
357      0,     0,     0,     0,    73,    74,    80,    78,     0,     0,
358     75,    82,    85,    87,     0,     0,   102,    99,   105,     0,
359    101,    33,     0,     5,    55,    54,     0,    52,    51,    50,
360     49,    48,    42,    43,    46,    47,    44,    45,    40,    41,
361     34,    38,    39,    35,    36,    37,   127,     0,    17,    16,
362      0,    20,    19,     0,    26,     0,    29,    30,     0,    66,
363     93,     0,    67,    76,    77,    81,    79,     0,    88,    90,
364      0,   123,    72,     0,     0,    84,    86,    61,   103,     0,
365     32,     0,    18,    21,    22,     0,    28,    31,    68,    89,
366     83,     0,     0,    91,   116,    53,    24,   124,     0,     0,
367      0
368 };
369
370 static const short yydefgoto[] = {   209,
371     34,    77,    36,   165,    37,   111,   168,    38,    39,    40,
372     41,   121,   122,   123,   124,   182,    55,    60,   184,   173,
373     44
374 };
375
376 static const short yypact[] = {   241,
377 -32768,-32768,-32768,-32768,-32768,-32768,     5,     5,     5,     5,
378    302,    24,     5,     5,    73,    66,    27,-32768,   212,   212,
379 -32768,-32768,-32768,   241,   241,   241,   241,   241,   241,    32,
380    241,   241,-32768,-32768,    -1,   523,   241,    42,-32768,-32768,
381 -32768,-32768,     3,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
382 -32768,-32768,   241,    43,    52,-32768,    70,    50,-32768,-32768,
383 -32768,    64,-32768,-32768,-32768,    60,-32768,-32768,-32768,-32768,
384 -32768,    43,    43,    43,    43,    43,    -7,    44,    43,    43,
385    241,   241,   241,   241,   241,   241,   241,   241,   241,   241,
386    241,   241,   241,   241,   241,   241,   241,   241,   241,   241,
387    241,   241,   241,-32768,-32768,   439,   458,   241,-32768,   523,
388    -18,    41,     5,     8,    16,    16,    16,    16,     4,   382,
389 -32768,   -34,-32768,-32768,    45,    26,    83,-32768,-32768,   212,
390 -32768,-32768,   241,   523,   523,   523,   487,   575,   599,   622,
391    644,   665,   684,   684,   143,   143,   143,   143,   226,   226,
392     69,   287,   287,    43,    43,    43,    94,   241,-32768,-32768,
393    241,-32768,-32768,   -11,   241,   241,-32768,-32768,   241,    95,
394 -32768,     5,-32768,-32768,-32768,-32768,-32768,    67,-32768,-32768,
395     49,-32768,    13,    -4,   152,-32768,-32768,   363,-32768,    72,
396     43,   241,    43,    43,-32768,    12,   523,    43,-32768,-32768,
397 -32768,    65,   212,-32768,-32768,   550,-32768,-32768,   127,   129,
398 -32768
399 };
400
401 static const short yypgoto[] = {-32768,
402 -32768,     6,    51,-32768,-32768,    14,    53,-32768,-32768,   -65,
403 -32768,    40,-32768,    47,    55,     1,     0,   163,-32768,    -5,
404 -32768
405 };
406
407
408 #define YYLAST          741
409
410
411 static const short yytable[] = {    43,
412     42,    49,    50,    51,    52,    35,   178,    61,    62,   166,
413     45,    46,    47,    45,    46,    47,    81,   114,    70,    71,
414     81,   119,   185,   203,   115,   116,    81,   202,    43,    78,
415     56,    45,    46,    47,   115,   116,    43,   112,   117,   166,
416    159,   162,    57,    58,    59,   167,   -64,    69,   117,   195,
417    118,   117,    43,   125,   132,   171,   113,   204,   119,   120,
418    118,    54,    48,   118,   179,    48,   126,   172,   119,   120,
419    129,   119,   120,   207,    72,    73,    74,    75,    76,    56,
420    131,    79,    80,    48,    66,   172,    67,   110,   127,    68,
421    128,    63,    64,    59,   104,   105,   106,   107,   108,   109,
422    160,   163,   130,   189,   167,   133,   188,   170,   -94,   -65,
423    201,   205,   171,   164,    99,   100,   101,   102,   103,   183,
424    104,   105,   106,   107,   108,   109,   210,   200,   211,   183,
425    190,   134,   135,   136,   137,   138,   139,   140,   141,   142,
426    143,   144,   145,   146,   147,   148,   149,   150,   151,   152,
427    153,   154,   155,   156,   174,   175,   176,   177,     5,   181,
428      7,     8,     9,    10,   169,    12,   199,    14,   186,    15,
429     16,    17,    18,    19,    20,    21,   187,    65,   196,     0,
430      0,     0,     0,   191,   183,    96,    97,    98,    99,   100,
431    101,   102,   103,     0,   104,   105,   106,   107,   108,   109,
432      0,     0,   183,   208,     0,     0,     0,     0,   193,     0,
433      0,   194,     0,   180,     0,   110,   197,     0,     5,   198,
434      7,     8,     9,    10,     0,    12,     0,    14,     0,    15,
435     16,    17,    18,    19,    20,    21,     0,     0,   191,     0,
436      0,     0,   206,     1,     2,     3,     4,     5,     6,     7,
437      8,     9,    10,    11,    12,    13,    14,     0,    15,    16,
438     17,    18,    19,    20,    21,    22,     0,    23,     0,     0,
439     98,    99,   100,   101,   102,   103,    24,   104,   105,   106,
440    107,   108,   109,     0,     0,     0,     0,    25,    26,     0,
441      0,     0,    27,    28,     0,     0,     0,    29,    30,    31,
442     32,     0,     0,    33,     1,     2,     3,     4,     5,     6,
443      7,     8,     9,    10,    11,    12,    13,    14,     0,    15,
444     16,    17,    18,    19,    20,    21,    22,     0,    23,     0,
445      0,     0,     0,     0,   101,   102,   103,    24,   104,   105,
446    106,   107,   108,   109,     0,     0,     0,     0,    25,    26,
447      0,     0,     0,    27,    28,     0,     0,     0,    53,    30,
448     31,    32,     0,     0,    33,     1,     2,     3,     4,     5,
449      6,     7,     8,     9,    10,    11,    12,    13,    14,     0,
450     15,    16,    17,    18,    19,    20,    21,    22,     5,    23,
451      7,     8,     9,    10,     0,    12,     0,    14,     0,    15,
452     16,    17,    18,    19,    20,    21,     0,     0,     0,     0,
453      0,     0,     0,     0,    27,    28,     0,   117,     0,    29,
454     30,    31,    32,     0,     0,    33,     0,     0,     0,   118,
455      0,     0,     0,     0,     0,     0,     0,   119,   120,     0,
456      0,     0,     0,   180,    45,   157,    47,     7,     8,     9,
457     10,     0,    12,     0,    14,     0,    15,    16,    17,    18,
458     19,    20,    21,    45,   157,    47,     7,     8,     9,    10,
459      0,    12,     0,    14,     0,    15,    16,    17,    18,    19,
460     20,    21,     0,     0,     0,     0,   158,     0,     0,     0,
461      0,     0,     0,     0,     0,     0,    48,     0,     0,     0,
462      0,     0,     0,     0,     0,   161,     0,     0,     0,     0,
463      0,     0,    82,     0,     0,    48,    83,    84,    85,    86,
464     87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
465     97,    98,    99,   100,   101,   102,   103,     0,   104,   105,
466    106,   107,   108,   109,     0,     0,     0,     0,    82,     0,
467      0,   192,    83,    84,    85,    86,    87,    88,    89,    90,
468     91,    92,    93,    94,    95,    96,    97,    98,    99,   100,
469    101,   102,   103,     0,   104,   105,   106,   107,   108,   109,
470     84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
471     94,    95,    96,    97,    98,    99,   100,   101,   102,   103,
472      0,   104,   105,   106,   107,   108,   109,    86,    87,    88,
473     89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
474     99,   100,   101,   102,   103,     0,   104,   105,   106,   107,
475    108,   109,    87,    88,    89,    90,    91,    92,    93,    94,
476     95,    96,    97,    98,    99,   100,   101,   102,   103,     0,
477    104,   105,   106,   107,   108,   109,    88,    89,    90,    91,
478     92,    93,    94,    95,    96,    97,    98,    99,   100,   101,
479    102,   103,     0,   104,   105,   106,   107,   108,   109,    89,
480     90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
481    100,   101,   102,   103,     0,   104,   105,   106,   107,   108,
482    109,    90,    91,    92,    93,    94,    95,    96,    97,    98,
483     99,   100,   101,   102,   103,     0,   104,   105,   106,   107,
484    108,   109,    92,    93,    94,    95,    96,    97,    98,    99,
485    100,   101,   102,   103,     0,   104,   105,   106,   107,   108,
486    109
487 };
488
489 static const short yycheck[] = {     0,
490      0,     7,     8,     9,    10,     0,     3,    13,    14,    28,
491      6,     7,     8,     6,     7,     8,    28,    15,    19,    20,
492     28,    56,    57,    28,    22,    23,    28,    15,    29,    29,
493      7,     6,     7,     8,    22,    23,    37,    37,    36,    28,
494    106,   107,    19,    20,    21,    64,    15,    21,    36,    61,
495     48,    36,    53,    53,    62,    48,    15,    62,    56,    57,
496     48,    11,    58,    48,    61,    58,    15,    60,    56,    57,
497     21,    56,    57,    62,    24,    25,    26,    27,    28,     7,
498     21,    31,    32,    58,    19,    60,    21,    37,    19,    24,
499     21,    19,    20,    21,    52,    53,    54,    55,    56,    57,
500    106,   107,    39,    21,    64,    62,    62,   113,    15,    15,
501     62,    40,    48,   108,    46,    47,    48,    49,    50,   120,
502     52,    53,    54,    55,    56,    57,     0,    61,     0,   130,
503    130,    81,    82,    83,    84,    85,    86,    87,    88,    89,
504     90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
505    100,   101,   102,   103,   115,   116,   117,   118,     7,   120,
506      9,    10,    11,    12,   112,    14,   172,    16,   122,    18,
507     19,    20,    21,    22,    23,    24,   122,    15,   165,    -1,
508     -1,    -1,    -1,   133,   185,    43,    44,    45,    46,    47,
509     48,    49,    50,    -1,    52,    53,    54,    55,    56,    57,
510     -1,    -1,   203,   203,    -1,    -1,    -1,    -1,   158,    -1,
511     -1,   161,    -1,    62,    -1,   165,   166,    -1,     7,   169,
512      9,    10,    11,    12,    -1,    14,    -1,    16,    -1,    18,
513     19,    20,    21,    22,    23,    24,    -1,    -1,   188,    -1,
514     -1,    -1,   192,     3,     4,     5,     6,     7,     8,     9,
515     10,    11,    12,    13,    14,    15,    16,    -1,    18,    19,
516     20,    21,    22,    23,    24,    25,    -1,    27,    -1,    -1,
517     45,    46,    47,    48,    49,    50,    36,    52,    53,    54,
518     55,    56,    57,    -1,    -1,    -1,    -1,    47,    48,    -1,
519     -1,    -1,    52,    53,    -1,    -1,    -1,    57,    58,    59,
520     60,    -1,    -1,    63,     3,     4,     5,     6,     7,     8,
521      9,    10,    11,    12,    13,    14,    15,    16,    -1,    18,
522     19,    20,    21,    22,    23,    24,    25,    -1,    27,    -1,
523     -1,    -1,    -1,    -1,    48,    49,    50,    36,    52,    53,
524     54,    55,    56,    57,    -1,    -1,    -1,    -1,    47,    48,
525     -1,    -1,    -1,    52,    53,    -1,    -1,    -1,    57,    58,
526     59,    60,    -1,    -1,    63,     3,     4,     5,     6,     7,
527      8,     9,    10,    11,    12,    13,    14,    15,    16,    -1,
528     18,    19,    20,    21,    22,    23,    24,    25,     7,    27,
529      9,    10,    11,    12,    -1,    14,    -1,    16,    -1,    18,
530     19,    20,    21,    22,    23,    24,    -1,    -1,    -1,    -1,
531     -1,    -1,    -1,    -1,    52,    53,    -1,    36,    -1,    57,
532     58,    59,    60,    -1,    -1,    63,    -1,    -1,    -1,    48,
533     -1,    -1,    -1,    -1,    -1,    -1,    -1,    56,    57,    -1,
534     -1,    -1,    -1,    62,     6,     7,     8,     9,    10,    11,
535     12,    -1,    14,    -1,    16,    -1,    18,    19,    20,    21,
536     22,    23,    24,     6,     7,     8,     9,    10,    11,    12,
537     -1,    14,    -1,    16,    -1,    18,    19,    20,    21,    22,
538     23,    24,    -1,    -1,    -1,    -1,    48,    -1,    -1,    -1,
539     -1,    -1,    -1,    -1,    -1,    -1,    58,    -1,    -1,    -1,
540     -1,    -1,    -1,    -1,    -1,    48,    -1,    -1,    -1,    -1,
541     -1,    -1,    26,    -1,    -1,    58,    30,    31,    32,    33,
542     34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
543     44,    45,    46,    47,    48,    49,    50,    -1,    52,    53,
544     54,    55,    56,    57,    -1,    -1,    -1,    -1,    26,    -1,
545     -1,    65,    30,    31,    32,    33,    34,    35,    36,    37,
546     38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
547     48,    49,    50,    -1,    52,    53,    54,    55,    56,    57,
548     31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
549     41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
550     -1,    52,    53,    54,    55,    56,    57,    33,    34,    35,
551     36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
552     46,    47,    48,    49,    50,    -1,    52,    53,    54,    55,
553     56,    57,    34,    35,    36,    37,    38,    39,    40,    41,
554     42,    43,    44,    45,    46,    47,    48,    49,    50,    -1,
555     52,    53,    54,    55,    56,    57,    35,    36,    37,    38,
556     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
557     49,    50,    -1,    52,    53,    54,    55,    56,    57,    36,
558     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
559     47,    48,    49,    50,    -1,    52,    53,    54,    55,    56,
560     57,    37,    38,    39,    40,    41,    42,    43,    44,    45,
561     46,    47,    48,    49,    50,    -1,    52,    53,    54,    55,
562     56,    57,    39,    40,    41,    42,    43,    44,    45,    46,
563     47,    48,    49,    50,    -1,    52,    53,    54,    55,    56,
564     57
565 };
566 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
567 #line 3 "/usr/unsupported/share/bison.simple"
568
569 /* Skeleton output parser for bison,
570    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
571
572    This program is free software; you can redistribute it and/or modify
573    it under the terms of the GNU General Public License as published by
574    the Free Software Foundation; either version 2, or (at your option)
575    any later version.
576
577    This program is distributed in the hope that it will be useful,
578    but WITHOUT ANY WARRANTY; without even the implied warranty of
579    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
580    GNU General Public License for more details.
581
582    You should have received a copy of the GNU General Public License
583    along with this program; if not, write to the Free Software
584    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
585
586 /* As a special exception, when this file is copied by Bison into a
587    Bison output file, you may use that output file without restriction.
588    This special exception was added by the Free Software Foundation
589    in version 1.24 of Bison.  */
590
591 #ifndef alloca
592 #ifdef __GNUC__
593 #define alloca __builtin_alloca
594 #else /* not GNU C.  */
595 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
596 #include <alloca.h>
597 #else /* not sparc */
598 #if defined (MSDOS) && !defined (__TURBOC__)
599 #else /* not MSDOS, or __TURBOC__ */
600 #if defined(_AIX)
601  #pragma alloca
602 #else /* not MSDOS, __TURBOC__, or _AIX */
603 #ifdef __hpux
604 #ifdef __cplusplus
605 extern "C" {
606 void *alloca (unsigned int);
607 };
608 #else /* not __cplusplus */
609 void *alloca ();
610 #endif /* not __cplusplus */
611 #endif /* __hpux */
612 #endif /* not _AIX */
613 #endif /* not MSDOS, or __TURBOC__ */
614 #endif /* not sparc.  */
615 #endif /* not GNU C.  */
616 #endif /* alloca not defined.  */
617
618 /* This is the parser code that is written into each bison parser
619   when the %semantic_parser declaration is not specified in the grammar.
620   It was written by Richard Stallman by simplifying the hairy parser
621   used when %semantic_parser is specified.  */
622
623 /* Note: there must be only one dollar sign in this file.
624    It is replaced by the list of actions, each action
625    as one case of the switch.  */
626
627 #define yyerrok         (yyerrstatus = 0)
628 #define yyclearin       (yychar = YYEMPTY)
629 #define YYEMPTY         -2
630 #define YYEOF           0
631 #define YYACCEPT        return(0)
632 #define YYABORT         return(1)
633 #define YYERROR         goto yyerrlab1
634 /* Like YYERROR except do call yyerror.
635    This remains here temporarily to ease the
636    transition to the new meaning of YYERROR, for GCC.
637    Once GCC version 2 has supplanted version 1, this can go.  */
638 #define YYFAIL          goto yyerrlab
639 #define YYRECOVERING()  (!!yyerrstatus)
640 #define YYBACKUP(token, value) \
641 do                                                              \
642   if (yychar == YYEMPTY && yylen == 1)                          \
643     { yychar = (token), yylval = (value);                       \
644       yychar1 = YYTRANSLATE (yychar);                           \
645       YYPOPSTACK;                                               \
646       goto yybackup;                                            \
647     }                                                           \
648   else                                                          \
649     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
650 while (0)
651
652 #define YYTERROR        1
653 #define YYERRCODE       256
654
655 #ifndef YYPURE
656 #define YYLEX           yylex()
657 #endif
658
659 #ifdef YYPURE
660 #ifdef YYLSP_NEEDED
661 #ifdef YYLEX_PARAM
662 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
663 #else
664 #define YYLEX           yylex(&yylval, &yylloc)
665 #endif
666 #else /* not YYLSP_NEEDED */
667 #ifdef YYLEX_PARAM
668 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
669 #else
670 #define YYLEX           yylex(&yylval)
671 #endif
672 #endif /* not YYLSP_NEEDED */
673 #endif
674
675 /* If nonreentrant, generate the variables here */
676
677 #ifndef YYPURE
678
679 int     yychar;                 /*  the lookahead symbol                */
680 YYSTYPE yylval;                 /*  the semantic value of the           */
681                                 /*  lookahead symbol                    */
682
683 #ifdef YYLSP_NEEDED
684 YYLTYPE yylloc;                 /*  location data for the lookahead     */
685                                 /*  symbol                              */
686 #endif
687
688 int yynerrs;                    /*  number of parse errors so far       */
689 #endif  /* not YYPURE */
690
691 #if YYDEBUG != 0
692 int yydebug;                    /*  nonzero means print parse trace     */
693 /* Since this is uninitialized, it does not stop multiple parsers
694    from coexisting.  */
695 #endif
696
697 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
698
699 #ifndef YYINITDEPTH
700 #define YYINITDEPTH 200
701 #endif
702
703 /*  YYMAXDEPTH is the maximum size the stacks can grow to
704     (effective only if the built-in stack extension method is used).  */
705
706 #if YYMAXDEPTH == 0
707 #undef YYMAXDEPTH
708 #endif
709
710 #ifndef YYMAXDEPTH
711 #define YYMAXDEPTH 10000
712 #endif
713
714 /* Prevent warning if -Wstrict-prototypes.  */
715 #ifdef __GNUC__
716 int yyparse (void);
717 #endif
718 \f
719 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
720 #define __yy_memcpy(FROM,TO,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
721 #else                           /* not GNU C or C++ */
722 #ifndef __cplusplus
723
724 /* This is the most reliable way to avoid incompatibilities
725    in available built-in functions on various systems.  */
726 static void
727 __yy_memcpy (from, to, count)
728      char *from;
729      char *to;
730      int count;
731 {
732   register char *f = from;
733   register char *t = to;
734   register int i = count;
735
736   while (i-- > 0)
737     *t++ = *f++;
738 }
739
740 #else /* __cplusplus */
741
742 /* This is the most reliable way to avoid incompatibilities
743    in available built-in functions on various systems.  */
744 static void
745 __yy_memcpy (char *from, char *to, int count)
746 {
747   register char *f = from;
748   register char *t = to;
749   register int i = count;
750
751   while (i-- > 0)
752     *t++ = *f++;
753 }
754
755 #endif
756 #endif
757 \f
758 #line 192 "/usr/unsupported/share/bison.simple"
759
760 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
761    into yyparse.  The argument should have type void *.
762    It should actually point to an object.
763    Grammar actions can access the variable by casting it
764    to the proper pointer type.  */
765
766 #ifdef YYPARSE_PARAM
767 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
768 #else
769 #define YYPARSE_PARAM
770 #define YYPARSE_PARAM_DECL
771 #endif
772
773 int
774 yyparse(YYPARSE_PARAM)
775      YYPARSE_PARAM_DECL
776 {
777   register int yystate;
778   register int yyn;
779   register short *yyssp;
780   register YYSTYPE *yyvsp;
781   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
782   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
783
784   short yyssa[YYINITDEPTH];     /*  the state stack                     */
785   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
786
787   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
788   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to xreallocate them elsewhere */
789
790 #ifdef YYLSP_NEEDED
791   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
792   YYLTYPE *yyls = yylsa;
793   YYLTYPE *yylsp;
794
795 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
796 #else
797 #define YYPOPSTACK   (yyvsp--, yyssp--)
798 #endif
799
800   int yystacksize = YYINITDEPTH;
801
802 #ifdef YYPURE
803   int yychar;
804   YYSTYPE yylval;
805   int yynerrs;
806 #ifdef YYLSP_NEEDED
807   YYLTYPE yylloc;
808 #endif
809 #endif
810
811   YYSTYPE yyval;                /*  the variable used to return         */
812                                 /*  semantic values from the action     */
813                                 /*  routines                            */
814
815   int yylen;
816
817 #if YYDEBUG != 0
818   if (yydebug)
819     fprintf(stderr, "Starting parse\n");
820 #endif
821
822   yystate = 0;
823   yyerrstatus = 0;
824   yynerrs = 0;
825   yychar = YYEMPTY;             /* Cause a token to be read.  */
826
827   /* Initialize stack pointers.
828      Waste one element of value and location stack
829      so that they stay on the same level as the state stack.
830      The wasted elements are never initialized.  */
831
832   yyssp = yyss - 1;
833   yyvsp = yyvs;
834 #ifdef YYLSP_NEEDED
835   yylsp = yyls;
836 #endif
837
838 /* Push a new state, which is found in  yystate  .  */
839 /* In all cases, when you get here, the value and location stacks
840    have just been pushed. so pushing a state here evens the stacks.  */
841 yynewstate:
842
843   *++yyssp = yystate;
844
845   if (yyssp >= yyss + yystacksize - 1)
846     {
847       /* Give user a chance to xreallocate the stack */
848       /* Use copies of these so that the &'s don't force the real ones into memory. */
849       YYSTYPE *yyvs1 = yyvs;
850       short *yyss1 = yyss;
851 #ifdef YYLSP_NEEDED
852       YYLTYPE *yyls1 = yyls;
853 #endif
854
855       /* Get the current used size of the three stacks, in elements.  */
856       int size = yyssp - yyss + 1;
857
858 #ifdef yyoverflow
859       /* Each stack pointer address is followed by the size of
860          the data in use in that stack, in bytes.  */
861 #ifdef YYLSP_NEEDED
862       /* This used to be a conditional around just the two extra args,
863          but that might be undefined if yyoverflow is a macro.  */
864       yyoverflow("parser stack overflow",
865                  &yyss1, size * sizeof (*yyssp),
866                  &yyvs1, size * sizeof (*yyvsp),
867                  &yyls1, size * sizeof (*yylsp),
868                  &yystacksize);
869 #else
870       yyoverflow("parser stack overflow",
871                  &yyss1, size * sizeof (*yyssp),
872                  &yyvs1, size * sizeof (*yyvsp),
873                  &yystacksize);
874 #endif
875
876       yyss = yyss1; yyvs = yyvs1;
877 #ifdef YYLSP_NEEDED
878       yyls = yyls1;
879 #endif
880 #else /* no yyoverflow */
881       /* Extend the stack our own way.  */
882       if (yystacksize >= YYMAXDEPTH)
883         {
884           yyerror("parser stack overflow");
885           return 2;
886         }
887       yystacksize *= 2;
888       if (yystacksize > YYMAXDEPTH)
889         yystacksize = YYMAXDEPTH;
890       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
891       __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
892       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
893       __yy_memcpy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
894 #ifdef YYLSP_NEEDED
895       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
896       __yy_memcpy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
897 #endif
898 #endif /* no yyoverflow */
899
900       yyssp = yyss + size - 1;
901       yyvsp = yyvs + size - 1;
902 #ifdef YYLSP_NEEDED
903       yylsp = yyls + size - 1;
904 #endif
905
906 #if YYDEBUG != 0
907       if (yydebug)
908         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
909 #endif
910
911       if (yyssp >= yyss + yystacksize - 1)
912         YYABORT;
913     }
914
915 #if YYDEBUG != 0
916   if (yydebug)
917     fprintf(stderr, "Entering state %d\n", yystate);
918 #endif
919
920   goto yybackup;
921  yybackup:
922
923 /* Do appropriate processing given the current state.  */
924 /* Read a lookahead token if we need one and don't already have one.  */
925 /* yyresume: */
926
927   /* First try to decide what to do without reference to lookahead token.  */
928
929   yyn = yypact[yystate];
930   if (yyn == YYFLAG)
931     goto yydefault;
932
933   /* Not known => get a lookahead token if don't already have one.  */
934
935   /* yychar is either YYEMPTY or YYEOF
936      or a valid token in external form.  */
937
938   if (yychar == YYEMPTY)
939     {
940 #if YYDEBUG != 0
941       if (yydebug)
942         fprintf(stderr, "Reading a token: ");
943 #endif
944       yychar = YYLEX;
945     }
946
947   /* Convert token to internal form (in yychar1) for indexing tables with */
948
949   if (yychar <= 0)              /* This means end of input. */
950     {
951       yychar1 = 0;
952       yychar = YYEOF;           /* Don't call YYLEX any more */
953
954 #if YYDEBUG != 0
955       if (yydebug)
956         fprintf(stderr, "Now at end of input.\n");
957 #endif
958     }
959   else
960     {
961       yychar1 = YYTRANSLATE(yychar);
962
963 #if YYDEBUG != 0
964       if (yydebug)
965         {
966           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
967           /* Give the individual parser a way to print the precise meaning
968              of a token, for further debugging info.  */
969 #ifdef YYPRINT
970           YYPRINT (stderr, yychar, yylval);
971 #endif
972           fprintf (stderr, ")\n");
973         }
974 #endif
975     }
976
977   yyn += yychar1;
978   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
979     goto yydefault;
980
981   yyn = yytable[yyn];
982
983   /* yyn is what to do for this token type in this state.
984      Negative => reduce, -yyn is rule number.
985      Positive => shift, yyn is new state.
986        New state is final state => don't bother to shift,
987        just return success.
988      0, or most negative number => error.  */
989
990   if (yyn < 0)
991     {
992       if (yyn == YYFLAG)
993         goto yyerrlab;
994       yyn = -yyn;
995       goto yyreduce;
996     }
997   else if (yyn == 0)
998     goto yyerrlab;
999
1000   if (yyn == YYFINAL)
1001     YYACCEPT;
1002
1003   /* Shift the lookahead token.  */
1004
1005 #if YYDEBUG != 0
1006   if (yydebug)
1007     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1008 #endif
1009
1010   /* Discard the token being shifted unless it is eof.  */
1011   if (yychar != YYEOF)
1012     yychar = YYEMPTY;
1013
1014   *++yyvsp = yylval;
1015 #ifdef YYLSP_NEEDED
1016   *++yylsp = yylloc;
1017 #endif
1018
1019   /* count tokens shifted since error; after three, turn off error status.  */
1020   if (yyerrstatus) yyerrstatus--;
1021
1022   yystate = yyn;
1023   goto yynewstate;
1024
1025 /* Do the default action for the current state.  */
1026 yydefault:
1027
1028   yyn = yydefact[yystate];
1029   if (yyn == 0)
1030     goto yyerrlab;
1031
1032 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
1033 yyreduce:
1034   yylen = yyr2[yyn];
1035   if (yylen > 0)
1036     yyval = yyvsp[1-yylen]; /* implement default value of the action */
1037
1038 #if YYDEBUG != 0
1039   if (yydebug)
1040     {
1041       int i;
1042
1043       fprintf (stderr, "Reducing via rule %d (line %d), ",
1044                yyn, yyrline[yyn]);
1045
1046       /* Print the symbols being reduced, and their result.  */
1047       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1048         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1049       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1050     }
1051 #endif
1052
1053
1054   switch (yyn) {
1055
1056 case 3:
1057 #line 228 "./c-exp.y"
1058 { write_exp_elt_opcode(OP_TYPE);
1059                           write_exp_elt_type(yyvsp[0].tval);
1060                           write_exp_elt_opcode(OP_TYPE);;
1061     break;}
1062 case 5:
1063 #line 236 "./c-exp.y"
1064 { write_exp_elt_opcode (BINOP_COMMA); ;
1065     break;}
1066 case 6:
1067 #line 241 "./c-exp.y"
1068 { write_exp_elt_opcode (UNOP_IND); ;
1069     break;}
1070 case 7:
1071 #line 244 "./c-exp.y"
1072 { write_exp_elt_opcode (UNOP_ADDR); ;
1073     break;}
1074 case 8:
1075 #line 247 "./c-exp.y"
1076 { write_exp_elt_opcode (UNOP_NEG); ;
1077     break;}
1078 case 9:
1079 #line 251 "./c-exp.y"
1080 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1081     break;}
1082 case 10:
1083 #line 255 "./c-exp.y"
1084 { write_exp_elt_opcode (UNOP_COMPLEMENT); ;
1085     break;}
1086 case 11:
1087 #line 259 "./c-exp.y"
1088 { write_exp_elt_opcode (UNOP_PREINCREMENT); ;
1089     break;}
1090 case 12:
1091 #line 263 "./c-exp.y"
1092 { write_exp_elt_opcode (UNOP_PREDECREMENT); ;
1093     break;}
1094 case 13:
1095 #line 267 "./c-exp.y"
1096 { write_exp_elt_opcode (UNOP_POSTINCREMENT); ;
1097     break;}
1098 case 14:
1099 #line 271 "./c-exp.y"
1100 { write_exp_elt_opcode (UNOP_POSTDECREMENT); ;
1101     break;}
1102 case 15:
1103 #line 275 "./c-exp.y"
1104 { write_exp_elt_opcode (UNOP_SIZEOF); ;
1105     break;}
1106 case 16:
1107 #line 279 "./c-exp.y"
1108 { write_exp_elt_opcode (STRUCTOP_PTR);
1109                           write_exp_string (yyvsp[0].sval);
1110                           write_exp_elt_opcode (STRUCTOP_PTR); ;
1111     break;}
1112 case 17:
1113 #line 285 "./c-exp.y"
1114 { /* exp->type::name becomes exp->*(&type::name) */
1115                           /* Note: this doesn't work if name is a
1116                              static member!  FIXME */
1117                           write_exp_elt_opcode (UNOP_ADDR);
1118                           write_exp_elt_opcode (STRUCTOP_MPTR); ;
1119     break;}
1120 case 18:
1121 #line 292 "./c-exp.y"
1122 { write_exp_elt_opcode (STRUCTOP_MPTR); ;
1123     break;}
1124 case 19:
1125 #line 296 "./c-exp.y"
1126 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1127                           write_exp_string (yyvsp[0].sval);
1128                           write_exp_elt_opcode (STRUCTOP_STRUCT); ;
1129     break;}
1130 case 20:
1131 #line 303 "./c-exp.y"
1132 { /* exp.type::name becomes exp.*(&type::name) */
1133                           /* Note: this doesn't work if name is a
1134                              static member!  FIXME */
1135                           write_exp_elt_opcode (UNOP_ADDR);
1136                           write_exp_elt_opcode (STRUCTOP_MEMBER); ;
1137     break;}
1138 case 21:
1139 #line 311 "./c-exp.y"
1140 { write_exp_elt_opcode (STRUCTOP_MEMBER); ;
1141     break;}
1142 case 22:
1143 #line 315 "./c-exp.y"
1144 { write_exp_elt_opcode (BINOP_SUBSCRIPT); ;
1145     break;}
1146 case 23:
1147 #line 321 "./c-exp.y"
1148 { start_arglist (); ;
1149     break;}
1150 case 24:
1151 #line 323 "./c-exp.y"
1152 { write_exp_elt_opcode (OP_FUNCALL);
1153                           write_exp_elt_longcst ((LONGEST) end_arglist ());
1154                           write_exp_elt_opcode (OP_FUNCALL); ;
1155     break;}
1156 case 25:
1157 #line 329 "./c-exp.y"
1158 { start_arglist (); ;
1159     break;}
1160 case 27:
1161 #line 336 "./c-exp.y"
1162 { arglist_len = 1; ;
1163     break;}
1164 case 28:
1165 #line 340 "./c-exp.y"
1166 { arglist_len++; ;
1167     break;}
1168 case 29:
1169 #line 344 "./c-exp.y"
1170 { yyval.lval = end_arglist () - 1; ;
1171     break;}
1172 case 30:
1173 #line 347 "./c-exp.y"
1174 { write_exp_elt_opcode (OP_ARRAY);
1175                           write_exp_elt_longcst ((LONGEST) 0);
1176                           write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1177                           write_exp_elt_opcode (OP_ARRAY); ;
1178     break;}
1179 case 31:
1180 #line 354 "./c-exp.y"
1181 { write_exp_elt_opcode (UNOP_MEMVAL);
1182                           write_exp_elt_type (yyvsp[-2].tval);
1183                           write_exp_elt_opcode (UNOP_MEMVAL); ;
1184     break;}
1185 case 32:
1186 #line 360 "./c-exp.y"
1187 { write_exp_elt_opcode (UNOP_CAST);
1188                           write_exp_elt_type (yyvsp[-2].tval);
1189                           write_exp_elt_opcode (UNOP_CAST); ;
1190     break;}
1191 case 33:
1192 #line 366 "./c-exp.y"
1193 { ;
1194     break;}
1195 case 34:
1196 #line 372 "./c-exp.y"
1197 { write_exp_elt_opcode (BINOP_REPEAT); ;
1198     break;}
1199 case 35:
1200 #line 376 "./c-exp.y"
1201 { write_exp_elt_opcode (BINOP_MUL); ;
1202     break;}
1203 case 36:
1204 #line 380 "./c-exp.y"
1205 { write_exp_elt_opcode (BINOP_DIV); ;
1206     break;}
1207 case 37:
1208 #line 384 "./c-exp.y"
1209 { write_exp_elt_opcode (BINOP_REM); ;
1210     break;}
1211 case 38:
1212 #line 388 "./c-exp.y"
1213 { write_exp_elt_opcode (BINOP_ADD); ;
1214     break;}
1215 case 39:
1216 #line 392 "./c-exp.y"
1217 { write_exp_elt_opcode (BINOP_SUB); ;
1218     break;}
1219 case 40:
1220 #line 396 "./c-exp.y"
1221 { write_exp_elt_opcode (BINOP_LSH); ;
1222     break;}
1223 case 41:
1224 #line 400 "./c-exp.y"
1225 { write_exp_elt_opcode (BINOP_RSH); ;
1226     break;}
1227 case 42:
1228 #line 404 "./c-exp.y"
1229 { write_exp_elt_opcode (BINOP_EQUAL); ;
1230     break;}
1231 case 43:
1232 #line 408 "./c-exp.y"
1233 { write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1234     break;}
1235 case 44:
1236 #line 412 "./c-exp.y"
1237 { write_exp_elt_opcode (BINOP_LEQ); ;
1238     break;}
1239 case 45:
1240 #line 416 "./c-exp.y"
1241 { write_exp_elt_opcode (BINOP_GEQ); ;
1242     break;}
1243 case 46:
1244 #line 420 "./c-exp.y"
1245 { write_exp_elt_opcode (BINOP_LESS); ;
1246     break;}
1247 case 47:
1248 #line 424 "./c-exp.y"
1249 { write_exp_elt_opcode (BINOP_GTR); ;
1250     break;}
1251 case 48:
1252 #line 428 "./c-exp.y"
1253 { write_exp_elt_opcode (BINOP_BITWISE_AND); ;
1254     break;}
1255 case 49:
1256 #line 432 "./c-exp.y"
1257 { write_exp_elt_opcode (BINOP_BITWISE_XOR); ;
1258     break;}
1259 case 50:
1260 #line 436 "./c-exp.y"
1261 { write_exp_elt_opcode (BINOP_BITWISE_IOR); ;
1262     break;}
1263 case 51:
1264 #line 440 "./c-exp.y"
1265 { write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1266     break;}
1267 case 52:
1268 #line 444 "./c-exp.y"
1269 { write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1270     break;}
1271 case 53:
1272 #line 448 "./c-exp.y"
1273 { write_exp_elt_opcode (TERNOP_COND); ;
1274     break;}
1275 case 54:
1276 #line 452 "./c-exp.y"
1277 { write_exp_elt_opcode (BINOP_ASSIGN); ;
1278     break;}
1279 case 55:
1280 #line 456 "./c-exp.y"
1281 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1282                           write_exp_elt_opcode (yyvsp[-1].opcode);
1283                           write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); ;
1284     break;}
1285 case 56:
1286 #line 462 "./c-exp.y"
1287 { write_exp_elt_opcode (OP_LONG);
1288                           write_exp_elt_type (yyvsp[0].typed_val_int.type);
1289                           write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1290                           write_exp_elt_opcode (OP_LONG); ;
1291     break;}
1292 case 57:
1293 #line 469 "./c-exp.y"
1294 { YYSTYPE val;
1295                           parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1296                           write_exp_elt_opcode (OP_LONG);
1297                           write_exp_elt_type (val.typed_val_int.type);
1298                           write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1299                           write_exp_elt_opcode (OP_LONG);
1300                         ;
1301     break;}
1302 case 58:
1303 #line 480 "./c-exp.y"
1304 { write_exp_elt_opcode (OP_DOUBLE);
1305                           write_exp_elt_type (yyvsp[0].typed_val_float.type);
1306                           write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1307                           write_exp_elt_opcode (OP_DOUBLE); ;
1308     break;}
1309 case 61:
1310 #line 494 "./c-exp.y"
1311 { write_exp_elt_opcode (OP_LONG);
1312                           write_exp_elt_type (builtin_type_int);
1313                           CHECK_TYPEDEF (yyvsp[-1].tval);
1314                           write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1315                           write_exp_elt_opcode (OP_LONG); ;
1316     break;}
1317 case 62:
1318 #line 502 "./c-exp.y"
1319 { /* C strings are converted into array constants with
1320                              an explicit null byte added at the end.  Thus
1321                              the array upper bound is the string length.
1322                              There is no such thing in C as a completely empty
1323                              string. */
1324                           char *sp = yyvsp[0].sval.ptr; int count = yyvsp[0].sval.length;
1325                           while (count-- > 0)
1326                             {
1327                               write_exp_elt_opcode (OP_LONG);
1328                               write_exp_elt_type (builtin_type_char);
1329                               write_exp_elt_longcst ((LONGEST)(*sp++));
1330                               write_exp_elt_opcode (OP_LONG);
1331                             }
1332                           write_exp_elt_opcode (OP_LONG);
1333                           write_exp_elt_type (builtin_type_char);
1334                           write_exp_elt_longcst ((LONGEST)'\0');
1335                           write_exp_elt_opcode (OP_LONG);
1336                           write_exp_elt_opcode (OP_ARRAY);
1337                           write_exp_elt_longcst ((LONGEST) 0);
1338                           write_exp_elt_longcst ((LONGEST) (yyvsp[0].sval.length));
1339                           write_exp_elt_opcode (OP_ARRAY); ;
1340     break;}
1341 case 63:
1342 #line 527 "./c-exp.y"
1343 { write_exp_elt_opcode (OP_THIS);
1344                           write_exp_elt_opcode (OP_THIS); ;
1345     break;}
1346 case 64:
1347 #line 534 "./c-exp.y"
1348 {
1349                           if (yyvsp[0].ssym.sym != 0)
1350                               yyval.bval = SYMBOL_BLOCK_VALUE (yyvsp[0].ssym.sym);
1351                           else
1352                             {
1353                               struct symtab *tem =
1354                                   lookup_symtab (copy_name (yyvsp[0].ssym.stoken));
1355                               if (tem)
1356                                 yyval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (tem), STATIC_BLOCK);
1357                               else
1358                                 error ("No file or function \"%s\".",
1359                                        copy_name (yyvsp[0].ssym.stoken));
1360                             }
1361                         ;
1362     break;}
1363 case 65:
1364 #line 551 "./c-exp.y"
1365 { struct symbol *tem
1366                             = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1367                                              VAR_NAMESPACE, (int *) NULL,
1368                                              (struct symtab **) NULL);
1369                           if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1370                             error ("No function \"%s\" in specified context.",
1371                                    copy_name (yyvsp[0].sval));
1372                           yyval.bval = SYMBOL_BLOCK_VALUE (tem); ;
1373     break;}
1374 case 66:
1375 #line 562 "./c-exp.y"
1376 { struct symbol *sym;
1377                           sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1378                                                VAR_NAMESPACE, (int *) NULL,
1379                                                (struct symtab **) NULL);
1380                           if (sym == 0)
1381                             error ("No symbol \"%s\" in specified context.",
1382                                    copy_name (yyvsp[0].sval));
1383
1384                           write_exp_elt_opcode (OP_VAR_VALUE);
1385                           /* block_found is set by lookup_symbol.  */
1386                           write_exp_elt_block (block_found);
1387                           write_exp_elt_sym (sym);
1388                           write_exp_elt_opcode (OP_VAR_VALUE); ;
1389     break;}
1390 case 67:
1391 #line 578 "./c-exp.y"
1392 {
1393                           struct type *type = yyvsp[-2].tval;
1394                           if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1395                               && TYPE_CODE (type) != TYPE_CODE_UNION)
1396                             error ("`%s' is not defined as an aggregate type.",
1397                                    TYPE_NAME (type));
1398
1399                           write_exp_elt_opcode (OP_SCOPE);
1400                           write_exp_elt_type (type);
1401                           write_exp_string (yyvsp[0].sval);
1402                           write_exp_elt_opcode (OP_SCOPE);
1403                         ;
1404     break;}
1405 case 68:
1406 #line 591 "./c-exp.y"
1407 {
1408                           struct type *type = yyvsp[-3].tval;
1409                           struct stoken tmp_token;
1410                           if (TYPE_CODE (type) != TYPE_CODE_STRUCT
1411                               && TYPE_CODE (type) != TYPE_CODE_UNION)
1412                             error ("`%s' is not defined as an aggregate type.",
1413                                    TYPE_NAME (type));
1414
1415                           if (!STREQ (type_name_no_tag (type), yyvsp[0].sval.ptr))
1416                             error ("invalid destructor `%s::~%s'",
1417                                    type_name_no_tag (type), yyvsp[0].sval.ptr);
1418
1419                           tmp_token.ptr = (char*) alloca (yyvsp[0].sval.length + 2);
1420                           tmp_token.length = yyvsp[0].sval.length + 1;
1421                           tmp_token.ptr[0] = '~';
1422                           memcpy (tmp_token.ptr+1, yyvsp[0].sval.ptr, yyvsp[0].sval.length);
1423                           tmp_token.ptr[tmp_token.length] = 0;
1424                           write_exp_elt_opcode (OP_SCOPE);
1425                           write_exp_elt_type (type);
1426                           write_exp_string (tmp_token);
1427                           write_exp_elt_opcode (OP_SCOPE);
1428                         ;
1429     break;}
1430 case 70:
1431 #line 617 "./c-exp.y"
1432 {
1433                           char *name = copy_name (yyvsp[0].sval);
1434                           struct symbol *sym;
1435                           struct minimal_symbol *msymbol;
1436
1437                           sym =
1438                             lookup_symbol (name, (const struct block *) NULL,
1439                                            VAR_NAMESPACE, (int *) NULL,
1440                                            (struct symtab **) NULL);
1441                           if (sym)
1442                             {
1443                               write_exp_elt_opcode (OP_VAR_VALUE);
1444                               write_exp_elt_block (NULL);
1445                               write_exp_elt_sym (sym);
1446                               write_exp_elt_opcode (OP_VAR_VALUE);
1447                               break;
1448                             }
1449
1450                           msymbol = lookup_minimal_symbol (name, NULL, NULL);
1451                           if (msymbol != NULL)
1452                             {
1453                               write_exp_msymbol (msymbol,
1454                                                  lookup_function_type (builtin_type_int),
1455                                                  builtin_type_int);
1456                             }
1457                           else
1458                             if (!have_full_symbols () && !have_partial_symbols ())
1459                               error ("No symbol table is loaded.  Use the \"file\" command.");
1460                             else
1461                               error ("No symbol \"%s\" in current context.", name);
1462                         ;
1463     break;}
1464 case 71:
1465 #line 651 "./c-exp.y"
1466 { struct symbol *sym = yyvsp[0].ssym.sym;
1467
1468                           if (sym)
1469                             {
1470                               if (symbol_read_needs_frame (sym))
1471                                 {
1472                                   if (innermost_block == 0 ||
1473                                       contained_in (block_found, 
1474                                                     innermost_block))
1475                                     innermost_block = block_found;
1476                                 }
1477
1478                               write_exp_elt_opcode (OP_VAR_VALUE);
1479                               /* We want to use the selected frame, not
1480                                  another more inner frame which happens to
1481                                  be in the same block.  */
1482                               write_exp_elt_block (NULL);
1483                               write_exp_elt_sym (sym);
1484                               write_exp_elt_opcode (OP_VAR_VALUE);
1485                             }
1486                           else if (yyvsp[0].ssym.is_a_field_of_this)
1487                             {
1488                               /* C++: it hangs off of `this'.  Must
1489                                  not inadvertently convert from a method call
1490                                  to data ref.  */
1491                               if (innermost_block == 0 || 
1492                                   contained_in (block_found, innermost_block))
1493                                 innermost_block = block_found;
1494                               write_exp_elt_opcode (OP_THIS);
1495                               write_exp_elt_opcode (OP_THIS);
1496                               write_exp_elt_opcode (STRUCTOP_PTR);
1497                               write_exp_string (yyvsp[0].ssym.stoken);
1498                               write_exp_elt_opcode (STRUCTOP_PTR);
1499                             }
1500                           else
1501                             {
1502                               struct minimal_symbol *msymbol;
1503                               register char *arg = copy_name (yyvsp[0].ssym.stoken);
1504
1505                               msymbol =
1506                                 lookup_minimal_symbol (arg, NULL, NULL);
1507                               if (msymbol != NULL)
1508                                 {
1509                                   write_exp_msymbol (msymbol,
1510                                                      lookup_function_type (builtin_type_int),
1511                                                      builtin_type_int);
1512                                 }
1513                               else if (!have_full_symbols () && !have_partial_symbols ())
1514                                 error ("No symbol table is loaded.  Use the \"file\" command.");
1515                               else
1516                                 error ("No symbol \"%s\" in current context.",
1517                                        copy_name (yyvsp[0].ssym.stoken));
1518                             }
1519                         ;
1520     break;}
1521 case 75:
1522 #line 717 "./c-exp.y"
1523 { yyval.tval = follow_types (yyvsp[-1].tval); ;
1524     break;}
1525 case 76:
1526 #line 719 "./c-exp.y"
1527 { yyval.tval = follow_types (yyvsp[-2].tval); ;
1528     break;}
1529 case 77:
1530 #line 721 "./c-exp.y"
1531 { yyval.tval = follow_types (yyvsp[-2].tval); ;
1532     break;}
1533 case 78:
1534 #line 725 "./c-exp.y"
1535 { push_type (tp_pointer); yyval.voidval = 0; ;
1536     break;}
1537 case 79:
1538 #line 727 "./c-exp.y"
1539 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; ;
1540     break;}
1541 case 80:
1542 #line 729 "./c-exp.y"
1543 { push_type (tp_reference); yyval.voidval = 0; ;
1544     break;}
1545 case 81:
1546 #line 731 "./c-exp.y"
1547 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; ;
1548     break;}
1549 case 83:
1550 #line 736 "./c-exp.y"
1551 { yyval.voidval = yyvsp[-1].voidval; ;
1552     break;}
1553 case 84:
1554 #line 738 "./c-exp.y"
1555 {
1556                           push_type_int (yyvsp[0].lval);
1557                           push_type (tp_array);
1558                         ;
1559     break;}
1560 case 85:
1561 #line 743 "./c-exp.y"
1562 {
1563                           push_type_int (yyvsp[0].lval);
1564                           push_type (tp_array);
1565                           yyval.voidval = 0;
1566                         ;
1567     break;}
1568 case 86:
1569 #line 750 "./c-exp.y"
1570 { push_type (tp_function); ;
1571     break;}
1572 case 87:
1573 #line 752 "./c-exp.y"
1574 { push_type (tp_function); ;
1575     break;}
1576 case 88:
1577 #line 756 "./c-exp.y"
1578 { yyval.lval = -1; ;
1579     break;}
1580 case 89:
1581 #line 758 "./c-exp.y"
1582 { yyval.lval = yyvsp[-1].typed_val_int.val; ;
1583     break;}
1584 case 90:
1585 #line 762 "./c-exp.y"
1586 { yyval.voidval = 0; ;
1587     break;}
1588 case 91:
1589 #line 764 "./c-exp.y"
1590 { free ((PTR)yyvsp[-1].tvec); yyval.voidval = 0; ;
1591     break;}
1592 case 93:
1593 #line 777 "./c-exp.y"
1594 { yyval.tval = lookup_member_type (builtin_type_int, yyvsp[-2].tval); ;
1595     break;}
1596 case 94:
1597 #line 782 "./c-exp.y"
1598 { yyval.tval = yyvsp[0].tsym.type; ;
1599     break;}
1600 case 95:
1601 #line 784 "./c-exp.y"
1602 { yyval.tval = builtin_type_int; ;
1603     break;}
1604 case 96:
1605 #line 786 "./c-exp.y"
1606 { yyval.tval = builtin_type_long; ;
1607     break;}
1608 case 97:
1609 #line 788 "./c-exp.y"
1610 { yyval.tval = builtin_type_short; ;
1611     break;}
1612 case 98:
1613 #line 790 "./c-exp.y"
1614 { yyval.tval = builtin_type_long; ;
1615     break;}
1616 case 99:
1617 #line 792 "./c-exp.y"
1618 { yyval.tval = builtin_type_unsigned_long; ;
1619     break;}
1620 case 100:
1621 #line 794 "./c-exp.y"
1622 { yyval.tval = builtin_type_long_long; ;
1623     break;}
1624 case 101:
1625 #line 796 "./c-exp.y"
1626 { yyval.tval = builtin_type_long_long; ;
1627     break;}
1628 case 102:
1629 #line 798 "./c-exp.y"
1630 { yyval.tval = builtin_type_unsigned_long_long; ;
1631     break;}
1632 case 103:
1633 #line 800 "./c-exp.y"
1634 { yyval.tval = builtin_type_unsigned_long_long; ;
1635     break;}
1636 case 104:
1637 #line 802 "./c-exp.y"
1638 { yyval.tval = builtin_type_short; ;
1639     break;}
1640 case 105:
1641 #line 804 "./c-exp.y"
1642 { yyval.tval = builtin_type_unsigned_short; ;
1643     break;}
1644 case 106:
1645 #line 806 "./c-exp.y"
1646 { yyval.tval = builtin_type_double; ;
1647     break;}
1648 case 107:
1649 #line 808 "./c-exp.y"
1650 { yyval.tval = builtin_type_long_double; ;
1651     break;}
1652 case 108:
1653 #line 810 "./c-exp.y"
1654 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1655                                               expression_context_block); ;
1656     break;}
1657 case 109:
1658 #line 813 "./c-exp.y"
1659 { yyval.tval = lookup_struct (copy_name (yyvsp[0].sval),
1660                                               expression_context_block); ;
1661     break;}
1662 case 110:
1663 #line 816 "./c-exp.y"
1664 { yyval.tval = lookup_union (copy_name (yyvsp[0].sval),
1665                                              expression_context_block); ;
1666     break;}
1667 case 111:
1668 #line 819 "./c-exp.y"
1669 { yyval.tval = lookup_enum (copy_name (yyvsp[0].sval),
1670                                             expression_context_block); ;
1671     break;}
1672 case 112:
1673 #line 822 "./c-exp.y"
1674 { yyval.tval = lookup_unsigned_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
1675     break;}
1676 case 113:
1677 #line 824 "./c-exp.y"
1678 { yyval.tval = builtin_type_unsigned_int; ;
1679     break;}
1680 case 114:
1681 #line 826 "./c-exp.y"
1682 { yyval.tval = lookup_signed_typename (TYPE_NAME(yyvsp[0].tsym.type)); ;
1683     break;}
1684 case 115:
1685 #line 828 "./c-exp.y"
1686 { yyval.tval = builtin_type_int; ;
1687     break;}
1688 case 116:
1689 #line 830 "./c-exp.y"
1690 { yyval.tval = lookup_template_type(copy_name(yyvsp[-3].sval), yyvsp[-1].tval,
1691                                                     expression_context_block);
1692                         ;
1693     break;}
1694 case 117:
1695 #line 836 "./c-exp.y"
1696 { yyval.tval = yyvsp[0].tval; ;
1697     break;}
1698 case 118:
1699 #line 837 "./c-exp.y"
1700 { yyval.tval = yyvsp[0].tval; ;
1701     break;}
1702 case 120:
1703 #line 842 "./c-exp.y"
1704 {
1705                   yyval.tsym.stoken.ptr = "int";
1706                   yyval.tsym.stoken.length = 3;
1707                   yyval.tsym.type = builtin_type_int;
1708                 ;
1709     break;}
1710 case 121:
1711 #line 848 "./c-exp.y"
1712 {
1713                   yyval.tsym.stoken.ptr = "long";
1714                   yyval.tsym.stoken.length = 4;
1715                   yyval.tsym.type = builtin_type_long;
1716                 ;
1717     break;}
1718 case 122:
1719 #line 854 "./c-exp.y"
1720 {
1721                   yyval.tsym.stoken.ptr = "short";
1722                   yyval.tsym.stoken.length = 5;
1723                   yyval.tsym.type = builtin_type_short;
1724                 ;
1725     break;}
1726 case 123:
1727 #line 863 "./c-exp.y"
1728 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1729                   yyval.ivec[0] = 1;    /* Number of types in vector */
1730                   yyval.tvec[1] = yyvsp[0].tval;
1731                 ;
1732     break;}
1733 case 124:
1734 #line 868 "./c-exp.y"
1735 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1736                   yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1737                   yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1738                 ;
1739     break;}
1740 case 125:
1741 #line 874 "./c-exp.y"
1742 { yyval.sval = yyvsp[0].ssym.stoken; ;
1743     break;}
1744 case 126:
1745 #line 875 "./c-exp.y"
1746 { yyval.sval = yyvsp[0].ssym.stoken; ;
1747     break;}
1748 case 127:
1749 #line 876 "./c-exp.y"
1750 { yyval.sval = yyvsp[0].tsym.stoken; ;
1751     break;}
1752 case 128:
1753 #line 877 "./c-exp.y"
1754 { yyval.sval = yyvsp[0].ssym.stoken; ;
1755     break;}
1756 }
1757    /* the action file gets copied in in place of this dollarsign */
1758 #line 487 "/usr/unsupported/share/bison.simple"
1759 \f
1760   yyvsp -= yylen;
1761   yyssp -= yylen;
1762 #ifdef YYLSP_NEEDED
1763   yylsp -= yylen;
1764 #endif
1765
1766 #if YYDEBUG != 0
1767   if (yydebug)
1768     {
1769       short *ssp1 = yyss - 1;
1770       fprintf (stderr, "state stack now");
1771       while (ssp1 != yyssp)
1772         fprintf (stderr, " %d", *++ssp1);
1773       fprintf (stderr, "\n");
1774     }
1775 #endif
1776
1777   *++yyvsp = yyval;
1778
1779 #ifdef YYLSP_NEEDED
1780   yylsp++;
1781   if (yylen == 0)
1782     {
1783       yylsp->first_line = yylloc.first_line;
1784       yylsp->first_column = yylloc.first_column;
1785       yylsp->last_line = (yylsp-1)->last_line;
1786       yylsp->last_column = (yylsp-1)->last_column;
1787       yylsp->text = 0;
1788     }
1789   else
1790     {
1791       yylsp->last_line = (yylsp+yylen-1)->last_line;
1792       yylsp->last_column = (yylsp+yylen-1)->last_column;
1793     }
1794 #endif
1795
1796   /* Now "shift" the result of the reduction.
1797      Determine what state that goes to,
1798      based on the state we popped back to
1799      and the rule number reduced by.  */
1800
1801   yyn = yyr1[yyn];
1802
1803   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1804   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1805     yystate = yytable[yystate];
1806   else
1807     yystate = yydefgoto[yyn - YYNTBASE];
1808
1809   goto yynewstate;
1810
1811 yyerrlab:   /* here on detecting error */
1812
1813   if (! yyerrstatus)
1814     /* If not already recovering from an error, report this error.  */
1815     {
1816       ++yynerrs;
1817
1818 #ifdef YYERROR_VERBOSE
1819       yyn = yypact[yystate];
1820
1821       if (yyn > YYFLAG && yyn < YYLAST)
1822         {
1823           int size = 0;
1824           char *msg;
1825           int x, count;
1826
1827           count = 0;
1828           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1829           for (x = (yyn < 0 ? -yyn : 0);
1830                x < (sizeof(yytname) / sizeof(char *)); x++)
1831             if (yycheck[x + yyn] == x)
1832               size += strlen(yytname[x]) + 15, count++;
1833           msg = (char *) xmalloc(size + 15);
1834           if (msg != 0)
1835             {
1836               strcpy(msg, "parse error");
1837
1838               if (count < 5)
1839                 {
1840                   count = 0;
1841                   for (x = (yyn < 0 ? -yyn : 0);
1842                        x < (sizeof(yytname) / sizeof(char *)); x++)
1843                     if (yycheck[x + yyn] == x)
1844                       {
1845                         strcat(msg, count == 0 ? ", expecting `" : " or `");
1846                         strcat(msg, yytname[x]);
1847                         strcat(msg, "'");
1848                         count++;
1849                       }
1850                 }
1851               yyerror(msg);
1852               free(msg);
1853             }
1854           else
1855             yyerror ("parse error; also virtual memory exceeded");
1856         }
1857       else
1858 #endif /* YYERROR_VERBOSE */
1859         yyerror("parse error");
1860     }
1861
1862   goto yyerrlab1;
1863 yyerrlab1:   /* here on error raised explicitly by an action */
1864
1865   if (yyerrstatus == 3)
1866     {
1867       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1868
1869       /* return failure if at end of input */
1870       if (yychar == YYEOF)
1871         YYABORT;
1872
1873 #if YYDEBUG != 0
1874       if (yydebug)
1875         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1876 #endif
1877
1878       yychar = YYEMPTY;
1879     }
1880
1881   /* Else will try to reuse lookahead token
1882      after shifting the error token.  */
1883
1884   yyerrstatus = 3;              /* Each real token shifted decrements this */
1885
1886   goto yyerrhandle;
1887
1888 yyerrdefault:  /* current state does not do anything special for the error token. */
1889
1890 #if 0
1891   /* This is wrong; only states that explicitly want error tokens
1892      should shift them.  */
1893   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1894   if (yyn) goto yydefault;
1895 #endif
1896
1897 yyerrpop:   /* pop the current state because it cannot handle the error token */
1898
1899   if (yyssp == yyss) YYABORT;
1900   yyvsp--;
1901   yystate = *--yyssp;
1902 #ifdef YYLSP_NEEDED
1903   yylsp--;
1904 #endif
1905
1906 #if YYDEBUG != 0
1907   if (yydebug)
1908     {
1909       short *ssp1 = yyss - 1;
1910       fprintf (stderr, "Error: state stack now");
1911       while (ssp1 != yyssp)
1912         fprintf (stderr, " %d", *++ssp1);
1913       fprintf (stderr, "\n");
1914     }
1915 #endif
1916
1917 yyerrhandle:
1918
1919   yyn = yypact[yystate];
1920   if (yyn == YYFLAG)
1921     goto yyerrdefault;
1922
1923   yyn += YYTERROR;
1924   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1925     goto yyerrdefault;
1926
1927   yyn = yytable[yyn];
1928   if (yyn < 0)
1929     {
1930       if (yyn == YYFLAG)
1931         goto yyerrpop;
1932       yyn = -yyn;
1933       goto yyreduce;
1934     }
1935   else if (yyn == 0)
1936     goto yyerrpop;
1937
1938   if (yyn == YYFINAL)
1939     YYACCEPT;
1940
1941 #if YYDEBUG != 0
1942   if (yydebug)
1943     fprintf(stderr, "Shifting error token, ");
1944 #endif
1945
1946   *++yyvsp = yylval;
1947 #ifdef YYLSP_NEEDED
1948   *++yylsp = yylloc;
1949 #endif
1950
1951   yystate = yyn;
1952   goto yynewstate;
1953 }
1954 #line 891 "./c-exp.y"
1955
1956
1957 /* Take care of parsing a number (anything that starts with a digit).
1958    Set yylval and return the token type; update lexptr.
1959    LEN is the number of characters in it.  */
1960
1961 /*** Needs some error checking for the float case ***/
1962
1963 static int
1964 parse_number (p, len, parsed_float, putithere)
1965      register char *p;
1966      register int len;
1967      int parsed_float;
1968      YYSTYPE *putithere;
1969 {
1970   /* FIXME: Shouldn't these be unsigned?  We don't deal with negative values
1971      here, and we do kind of silly things like cast to unsigned.  */
1972   register LONGEST n = 0;
1973   register LONGEST prevn = 0;
1974   unsigned LONGEST un;
1975
1976   register int i = 0;
1977   register int c;
1978   register int base = input_radix;
1979   int unsigned_p = 0;
1980
1981   /* Number of "L" suffixes encountered.  */
1982   int long_p = 0;
1983
1984   /* We have found a "L" or "U" suffix.  */
1985   int found_suffix = 0;
1986
1987   unsigned LONGEST high_bit;
1988   struct type *signed_type;
1989   struct type *unsigned_type;
1990
1991   if (parsed_float)
1992     {
1993       char c;
1994
1995       /* It's a float since it contains a point or an exponent.  */
1996
1997       if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
1998         sscanf (p, "%g", &putithere->typed_val_float.dval);
1999       else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2000         sscanf (p, "%lg", &putithere->typed_val_float.dval);
2001       else
2002         {
2003 #ifdef PRINTF_HAS_LONG_DOUBLE
2004           sscanf (p, "%Lg", &putithere->typed_val_float.dval);
2005 #else
2006           /* Scan it into a double, then assign it to the long double.
2007              This at least wins with values representable in the range
2008              of doubles. */
2009           double temp;
2010           sscanf (p, "%lg", &temp);
2011           putithere->typed_val_float.dval = temp;
2012 #endif
2013         }
2014
2015       /* See if it has `f' or `l' suffix (float or long double).  */
2016
2017       c = tolower (p[len - 1]);
2018
2019       if (c == 'f')
2020         putithere->typed_val_float.type = builtin_type_float;
2021       else if (c == 'l')
2022         putithere->typed_val_float.type = builtin_type_long_double;
2023       else if (isdigit (c) || c == '.')
2024         putithere->typed_val_float.type = builtin_type_double;
2025       else
2026         return ERROR;
2027
2028       return FLOAT;
2029     }
2030
2031   /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2032   if (p[0] == '0')
2033     switch (p[1])
2034       {
2035       case 'x':
2036       case 'X':
2037         if (len >= 3)
2038           {
2039             p += 2;
2040             base = 16;
2041             len -= 2;
2042           }
2043         break;
2044
2045       case 't':
2046       case 'T':
2047       case 'd':
2048       case 'D':
2049         if (len >= 3)
2050           {
2051             p += 2;
2052             base = 10;
2053             len -= 2;
2054           }
2055         break;
2056
2057       default:
2058         base = 8;
2059         break;
2060       }
2061
2062   while (len-- > 0)
2063     {
2064       c = *p++;
2065       if (c >= 'A' && c <= 'Z')
2066         c += 'a' - 'A';
2067       if (c != 'l' && c != 'u')
2068         n *= base;
2069       if (c >= '0' && c <= '9')
2070         {
2071           if (found_suffix)
2072             return ERROR;
2073           n += i = c - '0';
2074         }
2075       else
2076         {
2077           if (base > 10 && c >= 'a' && c <= 'f')
2078             {
2079               if (found_suffix)
2080                 return ERROR;
2081               n += i = c - 'a' + 10;
2082             }
2083           else if (c == 'l')
2084             {
2085               ++long_p;
2086               found_suffix = 1;
2087             }
2088           else if (c == 'u')
2089             {
2090               unsigned_p = 1;
2091               found_suffix = 1;
2092             }
2093           else
2094             return ERROR;       /* Char not a digit */
2095         }
2096       if (i >= base)
2097         return ERROR;           /* Invalid digit in this base */
2098
2099       /* Portably test for overflow (only works for nonzero values, so make
2100          a second check for zero).  FIXME: Can't we just make n and prevn
2101          unsigned and avoid this?  */
2102       if (c != 'l' && c != 'u' && (prevn >= n) && n != 0)
2103         unsigned_p = 1;         /* Try something unsigned */
2104
2105       /* Portably test for unsigned overflow.
2106          FIXME: This check is wrong; for example it doesn't find overflow
2107          on 0x123456789 when LONGEST is 32 bits.  */
2108       if (c != 'l' && c != 'u' && n != 0)
2109         {       
2110           if ((unsigned_p && (unsigned LONGEST) prevn >= (unsigned LONGEST) n))
2111             error ("Numeric constant too large.");
2112         }
2113       prevn = n;
2114     }
2115
2116   /* An integer constant is an int, a long, or a long long.  An L
2117      suffix forces it to be long; an LL suffix forces it to be long
2118      long.  If not forced to a larger size, it gets the first type of
2119      the above that it fits in.  To figure out whether it fits, we
2120      shift it right and see whether anything remains.  Note that we
2121      can't shift sizeof (LONGEST) * HOST_CHAR_BIT bits or more in one
2122      operation, because many compilers will warn about such a shift
2123      (which always produces a zero result).  Sometimes TARGET_INT_BIT
2124      or TARGET_LONG_BIT will be that big, sometimes not.  To deal with
2125      the case where it is we just always shift the value more than
2126      once, with fewer bits each time.  */
2127
2128   un = (unsigned LONGEST)n >> 2;
2129   if (long_p == 0
2130       && (un >> (TARGET_INT_BIT - 2)) == 0)
2131     {
2132       high_bit = ((unsigned LONGEST)1) << (TARGET_INT_BIT-1);
2133
2134       /* A large decimal (not hex or octal) constant (between INT_MAX
2135          and UINT_MAX) is a long or unsigned long, according to ANSI,
2136          never an unsigned int, but this code treats it as unsigned
2137          int.  This probably should be fixed.  GCC gives a warning on
2138          such constants.  */
2139
2140       unsigned_type = builtin_type_unsigned_int;
2141       signed_type = builtin_type_int;
2142     }
2143   else if (long_p <= 1
2144            && (un >> (TARGET_LONG_BIT - 2)) == 0)
2145     {
2146       high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
2147       unsigned_type = builtin_type_unsigned_long;
2148       signed_type = builtin_type_long;
2149     }
2150   else
2151     {
2152       high_bit = (((unsigned LONGEST)1)
2153                   << (TARGET_LONG_LONG_BIT - 32 - 1)
2154                   << 16
2155                   << 16);
2156       if (high_bit == 0)
2157         /* A long long does not fit in a LONGEST.  */
2158         high_bit =
2159           (unsigned LONGEST)1 << (sizeof (LONGEST) * HOST_CHAR_BIT - 1);
2160       unsigned_type = builtin_type_unsigned_long_long;
2161       signed_type = builtin_type_long_long;
2162     }
2163
2164    putithere->typed_val_int.val = n;
2165
2166    /* If the high bit of the worked out type is set then this number
2167       has to be unsigned. */
2168
2169    if (unsigned_p || (n & high_bit)) 
2170      {
2171        putithere->typed_val_int.type = unsigned_type;
2172      }
2173    else 
2174      {
2175        putithere->typed_val_int.type = signed_type;
2176      }
2177
2178    return INT;
2179 }
2180
2181 struct token
2182 {
2183   char *operator;
2184   int token;
2185   enum exp_opcode opcode;
2186 };
2187
2188 static const struct token tokentab3[] =
2189   {
2190     {">>=", ASSIGN_MODIFY, BINOP_RSH},
2191     {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2192   };
2193
2194 static const struct token tokentab2[] =
2195   {
2196     {"+=", ASSIGN_MODIFY, BINOP_ADD},
2197     {"-=", ASSIGN_MODIFY, BINOP_SUB},
2198     {"*=", ASSIGN_MODIFY, BINOP_MUL},
2199     {"/=", ASSIGN_MODIFY, BINOP_DIV},
2200     {"%=", ASSIGN_MODIFY, BINOP_REM},
2201     {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2202     {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2203     {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2204     {"++", INCREMENT, BINOP_END},
2205     {"--", DECREMENT, BINOP_END},
2206     {"->", ARROW, BINOP_END},
2207     {"&&", ANDAND, BINOP_END},
2208     {"||", OROR, BINOP_END},
2209     {"::", COLONCOLON, BINOP_END},
2210     {"<<", LSH, BINOP_END},
2211     {">>", RSH, BINOP_END},
2212     {"==", EQUAL, BINOP_END},
2213     {"!=", NOTEQUAL, BINOP_END},
2214     {"<=", LEQ, BINOP_END},
2215     {">=", GEQ, BINOP_END}
2216   };
2217
2218 /* Read one token, getting characters through lexptr.  */
2219
2220 static int
2221 yylex ()
2222 {
2223   int c;
2224   int namelen;
2225   unsigned int i;
2226   char *tokstart;
2227   char *tokptr;
2228   int tempbufindex;
2229   static char *tempbuf;
2230   static int tempbufsize;
2231   
2232  retry:
2233
2234   tokstart = lexptr;
2235   /* See if it is a special token of length 3.  */
2236   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2237     if (STREQN (tokstart, tokentab3[i].operator, 3))
2238       {
2239         lexptr += 3;
2240         yylval.opcode = tokentab3[i].opcode;
2241         return tokentab3[i].token;
2242       }
2243
2244   /* See if it is a special token of length 2.  */
2245   for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2246     if (STREQN (tokstart, tokentab2[i].operator, 2))
2247       {
2248         lexptr += 2;
2249         yylval.opcode = tokentab2[i].opcode;
2250         return tokentab2[i].token;
2251       }
2252
2253   switch (c = *tokstart)
2254     {
2255     case 0:
2256       return 0;
2257
2258     case ' ':
2259     case '\t':
2260     case '\n':
2261       lexptr++;
2262       goto retry;
2263
2264     case '\'':
2265       /* We either have a character constant ('0' or '\177' for example)
2266          or we have a quoted symbol reference ('foo(int,int)' in C++
2267          for example). */
2268       lexptr++;
2269       c = *lexptr++;
2270       if (c == '\\')
2271         c = parse_escape (&lexptr);
2272       else if (c == '\'')
2273         error ("Empty character constant.");
2274
2275       yylval.typed_val_int.val = c;
2276       yylval.typed_val_int.type = builtin_type_char;
2277
2278       c = *lexptr++;
2279       if (c != '\'')
2280         {
2281           namelen = skip_quoted (tokstart) - tokstart;
2282           if (namelen > 2)
2283             {
2284               lexptr = tokstart + namelen;
2285               if (lexptr[-1] != '\'')
2286                 error ("Unmatched single quote.");
2287               namelen -= 2;
2288               tokstart++;
2289               goto tryname;
2290             }
2291           error ("Invalid character constant.");
2292         }
2293       return INT;
2294
2295     case '(':
2296       paren_depth++;
2297       lexptr++;
2298       return c;
2299
2300     case ')':
2301       if (paren_depth == 0)
2302         return 0;
2303       paren_depth--;
2304       lexptr++;
2305       return c;
2306
2307     case ',':
2308       if (comma_terminates && paren_depth == 0)
2309         return 0;
2310       lexptr++;
2311       return c;
2312
2313     case '.':
2314       /* Might be a floating point number.  */
2315       if (lexptr[1] < '0' || lexptr[1] > '9')
2316         goto symbol;            /* Nope, must be a symbol. */
2317       /* FALL THRU into number case.  */
2318
2319     case '0':
2320     case '1':
2321     case '2':
2322     case '3':
2323     case '4':
2324     case '5':
2325     case '6':
2326     case '7':
2327     case '8':
2328     case '9':
2329       {
2330         /* It's a number.  */
2331         int got_dot = 0, got_e = 0, toktype;
2332         register char *p = tokstart;
2333         int hex = input_radix > 10;
2334
2335         if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2336           {
2337             p += 2;
2338             hex = 1;
2339           }
2340         else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2341           {
2342             p += 2;
2343             hex = 0;
2344           }
2345
2346         for (;; ++p)
2347           {
2348             /* This test includes !hex because 'e' is a valid hex digit
2349                and thus does not indicate a floating point number when
2350                the radix is hex.  */
2351             if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2352               got_dot = got_e = 1;
2353             /* This test does not include !hex, because a '.' always indicates
2354                a decimal floating point number regardless of the radix.  */
2355             else if (!got_dot && *p == '.')
2356               got_dot = 1;
2357             else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2358                      && (*p == '-' || *p == '+'))
2359               /* This is the sign of the exponent, not the end of the
2360                  number.  */
2361               continue;
2362             /* We will take any letters or digits.  parse_number will
2363                complain if past the radix, or if L or U are not final.  */
2364             else if ((*p < '0' || *p > '9')
2365                      && ((*p < 'a' || *p > 'z')
2366                                   && (*p < 'A' || *p > 'Z')))
2367               break;
2368           }
2369         toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2370         if (toktype == ERROR)
2371           {
2372             char *err_copy = (char *) alloca (p - tokstart + 1);
2373
2374             memcpy (err_copy, tokstart, p - tokstart);
2375             err_copy[p - tokstart] = 0;
2376             error ("Invalid number \"%s\".", err_copy);
2377           }
2378         lexptr = p;
2379         return toktype;
2380       }
2381
2382     case '+':
2383     case '-':
2384     case '*':
2385     case '/':
2386     case '%':
2387     case '|':
2388     case '&':
2389     case '^':
2390     case '~':
2391     case '!':
2392     case '@':
2393     case '<':
2394     case '>':
2395     case '[':
2396     case ']':
2397     case '?':
2398     case ':':
2399     case '=':
2400     case '{':
2401     case '}':
2402     symbol:
2403       lexptr++;
2404       return c;
2405
2406     case '"':
2407
2408       /* Build the gdb internal form of the input string in tempbuf,
2409          translating any standard C escape forms seen.  Note that the
2410          buffer is null byte terminated *only* for the convenience of
2411          debugging gdb itself and printing the buffer contents when
2412          the buffer contains no embedded nulls.  Gdb does not depend
2413          upon the buffer being null byte terminated, it uses the length
2414          string instead.  This allows gdb to handle C strings (as well
2415          as strings in other languages) with embedded null bytes */
2416
2417       tokptr = ++tokstart;
2418       tempbufindex = 0;
2419
2420       do {
2421         /* Grow the static temp buffer if necessary, including allocating
2422            the first one on demand. */
2423         if (tempbufindex + 1 >= tempbufsize)
2424           {
2425             tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2426           }
2427         switch (*tokptr)
2428           {
2429           case '\0':
2430           case '"':
2431             /* Do nothing, loop will terminate. */
2432             break;
2433           case '\\':
2434             tokptr++;
2435             c = parse_escape (&tokptr);
2436             if (c == -1)
2437               {
2438                 continue;
2439               }
2440             tempbuf[tempbufindex++] = c;
2441             break;
2442           default:
2443             tempbuf[tempbufindex++] = *tokptr++;
2444             break;
2445           }
2446       } while ((*tokptr != '"') && (*tokptr != '\0'));
2447       if (*tokptr++ != '"')
2448         {
2449           error ("Unterminated string in expression.");
2450         }
2451       tempbuf[tempbufindex] = '\0';     /* See note above */
2452       yylval.sval.ptr = tempbuf;
2453       yylval.sval.length = tempbufindex;
2454       lexptr = tokptr;
2455       return (STRING);
2456     }
2457
2458   if (!(c == '_' || c == '$'
2459         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2460     /* We must have come across a bad character (e.g. ';').  */
2461     error ("Invalid character '%c' in expression.", c);
2462
2463   /* It's a name.  See how long it is.  */
2464   namelen = 0;
2465   for (c = tokstart[namelen];
2466        (c == '_' || c == '$' || (c >= '0' && c <= '9')
2467         || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '<');)
2468     {
2469        if (c == '<')
2470          {
2471            int i = namelen;
2472            while (tokstart[++i] && tokstart[i] != '>');
2473            if (tokstart[i] == '>')
2474              namelen = i;
2475           }
2476        c = tokstart[++namelen];
2477      }
2478
2479   /* The token "if" terminates the expression and is NOT 
2480      removed from the input stream.  */
2481   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2482     {
2483       return 0;
2484     }
2485
2486   lexptr += namelen;
2487
2488   tryname:
2489
2490   /* Catch specific keywords.  Should be done with a data structure.  */
2491   switch (namelen)
2492     {
2493     case 8:
2494       if (STREQN (tokstart, "unsigned", 8))
2495         return UNSIGNED;
2496       if (current_language->la_language == language_cplus
2497           && STREQN (tokstart, "template", 8))
2498         return TEMPLATE;
2499       if (STREQN (tokstart, "volatile", 8))
2500         return VOLATILE_KEYWORD;
2501       break;
2502     case 6:
2503       if (STREQN (tokstart, "struct", 6))
2504         return STRUCT;
2505       if (STREQN (tokstart, "signed", 6))
2506         return SIGNED_KEYWORD;
2507       if (STREQN (tokstart, "sizeof", 6))      
2508         return SIZEOF;
2509       if (STREQN (tokstart, "double", 6))      
2510         return DOUBLE_KEYWORD;
2511       break;
2512     case 5:
2513       if (current_language->la_language == language_cplus
2514           && STREQN (tokstart, "class", 5))
2515         return CLASS;
2516       if (STREQN (tokstart, "union", 5))
2517         return UNION;
2518       if (STREQN (tokstart, "short", 5))
2519         return SHORT;
2520       if (STREQN (tokstart, "const", 5))
2521         return CONST_KEYWORD;
2522       break;
2523     case 4:
2524       if (STREQN (tokstart, "enum", 4))
2525         return ENUM;
2526       if (STREQN (tokstart, "long", 4))
2527         return LONG;
2528       if (current_language->la_language == language_cplus
2529           && STREQN (tokstart, "this", 4))
2530         {
2531           static const char this_name[] =
2532                                  { CPLUS_MARKER, 't', 'h', 'i', 's', '\0' };
2533
2534           if (lookup_symbol (this_name, expression_context_block,
2535                              VAR_NAMESPACE, (int *) NULL,
2536                              (struct symtab **) NULL))
2537             return THIS;
2538         }
2539       break;
2540     case 3:
2541       if (STREQN (tokstart, "int", 3))
2542         return INT_KEYWORD;
2543       break;
2544     default:
2545       break;
2546     }
2547
2548   yylval.sval.ptr = tokstart;
2549   yylval.sval.length = namelen;
2550
2551   if (*tokstart == '$')
2552     {
2553       write_dollar_variable (yylval.sval);
2554       return VARIABLE;
2555     }
2556
2557   /* Use token-type BLOCKNAME for symbols that happen to be defined as
2558      functions or symtabs.  If this is not so, then ...
2559      Use token-type TYPENAME for symbols that happen to be defined
2560      currently as names of types; NAME for other symbols.
2561      The caller is not constrained to care about the distinction.  */
2562   {
2563     char *tmp = copy_name (yylval.sval);
2564     struct symbol *sym;
2565     int is_a_field_of_this = 0;
2566     int hextype;
2567
2568     sym = lookup_symbol (tmp, expression_context_block,
2569                          VAR_NAMESPACE,
2570                          current_language->la_language == language_cplus
2571                          ? &is_a_field_of_this : (int *) NULL,
2572                          (struct symtab **) NULL);
2573     /* Call lookup_symtab, not lookup_partial_symtab, in case there are
2574        no psymtabs (coff, xcoff, or some future change to blow away the
2575        psymtabs once once symbols are read).  */
2576     if ((sym && SYMBOL_CLASS (sym) == LOC_BLOCK) ||
2577         lookup_symtab (tmp))
2578       {
2579         yylval.ssym.sym = sym;
2580         yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2581         return BLOCKNAME;
2582       }
2583     if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2584         {
2585 #if 1
2586           /* Despite the following flaw, we need to keep this code enabled.
2587              Because we can get called from check_stub_method, if we don't
2588              handle nested types then it screws many operations in any
2589              program which uses nested types.  */
2590           /* In "A::x", if x is a member function of A and there happens
2591              to be a type (nested or not, since the stabs don't make that
2592              distinction) named x, then this code incorrectly thinks we
2593              are dealing with nested types rather than a member function.  */
2594
2595           char *p;
2596           char *namestart;
2597           struct symbol *best_sym;
2598
2599           /* Look ahead to detect nested types.  This probably should be
2600              done in the grammar, but trying seemed to introduce a lot
2601              of shift/reduce and reduce/reduce conflicts.  It's possible
2602              that it could be done, though.  Or perhaps a non-grammar, but
2603              less ad hoc, approach would work well.  */
2604
2605           /* Since we do not currently have any way of distinguishing
2606              a nested type from a non-nested one (the stabs don't tell
2607              us whether a type is nested), we just ignore the
2608              containing type.  */
2609
2610           p = lexptr;
2611           best_sym = sym;
2612           while (1)
2613             {
2614               /* Skip whitespace.  */
2615               while (*p == ' ' || *p == '\t' || *p == '\n')
2616                 ++p;
2617               if (*p == ':' && p[1] == ':')
2618                 {
2619                   /* Skip the `::'.  */
2620                   p += 2;
2621                   /* Skip whitespace.  */
2622                   while (*p == ' ' || *p == '\t' || *p == '\n')
2623                     ++p;
2624                   namestart = p;
2625                   while (*p == '_' || *p == '$' || (*p >= '0' && *p <= '9')
2626                          || (*p >= 'a' && *p <= 'z')
2627                          || (*p >= 'A' && *p <= 'Z'))
2628                     ++p;
2629                   if (p != namestart)
2630                     {
2631                       struct symbol *cur_sym;
2632                       /* As big as the whole rest of the expression, which is
2633                          at least big enough.  */
2634                       char *ncopy = alloca (strlen (tmp)+strlen (namestart)+3);
2635                       char *tmp1;
2636
2637                       tmp1 = ncopy;
2638                       memcpy (tmp1, tmp, strlen (tmp));
2639                       tmp1 += strlen (tmp);
2640                       memcpy (tmp1, "::", 2);
2641                       tmp1 += 2;
2642                       memcpy (tmp1, namestart, p - namestart);
2643                       tmp1[p - namestart] = '\0';
2644                       cur_sym = lookup_symbol (ncopy, expression_context_block,
2645                                                VAR_NAMESPACE, (int *) NULL,
2646                                                (struct symtab **) NULL);
2647                       if (cur_sym)
2648                         {
2649                           if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
2650                             {
2651                               best_sym = cur_sym;
2652                               lexptr = p;
2653                             }
2654                           else
2655                             break;
2656                         }
2657                       else
2658                         break;
2659                     }
2660                   else
2661                     break;
2662                 }
2663               else
2664                 break;
2665             }
2666
2667           yylval.tsym.type = SYMBOL_TYPE (best_sym);
2668 #else /* not 0 */
2669           yylval.tsym.type = SYMBOL_TYPE (sym);
2670 #endif /* not 0 */
2671           return TYPENAME;
2672         }
2673     if ((yylval.tsym.type = lookup_primitive_typename (tmp)) != 0)
2674         return TYPENAME;
2675
2676     /* Input names that aren't symbols but ARE valid hex numbers,
2677        when the input radix permits them, can be names or numbers
2678        depending on the parse.  Note we support radixes > 16 here.  */
2679     if (!sym && 
2680         ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2681          (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2682       {
2683         YYSTYPE newlval;        /* Its value is ignored.  */
2684         hextype = parse_number (tokstart, namelen, 0, &newlval);
2685         if (hextype == INT)
2686           {
2687             yylval.ssym.sym = sym;
2688             yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2689             return NAME_OR_INT;
2690           }
2691       }
2692
2693     /* Any other kind of symbol */
2694     yylval.ssym.sym = sym;
2695     yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2696     return NAME;
2697   }
2698 }
2699
2700 void
2701 yyerror (msg)
2702      char *msg;
2703 {
2704   error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2705 }