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