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