HAMMER: MFC to 2.0
[dragonfly.git] / contrib / gdb-6.2.1 / gdb / jv-exp.c
blob0f1f7060fec948dccc3191bf3d960313de5fd7f1
1 /* A Bison parser, made by GNU Bison 1.875. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 INTEGER_LITERAL = 258,
57 FLOATING_POINT_LITERAL = 259,
58 IDENTIFIER = 260,
59 STRING_LITERAL = 261,
60 BOOLEAN_LITERAL = 262,
61 TYPENAME = 263,
62 NAME_OR_INT = 264,
63 ERROR = 265,
64 LONG = 266,
65 SHORT = 267,
66 BYTE = 268,
67 INT = 269,
68 CHAR = 270,
69 BOOLEAN = 271,
70 DOUBLE = 272,
71 FLOAT = 273,
72 VARIABLE = 274,
73 ASSIGN_MODIFY = 275,
74 SUPER = 276,
75 NEW = 277,
76 OROR = 278,
77 ANDAND = 279,
78 NOTEQUAL = 280,
79 EQUAL = 281,
80 GEQ = 282,
81 LEQ = 283,
82 RSH = 284,
83 LSH = 285,
84 DECREMENT = 286,
85 INCREMENT = 287
87 #endif
88 #define INTEGER_LITERAL 258
89 #define FLOATING_POINT_LITERAL 259
90 #define IDENTIFIER 260
91 #define STRING_LITERAL 261
92 #define BOOLEAN_LITERAL 262
93 #define TYPENAME 263
94 #define NAME_OR_INT 264
95 #define ERROR 265
96 #define LONG 266
97 #define SHORT 267
98 #define BYTE 268
99 #define INT 269
100 #define CHAR 270
101 #define BOOLEAN 271
102 #define DOUBLE 272
103 #define FLOAT 273
104 #define VARIABLE 274
105 #define ASSIGN_MODIFY 275
106 #define SUPER 276
107 #define NEW 277
108 #define OROR 278
109 #define ANDAND 279
110 #define NOTEQUAL 280
111 #define EQUAL 281
112 #define GEQ 282
113 #define LEQ 283
114 #define RSH 284
115 #define LSH 285
116 #define DECREMENT 286
117 #define INCREMENT 287
122 /* Copy the first part of user declarations. */
123 #line 38 "jv-exp.y"
126 #include "defs.h"
127 #include "gdb_string.h"
128 #include <ctype.h>
129 #include "expression.h"
130 #include "value.h"
131 #include "parser-defs.h"
132 #include "language.h"
133 #include "jv-lang.h"
134 #include "bfd.h" /* Required by objfiles.h. */
135 #include "symfile.h" /* Required by objfiles.h. */
136 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
137 #include "block.h"
139 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
140 as well as gratuitiously global symbol names, so we can have multiple
141 yacc generated parsers in gdb. Note that these are only the variables
142 produced by yacc. If other parser generators (bison, byacc, etc) produce
143 additional global names that conflict at link time, then those parser
144 generators need to be fixed instead of adding those names to this list. */
146 #define yymaxdepth java_maxdepth
147 #define yyparse java_parse
148 #define yylex java_lex
149 #define yyerror java_error
150 #define yylval java_lval
151 #define yychar java_char
152 #define yydebug java_debug
153 #define yypact java_pact
154 #define yyr1 java_r1
155 #define yyr2 java_r2
156 #define yydef java_def
157 #define yychk java_chk
158 #define yypgo java_pgo
159 #define yyact java_act
160 #define yyexca java_exca
161 #define yyerrflag java_errflag
162 #define yynerrs java_nerrs
163 #define yyps java_ps
164 #define yypv java_pv
165 #define yys java_s
166 #define yy_yys java_yys
167 #define yystate java_state
168 #define yytmp java_tmp
169 #define yyv java_v
170 #define yy_yyv java_yyv
171 #define yyval java_val
172 #define yylloc java_lloc
173 #define yyreds java_reds /* With YYDEBUG defined */
174 #define yytoks java_toks /* With YYDEBUG defined */
175 #define yyname java_name /* With YYDEBUG defined */
176 #define yyrule java_rule /* With YYDEBUG defined */
177 #define yylhs java_yylhs
178 #define yylen java_yylen
179 #define yydefred java_yydefred
180 #define yydgoto java_yydgoto
181 #define yysindex java_yysindex
182 #define yyrindex java_yyrindex
183 #define yygindex java_yygindex
184 #define yytable java_yytable
185 #define yycheck java_yycheck
187 #ifndef YYDEBUG
188 #define YYDEBUG 1 /* Default to yydebug support */
189 #endif
191 #define YYFPRINTF parser_fprintf
193 int yyparse (void);
195 static int yylex (void);
197 void yyerror (char *);
199 static struct type *java_type_from_name (struct stoken);
200 static void push_expression_name (struct stoken);
201 static void push_fieldnames (struct stoken);
203 static struct expression *copy_exp (struct expression *, int);
204 static void insert_exp (int, struct expression *);
208 /* Enabling traces. */
209 #ifndef YYDEBUG
210 # define YYDEBUG 0
211 #endif
213 /* Enabling verbose error messages. */
214 #ifdef YYERROR_VERBOSE
215 # undef YYERROR_VERBOSE
216 # define YYERROR_VERBOSE 1
217 #else
218 # define YYERROR_VERBOSE 0
219 #endif
221 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
222 #line 127 "jv-exp.y"
223 typedef union YYSTYPE {
224 LONGEST lval;
225 struct {
226 LONGEST val;
227 struct type *type;
228 } typed_val_int;
229 struct {
230 DOUBLEST dval;
231 struct type *type;
232 } typed_val_float;
233 struct symbol *sym;
234 struct type *tval;
235 struct stoken sval;
236 struct ttype tsym;
237 struct symtoken ssym;
238 struct block *bval;
239 enum exp_opcode opcode;
240 struct internalvar *ivar;
241 int *ivec;
242 } YYSTYPE;
243 /* Line 191 of yacc.c. */
244 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
245 # define YYSTYPE_IS_DECLARED 1
246 # define YYSTYPE_IS_TRIVIAL 1
247 #endif
251 /* Copy the second part of user declarations. */
252 #line 148 "jv-exp.y"
254 /* YYSTYPE gets defined by %union */
255 static int parse_number (char *, int, int, YYSTYPE *);
258 /* Line 214 of yacc.c. */
260 #if ! defined (yyoverflow) || YYERROR_VERBOSE
262 /* The parser invokes alloca or xmalloc; define the necessary symbols. */
264 # if YYSTACK_USE_ALLOCA
265 # define YYSTACK_ALLOC alloca
266 # else
267 # ifndef YYSTACK_USE_ALLOCA
268 # if defined (alloca) || defined (_ALLOCA_H)
269 # define YYSTACK_ALLOC alloca
270 # else
271 # ifdef __GNUC__
272 # define YYSTACK_ALLOC __builtin_alloca
273 # endif
274 # endif
275 # endif
276 # endif
278 # ifdef YYSTACK_ALLOC
279 /* Pacify GCC's `empty if-body' warning. */
280 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
281 # else
282 # if defined (__STDC__) || defined (__cplusplus)
283 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284 # define YYSIZE_T size_t
285 # endif
286 # define YYSTACK_ALLOC xmalloc
287 # define YYSTACK_FREE free
288 # endif
289 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
292 #if (! defined (yyoverflow) \
293 && (! defined (__cplusplus) \
294 || (YYSTYPE_IS_TRIVIAL)))
296 /* A type that is properly aligned for any stack member. */
297 union yyalloc
299 short yyss;
300 YYSTYPE yyvs;
303 /* The size of the maximum gap between one aligned stack and the next. */
304 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
306 /* The size of an array large to enough to hold all stacks, each with
307 N elements. */
308 # define YYSTACK_BYTES(N) \
309 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
310 + YYSTACK_GAP_MAXIMUM)
312 /* Copy COUNT objects from FROM to TO. The source and destination do
313 not overlap. */
314 # ifndef YYCOPY
315 # if 1 < __GNUC__
316 # define YYCOPY(To, From, Count) \
317 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
318 # else
319 # define YYCOPY(To, From, Count) \
320 do \
322 register YYSIZE_T yyi; \
323 for (yyi = 0; yyi < (Count); yyi++) \
324 (To)[yyi] = (From)[yyi]; \
326 while (0)
327 # endif
328 # endif
330 /* Relocate STACK from its old location to the new one. The
331 local variables YYSIZE and YYSTACKSIZE give the old and new number of
332 elements in the stack, and YYPTR gives the new location of the
333 stack. Advance YYPTR to a properly aligned location for the next
334 stack. */
335 # define YYSTACK_RELOCATE(Stack) \
336 do \
338 YYSIZE_T yynewbytes; \
339 YYCOPY (&yyptr->Stack, Stack, yysize); \
340 Stack = &yyptr->Stack; \
341 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
342 yyptr += yynewbytes / sizeof (*yyptr); \
344 while (0)
346 #endif
348 #if defined (__STDC__) || defined (__cplusplus)
349 typedef signed char yysigned_char;
350 #else
351 typedef short yysigned_char;
352 #endif
354 /* YYFINAL -- State number of the termination state. */
355 #define YYFINAL 97
356 /* YYLAST -- Last index in YYTABLE. */
357 #define YYLAST 421
359 /* YYNTOKENS -- Number of terminals. */
360 #define YYNTOKENS 56
361 /* YYNNTS -- Number of nonterminals. */
362 #define YYNNTS 56
363 /* YYNRULES -- Number of rules. */
364 #define YYNRULES 130
365 /* YYNRULES -- Number of states. */
366 #define YYNSTATES 207
368 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
369 #define YYUNDEFTOK 2
370 #define YYMAXUTOK 287
372 #define YYTRANSLATE(YYX) \
373 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
375 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
376 static const unsigned char yytranslate[] =
378 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
379 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
380 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
381 2, 2, 2, 54, 2, 2, 2, 43, 30, 2,
382 48, 49, 41, 39, 23, 40, 46, 42, 2, 2,
383 2, 2, 2, 2, 2, 2, 2, 2, 55, 2,
384 33, 24, 34, 25, 2, 2, 2, 2, 2, 2,
385 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
386 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
387 2, 47, 2, 52, 29, 2, 2, 2, 2, 2,
388 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
389 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
390 2, 2, 2, 50, 28, 51, 53, 2, 2, 2,
391 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
392 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
393 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
394 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
395 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
396 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
397 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
398 2, 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, 2, 2, 2,
402 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
403 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
404 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
405 15, 16, 17, 18, 19, 20, 21, 22, 26, 27,
406 31, 32, 35, 36, 37, 38, 44, 45
409 #if YYDEBUG
410 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
411 YYRHS. */
412 static const unsigned short yyprhs[] =
414 0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
415 19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
416 39, 41, 43, 45, 47, 49, 51, 54, 57, 59,
417 61, 63, 65, 67, 69, 73, 75, 79, 81, 83,
418 85, 89, 91, 93, 95, 97, 101, 103, 105, 111,
419 113, 117, 118, 120, 125, 130, 132, 135, 139, 142,
420 146, 148, 149, 153, 157, 162, 169, 176, 181, 186,
421 191, 193, 195, 197, 199, 201, 204, 207, 209, 211,
422 214, 217, 220, 222, 225, 228, 230, 233, 236, 238,
423 244, 249, 255, 257, 261, 265, 269, 271, 275, 279,
424 281, 285, 289, 291, 295, 299, 303, 307, 309, 313,
425 317, 319, 323, 325, 329, 331, 335, 337, 341, 343,
426 347, 349, 355, 357, 359, 363, 367, 369, 371, 373,
430 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
431 static const yysigned_char yyrhs[] =
433 57, 0, -1, 73, -1, 58, -1, 59, -1, 62,
434 -1, 68, -1, 6, -1, 3, -1, 9, -1, 4,
435 -1, 7, -1, 60, -1, 63, -1, 16, -1, 64,
436 -1, 65, -1, 13, -1, 12, -1, 14, -1, 11,
437 -1, 15, -1, 18, -1, 17, -1, 69, -1, 66,
438 -1, 62, 84, -1, 69, 84, -1, 5, -1, 72,
439 -1, 71, -1, 72, -1, 5, -1, 9, -1, 69,
440 46, 71, -1, 111, -1, 73, 23, 111, -1, 75,
441 -1, 81, -1, 61, -1, 48, 111, 49, -1, 78,
442 -1, 86, -1, 87, -1, 88, -1, 76, 79, 77,
443 -1, 50, -1, 51, -1, 22, 67, 48, 80, 49,
444 -1, 111, -1, 79, 23, 111, -1, -1, 79, -1,
445 22, 62, 82, 85, -1, 22, 66, 82, 85, -1,
446 83, -1, 82, 83, -1, 47, 111, 52, -1, 47,
447 52, -1, 84, 47, 52, -1, 84, -1, -1, 74,
448 46, 71, -1, 19, 46, 71, -1, 69, 48, 80,
449 49, -1, 74, 46, 71, 48, 80, 49, -1, 21,
450 46, 71, 48, 80, 49, -1, 69, 47, 111, 52,
451 -1, 19, 47, 111, 52, -1, 75, 47, 111, 52,
452 -1, 74, -1, 69, -1, 19, -1, 90, -1, 91,
453 -1, 89, 45, -1, 89, 44, -1, 93, -1, 94,
454 -1, 39, 92, -1, 40, 92, -1, 41, 92, -1,
455 95, -1, 45, 92, -1, 44, 92, -1, 89, -1,
456 53, 92, -1, 54, 92, -1, 96, -1, 48, 62,
457 85, 49, 92, -1, 48, 111, 49, 95, -1, 48,
458 69, 84, 49, 95, -1, 92, -1, 97, 41, 92,
459 -1, 97, 42, 92, -1, 97, 43, 92, -1, 97,
460 -1, 98, 39, 97, -1, 98, 40, 97, -1, 98,
461 -1, 99, 38, 98, -1, 99, 37, 98, -1, 99,
462 -1, 100, 33, 99, -1, 100, 34, 99, -1, 100,
463 36, 99, -1, 100, 35, 99, -1, 100, -1, 101,
464 32, 100, -1, 101, 31, 100, -1, 101, -1, 102,
465 30, 101, -1, 102, -1, 103, 29, 102, -1, 103,
466 -1, 104, 28, 103, -1, 104, -1, 105, 27, 104,
467 -1, 105, -1, 106, 26, 105, -1, 106, -1, 106,
468 25, 111, 55, 107, -1, 107, -1, 109, -1, 110,
469 24, 107, -1, 110, 20, 107, -1, 70, -1, 19,
470 -1, 86, -1, 88, -1, 108, -1
473 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
474 static const unsigned short yyrline[] =
476 0, 204, 204, 205, 208, 217, 218, 222, 231, 236,
477 244, 249, 254, 265, 266, 271, 272, 276, 278, 280,
478 282, 284, 289, 291, 303, 308, 312, 314, 319, 320,
479 324, 325, 329, 330, 334, 357, 358, 363, 364, 368,
480 369, 370, 371, 372, 373, 374, 382, 387, 392, 398,
481 400, 406, 407, 411, 414, 420, 421, 425, 429, 431,
482 436, 438, 442, 444, 450, 452, 454, 459, 476, 478,
483 483, 484, 486, 488, 489, 493, 498, 503, 504, 505,
484 506, 508, 510, 514, 519, 524, 525, 527, 529, 533,
485 537, 558, 566, 567, 569, 571, 576, 577, 579, 584,
486 585, 587, 593, 594, 596, 598, 600, 606, 607, 609,
487 614, 615, 620, 621, 625, 626, 631, 632, 637, 638,
488 643, 644, 649, 650, 654, 656, 663, 665, 667, 668,
491 #endif
493 #if YYDEBUG || YYERROR_VERBOSE
494 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
495 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
496 static const char *const yytname[] =
498 "$end", "error", "$undefined", "INTEGER_LITERAL",
499 "FLOATING_POINT_LITERAL", "IDENTIFIER", "STRING_LITERAL",
500 "BOOLEAN_LITERAL", "TYPENAME", "NAME_OR_INT", "ERROR", "LONG", "SHORT",
501 "BYTE", "INT", "CHAR", "BOOLEAN", "DOUBLE", "FLOAT", "VARIABLE",
502 "ASSIGN_MODIFY", "SUPER", "NEW", "','", "'='", "'?'", "OROR", "ANDAND",
503 "'|'", "'^'", "'&'", "NOTEQUAL", "EQUAL", "'<'", "'>'", "GEQ", "LEQ",
504 "RSH", "LSH", "'+'", "'-'", "'*'", "'/'", "'%'", "DECREMENT",
505 "INCREMENT", "'.'", "'['", "'('", "')'", "'{'", "'}'", "']'", "'~'",
506 "'!'", "':'", "$accept", "start", "type_exp", "PrimitiveOrArrayType",
507 "StringLiteral", "Literal", "PrimitiveType", "NumericType",
508 "IntegralType", "FloatingPointType", "ClassOrInterfaceType",
509 "ClassType", "ArrayType", "Name", "ForcedName", "SimpleName",
510 "QualifiedName", "exp1", "Primary", "PrimaryNoNewArray", "lcurly",
511 "rcurly", "ClassInstanceCreationExpression", "ArgumentList",
512 "ArgumentList_opt", "ArrayCreationExpression", "DimExprs", "DimExpr",
513 "Dims", "Dims_opt", "FieldAccess", "MethodInvocation", "ArrayAccess",
514 "PostfixExpression", "PostIncrementExpression",
515 "PostDecrementExpression", "UnaryExpression", "PreIncrementExpression",
516 "PreDecrementExpression", "UnaryExpressionNotPlusMinus",
517 "CastExpression", "MultiplicativeExpression", "AdditiveExpression",
518 "ShiftExpression", "RelationalExpression", "EqualityExpression",
519 "AndExpression", "ExclusiveOrExpression", "InclusiveOrExpression",
520 "ConditionalAndExpression", "ConditionalOrExpression",
521 "ConditionalExpression", "AssignmentExpression", "Assignment",
522 "LeftHandSide", "Expression", 0
524 #endif
526 # ifdef YYPRINT
527 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
528 token YYLEX-NUM. */
529 static const unsigned short yytoknum[] =
531 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
532 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
533 275, 276, 277, 44, 61, 63, 278, 279, 124, 94,
534 38, 280, 281, 60, 62, 282, 283, 284, 285, 43,
535 45, 42, 47, 37, 286, 287, 46, 91, 40, 41,
536 123, 125, 93, 126, 33, 58
538 # endif
540 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
541 static const unsigned char yyr1[] =
543 0, 56, 57, 57, 58, 59, 59, 60, 61, 61,
544 61, 61, 61, 62, 62, 63, 63, 64, 64, 64,
545 64, 64, 65, 65, 66, 67, 68, 68, 69, 69,
546 70, 70, 71, 71, 72, 73, 73, 74, 74, 75,
547 75, 75, 75, 75, 75, 75, 76, 77, 78, 79,
548 79, 80, 80, 81, 81, 82, 82, 83, 84, 84,
549 85, 85, 86, 86, 87, 87, 87, 88, 88, 88,
550 89, 89, 89, 89, 89, 90, 91, 92, 92, 92,
551 92, 92, 92, 93, 94, 95, 95, 95, 95, 96,
552 96, 96, 97, 97, 97, 97, 98, 98, 98, 99,
553 99, 99, 100, 100, 100, 100, 100, 101, 101, 101,
554 102, 102, 103, 103, 104, 104, 105, 105, 106, 106,
555 107, 107, 108, 108, 109, 109, 110, 110, 110, 110,
559 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
560 static const unsigned char yyr2[] =
562 0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
563 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
564 1, 1, 1, 1, 1, 1, 2, 2, 1, 1,
565 1, 1, 1, 1, 3, 1, 3, 1, 1, 1,
566 3, 1, 1, 1, 1, 3, 1, 1, 5, 1,
567 3, 0, 1, 4, 4, 1, 2, 3, 2, 3,
568 1, 0, 3, 3, 4, 6, 6, 4, 4, 4,
569 1, 1, 1, 1, 1, 2, 2, 1, 1, 2,
570 2, 2, 1, 2, 2, 1, 2, 2, 1, 5,
571 4, 5, 1, 3, 3, 3, 1, 3, 3, 1,
572 3, 3, 1, 3, 3, 3, 3, 1, 3, 3,
573 1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
574 1, 5, 1, 1, 3, 3, 1, 1, 1, 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, 8, 10, 28, 7, 11, 9, 20, 18, 17,
584 19, 21, 14, 23, 22, 72, 0, 0, 0, 0,
585 0, 0, 0, 0, 46, 0, 0, 0, 3, 4,
586 12, 39, 5, 13, 15, 16, 6, 71, 126, 30,
587 29, 2, 70, 37, 0, 41, 38, 42, 43, 44,
588 85, 73, 74, 92, 77, 78, 82, 88, 96, 99,
589 102, 107, 110, 112, 114, 116, 118, 120, 122, 130,
590 123, 0, 35, 0, 0, 0, 28, 0, 25, 0,
591 24, 29, 9, 72, 71, 42, 44, 79, 80, 81,
592 84, 83, 61, 71, 0, 86, 87, 1, 0, 26,
593 0, 0, 51, 27, 0, 0, 0, 0, 49, 76,
594 75, 0, 0, 0, 0, 0, 0, 0, 0, 0,
595 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
596 0, 0, 32, 33, 63, 0, 0, 0, 61, 55,
597 61, 51, 0, 60, 0, 0, 40, 58, 0, 34,
598 0, 52, 0, 36, 62, 0, 0, 47, 45, 93,
599 94, 95, 97, 98, 101, 100, 103, 104, 106, 105,
600 109, 108, 111, 113, 115, 117, 0, 119, 125, 124,
601 68, 51, 0, 0, 56, 53, 54, 0, 0, 0,
602 90, 59, 67, 64, 51, 69, 50, 0, 0, 57,
603 48, 89, 91, 0, 121, 66, 65
606 /* YYDEFGOTO[NTERM-NUM]. */
607 static const short yydefgoto[] =
609 -1, 27, 28, 29, 30, 31, 32, 33, 34, 35,
610 78, 79, 36, 84, 38, 39, 81, 41, 42, 43,
611 44, 158, 45, 151, 152, 46, 138, 139, 143, 144,
612 85, 48, 86, 50, 51, 52, 53, 54, 55, 56,
613 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
614 67, 68, 69, 70, 71, 108
617 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
618 STATE-NUM. */
619 #define YYPACT_NINF -135
620 static const short yypact[] =
622 204, -135, -135, 8, -135, -135, 14, -135, -135, -135,
623 -135, -135, -135, -135, -135, -4, 5, 50, 308, 308,
624 308, 308, 308, 204, -135, 308, 308, 40, -135, -135,
625 -135, -135, -1, -135, -135, -135, -135, 37, -135, -135,
626 28, 36, 45, 46, 360, -135, -135, 33, -135, 49,
627 -19, -135, -135, -135, -135, -135, -135, -135, 84, 31,
628 95, 54, 89, 75, 74, 81, 88, 110, -135, -135,
629 -135, 52, -135, 73, 360, 73, -135, 64, 64, 69,
630 77, -135, -135, 92, 83, -135, -135, -135, -135, -135,
631 -135, -135, -1, 37, 103, -135, -135, -135, 107, 114,
632 73, 256, 360, 114, 360, 73, 360, -6, -135, -135,
633 -135, 308, 308, 308, 308, 308, 308, 308, 308, 308,
634 308, 308, 308, 308, 308, 308, 308, 308, 360, 308,
635 308, 308, -135, -135, -135, 111, 116, 360, 118, -135,
636 118, 360, 360, 114, 117, -16, 367, -135, 115, -135,
637 120, 146, 121, -135, 125, 123, 360, -135, -135, -135,
638 -135, -135, 84, 84, 31, 31, 95, 95, 95, 95,
639 54, 54, 89, 75, 74, 81, 122, 88, -135, -135,
640 -135, 360, 124, 256, -135, -135, -135, 129, 308, 367,
641 -135, -135, -135, -135, 360, -135, -135, 308, 130, -135,
642 -135, -135, -135, 131, -135, -135, -135
645 /* YYPGOTO[NTERM-NUM]. */
646 static const short yypgoto[] =
648 -135, -135, -135, -135, -135, -135, 4, -135, -135, -135,
649 -135, -135, -135, 13, -135, -51, 0, -135, -135, -135,
650 -135, -135, -135, 138, -134, -135, 106, -101, -18, -59,
651 6, -135, 12, -135, -135, -135, -17, -135, -135, -131,
652 -135, 30, 34, -21, 35, 61, 63, 60, 65, 62,
653 -135, -120, -135, -135, -135, 18
656 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
657 positive, shift that token. If negative, reduce the rule which
658 number is the opposite. If zero, do what YYDEFACT says.
659 If YYTABLE_NINF, syntax error. */
660 #define YYTABLE_NINF -130
661 static const short yytable[] =
663 40, 87, 88, 89, 90, 91, 47, 187, 95, 96,
664 178, 179, 49, 37, 99, 190, -127, 156, 72, 103,
665 -127, 77, 134, 40, 136, 109, 110, 92, -32, 47,
666 80, 148, -32, 189, -33, 49, 93, 184, -33, 184,
667 97, 94, 73, 74, 40, 157, 98, 198, -31, 149,
668 47, 75, -31, -128, 154, 76, 49, -128, 202, 104,
669 203, 7, 8, 9, 10, 11, 12, 13, 14, -129,
670 114, 115, 130, -129, 40, 145, 131, 204, 132, 185,
671 47, 186, 133, 100, 101, 102, 49, 118, 119, 120,
672 121, 105, 135, 106, 159, 160, 161, 166, 167, 168,
673 169, 40, 40, 125, 40, 124, 40, 47, 47, 126,
674 47, 137, 47, 49, 49, 127, 49, 141, 49, 150,
675 122, 123, 153, 100, 155, 111, 112, 113, 40, 100,
676 142, 102, 116, 117, 47, 128, 129, 40, 73, 74,
677 49, 40, 40, 47, 162, 163, 176, 47, 47, 49,
678 164, 165, 146, 49, 49, 182, 40, 170, 171, 147,
679 150, 148, 47, 180, 181, 183, 188, 191, 49, 156,
680 193, 201, 192, 194, 196, 195, 199, 197, 200, 205,
681 206, 40, 107, 40, 140, 172, 174, 47, 173, 47,
682 0, 177, 175, 49, 40, 49, 0, 0, 0, 0,
683 47, 182, 0, 0, 0, 0, 49, 1, 2, 3,
684 4, 5, 0, 6, 0, 7, 8, 9, 10, 11,
685 12, 13, 14, 15, 0, 16, 17, 0, 0, 0,
686 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
687 0, 0, 0, 18, 19, 20, 0, 0, 21, 22,
688 0, 0, 23, 0, 24, 0, 0, 25, 26, 1,
689 2, 3, 4, 5, 0, 6, 0, 0, 0, 0,
690 0, 0, 0, 0, 0, 15, 0, 16, 17, 0,
691 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
692 0, 0, 0, 0, 0, 18, 19, 20, 0, 0,
693 21, 22, 0, 0, 23, 0, 24, 0, 147, 25,
694 26, 1, 2, 76, 4, 5, 0, 82, 0, 0,
695 0, 0, 0, 0, 0, 0, 0, 83, 0, 16,
696 17, 0, 0, 0, 0, 0, 0, 0, 0, 0,
697 0, 0, 0, 0, 0, 0, 0, 18, 19, 20,
698 0, 0, 21, 22, 0, 0, 23, 0, 24, 0,
699 0, 25, 26, 1, 2, 3, 4, 5, 0, 6,
700 1, 2, 76, 4, 5, 0, 82, 0, 0, 15,
701 0, 16, 17, 0, 0, 0, 83, 0, 16, 17,
702 0, 0, 0, 0, 0, 0, 0, 0, 0, 18,
703 19, 20, 0, 0, 21, 22, 0, 0, 23, 0,
704 24, 0, 0, 25, 26, 23, 0, 24, 0, 0,
705 25, 26
708 static const short yycheck[] =
710 0, 18, 19, 20, 21, 22, 0, 141, 25, 26,
711 130, 131, 0, 0, 32, 146, 20, 23, 0, 37,
712 24, 17, 73, 23, 75, 44, 45, 23, 20, 23,
713 17, 47, 24, 49, 20, 23, 23, 138, 24, 140,
714 0, 23, 46, 47, 44, 51, 47, 181, 20, 100,
715 44, 46, 24, 20, 105, 5, 44, 24, 189, 23,
716 194, 11, 12, 13, 14, 15, 16, 17, 18, 20,
717 39, 40, 20, 24, 74, 93, 24, 197, 5, 138,
718 74, 140, 9, 46, 47, 48, 74, 33, 34, 35,
719 36, 46, 74, 47, 111, 112, 113, 118, 119, 120,
720 121, 101, 102, 29, 104, 30, 106, 101, 102, 28,
721 104, 47, 106, 101, 102, 27, 104, 48, 106, 101,
722 31, 32, 104, 46, 106, 41, 42, 43, 128, 46,
723 47, 48, 37, 38, 128, 25, 26, 137, 46, 47,
724 128, 141, 142, 137, 114, 115, 128, 141, 142, 137,
725 116, 117, 49, 141, 142, 137, 156, 122, 123, 52,
726 142, 47, 156, 52, 48, 47, 49, 52, 156, 23,
727 49, 188, 52, 48, 156, 52, 52, 55, 49, 49,
728 49, 181, 44, 183, 78, 124, 126, 181, 125, 183,
729 -1, 129, 127, 181, 194, 183, -1, -1, -1, -1,
730 194, 183, -1, -1, -1, -1, 194, 3, 4, 5,
731 6, 7, -1, 9, -1, 11, 12, 13, 14, 15,
732 16, 17, 18, 19, -1, 21, 22, -1, -1, -1,
733 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
734 -1, -1, -1, 39, 40, 41, -1, -1, 44, 45,
735 -1, -1, 48, -1, 50, -1, -1, 53, 54, 3,
736 4, 5, 6, 7, -1, 9, -1, -1, -1, -1,
737 -1, -1, -1, -1, -1, 19, -1, 21, 22, -1,
738 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
739 -1, -1, -1, -1, -1, 39, 40, 41, -1, -1,
740 44, 45, -1, -1, 48, -1, 50, -1, 52, 53,
741 54, 3, 4, 5, 6, 7, -1, 9, -1, -1,
742 -1, -1, -1, -1, -1, -1, -1, 19, -1, 21,
743 22, -1, -1, -1, -1, -1, -1, -1, -1, -1,
744 -1, -1, -1, -1, -1, -1, -1, 39, 40, 41,
745 -1, -1, 44, 45, -1, -1, 48, -1, 50, -1,
746 -1, 53, 54, 3, 4, 5, 6, 7, -1, 9,
747 3, 4, 5, 6, 7, -1, 9, -1, -1, 19,
748 -1, 21, 22, -1, -1, -1, 19, -1, 21, 22,
749 -1, -1, -1, -1, -1, -1, -1, -1, -1, 39,
750 40, 41, -1, -1, 44, 45, -1, -1, 48, -1,
751 50, -1, -1, 53, 54, 48, -1, 50, -1, -1,
752 53, 54
755 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
756 symbol of state STATE-NUM. */
757 static const unsigned char yystos[] =
759 0, 3, 4, 5, 6, 7, 9, 11, 12, 13,
760 14, 15, 16, 17, 18, 19, 21, 22, 39, 40,
761 41, 44, 45, 48, 50, 53, 54, 57, 58, 59,
762 60, 61, 62, 63, 64, 65, 68, 69, 70, 71,
763 72, 73, 74, 75, 76, 78, 81, 86, 87, 88,
764 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
765 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
766 109, 110, 111, 46, 47, 46, 5, 62, 66, 67,
767 69, 72, 9, 19, 69, 86, 88, 92, 92, 92,
768 92, 92, 62, 69, 111, 92, 92, 0, 47, 84,
769 46, 47, 48, 84, 23, 46, 47, 79, 111, 44,
770 45, 41, 42, 43, 39, 40, 37, 38, 33, 34,
771 35, 36, 31, 32, 30, 29, 28, 27, 25, 26,
772 20, 24, 5, 9, 71, 111, 71, 47, 82, 83,
773 82, 48, 47, 84, 85, 84, 49, 52, 47, 71,
774 111, 79, 80, 111, 71, 111, 23, 51, 77, 92,
775 92, 92, 97, 97, 98, 98, 99, 99, 99, 99,
776 100, 100, 101, 102, 103, 104, 111, 105, 107, 107,
777 52, 48, 111, 47, 83, 85, 85, 80, 49, 49,
778 95, 52, 52, 49, 48, 52, 111, 55, 80, 52,
779 49, 92, 95, 80, 107, 49, 49
782 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
783 # define YYSIZE_T __SIZE_TYPE__
784 #endif
785 #if ! defined (YYSIZE_T) && defined (size_t)
786 # define YYSIZE_T size_t
787 #endif
788 #if ! defined (YYSIZE_T)
789 # if defined (__STDC__) || defined (__cplusplus)
790 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
791 # define YYSIZE_T size_t
792 # endif
793 #endif
794 #if ! defined (YYSIZE_T)
795 # define YYSIZE_T unsigned int
796 #endif
798 #define yyerrok (yyerrstatus = 0)
799 #define yyclearin (yychar = YYEMPTY)
800 #define YYEMPTY (-2)
801 #define YYEOF 0
803 #define YYACCEPT goto yyacceptlab
804 #define YYABORT goto yyabortlab
805 #define YYERROR goto yyerrlab1
807 /* Like YYERROR except do call yyerror. This remains here temporarily
808 to ease the transition to the new meaning of YYERROR, for GCC.
809 Once GCC version 2 has supplanted version 1, this can go. */
811 #define YYFAIL goto yyerrlab
813 #define YYRECOVERING() (!!yyerrstatus)
815 #define YYBACKUP(Token, Value) \
816 do \
817 if (yychar == YYEMPTY && yylen == 1) \
819 yychar = (Token); \
820 yylval = (Value); \
821 yytoken = YYTRANSLATE (yychar); \
822 YYPOPSTACK; \
823 goto yybackup; \
825 else \
827 yyerror ("syntax error: cannot back up");\
828 YYERROR; \
830 while (0)
832 #define YYTERROR 1
833 #define YYERRCODE 256
835 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
836 are run). */
838 #ifndef YYLLOC_DEFAULT
839 # define YYLLOC_DEFAULT(Current, Rhs, N) \
840 Current.first_line = Rhs[1].first_line; \
841 Current.first_column = Rhs[1].first_column; \
842 Current.last_line = Rhs[N].last_line; \
843 Current.last_column = Rhs[N].last_column;
844 #endif
846 /* YYLEX -- calling `yylex' with the right arguments. */
848 #ifdef YYLEX_PARAM
849 # define YYLEX yylex (YYLEX_PARAM)
850 #else
851 # define YYLEX yylex ()
852 #endif
854 /* Enable debugging if requested. */
855 #if YYDEBUG
857 # ifndef YYFPRINTF
858 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
859 # define YYFPRINTF fprintf
860 # endif
862 # define YYDPRINTF(Args) \
863 do { \
864 if (yydebug) \
865 YYFPRINTF Args; \
866 } while (0)
868 # define YYDSYMPRINT(Args) \
869 do { \
870 if (yydebug) \
871 yysymprint Args; \
872 } while (0)
874 # define YYDSYMPRINTF(Title, Token, Value, Location) \
875 do { \
876 if (yydebug) \
878 YYFPRINTF (stderr, "%s ", Title); \
879 yysymprint (stderr, \
880 Token, Value); \
881 YYFPRINTF (stderr, "\n"); \
883 } while (0)
885 /*------------------------------------------------------------------.
886 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
887 | TOP (cinluded). |
888 `------------------------------------------------------------------*/
890 #if defined (__STDC__) || defined (__cplusplus)
891 static void
892 yy_stack_print (short *bottom, short *top)
893 #else
894 static void
895 yy_stack_print (bottom, top)
896 short *bottom;
897 short *top;
898 #endif
900 YYFPRINTF (stderr, "Stack now");
901 for (/* Nothing. */; bottom <= top; ++bottom)
902 YYFPRINTF (stderr, " %d", *bottom);
903 YYFPRINTF (stderr, "\n");
906 # define YY_STACK_PRINT(Bottom, Top) \
907 do { \
908 if (yydebug) \
909 yy_stack_print ((Bottom), (Top)); \
910 } while (0)
913 /*------------------------------------------------.
914 | Report that the YYRULE is going to be reduced. |
915 `------------------------------------------------*/
917 #if defined (__STDC__) || defined (__cplusplus)
918 static void
919 yy_reduce_print (int yyrule)
920 #else
921 static void
922 yy_reduce_print (yyrule)
923 int yyrule;
924 #endif
926 int yyi;
927 unsigned int yylineno = yyrline[yyrule];
928 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
929 yyrule - 1, yylineno);
930 /* Print the symbols being reduced, and their result. */
931 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
932 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
933 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
936 # define YY_REDUCE_PRINT(Rule) \
937 do { \
938 if (yydebug) \
939 yy_reduce_print (Rule); \
940 } while (0)
942 /* Nonzero means print parse trace. It is left uninitialized so that
943 multiple parsers can coexist. */
944 int yydebug;
945 #else /* !YYDEBUG */
946 # define YYDPRINTF(Args)
947 # define YYDSYMPRINT(Args)
948 # define YYDSYMPRINTF(Title, Token, Value, Location)
949 # define YY_STACK_PRINT(Bottom, Top)
950 # define YY_REDUCE_PRINT(Rule)
951 #endif /* !YYDEBUG */
954 /* YYINITDEPTH -- initial size of the parser's stacks. */
955 #ifndef YYINITDEPTH
956 # define YYINITDEPTH 200
957 #endif
959 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
960 if the built-in stack extension method is used).
962 Do not make this value too large; the results are undefined if
963 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
964 evaluated with infinite-precision integer arithmetic. */
966 #if YYMAXDEPTH == 0
967 # undef YYMAXDEPTH
968 #endif
970 #ifndef YYMAXDEPTH
971 # define YYMAXDEPTH 10000
972 #endif
976 #if YYERROR_VERBOSE
978 # ifndef yystrlen
979 # if defined (__GLIBC__) && defined (_STRING_H)
980 # define yystrlen strlen
981 # else
982 /* Return the length of YYSTR. */
983 static YYSIZE_T
984 # if defined (__STDC__) || defined (__cplusplus)
985 yystrlen (const char *yystr)
986 # else
987 yystrlen (yystr)
988 const char *yystr;
989 # endif
991 register const char *yys = yystr;
993 while (*yys++ != '\0')
994 continue;
996 return yys - yystr - 1;
998 # endif
999 # endif
1001 # ifndef yystpcpy
1002 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
1003 # define yystpcpy stpcpy
1004 # else
1005 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1006 YYDEST. */
1007 static char *
1008 # if defined (__STDC__) || defined (__cplusplus)
1009 yystpcpy (char *yydest, const char *yysrc)
1010 # else
1011 yystpcpy (yydest, yysrc)
1012 char *yydest;
1013 const char *yysrc;
1014 # endif
1016 register char *yyd = yydest;
1017 register const char *yys = yysrc;
1019 while ((*yyd++ = *yys++) != '\0')
1020 continue;
1022 return yyd - 1;
1024 # endif
1025 # endif
1027 #endif /* !YYERROR_VERBOSE */
1031 #if YYDEBUG
1032 /*--------------------------------.
1033 | Print this symbol on YYOUTPUT. |
1034 `--------------------------------*/
1036 #if defined (__STDC__) || defined (__cplusplus)
1037 static void
1038 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
1039 #else
1040 static void
1041 yysymprint (yyoutput, yytype, yyvaluep)
1042 FILE *yyoutput;
1043 int yytype;
1044 YYSTYPE *yyvaluep;
1045 #endif
1047 /* Pacify ``unused variable'' warnings. */
1048 (void) yyvaluep;
1050 if (yytype < YYNTOKENS)
1052 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1053 # ifdef YYPRINT
1054 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1055 # endif
1057 else
1058 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1060 switch (yytype)
1062 default:
1063 break;
1065 YYFPRINTF (yyoutput, ")");
1068 #endif /* ! YYDEBUG */
1069 /*-----------------------------------------------.
1070 | Release the memory associated to this symbol. |
1071 `-----------------------------------------------*/
1073 #if defined (__STDC__) || defined (__cplusplus)
1074 static void
1075 yydestruct (int yytype, YYSTYPE *yyvaluep)
1076 #else
1077 static void
1078 yydestruct (yytype, yyvaluep)
1079 int yytype;
1080 YYSTYPE *yyvaluep;
1081 #endif
1083 /* Pacify ``unused variable'' warnings. */
1084 (void) yyvaluep;
1086 switch (yytype)
1089 default:
1090 break;
1095 /* Prevent warnings from -Wmissing-prototypes. */
1097 #ifdef YYPARSE_PARAM
1098 # if defined (__STDC__) || defined (__cplusplus)
1099 int yyparse (void *YYPARSE_PARAM);
1100 # else
1101 int yyparse ();
1102 # endif
1103 #else /* ! YYPARSE_PARAM */
1104 #if defined (__STDC__) || defined (__cplusplus)
1105 int yyparse (void);
1106 #else
1107 int yyparse ();
1108 #endif
1109 #endif /* ! YYPARSE_PARAM */
1113 /* The lookahead symbol. */
1114 int yychar;
1116 /* The semantic value of the lookahead symbol. */
1117 YYSTYPE yylval;
1119 /* Number of syntax errors so far. */
1120 int yynerrs;
1124 /*----------.
1125 | yyparse. |
1126 `----------*/
1128 #ifdef YYPARSE_PARAM
1129 # if defined (__STDC__) || defined (__cplusplus)
1130 int yyparse (void *YYPARSE_PARAM)
1131 # else
1132 int yyparse (YYPARSE_PARAM)
1133 void *YYPARSE_PARAM;
1134 # endif
1135 #else /* ! YYPARSE_PARAM */
1136 #if defined (__STDC__) || defined (__cplusplus)
1138 yyparse (void)
1139 #else
1141 yyparse ()
1143 #endif
1144 #endif
1147 register int yystate;
1148 register int yyn;
1149 int yyresult;
1150 /* Number of tokens to shift before error messages enabled. */
1151 int yyerrstatus;
1152 /* Lookahead token as an internal (translated) token number. */
1153 int yytoken = 0;
1155 /* Three stacks and their tools:
1156 `yyss': related to states,
1157 `yyvs': related to semantic values,
1158 `yyls': related to locations.
1160 Refer to the stacks thru separate pointers, to allow yyoverflow
1161 to xreallocate them elsewhere. */
1163 /* The state stack. */
1164 short yyssa[YYINITDEPTH];
1165 short *yyss = yyssa;
1166 register short *yyssp;
1168 /* The semantic value stack. */
1169 YYSTYPE yyvsa[YYINITDEPTH];
1170 YYSTYPE *yyvs = yyvsa;
1171 register YYSTYPE *yyvsp;
1175 #define YYPOPSTACK (yyvsp--, yyssp--)
1177 YYSIZE_T yystacksize = YYINITDEPTH;
1179 /* The variables used to return semantic value and location from the
1180 action routines. */
1181 YYSTYPE yyval;
1184 /* When reducing, the number of symbols on the RHS of the reduced
1185 rule. */
1186 int yylen;
1188 YYDPRINTF ((stderr, "Starting parse\n"));
1190 yystate = 0;
1191 yyerrstatus = 0;
1192 yynerrs = 0;
1193 yychar = YYEMPTY; /* Cause a token to be read. */
1195 /* Initialize stack pointers.
1196 Waste one element of value and location stack
1197 so that they stay on the same level as the state stack.
1198 The wasted elements are never initialized. */
1200 yyssp = yyss;
1201 yyvsp = yyvs;
1203 goto yysetstate;
1205 /*------------------------------------------------------------.
1206 | yynewstate -- Push a new state, which is found in yystate. |
1207 `------------------------------------------------------------*/
1208 yynewstate:
1209 /* In all cases, when you get here, the value and location stacks
1210 have just been pushed. so pushing a state here evens the stacks.
1212 yyssp++;
1214 yysetstate:
1215 *yyssp = yystate;
1217 if (yyss + yystacksize - 1 <= yyssp)
1219 /* Get the current used size of the three stacks, in elements. */
1220 YYSIZE_T yysize = yyssp - yyss + 1;
1222 #ifdef yyoverflow
1224 /* Give user a chance to xreallocate the stack. Use copies of
1225 these so that the &'s don't force the real ones into
1226 memory. */
1227 YYSTYPE *yyvs1 = yyvs;
1228 short *yyss1 = yyss;
1231 /* Each stack pointer address is followed by the size of the
1232 data in use in that stack, in bytes. This used to be a
1233 conditional around just the two extra args, but that might
1234 be undefined if yyoverflow is a macro. */
1235 yyoverflow ("parser stack overflow",
1236 &yyss1, yysize * sizeof (*yyssp),
1237 &yyvs1, yysize * sizeof (*yyvsp),
1239 &yystacksize);
1241 yyss = yyss1;
1242 yyvs = yyvs1;
1244 #else /* no yyoverflow */
1245 # ifndef YYSTACK_RELOCATE
1246 goto yyoverflowlab;
1247 # else
1248 /* Extend the stack our own way. */
1249 if (YYMAXDEPTH <= yystacksize)
1250 goto yyoverflowlab;
1251 yystacksize *= 2;
1252 if (YYMAXDEPTH < yystacksize)
1253 yystacksize = YYMAXDEPTH;
1256 short *yyss1 = yyss;
1257 union yyalloc *yyptr =
1258 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1259 if (! yyptr)
1260 goto yyoverflowlab;
1261 YYSTACK_RELOCATE (yyss);
1262 YYSTACK_RELOCATE (yyvs);
1264 # undef YYSTACK_RELOCATE
1265 if (yyss1 != yyssa)
1266 YYSTACK_FREE (yyss1);
1268 # endif
1269 #endif /* no yyoverflow */
1271 yyssp = yyss + yysize - 1;
1272 yyvsp = yyvs + yysize - 1;
1275 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1276 (unsigned long int) yystacksize));
1278 if (yyss + yystacksize - 1 <= yyssp)
1279 YYABORT;
1282 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1284 goto yybackup;
1286 /*-----------.
1287 | yybackup. |
1288 `-----------*/
1289 yybackup:
1291 /* Do appropriate processing given the current state. */
1292 /* Read a lookahead token if we need one and don't already have one. */
1293 /* yyresume: */
1295 /* First try to decide what to do without reference to lookahead token. */
1297 yyn = yypact[yystate];
1298 if (yyn == YYPACT_NINF)
1299 goto yydefault;
1301 /* Not known => get a lookahead token if don't already have one. */
1303 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1304 if (yychar == YYEMPTY)
1306 YYDPRINTF ((stderr, "Reading a token: "));
1307 yychar = YYLEX;
1310 if (yychar <= YYEOF)
1312 yychar = yytoken = YYEOF;
1313 YYDPRINTF ((stderr, "Now at end of input.\n"));
1315 else
1317 yytoken = YYTRANSLATE (yychar);
1318 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1321 /* If the proper action on seeing token YYTOKEN is to reduce or to
1322 detect an error, take that action. */
1323 yyn += yytoken;
1324 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1325 goto yydefault;
1326 yyn = yytable[yyn];
1327 if (yyn <= 0)
1329 if (yyn == 0 || yyn == YYTABLE_NINF)
1330 goto yyerrlab;
1331 yyn = -yyn;
1332 goto yyreduce;
1335 if (yyn == YYFINAL)
1336 YYACCEPT;
1338 /* Shift the lookahead token. */
1339 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1341 /* Discard the token being shifted unless it is eof. */
1342 if (yychar != YYEOF)
1343 yychar = YYEMPTY;
1345 *++yyvsp = yylval;
1348 /* Count tokens shifted since error; after three, turn off error
1349 status. */
1350 if (yyerrstatus)
1351 yyerrstatus--;
1353 yystate = yyn;
1354 goto yynewstate;
1357 /*-----------------------------------------------------------.
1358 | yydefault -- do the default action for the current state. |
1359 `-----------------------------------------------------------*/
1360 yydefault:
1361 yyn = yydefact[yystate];
1362 if (yyn == 0)
1363 goto yyerrlab;
1364 goto yyreduce;
1367 /*-----------------------------.
1368 | yyreduce -- Do a reduction. |
1369 `-----------------------------*/
1370 yyreduce:
1371 /* yyn is the number of a rule to reduce with. */
1372 yylen = yyr2[yyn];
1374 /* If YYLEN is nonzero, implement the default value of the action:
1375 `$$ = $1'.
1377 Otherwise, the following line sets YYVAL to garbage.
1378 This behavior is undocumented and Bison
1379 users should not rely upon it. Assigning to YYVAL
1380 unconditionally makes the parser a bit smaller, and it avoids a
1381 GCC warning that YYVAL may be used uninitialized. */
1382 yyval = yyvsp[1-yylen];
1385 YY_REDUCE_PRINT (yyn);
1386 switch (yyn)
1388 case 4:
1389 #line 209 "jv-exp.y"
1391 write_exp_elt_opcode(OP_TYPE);
1392 write_exp_elt_type(yyvsp[0].tval);
1393 write_exp_elt_opcode(OP_TYPE);
1395 break;
1397 case 7:
1398 #line 223 "jv-exp.y"
1400 write_exp_elt_opcode (OP_STRING);
1401 write_exp_string (yyvsp[0].sval);
1402 write_exp_elt_opcode (OP_STRING);
1404 break;
1406 case 8:
1407 #line 232 "jv-exp.y"
1408 { write_exp_elt_opcode (OP_LONG);
1409 write_exp_elt_type (yyvsp[0].typed_val_int.type);
1410 write_exp_elt_longcst ((LONGEST)(yyvsp[0].typed_val_int.val));
1411 write_exp_elt_opcode (OP_LONG); }
1412 break;
1414 case 9:
1415 #line 237 "jv-exp.y"
1416 { YYSTYPE val;
1417 parse_number (yyvsp[0].sval.ptr, yyvsp[0].sval.length, 0, &val);
1418 write_exp_elt_opcode (OP_LONG);
1419 write_exp_elt_type (val.typed_val_int.type);
1420 write_exp_elt_longcst ((LONGEST)val.typed_val_int.val);
1421 write_exp_elt_opcode (OP_LONG);
1423 break;
1425 case 10:
1426 #line 245 "jv-exp.y"
1427 { write_exp_elt_opcode (OP_DOUBLE);
1428 write_exp_elt_type (yyvsp[0].typed_val_float.type);
1429 write_exp_elt_dblcst (yyvsp[0].typed_val_float.dval);
1430 write_exp_elt_opcode (OP_DOUBLE); }
1431 break;
1433 case 11:
1434 #line 250 "jv-exp.y"
1435 { write_exp_elt_opcode (OP_LONG);
1436 write_exp_elt_type (java_boolean_type);
1437 write_exp_elt_longcst ((LONGEST)yyvsp[0].lval);
1438 write_exp_elt_opcode (OP_LONG); }
1439 break;
1441 case 14:
1442 #line 267 "jv-exp.y"
1443 { yyval.tval = java_boolean_type; }
1444 break;
1446 case 17:
1447 #line 277 "jv-exp.y"
1448 { yyval.tval = java_byte_type; }
1449 break;
1451 case 18:
1452 #line 279 "jv-exp.y"
1453 { yyval.tval = java_short_type; }
1454 break;
1456 case 19:
1457 #line 281 "jv-exp.y"
1458 { yyval.tval = java_int_type; }
1459 break;
1461 case 20:
1462 #line 283 "jv-exp.y"
1463 { yyval.tval = java_long_type; }
1464 break;
1466 case 21:
1467 #line 285 "jv-exp.y"
1468 { yyval.tval = java_char_type; }
1469 break;
1471 case 22:
1472 #line 290 "jv-exp.y"
1473 { yyval.tval = java_float_type; }
1474 break;
1476 case 23:
1477 #line 292 "jv-exp.y"
1478 { yyval.tval = java_double_type; }
1479 break;
1481 case 24:
1482 #line 304 "jv-exp.y"
1483 { yyval.tval = java_type_from_name (yyvsp[0].sval); }
1484 break;
1486 case 26:
1487 #line 313 "jv-exp.y"
1488 { yyval.tval = java_array_type (yyvsp[-1].tval, yyvsp[0].lval); }
1489 break;
1491 case 27:
1492 #line 315 "jv-exp.y"
1493 { yyval.tval = java_array_type (java_type_from_name (yyvsp[-1].sval), yyvsp[0].lval); }
1494 break;
1496 case 34:
1497 #line 335 "jv-exp.y"
1498 { yyval.sval.length = yyvsp[-2].sval.length + yyvsp[0].sval.length + 1;
1499 if (yyvsp[-2].sval.ptr + yyvsp[-2].sval.length + 1 == yyvsp[0].sval.ptr
1500 && yyvsp[-2].sval.ptr[yyvsp[-2].sval.length] == '.')
1501 yyval.sval.ptr = yyvsp[-2].sval.ptr; /* Optimization. */
1502 else
1504 yyval.sval.ptr = (char *) xmalloc (yyval.sval.length + 1);
1505 make_cleanup (free, yyval.sval.ptr);
1506 sprintf (yyval.sval.ptr, "%.*s.%.*s",
1507 yyvsp[-2].sval.length, yyvsp[-2].sval.ptr, yyvsp[0].sval.length, yyvsp[0].sval.ptr);
1509 break;
1511 case 36:
1512 #line 359 "jv-exp.y"
1513 { write_exp_elt_opcode (BINOP_COMMA); }
1514 break;
1516 case 45:
1517 #line 375 "jv-exp.y"
1518 { write_exp_elt_opcode (OP_ARRAY);
1519 write_exp_elt_longcst ((LONGEST) 0);
1520 write_exp_elt_longcst ((LONGEST) yyvsp[0].lval);
1521 write_exp_elt_opcode (OP_ARRAY); }
1522 break;
1524 case 46:
1525 #line 383 "jv-exp.y"
1526 { start_arglist (); }
1527 break;
1529 case 47:
1530 #line 388 "jv-exp.y"
1531 { yyval.lval = end_arglist () - 1; }
1532 break;
1534 case 48:
1535 #line 393 "jv-exp.y"
1536 { internal_error (__FILE__, __LINE__,
1537 _("FIXME - ClassInstanceCreationExpression")); }
1538 break;
1540 case 49:
1541 #line 399 "jv-exp.y"
1542 { arglist_len = 1; }
1543 break;
1545 case 50:
1546 #line 401 "jv-exp.y"
1547 { arglist_len++; }
1548 break;
1550 case 51:
1551 #line 406 "jv-exp.y"
1552 { arglist_len = 0; }
1553 break;
1555 case 53:
1556 #line 412 "jv-exp.y"
1557 { internal_error (__FILE__, __LINE__,
1558 _("FIXME - ArrayCreationExpression")); }
1559 break;
1561 case 54:
1562 #line 415 "jv-exp.y"
1563 { internal_error (__FILE__, __LINE__,
1564 _("FIXME - ArrayCreationExpression")); }
1565 break;
1567 case 58:
1568 #line 430 "jv-exp.y"
1569 { yyval.lval = 1; }
1570 break;
1572 case 59:
1573 #line 432 "jv-exp.y"
1574 { yyval.lval = yyvsp[-2].lval + 1; }
1575 break;
1577 case 61:
1578 #line 438 "jv-exp.y"
1579 { yyval.lval = 0; }
1580 break;
1582 case 62:
1583 #line 443 "jv-exp.y"
1584 { push_fieldnames (yyvsp[0].sval); }
1585 break;
1587 case 63:
1588 #line 445 "jv-exp.y"
1589 { push_fieldnames (yyvsp[0].sval); }
1590 break;
1592 case 64:
1593 #line 451 "jv-exp.y"
1594 { error (_("Method invocation not implemented")); }
1595 break;
1597 case 65:
1598 #line 453 "jv-exp.y"
1599 { error (_("Method invocation not implemented")); }
1600 break;
1602 case 66:
1603 #line 455 "jv-exp.y"
1604 { error (_("Method invocation not implemented")); }
1605 break;
1607 case 67:
1608 #line 460 "jv-exp.y"
1610 /* Emit code for the Name now, then exchange it in the
1611 expout array with the Expression's code. We could
1612 introduce a OP_SWAP code or a reversed version of
1613 BINOP_SUBSCRIPT, but that makes the rest of GDB pay
1614 for our parsing kludges. */
1615 struct expression *name_expr;
1617 push_expression_name (yyvsp[-3].sval);
1618 name_expr = copy_exp (expout, expout_ptr);
1619 expout_ptr -= name_expr->nelts;
1620 insert_exp (expout_ptr-length_of_subexp (expout, expout_ptr),
1621 name_expr);
1622 free (name_expr);
1623 write_exp_elt_opcode (BINOP_SUBSCRIPT);
1625 break;
1627 case 68:
1628 #line 477 "jv-exp.y"
1629 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1630 break;
1632 case 69:
1633 #line 479 "jv-exp.y"
1634 { write_exp_elt_opcode (BINOP_SUBSCRIPT); }
1635 break;
1637 case 71:
1638 #line 485 "jv-exp.y"
1639 { push_expression_name (yyvsp[0].sval); }
1640 break;
1642 case 75:
1643 #line 494 "jv-exp.y"
1644 { write_exp_elt_opcode (UNOP_POSTINCREMENT); }
1645 break;
1647 case 76:
1648 #line 499 "jv-exp.y"
1649 { write_exp_elt_opcode (UNOP_POSTDECREMENT); }
1650 break;
1652 case 80:
1653 #line 507 "jv-exp.y"
1654 { write_exp_elt_opcode (UNOP_NEG); }
1655 break;
1657 case 81:
1658 #line 509 "jv-exp.y"
1659 { write_exp_elt_opcode (UNOP_IND); }
1660 break;
1662 case 83:
1663 #line 515 "jv-exp.y"
1664 { write_exp_elt_opcode (UNOP_PREINCREMENT); }
1665 break;
1667 case 84:
1668 #line 520 "jv-exp.y"
1669 { write_exp_elt_opcode (UNOP_PREDECREMENT); }
1670 break;
1672 case 86:
1673 #line 526 "jv-exp.y"
1674 { write_exp_elt_opcode (UNOP_COMPLEMENT); }
1675 break;
1677 case 87:
1678 #line 528 "jv-exp.y"
1679 { write_exp_elt_opcode (UNOP_LOGICAL_NOT); }
1680 break;
1682 case 89:
1683 #line 534 "jv-exp.y"
1684 { write_exp_elt_opcode (UNOP_CAST);
1685 write_exp_elt_type (java_array_type (yyvsp[-3].tval, yyvsp[-2].lval));
1686 write_exp_elt_opcode (UNOP_CAST); }
1687 break;
1689 case 90:
1690 #line 538 "jv-exp.y"
1692 int exp_size = expout_ptr;
1693 int last_exp_size = length_of_subexp(expout, expout_ptr);
1694 struct type *type;
1695 int i;
1696 int base = expout_ptr - last_exp_size - 3;
1697 if (base < 0 || expout->elts[base+2].opcode != OP_TYPE)
1698 error (_("Invalid cast expression"));
1699 type = expout->elts[base+1].type;
1700 /* Remove the 'Expression' and slide the
1701 UnaryExpressionNotPlusMinus down to replace it. */
1702 for (i = 0; i < last_exp_size; i++)
1703 expout->elts[base + i] = expout->elts[base + i + 3];
1704 expout_ptr -= 3;
1705 if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
1706 type = lookup_pointer_type (type);
1707 write_exp_elt_opcode (UNOP_CAST);
1708 write_exp_elt_type (type);
1709 write_exp_elt_opcode (UNOP_CAST);
1711 break;
1713 case 91:
1714 #line 559 "jv-exp.y"
1715 { write_exp_elt_opcode (UNOP_CAST);
1716 write_exp_elt_type (java_array_type (java_type_from_name (yyvsp[-3].sval), yyvsp[-2].lval));
1717 write_exp_elt_opcode (UNOP_CAST); }
1718 break;
1720 case 93:
1721 #line 568 "jv-exp.y"
1722 { write_exp_elt_opcode (BINOP_MUL); }
1723 break;
1725 case 94:
1726 #line 570 "jv-exp.y"
1727 { write_exp_elt_opcode (BINOP_DIV); }
1728 break;
1730 case 95:
1731 #line 572 "jv-exp.y"
1732 { write_exp_elt_opcode (BINOP_REM); }
1733 break;
1735 case 97:
1736 #line 578 "jv-exp.y"
1737 { write_exp_elt_opcode (BINOP_ADD); }
1738 break;
1740 case 98:
1741 #line 580 "jv-exp.y"
1742 { write_exp_elt_opcode (BINOP_SUB); }
1743 break;
1745 case 100:
1746 #line 586 "jv-exp.y"
1747 { write_exp_elt_opcode (BINOP_LSH); }
1748 break;
1750 case 101:
1751 #line 588 "jv-exp.y"
1752 { write_exp_elt_opcode (BINOP_RSH); }
1753 break;
1755 case 103:
1756 #line 595 "jv-exp.y"
1757 { write_exp_elt_opcode (BINOP_LESS); }
1758 break;
1760 case 104:
1761 #line 597 "jv-exp.y"
1762 { write_exp_elt_opcode (BINOP_GTR); }
1763 break;
1765 case 105:
1766 #line 599 "jv-exp.y"
1767 { write_exp_elt_opcode (BINOP_LEQ); }
1768 break;
1770 case 106:
1771 #line 601 "jv-exp.y"
1772 { write_exp_elt_opcode (BINOP_GEQ); }
1773 break;
1775 case 108:
1776 #line 608 "jv-exp.y"
1777 { write_exp_elt_opcode (BINOP_EQUAL); }
1778 break;
1780 case 109:
1781 #line 610 "jv-exp.y"
1782 { write_exp_elt_opcode (BINOP_NOTEQUAL); }
1783 break;
1785 case 111:
1786 #line 616 "jv-exp.y"
1787 { write_exp_elt_opcode (BINOP_BITWISE_AND); }
1788 break;
1790 case 113:
1791 #line 622 "jv-exp.y"
1792 { write_exp_elt_opcode (BINOP_BITWISE_XOR); }
1793 break;
1795 case 115:
1796 #line 627 "jv-exp.y"
1797 { write_exp_elt_opcode (BINOP_BITWISE_IOR); }
1798 break;
1800 case 117:
1801 #line 633 "jv-exp.y"
1802 { write_exp_elt_opcode (BINOP_LOGICAL_AND); }
1803 break;
1805 case 119:
1806 #line 639 "jv-exp.y"
1807 { write_exp_elt_opcode (BINOP_LOGICAL_OR); }
1808 break;
1810 case 121:
1811 #line 645 "jv-exp.y"
1812 { write_exp_elt_opcode (TERNOP_COND); }
1813 break;
1815 case 124:
1816 #line 655 "jv-exp.y"
1817 { write_exp_elt_opcode (BINOP_ASSIGN); }
1818 break;
1820 case 125:
1821 #line 657 "jv-exp.y"
1822 { write_exp_elt_opcode (BINOP_ASSIGN_MODIFY);
1823 write_exp_elt_opcode (yyvsp[-1].opcode);
1824 write_exp_elt_opcode (BINOP_ASSIGN_MODIFY); }
1825 break;
1827 case 126:
1828 #line 664 "jv-exp.y"
1829 { push_expression_name (yyvsp[0].sval); }
1830 break;
1835 /* Line 991 of yacc.c. */
1837 yyvsp -= yylen;
1838 yyssp -= yylen;
1841 YY_STACK_PRINT (yyss, yyssp);
1843 *++yyvsp = yyval;
1846 /* Now `shift' the result of the reduction. Determine what state
1847 that goes to, based on the state we popped back to and the rule
1848 number reduced by. */
1850 yyn = yyr1[yyn];
1852 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1853 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1854 yystate = yytable[yystate];
1855 else
1856 yystate = yydefgoto[yyn - YYNTOKENS];
1858 goto yynewstate;
1861 /*------------------------------------.
1862 | yyerrlab -- here on detecting error |
1863 `------------------------------------*/
1864 yyerrlab:
1865 /* If not already recovering from an error, report this error. */
1866 if (!yyerrstatus)
1868 ++yynerrs;
1869 #if YYERROR_VERBOSE
1870 yyn = yypact[yystate];
1872 if (YYPACT_NINF < yyn && yyn < YYLAST)
1874 YYSIZE_T yysize = 0;
1875 int yytype = YYTRANSLATE (yychar);
1876 char *yymsg;
1877 int yyx, yycount;
1879 yycount = 0;
1880 /* Start YYX at -YYN if negative to avoid negative indexes in
1881 YYCHECK. */
1882 for (yyx = yyn < 0 ? -yyn : 0;
1883 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1884 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1885 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1886 yysize += yystrlen ("syntax error, unexpected ") + 1;
1887 yysize += yystrlen (yytname[yytype]);
1888 yymsg = (char *) YYSTACK_ALLOC (yysize);
1889 if (yymsg != 0)
1891 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1892 yyp = yystpcpy (yyp, yytname[yytype]);
1894 if (yycount < 5)
1896 yycount = 0;
1897 for (yyx = yyn < 0 ? -yyn : 0;
1898 yyx < (int) (sizeof (yytname) / sizeof (char *));
1899 yyx++)
1900 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1902 const char *yyq = ! yycount ? ", expecting " : " or ";
1903 yyp = yystpcpy (yyp, yyq);
1904 yyp = yystpcpy (yyp, yytname[yyx]);
1905 yycount++;
1908 yyerror (yymsg);
1909 YYSTACK_FREE (yymsg);
1911 else
1912 yyerror ("syntax error; also virtual memory exhausted");
1914 else
1915 #endif /* YYERROR_VERBOSE */
1916 yyerror ("syntax error");
1921 if (yyerrstatus == 3)
1923 /* If just tried and failed to reuse lookahead token after an
1924 error, discard it. */
1926 /* Return failure if at end of input. */
1927 if (yychar == YYEOF)
1929 /* Pop the error token. */
1930 YYPOPSTACK;
1931 /* Pop the rest of the stack. */
1932 while (yyss < yyssp)
1934 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1935 yydestruct (yystos[*yyssp], yyvsp);
1936 YYPOPSTACK;
1938 YYABORT;
1941 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1942 yydestruct (yytoken, &yylval);
1943 yychar = YYEMPTY;
1947 /* Else will try to reuse lookahead token after shifting the error
1948 token. */
1949 goto yyerrlab2;
1952 /*----------------------------------------------------.
1953 | yyerrlab1 -- error raised explicitly by an action. |
1954 `----------------------------------------------------*/
1955 yyerrlab1:
1957 /* Suppress GCC warning that yyerrlab1 is unused when no action
1958 invokes YYERROR. MacOS 10.2.3's buggy "smart preprocessor"
1959 insists on the trailing semicolon. */
1960 #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1961 __attribute__ ((__unused__));
1962 #endif
1965 goto yyerrlab2;
1968 /*---------------------------------------------------------------.
1969 | yyerrlab2 -- pop states until the error token can be shifted. |
1970 `---------------------------------------------------------------*/
1971 yyerrlab2:
1972 yyerrstatus = 3; /* Each real token shifted decrements this. */
1974 for (;;)
1976 yyn = yypact[yystate];
1977 if (yyn != YYPACT_NINF)
1979 yyn += YYTERROR;
1980 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1982 yyn = yytable[yyn];
1983 if (0 < yyn)
1984 break;
1988 /* Pop the current state because it cannot handle the error token. */
1989 if (yyssp == yyss)
1990 YYABORT;
1992 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1993 yydestruct (yystos[yystate], yyvsp);
1994 yyvsp--;
1995 yystate = *--yyssp;
1997 YY_STACK_PRINT (yyss, yyssp);
2000 if (yyn == YYFINAL)
2001 YYACCEPT;
2003 YYDPRINTF ((stderr, "Shifting error token, "));
2005 *++yyvsp = yylval;
2008 yystate = yyn;
2009 goto yynewstate;
2012 /*-------------------------------------.
2013 | yyacceptlab -- YYACCEPT comes here. |
2014 `-------------------------------------*/
2015 yyacceptlab:
2016 yyresult = 0;
2017 goto yyreturn;
2019 /*-----------------------------------.
2020 | yyabortlab -- YYABORT comes here. |
2021 `-----------------------------------*/
2022 yyabortlab:
2023 yyresult = 1;
2024 goto yyreturn;
2026 #ifndef yyoverflow
2027 /*----------------------------------------------.
2028 | yyoverflowlab -- parser overflow comes here. |
2029 `----------------------------------------------*/
2030 yyoverflowlab:
2031 yyerror ("parser stack overflow");
2032 yyresult = 2;
2033 /* Fall through. */
2034 #endif
2036 yyreturn:
2037 #ifndef yyoverflow
2038 if (yyss != yyssa)
2039 YYSTACK_FREE (yyss);
2040 #endif
2041 return yyresult;
2045 #line 676 "jv-exp.y"
2047 /* Take care of parsing a number (anything that starts with a digit).
2048 Set yylval and return the token type; update lexptr.
2049 LEN is the number of characters in it. */
2051 /*** Needs some error checking for the float case ***/
2053 static int
2054 parse_number (p, len, parsed_float, putithere)
2055 char *p;
2056 int len;
2057 int parsed_float;
2058 YYSTYPE *putithere;
2060 ULONGEST n = 0;
2061 ULONGEST limit, limit_div_base;
2063 int c;
2064 int base = input_radix;
2066 struct type *type;
2068 if (parsed_float)
2070 /* It's a float since it contains a point or an exponent. */
2071 char c;
2072 int num = 0; /* number of tokens scanned by scanf */
2073 char saved_char = p[len];
2075 p[len] = 0; /* null-terminate the token */
2076 if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
2077 num = sscanf (p, "%g%c", (float *) &putithere->typed_val_float.dval, &c);
2078 else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
2079 num = sscanf (p, "%lg%c", (double *) &putithere->typed_val_float.dval, &c);
2080 else
2082 #ifdef SCANF_HAS_LONG_DOUBLE
2083 num = sscanf (p, "%Lg%c", &putithere->typed_val_float.dval, &c);
2084 #else
2085 /* Scan it into a double, then assign it to the long double.
2086 This at least wins with values representable in the range
2087 of doubles. */
2088 double temp;
2089 num = sscanf (p, "%lg%c", &temp, &c);
2090 putithere->typed_val_float.dval = temp;
2091 #endif
2093 p[len] = saved_char; /* restore the input stream */
2094 if (num != 1) /* check scanf found ONLY a float ... */
2095 return ERROR;
2096 /* See if it has `f' or `d' suffix (float or double). */
2098 c = tolower (p[len - 1]);
2100 if (c == 'f' || c == 'F')
2101 putithere->typed_val_float.type = builtin_type_float;
2102 else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
2103 putithere->typed_val_float.type = builtin_type_double;
2104 else
2105 return ERROR;
2107 return FLOATING_POINT_LITERAL;
2110 /* Handle base-switching prefixes 0x, 0t, 0d, 0 */
2111 if (p[0] == '0')
2112 switch (p[1])
2114 case 'x':
2115 case 'X':
2116 if (len >= 3)
2118 p += 2;
2119 base = 16;
2120 len -= 2;
2122 break;
2124 case 't':
2125 case 'T':
2126 case 'd':
2127 case 'D':
2128 if (len >= 3)
2130 p += 2;
2131 base = 10;
2132 len -= 2;
2134 break;
2136 default:
2137 base = 8;
2138 break;
2141 c = p[len-1];
2142 /* A paranoid calculation of (1<<64)-1. */
2143 limit = (ULONGEST)0xffffffff;
2144 limit = ((limit << 16) << 16) | limit;
2145 if (c == 'l' || c == 'L')
2147 type = java_long_type;
2148 len--;
2150 else
2152 type = java_int_type;
2154 limit_div_base = limit / (ULONGEST) base;
2156 while (--len >= 0)
2158 c = *p++;
2159 if (c >= '0' && c <= '9')
2160 c -= '0';
2161 else if (c >= 'A' && c <= 'Z')
2162 c -= 'A' - 10;
2163 else if (c >= 'a' && c <= 'z')
2164 c -= 'a' - 10;
2165 else
2166 return ERROR; /* Char not a digit */
2167 if (c >= base)
2168 return ERROR;
2169 if (n > limit_div_base
2170 || (n *= base) > limit - c)
2171 error (_("Numeric constant too large"));
2172 n += c;
2175 /* If the type is bigger than a 32-bit signed integer can be, implicitly
2176 promote to long. Java does not do this, so mark it as builtin_type_uint64
2177 rather than java_long_type. 0x80000000 will become -0x80000000 instead
2178 of 0x80000000L, because we don't know the sign at this point.
2180 if (type == java_int_type && n > (ULONGEST)0x80000000)
2181 type = builtin_type_uint64;
2183 putithere->typed_val_int.val = n;
2184 putithere->typed_val_int.type = type;
2186 return INTEGER_LITERAL;
2189 struct token
2191 char *operator;
2192 int token;
2193 enum exp_opcode opcode;
2196 static const struct token tokentab3[] =
2198 {">>=", ASSIGN_MODIFY, BINOP_RSH},
2199 {"<<=", ASSIGN_MODIFY, BINOP_LSH}
2202 static const struct token tokentab2[] =
2204 {"+=", ASSIGN_MODIFY, BINOP_ADD},
2205 {"-=", ASSIGN_MODIFY, BINOP_SUB},
2206 {"*=", ASSIGN_MODIFY, BINOP_MUL},
2207 {"/=", ASSIGN_MODIFY, BINOP_DIV},
2208 {"%=", ASSIGN_MODIFY, BINOP_REM},
2209 {"|=", ASSIGN_MODIFY, BINOP_BITWISE_IOR},
2210 {"&=", ASSIGN_MODIFY, BINOP_BITWISE_AND},
2211 {"^=", ASSIGN_MODIFY, BINOP_BITWISE_XOR},
2212 {"++", INCREMENT, BINOP_END},
2213 {"--", DECREMENT, BINOP_END},
2214 {"&&", ANDAND, BINOP_END},
2215 {"||", OROR, BINOP_END},
2216 {"<<", LSH, BINOP_END},
2217 {">>", RSH, BINOP_END},
2218 {"==", EQUAL, BINOP_END},
2219 {"!=", NOTEQUAL, BINOP_END},
2220 {"<=", LEQ, BINOP_END},
2221 {">=", GEQ, BINOP_END}
2224 /* Read one token, getting characters through lexptr. */
2226 static int
2227 yylex ()
2229 int c;
2230 int namelen;
2231 unsigned int i;
2232 char *tokstart;
2233 char *tokptr;
2234 int tempbufindex;
2235 static char *tempbuf;
2236 static int tempbufsize;
2238 retry:
2240 prev_lexptr = lexptr;
2242 tokstart = lexptr;
2243 /* See if it is a special token of length 3. */
2244 for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
2245 if (strncmp (tokstart, tokentab3[i].operator, 3) == 0)
2247 lexptr += 3;
2248 yylval.opcode = tokentab3[i].opcode;
2249 return tokentab3[i].token;
2252 /* See if it is a special token of length 2. */
2253 for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++)
2254 if (strncmp (tokstart, tokentab2[i].operator, 2) == 0)
2256 lexptr += 2;
2257 yylval.opcode = tokentab2[i].opcode;
2258 return tokentab2[i].token;
2261 switch (c = *tokstart)
2263 case 0:
2264 return 0;
2266 case ' ':
2267 case '\t':
2268 case '\n':
2269 lexptr++;
2270 goto retry;
2272 case '\'':
2273 /* We either have a character constant ('0' or '\177' for example)
2274 or we have a quoted symbol reference ('foo(int,int)' in C++
2275 for example). */
2276 lexptr++;
2277 c = *lexptr++;
2278 if (c == '\\')
2279 c = parse_escape (&lexptr);
2280 else if (c == '\'')
2281 error (_("Empty character constant"));
2283 yylval.typed_val_int.val = c;
2284 yylval.typed_val_int.type = java_char_type;
2286 c = *lexptr++;
2287 if (c != '\'')
2289 namelen = skip_quoted (tokstart) - tokstart;
2290 if (namelen > 2)
2292 lexptr = tokstart + namelen;
2293 if (lexptr[-1] != '\'')
2294 error (_("Unmatched single quote"));
2295 namelen -= 2;
2296 tokstart++;
2297 goto tryname;
2299 error (_("Invalid character constant"));
2301 return INTEGER_LITERAL;
2303 case '(':
2304 paren_depth++;
2305 lexptr++;
2306 return c;
2308 case ')':
2309 if (paren_depth == 0)
2310 return 0;
2311 paren_depth--;
2312 lexptr++;
2313 return c;
2315 case ',':
2316 if (comma_terminates && paren_depth == 0)
2317 return 0;
2318 lexptr++;
2319 return c;
2321 case '.':
2322 /* Might be a floating point number. */
2323 if (lexptr[1] < '0' || lexptr[1] > '9')
2324 goto symbol; /* Nope, must be a symbol. */
2325 /* FALL THRU into number case. */
2327 case '0':
2328 case '1':
2329 case '2':
2330 case '3':
2331 case '4':
2332 case '5':
2333 case '6':
2334 case '7':
2335 case '8':
2336 case '9':
2338 /* It's a number. */
2339 int got_dot = 0, got_e = 0, toktype;
2340 char *p = tokstart;
2341 int hex = input_radix > 10;
2343 if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
2345 p += 2;
2346 hex = 1;
2348 else if (c == '0' && (p[1]=='t' || p[1]=='T' || p[1]=='d' || p[1]=='D'))
2350 p += 2;
2351 hex = 0;
2354 for (;; ++p)
2356 /* This test includes !hex because 'e' is a valid hex digit
2357 and thus does not indicate a floating point number when
2358 the radix is hex. */
2359 if (!hex && !got_e && (*p == 'e' || *p == 'E'))
2360 got_dot = got_e = 1;
2361 /* This test does not include !hex, because a '.' always indicates
2362 a decimal floating point number regardless of the radix. */
2363 else if (!got_dot && *p == '.')
2364 got_dot = 1;
2365 else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
2366 && (*p == '-' || *p == '+'))
2367 /* This is the sign of the exponent, not the end of the
2368 number. */
2369 continue;
2370 /* We will take any letters or digits. parse_number will
2371 complain if past the radix, or if L or U are not final. */
2372 else if ((*p < '0' || *p > '9')
2373 && ((*p < 'a' || *p > 'z')
2374 && (*p < 'A' || *p > 'Z')))
2375 break;
2377 toktype = parse_number (tokstart, p - tokstart, got_dot|got_e, &yylval);
2378 if (toktype == ERROR)
2380 char *err_copy = (char *) alloca (p - tokstart + 1);
2382 memcpy (err_copy, tokstart, p - tokstart);
2383 err_copy[p - tokstart] = 0;
2384 error (_("Invalid number \"%s\""), err_copy);
2386 lexptr = p;
2387 return toktype;
2390 case '+':
2391 case '-':
2392 case '*':
2393 case '/':
2394 case '%':
2395 case '|':
2396 case '&':
2397 case '^':
2398 case '~':
2399 case '!':
2400 case '<':
2401 case '>':
2402 case '[':
2403 case ']':
2404 case '?':
2405 case ':':
2406 case '=':
2407 case '{':
2408 case '}':
2409 symbol:
2410 lexptr++;
2411 return c;
2413 case '"':
2415 /* Build the gdb internal form of the input string in tempbuf,
2416 translating any standard C escape forms seen. Note that the
2417 buffer is null byte terminated *only* for the convenience of
2418 debugging gdb itself and printing the buffer contents when
2419 the buffer contains no embedded nulls. Gdb does not depend
2420 upon the buffer being null byte terminated, it uses the length
2421 string instead. This allows gdb to handle C strings (as well
2422 as strings in other languages) with embedded null bytes */
2424 tokptr = ++tokstart;
2425 tempbufindex = 0;
2427 do {
2428 /* Grow the static temp buffer if necessary, including allocating
2429 the first one on demand. */
2430 if (tempbufindex + 1 >= tempbufsize)
2432 tempbuf = (char *) xrealloc (tempbuf, tempbufsize += 64);
2434 switch (*tokptr)
2436 case '\0':
2437 case '"':
2438 /* Do nothing, loop will terminate. */
2439 break;
2440 case '\\':
2441 tokptr++;
2442 c = parse_escape (&tokptr);
2443 if (c == -1)
2445 continue;
2447 tempbuf[tempbufindex++] = c;
2448 break;
2449 default:
2450 tempbuf[tempbufindex++] = *tokptr++;
2451 break;
2453 } while ((*tokptr != '"') && (*tokptr != '\0'));
2454 if (*tokptr++ != '"')
2456 error (_("Unterminated string in expression"));
2458 tempbuf[tempbufindex] = '\0'; /* See note above */
2459 yylval.sval.ptr = tempbuf;
2460 yylval.sval.length = tempbufindex;
2461 lexptr = tokptr;
2462 return (STRING_LITERAL);
2465 if (!(c == '_' || c == '$'
2466 || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
2467 /* We must have come across a bad character (e.g. ';'). */
2468 error (_("Invalid character '%c' in expression"), c);
2470 /* It's a name. See how long it is. */
2471 namelen = 0;
2472 for (c = tokstart[namelen];
2473 (c == '_'
2474 || c == '$'
2475 || (c >= '0' && c <= '9')
2476 || (c >= 'a' && c <= 'z')
2477 || (c >= 'A' && c <= 'Z')
2478 || c == '<');
2481 if (c == '<')
2483 int i = namelen;
2484 while (tokstart[++i] && tokstart[i] != '>');
2485 if (tokstart[i] == '>')
2486 namelen = i;
2488 c = tokstart[++namelen];
2491 /* The token "if" terminates the expression and is NOT
2492 removed from the input stream. */
2493 if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
2495 return 0;
2498 lexptr += namelen;
2500 tryname:
2502 /* Catch specific keywords. Should be done with a data structure. */
2503 switch (namelen)
2505 case 7:
2506 if (DEPRECATED_STREQN (tokstart, "boolean", 7))
2507 return BOOLEAN;
2508 break;
2509 case 6:
2510 if (DEPRECATED_STREQN (tokstart, "double", 6))
2511 return DOUBLE;
2512 break;
2513 case 5:
2514 if (DEPRECATED_STREQN (tokstart, "short", 5))
2515 return SHORT;
2516 if (DEPRECATED_STREQN (tokstart, "false", 5))
2518 yylval.lval = 0;
2519 return BOOLEAN_LITERAL;
2521 if (DEPRECATED_STREQN (tokstart, "super", 5))
2522 return SUPER;
2523 if (DEPRECATED_STREQN (tokstart, "float", 5))
2524 return FLOAT;
2525 break;
2526 case 4:
2527 if (DEPRECATED_STREQN (tokstart, "long", 4))
2528 return LONG;
2529 if (DEPRECATED_STREQN (tokstart, "byte", 4))
2530 return BYTE;
2531 if (DEPRECATED_STREQN (tokstart, "char", 4))
2532 return CHAR;
2533 if (DEPRECATED_STREQN (tokstart, "true", 4))
2535 yylval.lval = 1;
2536 return BOOLEAN_LITERAL;
2538 break;
2539 case 3:
2540 if (strncmp (tokstart, "int", 3) == 0)
2541 return INT;
2542 if (strncmp (tokstart, "new", 3) == 0)
2543 return NEW;
2544 break;
2545 default:
2546 break;
2549 yylval.sval.ptr = tokstart;
2550 yylval.sval.length = namelen;
2552 if (*tokstart == '$')
2554 write_dollar_variable (yylval.sval);
2555 return VARIABLE;
2558 /* Input names that aren't symbols but ARE valid hex numbers,
2559 when the input radix permits them, can be names or numbers
2560 depending on the parse. Note we support radixes > 16 here. */
2561 if (((tokstart[0] >= 'a' && tokstart[0] < 'a' + input_radix - 10) ||
2562 (tokstart[0] >= 'A' && tokstart[0] < 'A' + input_radix - 10)))
2564 YYSTYPE newlval; /* Its value is ignored. */
2565 int hextype = parse_number (tokstart, namelen, 0, &newlval);
2566 if (hextype == INTEGER_LITERAL)
2567 return NAME_OR_INT;
2569 return IDENTIFIER;
2572 void
2573 yyerror (msg)
2574 char *msg;
2576 if (prev_lexptr)
2577 lexptr = prev_lexptr;
2579 if (msg)
2580 error (_("%s: near `%s'"), msg, lexptr);
2581 else
2582 error (_("error in expression, near `%s'"), lexptr);
2585 static struct type *
2586 java_type_from_name (name)
2587 struct stoken name;
2590 char *tmp = copy_name (name);
2591 struct type *typ = java_lookup_class (tmp);
2592 if (typ == NULL || TYPE_CODE (typ) != TYPE_CODE_STRUCT)
2593 error (_("No class named `%s'"), tmp);
2594 return typ;
2597 /* If NAME is a valid variable name in this scope, push it and return 1.
2598 Otherwise, return 0. */
2600 static int
2601 push_variable (struct stoken name)
2603 char *tmp = copy_name (name);
2604 int is_a_field_of_this = 0;
2605 struct symbol *sym;
2606 sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN,
2607 &is_a_field_of_this, (struct symtab **) NULL);
2608 if (sym && SYMBOL_CLASS (sym) != LOC_TYPEDEF)
2610 if (symbol_read_needs_frame (sym))
2612 if (innermost_block == 0 ||
2613 contained_in (block_found, innermost_block))
2614 innermost_block = block_found;
2617 write_exp_elt_opcode (OP_VAR_VALUE);
2618 /* We want to use the selected frame, not another more inner frame
2619 which happens to be in the same block. */
2620 write_exp_elt_block (NULL);
2621 write_exp_elt_sym (sym);
2622 write_exp_elt_opcode (OP_VAR_VALUE);
2623 return 1;
2625 if (is_a_field_of_this)
2627 /* it hangs off of `this'. Must not inadvertently convert from a
2628 method call to data ref. */
2629 if (innermost_block == 0 ||
2630 contained_in (block_found, innermost_block))
2631 innermost_block = block_found;
2632 write_exp_elt_opcode (OP_THIS);
2633 write_exp_elt_opcode (OP_THIS);
2634 write_exp_elt_opcode (STRUCTOP_PTR);
2635 write_exp_string (name);
2636 write_exp_elt_opcode (STRUCTOP_PTR);
2637 return 1;
2639 return 0;
2642 /* Assuming a reference expression has been pushed, emit the
2643 STRUCTOP_STRUCT ops to access the field named NAME. If NAME is a
2644 qualified name (has '.'), generate a field access for each part. */
2646 static void
2647 push_fieldnames (name)
2648 struct stoken name;
2650 int i;
2651 struct stoken token;
2652 token.ptr = name.ptr;
2653 for (i = 0; ; i++)
2655 if (i == name.length || name.ptr[i] == '.')
2657 /* token.ptr is start of current field name. */
2658 token.length = &name.ptr[i] - token.ptr;
2659 write_exp_elt_opcode (STRUCTOP_STRUCT);
2660 write_exp_string (token);
2661 write_exp_elt_opcode (STRUCTOP_STRUCT);
2662 token.ptr += token.length + 1;
2664 if (i >= name.length)
2665 break;
2669 /* Helper routine for push_expression_name.
2670 Handle a qualified name, where DOT_INDEX is the index of the first '.' */
2672 static void
2673 push_qualified_expression_name (struct stoken name, int dot_index)
2675 struct stoken token;
2676 char *tmp;
2677 struct type *typ;
2679 token.ptr = name.ptr;
2680 token.length = dot_index;
2682 if (push_variable (token))
2684 token.ptr = name.ptr + dot_index + 1;
2685 token.length = name.length - dot_index - 1;
2686 push_fieldnames (token);
2687 return;
2690 token.ptr = name.ptr;
2691 for (;;)
2693 token.length = dot_index;
2694 tmp = copy_name (token);
2695 typ = java_lookup_class (tmp);
2696 if (typ != NULL)
2698 if (dot_index == name.length)
2700 write_exp_elt_opcode(OP_TYPE);
2701 write_exp_elt_type(typ);
2702 write_exp_elt_opcode(OP_TYPE);
2703 return;
2705 dot_index++; /* Skip '.' */
2706 name.ptr += dot_index;
2707 name.length -= dot_index;
2708 dot_index = 0;
2709 while (dot_index < name.length && name.ptr[dot_index] != '.')
2710 dot_index++;
2711 token.ptr = name.ptr;
2712 token.length = dot_index;
2713 write_exp_elt_opcode (OP_SCOPE);
2714 write_exp_elt_type (typ);
2715 write_exp_string (token);
2716 write_exp_elt_opcode (OP_SCOPE);
2717 if (dot_index < name.length)
2719 dot_index++;
2720 name.ptr += dot_index;
2721 name.length -= dot_index;
2722 push_fieldnames (name);
2724 return;
2726 else if (dot_index >= name.length)
2727 break;
2728 dot_index++; /* Skip '.' */
2729 while (dot_index < name.length && name.ptr[dot_index] != '.')
2730 dot_index++;
2732 error (_("unknown type `%.*s'"), name.length, name.ptr);
2735 /* Handle Name in an expression (or LHS).
2736 Handle VAR, TYPE, TYPE.FIELD1....FIELDN and VAR.FIELD1....FIELDN. */
2738 static void
2739 push_expression_name (name)
2740 struct stoken name;
2742 char *tmp;
2743 struct type *typ;
2744 char *ptr;
2745 int i;
2747 for (i = 0; i < name.length; i++)
2749 if (name.ptr[i] == '.')
2751 /* It's a Qualified Expression Name. */
2752 push_qualified_expression_name (name, i);
2753 return;
2757 /* It's a Simple Expression Name. */
2759 if (push_variable (name))
2760 return;
2761 tmp = copy_name (name);
2762 typ = java_lookup_class (tmp);
2763 if (typ != NULL)
2765 write_exp_elt_opcode(OP_TYPE);
2766 write_exp_elt_type(typ);
2767 write_exp_elt_opcode(OP_TYPE);
2769 else
2771 struct minimal_symbol *msymbol;
2773 msymbol = lookup_minimal_symbol (tmp, NULL, NULL);
2774 if (msymbol != NULL)
2776 write_exp_msymbol (msymbol,
2777 lookup_function_type (builtin_type_int),
2778 builtin_type_int);
2780 else if (!have_full_symbols () && !have_partial_symbols ())
2781 error (_("No symbol table is loaded. Use the \"file\" command"));
2782 else
2783 error (_("No symbol \"%s\" in current context"), tmp);
2789 /* The following two routines, copy_exp and insert_exp, aren't specific to
2790 Java, so they could go in parse.c, but their only purpose is to support
2791 the parsing kludges we use in this file, so maybe it's best to isolate
2792 them here. */
2794 /* Copy the expression whose last element is at index ENDPOS - 1 in EXPR
2795 into a freshly xmalloc'ed struct expression. Its language_defn is set
2796 to null. */
2797 static struct expression *
2798 copy_exp (expr, endpos)
2799 struct expression *expr;
2800 int endpos;
2802 int len = length_of_subexp (expr, endpos);
2803 struct expression *new
2804 = (struct expression *) xmalloc (sizeof (*new) + EXP_ELEM_TO_BYTES (len));
2805 new->nelts = len;
2806 memcpy (new->elts, expr->elts + endpos - len, EXP_ELEM_TO_BYTES (len));
2807 new->language_defn = 0;
2809 return new;
2812 /* Insert the expression NEW into the current expression (expout) at POS. */
2813 static void
2814 insert_exp (pos, new)
2815 int pos;
2816 struct expression *new;
2818 int newlen = new->nelts;
2820 /* Grow expout if necessary. In this function's only use at present,
2821 this should never be necessary. */
2822 if (expout_ptr + newlen > expout_size)
2824 expout_size = max (expout_size * 2, expout_ptr + newlen + 10);
2825 expout = (struct expression *)
2826 xrealloc ((char *) expout, (sizeof (struct expression)
2827 + EXP_ELEM_TO_BYTES (expout_size)));
2831 int i;
2833 for (i = expout_ptr - 1; i >= pos; i--)
2834 expout->elts[i + newlen] = expout->elts[i];
2837 memcpy (expout->elts + pos, new->elts, EXP_ELEM_TO_BYTES (newlen));
2838 expout_ptr += newlen;