| 1 | /* A Bison parser, made from parse-gram.y, by GNU bison 1.75a. */ |
| 2 | |
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | /* As a special exception, when this file is copied by Bison into a |
| 22 | Bison output file, you may use that output file without restriction. |
| 23 | This special exception was added by the Free Software Foundation |
| 24 | in version 1.24 of Bison. */ |
| 25 | |
| 26 | /* Written by Richard Stallman by simplifying the original so called |
| 27 | ``semantic'' parser. */ |
| 28 | |
| 29 | /* All symbols defined below should begin with yy or YY, to avoid |
| 30 | infringing on user name space. This should be done even for local |
| 31 | variables, as they might otherwise be expanded by user macros. |
| 32 | There are some unavoidable exceptions within include files to |
| 33 | define necessary library symbols; they are noted "INFRINGES ON |
| 34 | USER NAME SPACE" below. */ |
| 35 | |
| 36 | /* Identify Bison output. */ |
| 37 | #define YYBISON 1 |
| 38 | |
| 39 | /* Pure parsers. */ |
| 40 | #define YYPURE 1 |
| 41 | |
| 42 | /* Using locations. */ |
| 43 | #define YYLSP_NEEDED 1 |
| 44 | |
| 45 | /* If NAME_PREFIX is specified substitute the variables and functions |
| 46 | names. */ |
| 47 | #define yyparse gram_parse |
| 48 | #define yylex gram_lex |
| 49 | #define yyerror gram_error |
| 50 | #define yylval gram_lval |
| 51 | #define yychar gram_char |
| 52 | #define yydebug gram_debug |
| 53 | #define yynerrs gram_nerrs |
| 54 | #define yylloc gram_lloc |
| 55 | |
| 56 | /* Tokens. */ |
| 57 | #ifndef YYTOKENTYPE |
| 58 | # define YYTOKENTYPE |
| 59 | /* Put the tokens into the symbol table, so that GDB and other debuggers |
| 60 | know about them. */ |
| 61 | enum yytokentype { |
| 62 | GRAM_EOF = 0, |
| 63 | STRING = 258, |
| 64 | CHARACTER = 259, |
| 65 | INT = 260, |
| 66 | PERCENT_TOKEN = 261, |
| 67 | PERCENT_NTERM = 262, |
| 68 | PERCENT_TYPE = 263, |
| 69 | PERCENT_DESTRUCTOR = 264, |
| 70 | PERCENT_PRINTER = 265, |
| 71 | PERCENT_UNION = 266, |
| 72 | PERCENT_LEFT = 267, |
| 73 | PERCENT_RIGHT = 268, |
| 74 | PERCENT_NONASSOC = 269, |
| 75 | PERCENT_PREC = 270, |
| 76 | PERCENT_DPREC = 271, |
| 77 | PERCENT_MERGE = 272, |
| 78 | PERCENT_DEBUG = 273, |
| 79 | PERCENT_DEFINE = 274, |
| 80 | PERCENT_DEFINES = 275, |
| 81 | PERCENT_ERROR_VERBOSE = 276, |
| 82 | PERCENT_EXPECT = 277, |
| 83 | PERCENT_FILE_PREFIX = 278, |
| 84 | PERCENT_GLR_PARSER = 279, |
| 85 | PERCENT_LEX_PARAM = 280, |
| 86 | PERCENT_LOCATIONS = 281, |
| 87 | PERCENT_NAME_PREFIX = 282, |
| 88 | PERCENT_NO_LINES = 283, |
| 89 | PERCENT_OUTPUT = 284, |
| 90 | PERCENT_PARSE_PARAM = 285, |
| 91 | PERCENT_PURE_PARSER = 286, |
| 92 | PERCENT_SKELETON = 287, |
| 93 | PERCENT_START = 288, |
| 94 | PERCENT_TOKEN_TABLE = 289, |
| 95 | PERCENT_VERBOSE = 290, |
| 96 | PERCENT_YACC = 291, |
| 97 | TYPE = 292, |
| 98 | EQUAL = 293, |
| 99 | SEMICOLON = 294, |
| 100 | COLON = 295, |
| 101 | COMMA = 296, |
| 102 | PIPE = 297, |
| 103 | ID = 298, |
| 104 | PERCENT_PERCENT = 299, |
| 105 | PROLOGUE = 300, |
| 106 | EPILOGUE = 301, |
| 107 | BRACED_CODE = 302 |
| 108 | }; |
| 109 | #endif |
| 110 | #define GRAM_EOF 0 |
| 111 | #define STRING 258 |
| 112 | #define CHARACTER 259 |
| 113 | #define INT 260 |
| 114 | #define PERCENT_TOKEN 261 |
| 115 | #define PERCENT_NTERM 262 |
| 116 | #define PERCENT_TYPE 263 |
| 117 | #define PERCENT_DESTRUCTOR 264 |
| 118 | #define PERCENT_PRINTER 265 |
| 119 | #define PERCENT_UNION 266 |
| 120 | #define PERCENT_LEFT 267 |
| 121 | #define PERCENT_RIGHT 268 |
| 122 | #define PERCENT_NONASSOC 269 |
| 123 | #define PERCENT_PREC 270 |
| 124 | #define PERCENT_DPREC 271 |
| 125 | #define PERCENT_MERGE 272 |
| 126 | #define PERCENT_DEBUG 273 |
| 127 | #define PERCENT_DEFINE 274 |
| 128 | #define PERCENT_DEFINES 275 |
| 129 | #define PERCENT_ERROR_VERBOSE 276 |
| 130 | #define PERCENT_EXPECT 277 |
| 131 | #define PERCENT_FILE_PREFIX 278 |
| 132 | #define PERCENT_GLR_PARSER 279 |
| 133 | #define PERCENT_LEX_PARAM 280 |
| 134 | #define PERCENT_LOCATIONS 281 |
| 135 | #define PERCENT_NAME_PREFIX 282 |
| 136 | #define PERCENT_NO_LINES 283 |
| 137 | #define PERCENT_OUTPUT 284 |
| 138 | #define PERCENT_PARSE_PARAM 285 |
| 139 | #define PERCENT_PURE_PARSER 286 |
| 140 | #define PERCENT_SKELETON 287 |
| 141 | #define PERCENT_START 288 |
| 142 | #define PERCENT_TOKEN_TABLE 289 |
| 143 | #define PERCENT_VERBOSE 290 |
| 144 | #define PERCENT_YACC 291 |
| 145 | #define TYPE 292 |
| 146 | #define EQUAL 293 |
| 147 | #define SEMICOLON 294 |
| 148 | #define COLON 295 |
| 149 | #define COMMA 296 |
| 150 | #define PIPE 297 |
| 151 | #define ID 298 |
| 152 | #define PERCENT_PERCENT 299 |
| 153 | #define PROLOGUE 300 |
| 154 | #define EPILOGUE 301 |
| 155 | #define BRACED_CODE 302 |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | /* Copy the first part of user declarations. */ |
| 161 | #line 31 "parse-gram.y" |
| 162 | |
| 163 | #include "system.h" |
| 164 | #include "complain.h" |
| 165 | #include "muscle_tab.h" |
| 166 | #include "files.h" |
| 167 | #include "getargs.h" |
| 168 | #include "output.h" |
| 169 | #include "symlist.h" |
| 170 | #include "gram.h" |
| 171 | #include "reader.h" |
| 172 | #include "conflicts.h" |
| 173 | |
| 174 | /* Produce verbose parse errors. */ |
| 175 | #define YYERROR_VERBOSE 1 |
| 176 | #define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 177 | do { \ |
| 178 | if (N) \ |
| 179 | { \ |
| 180 | Current.first_column = Rhs[1].first_column; \ |
| 181 | Current.first_line = Rhs[1].first_line; \ |
| 182 | Current.last_column = Rhs[N].last_column; \ |
| 183 | Current.last_line = Rhs[N].last_line; \ |
| 184 | } \ |
| 185 | else \ |
| 186 | { \ |
| 187 | Current = Rhs[0]; \ |
| 188 | } \ |
| 189 | } while (0) |
| 190 | |
| 191 | /* Pass the control structure to YYPARSE and YYLEX. */ |
| 192 | #define YYPARSE_PARAM gram_control |
| 193 | #define YYLEX_PARAM gram_control |
| 194 | /* YYPARSE receives GRAM_CONTROL as a void *. Provide a |
| 195 | correctly typed access to it. */ |
| 196 | #define yycontrol ((gram_control_t *) gram_control) |
| 197 | |
| 198 | /* Request detailed parse error messages, and pass them to GRAM_ERROR. |
| 199 | FIXME: depends on the undocumented availability of YYLLOC.t */ |
| 200 | #undef yyerror |
| 201 | #define yyerror(Msg) \ |
| 202 | gram_error (&yylloc, Msg) |
| 203 | |
| 204 | #define YYPRINT(File, Type, Value) \ |
| 205 | yyprint (File, Type, &Value) |
| 206 | static void yyprint (FILE *file, int type, const yystype *value); |
| 207 | |
| 208 | symbol_class current_class = unknown_sym; |
| 209 | char *current_type = 0; |
| 210 | symbol_t *current_lhs; |
| 211 | location_t current_lhs_location; |
| 212 | assoc_t current_assoc; |
| 213 | int current_prec = 0; |
| 214 | braced_code_t current_braced_code = action_braced_code; |
| 215 | |
| 216 | |
| 217 | /* Enabling traces. */ |
| 218 | #ifndef YYDEBUG |
| 219 | # define YYDEBUG 1 |
| 220 | #endif |
| 221 | |
| 222 | /* Enabling verbose error messages. */ |
| 223 | #ifdef YYERROR_VERBOSE |
| 224 | # undef YYERROR_VERBOSE |
| 225 | # define YYERROR_VERBOSE 1 |
| 226 | #else |
| 227 | # define YYERROR_VERBOSE 0 |
| 228 | #endif |
| 229 | |
| 230 | #ifndef YYSTYPE |
| 231 | #line 89 "parse-gram.y" |
| 232 | typedef union { |
| 233 | symbol_t *symbol; |
| 234 | symbol_list_t *list; |
| 235 | int integer; |
| 236 | char *string; |
| 237 | assoc_t assoc; |
| 238 | } yystype; |
| 239 | /* Line 193 of /usr/local/share/bison/yacc.c. */ |
| 240 | #line 241 "parse-gram.c" |
| 241 | # define YYSTYPE yystype |
| 242 | # define YYSTYPE_IS_TRIVIAL 1 |
| 243 | #endif |
| 244 | |
| 245 | #ifndef YYLTYPE |
| 246 | typedef struct yyltype |
| 247 | { |
| 248 | int first_line; |
| 249 | int first_column; |
| 250 | int last_line; |
| 251 | int last_column; |
| 252 | } yyltype; |
| 253 | # define YYLTYPE yyltype |
| 254 | # define YYLTYPE_IS_TRIVIAL 1 |
| 255 | #endif |
| 256 | |
| 257 | /* Copy the second part of user declarations. */ |
| 258 | |
| 259 | |
| 260 | /* Line 213 of /usr/local/share/bison/yacc.c. */ |
| 261 | #line 262 "parse-gram.c" |
| 262 | |
| 263 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 264 | |
| 265 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
| 266 | |
| 267 | # if YYSTACK_USE_ALLOCA |
| 268 | # define YYSTACK_ALLOC alloca |
| 269 | # else |
| 270 | # ifndef YYSTACK_USE_ALLOCA |
| 271 | # if defined (alloca) || defined (_ALLOCA_H) |
| 272 | # define YYSTACK_ALLOC alloca |
| 273 | # else |
| 274 | # ifdef __GNUC__ |
| 275 | # define YYSTACK_ALLOC __builtin_alloca |
| 276 | # endif |
| 277 | # endif |
| 278 | # endif |
| 279 | # endif |
| 280 | |
| 281 | # ifdef YYSTACK_ALLOC |
| 282 | /* Pacify GCC's `empty if-body' warning. */ |
| 283 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
| 284 | # else |
| 285 | # if defined (__STDC__) || defined (__cplusplus) |
| 286 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
| 287 | # define YYSIZE_T size_t |
| 288 | # endif |
| 289 | # define YYSTACK_ALLOC malloc |
| 290 | # define YYSTACK_FREE free |
| 291 | # endif |
| 292 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
| 293 | |
| 294 | |
| 295 | #if (! defined (yyoverflow) \ |
| 296 | && (! defined (__cplusplus) \ |
| 297 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
| 298 | |
| 299 | /* A type that is properly aligned for any stack member. */ |
| 300 | union yyalloc |
| 301 | { |
| 302 | short yyss; |
| 303 | YYSTYPE yyvs; |
| 304 | YYLTYPE yyls; |
| 305 | }; |
| 306 | |
| 307 | /* The size of the maximum gap between one aligned stack and the next. */ |
| 308 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) |
| 309 | |
| 310 | /* The size of an array large to enough to hold all stacks, each with |
| 311 | N elements. */ |
| 312 | # define YYSTACK_BYTES(N) \ |
| 313 | ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
| 314 | + 2 * YYSTACK_GAP_MAX) |
| 315 | |
| 316 | /* Copy COUNT objects from FROM to TO. The source and destination do |
| 317 | not overlap. */ |
| 318 | # ifndef YYCOPY |
| 319 | # if 1 < __GNUC__ |
| 320 | # define YYCOPY(To, From, Count) \ |
| 321 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
| 322 | # else |
| 323 | # define YYCOPY(To, From, Count) \ |
| 324 | do \ |
| 325 | { \ |
| 326 | register YYSIZE_T yyi; \ |
| 327 | for (yyi = 0; yyi < (Count); yyi++) \ |
| 328 | (To)[yyi] = (From)[yyi]; \ |
| 329 | } \ |
| 330 | while (0) |
| 331 | # endif |
| 332 | # endif |
| 333 | |
| 334 | /* Relocate STACK from its old location to the new one. The |
| 335 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
| 336 | elements in the stack, and YYPTR gives the new location of the |
| 337 | stack. Advance YYPTR to a properly aligned location for the next |
| 338 | stack. */ |
| 339 | # define YYSTACK_RELOCATE(Stack) \ |
| 340 | do \ |
| 341 | { \ |
| 342 | YYSIZE_T yynewbytes; \ |
| 343 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
| 344 | Stack = &yyptr->Stack; \ |
| 345 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ |
| 346 | yyptr += yynewbytes / sizeof (*yyptr); \ |
| 347 | } \ |
| 348 | while (0) |
| 349 | |
| 350 | #endif |
| 351 | |
| 352 | #if defined (__STDC__) || defined (__cplusplus) |
| 353 | typedef signed char yysigned_char; |
| 354 | #else |
| 355 | typedef short yysigned_char; |
| 356 | #endif |
| 357 | |
| 358 | /* YYFINAL -- State number of the termination state. */ |
| 359 | #define YYFINAL 3 |
| 360 | #define YYLAST 152 |
| 361 | |
| 362 | /* YYNTOKENS -- Number of terminals. */ |
| 363 | #define YYNTOKENS 48 |
| 364 | /* YYNNTS -- Number of nonterminals. */ |
| 365 | #define YYNNTS 28 |
| 366 | /* YYNRULES -- Number of rules. */ |
| 367 | #define YYNRULES 77 |
| 368 | /* YYNRULES -- Number of states. */ |
| 369 | #define YYNSTATES 116 |
| 370 | |
| 371 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
| 372 | #define YYUNDEFTOK 2 |
| 373 | #define YYMAXUTOK 302 |
| 374 | |
| 375 | #define YYTRANSLATE(X) \ |
| 376 | ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) |
| 377 | |
| 378 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
| 379 | static const unsigned char yytranslate[] = |
| 380 | { |
| 381 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 382 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 383 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 384 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 385 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 386 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 387 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 388 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 389 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 390 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 391 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 392 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 393 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 394 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 395 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 396 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 397 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 398 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 399 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 400 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 401 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 402 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 403 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 404 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 405 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 406 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
| 407 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 408 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
| 409 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 410 | 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| 411 | 45, 46, 47 |
| 412 | }; |
| 413 | |
| 414 | #if YYDEBUG |
| 415 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 416 | YYRHS. */ |
| 417 | static const unsigned char yyprhs[] = |
| 418 | { |
| 419 | 0, 0, 3, 8, 9, 13, 15, 17, 19, 23, |
| 420 | 25, 27, 30, 34, 36, 41, 43, 47, 49, 53, |
| 421 | 58, 60, 63, 65, 67, 69, 71, 73, 76, 79, |
| 422 | 80, 85, 86, 91, 92, 96, 97, 101, 105, 109, |
| 423 | 111, 113, 115, 116, 118, 120, 123, 125, 127, 130, |
| 424 | 133, 137, 139, 142, 144, 147, 149, 152, 155, 156, |
| 425 | 162, 164, 168, 169, 172, 175, 179, 183, 187, 189, |
| 426 | 191, 193, 195, 197, 199, 200, 203, 204 |
| 427 | }; |
| 428 | |
| 429 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 430 | static const yysigned_char yyrhs[] = |
| 431 | { |
| 432 | 49, 0, -1, 50, 44, 64, 74, -1, -1, 50, |
| 433 | 51, 75, -1, 52, -1, 45, -1, 18, -1, 19, |
| 434 | 73, 73, -1, 20, -1, 21, -1, 22, 5, -1, |
| 435 | 23, 38, 73, -1, 24, -1, 25, 73, 41, 73, |
| 436 | -1, 26, -1, 27, 38, 73, -1, 28, -1, 29, |
| 437 | 38, 73, -1, 30, 73, 41, 73, -1, 31, -1, |
| 438 | 32, 73, -1, 34, -1, 35, -1, 36, -1, 58, |
| 439 | -1, 55, -1, 33, 70, -1, 11, 47, -1, -1, |
| 440 | 9, 53, 47, 61, -1, -1, 10, 54, 47, 61, |
| 441 | -1, -1, 7, 56, 63, -1, -1, 6, 57, 63, |
| 442 | -1, 8, 37, 61, -1, 59, 60, 61, -1, 12, |
| 443 | -1, 13, -1, 14, -1, -1, 37, -1, 70, -1, |
| 444 | 61, 70, -1, 37, -1, 43, -1, 43, 5, -1, |
| 445 | 43, 72, -1, 43, 5, 72, -1, 62, -1, 63, |
| 446 | 62, -1, 65, -1, 64, 65, -1, 66, -1, 52, |
| 447 | 39, -1, 1, 39, -1, -1, 43, 40, 67, 68, |
| 448 | 39, -1, 69, -1, 68, 42, 69, -1, -1, 69, |
| 449 | 70, -1, 69, 71, -1, 69, 15, 70, -1, 69, |
| 450 | 16, 5, -1, 69, 17, 37, -1, 43, -1, 72, |
| 451 | -1, 4, -1, 47, -1, 3, -1, 3, -1, -1, |
| 452 | 44, 46, -1, -1, 39, -1 |
| 453 | }; |
| 454 | |
| 455 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 456 | static const unsigned short yyrline[] = |
| 457 | { |
| 458 | 0, 168, 168, 181, 183, 186, 188, 189, 190, 191, |
| 459 | 192, 193, 194, 195, 196, 198, 199, 200, 201, 202, |
| 460 | 204, 205, 206, 207, 208, 211, 213, 214, 218, 225, |
| 461 | 224, 235, 234, 247, 246, 252, 252, 257, 266, 281, |
| 462 | 283, 284, 287, 289, 294, 296, 300, 305, 310, 316, |
| 463 | 322, 332, 335, 344, 346, 352, 354, 359, 366, 365, |
| 464 | 370, 372, 375, 378, 380, 382, 384, 386, 390, 392, |
| 465 | 393, 396, 402, 411, 419, 424, 430, 432 |
| 466 | }; |
| 467 | #endif |
| 468 | |
| 469 | #if YYDEBUG || YYERROR_VERBOSE |
| 470 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 471 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 472 | static const char *const yytname[] = |
| 473 | { |
| 474 | "\"end of file\"", "error", "$undefined", "\"string\"", "\"character\"", |
| 475 | "\"integer\"", "\"%token\"", "\"%nterm\"", "\"%type\"", |
| 476 | "\"%destructor\"", "\"%printer\"", "\"%union\"", "\"%left\"", |
| 477 | "\"%right\"", "\"%nonassoc\"", "\"%prec\"", "\"%dprec\"", "\"%merge\"", |
| 478 | "\"%debug\"", "\"%define\"", "\"%defines\"", "\"%error-verbose\"", |
| 479 | "\"%expect\"", "\"%file-prefix\"", "\"%glr-parser\"", "\"%lex-param\"", |
| 480 | "\"%locations\"", "\"%name-prefix\"", "\"%no-lines\"", "\"%output\"", |
| 481 | "\"%parse-param\"", "\"%pure-parser\"", "\"%skeleton\"", "\"%start\"", |
| 482 | "\"%token-table\"", "\"%verbose\"", "\"%yacc\"", "\"type\"", "\"=\"", |
| 483 | "\";\"", "\":\"", "\",\"", "\"|\"", "\"identifier\"", "\"%%\"", |
| 484 | "\"%{...%}\"", "\"epilogue\"", "\"{...}\"", "$accept", "input", |
| 485 | "declarations", "declaration", "grammar_declaration", "@1", "@2", |
| 486 | "symbol_declaration", "@3", "@4", "precedence_declaration", |
| 487 | "precedence_declarator", "type.opt", "symbols.1", "symbol_def", |
| 488 | "symbol_defs.1", "grammar", "rules_or_grammar_declaration", "rules", |
| 489 | "@5", "rhses.1", "rhs", "symbol", "action", "string_as_id", |
| 490 | "string_content", "epilogue.opt", "semi_colon.opt", 0 |
| 491 | }; |
| 492 | #endif |
| 493 | |
| 494 | # ifdef YYPRINT |
| 495 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 496 | token YYLEX-NUM. */ |
| 497 | static const unsigned short yytoknum[] = |
| 498 | { |
| 499 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 500 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
| 501 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
| 502 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, |
| 503 | 295, 296, 297, 298, 299, 300, 301, 302 |
| 504 | }; |
| 505 | # endif |
| 506 | |
| 507 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
| 508 | static const unsigned char yyr1[] = |
| 509 | { |
| 510 | 0, 48, 49, 50, 50, 51, 51, 51, 51, 51, |
| 511 | 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, |
| 512 | 51, 51, 51, 51, 51, 52, 52, 52, 52, 53, |
| 513 | 52, 54, 52, 56, 55, 57, 55, 55, 58, 59, |
| 514 | 59, 59, 60, 60, 61, 61, 62, 62, 62, 62, |
| 515 | 62, 63, 63, 64, 64, 65, 65, 65, 67, 66, |
| 516 | 68, 68, 69, 69, 69, 69, 69, 69, 70, 70, |
| 517 | 70, 71, 72, 73, 74, 74, 75, 75 |
| 518 | }; |
| 519 | |
| 520 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 521 | static const unsigned char yyr2[] = |
| 522 | { |
| 523 | 0, 2, 4, 0, 3, 1, 1, 1, 3, 1, |
| 524 | 1, 2, 3, 1, 4, 1, 3, 1, 3, 4, |
| 525 | 1, 2, 1, 1, 1, 1, 1, 2, 2, 0, |
| 526 | 4, 0, 4, 0, 3, 0, 3, 3, 3, 1, |
| 527 | 1, 1, 0, 1, 1, 2, 1, 1, 2, 2, |
| 528 | 3, 1, 2, 1, 2, 1, 2, 2, 0, 5, |
| 529 | 1, 3, 0, 2, 2, 3, 3, 3, 1, 1, |
| 530 | 1, 1, 1, 1, 0, 2, 0, 1 |
| 531 | }; |
| 532 | |
| 533 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 534 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 535 | means the default is an error. */ |
| 536 | static const unsigned char yydefact[] = |
| 537 | { |
| 538 | 3, 0, 0, 1, 35, 33, 0, 29, 31, 0, |
| 539 | 39, 40, 41, 7, 0, 9, 10, 0, 0, 13, |
| 540 | 0, 15, 0, 17, 0, 0, 20, 0, 0, 22, |
| 541 | 23, 24, 0, 6, 76, 5, 26, 25, 42, 0, |
| 542 | 0, 0, 0, 0, 28, 73, 0, 11, 0, 0, |
| 543 | 0, 0, 0, 21, 72, 70, 68, 27, 69, 0, |
| 544 | 0, 0, 0, 53, 55, 77, 4, 43, 0, 46, |
| 545 | 47, 51, 36, 34, 37, 44, 0, 0, 8, 12, |
| 546 | 0, 16, 18, 0, 57, 58, 56, 0, 54, 2, |
| 547 | 38, 48, 49, 52, 45, 30, 32, 14, 19, 62, |
| 548 | 75, 50, 0, 60, 59, 62, 0, 0, 0, 71, |
| 549 | 63, 64, 61, 65, 66, 67 |
| 550 | }; |
| 551 | |
| 552 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 553 | static const yysigned_char yydefgoto[] = |
| 554 | { |
| 555 | -1, 1, 2, 34, 61, 42, 43, 36, 40, 39, |
| 556 | 37, 38, 68, 74, 71, 72, 62, 63, 64, 99, |
| 557 | 102, 103, 75, 111, 58, 46, 89, 66 |
| 558 | }; |
| 559 | |
| 560 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 561 | STATE-NUM. */ |
| 562 | #define YYPACT_NINF -64 |
| 563 | static const yysigned_char yypact[] = |
| 564 | { |
| 565 | -64, 9, 107, -64, -64, -64, -13, -64, -64, -9, |
| 566 | -64, -64, -64, -64, 27, -64, -64, 38, 3, -64, |
| 567 | 27, -64, 6, -64, 7, 27, -64, 27, -1, -64, |
| 568 | -64, -64, 79, -64, 10, -64, -64, -64, 13, -17, |
| 569 | -17, -1, 8, 11, -64, -64, 27, -64, 27, 15, |
| 570 | 27, 27, 16, -64, -64, -64, -64, -64, -64, 20, |
| 571 | 14, 21, 4, -64, -64, -64, -64, -64, -1, -64, |
| 572 | 18, -64, -17, -17, -1, -64, -1, -1, -64, -64, |
| 573 | 27, -64, -64, 27, -64, -64, -64, 17, -64, -64, |
| 574 | -1, 62, -64, -64, -64, -1, -1, -64, -64, -64, |
| 575 | -64, -64, -20, 36, -64, -64, -1, 61, 32, -64, |
| 576 | -64, -64, 36, -64, -64, -64 |
| 577 | }; |
| 578 | |
| 579 | /* YYPGOTO[NTERM-NUM]. */ |
| 580 | static const yysigned_char yypgoto[] = |
| 581 | { |
| 582 | -64, -64, -64, -64, 68, -64, -64, -64, -64, -64, |
| 583 | -64, -64, -64, -43, -37, 31, -64, 12, -64, -64, |
| 584 | -64, -33, -28, -64, -63, -19, -64, -64 |
| 585 | }; |
| 586 | |
| 587 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 588 | positive, shift that token. If negative, reduce the rule which |
| 589 | number is the opposite. If zero, do what YYDEFACT says. |
| 590 | If YYTABLE_NINF, parse error. */ |
| 591 | #define YYTABLE_NINF -75 |
| 592 | static const yysigned_char yytable[] = |
| 593 | { |
| 594 | 57, 49, 54, 55, -74, 59, 52, 92, 53, 3, |
| 595 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 104, |
| 596 | 69, 54, 105, 91, 41, 90, 70, 78, 101, 79, |
| 597 | 45, 81, 82, 95, 96, 93, 93, 28, 44, 54, |
| 598 | 55, 48, 56, 47, 50, 51, 94, 60, 87, 65, |
| 599 | 67, 106, 107, 108, 85, 76, 80, 83, 77, 84, |
| 600 | 86, 97, 94, 100, 98, 54, 114, 94, 94, 115, |
| 601 | 35, 73, 112, 0, 88, 110, 0, 0, 113, 56, |
| 602 | 59, 0, 0, 109, 110, 4, 5, 6, 7, 8, |
| 603 | 9, 10, 11, 12, 0, 0, 0, 0, 0, 0, |
| 604 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 605 | 0, 0, 28, 4, 5, 6, 7, 8, 9, 10, |
| 606 | 11, 12, 60, 0, 0, 13, 14, 15, 16, 17, |
| 607 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, |
| 608 | 28, 29, 30, 31, 0, 0, 0, 0, 0, 0, |
| 609 | 0, 32, 33 |
| 610 | }; |
| 611 | |
| 612 | static const yysigned_char yycheck[] = |
| 613 | { |
| 614 | 28, 20, 3, 4, 0, 1, 25, 70, 27, 0, |
| 615 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 39, |
| 616 | 37, 3, 42, 5, 37, 68, 43, 46, 91, 48, |
| 617 | 3, 50, 51, 76, 77, 72, 73, 33, 47, 3, |
| 618 | 4, 38, 43, 5, 38, 38, 74, 43, 44, 39, |
| 619 | 37, 15, 16, 17, 40, 47, 41, 41, 47, 39, |
| 620 | 39, 80, 90, 46, 83, 3, 5, 95, 96, 37, |
| 621 | 2, 40, 105, -1, 62, 103, -1, -1, 106, 43, |
| 622 | 1, -1, -1, 47, 112, 6, 7, 8, 9, 10, |
| 623 | 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, |
| 624 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 625 | -1, -1, 33, 6, 7, 8, 9, 10, 11, 12, |
| 626 | 13, 14, 43, -1, -1, 18, 19, 20, 21, 22, |
| 627 | 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, |
| 628 | 33, 34, 35, 36, -1, -1, -1, -1, -1, -1, |
| 629 | -1, 44, 45 |
| 630 | }; |
| 631 | |
| 632 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 633 | symbol of state STATE-NUM. */ |
| 634 | static const unsigned char yystos[] = |
| 635 | { |
| 636 | 0, 49, 50, 0, 6, 7, 8, 9, 10, 11, |
| 637 | 12, 13, 14, 18, 19, 20, 21, 22, 23, 24, |
| 638 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
| 639 | 35, 36, 44, 45, 51, 52, 55, 58, 59, 57, |
| 640 | 56, 37, 53, 54, 47, 3, 73, 5, 38, 73, |
| 641 | 38, 38, 73, 73, 3, 4, 43, 70, 72, 1, |
| 642 | 43, 52, 64, 65, 66, 39, 75, 37, 60, 37, |
| 643 | 43, 62, 63, 63, 61, 70, 47, 47, 73, 73, |
| 644 | 41, 73, 73, 41, 39, 40, 39, 44, 65, 74, |
| 645 | 61, 5, 72, 62, 70, 61, 61, 73, 73, 67, |
| 646 | 46, 72, 68, 69, 39, 42, 15, 16, 17, 47, |
| 647 | 70, 71, 69, 70, 5, 37 |
| 648 | }; |
| 649 | |
| 650 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 651 | # define YYSIZE_T __SIZE_TYPE__ |
| 652 | #endif |
| 653 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 654 | # define YYSIZE_T size_t |
| 655 | #endif |
| 656 | #if ! defined (YYSIZE_T) |
| 657 | # if defined (__STDC__) || defined (__cplusplus) |
| 658 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 659 | # define YYSIZE_T size_t |
| 660 | # endif |
| 661 | #endif |
| 662 | #if ! defined (YYSIZE_T) |
| 663 | # define YYSIZE_T unsigned int |
| 664 | #endif |
| 665 | |
| 666 | #define yyerrok (yyerrstatus = 0) |
| 667 | #define yyclearin (yychar = YYEMPTY) |
| 668 | #define YYEMPTY -2 |
| 669 | #define YYEOF 0 |
| 670 | |
| 671 | #define YYACCEPT goto yyacceptlab |
| 672 | #define YYABORT goto yyabortlab |
| 673 | #define YYERROR goto yyerrlab1 |
| 674 | |
| 675 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 676 | to ease the transition to the new meaning of YYERROR, for GCC. |
| 677 | Once GCC version 2 has supplanted version 1, this can go. */ |
| 678 | |
| 679 | #define YYFAIL goto yyerrlab |
| 680 | |
| 681 | #define YYRECOVERING() (!!yyerrstatus) |
| 682 | |
| 683 | #define YYBACKUP(Token, Value) \ |
| 684 | do \ |
| 685 | if (yychar == YYEMPTY && yylen == 1) \ |
| 686 | { \ |
| 687 | yychar = (Token); \ |
| 688 | yylval = (Value); \ |
| 689 | yychar1 = YYTRANSLATE (yychar); \ |
| 690 | YYPOPSTACK; \ |
| 691 | goto yybackup; \ |
| 692 | } \ |
| 693 | else \ |
| 694 | { \ |
| 695 | yyerror ("syntax error: cannot back up"); \ |
| 696 | YYERROR; \ |
| 697 | } \ |
| 698 | while (0) |
| 699 | |
| 700 | #define YYTERROR 1 |
| 701 | #define YYERRCODE 256 |
| 702 | |
| 703 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
| 704 | are run). */ |
| 705 | |
| 706 | #ifndef YYLLOC_DEFAULT |
| 707 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
| 708 | Current.first_line = Rhs[1].first_line; \ |
| 709 | Current.first_column = Rhs[1].first_column; \ |
| 710 | Current.last_line = Rhs[N].last_line; \ |
| 711 | Current.last_column = Rhs[N].last_column; |
| 712 | #endif |
| 713 | |
| 714 | /* YYLEX -- calling `yylex' with the right arguments. */ |
| 715 | |
| 716 | #ifdef YYLEX_PARAM |
| 717 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) |
| 718 | #else |
| 719 | # define YYLEX yylex (&yylval, &yylloc) |
| 720 | #endif |
| 721 | |
| 722 | /* Enable debugging if requested. */ |
| 723 | #if YYDEBUG |
| 724 | |
| 725 | # ifndef YYFPRINTF |
| 726 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
| 727 | # define YYFPRINTF fprintf |
| 728 | # endif |
| 729 | |
| 730 | # define YYDPRINTF(Args) \ |
| 731 | do { \ |
| 732 | if (yydebug) \ |
| 733 | YYFPRINTF Args; \ |
| 734 | } while (0) |
| 735 | # define YYDSYMPRINT(Args) \ |
| 736 | do { \ |
| 737 | if (yydebug) \ |
| 738 | yysymprint Args; \ |
| 739 | } while (0) |
| 740 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 741 | multiple parsers can coexist. */ |
| 742 | int yydebug; |
| 743 | #else /* !YYDEBUG */ |
| 744 | # define YYDPRINTF(Args) |
| 745 | # define YYDSYMPRINT(Args) |
| 746 | #endif /* !YYDEBUG */ |
| 747 | |
| 748 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
| 749 | #ifndef YYINITDEPTH |
| 750 | # define YYINITDEPTH 200 |
| 751 | #endif |
| 752 | |
| 753 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 754 | if the built-in stack extension method is used). |
| 755 | |
| 756 | Do not make this value too large; the results are undefined if |
| 757 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
| 758 | evaluated with infinite-precision integer arithmetic. */ |
| 759 | |
| 760 | #if YYMAXDEPTH == 0 |
| 761 | # undef YYMAXDEPTH |
| 762 | #endif |
| 763 | |
| 764 | #ifndef YYMAXDEPTH |
| 765 | # define YYMAXDEPTH 10000 |
| 766 | #endif |
| 767 | |
| 768 | \f |
| 769 | |
| 770 | #if YYERROR_VERBOSE |
| 771 | |
| 772 | # ifndef yystrlen |
| 773 | # if defined (__GLIBC__) && defined (_STRING_H) |
| 774 | # define yystrlen strlen |
| 775 | # else |
| 776 | /* Return the length of YYSTR. */ |
| 777 | static YYSIZE_T |
| 778 | # if defined (__STDC__) || defined (__cplusplus) |
| 779 | yystrlen (const char *yystr) |
| 780 | # else |
| 781 | yystrlen (yystr) |
| 782 | const char *yystr; |
| 783 | # endif |
| 784 | { |
| 785 | register const char *yys = yystr; |
| 786 | |
| 787 | while (*yys++ != '\0') |
| 788 | continue; |
| 789 | |
| 790 | return yys - yystr - 1; |
| 791 | } |
| 792 | # endif |
| 793 | # endif |
| 794 | |
| 795 | # ifndef yystpcpy |
| 796 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
| 797 | # define yystpcpy stpcpy |
| 798 | # else |
| 799 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
| 800 | YYDEST. */ |
| 801 | static char * |
| 802 | # if defined (__STDC__) || defined (__cplusplus) |
| 803 | yystpcpy (char *yydest, const char *yysrc) |
| 804 | # else |
| 805 | yystpcpy (yydest, yysrc) |
| 806 | char *yydest; |
| 807 | const char *yysrc; |
| 808 | # endif |
| 809 | { |
| 810 | register char *yyd = yydest; |
| 811 | register const char *yys = yysrc; |
| 812 | |
| 813 | while ((*yyd++ = *yys++) != '\0') |
| 814 | continue; |
| 815 | |
| 816 | return yyd - 1; |
| 817 | } |
| 818 | # endif |
| 819 | # endif |
| 820 | |
| 821 | #endif /* !YYERROR_VERBOSE */ |
| 822 | |
| 823 | \f |
| 824 | |
| 825 | #if YYDEBUG |
| 826 | /*-----------------------------. |
| 827 | | Print this symbol on YYOUT. | |
| 828 | `-----------------------------*/ |
| 829 | |
| 830 | static void |
| 831 | #if defined (__STDC__) || defined (__cplusplus) |
| 832 | yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue, YYLTYPE yylocation) |
| 833 | #else |
| 834 | yysymprint (yyout, yytype, yyvalue, yylocation) |
| 835 | FILE* yyout; |
| 836 | int yytype; |
| 837 | YYSTYPE yyvalue; |
| 838 | YYLTYPE yylocation; |
| 839 | #endif |
| 840 | { |
| 841 | /* Pacify ``unused variable'' warnings. */ |
| 842 | (void) yyvalue; |
| 843 | (void) yylocation; |
| 844 | |
| 845 | if (yytype < YYNTOKENS) |
| 846 | { |
| 847 | YYFPRINTF (yyout, "token %s (", yytname[yytype]); |
| 848 | # ifdef YYPRINT |
| 849 | YYPRINT (yyout, yytoknum[yytype], yyvalue); |
| 850 | # endif |
| 851 | } |
| 852 | else |
| 853 | YYFPRINTF (yyout, "nterm %s (", yytname[yytype]); |
| 854 | |
| 855 | switch (yytype) |
| 856 | { |
| 857 | default: |
| 858 | break; |
| 859 | } |
| 860 | YYFPRINTF (yyout, ")"); |
| 861 | } |
| 862 | #endif /* YYDEBUG. */ |
| 863 | |
| 864 | |
| 865 | /*-----------------------------------------------. |
| 866 | | Release the memory associated to this symbol. | |
| 867 | `-----------------------------------------------*/ |
| 868 | |
| 869 | static void |
| 870 | #if defined (__STDC__) || defined (__cplusplus) |
| 871 | yydestruct (int yytype, YYSTYPE yyvalue, YYLTYPE yylocation) |
| 872 | #else |
| 873 | yydestruct (yytype, yyvalue, yylocation) |
| 874 | int yytype; |
| 875 | YYSTYPE yyvalue; |
| 876 | YYLTYPE yylocation; |
| 877 | #endif |
| 878 | { |
| 879 | /* Pacify ``unused variable'' warnings. */ |
| 880 | (void) yyvalue; |
| 881 | (void) yylocation; |
| 882 | |
| 883 | switch (yytype) |
| 884 | { |
| 885 | default: |
| 886 | break; |
| 887 | } |
| 888 | } |
| 889 | |
| 890 | \f |
| 891 | |
| 892 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
| 893 | into yyparse. The argument should have type void *. |
| 894 | It should actually point to an object. |
| 895 | Grammar actions can access the variable by casting it |
| 896 | to the proper pointer type. */ |
| 897 | |
| 898 | #ifdef YYPARSE_PARAM |
| 899 | # if defined (__STDC__) || defined (__cplusplus) |
| 900 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
| 901 | # define YYPARSE_PARAM_DECL |
| 902 | # else |
| 903 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM |
| 904 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
| 905 | # endif |
| 906 | #else /* !YYPARSE_PARAM */ |
| 907 | # define YYPARSE_PARAM_ARG |
| 908 | # define YYPARSE_PARAM_DECL |
| 909 | #endif /* !YYPARSE_PARAM */ |
| 910 | |
| 911 | /* Prevent warning if -Wstrict-prototypes. */ |
| 912 | #ifdef __GNUC__ |
| 913 | # ifdef YYPARSE_PARAM |
| 914 | int yyparse (void *); |
| 915 | # else |
| 916 | int yyparse (void); |
| 917 | # endif |
| 918 | #endif |
| 919 | |
| 920 | |
| 921 | |
| 922 | |
| 923 | int |
| 924 | yyparse (YYPARSE_PARAM_ARG) |
| 925 | YYPARSE_PARAM_DECL |
| 926 | { |
| 927 | /* The lookahead symbol. */ |
| 928 | int yychar; |
| 929 | |
| 930 | /* The semantic value of the lookahead symbol. */ |
| 931 | YYSTYPE yylval; |
| 932 | |
| 933 | /* Number of parse errors so far. */ |
| 934 | int yynerrs; |
| 935 | /* Location data for the lookahead symbol. */ |
| 936 | YYLTYPE yylloc; |
| 937 | |
| 938 | register int yystate; |
| 939 | register int yyn; |
| 940 | int yyresult; |
| 941 | /* Number of tokens to shift before error messages enabled. */ |
| 942 | int yyerrstatus; |
| 943 | /* Lookahead token as an internal (translated) token number. */ |
| 944 | int yychar1 = 0; |
| 945 | |
| 946 | /* Three stacks and their tools: |
| 947 | `yyss': related to states, |
| 948 | `yyvs': related to semantic values, |
| 949 | `yyls': related to locations. |
| 950 | |
| 951 | Refer to the stacks thru separate pointers, to allow yyoverflow |
| 952 | to reallocate them elsewhere. */ |
| 953 | |
| 954 | /* The state stack. */ |
| 955 | short yyssa[YYINITDEPTH]; |
| 956 | short *yyss = yyssa; |
| 957 | register short *yyssp; |
| 958 | |
| 959 | /* The semantic value stack. */ |
| 960 | YYSTYPE yyvsa[YYINITDEPTH]; |
| 961 | YYSTYPE *yyvs = yyvsa; |
| 962 | register YYSTYPE *yyvsp; |
| 963 | |
| 964 | /* The location stack. */ |
| 965 | YYLTYPE yylsa[YYINITDEPTH]; |
| 966 | YYLTYPE *yyls = yylsa; |
| 967 | YYLTYPE *yylsp; |
| 968 | |
| 969 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
| 970 | |
| 971 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 972 | |
| 973 | /* The variables used to return semantic value and location from the |
| 974 | action routines. */ |
| 975 | YYSTYPE yyval; |
| 976 | YYLTYPE yyloc; |
| 977 | |
| 978 | /* When reducing, the number of symbols on the RHS of the reduced |
| 979 | rule. */ |
| 980 | int yylen; |
| 981 | |
| 982 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 983 | |
| 984 | yystate = 0; |
| 985 | yyerrstatus = 0; |
| 986 | yynerrs = 0; |
| 987 | yychar = YYEMPTY; /* Cause a token to be read. */ |
| 988 | |
| 989 | /* Initialize stack pointers. |
| 990 | Waste one element of value and location stack |
| 991 | so that they stay on the same level as the state stack. |
| 992 | The wasted elements are never initialized. */ |
| 993 | |
| 994 | yyssp = yyss; |
| 995 | yyvsp = yyvs; |
| 996 | yylsp = yyls; |
| 997 | goto yysetstate; |
| 998 | |
| 999 | /*------------------------------------------------------------. |
| 1000 | | yynewstate -- Push a new state, which is found in yystate. | |
| 1001 | `------------------------------------------------------------*/ |
| 1002 | yynewstate: |
| 1003 | /* In all cases, when you get here, the value and location stacks |
| 1004 | have just been pushed. so pushing a state here evens the stacks. |
| 1005 | */ |
| 1006 | yyssp++; |
| 1007 | |
| 1008 | yysetstate: |
| 1009 | *yyssp = yystate; |
| 1010 | |
| 1011 | if (yyssp >= yyss + yystacksize - 1) |
| 1012 | { |
| 1013 | /* Get the current used size of the three stacks, in elements. */ |
| 1014 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 1015 | |
| 1016 | #ifdef yyoverflow |
| 1017 | { |
| 1018 | /* Give user a chance to reallocate the stack. Use copies of |
| 1019 | these so that the &'s don't force the real ones into |
| 1020 | memory. */ |
| 1021 | YYSTYPE *yyvs1 = yyvs; |
| 1022 | short *yyss1 = yyss; |
| 1023 | YYLTYPE *yyls1 = yyls; |
| 1024 | |
| 1025 | /* Each stack pointer address is followed by the size of the |
| 1026 | data in use in that stack, in bytes. This used to be a |
| 1027 | conditional around just the two extra args, but that might |
| 1028 | be undefined if yyoverflow is a macro. */ |
| 1029 | yyoverflow ("parser stack overflow", |
| 1030 | &yyss1, yysize * sizeof (*yyssp), |
| 1031 | &yyvs1, yysize * sizeof (*yyvsp), |
| 1032 | &yyls1, yysize * sizeof (*yylsp), |
| 1033 | &yystacksize); |
| 1034 | yyls = yyls1; |
| 1035 | yyss = yyss1; |
| 1036 | yyvs = yyvs1; |
| 1037 | } |
| 1038 | #else /* no yyoverflow */ |
| 1039 | # ifndef YYSTACK_RELOCATE |
| 1040 | goto yyoverflowlab; |
| 1041 | # else |
| 1042 | /* Extend the stack our own way. */ |
| 1043 | if (yystacksize >= YYMAXDEPTH) |
| 1044 | goto yyoverflowlab; |
| 1045 | yystacksize *= 2; |
| 1046 | if (yystacksize > YYMAXDEPTH) |
| 1047 | yystacksize = YYMAXDEPTH; |
| 1048 | |
| 1049 | { |
| 1050 | short *yyss1 = yyss; |
| 1051 | union yyalloc *yyptr = |
| 1052 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 1053 | if (! yyptr) |
| 1054 | goto yyoverflowlab; |
| 1055 | YYSTACK_RELOCATE (yyss); |
| 1056 | YYSTACK_RELOCATE (yyvs); |
| 1057 | YYSTACK_RELOCATE (yyls); |
| 1058 | # undef YYSTACK_RELOCATE |
| 1059 | if (yyss1 != yyssa) |
| 1060 | YYSTACK_FREE (yyss1); |
| 1061 | } |
| 1062 | # endif |
| 1063 | #endif /* no yyoverflow */ |
| 1064 | |
| 1065 | yyssp = yyss + yysize - 1; |
| 1066 | yyvsp = yyvs + yysize - 1; |
| 1067 | yylsp = yyls + yysize - 1; |
| 1068 | |
| 1069 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1070 | (unsigned long int) yystacksize)); |
| 1071 | |
| 1072 | if (yyssp >= yyss + yystacksize - 1) |
| 1073 | YYABORT; |
| 1074 | } |
| 1075 | |
| 1076 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 1077 | |
| 1078 | goto yybackup; |
| 1079 | |
| 1080 | /*-----------. |
| 1081 | | yybackup. | |
| 1082 | `-----------*/ |
| 1083 | yybackup: |
| 1084 | |
| 1085 | /* Do appropriate processing given the current state. */ |
| 1086 | /* Read a lookahead token if we need one and don't already have one. */ |
| 1087 | /* yyresume: */ |
| 1088 | |
| 1089 | /* First try to decide what to do without reference to lookahead token. */ |
| 1090 | |
| 1091 | yyn = yypact[yystate]; |
| 1092 | if (yyn == YYPACT_NINF) |
| 1093 | goto yydefault; |
| 1094 | |
| 1095 | /* Not known => get a lookahead token if don't already have one. */ |
| 1096 | |
| 1097 | /* yychar is either YYEMPTY or YYEOF |
| 1098 | or a valid token in external form. */ |
| 1099 | |
| 1100 | if (yychar == YYEMPTY) |
| 1101 | { |
| 1102 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 1103 | yychar = YYLEX; |
| 1104 | } |
| 1105 | |
| 1106 | /* Convert token to internal form (in yychar1) for indexing tables with. */ |
| 1107 | |
| 1108 | if (yychar <= 0) /* This means end of input. */ |
| 1109 | { |
| 1110 | yychar1 = 0; |
| 1111 | yychar = YYEOF; /* Don't call YYLEX any more. */ |
| 1112 | |
| 1113 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 1114 | } |
| 1115 | else |
| 1116 | { |
| 1117 | yychar1 = YYTRANSLATE (yychar); |
| 1118 | |
| 1119 | /* We have to keep this `#if YYDEBUG', since we use variables |
| 1120 | which are defined only if `YYDEBUG' is set. */ |
| 1121 | YYDPRINTF ((stderr, "Next token is ")); |
| 1122 | YYDSYMPRINT ((stderr, yychar1, yylval, yyloc)); |
| 1123 | YYDPRINTF ((stderr, "\n")); |
| 1124 | } |
| 1125 | |
| 1126 | /* If the proper action on seeing token YYCHAR1 is to reduce or to |
| 1127 | detect an error, take that action. */ |
| 1128 | yyn += yychar1; |
| 1129 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) |
| 1130 | goto yydefault; |
| 1131 | yyn = yytable[yyn]; |
| 1132 | if (yyn <= 0) |
| 1133 | { |
| 1134 | if (yyn == 0 || yyn == YYTABLE_NINF) |
| 1135 | goto yyerrlab; |
| 1136 | yyn = -yyn; |
| 1137 | goto yyreduce; |
| 1138 | } |
| 1139 | |
| 1140 | if (yyn == YYFINAL) |
| 1141 | YYACCEPT; |
| 1142 | |
| 1143 | /* Shift the lookahead token. */ |
| 1144 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
| 1145 | yychar, yytname[yychar1])); |
| 1146 | |
| 1147 | /* Discard the token being shifted unless it is eof. */ |
| 1148 | if (yychar != YYEOF) |
| 1149 | yychar = YYEMPTY; |
| 1150 | |
| 1151 | *++yyvsp = yylval; |
| 1152 | *++yylsp = yylloc; |
| 1153 | |
| 1154 | /* Count tokens shifted since error; after three, turn off error |
| 1155 | status. */ |
| 1156 | if (yyerrstatus) |
| 1157 | yyerrstatus--; |
| 1158 | |
| 1159 | yystate = yyn; |
| 1160 | goto yynewstate; |
| 1161 | |
| 1162 | |
| 1163 | /*-----------------------------------------------------------. |
| 1164 | | yydefault -- do the default action for the current state. | |
| 1165 | `-----------------------------------------------------------*/ |
| 1166 | yydefault: |
| 1167 | yyn = yydefact[yystate]; |
| 1168 | if (yyn == 0) |
| 1169 | goto yyerrlab; |
| 1170 | goto yyreduce; |
| 1171 | |
| 1172 | |
| 1173 | /*-----------------------------. |
| 1174 | | yyreduce -- Do a reduction. | |
| 1175 | `-----------------------------*/ |
| 1176 | yyreduce: |
| 1177 | /* yyn is the number of a rule to reduce with. */ |
| 1178 | yylen = yyr2[yyn]; |
| 1179 | |
| 1180 | /* If YYLEN is nonzero, implement the default value of the action: |
| 1181 | `$$ = $1'. |
| 1182 | |
| 1183 | Otherwise, the following line sets YYVAL to garbage. |
| 1184 | This behavior is undocumented and Bison |
| 1185 | users should not rely upon it. Assigning to YYVAL |
| 1186 | unconditionally makes the parser a bit smaller, and it avoids a |
| 1187 | GCC warning that YYVAL may be used uninitialized. */ |
| 1188 | yyval = yyvsp[1-yylen]; |
| 1189 | |
| 1190 | /* Default location. */ |
| 1191 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); |
| 1192 | |
| 1193 | #if YYDEBUG |
| 1194 | /* We have to keep this `#if YYDEBUG', since we use variables which |
| 1195 | are defined only if `YYDEBUG' is set. */ |
| 1196 | if (yydebug) |
| 1197 | { |
| 1198 | int yyi; |
| 1199 | |
| 1200 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
| 1201 | yyn - 1, yyrline[yyn]); |
| 1202 | |
| 1203 | /* Print the symbols being reduced, and their result. */ |
| 1204 | for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) |
| 1205 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
| 1206 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
| 1207 | } |
| 1208 | #endif |
| 1209 | switch (yyn) |
| 1210 | { |
| 1211 | case 2: |
| 1212 | #line 170 "parse-gram.y" |
| 1213 | { |
| 1214 | yycontrol->errcode = 0; |
| 1215 | epilogue_set (yyvsp[0].string, yylsp[0]); |
| 1216 | } |
| 1217 | break; |
| 1218 | |
| 1219 | case 6: |
| 1220 | #line 188 "parse-gram.y" |
| 1221 | { prologue_augment (yyvsp[0].string, yylsp[0]); } |
| 1222 | break; |
| 1223 | |
| 1224 | case 7: |
| 1225 | #line 189 "parse-gram.y" |
| 1226 | { debug_flag = 1; } |
| 1227 | break; |
| 1228 | |
| 1229 | case 8: |
| 1230 | #line 190 "parse-gram.y" |
| 1231 | { muscle_insert (yyvsp[-1].string, yyvsp[0].string); } |
| 1232 | break; |
| 1233 | |
| 1234 | case 9: |
| 1235 | #line 191 "parse-gram.y" |
| 1236 | { defines_flag = 1; } |
| 1237 | break; |
| 1238 | |
| 1239 | case 10: |
| 1240 | #line 192 "parse-gram.y" |
| 1241 | { error_verbose = 1; } |
| 1242 | break; |
| 1243 | |
| 1244 | case 11: |
| 1245 | #line 193 "parse-gram.y" |
| 1246 | { expected_conflicts = yyvsp[0].integer; } |
| 1247 | break; |
| 1248 | |
| 1249 | case 12: |
| 1250 | #line 194 "parse-gram.y" |
| 1251 | { spec_file_prefix = yyvsp[0].string; } |
| 1252 | break; |
| 1253 | |
| 1254 | case 13: |
| 1255 | #line 195 "parse-gram.y" |
| 1256 | { glr_parser = 1; } |
| 1257 | break; |
| 1258 | |
| 1259 | case 14: |
| 1260 | #line 197 "parse-gram.y" |
| 1261 | { muscle_pair_list_grow ("lex_param", yyvsp[-2].string, yyvsp[0].string); } |
| 1262 | break; |
| 1263 | |
| 1264 | case 15: |
| 1265 | #line 198 "parse-gram.y" |
| 1266 | { locations_flag = 1; } |
| 1267 | break; |
| 1268 | |
| 1269 | case 16: |
| 1270 | #line 199 "parse-gram.y" |
| 1271 | { spec_name_prefix = yyvsp[0].string; } |
| 1272 | break; |
| 1273 | |
| 1274 | case 17: |
| 1275 | #line 200 "parse-gram.y" |
| 1276 | { no_lines_flag = 1; } |
| 1277 | break; |
| 1278 | |
| 1279 | case 18: |
| 1280 | #line 201 "parse-gram.y" |
| 1281 | { spec_outfile = yyvsp[0].string; } |
| 1282 | break; |
| 1283 | |
| 1284 | case 19: |
| 1285 | #line 203 "parse-gram.y" |
| 1286 | { muscle_pair_list_grow ("parse_param", yyvsp[-2].string, yyvsp[0].string); } |
| 1287 | break; |
| 1288 | |
| 1289 | case 20: |
| 1290 | #line 204 "parse-gram.y" |
| 1291 | { pure_parser = 1; } |
| 1292 | break; |
| 1293 | |
| 1294 | case 21: |
| 1295 | #line 205 "parse-gram.y" |
| 1296 | { skeleton = yyvsp[0].string; } |
| 1297 | break; |
| 1298 | |
| 1299 | case 22: |
| 1300 | #line 206 "parse-gram.y" |
| 1301 | { token_table_flag = 1; } |
| 1302 | break; |
| 1303 | |
| 1304 | case 23: |
| 1305 | #line 207 "parse-gram.y" |
| 1306 | { report_flag = 1; } |
| 1307 | break; |
| 1308 | |
| 1309 | case 24: |
| 1310 | #line 208 "parse-gram.y" |
| 1311 | { yacc_flag = 1; } |
| 1312 | break; |
| 1313 | |
| 1314 | case 27: |
| 1315 | #line 215 "parse-gram.y" |
| 1316 | { |
| 1317 | grammar_start_symbol_set (yyvsp[0].symbol, yylsp[0]); |
| 1318 | } |
| 1319 | break; |
| 1320 | |
| 1321 | case 28: |
| 1322 | #line 219 "parse-gram.y" |
| 1323 | { |
| 1324 | typed = 1; |
| 1325 | MUSCLE_INSERT_INT ("stype_line", yylsp[0].first_line); |
| 1326 | muscle_insert ("stype", yyvsp[0].string); |
| 1327 | } |
| 1328 | break; |
| 1329 | |
| 1330 | case 29: |
| 1331 | #line 225 "parse-gram.y" |
| 1332 | { current_braced_code = destructor_braced_code; } |
| 1333 | break; |
| 1334 | |
| 1335 | case 30: |
| 1336 | #line 227 "parse-gram.y" |
| 1337 | { |
| 1338 | symbol_list_t *list; |
| 1339 | for (list = yyvsp[0].list; list; list = list->next) |
| 1340 | symbol_destructor_set (list->sym, yyvsp[-1].string, yylsp[-1]); |
| 1341 | symbol_list_free (yyvsp[0].list); |
| 1342 | current_braced_code = action_braced_code; |
| 1343 | } |
| 1344 | break; |
| 1345 | |
| 1346 | case 31: |
| 1347 | #line 235 "parse-gram.y" |
| 1348 | { current_braced_code = printer_braced_code; } |
| 1349 | break; |
| 1350 | |
| 1351 | case 32: |
| 1352 | #line 237 "parse-gram.y" |
| 1353 | { |
| 1354 | symbol_list_t *list; |
| 1355 | for (list = yyvsp[0].list; list; list = list->next) |
| 1356 | symbol_printer_set (list->sym, yyvsp[-1].string, list->location); |
| 1357 | symbol_list_free (yyvsp[0].list); |
| 1358 | current_braced_code = action_braced_code; |
| 1359 | } |
| 1360 | break; |
| 1361 | |
| 1362 | case 33: |
| 1363 | #line 247 "parse-gram.y" |
| 1364 | { current_class = nterm_sym; } |
| 1365 | break; |
| 1366 | |
| 1367 | case 34: |
| 1368 | #line 248 "parse-gram.y" |
| 1369 | { |
| 1370 | current_class = unknown_sym; |
| 1371 | current_type = NULL; |
| 1372 | } |
| 1373 | break; |
| 1374 | |
| 1375 | case 35: |
| 1376 | #line 252 "parse-gram.y" |
| 1377 | { current_class = token_sym; } |
| 1378 | break; |
| 1379 | |
| 1380 | case 36: |
| 1381 | #line 253 "parse-gram.y" |
| 1382 | { |
| 1383 | current_class = unknown_sym; |
| 1384 | current_type = NULL; |
| 1385 | } |
| 1386 | break; |
| 1387 | |
| 1388 | case 37: |
| 1389 | #line 258 "parse-gram.y" |
| 1390 | { |
| 1391 | symbol_list_t *list; |
| 1392 | for (list = yyvsp[0].list; list; list = list->next) |
| 1393 | symbol_type_set (list->sym, yyvsp[-1].string, yylsp[-1]); |
| 1394 | symbol_list_free (yyvsp[0].list); |
| 1395 | } |
| 1396 | break; |
| 1397 | |
| 1398 | case 38: |
| 1399 | #line 268 "parse-gram.y" |
| 1400 | { |
| 1401 | symbol_list_t *list; |
| 1402 | ++current_prec; |
| 1403 | for (list = yyvsp[0].list; list; list = list->next) |
| 1404 | { |
| 1405 | symbol_type_set (list->sym, current_type, yylsp[-1]); |
| 1406 | symbol_precedence_set (list->sym, current_prec, yyvsp[-2].assoc, yylsp[-2]); |
| 1407 | } |
| 1408 | symbol_list_free (yyvsp[0].list); |
| 1409 | current_type = NULL; |
| 1410 | } |
| 1411 | break; |
| 1412 | |
| 1413 | case 39: |
| 1414 | #line 282 "parse-gram.y" |
| 1415 | { yyval.assoc = left_assoc; } |
| 1416 | break; |
| 1417 | |
| 1418 | case 40: |
| 1419 | #line 283 "parse-gram.y" |
| 1420 | { yyval.assoc = right_assoc; } |
| 1421 | break; |
| 1422 | |
| 1423 | case 41: |
| 1424 | #line 284 "parse-gram.y" |
| 1425 | { yyval.assoc = non_assoc; } |
| 1426 | break; |
| 1427 | |
| 1428 | case 42: |
| 1429 | #line 288 "parse-gram.y" |
| 1430 | { current_type = NULL;} |
| 1431 | break; |
| 1432 | |
| 1433 | case 43: |
| 1434 | #line 289 "parse-gram.y" |
| 1435 | { current_type = yyvsp[0].string; } |
| 1436 | break; |
| 1437 | |
| 1438 | case 44: |
| 1439 | #line 295 "parse-gram.y" |
| 1440 | { yyval.list = symbol_list_new (yyvsp[0].symbol, yylsp[0]); } |
| 1441 | break; |
| 1442 | |
| 1443 | case 45: |
| 1444 | #line 296 "parse-gram.y" |
| 1445 | { yyval.list = symbol_list_prepend (yyvsp[-1].list, yyvsp[0].symbol, yylsp[0]); } |
| 1446 | break; |
| 1447 | |
| 1448 | case 46: |
| 1449 | #line 302 "parse-gram.y" |
| 1450 | { |
| 1451 | current_type = yyvsp[0].string; |
| 1452 | } |
| 1453 | break; |
| 1454 | |
| 1455 | case 47: |
| 1456 | #line 306 "parse-gram.y" |
| 1457 | { |
| 1458 | symbol_class_set (yyvsp[0].symbol, current_class, yylsp[0]); |
| 1459 | symbol_type_set (yyvsp[0].symbol, current_type, yylsp[0]); |
| 1460 | } |
| 1461 | break; |
| 1462 | |
| 1463 | case 48: |
| 1464 | #line 311 "parse-gram.y" |
| 1465 | { |
| 1466 | symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]); |
| 1467 | symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]); |
| 1468 | symbol_user_token_number_set (yyvsp[-1].symbol, yyvsp[0].integer, yylsp[0]); |
| 1469 | } |
| 1470 | break; |
| 1471 | |
| 1472 | case 49: |
| 1473 | #line 317 "parse-gram.y" |
| 1474 | { |
| 1475 | symbol_class_set (yyvsp[-1].symbol, current_class, yylsp[-1]); |
| 1476 | symbol_type_set (yyvsp[-1].symbol, current_type, yylsp[-1]); |
| 1477 | symbol_make_alias (yyvsp[-1].symbol, yyvsp[0].symbol, yyloc); |
| 1478 | } |
| 1479 | break; |
| 1480 | |
| 1481 | case 50: |
| 1482 | #line 323 "parse-gram.y" |
| 1483 | { |
| 1484 | symbol_class_set (yyvsp[-2].symbol, current_class, yylsp[-2]); |
| 1485 | symbol_type_set (yyvsp[-2].symbol, current_type, yylsp[-2]); |
| 1486 | symbol_user_token_number_set (yyvsp[-2].symbol, yyvsp[-1].integer, yylsp[-1]); |
| 1487 | symbol_make_alias (yyvsp[-2].symbol, yyvsp[0].symbol, yyloc); |
| 1488 | } |
| 1489 | break; |
| 1490 | |
| 1491 | case 51: |
| 1492 | #line 334 "parse-gram.y" |
| 1493 | {;} |
| 1494 | break; |
| 1495 | |
| 1496 | case 52: |
| 1497 | #line 336 "parse-gram.y" |
| 1498 | {;} |
| 1499 | break; |
| 1500 | |
| 1501 | case 56: |
| 1502 | #line 355 "parse-gram.y" |
| 1503 | { |
| 1504 | if (yacc_flag) |
| 1505 | complain_at (yyloc, _("POSIX forbids declarations in the grammar")); |
| 1506 | } |
| 1507 | break; |
| 1508 | |
| 1509 | case 57: |
| 1510 | #line 360 "parse-gram.y" |
| 1511 | { |
| 1512 | yyerrok; |
| 1513 | } |
| 1514 | break; |
| 1515 | |
| 1516 | case 58: |
| 1517 | #line 366 "parse-gram.y" |
| 1518 | { current_lhs = yyvsp[-1].symbol; current_lhs_location = yylsp[-1]; } |
| 1519 | break; |
| 1520 | |
| 1521 | case 59: |
| 1522 | #line 367 "parse-gram.y" |
| 1523 | {;} |
| 1524 | break; |
| 1525 | |
| 1526 | case 60: |
| 1527 | #line 371 "parse-gram.y" |
| 1528 | { grammar_rule_end (yylsp[0]); } |
| 1529 | break; |
| 1530 | |
| 1531 | case 61: |
| 1532 | #line 372 "parse-gram.y" |
| 1533 | { grammar_rule_end (yylsp[0]); } |
| 1534 | break; |
| 1535 | |
| 1536 | case 62: |
| 1537 | #line 377 "parse-gram.y" |
| 1538 | { grammar_rule_begin (current_lhs, current_lhs_location); } |
| 1539 | break; |
| 1540 | |
| 1541 | case 63: |
| 1542 | #line 379 "parse-gram.y" |
| 1543 | { grammar_current_rule_symbol_append (yyvsp[0].symbol, yylsp[0]); } |
| 1544 | break; |
| 1545 | |
| 1546 | case 64: |
| 1547 | #line 381 "parse-gram.y" |
| 1548 | { grammar_current_rule_action_append (yyvsp[0].string, yylsp[0]); } |
| 1549 | break; |
| 1550 | |
| 1551 | case 65: |
| 1552 | #line 383 "parse-gram.y" |
| 1553 | { grammar_current_rule_prec_set (yyvsp[0].symbol, yylsp[0]); } |
| 1554 | break; |
| 1555 | |
| 1556 | case 66: |
| 1557 | #line 385 "parse-gram.y" |
| 1558 | { grammar_current_rule_dprec_set (yyvsp[0].integer, yylsp[0]); } |
| 1559 | break; |
| 1560 | |
| 1561 | case 67: |
| 1562 | #line 387 "parse-gram.y" |
| 1563 | { grammar_current_rule_merge_set (yyvsp[0].string, yylsp[0]); } |
| 1564 | break; |
| 1565 | |
| 1566 | case 68: |
| 1567 | #line 391 "parse-gram.y" |
| 1568 | { yyval.symbol = yyvsp[0].symbol; } |
| 1569 | break; |
| 1570 | |
| 1571 | case 69: |
| 1572 | #line 392 "parse-gram.y" |
| 1573 | { yyval.symbol = yyvsp[0].symbol; } |
| 1574 | break; |
| 1575 | |
| 1576 | case 70: |
| 1577 | #line 393 "parse-gram.y" |
| 1578 | { yyval.symbol = symbol_get (yyvsp[0].string, yylsp[0]); } |
| 1579 | break; |
| 1580 | |
| 1581 | case 71: |
| 1582 | #line 398 "parse-gram.y" |
| 1583 | { yyval.string = yyvsp[0].string; } |
| 1584 | break; |
| 1585 | |
| 1586 | case 72: |
| 1587 | #line 404 "parse-gram.y" |
| 1588 | { |
| 1589 | yyval.symbol = symbol_get (yyvsp[0].string, yylsp[0]); |
| 1590 | symbol_class_set (yyval.symbol, token_sym, yylsp[0]); |
| 1591 | } |
| 1592 | break; |
| 1593 | |
| 1594 | case 73: |
| 1595 | #line 413 "parse-gram.y" |
| 1596 | { |
| 1597 | yyval.string = yyvsp[0].string + 1; |
| 1598 | yyval.string[strlen (yyval.string) - 1] = '\0'; |
| 1599 | } |
| 1600 | break; |
| 1601 | |
| 1602 | case 74: |
| 1603 | #line 421 "parse-gram.y" |
| 1604 | { |
| 1605 | yyval.string = xstrdup (""); |
| 1606 | } |
| 1607 | break; |
| 1608 | |
| 1609 | case 75: |
| 1610 | #line 425 "parse-gram.y" |
| 1611 | { |
| 1612 | yyval.string = yyvsp[0].string; |
| 1613 | } |
| 1614 | break; |
| 1615 | |
| 1616 | |
| 1617 | } |
| 1618 | |
| 1619 | /* Line 1016 of /usr/local/share/bison/yacc.c. */ |
| 1620 | #line 1621 "parse-gram.c" |
| 1621 | \f |
| 1622 | yyvsp -= yylen; |
| 1623 | yyssp -= yylen; |
| 1624 | yylsp -= yylen; |
| 1625 | |
| 1626 | #if YYDEBUG |
| 1627 | if (yydebug) |
| 1628 | { |
| 1629 | short *yyssp1 = yyss - 1; |
| 1630 | YYFPRINTF (stderr, "state stack now"); |
| 1631 | while (yyssp1 != yyssp) |
| 1632 | YYFPRINTF (stderr, " %d", *++yyssp1); |
| 1633 | YYFPRINTF (stderr, "\n"); |
| 1634 | } |
| 1635 | #endif |
| 1636 | |
| 1637 | *++yyvsp = yyval; |
| 1638 | *++yylsp = yyloc; |
| 1639 | |
| 1640 | /* Now `shift' the result of the reduction. Determine what state |
| 1641 | that goes to, based on the state we popped back to and the rule |
| 1642 | number reduced by. */ |
| 1643 | |
| 1644 | yyn = yyr1[yyn]; |
| 1645 | |
| 1646 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 1647 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 1648 | yystate = yytable[yystate]; |
| 1649 | else |
| 1650 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 1651 | |
| 1652 | goto yynewstate; |
| 1653 | |
| 1654 | |
| 1655 | /*------------------------------------. |
| 1656 | | yyerrlab -- here on detecting error | |
| 1657 | `------------------------------------*/ |
| 1658 | yyerrlab: |
| 1659 | /* If not already recovering from an error, report this error. */ |
| 1660 | if (!yyerrstatus) |
| 1661 | { |
| 1662 | ++yynerrs; |
| 1663 | #if YYERROR_VERBOSE |
| 1664 | yyn = yypact[yystate]; |
| 1665 | |
| 1666 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
| 1667 | { |
| 1668 | YYSIZE_T yysize = 0; |
| 1669 | int yytype = YYTRANSLATE (yychar); |
| 1670 | char *yymsg; |
| 1671 | int yyx, yycount; |
| 1672 | |
| 1673 | yycount = 0; |
| 1674 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 1675 | YYCHECK. */ |
| 1676 | for (yyx = yyn < 0 ? -yyn : 0; |
| 1677 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) |
| 1678 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1679 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; |
| 1680 | yysize += yystrlen ("parse error, unexpected ") + 1; |
| 1681 | yysize += yystrlen (yytname[yytype]); |
| 1682 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
| 1683 | if (yymsg != 0) |
| 1684 | { |
| 1685 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); |
| 1686 | yyp = yystpcpy (yyp, yytname[yytype]); |
| 1687 | |
| 1688 | if (yycount < 5) |
| 1689 | { |
| 1690 | yycount = 0; |
| 1691 | for (yyx = yyn < 0 ? -yyn : 0; |
| 1692 | yyx < (int) (sizeof (yytname) / sizeof (char *)); |
| 1693 | yyx++) |
| 1694 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1695 | { |
| 1696 | const char *yyq = ! yycount ? ", expecting " : " or "; |
| 1697 | yyp = yystpcpy (yyp, yyq); |
| 1698 | yyp = yystpcpy (yyp, yytname[yyx]); |
| 1699 | yycount++; |
| 1700 | } |
| 1701 | } |
| 1702 | yyerror (yymsg); |
| 1703 | YYSTACK_FREE (yymsg); |
| 1704 | } |
| 1705 | else |
| 1706 | yyerror ("parse error; also virtual memory exhausted"); |
| 1707 | } |
| 1708 | else |
| 1709 | #endif /* YYERROR_VERBOSE */ |
| 1710 | yyerror ("parse error"); |
| 1711 | } |
| 1712 | goto yyerrlab1; |
| 1713 | |
| 1714 | |
| 1715 | /*----------------------------------------------------. |
| 1716 | | yyerrlab1 -- error raised explicitly by an action. | |
| 1717 | `----------------------------------------------------*/ |
| 1718 | yyerrlab1: |
| 1719 | if (yyerrstatus == 3) |
| 1720 | { |
| 1721 | /* If just tried and failed to reuse lookahead token after an |
| 1722 | error, discard it. */ |
| 1723 | |
| 1724 | /* Return failure if at end of input. */ |
| 1725 | if (yychar == YYEOF) |
| 1726 | { |
| 1727 | /* Pop the error token. */ |
| 1728 | YYPOPSTACK; |
| 1729 | /* Pop the rest of the stack. */ |
| 1730 | while (yyssp > yyss) |
| 1731 | { |
| 1732 | YYDPRINTF ((stderr, "Error: popping ")); |
| 1733 | YYDSYMPRINT ((stderr, |
| 1734 | yystos[*yyssp], |
| 1735 | *yyvsp, *yylsp)); |
| 1736 | YYDPRINTF ((stderr, "\n")); |
| 1737 | yydestruct (yystos[*yyssp], *yyvsp, *yylsp); |
| 1738 | YYPOPSTACK; |
| 1739 | } |
| 1740 | YYABORT; |
| 1741 | } |
| 1742 | |
| 1743 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
| 1744 | yychar, yytname[yychar1])); |
| 1745 | yydestruct (yychar1, yylval, yylloc); |
| 1746 | yychar = YYEMPTY; |
| 1747 | } |
| 1748 | |
| 1749 | /* Else will try to reuse lookahead token after shifting the error |
| 1750 | token. */ |
| 1751 | |
| 1752 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1753 | |
| 1754 | for (;;) |
| 1755 | { |
| 1756 | yyn = yypact[yystate]; |
| 1757 | if (yyn != YYPACT_NINF) |
| 1758 | { |
| 1759 | yyn += YYTERROR; |
| 1760 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 1761 | { |
| 1762 | yyn = yytable[yyn]; |
| 1763 | if (0 < yyn) |
| 1764 | break; |
| 1765 | } |
| 1766 | } |
| 1767 | |
| 1768 | /* Pop the current state because it cannot handle the error token. */ |
| 1769 | if (yyssp == yyss) |
| 1770 | YYABORT; |
| 1771 | |
| 1772 | YYDPRINTF ((stderr, "Error: popping ")); |
| 1773 | YYDSYMPRINT ((stderr, |
| 1774 | yystos[*yyssp], *yyvsp, *yylsp)); |
| 1775 | YYDPRINTF ((stderr, "\n")); |
| 1776 | |
| 1777 | yydestruct (yystos[yystate], *yyvsp, *yylsp); |
| 1778 | yyvsp--; |
| 1779 | yystate = *--yyssp; |
| 1780 | yylsp--; |
| 1781 | |
| 1782 | #if YYDEBUG |
| 1783 | if (yydebug) |
| 1784 | { |
| 1785 | short *yyssp1 = yyss - 1; |
| 1786 | YYFPRINTF (stderr, "Error: state stack now"); |
| 1787 | while (yyssp1 != yyssp) |
| 1788 | YYFPRINTF (stderr, " %d", *++yyssp1); |
| 1789 | YYFPRINTF (stderr, "\n"); |
| 1790 | } |
| 1791 | #endif |
| 1792 | } |
| 1793 | |
| 1794 | if (yyn == YYFINAL) |
| 1795 | YYACCEPT; |
| 1796 | |
| 1797 | YYDPRINTF ((stderr, "Shifting error token, ")); |
| 1798 | |
| 1799 | *++yyvsp = yylval; |
| 1800 | *++yylsp = yylloc; |
| 1801 | |
| 1802 | yystate = yyn; |
| 1803 | goto yynewstate; |
| 1804 | |
| 1805 | |
| 1806 | /*-------------------------------------. |
| 1807 | | yyacceptlab -- YYACCEPT comes here. | |
| 1808 | `-------------------------------------*/ |
| 1809 | yyacceptlab: |
| 1810 | yyresult = 0; |
| 1811 | goto yyreturn; |
| 1812 | |
| 1813 | /*-----------------------------------. |
| 1814 | | yyabortlab -- YYABORT comes here. | |
| 1815 | `-----------------------------------*/ |
| 1816 | yyabortlab: |
| 1817 | yyresult = 1; |
| 1818 | goto yyreturn; |
| 1819 | |
| 1820 | #ifndef yyoverflow |
| 1821 | /*----------------------------------------------. |
| 1822 | | yyoverflowlab -- parser overflow comes here. | |
| 1823 | `----------------------------------------------*/ |
| 1824 | yyoverflowlab: |
| 1825 | yyerror ("parser stack overflow"); |
| 1826 | yyresult = 2; |
| 1827 | /* Fall through. */ |
| 1828 | #endif |
| 1829 | |
| 1830 | yyreturn: |
| 1831 | #ifndef yyoverflow |
| 1832 | if (yyss != yyssa) |
| 1833 | YYSTACK_FREE (yyss); |
| 1834 | #endif |
| 1835 | return yyresult; |
| 1836 | } |
| 1837 | |
| 1838 | |
| 1839 | #line 434 "parse-gram.y" |
| 1840 | |
| 1841 | /*------------------------------------------------------------------. |
| 1842 | | When debugging the parser, display tokens' locations and values. | |
| 1843 | `------------------------------------------------------------------*/ |
| 1844 | |
| 1845 | static void |
| 1846 | yyprint (FILE *file, |
| 1847 | int type, const yystype *value) |
| 1848 | { |
| 1849 | fputc (' ', file); |
| 1850 | switch (type) |
| 1851 | { |
| 1852 | case CHARACTER: |
| 1853 | fprintf (file, " = '%s'", value->string); |
| 1854 | break; |
| 1855 | |
| 1856 | case ID: |
| 1857 | fprintf (file, " = %s", value->symbol->tag); |
| 1858 | break; |
| 1859 | |
| 1860 | case INT: |
| 1861 | fprintf (file, " = %d", value->integer); |
| 1862 | break; |
| 1863 | |
| 1864 | case STRING: |
| 1865 | fprintf (file, " = \"%s\"", value->string); |
| 1866 | break; |
| 1867 | |
| 1868 | case TYPE: |
| 1869 | fprintf (file, " = <%s>", value->string); |
| 1870 | break; |
| 1871 | |
| 1872 | case BRACED_CODE: |
| 1873 | case PROLOGUE: |
| 1874 | case EPILOGUE: |
| 1875 | fprintf (file, " = {{ %s }}", value->string); |
| 1876 | break; |
| 1877 | } |
| 1878 | } |
| 1879 | |
| 1880 | void |
| 1881 | gram_error (location_t *yylloc, const char *msg) |
| 1882 | { |
| 1883 | complain_at (*yylloc, "%s", msg); |
| 1884 | } |
| 1885 | |