1 | 2 | /* A Bison parser, made from aggr_mtd.y 3 | by GNU Bison version 1.28 */ 4 | 5 | #define YYBISON 1 /* Identify Bison output. */ 6 | 7 | #define yyparse aggr_mtdparse 8 | #define yylex aggr_mtdlex 9 | #define yyerror aggr_mtderror 10 | #define yylval aggr_mtdlval 11 | #define yychar aggr_mtdchar 12 | #define yydebug aggr_mtddebug 13 | #define yynerrs aggr_mtdnerrs 14 | #define KEYW_INBOUND 257 15 | #define KEYW_OUTBOUND 258 16 | #define OP_OR 259 17 | #define OP_AND 260 18 | #define KEYW_EXCEPT 261 19 | #define TKN_ASNO 262 20 | #define TKN_ASNAME 263 21 | 22 | #line 1 "aggr_mtd.y" 23 | 24 | /* 25 | filename: aggr_mtd.y 26 | 27 | description: 28 | Defines the grammar for an RPSL aggr-mtd attribute. It was mostly 29 | stolen from the IRRToolSet, simplified by removing ability to parse 30 | things defined by a dictionary (we use XML for extensibility rather 31 | than a dictionary). 32 | 33 | notes: 34 | Defines tokens for the associated lexer, aggr_mtd.l. 35 | */ 36 | #line 21 "aggr_mtd.y" 37 | 38 | #include <stdio.h> 39 | #include <stdarg.h> 40 | #include <stdlib.h> 41 | 42 | int yyerror(const char *s); 43 | 44 | #ifndef YYSTYPE 45 | #define YYSTYPE int 46 | #endif 47 | #include <stdio.h> 48 | 49 | #ifndef __cplusplus 50 | #ifndef __STDC__ 51 | #define const 52 | #endif 53 | #endif 54 | 55 | 56 | 57 | #define YYFINAL 21 58 | #define YYFLAG -32768 59 | #define YYNTBASE 12 60 | 61 | #define YYTRANSLATE(x) ((unsigned)(x) <= 263 ? yytranslate[x] : 18) 62 | 63 | static const char yytranslate[] = { 0, 64 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 65 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 66 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 67 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 68 | 11, 2, 2, 2, 2, 2, 2, 2, 2, 2, 69 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 70 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 72 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 73 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 74 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 75 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 76 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 77 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 78 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 79 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 80 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 81 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 82 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 83 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 84 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 85 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 86 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 87 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 88 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 89 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 90 | 7, 8, 9 91 | }; 92 | 93 | #if YYDEBUG != 0 94 | static const short yyprhs[] = { 0, 95 | 0, 2, 5, 6, 8, 12, 14, 18, 22, 24, 96 | 28, 30, 32 97 | }; 98 | 99 | static const short yyrhs[] = { 3, 100 | 0, 4, 13, 0, 0, 14, 0, 14, 5, 15, 101 | 0, 15, 0, 15, 6, 16, 0, 15, 7, 16, 102 | 0, 16, 0, 10, 14, 11, 0, 17, 0, 8, 103 | 0, 9, 0 104 | }; 105 | 106 | #endif 107 | 108 | #if YYDEBUG != 0 109 | static const short yyrline[] = { 0, 110 | 32, 33, 36, 37, 40, 41, 44, 45, 46, 49, 111 | 50, 53, 54 112 | }; 113 | #endif 114 | 115 | 116 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) 117 | 118 | static const char * const yytname[] = { "$","error","$undefined.","KEYW_INBOUND", 119 | "KEYW_OUTBOUND","OP_OR","OP_AND","KEYW_EXCEPT","TKN_ASNO","TKN_ASNAME","'('", 120 | "')'","aggr_mtd","opt_as_expr","as_expr","as_expr_term","as_expr_factor","as_expr_operand", NULL 121 | }; 122 | #endif 123 | 124 | static const short yyr1[] = { 0, 125 | 12, 12, 13, 13, 14, 14, 15, 15, 15, 16, 126 | 16, 17, 17 127 | }; 128 | 129 | static const short yyr2[] = { 0, 130 | 1, 2, 0, 1, 3, 1, 3, 3, 1, 3, 131 | 1, 1, 1 132 | }; 133 | 134 | static const short yydefact[] = { 0, 135 | 1, 3, 12, 13, 0, 2, 4, 6, 9, 11, 136 | 0, 0, 0, 0, 10, 5, 7, 8, 0, 0, 137 | 0 138 | }; 139 | 140 | static const short yydefgoto[] = { 19, 141 | 6, 7, 8, 9, 10 142 | }; 143 | 144 | static const short yypact[] = { 1, 145 | -32768, -7,-32768,-32768, -7,-32768, 7, 2,-32768,-32768, 146 | -5, -7, -7, -7,-32768, 2,-32768,-32768, 13, 14, 147 | -32768 148 | }; 149 | 150 | static const short yypgoto[] = {-32768, 151 | -32768, 10, 4, -3,-32768 152 | }; 153 | 154 | 155 | #define YYLAST 16 156 | 157 | 158 | static const short yytable[] = { 12, 159 | 3, 4, 5, 1, 2, 15, 0, 13, 14, 17, 160 | 18, 12, 20, 21, 11, 16 161 | }; 162 | 163 | static const short yycheck[] = { 5, 164 | 8, 9, 10, 3, 4, 11, -1, 6, 7, 13, 165 | 14, 5, 0, 0, 5, 12 166 | }; 167 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 168 | #line 3 "/usr/local/share/bison.simple" 169 | /* This file comes from bison-1.28. */ 170 | 171 | /* Skeleton output parser for bison, 172 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. 173 | 174 | This program is free software; you can redistribute it and/or modify 175 | it under the terms of the GNU General Public License as published by 176 | the Free Software Foundation; either version 2, or (at your option) 177 | any later version. 178 | 179 | This program is distributed in the hope that it will be useful, 180 | but WITHOUT ANY WARRANTY; without even the implied warranty of 181 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 182 | GNU General Public License for more details. 183 | 184 | You should have received a copy of the GNU General Public License 185 | along with this program; if not, write to the Free Software 186 | Foundation, Inc., 59 Temple Place - Suite 330, 187 | Boston, MA 02111-1307, USA. */ 188 | 189 | /* As a special exception, when this file is copied by Bison into a 190 | Bison output file, you may use that output file without restriction. 191 | This special exception was added by the Free Software Foundation 192 | in version 1.24 of Bison. */ 193 | 194 | /* This is the parser code that is written into each bison parser 195 | when the %semantic_parser declaration is not specified in the grammar. 196 | It was written by Richard Stallman by simplifying the hairy parser 197 | used when %semantic_parser is specified. */ 198 | 199 | #ifndef YYSTACK_USE_ALLOCA 200 | #ifdef alloca 201 | #define YYSTACK_USE_ALLOCA 202 | #else /* alloca not defined */ 203 | #ifdef __GNUC__ 204 | #define YYSTACK_USE_ALLOCA 205 | #define alloca __builtin_alloca 206 | #else /* not GNU C. */ 207 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) 208 | #define YYSTACK_USE_ALLOCA 209 | #include <alloca.h> 210 | #else /* not sparc */ 211 | /* We think this test detects Watcom and Microsoft C. */ 212 | /* This used to test MSDOS, but that is a bad idea 213 | since that symbol is in the user namespace. */ 214 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) 215 | #if 0 /* No need for malloc.h, which pollutes the namespace; 216 | instead, just don't use alloca. */ 217 | #include <malloc.h> 218 | #endif 219 | #else /* not MSDOS, or __TURBOC__ */ 220 | #if defined(_AIX) 221 | /* I don't know what this was needed for, but it pollutes the namespace. 222 | So I turned it off. rms, 2 May 1997. */ 223 | /* #include <malloc.h> */ 224 | #pragma alloca 225 | #define YYSTACK_USE_ALLOCA 226 | #else /* not MSDOS, or __TURBOC__, or _AIX */ 227 | #if 0 228 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, 229 | and on HPUX 10. Eventually we can turn this on. */ 230 | #define YYSTACK_USE_ALLOCA 231 | #define alloca __builtin_alloca 232 | #endif /* __hpux */ 233 | #endif 234 | #endif /* not _AIX */ 235 | #endif /* not MSDOS, or __TURBOC__ */ 236 | #endif /* not sparc */ 237 | #endif /* not GNU C */ 238 | #endif /* alloca not defined */ 239 | #endif /* YYSTACK_USE_ALLOCA not defined */ 240 | 241 | #ifdef YYSTACK_USE_ALLOCA 242 | #define YYSTACK_ALLOC alloca 243 | #else 244 | #define YYSTACK_ALLOC malloc 245 | #endif 246 | 247 | /* Note: there must be only one dollar sign in this file. 248 | It is replaced by the list of actions, each action 249 | as one case of the switch. */ 250 | 251 | #define yyerrok (yyerrstatus = 0) 252 | #define yyclearin (yychar = YYEMPTY) 253 | #define YYEMPTY -2 254 | #define YYEOF 0 255 | #define YYACCEPT goto yyacceptlab 256 | #define YYABORT goto yyabortlab 257 | #define YYERROR goto yyerrlab1 258 | /* Like YYERROR except do call yyerror. 259 | This remains here temporarily to ease the 260 | transition to the new meaning of YYERROR, for GCC. 261 | Once GCC version 2 has supplanted version 1, this can go. */ 262 | #define YYFAIL goto yyerrlab 263 | #define YYRECOVERING() (!!yyerrstatus) 264 | #define YYBACKUP(token, value) \ 265 | do \ 266 | if (yychar == YYEMPTY && yylen == 1) \ 267 | { yychar = (token), yylval = (value); \ 268 | yychar1 = YYTRANSLATE (yychar); \ 269 | YYPOPSTACK; \ 270 | goto yybackup; \ 271 | } \ 272 | else \ 273 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ 274 | while (0) 275 | 276 | #define YYTERROR 1 277 | #define YYERRCODE 256 278 | 279 | #ifndef YYPURE 280 | #define YYLEX yylex() 281 | #endif 282 | 283 | #ifdef YYPURE 284 | #ifdef YYLSP_NEEDED 285 | #ifdef YYLEX_PARAM 286 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) 287 | #else 288 | #define YYLEX yylex(&yylval, &yylloc) 289 | #endif 290 | #else /* not YYLSP_NEEDED */ 291 | #ifdef YYLEX_PARAM 292 | #define YYLEX yylex(&yylval, YYLEX_PARAM) 293 | #else 294 | #define YYLEX yylex(&yylval) 295 | #endif 296 | #endif /* not YYLSP_NEEDED */ 297 | #endif 298 | 299 | /* If nonreentrant, generate the variables here */ 300 | 301 | #ifndef YYPURE 302 | 303 | int yychar; /* the lookahead symbol */ 304 | YYSTYPE yylval; /* the semantic value of the */ 305 | /* lookahead symbol */ 306 | 307 | #ifdef YYLSP_NEEDED 308 | YYLTYPE yylloc; /* location data for the lookahead */ 309 | /* symbol */ 310 | #endif 311 | 312 | int yynerrs; /* number of parse errors so far */ 313 | #endif /* not YYPURE */ 314 | 315 | #if YYDEBUG != 0 316 | int yydebug; /* nonzero means print parse trace */ 317 | /* Since this is uninitialized, it does not stop multiple parsers 318 | from coexisting. */ 319 | #endif 320 | 321 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ 322 | 323 | #ifndef YYINITDEPTH 324 | #define YYINITDEPTH 200 325 | #endif 326 | 327 | /* YYMAXDEPTH is the maximum size the stacks can grow to 328 | (effective only if the built-in stack extension method is used). */ 329 | 330 | #if YYMAXDEPTH == 0 331 | #undef YYMAXDEPTH 332 | #endif 333 | 334 | #ifndef YYMAXDEPTH 335 | #define YYMAXDEPTH 10000 336 | #endif 337 | 338 | /* Define __yy_memcpy. Note that the size argument 339 | should be passed with type unsigned int, because that is what the non-GCC 340 | definitions require. With GCC, __builtin_memcpy takes an arg 341 | of type size_t, but it can handle unsigned int. */ 342 | 343 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ 344 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) 345 | #else /* not GNU C or C++ */ 346 | #ifndef __cplusplus 347 | 348 | /* This is the most reliable way to avoid incompatibilities 349 | in available built-in functions on various systems. */ 350 | static void 351 | __yy_memcpy (to, from, count) 352 | char *to; 353 | char *from; 354 | unsigned int count; 355 | { 356 | register char *f = from; 357 | register char *t = to; 358 | register int i = count; 359 | 360 | while (i-- > 0) 361 | *t++ = *f++; 362 | } 363 | 364 | #else /* __cplusplus */ 365 | 366 | /* This is the most reliable way to avoid incompatibilities 367 | in available built-in functions on various systems. */ 368 | static void 369 | __yy_memcpy (char *to, char *from, unsigned int count) 370 | { 371 | register char *t = to; 372 | register char *f = from; 373 | register int i = count; 374 | 375 | while (i-- > 0) 376 | *t++ = *f++; 377 | } 378 | 379 | #endif 380 | #endif 381 | 382 | #line 217 "/usr/local/share/bison.simple" 383 | 384 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed 385 | into yyparse. The argument should have type void *. 386 | It should actually point to an object. 387 | Grammar actions can access the variable by casting it 388 | to the proper pointer type. */ 389 | 390 | #ifdef YYPARSE_PARAM 391 | #ifdef __cplusplus 392 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 393 | #define YYPARSE_PARAM_DECL 394 | #else /* not __cplusplus */ 395 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM 396 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 397 | #endif /* not __cplusplus */ 398 | #else /* not YYPARSE_PARAM */ 399 | #define YYPARSE_PARAM_ARG 400 | #define YYPARSE_PARAM_DECL 401 | #endif /* not YYPARSE_PARAM */ 402 | 403 | /* Prevent warning if -Wstrict-prototypes. */ 404 | #ifdef __GNUC__ 405 | #ifdef YYPARSE_PARAM 406 | int yyparse (void *); 407 | #else 408 | int yyparse (void); 409 | #endif 410 | #endif 411 | 412 | int 413 | yyparse(YYPARSE_PARAM_ARG) 414 | YYPARSE_PARAM_DECL 415 | { 416 | register int yystate; 417 | register int yyn; 418 | register short *yyssp; 419 | register YYSTYPE *yyvsp; 420 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ 421 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ 422 | 423 | short yyssa[YYINITDEPTH]; /* the state stack */ 424 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ 425 | 426 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ 427 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ 428 | 429 | #ifdef YYLSP_NEEDED 430 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ 431 | YYLTYPE *yyls = yylsa; 432 | YYLTYPE *yylsp; 433 | 434 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 435 | #else 436 | #define YYPOPSTACK (yyvsp--, yyssp--) 437 | #endif 438 | 439 | int yystacksize = YYINITDEPTH; 440 | int yyfree_stacks = 0; 441 | 442 | #ifdef YYPURE 443 | int yychar; 444 | YYSTYPE yylval; 445 | int yynerrs; 446 | #ifdef YYLSP_NEEDED 447 | YYLTYPE yylloc; 448 | #endif 449 | #endif 450 | 451 | YYSTYPE yyval; /* the variable used to return */ 452 | /* semantic values from the action */ 453 | /* routines */ 454 | 455 | int yylen; 456 | 457 | #if YYDEBUG != 0 458 | if (yydebug) 459 | fprintf(stderr, "Starting parse\n"); 460 | #endif 461 | 462 | yystate = 0; 463 | yyerrstatus = 0; 464 | yynerrs = 0; 465 | yychar = YYEMPTY; /* Cause a token to be read. */ 466 | 467 | /* Initialize stack pointers. 468 | Waste one element of value and location stack 469 | so that they stay on the same level as the state stack. 470 | The wasted elements are never initialized. */ 471 | 472 | yyssp = yyss - 1; 473 | yyvsp = yyvs; 474 | #ifdef YYLSP_NEEDED 475 | yylsp = yyls; 476 | #endif 477 | 478 | /* Push a new state, which is found in yystate . */ 479 | /* In all cases, when you get here, the value and location stacks 480 | have just been pushed. so pushing a state here evens the stacks. */ 481 | yynewstate: 482 | 483 | *++yyssp = yystate; 484 | 485 | if (yyssp >= yyss + yystacksize - 1) 486 | { 487 | /* Give user a chance to reallocate the stack */ 488 | /* Use copies of these so that the &'s don't force the real ones into memory. */ 489 | YYSTYPE *yyvs1 = yyvs; 490 | short *yyss1 = yyss; 491 | #ifdef YYLSP_NEEDED 492 | YYLTYPE *yyls1 = yyls; 493 | #endif 494 | 495 | /* Get the current used size of the three stacks, in elements. */ 496 | int size = yyssp - yyss + 1; 497 | 498 | #ifdef yyoverflow 499 | /* Each stack pointer address is followed by the size of 500 | the data in use in that stack, in bytes. */ 501 | #ifdef YYLSP_NEEDED 502 | /* This used to be a conditional around just the two extra args, 503 | but that might be undefined if yyoverflow is a macro. */ 504 | yyoverflow("parser stack overflow", 505 | &yyss1, size * sizeof (*yyssp), 506 | &yyvs1, size * sizeof (*yyvsp), 507 | &yyls1, size * sizeof (*yylsp), 508 | &yystacksize); 509 | #else 510 | yyoverflow("parser stack overflow", 511 | &yyss1, size * sizeof (*yyssp), 512 | &yyvs1, size * sizeof (*yyvsp), 513 | &yystacksize); 514 | #endif 515 | 516 | yyss = yyss1; yyvs = yyvs1; 517 | #ifdef YYLSP_NEEDED 518 | yyls = yyls1; 519 | #endif 520 | #else /* no yyoverflow */ 521 | /* Extend the stack our own way. */ 522 | if (yystacksize >= YYMAXDEPTH) 523 | { 524 | yyerror("parser stack overflow"); 525 | if (yyfree_stacks) 526 | { 527 | free (yyss); 528 | free (yyvs); 529 | #ifdef YYLSP_NEEDED 530 | free (yyls); 531 | #endif 532 | } 533 | return 2; 534 | } 535 | yystacksize *= 2; 536 | if (yystacksize > YYMAXDEPTH) 537 | yystacksize = YYMAXDEPTH; 538 | #ifndef YYSTACK_USE_ALLOCA 539 | yyfree_stacks = 1; 540 | #endif 541 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); 542 | __yy_memcpy ((char *)yyss, (char *)yyss1, 543 | size * (unsigned int) sizeof (*yyssp)); 544 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); 545 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, 546 | size * (unsigned int) sizeof (*yyvsp)); 547 | #ifdef YYLSP_NEEDED 548 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); 549 | __yy_memcpy ((char *)yyls, (char *)yyls1, 550 | size * (unsigned int) sizeof (*yylsp)); 551 | #endif 552 | #endif /* no yyoverflow */ 553 | 554 | yyssp = yyss + size - 1; 555 | yyvsp = yyvs + size - 1; 556 | #ifdef YYLSP_NEEDED 557 | yylsp = yyls + size - 1; 558 | #endif 559 | 560 | #if YYDEBUG != 0 561 | if (yydebug) 562 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); 563 | #endif 564 | 565 | if (yyssp >= yyss + yystacksize - 1) 566 | YYABORT; 567 | } 568 | 569 | #if YYDEBUG != 0 570 | if (yydebug) 571 | fprintf(stderr, "Entering state %d\n", yystate); 572 | #endif 573 | 574 | goto yybackup; 575 | yybackup: 576 | 577 | /* Do appropriate processing given the current state. */ 578 | /* Read a lookahead token if we need one and don't already have one. */ 579 | /* yyresume: */ 580 | 581 | /* First try to decide what to do without reference to lookahead token. */ 582 | 583 | yyn = yypact[yystate]; 584 | if (yyn == YYFLAG) 585 | goto yydefault; 586 | 587 | /* Not known => get a lookahead token if don't already have one. */ 588 | 589 | /* yychar is either YYEMPTY or YYEOF 590 | or a valid token in external form. */ 591 | 592 | if (yychar == YYEMPTY) 593 | { 594 | #if YYDEBUG != 0 595 | if (yydebug) 596 | fprintf(stderr, "Reading a token: "); 597 | #endif 598 | yychar = YYLEX; 599 | } 600 | 601 | /* Convert token to internal form (in yychar1) for indexing tables with */ 602 | 603 | if (yychar <= 0) /* This means end of input. */ 604 | { 605 | yychar1 = 0; 606 | yychar = YYEOF; /* Don't call YYLEX any more */ 607 | 608 | #if YYDEBUG != 0 609 | if (yydebug) 610 | fprintf(stderr, "Now at end of input.\n"); 611 | #endif 612 | } 613 | else 614 | { 615 | yychar1 = YYTRANSLATE(yychar); 616 | 617 | #if YYDEBUG != 0 618 | if (yydebug) 619 | { 620 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); 621 | /* Give the individual parser a way to print the precise meaning 622 | of a token, for further debugging info. */ 623 | #ifdef YYPRINT 624 | YYPRINT (stderr, yychar, yylval); 625 | #endif 626 | fprintf (stderr, ")\n"); 627 | } 628 | #endif 629 | } 630 | 631 | yyn += yychar1; 632 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 633 | goto yydefault; 634 | 635 | yyn = yytable[yyn]; 636 | 637 | /* yyn is what to do for this token type in this state. 638 | Negative => reduce, -yyn is rule number. 639 | Positive => shift, yyn is new state. 640 | New state is final state => don't bother to shift, 641 | just return success. 642 | 0, or most negative number => error. */ 643 | 644 | if (yyn < 0) 645 | { 646 | if (yyn == YYFLAG) 647 | goto yyerrlab; 648 | yyn = -yyn; 649 | goto yyreduce; 650 | } 651 | else if (yyn == 0) 652 | goto yyerrlab; 653 | 654 | if (yyn == YYFINAL) 655 | YYACCEPT; 656 | 657 | /* Shift the lookahead token. */ 658 | 659 | #if YYDEBUG != 0 660 | if (yydebug) 661 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); 662 | #endif 663 | 664 | /* Discard the token being shifted unless it is eof. */ 665 | if (yychar != YYEOF) 666 | yychar = YYEMPTY; 667 | 668 | *++yyvsp = yylval; 669 | #ifdef YYLSP_NEEDED 670 | *++yylsp = yylloc; 671 | #endif 672 | 673 | /* count tokens shifted since error; after three, turn off error status. */ 674 | if (yyerrstatus) yyerrstatus--; 675 | 676 | yystate = yyn; 677 | goto yynewstate; 678 | 679 | /* Do the default action for the current state. */ 680 | yydefault: 681 | 682 | yyn = yydefact[yystate]; 683 | if (yyn == 0) 684 | goto yyerrlab; 685 | 686 | /* Do a reduction. yyn is the number of a rule to reduce with. */ 687 | yyreduce: 688 | yylen = yyr2[yyn]; 689 | if (yylen > 0) 690 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ 691 | 692 | #if YYDEBUG != 0 693 | if (yydebug) 694 | { 695 | int i; 696 | 697 | fprintf (stderr, "Reducing via rule %d (line %d), ", 698 | yyn, yyrline[yyn]); 699 | 700 | /* Print the symbols being reduced, and their result. */ 701 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) 702 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); 703 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); 704 | } 705 | #endif 706 | 707 | 708 | switch (yyn) { 709 | 710 | } 711 | /* the action file gets copied in in place of this dollarsign */ 712 | #line 543 "/usr/local/share/bison.simple" 713 | 714 | yyvsp -= yylen; 715 | yyssp -= yylen; 716 | #ifdef YYLSP_NEEDED 717 | yylsp -= yylen; 718 | #endif 719 | 720 | #if YYDEBUG != 0 721 | if (yydebug) 722 | { 723 | short *ssp1 = yyss - 1; 724 | fprintf (stderr, "state stack now"); 725 | while (ssp1 != yyssp) 726 | fprintf (stderr, " %d", *++ssp1); 727 | fprintf (stderr, "\n"); 728 | } 729 | #endif 730 | 731 | *++yyvsp = yyval; 732 | 733 | #ifdef YYLSP_NEEDED 734 | yylsp++; 735 | if (yylen == 0) 736 | { 737 | yylsp->first_line = yylloc.first_line; 738 | yylsp->first_column = yylloc.first_column; 739 | yylsp->last_line = (yylsp-1)->last_line; 740 | yylsp->last_column = (yylsp-1)->last_column; 741 | yylsp->text = 0; 742 | } 743 | else 744 | { 745 | yylsp->last_line = (yylsp+yylen-1)->last_line; 746 | yylsp->last_column = (yylsp+yylen-1)->last_column; 747 | } 748 | #endif 749 | 750 | /* Now "shift" the result of the reduction. 751 | Determine what state that goes to, 752 | based on the state we popped back to 753 | and the rule number reduced by. */ 754 | 755 | yyn = yyr1[yyn]; 756 | 757 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 758 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 759 | yystate = yytable[yystate]; 760 | else 761 | yystate = yydefgoto[yyn - YYNTBASE]; 762 | 763 | goto yynewstate; 764 | 765 | yyerrlab: /* here on detecting error */ 766 | 767 | if (! yyerrstatus) 768 | /* If not already recovering from an error, report this error. */ 769 | { 770 | ++yynerrs; 771 | 772 | #ifdef YYERROR_VERBOSE 773 | yyn = yypact[yystate]; 774 | 775 | if (yyn > YYFLAG && yyn < YYLAST) 776 | { 777 | int size = 0; 778 | char *msg; 779 | int x, count; 780 | 781 | count = 0; 782 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ 783 | for (x = (yyn < 0 ? -yyn : 0); 784 | x < (sizeof(yytname) / sizeof(char *)); x++) 785 | if (yycheck[x + yyn] == x) 786 | size += strlen(yytname[x]) + 15, count++; 787 | msg = (char *) malloc(size + 15); 788 | if (msg != 0) 789 | { 790 | strcpy(msg, "parse error"); 791 | 792 | if (count < 5) 793 | { 794 | count = 0; 795 | for (x = (yyn < 0 ? -yyn : 0); 796 | x < (sizeof(yytname) / sizeof(char *)); x++) 797 | if (yycheck[x + yyn] == x) 798 | { 799 | strcat(msg, count == 0 ? ", expecting `" : " or `"); 800 | strcat(msg, yytname[x]); 801 | strcat(msg, "'"); 802 | count++; 803 | } 804 | } 805 | yyerror(msg); 806 | free(msg); 807 | } 808 | else 809 | yyerror ("parse error; also virtual memory exceeded"); 810 | } 811 | else 812 | #endif /* YYERROR_VERBOSE */ 813 | yyerror("parse error"); 814 | } 815 | 816 | goto yyerrlab1; 817 | yyerrlab1: /* here on error raised explicitly by an action */ 818 | 819 | if (yyerrstatus == 3) 820 | { 821 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ 822 | 823 | /* return failure if at end of input */ 824 | if (yychar == YYEOF) 825 | YYABORT; 826 | 827 | #if YYDEBUG != 0 828 | if (yydebug) 829 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); 830 | #endif 831 | 832 | yychar = YYEMPTY; 833 | } 834 | 835 | /* Else will try to reuse lookahead token 836 | after shifting the error token. */ 837 | 838 | yyerrstatus = 3; /* Each real token shifted decrements this */ 839 | 840 | goto yyerrhandle; 841 | 842 | yyerrdefault: /* current state does not do anything special for the error token. */ 843 | 844 | #if 0 845 | /* This is wrong; only states that explicitly want error tokens 846 | should shift them. */ 847 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ 848 | if (yyn) goto yydefault; 849 | #endif 850 | 851 | yyerrpop: /* pop the current state because it cannot handle the error token */ 852 | 853 | if (yyssp == yyss) YYABORT; 854 | yyvsp--; 855 | yystate = *--yyssp; 856 | #ifdef YYLSP_NEEDED 857 | yylsp--; 858 | #endif 859 | 860 | #if YYDEBUG != 0 861 | if (yydebug) 862 | { 863 | short *ssp1 = yyss - 1; 864 | fprintf (stderr, "Error: state stack now"); 865 | while (ssp1 != yyssp) 866 | fprintf (stderr, " %d", *++ssp1); 867 | fprintf (stderr, "\n"); 868 | } 869 | #endif 870 | 871 | yyerrhandle: 872 | 873 | yyn = yypact[yystate]; 874 | if (yyn == YYFLAG) 875 | goto yyerrdefault; 876 | 877 | yyn += YYTERROR; 878 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 879 | goto yyerrdefault; 880 | 881 | yyn = yytable[yyn]; 882 | if (yyn < 0) 883 | { 884 | if (yyn == YYFLAG) 885 | goto yyerrpop; 886 | yyn = -yyn; 887 | goto yyreduce; 888 | } 889 | else if (yyn == 0) 890 | goto yyerrpop; 891 | 892 | if (yyn == YYFINAL) 893 | YYACCEPT; 894 | 895 | #if YYDEBUG != 0 896 | if (yydebug) 897 | fprintf(stderr, "Shifting error token, "); 898 | #endif 899 | 900 | *++yyvsp = yylval; 901 | #ifdef YYLSP_NEEDED 902 | *++yylsp = yylloc; 903 | #endif 904 | 905 | yystate = yyn; 906 | goto yynewstate; 907 | 908 | yyacceptlab: 909 | /* YYACCEPT comes here. */ 910 | if (yyfree_stacks) 911 | { 912 | free (yyss); 913 | free (yyvs); 914 | #ifdef YYLSP_NEEDED 915 | free (yyls); 916 | #endif 917 | } 918 | return 0; 919 | 920 | yyabortlab: 921 | /* YYABORT comes here. */ 922 | if (yyfree_stacks) 923 | { 924 | free (yyss); 925 | free (yyvs); 926 | #ifdef YYLSP_NEEDED 927 | free (yyls); 928 | #endif 929 | } 930 | return 1; 931 | } 932 | #line 57 "aggr_mtd.y" 933 | 934 | 935 | #undef aggr_mtderror 936 | #undef yyerror 937 | 938 | int 939 | aggr_mtderror (const char *s) 940 | { 941 | yyerror(s); 942 | return 0; 943 | } 944 | 945 |