1 /* A Bison parser, made from itbl-parse.y 2 by GNU bison 1.35. */ 3 4 #define YYBISON 1 /* Identify Bison output. */ 5 6 # define DREG 257 7 # define CREG 258 8 # define GREG 259 9 # define IMMED 260 10 # define ADDR 261 11 # define INSN 262 12 # define NUM 263 13 # define ID 264 14 # define NL 265 15 # define PNUM 266 16 17 #line 21 "itbl-parse.y" 18 19 20 /* 21 22 Yacc grammar for instruction table entries. 23 24 ======================================================================= 25 Original Instruction table specification document: 26 27 MIPS Coprocessor Table Specification 28 ==================================== 29 30 This document describes the format of the MIPS coprocessor table. The 31 table specifies a list of valid functions, data registers and control 32 registers that can be used in coprocessor instructions. This list, 33 together with the coprocessor instruction classes listed below, 34 specifies the complete list of coprocessor instructions that will 35 be recognized and assembled by the GNU assembler. In effect, 36 this makes the GNU assembler table-driven, where the table is 37 specified by the programmer. 38 39 The table is an ordinary text file that the GNU assembler reads when 40 it starts. Using the information in the table, the assembler 41 generates an internal list of valid coprocessor registers and 42 functions. The assembler uses this internal list in addition to the 43 standard MIPS registers and instructions which are built-in to the 44 assembler during code generation. 45 46 To specify the coprocessor table when invoking the GNU assembler, use 47 the command line option "--itbl file", where file is the 48 complete name of the table, including path and extension. 49 50 Examples: 51 52 gas -t cop.tbl test.s -o test.o 53 gas -t /usr/local/lib/cop.tbl test.s -o test.o 54 gas --itbl d:\gnu\data\cop.tbl test.s -o test.o 55 56 Only one table may be supplied during a single invocation of 57 the assembler. 58 59 60 Instruction classes 61 =================== 62 63 Below is a list of the valid coprocessor instruction classes for 64 any given coprocessor "z". These instructions are already recognized 65 by the assembler, and are listed here only for reference. 66 67 Class format instructions 68 ------------------------------------------------- 69 Class1: 70 op base rt offset 71 LWCz rt,offset (base) 72 SWCz rt,offset (base) 73 Class2: 74 COPz sub rt rd 0 75 MTCz rt,rd 76 MFCz rt,rd 77 CTCz rt,rd 78 CFCz rt,rd 79 Class3: 80 COPz CO cofun 81 COPz cofun 82 Class4: 83 COPz BC br offset 84 BCzT offset 85 BCzF offset 86 Class5: 87 COPz sub rt rd 0 88 DMFCz rt,rd 89 DMTCz rt,rd 90 Class6: 91 op base rt offset 92 LDCz rt,offset (base) 93 SDCz rt,offset (base) 94 Class7: 95 COPz BC br offset 96 BCzTL offset 97 BCzFL offset 98 99 The coprocessor table defines coprocessor-specific registers that can 100 be used with all of the above classes of instructions, where 101 appropriate. It also defines additional coprocessor-specific 102 functions for Class3 (COPz cofun) instructions, Thus, the table allows 103 the programmer to use convenient mnemonics and operands for these 104 functions, instead of the COPz mmenmonic and cofun operand. 105 106 The names of the MIPS general registers and their aliases are defined 107 by the assembler and will be recognized as valid register names by the 108 assembler when used (where allowed) in coprocessor instructions. 109 However, the names and values of all coprocessor data and control 110 register mnemonics must be specified in the coprocessor table. 111 112 113 Table Grammar 114 ============= 115 116 Here is the grammar for the coprocessor table: 117 118 table -> entry* 119 120 entry -> [z entrydef] [comment] '\n' 121 122 entrydef -> type name val 123 entrydef -> 'insn' name val funcdef ; type of entry (instruction) 124 125 z -> 'p'['0'..'3'] ; processor number 126 type -> ['dreg' | 'creg' | 'greg' ] ; type of entry (register) 127 ; 'dreg', 'creg' or 'greg' specifies a data, control, or general 128 ; register mnemonic, respectively 129 name -> [ltr|dec]* ; mnemonic of register/function 130 val -> [dec|hex] ; register/function number (integer constant) 131 132 funcdef -> frange flags fields 133 ; bitfield range for opcode 134 ; list of fields' formats 135 fields -> field* 136 field -> [','] ftype frange flags 137 flags -> ['*' flagexpr] 138 flagexpr -> '[' flagexpr ']' 139 flagexpr -> val '|' flagexpr 140 ftype -> [ type | 'immed' | 'addr' ] 141 ; 'immed' specifies an immediate value; see grammar for "val" above 142 ; 'addr' specifies a C identifier; name of symbol to be resolved at 143 ; link time 144 frange -> ':' val '-' val ; starting to ending bit positions, where 145 ; where 0 is least significant bit 146 frange -> (null) ; default range of 31-0 will be assumed 147 148 comment -> [';'|'#'] [char]* 149 char -> any printable character 150 ltr -> ['a'..'z'|'A'..'Z'] 151 dec -> ['0'..'9']* ; value in decimal 152 hex -> '0x'['0'..'9' | 'a'..'f' | 'A'..'F']* ; value in hexadecimal 153 154 155 Examples 156 ======== 157 158 Example 1: 159 160 The table: 161 162 p1 dreg d1 1 ; data register "d1" for COP1 has value 1 163 p1 creg c3 3 ; ctrl register "c3" for COP1 has value 3 164 p3 func fill 0x1f:24-20 ; function "fill" for COP3 has value 31 and 165 ; no fields 166 167 will allow the assembler to accept the following coprocessor instructions: 168 169 LWC1 d1,0x100 ($2) 170 fill 171 172 Here, the general purpose register "$2", and instruction "LWC1", are standard 173 mnemonics built-in to the MIPS assembler. 174 175 176 Example 2: 177 178 The table: 179 180 p3 dreg d3 3 ; data register "d3" for COP3 has value 3 181 p3 creg c2 22 ; control register "c2" for COP3 has value 22 182 p3 func fee 0x1f:24-20 dreg:17-13 creg:12-8 immed:7-0 183 ; function "fee" for COP3 has value 31, and 3 fields 184 ; consisting of a data register, a control register, 185 ; and an immediate value. 186 187 will allow the assembler to accept the following coprocessor instruction: 188 189 fee d3,c2,0x1 190 191 and will emit the object code: 192 193 31-26 25 24-20 19-18 17-13 12-8 7-0 194 COPz CO fun dreg creg immed 195 010011 1 11111 00 00011 10110 00000001 196 197 0x4ff07601 198 199 200 Example 3: 201 202 The table: 203 204 p3 dreg d3 3 ; data register "d3" for COP3 has value 3 205 p3 creg c2 22 ; control register "c2" for COP3 has value 22 206 p3 func fuu 0x01f00001 dreg:17-13 creg:12-8 207 208 will allow the assembler to accept the following coprocessor 209 instruction: 210 211 fuu d3,c2 212 213 and will emit the object code: 214 215 31-26 25 24-20 19-18 17-13 12-8 7-0 216 COPz CO fun dreg creg 217 010011 1 11111 00 00011 10110 00000001 218 219 0x4ff07601 220 221 In this way, the programmer can force arbitrary bits of an instruction 222 to have predefined values. 223 224 ======================================================================= 225 Additional notes: 226 227 Encoding of ranges: 228 To handle more than one bit position range within an instruction, 229 use 0s to mask out the ranges which don't apply. 230 May decide to modify the syntax to allow commas separate multiple 231 ranges within an instruction (range','range). 232 233 Changes in grammar: 234 The number of parms argument to the function entry 235 was deleted from the original format such that we now count the fields. 236 237 ---- 238 FIXME! should really change lexical analyzer 239 to recognize 'dreg' etc. in context sensitive way. 240 Currently function names or mnemonics may be incorrectly parsed as keywords 241 242 FIXME! hex is ambiguous with any digit 243 244 */ 245 246 #include <stdio.h> 247 #include "itbl-ops.h" 248 249 /* #define DEBUG */ 250 251 #ifdef DEBUG 252 #ifndef DBG_LVL 253 #define DBG_LVL 1 254 #endif 255 #else 256 #define DBG_LVL 0 257 #endif 258 259 #if DBG_LVL >= 1 260 #define DBG(x) printf x 261 #else 262 #define DBG(x) 263 #endif 264 265 #if DBG_LVL >= 2 266 #define DBGL2(x) printf x 267 #else 268 #define DBGL2(x) 269 #endif 270 271 static int sbit, ebit; 272 static struct itbl_entry *insn=0; 273 extern int insntbl_line; 274 int yyparse PARAMS ((void)); 275 int yylex PARAMS ((void)); 276 static int yyerror PARAMS ((const char *)); 277 278 279 #line 283 "itbl-parse.y" 280 #ifndef YYSTYPE 281 typedef union 282 { 283 char *str; 284 int num; 285 int processor; 286 unsigned long val; 287 } yystype; 288 # define YYSTYPE yystype 289 # define YYSTYPE_IS_TRIVIAL 1 290 #endif 291 #ifndef YYDEBUG 292 # define YYDEBUG 0 293 #endif 294 295 296 297 #define YYFINAL 51 298 #define YYFLAG -32768 299 #define YYNTBASE 20 300 301 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ 302 #define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 34) 303 304 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ 305 static const char yytranslate[] = 306 { 307 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 308 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 309 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 310 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 311 2, 2, 17, 2, 13, 19, 2, 2, 2, 2, 312 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, 313 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 314 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 315 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 316 2, 15, 2, 16, 2, 2, 2, 2, 2, 2, 317 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 318 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 319 2, 2, 2, 2, 14, 2, 2, 2, 2, 2, 320 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 321 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 322 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 323 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 324 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 325 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 326 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 327 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 328 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 329 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 330 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 331 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 332 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 333 6, 7, 8, 9, 10, 11, 12 334 }; 335 336 #if YYDEBUG 337 static const short yyprhs[] = 338 { 339 0, 0, 2, 5, 6, 12, 13, 23, 25, 28, 340 32, 35, 36, 38, 40, 42, 46, 50, 54, 56, 341 59, 60, 65, 66, 68, 70, 72, 74, 76, 78 342 }; 343 static const short yyrhs[] = 344 { 345 21, 0, 22, 21, 0, 0, 30, 31, 32, 33, 346 11, 0, 0, 30, 8, 32, 33, 29, 28, 23, 347 24, 11, 0, 11, 0, 1, 11, 0, 13, 26, 348 24, 0, 26, 24, 0, 0, 31, 0, 7, 0, 349 6, 0, 25, 29, 28, 0, 9, 14, 27, 0, 350 15, 27, 16, 0, 9, 0, 17, 27, 0, 0, 351 18, 9, 19, 9, 0, 0, 12, 0, 3, 0, 352 4, 0, 5, 0, 10, 0, 9, 0, 9, 0 353 }; 354 355 #endif 356 357 #if YYDEBUG 358 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 359 static const short yyrline[] = 360 { 361 0, 300, 304, 306, 309, 316, 316, 325, 326, 329, 362 331, 332, 335, 341, 346, 353, 362, 367, 371, 377, 363 383, 389, 396, 403, 411, 417, 422, 429, 437, 445 364 }; 365 #endif 366 367 368 #if (YYDEBUG) || defined YYERROR_VERBOSE 369 370 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ 371 static const char *const yytname[] = 372 { 373 "$", "error", "$undefined.", "DREG", "CREG", "GREG", "IMMED", "ADDR", 374 "INSN", "NUM", "ID", "NL", "PNUM", "','", "'|'", "'['", "']'", "'*'", 375 "':'", "'-'", "insntbl", "entrys", "entry", "@1", "fieldspecs", "ftype", 376 "fieldspec", "flagexpr", "flags", "range", "pnum", "regtype", "name", 377 "value", 0 378 }; 379 #endif 380 381 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 382 static const short yyr1[] = 383 { 384 0, 20, 21, 21, 22, 23, 22, 22, 22, 24, 385 24, 24, 25, 25, 25, 26, 27, 27, 27, 28, 386 28, 29, 29, 30, 31, 31, 31, 32, 34, 33 387 }; 388 389 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 390 static const short yyr2[] = 391 { 392 0, 1, 2, 0, 5, 0, 9, 1, 2, 3, 393 2, 0, 1, 1, 1, 3, 3, 3, 1, 2, 394 0, 4, 0, 1, 1, 1, 1, 1, 1, 1 395 }; 396 397 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE 398 doesn't specify something else to do. Zero means the default is an 399 error. */ 400 static const short yydefact[] = 401 { 402 0, 0, 7, 23, 1, 0, 0, 8, 2, 24, 403 25, 26, 0, 0, 27, 0, 0, 29, 22, 0, 404 0, 20, 4, 0, 0, 5, 0, 18, 0, 19, 405 11, 21, 0, 0, 14, 13, 0, 0, 22, 11, 406 12, 16, 17, 11, 6, 20, 10, 9, 15, 0, 407 0, 0 408 }; 409 410 static const short yydefgoto[] = 411 { 412 49, 4, 5, 30, 37, 38, 39, 29, 25, 21, 413 6, 40, 15, 18 414 }; 415 416 static const short yypact[] = 417 { 418 0, -9,-32768,-32768,-32768, 0, 12,-32768,-32768,-32768, 419 -32768,-32768, 3, 3,-32768, 9, 9,-32768, -8, 8, 420 19, 15,-32768, 10, -6,-32768, 24, 20, -6,-32768, 421 1,-32768, -6, 21,-32768,-32768, 18, 25, -8, 1, 422 -32768,-32768,-32768, 1,-32768, 15,-32768,-32768,-32768, 35, 423 38,-32768 424 }; 425 426 static const short yypgoto[] = 427 { 428 -32768, 34,-32768,-32768, -13,-32768, 4, -1, -4, 5, 429 -32768, 36, 31, 29 430 }; 431 432 433 #define YYLAST 45 434 435 436 static const short yytable[] = 437 { 438 -3, 1, 7, 27, 9, 10, 11, 34, 35, 28, 439 20, 2, 3, 14, 36, 9, 10, 11, 17, 22, 440 12, 9, 10, 11, 34, 35, 46, 33, 23, 26, 441 47, 41, 24, 31, 32, 50, 44, 42, 51, 8, 442 43, 48, 13, 45, 16, 19 443 }; 444 445 static const short yycheck[] = 446 { 447 0, 1, 11, 9, 3, 4, 5, 6, 7, 15, 448 18, 11, 12, 10, 13, 3, 4, 5, 9, 11, 449 8, 3, 4, 5, 6, 7, 39, 28, 9, 19, 450 43, 32, 17, 9, 14, 0, 11, 16, 0, 5, 451 36, 45, 6, 38, 13, 16 452 }; 453 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 454 #line 3 "/usr/share/bison-1.35/bison.simple" 455 456 /* Skeleton output parser for bison, 457 458 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software 459 Foundation, Inc. 460 461 This program is free software; you can redistribute it and/or modify 462 it under the terms of the GNU General Public License as published by 463 the Free Software Foundation; either version 2, or (at your option) 464 any later version. 465 466 This program is distributed in the hope that it will be useful, 467 but WITHOUT ANY WARRANTY; without even the implied warranty of 468 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 469 GNU General Public License for more details. 470 471 You should have received a copy of the GNU General Public License 472 along with this program; if not, write to the Free Software 473 Foundation, Inc., 59 Temple Place - Suite 330, 474 Boston, MA 02111-1307, USA. */ 475 476 /* As a special exception, when this file is copied by Bison into a 477 Bison output file, you may use that output file without restriction. 478 This special exception was added by the Free Software Foundation 479 in version 1.24 of Bison. */ 480 481 /* This is the parser code that is written into each bison parser when 482 the %semantic_parser declaration is not specified in the grammar. 483 It was written by Richard Stallman by simplifying the hairy parser 484 used when %semantic_parser is specified. */ 485 486 /* All symbols defined below should begin with yy or YY, to avoid 487 infringing on user name space. This should be done even for local 488 variables, as they might otherwise be expanded by user macros. 489 There are some unavoidable exceptions within include files to 490 define necessary library symbols; they are noted "INFRINGES ON 491 USER NAME SPACE" below. */ 492 493 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) 494 495 /* The parser invokes alloca or malloc; define the necessary symbols. */ 496 497 # if YYSTACK_USE_ALLOCA 498 # define YYSTACK_ALLOC alloca 499 # else 500 # ifndef YYSTACK_USE_ALLOCA 501 # if defined (alloca) || defined (_ALLOCA_H) 502 # define YYSTACK_ALLOC alloca 503 # else 504 # ifdef __GNUC__ 505 # define YYSTACK_ALLOC __builtin_alloca 506 # endif 507 # endif 508 # endif 509 # endif 510 511 # ifdef YYSTACK_ALLOC 512 /* Pacify GCC's `empty if-body' warning. */ 513 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 514 # else 515 # if defined (__STDC__) || defined (__cplusplus) 516 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 517 # define YYSIZE_T size_t 518 # endif 519 # define YYSTACK_ALLOC malloc 520 # define YYSTACK_FREE free 521 # endif 522 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ 523 524 525 #if (! defined (yyoverflow) \ 526 && (! defined (__cplusplus) \ 527 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 528 529 /* A type that is properly aligned for any stack member. */ 530 union yyalloc 531 { 532 short yyss; 533 YYSTYPE yyvs; 534 # if YYLSP_NEEDED 535 YYLTYPE yyls; 536 # endif 537 }; 538 539 /* The size of the maximum gap between one aligned stack and the next. */ 540 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) 541 542 /* The size of an array large to enough to hold all stacks, each with 543 N elements. */ 544 # if YYLSP_NEEDED 545 # define YYSTACK_BYTES(N) \ 546 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 547 + 2 * YYSTACK_GAP_MAX) 548 # else 549 # define YYSTACK_BYTES(N) \ 550 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ 551 + YYSTACK_GAP_MAX) 552 # endif 553 554 /* Copy COUNT objects from FROM to TO. The source and destination do 555 not overlap. */ 556 # ifndef YYCOPY 557 # if 1 < __GNUC__ 558 # define YYCOPY(To, From, Count) \ 559 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 560 # else 561 # define YYCOPY(To, From, Count) \ 562 do \ 563 { \ 564 register YYSIZE_T yyi; \ 565 for (yyi = 0; yyi < (Count); yyi++) \ 566 (To)[yyi] = (From)[yyi]; \ 567 } \ 568 while (0) 569 # endif 570 # endif 571 572 /* Relocate STACK from its old location to the new one. The 573 local variables YYSIZE and YYSTACKSIZE give the old and new number of 574 elements in the stack, and YYPTR gives the new location of the 575 stack. Advance YYPTR to a properly aligned location for the next 576 stack. */ 577 # define YYSTACK_RELOCATE(Stack) \ 578 do \ 579 { \ 580 YYSIZE_T yynewbytes; \ 581 YYCOPY (&yyptr->Stack, Stack, yysize); \ 582 Stack = &yyptr->Stack; \ 583 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ 584 yyptr += yynewbytes / sizeof (*yyptr); \ 585 } \ 586 while (0) 587 588 #endif 589 590 591 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 592 # define YYSIZE_T __SIZE_TYPE__ 593 #endif 594 #if ! defined (YYSIZE_T) && defined (size_t) 595 # define YYSIZE_T size_t 596 #endif 597 #if ! defined (YYSIZE_T) 598 # if defined (__STDC__) || defined (__cplusplus) 599 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 600 # define YYSIZE_T size_t 601 # endif 602 #endif 603 #if ! defined (YYSIZE_T) 604 # define YYSIZE_T unsigned int 605 #endif 606 607 #define yyerrok (yyerrstatus = 0) 608 #define yyclearin (yychar = YYEMPTY) 609 #define YYEMPTY -2 610 #define YYEOF 0 611 #define YYACCEPT goto yyacceptlab 612 #define YYABORT goto yyabortlab 613 #define YYERROR goto yyerrlab1 614 /* Like YYERROR except do call yyerror. This remains here temporarily 615 to ease the transition to the new meaning of YYERROR, for GCC. 616 Once GCC version 2 has supplanted version 1, this can go. */ 617 #define YYFAIL goto yyerrlab 618 #define YYRECOVERING() (!!yyerrstatus) 619 #define YYBACKUP(Token, Value) \ 620 do \ 621 if (yychar == YYEMPTY && yylen == 1) \ 622 { \ 623 yychar = (Token); \ 624 yylval = (Value); \ 625 yychar1 = YYTRANSLATE (yychar); \ 626 YYPOPSTACK; \ 627 goto yybackup; \ 628 } \ 629 else \ 630 { \ 631 yyerror ("syntax error: cannot back up"); \ 632 YYERROR; \ 633 } \ 634 while (0) 635 636 #define YYTERROR 1 637 #define YYERRCODE 256 638 639 640 /* YYLLOC_DEFAULT -- Compute the default location (before the actions 641 are run). 642 643 When YYLLOC_DEFAULT is run, CURRENT is set the location of the 644 first token. By default, to implement support for ranges, extend 645 its range to the last symbol. */ 646 647 #ifndef YYLLOC_DEFAULT 648 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 649 Current.last_line = Rhs[N].last_line; \ 650 Current.last_column = Rhs[N].last_column; 651 #endif 652 653 654 /* YYLEX -- calling `yylex' with the right arguments. */ 655 656 #if YYPURE 657 # if YYLSP_NEEDED 658 # ifdef YYLEX_PARAM 659 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) 660 # else 661 # define YYLEX yylex (&yylval, &yylloc) 662 # endif 663 # else /* !YYLSP_NEEDED */ 664 # ifdef YYLEX_PARAM 665 # define YYLEX yylex (&yylval, YYLEX_PARAM) 666 # else 667 # define YYLEX yylex (&yylval) 668 # endif 669 # endif /* !YYLSP_NEEDED */ 670 #else /* !YYPURE */ 671 # define YYLEX yylex () 672 #endif /* !YYPURE */ 673 674 675 /* Enable debugging if requested. */ 676 #if YYDEBUG 677 678 # ifndef YYFPRINTF 679 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 680 # define YYFPRINTF fprintf 681 # endif 682 683 # define YYDPRINTF(Args) \ 684 do { \ 685 if (yydebug) \ 686 YYFPRINTF Args; \ 687 } while (0) 688 /* Nonzero means print parse trace. It is left uninitialized so that 689 multiple parsers can coexist. */ 690 int yydebug; 691 #else /* !YYDEBUG */ 692 # define YYDPRINTF(Args) 693 #endif /* !YYDEBUG */ 694 695 /* YYINITDEPTH -- initial size of the parser's stacks. */ 696 #ifndef YYINITDEPTH 697 # define YYINITDEPTH 200 698 #endif 699 700 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 701 if the built-in stack extension method is used). 702 703 Do not make this value too large; the results are undefined if 704 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) 705 evaluated with infinite-precision integer arithmetic. */ 706 707 #if YYMAXDEPTH == 0 708 # undef YYMAXDEPTH 709 #endif 710 711 #ifndef YYMAXDEPTH 712 # define YYMAXDEPTH 10000 713 #endif 714 715 #ifdef YYERROR_VERBOSE 716 717 # ifndef yystrlen 718 # if defined (__GLIBC__) && defined (_STRING_H) 719 # define yystrlen strlen 720 # else 721 /* Return the length of YYSTR. */ 722 static YYSIZE_T 723 # if defined (__STDC__) || defined (__cplusplus) 724 yystrlen (const char *yystr) 725 # else 726 yystrlen (yystr) 727 const char *yystr; 728 # endif 729 { 730 register const char *yys = yystr; 731 732 while (*yys++ != '\0') 733 continue; 734 735 return yys - yystr - 1; 736 } 737 # endif 738 # endif 739 740 # ifndef yystpcpy 741 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 742 # define yystpcpy stpcpy 743 # else 744 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 745 YYDEST. */ 746 static char * 747 # if defined (__STDC__) || defined (__cplusplus) 748 yystpcpy (char *yydest, const char *yysrc) 749 # else 750 yystpcpy (yydest, yysrc) 751 char *yydest; 752 const char *yysrc; 753 # endif 754 { 755 register char *yyd = yydest; 756 register const char *yys = yysrc; 757 758 while ((*yyd++ = *yys++) != '\0') 759 continue; 760 761 return yyd - 1; 762 } 763 # endif 764 # endif 765 #endif 766 767 #line 315 "/usr/share/bison-1.35/bison.simple" 768 769 770 /* The user can define YYPARSE_PARAM as the name of an argument to be passed 771 into yyparse. The argument should have type void *. 772 It should actually point to an object. 773 Grammar actions can access the variable by casting it 774 to the proper pointer type. */ 775 776 #ifdef YYPARSE_PARAM 777 # if defined (__STDC__) || defined (__cplusplus) 778 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 779 # define YYPARSE_PARAM_DECL 780 # else 781 # define YYPARSE_PARAM_ARG YYPARSE_PARAM 782 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 783 # endif 784 #else /* !YYPARSE_PARAM */ 785 # define YYPARSE_PARAM_ARG 786 # define YYPARSE_PARAM_DECL 787 #endif /* !YYPARSE_PARAM */ 788 789 /* Prevent warning if -Wstrict-prototypes. */ 790 #ifdef __GNUC__ 791 # ifdef YYPARSE_PARAM 792 int yyparse (void *); 793 # else 794 int yyparse (void); 795 # endif 796 #endif 797 798 /* YY_DECL_VARIABLES -- depending whether we use a pure parser, 799 variables are global, or local to YYPARSE. */ 800 801 #define YY_DECL_NON_LSP_VARIABLES \ 802 /* The lookahead symbol. */ \ 803 int yychar; \ 804 \ 805 /* The semantic value of the lookahead symbol. */ \ 806 YYSTYPE yylval; \ 807 \ 808 /* Number of parse errors so far. */ \ 809 int yynerrs; 810 811 #if YYLSP_NEEDED 812 # define YY_DECL_VARIABLES \ 813 YY_DECL_NON_LSP_VARIABLES \ 814 \ 815 /* Location data for the lookahead symbol. */ \ 816 YYLTYPE yylloc; 817 #else 818 # define YY_DECL_VARIABLES \ 819 YY_DECL_NON_LSP_VARIABLES 820 #endif 821 822 823 /* If nonreentrant, generate the variables here. */ 824 825 #if !YYPURE 826 YY_DECL_VARIABLES 827 #endif /* !YYPURE */ 828 829 int 830 yyparse (YYPARSE_PARAM_ARG) 831 YYPARSE_PARAM_DECL 832 { 833 /* If reentrant, generate the variables here. */ 834 #if YYPURE 835 YY_DECL_VARIABLES 836 #endif /* !YYPURE */ 837 838 register int yystate; 839 register int yyn; 840 int yyresult; 841 /* Number of tokens to shift before error messages enabled. */ 842 int yyerrstatus; 843 /* Lookahead token as an internal (translated) token number. */ 844 int yychar1 = 0; 845 846 /* Three stacks and their tools: 847 `yyss': related to states, 848 `yyvs': related to semantic values, 849 `yyls': related to locations. 850 851 Refer to the stacks thru separate pointers, to allow yyoverflow 852 to reallocate them elsewhere. */ 853 854 /* The state stack. */ 855 short yyssa[YYINITDEPTH]; 856 short *yyss = yyssa; 857 register short *yyssp; 858 859 /* The semantic value stack. */ 860 YYSTYPE yyvsa[YYINITDEPTH]; 861 YYSTYPE *yyvs = yyvsa; 862 register YYSTYPE *yyvsp; 863 864 #if YYLSP_NEEDED 865 /* The location stack. */ 866 YYLTYPE yylsa[YYINITDEPTH]; 867 YYLTYPE *yyls = yylsa; 868 YYLTYPE *yylsp; 869 #endif 870 871 #if YYLSP_NEEDED 872 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 873 #else 874 # define YYPOPSTACK (yyvsp--, yyssp--) 875 #endif 876 877 YYSIZE_T yystacksize = YYINITDEPTH; 878 879 880 /* The variables used to return semantic value and location from the 881 action routines. */ 882 YYSTYPE yyval; 883 #if YYLSP_NEEDED 884 YYLTYPE yyloc; 885 #endif 886 887 /* When reducing, the number of symbols on the RHS of the reduced 888 rule. */ 889 int yylen; 890 891 YYDPRINTF ((stderr, "Starting parse\n")); 892 893 yystate = 0; 894 yyerrstatus = 0; 895 yynerrs = 0; 896 yychar = YYEMPTY; /* Cause a token to be read. */ 897 898 /* Initialize stack pointers. 899 Waste one element of value and location stack 900 so that they stay on the same level as the state stack. 901 The wasted elements are never initialized. */ 902 903 yyssp = yyss; 904 yyvsp = yyvs; 905 #if YYLSP_NEEDED 906 yylsp = yyls; 907 #endif 908 goto yysetstate; 909 910 /*------------------------------------------------------------. 911 | yynewstate -- Push a new state, which is found in yystate. | 912 `------------------------------------------------------------*/ 913 yynewstate: 914 /* In all cases, when you get here, the value and location stacks 915 have just been pushed. so pushing a state here evens the stacks. 916 */ 917 yyssp++; 918 919 yysetstate: 920 *yyssp = yystate; 921 922 if (yyssp >= yyss + yystacksize - 1) 923 { 924 /* Get the current used size of the three stacks, in elements. */ 925 YYSIZE_T yysize = yyssp - yyss + 1; 926 927 #ifdef yyoverflow 928 { 929 /* Give user a chance to reallocate the stack. Use copies of 930 these so that the &'s don't force the real ones into 931 memory. */ 932 YYSTYPE *yyvs1 = yyvs; 933 short *yyss1 = yyss; 934 935 /* Each stack pointer address is followed by the size of the 936 data in use in that stack, in bytes. */ 937 # if YYLSP_NEEDED 938 YYLTYPE *yyls1 = yyls; 939 /* This used to be a conditional around just the two extra args, 940 but that might be undefined if yyoverflow is a macro. */ 941 yyoverflow ("parser stack overflow", 942 &yyss1, yysize * sizeof (*yyssp), 943 &yyvs1, yysize * sizeof (*yyvsp), 944 &yyls1, yysize * sizeof (*yylsp), 945 &yystacksize); 946 yyls = yyls1; 947 # else 948 yyoverflow ("parser stack overflow", 949 &yyss1, yysize * sizeof (*yyssp), 950 &yyvs1, yysize * sizeof (*yyvsp), 951 &yystacksize); 952 # endif 953 yyss = yyss1; 954 yyvs = yyvs1; 955 } 956 #else /* no yyoverflow */ 957 # ifndef YYSTACK_RELOCATE 958 goto yyoverflowlab; 959 # else 960 /* Extend the stack our own way. */ 961 if (yystacksize >= YYMAXDEPTH) 962 goto yyoverflowlab; 963 yystacksize *= 2; 964 if (yystacksize > YYMAXDEPTH) 965 yystacksize = YYMAXDEPTH; 966 967 { 968 short *yyss1 = yyss; 969 union yyalloc *yyptr = 970 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 971 if (! yyptr) 972 goto yyoverflowlab; 973 YYSTACK_RELOCATE (yyss); 974 YYSTACK_RELOCATE (yyvs); 975 # if YYLSP_NEEDED 976 YYSTACK_RELOCATE (yyls); 977 # endif 978 # undef YYSTACK_RELOCATE 979 if (yyss1 != yyssa) 980 YYSTACK_FREE (yyss1); 981 } 982 # endif 983 #endif /* no yyoverflow */ 984 985 yyssp = yyss + yysize - 1; 986 yyvsp = yyvs + yysize - 1; 987 #if YYLSP_NEEDED 988 yylsp = yyls + yysize - 1; 989 #endif 990 991 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 992 (unsigned long int) yystacksize)); 993 994 if (yyssp >= yyss + yystacksize - 1) 995 YYABORT; 996 } 997 998 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 999 1000 goto yybackup; 1001 1002 1003 /*-----------. 1004 | yybackup. | 1005 `-----------*/ 1006 yybackup: 1007 1008 /* Do appropriate processing given the current state. */ 1009 /* Read a lookahead token if we need one and don't already have one. */ 1010 /* yyresume: */ 1011 1012 /* First try to decide what to do without reference to lookahead token. */ 1013 1014 yyn = yypact[yystate]; 1015 if (yyn == YYFLAG) 1016 goto yydefault; 1017 1018 /* Not known => get a lookahead token if don't already have one. */ 1019 1020 /* yychar is either YYEMPTY or YYEOF 1021 or a valid token in external form. */ 1022 1023 if (yychar == YYEMPTY) 1024 { 1025 YYDPRINTF ((stderr, "Reading a token: ")); 1026 yychar = YYLEX; 1027 } 1028 1029 /* Convert token to internal form (in yychar1) for indexing tables with */ 1030 1031 if (yychar <= 0) /* This means end of input. */ 1032 { 1033 yychar1 = 0; 1034 yychar = YYEOF; /* Don't call YYLEX any more */ 1035 1036 YYDPRINTF ((stderr, "Now at end of input.\n")); 1037 } 1038 else 1039 { 1040 yychar1 = YYTRANSLATE (yychar); 1041 1042 #if YYDEBUG 1043 /* We have to keep this `#if YYDEBUG', since we use variables 1044 which are defined only if `YYDEBUG' is set. */ 1045 if (yydebug) 1046 { 1047 YYFPRINTF (stderr, "Next token is %d (%s", 1048 yychar, yytname[yychar1]); 1049 /* Give the individual parser a way to print the precise 1050 meaning of a token, for further debugging info. */ 1051 # ifdef YYPRINT 1052 YYPRINT (stderr, yychar, yylval); 1053 # endif 1054 YYFPRINTF (stderr, ")\n"); 1055 } 1056 #endif 1057 } 1058 1059 yyn += yychar1; 1060 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 1061 goto yydefault; 1062 1063 yyn = yytable[yyn]; 1064 1065 /* yyn is what to do for this token type in this state. 1066 Negative => reduce, -yyn is rule number. 1067 Positive => shift, yyn is new state. 1068 New state is final state => don't bother to shift, 1069 just return success. 1070 0, or most negative number => error. */ 1071 1072 if (yyn < 0) 1073 { 1074 if (yyn == YYFLAG) 1075 goto yyerrlab; 1076 yyn = -yyn; 1077 goto yyreduce; 1078 } 1079 else if (yyn == 0) 1080 goto yyerrlab; 1081 1082 if (yyn == YYFINAL) 1083 YYACCEPT; 1084 1085 /* Shift the lookahead token. */ 1086 YYDPRINTF ((stderr, "Shifting token %d (%s), ", 1087 yychar, yytname[yychar1])); 1088 1089 /* Discard the token being shifted unless it is eof. */ 1090 if (yychar != YYEOF) 1091 yychar = YYEMPTY; 1092 1093 *++yyvsp = yylval; 1094 #if YYLSP_NEEDED 1095 *++yylsp = yylloc; 1096 #endif 1097 1098 /* Count tokens shifted since error; after three, turn off error 1099 status. */ 1100 if (yyerrstatus) 1101 yyerrstatus--; 1102 1103 yystate = yyn; 1104 goto yynewstate; 1105 1106 1107 /*-----------------------------------------------------------. 1108 | yydefault -- do the default action for the current state. | 1109 `-----------------------------------------------------------*/ 1110 yydefault: 1111 yyn = yydefact[yystate]; 1112 if (yyn == 0) 1113 goto yyerrlab; 1114 goto yyreduce; 1115 1116 1117 /*-----------------------------. 1118 | yyreduce -- Do a reduction. | 1119 `-----------------------------*/ 1120 yyreduce: 1121 /* yyn is the number of a rule to reduce with. */ 1122 yylen = yyr2[yyn]; 1123 1124 /* If YYLEN is nonzero, implement the default value of the action: 1125 `$$ = $1'. 1126 1127 Otherwise, the following line sets YYVAL to the semantic value of 1128 the lookahead token. This behavior is undocumented and Bison 1129 users should not rely upon it. Assigning to YYVAL 1130 unconditionally makes the parser a bit smaller, and it avoids a 1131 GCC warning that YYVAL may be used uninitialized. */ 1132 yyval = yyvsp[1-yylen]; 1133 1134 #if YYLSP_NEEDED 1135 /* Similarly for the default location. Let the user run additional 1136 commands if for instance locations are ranges. */ 1137 yyloc = yylsp[1-yylen]; 1138 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); 1139 #endif 1140 1141 #if YYDEBUG 1142 /* We have to keep this `#if YYDEBUG', since we use variables which 1143 are defined only if `YYDEBUG' is set. */ 1144 if (yydebug) 1145 { 1146 int yyi; 1147 1148 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", 1149 yyn, yyrline[yyn]); 1150 1151 /* Print the symbols being reduced, and their result. */ 1152 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) 1153 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); 1154 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); 1155 } 1156 #endif 1157 1158 switch (yyn) { 1159 1160 case 4: 1161 #line 311 "itbl-parse.y" 1162 { 1163 DBG (("line %d: entry pnum=%d type=%d name=%s value=x%x\n", 1164 insntbl_line, yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val)); 1165 itbl_add_reg (yyvsp[-4].num, yyvsp[-3].num, yyvsp[-2].str, yyvsp[-1].val); 1166 } 1167 break; 1168 case 5: 1169 #line 317 "itbl-parse.y" 1170 { 1171 DBG (("line %d: entry pnum=%d type=INSN name=%s value=x%x", 1172 insntbl_line, yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val)); 1173 DBG ((" sbit=%d ebit=%d flags=0x%x\n", sbit, ebit, yyvsp[0].val)); 1174 insn=itbl_add_insn (yyvsp[-5].num, yyvsp[-3].str, yyvsp[-2].val, sbit, ebit, yyvsp[0].val); 1175 } 1176 break; 1177 case 6: 1178 #line 324 "itbl-parse.y" 1179 {} 1180 break; 1181 case 12: 1182 #line 337 "itbl-parse.y" 1183 { 1184 DBGL2 (("ftype\n")); 1185 yyval.num = yyvsp[0].num; 1186 } 1187 break; 1188 case 13: 1189 #line 342 "itbl-parse.y" 1190 { 1191 DBGL2 (("addr\n")); 1192 yyval.num = ADDR; 1193 } 1194 break; 1195 case 14: 1196 #line 347 "itbl-parse.y" 1197 { 1198 DBGL2 (("immed\n")); 1199 yyval.num = IMMED; 1200 } 1201 break; 1202 case 15: 1203 #line 355 "itbl-parse.y" 1204 { 1205 DBG (("line %d: field type=%d sbit=%d ebit=%d, flags=0x%x\n", 1206 insntbl_line, yyvsp[-2].num, sbit, ebit, yyvsp[0].val)); 1207 itbl_add_operand (insn, yyvsp[-2].num, sbit, ebit, yyvsp[0].val); 1208 } 1209 break; 1210 case 16: 1211 #line 364 "itbl-parse.y" 1212 { 1213 yyval.val = yyvsp[-2].num | yyvsp[0].val; 1214 } 1215 break; 1216 case 17: 1217 #line 368 "itbl-parse.y" 1218 { 1219 yyval.val = yyvsp[-1].val; 1220 } 1221 break; 1222 case 18: 1223 #line 372 "itbl-parse.y" 1224 { 1225 yyval.val = yyvsp[0].num; 1226 } 1227 break; 1228 case 19: 1229 #line 379 "itbl-parse.y" 1230 { 1231 DBGL2 (("flags=%d\n", yyvsp[0].val)); 1232 yyval.val = yyvsp[0].val; 1233 } 1234 break; 1235 case 20: 1236 #line 384 "itbl-parse.y" 1237 { 1238 yyval.val = 0; 1239 } 1240 break; 1241 case 21: 1242 #line 391 "itbl-parse.y" 1243 { 1244 DBGL2 (("range %d %d\n", yyvsp[-2].num, yyvsp[0].num)); 1245 sbit = yyvsp[-2].num; 1246 ebit = yyvsp[0].num; 1247 } 1248 break; 1249 case 22: 1250 #line 397 "itbl-parse.y" 1251 { 1252 sbit = 31; 1253 ebit = 0; 1254 } 1255 break; 1256 case 23: 1257 #line 405 "itbl-parse.y" 1258 { 1259 DBGL2 (("pnum=%d\n",yyvsp[0].num)); 1260 yyval.num = yyvsp[0].num; 1261 } 1262 break; 1263 case 24: 1264 #line 413 "itbl-parse.y" 1265 { 1266 DBGL2 (("dreg\n")); 1267 yyval.num = DREG; 1268 } 1269 break; 1270 case 25: 1271 #line 418 "itbl-parse.y" 1272 { 1273 DBGL2 (("creg\n")); 1274 yyval.num = CREG; 1275 } 1276 break; 1277 case 26: 1278 #line 423 "itbl-parse.y" 1279 { 1280 DBGL2 (("greg\n")); 1281 yyval.num = GREG; 1282 } 1283 break; 1284 case 27: 1285 #line 431 "itbl-parse.y" 1286 { 1287 DBGL2 (("name=%s\n",yyvsp[0].str)); 1288 yyval.str = yyvsp[0].str; 1289 } 1290 break; 1291 case 28: 1292 #line 439 "itbl-parse.y" 1293 { 1294 DBGL2 (("num=%d\n",yyvsp[0].num)); 1295 yyval.num = yyvsp[0].num; 1296 } 1297 break; 1298 case 29: 1299 #line 447 "itbl-parse.y" 1300 { 1301 DBGL2 (("val=x%x\n",yyvsp[0].num)); 1302 yyval.val = yyvsp[0].num; 1303 } 1304 break; 1305 } 1306 1307 #line 705 "/usr/share/bison-1.35/bison.simple" 1308 1309 1310 yyvsp -= yylen; 1311 yyssp -= yylen; 1312 #if YYLSP_NEEDED 1313 yylsp -= yylen; 1314 #endif 1315 1316 #if YYDEBUG 1317 if (yydebug) 1318 { 1319 short *yyssp1 = yyss - 1; 1320 YYFPRINTF (stderr, "state stack now"); 1321 while (yyssp1 != yyssp) 1322 YYFPRINTF (stderr, " %d", *++yyssp1); 1323 YYFPRINTF (stderr, "\n"); 1324 } 1325 #endif 1326 1327 *++yyvsp = yyval; 1328 #if YYLSP_NEEDED 1329 *++yylsp = yyloc; 1330 #endif 1331 1332 /* Now `shift' the result of the reduction. Determine what state 1333 that goes to, based on the state we popped back to and the rule 1334 number reduced by. */ 1335 1336 yyn = yyr1[yyn]; 1337 1338 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 1339 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1340 yystate = yytable[yystate]; 1341 else 1342 yystate = yydefgoto[yyn - YYNTBASE]; 1343 1344 goto yynewstate; 1345 1346 1347 /*------------------------------------. 1348 | yyerrlab -- here on detecting error | 1349 `------------------------------------*/ 1350 yyerrlab: 1351 /* If not already recovering from an error, report this error. */ 1352 if (!yyerrstatus) 1353 { 1354 ++yynerrs; 1355 1356 #ifdef YYERROR_VERBOSE 1357 yyn = yypact[yystate]; 1358 1359 if (yyn > YYFLAG && yyn < YYLAST) 1360 { 1361 YYSIZE_T yysize = 0; 1362 char *yymsg; 1363 int yyx, yycount; 1364 1365 yycount = 0; 1366 /* Start YYX at -YYN if negative to avoid negative indexes in 1367 YYCHECK. */ 1368 for (yyx = yyn < 0 ? -yyn : 0; 1369 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) 1370 if (yycheck[yyx + yyn] == yyx) 1371 yysize += yystrlen (yytname[yyx]) + 15, yycount++; 1372 yysize += yystrlen ("parse error, unexpected ") + 1; 1373 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); 1374 yymsg = (char *) YYSTACK_ALLOC (yysize); 1375 if (yymsg != 0) 1376 { 1377 char *yyp = yystpcpy (yymsg, "parse error, unexpected "); 1378 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); 1379 1380 if (yycount < 5) 1381 { 1382 yycount = 0; 1383 for (yyx = yyn < 0 ? -yyn : 0; 1384 yyx < (int) (sizeof (yytname) / sizeof (char *)); 1385 yyx++) 1386 if (yycheck[yyx + yyn] == yyx) 1387 { 1388 const char *yyq = ! yycount ? ", expecting " : " or "; 1389 yyp = yystpcpy (yyp, yyq); 1390 yyp = yystpcpy (yyp, yytname[yyx]); 1391 yycount++; 1392 } 1393 } 1394 yyerror (yymsg); 1395 YYSTACK_FREE (yymsg); 1396 } 1397 else 1398 yyerror ("parse error; also virtual memory exhausted"); 1399 } 1400 else 1401 #endif /* defined (YYERROR_VERBOSE) */ 1402 yyerror ("parse error"); 1403 } 1404 goto yyerrlab1; 1405 1406 1407 /*--------------------------------------------------. 1408 | yyerrlab1 -- error raised explicitly by an action | 1409 `--------------------------------------------------*/ 1410 yyerrlab1: 1411 if (yyerrstatus == 3) 1412 { 1413 /* If just tried and failed to reuse lookahead token after an 1414 error, discard it. */ 1415 1416 /* return failure if at end of input */ 1417 if (yychar == YYEOF) 1418 YYABORT; 1419 YYDPRINTF ((stderr, "Discarding token %d (%s).\n", 1420 yychar, yytname[yychar1])); 1421 yychar = YYEMPTY; 1422 } 1423 1424 /* Else will try to reuse lookahead token after shifting the error 1425 token. */ 1426 1427 yyerrstatus = 3; /* Each real token shifted decrements this */ 1428 1429 goto yyerrhandle; 1430 1431 1432 /*-------------------------------------------------------------------. 1433 | yyerrdefault -- current state does not do anything special for the | 1434 | error token. | 1435 `-------------------------------------------------------------------*/ 1436 yyerrdefault: 1437 #if 0 1438 /* This is wrong; only states that explicitly want error tokens 1439 should shift them. */ 1440 1441 /* If its default is to accept any token, ok. Otherwise pop it. */ 1442 yyn = yydefact[yystate]; 1443 if (yyn) 1444 goto yydefault; 1445 #endif 1446 1447 1448 /*---------------------------------------------------------------. 1449 | yyerrpop -- pop the current state because it cannot handle the | 1450 | error token | 1451 `---------------------------------------------------------------*/ 1452 yyerrpop: 1453 if (yyssp == yyss) 1454 YYABORT; 1455 yyvsp--; 1456 yystate = *--yyssp; 1457 #if YYLSP_NEEDED 1458 yylsp--; 1459 #endif 1460 1461 #if YYDEBUG 1462 if (yydebug) 1463 { 1464 short *yyssp1 = yyss - 1; 1465 YYFPRINTF (stderr, "Error: state stack now"); 1466 while (yyssp1 != yyssp) 1467 YYFPRINTF (stderr, " %d", *++yyssp1); 1468 YYFPRINTF (stderr, "\n"); 1469 } 1470 #endif 1471 1472 /*--------------. 1473 | yyerrhandle. | 1474 `--------------*/ 1475 yyerrhandle: 1476 yyn = yypact[yystate]; 1477 if (yyn == YYFLAG) 1478 goto yyerrdefault; 1479 1480 yyn += YYTERROR; 1481 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 1482 goto yyerrdefault; 1483 1484 yyn = yytable[yyn]; 1485 if (yyn < 0) 1486 { 1487 if (yyn == YYFLAG) 1488 goto yyerrpop; 1489 yyn = -yyn; 1490 goto yyreduce; 1491 } 1492 else if (yyn == 0) 1493 goto yyerrpop; 1494 1495 if (yyn == YYFINAL) 1496 YYACCEPT; 1497 1498 YYDPRINTF ((stderr, "Shifting error token, ")); 1499 1500 *++yyvsp = yylval; 1501 #if YYLSP_NEEDED 1502 *++yylsp = yylloc; 1503 #endif 1504 1505 yystate = yyn; 1506 goto yynewstate; 1507 1508 1509 /*-------------------------------------. 1510 | yyacceptlab -- YYACCEPT comes here. | 1511 `-------------------------------------*/ 1512 yyacceptlab: 1513 yyresult = 0; 1514 goto yyreturn; 1515 1516 /*-----------------------------------. 1517 | yyabortlab -- YYABORT comes here. | 1518 `-----------------------------------*/ 1519 yyabortlab: 1520 yyresult = 1; 1521 goto yyreturn; 1522 1523 /*---------------------------------------------. 1524 | yyoverflowab -- parser overflow comes here. | 1525 `---------------------------------------------*/ 1526 yyoverflowlab: 1527 yyerror ("parser stack overflow"); 1528 yyresult = 2; 1529 /* Fall through. */ 1530 1531 yyreturn: 1532 #ifndef yyoverflow 1533 if (yyss != yyssa) 1534 YYSTACK_FREE (yyss); 1535 #endif 1536 return yyresult; 1537 } 1538 #line 452 "itbl-parse.y" 1539 1540 1541 static int 1542 yyerror (msg) 1543 const char *msg; 1544 { 1545 printf ("line %d: %s\n", insntbl_line, msg); 1546 return 0; 1547 } 1548