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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
 
2
/*  A Bison parser, made from m2-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 HEX     258
10
#define ERROR   259
11
#define UINT    260
12
#define M2_TRUE 261
13
#define M2_FALSE        262
14
#define CHAR    263
15
#define FLOAT   264
16
#define STRING  265
17
#define NAME    266
18
#define BLOCKNAME       267
19
#define IDENT   268
20
#define VARNAME 269
21
#define TYPENAME        270
22
#define SIZE    271
23
#define CAP     272
24
#define ORD     273
25
#define HIGH    274
26
#define ABS     275
27
#define MIN_FUNC        276
28
#define MAX_FUNC        277
29
#define FLOAT_FUNC      278
30
#define VAL     279
31
#define CHR     280
32
#define ODD     281
33
#define TRUNC   282
34
#define INC     283
35
#define DEC     284
36
#define INCL    285
37
#define EXCL    286
38
#define COLONCOLON      287
39
#define INTERNAL_VAR    288
40
#define ABOVE_COMMA     289
41
#define ASSIGN  290
42
#define LEQ     291
43
#define GEQ     292
44
#define NOTEQUAL        293
45
#define IN      294
46
#define OROR    295
47
#define LOGICAL_AND     296
48
#define DIV     297
49
#define MOD     298
50
#define UNARY   299
51
#define DOT     300
52
#define NOT     301
53
#define QID     302
54
 
55
#line 41 "m2-exp.y"
56
 
57
 
58
#include "defs.h"
59
#include "gdb_string.h"
60
#include "expression.h"
61
#include "language.h"
62
#include "value.h"
63
#include "parser-defs.h"
64
#include "m2-lang.h"
65
#include "bfd.h" /* Required by objfiles.h.  */
66
#include "symfile.h" /* Required by objfiles.h.  */
67
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
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 m2_maxdepth
77
#define yyparse m2_parse
78
#define yylex   m2_lex
79
#define yyerror m2_error
80
#define yylval  m2_lval
81
#define yychar  m2_char
82
#define yydebug m2_debug
83
#define yypact  m2_pact
84
#define yyr1    m2_r1
85
#define yyr2    m2_r2
86
#define yydef   m2_def
87
#define yychk   m2_chk
88
#define yypgo   m2_pgo
89
#define yyact   m2_act
90
#define yyexca  m2_exca
91
#define yyerrflag m2_errflag
92
#define yynerrs m2_nerrs
93
#define yyps    m2_ps
94
#define yypv    m2_pv
95
#define yys     m2_s
96
#define yy_yys  m2_yys
97
#define yystate m2_state
98
#define yytmp   m2_tmp
99
#define yyv     m2_v
100
#define yy_yyv  m2_yyv
101
#define yyval   m2_val
102
#define yylloc  m2_lloc
103
#define yyreds  m2_reds         /* With YYDEBUG defined */
104
#define yytoks  m2_toks         /* With YYDEBUG defined */
105
#define yylhs   m2_yylhs
106
#define yylen   m2_yylen
107
#define yydefred m2_yydefred
108
#define yydgoto m2_yydgoto
109
#define yysindex m2_yysindex
110
#define yyrindex m2_yyrindex
111
#define yygindex m2_yygindex
112
#define yytable  m2_yytable
113
#define yycheck  m2_yycheck
114
 
115
#ifndef YYDEBUG
116
#define YYDEBUG 0                /* Default to no yydebug support */
117
#endif
118
 
119
int yyparse (void);
120
 
121
static int yylex (void);
122
 
123
void yyerror (char *);
124
 
125
#if 0
126
static char *make_qualname (char *, char *);
127
#endif
128
 
129
static int parse_number (int);
130
 
131
/* The sign of the number being parsed. */
132
static int number_sign = 1;
133
 
134
/* The block that the module specified by the qualifer on an identifer is
135
   contained in, */
136
#if 0
137
static struct block *modblock=0;
138
#endif
139
 
140
 
141
#line 131 "m2-exp.y"
142
typedef union
143
  {
144
    LONGEST lval;
145
    ULONGEST ulval;
146
    DOUBLEST dval;
147
    struct symbol *sym;
148
    struct type *tval;
149
    struct stoken sval;
150
    int voidval;
151
    struct block *bval;
152
    enum exp_opcode opcode;
153
    struct internalvar *ivar;
154
 
155
    struct type **tvec;
156
    int *ivec;
157
  } YYSTYPE;
158
#include <stdio.h>
159
 
160
#ifndef __cplusplus
161
#ifndef __STDC__
162
#define const
163
#endif
164
#endif
165
 
166
 
167
 
168
#define YYFINAL         181
169
#define YYFLAG          -32768
170
#define YYNTBASE        68
171
 
172
#define YYTRANSLATE(x) ((unsigned)(x) <= 302 ? yytranslate[x] : 82)
173
 
174
static const char yytranslate[] = {     0,
175
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
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,    44,     2,     2,    48,     2,    60,
179
    64,    52,    50,    35,    51,     2,    53,     2,     2,     2,
180
     2,     2,     2,     2,     2,     2,     2,     2,     2,    38,
181
    42,    39,     2,    49,     2,     2,     2,     2,     2,     2,
182
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
183
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
184
    59,     2,    67,    57,     2,     2,     2,     2,     2,     2,
185
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
186
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
187
     2,     2,    65,     2,    66,    62,     2,     2,     2,     2,
188
     2,     2,     2,     2,     2,     2,     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,     1,     3,     4,     5,     6,
201
     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
202
    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
203
    27,    28,    29,    30,    31,    32,    33,    34,    36,    37,
204
    40,    41,    43,    45,    46,    47,    54,    55,    56,    58,
205
    61,    63
206
};
207
 
208
#if YYDEBUG != 0
209
static const short yyprhs[] = {     0,
210
     0,     2,     4,     6,     9,    10,    14,    17,    20,    22,
211
    24,    29,    34,    39,    44,    49,    54,    59,    66,    71,
212
    76,    81,    84,    89,    96,   101,   108,   112,   114,   118,
213
   125,   132,   136,   141,   142,   148,   149,   155,   156,   158,
214
   162,   164,   168,   173,   178,   182,   186,   190,   194,   198,
215
   202,   206,   210,   214,   218,   222,   226,   230,   234,   238,
216
   242,   246,   250,   252,   254,   256,   258,   260,   262,   264,
217
   269,   271,   273,   275,   279,   281,   283,   287,   289
218
};
219
 
220
static const short yyrhs[] = {    70,
221
     0,    69,     0,    81,     0,    70,    57,     0,     0,    51,
222
    71,    70,     0,    50,    70,     0,    72,    70,     0,    61,
223
     0,    62,     0,    18,    60,    70,    64,     0,    19,    60,
224
    70,    64,     0,    21,    60,    70,    64,     0,    20,    60,
225
    70,    64,     0,    22,    60,    81,    64,     0,    23,    60,
226
    81,    64,     0,    24,    60,    70,    64,     0,    25,    60,
227
    81,    35,    70,    64,     0,    26,    60,    70,    64,     0,
228
    27,    60,    70,    64,     0,    28,    60,    70,    64,     0,
229
    17,    70,     0,    29,    60,    70,    64,     0,    29,    60,
230
    70,    35,    70,    64,     0,    30,    60,    70,    64,     0,
231
    30,    60,    70,    35,    70,    64,     0,    70,    58,    12,
232
     0,    73,     0,    70,    45,    73,     0,    31,    60,    70,
233
    35,    70,    64,     0,    32,    60,    70,    35,    70,    64,
234
     0,    65,    76,    66,     0,    81,    65,    76,    66,     0,
235
     0,    70,    59,    74,    77,    67,     0,     0,    70,    60,
236
    75,    76,    64,     0,     0,    70,     0,    76,    35,    70,
237
     0,    70,     0,    77,    35,    70,     0,    65,    81,    66,
238
    70,     0,    81,    60,    70,    64,     0,    60,    70,    64,
239
     0,    70,    49,    70,     0,    70,    52,    70,     0,    70,
240
    53,    70,     0,    70,    54,    70,     0,    70,    55,    70,
241
     0,    70,    50,    70,     0,    70,    51,    70,     0,    70,
242
    42,    70,     0,    70,    43,    70,     0,    70,    44,    70,
243
     0,    70,    40,    70,     0,    70,    41,    70,     0,    70,
244
    38,    70,     0,    70,    39,    70,     0,    70,    47,    70,
245
     0,    70,    46,    70,     0,    70,    37,    70,     0,     7,
246
     0,     8,     0,     3,     0,     6,     0,     9,     0,    10,
247
     0,    80,     0,    17,    60,    81,    64,     0,    11,     0,
248
    79,     0,    13,     0,    78,    33,    13,     0,    79,     0,
249
    34,     0,    78,    33,    12,     0,    12,     0,    16,     0
250
};
251
 
252
#endif
253
 
254
#if YYDEBUG != 0
255
static const short yyrline[] = { 0,
256
   200,   201,   204,   213,   216,   218,   223,   227,   231,   232,
257
   235,   239,   243,   247,   251,   257,   263,   267,   273,   277,
258
   281,   285,   290,   294,   300,   304,   310,   316,   319,   323,
259
   327,   330,   332,   338,   343,   349,   353,   359,   362,   366,
260
   371,   376,   381,   387,   393,   401,   405,   409,   413,   417,
261
   421,   425,   429,   433,   435,   439,   443,   447,   451,   455,
262
   459,   463,   470,   476,   482,   489,   498,   506,   513,   516,
263
   523,   530,   534,   543,   555,   563,   567,   583,   634
264
};
265
#endif
266
 
267
 
268
#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
269
 
270
static const char * const yytname[] = {   "$","error","$undefined.","INT","HEX",
271
"ERROR","UINT","M2_TRUE","M2_FALSE","CHAR","FLOAT","STRING","NAME","BLOCKNAME",
272
"IDENT","VARNAME","TYPENAME","SIZE","CAP","ORD","HIGH","ABS","MIN_FUNC","MAX_FUNC",
273
"FLOAT_FUNC","VAL","CHR","ODD","TRUNC","INC","DEC","INCL","EXCL","COLONCOLON",
274
"INTERNAL_VAR","','","ABOVE_COMMA","ASSIGN","'<'","'>'","LEQ","GEQ","'='","NOTEQUAL",
275
"'#'","IN","OROR","LOGICAL_AND","'&'","'@'","'+'","'-'","'*'","'/'","DIV","MOD",
276
"UNARY","'^'","DOT","'['","'('","NOT","'~'","QID","')'","'{'","'}'","']'","start",
277
"type_exp","exp","@1","not_exp","set","@2","@3","arglist","non_empty_arglist",
278
"block","fblock","variable","type", NULL
279
};
280
#endif
281
 
282
static const short yyr1[] = {     0,
283
    68,    68,    69,    70,    71,    70,    70,    70,    72,    72,
284
    70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
285
    70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
286
    70,    73,    73,    74,    70,    75,    70,    76,    76,    76,
287
    77,    77,    70,    70,    70,    70,    70,    70,    70,    70,
288
    70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
289
    70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
290
    70,    78,    79,    79,    80,    80,    80,    80,    81
291
};
292
 
293
static const short yyr2[] = {     0,
294
     1,     1,     1,     2,     0,     3,     2,     2,     1,     1,
295
     4,     4,     4,     4,     4,     4,     4,     6,     4,     4,
296
     4,     2,     4,     6,     4,     6,     3,     1,     3,     6,
297
     6,     3,     4,     0,     5,     0,     5,     0,     1,     3,
298
     1,     3,     4,     4,     3,     3,     3,     3,     3,     3,
299
     3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
300
     3,     3,     1,     1,     1,     1,     1,     1,     1,     4,
301
     1,     1,     1,     3,     1,     1,     3,     1,     1
302
};
303
 
304
static const short yydefact[] = {     0,
305
    65,    66,    63,    64,    67,    68,    71,    78,    73,    79,
306
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
307
     0,     0,     0,     0,     0,     0,    76,     0,     5,     0,
308
     9,    10,    38,     2,     1,     0,    28,     0,    75,    69,
309
     3,     0,    22,     0,     0,     0,     0,     0,     0,     0,
310
     0,     0,     0,     0,     0,     0,     0,     0,     0,     7,
311
     0,     0,    39,     0,     0,     0,     0,     0,     0,     0,
312
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
313
     0,     0,     0,     4,     0,    34,    36,     8,     0,     0,
314
    38,     0,     0,     0,     0,     0,     0,     0,     0,     0,
315
     0,     0,     0,     0,     0,     0,     0,     6,    45,     0,
316
    32,     0,    62,    58,    59,    56,    57,    53,    54,    55,
317
    38,    29,     0,    61,    60,    46,    51,    52,    47,    48,
318
    49,    50,    27,     0,    38,    77,    74,     0,     0,    70,
319
    11,    12,    14,    13,    15,    16,    17,     0,    19,    20,
320
    21,     0,    23,     0,    25,     0,     0,    40,    43,    41,
321
     0,     0,    44,    33,     0,     0,     0,     0,     0,     0,
322
    35,    37,    18,    24,    26,    30,    31,    42,     0,     0,
323
 
324
};
325
 
326
static const short yydefgoto[] = {   179,
327
    34,    63,    61,    36,    37,   134,   135,    64,   161,    38,
328
    39,    40,    44
329
};
330
 
331
static const short yypact[] = {   155,
332
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
333
   215,   -27,   -22,   -20,   -19,    14,    24,    26,    27,    28,
334
    29,    31,    32,    33,    35,    36,-32768,   155,-32768,   155,
335
-32768,-32768,   155,-32768,   742,   155,-32768,    -6,    -4,-32768,
336
   -34,   155,     5,   -34,   155,   155,   155,   155,    44,    44,
337
   155,    44,   155,   155,   155,   155,   155,   155,   155,     5,
338
   155,   272,   742,   -31,   -41,   155,   155,   155,   155,   155,
339
   155,   155,   155,   -15,   155,   155,   155,   155,   155,   155,
340
   155,   155,   155,-32768,    85,-32768,-32768,     5,    -5,   155,
341
   155,   -21,   300,   328,   356,   384,    34,    39,   412,    64,
342
   440,   468,   496,    78,   244,   692,   718,     5,-32768,   155,
343
-32768,   155,   766,   -37,   -37,   -37,   -37,   -37,   -37,   -37,
344
   155,-32768,    40,   141,   201,   777,   786,   786,     5,     5,
345
     5,     5,-32768,   155,   155,-32768,-32768,   524,   -29,-32768,
346
-32768,-32768,-32768,-32768,-32768,-32768,-32768,   155,-32768,-32768,
347
-32768,   155,-32768,   155,-32768,   155,   155,   742,     5,   742,
348
   -33,   -32,-32768,-32768,   552,   580,   608,   636,   664,   155,
349
-32768,-32768,-32768,-32768,-32768,-32768,-32768,   742,   100,   106,
350
-32768
351
};
352
 
353
static const short yypgoto[] = {-32768,
354
-32768,     0,-32768,-32768,    37,-32768,-32768,   -86,-32768,-32768,
355
-32768,-32768,    52
356
};
357
 
358
 
359
#define YYLAST          846
360
 
361
 
362
static const short yytable[] = {    35,
363
    10,   170,   110,   110,   139,   110,   136,   137,    75,    76,
364
    43,    77,    78,    79,    80,    81,    82,    83,    90,    84,
365
    85,    86,    87,    91,   112,    90,    89,    60,   -72,    62,
366
    91,   172,    45,   171,   111,    88,   164,    46,    90,    47,
367
    48,    62,   140,    91,    93,    94,    95,    96,   162,   121,
368
    99,    41,   101,   102,   103,   104,   105,   106,   107,    10,
369
   108,    84,    85,    86,    87,   113,   114,   115,   116,   117,
370
   118,   119,   120,    49,   124,   125,   126,   127,   128,   129,
371
   130,   131,   132,    50,    65,    51,    52,    53,    54,   138,
372
    55,    56,    57,    92,    58,    59,   133,   145,   148,   180,
373
    97,    98,   146,   100,    91,   181,     0,     0,     0,   158,
374
   122,   159,   152,     0,    66,    67,    68,    69,    70,    71,
375
    72,    73,    74,    75,    76,   123,    77,    78,    79,    80,
376
    81,    82,    83,   160,    84,    85,    86,    87,     0,     0,
377
     0,   153,     0,     0,     0,     0,     0,   165,     0,     0,
378
     0,   166,     0,   167,     0,   168,   169,     1,     0,     0,
379
     2,     3,     4,     5,     6,     7,     8,     9,     0,   178,
380
    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
381
    20,    21,    22,    23,    24,    25,    26,    76,    27,    77,
382
    78,    79,    80,    81,    82,    83,     0,    84,    85,    86,
383
    87,     0,     0,     0,    28,    29,     0,     0,     0,     0,
384
     0,     0,     0,     0,    30,    31,    32,     1,     0,    33,
385
     2,     3,     4,     5,     6,     7,     8,     9,     0,     0,
386
    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
387
    20,    21,    22,    23,    24,    25,    26,     0,    27,    77,
388
    78,    79,    80,    81,    82,    83,     0,    84,    85,    86,
389
    87,     0,     0,     0,    28,    29,     0,     0,     0,     0,
390
     0,     0,     0,     0,    42,    31,    32,     0,   154,    33,
391
    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
392
    76,     0,    77,    78,    79,    80,    81,    82,    83,     0,
393
    84,    85,    86,    87,     0,     0,     0,   155,    66,    67,
394
    68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
395
    77,    78,    79,    80,    81,    82,    83,     0,    84,    85,
396
    86,    87,     0,     0,     0,   109,    66,    67,    68,    69,
397
    70,    71,    72,    73,    74,    75,    76,     0,    77,    78,
398
    79,    80,    81,    82,    83,     0,    84,    85,    86,    87,
399
     0,     0,     0,   141,    66,    67,    68,    69,    70,    71,
400
    72,    73,    74,    75,    76,     0,    77,    78,    79,    80,
401
    81,    82,    83,     0,    84,    85,    86,    87,     0,     0,
402
     0,   142,    66,    67,    68,    69,    70,    71,    72,    73,
403
    74,    75,    76,     0,    77,    78,    79,    80,    81,    82,
404
    83,     0,    84,    85,    86,    87,     0,     0,     0,   143,
405
    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
406
    76,     0,    77,    78,    79,    80,    81,    82,    83,     0,
407
    84,    85,    86,    87,     0,     0,     0,   144,    66,    67,
408
    68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
409
    77,    78,    79,    80,    81,    82,    83,     0,    84,    85,
410
    86,    87,     0,     0,     0,   147,    66,    67,    68,    69,
411
    70,    71,    72,    73,    74,    75,    76,     0,    77,    78,
412
    79,    80,    81,    82,    83,     0,    84,    85,    86,    87,
413
     0,     0,     0,   149,    66,    67,    68,    69,    70,    71,
414
    72,    73,    74,    75,    76,     0,    77,    78,    79,    80,
415
    81,    82,    83,     0,    84,    85,    86,    87,     0,     0,
416
     0,   150,    66,    67,    68,    69,    70,    71,    72,    73,
417
    74,    75,    76,     0,    77,    78,    79,    80,    81,    82,
418
    83,     0,    84,    85,    86,    87,     0,     0,     0,   151,
419
    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
420
    76,     0,    77,    78,    79,    80,    81,    82,    83,     0,
421
    84,    85,    86,    87,     0,     0,     0,   163,    66,    67,
422
    68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
423
    77,    78,    79,    80,    81,    82,    83,     0,    84,    85,
424
    86,    87,     0,     0,     0,   173,    66,    67,    68,    69,
425
    70,    71,    72,    73,    74,    75,    76,     0,    77,    78,
426
    79,    80,    81,    82,    83,     0,    84,    85,    86,    87,
427
     0,     0,     0,   174,    66,    67,    68,    69,    70,    71,
428
    72,    73,    74,    75,    76,     0,    77,    78,    79,    80,
429
    81,    82,    83,     0,    84,    85,    86,    87,     0,     0,
430
     0,   175,    66,    67,    68,    69,    70,    71,    72,    73,
431
    74,    75,    76,     0,    77,    78,    79,    80,    81,    82,
432
    83,     0,    84,    85,    86,    87,     0,     0,     0,   176,
433
    66,    67,    68,    69,    70,    71,    72,    73,    74,    75,
434
    76,     0,    77,    78,    79,    80,    81,    82,    83,     0,
435
    84,    85,    86,    87,     0,     0,   156,   177,    66,    67,
436
    68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
437
    77,    78,    79,    80,    81,    82,    83,     0,    84,    85,
438
    86,    87,   157,     0,    66,    67,    68,    69,    70,    71,
439
    72,    73,    74,    75,    76,     0,    77,    78,    79,    80,
440
    81,    82,    83,     0,    84,    85,    86,    87,    66,    67,
441
    68,    69,    70,    71,    72,    73,    74,    75,    76,     0,
442
    77,    78,    79,    80,    81,    82,    83,     0,    84,    85,
443
    86,    87,-32768,    67,    68,    69,    70,    71,    72,    73,
444
    74,    75,    76,     0,    77,    78,    79,    80,    81,    82,
445
    83,     0,    84,    85,    86,    87,    78,    79,    80,    81,
446
    82,    83,     0,    84,    85,    86,    87,    80,    81,    82,
447
    83,     0,    84,    85,    86,    87
448
};
449
 
450
static const short yycheck[] = {     0,
451
    16,    35,    35,    35,    91,    35,    12,    13,    46,    47,
452
    11,    49,    50,    51,    52,    53,    54,    55,    60,    57,
453
    58,    59,    60,    65,    66,    60,    33,    28,    33,    30,
454
    65,    64,    60,    67,    66,    36,    66,    60,    60,    60,
455
    60,    42,    64,    65,    45,    46,    47,    48,   135,    65,
456
    51,     0,    53,    54,    55,    56,    57,    58,    59,    16,
457
    61,    57,    58,    59,    60,    66,    67,    68,    69,    70,
458
    71,    72,    73,    60,    75,    76,    77,    78,    79,    80,
459
    81,    82,    83,    60,    33,    60,    60,    60,    60,    90,
460
    60,    60,    60,    42,    60,    60,    12,    64,    35,     0,
461
    49,    50,    64,    52,    65,     0,    -1,    -1,    -1,   110,
462
    74,   112,    35,    -1,    37,    38,    39,    40,    41,    42,
463
    43,    44,    45,    46,    47,    74,    49,    50,    51,    52,
464
    53,    54,    55,   134,    57,    58,    59,    60,    -1,    -1,
465
    -1,    64,    -1,    -1,    -1,    -1,    -1,   148,    -1,    -1,
466
    -1,   152,    -1,   154,    -1,   156,   157,     3,    -1,    -1,
467
     6,     7,     8,     9,    10,    11,    12,    13,    -1,   170,
468
    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
469
    26,    27,    28,    29,    30,    31,    32,    47,    34,    49,
470
    50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
471
    60,    -1,    -1,    -1,    50,    51,    -1,    -1,    -1,    -1,
472
    -1,    -1,    -1,    -1,    60,    61,    62,     3,    -1,    65,
473
     6,     7,     8,     9,    10,    11,    12,    13,    -1,    -1,
474
    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
475
    26,    27,    28,    29,    30,    31,    32,    -1,    34,    49,
476
    50,    51,    52,    53,    54,    55,    -1,    57,    58,    59,
477
    60,    -1,    -1,    -1,    50,    51,    -1,    -1,    -1,    -1,
478
    -1,    -1,    -1,    -1,    60,    61,    62,    -1,    35,    65,
479
    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
480
    47,    -1,    49,    50,    51,    52,    53,    54,    55,    -1,
481
    57,    58,    59,    60,    -1,    -1,    -1,    64,    37,    38,
482
    39,    40,    41,    42,    43,    44,    45,    46,    47,    -1,
483
    49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
484
    59,    60,    -1,    -1,    -1,    64,    37,    38,    39,    40,
485
    41,    42,    43,    44,    45,    46,    47,    -1,    49,    50,
486
    51,    52,    53,    54,    55,    -1,    57,    58,    59,    60,
487
    -1,    -1,    -1,    64,    37,    38,    39,    40,    41,    42,
488
    43,    44,    45,    46,    47,    -1,    49,    50,    51,    52,
489
    53,    54,    55,    -1,    57,    58,    59,    60,    -1,    -1,
490
    -1,    64,    37,    38,    39,    40,    41,    42,    43,    44,
491
    45,    46,    47,    -1,    49,    50,    51,    52,    53,    54,
492
    55,    -1,    57,    58,    59,    60,    -1,    -1,    -1,    64,
493
    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
494
    47,    -1,    49,    50,    51,    52,    53,    54,    55,    -1,
495
    57,    58,    59,    60,    -1,    -1,    -1,    64,    37,    38,
496
    39,    40,    41,    42,    43,    44,    45,    46,    47,    -1,
497
    49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
498
    59,    60,    -1,    -1,    -1,    64,    37,    38,    39,    40,
499
    41,    42,    43,    44,    45,    46,    47,    -1,    49,    50,
500
    51,    52,    53,    54,    55,    -1,    57,    58,    59,    60,
501
    -1,    -1,    -1,    64,    37,    38,    39,    40,    41,    42,
502
    43,    44,    45,    46,    47,    -1,    49,    50,    51,    52,
503
    53,    54,    55,    -1,    57,    58,    59,    60,    -1,    -1,
504
    -1,    64,    37,    38,    39,    40,    41,    42,    43,    44,
505
    45,    46,    47,    -1,    49,    50,    51,    52,    53,    54,
506
    55,    -1,    57,    58,    59,    60,    -1,    -1,    -1,    64,
507
    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
508
    47,    -1,    49,    50,    51,    52,    53,    54,    55,    -1,
509
    57,    58,    59,    60,    -1,    -1,    -1,    64,    37,    38,
510
    39,    40,    41,    42,    43,    44,    45,    46,    47,    -1,
511
    49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
512
    59,    60,    -1,    -1,    -1,    64,    37,    38,    39,    40,
513
    41,    42,    43,    44,    45,    46,    47,    -1,    49,    50,
514
    51,    52,    53,    54,    55,    -1,    57,    58,    59,    60,
515
    -1,    -1,    -1,    64,    37,    38,    39,    40,    41,    42,
516
    43,    44,    45,    46,    47,    -1,    49,    50,    51,    52,
517
    53,    54,    55,    -1,    57,    58,    59,    60,    -1,    -1,
518
    -1,    64,    37,    38,    39,    40,    41,    42,    43,    44,
519
    45,    46,    47,    -1,    49,    50,    51,    52,    53,    54,
520
    55,    -1,    57,    58,    59,    60,    -1,    -1,    -1,    64,
521
    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
522
    47,    -1,    49,    50,    51,    52,    53,    54,    55,    -1,
523
    57,    58,    59,    60,    -1,    -1,    35,    64,    37,    38,
524
    39,    40,    41,    42,    43,    44,    45,    46,    47,    -1,
525
    49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
526
    59,    60,    35,    -1,    37,    38,    39,    40,    41,    42,
527
    43,    44,    45,    46,    47,    -1,    49,    50,    51,    52,
528
    53,    54,    55,    -1,    57,    58,    59,    60,    37,    38,
529
    39,    40,    41,    42,    43,    44,    45,    46,    47,    -1,
530
    49,    50,    51,    52,    53,    54,    55,    -1,    57,    58,
531
    59,    60,    37,    38,    39,    40,    41,    42,    43,    44,
532
    45,    46,    47,    -1,    49,    50,    51,    52,    53,    54,
533
    55,    -1,    57,    58,    59,    60,    50,    51,    52,    53,
534
    54,    55,    -1,    57,    58,    59,    60,    52,    53,    54,
535
    55,    -1,    57,    58,    59,    60
536
};
537
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
538
#line 3 "/usr/lib/bison.simple"
539
/* This file comes from bison-1.27.  */
540
 
541
/* Skeleton output parser for bison,
542
   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
543
 
544
   This program is free software; you can redistribute it and/or modify
545
   it under the terms of the GNU General Public License as published by
546
   the Free Software Foundation; either version 2, or (at your option)
547
   any later version.
548
 
549
   This program is distributed in the hope that it will be useful,
550
   but WITHOUT ANY WARRANTY; without even the implied warranty of
551
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
552
   GNU General Public License for more details.
553
 
554
   You should have received a copy of the GNU General Public License
555
   along with this program; if not, write to the Free Software
556
   Foundation, Inc., 59 Temple Place - Suite 330,
557
   Boston, MA 02111-1307, USA.  */
558
 
559
/* As a special exception, when this file is copied by Bison into a
560
   Bison output file, you may use that output file without restriction.
561
   This special exception was added by the Free Software Foundation
562
   in version 1.24 of Bison.  */
563
 
564
/* This is the parser code that is written into each bison parser
565
  when the %semantic_parser declaration is not specified in the grammar.
566
  It was written by Richard Stallman by simplifying the hairy parser
567
  used when %semantic_parser is specified.  */
568
 
569
#ifndef YYSTACK_USE_ALLOCA
570
#ifdef alloca
571
#define YYSTACK_USE_ALLOCA
572
#else /* alloca not defined */
573
#ifdef __GNUC__
574
#define YYSTACK_USE_ALLOCA
575
#define alloca __builtin_alloca
576
#else /* not GNU C.  */
577
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
578
#define YYSTACK_USE_ALLOCA
579
#include <alloca.h>
580
#else /* not sparc */
581
/* We think this test detects Watcom and Microsoft C.  */
582
/* This used to test MSDOS, but that is a bad idea
583
   since that symbol is in the user namespace.  */
584
#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
585
#if 0 /* No need for xmalloc.h, which pollutes the namespace;
586
         instead, just don't use alloca.  */
587
#endif
588
#else /* not MSDOS, or __TURBOC__ */
589
#if defined(_AIX)
590
/* I don't know what this was needed for, but it pollutes the namespace.
591
   So I turned it off.   rms, 2 May 1997.  */
592
 #pragma alloca
593
#define YYSTACK_USE_ALLOCA
594
#else /* not MSDOS, or __TURBOC__, or _AIX */
595
#if 0
596
#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
597
                 and on HPUX 10.  Eventually we can turn this on.  */
598
#define YYSTACK_USE_ALLOCA
599
#define alloca __builtin_alloca
600
#endif /* __hpux */
601
#endif
602
#endif /* not _AIX */
603
#endif /* not MSDOS, or __TURBOC__ */
604
#endif /* not sparc */
605
#endif /* not GNU C */
606
#endif /* alloca not defined */
607
#endif /* YYSTACK_USE_ALLOCA not defined */
608
 
609
#ifdef YYSTACK_USE_ALLOCA
610
#define YYSTACK_ALLOC alloca
611
#else
612
#define YYSTACK_ALLOC xmalloc
613
#endif
614
 
615
/* Note: there must be only one dollar sign in this file.
616
   It is replaced by the list of actions, each action
617
   as one case of the switch.  */
618
 
619
#define yyerrok         (yyerrstatus = 0)
620
#define yyclearin       (yychar = YYEMPTY)
621
#define YYEMPTY         -2
622
#define YYEOF           0
623
#define YYACCEPT        goto yyacceptlab
624
#define YYABORT         goto yyabortlab
625
#define YYERROR         goto yyerrlab1
626
/* Like YYERROR except do call yyerror.
627
   This remains here temporarily to ease the
628
   transition to the new meaning of YYERROR, for GCC.
629
   Once GCC version 2 has supplanted version 1, this can go.  */
630
#define YYFAIL          goto yyerrlab
631
#define YYRECOVERING()  (!!yyerrstatus)
632
#define YYBACKUP(token, value) \
633
do                                                              \
634
  if (yychar == YYEMPTY && yylen == 1)                          \
635
    { yychar = (token), yylval = (value);                       \
636
      yychar1 = YYTRANSLATE (yychar);                           \
637
      YYPOPSTACK;                                               \
638
      goto yybackup;                                            \
639
    }                                                           \
640
  else                                                          \
641
    { yyerror ("syntax error: cannot back up"); YYERROR; }      \
642
while (0)
643
 
644
#define YYTERROR        1
645
#define YYERRCODE       256
646
 
647
#ifndef YYPURE
648
#define YYLEX           yylex()
649
#endif
650
 
651
#ifdef YYPURE
652
#ifdef YYLSP_NEEDED
653
#ifdef YYLEX_PARAM
654
#define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
655
#else
656
#define YYLEX           yylex(&yylval, &yylloc)
657
#endif
658
#else /* not YYLSP_NEEDED */
659
#ifdef YYLEX_PARAM
660
#define YYLEX           yylex(&yylval, YYLEX_PARAM)
661
#else
662
#define YYLEX           yylex(&yylval)
663
#endif
664
#endif /* not YYLSP_NEEDED */
665
#endif
666
 
667
/* If nonreentrant, generate the variables here */
668
 
669
#ifndef YYPURE
670
 
671
int     yychar;                 /*  the lookahead symbol                */
672
YYSTYPE yylval;                 /*  the semantic value of the           */
673
                                /*  lookahead symbol                    */
674
 
675
#ifdef YYLSP_NEEDED
676
YYLTYPE yylloc;                 /*  location data for the lookahead     */
677
                                /*  symbol                              */
678
#endif
679
 
680
int yynerrs;                    /*  number of parse errors so far       */
681
#endif  /* not YYPURE */
682
 
683
#if YYDEBUG != 0
684
int yydebug;                    /*  nonzero means print parse trace     */
685
/* Since this is uninitialized, it does not stop multiple parsers
686
   from coexisting.  */
687
#endif
688
 
689
/*  YYINITDEPTH indicates the initial size of the parser's stacks       */
690
 
691
#ifndef YYINITDEPTH
692
#define YYINITDEPTH 200
693
#endif
694
 
695
/*  YYMAXDEPTH is the maximum size the stacks can grow to
696
    (effective only if the built-in stack extension method is used).  */
697
 
698
#if YYMAXDEPTH == 0
699
#undef YYMAXDEPTH
700
#endif
701
 
702
#ifndef YYMAXDEPTH
703
#define YYMAXDEPTH 10000
704
#endif
705
 
706
/* Define __yy_memcpy.  Note that the size argument
707
   should be passed with type unsigned int, because that is what the non-GCC
708
   definitions require.  With GCC, __builtin_memcpy takes an arg
709
   of type size_t, but it can handle unsigned int.  */
710
 
711
#if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
712
#define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
713
#else                           /* not GNU C or C++ */
714
#ifndef __cplusplus
715
 
716
/* This is the most reliable way to avoid incompatibilities
717
   in available built-in functions on various systems.  */
718
static void
719
__yy_memcpy (to, from, count)
720
     char *to;
721
     char *from;
722
     unsigned int count;
723
{
724
  register char *f = from;
725
  register char *t = to;
726
  register int i = count;
727
 
728
  while (i-- > 0)
729
    *t++ = *f++;
730
}
731
 
732
#else /* __cplusplus */
733
 
734
/* This is the most reliable way to avoid incompatibilities
735
   in available built-in functions on various systems.  */
736
static void
737
__yy_memcpy (char *to, char *from, unsigned int count)
738
{
739
  register char *t = to;
740
  register char *f = from;
741
  register int i = count;
742
 
743
  while (i-- > 0)
744
    *t++ = *f++;
745
}
746
 
747
#endif
748
#endif
749
 
750
#line 216 "/usr/lib/bison.simple"
751
 
752
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
753
   into yyparse.  The argument should have type void *.
754
   It should actually point to an object.
755
   Grammar actions can access the variable by casting it
756
   to the proper pointer type.  */
757
 
758
#ifdef YYPARSE_PARAM
759
#ifdef __cplusplus
760
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
761
#define YYPARSE_PARAM_DECL
762
#else /* not __cplusplus */
763
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
764
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
765
#endif /* not __cplusplus */
766
#else /* not YYPARSE_PARAM */
767
#define YYPARSE_PARAM_ARG
768
#define YYPARSE_PARAM_DECL
769
#endif /* not YYPARSE_PARAM */
770
 
771
/* Prevent warning if -Wstrict-prototypes.  */
772
#ifdef __GNUC__
773
#ifdef YYPARSE_PARAM
774
int yyparse (void *);
775
#else
776
int yyparse (void);
777
#endif
778
#endif
779
 
780
int
781
yyparse(YYPARSE_PARAM_ARG)
782
     YYPARSE_PARAM_DECL
783
{
784
  register int yystate;
785
  register int yyn;
786
  register short *yyssp;
787
  register YYSTYPE *yyvsp;
788
  int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
789
  int yychar1 = 0;               /*  lookahead token as an internal (translated) token number */
790
 
791
  short yyssa[YYINITDEPTH];     /*  the state stack                     */
792
  YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
793
 
794
  short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
795
  YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to xreallocate them elsewhere */
796
 
797
#ifdef YYLSP_NEEDED
798
  YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
799
  YYLTYPE *yyls = yylsa;
800
  YYLTYPE *yylsp;
801
 
802
#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
803
#else
804
#define YYPOPSTACK   (yyvsp--, yyssp--)
805
#endif
806
 
807
  int yystacksize = YYINITDEPTH;
808
  int yyfree_stacks = 0;
809
 
810
#ifdef YYPURE
811
  int yychar;
812
  YYSTYPE yylval;
813
  int yynerrs;
814
#ifdef YYLSP_NEEDED
815
  YYLTYPE yylloc;
816
#endif
817
#endif
818
 
819
  YYSTYPE yyval;                /*  the variable used to return         */
820
                                /*  semantic values from the action     */
821
                                /*  routines                            */
822
 
823
  int yylen;
824
 
825
#if YYDEBUG != 0
826
  if (yydebug)
827
    fprintf(stderr, "Starting parse\n");
828
#endif
829
 
830
  yystate = 0;
831
  yyerrstatus = 0;
832
  yynerrs = 0;
833
  yychar = YYEMPTY;             /* Cause a token to be read.  */
834
 
835
  /* Initialize stack pointers.
836
     Waste one element of value and location stack
837
     so that they stay on the same level as the state stack.
838
     The wasted elements are never initialized.  */
839
 
840
  yyssp = yyss - 1;
841
  yyvsp = yyvs;
842
#ifdef YYLSP_NEEDED
843
  yylsp = yyls;
844
#endif
845
 
846
/* Push a new state, which is found in  yystate  .  */
847
/* In all cases, when you get here, the value and location stacks
848
   have just been pushed. so pushing a state here evens the stacks.  */
849
yynewstate:
850
 
851
  *++yyssp = yystate;
852
 
853
  if (yyssp >= yyss + yystacksize - 1)
854
    {
855
      /* Give user a chance to xreallocate the stack */
856
      /* Use copies of these so that the &'s don't force the real ones into memory. */
857
      YYSTYPE *yyvs1 = yyvs;
858
      short *yyss1 = yyss;
859
#ifdef YYLSP_NEEDED
860
      YYLTYPE *yyls1 = yyls;
861
#endif
862
 
863
      /* Get the current used size of the three stacks, in elements.  */
864
      int size = yyssp - yyss + 1;
865
 
866
#ifdef yyoverflow
867
      /* Each stack pointer address is followed by the size of
868
         the data in use in that stack, in bytes.  */
869
#ifdef YYLSP_NEEDED
870
      /* This used to be a conditional around just the two extra args,
871
         but that might be undefined if yyoverflow is a macro.  */
872
      yyoverflow("parser stack overflow",
873
                 &yyss1, size * sizeof (*yyssp),
874
                 &yyvs1, size * sizeof (*yyvsp),
875
                 &yyls1, size * sizeof (*yylsp),
876
                 &yystacksize);
877
#else
878
      yyoverflow("parser stack overflow",
879
                 &yyss1, size * sizeof (*yyssp),
880
                 &yyvs1, size * sizeof (*yyvsp),
881
                 &yystacksize);
882
#endif
883
 
884
      yyss = yyss1; yyvs = yyvs1;
885
#ifdef YYLSP_NEEDED
886
      yyls = yyls1;
887
#endif
888
#else /* no yyoverflow */
889
      /* Extend the stack our own way.  */
890
      if (yystacksize >= YYMAXDEPTH)
891
        {
892
          yyerror("parser stack overflow");
893
          if (yyfree_stacks)
894
            {
895
              free (yyss);
896
              free (yyvs);
897
#ifdef YYLSP_NEEDED
898
              free (yyls);
899
#endif
900
            }
901
          return 2;
902
        }
903
      yystacksize *= 2;
904
      if (yystacksize > YYMAXDEPTH)
905
        yystacksize = YYMAXDEPTH;
906
#ifndef YYSTACK_USE_ALLOCA
907
      yyfree_stacks = 1;
908
#endif
909
      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
910
      __yy_memcpy ((char *)yyss, (char *)yyss1,
911
                   size * (unsigned int) sizeof (*yyssp));
912
      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
913
      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
914
                   size * (unsigned int) sizeof (*yyvsp));
915
#ifdef YYLSP_NEEDED
916
      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
917
      __yy_memcpy ((char *)yyls, (char *)yyls1,
918
                   size * (unsigned int) sizeof (*yylsp));
919
#endif
920
#endif /* no yyoverflow */
921
 
922
      yyssp = yyss + size - 1;
923
      yyvsp = yyvs + size - 1;
924
#ifdef YYLSP_NEEDED
925
      yylsp = yyls + size - 1;
926
#endif
927
 
928
#if YYDEBUG != 0
929
      if (yydebug)
930
        fprintf(stderr, "Stack size increased to %d\n", yystacksize);
931
#endif
932
 
933
      if (yyssp >= yyss + yystacksize - 1)
934
        YYABORT;
935
    }
936
 
937
#if YYDEBUG != 0
938
  if (yydebug)
939
    fprintf(stderr, "Entering state %d\n", yystate);
940
#endif
941
 
942
  goto yybackup;
943
 yybackup:
944
 
945
/* Do appropriate processing given the current state.  */
946
/* Read a lookahead token if we need one and don't already have one.  */
947
/* yyresume: */
948
 
949
  /* First try to decide what to do without reference to lookahead token.  */
950
 
951
  yyn = yypact[yystate];
952
  if (yyn == YYFLAG)
953
    goto yydefault;
954
 
955
  /* Not known => get a lookahead token if don't already have one.  */
956
 
957
  /* yychar is either YYEMPTY or YYEOF
958
     or a valid token in external form.  */
959
 
960
  if (yychar == YYEMPTY)
961
    {
962
#if YYDEBUG != 0
963
      if (yydebug)
964
        fprintf(stderr, "Reading a token: ");
965
#endif
966
      yychar = YYLEX;
967
    }
968
 
969
  /* Convert token to internal form (in yychar1) for indexing tables with */
970
 
971
  if (yychar <= 0)               /* This means end of input. */
972
    {
973
      yychar1 = 0;
974
      yychar = YYEOF;           /* Don't call YYLEX any more */
975
 
976
#if YYDEBUG != 0
977
      if (yydebug)
978
        fprintf(stderr, "Now at end of input.\n");
979
#endif
980
    }
981
  else
982
    {
983
      yychar1 = YYTRANSLATE(yychar);
984
 
985
#if YYDEBUG != 0
986
      if (yydebug)
987
        {
988
          fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
989
          /* Give the individual parser a way to print the precise meaning
990
             of a token, for further debugging info.  */
991
#ifdef YYPRINT
992
          YYPRINT (stderr, yychar, yylval);
993
#endif
994
          fprintf (stderr, ")\n");
995
        }
996
#endif
997
    }
998
 
999
  yyn += yychar1;
1000
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1001
    goto yydefault;
1002
 
1003
  yyn = yytable[yyn];
1004
 
1005
  /* yyn is what to do for this token type in this state.
1006
     Negative => reduce, -yyn is rule number.
1007
     Positive => shift, yyn is new state.
1008
       New state is final state => don't bother to shift,
1009
       just return success.
1010
     0, or most negative number => error.  */
1011
 
1012
  if (yyn < 0)
1013
    {
1014
      if (yyn == YYFLAG)
1015
        goto yyerrlab;
1016
      yyn = -yyn;
1017
      goto yyreduce;
1018
    }
1019
  else if (yyn == 0)
1020
    goto yyerrlab;
1021
 
1022
  if (yyn == YYFINAL)
1023
    YYACCEPT;
1024
 
1025
  /* Shift the lookahead token.  */
1026
 
1027
#if YYDEBUG != 0
1028
  if (yydebug)
1029
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1030
#endif
1031
 
1032
  /* Discard the token being shifted unless it is eof.  */
1033
  if (yychar != YYEOF)
1034
    yychar = YYEMPTY;
1035
 
1036
  *++yyvsp = yylval;
1037
#ifdef YYLSP_NEEDED
1038
  *++yylsp = yylloc;
1039
#endif
1040
 
1041
  /* count tokens shifted since error; after three, turn off error status.  */
1042
  if (yyerrstatus) yyerrstatus--;
1043
 
1044
  yystate = yyn;
1045
  goto yynewstate;
1046
 
1047
/* Do the default action for the current state.  */
1048
yydefault:
1049
 
1050
  yyn = yydefact[yystate];
1051
  if (yyn == 0)
1052
    goto yyerrlab;
1053
 
1054
/* Do a reduction.  yyn is the number of a rule to reduce with.  */
1055
yyreduce:
1056
  yylen = yyr2[yyn];
1057
  if (yylen > 0)
1058
    yyval = yyvsp[1-yylen]; /* implement default value of the action */
1059
 
1060
#if YYDEBUG != 0
1061
  if (yydebug)
1062
    {
1063
      int i;
1064
 
1065
      fprintf (stderr, "Reducing via rule %d (line %d), ",
1066
               yyn, yyrline[yyn]);
1067
 
1068
      /* Print the symbols being reduced, and their result.  */
1069
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1070
        fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1071
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1072
    }
1073
#endif
1074
 
1075
 
1076
  switch (yyn) {
1077
 
1078
case 3:
1079
#line 205 "m2-exp.y"
1080
{ write_exp_elt_opcode(OP_TYPE);
1081
                  write_exp_elt_type(yyvsp[0].tval);
1082
                  write_exp_elt_opcode(OP_TYPE);
1083
                ;
1084
    break;}
1085
case 4:
1086
#line 214 "m2-exp.y"
1087
{ write_exp_elt_opcode (UNOP_IND); ;
1088
    break;}
1089
case 5:
1090
#line 217 "m2-exp.y"
1091
{ number_sign = -1; ;
1092
    break;}
1093
case 6:
1094
#line 219 "m2-exp.y"
1095
{ number_sign = 1;
1096
                          write_exp_elt_opcode (UNOP_NEG); ;
1097
    break;}
1098
case 7:
1099
#line 224 "m2-exp.y"
1100
{ write_exp_elt_opcode(UNOP_PLUS); ;
1101
    break;}
1102
case 8:
1103
#line 228 "m2-exp.y"
1104
{ write_exp_elt_opcode (UNOP_LOGICAL_NOT); ;
1105
    break;}
1106
case 11:
1107
#line 236 "m2-exp.y"
1108
{ write_exp_elt_opcode (UNOP_CAP); ;
1109
    break;}
1110
case 12:
1111
#line 240 "m2-exp.y"
1112
{ write_exp_elt_opcode (UNOP_ORD); ;
1113
    break;}
1114
case 13:
1115
#line 244 "m2-exp.y"
1116
{ write_exp_elt_opcode (UNOP_ABS); ;
1117
    break;}
1118
case 14:
1119
#line 248 "m2-exp.y"
1120
{ write_exp_elt_opcode (UNOP_HIGH); ;
1121
    break;}
1122
case 15:
1123
#line 252 "m2-exp.y"
1124
{ write_exp_elt_opcode (UNOP_MIN);
1125
                          write_exp_elt_type (yyvsp[-1].tval);
1126
                          write_exp_elt_opcode (UNOP_MIN); ;
1127
    break;}
1128
case 16:
1129
#line 258 "m2-exp.y"
1130
{ write_exp_elt_opcode (UNOP_MAX);
1131
                          write_exp_elt_type (yyvsp[-1].tval);
1132
                          write_exp_elt_opcode (UNOP_MIN); ;
1133
    break;}
1134
case 17:
1135
#line 264 "m2-exp.y"
1136
{ write_exp_elt_opcode (UNOP_FLOAT); ;
1137
    break;}
1138
case 18:
1139
#line 268 "m2-exp.y"
1140
{ write_exp_elt_opcode (BINOP_VAL);
1141
                          write_exp_elt_type (yyvsp[-3].tval);
1142
                          write_exp_elt_opcode (BINOP_VAL); ;
1143
    break;}
1144
case 19:
1145
#line 274 "m2-exp.y"
1146
{ write_exp_elt_opcode (UNOP_CHR); ;
1147
    break;}
1148
case 20:
1149
#line 278 "m2-exp.y"
1150
{ write_exp_elt_opcode (UNOP_ODD); ;
1151
    break;}
1152
case 21:
1153
#line 282 "m2-exp.y"
1154
{ write_exp_elt_opcode (UNOP_TRUNC); ;
1155
    break;}
1156
case 22:
1157
#line 286 "m2-exp.y"
1158
{ write_exp_elt_opcode (UNOP_SIZEOF); ;
1159
    break;}
1160
case 23:
1161
#line 291 "m2-exp.y"
1162
{ write_exp_elt_opcode(UNOP_PREINCREMENT); ;
1163
    break;}
1164
case 24:
1165
#line 295 "m2-exp.y"
1166
{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
1167
                          write_exp_elt_opcode(BINOP_ADD);
1168
                          write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
1169
    break;}
1170
case 25:
1171
#line 301 "m2-exp.y"
1172
{ write_exp_elt_opcode(UNOP_PREDECREMENT);;
1173
    break;}
1174
case 26:
1175
#line 305 "m2-exp.y"
1176
{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
1177
                          write_exp_elt_opcode(BINOP_SUB);
1178
                          write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); ;
1179
    break;}
1180
case 27:
1181
#line 311 "m2-exp.y"
1182
{ write_exp_elt_opcode (STRUCTOP_STRUCT);
1183
                          write_exp_string (yyvsp[0].sval);
1184
                          write_exp_elt_opcode (STRUCTOP_STRUCT); ;
1185
    break;}
1186
case 29:
1187
#line 320 "m2-exp.y"
1188
{ error("Sets are not implemented.");;
1189
    break;}
1190
case 30:
1191
#line 324 "m2-exp.y"
1192
{ error("Sets are not implemented.");;
1193
    break;}
1194
case 31:
1195
#line 328 "m2-exp.y"
1196
{ error("Sets are not implemented.");;
1197
    break;}
1198
case 32:
1199
#line 331 "m2-exp.y"
1200
{ error("Sets are not implemented.");;
1201
    break;}
1202
case 33:
1203
#line 333 "m2-exp.y"
1204
{ error("Sets are not implemented.");;
1205
    break;}
1206
case 34:
1207
#line 342 "m2-exp.y"
1208
{ start_arglist(); ;
1209
    break;}
1210
case 35:
1211
#line 344 "m2-exp.y"
1212
{ write_exp_elt_opcode (MULTI_SUBSCRIPT);
1213
                          write_exp_elt_longcst ((LONGEST) end_arglist());
1214
                          write_exp_elt_opcode (MULTI_SUBSCRIPT); ;
1215
    break;}
1216
case 36:
1217
#line 352 "m2-exp.y"
1218
{ start_arglist (); ;
1219
    break;}
1220
case 37:
1221
#line 354 "m2-exp.y"
1222
{ write_exp_elt_opcode (OP_FUNCALL);
1223
                          write_exp_elt_longcst ((LONGEST) end_arglist ());
1224
                          write_exp_elt_opcode (OP_FUNCALL); ;
1225
    break;}
1226
case 39:
1227
#line 363 "m2-exp.y"
1228
{ arglist_len = 1; ;
1229
    break;}
1230
case 40:
1231
#line 367 "m2-exp.y"
1232
{ arglist_len++; ;
1233
    break;}
1234
case 41:
1235
#line 372 "m2-exp.y"
1236
{ arglist_len = 1; ;
1237
    break;}
1238
case 42:
1239
#line 377 "m2-exp.y"
1240
{ arglist_len++; ;
1241
    break;}
1242
case 43:
1243
#line 382 "m2-exp.y"
1244
{ write_exp_elt_opcode (UNOP_MEMVAL);
1245
                          write_exp_elt_type (yyvsp[-2].tval);
1246
                          write_exp_elt_opcode (UNOP_MEMVAL); ;
1247
    break;}
1248
case 44:
1249
#line 388 "m2-exp.y"
1250
{ write_exp_elt_opcode (UNOP_CAST);
1251
                          write_exp_elt_type (yyvsp[-3].tval);
1252
                          write_exp_elt_opcode (UNOP_CAST); ;
1253
    break;}
1254
case 45:
1255
#line 394 "m2-exp.y"
1256
{ ;
1257
    break;}
1258
case 46:
1259
#line 402 "m2-exp.y"
1260
{ write_exp_elt_opcode (BINOP_REPEAT); ;
1261
    break;}
1262
case 47:
1263
#line 406 "m2-exp.y"
1264
{ write_exp_elt_opcode (BINOP_MUL); ;
1265
    break;}
1266
case 48:
1267
#line 410 "m2-exp.y"
1268
{ write_exp_elt_opcode (BINOP_DIV); ;
1269
    break;}
1270
case 49:
1271
#line 414 "m2-exp.y"
1272
{ write_exp_elt_opcode (BINOP_INTDIV); ;
1273
    break;}
1274
case 50:
1275
#line 418 "m2-exp.y"
1276
{ write_exp_elt_opcode (BINOP_REM); ;
1277
    break;}
1278
case 51:
1279
#line 422 "m2-exp.y"
1280
{ write_exp_elt_opcode (BINOP_ADD); ;
1281
    break;}
1282
case 52:
1283
#line 426 "m2-exp.y"
1284
{ write_exp_elt_opcode (BINOP_SUB); ;
1285
    break;}
1286
case 53:
1287
#line 430 "m2-exp.y"
1288
{ write_exp_elt_opcode (BINOP_EQUAL); ;
1289
    break;}
1290
case 54:
1291
#line 434 "m2-exp.y"
1292
{ write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1293
    break;}
1294
case 55:
1295
#line 436 "m2-exp.y"
1296
{ write_exp_elt_opcode (BINOP_NOTEQUAL); ;
1297
    break;}
1298
case 56:
1299
#line 440 "m2-exp.y"
1300
{ write_exp_elt_opcode (BINOP_LEQ); ;
1301
    break;}
1302
case 57:
1303
#line 444 "m2-exp.y"
1304
{ write_exp_elt_opcode (BINOP_GEQ); ;
1305
    break;}
1306
case 58:
1307
#line 448 "m2-exp.y"
1308
{ write_exp_elt_opcode (BINOP_LESS); ;
1309
    break;}
1310
case 59:
1311
#line 452 "m2-exp.y"
1312
{ write_exp_elt_opcode (BINOP_GTR); ;
1313
    break;}
1314
case 60:
1315
#line 456 "m2-exp.y"
1316
{ write_exp_elt_opcode (BINOP_LOGICAL_AND); ;
1317
    break;}
1318
case 61:
1319
#line 460 "m2-exp.y"
1320
{ write_exp_elt_opcode (BINOP_LOGICAL_OR); ;
1321
    break;}
1322
case 62:
1323
#line 464 "m2-exp.y"
1324
{ write_exp_elt_opcode (BINOP_ASSIGN); ;
1325
    break;}
1326
case 63:
1327
#line 471 "m2-exp.y"
1328
{ write_exp_elt_opcode (OP_BOOL);
1329
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1330
                          write_exp_elt_opcode (OP_BOOL); ;
1331
    break;}
1332
case 64:
1333
#line 477 "m2-exp.y"
1334
{ write_exp_elt_opcode (OP_BOOL);
1335
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1336
                          write_exp_elt_opcode (OP_BOOL); ;
1337
    break;}
1338
case 65:
1339
#line 483 "m2-exp.y"
1340
{ write_exp_elt_opcode (OP_LONG);
1341
                          write_exp_elt_type (builtin_type_m2_int);
1342
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1343
                          write_exp_elt_opcode (OP_LONG); ;
1344
    break;}
1345
case 66:
1346
#line 490 "m2-exp.y"
1347
{
1348
                          write_exp_elt_opcode (OP_LONG);
1349
                          write_exp_elt_type (builtin_type_m2_card);
1350
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1351
                          write_exp_elt_opcode (OP_LONG);
1352
                        ;
1353
    break;}
1354
case 67:
1355
#line 499 "m2-exp.y"
1356
{ write_exp_elt_opcode (OP_LONG);
1357
                          write_exp_elt_type (builtin_type_m2_char);
1358
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1359
                          write_exp_elt_opcode (OP_LONG); ;
1360
    break;}
1361
case 68:
1362
#line 507 "m2-exp.y"
1363
{ write_exp_elt_opcode (OP_DOUBLE);
1364
                          write_exp_elt_type (builtin_type_m2_real);
1365
                          write_exp_elt_dblcst (yyvsp[0].dval);
1366
                          write_exp_elt_opcode (OP_DOUBLE); ;
1367
    break;}
1368
case 70:
1369
#line 517 "m2-exp.y"
1370
{ write_exp_elt_opcode (OP_LONG);
1371
                          write_exp_elt_type (builtin_type_int);
1372
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1373
                          write_exp_elt_opcode (OP_LONG); ;
1374
    break;}
1375
case 71:
1376
#line 524 "m2-exp.y"
1377
{ write_exp_elt_opcode (OP_M2_STRING);
1378
                          write_exp_string (yyvsp[0].sval);
1379
                          write_exp_elt_opcode (OP_M2_STRING); ;
1380
    break;}
1381
case 72:
1382
#line 531 "m2-exp.y"
1383
{ yyval.bval = SYMBOL_BLOCK_VALUE(yyvsp[0].sym); ;
1384
    break;}
1385
case 73:
1386
#line 535 "m2-exp.y"
1387
{ struct symbol *sym
1388
                            = lookup_symbol (copy_name (yyvsp[0].sval), expression_context_block,
1389
                                             VAR_NAMESPACE, 0, NULL);
1390
                          yyval.sym = sym;;
1391
    break;}
1392
case 74:
1393
#line 544 "m2-exp.y"
1394
{ struct symbol *tem
1395
                            = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1396
                                             VAR_NAMESPACE, 0, NULL);
1397
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1398
                            error ("No function \"%s\" in specified context.",
1399
                                   copy_name (yyvsp[0].sval));
1400
                          yyval.sym = tem;
1401
                        ;
1402
    break;}
1403
case 75:
1404
#line 556 "m2-exp.y"
1405
{ write_exp_elt_opcode(OP_VAR_VALUE);
1406
                          write_exp_elt_block (NULL);
1407
                          write_exp_elt_sym (yyvsp[0].sym);
1408
                          write_exp_elt_opcode (OP_VAR_VALUE); ;
1409
    break;}
1410
case 77:
1411
#line 568 "m2-exp.y"
1412
{ struct symbol *sym;
1413
                          sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1414
                                               VAR_NAMESPACE, 0, NULL);
1415
                          if (sym == 0)
1416
                            error ("No symbol \"%s\" in specified context.",
1417
                                   copy_name (yyvsp[0].sval));
1418
 
1419
                          write_exp_elt_opcode (OP_VAR_VALUE);
1420
                          /* block_found is set by lookup_symbol.  */
1421
                          write_exp_elt_block (block_found);
1422
                          write_exp_elt_sym (sym);
1423
                          write_exp_elt_opcode (OP_VAR_VALUE); ;
1424
    break;}
1425
case 78:
1426
#line 584 "m2-exp.y"
1427
{ struct symbol *sym;
1428
                          int is_a_field_of_this;
1429
 
1430
                          sym = lookup_symbol (copy_name (yyvsp[0].sval),
1431
                                               expression_context_block,
1432
                                               VAR_NAMESPACE,
1433
                                               &is_a_field_of_this,
1434
                                               NULL);
1435
                          if (sym)
1436
                            {
1437
                              if (symbol_read_needs_frame (sym))
1438
                                {
1439
                                  if (innermost_block == 0 ||
1440
                                      contained_in (block_found,
1441
                                                    innermost_block))
1442
                                    innermost_block = block_found;
1443
                                }
1444
 
1445
                              write_exp_elt_opcode (OP_VAR_VALUE);
1446
                              /* We want to use the selected frame, not
1447
                                 another more inner frame which happens to
1448
                                 be in the same block.  */
1449
                              write_exp_elt_block (NULL);
1450
                              write_exp_elt_sym (sym);
1451
                              write_exp_elt_opcode (OP_VAR_VALUE);
1452
                            }
1453
                          else
1454
                            {
1455
                              struct minimal_symbol *msymbol;
1456
                              register char *arg = copy_name (yyvsp[0].sval);
1457
 
1458
                              msymbol =
1459
                                lookup_minimal_symbol (arg, NULL, NULL);
1460
                              if (msymbol != NULL)
1461
                                {
1462
                                  write_exp_msymbol
1463
                                    (msymbol,
1464
                                     lookup_function_type (builtin_type_int),
1465
                                     builtin_type_int);
1466
                                }
1467
                              else if (!have_full_symbols () && !have_partial_symbols ())
1468
                                error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
1469
                              else
1470
                                error ("No symbol \"%s\" in current context.",
1471
                                       copy_name (yyvsp[0].sval));
1472
                            }
1473
                        ;
1474
    break;}
1475
case 79:
1476
#line 635 "m2-exp.y"
1477
{ yyval.tval = lookup_typename (copy_name (yyvsp[0].sval),
1478
                                                expression_context_block, 0); ;
1479
    break;}
1480
}
1481
   /* the action file gets copied in in place of this dollarsign */
1482
#line 542 "/usr/lib/bison.simple"
1483
 
1484
  yyvsp -= yylen;
1485
  yyssp -= yylen;
1486
#ifdef YYLSP_NEEDED
1487
  yylsp -= yylen;
1488
#endif
1489
 
1490
#if YYDEBUG != 0
1491
  if (yydebug)
1492
    {
1493
      short *ssp1 = yyss - 1;
1494
      fprintf (stderr, "state stack now");
1495
      while (ssp1 != yyssp)
1496
        fprintf (stderr, " %d", *++ssp1);
1497
      fprintf (stderr, "\n");
1498
    }
1499
#endif
1500
 
1501
  *++yyvsp = yyval;
1502
 
1503
#ifdef YYLSP_NEEDED
1504
  yylsp++;
1505
  if (yylen == 0)
1506
    {
1507
      yylsp->first_line = yylloc.first_line;
1508
      yylsp->first_column = yylloc.first_column;
1509
      yylsp->last_line = (yylsp-1)->last_line;
1510
      yylsp->last_column = (yylsp-1)->last_column;
1511
      yylsp->text = 0;
1512
    }
1513
  else
1514
    {
1515
      yylsp->last_line = (yylsp+yylen-1)->last_line;
1516
      yylsp->last_column = (yylsp+yylen-1)->last_column;
1517
    }
1518
#endif
1519
 
1520
  /* Now "shift" the result of the reduction.
1521
     Determine what state that goes to,
1522
     based on the state we popped back to
1523
     and the rule number reduced by.  */
1524
 
1525
  yyn = yyr1[yyn];
1526
 
1527
  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1528
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1529
    yystate = yytable[yystate];
1530
  else
1531
    yystate = yydefgoto[yyn - YYNTBASE];
1532
 
1533
  goto yynewstate;
1534
 
1535
yyerrlab:   /* here on detecting error */
1536
 
1537
  if (! yyerrstatus)
1538
    /* If not already recovering from an error, report this error.  */
1539
    {
1540
      ++yynerrs;
1541
 
1542
#ifdef YYERROR_VERBOSE
1543
      yyn = yypact[yystate];
1544
 
1545
      if (yyn > YYFLAG && yyn < YYLAST)
1546
        {
1547
          int size = 0;
1548
          char *msg;
1549
          int x, count;
1550
 
1551
          count = 0;
1552
          /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
1553
          for (x = (yyn < 0 ? -yyn : 0);
1554
               x < (sizeof(yytname) / sizeof(char *)); x++)
1555
            if (yycheck[x + yyn] == x)
1556
              size += strlen(yytname[x]) + 15, count++;
1557
          msg = (char *) xmalloc(size + 15);
1558
          if (msg != 0)
1559
            {
1560
              strcpy(msg, "parse error");
1561
 
1562
              if (count < 5)
1563
                {
1564
                  count = 0;
1565
                  for (x = (yyn < 0 ? -yyn : 0);
1566
                       x < (sizeof(yytname) / sizeof(char *)); x++)
1567
                    if (yycheck[x + yyn] == x)
1568
                      {
1569
                        strcat(msg, count == 0 ? ", expecting `" : " or `");
1570
                        strcat(msg, yytname[x]);
1571
                        strcat(msg, "'");
1572
                        count++;
1573
                      }
1574
                }
1575
              yyerror(msg);
1576
              free(msg);
1577
            }
1578
          else
1579
            yyerror ("parse error; also virtual memory exceeded");
1580
        }
1581
      else
1582
#endif /* YYERROR_VERBOSE */
1583
        yyerror("parse error");
1584
    }
1585
 
1586
  goto yyerrlab1;
1587
yyerrlab1:   /* here on error raised explicitly by an action */
1588
 
1589
  if (yyerrstatus == 3)
1590
    {
1591
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
1592
 
1593
      /* return failure if at end of input */
1594
      if (yychar == YYEOF)
1595
        YYABORT;
1596
 
1597
#if YYDEBUG != 0
1598
      if (yydebug)
1599
        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1600
#endif
1601
 
1602
      yychar = YYEMPTY;
1603
    }
1604
 
1605
  /* Else will try to reuse lookahead token
1606
     after shifting the error token.  */
1607
 
1608
  yyerrstatus = 3;              /* Each real token shifted decrements this */
1609
 
1610
  goto yyerrhandle;
1611
 
1612
yyerrdefault:  /* current state does not do anything special for the error token. */
1613
 
1614
#if 0
1615
  /* This is wrong; only states that explicitly want error tokens
1616
     should shift them.  */
1617
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
1618
  if (yyn) goto yydefault;
1619
#endif
1620
 
1621
yyerrpop:   /* pop the current state because it cannot handle the error token */
1622
 
1623
  if (yyssp == yyss) YYABORT;
1624
  yyvsp--;
1625
  yystate = *--yyssp;
1626
#ifdef YYLSP_NEEDED
1627
  yylsp--;
1628
#endif
1629
 
1630
#if YYDEBUG != 0
1631
  if (yydebug)
1632
    {
1633
      short *ssp1 = yyss - 1;
1634
      fprintf (stderr, "Error: state stack now");
1635
      while (ssp1 != yyssp)
1636
        fprintf (stderr, " %d", *++ssp1);
1637
      fprintf (stderr, "\n");
1638
    }
1639
#endif
1640
 
1641
yyerrhandle:
1642
 
1643
  yyn = yypact[yystate];
1644
  if (yyn == YYFLAG)
1645
    goto yyerrdefault;
1646
 
1647
  yyn += YYTERROR;
1648
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1649
    goto yyerrdefault;
1650
 
1651
  yyn = yytable[yyn];
1652
  if (yyn < 0)
1653
    {
1654
      if (yyn == YYFLAG)
1655
        goto yyerrpop;
1656
      yyn = -yyn;
1657
      goto yyreduce;
1658
    }
1659
  else if (yyn == 0)
1660
    goto yyerrpop;
1661
 
1662
  if (yyn == YYFINAL)
1663
    YYACCEPT;
1664
 
1665
#if YYDEBUG != 0
1666
  if (yydebug)
1667
    fprintf(stderr, "Shifting error token, ");
1668
#endif
1669
 
1670
  *++yyvsp = yylval;
1671
#ifdef YYLSP_NEEDED
1672
  *++yylsp = yylloc;
1673
#endif
1674
 
1675
  yystate = yyn;
1676
  goto yynewstate;
1677
 
1678
 yyacceptlab:
1679
  /* YYACCEPT comes here.  */
1680
  if (yyfree_stacks)
1681
    {
1682
      free (yyss);
1683
      free (yyvs);
1684
#ifdef YYLSP_NEEDED
1685
      free (yyls);
1686
#endif
1687
    }
1688
  return 0;
1689
 
1690
 yyabortlab:
1691
  /* YYABORT comes here.  */
1692
  if (yyfree_stacks)
1693
    {
1694
      free (yyss);
1695
      free (yyvs);
1696
#ifdef YYLSP_NEEDED
1697
      free (yyls);
1698
#endif
1699
    }
1700
  return 1;
1701
}
1702
#line 640 "m2-exp.y"
1703
 
1704
 
1705
#if 0  /* FIXME! */
1706
int
1707
overflow(a,b)
1708
   long a,b;
1709
{
1710
   return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
1711
}
1712
 
1713
int
1714
uoverflow(a,b)
1715
   unsigned long a,b;
1716
{
1717
   return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
1718
}
1719
#endif /* FIXME */
1720
 
1721
/* Take care of parsing a number (anything that starts with a digit).
1722
   Set yylval and return the token type; update lexptr.
1723
   LEN is the number of characters in it.  */
1724
 
1725
/*** Needs some error checking for the float case ***/
1726
 
1727
static int
1728
parse_number (olen)
1729
     int olen;
1730
{
1731
  register char *p = lexptr;
1732
  register LONGEST n = 0;
1733
  register LONGEST prevn = 0;
1734
  register int c,i,ischar=0;
1735
  register int base = input_radix;
1736
  register int len = olen;
1737
  int unsigned_p = number_sign == 1 ? 1 : 0;
1738
 
1739
  if(p[len-1] == 'H')
1740
  {
1741
     base = 16;
1742
     len--;
1743
  }
1744
  else if(p[len-1] == 'C' || p[len-1] == 'B')
1745
  {
1746
     base = 8;
1747
     ischar = p[len-1] == 'C';
1748
     len--;
1749
  }
1750
 
1751
  /* Scan the number */
1752
  for (c = 0; c < len; c++)
1753
  {
1754
    if (p[c] == '.' && base == 10)
1755
      {
1756
        /* It's a float since it contains a point.  */
1757
        yylval.dval = atof (p);
1758
        lexptr += len;
1759
        return FLOAT;
1760
      }
1761
    if (p[c] == '.' && base != 10)
1762
       error("Floating point numbers must be base 10.");
1763
    if (base == 10 && (p[c] < '0' || p[c] > '9'))
1764
       error("Invalid digit \'%c\' in number.",p[c]);
1765
 }
1766
 
1767
  while (len-- > 0)
1768
    {
1769
      c = *p++;
1770
      n *= base;
1771
      if( base == 8 && (c == '8' || c == '9'))
1772
         error("Invalid digit \'%c\' in octal number.",c);
1773
      if (c >= '0' && c <= '9')
1774
        i = c - '0';
1775
      else
1776
        {
1777
          if (base == 16 && c >= 'A' && c <= 'F')
1778
            i = c - 'A' + 10;
1779
          else
1780
             return ERROR;
1781
        }
1782
      n+=i;
1783
      if(i >= base)
1784
         return ERROR;
1785
      if(!unsigned_p && number_sign == 1 && (prevn >= n))
1786
         unsigned_p=1;          /* Try something unsigned */
1787
      /* Don't do the range check if n==i and i==0, since that special
1788
         case will give an overflow error. */
1789
      if(RANGE_CHECK && n!=i && i)
1790
      {
1791
         if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
1792
            ((!unsigned_p && number_sign==-1) && -prevn <= -n))
1793
            range_error("Overflow on numeric constant.");
1794
      }
1795
         prevn=n;
1796
    }
1797
 
1798
  lexptr = p;
1799
  if(*p == 'B' || *p == 'C' || *p == 'H')
1800
     lexptr++;                  /* Advance past B,C or H */
1801
 
1802
  if (ischar)
1803
  {
1804
     yylval.ulval = n;
1805
     return CHAR;
1806
  }
1807
  else if ( unsigned_p && number_sign == 1)
1808
  {
1809
     yylval.ulval = n;
1810
     return UINT;
1811
  }
1812
  else if((unsigned_p && (n<0))) {
1813
     range_error("Overflow on numeric constant -- number too large.");
1814
     /* But, this can return if range_check == range_warn.  */
1815
  }
1816
  yylval.lval = n;
1817
  return INT;
1818
}
1819
 
1820
 
1821
/* Some tokens */
1822
 
1823
static struct
1824
{
1825
   char name[2];
1826
   int token;
1827
} tokentab2[] =
1828
{
1829
    { {'<', '>'},    NOTEQUAL   },
1830
    { {':', '='},    ASSIGN     },
1831
    { {'<', '='},    LEQ        },
1832
    { {'>', '='},    GEQ        },
1833
    { {':', ':'},    COLONCOLON },
1834
 
1835
};
1836
 
1837
/* Some specific keywords */
1838
 
1839
struct keyword {
1840
   char keyw[10];
1841
   int token;
1842
};
1843
 
1844
static struct keyword keytab[] =
1845
{
1846
    {"OR" ,   OROR       },
1847
    {"IN",    IN         },/* Note space after IN */
1848
    {"AND",   LOGICAL_AND},
1849
    {"ABS",   ABS        },
1850
    {"CHR",   CHR        },
1851
    {"DEC",   DEC        },
1852
    {"NOT",   NOT        },
1853
    {"DIV",   DIV        },
1854
    {"INC",   INC        },
1855
    {"MAX",   MAX_FUNC   },
1856
    {"MIN",   MIN_FUNC   },
1857
    {"MOD",   MOD        },
1858
    {"ODD",   ODD        },
1859
    {"CAP",   CAP        },
1860
    {"ORD",   ORD        },
1861
    {"VAL",   VAL        },
1862
    {"EXCL",  EXCL       },
1863
    {"HIGH",  HIGH       },
1864
    {"INCL",  INCL       },
1865
    {"SIZE",  SIZE       },
1866
    {"FLOAT", FLOAT_FUNC },
1867
    {"TRUNC", TRUNC      },
1868
};
1869
 
1870
 
1871
/* Read one token, getting characters through lexptr.  */
1872
 
1873
/* This is where we will check to make sure that the language and the operators used are
1874
   compatible  */
1875
 
1876
static int
1877
yylex ()
1878
{
1879
  register int c;
1880
  register int namelen;
1881
  register int i;
1882
  register char *tokstart;
1883
  register char quote;
1884
 
1885
 retry:
1886
 
1887
  tokstart = lexptr;
1888
 
1889
 
1890
  /* See if it is a special token of length 2 */
1891
  for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++)
1892
     if(STREQN(tokentab2[i].name, tokstart, 2))
1893
     {
1894
        lexptr += 2;
1895
        return tokentab2[i].token;
1896
     }
1897
 
1898
  switch (c = *tokstart)
1899
    {
1900
    case 0:
1901
      return 0;
1902
 
1903
    case ' ':
1904
    case '\t':
1905
    case '\n':
1906
      lexptr++;
1907
      goto retry;
1908
 
1909
    case '(':
1910
      paren_depth++;
1911
      lexptr++;
1912
      return c;
1913
 
1914
    case ')':
1915
      if (paren_depth == 0)
1916
        return 0;
1917
      paren_depth--;
1918
      lexptr++;
1919
      return c;
1920
 
1921
    case ',':
1922
      if (comma_terminates && paren_depth == 0)
1923
        return 0;
1924
      lexptr++;
1925
      return c;
1926
 
1927
    case '.':
1928
      /* Might be a floating point number.  */
1929
      if (lexptr[1] >= '0' && lexptr[1] <= '9')
1930
        break;                  /* Falls into number code.  */
1931
      else
1932
      {
1933
         lexptr++;
1934
         return DOT;
1935
      }
1936
 
1937
/* These are character tokens that appear as-is in the YACC grammar */
1938
    case '+':
1939
    case '-':
1940
    case '*':
1941
    case '/':
1942
    case '^':
1943
    case '<':
1944
    case '>':
1945
    case '[':
1946
    case ']':
1947
    case '=':
1948
    case '{':
1949
    case '}':
1950
    case '#':
1951
    case '@':
1952
    case '~':
1953
    case '&':
1954
      lexptr++;
1955
      return c;
1956
 
1957
    case '\'' :
1958
    case '"':
1959
      quote = c;
1960
      for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
1961
        if (c == '\\')
1962
          {
1963
            c = tokstart[++namelen];
1964
            if (c >= '0' && c <= '9')
1965
              {
1966
                c = tokstart[++namelen];
1967
                if (c >= '0' && c <= '9')
1968
                  c = tokstart[++namelen];
1969
              }
1970
          }
1971
      if(c != quote)
1972
         error("Unterminated string or character constant.");
1973
      yylval.sval.ptr = tokstart + 1;
1974
      yylval.sval.length = namelen - 1;
1975
      lexptr += namelen + 1;
1976
 
1977
      if(namelen == 2)          /* Single character */
1978
      {
1979
           yylval.ulval = tokstart[1];
1980
           return CHAR;
1981
      }
1982
      else
1983
         return STRING;
1984
    }
1985
 
1986
  /* Is it a number?  */
1987
  /* Note:  We have already dealt with the case of the token '.'.
1988
     See case '.' above.  */
1989
  if ((c >= '0' && c <= '9'))
1990
    {
1991
      /* It's a number.  */
1992
      int got_dot = 0, got_e = 0;
1993
      register char *p = tokstart;
1994
      int toktype;
1995
 
1996
      for (++p ;; ++p)
1997
        {
1998
          if (!got_e && (*p == 'e' || *p == 'E'))
1999
            got_dot = got_e = 1;
2000
          else if (!got_dot && *p == '.')
2001
            got_dot = 1;
2002
          else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2003
                   && (*p == '-' || *p == '+'))
2004
            /* This is the sign of the exponent, not the end of the
2005
               number.  */
2006
            continue;
2007
          else if ((*p < '0' || *p > '9') &&
2008
                   (*p < 'A' || *p > 'F') &&
2009
                   (*p != 'H'))  /* Modula-2 hexadecimal number */
2010
            break;
2011
        }
2012
        toktype = parse_number (p - tokstart);
2013
        if (toktype == ERROR)
2014
          {
2015
            char *err_copy = (char *) alloca (p - tokstart + 1);
2016
 
2017
            memcpy (err_copy, tokstart, p - tokstart);
2018
            err_copy[p - tokstart] = 0;
2019
            error ("Invalid number \"%s\".", err_copy);
2020
          }
2021
        lexptr = p;
2022
        return toktype;
2023
    }
2024
 
2025
  if (!(c == '_' || c == '$'
2026
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2027
    /* We must have come across a bad character (e.g. ';').  */
2028
    error ("Invalid character '%c' in expression.", c);
2029
 
2030
  /* It's a name.  See how long it is.  */
2031
  namelen = 0;
2032
  for (c = tokstart[namelen];
2033
       (c == '_' || c == '$' || (c >= '0' && c <= '9')
2034
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2035
       c = tokstart[++namelen])
2036
    ;
2037
 
2038
  /* The token "if" terminates the expression and is NOT
2039
     removed from the input stream.  */
2040
  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2041
    {
2042
      return 0;
2043
    }
2044
 
2045
  lexptr += namelen;
2046
 
2047
  /*  Lookup special keywords */
2048
  for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++)
2049
     if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
2050
           return keytab[i].token;
2051
 
2052
  yylval.sval.ptr = tokstart;
2053
  yylval.sval.length = namelen;
2054
 
2055
  if (*tokstart == '$')
2056
    {
2057
      write_dollar_variable (yylval.sval);
2058
      return INTERNAL_VAR;
2059
    }
2060
 
2061
  /* Use token-type BLOCKNAME for symbols that happen to be defined as
2062
     functions.  If this is not so, then ...
2063
     Use token-type TYPENAME for symbols that happen to be defined
2064
     currently as names of types; NAME for other symbols.
2065
     The caller is not constrained to care about the distinction.  */
2066
 {
2067
 
2068
 
2069
    char *tmp = copy_name (yylval.sval);
2070
    struct symbol *sym;
2071
 
2072
    if (lookup_partial_symtab (tmp))
2073
      return BLOCKNAME;
2074
    sym = lookup_symbol (tmp, expression_context_block,
2075
                         VAR_NAMESPACE, 0, NULL);
2076
    if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
2077
      return BLOCKNAME;
2078
    if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
2079
      return TYPENAME;
2080
 
2081
    if(sym)
2082
    {
2083
       switch(sym->aclass)
2084
       {
2085
       case LOC_STATIC:
2086
       case LOC_REGISTER:
2087
       case LOC_ARG:
2088
       case LOC_REF_ARG:
2089
       case LOC_REGPARM:
2090
       case LOC_REGPARM_ADDR:
2091
       case LOC_LOCAL:
2092
       case LOC_LOCAL_ARG:
2093
       case LOC_BASEREG:
2094
       case LOC_BASEREG_ARG:
2095
       case LOC_CONST:
2096
       case LOC_CONST_BYTES:
2097
       case LOC_OPTIMIZED_OUT:
2098
          return NAME;
2099
 
2100
       case LOC_TYPEDEF:
2101
          return TYPENAME;
2102
 
2103
       case LOC_BLOCK:
2104
          return BLOCKNAME;
2105
 
2106
       case LOC_UNDEF:
2107
          error("internal:  Undefined class in m2lex()");
2108
 
2109
       case LOC_LABEL:
2110
       case LOC_UNRESOLVED:
2111
          error("internal:  Unforseen case in m2lex()");
2112
 
2113
       default:
2114
          error ("unhandled token in m2lex()");
2115
          break;
2116
       }
2117
    }
2118
    else
2119
    {
2120
       /* Built-in BOOLEAN type.  This is sort of a hack. */
2121
       if(STREQN(tokstart,"TRUE",4))
2122
       {
2123
          yylval.ulval = 1;
2124
          return M2_TRUE;
2125
       }
2126
       else if(STREQN(tokstart,"FALSE",5))
2127
       {
2128
          yylval.ulval = 0;
2129
          return M2_FALSE;
2130
       }
2131
    }
2132
 
2133
    /* Must be another type of name... */
2134
    return NAME;
2135
 }
2136
}
2137
 
2138
#if 0           /* Unused */
2139
static char *
2140
make_qualname(mod,ident)
2141
   char *mod, *ident;
2142
{
2143
   char *new = xmalloc(strlen(mod)+strlen(ident)+2);
2144
 
2145
   strcpy(new,mod);
2146
   strcat(new,".");
2147
   strcat(new,ident);
2148
   return new;
2149
}
2150
#endif  /* 0 */
2151
 
2152
void
2153
yyerror (msg)
2154
     char *msg;
2155
{
2156
  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2157
}

powered by: WebSVN 2.1.0

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