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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [m2-exp.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* A Bison parser, made by GNU Bison 1.875c.  */
2
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 2, or (at your option)
9
   any later version.
10
 
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
 
16
   You should have received a copy of the GNU General Public License
17
   along with this program; if not, write to the Free Software
18
   Foundation, Inc., 59 Temple Place - Suite 330,
19
   Boston, MA 02111-1307, USA.  */
20
 
21
/* As a special exception, when this file is copied by Bison into a
22
   Bison output file, you may use that output file without restriction.
23
   This special exception was added by the Free Software Foundation
24
   in version 1.24 of Bison.  */
25
 
26
/* Written by Richard Stallman by simplifying the original so called
27
   ``semantic'' parser.  */
28
 
29
/* All symbols defined below should begin with yy or YY, to avoid
30
   infringing on user name space.  This should be done even for local
31
   variables, as they might otherwise be expanded by user macros.
32
   There are some unavoidable exceptions within include files to
33
   define necessary library symbols; they are noted "INFRINGES ON
34
   USER NAME SPACE" below.  */
35
 
36
/* Identify Bison output.  */
37
#define YYBISON 1
38
 
39
/* Skeleton name.  */
40
#define YYSKELETON_NAME "yacc.c"
41
 
42
/* Pure parsers.  */
43
#define YYPURE 0
44
 
45
/* Using locations.  */
46
#define YYLSP_NEEDED 0
47
 
48
 
49
 
50
/* Tokens.  */
51
#ifndef YYTOKENTYPE
52
# define YYTOKENTYPE
53
   /* Put the tokens into the symbol table, so that GDB and other debuggers
54
      know about them.  */
55
   enum yytokentype {
56
     INT = 258,
57
     HEX = 259,
58
     ERROR = 260,
59
     UINT = 261,
60
     M2_TRUE = 262,
61
     M2_FALSE = 263,
62
     CHAR = 264,
63
     FLOAT = 265,
64
     STRING = 266,
65
     NAME = 267,
66
     BLOCKNAME = 268,
67
     IDENT = 269,
68
     VARNAME = 270,
69
     TYPENAME = 271,
70
     SIZE = 272,
71
     CAP = 273,
72
     ORD = 274,
73
     HIGH = 275,
74
     ABS = 276,
75
     MIN_FUNC = 277,
76
     MAX_FUNC = 278,
77
     FLOAT_FUNC = 279,
78
     VAL = 280,
79
     CHR = 281,
80
     ODD = 282,
81
     TRUNC = 283,
82
     TSIZE = 284,
83
     INC = 285,
84
     DEC = 286,
85
     INCL = 287,
86
     EXCL = 288,
87
     COLONCOLON = 289,
88
     INTERNAL_VAR = 290,
89
     ABOVE_COMMA = 291,
90
     ASSIGN = 292,
91
     IN = 293,
92
     NOTEQUAL = 294,
93
     GEQ = 295,
94
     LEQ = 296,
95
     OROR = 297,
96
     LOGICAL_AND = 298,
97
     MOD = 299,
98
     DIV = 300,
99
     UNARY = 301,
100
     DOT = 302,
101
     NOT = 303,
102
     QID = 304
103
   };
104
#endif
105
#define INT 258
106
#define HEX 259
107
#define ERROR 260
108
#define UINT 261
109
#define M2_TRUE 262
110
#define M2_FALSE 263
111
#define CHAR 264
112
#define FLOAT 265
113
#define STRING 266
114
#define NAME 267
115
#define BLOCKNAME 268
116
#define IDENT 269
117
#define VARNAME 270
118
#define TYPENAME 271
119
#define SIZE 272
120
#define CAP 273
121
#define ORD 274
122
#define HIGH 275
123
#define ABS 276
124
#define MIN_FUNC 277
125
#define MAX_FUNC 278
126
#define FLOAT_FUNC 279
127
#define VAL 280
128
#define CHR 281
129
#define ODD 282
130
#define TRUNC 283
131
#define TSIZE 284
132
#define INC 285
133
#define DEC 286
134
#define INCL 287
135
#define EXCL 288
136
#define COLONCOLON 289
137
#define INTERNAL_VAR 290
138
#define ABOVE_COMMA 291
139
#define ASSIGN 292
140
#define IN 293
141
#define NOTEQUAL 294
142
#define GEQ 295
143
#define LEQ 296
144
#define OROR 297
145
#define LOGICAL_AND 298
146
#define MOD 299
147
#define DIV 300
148
#define UNARY 301
149
#define DOT 302
150
#define NOT 303
151
#define QID 304
152
 
153
 
154
 
155
 
156
/* Copy the first part of user declarations.  */
157
#line 41 "m2-exp.y"
158
 
159
 
160
#include "defs.h"
161
#include "gdb_string.h"
162
#include "expression.h"
163
#include "language.h"
164
#include "value.h"
165
#include "parser-defs.h"
166
#include "m2-lang.h"
167
#include "bfd.h" /* Required by objfiles.h.  */
168
#include "symfile.h" /* Required by objfiles.h.  */
169
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
170
#include "block.h"
171
 
172
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
173
   as well as gratuitiously global symbol names, so we can have multiple
174
   yacc generated parsers in gdb.  Note that these are only the variables
175
   produced by yacc.  If other parser generators (bison, byacc, etc) produce
176
   additional global names that conflict at link time, then those parser
177
   generators need to be fixed instead of adding those names to this list. */
178
 
179
#define yymaxdepth m2_maxdepth
180
#define yyparse m2_parse
181
#define yylex   m2_lex
182
#define yyerror m2_error
183
#define yylval  m2_lval
184
#define yychar  m2_char
185
#define yydebug m2_debug
186
#define yypact  m2_pact
187
#define yyr1    m2_r1
188
#define yyr2    m2_r2
189
#define yydef   m2_def
190
#define yychk   m2_chk
191
#define yypgo   m2_pgo
192
#define yyact   m2_act
193
#define yyexca  m2_exca
194
#define yyerrflag m2_errflag
195
#define yynerrs m2_nerrs
196
#define yyps    m2_ps
197
#define yypv    m2_pv
198
#define yys     m2_s
199
#define yy_yys  m2_yys
200
#define yystate m2_state
201
#define yytmp   m2_tmp
202
#define yyv     m2_v
203
#define yy_yyv  m2_yyv
204
#define yyval   m2_val
205
#define yylloc  m2_lloc
206
#define yyreds  m2_reds         /* With YYDEBUG defined */
207
#define yytoks  m2_toks         /* With YYDEBUG defined */
208
#define yyname  m2_name         /* With YYDEBUG defined */
209
#define yyrule  m2_rule         /* With YYDEBUG defined */
210
#define yylhs   m2_yylhs
211
#define yylen   m2_yylen
212
#define yydefred m2_yydefred
213
#define yydgoto m2_yydgoto
214
#define yysindex m2_yysindex
215
#define yyrindex m2_yyrindex
216
#define yygindex m2_yygindex
217
#define yytable  m2_yytable
218
#define yycheck  m2_yycheck
219
 
220
#ifndef YYDEBUG
221
#define YYDEBUG 1               /* Default to yydebug support */
222
#endif
223
 
224
#define YYFPRINTF parser_fprintf
225
 
226
int yyparse (void);
227
 
228
static int yylex (void);
229
 
230
void yyerror (char *);
231
 
232
#if 0
233
static char *make_qualname (char *, char *);
234
#endif
235
 
236
static int parse_number (int);
237
 
238
/* The sign of the number being parsed. */
239
static int number_sign = 1;
240
 
241
/* The block that the module specified by the qualifer on an identifer is
242
   contained in, */
243
#if 0
244
static struct block *modblock=0;
245
#endif
246
 
247
 
248
 
249
/* Enabling traces.  */
250
#ifndef YYDEBUG
251
# define YYDEBUG 0
252
#endif
253
 
254
/* Enabling verbose error messages.  */
255
#ifdef YYERROR_VERBOSE
256
# undef YYERROR_VERBOSE
257
# define YYERROR_VERBOSE 1
258
#else
259
# define YYERROR_VERBOSE 0
260
#endif
261
 
262
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
263
#line 137 "m2-exp.y"
264
typedef union YYSTYPE {
265
    LONGEST lval;
266
    ULONGEST ulval;
267
    DOUBLEST dval;
268
    struct symbol *sym;
269
    struct type *tval;
270
    struct stoken sval;
271
    int voidval;
272
    struct block *bval;
273
    enum exp_opcode opcode;
274
    struct internalvar *ivar;
275
 
276
    struct type **tvec;
277
    int *ivec;
278
  } YYSTYPE;
279
/* Line 191 of yacc.c.  */
280
#line 281 "m2-exp.c.tmp"
281
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
282
# define YYSTYPE_IS_DECLARED 1
283
# define YYSTYPE_IS_TRIVIAL 1
284
#endif
285
 
286
 
287
 
288
/* Copy the second part of user declarations.  */
289
 
290
 
291
/* Line 214 of yacc.c.  */
292
#line 293 "m2-exp.c.tmp"
293
 
294
#if ! defined (yyoverflow) || YYERROR_VERBOSE
295
 
296
# ifndef YYFREE
297
#  define YYFREE free
298
# endif
299
# ifndef YYMALLOC
300
#  define YYMALLOC xmalloc
301
# endif
302
 
303
/* The parser invokes alloca or xmalloc; define the necessary symbols.  */
304
 
305
# ifdef YYSTACK_USE_ALLOCA
306
#  if YYSTACK_USE_ALLOCA
307
#   define YYSTACK_ALLOC alloca
308
#  endif
309
# else
310
#  if defined (alloca) || defined (_ALLOCA_H)
311
#   define YYSTACK_ALLOC alloca
312
#  else
313
#   ifdef __GNUC__
314
#    define YYSTACK_ALLOC __builtin_alloca
315
#   endif
316
#  endif
317
# endif
318
 
319
# ifdef YYSTACK_ALLOC
320
   /* Pacify GCC's `empty if-body' warning. */
321
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
322
# else
323
#  if defined (__STDC__) || defined (__cplusplus)
324
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
325
#   define YYSIZE_T size_t
326
#  endif
327
#  define YYSTACK_ALLOC YYMALLOC
328
#  define YYSTACK_FREE YYFREE
329
# endif
330
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
331
 
332
 
333
#if (! defined (yyoverflow) \
334
     && (! defined (__cplusplus) \
335
         || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
336
 
337
/* A type that is properly aligned for any stack member.  */
338
union yyalloc
339
{
340
  short yyss;
341
  YYSTYPE yyvs;
342
  };
343
 
344
/* The size of the maximum gap between one aligned stack and the next.  */
345
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
346
 
347
/* The size of an array large to enough to hold all stacks, each with
348
   N elements.  */
349
# define YYSTACK_BYTES(N) \
350
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
351
      + YYSTACK_GAP_MAXIMUM)
352
 
353
/* Copy COUNT objects from FROM to TO.  The source and destination do
354
   not overlap.  */
355
# ifndef YYCOPY
356
#  if defined (__GNUC__) && 1 < __GNUC__
357
#   define YYCOPY(To, From, Count) \
358
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
359
#  else
360
#   define YYCOPY(To, From, Count)              \
361
      do                                        \
362
        {                                       \
363
          register YYSIZE_T yyi;                \
364
          for (yyi = 0; yyi < (Count); yyi++)    \
365
            (To)[yyi] = (From)[yyi];            \
366
        }                                       \
367
      while (0)
368
#  endif
369
# endif
370
 
371
/* Relocate STACK from its old location to the new one.  The
372
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
373
   elements in the stack, and YYPTR gives the new location of the
374
   stack.  Advance YYPTR to a properly aligned location for the next
375
   stack.  */
376
# define YYSTACK_RELOCATE(Stack)                                        \
377
    do                                                                  \
378
      {                                                                 \
379
        YYSIZE_T yynewbytes;                                            \
380
        YYCOPY (&yyptr->Stack, Stack, yysize);                          \
381
        Stack = &yyptr->Stack;                                          \
382
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
383
        yyptr += yynewbytes / sizeof (*yyptr);                          \
384
      }                                                                 \
385
    while (0)
386
 
387
#endif
388
 
389
#if defined (__STDC__) || defined (__cplusplus)
390
   typedef signed char yysigned_char;
391
#else
392
   typedef short yysigned_char;
393
#endif
394
 
395
/* YYFINAL -- State number of the termination state. */
396
#define YYFINAL  69
397
/* YYLAST -- Last index in YYTABLE.  */
398
#define YYLAST   923
399
 
400
/* YYNTOKENS -- Number of terminals. */
401
#define YYNTOKENS  69
402
/* YYNNTS -- Number of nonterminals. */
403
#define YYNNTS  15
404
/* YYNRULES -- Number of rules. */
405
#define YYNRULES  82
406
/* YYNRULES -- Number of states. */
407
#define YYNSTATES  187
408
 
409
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
410
#define YYUNDEFTOK  2
411
#define YYMAXUTOK   304
412
 
413
#define YYTRANSLATE(YYX)                                                \
414
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
415
 
416
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
417
static const unsigned char yytranslate[] =
418
{
419
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
420
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
421
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
422
       2,     2,     2,     2,     2,    42,     2,     2,    48,     2,
423
      60,    65,    53,    51,    36,    52,     2,    54,     2,     2,
424
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
425
      39,    41,    40,     2,    50,     2,     2,     2,     2,     2,
426
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
427
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
428
       2,    59,     2,    68,    58,     2,     2,     2,     2,     2,
429
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
430
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
431
       2,     2,     2,    66,     2,    67,    62,     2,     2,     2,
432
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
433
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
434
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
435
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
436
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
437
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
438
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
439
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
441
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
443
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
444
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
445
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
446
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
447
      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
448
      35,    37,    38,    43,    44,    45,    46,    47,    49,    55,
449
      56,    57,    61,    63,    64
450
};
451
 
452
#if YYDEBUG
453
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
454
   YYRHS.  */
455
static const unsigned short yyprhs[] =
456
{
457
       0,     0,     3,     5,     7,     9,    12,    13,    17,    20,
458
      23,    25,    27,    32,    37,    42,    47,    52,    57,    62,
459
      69,    74,    79,    84,    89,    92,    97,   104,   109,   116,
460
     120,   122,   126,   133,   140,   144,   149,   150,   156,   161,
461
     162,   168,   169,   171,   175,   177,   181,   186,   191,   195,
462
     199,   203,   207,   211,   215,   219,   223,   227,   231,   235,
463
     239,   243,   247,   251,   255,   259,   263,   265,   267,   269,
464
     271,   273,   275,   277,   282,   284,   286,   288,   292,   294,
465
     296,   300,   302
466
};
467
 
468
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
469
static const yysigned_char yyrhs[] =
470
{
471
      70,     0,    -1,    72,    -1,    71,    -1,    83,    -1,    72,
472
      58,    -1,    -1,    52,    73,    72,    -1,    51,    72,    -1,
473
      74,    72,    -1,    63,    -1,    62,    -1,    18,    60,    72,
474
      65,    -1,    19,    60,    72,    65,    -1,    21,    60,    72,
475
      65,    -1,    20,    60,    72,    65,    -1,    22,    60,    83,
476
      65,    -1,    23,    60,    83,    65,    -1,    24,    60,    72,
477
      65,    -1,    25,    60,    83,    36,    72,    65,    -1,    26,
478
      60,    72,    65,    -1,    27,    60,    72,    65,    -1,    28,
479
      60,    72,    65,    -1,    29,    60,    72,    65,    -1,    17,
480
      72,    -1,    30,    60,    72,    65,    -1,    30,    60,    72,
481
      36,    72,    65,    -1,    31,    60,    72,    65,    -1,    31,
482
      60,    72,    36,    72,    65,    -1,    72,    61,    12,    -1,
483
      75,    -1,    72,    43,    75,    -1,    32,    60,    72,    36,
484
      72,    65,    -1,    33,    60,    72,    36,    72,    65,    -1,
485
      66,    78,    67,    -1,    83,    66,    78,    67,    -1,    -1,
486
      72,    59,    76,    79,    68,    -1,    72,    59,    72,    68,
487
      -1,    -1,    72,    60,    77,    78,    65,    -1,    -1,    72,
488
      -1,    78,    36,    72,    -1,    72,    -1,    79,    36,    72,
489
      -1,    66,    83,    67,    72,    -1,    83,    60,    72,    65,
490
      -1,    60,    72,    65,    -1,    72,    50,    72,    -1,    72,
491
      53,    72,    -1,    72,    54,    72,    -1,    72,    56,    72,
492
      -1,    72,    55,    72,    -1,    72,    51,    72,    -1,    72,
493
      52,    72,    -1,    72,    41,    72,    -1,    72,    44,    72,
494
      -1,    72,    42,    72,    -1,    72,    46,    72,    -1,    72,
495
      45,    72,    -1,    72,    39,    72,    -1,    72,    40,    72,
496
      -1,    72,    49,    72,    -1,    72,    47,    72,    -1,    72,
497
      38,    72,    -1,     7,    -1,     8,    -1,     3,    -1,     6,
498
      -1,     9,    -1,    10,    -1,    82,    -1,    17,    60,    83,
499
      65,    -1,    11,    -1,    81,    -1,    13,    -1,    80,    34,
500
      13,    -1,    81,    -1,    35,    -1,    80,    34,    12,    -1,
501
      12,    -1,    16,    -1
502
};
503
 
504
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
505
static const unsigned short yyrline[] =
506
{
507
       0,   206,   206,   207,   210,   219,   224,   223,   230,   234,
508
     238,   239,   242,   246,   250,   254,   258,   264,   270,   274,
509
     280,   284,   288,   292,   296,   301,   305,   311,   315,   321,
510
     327,   330,   334,   338,   342,   344,   354,   350,   361,   368,
511
     365,   375,   378,   382,   387,   392,   397,   403,   409,   417,
512
     421,   425,   429,   433,   437,   441,   445,   449,   451,   455,
513
     459,   463,   467,   471,   475,   479,   486,   492,   498,   505,
514
     514,   522,   529,   532,   539,   546,   550,   559,   571,   579,
515
     583,   599,   650
516
};
517
#endif
518
 
519
#if YYDEBUG || YYERROR_VERBOSE
520
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
521
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
522
static const char *const yytname[] =
523
{
524
  "$end", "error", "$undefined", "INT", "HEX", "ERROR", "UINT", "M2_TRUE",
525
  "M2_FALSE", "CHAR", "FLOAT", "STRING", "NAME", "BLOCKNAME", "IDENT",
526
  "VARNAME", "TYPENAME", "SIZE", "CAP", "ORD", "HIGH", "ABS", "MIN_FUNC",
527
  "MAX_FUNC", "FLOAT_FUNC", "VAL", "CHR", "ODD", "TRUNC", "TSIZE", "INC",
528
  "DEC", "INCL", "EXCL", "COLONCOLON", "INTERNAL_VAR", "','",
529
  "ABOVE_COMMA", "ASSIGN", "'<'", "'>'", "'='", "'#'", "IN", "NOTEQUAL",
530
  "GEQ", "LEQ", "OROR", "'&'", "LOGICAL_AND", "'@'", "'+'", "'-'", "'*'",
531
  "'/'", "MOD", "DIV", "UNARY", "'^'", "'['", "'('", "DOT", "'~'", "NOT",
532
  "QID", "')'", "'{'", "'}'", "']'", "$accept", "start", "type_exp", "exp",
533
  "@1", "not_exp", "set", "@2", "@3", "arglist", "non_empty_arglist",
534
  "block", "fblock", "variable", "type", 0
535
};
536
#endif
537
 
538
# ifdef YYPRINT
539
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
540
   token YYLEX-NUM.  */
541
static const unsigned short yytoknum[] =
542
{
543
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
544
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
545
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
546
     285,   286,   287,   288,   289,   290,    44,   291,   292,    60,
547
      62,    61,    35,   293,   294,   295,   296,   297,    38,   298,
548
      64,    43,    45,    42,    47,   299,   300,   301,    94,    91,
549
      40,   302,   126,   303,   304,    41,   123,   125,    93
550
};
551
# endif
552
 
553
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
554
static const unsigned char yyr1[] =
555
{
556
       0,    69,    70,    70,    71,    72,    73,    72,    72,    72,
557
      74,    74,    72,    72,    72,    72,    72,    72,    72,    72,
558
      72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
559
      72,    72,    72,    72,    75,    75,    76,    72,    72,    77,
560
      72,    78,    78,    78,    79,    79,    72,    72,    72,    72,
561
      72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
562
      72,    72,    72,    72,    72,    72,    72,    72,    72,    72,
563
      72,    72,    72,    72,    72,    80,    81,    81,    82,    82,
564
      82,    82,    83
565
};
566
 
567
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
568
static const unsigned char yyr2[] =
569
{
570
       0,     2,     1,     1,     1,     2,     0,     3,     2,     2,
571
       1,     1,     4,     4,     4,     4,     4,     4,     4,     6,
572
       4,     4,     4,     4,     2,     4,     6,     4,     6,     3,
573
       1,     3,     6,     6,     3,     4,     0,     5,     4,     0,
574
       5,     0,     1,     3,     1,     3,     4,     4,     3,     3,
575
       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
576
       3,     3,     3,     3,     3,     3,     1,     1,     1,     1,
577
       1,     1,     1,     4,     1,     1,     1,     3,     1,     1,
578
       3,     1,     1
579
};
580
 
581
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
582
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
583
   means the default is an error.  */
584
static const unsigned char yydefact[] =
585
{
586
       0,    68,    69,    66,    67,    70,    71,    74,    81,    76,
587
      82,     0,     0,     0,     0,     0,     0,     0,     0,     0,
588
       0,     0,     0,     0,     0,     0,     0,     0,    79,     0,
589
       6,     0,    11,    10,    41,     0,     3,     2,     0,    30,
590
       0,    78,    72,     4,     0,    24,     0,     0,     0,     0,
591
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
592
       0,     0,     0,     8,     0,     0,    42,     0,     0,     1,
593
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
594
       0,     0,     0,     0,     0,     0,     0,     0,     5,     0,
595
      39,     0,     9,     0,     0,    41,     0,     0,     0,     0,
596
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
597
       0,     0,     0,     7,    48,     0,    34,     0,    65,    61,
598
      62,    56,    58,    41,    31,     0,    57,    60,    59,    64,
599
      63,    49,    54,    55,    50,    51,    53,    52,     0,     0,
600
      41,    29,    80,    77,     0,     0,    73,    12,    13,    15,
601
      14,    16,    17,    18,     0,    20,    21,    22,    23,     0,
602
      25,     0,    27,     0,     0,    43,    46,    38,    44,     0,
603
       0,    47,    35,     0,     0,     0,     0,     0,     0,    37,
604
      40,    19,    26,    28,    32,    33,    45
605
};
606
 
607
/* YYDEFGOTO[NTERM-NUM]. */
608
static const short yydefgoto[] =
609
{
610
      -1,    35,    36,    66,    64,    38,    39,   139,   140,    67,
611
     169,    40,    41,    42,    46
612
};
613
 
614
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
615
   STATE-NUM.  */
616
#define YYPACT_NINF -89
617
static const short yypact[] =
618
{
619
     163,   -89,   -89,   -89,   -89,   -89,   -89,   -89,   -89,   -89,
620
     -89,   224,   -54,   -35,   -30,   -20,   -19,   -14,     3,     9,
621
      15,    30,    31,    32,    33,    35,    36,    37,   -89,   163,
622
     -89,   163,   -89,   -89,   163,    28,   -89,   838,   163,   -89,
623
      11,    65,   -89,   -27,   163,     7,   -27,   163,   163,   163,
624
     163,    84,    84,   163,    84,   163,   163,   163,   163,   163,
625
     163,   163,   163,     7,   163,   340,   838,   -32,   -40,   -89,
626
     163,   163,   163,   163,   163,   -15,   163,   163,   163,   163,
627
     163,   163,   163,   163,   163,   163,   163,   163,   -89,   163,
628
     -89,    89,     7,    -4,   163,   163,   -23,   368,   396,   424,
629
     452,    38,    39,   480,    66,   508,   536,   564,   592,   284,
630
     312,   788,   814,     7,   -89,   163,   -89,   163,   862,   -37,
631
     -37,   -37,   -37,   163,   -89,    41,   -37,   -37,   -37,    72,
632
      90,   148,   207,   207,     7,     7,     7,     7,   253,   163,
633
     163,   -89,   -89,   -89,   620,   -31,   -89,   -89,   -89,   -89,
634
     -89,   -89,   -89,   -89,   163,   -89,   -89,   -89,   -89,   163,
635
     -89,   163,   -89,   163,   163,   838,     7,   -89,   838,   -34,
636
     -33,   -89,   -89,   648,   676,   704,   732,   760,   163,   -89,
637
     -89,   -89,   -89,   -89,   -89,   -89,   838
638
};
639
 
640
/* YYPGOTO[NTERM-NUM].  */
641
static const yysigned_char yypgoto[] =
642
{
643
     -89,   -89,   -89,     0,   -89,   -89,    34,   -89,   -89,   -88,
644
     -89,   -89,   -89,   -89,    54
645
};
646
 
647
/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
648
   positive, shift that token.  If negative, reduce the rule which
649
   number is the opposite.  If zero, do what YYDEFACT says.
650
   If YYTABLE_NINF, syntax error.  */
651
#define YYTABLE_NINF -76
652
static const short yytable[] =
653
{
654
      37,    10,   178,   115,   115,   115,    47,   145,   142,   143,
655
      79,    45,    80,    81,    82,    83,    84,    85,    86,    87,
656
      94,    88,    89,    90,    91,    48,    95,   117,    69,    63,
657
      49,    65,   180,    94,   179,   116,   172,    94,    92,    95,
658
      50,    51,   146,    95,    65,    93,    52,    97,    98,    99,
659
     100,   123,   170,   103,    43,   105,   106,   107,   108,   109,
660
     110,   111,   112,    53,   113,    88,    89,    90,    91,    54,
661
     118,   119,   120,   121,   122,    55,   126,   127,   128,   129,
662
     130,   131,   132,   133,   134,   135,   136,   137,    68,   138,
663
      56,    57,    58,    59,   144,    60,    61,    62,    96,   -75,
664
      10,   141,   154,   151,   152,   101,   102,    95,   104,   124,
665
       0,     0,     0,     0,     0,   165,     0,   166,     0,     0,
666
       0,    80,    81,    82,    83,    84,    85,    86,    87,   125,
667
      88,    89,    90,    91,     0,     0,     0,     0,     0,   168,
668
      81,    82,    83,    84,    85,    86,    87,     0,    88,    89,
669
      90,    91,     0,     0,   173,     0,     0,     0,     0,   174,
670
       0,   175,     0,   176,   177,     0,     1,     0,     0,     2,
671
       3,     4,     5,     6,     7,     8,     9,     0,   186,    10,
672
      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
673
      21,    22,    23,    24,    25,    26,    27,     0,    28,    82,
674
      83,    84,    85,    86,    87,     0,    88,    89,    90,    91,
675
       0,     0,     0,     0,    29,    30,     0,     0,     0,     0,
676
       0,     0,     0,    31,     0,    32,    33,     1,     0,    34,
677
       2,     3,     4,     5,     6,     7,     8,     9,     0,     0,
678
      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
679
      20,    21,    22,    23,    24,    25,    26,    27,     0,    28,
680
      84,    85,    86,    87,     0,    88,    89,    90,    91,     0,
681
       0,     0,     0,     0,     0,    29,    30,     0,     0,     0,
682
       0,     0,     0,     0,    44,     0,    32,    33,     0,     0,
683
      34,    70,    71,    72,    73,    74,    75,    76,    77,    78,
684
      79,     0,    80,    81,    82,    83,    84,    85,    86,    87,
685
       0,    88,    89,    90,    91,     0,     0,     0,     0,     0,
686
     159,   167,    70,    71,    72,    73,    74,    75,    76,    77,
687
      78,    79,     0,    80,    81,    82,    83,    84,    85,    86,
688
      87,     0,    88,    89,    90,    91,     0,     0,   161,   160,
689
      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
690
       0,    80,    81,    82,    83,    84,    85,    86,    87,     0,
691
      88,    89,    90,    91,     0,     0,     0,   162,    70,    71,
692
      72,    73,    74,    75,    76,    77,    78,    79,     0,    80,
693
      81,    82,    83,    84,    85,    86,    87,     0,    88,    89,
694
      90,    91,     0,     0,     0,   114,    70,    71,    72,    73,
695
      74,    75,    76,    77,    78,    79,     0,    80,    81,    82,
696
      83,    84,    85,    86,    87,     0,    88,    89,    90,    91,
697
       0,     0,     0,   147,    70,    71,    72,    73,    74,    75,
698
      76,    77,    78,    79,     0,    80,    81,    82,    83,    84,
699
      85,    86,    87,     0,    88,    89,    90,    91,     0,     0,
700
       0,   148,    70,    71,    72,    73,    74,    75,    76,    77,
701
      78,    79,     0,    80,    81,    82,    83,    84,    85,    86,
702
      87,     0,    88,    89,    90,    91,     0,     0,     0,   149,
703
      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
704
       0,    80,    81,    82,    83,    84,    85,    86,    87,     0,
705
      88,    89,    90,    91,     0,     0,     0,   150,    70,    71,
706
      72,    73,    74,    75,    76,    77,    78,    79,     0,    80,
707
      81,    82,    83,    84,    85,    86,    87,     0,    88,    89,
708
      90,    91,     0,     0,     0,   153,    70,    71,    72,    73,
709
      74,    75,    76,    77,    78,    79,     0,    80,    81,    82,
710
      83,    84,    85,    86,    87,     0,    88,    89,    90,    91,
711
       0,     0,     0,   155,    70,    71,    72,    73,    74,    75,
712
      76,    77,    78,    79,     0,    80,    81,    82,    83,    84,
713
      85,    86,    87,     0,    88,    89,    90,    91,     0,     0,
714
       0,   156,    70,    71,    72,    73,    74,    75,    76,    77,
715
      78,    79,     0,    80,    81,    82,    83,    84,    85,    86,
716
      87,     0,    88,    89,    90,    91,     0,     0,     0,   157,
717
      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
718
       0,    80,    81,    82,    83,    84,    85,    86,    87,     0,
719
      88,    89,    90,    91,     0,     0,     0,   158,    70,    71,
720
      72,    73,    74,    75,    76,    77,    78,    79,     0,    80,
721
      81,    82,    83,    84,    85,    86,    87,     0,    88,    89,
722
      90,    91,     0,     0,     0,   171,    70,    71,    72,    73,
723
      74,    75,    76,    77,    78,    79,     0,    80,    81,    82,
724
      83,    84,    85,    86,    87,     0,    88,    89,    90,    91,
725
       0,     0,     0,   181,    70,    71,    72,    73,    74,    75,
726
      76,    77,    78,    79,     0,    80,    81,    82,    83,    84,
727
      85,    86,    87,     0,    88,    89,    90,    91,     0,     0,
728
       0,   182,    70,    71,    72,    73,    74,    75,    76,    77,
729
      78,    79,     0,    80,    81,    82,    83,    84,    85,    86,
730
      87,     0,    88,    89,    90,    91,     0,     0,     0,   183,
731
      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
732
       0,    80,    81,    82,    83,    84,    85,    86,    87,     0,
733
      88,    89,    90,    91,     0,     0,     0,   184,    70,    71,
734
      72,    73,    74,    75,    76,    77,    78,    79,     0,    80,
735
      81,    82,    83,    84,    85,    86,    87,     0,    88,    89,
736
      90,    91,     0,     0,   163,   185,    70,    71,    72,    73,
737
      74,    75,    76,    77,    78,    79,     0,    80,    81,    82,
738
      83,    84,    85,    86,    87,     0,    88,    89,    90,    91,
739
     164,     0,    70,    71,    72,    73,    74,    75,    76,    77,
740
      78,    79,     0,    80,    81,    82,    83,    84,    85,    86,
741
      87,     0,    88,    89,    90,    91,    70,    71,    72,    73,
742
      74,    75,    76,    77,    78,    79,     0,    80,    81,    82,
743
      83,    84,    85,    86,    87,     0,    88,    89,    90,    91,
744
     -76,    71,    72,    73,    74,    75,    76,    77,    78,    79,
745
       0,    80,    81,    82,    83,    84,    85,    86,    87,     0,
746
      88,    89,    90,    91
747
};
748
 
749
static const short yycheck[] =
750
{
751
       0,    16,    36,    36,    36,    36,    60,    95,    12,    13,
752
      47,    11,    49,    50,    51,    52,    53,    54,    55,    56,
753
      60,    58,    59,    60,    61,    60,    66,    67,     0,    29,
754
      60,    31,    65,    60,    68,    67,    67,    60,    38,    66,
755
      60,    60,    65,    66,    44,    34,    60,    47,    48,    49,
756
      50,    66,   140,    53,     0,    55,    56,    57,    58,    59,
757
      60,    61,    62,    60,    64,    58,    59,    60,    61,    60,
758
      70,    71,    72,    73,    74,    60,    76,    77,    78,    79,
759
      80,    81,    82,    83,    84,    85,    86,    87,    34,    89,
760
      60,    60,    60,    60,    94,    60,    60,    60,    44,    34,
761
      16,    12,    36,    65,    65,    51,    52,    66,    54,    75,
762
      -1,    -1,    -1,    -1,    -1,   115,    -1,   117,    -1,    -1,
763
      -1,    49,    50,    51,    52,    53,    54,    55,    56,    75,
764
      58,    59,    60,    61,    -1,    -1,    -1,    -1,    -1,   139,
765
      50,    51,    52,    53,    54,    55,    56,    -1,    58,    59,
766
      60,    61,    -1,    -1,   154,    -1,    -1,    -1,    -1,   159,
767
      -1,   161,    -1,   163,   164,    -1,     3,    -1,    -1,     6,
768
       7,     8,     9,    10,    11,    12,    13,    -1,   178,    16,
769
      17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
770
      27,    28,    29,    30,    31,    32,    33,    -1,    35,    51,
771
      52,    53,    54,    55,    56,    -1,    58,    59,    60,    61,
772
      -1,    -1,    -1,    -1,    51,    52,    -1,    -1,    -1,    -1,
773
      -1,    -1,    -1,    60,    -1,    62,    63,     3,    -1,    66,
774
       6,     7,     8,     9,    10,    11,    12,    13,    -1,    -1,
775
      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
776
      26,    27,    28,    29,    30,    31,    32,    33,    -1,    35,
777
      53,    54,    55,    56,    -1,    58,    59,    60,    61,    -1,
778
      -1,    -1,    -1,    -1,    -1,    51,    52,    -1,    -1,    -1,
779
      -1,    -1,    -1,    -1,    60,    -1,    62,    63,    -1,    -1,
780
      66,    38,    39,    40,    41,    42,    43,    44,    45,    46,
781
      47,    -1,    49,    50,    51,    52,    53,    54,    55,    56,
782
      -1,    58,    59,    60,    61,    -1,    -1,    -1,    -1,    -1,
783
      36,    68,    38,    39,    40,    41,    42,    43,    44,    45,
784
      46,    47,    -1,    49,    50,    51,    52,    53,    54,    55,
785
      56,    -1,    58,    59,    60,    61,    -1,    -1,    36,    65,
786
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
787
      -1,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
788
      58,    59,    60,    61,    -1,    -1,    -1,    65,    38,    39,
789
      40,    41,    42,    43,    44,    45,    46,    47,    -1,    49,
790
      50,    51,    52,    53,    54,    55,    56,    -1,    58,    59,
791
      60,    61,    -1,    -1,    -1,    65,    38,    39,    40,    41,
792
      42,    43,    44,    45,    46,    47,    -1,    49,    50,    51,
793
      52,    53,    54,    55,    56,    -1,    58,    59,    60,    61,
794
      -1,    -1,    -1,    65,    38,    39,    40,    41,    42,    43,
795
      44,    45,    46,    47,    -1,    49,    50,    51,    52,    53,
796
      54,    55,    56,    -1,    58,    59,    60,    61,    -1,    -1,
797
      -1,    65,    38,    39,    40,    41,    42,    43,    44,    45,
798
      46,    47,    -1,    49,    50,    51,    52,    53,    54,    55,
799
      56,    -1,    58,    59,    60,    61,    -1,    -1,    -1,    65,
800
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
801
      -1,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
802
      58,    59,    60,    61,    -1,    -1,    -1,    65,    38,    39,
803
      40,    41,    42,    43,    44,    45,    46,    47,    -1,    49,
804
      50,    51,    52,    53,    54,    55,    56,    -1,    58,    59,
805
      60,    61,    -1,    -1,    -1,    65,    38,    39,    40,    41,
806
      42,    43,    44,    45,    46,    47,    -1,    49,    50,    51,
807
      52,    53,    54,    55,    56,    -1,    58,    59,    60,    61,
808
      -1,    -1,    -1,    65,    38,    39,    40,    41,    42,    43,
809
      44,    45,    46,    47,    -1,    49,    50,    51,    52,    53,
810
      54,    55,    56,    -1,    58,    59,    60,    61,    -1,    -1,
811
      -1,    65,    38,    39,    40,    41,    42,    43,    44,    45,
812
      46,    47,    -1,    49,    50,    51,    52,    53,    54,    55,
813
      56,    -1,    58,    59,    60,    61,    -1,    -1,    -1,    65,
814
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
815
      -1,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
816
      58,    59,    60,    61,    -1,    -1,    -1,    65,    38,    39,
817
      40,    41,    42,    43,    44,    45,    46,    47,    -1,    49,
818
      50,    51,    52,    53,    54,    55,    56,    -1,    58,    59,
819
      60,    61,    -1,    -1,    -1,    65,    38,    39,    40,    41,
820
      42,    43,    44,    45,    46,    47,    -1,    49,    50,    51,
821
      52,    53,    54,    55,    56,    -1,    58,    59,    60,    61,
822
      -1,    -1,    -1,    65,    38,    39,    40,    41,    42,    43,
823
      44,    45,    46,    47,    -1,    49,    50,    51,    52,    53,
824
      54,    55,    56,    -1,    58,    59,    60,    61,    -1,    -1,
825
      -1,    65,    38,    39,    40,    41,    42,    43,    44,    45,
826
      46,    47,    -1,    49,    50,    51,    52,    53,    54,    55,
827
      56,    -1,    58,    59,    60,    61,    -1,    -1,    -1,    65,
828
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
829
      -1,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
830
      58,    59,    60,    61,    -1,    -1,    -1,    65,    38,    39,
831
      40,    41,    42,    43,    44,    45,    46,    47,    -1,    49,
832
      50,    51,    52,    53,    54,    55,    56,    -1,    58,    59,
833
      60,    61,    -1,    -1,    36,    65,    38,    39,    40,    41,
834
      42,    43,    44,    45,    46,    47,    -1,    49,    50,    51,
835
      52,    53,    54,    55,    56,    -1,    58,    59,    60,    61,
836
      36,    -1,    38,    39,    40,    41,    42,    43,    44,    45,
837
      46,    47,    -1,    49,    50,    51,    52,    53,    54,    55,
838
      56,    -1,    58,    59,    60,    61,    38,    39,    40,    41,
839
      42,    43,    44,    45,    46,    47,    -1,    49,    50,    51,
840
      52,    53,    54,    55,    56,    -1,    58,    59,    60,    61,
841
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
842
      -1,    49,    50,    51,    52,    53,    54,    55,    56,    -1,
843
      58,    59,    60,    61
844
};
845
 
846
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
847
   symbol of state STATE-NUM.  */
848
static const unsigned char yystos[] =
849
{
850
       0,     3,     6,     7,     8,     9,    10,    11,    12,    13,
851
      16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
852
      26,    27,    28,    29,    30,    31,    32,    33,    35,    51,
853
      52,    60,    62,    63,    66,    70,    71,    72,    74,    75,
854
      80,    81,    82,    83,    60,    72,    83,    60,    60,    60,
855
      60,    60,    60,    60,    60,    60,    60,    60,    60,    60,
856
      60,    60,    60,    72,    73,    72,    72,    78,    83,     0,
857
      38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
858
      49,    50,    51,    52,    53,    54,    55,    56,    58,    59,
859
      60,    61,    72,    34,    60,    66,    83,    72,    72,    72,
860
      72,    83,    83,    72,    83,    72,    72,    72,    72,    72,
861
      72,    72,    72,    72,    65,    36,    67,    67,    72,    72,
862
      72,    72,    72,    66,    75,    83,    72,    72,    72,    72,
863
      72,    72,    72,    72,    72,    72,    72,    72,    72,    76,
864
      77,    12,    12,    13,    72,    78,    65,    65,    65,    65,
865
      65,    65,    65,    65,    36,    65,    65,    65,    65,    36,
866
      65,    36,    65,    36,    36,    72,    72,    68,    72,    79,
867
      78,    65,    67,    72,    72,    72,    72,    72,    36,    68,
868
      65,    65,    65,    65,    65,    65,    72
869
};
870
 
871
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
872
# define YYSIZE_T __SIZE_TYPE__
873
#endif
874
#if ! defined (YYSIZE_T) && defined (size_t)
875
# define YYSIZE_T size_t
876
#endif
877
#if ! defined (YYSIZE_T)
878
# if defined (__STDC__) || defined (__cplusplus)
879
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
880
#  define YYSIZE_T size_t
881
# endif
882
#endif
883
#if ! defined (YYSIZE_T)
884
# define YYSIZE_T unsigned int
885
#endif
886
 
887
#define yyerrok         (yyerrstatus = 0)
888
#define yyclearin       (yychar = YYEMPTY)
889
#define YYEMPTY         (-2)
890
#define YYEOF           0
891
 
892
#define YYACCEPT        goto yyacceptlab
893
#define YYABORT         goto yyabortlab
894
#define YYERROR         goto yyerrorlab
895
 
896
 
897
/* Like YYERROR except do call yyerror.  This remains here temporarily
898
   to ease the transition to the new meaning of YYERROR, for GCC.
899
   Once GCC version 2 has supplanted version 1, this can go.  */
900
 
901
#define YYFAIL          goto yyerrlab
902
 
903
#define YYRECOVERING()  (!!yyerrstatus)
904
 
905
#define YYBACKUP(Token, Value)                                  \
906
do                                                              \
907
  if (yychar == YYEMPTY && yylen == 1)                          \
908
    {                                                           \
909
      yychar = (Token);                                         \
910
      yylval = (Value);                                         \
911
      yytoken = YYTRANSLATE (yychar);                           \
912
      YYPOPSTACK;                                               \
913
      goto yybackup;                                            \
914
    }                                                           \
915
  else                                                          \
916
    {                                                           \
917
      yyerror ("syntax error: cannot back up");\
918
      YYERROR;                                                  \
919
    }                                                           \
920
while (0)
921
 
922
#define YYTERROR        1
923
#define YYERRCODE       256
924
 
925
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
926
   are run).  */
927
 
928
#ifndef YYLLOC_DEFAULT
929
# define YYLLOC_DEFAULT(Current, Rhs, N)                \
930
   ((Current).first_line   = (Rhs)[1].first_line,       \
931
    (Current).first_column = (Rhs)[1].first_column,     \
932
    (Current).last_line    = (Rhs)[N].last_line,        \
933
    (Current).last_column  = (Rhs)[N].last_column)
934
#endif
935
 
936
/* YYLEX -- calling `yylex' with the right arguments.  */
937
 
938
#ifdef YYLEX_PARAM
939
# define YYLEX yylex (YYLEX_PARAM)
940
#else
941
# define YYLEX yylex ()
942
#endif
943
 
944
/* Enable debugging if requested.  */
945
#if YYDEBUG
946
 
947
# ifndef YYFPRINTF
948
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
949
#  define YYFPRINTF fprintf
950
# endif
951
 
952
# define YYDPRINTF(Args)                        \
953
do {                                            \
954
  if (yydebug)                                  \
955
    YYFPRINTF Args;                             \
956
} while (0)
957
 
958
# define YYDSYMPRINT(Args)                      \
959
do {                                            \
960
  if (yydebug)                                  \
961
    yysymprint Args;                            \
962
} while (0)
963
 
964
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
965
do {                                                            \
966
  if (yydebug)                                                  \
967
    {                                                           \
968
      YYFPRINTF (stderr, "%s ", Title);                         \
969
      yysymprint (stderr,                                       \
970
                  Token, Value);        \
971
      YYFPRINTF (stderr, "\n");                                 \
972
    }                                                           \
973
} while (0)
974
 
975
/*------------------------------------------------------------------.
976
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
977
| TOP (included).                                                   |
978
`------------------------------------------------------------------*/
979
 
980
#if defined (__STDC__) || defined (__cplusplus)
981
static void
982
yy_stack_print (short *bottom, short *top)
983
#else
984
static void
985
yy_stack_print (bottom, top)
986
    short *bottom;
987
    short *top;
988
#endif
989
{
990
  YYFPRINTF (stderr, "Stack now");
991
  for (/* Nothing. */; bottom <= top; ++bottom)
992
    YYFPRINTF (stderr, " %d", *bottom);
993
  YYFPRINTF (stderr, "\n");
994
}
995
 
996
# define YY_STACK_PRINT(Bottom, Top)                            \
997
do {                                                            \
998
  if (yydebug)                                                  \
999
    yy_stack_print ((Bottom), (Top));                           \
1000
} while (0)
1001
 
1002
 
1003
/*------------------------------------------------.
1004
| Report that the YYRULE is going to be reduced.  |
1005
`------------------------------------------------*/
1006
 
1007
#if defined (__STDC__) || defined (__cplusplus)
1008
static void
1009
yy_reduce_print (int yyrule)
1010
#else
1011
static void
1012
yy_reduce_print (yyrule)
1013
    int yyrule;
1014
#endif
1015
{
1016
  int yyi;
1017
  unsigned int yylno = yyrline[yyrule];
1018
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
1019
             yyrule - 1, yylno);
1020
  /* Print the symbols being reduced, and their result.  */
1021
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
1022
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
1023
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
1024
}
1025
 
1026
# define YY_REDUCE_PRINT(Rule)          \
1027
do {                                    \
1028
  if (yydebug)                          \
1029
    yy_reduce_print (Rule);             \
1030
} while (0)
1031
 
1032
/* Nonzero means print parse trace.  It is left uninitialized so that
1033
   multiple parsers can coexist.  */
1034
int yydebug;
1035
#else /* !YYDEBUG */
1036
# define YYDPRINTF(Args)
1037
# define YYDSYMPRINT(Args)
1038
# define YYDSYMPRINTF(Title, Token, Value, Location)
1039
# define YY_STACK_PRINT(Bottom, Top)
1040
# define YY_REDUCE_PRINT(Rule)
1041
#endif /* !YYDEBUG */
1042
 
1043
 
1044
/* YYINITDEPTH -- initial size of the parser's stacks.  */
1045
#ifndef YYINITDEPTH
1046
# define YYINITDEPTH 200
1047
#endif
1048
 
1049
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1050
   if the built-in stack extension method is used).
1051
 
1052
   Do not make this value too large; the results are undefined if
1053
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1054
   evaluated with infinite-precision integer arithmetic.  */
1055
 
1056
#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
1057
# undef YYMAXDEPTH
1058
#endif
1059
 
1060
#ifndef YYMAXDEPTH
1061
# define YYMAXDEPTH 10000
1062
#endif
1063
 
1064
 
1065
 
1066
#if YYERROR_VERBOSE
1067
 
1068
# ifndef yystrlen
1069
#  if defined (__GLIBC__) && defined (_STRING_H)
1070
#   define yystrlen strlen
1071
#  else
1072
/* Return the length of YYSTR.  */
1073
static YYSIZE_T
1074
#   if defined (__STDC__) || defined (__cplusplus)
1075
yystrlen (const char *yystr)
1076
#   else
1077
yystrlen (yystr)
1078
     const char *yystr;
1079
#   endif
1080
{
1081
  register const char *yys = yystr;
1082
 
1083
  while (*yys++ != '\0')
1084
    continue;
1085
 
1086
  return yys - yystr - 1;
1087
}
1088
#  endif
1089
# endif
1090
 
1091
# ifndef yystpcpy
1092
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1093
#   define yystpcpy stpcpy
1094
#  else
1095
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1096
   YYDEST.  */
1097
static char *
1098
#   if defined (__STDC__) || defined (__cplusplus)
1099
yystpcpy (char *yydest, const char *yysrc)
1100
#   else
1101
yystpcpy (yydest, yysrc)
1102
     char *yydest;
1103
     const char *yysrc;
1104
#   endif
1105
{
1106
  register char *yyd = yydest;
1107
  register const char *yys = yysrc;
1108
 
1109
  while ((*yyd++ = *yys++) != '\0')
1110
    continue;
1111
 
1112
  return yyd - 1;
1113
}
1114
#  endif
1115
# endif
1116
 
1117
#endif /* !YYERROR_VERBOSE */
1118
 
1119
 
1120
 
1121
#if YYDEBUG
1122
/*--------------------------------.
1123
| Print this symbol on YYOUTPUT.  |
1124
`--------------------------------*/
1125
 
1126
#if defined (__STDC__) || defined (__cplusplus)
1127
static void
1128
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1129
#else
1130
static void
1131
yysymprint (yyoutput, yytype, yyvaluep)
1132
    FILE *yyoutput;
1133
    int yytype;
1134
    YYSTYPE *yyvaluep;
1135
#endif
1136
{
1137
  /* Pacify ``unused variable'' warnings.  */
1138
  (void) yyvaluep;
1139
 
1140
  if (yytype < YYNTOKENS)
1141
    {
1142
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1143
# ifdef YYPRINT
1144
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1145
# endif
1146
    }
1147
  else
1148
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1149
 
1150
  switch (yytype)
1151
    {
1152
      default:
1153
        break;
1154
    }
1155
  YYFPRINTF (yyoutput, ")");
1156
}
1157
 
1158
#endif /* ! YYDEBUG */
1159
/*-----------------------------------------------.
1160
| Release the memory associated to this symbol.  |
1161
`-----------------------------------------------*/
1162
 
1163
#if defined (__STDC__) || defined (__cplusplus)
1164
static void
1165
yydestruct (int yytype, YYSTYPE *yyvaluep)
1166
#else
1167
static void
1168
yydestruct (yytype, yyvaluep)
1169
    int yytype;
1170
    YYSTYPE *yyvaluep;
1171
#endif
1172
{
1173
  /* Pacify ``unused variable'' warnings.  */
1174
  (void) yyvaluep;
1175
 
1176
  switch (yytype)
1177
    {
1178
 
1179
      default:
1180
        break;
1181
    }
1182
}
1183
 
1184
 
1185
/* Prevent warnings from -Wmissing-prototypes.  */
1186
 
1187
#ifdef YYPARSE_PARAM
1188
# if defined (__STDC__) || defined (__cplusplus)
1189
int yyparse (void *YYPARSE_PARAM);
1190
# else
1191
int yyparse ();
1192
# endif
1193
#else /* ! YYPARSE_PARAM */
1194
#if defined (__STDC__) || defined (__cplusplus)
1195
int yyparse (void);
1196
#else
1197
int yyparse ();
1198
#endif
1199
#endif /* ! YYPARSE_PARAM */
1200
 
1201
 
1202
 
1203
/* The lookahead symbol.  */
1204
int yychar;
1205
 
1206
/* The semantic value of the lookahead symbol.  */
1207
YYSTYPE yylval;
1208
 
1209
/* Number of syntax errors so far.  */
1210
int yynerrs;
1211
 
1212
 
1213
 
1214
/*----------.
1215
| yyparse.  |
1216
`----------*/
1217
 
1218
#ifdef YYPARSE_PARAM
1219
# if defined (__STDC__) || defined (__cplusplus)
1220
int yyparse (void *YYPARSE_PARAM)
1221
# else
1222
int yyparse (YYPARSE_PARAM)
1223
  void *YYPARSE_PARAM;
1224
# endif
1225
#else /* ! YYPARSE_PARAM */
1226
#if defined (__STDC__) || defined (__cplusplus)
1227
int
1228
yyparse (void)
1229
#else
1230
int
1231
yyparse ()
1232
 
1233
#endif
1234
#endif
1235
{
1236
 
1237
  register int yystate;
1238
  register int yyn;
1239
  int yyresult;
1240
  /* Number of tokens to shift before error messages enabled.  */
1241
  int yyerrstatus;
1242
  /* Lookahead token as an internal (translated) token number.  */
1243
  int yytoken = 0;
1244
 
1245
  /* Three stacks and their tools:
1246
     `yyss': related to states,
1247
     `yyvs': related to semantic values,
1248
     `yyls': related to locations.
1249
 
1250
     Refer to the stacks thru separate pointers, to allow yyoverflow
1251
     to xreallocate them elsewhere.  */
1252
 
1253
  /* The state stack.  */
1254
  short yyssa[YYINITDEPTH];
1255
  short *yyss = yyssa;
1256
  register short *yyssp;
1257
 
1258
  /* The semantic value stack.  */
1259
  YYSTYPE yyvsa[YYINITDEPTH];
1260
  YYSTYPE *yyvs = yyvsa;
1261
  register YYSTYPE *yyvsp;
1262
 
1263
 
1264
 
1265
#define YYPOPSTACK   (yyvsp--, yyssp--)
1266
 
1267
  YYSIZE_T yystacksize = YYINITDEPTH;
1268
 
1269
  /* The variables used to return semantic value and location from the
1270
     action routines.  */
1271
  YYSTYPE yyval;
1272
 
1273
 
1274
  /* When reducing, the number of symbols on the RHS of the reduced
1275
     rule.  */
1276
  int yylen;
1277
 
1278
  YYDPRINTF ((stderr, "Starting parse\n"));
1279
 
1280
  yystate = 0;
1281
  yyerrstatus = 0;
1282
  yynerrs = 0;
1283
  yychar = YYEMPTY;             /* Cause a token to be read.  */
1284
 
1285
  /* Initialize stack pointers.
1286
     Waste one element of value and location stack
1287
     so that they stay on the same level as the state stack.
1288
     The wasted elements are never initialized.  */
1289
 
1290
  yyssp = yyss;
1291
  yyvsp = yyvs;
1292
 
1293
  goto yysetstate;
1294
 
1295
/*------------------------------------------------------------.
1296
| yynewstate -- Push a new state, which is found in yystate.  |
1297
`------------------------------------------------------------*/
1298
 yynewstate:
1299
  /* In all cases, when you get here, the value and location stacks
1300
     have just been pushed. so pushing a state here evens the stacks.
1301
     */
1302
  yyssp++;
1303
 
1304
 yysetstate:
1305
  *yyssp = yystate;
1306
 
1307
  if (yyss + yystacksize - 1 <= yyssp)
1308
    {
1309
      /* Get the current used size of the three stacks, in elements.  */
1310
      YYSIZE_T yysize = yyssp - yyss + 1;
1311
 
1312
#ifdef yyoverflow
1313
      {
1314
        /* Give user a chance to xreallocate the stack. Use copies of
1315
           these so that the &'s don't force the real ones into
1316
           memory.  */
1317
        YYSTYPE *yyvs1 = yyvs;
1318
        short *yyss1 = yyss;
1319
 
1320
 
1321
        /* Each stack pointer address is followed by the size of the
1322
           data in use in that stack, in bytes.  This used to be a
1323
           conditional around just the two extra args, but that might
1324
           be undefined if yyoverflow is a macro.  */
1325
        yyoverflow ("parser stack overflow",
1326
                    &yyss1, yysize * sizeof (*yyssp),
1327
                    &yyvs1, yysize * sizeof (*yyvsp),
1328
 
1329
                    &yystacksize);
1330
 
1331
        yyss = yyss1;
1332
        yyvs = yyvs1;
1333
      }
1334
#else /* no yyoverflow */
1335
# ifndef YYSTACK_RELOCATE
1336
      goto yyoverflowlab;
1337
# else
1338
      /* Extend the stack our own way.  */
1339
      if (YYMAXDEPTH <= yystacksize)
1340
        goto yyoverflowlab;
1341
      yystacksize *= 2;
1342
      if (YYMAXDEPTH < yystacksize)
1343
        yystacksize = YYMAXDEPTH;
1344
 
1345
      {
1346
        short *yyss1 = yyss;
1347
        union yyalloc *yyptr =
1348
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1349
        if (! yyptr)
1350
          goto yyoverflowlab;
1351
        YYSTACK_RELOCATE (yyss);
1352
        YYSTACK_RELOCATE (yyvs);
1353
 
1354
#  undef YYSTACK_RELOCATE
1355
        if (yyss1 != yyssa)
1356
          YYSTACK_FREE (yyss1);
1357
      }
1358
# endif
1359
#endif /* no yyoverflow */
1360
 
1361
      yyssp = yyss + yysize - 1;
1362
      yyvsp = yyvs + yysize - 1;
1363
 
1364
 
1365
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1366
                  (unsigned long int) yystacksize));
1367
 
1368
      if (yyss + yystacksize - 1 <= yyssp)
1369
        YYABORT;
1370
    }
1371
 
1372
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1373
 
1374
  goto yybackup;
1375
 
1376
/*-----------.
1377
| yybackup.  |
1378
`-----------*/
1379
yybackup:
1380
 
1381
/* Do appropriate processing given the current state.  */
1382
/* Read a lookahead token if we need one and don't already have one.  */
1383
/* yyresume: */
1384
 
1385
  /* First try to decide what to do without reference to lookahead token.  */
1386
 
1387
  yyn = yypact[yystate];
1388
  if (yyn == YYPACT_NINF)
1389
    goto yydefault;
1390
 
1391
  /* Not known => get a lookahead token if don't already have one.  */
1392
 
1393
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1394
  if (yychar == YYEMPTY)
1395
    {
1396
      YYDPRINTF ((stderr, "Reading a token: "));
1397
      yychar = YYLEX;
1398
    }
1399
 
1400
  if (yychar <= YYEOF)
1401
    {
1402
      yychar = yytoken = YYEOF;
1403
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1404
    }
1405
  else
1406
    {
1407
      yytoken = YYTRANSLATE (yychar);
1408
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1409
    }
1410
 
1411
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1412
     detect an error, take that action.  */
1413
  yyn += yytoken;
1414
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1415
    goto yydefault;
1416
  yyn = yytable[yyn];
1417
  if (yyn <= 0)
1418
    {
1419
      if (yyn == 0 || yyn == YYTABLE_NINF)
1420
        goto yyerrlab;
1421
      yyn = -yyn;
1422
      goto yyreduce;
1423
    }
1424
 
1425
  if (yyn == YYFINAL)
1426
    YYACCEPT;
1427
 
1428
  /* Shift the lookahead token.  */
1429
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1430
 
1431
  /* Discard the token being shifted unless it is eof.  */
1432
  if (yychar != YYEOF)
1433
    yychar = YYEMPTY;
1434
 
1435
  *++yyvsp = yylval;
1436
 
1437
 
1438
  /* Count tokens shifted since error; after three, turn off error
1439
     status.  */
1440
  if (yyerrstatus)
1441
    yyerrstatus--;
1442
 
1443
  yystate = yyn;
1444
  goto yynewstate;
1445
 
1446
 
1447
/*-----------------------------------------------------------.
1448
| yydefault -- do the default action for the current state.  |
1449
`-----------------------------------------------------------*/
1450
yydefault:
1451
  yyn = yydefact[yystate];
1452
  if (yyn == 0)
1453
    goto yyerrlab;
1454
  goto yyreduce;
1455
 
1456
 
1457
/*-----------------------------.
1458
| yyreduce -- Do a reduction.  |
1459
`-----------------------------*/
1460
yyreduce:
1461
  /* yyn is the number of a rule to reduce with.  */
1462
  yylen = yyr2[yyn];
1463
 
1464
  /* If YYLEN is nonzero, implement the default value of the action:
1465
     `$$ = $1'.
1466
 
1467
     Otherwise, the following line sets YYVAL to garbage.
1468
     This behavior is undocumented and Bison
1469
     users should not rely upon it.  Assigning to YYVAL
1470
     unconditionally makes the parser a bit smaller, and it avoids a
1471
     GCC warning that YYVAL may be used uninitialized.  */
1472
  yyval = yyvsp[1-yylen];
1473
 
1474
 
1475
  YY_REDUCE_PRINT (yyn);
1476
  switch (yyn)
1477
    {
1478
        case 4:
1479
#line 211 "m2-exp.y"
1480
    { write_exp_elt_opcode(OP_TYPE);
1481
                  write_exp_elt_type(yyvsp[0].tval);
1482
                  write_exp_elt_opcode(OP_TYPE);
1483
                }
1484
    break;
1485
 
1486
  case 5:
1487
#line 220 "m2-exp.y"
1488
    { write_exp_elt_opcode (UNOP_IND); }
1489
    break;
1490
 
1491
  case 6:
1492
#line 224 "m2-exp.y"
1493
    { number_sign = -1; }
1494
    break;
1495
 
1496
  case 7:
1497
#line 226 "m2-exp.y"
1498
    { number_sign = 1;
1499
                          write_exp_elt_opcode (UNOP_NEG); }
1500
    break;
1501
 
1502
  case 8:
1503
#line 231 "m2-exp.y"
1504
    { write_exp_elt_opcode(UNOP_PLUS); }
1505
    break;
1506
 
1507
  case 9:
1508
#line 235 "m2-exp.y"
1509
    { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1510
    break;
1511
 
1512
  case 12:
1513
#line 243 "m2-exp.y"
1514
    { write_exp_elt_opcode (UNOP_CAP); }
1515
    break;
1516
 
1517
  case 13:
1518
#line 247 "m2-exp.y"
1519
    { write_exp_elt_opcode (UNOP_ORD); }
1520
    break;
1521
 
1522
  case 14:
1523
#line 251 "m2-exp.y"
1524
    { write_exp_elt_opcode (UNOP_ABS); }
1525
    break;
1526
 
1527
  case 15:
1528
#line 255 "m2-exp.y"
1529
    { write_exp_elt_opcode (UNOP_HIGH); }
1530
    break;
1531
 
1532
  case 16:
1533
#line 259 "m2-exp.y"
1534
    { write_exp_elt_opcode (UNOP_MIN);
1535
                          write_exp_elt_type (yyvsp[-1].tval);
1536
                          write_exp_elt_opcode (UNOP_MIN); }
1537
    break;
1538
 
1539
  case 17:
1540
#line 265 "m2-exp.y"
1541
    { write_exp_elt_opcode (UNOP_MAX);
1542
                          write_exp_elt_type (yyvsp[-1].tval);
1543
                          write_exp_elt_opcode (UNOP_MIN); }
1544
    break;
1545
 
1546
  case 18:
1547
#line 271 "m2-exp.y"
1548
    { write_exp_elt_opcode (UNOP_FLOAT); }
1549
    break;
1550
 
1551
  case 19:
1552
#line 275 "m2-exp.y"
1553
    { write_exp_elt_opcode (BINOP_VAL);
1554
                          write_exp_elt_type (yyvsp[-3].tval);
1555
                          write_exp_elt_opcode (BINOP_VAL); }
1556
    break;
1557
 
1558
  case 20:
1559
#line 281 "m2-exp.y"
1560
    { write_exp_elt_opcode (UNOP_CHR); }
1561
    break;
1562
 
1563
  case 21:
1564
#line 285 "m2-exp.y"
1565
    { write_exp_elt_opcode (UNOP_ODD); }
1566
    break;
1567
 
1568
  case 22:
1569
#line 289 "m2-exp.y"
1570
    { write_exp_elt_opcode (UNOP_TRUNC); }
1571
    break;
1572
 
1573
  case 23:
1574
#line 293 "m2-exp.y"
1575
    { write_exp_elt_opcode (UNOP_SIZEOF); }
1576
    break;
1577
 
1578
  case 24:
1579
#line 297 "m2-exp.y"
1580
    { write_exp_elt_opcode (UNOP_SIZEOF); }
1581
    break;
1582
 
1583
  case 25:
1584
#line 302 "m2-exp.y"
1585
    { write_exp_elt_opcode(UNOP_PREINCREMENT); }
1586
    break;
1587
 
1588
  case 26:
1589
#line 306 "m2-exp.y"
1590
    { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
1591
                          write_exp_elt_opcode(BINOP_ADD);
1592
                          write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); }
1593
    break;
1594
 
1595
  case 27:
1596
#line 312 "m2-exp.y"
1597
    { write_exp_elt_opcode(UNOP_PREDECREMENT);}
1598
    break;
1599
 
1600
  case 28:
1601
#line 316 "m2-exp.y"
1602
    { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
1603
                          write_exp_elt_opcode(BINOP_SUB);
1604
                          write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); }
1605
    break;
1606
 
1607
  case 29:
1608
#line 322 "m2-exp.y"
1609
    { write_exp_elt_opcode (STRUCTOP_STRUCT);
1610
                          write_exp_string (yyvsp[0].sval);
1611
                          write_exp_elt_opcode (STRUCTOP_STRUCT); }
1612
    break;
1613
 
1614
  case 31:
1615
#line 331 "m2-exp.y"
1616
    { error("Sets are not implemented.");}
1617
    break;
1618
 
1619
  case 32:
1620
#line 335 "m2-exp.y"
1621
    { error("Sets are not implemented.");}
1622
    break;
1623
 
1624
  case 33:
1625
#line 339 "m2-exp.y"
1626
    { error("Sets are not implemented.");}
1627
    break;
1628
 
1629
  case 34:
1630
#line 343 "m2-exp.y"
1631
    { error("Sets are not implemented.");}
1632
    break;
1633
 
1634
  case 35:
1635
#line 345 "m2-exp.y"
1636
    { error("Sets are not implemented.");}
1637
    break;
1638
 
1639
  case 36:
1640
#line 354 "m2-exp.y"
1641
    { start_arglist(); }
1642
    break;
1643
 
1644
  case 37:
1645
#line 356 "m2-exp.y"
1646
    { write_exp_elt_opcode (MULTI_SUBSCRIPT);
1647
                          write_exp_elt_longcst ((LONGEST) end_arglist());
1648
                          write_exp_elt_opcode (MULTI_SUBSCRIPT); }
1649
    break;
1650
 
1651
  case 38:
1652
#line 362 "m2-exp.y"
1653
    { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1654
    break;
1655
 
1656
  case 39:
1657
#line 368 "m2-exp.y"
1658
    { start_arglist (); }
1659
    break;
1660
 
1661
  case 40:
1662
#line 370 "m2-exp.y"
1663
    { write_exp_elt_opcode (OP_FUNCALL);
1664
                          write_exp_elt_longcst ((LONGEST) end_arglist ());
1665
                          write_exp_elt_opcode (OP_FUNCALL); }
1666
    break;
1667
 
1668
  case 42:
1669
#line 379 "m2-exp.y"
1670
    { arglist_len = 1; }
1671
    break;
1672
 
1673
  case 43:
1674
#line 383 "m2-exp.y"
1675
    { arglist_len++; }
1676
    break;
1677
 
1678
  case 44:
1679
#line 388 "m2-exp.y"
1680
    { arglist_len = 1; }
1681
    break;
1682
 
1683
  case 45:
1684
#line 393 "m2-exp.y"
1685
    { arglist_len++; }
1686
    break;
1687
 
1688
  case 46:
1689
#line 398 "m2-exp.y"
1690
    { write_exp_elt_opcode (UNOP_MEMVAL);
1691
                          write_exp_elt_type (yyvsp[-2].tval);
1692
                          write_exp_elt_opcode (UNOP_MEMVAL); }
1693
    break;
1694
 
1695
  case 47:
1696
#line 404 "m2-exp.y"
1697
    { write_exp_elt_opcode (UNOP_CAST);
1698
                          write_exp_elt_type (yyvsp[-3].tval);
1699
                          write_exp_elt_opcode (UNOP_CAST); }
1700
    break;
1701
 
1702
  case 48:
1703
#line 410 "m2-exp.y"
1704
    { }
1705
    break;
1706
 
1707
  case 49:
1708
#line 418 "m2-exp.y"
1709
    { write_exp_elt_opcode (BINOP_REPEAT); }
1710
    break;
1711
 
1712
  case 50:
1713
#line 422 "m2-exp.y"
1714
    { write_exp_elt_opcode (BINOP_MUL); }
1715
    break;
1716
 
1717
  case 51:
1718
#line 426 "m2-exp.y"
1719
    { write_exp_elt_opcode (BINOP_DIV); }
1720
    break;
1721
 
1722
  case 52:
1723
#line 430 "m2-exp.y"
1724
    { write_exp_elt_opcode (BINOP_INTDIV); }
1725
    break;
1726
 
1727
  case 53:
1728
#line 434 "m2-exp.y"
1729
    { write_exp_elt_opcode (BINOP_REM); }
1730
    break;
1731
 
1732
  case 54:
1733
#line 438 "m2-exp.y"
1734
    { write_exp_elt_opcode (BINOP_ADD); }
1735
    break;
1736
 
1737
  case 55:
1738
#line 442 "m2-exp.y"
1739
    { write_exp_elt_opcode (BINOP_SUB); }
1740
    break;
1741
 
1742
  case 56:
1743
#line 446 "m2-exp.y"
1744
    { write_exp_elt_opcode (BINOP_EQUAL); }
1745
    break;
1746
 
1747
  case 57:
1748
#line 450 "m2-exp.y"
1749
    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1750
    break;
1751
 
1752
  case 58:
1753
#line 452 "m2-exp.y"
1754
    { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1755
    break;
1756
 
1757
  case 59:
1758
#line 456 "m2-exp.y"
1759
    { write_exp_elt_opcode (BINOP_LEQ); }
1760
    break;
1761
 
1762
  case 60:
1763
#line 460 "m2-exp.y"
1764
    { write_exp_elt_opcode (BINOP_GEQ); }
1765
    break;
1766
 
1767
  case 61:
1768
#line 464 "m2-exp.y"
1769
    { write_exp_elt_opcode (BINOP_LESS); }
1770
    break;
1771
 
1772
  case 62:
1773
#line 468 "m2-exp.y"
1774
    { write_exp_elt_opcode (BINOP_GTR); }
1775
    break;
1776
 
1777
  case 63:
1778
#line 472 "m2-exp.y"
1779
    { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1780
    break;
1781
 
1782
  case 64:
1783
#line 476 "m2-exp.y"
1784
    { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1785
    break;
1786
 
1787
  case 65:
1788
#line 480 "m2-exp.y"
1789
    { write_exp_elt_opcode (BINOP_ASSIGN); }
1790
    break;
1791
 
1792
  case 66:
1793
#line 487 "m2-exp.y"
1794
    { write_exp_elt_opcode (OP_BOOL);
1795
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1796
                          write_exp_elt_opcode (OP_BOOL); }
1797
    break;
1798
 
1799
  case 67:
1800
#line 493 "m2-exp.y"
1801
    { write_exp_elt_opcode (OP_BOOL);
1802
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1803
                          write_exp_elt_opcode (OP_BOOL); }
1804
    break;
1805
 
1806
  case 68:
1807
#line 499 "m2-exp.y"
1808
    { write_exp_elt_opcode (OP_LONG);
1809
                          write_exp_elt_type (builtin_type_m2_int);
1810
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1811
                          write_exp_elt_opcode (OP_LONG); }
1812
    break;
1813
 
1814
  case 69:
1815
#line 506 "m2-exp.y"
1816
    {
1817
                          write_exp_elt_opcode (OP_LONG);
1818
                          write_exp_elt_type (builtin_type_m2_card);
1819
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1820
                          write_exp_elt_opcode (OP_LONG);
1821
                        }
1822
    break;
1823
 
1824
  case 70:
1825
#line 515 "m2-exp.y"
1826
    { write_exp_elt_opcode (OP_LONG);
1827
                          write_exp_elt_type (builtin_type_m2_char);
1828
                          write_exp_elt_longcst ((LONGEST) yyvsp[0].ulval);
1829
                          write_exp_elt_opcode (OP_LONG); }
1830
    break;
1831
 
1832
  case 71:
1833
#line 523 "m2-exp.y"
1834
    { write_exp_elt_opcode (OP_DOUBLE);
1835
                          write_exp_elt_type (builtin_type_m2_real);
1836
                          write_exp_elt_dblcst (yyvsp[0].dval);
1837
                          write_exp_elt_opcode (OP_DOUBLE); }
1838
    break;
1839
 
1840
  case 73:
1841
#line 533 "m2-exp.y"
1842
    { write_exp_elt_opcode (OP_LONG);
1843
                          write_exp_elt_type (builtin_type_int);
1844
                          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1845
                          write_exp_elt_opcode (OP_LONG); }
1846
    break;
1847
 
1848
  case 74:
1849
#line 540 "m2-exp.y"
1850
    { write_exp_elt_opcode (OP_M2_STRING);
1851
                          write_exp_string (yyvsp[0].sval);
1852
                          write_exp_elt_opcode (OP_M2_STRING); }
1853
    break;
1854
 
1855
  case 75:
1856
#line 547 "m2-exp.y"
1857
    { yyval.bval = SYMBOL_BLOCK_VALUE(yyvsp[0].sym); }
1858
    break;
1859
 
1860
  case 76:
1861
#line 551 "m2-exp.y"
1862
    { struct symbol *sym
1863
                            = lookup_symbol (copy_name (yyvsp[0].sval), expression_context_block,
1864
                                             VAR_DOMAIN, 0, NULL);
1865
                          yyval.sym = sym;}
1866
    break;
1867
 
1868
  case 77:
1869
#line 560 "m2-exp.y"
1870
    { struct symbol *tem
1871
                            = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1872
                                             VAR_DOMAIN, 0, NULL);
1873
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
1874
                            error ("No function \"%s\" in specified context.",
1875
                                   copy_name (yyvsp[0].sval));
1876
                          yyval.sym = tem;
1877
                        }
1878
    break;
1879
 
1880
  case 78:
1881
#line 572 "m2-exp.y"
1882
    { write_exp_elt_opcode(OP_VAR_VALUE);
1883
                          write_exp_elt_block (NULL);
1884
                          write_exp_elt_sym (yyvsp[0].sym);
1885
                          write_exp_elt_opcode (OP_VAR_VALUE); }
1886
    break;
1887
 
1888
  case 80:
1889
#line 584 "m2-exp.y"
1890
    { struct symbol *sym;
1891
                          sym = lookup_symbol (copy_name (yyvsp[0].sval), yyvsp[-2].bval,
1892
                                               VAR_DOMAIN, 0, NULL);
1893
                          if (sym == 0)
1894
                            error ("No symbol \"%s\" in specified context.",
1895
                                   copy_name (yyvsp[0].sval));
1896
 
1897
                          write_exp_elt_opcode (OP_VAR_VALUE);
1898
                          /* block_found is set by lookup_symbol.  */
1899
                          write_exp_elt_block (block_found);
1900
                          write_exp_elt_sym (sym);
1901
                          write_exp_elt_opcode (OP_VAR_VALUE); }
1902
    break;
1903
 
1904
  case 81:
1905
#line 600 "m2-exp.y"
1906
    { struct symbol *sym;
1907
                          int is_a_field_of_this;
1908
 
1909
                          sym = lookup_symbol (copy_name (yyvsp[0].sval),
1910
                                               expression_context_block,
1911
                                               VAR_DOMAIN,
1912
                                               &is_a_field_of_this,
1913
                                               NULL);
1914
                          if (sym)
1915
                            {
1916
                              if (symbol_read_needs_frame (sym))
1917
                                {
1918
                                  if (innermost_block == 0 ||
1919
                                      contained_in (block_found,
1920
                                                    innermost_block))
1921
                                    innermost_block = block_found;
1922
                                }
1923
 
1924
                              write_exp_elt_opcode (OP_VAR_VALUE);
1925
                              /* We want to use the selected frame, not
1926
                                 another more inner frame which happens to
1927
                                 be in the same block.  */
1928
                              write_exp_elt_block (NULL);
1929
                              write_exp_elt_sym (sym);
1930
                              write_exp_elt_opcode (OP_VAR_VALUE);
1931
                            }
1932
                          else
1933
                            {
1934
                              struct minimal_symbol *msymbol;
1935
                              char *arg = copy_name (yyvsp[0].sval);
1936
 
1937
                              msymbol =
1938
                                lookup_minimal_symbol (arg, NULL, NULL);
1939
                              if (msymbol != NULL)
1940
                                {
1941
                                  write_exp_msymbol
1942
                                    (msymbol,
1943
                                     lookup_function_type (builtin_type_int),
1944
                                     builtin_type_int);
1945
                                }
1946
                              else if (!have_full_symbols () && !have_partial_symbols ())
1947
                                error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
1948
                              else
1949
                                error ("No symbol \"%s\" in current context.",
1950
                                       copy_name (yyvsp[0].sval));
1951
                            }
1952
                        }
1953
    break;
1954
 
1955
  case 82:
1956
#line 651 "m2-exp.y"
1957
    { yyval.tval = lookup_typename (copy_name (yyvsp[0].sval),
1958
                                                expression_context_block, 0); }
1959
    break;
1960
 
1961
 
1962
    }
1963
 
1964
/* Line 1000 of yacc.c.  */
1965
#line 1966 "m2-exp.c.tmp"
1966
 
1967
  yyvsp -= yylen;
1968
  yyssp -= yylen;
1969
 
1970
 
1971
  YY_STACK_PRINT (yyss, yyssp);
1972
 
1973
  *++yyvsp = yyval;
1974
 
1975
 
1976
  /* Now `shift' the result of the reduction.  Determine what state
1977
     that goes to, based on the state we popped back to and the rule
1978
     number reduced by.  */
1979
 
1980
  yyn = yyr1[yyn];
1981
 
1982
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1983
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1984
    yystate = yytable[yystate];
1985
  else
1986
    yystate = yydefgoto[yyn - YYNTOKENS];
1987
 
1988
  goto yynewstate;
1989
 
1990
 
1991
/*------------------------------------.
1992
| yyerrlab -- here on detecting error |
1993
`------------------------------------*/
1994
yyerrlab:
1995
  /* If not already recovering from an error, report this error.  */
1996
  if (!yyerrstatus)
1997
    {
1998
      ++yynerrs;
1999
#if YYERROR_VERBOSE
2000
      yyn = yypact[yystate];
2001
 
2002
      if (YYPACT_NINF < yyn && yyn < YYLAST)
2003
        {
2004
          YYSIZE_T yysize = 0;
2005
          int yytype = YYTRANSLATE (yychar);
2006
          const char* yyprefix;
2007
          char *yymsg;
2008
          int yyx;
2009
 
2010
          /* Start YYX at -YYN if negative to avoid negative indexes in
2011
             YYCHECK.  */
2012
          int yyxbegin = yyn < 0 ? -yyn : 0;
2013
 
2014
          /* Stay within bounds of both yycheck and yytname.  */
2015
          int yychecklim = YYLAST - yyn;
2016
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2017
          int yycount = 0;
2018
 
2019
          yyprefix = ", expecting ";
2020
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2021
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2022
              {
2023
                yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
2024
                yycount += 1;
2025
                if (yycount == 5)
2026
                  {
2027
                    yysize = 0;
2028
                    break;
2029
                  }
2030
              }
2031
          yysize += (sizeof ("syntax error, unexpected ")
2032
                     + yystrlen (yytname[yytype]));
2033
          yymsg = (char *) YYSTACK_ALLOC (yysize);
2034
          if (yymsg != 0)
2035
            {
2036
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
2037
              yyp = yystpcpy (yyp, yytname[yytype]);
2038
 
2039
              if (yycount < 5)
2040
                {
2041
                  yyprefix = ", expecting ";
2042
                  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2043
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
2044
                      {
2045
                        yyp = yystpcpy (yyp, yyprefix);
2046
                        yyp = yystpcpy (yyp, yytname[yyx]);
2047
                        yyprefix = " or ";
2048
                      }
2049
                }
2050
              yyerror (yymsg);
2051
              YYSTACK_FREE (yymsg);
2052
            }
2053
          else
2054
            yyerror ("syntax error; also virtual memory exhausted");
2055
        }
2056
      else
2057
#endif /* YYERROR_VERBOSE */
2058
        yyerror ("syntax error");
2059
    }
2060
 
2061
 
2062
 
2063
  if (yyerrstatus == 3)
2064
    {
2065
      /* If just tried and failed to reuse lookahead token after an
2066
         error, discard it.  */
2067
 
2068
      if (yychar <= YYEOF)
2069
        {
2070
          /* If at end of input, pop the error token,
2071
             then the rest of the stack, then return failure.  */
2072
          if (yychar == YYEOF)
2073
             for (;;)
2074
               {
2075
                 YYPOPSTACK;
2076
                 if (yyssp == yyss)
2077
                   YYABORT;
2078
                 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2079
                 yydestruct (yystos[*yyssp], yyvsp);
2080
               }
2081
        }
2082
      else
2083
        {
2084
          YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
2085
          yydestruct (yytoken, &yylval);
2086
          yychar = YYEMPTY;
2087
 
2088
        }
2089
    }
2090
 
2091
  /* Else will try to reuse lookahead token after shifting the error
2092
     token.  */
2093
  goto yyerrlab1;
2094
 
2095
 
2096
/*---------------------------------------------------.
2097
| yyerrorlab -- error raised explicitly by YYERROR.  |
2098
`---------------------------------------------------*/
2099
yyerrorlab:
2100
 
2101
#ifdef __GNUC__
2102
  /* Pacify GCC when the user code never invokes YYERROR and the label
2103
     yyerrorlab therefore never appears in user code.  */
2104
  if (0)
2105
     goto yyerrorlab;
2106
#endif
2107
 
2108
  yyvsp -= yylen;
2109
  yyssp -= yylen;
2110
  yystate = *yyssp;
2111
  goto yyerrlab1;
2112
 
2113
 
2114
/*-------------------------------------------------------------.
2115
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
2116
`-------------------------------------------------------------*/
2117
yyerrlab1:
2118
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2119
 
2120
  for (;;)
2121
    {
2122
      yyn = yypact[yystate];
2123
      if (yyn != YYPACT_NINF)
2124
        {
2125
          yyn += YYTERROR;
2126
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2127
            {
2128
              yyn = yytable[yyn];
2129
              if (0 < yyn)
2130
                break;
2131
            }
2132
        }
2133
 
2134
      /* Pop the current state because it cannot handle the error token.  */
2135
      if (yyssp == yyss)
2136
        YYABORT;
2137
 
2138
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2139
      yydestruct (yystos[yystate], yyvsp);
2140
      YYPOPSTACK;
2141
      yystate = *yyssp;
2142
      YY_STACK_PRINT (yyss, yyssp);
2143
    }
2144
 
2145
  if (yyn == YYFINAL)
2146
    YYACCEPT;
2147
 
2148
  YYDPRINTF ((stderr, "Shifting error token, "));
2149
 
2150
  *++yyvsp = yylval;
2151
 
2152
 
2153
  yystate = yyn;
2154
  goto yynewstate;
2155
 
2156
 
2157
/*-------------------------------------.
2158
| yyacceptlab -- YYACCEPT comes here.  |
2159
`-------------------------------------*/
2160
yyacceptlab:
2161
  yyresult = 0;
2162
  goto yyreturn;
2163
 
2164
/*-----------------------------------.
2165
| yyabortlab -- YYABORT comes here.  |
2166
`-----------------------------------*/
2167
yyabortlab:
2168
  yyresult = 1;
2169
  goto yyreturn;
2170
 
2171
#ifndef yyoverflow
2172
/*----------------------------------------------.
2173
| yyoverflowlab -- parser overflow comes here.  |
2174
`----------------------------------------------*/
2175
yyoverflowlab:
2176
  yyerror ("parser stack overflow");
2177
  yyresult = 2;
2178
  /* Fall through.  */
2179
#endif
2180
 
2181
yyreturn:
2182
#ifndef yyoverflow
2183
  if (yyss != yyssa)
2184
    YYSTACK_FREE (yyss);
2185
#endif
2186
  return yyresult;
2187
}
2188
 
2189
 
2190
#line 656 "m2-exp.y"
2191
 
2192
 
2193
#if 0  /* FIXME! */
2194
int
2195
overflow(a,b)
2196
   long a,b;
2197
{
2198
   return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
2199
}
2200
 
2201
int
2202
uoverflow(a,b)
2203
   unsigned long a,b;
2204
{
2205
   return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
2206
}
2207
#endif /* FIXME */
2208
 
2209
/* Take care of parsing a number (anything that starts with a digit).
2210
   Set yylval and return the token type; update lexptr.
2211
   LEN is the number of characters in it.  */
2212
 
2213
/*** Needs some error checking for the float case ***/
2214
 
2215
static int
2216
parse_number (olen)
2217
     int olen;
2218
{
2219
  char *p = lexptr;
2220
  LONGEST n = 0;
2221
  LONGEST prevn = 0;
2222
  int c,i,ischar=0;
2223
  int base = input_radix;
2224
  int len = olen;
2225
  int unsigned_p = number_sign == 1 ? 1 : 0;
2226
 
2227
  if(p[len-1] == 'H')
2228
  {
2229
     base = 16;
2230
     len--;
2231
  }
2232
  else if(p[len-1] == 'C' || p[len-1] == 'B')
2233
  {
2234
     base = 8;
2235
     ischar = p[len-1] == 'C';
2236
     len--;
2237
  }
2238
 
2239
  /* Scan the number */
2240
  for (c = 0; c < len; c++)
2241
  {
2242
    if (p[c] == '.' && base == 10)
2243
      {
2244
        /* It's a float since it contains a point.  */
2245
        yylval.dval = atof (p);
2246
        lexptr += len;
2247
        return FLOAT;
2248
      }
2249
    if (p[c] == '.' && base != 10)
2250
       error("Floating point numbers must be base 10.");
2251
    if (base == 10 && (p[c] < '0' || p[c] > '9'))
2252
       error("Invalid digit \'%c\' in number.",p[c]);
2253
 }
2254
 
2255
  while (len-- > 0)
2256
    {
2257
      c = *p++;
2258
      n *= base;
2259
      if( base == 8 && (c == '8' || c == '9'))
2260
         error("Invalid digit \'%c\' in octal number.",c);
2261
      if (c >= '0' && c <= '9')
2262
        i = c - '0';
2263
      else
2264
        {
2265
          if (base == 16 && c >= 'A' && c <= 'F')
2266
            i = c - 'A' + 10;
2267
          else
2268
             return ERROR;
2269
        }
2270
      n+=i;
2271
      if(i >= base)
2272
         return ERROR;
2273
      if(!unsigned_p && number_sign == 1 && (prevn >= n))
2274
         unsigned_p=1;          /* Try something unsigned */
2275
      /* Don't do the range check if n==i and i==0, since that special
2276
         case will give an overflow error. */
2277
      if(RANGE_CHECK && n!=i && i)
2278
      {
2279
         if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
2280
            ((!unsigned_p && number_sign==-1) && -prevn <= -n))
2281
            range_error("Overflow on numeric constant.");
2282
      }
2283
         prevn=n;
2284
    }
2285
 
2286
  lexptr = p;
2287
  if(*p == 'B' || *p == 'C' || *p == 'H')
2288
     lexptr++;                  /* Advance past B,C or H */
2289
 
2290
  if (ischar)
2291
  {
2292
     yylval.ulval = n;
2293
     return CHAR;
2294
  }
2295
  else if ( unsigned_p && number_sign == 1)
2296
  {
2297
     yylval.ulval = n;
2298
     return UINT;
2299
  }
2300
  else if((unsigned_p && (n<0))) {
2301
     range_error("Overflow on numeric constant -- number too large.");
2302
     /* But, this can return if range_check == range_warn.  */
2303
  }
2304
  yylval.lval = n;
2305
  return INT;
2306
}
2307
 
2308
 
2309
/* Some tokens */
2310
 
2311
static struct
2312
{
2313
   char name[2];
2314
   int token;
2315
} tokentab2[] =
2316
{
2317
    { {'<', '>'},    NOTEQUAL   },
2318
    { {':', '='},    ASSIGN     },
2319
    { {'<', '='},    LEQ        },
2320
    { {'>', '='},    GEQ        },
2321
    { {':', ':'},    COLONCOLON },
2322
 
2323
};
2324
 
2325
/* Some specific keywords */
2326
 
2327
struct keyword {
2328
   char keyw[10];
2329
   int token;
2330
};
2331
 
2332
static struct keyword keytab[] =
2333
{
2334
    {"OR" ,   OROR       },
2335
    {"IN",    IN         },/* Note space after IN */
2336
    {"AND",   LOGICAL_AND},
2337
    {"ABS",   ABS        },
2338
    {"CHR",   CHR        },
2339
    {"DEC",   DEC        },
2340
    {"NOT",   NOT        },
2341
    {"DIV",   DIV        },
2342
    {"INC",   INC        },
2343
    {"MAX",   MAX_FUNC   },
2344
    {"MIN",   MIN_FUNC   },
2345
    {"MOD",   MOD        },
2346
    {"ODD",   ODD        },
2347
    {"CAP",   CAP        },
2348
    {"ORD",   ORD        },
2349
    {"VAL",   VAL        },
2350
    {"EXCL",  EXCL       },
2351
    {"HIGH",  HIGH       },
2352
    {"INCL",  INCL       },
2353
    {"SIZE",  SIZE       },
2354
    {"FLOAT", FLOAT_FUNC },
2355
    {"TRUNC", TRUNC      },
2356
    {"TSIZE", SIZE       },
2357
};
2358
 
2359
 
2360
/* Read one token, getting characters through lexptr.  */
2361
 
2362
/* This is where we will check to make sure that the language and the operators used are
2363
   compatible  */
2364
 
2365
static int
2366
yylex ()
2367
{
2368
  int c;
2369
  int namelen;
2370
  int i;
2371
  char *tokstart;
2372
  char quote;
2373
 
2374
 retry:
2375
 
2376
  prev_lexptr = lexptr;
2377
 
2378
  tokstart = lexptr;
2379
 
2380
 
2381
  /* See if it is a special token of length 2 */
2382
  for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++)
2383
     if (strncmp (tokentab2[i].name, tokstart, 2) == 0)
2384
     {
2385
        lexptr += 2;
2386
        return tokentab2[i].token;
2387
     }
2388
 
2389
  switch (c = *tokstart)
2390
    {
2391
    case 0:
2392
      return 0;
2393
 
2394
    case ' ':
2395
    case '\t':
2396
    case '\n':
2397
      lexptr++;
2398
      goto retry;
2399
 
2400
    case '(':
2401
      paren_depth++;
2402
      lexptr++;
2403
      return c;
2404
 
2405
    case ')':
2406
      if (paren_depth == 0)
2407
        return 0;
2408
      paren_depth--;
2409
      lexptr++;
2410
      return c;
2411
 
2412
    case ',':
2413
      if (comma_terminates && paren_depth == 0)
2414
        return 0;
2415
      lexptr++;
2416
      return c;
2417
 
2418
    case '.':
2419
      /* Might be a floating point number.  */
2420
      if (lexptr[1] >= '0' && lexptr[1] <= '9')
2421
        break;                  /* Falls into number code.  */
2422
      else
2423
      {
2424
         lexptr++;
2425
         return DOT;
2426
      }
2427
 
2428
/* These are character tokens that appear as-is in the YACC grammar */
2429
    case '+':
2430
    case '-':
2431
    case '*':
2432
    case '/':
2433
    case '^':
2434
    case '<':
2435
    case '>':
2436
    case '[':
2437
    case ']':
2438
    case '=':
2439
    case '{':
2440
    case '}':
2441
    case '#':
2442
    case '@':
2443
    case '~':
2444
    case '&':
2445
      lexptr++;
2446
      return c;
2447
 
2448
    case '\'' :
2449
    case '"':
2450
      quote = c;
2451
      for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
2452
        if (c == '\\')
2453
          {
2454
            c = tokstart[++namelen];
2455
            if (c >= '0' && c <= '9')
2456
              {
2457
                c = tokstart[++namelen];
2458
                if (c >= '0' && c <= '9')
2459
                  c = tokstart[++namelen];
2460
              }
2461
          }
2462
      if(c != quote)
2463
         error("Unterminated string or character constant.");
2464
      yylval.sval.ptr = tokstart + 1;
2465
      yylval.sval.length = namelen - 1;
2466
      lexptr += namelen + 1;
2467
 
2468
      if(namelen == 2)          /* Single character */
2469
      {
2470
           yylval.ulval = tokstart[1];
2471
           return CHAR;
2472
      }
2473
      else
2474
         return STRING;
2475
    }
2476
 
2477
  /* Is it a number?  */
2478
  /* Note:  We have already dealt with the case of the token '.'.
2479
     See case '.' above.  */
2480
  if ((c >= '0' && c <= '9'))
2481
    {
2482
      /* It's a number.  */
2483
      int got_dot = 0, got_e = 0;
2484
      char *p = tokstart;
2485
      int toktype;
2486
 
2487
      for (++p ;; ++p)
2488
        {
2489
          if (!got_e && (*p == 'e' || *p == 'E'))
2490
            got_dot = got_e = 1;
2491
          else if (!got_dot && *p == '.')
2492
            got_dot = 1;
2493
          else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2494
                   && (*p == '-' || *p == '+'))
2495
            /* This is the sign of the exponent, not the end of the
2496
               number.  */
2497
            continue;
2498
          else if ((*p < '0' || *p > '9') &&
2499
                   (*p < 'A' || *p > 'F') &&
2500
                   (*p != 'H'))  /* Modula-2 hexadecimal number */
2501
            break;
2502
        }
2503
        toktype = parse_number (p - tokstart);
2504
        if (toktype == ERROR)
2505
          {
2506
            char *err_copy = (char *) alloca (p - tokstart + 1);
2507
 
2508
            memcpy (err_copy, tokstart, p - tokstart);
2509
            err_copy[p - tokstart] = 0;
2510
            error ("Invalid number \"%s\".", err_copy);
2511
          }
2512
        lexptr = p;
2513
        return toktype;
2514
    }
2515
 
2516
  if (!(c == '_' || c == '$'
2517
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2518
    /* We must have come across a bad character (e.g. ';').  */
2519
    error ("Invalid character '%c' in expression.", c);
2520
 
2521
  /* It's a name.  See how long it is.  */
2522
  namelen = 0;
2523
  for (c = tokstart[namelen];
2524
       (c == '_' || c == '$' || (c >= '0' && c <= '9')
2525
        || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2526
       c = tokstart[++namelen])
2527
    ;
2528
 
2529
  /* The token "if" terminates the expression and is NOT
2530
     removed from the input stream.  */
2531
  if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2532
    {
2533
      return 0;
2534
    }
2535
 
2536
  lexptr += namelen;
2537
 
2538
  /*  Lookup special keywords */
2539
  for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++)
2540
     if (namelen == strlen (keytab[i].keyw)
2541
         && strncmp (tokstart, keytab[i].keyw, namelen) == 0)
2542
           return keytab[i].token;
2543
 
2544
  yylval.sval.ptr = tokstart;
2545
  yylval.sval.length = namelen;
2546
 
2547
  if (*tokstart == '$')
2548
    {
2549
      write_dollar_variable (yylval.sval);
2550
      return INTERNAL_VAR;
2551
    }
2552
 
2553
  /* Use token-type BLOCKNAME for symbols that happen to be defined as
2554
     functions.  If this is not so, then ...
2555
     Use token-type TYPENAME for symbols that happen to be defined
2556
     currently as names of types; NAME for other symbols.
2557
     The caller is not constrained to care about the distinction.  */
2558
 {
2559
 
2560
 
2561
    char *tmp = copy_name (yylval.sval);
2562
    struct symbol *sym;
2563
 
2564
    if (lookup_partial_symtab (tmp))
2565
      return BLOCKNAME;
2566
    sym = lookup_symbol (tmp, expression_context_block,
2567
                         VAR_DOMAIN, 0, NULL);
2568
    if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
2569
      return BLOCKNAME;
2570
    if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
2571
      return TYPENAME;
2572
 
2573
    if(sym)
2574
    {
2575
       switch(sym->aclass)
2576
       {
2577
       case LOC_STATIC:
2578
       case LOC_REGISTER:
2579
       case LOC_ARG:
2580
       case LOC_REF_ARG:
2581
       case LOC_REGPARM:
2582
       case LOC_REGPARM_ADDR:
2583
       case LOC_LOCAL:
2584
       case LOC_LOCAL_ARG:
2585
       case LOC_BASEREG:
2586
       case LOC_BASEREG_ARG:
2587
       case LOC_CONST:
2588
       case LOC_CONST_BYTES:
2589
       case LOC_OPTIMIZED_OUT:
2590
       case LOC_COMPUTED:
2591
       case LOC_COMPUTED_ARG:
2592
          return NAME;
2593
 
2594
       case LOC_TYPEDEF:
2595
          return TYPENAME;
2596
 
2597
       case LOC_BLOCK:
2598
          return BLOCKNAME;
2599
 
2600
       case LOC_UNDEF:
2601
          error("internal:  Undefined class in m2lex()");
2602
 
2603
       case LOC_LABEL:
2604
       case LOC_UNRESOLVED:
2605
          error("internal:  Unforseen case in m2lex()");
2606
 
2607
       default:
2608
          error ("unhandled token in m2lex()");
2609
          break;
2610
       }
2611
    }
2612
    else
2613
    {
2614
       /* Built-in BOOLEAN type.  This is sort of a hack. */
2615
       if (strncmp (tokstart, "TRUE", 4) == 0)
2616
       {
2617
          yylval.ulval = 1;
2618
          return M2_TRUE;
2619
       }
2620
       else if (strncmp (tokstart, "FALSE", 5) == 0)
2621
       {
2622
          yylval.ulval = 0;
2623
          return M2_FALSE;
2624
       }
2625
    }
2626
 
2627
    /* Must be another type of name... */
2628
    return NAME;
2629
 }
2630
}
2631
 
2632
#if 0           /* Unused */
2633
static char *
2634
make_qualname(mod,ident)
2635
   char *mod, *ident;
2636
{
2637
   char *new = xmalloc(strlen(mod)+strlen(ident)+2);
2638
 
2639
   strcpy(new,mod);
2640
   strcat(new,".");
2641
   strcat(new,ident);
2642
   return new;
2643
}
2644
#endif  /* 0 */
2645
 
2646
void
2647
yyerror (msg)
2648
     char *msg;
2649
{
2650
  if (prev_lexptr)
2651
    lexptr = prev_lexptr;
2652
 
2653
  error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);
2654
}
2655
 
2656
 

powered by: WebSVN 2.1.0

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