Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gdb6 / gdb / f-exp.c
blob527fd76f194467624df7c3234603f84af2f50d0a
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 FLOAT = 259,
58 STRING_LITERAL = 260,
59 BOOLEAN_LITERAL = 261,
60 NAME = 262,
61 TYPENAME = 263,
62 NAME_OR_INT = 264,
63 SIZEOF = 265,
64 ERROR = 266,
65 INT_KEYWORD = 267,
66 INT_S2_KEYWORD = 268,
67 LOGICAL_S1_KEYWORD = 269,
68 LOGICAL_S2_KEYWORD = 270,
69 LOGICAL_KEYWORD = 271,
70 REAL_KEYWORD = 272,
71 REAL_S8_KEYWORD = 273,
72 REAL_S16_KEYWORD = 274,
73 COMPLEX_S8_KEYWORD = 275,
74 COMPLEX_S16_KEYWORD = 276,
75 COMPLEX_S32_KEYWORD = 277,
76 BOOL_AND = 278,
77 BOOL_OR = 279,
78 BOOL_NOT = 280,
79 CHARACTER = 281,
80 VARIABLE = 282,
81 ASSIGN_MODIFY = 283,
82 ABOVE_COMMA = 284,
83 NOTEQUAL = 285,
84 EQUAL = 286,
85 GEQ = 287,
86 LEQ = 288,
87 GREATERTHAN = 289,
88 LESSTHAN = 290,
89 RSH = 291,
90 LSH = 292,
91 STARSTAR = 293,
92 UNARY = 294
94 #endif
95 #define INT 258
96 #define FLOAT 259
97 #define STRING_LITERAL 260
98 #define BOOLEAN_LITERAL 261
99 #define NAME 262
100 #define TYPENAME 263
101 #define NAME_OR_INT 264
102 #define SIZEOF 265
103 #define ERROR 266
104 #define INT_KEYWORD 267
105 #define INT_S2_KEYWORD 268
106 #define LOGICAL_S1_KEYWORD 269
107 #define LOGICAL_S2_KEYWORD 270
108 #define LOGICAL_KEYWORD 271
109 #define REAL_KEYWORD 272
110 #define REAL_S8_KEYWORD 273
111 #define REAL_S16_KEYWORD 274
112 #define COMPLEX_S8_KEYWORD 275
113 #define COMPLEX_S16_KEYWORD 276
114 #define COMPLEX_S32_KEYWORD 277
115 #define BOOL_AND 278
116 #define BOOL_OR 279
117 #define BOOL_NOT 280
118 #define CHARACTER 281
119 #define VARIABLE 282
120 #define ASSIGN_MODIFY 283
121 #define ABOVE_COMMA 284
122 #define NOTEQUAL 285
123 #define EQUAL 286
124 #define GEQ 287
125 #define LEQ 288
126 #define GREATERTHAN 289
127 #define LESSTHAN 290
128 #define RSH 291
129 #define LSH 292
130 #define STARSTAR 293
131 #define UNARY 294
136 /* Copy the first part of user declarations. */
137 #line 45 "f-exp.y"
140 #include "defs.h"
141 #include "gdb_string.h"
142 #include "expression.h"
143 #include "value.h"
144 #include "parser-defs.h"
145 #include "language.h"
146 #include "f-lang.h"
147 #include "bfd.h" /* Required by objfiles.h. */
148 #include "symfile.h" /* Required by objfiles.h. */
149 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
150 #include "block.h"
151 #include <ctype.h>
153 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
154 as well as gratuitiously global symbol names, so we can have multiple
155 yacc generated parsers in gdb. Note that these are only the variables
156 produced by yacc. If other parser generators (bison, byacc, etc) produce
157 additional global names that conflict at link time, then those parser
158 generators need to be fixed instead of adding those names to this list. */
160 #define yymaxdepth f_maxdepth
161 #define yyparse f_parse
162 #define yylex f_lex
163 #define yyerror f_error
164 #define yylval f_lval
165 #define yychar f_char
166 #define yydebug f_debug
167 #define yypact f_pact
168 #define yyr1 f_r1
169 #define yyr2 f_r2
170 #define yydef f_def
171 #define yychk f_chk
172 #define yypgo f_pgo
173 #define yyact f_act
174 #define yyexca f_exca
175 #define yyerrflag f_errflag
176 #define yynerrs f_nerrs
177 #define yyps f_ps
178 #define yypv f_pv
179 #define yys f_s
180 #define yy_yys f_yys
181 #define yystate f_state
182 #define yytmp f_tmp
183 #define yyv f_v
184 #define yy_yyv f_yyv
185 #define yyval f_val
186 #define yylloc f_lloc
187 #define yyreds f_reds /* With YYDEBUG defined */
188 #define yytoks f_toks /* With YYDEBUG defined */
189 #define yyname f_name /* With YYDEBUG defined */
190 #define yyrule f_rule /* With YYDEBUG defined */
191 #define yylhs f_yylhs
192 #define yylen f_yylen
193 #define yydefred f_yydefred
194 #define yydgoto f_yydgoto
195 #define yysindex f_yysindex
196 #define yyrindex f_yyrindex
197 #define yygindex f_yygindex
198 #define yytable f_yytable
199 #define yycheck f_yycheck
201 #ifndef YYDEBUG
202 #define YYDEBUG 1 /* Default to yydebug support */
203 #endif
205 #define YYFPRINTF parser_fprintf
207 int yyparse (void);
209 static int yylex (void);
211 void yyerror (char *);
213 static void growbuf_by_size (int);
215 static int match_string_literal (void);
219 /* Enabling traces. */
220 #ifndef YYDEBUG
221 # define YYDEBUG 0
222 #endif
224 /* Enabling verbose error messages. */
225 #ifdef YYERROR_VERBOSE
226 # undef YYERROR_VERBOSE
227 # define YYERROR_VERBOSE 1
228 #else
229 # define YYERROR_VERBOSE 0
230 #endif
232 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
233 #line 131 "f-exp.y"
234 typedef union YYSTYPE {
235 LONGEST lval;
236 struct {
237 LONGEST val;
238 struct type *type;
239 } typed_val;
240 DOUBLEST dval;
241 struct symbol *sym;
242 struct type *tval;
243 struct stoken sval;
244 struct ttype tsym;
245 struct symtoken ssym;
246 int voidval;
247 struct block *bval;
248 enum exp_opcode opcode;
249 struct internalvar *ivar;
251 struct type **tvec;
252 int *ivec;
253 } YYSTYPE;
254 /* Line 191 of yacc.c. */
255 #line 256 "f-exp.c.tmp"
256 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
257 # define YYSTYPE_IS_DECLARED 1
258 # define YYSTYPE_IS_TRIVIAL 1
259 #endif
263 /* Copy the second part of user declarations. */
264 #line 152 "f-exp.y"
266 /* YYSTYPE gets defined by %union */
267 static int parse_number (char *, int, int, YYSTYPE *);
270 /* Line 214 of yacc.c. */
271 #line 272 "f-exp.c.tmp"
273 #if ! defined (yyoverflow) || YYERROR_VERBOSE
275 # ifndef YYFREE
276 # define YYFREE free
277 # endif
278 # ifndef YYMALLOC
279 # define YYMALLOC xmalloc
280 # endif
282 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
284 # ifdef YYSTACK_USE_ALLOCA
285 # if YYSTACK_USE_ALLOCA
286 # define YYSTACK_ALLOC alloca
287 # endif
288 # else
289 # if defined (alloca) || defined (_ALLOCA_H)
290 # define YYSTACK_ALLOC alloca
291 # else
292 # ifdef __GNUC__
293 # define YYSTACK_ALLOC __builtin_alloca
294 # endif
295 # endif
296 # endif
298 # ifdef YYSTACK_ALLOC
299 /* Pacify GCC's `empty if-body' warning. */
300 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
301 # else
302 # if defined (__STDC__) || defined (__cplusplus)
303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
304 # define YYSIZE_T size_t
305 # endif
306 # define YYSTACK_ALLOC YYMALLOC
307 # define YYSTACK_FREE YYFREE
308 # endif
309 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
312 #if (! defined (yyoverflow) \
313 && (! defined (__cplusplus) \
314 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
316 /* A type that is properly aligned for any stack member. */
317 union yyalloc
319 short yyss;
320 YYSTYPE yyvs;
323 /* The size of the maximum gap between one aligned stack and the next. */
324 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
326 /* The size of an array large to enough to hold all stacks, each with
327 N elements. */
328 # define YYSTACK_BYTES(N) \
329 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
330 + YYSTACK_GAP_MAXIMUM)
332 /* Copy COUNT objects from FROM to TO. The source and destination do
333 not overlap. */
334 # ifndef YYCOPY
335 # if defined (__GNUC__) && 1 < __GNUC__
336 # define YYCOPY(To, From, Count) \
337 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
338 # else
339 # define YYCOPY(To, From, Count) \
340 do \
342 register YYSIZE_T yyi; \
343 for (yyi = 0; yyi < (Count); yyi++) \
344 (To)[yyi] = (From)[yyi]; \
346 while (0)
347 # endif
348 # endif
350 /* Relocate STACK from its old location to the new one. The
351 local variables YYSIZE and YYSTACKSIZE give the old and new number of
352 elements in the stack, and YYPTR gives the new location of the
353 stack. Advance YYPTR to a properly aligned location for the next
354 stack. */
355 # define YYSTACK_RELOCATE(Stack) \
356 do \
358 YYSIZE_T yynewbytes; \
359 YYCOPY (&yyptr->Stack, Stack, yysize); \
360 Stack = &yyptr->Stack; \
361 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
362 yyptr += yynewbytes / sizeof (*yyptr); \
364 while (0)
366 #endif
368 #if defined (__STDC__) || defined (__cplusplus)
369 typedef signed char yysigned_char;
370 #else
371 typedef short yysigned_char;
372 #endif
374 /* YYFINAL -- State number of the termination state. */
375 #define YYFINAL 46
376 /* YYLAST -- Last index in YYTABLE. */
377 #define YYLAST 531
379 /* YYNTOKENS -- Number of terminals. */
380 #define YYNTOKENS 56
381 /* YYNNTS -- Number of nonterminals. */
382 #define YYNNTS 18
383 /* YYNRULES -- Number of rules. */
384 #define YYNRULES 85
385 /* YYNRULES -- Number of states. */
386 #define YYNSTATES 130
388 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
389 #define YYUNDEFTOK 2
390 #define YYMAXUTOK 294
392 #define YYTRANSLATE(YYX) \
393 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
395 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
396 static const unsigned char yytranslate[] =
398 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
399 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
400 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
401 2, 2, 2, 2, 2, 2, 2, 50, 35, 2,
402 52, 53, 47, 45, 29, 46, 2, 48, 2, 2,
403 2, 2, 2, 2, 2, 2, 2, 2, 55, 2,
404 2, 31, 2, 32, 44, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 34, 2, 2, 2, 2, 2,
408 2, 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, 33, 2, 54, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 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, 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, 2, 2, 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, 1, 2, 3, 4,
424 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
425 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
426 25, 26, 27, 28, 30, 36, 37, 38, 39, 40,
427 41, 42, 43, 49, 51
430 #if YYDEBUG
431 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
432 YYRHS. */
433 static const unsigned char yyprhs[] =
435 0, 0, 3, 5, 7, 9, 13, 16, 19, 22,
436 25, 28, 31, 32, 38, 39, 41, 43, 47, 51,
437 54, 57, 59, 63, 67, 72, 76, 80, 84, 88,
438 92, 96, 100, 104, 108, 112, 116, 120, 124, 128,
439 132, 136, 140, 144, 148, 152, 156, 160, 162, 164,
440 166, 168, 170, 175, 177, 179, 181, 183, 185, 188,
441 190, 193, 195, 198, 200, 204, 207, 209, 212, 216,
442 218, 220, 222, 224, 226, 228, 230, 232, 234, 236,
443 238, 240, 242, 244, 248, 250
446 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
447 static const yysigned_char yyrhs[] =
449 57, 0, -1, 59, -1, 58, -1, 65, -1, 52,
450 59, 53, -1, 47, 59, -1, 35, 59, -1, 46,
451 59, -1, 25, 59, -1, 54, 59, -1, 10, 59,
452 -1, -1, 59, 52, 60, 61, 53, -1, -1, 59,
453 -1, 62, -1, 61, 29, 59, -1, 59, 55, 59,
454 -1, 59, 55, -1, 55, 59, -1, 55, -1, 59,
455 29, 59, -1, 52, 63, 53, -1, 52, 65, 53,
456 59, -1, 59, 50, 72, -1, 59, 44, 59, -1,
457 59, 49, 59, -1, 59, 47, 59, -1, 59, 48,
458 59, -1, 59, 45, 59, -1, 59, 46, 59, -1,
459 59, 43, 59, -1, 59, 42, 59, -1, 59, 37,
460 59, -1, 59, 36, 59, -1, 59, 39, 59, -1,
461 59, 38, 59, -1, 59, 41, 59, -1, 59, 40,
462 59, -1, 59, 35, 59, -1, 59, 34, 59, -1,
463 59, 33, 59, -1, 59, 23, 59, -1, 59, 24,
464 59, -1, 59, 31, 59, -1, 59, 28, 59, -1,
465 3, -1, 9, -1, 4, -1, 64, -1, 27, -1,
466 10, 52, 65, 53, -1, 6, -1, 5, -1, 73,
467 -1, 66, -1, 70, -1, 70, 67, -1, 47, -1,
468 47, 67, -1, 35, -1, 35, 67, -1, 68, -1,
469 52, 67, 53, -1, 68, 69, -1, 69, -1, 52,
470 53, -1, 52, 71, 53, -1, 8, -1, 12, -1,
471 13, -1, 26, -1, 16, -1, 15, -1, 14, -1,
472 17, -1, 18, -1, 19, -1, 20, -1, 21, -1,
473 22, -1, 65, -1, 71, 29, 65, -1, 7, -1,
474 7, -1
477 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
478 static const unsigned short yyrline[] =
480 0, 230, 230, 231, 234, 240, 245, 249, 253, 257,
481 261, 265, 275, 274, 282, 285, 289, 293, 299, 305,
482 311, 317, 323, 327, 331, 337, 345, 349, 353, 357,
483 361, 365, 369, 373, 377, 381, 385, 389, 393, 397,
484 401, 405, 409, 413, 418, 422, 426, 432, 439, 448,
485 455, 458, 461, 469, 476, 484, 528, 531, 532, 575,
486 577, 579, 581, 583, 586, 588, 590, 594, 596, 601,
487 603, 605, 607, 609, 611, 613, 615, 617, 619, 621,
488 623, 625, 630, 635, 642, 646
490 #endif
492 #if YYDEBUG || YYERROR_VERBOSE
493 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
494 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
495 static const char *const yytname[] =
497 "$end", "error", "$undefined", "INT", "FLOAT", "STRING_LITERAL",
498 "BOOLEAN_LITERAL", "NAME", "TYPENAME", "NAME_OR_INT", "SIZEOF", "ERROR",
499 "INT_KEYWORD", "INT_S2_KEYWORD", "LOGICAL_S1_KEYWORD",
500 "LOGICAL_S2_KEYWORD", "LOGICAL_KEYWORD", "REAL_KEYWORD",
501 "REAL_S8_KEYWORD", "REAL_S16_KEYWORD", "COMPLEX_S8_KEYWORD",
502 "COMPLEX_S16_KEYWORD", "COMPLEX_S32_KEYWORD", "BOOL_AND", "BOOL_OR",
503 "BOOL_NOT", "CHARACTER", "VARIABLE", "ASSIGN_MODIFY", "','",
504 "ABOVE_COMMA", "'='", "'?'", "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL",
505 "GEQ", "LEQ", "GREATERTHAN", "LESSTHAN", "RSH", "LSH", "'@'", "'+'",
506 "'-'", "'*'", "'/'", "STARSTAR", "'%'", "UNARY", "'('", "')'", "'~'",
507 "':'", "$accept", "start", "type_exp", "exp", "@1", "arglist",
508 "subrange", "complexnum", "variable", "type", "ptype", "abs_decl",
509 "direct_abs_decl", "func_mod", "typebase", "nonempty_typelist", "name",
510 "name_not_typename", 0
512 #endif
514 # ifdef YYPRINT
515 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
516 token YYLEX-NUM. */
517 static const unsigned short yytoknum[] =
519 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
520 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
521 275, 276, 277, 278, 279, 280, 281, 282, 283, 44,
522 284, 61, 63, 124, 94, 38, 285, 286, 287, 288,
523 289, 290, 291, 292, 64, 43, 45, 42, 47, 293,
524 37, 294, 40, 41, 126, 58
526 # endif
528 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
529 static const unsigned char yyr1[] =
531 0, 56, 57, 57, 58, 59, 59, 59, 59, 59,
532 59, 59, 60, 59, 61, 61, 61, 61, 62, 62,
533 62, 62, 63, 59, 59, 59, 59, 59, 59, 59,
534 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
535 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
536 59, 59, 59, 59, 59, 64, 65, 66, 66, 67,
537 67, 67, 67, 67, 68, 68, 68, 69, 69, 70,
538 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
539 70, 70, 71, 71, 72, 73
542 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
543 static const unsigned char yyr2[] =
545 0, 2, 1, 1, 1, 3, 2, 2, 2, 2,
546 2, 2, 0, 5, 0, 1, 1, 3, 3, 2,
547 2, 1, 3, 3, 4, 3, 3, 3, 3, 3,
548 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
549 3, 3, 3, 3, 3, 3, 3, 1, 1, 1,
550 1, 1, 4, 1, 1, 1, 1, 1, 2, 1,
551 2, 1, 2, 1, 3, 2, 1, 2, 3, 1,
552 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
553 1, 1, 1, 3, 1, 1
556 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
557 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
558 means the default is an error. */
559 static const unsigned char yydefact[] =
561 0, 47, 49, 54, 53, 85, 69, 48, 0, 70,
562 71, 75, 74, 73, 76, 77, 78, 79, 80, 81,
563 0, 72, 51, 0, 0, 0, 0, 0, 0, 3,
564 2, 50, 4, 56, 57, 55, 0, 11, 9, 7,
565 8, 6, 0, 0, 0, 10, 1, 0, 0, 0,
566 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
567 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
568 61, 59, 0, 58, 63, 66, 0, 0, 5, 23,
569 0, 43, 44, 46, 45, 42, 41, 40, 35, 34,
570 37, 36, 39, 38, 33, 32, 26, 30, 31, 28,
571 29, 27, 84, 25, 14, 62, 60, 67, 82, 0,
572 0, 0, 65, 52, 22, 24, 21, 15, 0, 16,
573 64, 0, 68, 20, 19, 0, 13, 83, 18, 17
576 /* YYDEFGOTO[NTERM-NUM]. */
577 static const yysigned_char yydefgoto[] =
579 -1, 28, 29, 42, 104, 118, 119, 43, 31, 108,
580 33, 73, 74, 75, 34, 110, 103, 35
583 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
584 STATE-NUM. */
585 #define YYPACT_NINF -49
586 static const short yypact[] =
588 123, -49, -49, -49, -49, -49, -49, -49, 156, -49,
589 -49, -49, -49, -49, -49, -49, -49, -49, -49, -49,
590 189, -49, -49, 189, 189, 189, 123, 189, 3, -49,
591 362, -49, -49, -49, -34, -49, 123, -48, -48, -48,
592 -48, -48, 331, -46, -32, -48, -49, 189, 189, 189,
593 189, 189, 189, 189, 189, 189, 189, 189, 189, 189,
594 189, 189, 189, 189, 189, 189, 189, 189, 8, -49,
595 -34, -34, 238, -49, -26, -49, -31, 189, -49, -49,
596 189, 410, 390, 362, 362, 429, 447, 464, 479, 479,
597 39, 39, 39, 39, -13, -13, 49, -38, -38, -33,
598 -33, -33, -49, -49, 65, -49, -49, -49, -49, -10,
599 -24, 280, -49, 222, 362, -48, 189, 301, -23, -49,
600 -49, 295, -49, 362, 189, 189, -49, -49, 362, 362
603 /* YYPGOTO[NTERM-NUM]. */
604 static const yysigned_char yypgoto[] =
606 -49, -49, -49, 0, -49, -49, -49, -49, -49, 2,
607 -49, -30, -49, -29, -49, -49, -49, -49
610 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
611 positive, shift that token. If negative, reduce the rule which
612 number is the opposite. If zero, do what YYDEFACT says.
613 If YYTABLE_NINF, syntax error. */
614 #define YYTABLE_NINF -1
615 static const unsigned char yytable[] =
617 30, 70, 32, 46, 69, 121, 125, 79, 37, 65,
618 66, 67, 68, 71, 69, 102, 67, 68, 72, 69,
619 38, 80, 113, 39, 40, 41, 111, 45, 44, 122,
620 126, 62, 63, 64, 65, 66, 67, 68, 76, 69,
621 105, 106, 109, 120, 0, 112, 0, 81, 82, 83,
622 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
623 94, 95, 96, 97, 98, 99, 100, 101, 1, 2,
624 3, 4, 5, 0, 7, 8, 0, 114, 0, 0,
625 115, 60, 61, 62, 63, 64, 65, 66, 67, 68,
626 20, 69, 22, 0, 63, 64, 65, 66, 67, 68,
627 23, 69, 0, 0, 117, 0, 0, 0, 0, 0,
628 0, 24, 25, 115, 0, 0, 123, 26, 0, 27,
629 116, 0, 0, 127, 128, 129, 1, 2, 3, 4,
630 5, 6, 7, 8, 0, 9, 10, 11, 12, 13,
631 14, 15, 16, 17, 18, 19, 0, 0, 20, 21,
632 22, 0, 0, 0, 0, 0, 0, 0, 23, 1,
633 2, 3, 4, 5, 0, 7, 8, 0, 0, 24,
634 25, 0, 0, 0, 0, 26, 0, 27, 0, 0,
635 0, 20, 0, 22, 0, 0, 0, 0, 0, 0,
636 0, 23, 1, 2, 3, 4, 5, 0, 7, 8,
637 0, 0, 24, 25, 0, 0, 0, 0, 36, 0,
638 27, 0, 0, 0, 20, 0, 22, 0, 0, 0,
639 0, 0, 0, 0, 23, 1, 2, 3, 4, 5,
640 0, 7, 8, 0, 0, 24, 25, 0, 0, 0,
641 0, 26, 0, 27, 0, 0, 6, 20, 0, 22,
642 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
643 19, 0, 0, 0, 21, 0, 0, 0, 0, 0,
644 0, 0, 0, 70, 26, 0, 27, 0, 0, 0,
645 0, 0, 0, 0, 0, 71, 0, 0, 6, 0,
646 72, 107, 9, 10, 11, 12, 13, 14, 15, 16,
647 17, 18, 19, 6, 0, 0, 21, 9, 10, 11,
648 12, 13, 14, 15, 16, 17, 18, 19, 0, 0,
649 0, 21, 0, 0, 47, 48, 0, 0, 0, 49,
650 0, 0, 50, 107, 51, 52, 53, 54, 55, 56,
651 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
652 67, 68, 0, 69, 47, 48, 124, 0, 0, 49,
653 77, 0, 50, 0, 51, 52, 53, 54, 55, 56,
654 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
655 67, 68, 0, 69, 78, 47, 48, 0, 0, 0,
656 49, 0, 0, 50, 0, 51, 52, 53, 54, 55,
657 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
658 66, 67, 68, 47, 69, 0, 0, 0, 0, 0,
659 0, 0, 0, 51, 52, 53, 54, 55, 56, 57,
660 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
661 68, 0, 69, 51, 52, 53, 54, 55, 56, 57,
662 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
663 68, 0, 69, 52, 53, 54, 55, 56, 57, 58,
664 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
665 0, 69, 53, 54, 55, 56, 57, 58, 59, 60,
666 61, 62, 63, 64, 65, 66, 67, 68, 0, 69,
667 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
668 64, 65, 66, 67, 68, 0, 69, 56, 57, 58,
669 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
670 0, 69
673 static const yysigned_char yycheck[] =
675 0, 35, 0, 0, 52, 29, 29, 53, 8, 47,
676 48, 49, 50, 47, 52, 7, 49, 50, 52, 52,
677 20, 53, 53, 23, 24, 25, 52, 27, 26, 53,
678 53, 44, 45, 46, 47, 48, 49, 50, 36, 52,
679 70, 71, 72, 53, -1, 74, -1, 47, 48, 49,
680 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
681 60, 61, 62, 63, 64, 65, 66, 67, 3, 4,
682 5, 6, 7, -1, 9, 10, -1, 77, -1, -1,
683 80, 42, 43, 44, 45, 46, 47, 48, 49, 50,
684 25, 52, 27, -1, 45, 46, 47, 48, 49, 50,
685 35, 52, -1, -1, 104, -1, -1, -1, -1, -1,
686 -1, 46, 47, 113, -1, -1, 116, 52, -1, 54,
687 55, -1, -1, 121, 124, 125, 3, 4, 5, 6,
688 7, 8, 9, 10, -1, 12, 13, 14, 15, 16,
689 17, 18, 19, 20, 21, 22, -1, -1, 25, 26,
690 27, -1, -1, -1, -1, -1, -1, -1, 35, 3,
691 4, 5, 6, 7, -1, 9, 10, -1, -1, 46,
692 47, -1, -1, -1, -1, 52, -1, 54, -1, -1,
693 -1, 25, -1, 27, -1, -1, -1, -1, -1, -1,
694 -1, 35, 3, 4, 5, 6, 7, -1, 9, 10,
695 -1, -1, 46, 47, -1, -1, -1, -1, 52, -1,
696 54, -1, -1, -1, 25, -1, 27, -1, -1, -1,
697 -1, -1, -1, -1, 35, 3, 4, 5, 6, 7,
698 -1, 9, 10, -1, -1, 46, 47, -1, -1, -1,
699 -1, 52, -1, 54, -1, -1, 8, 25, -1, 27,
700 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
701 22, -1, -1, -1, 26, -1, -1, -1, -1, -1,
702 -1, -1, -1, 35, 52, -1, 54, -1, -1, -1,
703 -1, -1, -1, -1, -1, 47, -1, -1, 8, -1,
704 52, 53, 12, 13, 14, 15, 16, 17, 18, 19,
705 20, 21, 22, 8, -1, -1, 26, 12, 13, 14,
706 15, 16, 17, 18, 19, 20, 21, 22, -1, -1,
707 -1, 26, -1, -1, 23, 24, -1, -1, -1, 28,
708 -1, -1, 31, 53, 33, 34, 35, 36, 37, 38,
709 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
710 49, 50, -1, 52, 23, 24, 55, -1, -1, 28,
711 29, -1, 31, -1, 33, 34, 35, 36, 37, 38,
712 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
713 49, 50, -1, 52, 53, 23, 24, -1, -1, -1,
714 28, -1, -1, 31, -1, 33, 34, 35, 36, 37,
715 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
716 48, 49, 50, 23, 52, -1, -1, -1, -1, -1,
717 -1, -1, -1, 33, 34, 35, 36, 37, 38, 39,
718 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
719 50, -1, 52, 33, 34, 35, 36, 37, 38, 39,
720 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
721 50, -1, 52, 34, 35, 36, 37, 38, 39, 40,
722 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
723 -1, 52, 35, 36, 37, 38, 39, 40, 41, 42,
724 43, 44, 45, 46, 47, 48, 49, 50, -1, 52,
725 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
726 46, 47, 48, 49, 50, -1, 52, 38, 39, 40,
727 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
728 -1, 52
731 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
732 symbol of state STATE-NUM. */
733 static const unsigned char yystos[] =
735 0, 3, 4, 5, 6, 7, 8, 9, 10, 12,
736 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
737 25, 26, 27, 35, 46, 47, 52, 54, 57, 58,
738 59, 64, 65, 66, 70, 73, 52, 59, 59, 59,
739 59, 59, 59, 63, 65, 59, 0, 23, 24, 28,
740 31, 33, 34, 35, 36, 37, 38, 39, 40, 41,
741 42, 43, 44, 45, 46, 47, 48, 49, 50, 52,
742 35, 47, 52, 67, 68, 69, 65, 29, 53, 53,
743 53, 59, 59, 59, 59, 59, 59, 59, 59, 59,
744 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
745 59, 59, 7, 72, 60, 67, 67, 53, 65, 67,
746 71, 52, 69, 53, 59, 59, 55, 59, 61, 62,
747 53, 29, 53, 59, 55, 29, 53, 65, 59, 59
750 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
751 # define YYSIZE_T __SIZE_TYPE__
752 #endif
753 #if ! defined (YYSIZE_T) && defined (size_t)
754 # define YYSIZE_T size_t
755 #endif
756 #if ! defined (YYSIZE_T)
757 # if defined (__STDC__) || defined (__cplusplus)
758 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
759 # define YYSIZE_T size_t
760 # endif
761 #endif
762 #if ! defined (YYSIZE_T)
763 # define YYSIZE_T unsigned int
764 #endif
766 #define yyerrok (yyerrstatus = 0)
767 #define yyclearin (yychar = YYEMPTY)
768 #define YYEMPTY (-2)
769 #define YYEOF 0
771 #define YYACCEPT goto yyacceptlab
772 #define YYABORT goto yyabortlab
773 #define YYERROR goto yyerrorlab
776 /* Like YYERROR except do call yyerror. This remains here temporarily
777 to ease the transition to the new meaning of YYERROR, for GCC.
778 Once GCC version 2 has supplanted version 1, this can go. */
780 #define YYFAIL goto yyerrlab
782 #define YYRECOVERING() (!!yyerrstatus)
784 #define YYBACKUP(Token, Value) \
785 do \
786 if (yychar == YYEMPTY && yylen == 1) \
788 yychar = (Token); \
789 yylval = (Value); \
790 yytoken = YYTRANSLATE (yychar); \
791 YYPOPSTACK; \
792 goto yybackup; \
794 else \
796 yyerror ("syntax error: cannot back up");\
797 YYERROR; \
799 while (0)
801 #define YYTERROR 1
802 #define YYERRCODE 256
804 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
805 are run). */
807 #ifndef YYLLOC_DEFAULT
808 # define YYLLOC_DEFAULT(Current, Rhs, N) \
809 ((Current).first_line = (Rhs)[1].first_line, \
810 (Current).first_column = (Rhs)[1].first_column, \
811 (Current).last_line = (Rhs)[N].last_line, \
812 (Current).last_column = (Rhs)[N].last_column)
813 #endif
815 /* YYLEX -- calling `yylex' with the right arguments. */
817 #ifdef YYLEX_PARAM
818 # define YYLEX yylex (YYLEX_PARAM)
819 #else
820 # define YYLEX yylex ()
821 #endif
823 /* Enable debugging if requested. */
824 #if YYDEBUG
826 # ifndef YYFPRINTF
827 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
828 # define YYFPRINTF fprintf
829 # endif
831 # define YYDPRINTF(Args) \
832 do { \
833 if (yydebug) \
834 YYFPRINTF Args; \
835 } while (0)
837 # define YYDSYMPRINT(Args) \
838 do { \
839 if (yydebug) \
840 yysymprint Args; \
841 } while (0)
843 # define YYDSYMPRINTF(Title, Token, Value, Location) \
844 do { \
845 if (yydebug) \
847 YYFPRINTF (stderr, "%s ", Title); \
848 yysymprint (stderr, \
849 Token, Value); \
850 YYFPRINTF (stderr, "\n"); \
852 } while (0)
854 /*------------------------------------------------------------------.
855 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
856 | TOP (included). |
857 `------------------------------------------------------------------*/
859 #if defined (__STDC__) || defined (__cplusplus)
860 static void
861 yy_stack_print (short *bottom, short *top)
862 #else
863 static void
864 yy_stack_print (bottom, top)
865 short *bottom;
866 short *top;
867 #endif
869 YYFPRINTF (stderr, "Stack now");
870 for (/* Nothing. */; bottom <= top; ++bottom)
871 YYFPRINTF (stderr, " %d", *bottom);
872 YYFPRINTF (stderr, "\n");
875 # define YY_STACK_PRINT(Bottom, Top) \
876 do { \
877 if (yydebug) \
878 yy_stack_print ((Bottom), (Top)); \
879 } while (0)
882 /*------------------------------------------------.
883 | Report that the YYRULE is going to be reduced. |
884 `------------------------------------------------*/
886 #if defined (__STDC__) || defined (__cplusplus)
887 static void
888 yy_reduce_print (int yyrule)
889 #else
890 static void
891 yy_reduce_print (yyrule)
892 int yyrule;
893 #endif
895 int yyi;
896 unsigned int yylno = yyrline[yyrule];
897 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
898 yyrule - 1, yylno);
899 /* Print the symbols being reduced, and their result. */
900 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
901 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
902 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
905 # define YY_REDUCE_PRINT(Rule) \
906 do { \
907 if (yydebug) \
908 yy_reduce_print (Rule); \
909 } while (0)
911 /* Nonzero means print parse trace. It is left uninitialized so that
912 multiple parsers can coexist. */
913 int yydebug;
914 #else /* !YYDEBUG */
915 # define YYDPRINTF(Args)
916 # define YYDSYMPRINT(Args)
917 # define YYDSYMPRINTF(Title, Token, Value, Location)
918 # define YY_STACK_PRINT(Bottom, Top)
919 # define YY_REDUCE_PRINT(Rule)
920 #endif /* !YYDEBUG */
923 /* YYINITDEPTH -- initial size of the parser's stacks. */
924 #ifndef YYINITDEPTH
925 # define YYINITDEPTH 200
926 #endif
928 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
929 if the built-in stack extension method is used).
931 Do not make this value too large; the results are undefined if
932 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
933 evaluated with infinite-precision integer arithmetic. */
935 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
936 # undef YYMAXDEPTH
937 #endif
939 #ifndef YYMAXDEPTH
940 # define YYMAXDEPTH 10000
941 #endif
945 #if YYERROR_VERBOSE
947 # ifndef yystrlen
948 # if defined (__GLIBC__) && defined (_STRING_H)
949 # define yystrlen strlen
950 # else
951 /* Return the length of YYSTR. */
952 static YYSIZE_T
953 # if defined (__STDC__) || defined (__cplusplus)
954 yystrlen (const char *yystr)
955 # else
956 yystrlen (yystr)
957 const char *yystr;
958 # endif
960 register const char *yys = yystr;
962 while (*yys++ != '\0')
963 continue;
965 return yys - yystr - 1;
967 # endif
968 # endif
970 # ifndef yystpcpy
971 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
972 # define yystpcpy stpcpy
973 # else
974 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
975 YYDEST. */
976 static char *
977 # if defined (__STDC__) || defined (__cplusplus)
978 yystpcpy (char *yydest, const char *yysrc)
979 # else
980 yystpcpy (yydest, yysrc)
981 char *yydest;
982 const char *yysrc;
983 # endif
985 register char *yyd = yydest;
986 register const char *yys = yysrc;
988 while ((*yyd++ = *yys++) != '\0')
989 continue;
991 return yyd - 1;
993 # endif
994 # endif
996 #endif /* !YYERROR_VERBOSE */
1000 #if YYDEBUG
1001 /*--------------------------------.
1002 | Print this symbol on YYOUTPUT. |
1003 `--------------------------------*/
1005 #if defined (__STDC__) || defined (__cplusplus)
1006 static void
1007 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1008 #else
1009 static void
1010 yysymprint (yyoutput, yytype, yyvaluep)
1011 FILE *yyoutput;
1012 int yytype;
1013 YYSTYPE *yyvaluep;
1014 #endif
1016 /* Pacify ``unused variable'' warnings. */
1017 (void) yyvaluep;
1019 if (yytype < YYNTOKENS)
1021 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1022 # ifdef YYPRINT
1023 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1024 # endif
1026 else
1027 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1029 switch (yytype)
1031 default:
1032 break;
1034 YYFPRINTF (yyoutput, ")");
1037 #endif /* ! YYDEBUG */
1038 /*-----------------------------------------------.
1039 | Release the memory associated to this symbol. |
1040 `-----------------------------------------------*/
1042 #if defined (__STDC__) || defined (__cplusplus)
1043 static void
1044 yydestruct (int yytype, YYSTYPE *yyvaluep)
1045 #else
1046 static void
1047 yydestruct (yytype, yyvaluep)
1048 int yytype;
1049 YYSTYPE *yyvaluep;
1050 #endif
1052 /* Pacify ``unused variable'' warnings. */
1053 (void) yyvaluep;
1055 switch (yytype)
1058 default:
1059 break;
1064 /* Prevent warnings from -Wmissing-prototypes. */
1066 #ifdef YYPARSE_PARAM
1067 # if defined (__STDC__) || defined (__cplusplus)
1068 int yyparse (void *YYPARSE_PARAM);
1069 # else
1070 int yyparse ();
1071 # endif
1072 #else /* ! YYPARSE_PARAM */
1073 #if defined (__STDC__) || defined (__cplusplus)
1074 int yyparse (void);
1075 #else
1076 int yyparse ();
1077 #endif
1078 #endif /* ! YYPARSE_PARAM */
1082 /* The lookahead symbol. */
1083 int yychar;
1085 /* The semantic value of the lookahead symbol. */
1086 YYSTYPE yylval;
1088 /* Number of syntax errors so far. */
1089 int yynerrs;
1093 /*----------.
1094 | yyparse. |
1095 `----------*/
1097 #ifdef YYPARSE_PARAM
1098 # if defined (__STDC__) || defined (__cplusplus)
1099 int yyparse (void *YYPARSE_PARAM)
1100 # else
1101 int yyparse (YYPARSE_PARAM)
1102 void *YYPARSE_PARAM;
1103 # endif
1104 #else /* ! YYPARSE_PARAM */
1105 #if defined (__STDC__) || defined (__cplusplus)
1107 yyparse (void)
1108 #else
1110 yyparse ()
1112 #endif
1113 #endif
1116 register int yystate;
1117 register int yyn;
1118 int yyresult;
1119 /* Number of tokens to shift before error messages enabled. */
1120 int yyerrstatus;
1121 /* Lookahead token as an internal (translated) token number. */
1122 int yytoken = 0;
1124 /* Three stacks and their tools:
1125 `yyss': related to states,
1126 `yyvs': related to semantic values,
1127 `yyls': related to locations.
1129 Refer to the stacks thru separate pointers, to allow yyoverflow
1130 to xreallocate them elsewhere. */
1132 /* The state stack. */
1133 short yyssa[YYINITDEPTH];
1134 short *yyss = yyssa;
1135 register short *yyssp;
1137 /* The semantic value stack. */
1138 YYSTYPE yyvsa[YYINITDEPTH];
1139 YYSTYPE *yyvs = yyvsa;
1140 register YYSTYPE *yyvsp;
1144 #define YYPOPSTACK (yyvsp--, yyssp--)
1146 YYSIZE_T yystacksize = YYINITDEPTH;
1148 /* The variables used to return semantic value and location from the
1149 action routines. */
1150 YYSTYPE yyval;
1153 /* When reducing, the number of symbols on the RHS of the reduced
1154 rule. */
1155 int yylen;
1157 YYDPRINTF ((stderr, "Starting parse\n"));
1159 yystate = 0;
1160 yyerrstatus = 0;
1161 yynerrs = 0;
1162 yychar = YYEMPTY; /* Cause a token to be read. */
1164 /* Initialize stack pointers.
1165 Waste one element of value and location stack
1166 so that they stay on the same level as the state stack.
1167 The wasted elements are never initialized. */
1169 yyssp = yyss;
1170 yyvsp = yyvs;
1172 goto yysetstate;
1174 /*------------------------------------------------------------.
1175 | yynewstate -- Push a new state, which is found in yystate. |
1176 `------------------------------------------------------------*/
1177 yynewstate:
1178 /* In all cases, when you get here, the value and location stacks
1179 have just been pushed. so pushing a state here evens the stacks.
1181 yyssp++;
1183 yysetstate:
1184 *yyssp = yystate;
1186 if (yyss + yystacksize - 1 <= yyssp)
1188 /* Get the current used size of the three stacks, in elements. */
1189 YYSIZE_T yysize = yyssp - yyss + 1;
1191 #ifdef yyoverflow
1193 /* Give user a chance to xreallocate the stack. Use copies of
1194 these so that the &'s don't force the real ones into
1195 memory. */
1196 YYSTYPE *yyvs1 = yyvs;
1197 short *yyss1 = yyss;
1200 /* Each stack pointer address is followed by the size of the
1201 data in use in that stack, in bytes. This used to be a
1202 conditional around just the two extra args, but that might
1203 be undefined if yyoverflow is a macro. */
1204 yyoverflow ("parser stack overflow",
1205 &yyss1, yysize * sizeof (*yyssp),
1206 &yyvs1, yysize * sizeof (*yyvsp),
1208 &yystacksize);
1210 yyss = yyss1;
1211 yyvs = yyvs1;
1213 #else /* no yyoverflow */
1214 # ifndef YYSTACK_RELOCATE
1215 goto yyoverflowlab;
1216 # else
1217 /* Extend the stack our own way. */
1218 if (YYMAXDEPTH <= yystacksize)
1219 goto yyoverflowlab;
1220 yystacksize *= 2;
1221 if (YYMAXDEPTH < yystacksize)
1222 yystacksize = YYMAXDEPTH;
1225 short *yyss1 = yyss;
1226 union yyalloc *yyptr =
1227 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1228 if (! yyptr)
1229 goto yyoverflowlab;
1230 YYSTACK_RELOCATE (yyss);
1231 YYSTACK_RELOCATE (yyvs);
1233 # undef YYSTACK_RELOCATE
1234 if (yyss1 != yyssa)
1235 YYSTACK_FREE (yyss1);
1237 # endif
1238 #endif /* no yyoverflow */
1240 yyssp = yyss + yysize - 1;
1241 yyvsp = yyvs + yysize - 1;
1244 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1245 (unsigned long int) yystacksize));
1247 if (yyss + yystacksize - 1 <= yyssp)
1248 YYABORT;
1251 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1253 goto yybackup;
1255 /*-----------.
1256 | yybackup. |
1257 `-----------*/
1258 yybackup:
1260 /* Do appropriate processing given the current state. */
1261 /* Read a lookahead token if we need one and don't already have one. */
1262 /* yyresume: */
1264 /* First try to decide what to do without reference to lookahead token. */
1266 yyn = yypact[yystate];
1267 if (yyn == YYPACT_NINF)
1268 goto yydefault;
1270 /* Not known => get a lookahead token if don't already have one. */
1272 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1273 if (yychar == YYEMPTY)
1275 YYDPRINTF ((stderr, "Reading a token: "));
1276 yychar = YYLEX;
1279 if (yychar <= YYEOF)
1281 yychar = yytoken = YYEOF;
1282 YYDPRINTF ((stderr, "Now at end of input.\n"));
1284 else
1286 yytoken = YYTRANSLATE (yychar);
1287 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1290 /* If the proper action on seeing token YYTOKEN is to reduce or to
1291 detect an error, take that action. */
1292 yyn += yytoken;
1293 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1294 goto yydefault;
1295 yyn = yytable[yyn];
1296 if (yyn <= 0)
1298 if (yyn == 0 || yyn == YYTABLE_NINF)
1299 goto yyerrlab;
1300 yyn = -yyn;
1301 goto yyreduce;
1304 if (yyn == YYFINAL)
1305 YYACCEPT;
1307 /* Shift the lookahead token. */
1308 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1310 /* Discard the token being shifted unless it is eof. */
1311 if (yychar != YYEOF)
1312 yychar = YYEMPTY;
1314 *++yyvsp = yylval;
1317 /* Count tokens shifted since error; after three, turn off error
1318 status. */
1319 if (yyerrstatus)
1320 yyerrstatus--;
1322 yystate = yyn;
1323 goto yynewstate;
1326 /*-----------------------------------------------------------.
1327 | yydefault -- do the default action for the current state. |
1328 `-----------------------------------------------------------*/
1329 yydefault:
1330 yyn = yydefact[yystate];
1331 if (yyn == 0)
1332 goto yyerrlab;
1333 goto yyreduce;
1336 /*-----------------------------.
1337 | yyreduce -- Do a reduction. |
1338 `-----------------------------*/
1339 yyreduce:
1340 /* yyn is the number of a rule to reduce with. */
1341 yylen = yyr2[yyn];
1343 /* If YYLEN is nonzero, implement the default value of the action:
1344 `$$ = $1'.
1346 Otherwise, the following line sets YYVAL to garbage.
1347 This behavior is undocumented and Bison
1348 users should not rely upon it. Assigning to YYVAL
1349 unconditionally makes the parser a bit smaller, and it avoids a
1350 GCC warning that YYVAL may be used uninitialized. */
1351 yyval = yyvsp[1-yylen];
1354 YY_REDUCE_PRINT (yyn);
1355 switch (yyn)
1357 case 4:
1358 #line 235 "f-exp.y"
1359 { write_exp_elt_opcode(OP_TYPE);
1360 write_exp_elt_type(yyvsp[0].tval);
1361 write_exp_elt_opcode(OP_TYPE); }
1362 break;
1364 case 5:
1365 #line 241 "f-exp.y"
1367 break;
1369 case 6:
1370 #line 246 "f-exp.y"
1371 { write_exp_elt_opcode (UNOP_IND); }
1372 break;
1374 case 7:
1375 #line 250 "f-exp.y"
1376 { write_exp_elt_opcode (UNOP_ADDR); }
1377 break;
1379 case 8:
1380 #line 254 "f-exp.y"
1381 { write_exp_elt_opcode (UNOP_NEG); }
1382 break;
1384 case 9:
1385 #line 258 "f-exp.y"
1386 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1387 break;
1389 case 10:
1390 #line 262 "f-exp.y"
1391 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1392 break;
1394 case 11:
1395 #line 266 "f-exp.y"
1396 { write_exp_elt_opcode (UNOP_SIZEOF); }
1397 break;
1399 case 12:
1400 #line 275 "f-exp.y"
1401 { start_arglist (); }
1402 break;
1404 case 13:
1405 #line 277 "f-exp.y"
1406 { write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST);
1407 write_exp_elt_longcst ((LONGEST) end_arglist ());
1408 write_exp_elt_opcode (OP_F77_UNDETERMINED_ARGLIST); }
1409 break;
1411 case 15:
1412 #line 286 "f-exp.y"
1413 { arglist_len = 1; }
1414 break;
1416 case 16:
1417 #line 290 "f-exp.y"
1418 { arglist_len = 1; }
1419 break;
1421 case 17:
1422 #line 294 "f-exp.y"
1423 { arglist_len++; }
1424 break;
1426 case 18:
1427 #line 300 "f-exp.y"
1428 { write_exp_elt_opcode (OP_F90_RANGE);
1429 write_exp_elt_longcst (NONE_BOUND_DEFAULT);
1430 write_exp_elt_opcode (OP_F90_RANGE); }
1431 break;
1433 case 19:
1434 #line 306 "f-exp.y"
1435 { write_exp_elt_opcode (OP_F90_RANGE);
1436 write_exp_elt_longcst (HIGH_BOUND_DEFAULT);
1437 write_exp_elt_opcode (OP_F90_RANGE); }
1438 break;
1440 case 20:
1441 #line 312 "f-exp.y"
1442 { write_exp_elt_opcode (OP_F90_RANGE);
1443 write_exp_elt_longcst (LOW_BOUND_DEFAULT);
1444 write_exp_elt_opcode (OP_F90_RANGE); }
1445 break;
1447 case 21:
1448 #line 318 "f-exp.y"
1449 { write_exp_elt_opcode (OP_F90_RANGE);
1450 write_exp_elt_longcst (BOTH_BOUND_DEFAULT);
1451 write_exp_elt_opcode (OP_F90_RANGE); }
1452 break;
1454 case 22:
1455 #line 324 "f-exp.y"
1457 break;
1459 case 23:
1460 #line 328 "f-exp.y"
1461 { write_exp_elt_opcode(OP_COMPLEX); }
1462 break;
1464 case 24:
1465 #line 332 "f-exp.y"
1466 { write_exp_elt_opcode (UNOP_CAST);
1467 write_exp_elt_type (yyvsp[-2].tval);
1468 write_exp_elt_opcode (UNOP_CAST); }
1469 break;
1471 case 25:
1472 #line 338 "f-exp.y"
1473 { write_exp_elt_opcode (STRUCTOP_STRUCT);
1474 write_exp_string (yyvsp[0].sval);
1475 write_exp_elt_opcode (STRUCTOP_STRUCT); }
1476 break;
1478 case 26:
1479 #line 346 "f-exp.y"
1480 { write_exp_elt_opcode (BINOP_REPEAT); }
1481 break;
1483 case 27:
1484 #line 350 "f-exp.y"
1485 { write_exp_elt_opcode (BINOP_EXP); }
1486 break;
1488 case 28:
1489 #line 354 "f-exp.y"
1490 { write_exp_elt_opcode (BINOP_MUL); }
1491 break;
1493 case 29:
1494 #line 358 "f-exp.y"
1495 { write_exp_elt_opcode (BINOP_DIV); }
1496 break;
1498 case 30:
1499 #line 362 "f-exp.y"
1500 { write_exp_elt_opcode (BINOP_ADD); }
1501 break;
1503 case 31:
1504 #line 366 "f-exp.y"
1505 { write_exp_elt_opcode (BINOP_SUB); }
1506 break;
1508 case 32:
1509 #line 370 "f-exp.y"
1510 { write_exp_elt_opcode (BINOP_LSH); }
1511 break;
1513 case 33:
1514 #line 374 "f-exp.y"
1515 { write_exp_elt_opcode (BINOP_RSH); }
1516 break;
1518 case 34:
1519 #line 378 "f-exp.y"
1520 { write_exp_elt_opcode (BINOP_EQUAL); }
1521 break;
1523 case 35:
1524 #line 382 "f-exp.y"
1525 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1526 break;
1528 case 36:
1529 #line 386 "f-exp.y"
1530 { write_exp_elt_opcode (BINOP_LEQ); }
1531 break;
1533 case 37:
1534 #line 390 "f-exp.y"
1535 { write_exp_elt_opcode (BINOP_GEQ); }
1536 break;
1538 case 38:
1539 #line 394 "f-exp.y"
1540 { write_exp_elt_opcode (BINOP_LESS); }
1541 break;
1543 case 39:
1544 #line 398 "f-exp.y"
1545 { write_exp_elt_opcode (BINOP_GTR); }
1546 break;
1548 case 40:
1549 #line 402 "f-exp.y"
1550 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1551 break;
1553 case 41:
1554 #line 406 "f-exp.y"
1555 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1556 break;
1558 case 42:
1559 #line 410 "f-exp.y"
1560 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1561 break;
1563 case 43:
1564 #line 414 "f-exp.y"
1565 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1566 break;
1568 case 44:
1569 #line 419 "f-exp.y"
1570 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1571 break;
1573 case 45:
1574 #line 423 "f-exp.y"
1575 { write_exp_elt_opcode (BINOP_ASSIGN); }
1576 break;
1578 case 46:
1579 #line 427 "f-exp.y"
1580 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1581 write_exp_elt_opcode (yyvsp[-1].opcode);
1582 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1583 break;
1585 case 47:
1586 #line 433 "f-exp.y"
1587 { write_exp_elt_opcode (OP_LONG);
1588 write_exp_elt_type (yyvsp[0].typed_val.type);
1589 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val.val));
1590 write_exp_elt_opcode (OP_LONG); }
1591 break;
1593 case 48:
1594 #line 440 "f-exp.y"
1595 { YYSTYPE val;
1596 parse_number (yyvsp[0].ssym.stoken.ptr, yyvsp[0].ssym.stoken.length, 0, &val);
1597 write_exp_elt_opcode (OP_LONG);
1598 write_exp_elt_type (val.typed_val.type);
1599 write_exp_elt_longcst ((LONGEST)val.typed_val.val);
1600 write_exp_elt_opcode (OP_LONG); }
1601 break;
1603 case 49:
1604 #line 449 "f-exp.y"
1605 { write_exp_elt_opcode (OP_DOUBLE);
1606 write_exp_elt_type (builtin_type_f_real_s8);
1607 write_exp_elt_dblcst (yyvsp[0].dval);
1608 write_exp_elt_opcode (OP_DOUBLE); }
1609 break;
1611 case 52:
1612 #line 462 "f-exp.y"
1613 { write_exp_elt_opcode (OP_LONG);
1614 write_exp_elt_type (builtin_type_f_integer);
1615 CHECK_TYPEDEF (yyvsp[-1].tval);
1616 write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yyvsp[-1].tval));
1617 write_exp_elt_opcode (OP_LONG); }
1618 break;
1620 case 53:
1621 #line 470 "f-exp.y"
1622 { write_exp_elt_opcode (OP_BOOL);
1623 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1624 write_exp_elt_opcode (OP_BOOL);
1626 break;
1628 case 54:
1629 #line 477 "f-exp.y"
1631 write_exp_elt_opcode (OP_STRING);
1632 write_exp_string (yyvsp[0].sval);
1633 write_exp_elt_opcode (OP_STRING);
1635 break;
1637 case 55:
1638 #line 485 "f-exp.y"
1639 { struct symbol *sym = yyvsp[0].ssym.sym;
1641 if (sym)
1643 if (symbol_read_needs_frame (sym))
1645 if (innermost_block == 0 ||
1646 contained_in (block_found,
1647 innermost_block))
1648 innermost_block = block_found;
1650 write_exp_elt_opcode (OP_VAR_VALUE);
1651 /* We want to use the selected frame, not
1652 another more inner frame which happens to
1653 be in the same block. */
1654 write_exp_elt_block (NULL);
1655 write_exp_elt_sym (sym);
1656 write_exp_elt_opcode (OP_VAR_VALUE);
1657 break;
1659 else
1661 struct minimal_symbol *msymbol;
1662 char *arg = copy_name (yyvsp[0].ssym.stoken);
1664 msymbol =
1665 lookup_minimal_symbol (arg, NULL, NULL);
1666 if (msymbol != NULL)
1668 write_exp_msymbol (msymbol,
1669 lookup_function_type (builtin_type_int),
1670 builtin_type_int);
1672 else if (!have_full_symbols () && !have_partial_symbols ())
1673 error ("No symbol table is loaded. Use the \"file\" command.");
1674 else
1675 error ("No symbol \"%s\" in current context.",
1676 copy_name (yyvsp[0].ssym.stoken));
1679 break;
1681 case 58:
1682 #line 533 "f-exp.y"
1684 /* This is where the interesting stuff happens. */
1685 int done = 0;
1686 int array_size;
1687 struct type *follow_type = yyvsp[-1].tval;
1688 struct type *range_type;
1690 while (!done)
1691 switch (pop_type ())
1693 case tp_end:
1694 done = 1;
1695 break;
1696 case tp_pointer:
1697 follow_type = lookup_pointer_type (follow_type);
1698 break;
1699 case tp_reference:
1700 follow_type = lookup_reference_type (follow_type);
1701 break;
1702 case tp_array:
1703 array_size = pop_type_int ();
1704 if (array_size != -1)
1706 range_type =
1707 create_range_type ((struct type *) NULL,
1708 builtin_type_f_integer, 0,
1709 array_size - 1);
1710 follow_type =
1711 create_array_type ((struct type *) NULL,
1712 follow_type, range_type);
1714 else
1715 follow_type = lookup_pointer_type (follow_type);
1716 break;
1717 case tp_function:
1718 follow_type = lookup_function_type (follow_type);
1719 break;
1721 yyval.tval = follow_type;
1723 break;
1725 case 59:
1726 #line 576 "f-exp.y"
1727 { push_type (tp_pointer); yyval.voidval = 0; }
1728 break;
1730 case 60:
1731 #line 578 "f-exp.y"
1732 { push_type (tp_pointer); yyval.voidval = yyvsp[0].voidval; }
1733 break;
1735 case 61:
1736 #line 580 "f-exp.y"
1737 { push_type (tp_reference); yyval.voidval = 0; }
1738 break;
1740 case 62:
1741 #line 582 "f-exp.y"
1742 { push_type (tp_reference); yyval.voidval = yyvsp[0].voidval; }
1743 break;
1745 case 64:
1746 #line 587 "f-exp.y"
1747 { yyval.voidval = yyvsp[-1].voidval; }
1748 break;
1750 case 65:
1751 #line 589 "f-exp.y"
1752 { push_type (tp_function); }
1753 break;
1755 case 66:
1756 #line 591 "f-exp.y"
1757 { push_type (tp_function); }
1758 break;
1760 case 67:
1761 #line 595 "f-exp.y"
1762 { yyval.voidval = 0; }
1763 break;
1765 case 68:
1766 #line 597 "f-exp.y"
1767 { free (yyvsp[-1].tvec); yyval.voidval = 0; }
1768 break;
1770 case 69:
1771 #line 602 "f-exp.y"
1772 { yyval.tval = yyvsp[0].tsym.type; }
1773 break;
1775 case 70:
1776 #line 604 "f-exp.y"
1777 { yyval.tval = builtin_type_f_integer; }
1778 break;
1780 case 71:
1781 #line 606 "f-exp.y"
1782 { yyval.tval = builtin_type_f_integer_s2; }
1783 break;
1785 case 72:
1786 #line 608 "f-exp.y"
1787 { yyval.tval = builtin_type_f_character; }
1788 break;
1790 case 73:
1791 #line 610 "f-exp.y"
1792 { yyval.tval = builtin_type_f_logical;}
1793 break;
1795 case 74:
1796 #line 612 "f-exp.y"
1797 { yyval.tval = builtin_type_f_logical_s2;}
1798 break;
1800 case 75:
1801 #line 614 "f-exp.y"
1802 { yyval.tval = builtin_type_f_logical_s1;}
1803 break;
1805 case 76:
1806 #line 616 "f-exp.y"
1807 { yyval.tval = builtin_type_f_real;}
1808 break;
1810 case 77:
1811 #line 618 "f-exp.y"
1812 { yyval.tval = builtin_type_f_real_s8;}
1813 break;
1815 case 78:
1816 #line 620 "f-exp.y"
1817 { yyval.tval = builtin_type_f_real_s16;}
1818 break;
1820 case 79:
1821 #line 622 "f-exp.y"
1822 { yyval.tval = builtin_type_f_complex_s8;}
1823 break;
1825 case 80:
1826 #line 624 "f-exp.y"
1827 { yyval.tval = builtin_type_f_complex_s16;}
1828 break;
1830 case 81:
1831 #line 626 "f-exp.y"
1832 { yyval.tval = builtin_type_f_complex_s32;}
1833 break;
1835 case 82:
1836 #line 631 "f-exp.y"
1837 { yyval.tvec = (struct type **) xmalloc (sizeof (struct type *) * 2);
1838 yyval.ivec[0] = 1; /* Number of types in vector */
1839 yyval.tvec[1] = yyvsp[0].tval;
1841 break;
1843 case 83:
1844 #line 636 "f-exp.y"
1845 { int len = sizeof (struct type *) * (++(yyvsp[-2].ivec[0]) + 1);
1846 yyval.tvec = (struct type **) xrealloc ((char *) yyvsp[-2].tvec, len);
1847 yyval.tvec[yyval.ivec[0]] = yyvsp[0].tval;
1849 break;
1851 case 84:
1852 #line 643 "f-exp.y"
1853 { yyval.sval = yyvsp[0].ssym.stoken; }
1854 break;
1859 /* Line 1000 of yacc.c. */
1860 #line 1861 "f-exp.c.tmp"
1862 yyvsp -= yylen;
1863 yyssp -= yylen;
1866 YY_STACK_PRINT (yyss, yyssp);
1868 *++yyvsp = yyval;
1871 /* Now `shift' the result of the reduction. Determine what state
1872 that goes to, based on the state we popped back to and the rule
1873 number reduced by. */
1875 yyn = yyr1[yyn];
1877 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1878 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1879 yystate = yytable[yystate];
1880 else
1881 yystate = yydefgoto[yyn - YYNTOKENS];
1883 goto yynewstate;
1886 /*------------------------------------.
1887 | yyerrlab -- here on detecting error |
1888 `------------------------------------*/
1889 yyerrlab:
1890 /* If not already recovering from an error, report this error. */
1891 if (!yyerrstatus)
1893 ++yynerrs;
1894 #if YYERROR_VERBOSE
1895 yyn = yypact[yystate];
1897 if (YYPACT_NINF < yyn && yyn < YYLAST)
1899 YYSIZE_T yysize = 0;
1900 int yytype = YYTRANSLATE (yychar);
1901 const char* yyprefix;
1902 char *yymsg;
1903 int yyx;
1905 /* Start YYX at -YYN if negative to avoid negative indexes in
1906 YYCHECK. */
1907 int yyxbegin = yyn < 0 ? -yyn : 0;
1909 /* Stay within bounds of both yycheck and yytname. */
1910 int yychecklim = YYLAST - yyn;
1911 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1912 int yycount = 0;
1914 yyprefix = ", expecting ";
1915 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1916 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1918 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1919 yycount += 1;
1920 if (yycount == 5)
1922 yysize = 0;
1923 break;
1926 yysize += (sizeof ("syntax error, unexpected ")
1927 + yystrlen (yytname[yytype]));
1928 yymsg = (char *) YYSTACK_ALLOC (yysize);
1929 if (yymsg != 0)
1931 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1932 yyp = yystpcpy (yyp, yytname[yytype]);
1934 if (yycount < 5)
1936 yyprefix = ", expecting ";
1937 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1938 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1940 yyp = yystpcpy (yyp, yyprefix);
1941 yyp = yystpcpy (yyp, yytname[yyx]);
1942 yyprefix = " or ";
1945 yyerror (yymsg);
1946 YYSTACK_FREE (yymsg);
1948 else
1949 yyerror ("syntax error; also virtual memory exhausted");
1951 else
1952 #endif /* YYERROR_VERBOSE */
1953 yyerror ("syntax error");
1958 if (yyerrstatus == 3)
1960 /* If just tried and failed to reuse lookahead token after an
1961 error, discard it. */
1963 if (yychar <= YYEOF)
1965 /* If at end of input, pop the error token,
1966 then the rest of the stack, then return failure. */
1967 if (yychar == YYEOF)
1968 for (;;)
1970 YYPOPSTACK;
1971 if (yyssp == yyss)
1972 YYABORT;
1973 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1974 yydestruct (yystos[*yyssp], yyvsp);
1977 else
1979 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1980 yydestruct (yytoken, &yylval);
1981 yychar = YYEMPTY;
1986 /* Else will try to reuse lookahead token after shifting the error
1987 token. */
1988 goto yyerrlab1;
1991 /*---------------------------------------------------.
1992 | yyerrorlab -- error raised explicitly by YYERROR. |
1993 `---------------------------------------------------*/
1994 yyerrorlab:
1996 #ifdef __GNUC__
1997 /* Pacify GCC when the user code never invokes YYERROR and the label
1998 yyerrorlab therefore never appears in user code. */
1999 if (0)
2000 goto yyerrorlab;
2001 #endif
2003 yyvsp -= yylen;
2004 yyssp -= yylen;
2005 yystate = *yyssp;
2006 goto yyerrlab1;
2009 /*-------------------------------------------------------------.
2010 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2011 `-------------------------------------------------------------*/
2012 yyerrlab1:
2013 yyerrstatus = 3; /* Each real token shifted decrements this. */
2015 for (;;)
2017 yyn = yypact[yystate];
2018 if (yyn != YYPACT_NINF)
2020 yyn += YYTERROR;
2021 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2023 yyn = yytable[yyn];
2024 if (0 < yyn)
2025 break;
2029 /* Pop the current state because it cannot handle the error token. */
2030 if (yyssp == yyss)
2031 YYABORT;
2033 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
2034 yydestruct (yystos[yystate], yyvsp);
2035 YYPOPSTACK;
2036 yystate = *yyssp;
2037 YY_STACK_PRINT (yyss, yyssp);
2040 if (yyn == YYFINAL)
2041 YYACCEPT;
2043 YYDPRINTF ((stderr, "Shifting error token, "));
2045 *++yyvsp = yylval;
2048 yystate = yyn;
2049 goto yynewstate;
2052 /*-------------------------------------.
2053 | yyacceptlab -- YYACCEPT comes here. |
2054 `-------------------------------------*/
2055 yyacceptlab:
2056 yyresult = 0;
2057 goto yyreturn;
2059 /*-----------------------------------.
2060 | yyabortlab -- YYABORT comes here. |
2061 `-----------------------------------*/
2062 yyabortlab:
2063 yyresult = 1;
2064 goto yyreturn;
2066 #ifndef yyoverflow
2067 /*----------------------------------------------.
2068 | yyoverflowlab -- parser overflow comes here. |
2069 `----------------------------------------------*/
2070 yyoverflowlab:
2071 yyerror ("parser stack overflow");
2072 yyresult = 2;
2073 /* Fall through. */
2074 #endif
2076 yyreturn:
2077 #ifndef yyoverflow
2078 if (yyss != yyssa)
2079 YYSTACK_FREE (yyss);
2080 #endif
2081 return yyresult;
2085 #line 656 "f-exp.y"
2088 /* Take care of parsing a number (anything that starts with a digit).
2089 Set yylval and return the token type; update lexptr.
2090 LEN is the number of characters in it. */
2092 /*** Needs some error checking for the float case ***/
2094 static int
2095 parse_number (p, len, parsed_float, putithere)
2096 char *p;
2097 int len;
2098 int parsed_float;
2099 YYSTYPE *putithere;
2101 LONGEST n = 0;
2102 LONGEST prevn = 0;
2103 int c;
2104 int base = input_radix;
2105 int unsigned_p = 0;
2106 int long_p = 0;
2107 ULONGEST high_bit;
2108 struct type *signed_type;
2109 struct type *unsigned_type;
2111 if (parsed_float)
2113 /* It's a float since it contains a point or an exponent. */
2114 /* [dD] is not understood as an exponent by atof, change it to 'e'. */
2115 char *tmp, *tmp2;
2117 tmp = xstrdup (p);
2118 for (tmp2 = tmp; *tmp2; ++tmp2)
2119 if (*tmp2 == 'd' || *tmp2 == 'D')
2120 *tmp2 = 'e';
2121 putithere->dval = atof (tmp);
2122 free (tmp);
2123 return FLOAT;
2126 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2127 if (p[0] == '0')
2128 switch (p[1])
2130 case 'x':
2131 case 'X':
2132 if (len >= 3)
2134 p += 2;
2135 base = 16;
2136 len -= 2;
2138 break;
2140 case 't':
2141 case 'T':
2142 case 'd':
2143 case 'D':
2144 if (len >= 3)
2146 p += 2;
2147 base = 10;
2148 len -= 2;
2150 break;
2152 default:
2153 base = 8;
2154 break;
2157 while (len-- > 0)
2159 c = *p++;
2160 if (isupper (c))
2161 c = tolower (c);
2162 if (len == 0 && c == 'l')
2163 long_p = 1;
2164 else if (len == 0 && c == 'u')
2165 unsigned_p = 1;
2166 else
2168 int i;
2169 if (c >= '0' && c <= '9')
2170 i = c - '0';
2171 else if (c >= 'a' && c <= 'f')
2172 i = c - 'a' + 10;
2173 else
2174 return ERROR; /* Char not a digit */
2175 if (i >= base)
2176 return ERROR; /* Invalid digit in this base */
2177 n *= base;
2178 n += i;
2180 /* Portably test for overflow (only works for nonzero values, so make
2181 a second check for zero). */
2182 if ((prevn >= n) && n != 0)
2183 unsigned_p=1; /* Try something unsigned */
2184 /* If range checking enabled, portably test for unsigned overflow. */
2185 if (RANGE_CHECK && n != 0)
2187 if ((unsigned_p && (unsigned)prevn >= (unsigned)n))
2188 range_error("Overflow on numeric constant.");
2190 prevn = n;
2193 /* If the number is too big to be an int, or it's got an l suffix
2194 then it's a long. Work out if this has to be a long by
2195 shifting right and and seeing if anything remains, and the
2196 target int size is different to the target long size.
2198 In the expression below, we could have tested
2199 (n >> TARGET_INT_BIT)
2200 to see if it was zero,
2201 but too many compilers warn about that, when ints and longs
2202 are the same size. So we shift it twice, with fewer bits
2203 each time, for the same result. */
2205 if ((TARGET_INT_BIT != TARGET_LONG_BIT
2206 && ((n >> 2) >> (TARGET_INT_BIT-2))) /* Avoid shift warning */
2207 || long_p)
2209 high_bit = ((ULONGEST)1) << (TARGET_LONG_BIT-1);
2210 unsigned_type = builtin_type_unsigned_long;
2211 signed_type = builtin_type_long;
2213 else
2215 high_bit = ((ULONGEST)1) << (TARGET_INT_BIT-1);
2216 unsigned_type = builtin_type_unsigned_int;
2217 signed_type = builtin_type_int;
2220 putithere->typed_val.val = n;
2222 /* If the high bit of the worked out type is set then this number
2223 has to be unsigned. */
2225 if (unsigned_p || (n & high_bit))
2226 putithere->typed_val.type = unsigned_type;
2227 else
2228 putithere->typed_val.type = signed_type;
2230 return INT;
2233 struct token
2235 char *operator;
2236 int token;
2237 enum exp_opcode opcode;
2240 static const struct token dot_ops[] =
2242 { ".and.", BOOL_AND, BINOP_END },
2243 { ".AND.", BOOL_AND, BINOP_END },
2244 { ".or.", BOOL_OR, BINOP_END },
2245 { ".OR.", BOOL_OR, BINOP_END },
2246 { ".not.", BOOL_NOT, BINOP_END },
2247 { ".NOT.", BOOL_NOT, BINOP_END },
2248 { ".eq.", EQUAL, BINOP_END },
2249 { ".EQ.", EQUAL, BINOP_END },
2250 { ".eqv.", EQUAL, BINOP_END },
2251 { ".NEQV.", NOTEQUAL, BINOP_END },
2252 { ".neqv.", NOTEQUAL, BINOP_END },
2253 { ".EQV.", EQUAL, BINOP_END },
2254 { ".ne.", NOTEQUAL, BINOP_END },
2255 { ".NE.", NOTEQUAL, BINOP_END },
2256 { ".le.", LEQ, BINOP_END },
2257 { ".LE.", LEQ, BINOP_END },
2258 { ".ge.", GEQ, BINOP_END },
2259 { ".GE.", GEQ, BINOP_END },
2260 { ".gt.", GREATERTHAN, BINOP_END },
2261 { ".GT.", GREATERTHAN, BINOP_END },
2262 { ".lt.", LESSTHAN, BINOP_END },
2263 { ".LT.", LESSTHAN, BINOP_END },
2264 { NULL, 0, 0 }
2267 struct f77_boolean_val
2269 char *name;
2270 int value;
2273 static const struct f77_boolean_val boolean_values[] =
2275 { ".true.", 1 },
2276 { ".TRUE.", 1 },
2277 { ".false.", 0 },
2278 { ".FALSE.", 0 },
2279 { NULL, 0 }
2282 static const struct token f77_keywords[] =
2284 { "complex_16", COMPLEX_S16_KEYWORD, BINOP_END },
2285 { "complex_32", COMPLEX_S32_KEYWORD, BINOP_END },
2286 { "character", CHARACTER, BINOP_END },
2287 { "integer_2", INT_S2_KEYWORD, BINOP_END },
2288 { "logical_1", LOGICAL_S1_KEYWORD, BINOP_END },
2289 { "logical_2", LOGICAL_S2_KEYWORD, BINOP_END },
2290 { "complex_8", COMPLEX_S8_KEYWORD, BINOP_END },
2291 { "integer", INT_KEYWORD, BINOP_END },
2292 { "logical", LOGICAL_KEYWORD, BINOP_END },
2293 { "real_16", REAL_S16_KEYWORD, BINOP_END },
2294 { "complex", COMPLEX_S8_KEYWORD, BINOP_END },
2295 { "sizeof", SIZEOF, BINOP_END },
2296 { "real_8", REAL_S8_KEYWORD, BINOP_END },
2297 { "real", REAL_KEYWORD, BINOP_END },
2298 { NULL, 0, 0 }
2301 /* Implementation of a dynamically expandable buffer for processing input
2302 characters acquired through lexptr and building a value to return in
2303 yylval. Ripped off from ch-exp.y */
2305 static char *tempbuf; /* Current buffer contents */
2306 static int tempbufsize; /* Size of allocated buffer */
2307 static int tempbufindex; /* Current index into buffer */
2309 #define GROWBY_MIN_SIZE 64 /* Minimum amount to grow buffer by */
2311 #define CHECKBUF(size) \
2312 do { \
2313 if (tempbufindex + (size) >= tempbufsize) \
2315 growbuf_by_size (size); \
2317 } while (0);
2320 /* Grow the static temp buffer if necessary, including allocating the first one
2321 on demand. */
2323 static void
2324 growbuf_by_size (count)
2325 int count;
2327 int growby;
2329 growby = max (count, GROWBY_MIN_SIZE);
2330 tempbufsize += growby;
2331 if (tempbuf == NULL)
2332 tempbuf = (char *) xmalloc (tempbufsize);
2333 else
2334 tempbuf = (char *) xrealloc (tempbuf, tempbufsize);
2337 /* Blatantly ripped off from ch-exp.y. This routine recognizes F77
2338 string-literals.
2340 Recognize a string literal. A string literal is a nonzero sequence
2341 of characters enclosed in matching single quotes, except that
2342 a single character inside single quotes is a character literal, which
2343 we reject as a string literal. To embed the terminator character inside
2344 a string, it is simply doubled (I.E. 'this''is''one''string') */
2346 static int
2347 match_string_literal ()
2349 char *tokptr = lexptr;
2351 for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
2353 CHECKBUF (1);
2354 if (*tokptr == *lexptr)
2356 if (*(tokptr + 1) == *lexptr)
2357 tokptr++;
2358 else
2359 break;
2361 tempbuf[tempbufindex++] = *tokptr;
2363 if (*tokptr == '\0' /* no terminator */
2364 || tempbufindex == 0) /* no string */
2365 return 0;
2366 else
2368 tempbuf[tempbufindex] = '\0';
2369 yylval.sval.ptr = tempbuf;
2370 yylval.sval.length = tempbufindex;
2371 lexptr = ++tokptr;
2372 return STRING_LITERAL;
2376 /* Read one token, getting characters through lexptr. */
2378 static int
2379 yylex ()
2381 int c;
2382 int namelen;
2383 unsigned int i,token;
2384 char *tokstart;
2386 retry:
2388 prev_lexptr = lexptr;
2390 tokstart = lexptr;
2392 /* First of all, let us make sure we are not dealing with the
2393 special tokens .true. and .false. which evaluate to 1 and 0. */
2395 if (*lexptr == '.')
2397 for (i = 0; boolean_values[i].name != NULL; i++)
2399 if (strncmp (tokstart, boolean_values[i].name,
2400 strlen (boolean_values[i].name)) == 0)
2402 lexptr += strlen (boolean_values[i].name);
2403 yylval.lval = boolean_values[i].value;
2404 return BOOLEAN_LITERAL;
2409 /* See if it is a special .foo. operator. */
2411 for (i = 0; dot_ops[i].operator != NULL; i++)
2412 if (strncmp (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)) == 0)
2414 lexptr += strlen (dot_ops[i].operator);
2415 yylval.opcode = dot_ops[i].opcode;
2416 return dot_ops[i].token;
2419 /* See if it is an exponentiation operator. */
2421 if (strncmp (tokstart, "**", 2) == 0)
2423 lexptr += 2;
2424 yylval.opcode = BINOP_EXP;
2425 return STARSTAR;
2428 switch (c = *tokstart)
2430 case 0:
2431 return 0;
2433 case ' ':
2434 case '\t':
2435 case '\n':
2436 lexptr++;
2437 goto retry;
2439 case '\'':
2440 token = match_string_literal ();
2441 if (token != 0)
2442 return (token);
2443 break;
2445 case '(':
2446 paren_depth++;
2447 lexptr++;
2448 return c;
2450 case ')':
2451 if (paren_depth == 0)
2452 return 0;
2453 paren_depth--;
2454 lexptr++;
2455 return c;
2457 case ',':
2458 if (comma_terminates && paren_depth == 0)
2459 return 0;
2460 lexptr++;
2461 return c;
2463 case '.':
2464 /* Might be a floating point number. */
2465 if (lexptr[1] < '0' || lexptr[1] > '9')
2466 goto symbol; /* Nope, must be a symbol. */
2467 /* FALL THRU into number case. */
2469 case '0':
2470 case '1':
2471 case '2':
2472 case '3':
2473 case '4':
2474 case '5':
2475 case '6':
2476 case '7':
2477 case '8':
2478 case '9':
2480 /* It's a number. */
2481 int got_dot = 0, got_e = 0, got_d = 0, toktype;
2482 char *p = tokstart;
2483 int hex = input_radix > 10;
2485 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2487 p += 2;
2488 hex = 1;
2490 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2492 p += 2;
2493 hex = 0;
2496 for (;; ++p)
2498 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2499 got_dot = got_e = 1;
2500 else if (!hex && !got_d && (*p == 'd' || *p == 'D'))
2501 got_dot = got_d = 1;
2502 else if (!hex && !got_dot && *p == '.')
2503 got_dot = 1;
2504 else if (((got_e && (p[-1] == 'e' || p[-1] == 'E'))
2505 || (got_d && (p[-1] == 'd' || p[-1] == 'D')))
2506 && (*p == '-' || *p == '+'))
2507 /* This is the sign of the exponent, not the end of the
2508 number. */
2509 continue;
2510 /* We will take any letters or digits. parse_number will
2511 complain if past the radix, or if L or U are not final. */
2512 else if ((*p < '0' || *p > '9')
2513 && ((*p < 'a' || *p > 'z')
2514 && (*p < 'A' || *p > 'Z')))
2515 break;
2517 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e|got_d,
2518 &yylval);
2519 if (toktype == ERROR)
2521 char *err_copy = (char *) alloca (p - tokstart + 1);
2523 memcpy (err_copy, tokstart, p - tokstart);
2524 err_copy[p - tokstart] = 0;
2525 error ("Invalid number \"%s\".", err_copy);
2527 lexptr = p;
2528 return toktype;
2531 case '+':
2532 case '-':
2533 case '*':
2534 case '/':
2535 case '%':
2536 case '|':
2537 case '&':
2538 case '^':
2539 case '~':
2540 case '!':
2541 case '@':
2542 case '<':
2543 case '>':
2544 case '[':
2545 case ']':
2546 case '?':
2547 case ':':
2548 case '=':
2549 case '{':
2550 case '}':
2551 symbol:
2552 lexptr++;
2553 return c;
2556 if (!(c == '_' || c == '$'
2557 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2558 /* We must have come across a bad character (e.g. ';'). */
2559 error ("Invalid character '%c' in expression.", c);
2561 namelen = 0;
2562 for (c = tokstart[namelen];
2563 (c == '_' || c == '$' || (c >= '0' && c <= '9')
2564 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
2565 c = tokstart[++namelen]);
2567 /* The token "if" terminates the expression and is NOT
2568 removed from the input stream. */
2570 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2571 return 0;
2573 lexptr += namelen;
2575 /* Catch specific keywords. */
2577 for (i = 0; f77_keywords[i].operator != NULL; i++)
2578 if (strncmp (tokstart, f77_keywords[i].operator,
2579 strlen(f77_keywords[i].operator)) == 0)
2581 /* lexptr += strlen(f77_keywords[i].operator); */
2582 yylval.opcode = f77_keywords[i].opcode;
2583 return f77_keywords[i].token;
2586 yylval.sval.ptr = tokstart;
2587 yylval.sval.length = namelen;
2589 if (*tokstart == '$')
2591 write_dollar_variable (yylval.sval);
2592 return VARIABLE;
2595 /* Use token-type TYPENAME for symbols that happen to be defined
2596 currently as names of types; NAME for other symbols.
2597 The caller is not constrained to care about the distinction. */
2599 char *tmp = copy_name (yylval.sval);
2600 struct symbol *sym;
2601 int is_a_field_of_this = 0;
2602 int hextype;
2604 sym = lookup_symbol (tmp, expression_context_block,
2605 VAR_DOMAIN,
2606 current_language->la_language == language_cplus
2607 ? &is_a_field_of_this : NULL,
2608 NULL);
2609 if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
2611 yylval.tsym.type = SYMBOL_TYPE (sym);
2612 return TYPENAME;
2614 yylval.tsym.type
2615 = language_lookup_primitive_type_by_name (current_language,
2616 current_gdbarch, tmp);
2617 if (yylval.tsym.type != NULL)
2618 return TYPENAME;
2620 /* Input names that aren't symbols but ARE valid hex numbers,
2621 when the input radix permits them, can be names or numbers
2622 depending on the parse. Note we support radixes > 16 here. */
2623 if (!sym
2624 && ((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10)
2625 || (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2627 YYSTYPE newlval; /* Its value is ignored. */
2628 hextype = parse_number (tokstart, namelen, 0, &newlval);
2629 if (hextype == INT)
2631 yylval.ssym.sym = sym;
2632 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2633 return NAME_OR_INT;
2637 /* Any other kind of symbol */
2638 yylval.ssym.sym = sym;
2639 yylval.ssym.is_a_field_of_this = is_a_field_of_this;
2640 return NAME;
2644 void
2645 yyerror (msg)
2646 char *msg;
2648 if (prev_lexptr)
2649 lexptr = prev_lexptr;
2651 error ("A %s in expression, near `%s'.", (msg ? msg : "error"), lexptr);