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