1/* A Bison parser, made by GNU Bison 3.0. */ 2 3/* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. 6 7 This program is free software: you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation, either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20/* As a special exception, you may create a larger work that contains 21 part or all of the Bison parser skeleton and distribute that work 22 under terms of your choice, so long as that work isn't itself a 23 parser generator using the skeleton or a modified version thereof 24 as a parser skeleton. Alternatively, if you modify or redistribute 25 the parser skeleton itself, you may (at your option) remove this 26 special exception, which will cause the skeleton and the resulting 27 Bison output files to be licensed under the GNU General Public 28 License without this special exception. 29 30 This special exception was added by the Free Software Foundation in 31 version 2.2 of Bison. */ 32 33/* C LALR(1) parser skeleton written by Richard Stallman, by 34 simplifying the original so-called "semantic" parser. */ 35 36/* All symbols defined below should begin with yy or YY, to avoid 37 infringing on user name space. This should be done even for local 38 variables, as they might otherwise be expanded by user macros. 39 There are some unavoidable exceptions within include files to 40 define necessary library symbols; they are noted "INFRINGES ON 41 USER NAME SPACE" below. */ 42 43/* Identify Bison output. */ 44#define YYBISON 1 45 46/* Bison version. */ 47#define YYBISON_VERSION "3.0" 48 49/* Skeleton name. */ 50#define YYSKELETON_NAME "yacc.c" 51 52/* Pure parsers. */ 53#define YYPURE 0 54 55/* Push parsers. */ 56#define YYPUSH 0 57 58/* Pull parsers. */ 59#define YYPULL 1 60 61 62 63 64/* Copy the first part of user declarations. */ 65#line 27 "m68k-parse.y" /* yacc.c:339 */ 66 67 68#include "as.h" 69#include "tc-m68k.h" 70#include "m68k-parse.h" 71#include "safe-ctype.h" 72 73/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, 74 etc), as well as gratuitously global symbol names If other parser 75 generators (bison, byacc, etc) produce additional global names that 76 conflict at link time, then those parser generators need to be 77 fixed instead of adding those names to this list. */ 78 79#define yymaxdepth m68k_maxdepth 80#define yyparse m68k_parse 81#define yylex m68k_lex 82#define yyerror m68k_error 83#define yylval m68k_lval 84#define yychar m68k_char 85#define yydebug m68k_debug 86#define yypact m68k_pact 87#define yyr1 m68k_r1 88#define yyr2 m68k_r2 89#define yydef m68k_def 90#define yychk m68k_chk 91#define yypgo m68k_pgo 92#define yyact m68k_act 93#define yyexca m68k_exca 94#define yyerrflag m68k_errflag 95#define yynerrs m68k_nerrs 96#define yyps m68k_ps 97#define yypv m68k_pv 98#define yys m68k_s 99#define yy_yys m68k_yys 100#define yystate m68k_state 101#define yytmp m68k_tmp 102#define yyv m68k_v 103#define yy_yyv m68k_yyv 104#define yyval m68k_val 105#define yylloc m68k_lloc 106#define yyreds m68k_reds /* With YYDEBUG defined */ 107#define yytoks m68k_toks /* With YYDEBUG defined */ 108#define yylhs m68k_yylhs 109#define yylen m68k_yylen 110#define yydefred m68k_yydefred 111#define yydgoto m68k_yydgoto 112#define yysindex m68k_yysindex 113#define yyrindex m68k_yyrindex 114#define yygindex m68k_yygindex 115#define yytable m68k_yytable 116#define yycheck m68k_yycheck 117 118#ifndef YYDEBUG 119#define YYDEBUG 1 120#endif 121 122/* Internal functions. */ 123 124static enum m68k_register m68k_reg_parse (char **); 125static int yylex (void); 126static void yyerror (const char *); 127 128/* The parser sets fields pointed to by this global variable. */ 129static struct m68k_op *op; 130 131 132#line 133 "m68k-parse.c" /* yacc.c:339 */ 133 134# ifndef YY_NULL 135# if defined __cplusplus && 201103L <= __cplusplus 136# define YY_NULL nullptr 137# else 138# define YY_NULL 0 139# endif 140# endif 141 142/* Enabling verbose error messages. */ 143#ifdef YYERROR_VERBOSE 144# undef YYERROR_VERBOSE 145# define YYERROR_VERBOSE 1 146#else 147# define YYERROR_VERBOSE 0 148#endif 149 150 151/* Debug traces. */ 152#ifndef YYDEBUG 153# define YYDEBUG 0 154#endif 155#if YYDEBUG 156extern int yydebug; 157#endif 158 159/* Token type. */ 160#ifndef YYTOKENTYPE 161# define YYTOKENTYPE 162 enum yytokentype 163 { 164 DR = 258, 165 AR = 259, 166 FPR = 260, 167 FPCR = 261, 168 LPC = 262, 169 ZAR = 263, 170 ZDR = 264, 171 LZPC = 265, 172 CREG = 266, 173 INDEXREG = 267, 174 EXPR = 268 175 }; 176#endif 177/* Tokens. */ 178#define DR 258 179#define AR 259 180#define FPR 260 181#define FPCR 261 182#define LPC 262 183#define ZAR 263 184#define ZDR 264 185#define LZPC 265 186#define CREG 266 187#define INDEXREG 267 188#define EXPR 268 189 190/* Value type. */ 191#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 192typedef union YYSTYPE YYSTYPE; 193union YYSTYPE 194{ 195#line 95 "m68k-parse.y" /* yacc.c:355 */ 196 197 struct m68k_indexreg indexreg; 198 enum m68k_register reg; 199 struct m68k_exp exp; 200 unsigned long mask; 201 int onereg; 202 int trailing_ampersand; 203 204#line 205 "m68k-parse.c" /* yacc.c:355 */ 205}; 206# define YYSTYPE_IS_TRIVIAL 1 207# define YYSTYPE_IS_DECLARED 1 208#endif 209 210 211extern YYSTYPE yylval; 212 213int yyparse (void); 214 215 216 217/* Copy the second part of user declarations. */ 218 219#line 220 "m68k-parse.c" /* yacc.c:358 */ 220 221#ifdef short 222# undef short 223#endif 224 225#ifdef YYTYPE_UINT8 226typedef YYTYPE_UINT8 yytype_uint8; 227#else 228typedef unsigned char yytype_uint8; 229#endif 230 231#ifdef YYTYPE_INT8 232typedef YYTYPE_INT8 yytype_int8; 233#else 234typedef signed char yytype_int8; 235#endif 236 237#ifdef YYTYPE_UINT16 238typedef YYTYPE_UINT16 yytype_uint16; 239#else 240typedef unsigned short int yytype_uint16; 241#endif 242 243#ifdef YYTYPE_INT16 244typedef YYTYPE_INT16 yytype_int16; 245#else 246typedef short int yytype_int16; 247#endif 248 249#ifndef YYSIZE_T 250# ifdef __SIZE_TYPE__ 251# define YYSIZE_T __SIZE_TYPE__ 252# elif defined size_t 253# define YYSIZE_T size_t 254# elif ! defined YYSIZE_T 255# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 256# define YYSIZE_T size_t 257# else 258# define YYSIZE_T unsigned int 259# endif 260#endif 261 262#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 263 264#ifndef YY_ 265# if defined YYENABLE_NLS && YYENABLE_NLS 266# if ENABLE_NLS 267# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 268# define YY_(Msgid) dgettext ("bison-runtime", Msgid) 269# endif 270# endif 271# ifndef YY_ 272# define YY_(Msgid) Msgid 273# endif 274#endif 275 276#ifndef __attribute__ 277/* This feature is available in gcc versions 2.5 and later. */ 278# if (! defined __GNUC__ || __GNUC__ < 2 \ 279 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) 280# define __attribute__(Spec) /* empty */ 281# endif 282#endif 283 284/* Suppress unused-variable warnings by "using" E. */ 285#if ! defined lint || defined __GNUC__ 286# define YYUSE(E) ((void) (E)) 287#else 288# define YYUSE(E) /* empty */ 289#endif 290 291#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 292/* Suppress an incorrect diagnostic about yylval being uninitialized. */ 293# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 294 _Pragma ("GCC diagnostic push") \ 295 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 296 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 297# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 298 _Pragma ("GCC diagnostic pop") 299#else 300# define YY_INITIAL_VALUE(Value) Value 301#endif 302#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 303# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 304# define YY_IGNORE_MAYBE_UNINITIALIZED_END 305#endif 306#ifndef YY_INITIAL_VALUE 307# define YY_INITIAL_VALUE(Value) /* Nothing. */ 308#endif 309 310 311#if ! defined yyoverflow || YYERROR_VERBOSE 312 313/* The parser invokes alloca or malloc; define the necessary symbols. */ 314 315# ifdef YYSTACK_USE_ALLOCA 316# if YYSTACK_USE_ALLOCA 317# ifdef __GNUC__ 318# define YYSTACK_ALLOC __builtin_alloca 319# elif defined __BUILTIN_VA_ARG_INCR 320# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 321# elif defined _AIX 322# define YYSTACK_ALLOC __alloca 323# elif defined _MSC_VER 324# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 325# define alloca _alloca 326# else 327# define YYSTACK_ALLOC alloca 328# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 329# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 330 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 331# ifndef EXIT_SUCCESS 332# define EXIT_SUCCESS 0 333# endif 334# endif 335# endif 336# endif 337# endif 338 339# ifdef YYSTACK_ALLOC 340 /* Pacify GCC's 'empty if-body' warning. */ 341# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 342# ifndef YYSTACK_ALLOC_MAXIMUM 343 /* The OS might guarantee only one guard page at the bottom of the stack, 344 and a page size can be as small as 4096 bytes. So we cannot safely 345 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 346 to allow for a few compiler-allocated temporary stack slots. */ 347# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 348# endif 349# else 350# define YYSTACK_ALLOC YYMALLOC 351# define YYSTACK_FREE YYFREE 352# ifndef YYSTACK_ALLOC_MAXIMUM 353# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 354# endif 355# if (defined __cplusplus && ! defined EXIT_SUCCESS \ 356 && ! ((defined YYMALLOC || defined malloc) \ 357 && (defined YYFREE || defined free))) 358# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 359# ifndef EXIT_SUCCESS 360# define EXIT_SUCCESS 0 361# endif 362# endif 363# ifndef YYMALLOC 364# define YYMALLOC malloc 365# if ! defined malloc && ! defined EXIT_SUCCESS 366void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 367# endif 368# endif 369# ifndef YYFREE 370# define YYFREE free 371# if ! defined free && ! defined EXIT_SUCCESS 372void free (void *); /* INFRINGES ON USER NAME SPACE */ 373# endif 374# endif 375# endif 376#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 377 378 379#if (! defined yyoverflow \ 380 && (! defined __cplusplus \ 381 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 382 383/* A type that is properly aligned for any stack member. */ 384union yyalloc 385{ 386 yytype_int16 yyss_alloc; 387 YYSTYPE yyvs_alloc; 388}; 389 390/* The size of the maximum gap between one aligned stack and the next. */ 391# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 392 393/* The size of an array large to enough to hold all stacks, each with 394 N elements. */ 395# define YYSTACK_BYTES(N) \ 396 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 397 + YYSTACK_GAP_MAXIMUM) 398 399# define YYCOPY_NEEDED 1 400 401/* Relocate STACK from its old location to the new one. The 402 local variables YYSIZE and YYSTACKSIZE give the old and new number of 403 elements in the stack, and YYPTR gives the new location of the 404 stack. Advance YYPTR to a properly aligned location for the next 405 stack. */ 406# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 407 do \ 408 { \ 409 YYSIZE_T yynewbytes; \ 410 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 411 Stack = &yyptr->Stack_alloc; \ 412 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 413 yyptr += yynewbytes / sizeof (*yyptr); \ 414 } \ 415 while (0) 416 417#endif 418 419#if defined YYCOPY_NEEDED && YYCOPY_NEEDED 420/* Copy COUNT objects from SRC to DST. The source and destination do 421 not overlap. */ 422# ifndef YYCOPY 423# if defined __GNUC__ && 1 < __GNUC__ 424# define YYCOPY(Dst, Src, Count) \ 425 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 426# else 427# define YYCOPY(Dst, Src, Count) \ 428 do \ 429 { \ 430 YYSIZE_T yyi; \ 431 for (yyi = 0; yyi < (Count); yyi++) \ 432 (Dst)[yyi] = (Src)[yyi]; \ 433 } \ 434 while (0) 435# endif 436# endif 437#endif /* !YYCOPY_NEEDED */ 438 439/* YYFINAL -- State number of the termination state. */ 440#define YYFINAL 44 441/* YYLAST -- Last index in YYTABLE. */ 442#define YYLAST 215 443 444/* YYNTOKENS -- Number of terminals. */ 445#define YYNTOKENS 27 446/* YYNNTS -- Number of nonterminals. */ 447#define YYNNTS 21 448/* YYNRULES -- Number of rules. */ 449#define YYNRULES 89 450/* YYNSTATES -- Number of states. */ 451#define YYNSTATES 180 452 453/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 454 by yylex, with out-of-bounds checking. */ 455#define YYUNDEFTOK 2 456#define YYMAXUTOK 268 457 458#define YYTRANSLATE(YYX) \ 459 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 460 461/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 462 as returned by yylex, without out-of-bounds checking. */ 463static const yytype_uint8 yytranslate[] = 464{ 465 0, 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, 17, 2, 2, 14, 2, 469 18, 19, 2, 20, 22, 21, 2, 26, 2, 2, 470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 471 15, 2, 16, 2, 25, 2, 2, 2, 2, 2, 472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 474 2, 23, 2, 24, 2, 2, 2, 2, 2, 2, 475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 476 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 477 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 479 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 490 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 491 5, 6, 7, 8, 9, 10, 11, 12, 13 492}; 493 494#if YYDEBUG 495 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 496static const yytype_uint16 yyrline[] = 497{ 498 0, 120, 120, 121, 125, 134, 135, 142, 147, 152, 499 157, 162, 167, 172, 177, 182, 187, 192, 205, 210, 500 215, 220, 230, 240, 250, 255, 260, 265, 272, 283, 501 290, 296, 303, 309, 320, 330, 337, 343, 351, 358, 502 365, 371, 379, 386, 398, 409, 422, 430, 438, 446, 503 456, 463, 471, 478, 492, 493, 506, 507, 519, 520, 504 521, 527, 528, 534, 535, 542, 543, 544, 551, 554, 505 560, 561, 568, 571, 581, 585, 595, 599, 608, 609, 506 613, 625, 629, 630, 634, 641, 651, 655, 659, 663 507}; 508#endif 509 510#if YYDEBUG || YYERROR_VERBOSE || 0 511/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 512 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 513static const char *const yytname[] = 514{ 515 "$end", "error", "$undefined", "DR", "AR", "FPR", "FPCR", "LPC", "ZAR", 516 "ZDR", "LZPC", "CREG", "INDEXREG", "EXPR", "'&'", "'<'", "'>'", "'#'", 517 "'('", "')'", "'+'", "'-'", "','", "'['", "']'", "'@'", "'/'", "$accept", 518 "operand", "optional_ampersand", "generic_operand", "motorola_operand", 519 "mit_operand", "zireg", "zdireg", "zadr", "zdr", "apc", "zapc", 520 "optzapc", "zpc", "optczapc", "optcexpr", "optexprc", "reglist", 521 "ireglist", "reglistpair", "reglistreg", YY_NULL 522}; 523#endif 524 525# ifdef YYPRINT 526/* YYTOKNUM[NUM] -- (External) token number corresponding to the 527 (internal) symbol number NUM (which must be that of a token). */ 528static const yytype_uint16 yytoknum[] = 529{ 530 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 531 265, 266, 267, 268, 38, 60, 62, 35, 40, 41, 532 43, 45, 44, 91, 93, 64, 47 533}; 534# endif 535 536#define YYPACT_NINF -98 537 538#define yypact_value_is_default(Yystate) \ 539 (!!((Yystate) == (-98))) 540 541#define YYTABLE_NINF -64 542 543#define yytable_value_is_error(Yytable_value) \ 544 0 545 546 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 547 STATE-NUM. */ 548static const yytype_int16 yypact[] = 549{ 550 89, 14, 9, 31, 35, -98, -98, -98, -98, 0, 551 36, 42, 28, 56, 63, 67, 90, -98, 75, 75, 552 -98, -98, 86, -98, 96, -15, 123, -98, -98, -98, 553 -98, -98, 97, 115, 119, -98, 120, -98, 122, 16, 554 126, -98, 127, 157, -98, -98, -98, -98, 19, 154, 555 154, 154, -98, 140, 29, 144, -98, -98, -98, 123, 556 141, 99, 18, 70, 147, 105, 148, 152, -98, -98, 557 -98, -98, -98, -98, -98, 142, -13, -98, -98, 146, 558 150, -98, 133, -98, 140, 60, 146, 149, 133, 153, 559 140, 151, -98, -98, -98, -98, -98, -98, -98, 155, 560 158, -98, -98, 159, -98, 62, 143, 154, 154, -98, 561 160, 161, 162, -98, 133, 163, 164, 165, 166, 116, 562 168, 167, -98, -98, -98, -98, 169, -98, 173, -98, 563 -98, -98, -98, -98, 174, 176, 133, 116, 177, 175, 564 175, -98, 175, -98, 175, 170, 178, -98, -98, 180, 565 181, 175, -98, 171, 179, 182, 183, 187, 186, 189, 566 175, 175, 190, -98, -98, -98, -98, 79, 143, 195, 567 191, 192, -98, -98, 193, 194, -98, -98, -98, -98 568}; 569 570 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 571 Performed when YYTABLE does not specify something else to do. Zero 572 means the default is an error. */ 573static const yytype_uint8 yydefact[] = 574{ 575 68, 86, 87, 88, 89, 64, 67, 66, 13, 14, 576 0, 0, 0, 0, 0, 0, 0, 2, 5, 5, 577 65, 69, 0, 17, 78, 0, 0, 16, 7, 8, 578 15, 61, 63, 64, 67, 62, 66, 56, 0, 76, 579 72, 57, 0, 0, 1, 6, 3, 4, 46, 0, 580 0, 0, 63, 72, 0, 18, 24, 25, 26, 0, 581 72, 0, 0, 0, 0, 0, 0, 76, 47, 48, 582 86, 87, 88, 89, 79, 82, 81, 85, 80, 0, 583 0, 23, 0, 19, 72, 0, 77, 0, 0, 74, 584 72, 0, 73, 36, 59, 70, 60, 71, 54, 0, 585 0, 55, 58, 0, 20, 0, 0, 0, 0, 35, 586 0, 0, 0, 21, 0, 73, 74, 0, 0, 0, 587 0, 0, 30, 22, 32, 34, 49, 77, 0, 83, 588 84, 31, 33, 29, 0, 0, 0, 0, 0, 74, 589 74, 75, 74, 40, 74, 0, 50, 27, 28, 0, 590 0, 74, 38, 0, 0, 0, 0, 0, 76, 0, 591 74, 74, 0, 42, 44, 39, 45, 0, 0, 0, 592 0, 0, 37, 52, 0, 0, 41, 43, 51, 53 593}; 594 595 /* YYPGOTO[NTERM-NUM]. */ 596static const yytype_int16 yypgoto[] = 597{ 598 -98, -98, 196, -98, -98, -98, -81, 6, -98, -9, 599 -98, 2, -98, -78, -38, -97, -67, -98, -48, 172, 600 12 601}; 602 603 /* YYDEFGOTO[NTERM-NUM]. */ 604static const yytype_int8 yydefgoto[] = 605{ 606 -1, 16, 46, 17, 18, 19, 100, 40, 101, 102, 607 20, 92, 22, 103, 64, 120, 62, 23, 74, 75, 608 76 609}; 610 611 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 612 positive, shift that token. If negative, reduce the rule whose 613 number is the opposite. If YYTABLE_NINF, syntax error. */ 614static const yytype_int16 yytable[] = 615{ 616 106, 110, 21, 78, 111, 41, 50, 117, 50, -10, 617 118, 51, 25, 108, -9, 80, 42, 41, 26, 138, 618 52, 31, 87, 5, 6, 128, 7, 35, 54, 60, 619 37, -11, 53, 134, -63, -12, 135, 67, 142, 68, 620 69, 61, 154, 155, 29, 156, 112, 157, 81, 27, 621 41, 82, 121, 41, 162, 149, 151, 28, 150, 129, 622 130, 85, 77, 170, 171, 84, 31, 32, 90, 30, 623 33, 34, 35, 36, 52, 37, 38, 5, 6, 113, 624 7, 126, 114, 91, 127, 43, 39, 174, 115, 45, 625 44, 168, 1, 2, 3, 4, 5, 6, 173, 7, 626 8, 127, 9, 10, 11, 12, 13, 14, 31, 94, 627 15, 48, 95, 96, 35, 97, 55, 98, 99, 31, 628 94, 88, 49, 89, 96, 35, 31, 52, 98, 141, 629 5, 6, 35, 7, 56, 37, 31, 94, 57, 58, 630 95, 96, 35, 97, 59, 98, 31, 94, 63, 65, 631 52, 96, 35, 5, 6, 98, 7, 70, 71, 72, 632 73, 66, 79, 86, 83, 105, 93, 104, 107, 109, 633 122, 0, 24, 116, 123, 119, 0, 124, 125, 131, 634 132, 133, 0, 0, 141, 136, 137, 143, 158, 139, 635 140, 144, 146, 147, 145, 148, 152, 153, 163, 167, 636 0, 164, 165, 159, 160, 161, 166, 169, 175, 172, 637 176, 177, 178, 179, 0, 47 638}; 639 640static const yytype_int16 yycheck[] = 641{ 642 67, 82, 0, 51, 82, 14, 21, 88, 21, 0, 643 88, 26, 0, 26, 0, 53, 14, 26, 18, 116, 644 4, 3, 60, 7, 8, 106, 10, 9, 26, 13, 645 12, 0, 26, 114, 25, 0, 114, 18, 119, 20, 646 21, 39, 139, 140, 16, 142, 84, 144, 19, 13, 647 59, 22, 90, 62, 151, 136, 137, 15, 136, 107, 648 108, 59, 50, 160, 161, 59, 3, 4, 62, 13, 649 7, 8, 9, 10, 4, 12, 13, 7, 8, 19, 650 10, 19, 22, 13, 22, 18, 23, 168, 86, 14, 651 0, 158, 3, 4, 5, 6, 7, 8, 19, 10, 652 11, 22, 13, 14, 15, 16, 17, 18, 3, 4, 653 21, 25, 7, 8, 9, 10, 19, 12, 13, 3, 654 4, 22, 26, 24, 8, 9, 3, 4, 12, 13, 655 7, 8, 9, 10, 19, 12, 3, 4, 19, 19, 656 7, 8, 9, 10, 22, 12, 3, 4, 22, 22, 657 4, 8, 9, 7, 8, 12, 10, 3, 4, 5, 658 6, 4, 22, 22, 20, 13, 19, 19, 26, 19, 659 19, -1, 0, 24, 19, 22, -1, 19, 19, 19, 660 19, 19, -1, -1, 13, 22, 22, 19, 18, 24, 661 24, 24, 19, 19, 25, 19, 19, 22, 19, 13, 662 -1, 19, 19, 25, 24, 24, 19, 18, 13, 19, 663 19, 19, 19, 19, -1, 19 664}; 665 666 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 667 symbol of state STATE-NUM. */ 668static const yytype_uint8 yystos[] = 669{ 670 0, 3, 4, 5, 6, 7, 8, 10, 11, 13, 671 14, 15, 16, 17, 18, 21, 28, 30, 31, 32, 672 37, 38, 39, 44, 46, 47, 18, 13, 15, 16, 673 13, 3, 4, 7, 8, 9, 10, 12, 13, 23, 674 34, 36, 38, 18, 0, 14, 29, 29, 25, 26, 675 21, 26, 4, 34, 38, 19, 19, 19, 19, 22, 676 13, 38, 43, 22, 41, 22, 4, 18, 20, 21, 677 3, 4, 5, 6, 45, 46, 47, 47, 45, 22, 678 41, 19, 22, 20, 34, 38, 22, 41, 22, 24, 679 34, 13, 38, 19, 4, 7, 8, 10, 12, 13, 680 33, 35, 36, 40, 19, 13, 43, 26, 26, 19, 681 33, 40, 41, 19, 22, 38, 24, 33, 40, 22, 682 42, 41, 19, 19, 19, 19, 19, 22, 33, 45, 683 45, 19, 19, 19, 33, 40, 22, 22, 42, 24, 684 24, 13, 33, 19, 24, 25, 19, 19, 19, 33, 685 40, 33, 19, 22, 42, 42, 42, 42, 18, 25, 686 24, 24, 42, 19, 19, 19, 19, 13, 43, 18, 687 42, 42, 19, 19, 33, 13, 19, 19, 19, 19 688}; 689 690 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 691static const yytype_uint8 yyr1[] = 692{ 693 0, 27, 28, 28, 28, 29, 29, 30, 30, 30, 694 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 695 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 696 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 697 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 698 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 699 35, 36, 36, 37, 37, 38, 38, 38, 39, 39, 700 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 701 44, 45, 45, 45, 45, 46, 47, 47, 47, 47 702}; 703 704 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 705static const yytype_uint8 yyr2[] = 706{ 707 0, 2, 1, 2, 2, 0, 1, 2, 2, 1, 708 1, 1, 1, 1, 1, 2, 2, 1, 3, 4, 709 4, 5, 5, 4, 3, 3, 3, 7, 7, 6, 710 5, 6, 5, 6, 5, 5, 4, 9, 7, 8, 711 6, 10, 8, 10, 8, 8, 2, 3, 3, 5, 712 6, 10, 9, 10, 1, 1, 1, 1, 1, 1, 713 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 714 1, 1, 0, 2, 0, 2, 0, 2, 1, 3, 715 3, 1, 1, 3, 3, 3, 1, 1, 1, 1 716}; 717 718 719#define yyerrok (yyerrstatus = 0) 720#define yyclearin (yychar = YYEMPTY) 721#define YYEMPTY (-2) 722#define YYEOF 0 723 724#define YYACCEPT goto yyacceptlab 725#define YYABORT goto yyabortlab 726#define YYERROR goto yyerrorlab 727 728 729#define YYRECOVERING() (!!yyerrstatus) 730 731#define YYBACKUP(Token, Value) \ 732do \ 733 if (yychar == YYEMPTY) \ 734 { \ 735 yychar = (Token); \ 736 yylval = (Value); \ 737 YYPOPSTACK (yylen); \ 738 yystate = *yyssp; \ 739 goto yybackup; \ 740 } \ 741 else \ 742 { \ 743 yyerror (YY_("syntax error: cannot back up")); \ 744 YYERROR; \ 745 } \ 746while (0) 747 748/* Error token number */ 749#define YYTERROR 1 750#define YYERRCODE 256 751 752 753 754/* Enable debugging if requested. */ 755#if YYDEBUG 756 757# ifndef YYFPRINTF 758# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 759# define YYFPRINTF fprintf 760# endif 761 762# define YYDPRINTF(Args) \ 763do { \ 764 if (yydebug) \ 765 YYFPRINTF Args; \ 766} while (0) 767 768/* This macro is provided for backward compatibility. */ 769#ifndef YY_LOCATION_PRINT 770# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 771#endif 772 773 774# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 775do { \ 776 if (yydebug) \ 777 { \ 778 YYFPRINTF (stderr, "%s ", Title); \ 779 yy_symbol_print (stderr, \ 780 Type, Value); \ 781 YYFPRINTF (stderr, "\n"); \ 782 } \ 783} while (0) 784 785 786/*----------------------------------------. 787| Print this symbol's value on YYOUTPUT. | 788`----------------------------------------*/ 789 790static void 791yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 792{ 793 FILE *yyo = yyoutput; 794 YYUSE (yyo); 795 if (!yyvaluep) 796 return; 797# ifdef YYPRINT 798 if (yytype < YYNTOKENS) 799 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 800# endif 801 YYUSE (yytype); 802} 803 804 805/*--------------------------------. 806| Print this symbol on YYOUTPUT. | 807`--------------------------------*/ 808 809static void 810yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 811{ 812 YYFPRINTF (yyoutput, "%s %s (", 813 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 814 815 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 816 YYFPRINTF (yyoutput, ")"); 817} 818 819/*------------------------------------------------------------------. 820| yy_stack_print -- Print the state stack from its BOTTOM up to its | 821| TOP (included). | 822`------------------------------------------------------------------*/ 823 824static void 825yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 826{ 827 YYFPRINTF (stderr, "Stack now"); 828 for (; yybottom <= yytop; yybottom++) 829 { 830 int yybot = *yybottom; 831 YYFPRINTF (stderr, " %d", yybot); 832 } 833 YYFPRINTF (stderr, "\n"); 834} 835 836# define YY_STACK_PRINT(Bottom, Top) \ 837do { \ 838 if (yydebug) \ 839 yy_stack_print ((Bottom), (Top)); \ 840} while (0) 841 842 843/*------------------------------------------------. 844| Report that the YYRULE is going to be reduced. | 845`------------------------------------------------*/ 846 847static void 848yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) 849{ 850 unsigned long int yylno = yyrline[yyrule]; 851 int yynrhs = yyr2[yyrule]; 852 int yyi; 853 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 854 yyrule - 1, yylno); 855 /* The symbols being reduced. */ 856 for (yyi = 0; yyi < yynrhs; yyi++) 857 { 858 YYFPRINTF (stderr, " $%d = ", yyi + 1); 859 yy_symbol_print (stderr, 860 yystos[yyssp[yyi + 1 - yynrhs]], 861 &(yyvsp[(yyi + 1) - (yynrhs)]) 862 ); 863 YYFPRINTF (stderr, "\n"); 864 } 865} 866 867# define YY_REDUCE_PRINT(Rule) \ 868do { \ 869 if (yydebug) \ 870 yy_reduce_print (yyssp, yyvsp, Rule); \ 871} while (0) 872 873/* Nonzero means print parse trace. It is left uninitialized so that 874 multiple parsers can coexist. */ 875int yydebug; 876#else /* !YYDEBUG */ 877# define YYDPRINTF(Args) 878# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 879# define YY_STACK_PRINT(Bottom, Top) 880# define YY_REDUCE_PRINT(Rule) 881#endif /* !YYDEBUG */ 882 883 884/* YYINITDEPTH -- initial size of the parser's stacks. */ 885#ifndef YYINITDEPTH 886# define YYINITDEPTH 200 887#endif 888 889/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 890 if the built-in stack extension method is used). 891 892 Do not make this value too large; the results are undefined if 893 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 894 evaluated with infinite-precision integer arithmetic. */ 895 896#ifndef YYMAXDEPTH 897# define YYMAXDEPTH 10000 898#endif 899 900 901#if YYERROR_VERBOSE 902 903# ifndef yystrlen 904# if defined __GLIBC__ && defined _STRING_H 905# define yystrlen strlen 906# else 907/* Return the length of YYSTR. */ 908static YYSIZE_T 909yystrlen (const char *yystr) 910{ 911 YYSIZE_T yylen; 912 for (yylen = 0; yystr[yylen]; yylen++) 913 continue; 914 return yylen; 915} 916# endif 917# endif 918 919# ifndef yystpcpy 920# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 921# define yystpcpy stpcpy 922# else 923/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 924 YYDEST. */ 925static char * 926yystpcpy (char *yydest, const char *yysrc) 927{ 928 char *yyd = yydest; 929 const char *yys = yysrc; 930 931 while ((*yyd++ = *yys++) != '\0') 932 continue; 933 934 return yyd - 1; 935} 936# endif 937# endif 938 939# ifndef yytnamerr 940/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 941 quotes and backslashes, so that it's suitable for yyerror. The 942 heuristic is that double-quoting is unnecessary unless the string 943 contains an apostrophe, a comma, or backslash (other than 944 backslash-backslash). YYSTR is taken from yytname. If YYRES is 945 null, do not copy; instead, return the length of what the result 946 would have been. */ 947static YYSIZE_T 948yytnamerr (char *yyres, const char *yystr) 949{ 950 if (*yystr == '"') 951 { 952 YYSIZE_T yyn = 0; 953 char const *yyp = yystr; 954 955 for (;;) 956 switch (*++yyp) 957 { 958 case '\'': 959 case ',': 960 goto do_not_strip_quotes; 961 962 case '\\': 963 if (*++yyp != '\\') 964 goto do_not_strip_quotes; 965 /* Fall through. */ 966 default: 967 if (yyres) 968 yyres[yyn] = *yyp; 969 yyn++; 970 break; 971 972 case '"': 973 if (yyres) 974 yyres[yyn] = '\0'; 975 return yyn; 976 } 977 do_not_strip_quotes: ; 978 } 979 980 if (! yyres) 981 return yystrlen (yystr); 982 983 return yystpcpy (yyres, yystr) - yyres; 984} 985# endif 986 987/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 988 about the unexpected token YYTOKEN for the state stack whose top is 989 YYSSP. 990 991 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 992 not large enough to hold the message. In that case, also set 993 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 994 required number of bytes is too large to store. */ 995static int 996yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 997 yytype_int16 *yyssp, int yytoken) 998{ 999 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); 1000 YYSIZE_T yysize = yysize0; 1001 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1002 /* Internationalized format string. */ 1003 const char *yyformat = YY_NULL; 1004 /* Arguments of yyformat. */ 1005 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1006 /* Number of reported tokens (one for the "unexpected", one per 1007 "expected"). */ 1008 int yycount = 0; 1009 1010 /* There are many possibilities here to consider: 1011 - If this state is a consistent state with a default action, then 1012 the only way this function was invoked is if the default action 1013 is an error action. In that case, don't check for expected 1014 tokens because there are none. 1015 - The only way there can be no lookahead present (in yychar) is if 1016 this state is a consistent state with a default action. Thus, 1017 detecting the absence of a lookahead is sufficient to determine 1018 that there is no unexpected or expected token to report. In that 1019 case, just report a simple "syntax error". 1020 - Don't assume there isn't a lookahead just because this state is a 1021 consistent state with a default action. There might have been a 1022 previous inconsistent state, consistent state with a non-default 1023 action, or user semantic action that manipulated yychar. 1024 - Of course, the expected token list depends on states to have 1025 correct lookahead information, and it depends on the parser not 1026 to perform extra reductions after fetching a lookahead from the 1027 scanner and before detecting a syntax error. Thus, state merging 1028 (from LALR or IELR) and default reductions corrupt the expected 1029 token list. However, the list is correct for canonical LR with 1030 one exception: it will still contain any token that will not be 1031 accepted due to an error action in a later state. 1032 */ 1033 if (yytoken != YYEMPTY) 1034 { 1035 int yyn = yypact[*yyssp]; 1036 yyarg[yycount++] = yytname[yytoken]; 1037 if (!yypact_value_is_default (yyn)) 1038 { 1039 /* Start YYX at -YYN if negative to avoid negative indexes in 1040 YYCHECK. In other words, skip the first -YYN actions for 1041 this state because they are default actions. */ 1042 int yyxbegin = yyn < 0 ? -yyn : 0; 1043 /* Stay within bounds of both yycheck and yytname. */ 1044 int yychecklim = YYLAST - yyn + 1; 1045 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1046 int yyx; 1047 1048 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1049 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1050 && !yytable_value_is_error (yytable[yyx + yyn])) 1051 { 1052 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1053 { 1054 yycount = 1; 1055 yysize = yysize0; 1056 break; 1057 } 1058 yyarg[yycount++] = yytname[yyx]; 1059 { 1060 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); 1061 if (! (yysize <= yysize1 1062 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1063 return 2; 1064 yysize = yysize1; 1065 } 1066 } 1067 } 1068 } 1069 1070 switch (yycount) 1071 { 1072# define YYCASE_(N, S) \ 1073 case N: \ 1074 yyformat = S; \ 1075 break 1076 YYCASE_(0, YY_("syntax error")); 1077 YYCASE_(1, YY_("syntax error, unexpected %s")); 1078 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1079 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1080 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1081 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1082# undef YYCASE_ 1083 } 1084 1085 { 1086 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1087 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1088 return 2; 1089 yysize = yysize1; 1090 } 1091 1092 if (*yymsg_alloc < yysize) 1093 { 1094 *yymsg_alloc = 2 * yysize; 1095 if (! (yysize <= *yymsg_alloc 1096 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1097 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1098 return 1; 1099 } 1100 1101 /* Avoid sprintf, as that infringes on the user's name space. 1102 Don't have undefined behavior even if the translation 1103 produced a string with the wrong number of "%s"s. */ 1104 { 1105 char *yyp = *yymsg; 1106 int yyi = 0; 1107 while ((*yyp = *yyformat) != '\0') 1108 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1109 { 1110 yyp += yytnamerr (yyp, yyarg[yyi++]); 1111 yyformat += 2; 1112 } 1113 else 1114 { 1115 yyp++; 1116 yyformat++; 1117 } 1118 } 1119 return 0; 1120} 1121#endif /* YYERROR_VERBOSE */ 1122 1123/*-----------------------------------------------. 1124| Release the memory associated to this symbol. | 1125`-----------------------------------------------*/ 1126 1127static void 1128yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1129{ 1130 YYUSE (yyvaluep); 1131 if (!yymsg) 1132 yymsg = "Deleting"; 1133 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1134 1135 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1136 YYUSE (yytype); 1137 YY_IGNORE_MAYBE_UNINITIALIZED_END 1138} 1139 1140 1141 1142 1143/* The lookahead symbol. */ 1144int yychar; 1145 1146/* The semantic value of the lookahead symbol. */ 1147YYSTYPE yylval; 1148/* Number of syntax errors so far. */ 1149int yynerrs; 1150 1151 1152/*----------. 1153| yyparse. | 1154`----------*/ 1155 1156int 1157yyparse (void) 1158{ 1159 int yystate; 1160 /* Number of tokens to shift before error messages enabled. */ 1161 int yyerrstatus; 1162 1163 /* The stacks and their tools: 1164 'yyss': related to states. 1165 'yyvs': related to semantic values. 1166 1167 Refer to the stacks through separate pointers, to allow yyoverflow 1168 to reallocate them elsewhere. */ 1169 1170 /* The state stack. */ 1171 yytype_int16 yyssa[YYINITDEPTH]; 1172 yytype_int16 *yyss; 1173 yytype_int16 *yyssp; 1174 1175 /* The semantic value stack. */ 1176 YYSTYPE yyvsa[YYINITDEPTH]; 1177 YYSTYPE *yyvs; 1178 YYSTYPE *yyvsp; 1179 1180 YYSIZE_T yystacksize; 1181 1182 int yyn; 1183 int yyresult; 1184 /* Lookahead token as an internal (translated) token number. */ 1185 int yytoken = 0; 1186 /* The variables used to return semantic value and location from the 1187 action routines. */ 1188 YYSTYPE yyval; 1189 1190#if YYERROR_VERBOSE 1191 /* Buffer for error messages, and its allocated size. */ 1192 char yymsgbuf[128]; 1193 char *yymsg = yymsgbuf; 1194 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1195#endif 1196 1197#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1198 1199 /* The number of symbols on the RHS of the reduced rule. 1200 Keep to zero when no symbol should be popped. */ 1201 int yylen = 0; 1202 1203 yyssp = yyss = yyssa; 1204 yyvsp = yyvs = yyvsa; 1205 yystacksize = YYINITDEPTH; 1206 1207 YYDPRINTF ((stderr, "Starting parse\n")); 1208 1209 yystate = 0; 1210 yyerrstatus = 0; 1211 yynerrs = 0; 1212 yychar = YYEMPTY; /* Cause a token to be read. */ 1213 goto yysetstate; 1214 1215/*------------------------------------------------------------. 1216| yynewstate -- Push a new state, which is found in yystate. | 1217`------------------------------------------------------------*/ 1218 yynewstate: 1219 /* In all cases, when you get here, the value and location stacks 1220 have just been pushed. So pushing a state here evens the stacks. */ 1221 yyssp++; 1222 1223 yysetstate: 1224 *yyssp = yystate; 1225 1226 if (yyss + yystacksize - 1 <= yyssp) 1227 { 1228 /* Get the current used size of the three stacks, in elements. */ 1229 YYSIZE_T yysize = yyssp - yyss + 1; 1230 1231#ifdef yyoverflow 1232 { 1233 /* Give user a chance to reallocate the stack. Use copies of 1234 these so that the &'s don't force the real ones into 1235 memory. */ 1236 YYSTYPE *yyvs1 = yyvs; 1237 yytype_int16 *yyss1 = yyss; 1238 1239 /* Each stack pointer address is followed by the size of the 1240 data in use in that stack, in bytes. This used to be a 1241 conditional around just the two extra args, but that might 1242 be undefined if yyoverflow is a macro. */ 1243 yyoverflow (YY_("memory exhausted"), 1244 &yyss1, yysize * sizeof (*yyssp), 1245 &yyvs1, yysize * sizeof (*yyvsp), 1246 &yystacksize); 1247 1248 yyss = yyss1; 1249 yyvs = yyvs1; 1250 } 1251#else /* no yyoverflow */ 1252# ifndef YYSTACK_RELOCATE 1253 goto yyexhaustedlab; 1254# else 1255 /* Extend the stack our own way. */ 1256 if (YYMAXDEPTH <= yystacksize) 1257 goto yyexhaustedlab; 1258 yystacksize *= 2; 1259 if (YYMAXDEPTH < yystacksize) 1260 yystacksize = YYMAXDEPTH; 1261 1262 { 1263 yytype_int16 *yyss1 = yyss; 1264 union yyalloc *yyptr = 1265 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1266 if (! yyptr) 1267 goto yyexhaustedlab; 1268 YYSTACK_RELOCATE (yyss_alloc, yyss); 1269 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1270# undef YYSTACK_RELOCATE 1271 if (yyss1 != yyssa) 1272 YYSTACK_FREE (yyss1); 1273 } 1274# endif 1275#endif /* no yyoverflow */ 1276 1277 yyssp = yyss + yysize - 1; 1278 yyvsp = yyvs + yysize - 1; 1279 1280 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1281 (unsigned long int) yystacksize)); 1282 1283 if (yyss + yystacksize - 1 <= yyssp) 1284 YYABORT; 1285 } 1286 1287 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1288 1289 if (yystate == YYFINAL) 1290 YYACCEPT; 1291 1292 goto yybackup; 1293 1294/*-----------. 1295| yybackup. | 1296`-----------*/ 1297yybackup: 1298 1299 /* Do appropriate processing given the current state. Read a 1300 lookahead token if we need one and don't already have one. */ 1301 1302 /* First try to decide what to do without reference to lookahead token. */ 1303 yyn = yypact[yystate]; 1304 if (yypact_value_is_default (yyn)) 1305 goto yydefault; 1306 1307 /* Not known => get a lookahead token if don't already have one. */ 1308 1309 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1310 if (yychar == YYEMPTY) 1311 { 1312 YYDPRINTF ((stderr, "Reading a token: ")); 1313 yychar = yylex (); 1314 } 1315 1316 if (yychar <= YYEOF) 1317 { 1318 yychar = yytoken = YYEOF; 1319 YYDPRINTF ((stderr, "Now at end of input.\n")); 1320 } 1321 else 1322 { 1323 yytoken = YYTRANSLATE (yychar); 1324 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1325 } 1326 1327 /* If the proper action on seeing token YYTOKEN is to reduce or to 1328 detect an error, take that action. */ 1329 yyn += yytoken; 1330 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1331 goto yydefault; 1332 yyn = yytable[yyn]; 1333 if (yyn <= 0) 1334 { 1335 if (yytable_value_is_error (yyn)) 1336 goto yyerrlab; 1337 yyn = -yyn; 1338 goto yyreduce; 1339 } 1340 1341 /* Count tokens shifted since error; after three, turn off error 1342 status. */ 1343 if (yyerrstatus) 1344 yyerrstatus--; 1345 1346 /* Shift the lookahead token. */ 1347 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1348 1349 /* Discard the shifted token. */ 1350 yychar = YYEMPTY; 1351 1352 yystate = yyn; 1353 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1354 *++yyvsp = yylval; 1355 YY_IGNORE_MAYBE_UNINITIALIZED_END 1356 1357 goto yynewstate; 1358 1359 1360/*-----------------------------------------------------------. 1361| yydefault -- do the default action for the current state. | 1362`-----------------------------------------------------------*/ 1363yydefault: 1364 yyn = yydefact[yystate]; 1365 if (yyn == 0) 1366 goto yyerrlab; 1367 goto yyreduce; 1368 1369 1370/*-----------------------------. 1371| yyreduce -- Do a reduction. | 1372`-----------------------------*/ 1373yyreduce: 1374 /* yyn is the number of a rule to reduce with. */ 1375 yylen = yyr2[yyn]; 1376 1377 /* If YYLEN is nonzero, implement the default value of the action: 1378 '$$ = $1'. 1379 1380 Otherwise, the following line sets YYVAL to garbage. 1381 This behavior is undocumented and Bison 1382 users should not rely upon it. Assigning to YYVAL 1383 unconditionally makes the parser a bit smaller, and it avoids a 1384 GCC warning that YYVAL may be used uninitialized. */ 1385 yyval = yyvsp[1-yylen]; 1386 1387 1388 YY_REDUCE_PRINT (yyn); 1389 switch (yyn) 1390 { 1391 case 3: 1392#line 122 "m68k-parse.y" /* yacc.c:1661 */ 1393 { 1394 op->trailing_ampersand = (yyvsp[0].trailing_ampersand); 1395 } 1396#line 1397 "m68k-parse.c" /* yacc.c:1661 */ 1397 break; 1398 1399 case 4: 1400#line 126 "m68k-parse.y" /* yacc.c:1661 */ 1401 { 1402 op->trailing_ampersand = (yyvsp[0].trailing_ampersand); 1403 } 1404#line 1405 "m68k-parse.c" /* yacc.c:1661 */ 1405 break; 1406 1407 case 5: 1408#line 134 "m68k-parse.y" /* yacc.c:1661 */ 1409 { (yyval.trailing_ampersand) = 0; } 1410#line 1411 "m68k-parse.c" /* yacc.c:1661 */ 1411 break; 1412 1413 case 6: 1414#line 136 "m68k-parse.y" /* yacc.c:1661 */ 1415 { (yyval.trailing_ampersand) = 1; } 1416#line 1417 "m68k-parse.c" /* yacc.c:1661 */ 1417 break; 1418 1419 case 7: 1420#line 143 "m68k-parse.y" /* yacc.c:1661 */ 1421 { 1422 op->mode = LSH; 1423 } 1424#line 1425 "m68k-parse.c" /* yacc.c:1661 */ 1425 break; 1426 1427 case 8: 1428#line 148 "m68k-parse.y" /* yacc.c:1661 */ 1429 { 1430 op->mode = RSH; 1431 } 1432#line 1433 "m68k-parse.c" /* yacc.c:1661 */ 1433 break; 1434 1435 case 9: 1436#line 153 "m68k-parse.y" /* yacc.c:1661 */ 1437 { 1438 op->mode = DREG; 1439 op->reg = (yyvsp[0].reg); 1440 } 1441#line 1442 "m68k-parse.c" /* yacc.c:1661 */ 1442 break; 1443 1444 case 10: 1445#line 158 "m68k-parse.y" /* yacc.c:1661 */ 1446 { 1447 op->mode = AREG; 1448 op->reg = (yyvsp[0].reg); 1449 } 1450#line 1451 "m68k-parse.c" /* yacc.c:1661 */ 1451 break; 1452 1453 case 11: 1454#line 163 "m68k-parse.y" /* yacc.c:1661 */ 1455 { 1456 op->mode = FPREG; 1457 op->reg = (yyvsp[0].reg); 1458 } 1459#line 1460 "m68k-parse.c" /* yacc.c:1661 */ 1460 break; 1461 1462 case 12: 1463#line 168 "m68k-parse.y" /* yacc.c:1661 */ 1464 { 1465 op->mode = CONTROL; 1466 op->reg = (yyvsp[0].reg); 1467 } 1468#line 1469 "m68k-parse.c" /* yacc.c:1661 */ 1469 break; 1470 1471 case 13: 1472#line 173 "m68k-parse.y" /* yacc.c:1661 */ 1473 { 1474 op->mode = CONTROL; 1475 op->reg = (yyvsp[0].reg); 1476 } 1477#line 1478 "m68k-parse.c" /* yacc.c:1661 */ 1478 break; 1479 1480 case 14: 1481#line 178 "m68k-parse.y" /* yacc.c:1661 */ 1482 { 1483 op->mode = ABSL; 1484 op->disp = (yyvsp[0].exp); 1485 } 1486#line 1487 "m68k-parse.c" /* yacc.c:1661 */ 1487 break; 1488 1489 case 15: 1490#line 183 "m68k-parse.y" /* yacc.c:1661 */ 1491 { 1492 op->mode = IMMED; 1493 op->disp = (yyvsp[0].exp); 1494 } 1495#line 1496 "m68k-parse.c" /* yacc.c:1661 */ 1496 break; 1497 1498 case 16: 1499#line 188 "m68k-parse.y" /* yacc.c:1661 */ 1500 { 1501 op->mode = IMMED; 1502 op->disp = (yyvsp[0].exp); 1503 } 1504#line 1505 "m68k-parse.c" /* yacc.c:1661 */ 1505 break; 1506 1507 case 17: 1508#line 193 "m68k-parse.y" /* yacc.c:1661 */ 1509 { 1510 op->mode = REGLST; 1511 op->mask = (yyvsp[0].mask); 1512 } 1513#line 1514 "m68k-parse.c" /* yacc.c:1661 */ 1514 break; 1515 1516 case 18: 1517#line 206 "m68k-parse.y" /* yacc.c:1661 */ 1518 { 1519 op->mode = AINDR; 1520 op->reg = (yyvsp[-1].reg); 1521 } 1522#line 1523 "m68k-parse.c" /* yacc.c:1661 */ 1523 break; 1524 1525 case 19: 1526#line 211 "m68k-parse.y" /* yacc.c:1661 */ 1527 { 1528 op->mode = AINC; 1529 op->reg = (yyvsp[-2].reg); 1530 } 1531#line 1532 "m68k-parse.c" /* yacc.c:1661 */ 1532 break; 1533 1534 case 20: 1535#line 216 "m68k-parse.y" /* yacc.c:1661 */ 1536 { 1537 op->mode = ADEC; 1538 op->reg = (yyvsp[-1].reg); 1539 } 1540#line 1541 "m68k-parse.c" /* yacc.c:1661 */ 1541 break; 1542 1543 case 21: 1544#line 221 "m68k-parse.y" /* yacc.c:1661 */ 1545 { 1546 op->reg = (yyvsp[-1].reg); 1547 op->disp = (yyvsp[-3].exp); 1548 if (((yyvsp[-1].reg) >= ZADDR0 && (yyvsp[-1].reg) <= ZADDR7) 1549 || (yyvsp[-1].reg) == ZPC) 1550 op->mode = BASE; 1551 else 1552 op->mode = DISP; 1553 } 1554#line 1555 "m68k-parse.c" /* yacc.c:1661 */ 1555 break; 1556 1557 case 22: 1558#line 231 "m68k-parse.y" /* yacc.c:1661 */ 1559 { 1560 op->reg = (yyvsp[-3].reg); 1561 op->disp = (yyvsp[-1].exp); 1562 if (((yyvsp[-3].reg) >= ZADDR0 && (yyvsp[-3].reg) <= ZADDR7) 1563 || (yyvsp[-3].reg) == ZPC) 1564 op->mode = BASE; 1565 else 1566 op->mode = DISP; 1567 } 1568#line 1569 "m68k-parse.c" /* yacc.c:1661 */ 1569 break; 1570 1571 case 23: 1572#line 241 "m68k-parse.y" /* yacc.c:1661 */ 1573 { 1574 op->reg = (yyvsp[-1].reg); 1575 op->disp = (yyvsp[-3].exp); 1576 if (((yyvsp[-1].reg) >= ZADDR0 && (yyvsp[-1].reg) <= ZADDR7) 1577 || (yyvsp[-1].reg) == ZPC) 1578 op->mode = BASE; 1579 else 1580 op->mode = DISP; 1581 } 1582#line 1583 "m68k-parse.c" /* yacc.c:1661 */ 1583 break; 1584 1585 case 24: 1586#line 251 "m68k-parse.y" /* yacc.c:1661 */ 1587 { 1588 op->mode = DISP; 1589 op->reg = (yyvsp[-1].reg); 1590 } 1591#line 1592 "m68k-parse.c" /* yacc.c:1661 */ 1592 break; 1593 1594 case 25: 1595#line 256 "m68k-parse.y" /* yacc.c:1661 */ 1596 { 1597 op->mode = BASE; 1598 op->reg = (yyvsp[-1].reg); 1599 } 1600#line 1601 "m68k-parse.c" /* yacc.c:1661 */ 1601 break; 1602 1603 case 26: 1604#line 261 "m68k-parse.y" /* yacc.c:1661 */ 1605 { 1606 op->mode = BASE; 1607 op->reg = (yyvsp[-1].reg); 1608 } 1609#line 1610 "m68k-parse.c" /* yacc.c:1661 */ 1610 break; 1611 1612 case 27: 1613#line 266 "m68k-parse.y" /* yacc.c:1661 */ 1614 { 1615 op->mode = BASE; 1616 op->reg = (yyvsp[-3].reg); 1617 op->disp = (yyvsp[-5].exp); 1618 op->index = (yyvsp[-1].indexreg); 1619 } 1620#line 1621 "m68k-parse.c" /* yacc.c:1661 */ 1621 break; 1622 1623 case 28: 1624#line 273 "m68k-parse.y" /* yacc.c:1661 */ 1625 { 1626 if ((yyvsp[-3].reg) == PC || (yyvsp[-3].reg) == ZPC) 1627 yyerror (_("syntax error")); 1628 op->mode = BASE; 1629 op->reg = (yyvsp[-1].reg); 1630 op->disp = (yyvsp[-5].exp); 1631 op->index.reg = (yyvsp[-3].reg); 1632 op->index.size = SIZE_UNSPEC; 1633 op->index.scale = 1; 1634 } 1635#line 1636 "m68k-parse.c" /* yacc.c:1661 */ 1636 break; 1637 1638 case 29: 1639#line 284 "m68k-parse.y" /* yacc.c:1661 */ 1640 { 1641 op->mode = BASE; 1642 op->reg = (yyvsp[-1].reg); 1643 op->disp = (yyvsp[-4].exp); 1644 op->index = (yyvsp[-2].indexreg); 1645 } 1646#line 1647 "m68k-parse.c" /* yacc.c:1661 */ 1647 break; 1648 1649 case 30: 1650#line 291 "m68k-parse.y" /* yacc.c:1661 */ 1651 { 1652 op->mode = BASE; 1653 op->disp = (yyvsp[-1].exp); 1654 op->index = (yyvsp[-3].indexreg); 1655 } 1656#line 1657 "m68k-parse.c" /* yacc.c:1661 */ 1657 break; 1658 1659 case 31: 1660#line 297 "m68k-parse.y" /* yacc.c:1661 */ 1661 { 1662 op->mode = BASE; 1663 op->reg = (yyvsp[-3].reg); 1664 op->disp = (yyvsp[-5].exp); 1665 op->index = (yyvsp[-1].indexreg); 1666 } 1667#line 1668 "m68k-parse.c" /* yacc.c:1661 */ 1668 break; 1669 1670 case 32: 1671#line 304 "m68k-parse.y" /* yacc.c:1661 */ 1672 { 1673 op->mode = BASE; 1674 op->reg = (yyvsp[-3].reg); 1675 op->index = (yyvsp[-1].indexreg); 1676 } 1677#line 1678 "m68k-parse.c" /* yacc.c:1661 */ 1678 break; 1679 1680 case 33: 1681#line 310 "m68k-parse.y" /* yacc.c:1661 */ 1682 { 1683 if ((yyvsp[-3].reg) == PC || (yyvsp[-3].reg) == ZPC) 1684 yyerror (_("syntax error")); 1685 op->mode = BASE; 1686 op->reg = (yyvsp[-1].reg); 1687 op->disp = (yyvsp[-5].exp); 1688 op->index.reg = (yyvsp[-3].reg); 1689 op->index.size = SIZE_UNSPEC; 1690 op->index.scale = 1; 1691 } 1692#line 1693 "m68k-parse.c" /* yacc.c:1661 */ 1693 break; 1694 1695 case 34: 1696#line 321 "m68k-parse.y" /* yacc.c:1661 */ 1697 { 1698 if ((yyvsp[-3].reg) == PC || (yyvsp[-3].reg) == ZPC) 1699 yyerror (_("syntax error")); 1700 op->mode = BASE; 1701 op->reg = (yyvsp[-1].reg); 1702 op->index.reg = (yyvsp[-3].reg); 1703 op->index.size = SIZE_UNSPEC; 1704 op->index.scale = 1; 1705 } 1706#line 1707 "m68k-parse.c" /* yacc.c:1661 */ 1707 break; 1708 1709 case 35: 1710#line 331 "m68k-parse.y" /* yacc.c:1661 */ 1711 { 1712 op->mode = BASE; 1713 op->reg = (yyvsp[-1].reg); 1714 op->disp = (yyvsp[-4].exp); 1715 op->index = (yyvsp[-2].indexreg); 1716 } 1717#line 1718 "m68k-parse.c" /* yacc.c:1661 */ 1718 break; 1719 1720 case 36: 1721#line 338 "m68k-parse.y" /* yacc.c:1661 */ 1722 { 1723 op->mode = BASE; 1724 op->reg = (yyvsp[-1].reg); 1725 op->index = (yyvsp[-2].indexreg); 1726 } 1727#line 1728 "m68k-parse.c" /* yacc.c:1661 */ 1728 break; 1729 1730 case 37: 1731#line 344 "m68k-parse.y" /* yacc.c:1661 */ 1732 { 1733 op->mode = POST; 1734 op->reg = (yyvsp[-5].reg); 1735 op->disp = (yyvsp[-6].exp); 1736 op->index = (yyvsp[-2].indexreg); 1737 op->odisp = (yyvsp[-1].exp); 1738 } 1739#line 1740 "m68k-parse.c" /* yacc.c:1661 */ 1740 break; 1741 1742 case 38: 1743#line 352 "m68k-parse.y" /* yacc.c:1661 */ 1744 { 1745 op->mode = POST; 1746 op->reg = (yyvsp[-3].reg); 1747 op->disp = (yyvsp[-4].exp); 1748 op->odisp = (yyvsp[-1].exp); 1749 } 1750#line 1751 "m68k-parse.c" /* yacc.c:1661 */ 1751 break; 1752 1753 case 39: 1754#line 359 "m68k-parse.y" /* yacc.c:1661 */ 1755 { 1756 op->mode = POST; 1757 op->reg = (yyvsp[-5].reg); 1758 op->index = (yyvsp[-2].indexreg); 1759 op->odisp = (yyvsp[-1].exp); 1760 } 1761#line 1762 "m68k-parse.c" /* yacc.c:1661 */ 1762 break; 1763 1764 case 40: 1765#line 366 "m68k-parse.y" /* yacc.c:1661 */ 1766 { 1767 op->mode = POST; 1768 op->reg = (yyvsp[-3].reg); 1769 op->odisp = (yyvsp[-1].exp); 1770 } 1771#line 1772 "m68k-parse.c" /* yacc.c:1661 */ 1772 break; 1773 1774 case 41: 1775#line 372 "m68k-parse.y" /* yacc.c:1661 */ 1776 { 1777 op->mode = PRE; 1778 op->reg = (yyvsp[-5].reg); 1779 op->disp = (yyvsp[-7].exp); 1780 op->index = (yyvsp[-3].indexreg); 1781 op->odisp = (yyvsp[-1].exp); 1782 } 1783#line 1784 "m68k-parse.c" /* yacc.c:1661 */ 1784 break; 1785 1786 case 42: 1787#line 380 "m68k-parse.y" /* yacc.c:1661 */ 1788 { 1789 op->mode = PRE; 1790 op->reg = (yyvsp[-5].reg); 1791 op->index = (yyvsp[-3].indexreg); 1792 op->odisp = (yyvsp[-1].exp); 1793 } 1794#line 1795 "m68k-parse.c" /* yacc.c:1661 */ 1795 break; 1796 1797 case 43: 1798#line 387 "m68k-parse.y" /* yacc.c:1661 */ 1799 { 1800 if ((yyvsp[-5].reg) == PC || (yyvsp[-5].reg) == ZPC) 1801 yyerror (_("syntax error")); 1802 op->mode = PRE; 1803 op->reg = (yyvsp[-3].reg); 1804 op->disp = (yyvsp[-7].exp); 1805 op->index.reg = (yyvsp[-5].reg); 1806 op->index.size = SIZE_UNSPEC; 1807 op->index.scale = 1; 1808 op->odisp = (yyvsp[-1].exp); 1809 } 1810#line 1811 "m68k-parse.c" /* yacc.c:1661 */ 1811 break; 1812 1813 case 44: 1814#line 399 "m68k-parse.y" /* yacc.c:1661 */ 1815 { 1816 if ((yyvsp[-5].reg) == PC || (yyvsp[-5].reg) == ZPC) 1817 yyerror (_("syntax error")); 1818 op->mode = PRE; 1819 op->reg = (yyvsp[-3].reg); 1820 op->index.reg = (yyvsp[-5].reg); 1821 op->index.size = SIZE_UNSPEC; 1822 op->index.scale = 1; 1823 op->odisp = (yyvsp[-1].exp); 1824 } 1825#line 1826 "m68k-parse.c" /* yacc.c:1661 */ 1826 break; 1827 1828 case 45: 1829#line 410 "m68k-parse.y" /* yacc.c:1661 */ 1830 { 1831 op->mode = PRE; 1832 op->reg = (yyvsp[-3].reg); 1833 op->disp = (yyvsp[-5].exp); 1834 op->index = (yyvsp[-4].indexreg); 1835 op->odisp = (yyvsp[-1].exp); 1836 } 1837#line 1838 "m68k-parse.c" /* yacc.c:1661 */ 1838 break; 1839 1840 case 46: 1841#line 423 "m68k-parse.y" /* yacc.c:1661 */ 1842 { 1843 /* We use optzapc to avoid a shift/reduce conflict. */ 1844 if ((yyvsp[-1].reg) < ADDR0 || (yyvsp[-1].reg) > ADDR7) 1845 yyerror (_("syntax error")); 1846 op->mode = AINDR; 1847 op->reg = (yyvsp[-1].reg); 1848 } 1849#line 1850 "m68k-parse.c" /* yacc.c:1661 */ 1850 break; 1851 1852 case 47: 1853#line 431 "m68k-parse.y" /* yacc.c:1661 */ 1854 { 1855 /* We use optzapc to avoid a shift/reduce conflict. */ 1856 if ((yyvsp[-2].reg) < ADDR0 || (yyvsp[-2].reg) > ADDR7) 1857 yyerror (_("syntax error")); 1858 op->mode = AINC; 1859 op->reg = (yyvsp[-2].reg); 1860 } 1861#line 1862 "m68k-parse.c" /* yacc.c:1661 */ 1862 break; 1863 1864 case 48: 1865#line 439 "m68k-parse.y" /* yacc.c:1661 */ 1866 { 1867 /* We use optzapc to avoid a shift/reduce conflict. */ 1868 if ((yyvsp[-2].reg) < ADDR0 || (yyvsp[-2].reg) > ADDR7) 1869 yyerror (_("syntax error")); 1870 op->mode = ADEC; 1871 op->reg = (yyvsp[-2].reg); 1872 } 1873#line 1874 "m68k-parse.c" /* yacc.c:1661 */ 1874 break; 1875 1876 case 49: 1877#line 447 "m68k-parse.y" /* yacc.c:1661 */ 1878 { 1879 op->reg = (yyvsp[-4].reg); 1880 op->disp = (yyvsp[-1].exp); 1881 if (((yyvsp[-4].reg) >= ZADDR0 && (yyvsp[-4].reg) <= ZADDR7) 1882 || (yyvsp[-4].reg) == ZPC) 1883 op->mode = BASE; 1884 else 1885 op->mode = DISP; 1886 } 1887#line 1888 "m68k-parse.c" /* yacc.c:1661 */ 1888 break; 1889 1890 case 50: 1891#line 457 "m68k-parse.y" /* yacc.c:1661 */ 1892 { 1893 op->mode = BASE; 1894 op->reg = (yyvsp[-5].reg); 1895 op->disp = (yyvsp[-2].exp); 1896 op->index = (yyvsp[-1].indexreg); 1897 } 1898#line 1899 "m68k-parse.c" /* yacc.c:1661 */ 1899 break; 1900 1901 case 51: 1902#line 464 "m68k-parse.y" /* yacc.c:1661 */ 1903 { 1904 op->mode = POST; 1905 op->reg = (yyvsp[-9].reg); 1906 op->disp = (yyvsp[-6].exp); 1907 op->index = (yyvsp[-1].indexreg); 1908 op->odisp = (yyvsp[-2].exp); 1909 } 1910#line 1911 "m68k-parse.c" /* yacc.c:1661 */ 1911 break; 1912 1913 case 52: 1914#line 472 "m68k-parse.y" /* yacc.c:1661 */ 1915 { 1916 op->mode = POST; 1917 op->reg = (yyvsp[-8].reg); 1918 op->disp = (yyvsp[-5].exp); 1919 op->odisp = (yyvsp[-1].exp); 1920 } 1921#line 1922 "m68k-parse.c" /* yacc.c:1661 */ 1922 break; 1923 1924 case 53: 1925#line 479 "m68k-parse.y" /* yacc.c:1661 */ 1926 { 1927 op->mode = PRE; 1928 op->reg = (yyvsp[-9].reg); 1929 op->disp = (yyvsp[-6].exp); 1930 op->index = (yyvsp[-5].indexreg); 1931 op->odisp = (yyvsp[-1].exp); 1932 } 1933#line 1934 "m68k-parse.c" /* yacc.c:1661 */ 1934 break; 1935 1936 case 55: 1937#line 494 "m68k-parse.y" /* yacc.c:1661 */ 1938 { 1939 (yyval.indexreg).reg = (yyvsp[0].reg); 1940 (yyval.indexreg).size = SIZE_UNSPEC; 1941 (yyval.indexreg).scale = 1; 1942 } 1943#line 1944 "m68k-parse.c" /* yacc.c:1661 */ 1944 break; 1945 1946 case 57: 1947#line 508 "m68k-parse.y" /* yacc.c:1661 */ 1948 { 1949 (yyval.indexreg).reg = (yyvsp[0].reg); 1950 (yyval.indexreg).size = SIZE_UNSPEC; 1951 (yyval.indexreg).scale = 1; 1952 } 1953#line 1954 "m68k-parse.c" /* yacc.c:1661 */ 1954 break; 1955 1956 case 68: 1957#line 551 "m68k-parse.y" /* yacc.c:1661 */ 1958 { 1959 (yyval.reg) = ZADDR0; 1960 } 1961#line 1962 "m68k-parse.c" /* yacc.c:1661 */ 1962 break; 1963 1964 case 72: 1965#line 568 "m68k-parse.y" /* yacc.c:1661 */ 1966 { 1967 (yyval.reg) = ZADDR0; 1968 } 1969#line 1970 "m68k-parse.c" /* yacc.c:1661 */ 1970 break; 1971 1972 case 73: 1973#line 572 "m68k-parse.y" /* yacc.c:1661 */ 1974 { 1975 (yyval.reg) = (yyvsp[0].reg); 1976 } 1977#line 1978 "m68k-parse.c" /* yacc.c:1661 */ 1978 break; 1979 1980 case 74: 1981#line 581 "m68k-parse.y" /* yacc.c:1661 */ 1982 { 1983 (yyval.exp).exp.X_op = O_absent; 1984 (yyval.exp).size = SIZE_UNSPEC; 1985 } 1986#line 1987 "m68k-parse.c" /* yacc.c:1661 */ 1987 break; 1988 1989 case 75: 1990#line 586 "m68k-parse.y" /* yacc.c:1661 */ 1991 { 1992 (yyval.exp) = (yyvsp[0].exp); 1993 } 1994#line 1995 "m68k-parse.c" /* yacc.c:1661 */ 1995 break; 1996 1997 case 76: 1998#line 595 "m68k-parse.y" /* yacc.c:1661 */ 1999 { 2000 (yyval.exp).exp.X_op = O_absent; 2001 (yyval.exp).size = SIZE_UNSPEC; 2002 } 2003#line 2004 "m68k-parse.c" /* yacc.c:1661 */ 2004 break; 2005 2006 case 77: 2007#line 600 "m68k-parse.y" /* yacc.c:1661 */ 2008 { 2009 (yyval.exp) = (yyvsp[-1].exp); 2010 } 2011#line 2012 "m68k-parse.c" /* yacc.c:1661 */ 2012 break; 2013 2014 case 79: 2015#line 610 "m68k-parse.y" /* yacc.c:1661 */ 2016 { 2017 (yyval.mask) = (yyvsp[-2].mask) | (yyvsp[0].mask); 2018 } 2019#line 2020 "m68k-parse.c" /* yacc.c:1661 */ 2020 break; 2021 2022 case 80: 2023#line 614 "m68k-parse.y" /* yacc.c:1661 */ 2024 { 2025 (yyval.mask) = (1 << (yyvsp[-2].onereg)) | (yyvsp[0].mask); 2026 } 2027#line 2028 "m68k-parse.c" /* yacc.c:1661 */ 2028 break; 2029 2030 case 81: 2031#line 626 "m68k-parse.y" /* yacc.c:1661 */ 2032 { 2033 (yyval.mask) = 1 << (yyvsp[0].onereg); 2034 } 2035#line 2036 "m68k-parse.c" /* yacc.c:1661 */ 2036 break; 2037 2038 case 83: 2039#line 631 "m68k-parse.y" /* yacc.c:1661 */ 2040 { 2041 (yyval.mask) = (yyvsp[-2].mask) | (yyvsp[0].mask); 2042 } 2043#line 2044 "m68k-parse.c" /* yacc.c:1661 */ 2044 break; 2045 2046 case 84: 2047#line 635 "m68k-parse.y" /* yacc.c:1661 */ 2048 { 2049 (yyval.mask) = (1 << (yyvsp[-2].onereg)) | (yyvsp[0].mask); 2050 } 2051#line 2052 "m68k-parse.c" /* yacc.c:1661 */ 2052 break; 2053 2054 case 85: 2055#line 642 "m68k-parse.y" /* yacc.c:1661 */ 2056 { 2057 if ((yyvsp[-2].onereg) <= (yyvsp[0].onereg)) 2058 (yyval.mask) = (1 << ((yyvsp[0].onereg) + 1)) - 1 - ((1 << (yyvsp[-2].onereg)) - 1); 2059 else 2060 (yyval.mask) = (1 << ((yyvsp[-2].onereg) + 1)) - 1 - ((1 << (yyvsp[0].onereg)) - 1); 2061 } 2062#line 2063 "m68k-parse.c" /* yacc.c:1661 */ 2063 break; 2064 2065 case 86: 2066#line 652 "m68k-parse.y" /* yacc.c:1661 */ 2067 { 2068 (yyval.onereg) = (yyvsp[0].reg) - DATA0; 2069 } 2070#line 2071 "m68k-parse.c" /* yacc.c:1661 */ 2071 break; 2072 2073 case 87: 2074#line 656 "m68k-parse.y" /* yacc.c:1661 */ 2075 { 2076 (yyval.onereg) = (yyvsp[0].reg) - ADDR0 + 8; 2077 } 2078#line 2079 "m68k-parse.c" /* yacc.c:1661 */ 2079 break; 2080 2081 case 88: 2082#line 660 "m68k-parse.y" /* yacc.c:1661 */ 2083 { 2084 (yyval.onereg) = (yyvsp[0].reg) - FP0 + 16; 2085 } 2086#line 2087 "m68k-parse.c" /* yacc.c:1661 */ 2087 break; 2088 2089 case 89: 2090#line 664 "m68k-parse.y" /* yacc.c:1661 */ 2091 { 2092 if ((yyvsp[0].reg) == FPI) 2093 (yyval.onereg) = 24; 2094 else if ((yyvsp[0].reg) == FPS) 2095 (yyval.onereg) = 25; 2096 else 2097 (yyval.onereg) = 26; 2098 } 2099#line 2100 "m68k-parse.c" /* yacc.c:1661 */ 2100 break; 2101 2102 2103#line 2104 "m68k-parse.c" /* yacc.c:1661 */ 2104 default: break; 2105 } 2106 /* User semantic actions sometimes alter yychar, and that requires 2107 that yytoken be updated with the new translation. We take the 2108 approach of translating immediately before every use of yytoken. 2109 One alternative is translating here after every semantic action, 2110 but that translation would be missed if the semantic action invokes 2111 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 2112 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 2113 incorrect destructor might then be invoked immediately. In the 2114 case of YYERROR or YYBACKUP, subsequent parser actions might lead 2115 to an incorrect destructor call or verbose syntax error message 2116 before the lookahead is translated. */ 2117 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2118 2119 YYPOPSTACK (yylen); 2120 yylen = 0; 2121 YY_STACK_PRINT (yyss, yyssp); 2122 2123 *++yyvsp = yyval; 2124 2125 /* Now 'shift' the result of the reduction. Determine what state 2126 that goes to, based on the state we popped back to and the rule 2127 number reduced by. */ 2128 2129 yyn = yyr1[yyn]; 2130 2131 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2132 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2133 yystate = yytable[yystate]; 2134 else 2135 yystate = yydefgoto[yyn - YYNTOKENS]; 2136 2137 goto yynewstate; 2138 2139 2140/*--------------------------------------. 2141| yyerrlab -- here on detecting error. | 2142`--------------------------------------*/ 2143yyerrlab: 2144 /* Make sure we have latest lookahead translation. See comments at 2145 user semantic actions for why this is necessary. */ 2146 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 2147 2148 /* If not already recovering from an error, report this error. */ 2149 if (!yyerrstatus) 2150 { 2151 ++yynerrs; 2152#if ! YYERROR_VERBOSE 2153 yyerror (YY_("syntax error")); 2154#else 2155# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 2156 yyssp, yytoken) 2157 { 2158 char const *yymsgp = YY_("syntax error"); 2159 int yysyntax_error_status; 2160 yysyntax_error_status = YYSYNTAX_ERROR; 2161 if (yysyntax_error_status == 0) 2162 yymsgp = yymsg; 2163 else if (yysyntax_error_status == 1) 2164 { 2165 if (yymsg != yymsgbuf) 2166 YYSTACK_FREE (yymsg); 2167 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 2168 if (!yymsg) 2169 { 2170 yymsg = yymsgbuf; 2171 yymsg_alloc = sizeof yymsgbuf; 2172 yysyntax_error_status = 2; 2173 } 2174 else 2175 { 2176 yysyntax_error_status = YYSYNTAX_ERROR; 2177 yymsgp = yymsg; 2178 } 2179 } 2180 yyerror (yymsgp); 2181 if (yysyntax_error_status == 2) 2182 goto yyexhaustedlab; 2183 } 2184# undef YYSYNTAX_ERROR 2185#endif 2186 } 2187 2188 2189 2190 if (yyerrstatus == 3) 2191 { 2192 /* If just tried and failed to reuse lookahead token after an 2193 error, discard it. */ 2194 2195 if (yychar <= YYEOF) 2196 { 2197 /* Return failure if at end of input. */ 2198 if (yychar == YYEOF) 2199 YYABORT; 2200 } 2201 else 2202 { 2203 yydestruct ("Error: discarding", 2204 yytoken, &yylval); 2205 yychar = YYEMPTY; 2206 } 2207 } 2208 2209 /* Else will try to reuse lookahead token after shifting the error 2210 token. */ 2211 goto yyerrlab1; 2212 2213 2214/*---------------------------------------------------. 2215| yyerrorlab -- error raised explicitly by YYERROR. | 2216`---------------------------------------------------*/ 2217yyerrorlab: 2218 2219 /* Pacify compilers like GCC when the user code never invokes 2220 YYERROR and the label yyerrorlab therefore never appears in user 2221 code. */ 2222 if (/*CONSTCOND*/ 0) 2223 goto yyerrorlab; 2224 2225 /* Do not reclaim the symbols of the rule whose action triggered 2226 this YYERROR. */ 2227 YYPOPSTACK (yylen); 2228 yylen = 0; 2229 YY_STACK_PRINT (yyss, yyssp); 2230 yystate = *yyssp; 2231 goto yyerrlab1; 2232 2233 2234/*-------------------------------------------------------------. 2235| yyerrlab1 -- common code for both syntax error and YYERROR. | 2236`-------------------------------------------------------------*/ 2237yyerrlab1: 2238 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2239 2240 for (;;) 2241 { 2242 yyn = yypact[yystate]; 2243 if (!yypact_value_is_default (yyn)) 2244 { 2245 yyn += YYTERROR; 2246 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2247 { 2248 yyn = yytable[yyn]; 2249 if (0 < yyn) 2250 break; 2251 } 2252 } 2253 2254 /* Pop the current state because it cannot handle the error token. */ 2255 if (yyssp == yyss) 2256 YYABORT; 2257 2258 2259 yydestruct ("Error: popping", 2260 yystos[yystate], yyvsp); 2261 YYPOPSTACK (1); 2262 yystate = *yyssp; 2263 YY_STACK_PRINT (yyss, yyssp); 2264 } 2265 2266 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 2267 *++yyvsp = yylval; 2268 YY_IGNORE_MAYBE_UNINITIALIZED_END 2269 2270 2271 /* Shift the error token. */ 2272 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2273 2274 yystate = yyn; 2275 goto yynewstate; 2276 2277 2278/*-------------------------------------. 2279| yyacceptlab -- YYACCEPT comes here. | 2280`-------------------------------------*/ 2281yyacceptlab: 2282 yyresult = 0; 2283 goto yyreturn; 2284 2285/*-----------------------------------. 2286| yyabortlab -- YYABORT comes here. | 2287`-----------------------------------*/ 2288yyabortlab: 2289 yyresult = 1; 2290 goto yyreturn; 2291 2292#if !defined yyoverflow || YYERROR_VERBOSE 2293/*-------------------------------------------------. 2294| yyexhaustedlab -- memory exhaustion comes here. | 2295`-------------------------------------------------*/ 2296yyexhaustedlab: 2297 yyerror (YY_("memory exhausted")); 2298 yyresult = 2; 2299 /* Fall through. */ 2300#endif 2301 2302yyreturn: 2303 if (yychar != YYEMPTY) 2304 { 2305 /* Make sure we have latest lookahead translation. See comments at 2306 user semantic actions for why this is necessary. */ 2307 yytoken = YYTRANSLATE (yychar); 2308 yydestruct ("Cleanup: discarding lookahead", 2309 yytoken, &yylval); 2310 } 2311 /* Do not reclaim the symbols of the rule whose action triggered 2312 this YYABORT or YYACCEPT. */ 2313 YYPOPSTACK (yylen); 2314 YY_STACK_PRINT (yyss, yyssp); 2315 while (yyssp != yyss) 2316 { 2317 yydestruct ("Cleanup: popping", 2318 yystos[*yyssp], yyvsp); 2319 YYPOPSTACK (1); 2320 } 2321#ifndef yyoverflow 2322 if (yyss != yyssa) 2323 YYSTACK_FREE (yyss); 2324#endif 2325#if YYERROR_VERBOSE 2326 if (yymsg != yymsgbuf) 2327 YYSTACK_FREE (yymsg); 2328#endif 2329 return yyresult; 2330} 2331#line 674 "m68k-parse.y" /* yacc.c:1906 */ 2332 2333 2334/* The string to parse is stored here, and modified by yylex. */ 2335 2336static char *str; 2337 2338/* The original string pointer. */ 2339 2340static char *strorig; 2341 2342/* If *CCP could be a register, return the register number and advance 2343 *CCP. Otherwise don't change *CCP, and return 0. */ 2344 2345static enum m68k_register 2346m68k_reg_parse (char **ccp) 2347{ 2348 char *start = *ccp; 2349 char c; 2350 char *p; 2351 symbolS *symbolp; 2352 2353 if (flag_reg_prefix_optional) 2354 { 2355 if (*start == REGISTER_PREFIX) 2356 start++; 2357 p = start; 2358 } 2359 else 2360 { 2361 if (*start != REGISTER_PREFIX) 2362 return 0; 2363 p = start + 1; 2364 } 2365 2366 if (! is_name_beginner (*p)) 2367 return 0; 2368 2369 p++; 2370 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*') 2371 p++; 2372 2373 c = *p; 2374 *p = 0; 2375 symbolp = symbol_find (start); 2376 *p = c; 2377 2378 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section) 2379 { 2380 *ccp = p; 2381 return S_GET_VALUE (symbolp); 2382 } 2383 2384 /* In MRI mode, something like foo.bar can be equated to a register 2385 name. */ 2386 while (flag_mri && c == '.') 2387 { 2388 ++p; 2389 while (is_part_of_name (*p) && *p != '.' && *p != ':' && *p != '*') 2390 p++; 2391 c = *p; 2392 *p = '\0'; 2393 symbolp = symbol_find (start); 2394 *p = c; 2395 if (symbolp != NULL && S_GET_SEGMENT (symbolp) == reg_section) 2396 { 2397 *ccp = p; 2398 return S_GET_VALUE (symbolp); 2399 } 2400 } 2401 2402 return 0; 2403} 2404 2405/* The lexer. */ 2406 2407static int 2408yylex (void) 2409{ 2410 enum m68k_register reg; 2411 char *s; 2412 int parens; 2413 int c = 0; 2414 int tail = 0; 2415 char *hold; 2416 2417 if (*str == ' ') 2418 ++str; 2419 2420 if (*str == '\0') 2421 return 0; 2422 2423 /* Various special characters are just returned directly. */ 2424 switch (*str) 2425 { 2426 case '@': 2427 /* In MRI mode, this can be the start of an octal number. */ 2428 if (flag_mri) 2429 { 2430 if (ISDIGIT (str[1]) 2431 || ((str[1] == '+' || str[1] == '-') 2432 && ISDIGIT (str[2]))) 2433 break; 2434 } 2435 /* Fall through. */ 2436 case '#': 2437 case '&': 2438 case ',': 2439 case ')': 2440 case '/': 2441 case '[': 2442 case ']': 2443 case '<': 2444 case '>': 2445 return *str++; 2446 case '+': 2447 /* It so happens that a '+' can only appear at the end of an 2448 operand, or if it is trailed by an '&'(see mac load insn). 2449 If it appears anywhere else, it must be a unary. */ 2450 if (str[1] == '\0' || (str[1] == '&' && str[2] == '\0')) 2451 return *str++; 2452 break; 2453 case '-': 2454 /* A '-' can only appear in -(ar), rn-rn, or ar@-. If it 2455 appears anywhere else, it must be a unary minus on an 2456 expression, unless it it trailed by a '&'(see mac load insn). */ 2457 if (str[1] == '\0' || (str[1] == '&' && str[2] == '\0')) 2458 return *str++; 2459 s = str + 1; 2460 if (*s == '(') 2461 ++s; 2462 if (m68k_reg_parse (&s) != 0) 2463 return *str++; 2464 break; 2465 case '(': 2466 /* A '(' can only appear in `(reg)', `(expr,...', `([', `@(', or 2467 `)('. If it appears anywhere else, it must be starting an 2468 expression. */ 2469 if (str[1] == '[' 2470 || (str > strorig 2471 && (str[-1] == '@' 2472 || str[-1] == ')'))) 2473 return *str++; 2474 s = str + 1; 2475 if (m68k_reg_parse (&s) != 0) 2476 return *str++; 2477 /* Check for the case of '(expr,...' by scanning ahead. If we 2478 find a comma outside of balanced parentheses, we return '('. 2479 If we find an unbalanced right parenthesis, then presumably 2480 the '(' really starts an expression. */ 2481 parens = 0; 2482 for (s = str + 1; *s != '\0'; s++) 2483 { 2484 if (*s == '(') 2485 ++parens; 2486 else if (*s == ')') 2487 { 2488 if (parens == 0) 2489 break; 2490 --parens; 2491 } 2492 else if (*s == ',' && parens == 0) 2493 { 2494 /* A comma can not normally appear in an expression, so 2495 this is a case of '(expr,...'. */ 2496 return *str++; 2497 } 2498 } 2499 } 2500 2501 /* See if it's a register. */ 2502 2503 reg = m68k_reg_parse (&str); 2504 if (reg != 0) 2505 { 2506 int ret; 2507 2508 yylval.reg = reg; 2509 2510 if (reg >= DATA0 && reg <= DATA7) 2511 ret = DR; 2512 else if (reg >= ADDR0 && reg <= ADDR7) 2513 ret = AR; 2514 else if (reg >= FP0 && reg <= FP7) 2515 return FPR; 2516 else if (reg == FPI 2517 || reg == FPS 2518 || reg == FPC) 2519 return FPCR; 2520 else if (reg == PC) 2521 return LPC; 2522 else if (reg >= ZDATA0 && reg <= ZDATA7) 2523 ret = ZDR; 2524 else if (reg >= ZADDR0 && reg <= ZADDR7) 2525 ret = ZAR; 2526 else if (reg == ZPC) 2527 return LZPC; 2528 else 2529 return CREG; 2530 2531 /* If we get here, we have a data or address register. We 2532 must check for a size or scale; if we find one, we must 2533 return INDEXREG. */ 2534 2535 s = str; 2536 2537 if (*s != '.' && *s != ':' && *s != '*') 2538 return ret; 2539 2540 yylval.indexreg.reg = reg; 2541 2542 if (*s != '.' && *s != ':') 2543 yylval.indexreg.size = SIZE_UNSPEC; 2544 else 2545 { 2546 ++s; 2547 switch (*s) 2548 { 2549 case 'w': 2550 case 'W': 2551 yylval.indexreg.size = SIZE_WORD; 2552 ++s; 2553 break; 2554 case 'l': 2555 case 'L': 2556 yylval.indexreg.size = SIZE_LONG; 2557 ++s; 2558 break; 2559 default: 2560 yyerror (_("illegal size specification")); 2561 yylval.indexreg.size = SIZE_UNSPEC; 2562 break; 2563 } 2564 } 2565 2566 yylval.indexreg.scale = 1; 2567 2568 if (*s == '*' || *s == ':') 2569 { 2570 expressionS scale; 2571 2572 ++s; 2573 2574 hold = input_line_pointer; 2575 input_line_pointer = s; 2576 expression (&scale); 2577 s = input_line_pointer; 2578 input_line_pointer = hold; 2579 2580 if (scale.X_op != O_constant) 2581 yyerror (_("scale specification must resolve to a number")); 2582 else 2583 { 2584 switch (scale.X_add_number) 2585 { 2586 case 1: 2587 case 2: 2588 case 4: 2589 case 8: 2590 yylval.indexreg.scale = scale.X_add_number; 2591 break; 2592 default: 2593 yyerror (_("invalid scale value")); 2594 break; 2595 } 2596 } 2597 } 2598 2599 str = s; 2600 2601 return INDEXREG; 2602 } 2603 2604 /* It must be an expression. Before we call expression, we need to 2605 look ahead to see if there is a size specification. We must do 2606 that first, because otherwise foo.l will be treated as the symbol 2607 foo.l, rather than as the symbol foo with a long size 2608 specification. The grammar requires that all expressions end at 2609 the end of the operand, or with ',', '(', ']', ')'. */ 2610 2611 parens = 0; 2612 for (s = str; *s != '\0'; s++) 2613 { 2614 if (*s == '(') 2615 { 2616 if (parens == 0 2617 && s > str 2618 && (s[-1] == ')' || ISALNUM (s[-1]))) 2619 break; 2620 ++parens; 2621 } 2622 else if (*s == ')') 2623 { 2624 if (parens == 0) 2625 break; 2626 --parens; 2627 } 2628 else if (parens == 0 2629 && (*s == ',' || *s == ']')) 2630 break; 2631 } 2632 2633 yylval.exp.size = SIZE_UNSPEC; 2634 if (s <= str + 2 2635 || (s[-2] != '.' && s[-2] != ':')) 2636 tail = 0; 2637 else 2638 { 2639 switch (s[-1]) 2640 { 2641 case 's': 2642 case 'S': 2643 case 'b': 2644 case 'B': 2645 yylval.exp.size = SIZE_BYTE; 2646 break; 2647 case 'w': 2648 case 'W': 2649 yylval.exp.size = SIZE_WORD; 2650 break; 2651 case 'l': 2652 case 'L': 2653 yylval.exp.size = SIZE_LONG; 2654 break; 2655 default: 2656 break; 2657 } 2658 if (yylval.exp.size != SIZE_UNSPEC) 2659 tail = 2; 2660 } 2661 2662#ifdef OBJ_ELF 2663 { 2664 /* Look for @PLTPC, etc. */ 2665 char *cp; 2666 2667 yylval.exp.pic_reloc = pic_none; 2668 cp = s - tail; 2669 if (cp - 7 > str && cp[-7] == '@') 2670 { 2671 if (strncmp (cp - 7, "@TLSLDM", 7) == 0) 2672 { 2673 yylval.exp.pic_reloc = pic_tls_ldm; 2674 tail += 7; 2675 } 2676 else if (strncmp (cp - 7, "@TLSLDO", 7) == 0) 2677 { 2678 yylval.exp.pic_reloc = pic_tls_ldo; 2679 tail += 7; 2680 } 2681 } 2682 else if (cp - 6 > str && cp[-6] == '@') 2683 { 2684 if (strncmp (cp - 6, "@PLTPC", 6) == 0) 2685 { 2686 yylval.exp.pic_reloc = pic_plt_pcrel; 2687 tail += 6; 2688 } 2689 else if (strncmp (cp - 6, "@GOTPC", 6) == 0) 2690 { 2691 yylval.exp.pic_reloc = pic_got_pcrel; 2692 tail += 6; 2693 } 2694 else if (strncmp (cp - 6, "@TLSGD", 6) == 0) 2695 { 2696 yylval.exp.pic_reloc = pic_tls_gd; 2697 tail += 6; 2698 } 2699 else if (strncmp (cp - 6, "@TLSIE", 6) == 0) 2700 { 2701 yylval.exp.pic_reloc = pic_tls_ie; 2702 tail += 6; 2703 } 2704 else if (strncmp (cp - 6, "@TLSLE", 6) == 0) 2705 { 2706 yylval.exp.pic_reloc = pic_tls_le; 2707 tail += 6; 2708 } 2709 } 2710 else if (cp - 4 > str && cp[-4] == '@') 2711 { 2712 if (strncmp (cp - 4, "@PLT", 4) == 0) 2713 { 2714 yylval.exp.pic_reloc = pic_plt_off; 2715 tail += 4; 2716 } 2717 else if (strncmp (cp - 4, "@GOT", 4) == 0) 2718 { 2719 yylval.exp.pic_reloc = pic_got_off; 2720 tail += 4; 2721 } 2722 } 2723 } 2724#endif 2725 2726 if (tail != 0) 2727 { 2728 c = s[-tail]; 2729 s[-tail] = 0; 2730 } 2731 2732 hold = input_line_pointer; 2733 input_line_pointer = str; 2734 expression (&yylval.exp.exp); 2735 str = input_line_pointer; 2736 input_line_pointer = hold; 2737 2738 if (tail != 0) 2739 { 2740 s[-tail] = c; 2741 str = s; 2742 } 2743 2744 return EXPR; 2745} 2746 2747/* Parse an m68k operand. This is the only function which is called 2748 from outside this file. */ 2749 2750int 2751m68k_ip_op (char *s, struct m68k_op *oparg) 2752{ 2753 memset (oparg, 0, sizeof *oparg); 2754 oparg->error = NULL; 2755 oparg->index.reg = ZDATA0; 2756 oparg->index.scale = 1; 2757 oparg->disp.exp.X_op = O_absent; 2758 oparg->odisp.exp.X_op = O_absent; 2759 2760 str = strorig = s; 2761 op = oparg; 2762 2763 return yyparse (); 2764} 2765 2766/* The error handler. */ 2767 2768static void 2769yyerror (const char *s) 2770{ 2771 op->error = s; 2772} 2773