NaCl changes
[nacl-binutils.git] / gas / m68k-parse.c
blobbe072c20cb287ca0a6497a760b24c836ab073100
1 /* A Bison parser, made by GNU Bison 2.3. */
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
46 /* Identify Bison output. */
47 #define YYBISON 1
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
55 /* Pure parsers. */
56 #define YYPURE 0
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
63 /* Tokens. */
64 #ifndef YYTOKENTYPE
65 # define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 DR = 258,
70 AR = 259,
71 FPR = 260,
72 FPCR = 261,
73 LPC = 262,
74 ZAR = 263,
75 ZDR = 264,
76 LZPC = 265,
77 CREG = 266,
78 INDEXREG = 267,
79 EXPR = 268
81 #endif
82 /* Tokens. */
83 #define DR 258
84 #define AR 259
85 #define FPR 260
86 #define FPCR 261
87 #define LPC 262
88 #define ZAR 263
89 #define ZDR 264
90 #define LZPC 265
91 #define CREG 266
92 #define INDEXREG 267
93 #define EXPR 268
98 /* Copy the first part of user declarations. */
99 #line 28 "m68k-parse.y"
102 #include "as.h"
103 #include "tc-m68k.h"
104 #include "m68k-parse.h"
105 #include "safe-ctype.h"
107 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
108 etc), as well as gratuitously global symbol names If other parser
109 generators (bison, byacc, etc) produce additional global names that
110 conflict at link time, then those parser generators need to be
111 fixed instead of adding those names to this list. */
113 #define yymaxdepth m68k_maxdepth
114 #define yyparse m68k_parse
115 #define yylex m68k_lex
116 #define yyerror m68k_error
117 #define yylval m68k_lval
118 #define yychar m68k_char
119 #define yydebug m68k_debug
120 #define yypact m68k_pact
121 #define yyr1 m68k_r1
122 #define yyr2 m68k_r2
123 #define yydef m68k_def
124 #define yychk m68k_chk
125 #define yypgo m68k_pgo
126 #define yyact m68k_act
127 #define yyexca m68k_exca
128 #define yyerrflag m68k_errflag
129 #define yynerrs m68k_nerrs
130 #define yyps m68k_ps
131 #define yypv m68k_pv
132 #define yys m68k_s
133 #define yy_yys m68k_yys
134 #define yystate m68k_state
135 #define yytmp m68k_tmp
136 #define yyv m68k_v
137 #define yy_yyv m68k_yyv
138 #define yyval m68k_val
139 #define yylloc m68k_lloc
140 #define yyreds m68k_reds /* With YYDEBUG defined */
141 #define yytoks m68k_toks /* With YYDEBUG defined */
142 #define yylhs m68k_yylhs
143 #define yylen m68k_yylen
144 #define yydefred m68k_yydefred
145 #define yydgoto m68k_yydgoto
146 #define yysindex m68k_yysindex
147 #define yyrindex m68k_yyrindex
148 #define yygindex m68k_yygindex
149 #define yytable m68k_yytable
150 #define yycheck m68k_yycheck
152 #ifndef YYDEBUG
153 #define YYDEBUG 1
154 #endif
156 /* Internal functions. */
158 static enum m68k_register m68k_reg_parse (char **);
159 static int yylex (void);
160 static void yyerror (const char *);
162 /* The parser sets fields pointed to by this global variable. */
163 static struct m68k_op *op;
167 /* Enabling traces. */
168 #ifndef YYDEBUG
169 # define YYDEBUG 0
170 #endif
172 /* Enabling verbose error messages. */
173 #ifdef YYERROR_VERBOSE
174 # undef YYERROR_VERBOSE
175 # define YYERROR_VERBOSE 1
176 #else
177 # define YYERROR_VERBOSE 0
178 #endif
180 /* Enabling the token table. */
181 #ifndef YYTOKEN_TABLE
182 # define YYTOKEN_TABLE 0
183 #endif
185 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
186 typedef union YYSTYPE
187 #line 96 "m68k-parse.y"
189 struct m68k_indexreg indexreg;
190 enum m68k_register reg;
191 struct m68k_exp exp;
192 unsigned long mask;
193 int onereg;
194 int trailing_ampersand;
196 /* Line 187 of yacc.c. */
197 #line 198 "m68k-parse.c"
198 YYSTYPE;
199 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
200 # define YYSTYPE_IS_DECLARED 1
201 # define YYSTYPE_IS_TRIVIAL 1
202 #endif
206 /* Copy the second part of user declarations. */
209 /* Line 216 of yacc.c. */
210 #line 211 "m68k-parse.c"
212 #ifdef short
213 # undef short
214 #endif
216 #ifdef YYTYPE_UINT8
217 typedef YYTYPE_UINT8 yytype_uint8;
218 #else
219 typedef unsigned char yytype_uint8;
220 #endif
222 #ifdef YYTYPE_INT8
223 typedef YYTYPE_INT8 yytype_int8;
224 #elif (defined __STDC__ || defined __C99__FUNC__ \
225 || defined __cplusplus || defined _MSC_VER)
226 typedef signed char yytype_int8;
227 #else
228 typedef short int yytype_int8;
229 #endif
231 #ifdef YYTYPE_UINT16
232 typedef YYTYPE_UINT16 yytype_uint16;
233 #else
234 typedef unsigned short int yytype_uint16;
235 #endif
237 #ifdef YYTYPE_INT16
238 typedef YYTYPE_INT16 yytype_int16;
239 #else
240 typedef short int yytype_int16;
241 #endif
243 #ifndef YYSIZE_T
244 # ifdef __SIZE_TYPE__
245 # define YYSIZE_T __SIZE_TYPE__
246 # elif defined size_t
247 # define YYSIZE_T size_t
248 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
249 || defined __cplusplus || defined _MSC_VER)
250 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
251 # define YYSIZE_T size_t
252 # else
253 # define YYSIZE_T unsigned int
254 # endif
255 #endif
257 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
259 #ifndef YY_
260 # if YYENABLE_NLS
261 # if ENABLE_NLS
262 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
263 # define YY_(msgid) dgettext ("bison-runtime", msgid)
264 # endif
265 # endif
266 # ifndef YY_
267 # define YY_(msgid) msgid
268 # endif
269 #endif
271 /* Suppress unused-variable warnings by "using" E. */
272 #if ! defined lint || defined __GNUC__
273 # define YYUSE(e) ((void) (e))
274 #else
275 # define YYUSE(e) /* empty */
276 #endif
278 /* Identity function, used to suppress warnings about constant conditions. */
279 #ifndef lint
280 # define YYID(n) (n)
281 #else
282 #if (defined __STDC__ || defined __C99__FUNC__ \
283 || defined __cplusplus || defined _MSC_VER)
284 static int
285 YYID (int i)
286 #else
287 static int
288 YYID (i)
289 int i;
290 #endif
292 return i;
294 #endif
296 #if ! defined yyoverflow || YYERROR_VERBOSE
298 /* The parser invokes alloca or malloc; define the necessary symbols. */
300 # ifdef YYSTACK_USE_ALLOCA
301 # if YYSTACK_USE_ALLOCA
302 # ifdef __GNUC__
303 # define YYSTACK_ALLOC __builtin_alloca
304 # elif defined __BUILTIN_VA_ARG_INCR
305 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
306 # elif defined _AIX
307 # define YYSTACK_ALLOC __alloca
308 # elif defined _MSC_VER
309 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
310 # define alloca _alloca
311 # else
312 # define YYSTACK_ALLOC alloca
313 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
314 || defined __cplusplus || defined _MSC_VER)
315 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
316 # ifndef _STDLIB_H
317 # define _STDLIB_H 1
318 # endif
319 # endif
320 # endif
321 # endif
322 # endif
324 # ifdef YYSTACK_ALLOC
325 /* Pacify GCC's `empty if-body' warning. */
326 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
327 # ifndef YYSTACK_ALLOC_MAXIMUM
328 /* The OS might guarantee only one guard page at the bottom of the stack,
329 and a page size can be as small as 4096 bytes. So we cannot safely
330 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
331 to allow for a few compiler-allocated temporary stack slots. */
332 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
333 # endif
334 # else
335 # define YYSTACK_ALLOC YYMALLOC
336 # define YYSTACK_FREE YYFREE
337 # ifndef YYSTACK_ALLOC_MAXIMUM
338 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
339 # endif
340 # if (defined __cplusplus && ! defined _STDLIB_H \
341 && ! ((defined YYMALLOC || defined malloc) \
342 && (defined YYFREE || defined free)))
343 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
344 # ifndef _STDLIB_H
345 # define _STDLIB_H 1
346 # endif
347 # endif
348 # ifndef YYMALLOC
349 # define YYMALLOC malloc
350 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
351 || defined __cplusplus || defined _MSC_VER)
352 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
353 # endif
354 # endif
355 # ifndef YYFREE
356 # define YYFREE free
357 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
358 || defined __cplusplus || defined _MSC_VER)
359 void free (void *); /* INFRINGES ON USER NAME SPACE */
360 # endif
361 # endif
362 # endif
363 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
366 #if (! defined yyoverflow \
367 && (! defined __cplusplus \
368 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
370 /* A type that is properly aligned for any stack member. */
371 union yyalloc
373 yytype_int16 yyss;
374 YYSTYPE yyvs;
377 /* The size of the maximum gap between one aligned stack and the next. */
378 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
380 /* The size of an array large to enough to hold all stacks, each with
381 N elements. */
382 # define YYSTACK_BYTES(N) \
383 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
384 + YYSTACK_GAP_MAXIMUM)
386 /* Copy COUNT objects from FROM to TO. The source and destination do
387 not overlap. */
388 # ifndef YYCOPY
389 # if defined __GNUC__ && 1 < __GNUC__
390 # define YYCOPY(To, From, Count) \
391 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
392 # else
393 # define YYCOPY(To, From, Count) \
394 do \
396 YYSIZE_T yyi; \
397 for (yyi = 0; yyi < (Count); yyi++) \
398 (To)[yyi] = (From)[yyi]; \
400 while (YYID (0))
401 # endif
402 # endif
404 /* Relocate STACK from its old location to the new one. The
405 local variables YYSIZE and YYSTACKSIZE give the old and new number of
406 elements in the stack, and YYPTR gives the new location of the
407 stack. Advance YYPTR to a properly aligned location for the next
408 stack. */
409 # define YYSTACK_RELOCATE(Stack) \
410 do \
412 YYSIZE_T yynewbytes; \
413 YYCOPY (&yyptr->Stack, Stack, yysize); \
414 Stack = &yyptr->Stack; \
415 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
416 yyptr += yynewbytes / sizeof (*yyptr); \
418 while (YYID (0))
420 #endif
422 /* YYFINAL -- State number of the termination state. */
423 #define YYFINAL 44
424 /* YYLAST -- Last index in YYTABLE. */
425 #define YYLAST 215
427 /* YYNTOKENS -- Number of terminals. */
428 #define YYNTOKENS 27
429 /* YYNNTS -- Number of nonterminals. */
430 #define YYNNTS 21
431 /* YYNRULES -- Number of rules. */
432 #define YYNRULES 89
433 /* YYNRULES -- Number of states. */
434 #define YYNSTATES 180
436 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
437 #define YYUNDEFTOK 2
438 #define YYMAXUTOK 268
440 #define YYTRANSLATE(YYX) \
441 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
443 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
444 static const yytype_uint8 yytranslate[] =
446 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 17, 2, 2, 14, 2,
450 18, 19, 2, 20, 22, 21, 2, 26, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 15, 2, 16, 2, 25, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 23, 2, 24, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
472 5, 6, 7, 8, 9, 10, 11, 12, 13
475 #if YYDEBUG
476 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
477 YYRHS. */
478 static const yytype_uint16 yyprhs[] =
480 0, 0, 3, 5, 8, 11, 12, 14, 17, 20,
481 22, 24, 26, 28, 30, 32, 35, 38, 40, 44,
482 49, 54, 60, 66, 71, 75, 79, 83, 91, 99,
483 106, 112, 119, 125, 132, 138, 144, 149, 159, 167,
484 176, 183, 194, 203, 214, 223, 232, 235, 239, 243,
485 249, 256, 267, 277, 288, 290, 292, 294, 296, 298,
486 300, 302, 304, 306, 308, 310, 312, 314, 316, 317,
487 319, 321, 323, 324, 327, 328, 331, 332, 335, 337,
488 341, 345, 347, 349, 353, 357, 361, 363, 365, 367
491 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
492 static const yytype_int8 yyrhs[] =
494 28, 0, -1, 30, -1, 31, 29, -1, 32, 29,
495 -1, -1, 14, -1, 15, 15, -1, 16, 16, -1,
496 3, -1, 4, -1, 5, -1, 6, -1, 11, -1,
497 13, -1, 17, 13, -1, 14, 13, -1, 44, -1,
498 18, 4, 19, -1, 18, 4, 19, 20, -1, 21,
499 18, 4, 19, -1, 18, 13, 22, 38, 19, -1,
500 18, 38, 22, 13, 19, -1, 13, 18, 38, 19,
501 -1, 18, 7, 19, -1, 18, 8, 19, -1, 18,
502 10, 19, -1, 18, 13, 22, 38, 22, 33, 19,
503 -1, 18, 13, 22, 38, 22, 40, 19, -1, 18,
504 13, 22, 34, 41, 19, -1, 18, 34, 22, 13,
505 19, -1, 13, 18, 38, 22, 33, 19, -1, 18,
506 38, 22, 33, 19, -1, 13, 18, 38, 22, 40,
507 19, -1, 18, 38, 22, 40, 19, -1, 13, 18,
508 34, 41, 19, -1, 18, 34, 41, 19, -1, 18,
509 23, 13, 41, 24, 22, 33, 42, 19, -1, 18,
510 23, 13, 41, 24, 42, 19, -1, 18, 23, 38,
511 24, 22, 33, 42, 19, -1, 18, 23, 38, 24,
512 42, 19, -1, 18, 23, 13, 22, 38, 22, 33,
513 24, 42, 19, -1, 18, 23, 38, 22, 33, 24,
514 42, 19, -1, 18, 23, 13, 22, 38, 22, 40,
515 24, 42, 19, -1, 18, 23, 38, 22, 40, 24,
516 42, 19, -1, 18, 23, 43, 34, 41, 24, 42,
517 19, -1, 39, 25, -1, 39, 25, 20, -1, 39,
518 25, 21, -1, 39, 25, 18, 13, 19, -1, 39,
519 25, 18, 43, 33, 19, -1, 39, 25, 18, 13,
520 19, 25, 18, 43, 33, 19, -1, 39, 25, 18,
521 13, 19, 25, 18, 13, 19, -1, 39, 25, 18,
522 43, 33, 19, 25, 18, 13, 19, -1, 12, -1,
523 35, -1, 12, -1, 36, -1, 36, -1, 4, -1,
524 8, -1, 3, -1, 9, -1, 4, -1, 7, -1,
525 37, -1, 10, -1, 8, -1, -1, 38, -1, 7,
526 -1, 10, -1, -1, 22, 38, -1, -1, 22, 13,
527 -1, -1, 13, 22, -1, 46, -1, 46, 26, 45,
528 -1, 47, 26, 45, -1, 47, -1, 46, -1, 46,
529 26, 45, -1, 47, 26, 45, -1, 47, 21, 47,
530 -1, 3, -1, 4, -1, 5, -1, 6, -1
533 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
534 static const yytype_uint16 yyrline[] =
536 0, 121, 121, 122, 126, 135, 136, 143, 148, 153,
537 158, 163, 168, 173, 178, 183, 188, 193, 206, 211,
538 216, 221, 231, 241, 251, 256, 261, 266, 273, 284,
539 291, 297, 304, 310, 321, 331, 338, 344, 352, 359,
540 366, 372, 380, 387, 399, 410, 423, 431, 439, 447,
541 457, 464, 472, 479, 493, 494, 507, 508, 520, 521,
542 522, 528, 529, 535, 536, 543, 544, 545, 552, 555,
543 561, 562, 569, 572, 582, 586, 596, 600, 609, 610,
544 614, 626, 630, 631, 635, 642, 652, 656, 660, 664
546 #endif
548 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
549 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
550 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
551 static const char *const yytname[] =
553 "$end", "error", "$undefined", "DR", "AR", "FPR", "FPCR", "LPC", "ZAR",
554 "ZDR", "LZPC", "CREG", "INDEXREG", "EXPR", "'&'", "'<'", "'>'", "'#'",
555 "'('", "')'", "'+'", "'-'", "','", "'['", "']'", "'@'", "'/'", "$accept",
556 "operand", "optional_ampersand", "generic_operand", "motorola_operand",
557 "mit_operand", "zireg", "zdireg", "zadr", "zdr", "apc", "zapc",
558 "optzapc", "zpc", "optczapc", "optcexpr", "optexprc", "reglist",
559 "ireglist", "reglistpair", "reglistreg", 0
561 #endif
563 # ifdef YYPRINT
564 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
565 token YYLEX-NUM. */
566 static const yytype_uint16 yytoknum[] =
568 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
569 265, 266, 267, 268, 38, 60, 62, 35, 40, 41,
570 43, 45, 44, 91, 93, 64, 47
572 # endif
574 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
575 static const yytype_uint8 yyr1[] =
577 0, 27, 28, 28, 28, 29, 29, 30, 30, 30,
578 30, 30, 30, 30, 30, 30, 30, 30, 31, 31,
579 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
580 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
581 31, 31, 31, 31, 31, 31, 32, 32, 32, 32,
582 32, 32, 32, 32, 33, 33, 34, 34, 35, 35,
583 35, 36, 36, 37, 37, 38, 38, 38, 39, 39,
584 40, 40, 41, 41, 42, 42, 43, 43, 44, 44,
585 44, 45, 45, 45, 45, 46, 47, 47, 47, 47
588 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
589 static const yytype_uint8 yyr2[] =
591 0, 2, 1, 2, 2, 0, 1, 2, 2, 1,
592 1, 1, 1, 1, 1, 2, 2, 1, 3, 4,
593 4, 5, 5, 4, 3, 3, 3, 7, 7, 6,
594 5, 6, 5, 6, 5, 5, 4, 9, 7, 8,
595 6, 10, 8, 10, 8, 8, 2, 3, 3, 5,
596 6, 10, 9, 10, 1, 1, 1, 1, 1, 1,
597 1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
598 1, 1, 0, 2, 0, 2, 0, 2, 1, 3,
599 3, 1, 1, 3, 3, 3, 1, 1, 1, 1
602 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
603 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
604 means the default is an error. */
605 static const yytype_uint8 yydefact[] =
607 68, 86, 87, 88, 89, 64, 67, 66, 13, 14,
608 0, 0, 0, 0, 0, 0, 0, 2, 5, 5,
609 65, 69, 0, 17, 78, 0, 0, 16, 7, 8,
610 15, 61, 63, 64, 67, 62, 66, 56, 0, 76,
611 72, 57, 0, 0, 1, 6, 3, 4, 46, 0,
612 0, 0, 63, 72, 0, 18, 24, 25, 26, 0,
613 72, 0, 0, 0, 0, 0, 0, 76, 47, 48,
614 86, 87, 88, 89, 79, 82, 81, 85, 80, 0,
615 0, 23, 0, 19, 72, 0, 77, 0, 0, 74,
616 72, 0, 73, 36, 59, 70, 60, 71, 54, 0,
617 0, 55, 58, 0, 20, 0, 0, 0, 0, 35,
618 0, 0, 0, 21, 0, 73, 74, 0, 0, 0,
619 0, 0, 30, 22, 32, 34, 49, 77, 0, 83,
620 84, 31, 33, 29, 0, 0, 0, 0, 0, 74,
621 74, 75, 74, 40, 74, 0, 50, 27, 28, 0,
622 0, 74, 38, 0, 0, 0, 0, 0, 76, 0,
623 74, 74, 0, 42, 44, 39, 45, 0, 0, 0,
624 0, 0, 37, 52, 0, 0, 41, 43, 51, 53
627 /* YYDEFGOTO[NTERM-NUM]. */
628 static const yytype_int8 yydefgoto[] =
630 -1, 16, 46, 17, 18, 19, 100, 40, 101, 102,
631 20, 92, 22, 103, 64, 120, 62, 23, 74, 75,
635 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
636 STATE-NUM. */
637 #define YYPACT_NINF -98
638 static const yytype_int16 yypact[] =
640 89, 14, 9, 31, 35, -98, -98, -98, -98, 0,
641 36, 42, 28, 56, 63, 67, 90, -98, 75, 75,
642 -98, -98, 86, -98, 96, -15, 123, -98, -98, -98,
643 -98, -98, 97, 115, 119, -98, 120, -98, 122, 16,
644 126, -98, 127, 157, -98, -98, -98, -98, 19, 154,
645 154, 154, -98, 140, 29, 144, -98, -98, -98, 123,
646 141, 99, 18, 70, 147, 105, 148, 152, -98, -98,
647 -98, -98, -98, -98, -98, 142, -13, -98, -98, 146,
648 150, -98, 133, -98, 140, 60, 146, 149, 133, 153,
649 140, 151, -98, -98, -98, -98, -98, -98, -98, 155,
650 158, -98, -98, 159, -98, 62, 143, 154, 154, -98,
651 160, 161, 162, -98, 133, 163, 164, 165, 166, 116,
652 168, 167, -98, -98, -98, -98, 169, -98, 173, -98,
653 -98, -98, -98, -98, 174, 176, 133, 116, 177, 175,
654 175, -98, 175, -98, 175, 170, 178, -98, -98, 180,
655 181, 175, -98, 171, 179, 182, 183, 187, 186, 189,
656 175, 175, 190, -98, -98, -98, -98, 79, 143, 195,
657 191, 192, -98, -98, 193, 194, -98, -98, -98, -98
660 /* YYPGOTO[NTERM-NUM]. */
661 static const yytype_int16 yypgoto[] =
663 -98, -98, 196, -98, -98, -98, -81, 6, -98, -9,
664 -98, 2, -98, -78, -38, -97, -67, -98, -48, 172,
668 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
669 positive, shift that token. If negative, reduce the rule which
670 number is the opposite. If zero, do what YYDEFACT says.
671 If YYTABLE_NINF, syntax error. */
672 #define YYTABLE_NINF -64
673 static const yytype_int16 yytable[] =
675 106, 110, 21, 78, 111, 41, 50, 117, 50, -10,
676 118, 51, 25, 108, -9, 80, 42, 41, 26, 138,
677 52, 31, 87, 5, 6, 128, 7, 35, 54, 60,
678 37, -11, 53, 134, -63, -12, 135, 67, 142, 68,
679 69, 61, 154, 155, 29, 156, 112, 157, 81, 27,
680 41, 82, 121, 41, 162, 149, 151, 28, 150, 129,
681 130, 85, 77, 170, 171, 84, 31, 32, 90, 30,
682 33, 34, 35, 36, 52, 37, 38, 5, 6, 113,
683 7, 126, 114, 91, 127, 43, 39, 174, 115, 45,
684 44, 168, 1, 2, 3, 4, 5, 6, 173, 7,
685 8, 127, 9, 10, 11, 12, 13, 14, 31, 94,
686 15, 48, 95, 96, 35, 97, 55, 98, 99, 31,
687 94, 88, 49, 89, 96, 35, 31, 52, 98, 141,
688 5, 6, 35, 7, 56, 37, 31, 94, 57, 58,
689 95, 96, 35, 97, 59, 98, 31, 94, 63, 65,
690 52, 96, 35, 5, 6, 98, 7, 70, 71, 72,
691 73, 66, 79, 86, 83, 105, 93, 104, 107, 109,
692 122, 0, 24, 116, 123, 119, 0, 124, 125, 131,
693 132, 133, 0, 0, 141, 136, 137, 143, 158, 139,
694 140, 144, 146, 147, 145, 148, 152, 153, 163, 167,
695 0, 164, 165, 159, 160, 161, 166, 169, 175, 172,
696 176, 177, 178, 179, 0, 47
699 static const yytype_int16 yycheck[] =
701 67, 82, 0, 51, 82, 14, 21, 88, 21, 0,
702 88, 26, 0, 26, 0, 53, 14, 26, 18, 116,
703 4, 3, 60, 7, 8, 106, 10, 9, 26, 13,
704 12, 0, 26, 114, 25, 0, 114, 18, 119, 20,
705 21, 39, 139, 140, 16, 142, 84, 144, 19, 13,
706 59, 22, 90, 62, 151, 136, 137, 15, 136, 107,
707 108, 59, 50, 160, 161, 59, 3, 4, 62, 13,
708 7, 8, 9, 10, 4, 12, 13, 7, 8, 19,
709 10, 19, 22, 13, 22, 18, 23, 168, 86, 14,
710 0, 158, 3, 4, 5, 6, 7, 8, 19, 10,
711 11, 22, 13, 14, 15, 16, 17, 18, 3, 4,
712 21, 25, 7, 8, 9, 10, 19, 12, 13, 3,
713 4, 22, 26, 24, 8, 9, 3, 4, 12, 13,
714 7, 8, 9, 10, 19, 12, 3, 4, 19, 19,
715 7, 8, 9, 10, 22, 12, 3, 4, 22, 22,
716 4, 8, 9, 7, 8, 12, 10, 3, 4, 5,
717 6, 4, 22, 22, 20, 13, 19, 19, 26, 19,
718 19, -1, 0, 24, 19, 22, -1, 19, 19, 19,
719 19, 19, -1, -1, 13, 22, 22, 19, 18, 24,
720 24, 24, 19, 19, 25, 19, 19, 22, 19, 13,
721 -1, 19, 19, 25, 24, 24, 19, 18, 13, 19,
722 19, 19, 19, 19, -1, 19
725 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
726 symbol of state STATE-NUM. */
727 static const yytype_uint8 yystos[] =
729 0, 3, 4, 5, 6, 7, 8, 10, 11, 13,
730 14, 15, 16, 17, 18, 21, 28, 30, 31, 32,
731 37, 38, 39, 44, 46, 47, 18, 13, 15, 16,
732 13, 3, 4, 7, 8, 9, 10, 12, 13, 23,
733 34, 36, 38, 18, 0, 14, 29, 29, 25, 26,
734 21, 26, 4, 34, 38, 19, 19, 19, 19, 22,
735 13, 38, 43, 22, 41, 22, 4, 18, 20, 21,
736 3, 4, 5, 6, 45, 46, 47, 47, 45, 22,
737 41, 19, 22, 20, 34, 38, 22, 41, 22, 24,
738 34, 13, 38, 19, 4, 7, 8, 10, 12, 13,
739 33, 35, 36, 40, 19, 13, 43, 26, 26, 19,
740 33, 40, 41, 19, 22, 38, 24, 33, 40, 22,
741 42, 41, 19, 19, 19, 19, 19, 22, 33, 45,
742 45, 19, 19, 19, 33, 40, 22, 22, 42, 24,
743 24, 13, 33, 19, 24, 25, 19, 19, 19, 33,
744 40, 33, 19, 22, 42, 42, 42, 42, 18, 25,
745 24, 24, 42, 19, 19, 19, 19, 13, 43, 18,
746 42, 42, 19, 19, 33, 13, 19, 19, 19, 19
749 #define yyerrok (yyerrstatus = 0)
750 #define yyclearin (yychar = YYEMPTY)
751 #define YYEMPTY (-2)
752 #define YYEOF 0
754 #define YYACCEPT goto yyacceptlab
755 #define YYABORT goto yyabortlab
756 #define YYERROR goto yyerrorlab
759 /* Like YYERROR except do call yyerror. This remains here temporarily
760 to ease the transition to the new meaning of YYERROR, for GCC.
761 Once GCC version 2 has supplanted version 1, this can go. */
763 #define YYFAIL goto yyerrlab
765 #define YYRECOVERING() (!!yyerrstatus)
767 #define YYBACKUP(Token, Value) \
768 do \
769 if (yychar == YYEMPTY && yylen == 1) \
771 yychar = (Token); \
772 yylval = (Value); \
773 yytoken = YYTRANSLATE (yychar); \
774 YYPOPSTACK (1); \
775 goto yybackup; \
777 else \
779 yyerror (YY_("syntax error: cannot back up")); \
780 YYERROR; \
782 while (YYID (0))
785 #define YYTERROR 1
786 #define YYERRCODE 256
789 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
790 If N is 0, then set CURRENT to the empty location which ends
791 the previous symbol: RHS[0] (always defined). */
793 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
794 #ifndef YYLLOC_DEFAULT
795 # define YYLLOC_DEFAULT(Current, Rhs, N) \
796 do \
797 if (YYID (N)) \
799 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
800 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
801 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
802 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
804 else \
806 (Current).first_line = (Current).last_line = \
807 YYRHSLOC (Rhs, 0).last_line; \
808 (Current).first_column = (Current).last_column = \
809 YYRHSLOC (Rhs, 0).last_column; \
811 while (YYID (0))
812 #endif
815 /* YY_LOCATION_PRINT -- Print the location on the stream.
816 This macro was not mandated originally: define only if we know
817 we won't break user code: when these are the locations we know. */
819 #ifndef YY_LOCATION_PRINT
820 # if YYLTYPE_IS_TRIVIAL
821 # define YY_LOCATION_PRINT(File, Loc) \
822 fprintf (File, "%d.%d-%d.%d", \
823 (Loc).first_line, (Loc).first_column, \
824 (Loc).last_line, (Loc).last_column)
825 # else
826 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
827 # endif
828 #endif
831 /* YYLEX -- calling `yylex' with the right arguments. */
833 #ifdef YYLEX_PARAM
834 # define YYLEX yylex (YYLEX_PARAM)
835 #else
836 # define YYLEX yylex ()
837 #endif
839 /* Enable debugging if requested. */
840 #if YYDEBUG
842 # ifndef YYFPRINTF
843 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
844 # define YYFPRINTF fprintf
845 # endif
847 # define YYDPRINTF(Args) \
848 do { \
849 if (yydebug) \
850 YYFPRINTF Args; \
851 } while (YYID (0))
853 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
854 do { \
855 if (yydebug) \
857 YYFPRINTF (stderr, "%s ", Title); \
858 yy_symbol_print (stderr, \
859 Type, Value); \
860 YYFPRINTF (stderr, "\n"); \
862 } while (YYID (0))
865 /*--------------------------------.
866 | Print this symbol on YYOUTPUT. |
867 `--------------------------------*/
869 /*ARGSUSED*/
870 #if (defined __STDC__ || defined __C99__FUNC__ \
871 || defined __cplusplus || defined _MSC_VER)
872 static void
873 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
874 #else
875 static void
876 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
877 FILE *yyoutput;
878 int yytype;
879 YYSTYPE const * const yyvaluep;
880 #endif
882 if (!yyvaluep)
883 return;
884 # ifdef YYPRINT
885 if (yytype < YYNTOKENS)
886 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
887 # else
888 YYUSE (yyoutput);
889 # endif
890 switch (yytype)
892 default:
893 break;
898 /*--------------------------------.
899 | Print this symbol on YYOUTPUT. |
900 `--------------------------------*/
902 #if (defined __STDC__ || defined __C99__FUNC__ \
903 || defined __cplusplus || defined _MSC_VER)
904 static void
905 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
906 #else
907 static void
908 yy_symbol_print (yyoutput, yytype, yyvaluep)
909 FILE *yyoutput;
910 int yytype;
911 YYSTYPE const * const yyvaluep;
912 #endif
914 if (yytype < YYNTOKENS)
915 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
916 else
917 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
919 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
920 YYFPRINTF (yyoutput, ")");
923 /*------------------------------------------------------------------.
924 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
925 | TOP (included). |
926 `------------------------------------------------------------------*/
928 #if (defined __STDC__ || defined __C99__FUNC__ \
929 || defined __cplusplus || defined _MSC_VER)
930 static void
931 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
932 #else
933 static void
934 yy_stack_print (bottom, top)
935 yytype_int16 *bottom;
936 yytype_int16 *top;
937 #endif
939 YYFPRINTF (stderr, "Stack now");
940 for (; bottom <= top; ++bottom)
941 YYFPRINTF (stderr, " %d", *bottom);
942 YYFPRINTF (stderr, "\n");
945 # define YY_STACK_PRINT(Bottom, Top) \
946 do { \
947 if (yydebug) \
948 yy_stack_print ((Bottom), (Top)); \
949 } while (YYID (0))
952 /*------------------------------------------------.
953 | Report that the YYRULE is going to be reduced. |
954 `------------------------------------------------*/
956 #if (defined __STDC__ || defined __C99__FUNC__ \
957 || defined __cplusplus || defined _MSC_VER)
958 static void
959 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
960 #else
961 static void
962 yy_reduce_print (yyvsp, yyrule)
963 YYSTYPE *yyvsp;
964 int yyrule;
965 #endif
967 int yynrhs = yyr2[yyrule];
968 int yyi;
969 unsigned long int yylno = yyrline[yyrule];
970 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
971 yyrule - 1, yylno);
972 /* The symbols being reduced. */
973 for (yyi = 0; yyi < yynrhs; yyi++)
975 fprintf (stderr, " $%d = ", yyi + 1);
976 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
977 &(yyvsp[(yyi + 1) - (yynrhs)])
979 fprintf (stderr, "\n");
983 # define YY_REDUCE_PRINT(Rule) \
984 do { \
985 if (yydebug) \
986 yy_reduce_print (yyvsp, Rule); \
987 } while (YYID (0))
989 /* Nonzero means print parse trace. It is left uninitialized so that
990 multiple parsers can coexist. */
991 int yydebug;
992 #else /* !YYDEBUG */
993 # define YYDPRINTF(Args)
994 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
995 # define YY_STACK_PRINT(Bottom, Top)
996 # define YY_REDUCE_PRINT(Rule)
997 #endif /* !YYDEBUG */
1000 /* YYINITDEPTH -- initial size of the parser's stacks. */
1001 #ifndef YYINITDEPTH
1002 # define YYINITDEPTH 200
1003 #endif
1005 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1006 if the built-in stack extension method is used).
1008 Do not make this value too large; the results are undefined if
1009 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1010 evaluated with infinite-precision integer arithmetic. */
1012 #ifndef YYMAXDEPTH
1013 # define YYMAXDEPTH 10000
1014 #endif
1018 #if YYERROR_VERBOSE
1020 # ifndef yystrlen
1021 # if defined __GLIBC__ && defined _STRING_H
1022 # define yystrlen strlen
1023 # else
1024 /* Return the length of YYSTR. */
1025 #if (defined __STDC__ || defined __C99__FUNC__ \
1026 || defined __cplusplus || defined _MSC_VER)
1027 static YYSIZE_T
1028 yystrlen (const char *yystr)
1029 #else
1030 static YYSIZE_T
1031 yystrlen (yystr)
1032 const char *yystr;
1033 #endif
1035 YYSIZE_T yylen;
1036 for (yylen = 0; yystr[yylen]; yylen++)
1037 continue;
1038 return yylen;
1040 # endif
1041 # endif
1043 # ifndef yystpcpy
1044 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1045 # define yystpcpy stpcpy
1046 # else
1047 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1048 YYDEST. */
1049 #if (defined __STDC__ || defined __C99__FUNC__ \
1050 || defined __cplusplus || defined _MSC_VER)
1051 static char *
1052 yystpcpy (char *yydest, const char *yysrc)
1053 #else
1054 static char *
1055 yystpcpy (yydest, yysrc)
1056 char *yydest;
1057 const char *yysrc;
1058 #endif
1060 char *yyd = yydest;
1061 const char *yys = yysrc;
1063 while ((*yyd++ = *yys++) != '\0')
1064 continue;
1066 return yyd - 1;
1068 # endif
1069 # endif
1071 # ifndef yytnamerr
1072 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1073 quotes and backslashes, so that it's suitable for yyerror. The
1074 heuristic is that double-quoting is unnecessary unless the string
1075 contains an apostrophe, a comma, or backslash (other than
1076 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1077 null, do not copy; instead, return the length of what the result
1078 would have been. */
1079 static YYSIZE_T
1080 yytnamerr (char *yyres, const char *yystr)
1082 if (*yystr == '"')
1084 YYSIZE_T yyn = 0;
1085 char const *yyp = yystr;
1087 for (;;)
1088 switch (*++yyp)
1090 case '\'':
1091 case ',':
1092 goto do_not_strip_quotes;
1094 case '\\':
1095 if (*++yyp != '\\')
1096 goto do_not_strip_quotes;
1097 /* Fall through. */
1098 default:
1099 if (yyres)
1100 yyres[yyn] = *yyp;
1101 yyn++;
1102 break;
1104 case '"':
1105 if (yyres)
1106 yyres[yyn] = '\0';
1107 return yyn;
1109 do_not_strip_quotes: ;
1112 if (! yyres)
1113 return yystrlen (yystr);
1115 return yystpcpy (yyres, yystr) - yyres;
1117 # endif
1119 /* Copy into YYRESULT an error message about the unexpected token
1120 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1121 including the terminating null byte. If YYRESULT is null, do not
1122 copy anything; just return the number of bytes that would be
1123 copied. As a special case, return 0 if an ordinary "syntax error"
1124 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1125 size calculation. */
1126 static YYSIZE_T
1127 yysyntax_error (char *yyresult, int yystate, int yychar)
1129 int yyn = yypact[yystate];
1131 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1132 return 0;
1133 else
1135 int yytype = YYTRANSLATE (yychar);
1136 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1137 YYSIZE_T yysize = yysize0;
1138 YYSIZE_T yysize1;
1139 int yysize_overflow = 0;
1140 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1141 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1142 int yyx;
1144 # if 0
1145 /* This is so xgettext sees the translatable formats that are
1146 constructed on the fly. */
1147 YY_("syntax error, unexpected %s");
1148 YY_("syntax error, unexpected %s, expecting %s");
1149 YY_("syntax error, unexpected %s, expecting %s or %s");
1150 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1151 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1152 # endif
1153 char *yyfmt;
1154 char const *yyf;
1155 static char const yyunexpected[] = "syntax error, unexpected %s";
1156 static char const yyexpecting[] = ", expecting %s";
1157 static char const yyor[] = " or %s";
1158 char yyformat[sizeof yyunexpected
1159 + sizeof yyexpecting - 1
1160 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1161 * (sizeof yyor - 1))];
1162 char const *yyprefix = yyexpecting;
1164 /* Start YYX at -YYN if negative to avoid negative indexes in
1165 YYCHECK. */
1166 int yyxbegin = yyn < 0 ? -yyn : 0;
1168 /* Stay within bounds of both yycheck and yytname. */
1169 int yychecklim = YYLAST - yyn + 1;
1170 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1171 int yycount = 1;
1173 yyarg[0] = yytname[yytype];
1174 yyfmt = yystpcpy (yyformat, yyunexpected);
1176 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1177 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1179 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1181 yycount = 1;
1182 yysize = yysize0;
1183 yyformat[sizeof yyunexpected - 1] = '\0';
1184 break;
1186 yyarg[yycount++] = yytname[yyx];
1187 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1188 yysize_overflow |= (yysize1 < yysize);
1189 yysize = yysize1;
1190 yyfmt = yystpcpy (yyfmt, yyprefix);
1191 yyprefix = yyor;
1194 yyf = YY_(yyformat);
1195 yysize1 = yysize + yystrlen (yyf);
1196 yysize_overflow |= (yysize1 < yysize);
1197 yysize = yysize1;
1199 if (yysize_overflow)
1200 return YYSIZE_MAXIMUM;
1202 if (yyresult)
1204 /* Avoid sprintf, as that infringes on the user's name space.
1205 Don't have undefined behavior even if the translation
1206 produced a string with the wrong number of "%s"s. */
1207 char *yyp = yyresult;
1208 int yyi = 0;
1209 while ((*yyp = *yyf) != '\0')
1211 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1213 yyp += yytnamerr (yyp, yyarg[yyi++]);
1214 yyf += 2;
1216 else
1218 yyp++;
1219 yyf++;
1223 return yysize;
1226 #endif /* YYERROR_VERBOSE */
1229 /*-----------------------------------------------.
1230 | Release the memory associated to this symbol. |
1231 `-----------------------------------------------*/
1233 /*ARGSUSED*/
1234 #if (defined __STDC__ || defined __C99__FUNC__ \
1235 || defined __cplusplus || defined _MSC_VER)
1236 static void
1237 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1238 #else
1239 static void
1240 yydestruct (yymsg, yytype, yyvaluep)
1241 const char *yymsg;
1242 int yytype;
1243 YYSTYPE *yyvaluep;
1244 #endif
1246 YYUSE (yyvaluep);
1248 if (!yymsg)
1249 yymsg = "Deleting";
1250 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1252 switch (yytype)
1255 default:
1256 break;
1261 /* Prevent warnings from -Wmissing-prototypes. */
1263 #ifdef YYPARSE_PARAM
1264 #if defined __STDC__ || defined __cplusplus
1265 int yyparse (void *YYPARSE_PARAM);
1266 #else
1267 int yyparse ();
1268 #endif
1269 #else /* ! YYPARSE_PARAM */
1270 #if defined __STDC__ || defined __cplusplus
1271 int yyparse (void);
1272 #else
1273 int yyparse ();
1274 #endif
1275 #endif /* ! YYPARSE_PARAM */
1279 /* The look-ahead symbol. */
1280 int yychar;
1282 /* The semantic value of the look-ahead symbol. */
1283 YYSTYPE yylval;
1285 /* Number of syntax errors so far. */
1286 int yynerrs;
1290 /*----------.
1291 | yyparse. |
1292 `----------*/
1294 #ifdef YYPARSE_PARAM
1295 #if (defined __STDC__ || defined __C99__FUNC__ \
1296 || defined __cplusplus || defined _MSC_VER)
1298 yyparse (void *YYPARSE_PARAM)
1299 #else
1301 yyparse (YYPARSE_PARAM)
1302 void *YYPARSE_PARAM;
1303 #endif
1304 #else /* ! YYPARSE_PARAM */
1305 #if (defined __STDC__ || defined __C99__FUNC__ \
1306 || defined __cplusplus || defined _MSC_VER)
1308 yyparse (void)
1309 #else
1311 yyparse ()
1313 #endif
1314 #endif
1317 int yystate;
1318 int yyn;
1319 int yyresult;
1320 /* Number of tokens to shift before error messages enabled. */
1321 int yyerrstatus;
1322 /* Look-ahead token as an internal (translated) token number. */
1323 int yytoken = 0;
1324 #if YYERROR_VERBOSE
1325 /* Buffer for error messages, and its allocated size. */
1326 char yymsgbuf[128];
1327 char *yymsg = yymsgbuf;
1328 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1329 #endif
1331 /* Three stacks and their tools:
1332 `yyss': related to states,
1333 `yyvs': related to semantic values,
1334 `yyls': related to locations.
1336 Refer to the stacks thru separate pointers, to allow yyoverflow
1337 to reallocate them elsewhere. */
1339 /* The state stack. */
1340 yytype_int16 yyssa[YYINITDEPTH];
1341 yytype_int16 *yyss = yyssa;
1342 yytype_int16 *yyssp;
1344 /* The semantic value stack. */
1345 YYSTYPE yyvsa[YYINITDEPTH];
1346 YYSTYPE *yyvs = yyvsa;
1347 YYSTYPE *yyvsp;
1351 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1353 YYSIZE_T yystacksize = YYINITDEPTH;
1355 /* The variables used to return semantic value and location from the
1356 action routines. */
1357 YYSTYPE yyval;
1360 /* The number of symbols on the RHS of the reduced rule.
1361 Keep to zero when no symbol should be popped. */
1362 int yylen = 0;
1364 YYDPRINTF ((stderr, "Starting parse\n"));
1366 yystate = 0;
1367 yyerrstatus = 0;
1368 yynerrs = 0;
1369 yychar = YYEMPTY; /* Cause a token to be read. */
1371 /* Initialize stack pointers.
1372 Waste one element of value and location stack
1373 so that they stay on the same level as the state stack.
1374 The wasted elements are never initialized. */
1376 yyssp = yyss;
1377 yyvsp = yyvs;
1379 goto yysetstate;
1381 /*------------------------------------------------------------.
1382 | yynewstate -- Push a new state, which is found in yystate. |
1383 `------------------------------------------------------------*/
1384 yynewstate:
1385 /* In all cases, when you get here, the value and location stacks
1386 have just been pushed. So pushing a state here evens the stacks. */
1387 yyssp++;
1389 yysetstate:
1390 *yyssp = yystate;
1392 if (yyss + yystacksize - 1 <= yyssp)
1394 /* Get the current used size of the three stacks, in elements. */
1395 YYSIZE_T yysize = yyssp - yyss + 1;
1397 #ifdef yyoverflow
1399 /* Give user a chance to reallocate the stack. Use copies of
1400 these so that the &'s don't force the real ones into
1401 memory. */
1402 YYSTYPE *yyvs1 = yyvs;
1403 yytype_int16 *yyss1 = yyss;
1406 /* Each stack pointer address is followed by the size of the
1407 data in use in that stack, in bytes. This used to be a
1408 conditional around just the two extra args, but that might
1409 be undefined if yyoverflow is a macro. */
1410 yyoverflow (YY_("memory exhausted"),
1411 &yyss1, yysize * sizeof (*yyssp),
1412 &yyvs1, yysize * sizeof (*yyvsp),
1414 &yystacksize);
1416 yyss = yyss1;
1417 yyvs = yyvs1;
1419 #else /* no yyoverflow */
1420 # ifndef YYSTACK_RELOCATE
1421 goto yyexhaustedlab;
1422 # else
1423 /* Extend the stack our own way. */
1424 if (YYMAXDEPTH <= yystacksize)
1425 goto yyexhaustedlab;
1426 yystacksize *= 2;
1427 if (YYMAXDEPTH < yystacksize)
1428 yystacksize = YYMAXDEPTH;
1431 yytype_int16 *yyss1 = yyss;
1432 union yyalloc *yyptr =
1433 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1434 if (! yyptr)
1435 goto yyexhaustedlab;
1436 YYSTACK_RELOCATE (yyss);
1437 YYSTACK_RELOCATE (yyvs);
1439 # undef YYSTACK_RELOCATE
1440 if (yyss1 != yyssa)
1441 YYSTACK_FREE (yyss1);
1443 # endif
1444 #endif /* no yyoverflow */
1446 yyssp = yyss + yysize - 1;
1447 yyvsp = yyvs + yysize - 1;
1450 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1451 (unsigned long int) yystacksize));
1453 if (yyss + yystacksize - 1 <= yyssp)
1454 YYABORT;
1457 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1459 goto yybackup;
1461 /*-----------.
1462 | yybackup. |
1463 `-----------*/
1464 yybackup:
1466 /* Do appropriate processing given the current state. Read a
1467 look-ahead token if we need one and don't already have one. */
1469 /* First try to decide what to do without reference to look-ahead token. */
1470 yyn = yypact[yystate];
1471 if (yyn == YYPACT_NINF)
1472 goto yydefault;
1474 /* Not known => get a look-ahead token if don't already have one. */
1476 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1477 if (yychar == YYEMPTY)
1479 YYDPRINTF ((stderr, "Reading a token: "));
1480 yychar = YYLEX;
1483 if (yychar <= YYEOF)
1485 yychar = yytoken = YYEOF;
1486 YYDPRINTF ((stderr, "Now at end of input.\n"));
1488 else
1490 yytoken = YYTRANSLATE (yychar);
1491 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1494 /* If the proper action on seeing token YYTOKEN is to reduce or to
1495 detect an error, take that action. */
1496 yyn += yytoken;
1497 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1498 goto yydefault;
1499 yyn = yytable[yyn];
1500 if (yyn <= 0)
1502 if (yyn == 0 || yyn == YYTABLE_NINF)
1503 goto yyerrlab;
1504 yyn = -yyn;
1505 goto yyreduce;
1508 if (yyn == YYFINAL)
1509 YYACCEPT;
1511 /* Count tokens shifted since error; after three, turn off error
1512 status. */
1513 if (yyerrstatus)
1514 yyerrstatus--;
1516 /* Shift the look-ahead token. */
1517 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1519 /* Discard the shifted token unless it is eof. */
1520 if (yychar != YYEOF)
1521 yychar = YYEMPTY;
1523 yystate = yyn;
1524 *++yyvsp = yylval;
1526 goto yynewstate;
1529 /*-----------------------------------------------------------.
1530 | yydefault -- do the default action for the current state. |
1531 `-----------------------------------------------------------*/
1532 yydefault:
1533 yyn = yydefact[yystate];
1534 if (yyn == 0)
1535 goto yyerrlab;
1536 goto yyreduce;
1539 /*-----------------------------.
1540 | yyreduce -- Do a reduction. |
1541 `-----------------------------*/
1542 yyreduce:
1543 /* yyn is the number of a rule to reduce with. */
1544 yylen = yyr2[yyn];
1546 /* If YYLEN is nonzero, implement the default value of the action:
1547 `$$ = $1'.
1549 Otherwise, the following line sets YYVAL to garbage.
1550 This behavior is undocumented and Bison
1551 users should not rely upon it. Assigning to YYVAL
1552 unconditionally makes the parser a bit smaller, and it avoids a
1553 GCC warning that YYVAL may be used uninitialized. */
1554 yyval = yyvsp[1-yylen];
1557 YY_REDUCE_PRINT (yyn);
1558 switch (yyn)
1560 case 3:
1561 #line 123 "m68k-parse.y"
1563 op->trailing_ampersand = (yyvsp[(2) - (2)].trailing_ampersand);
1565 break;
1567 case 4:
1568 #line 127 "m68k-parse.y"
1570 op->trailing_ampersand = (yyvsp[(2) - (2)].trailing_ampersand);
1572 break;
1574 case 5:
1575 #line 135 "m68k-parse.y"
1576 { (yyval.trailing_ampersand) = 0; }
1577 break;
1579 case 6:
1580 #line 137 "m68k-parse.y"
1581 { (yyval.trailing_ampersand) = 1; }
1582 break;
1584 case 7:
1585 #line 144 "m68k-parse.y"
1587 op->mode = LSH;
1589 break;
1591 case 8:
1592 #line 149 "m68k-parse.y"
1594 op->mode = RSH;
1596 break;
1598 case 9:
1599 #line 154 "m68k-parse.y"
1601 op->mode = DREG;
1602 op->reg = (yyvsp[(1) - (1)].reg);
1604 break;
1606 case 10:
1607 #line 159 "m68k-parse.y"
1609 op->mode = AREG;
1610 op->reg = (yyvsp[(1) - (1)].reg);
1612 break;
1614 case 11:
1615 #line 164 "m68k-parse.y"
1617 op->mode = FPREG;
1618 op->reg = (yyvsp[(1) - (1)].reg);
1620 break;
1622 case 12:
1623 #line 169 "m68k-parse.y"
1625 op->mode = CONTROL;
1626 op->reg = (yyvsp[(1) - (1)].reg);
1628 break;
1630 case 13:
1631 #line 174 "m68k-parse.y"
1633 op->mode = CONTROL;
1634 op->reg = (yyvsp[(1) - (1)].reg);
1636 break;
1638 case 14:
1639 #line 179 "m68k-parse.y"
1641 op->mode = ABSL;
1642 op->disp = (yyvsp[(1) - (1)].exp);
1644 break;
1646 case 15:
1647 #line 184 "m68k-parse.y"
1649 op->mode = IMMED;
1650 op->disp = (yyvsp[(2) - (2)].exp);
1652 break;
1654 case 16:
1655 #line 189 "m68k-parse.y"
1657 op->mode = IMMED;
1658 op->disp = (yyvsp[(2) - (2)].exp);
1660 break;
1662 case 17:
1663 #line 194 "m68k-parse.y"
1665 op->mode = REGLST;
1666 op->mask = (yyvsp[(1) - (1)].mask);
1668 break;
1670 case 18:
1671 #line 207 "m68k-parse.y"
1673 op->mode = AINDR;
1674 op->reg = (yyvsp[(2) - (3)].reg);
1676 break;
1678 case 19:
1679 #line 212 "m68k-parse.y"
1681 op->mode = AINC;
1682 op->reg = (yyvsp[(2) - (4)].reg);
1684 break;
1686 case 20:
1687 #line 217 "m68k-parse.y"
1689 op->mode = ADEC;
1690 op->reg = (yyvsp[(3) - (4)].reg);
1692 break;
1694 case 21:
1695 #line 222 "m68k-parse.y"
1697 op->reg = (yyvsp[(4) - (5)].reg);
1698 op->disp = (yyvsp[(2) - (5)].exp);
1699 if (((yyvsp[(4) - (5)].reg) >= ZADDR0 && (yyvsp[(4) - (5)].reg) <= ZADDR7)
1700 || (yyvsp[(4) - (5)].reg) == ZPC)
1701 op->mode = BASE;
1702 else
1703 op->mode = DISP;
1705 break;
1707 case 22:
1708 #line 232 "m68k-parse.y"
1710 op->reg = (yyvsp[(2) - (5)].reg);
1711 op->disp = (yyvsp[(4) - (5)].exp);
1712 if (((yyvsp[(2) - (5)].reg) >= ZADDR0 && (yyvsp[(2) - (5)].reg) <= ZADDR7)
1713 || (yyvsp[(2) - (5)].reg) == ZPC)
1714 op->mode = BASE;
1715 else
1716 op->mode = DISP;
1718 break;
1720 case 23:
1721 #line 242 "m68k-parse.y"
1723 op->reg = (yyvsp[(3) - (4)].reg);
1724 op->disp = (yyvsp[(1) - (4)].exp);
1725 if (((yyvsp[(3) - (4)].reg) >= ZADDR0 && (yyvsp[(3) - (4)].reg) <= ZADDR7)
1726 || (yyvsp[(3) - (4)].reg) == ZPC)
1727 op->mode = BASE;
1728 else
1729 op->mode = DISP;
1731 break;
1733 case 24:
1734 #line 252 "m68k-parse.y"
1736 op->mode = DISP;
1737 op->reg = (yyvsp[(2) - (3)].reg);
1739 break;
1741 case 25:
1742 #line 257 "m68k-parse.y"
1744 op->mode = BASE;
1745 op->reg = (yyvsp[(2) - (3)].reg);
1747 break;
1749 case 26:
1750 #line 262 "m68k-parse.y"
1752 op->mode = BASE;
1753 op->reg = (yyvsp[(2) - (3)].reg);
1755 break;
1757 case 27:
1758 #line 267 "m68k-parse.y"
1760 op->mode = BASE;
1761 op->reg = (yyvsp[(4) - (7)].reg);
1762 op->disp = (yyvsp[(2) - (7)].exp);
1763 op->index = (yyvsp[(6) - (7)].indexreg);
1765 break;
1767 case 28:
1768 #line 274 "m68k-parse.y"
1770 if ((yyvsp[(4) - (7)].reg) == PC || (yyvsp[(4) - (7)].reg) == ZPC)
1771 yyerror (_("syntax error"));
1772 op->mode = BASE;
1773 op->reg = (yyvsp[(6) - (7)].reg);
1774 op->disp = (yyvsp[(2) - (7)].exp);
1775 op->index.reg = (yyvsp[(4) - (7)].reg);
1776 op->index.size = SIZE_UNSPEC;
1777 op->index.scale = 1;
1779 break;
1781 case 29:
1782 #line 285 "m68k-parse.y"
1784 op->mode = BASE;
1785 op->reg = (yyvsp[(5) - (6)].reg);
1786 op->disp = (yyvsp[(2) - (6)].exp);
1787 op->index = (yyvsp[(4) - (6)].indexreg);
1789 break;
1791 case 30:
1792 #line 292 "m68k-parse.y"
1794 op->mode = BASE;
1795 op->disp = (yyvsp[(4) - (5)].exp);
1796 op->index = (yyvsp[(2) - (5)].indexreg);
1798 break;
1800 case 31:
1801 #line 298 "m68k-parse.y"
1803 op->mode = BASE;
1804 op->reg = (yyvsp[(3) - (6)].reg);
1805 op->disp = (yyvsp[(1) - (6)].exp);
1806 op->index = (yyvsp[(5) - (6)].indexreg);
1808 break;
1810 case 32:
1811 #line 305 "m68k-parse.y"
1813 op->mode = BASE;
1814 op->reg = (yyvsp[(2) - (5)].reg);
1815 op->index = (yyvsp[(4) - (5)].indexreg);
1817 break;
1819 case 33:
1820 #line 311 "m68k-parse.y"
1822 if ((yyvsp[(3) - (6)].reg) == PC || (yyvsp[(3) - (6)].reg) == ZPC)
1823 yyerror (_("syntax error"));
1824 op->mode = BASE;
1825 op->reg = (yyvsp[(5) - (6)].reg);
1826 op->disp = (yyvsp[(1) - (6)].exp);
1827 op->index.reg = (yyvsp[(3) - (6)].reg);
1828 op->index.size = SIZE_UNSPEC;
1829 op->index.scale = 1;
1831 break;
1833 case 34:
1834 #line 322 "m68k-parse.y"
1836 if ((yyvsp[(2) - (5)].reg) == PC || (yyvsp[(2) - (5)].reg) == ZPC)
1837 yyerror (_("syntax error"));
1838 op->mode = BASE;
1839 op->reg = (yyvsp[(4) - (5)].reg);
1840 op->index.reg = (yyvsp[(2) - (5)].reg);
1841 op->index.size = SIZE_UNSPEC;
1842 op->index.scale = 1;
1844 break;
1846 case 35:
1847 #line 332 "m68k-parse.y"
1849 op->mode = BASE;
1850 op->reg = (yyvsp[(4) - (5)].reg);
1851 op->disp = (yyvsp[(1) - (5)].exp);
1852 op->index = (yyvsp[(3) - (5)].indexreg);
1854 break;
1856 case 36:
1857 #line 339 "m68k-parse.y"
1859 op->mode = BASE;
1860 op->reg = (yyvsp[(3) - (4)].reg);
1861 op->index = (yyvsp[(2) - (4)].indexreg);
1863 break;
1865 case 37:
1866 #line 345 "m68k-parse.y"
1868 op->mode = POST;
1869 op->reg = (yyvsp[(4) - (9)].reg);
1870 op->disp = (yyvsp[(3) - (9)].exp);
1871 op->index = (yyvsp[(7) - (9)].indexreg);
1872 op->odisp = (yyvsp[(8) - (9)].exp);
1874 break;
1876 case 38:
1877 #line 353 "m68k-parse.y"
1879 op->mode = POST;
1880 op->reg = (yyvsp[(4) - (7)].reg);
1881 op->disp = (yyvsp[(3) - (7)].exp);
1882 op->odisp = (yyvsp[(6) - (7)].exp);
1884 break;
1886 case 39:
1887 #line 360 "m68k-parse.y"
1889 op->mode = POST;
1890 op->reg = (yyvsp[(3) - (8)].reg);
1891 op->index = (yyvsp[(6) - (8)].indexreg);
1892 op->odisp = (yyvsp[(7) - (8)].exp);
1894 break;
1896 case 40:
1897 #line 367 "m68k-parse.y"
1899 op->mode = POST;
1900 op->reg = (yyvsp[(3) - (6)].reg);
1901 op->odisp = (yyvsp[(5) - (6)].exp);
1903 break;
1905 case 41:
1906 #line 373 "m68k-parse.y"
1908 op->mode = PRE;
1909 op->reg = (yyvsp[(5) - (10)].reg);
1910 op->disp = (yyvsp[(3) - (10)].exp);
1911 op->index = (yyvsp[(7) - (10)].indexreg);
1912 op->odisp = (yyvsp[(9) - (10)].exp);
1914 break;
1916 case 42:
1917 #line 381 "m68k-parse.y"
1919 op->mode = PRE;
1920 op->reg = (yyvsp[(3) - (8)].reg);
1921 op->index = (yyvsp[(5) - (8)].indexreg);
1922 op->odisp = (yyvsp[(7) - (8)].exp);
1924 break;
1926 case 43:
1927 #line 388 "m68k-parse.y"
1929 if ((yyvsp[(5) - (10)].reg) == PC || (yyvsp[(5) - (10)].reg) == ZPC)
1930 yyerror (_("syntax error"));
1931 op->mode = PRE;
1932 op->reg = (yyvsp[(7) - (10)].reg);
1933 op->disp = (yyvsp[(3) - (10)].exp);
1934 op->index.reg = (yyvsp[(5) - (10)].reg);
1935 op->index.size = SIZE_UNSPEC;
1936 op->index.scale = 1;
1937 op->odisp = (yyvsp[(9) - (10)].exp);
1939 break;
1941 case 44:
1942 #line 400 "m68k-parse.y"
1944 if ((yyvsp[(3) - (8)].reg) == PC || (yyvsp[(3) - (8)].reg) == ZPC)
1945 yyerror (_("syntax error"));
1946 op->mode = PRE;
1947 op->reg = (yyvsp[(5) - (8)].reg);
1948 op->index.reg = (yyvsp[(3) - (8)].reg);
1949 op->index.size = SIZE_UNSPEC;
1950 op->index.scale = 1;
1951 op->odisp = (yyvsp[(7) - (8)].exp);
1953 break;
1955 case 45:
1956 #line 411 "m68k-parse.y"
1958 op->mode = PRE;
1959 op->reg = (yyvsp[(5) - (8)].reg);
1960 op->disp = (yyvsp[(3) - (8)].exp);
1961 op->index = (yyvsp[(4) - (8)].indexreg);
1962 op->odisp = (yyvsp[(7) - (8)].exp);
1964 break;
1966 case 46:
1967 #line 424 "m68k-parse.y"
1969 /* We use optzapc to avoid a shift/reduce conflict. */
1970 if ((yyvsp[(1) - (2)].reg) < ADDR0 || (yyvsp[(1) - (2)].reg) > ADDR7)
1971 yyerror (_("syntax error"));
1972 op->mode = AINDR;
1973 op->reg = (yyvsp[(1) - (2)].reg);
1975 break;
1977 case 47:
1978 #line 432 "m68k-parse.y"
1980 /* We use optzapc to avoid a shift/reduce conflict. */
1981 if ((yyvsp[(1) - (3)].reg) < ADDR0 || (yyvsp[(1) - (3)].reg) > ADDR7)
1982 yyerror (_("syntax error"));
1983 op->mode = AINC;
1984 op->reg = (yyvsp[(1) - (3)].reg);
1986 break;
1988 case 48:
1989 #line 440 "m68k-parse.y"
1991 /* We use optzapc to avoid a shift/reduce conflict. */
1992 if ((yyvsp[(1) - (3)].reg) < ADDR0 || (yyvsp[(1) - (3)].reg) > ADDR7)
1993 yyerror (_("syntax error"));
1994 op->mode = ADEC;
1995 op->reg = (yyvsp[(1) - (3)].reg);
1997 break;
1999 case 49:
2000 #line 448 "m68k-parse.y"
2002 op->reg = (yyvsp[(1) - (5)].reg);
2003 op->disp = (yyvsp[(4) - (5)].exp);
2004 if (((yyvsp[(1) - (5)].reg) >= ZADDR0 && (yyvsp[(1) - (5)].reg) <= ZADDR7)
2005 || (yyvsp[(1) - (5)].reg) == ZPC)
2006 op->mode = BASE;
2007 else
2008 op->mode = DISP;
2010 break;
2012 case 50:
2013 #line 458 "m68k-parse.y"
2015 op->mode = BASE;
2016 op->reg = (yyvsp[(1) - (6)].reg);
2017 op->disp = (yyvsp[(4) - (6)].exp);
2018 op->index = (yyvsp[(5) - (6)].indexreg);
2020 break;
2022 case 51:
2023 #line 465 "m68k-parse.y"
2025 op->mode = POST;
2026 op->reg = (yyvsp[(1) - (10)].reg);
2027 op->disp = (yyvsp[(4) - (10)].exp);
2028 op->index = (yyvsp[(9) - (10)].indexreg);
2029 op->odisp = (yyvsp[(8) - (10)].exp);
2031 break;
2033 case 52:
2034 #line 473 "m68k-parse.y"
2036 op->mode = POST;
2037 op->reg = (yyvsp[(1) - (9)].reg);
2038 op->disp = (yyvsp[(4) - (9)].exp);
2039 op->odisp = (yyvsp[(8) - (9)].exp);
2041 break;
2043 case 53:
2044 #line 480 "m68k-parse.y"
2046 op->mode = PRE;
2047 op->reg = (yyvsp[(1) - (10)].reg);
2048 op->disp = (yyvsp[(4) - (10)].exp);
2049 op->index = (yyvsp[(5) - (10)].indexreg);
2050 op->odisp = (yyvsp[(9) - (10)].exp);
2052 break;
2054 case 55:
2055 #line 495 "m68k-parse.y"
2057 (yyval.indexreg).reg = (yyvsp[(1) - (1)].reg);
2058 (yyval.indexreg).size = SIZE_UNSPEC;
2059 (yyval.indexreg).scale = 1;
2061 break;
2063 case 57:
2064 #line 509 "m68k-parse.y"
2066 (yyval.indexreg).reg = (yyvsp[(1) - (1)].reg);
2067 (yyval.indexreg).size = SIZE_UNSPEC;
2068 (yyval.indexreg).scale = 1;
2070 break;
2072 case 68:
2073 #line 552 "m68k-parse.y"
2075 (yyval.reg) = ZADDR0;
2077 break;
2079 case 72:
2080 #line 569 "m68k-parse.y"
2082 (yyval.reg) = ZADDR0;
2084 break;
2086 case 73:
2087 #line 573 "m68k-parse.y"
2089 (yyval.reg) = (yyvsp[(2) - (2)].reg);
2091 break;
2093 case 74:
2094 #line 582 "m68k-parse.y"
2096 (yyval.exp).exp.X_op = O_absent;
2097 (yyval.exp).size = SIZE_UNSPEC;
2099 break;
2101 case 75:
2102 #line 587 "m68k-parse.y"
2104 (yyval.exp) = (yyvsp[(2) - (2)].exp);
2106 break;
2108 case 76:
2109 #line 596 "m68k-parse.y"
2111 (yyval.exp).exp.X_op = O_absent;
2112 (yyval.exp).size = SIZE_UNSPEC;
2114 break;
2116 case 77:
2117 #line 601 "m68k-parse.y"
2119 (yyval.exp) = (yyvsp[(1) - (2)].exp);
2121 break;
2123 case 79:
2124 #line 611 "m68k-parse.y"
2126 (yyval.mask) = (yyvsp[(1) - (3)].mask) | (yyvsp[(3) - (3)].mask);
2128 break;
2130 case 80:
2131 #line 615 "m68k-parse.y"
2133 (yyval.mask) = (1 << (yyvsp[(1) - (3)].onereg)) | (yyvsp[(3) - (3)].mask);
2135 break;
2137 case 81:
2138 #line 627 "m68k-parse.y"
2140 (yyval.mask) = 1 << (yyvsp[(1) - (1)].onereg);
2142 break;
2144 case 83:
2145 #line 632 "m68k-parse.y"
2147 (yyval.mask) = (yyvsp[(1) - (3)].mask) | (yyvsp[(3) - (3)].mask);
2149 break;
2151 case 84:
2152 #line 636 "m68k-parse.y"
2154 (yyval.mask) = (1 << (yyvsp[(1) - (3)].onereg)) | (yyvsp[(3) - (3)].mask);
2156 break;
2158 case 85:
2159 #line 643 "m68k-parse.y"
2161 if ((yyvsp[(1) - (3)].onereg) <= (yyvsp[(3) - (3)].onereg))
2162 (yyval.mask) = (1 << ((yyvsp[(3) - (3)].onereg) + 1)) - 1 - ((1 << (yyvsp[(1) - (3)].onereg)) - 1);
2163 else
2164 (yyval.mask) = (1 << ((yyvsp[(1) - (3)].onereg) + 1)) - 1 - ((1 << (yyvsp[(3) - (3)].onereg)) - 1);
2166 break;
2168 case 86:
2169 #line 653 "m68k-parse.y"
2171 (yyval.onereg) = (yyvsp[(1) - (1)].reg) - DATA0;
2173 break;
2175 case 87:
2176 #line 657 "m68k-parse.y"
2178 (yyval.onereg) = (yyvsp[(1) - (1)].reg) - ADDR0 + 8;
2180 break;
2182 case 88:
2183 #line 661 "m68k-parse.y"
2185 (yyval.onereg) = (yyvsp[(1) - (1)].reg) - FP0 + 16;
2187 break;
2189 case 89:
2190 #line 665 "m68k-parse.y"
2192 if ((yyvsp[(1) - (1)].reg) == FPI)
2193 (yyval.onereg) = 24;
2194 else if ((yyvsp[(1) - (1)].reg) == FPS)
2195 (yyval.onereg) = 25;
2196 else
2197 (yyval.onereg) = 26;
2199 break;
2202 /* Line 1267 of yacc.c. */
2203 #line 2204 "m68k-parse.c"
2204 default: break;
2206 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2208 YYPOPSTACK (yylen);
2209 yylen = 0;
2210 YY_STACK_PRINT (yyss, yyssp);
2212 *++yyvsp = yyval;
2215 /* Now `shift' the result of the reduction. Determine what state
2216 that goes to, based on the state we popped back to and the rule
2217 number reduced by. */
2219 yyn = yyr1[yyn];
2221 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2222 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2223 yystate = yytable[yystate];
2224 else
2225 yystate = yydefgoto[yyn - YYNTOKENS];
2227 goto yynewstate;
2230 /*------------------------------------.
2231 | yyerrlab -- here on detecting error |
2232 `------------------------------------*/
2233 yyerrlab:
2234 /* If not already recovering from an error, report this error. */
2235 if (!yyerrstatus)
2237 ++yynerrs;
2238 #if ! YYERROR_VERBOSE
2239 yyerror (YY_("syntax error"));
2240 #else
2242 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2243 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2245 YYSIZE_T yyalloc = 2 * yysize;
2246 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2247 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2248 if (yymsg != yymsgbuf)
2249 YYSTACK_FREE (yymsg);
2250 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2251 if (yymsg)
2252 yymsg_alloc = yyalloc;
2253 else
2255 yymsg = yymsgbuf;
2256 yymsg_alloc = sizeof yymsgbuf;
2260 if (0 < yysize && yysize <= yymsg_alloc)
2262 (void) yysyntax_error (yymsg, yystate, yychar);
2263 yyerror (yymsg);
2265 else
2267 yyerror (YY_("syntax error"));
2268 if (yysize != 0)
2269 goto yyexhaustedlab;
2272 #endif
2277 if (yyerrstatus == 3)
2279 /* If just tried and failed to reuse look-ahead token after an
2280 error, discard it. */
2282 if (yychar <= YYEOF)
2284 /* Return failure if at end of input. */
2285 if (yychar == YYEOF)
2286 YYABORT;
2288 else
2290 yydestruct ("Error: discarding",
2291 yytoken, &yylval);
2292 yychar = YYEMPTY;
2296 /* Else will try to reuse look-ahead token after shifting the error
2297 token. */
2298 goto yyerrlab1;
2301 /*---------------------------------------------------.
2302 | yyerrorlab -- error raised explicitly by YYERROR. |
2303 `---------------------------------------------------*/
2304 yyerrorlab:
2306 /* Pacify compilers like GCC when the user code never invokes
2307 YYERROR and the label yyerrorlab therefore never appears in user
2308 code. */
2309 if (/*CONSTCOND*/ 0)
2310 goto yyerrorlab;
2312 /* Do not reclaim the symbols of the rule which action triggered
2313 this YYERROR. */
2314 YYPOPSTACK (yylen);
2315 yylen = 0;
2316 YY_STACK_PRINT (yyss, yyssp);
2317 yystate = *yyssp;
2318 goto yyerrlab1;
2321 /*-------------------------------------------------------------.
2322 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2323 `-------------------------------------------------------------*/
2324 yyerrlab1:
2325 yyerrstatus = 3; /* Each real token shifted decrements this. */
2327 for (;;)
2329 yyn = yypact[yystate];
2330 if (yyn != YYPACT_NINF)
2332 yyn += YYTERROR;
2333 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2335 yyn = yytable[yyn];
2336 if (0 < yyn)
2337 break;
2341 /* Pop the current state because it cannot handle the error token. */
2342 if (yyssp == yyss)
2343 YYABORT;
2346 yydestruct ("Error: popping",
2347 yystos[yystate], yyvsp);
2348 YYPOPSTACK (1);
2349 yystate = *yyssp;
2350 YY_STACK_PRINT (yyss, yyssp);
2353 if (yyn == YYFINAL)
2354 YYACCEPT;
2356 *++yyvsp = yylval;
2359 /* Shift the error token. */
2360 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2362 yystate = yyn;
2363 goto yynewstate;
2366 /*-------------------------------------.
2367 | yyacceptlab -- YYACCEPT comes here. |
2368 `-------------------------------------*/
2369 yyacceptlab:
2370 yyresult = 0;
2371 goto yyreturn;
2373 /*-----------------------------------.
2374 | yyabortlab -- YYABORT comes here. |
2375 `-----------------------------------*/
2376 yyabortlab:
2377 yyresult = 1;
2378 goto yyreturn;
2380 #ifndef yyoverflow
2381 /*-------------------------------------------------.
2382 | yyexhaustedlab -- memory exhaustion comes here. |
2383 `-------------------------------------------------*/
2384 yyexhaustedlab:
2385 yyerror (YY_("memory exhausted"));
2386 yyresult = 2;
2387 /* Fall through. */
2388 #endif
2390 yyreturn:
2391 if (yychar != YYEOF && yychar != YYEMPTY)
2392 yydestruct ("Cleanup: discarding lookahead",
2393 yytoken, &yylval);
2394 /* Do not reclaim the symbols of the rule which action triggered
2395 this YYABORT or YYACCEPT. */
2396 YYPOPSTACK (yylen);
2397 YY_STACK_PRINT (yyss, yyssp);
2398 while (yyssp != yyss)
2400 yydestruct ("Cleanup: popping",
2401 yystos[*yyssp], yyvsp);
2402 YYPOPSTACK (1);
2404 #ifndef yyoverflow
2405 if (yyss != yyssa)
2406 YYSTACK_FREE (yyss);
2407 #endif
2408 #if YYERROR_VERBOSE
2409 if (yymsg != yymsgbuf)
2410 YYSTACK_FREE (yymsg);
2411 #endif
2412 /* Make sure YYID is used. */
2413 return YYID (yyresult);
2417 #line 675 "m68k-parse.y"
2420 /* The string to parse is stored here, and modified by yylex. */
2422 static char *str;
2424 /* The original string pointer. */
2426 static char *strorig;
2428 /* If *CCP could be a register, return the register number and advance
2429 *CCP. Otherwise don't change *CCP, and return 0. */
2431 static enum m68k_register
2432 m68k_reg_parse (ccp)
2433 register char **ccp;
2435 char *start = *ccp;
2436 char c;
2437 char *p;
2438 symbolS *symbolp;
2440 if (flag_reg_prefix_optional)
2442 if (*start == REGISTER_PREFIX)
2443 start++;
2444 p = start;
2446 else
2448 if (*start != REGISTER_PREFIX)
2449 return 0;
2450 p = start + 1;
2453 if (! is_name_beginner (*p))
2454 return 0;
2456 p++;
2457 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
2458 p++;
2460 c = *p;
2461 *p = 0;
2462 symbolp = symbol_find (start);
2463 *p = c;
2465 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
2467 *ccp = p;
2468 return S_GET_VALUE (symbolp);
2471 /* In MRI mode, something like foo.bar can be equated to a register
2472 name. */
2473 while (flag_mri && c == '.')
2475 ++p;
2476 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*')
2477 p++;
2478 c = *p;
2479 *p = '\0';
2480 symbolp = symbol_find (start);
2481 *p = c;
2482 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section)
2484 *ccp = p;
2485 return S_GET_VALUE (symbolp);
2489 return 0;
2492 /* The lexer. */
2494 static int
2495 yylex ()
2497 enum m68k_register reg;
2498 char *s;
2499 int parens;
2500 int c = 0;
2501 int tail = 0;
2502 char *hold;
2504 if (*str == ' ')
2505 ++str;
2507 if (*str == '\0')
2508 return 0;
2510 /* Various special characters are just returned directly. */
2511 switch (*str)
2513 case '@':
2514 /* In MRI mode, this can be the start of an octal number. */
2515 if (flag_mri)
2517 if (ISDIGIT (str[1])
2518 || ((str[1] == '+' || str[1] == '-')
2519 && ISDIGIT (str[2])))
2520 break;
2522 /* Fall through. */
2523 case '#':
2524 case '&':
2525 case ',':
2526 case ')':
2527 case '/':
2528 case '[':
2529 case ']':
2530 case '<':
2531 case '>':
2532 return *str++;
2533 case '+':
2534 /* It so happens that a '+' can only appear at the end of an
2535 operand, or if it is trailed by an '&'(see mac load insn).
2536 If it appears anywhere else, it must be a unary. */
2537 if (str[1] == '\0' || (str[1] == '&' && str[2] == '\0'))
2538 return *str++;
2539 break;
2540 case '-':
2541 /* A '-' can only appear in -(ar), rn-rn, or ar@-. If it
2542 appears anywhere else, it must be a unary minus on an
2543 expression, unless it it trailed by a '&'(see mac load insn). */
2544 if (str[1] == '\0' || (str[1] == '&' && str[2] == '\0'))
2545 return *str++;
2546 s = str + 1;
2547 if (*s == '(')
2548 ++s;
2549 if (m68k_reg_parse (&s) != 0)
2550 return *str++;
2551 break;
2552 case '(':
2553 /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or
2554 `)('. If it appears anywhere else, it must be starting an
2555 expression. */
2556 if (str[1] == '['
2557 || (str > strorig
2558 && (str[-1] == '@'
2559 || str[-1] == ')')))
2560 return *str++;
2561 s = str + 1;
2562 if (m68k_reg_parse (&s) != 0)
2563 return *str++;
2564 /* Check for the case of '(expr,...' by scanning ahead. If we
2565 find a comma outside of balanced parentheses, we return '('.
2566 If we find an unbalanced right parenthesis, then presumably
2567 the '(' really starts an expression. */
2568 parens = 0;
2569 for (s = str + 1; *s != '\0'; s++)
2571 if (*s == '(')
2572 ++parens;
2573 else if (*s == ')')
2575 if (parens == 0)
2576 break;
2577 --parens;
2579 else if (*s == ',' && parens == 0)
2581 /* A comma can not normally appear in an expression, so
2582 this is a case of '(expr,...'. */
2583 return *str++;
2588 /* See if it's a register. */
2590 reg = m68k_reg_parse (&str);
2591 if (reg != 0)
2593 int ret;
2595 yylval.reg = reg;
2597 if (reg >= DATA0 && reg <= DATA7)
2598 ret = DR;
2599 else if (reg >= ADDR0 && reg <= ADDR7)
2600 ret = AR;
2601 else if (reg >= FP0 && reg <= FP7)
2602 return FPR;
2603 else if (reg == FPI
2604 || reg == FPS
2605 || reg == FPC)
2606 return FPCR;
2607 else if (reg == PC)
2608 return LPC;
2609 else if (reg >= ZDATA0 && reg <= ZDATA7)
2610 ret = ZDR;
2611 else if (reg >= ZADDR0 && reg <= ZADDR7)
2612 ret = ZAR;
2613 else if (reg == ZPC)
2614 return LZPC;
2615 else
2616 return CREG;
2618 /* If we get here, we have a data or address register. We
2619 must check for a size or scale; if we find one, we must
2620 return INDEXREG. */
2622 s = str;
2624 if (*s != '.' && *s != ':' && *s != '*')
2625 return ret;
2627 yylval.indexreg.reg = reg;
2629 if (*s != '.' && *s != ':')
2630 yylval.indexreg.size = SIZE_UNSPEC;
2631 else
2633 ++s;
2634 switch (*s)
2636 case 'w':
2637 case 'W':
2638 yylval.indexreg.size = SIZE_WORD;
2639 ++s;
2640 break;
2641 case 'l':
2642 case 'L':
2643 yylval.indexreg.size = SIZE_LONG;
2644 ++s;
2645 break;
2646 default:
2647 yyerror (_("illegal size specification"));
2648 yylval.indexreg.size = SIZE_UNSPEC;
2649 break;
2653 yylval.indexreg.scale = 1;
2655 if (*s == '*' || *s == ':')
2657 expressionS scale;
2659 ++s;
2661 hold = input_line_pointer;
2662 input_line_pointer = s;
2663 expression (&scale);
2664 s = input_line_pointer;
2665 input_line_pointer = hold;
2667 if (scale.X_op != O_constant)
2668 yyerror (_("scale specification must resolve to a number"));
2669 else
2671 switch (scale.X_add_number)
2673 case 1:
2674 case 2:
2675 case 4:
2676 case 8:
2677 yylval.indexreg.scale = scale.X_add_number;
2678 break;
2679 default:
2680 yyerror (_("invalid scale value"));
2681 break;
2686 str = s;
2688 return INDEXREG;
2691 /* It must be an expression. Before we call expression, we need to
2692 look ahead to see if there is a size specification. We must do
2693 that first, because otherwise foo.l will be treated as the symbol
2694 foo.l, rather than as the symbol foo with a long size
2695 specification. The grammar requires that all expressions end at
2696 the end of the operand, or with ',', '(', ']', ')'. */
2698 parens = 0;
2699 for (s = str; *s != '\0'; s++)
2701 if (*s == '(')
2703 if (parens == 0
2704 && s > str
2705 && (s[-1] == ')' || ISALNUM (s[-1])))
2706 break;
2707 ++parens;
2709 else if (*s == ')')
2711 if (parens == 0)
2712 break;
2713 --parens;
2715 else if (parens == 0
2716 && (*s == ',' || *s == ']'))
2717 break;
2720 yylval.exp.size = SIZE_UNSPEC;
2721 if (s <= str + 2
2722 || (s[-2] != '.' && s[-2] != ':'))
2723 tail = 0;
2724 else
2726 switch (s[-1])
2728 case 's':
2729 case 'S':
2730 case 'b':
2731 case 'B':
2732 yylval.exp.size = SIZE_BYTE;
2733 break;
2734 case 'w':
2735 case 'W':
2736 yylval.exp.size = SIZE_WORD;
2737 break;
2738 case 'l':
2739 case 'L':
2740 yylval.exp.size = SIZE_LONG;
2741 break;
2742 default:
2743 break;
2745 if (yylval.exp.size != SIZE_UNSPEC)
2746 tail = 2;
2749 #ifdef OBJ_ELF
2751 /* Look for @PLTPC, etc. */
2752 char *cp;
2754 yylval.exp.pic_reloc = pic_none;
2755 cp = s - tail;
2756 if (cp - 6 > str && cp[-6] == '@')
2758 if (strncmp (cp - 6, "@PLTPC", 6) == 0)
2760 yylval.exp.pic_reloc = pic_plt_pcrel;
2761 tail += 6;
2763 else if (strncmp (cp - 6, "@GOTPC", 6) == 0)
2765 yylval.exp.pic_reloc = pic_got_pcrel;
2766 tail += 6;
2769 else if (cp - 4 > str && cp[-4] == '@')
2771 if (strncmp (cp - 4, "@PLT", 4) == 0)
2773 yylval.exp.pic_reloc = pic_plt_off;
2774 tail += 4;
2776 else if (strncmp (cp - 4, "@GOT", 4) == 0)
2778 yylval.exp.pic_reloc = pic_got_off;
2779 tail += 4;
2783 #endif
2785 if (tail != 0)
2787 c = s[-tail];
2788 s[-tail] = 0;
2791 hold = input_line_pointer;
2792 input_line_pointer = str;
2793 expression (&yylval.exp.exp);
2794 str = input_line_pointer;
2795 input_line_pointer = hold;
2797 if (tail != 0)
2799 s[-tail] = c;
2800 str = s;
2803 return EXPR;
2806 /* Parse an m68k operand. This is the only function which is called
2807 from outside this file. */
2810 m68k_ip_op (s, oparg)
2811 char *s;
2812 struct m68k_op *oparg;
2814 memset (oparg, 0, sizeof *oparg);
2815 oparg->error = NULL;
2816 oparg->index.reg = ZDATA0;
2817 oparg->index.scale = 1;
2818 oparg->disp.exp.X_op = O_absent;
2819 oparg->odisp.exp.X_op = O_absent;
2821 str = strorig = s;
2822 op = oparg;
2824 return yyparse ();
2827 /* The error handler. */
2829 static void
2830 yyerror (s)
2831 const char *s;
2833 op->error = s;