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