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