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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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