OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [c-exp.tab.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.