1/* A Bison parser, made by GNU Bison 2.3. */ 2 3/* Skeleton implementation for Bison's Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 6 Free Software Foundation, Inc. 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2, or (at your option) 11 any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 Boston, MA 02110-1301, USA. */ 22 23/* As a special exception, you may create a larger work that contains 24 part or all of the Bison parser skeleton and distribute that work 25 under terms of your choice, so long as that work isn't itself a 26 parser generator using the skeleton or a modified version thereof 27 as a parser skeleton. Alternatively, if you modify or redistribute 28 the parser skeleton itself, you may (at your option) remove this 29 special exception, which will cause the skeleton and the resulting 30 Bison output files to be licensed under the GNU General Public 31 License without this special exception. 32 33 This special exception was added by the Free Software Foundation in 34 version 2.2 of Bison. */ 35 36/* C LALR(1) parser skeleton written by Richard Stallman, by 37 simplifying the original so-called "semantic" parser. */ 38 39/* All symbols defined below should begin with yy or YY, to avoid 40 infringing on user name space. This should be done even for local 41 variables, as they might otherwise be expanded by user macros. 42 There are some unavoidable exceptions within include files to 43 define necessary library symbols; they are noted "INFRINGES ON 44 USER NAME SPACE" below. */ 45 46/* Identify Bison output. */ 47#define YYBISON 1 48 49/* Bison version. */ 50#define YYBISON_VERSION "2.3" 51 52/* Skeleton name. */ 53#define YYSKELETON_NAME "yacc.c" 54 55/* Pure parsers. */ 56#define YYPURE 0 57 58/* Using locations. */ 59#define YYLSP_NEEDED 0 60 61/* Substitute the variable and function names. */ 62#define yyparse cpyyparse 63#define yylex cpyylex 64#define yyerror cpyyerror 65#define yylval cpyylval 66#define yychar cpyychar 67#define yydebug cpyydebug 68#define yynerrs cpyynerrs 69 70 71/* Tokens. */ 72#ifndef YYTOKENTYPE 73# define YYTOKENTYPE 74 /* Put the tokens into the symbol table, so that GDB and other debuggers 75 know about them. */ 76 enum yytokentype { 77 INTERFACE = 258, 78 IFNAME = 259, 79 IPV6ADDR = 260, 80 REQUEST = 261, 81 SEND = 262, 82 RAPID_COMMIT = 263, 83 PREFIX_DELEGATION = 264, 84 DNS_SERVERS = 265, 85 SIP_SERVERS = 266, 86 NTP_SERVERS = 267, 87 INFO_ONLY = 268, 88 TEMP_ADDR = 269, 89 SOLICIT_ONLY = 270, 90 IANA_ONLY = 271, 91 IAPD_ONLY = 272, 92 DOMAIN_LIST = 273, 93 ADDRESS = 274, 94 PREFIX = 275, 95 IAID = 276, 96 RENEW_TIME = 277, 97 REBIND_TIME = 278, 98 V_TIME = 279, 99 P_TIME = 280, 100 PREFIX_DELEGATION_INTERFACE = 281, 101 USER_CLASS = 282, 102 XID_SOL = 283, 103 XID_REQ = 284, 104 DUID_TIME = 285, 105 NUMBER = 286, 106 SLASH = 287, 107 EOS = 288, 108 BCL = 289, 109 ECL = 290, 110 STRING = 291, 111 INFINITY = 292, 112 COMMA = 293, 113 OPTION = 294 114 }; 115#endif 116/* Tokens. */ 117#define INTERFACE 258 118#define IFNAME 259 119#define IPV6ADDR 260 120#define REQUEST 261 121#define SEND 262 122#define RAPID_COMMIT 263 123#define PREFIX_DELEGATION 264 124#define DNS_SERVERS 265 125#define SIP_SERVERS 266 126#define NTP_SERVERS 267 127#define INFO_ONLY 268 128#define TEMP_ADDR 269 129#define SOLICIT_ONLY 270 130#define IANA_ONLY 271 131#define IAPD_ONLY 272 132#define DOMAIN_LIST 273 133#define ADDRESS 274 134#define PREFIX 275 135#define IAID 276 136#define RENEW_TIME 277 137#define REBIND_TIME 278 138#define V_TIME 279 139#define P_TIME 280 140#define PREFIX_DELEGATION_INTERFACE 281 141#define USER_CLASS 282 142#define XID_SOL 283 143#define XID_REQ 284 144#define DUID_TIME 285 145#define NUMBER 286 146#define SLASH 287 147#define EOS 288 148#define BCL 289 149#define ECL 290 150#define STRING 291 151#define INFINITY 292 152#define COMMA 293 153#define OPTION 294 154 155 156 157 158/* Copy the first part of user declarations. */ 159#line 32 "client6_parse.y" 160 161#include <string.h> 162 163#include <stdlib.h> 164#include <sys/types.h> 165#include <sys/socket.h> 166#include <netinet/in.h> 167 168#include <arpa/inet.h> 169 170#include <malloc.h> 171#include "queue.h" 172#include "dhcp6.h" 173#include "config.h" 174#include "common.h" 175 176extern int lineno; 177extern int cfdebug; 178 179extern void cpyywarn __P((char *, ...)) 180 __attribute__((__format__(__printf__, 1, 2))); 181extern void cpyyerror __P((char *, ...)) 182 __attribute__((__format__(__printf__, 1, 2))); 183 184#define MAKE_NAMELIST(l, n, p) do { \ 185 (l) = (struct cf_namelist *)malloc(sizeof(*(l))); \ 186 if ((l) == NULL) { \ 187 cpyywarn("can't allocate memory"); \ 188 if (p) cleanup_cflist(p); \ 189 return (-1); \ 190 } \ 191 memset((l), 0, sizeof(*(l))); \ 192 l->line = lineno; \ 193 l->name = (n); \ 194 l->params = (p); \ 195 } while (0) 196 197#define MAKE_CFLIST(l, t, pp, pl) do { \ 198 (l) = (struct cf_list *)malloc(sizeof(*(l))); \ 199 if ((l) == NULL) { \ 200 cpyywarn("can't allocate memory"); \ 201 if (pp) free(pp); \ 202 if (pl) cleanup_cflist(pl); \ 203 return (-1); \ 204 } \ 205 memset((l), 0, sizeof(*(l))); \ 206 l->line = lineno; \ 207 l->type = (t); \ 208 l->ptr = (pp); \ 209 l->list = (pl); \ 210 } while (0) 211 212static struct cf_namelist *iflist_head; 213struct cf_list *cf_dns_list; 214 215extern int cpyylex __P((void)); 216static void cleanup __P((void)); 217static int add_namelist __P((struct cf_namelist *, struct cf_namelist **)); 218static void cleanup_namelist __P((struct cf_namelist *)); 219static void cleanup_cflist __P((struct cf_list *)); 220 221 222/* Enabling traces. */ 223#ifndef YYDEBUG 224# define YYDEBUG 0 225#endif 226 227/* Enabling verbose error messages. */ 228#ifdef YYERROR_VERBOSE 229# undef YYERROR_VERBOSE 230# define YYERROR_VERBOSE 1 231#else 232# define YYERROR_VERBOSE 0 233#endif 234 235/* Enabling the token table. */ 236#ifndef YYTOKEN_TABLE 237# define YYTOKEN_TABLE 0 238#endif 239 240#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 241typedef union YYSTYPE 242#line 104 "client6_parse.y" 243{ 244 long long num; 245 char* str; 246 struct cf_list *list; 247 struct in6_addr addr; 248 struct dhcp6_addr *v6addr; 249} 250/* Line 187 of yacc.c. */ 251#line 252 "y.tab.c" 252 YYSTYPE; 253# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 254# define YYSTYPE_IS_DECLARED 1 255# define YYSTYPE_IS_TRIVIAL 1 256#endif 257 258 259 260/* Copy the second part of user declarations. */ 261 262 263/* Line 216 of yacc.c. */ 264#line 265 "y.tab.c" 265 266#ifdef short 267# undef short 268#endif 269 270#ifdef YYTYPE_UINT8 271typedef YYTYPE_UINT8 yytype_uint8; 272#else 273typedef unsigned char yytype_uint8; 274#endif 275 276#ifdef YYTYPE_INT8 277typedef YYTYPE_INT8 yytype_int8; 278#elif (defined __STDC__ || defined __C99__FUNC__ \ 279 || defined __cplusplus || defined _MSC_VER) 280typedef signed char yytype_int8; 281#else 282typedef short int yytype_int8; 283#endif 284 285#ifdef YYTYPE_UINT16 286typedef YYTYPE_UINT16 yytype_uint16; 287#else 288typedef unsigned short int yytype_uint16; 289#endif 290 291#ifdef YYTYPE_INT16 292typedef YYTYPE_INT16 yytype_int16; 293#else 294typedef short int yytype_int16; 295#endif 296 297#ifndef YYSIZE_T 298# ifdef __SIZE_TYPE__ 299# define YYSIZE_T __SIZE_TYPE__ 300# elif defined size_t 301# define YYSIZE_T size_t 302# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 303 || defined __cplusplus || defined _MSC_VER) 304# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 305# define YYSIZE_T size_t 306# else 307# define YYSIZE_T unsigned int 308# endif 309#endif 310 311#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 312 313#ifndef YY_ 314# if YYENABLE_NLS 315# if ENABLE_NLS 316# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 317# define YY_(msgid) dgettext ("bison-runtime", msgid) 318# endif 319# endif 320# ifndef YY_ 321# define YY_(msgid) msgid 322# endif 323#endif 324 325/* Suppress unused-variable warnings by "using" E. */ 326#if ! defined lint || defined __GNUC__ 327# define YYUSE(e) ((void) (e)) 328#else 329# define YYUSE(e) /* empty */ 330#endif 331 332/* Identity function, used to suppress warnings about constant conditions. */ 333#ifndef lint 334# define YYID(n) (n) 335#else 336#if (defined __STDC__ || defined __C99__FUNC__ \ 337 || defined __cplusplus || defined _MSC_VER) 338static int 339YYID (int i) 340#else 341static int 342YYID (i) 343 int i; 344#endif 345{ 346 return i; 347} 348#endif 349 350#if ! defined yyoverflow || YYERROR_VERBOSE 351 352/* The parser invokes alloca or malloc; define the necessary symbols. */ 353 354# ifdef YYSTACK_USE_ALLOCA 355# if YYSTACK_USE_ALLOCA 356# ifdef __GNUC__ 357# define YYSTACK_ALLOC __builtin_alloca 358# elif defined __BUILTIN_VA_ARG_INCR 359# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 360# elif defined _AIX 361# define YYSTACK_ALLOC __alloca 362# elif defined _MSC_VER 363# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 364# define alloca _alloca 365# else 366# define YYSTACK_ALLOC alloca 367# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 368 || defined __cplusplus || defined _MSC_VER) 369# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 370# ifndef _STDLIB_H 371# define _STDLIB_H 1 372# endif 373# endif 374# endif 375# endif 376# endif 377 378# ifdef YYSTACK_ALLOC 379 /* Pacify GCC's `empty if-body' warning. */ 380# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 381# ifndef YYSTACK_ALLOC_MAXIMUM 382 /* The OS might guarantee only one guard page at the bottom of the stack, 383 and a page size can be as small as 4096 bytes. So we cannot safely 384 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 385 to allow for a few compiler-allocated temporary stack slots. */ 386# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 387# endif 388# else 389# define YYSTACK_ALLOC YYMALLOC 390# define YYSTACK_FREE YYFREE 391# ifndef YYSTACK_ALLOC_MAXIMUM 392# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 393# endif 394# if (defined __cplusplus && ! defined _STDLIB_H \ 395 && ! ((defined YYMALLOC || defined malloc) \ 396 && (defined YYFREE || defined free))) 397# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 398# ifndef _STDLIB_H 399# define _STDLIB_H 1 400# endif 401# endif 402# ifndef YYMALLOC 403# define YYMALLOC malloc 404# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 405 || defined __cplusplus || defined _MSC_VER) 406void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 407# endif 408# endif 409# ifndef YYFREE 410# define YYFREE free 411# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 412 || defined __cplusplus || defined _MSC_VER) 413void free (void *); /* INFRINGES ON USER NAME SPACE */ 414# endif 415# endif 416# endif 417#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 418 419 420#if (! defined yyoverflow \ 421 && (! defined __cplusplus \ 422 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 423 424/* A type that is properly aligned for any stack member. */ 425union yyalloc 426{ 427 yytype_int16 yyss; 428 YYSTYPE yyvs; 429 }; 430 431/* The size of the maximum gap between one aligned stack and the next. */ 432# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 433 434/* The size of an array large to enough to hold all stacks, each with 435 N elements. */ 436# define YYSTACK_BYTES(N) \ 437 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 438 + YYSTACK_GAP_MAXIMUM) 439 440/* Copy COUNT objects from FROM to TO. The source and destination do 441 not overlap. */ 442# ifndef YYCOPY 443# if defined __GNUC__ && 1 < __GNUC__ 444# define YYCOPY(To, From, Count) \ 445 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 446# else 447# define YYCOPY(To, From, Count) \ 448 do \ 449 { \ 450 YYSIZE_T yyi; \ 451 for (yyi = 0; yyi < (Count); yyi++) \ 452 (To)[yyi] = (From)[yyi]; \ 453 } \ 454 while (YYID (0)) 455# endif 456# endif 457 458/* Relocate STACK from its old location to the new one. The 459 local variables YYSIZE and YYSTACKSIZE give the old and new number of 460 elements in the stack, and YYPTR gives the new location of the 461 stack. Advance YYPTR to a properly aligned location for the next 462 stack. */ 463# define YYSTACK_RELOCATE(Stack) \ 464 do \ 465 { \ 466 YYSIZE_T yynewbytes; \ 467 YYCOPY (&yyptr->Stack, Stack, yysize); \ 468 Stack = &yyptr->Stack; \ 469 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 470 yyptr += yynewbytes / sizeof (*yyptr); \ 471 } \ 472 while (YYID (0)) 473 474#endif 475 476/* YYFINAL -- State number of the termination state. */ 477#define YYFINAL 2 478/* YYLAST -- Last index in YYTABLE. */ 479#define YYLAST 82 480 481/* YYNTOKENS -- Number of terminals. */ 482#define YYNTOKENS 40 483/* YYNNTS -- Number of nonterminals. */ 484#define YYNNTS 12 485/* YYNRULES -- Number of rules. */ 486#define YYNRULES 40 487/* YYNRULES -- Number of states. */ 488#define YYNSTATES 85 489 490/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 491#define YYUNDEFTOK 2 492#define YYMAXUTOK 294 493 494#define YYTRANSLATE(YYX) \ 495 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 496 497/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 498static const yytype_uint8 yytranslate[] = 499{ 500 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 506 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 507 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 508 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 511 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 512 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 513 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 514 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 515 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 516 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 517 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 518 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 519 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 521 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 522 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 525 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 526 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 527 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 528 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 529 35, 36, 37, 38, 39 530}; 531 532#if YYDEBUG 533/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 534 YYRHS. */ 535static const yytype_uint8 yyprhs[] = 536{ 537 0, 0, 3, 4, 7, 9, 16, 17, 20, 24, 538 28, 31, 34, 37, 40, 44, 50, 56, 60, 64, 539 68, 72, 76, 80, 84, 88, 90, 92, 94, 96, 540 98, 100, 103, 106, 110, 114, 116, 121, 125, 129, 541 131 542}; 543 544/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 545static const yytype_int8 yyrhs[] = 546{ 547 41, 0, -1, -1, 41, 42, -1, 43, -1, 3, 548 4, 34, 44, 35, 33, -1, -1, 44, 45, -1, 549 7, 46, 33, -1, 6, 46, 33, -1, 13, 33, 550 -1, 15, 33, -1, 16, 33, -1, 17, 33, -1, 551 6, 14, 33, -1, 19, 34, 47, 35, 33, -1, 552 20, 34, 47, 35, 33, -1, 22, 51, 33, -1, 553 23, 51, 33, -1, 21, 31, 33, -1, 26, 36, 554 33, -1, 27, 36, 33, -1, 28, 31, 33, -1, 555 29, 31, 33, -1, 30, 31, 33, -1, 8, -1, 556 9, -1, 10, -1, 18, -1, 11, -1, 12, -1, 557 48, 49, -1, 48, 50, -1, 48, 49, 50, -1, 558 48, 50, 49, -1, 48, -1, 5, 32, 31, 33, 559 -1, 24, 51, 33, -1, 25, 51, 33, -1, 37, 560 -1, 31, -1 561}; 562 563/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 564static const yytype_uint16 yyrline[] = 565{ 566 0, 119, 119, 121, 125, 129, 141, 142, 160, 168, 567 176, 184, 192, 200, 209, 217, 227, 237, 247, 257, 568 266, 275, 284, 293, 302, 314, 322, 330, 338, 346, 569 354, 366, 373, 379, 386, 393, 399, 417, 424, 431, 570 435 571}; 572#endif 573 574#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 575/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 576 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 577static const char *const yytname[] = 578{ 579 "$end", "error", "$undefined", "INTERFACE", "IFNAME", "IPV6ADDR", 580 "REQUEST", "SEND", "RAPID_COMMIT", "PREFIX_DELEGATION", "DNS_SERVERS", 581 "SIP_SERVERS", "NTP_SERVERS", "INFO_ONLY", "TEMP_ADDR", "SOLICIT_ONLY", 582 "IANA_ONLY", "IAPD_ONLY", "DOMAIN_LIST", "ADDRESS", "PREFIX", "IAID", 583 "RENEW_TIME", "REBIND_TIME", "V_TIME", "P_TIME", 584 "PREFIX_DELEGATION_INTERFACE", "USER_CLASS", "XID_SOL", "XID_REQ", 585 "DUID_TIME", "NUMBER", "SLASH", "EOS", "BCL", "ECL", "STRING", 586 "INFINITY", "COMMA", "OPTION", "$accept", "statements", "statement", 587 "interface_statement", "declarations", "declaration", "dhcpoption", 588 "addrdecl", "addrparam", "addrvtime", "addrptime", "duration", 0 589}; 590#endif 591 592# ifdef YYPRINT 593/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 594 token YYLEX-NUM. */ 595static const yytype_uint16 yytoknum[] = 596{ 597 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 598 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 599 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 600 285, 286, 287, 288, 289, 290, 291, 292, 293, 294 601}; 602# endif 603 604/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 605static const yytype_uint8 yyr1[] = 606{ 607 0, 40, 41, 41, 42, 43, 44, 44, 45, 45, 608 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 609 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 610 46, 47, 47, 47, 47, 47, 48, 49, 50, 51, 611 51 612}; 613 614/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 615static const yytype_uint8 yyr2[] = 616{ 617 0, 2, 0, 2, 1, 6, 0, 2, 3, 3, 618 2, 2, 2, 2, 3, 5, 5, 3, 3, 3, 619 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 620 1, 2, 2, 3, 3, 1, 4, 3, 3, 1, 621 1 622}; 623 624/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 625 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 626 means the default is an error. */ 627static const yytype_uint8 yydefact[] = 628{ 629 2, 0, 1, 0, 3, 4, 0, 6, 0, 0, 630 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 631 0, 0, 0, 0, 0, 0, 7, 25, 26, 27, 632 29, 30, 0, 28, 0, 0, 10, 11, 12, 13, 633 0, 0, 0, 40, 39, 0, 0, 0, 0, 0, 634 0, 0, 5, 14, 9, 8, 0, 0, 35, 0, 635 19, 17, 18, 20, 21, 22, 23, 24, 0, 0, 636 0, 0, 31, 32, 0, 0, 15, 0, 0, 33, 637 34, 16, 36, 37, 38 638}; 639 640/* YYDEFGOTO[NTERM-NUM]. */ 641static const yytype_int8 yydefgoto[] = 642{ 643 -1, 1, 4, 5, 8, 26, 34, 57, 58, 72, 644 73, 45 645}; 646 647/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 648 STATE-NUM. */ 649#define YYPACT_NINF -29 650static const yytype_int8 yypact[] = 651{ 652 -29, 4, -29, 1, -29, -29, -21, -29, -5, 23, 653 35, -27, -14, -13, -4, -6, 5, 7, -28, -28, 654 0, 6, 9, 17, 18, 21, -29, -29, -29, -29, 655 -29, -29, 22, -29, 24, 25, -29, -29, -29, -29, 656 45, 45, 26, -29, -29, 27, 28, 29, 30, 31, 657 32, 33, -29, -29, -29, -29, 36, 34, 2, 37, 658 -29, -29, -29, -29, -29, -29, -29, -29, 39, 38, 659 -28, -28, 42, 49, 41, 43, -29, 44, 46, -29, 660 -29, -29, -29, -29, -29 661}; 662 663/* YYPGOTO[NTERM-NUM]. */ 664static const yytype_int8 yypgoto[] = 665{ 666 -29, -29, -29, -29, -29, -29, 65, 15, -29, 8, 667 10, -19 668}; 669 670/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 671 positive, shift that token. If negative, reduce the rule which 672 number is the opposite. If zero, do what YYDEFACT says. 673 If YYTABLE_NINF, syntax error. */ 674#define YYTABLE_NINF -1 675static const yytype_uint8 yytable[] = 676{ 677 46, 9, 10, 43, 2, 6, 36, 3, 11, 44, 678 12, 13, 14, 7, 15, 16, 17, 18, 19, 37, 679 38, 20, 21, 22, 23, 24, 70, 71, 40, 39, 680 25, 27, 28, 29, 30, 31, 47, 32, 42, 41, 681 49, 33, 48, 27, 28, 29, 30, 31, 50, 51, 682 56, 77, 78, 33, 52, 53, 59, 54, 55, 60, 683 61, 62, 63, 64, 65, 66, 67, 71, 68, 69, 684 75, 76, 74, 70, 81, 35, 82, 83, 0, 84, 685 0, 80, 79 686}; 687 688static const yytype_int8 yycheck[] = 689{ 690 19, 6, 7, 31, 0, 4, 33, 3, 13, 37, 691 15, 16, 17, 34, 19, 20, 21, 22, 23, 33, 692 33, 26, 27, 28, 29, 30, 24, 25, 34, 33, 693 35, 8, 9, 10, 11, 12, 36, 14, 31, 34, 694 31, 18, 36, 8, 9, 10, 11, 12, 31, 31, 695 5, 70, 71, 18, 33, 33, 41, 33, 33, 33, 696 33, 33, 33, 33, 33, 33, 33, 25, 32, 35, 697 31, 33, 35, 24, 33, 10, 33, 33, -1, 33, 698 -1, 73, 72 699}; 700 701/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 702 symbol of state STATE-NUM. */ 703static const yytype_uint8 yystos[] = 704{ 705 0, 41, 0, 3, 42, 43, 4, 34, 44, 6, 706 7, 13, 15, 16, 17, 19, 20, 21, 22, 23, 707 26, 27, 28, 29, 30, 35, 45, 8, 9, 10, 708 11, 12, 14, 18, 46, 46, 33, 33, 33, 33, 709 34, 34, 31, 31, 37, 51, 51, 36, 36, 31, 710 31, 31, 33, 33, 33, 33, 5, 47, 48, 47, 711 33, 33, 33, 33, 33, 33, 33, 33, 32, 35, 712 24, 25, 49, 50, 35, 31, 33, 51, 51, 50, 713 49, 33, 33, 33, 33 714}; 715 716#define yyerrok (yyerrstatus = 0) 717#define yyclearin (yychar = YYEMPTY) 718#define YYEMPTY (-2) 719#define YYEOF 0 720 721#define YYACCEPT goto yyacceptlab 722#define YYABORT goto yyabortlab 723#define YYERROR goto yyerrorlab 724 725 726/* Like YYERROR except do call yyerror. This remains here temporarily 727 to ease the transition to the new meaning of YYERROR, for GCC. 728 Once GCC version 2 has supplanted version 1, this can go. */ 729 730#define YYFAIL goto yyerrlab 731 732#define YYRECOVERING() (!!yyerrstatus) 733 734#define YYBACKUP(Token, Value) \ 735do \ 736 if (yychar == YYEMPTY && yylen == 1) \ 737 { \ 738 yychar = (Token); \ 739 yylval = (Value); \ 740 yytoken = YYTRANSLATE (yychar); \ 741 YYPOPSTACK (1); \ 742 goto yybackup; \ 743 } \ 744 else \ 745 { \ 746 yyerror (YY_("syntax error: cannot back up")); \ 747 YYERROR; \ 748 } \ 749while (YYID (0)) 750 751 752#define YYTERROR 1 753#define YYERRCODE 256 754 755 756/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 757 If N is 0, then set CURRENT to the empty location which ends 758 the previous symbol: RHS[0] (always defined). */ 759 760#define YYRHSLOC(Rhs, K) ((Rhs)[K]) 761#ifndef YYLLOC_DEFAULT 762# define YYLLOC_DEFAULT(Current, Rhs, N) \ 763 do \ 764 if (YYID (N)) \ 765 { \ 766 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 767 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 768 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 769 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 770 } \ 771 else \ 772 { \ 773 (Current).first_line = (Current).last_line = \ 774 YYRHSLOC (Rhs, 0).last_line; \ 775 (Current).first_column = (Current).last_column = \ 776 YYRHSLOC (Rhs, 0).last_column; \ 777 } \ 778 while (YYID (0)) 779#endif 780 781 782/* YY_LOCATION_PRINT -- Print the location on the stream. 783 This macro was not mandated originally: define only if we know 784 we won't break user code: when these are the locations we know. */ 785 786#ifndef YY_LOCATION_PRINT 787# if YYLTYPE_IS_TRIVIAL 788# define YY_LOCATION_PRINT(File, Loc) \ 789 fprintf (File, "%d.%d-%d.%d", \ 790 (Loc).first_line, (Loc).first_column, \ 791 (Loc).last_line, (Loc).last_column) 792# else 793# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 794# endif 795#endif 796 797 798/* YYLEX -- calling `yylex' with the right arguments. */ 799 800#ifdef YYLEX_PARAM 801# define YYLEX yylex (YYLEX_PARAM) 802#else 803# define YYLEX yylex () 804#endif 805 806/* Enable debugging if requested. */ 807#if YYDEBUG 808 809# ifndef YYFPRINTF 810# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 811# define YYFPRINTF fprintf 812# endif 813 814# define YYDPRINTF(Args) \ 815do { \ 816 if (yydebug) \ 817 YYFPRINTF Args; \ 818} while (YYID (0)) 819 820# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 821do { \ 822 if (yydebug) \ 823 { \ 824 YYFPRINTF (stderr, "%s ", Title); \ 825 yy_symbol_print (stderr, \ 826 Type, Value); \ 827 YYFPRINTF (stderr, "\n"); \ 828 } \ 829} while (YYID (0)) 830 831 832/*--------------------------------. 833| Print this symbol on YYOUTPUT. | 834`--------------------------------*/ 835 836/*ARGSUSED*/ 837#if (defined __STDC__ || defined __C99__FUNC__ \ 838 || defined __cplusplus || defined _MSC_VER) 839static void 840yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 841#else 842static void 843yy_symbol_value_print (yyoutput, yytype, yyvaluep) 844 FILE *yyoutput; 845 int yytype; 846 YYSTYPE const * const yyvaluep; 847#endif 848{ 849 if (!yyvaluep) 850 return; 851# ifdef YYPRINT 852 if (yytype < YYNTOKENS) 853 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 854# else 855 YYUSE (yyoutput); 856# endif 857 switch (yytype) 858 { 859 default: 860 break; 861 } 862} 863 864 865/*--------------------------------. 866| Print this symbol on YYOUTPUT. | 867`--------------------------------*/ 868 869#if (defined __STDC__ || defined __C99__FUNC__ \ 870 || defined __cplusplus || defined _MSC_VER) 871static void 872yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 873#else 874static void 875yy_symbol_print (yyoutput, yytype, yyvaluep) 876 FILE *yyoutput; 877 int yytype; 878 YYSTYPE const * const yyvaluep; 879#endif 880{ 881 if (yytype < YYNTOKENS) 882 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 883 else 884 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 885 886 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 887 YYFPRINTF (yyoutput, ")"); 888} 889 890/*------------------------------------------------------------------. 891| yy_stack_print -- Print the state stack from its BOTTOM up to its | 892| TOP (included). | 893`------------------------------------------------------------------*/ 894 895#if (defined __STDC__ || defined __C99__FUNC__ \ 896 || defined __cplusplus || defined _MSC_VER) 897static void 898yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) 899#else 900static void 901yy_stack_print (bottom, top) 902 yytype_int16 *bottom; 903 yytype_int16 *top; 904#endif 905{ 906 YYFPRINTF (stderr, "Stack now"); 907 for (; bottom <= top; ++bottom) 908 YYFPRINTF (stderr, " %d", *bottom); 909 YYFPRINTF (stderr, "\n"); 910} 911 912# define YY_STACK_PRINT(Bottom, Top) \ 913do { \ 914 if (yydebug) \ 915 yy_stack_print ((Bottom), (Top)); \ 916} while (YYID (0)) 917 918 919/*------------------------------------------------. 920| Report that the YYRULE is going to be reduced. | 921`------------------------------------------------*/ 922 923#if (defined __STDC__ || defined __C99__FUNC__ \ 924 || defined __cplusplus || defined _MSC_VER) 925static void 926yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 927#else 928static void 929yy_reduce_print (yyvsp, yyrule) 930 YYSTYPE *yyvsp; 931 int yyrule; 932#endif 933{ 934 int yynrhs = yyr2[yyrule]; 935 int yyi; 936 unsigned long int yylno = yyrline[yyrule]; 937 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 938 yyrule - 1, yylno); 939 /* The symbols being reduced. */ 940 for (yyi = 0; yyi < yynrhs; yyi++) 941 { 942 fprintf (stderr, " $%d = ", yyi + 1); 943 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 944 &(yyvsp[(yyi + 1) - (yynrhs)]) 945 ); 946 fprintf (stderr, "\n"); 947 } 948} 949 950# define YY_REDUCE_PRINT(Rule) \ 951do { \ 952 if (yydebug) \ 953 yy_reduce_print (yyvsp, Rule); \ 954} while (YYID (0)) 955 956/* Nonzero means print parse trace. It is left uninitialized so that 957 multiple parsers can coexist. */ 958int yydebug; 959#else /* !YYDEBUG */ 960# define YYDPRINTF(Args) 961# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 962# define YY_STACK_PRINT(Bottom, Top) 963# define YY_REDUCE_PRINT(Rule) 964#endif /* !YYDEBUG */ 965 966 967/* YYINITDEPTH -- initial size of the parser's stacks. */ 968#ifndef YYINITDEPTH 969# define YYINITDEPTH 200 970#endif 971 972/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 973 if the built-in stack extension method is used). 974 975 Do not make this value too large; the results are undefined if 976 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 977 evaluated with infinite-precision integer arithmetic. */ 978 979#ifndef YYMAXDEPTH 980# define YYMAXDEPTH 10000 981#endif 982 983 984 985#if YYERROR_VERBOSE 986 987# ifndef yystrlen 988# if defined __GLIBC__ && defined _STRING_H 989# define yystrlen strlen 990# else 991/* Return the length of YYSTR. */ 992#if (defined __STDC__ || defined __C99__FUNC__ \ 993 || defined __cplusplus || defined _MSC_VER) 994static YYSIZE_T 995yystrlen (const char *yystr) 996#else 997static YYSIZE_T 998yystrlen (yystr) 999 const char *yystr; 1000#endif 1001{ 1002 YYSIZE_T yylen; 1003 for (yylen = 0; yystr[yylen]; yylen++) 1004 continue; 1005 return yylen; 1006} 1007# endif 1008# endif 1009 1010# ifndef yystpcpy 1011# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1012# define yystpcpy stpcpy 1013# else 1014/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1015 YYDEST. */ 1016#if (defined __STDC__ || defined __C99__FUNC__ \ 1017 || defined __cplusplus || defined _MSC_VER) 1018static char * 1019yystpcpy (char *yydest, const char *yysrc) 1020#else 1021static char * 1022yystpcpy (yydest, yysrc) 1023 char *yydest; 1024 const char *yysrc; 1025#endif 1026{ 1027 char *yyd = yydest; 1028 const char *yys = yysrc; 1029 1030 while ((*yyd++ = *yys++) != '\0') 1031 continue; 1032 1033 return yyd - 1; 1034} 1035# endif 1036# endif 1037 1038# ifndef yytnamerr 1039/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1040 quotes and backslashes, so that it's suitable for yyerror. The 1041 heuristic is that double-quoting is unnecessary unless the string 1042 contains an apostrophe, a comma, or backslash (other than 1043 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1044 null, do not copy; instead, return the length of what the result 1045 would have been. */ 1046static YYSIZE_T 1047yytnamerr (char *yyres, const char *yystr) 1048{ 1049 if (*yystr == '"') 1050 { 1051 YYSIZE_T yyn = 0; 1052 char const *yyp = yystr; 1053 1054 for (;;) 1055 switch (*++yyp) 1056 { 1057 case '\'': 1058 case ',': 1059 goto do_not_strip_quotes; 1060 1061 case '\\': 1062 if (*++yyp != '\\') 1063 goto do_not_strip_quotes; 1064 /* Fall through. */ 1065 default: 1066 if (yyres) 1067 yyres[yyn] = *yyp; 1068 yyn++; 1069 break; 1070 1071 case '"': 1072 if (yyres) 1073 yyres[yyn] = '\0'; 1074 return yyn; 1075 } 1076 do_not_strip_quotes: ; 1077 } 1078 1079 if (! yyres) 1080 return yystrlen (yystr); 1081 1082 return yystpcpy (yyres, yystr) - yyres; 1083} 1084# endif 1085 1086/* Copy into YYRESULT an error message about the unexpected token 1087 YYCHAR while in state YYSTATE. Return the number of bytes copied, 1088 including the terminating null byte. If YYRESULT is null, do not 1089 copy anything; just return the number of bytes that would be 1090 copied. As a special case, return 0 if an ordinary "syntax error" 1091 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 1092 size calculation. */ 1093static YYSIZE_T 1094yysyntax_error (char *yyresult, int yystate, int yychar) 1095{ 1096 int yyn = yypact[yystate]; 1097 1098 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1099 return 0; 1100 else 1101 { 1102 int yytype = YYTRANSLATE (yychar); 1103 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1104 YYSIZE_T yysize = yysize0; 1105 YYSIZE_T yysize1; 1106 int yysize_overflow = 0; 1107 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1108 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1109 int yyx; 1110 1111# if 0 1112 /* This is so xgettext sees the translatable formats that are 1113 constructed on the fly. */ 1114 YY_("syntax error, unexpected %s"); 1115 YY_("syntax error, unexpected %s, expecting %s"); 1116 YY_("syntax error, unexpected %s, expecting %s or %s"); 1117 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1118 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1119# endif 1120 char *yyfmt; 1121 char const *yyf; 1122 static char const yyunexpected[] = "syntax error, unexpected %s"; 1123 static char const yyexpecting[] = ", expecting %s"; 1124 static char const yyor[] = " or %s"; 1125 char yyformat[sizeof yyunexpected 1126 + sizeof yyexpecting - 1 1127 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1128 * (sizeof yyor - 1))]; 1129 char const *yyprefix = yyexpecting; 1130 1131 /* Start YYX at -YYN if negative to avoid negative indexes in 1132 YYCHECK. */ 1133 int yyxbegin = yyn < 0 ? -yyn : 0; 1134 1135 /* Stay within bounds of both yycheck and yytname. */ 1136 int yychecklim = YYLAST - yyn + 1; 1137 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1138 int yycount = 1; 1139 1140 yyarg[0] = yytname[yytype]; 1141 yyfmt = yystpcpy (yyformat, yyunexpected); 1142 1143 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1144 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1145 { 1146 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1147 { 1148 yycount = 1; 1149 yysize = yysize0; 1150 yyformat[sizeof yyunexpected - 1] = '\0'; 1151 break; 1152 } 1153 yyarg[yycount++] = yytname[yyx]; 1154 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1155 yysize_overflow |= (yysize1 < yysize); 1156 yysize = yysize1; 1157 yyfmt = yystpcpy (yyfmt, yyprefix); 1158 yyprefix = yyor; 1159 } 1160 1161 yyf = YY_(yyformat); 1162 yysize1 = yysize + yystrlen (yyf); 1163 yysize_overflow |= (yysize1 < yysize); 1164 yysize = yysize1; 1165 1166 if (yysize_overflow) 1167 return YYSIZE_MAXIMUM; 1168 1169 if (yyresult) 1170 { 1171 /* Avoid sprintf, as that infringes on the user's name space. 1172 Don't have undefined behavior even if the translation 1173 produced a string with the wrong number of "%s"s. */ 1174 char *yyp = yyresult; 1175 int yyi = 0; 1176 while ((*yyp = *yyf) != '\0') 1177 { 1178 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1179 { 1180 yyp += yytnamerr (yyp, yyarg[yyi++]); 1181 yyf += 2; 1182 } 1183 else 1184 { 1185 yyp++; 1186 yyf++; 1187 } 1188 } 1189 } 1190 return yysize; 1191 } 1192} 1193#endif /* YYERROR_VERBOSE */ 1194 1195 1196/*-----------------------------------------------. 1197| Release the memory associated to this symbol. | 1198`-----------------------------------------------*/ 1199 1200/*ARGSUSED*/ 1201#if (defined __STDC__ || defined __C99__FUNC__ \ 1202 || defined __cplusplus || defined _MSC_VER) 1203static void 1204yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1205#else 1206static void 1207yydestruct (yymsg, yytype, yyvaluep) 1208 const char *yymsg; 1209 int yytype; 1210 YYSTYPE *yyvaluep; 1211#endif 1212{ 1213 YYUSE (yyvaluep); 1214 1215 if (!yymsg) 1216 yymsg = "Deleting"; 1217 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1218 1219 switch (yytype) 1220 { 1221 1222 default: 1223 break; 1224 } 1225} 1226 1227 1228/* Prevent warnings from -Wmissing-prototypes. */ 1229 1230#ifdef YYPARSE_PARAM 1231#if defined __STDC__ || defined __cplusplus 1232int yyparse (void *YYPARSE_PARAM); 1233#else 1234int yyparse (); 1235#endif 1236#else /* ! YYPARSE_PARAM */ 1237#if defined __STDC__ || defined __cplusplus 1238int yyparse (void); 1239#else 1240int yyparse (); 1241#endif 1242#endif /* ! YYPARSE_PARAM */ 1243 1244 1245 1246/* The look-ahead symbol. */ 1247int yychar; 1248 1249/* The semantic value of the look-ahead symbol. */ 1250YYSTYPE yylval; 1251 1252/* Number of syntax errors so far. */ 1253int yynerrs; 1254 1255 1256 1257/*----------. 1258| yyparse. | 1259`----------*/ 1260 1261#ifdef YYPARSE_PARAM 1262#if (defined __STDC__ || defined __C99__FUNC__ \ 1263 || defined __cplusplus || defined _MSC_VER) 1264int 1265yyparse (void *YYPARSE_PARAM) 1266#else 1267int 1268yyparse (YYPARSE_PARAM) 1269 void *YYPARSE_PARAM; 1270#endif 1271#else /* ! YYPARSE_PARAM */ 1272#if (defined __STDC__ || defined __C99__FUNC__ \ 1273 || defined __cplusplus || defined _MSC_VER) 1274int 1275yyparse (void) 1276#else 1277int 1278yyparse () 1279 1280#endif 1281#endif 1282{ 1283 1284 int yystate; 1285 int yyn; 1286 int yyresult; 1287 /* Number of tokens to shift before error messages enabled. */ 1288 int yyerrstatus; 1289 /* Look-ahead token as an internal (translated) token number. */ 1290 int yytoken = 0; 1291#if YYERROR_VERBOSE 1292 /* Buffer for error messages, and its allocated size. */ 1293 char yymsgbuf[128]; 1294 char *yymsg = yymsgbuf; 1295 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1296#endif 1297 1298 /* Three stacks and their tools: 1299 `yyss': related to states, 1300 `yyvs': related to semantic values, 1301 `yyls': related to locations. 1302 1303 Refer to the stacks thru separate pointers, to allow yyoverflow 1304 to reallocate them elsewhere. */ 1305 1306 /* The state stack. */ 1307 yytype_int16 yyssa[YYINITDEPTH]; 1308 yytype_int16 *yyss = yyssa; 1309 yytype_int16 *yyssp; 1310 1311 /* The semantic value stack. */ 1312 YYSTYPE yyvsa[YYINITDEPTH]; 1313 YYSTYPE *yyvs = yyvsa; 1314 YYSTYPE *yyvsp; 1315 1316 1317 1318#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1319 1320 YYSIZE_T yystacksize = YYINITDEPTH; 1321 1322 /* The variables used to return semantic value and location from the 1323 action routines. */ 1324 YYSTYPE yyval; 1325 1326 1327 /* The number of symbols on the RHS of the reduced rule. 1328 Keep to zero when no symbol should be popped. */ 1329 int yylen = 0; 1330 1331 YYDPRINTF ((stderr, "Starting parse\n")); 1332 1333 yystate = 0; 1334 yyerrstatus = 0; 1335 yynerrs = 0; 1336 yychar = YYEMPTY; /* Cause a token to be read. */ 1337 1338 /* Initialize stack pointers. 1339 Waste one element of value and location stack 1340 so that they stay on the same level as the state stack. 1341 The wasted elements are never initialized. */ 1342 1343 yyssp = yyss; 1344 yyvsp = yyvs; 1345 1346 goto yysetstate; 1347 1348/*------------------------------------------------------------. 1349| yynewstate -- Push a new state, which is found in yystate. | 1350`------------------------------------------------------------*/ 1351 yynewstate: 1352 /* In all cases, when you get here, the value and location stacks 1353 have just been pushed. So pushing a state here evens the stacks. */ 1354 yyssp++; 1355 1356 yysetstate: 1357 *yyssp = yystate; 1358 1359 if (yyss + yystacksize - 1 <= yyssp) 1360 { 1361 /* Get the current used size of the three stacks, in elements. */ 1362 YYSIZE_T yysize = yyssp - yyss + 1; 1363 1364#ifdef yyoverflow 1365 { 1366 /* Give user a chance to reallocate the stack. Use copies of 1367 these so that the &'s don't force the real ones into 1368 memory. */ 1369 YYSTYPE *yyvs1 = yyvs; 1370 yytype_int16 *yyss1 = yyss; 1371 1372 1373 /* Each stack pointer address is followed by the size of the 1374 data in use in that stack, in bytes. This used to be a 1375 conditional around just the two extra args, but that might 1376 be undefined if yyoverflow is a macro. */ 1377 yyoverflow (YY_("memory exhausted"), 1378 &yyss1, yysize * sizeof (*yyssp), 1379 &yyvs1, yysize * sizeof (*yyvsp), 1380 1381 &yystacksize); 1382 1383 yyss = yyss1; 1384 yyvs = yyvs1; 1385 } 1386#else /* no yyoverflow */ 1387# ifndef YYSTACK_RELOCATE 1388 goto yyexhaustedlab; 1389# else 1390 /* Extend the stack our own way. */ 1391 if (YYMAXDEPTH <= yystacksize) 1392 goto yyexhaustedlab; 1393 yystacksize *= 2; 1394 if (YYMAXDEPTH < yystacksize) 1395 yystacksize = YYMAXDEPTH; 1396 1397 { 1398 yytype_int16 *yyss1 = yyss; 1399 union yyalloc *yyptr = 1400 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1401 if (! yyptr) 1402 goto yyexhaustedlab; 1403 YYSTACK_RELOCATE (yyss); 1404 YYSTACK_RELOCATE (yyvs); 1405 1406# undef YYSTACK_RELOCATE 1407 if (yyss1 != yyssa) 1408 YYSTACK_FREE (yyss1); 1409 } 1410# endif 1411#endif /* no yyoverflow */ 1412 1413 yyssp = yyss + yysize - 1; 1414 yyvsp = yyvs + yysize - 1; 1415 1416 1417 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1418 (unsigned long int) yystacksize)); 1419 1420 if (yyss + yystacksize - 1 <= yyssp) 1421 YYABORT; 1422 } 1423 1424 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1425 1426 goto yybackup; 1427 1428/*-----------. 1429| yybackup. | 1430`-----------*/ 1431yybackup: 1432 1433 /* Do appropriate processing given the current state. Read a 1434 look-ahead token if we need one and don't already have one. */ 1435 1436 /* First try to decide what to do without reference to look-ahead token. */ 1437 yyn = yypact[yystate]; 1438 if (yyn == YYPACT_NINF) 1439 goto yydefault; 1440 1441 /* Not known => get a look-ahead token if don't already have one. */ 1442 1443 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 1444 if (yychar == YYEMPTY) 1445 { 1446 YYDPRINTF ((stderr, "Reading a token: ")); 1447 yychar = YYLEX; 1448 } 1449 1450 if (yychar <= YYEOF) 1451 { 1452 yychar = yytoken = YYEOF; 1453 YYDPRINTF ((stderr, "Now at end of input.\n")); 1454 } 1455 else 1456 { 1457 yytoken = YYTRANSLATE (yychar); 1458 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1459 } 1460 1461 /* If the proper action on seeing token YYTOKEN is to reduce or to 1462 detect an error, take that action. */ 1463 yyn += yytoken; 1464 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1465 goto yydefault; 1466 yyn = yytable[yyn]; 1467 if (yyn <= 0) 1468 { 1469 if (yyn == 0 || yyn == YYTABLE_NINF) 1470 goto yyerrlab; 1471 yyn = -yyn; 1472 goto yyreduce; 1473 } 1474 1475 if (yyn == YYFINAL) 1476 YYACCEPT; 1477 1478 /* Count tokens shifted since error; after three, turn off error 1479 status. */ 1480 if (yyerrstatus) 1481 yyerrstatus--; 1482 1483 /* Shift the look-ahead token. */ 1484 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1485 1486 /* Discard the shifted token unless it is eof. */ 1487 if (yychar != YYEOF) 1488 yychar = YYEMPTY; 1489 1490 yystate = yyn; 1491 *++yyvsp = yylval; 1492 1493 goto yynewstate; 1494 1495 1496/*-----------------------------------------------------------. 1497| yydefault -- do the default action for the current state. | 1498`-----------------------------------------------------------*/ 1499yydefault: 1500 yyn = yydefact[yystate]; 1501 if (yyn == 0) 1502 goto yyerrlab; 1503 goto yyreduce; 1504 1505 1506/*-----------------------------. 1507| yyreduce -- Do a reduction. | 1508`-----------------------------*/ 1509yyreduce: 1510 /* yyn is the number of a rule to reduce with. */ 1511 yylen = yyr2[yyn]; 1512 1513 /* If YYLEN is nonzero, implement the default value of the action: 1514 `$$ = $1'. 1515 1516 Otherwise, the following line sets YYVAL to garbage. 1517 This behavior is undocumented and Bison 1518 users should not rely upon it. Assigning to YYVAL 1519 unconditionally makes the parser a bit smaller, and it avoids a 1520 GCC warning that YYVAL may be used uninitialized. */ 1521 yyval = yyvsp[1-yylen]; 1522 1523 1524 YY_REDUCE_PRINT (yyn); 1525 switch (yyn) 1526 { 1527 case 5: 1528#line 130 "client6_parse.y" 1529 { 1530 struct cf_namelist *ifl; 1531 1532 MAKE_NAMELIST(ifl, (yyvsp[(2) - (6)].str), (yyvsp[(4) - (6)].list)); 1533 1534 if (add_namelist(ifl, &iflist_head)) 1535 return (-1); 1536 } 1537 break; 1538 1539 case 6: 1540#line 141 "client6_parse.y" 1541 { (yyval.list) = NULL; } 1542 break; 1543 1544 case 7: 1545#line 143 "client6_parse.y" 1546 { 1547 struct cf_list *head; 1548 1549 if ((head = (yyvsp[(1) - (2)].list)) == NULL) { 1550 (yyvsp[(2) - (2)].list)->next = NULL; 1551 (yyvsp[(2) - (2)].list)->tail = (yyvsp[(2) - (2)].list); 1552 head = (yyvsp[(2) - (2)].list); 1553 } else { 1554 head->tail->next = (yyvsp[(2) - (2)].list); 1555 head->tail = (yyvsp[(2) - (2)].list); 1556 } 1557 1558 (yyval.list) = head; 1559 } 1560 break; 1561 1562 case 8: 1563#line 161 "client6_parse.y" 1564 { 1565 struct cf_list *l; 1566 1567 MAKE_CFLIST(l, DECL_SEND, NULL, (yyvsp[(2) - (3)].list)); 1568 1569 (yyval.list) = l; 1570 } 1571 break; 1572 1573 case 9: 1574#line 169 "client6_parse.y" 1575 { 1576 struct cf_list *l; 1577 1578 MAKE_CFLIST(l, DECL_REQUEST, NULL, (yyvsp[(2) - (3)].list)); 1579 1580 (yyval.list) = l; 1581 } 1582 break; 1583 1584 case 10: 1585#line 177 "client6_parse.y" 1586 { 1587 struct cf_list *l; 1588 1589 MAKE_CFLIST(l, DECL_INFO_ONLY, NULL, NULL); 1590 /* no value */ 1591 (yyval.list) = l; 1592 } 1593 break; 1594 1595 case 11: 1596#line 185 "client6_parse.y" 1597 { 1598 struct cf_list *l; 1599 1600 MAKE_CFLIST(l, DECL_SOLICIT_ONLY, NULL, NULL); 1601 /* no value */ 1602 (yyval.list) = l; 1603 } 1604 break; 1605 1606 case 12: 1607#line 193 "client6_parse.y" 1608 { 1609 struct cf_list *l; 1610 1611 MAKE_CFLIST(l, DECL_IANA_ONLY, NULL, NULL); 1612 /* no value */ 1613 (yyval.list) = l; 1614 } 1615 break; 1616 1617 case 13: 1618#line 201 "client6_parse.y" 1619 { 1620 struct cf_list *l; 1621 1622 MAKE_CFLIST(l, DECL_IAPD_ONLY, NULL, NULL); 1623 /* no value */ 1624 (yyval.list) = l; 1625 } 1626 break; 1627 1628 case 14: 1629#line 210 "client6_parse.y" 1630 { 1631 struct cf_list *l; 1632 1633 MAKE_CFLIST(l, DECL_TEMP_ADDR, NULL, NULL); 1634 /* no value */ 1635 (yyval.list) = l; 1636 } 1637 break; 1638 1639 case 15: 1640#line 218 "client6_parse.y" 1641 { 1642 struct cf_list *l; 1643 1644 MAKE_CFLIST(l, DECL_ADDRESS, (yyvsp[(3) - (5)].v6addr), NULL); 1645 1646 (yyval.list) = l; 1647 1648 } 1649 break; 1650 1651 case 16: 1652#line 228 "client6_parse.y" 1653 { 1654 struct cf_list *l; 1655 1656 MAKE_CFLIST(l, DECL_PREFIX, (yyvsp[(3) - (5)].v6addr), NULL); 1657 1658 (yyval.list) = l; 1659 1660 } 1661 break; 1662 1663 case 17: 1664#line 238 "client6_parse.y" 1665 { 1666 struct cf_list *l; 1667 1668 MAKE_CFLIST(l, DECL_RENEWTIME, NULL, NULL); 1669 l->num = (yyvsp[(2) - (3)].num); 1670 1671 (yyval.list) = l; 1672 1673 } 1674 break; 1675 1676 case 18: 1677#line 248 "client6_parse.y" 1678 { 1679 struct cf_list *l; 1680 1681 MAKE_CFLIST(l, DECL_REBINDTIME, NULL, NULL); 1682 l->num = (yyvsp[(2) - (3)].num); 1683 1684 (yyval.list) = l; 1685 1686 } 1687 break; 1688 1689 case 19: 1690#line 258 "client6_parse.y" 1691 { 1692 struct cf_list *l; 1693 1694 MAKE_CFLIST(l, DECL_IAID, NULL, NULL); 1695 l->num = (yyvsp[(2) - (3)].num); 1696 1697 (yyval.list) = l; 1698 } 1699 break; 1700 1701 case 20: 1702#line 267 "client6_parse.y" 1703 { 1704 struct cf_list *l; 1705 char *pp = (char*)malloc(strlen((yyvsp[(2) - (3)].str))+1); 1706 strcpy(pp,(yyvsp[(2) - (3)].str)); 1707 MAKE_CFLIST(l, DECL_PREFIX_DELEGATION_INTERFACE, pp, NULL ); 1708 1709 (yyval.list) = l; 1710 } 1711 break; 1712 1713 case 21: 1714#line 276 "client6_parse.y" 1715 { 1716 struct cf_list *l; 1717 char *pp = (char*)malloc(strlen((yyvsp[(2) - (3)].str))+1); 1718 strcpy(pp,(yyvsp[(2) - (3)].str)); 1719 MAKE_CFLIST(l, DECL_USER_CLASS, pp, NULL ); 1720 1721 (yyval.list) = l; 1722 } 1723 break; 1724 1725 case 22: 1726#line 285 "client6_parse.y" 1727 { 1728 struct cf_list *l; 1729 1730 MAKE_CFLIST(l, DECL_XID_SOL, NULL, NULL); 1731 l->num = (yyvsp[(2) - (3)].num); 1732 1733 (yyval.list) = l; 1734 } 1735 break; 1736 1737 case 23: 1738#line 294 "client6_parse.y" 1739 { 1740 struct cf_list *l; 1741 1742 MAKE_CFLIST(l, DECL_XID_REQ, NULL, NULL); 1743 l->num = (yyvsp[(2) - (3)].num); 1744 1745 (yyval.list) = l; 1746 } 1747 break; 1748 1749 case 24: 1750#line 303 "client6_parse.y" 1751 { 1752 struct cf_list *l; 1753 1754 MAKE_CFLIST(l, DECL_DUID_TIME, NULL, NULL); 1755 l->num = (yyvsp[(2) - (3)].num); 1756 1757 (yyval.list) = l; 1758 } 1759 break; 1760 1761 case 25: 1762#line 315 "client6_parse.y" 1763 { 1764 struct cf_list *l; 1765 1766 MAKE_CFLIST(l, DHCPOPT_RAPID_COMMIT, NULL, NULL); 1767 /* no value */ 1768 (yyval.list) = l; 1769 } 1770 break; 1771 1772 case 26: 1773#line 323 "client6_parse.y" 1774 { 1775 struct cf_list *l; 1776 1777 MAKE_CFLIST(l, DHCPOPT_PREFIX_DELEGATION, NULL, NULL); 1778 /* currently no value */ 1779 (yyval.list) = l; 1780 } 1781 break; 1782 1783 case 27: 1784#line 331 "client6_parse.y" 1785 { 1786 struct cf_list *l; 1787 1788 MAKE_CFLIST(l, DHCPOPT_DNS, NULL, NULL); 1789 /* currently no value */ 1790 (yyval.list) = l; 1791 } 1792 break; 1793 1794 case 28: 1795#line 339 "client6_parse.y" 1796 { 1797 struct cf_list *l; 1798 1799 MAKE_CFLIST(l, DHCPOPT_DOMAIN_LIST, NULL, NULL); 1800 /* currently no value */ 1801 (yyval.list) = l; 1802 } 1803 break; 1804 1805 case 29: 1806#line 347 "client6_parse.y" 1807 { 1808 struct cf_list *l; 1809 1810 MAKE_CFLIST(l, DHCPOPT_SIP, NULL, NULL); 1811 /* currently no value */ 1812 (yyval.list) = l; 1813 } 1814 break; 1815 1816 case 30: 1817#line 355 "client6_parse.y" 1818 { 1819 struct cf_list *l; 1820 1821 MAKE_CFLIST(l, DHCPOPT_NTP, NULL, NULL); 1822 /* currently no value */ 1823 (yyval.list) = l; 1824 } 1825 break; 1826 1827 case 31: 1828#line 367 "client6_parse.y" 1829 { 1830 struct dhcp6_addr *addr=(struct dhcp6_addr *)(yyvsp[(1) - (2)].v6addr); 1831 1832 addr->validlifetime = (u_int32_t)(yyvsp[(2) - (2)].num); 1833 (yyval.v6addr) = (yyvsp[(1) - (2)].v6addr); 1834 } 1835 break; 1836 1837 case 32: 1838#line 374 "client6_parse.y" 1839 { 1840 struct dhcp6_addr *addr=(struct dhcp6_addr *)(yyvsp[(1) - (2)].v6addr); 1841 addr->preferlifetime = (u_int32_t)(yyvsp[(2) - (2)].num); 1842 (yyval.v6addr) = (yyvsp[(1) - (2)].v6addr); 1843 } 1844 break; 1845 1846 case 33: 1847#line 380 "client6_parse.y" 1848 { 1849 struct dhcp6_addr *addr=(struct dhcp6_addr *)(yyvsp[(1) - (3)].v6addr); 1850 addr->validlifetime = (u_int32_t)(yyvsp[(2) - (3)].num); 1851 addr->preferlifetime = (u_int32_t)(yyvsp[(3) - (3)].num); 1852 (yyval.v6addr) = (yyvsp[(1) - (3)].v6addr); 1853 } 1854 break; 1855 1856 case 34: 1857#line 387 "client6_parse.y" 1858 { 1859 struct dhcp6_addr *addr=(struct dhcp6_addr *)(yyvsp[(1) - (3)].v6addr); 1860 addr->validlifetime = (u_int32_t)(yyvsp[(3) - (3)].num); 1861 addr->preferlifetime = (u_int32_t)(yyvsp[(2) - (3)].num); 1862 (yyval.v6addr) = (yyvsp[(1) - (3)].v6addr); 1863 } 1864 break; 1865 1866 case 35: 1867#line 394 "client6_parse.y" 1868 { 1869 (yyval.v6addr) = (yyvsp[(1) - (1)].v6addr); 1870 } 1871 break; 1872 1873 case 36: 1874#line 400 "client6_parse.y" 1875 { 1876 struct dhcp6_addr *v6addr; 1877 /* validate other parameters later */ 1878 if ((yyvsp[(3) - (4)].num) < 0 || (yyvsp[(3) - (4)].num) > 128) 1879 return (-1); 1880 if ((v6addr = malloc(sizeof(*v6addr))) == NULL) { 1881 cpyywarn("can't allocate memory"); 1882 return (-1); 1883 } 1884 memset(v6addr, 0, sizeof(*v6addr)); 1885 memcpy(&v6addr->addr, &(yyvsp[(1) - (4)].addr), sizeof(v6addr->addr)); 1886 v6addr->plen = (yyvsp[(3) - (4)].num); 1887 (yyval.v6addr) = v6addr; 1888 } 1889 break; 1890 1891 case 37: 1892#line 418 "client6_parse.y" 1893 { 1894 (yyval.num) = (yyvsp[(2) - (3)].num); 1895 } 1896 break; 1897 1898 case 38: 1899#line 425 "client6_parse.y" 1900 { 1901 (yyval.num) = (yyvsp[(2) - (3)].num); 1902 } 1903 break; 1904 1905 case 39: 1906#line 432 "client6_parse.y" 1907 { 1908 (yyval.num) = -1; 1909 } 1910 break; 1911 1912 case 40: 1913#line 436 "client6_parse.y" 1914 { 1915 (yyval.num) = (yyvsp[(1) - (1)].num); 1916 } 1917 break; 1918 1919 1920/* Line 1267 of yacc.c. */ 1921#line 1922 "y.tab.c" 1922 default: break; 1923 } 1924 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1925 1926 YYPOPSTACK (yylen); 1927 yylen = 0; 1928 YY_STACK_PRINT (yyss, yyssp); 1929 1930 *++yyvsp = yyval; 1931 1932 1933 /* Now `shift' the result of the reduction. Determine what state 1934 that goes to, based on the state we popped back to and the rule 1935 number reduced by. */ 1936 1937 yyn = yyr1[yyn]; 1938 1939 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1940 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1941 yystate = yytable[yystate]; 1942 else 1943 yystate = yydefgoto[yyn - YYNTOKENS]; 1944 1945 goto yynewstate; 1946 1947 1948/*------------------------------------. 1949| yyerrlab -- here on detecting error | 1950`------------------------------------*/ 1951yyerrlab: 1952 /* If not already recovering from an error, report this error. */ 1953 if (!yyerrstatus) 1954 { 1955 ++yynerrs; 1956#if ! YYERROR_VERBOSE 1957 yyerror (YY_("syntax error")); 1958#else 1959 { 1960 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 1961 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 1962 { 1963 YYSIZE_T yyalloc = 2 * yysize; 1964 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 1965 yyalloc = YYSTACK_ALLOC_MAXIMUM; 1966 if (yymsg != yymsgbuf) 1967 YYSTACK_FREE (yymsg); 1968 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 1969 if (yymsg) 1970 yymsg_alloc = yyalloc; 1971 else 1972 { 1973 yymsg = yymsgbuf; 1974 yymsg_alloc = sizeof yymsgbuf; 1975 } 1976 } 1977 1978 if (0 < yysize && yysize <= yymsg_alloc) 1979 { 1980 (void) yysyntax_error (yymsg, yystate, yychar); 1981 yyerror (yymsg); 1982 } 1983 else 1984 { 1985 yyerror (YY_("syntax error")); 1986 if (yysize != 0) 1987 goto yyexhaustedlab; 1988 } 1989 } 1990#endif 1991 } 1992 1993 1994 1995 if (yyerrstatus == 3) 1996 { 1997 /* If just tried and failed to reuse look-ahead token after an 1998 error, discard it. */ 1999 2000 if (yychar <= YYEOF) 2001 { 2002 /* Return failure if at end of input. */ 2003 if (yychar == YYEOF) 2004 YYABORT; 2005 } 2006 else 2007 { 2008 yydestruct ("Error: discarding", 2009 yytoken, &yylval); 2010 yychar = YYEMPTY; 2011 } 2012 } 2013 2014 /* Else will try to reuse look-ahead token after shifting the error 2015 token. */ 2016 goto yyerrlab1; 2017 2018 2019/*---------------------------------------------------. 2020| yyerrorlab -- error raised explicitly by YYERROR. | 2021`---------------------------------------------------*/ 2022yyerrorlab: 2023 2024 /* Pacify compilers like GCC when the user code never invokes 2025 YYERROR and the label yyerrorlab therefore never appears in user 2026 code. */ 2027 if (/*CONSTCOND*/ 0) 2028 goto yyerrorlab; 2029 2030 /* Do not reclaim the symbols of the rule which action triggered 2031 this YYERROR. */ 2032 YYPOPSTACK (yylen); 2033 yylen = 0; 2034 YY_STACK_PRINT (yyss, yyssp); 2035 yystate = *yyssp; 2036 goto yyerrlab1; 2037 2038 2039/*-------------------------------------------------------------. 2040| yyerrlab1 -- common code for both syntax error and YYERROR. | 2041`-------------------------------------------------------------*/ 2042yyerrlab1: 2043 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2044 2045 for (;;) 2046 { 2047 yyn = yypact[yystate]; 2048 if (yyn != YYPACT_NINF) 2049 { 2050 yyn += YYTERROR; 2051 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2052 { 2053 yyn = yytable[yyn]; 2054 if (0 < yyn) 2055 break; 2056 } 2057 } 2058 2059 /* Pop the current state because it cannot handle the error token. */ 2060 if (yyssp == yyss) 2061 YYABORT; 2062 2063 2064 yydestruct ("Error: popping", 2065 yystos[yystate], yyvsp); 2066 YYPOPSTACK (1); 2067 yystate = *yyssp; 2068 YY_STACK_PRINT (yyss, yyssp); 2069 } 2070 2071 if (yyn == YYFINAL) 2072 YYACCEPT; 2073 2074 *++yyvsp = yylval; 2075 2076 2077 /* Shift the error token. */ 2078 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2079 2080 yystate = yyn; 2081 goto yynewstate; 2082 2083 2084/*-------------------------------------. 2085| yyacceptlab -- YYACCEPT comes here. | 2086`-------------------------------------*/ 2087yyacceptlab: 2088 yyresult = 0; 2089 goto yyreturn; 2090 2091/*-----------------------------------. 2092| yyabortlab -- YYABORT comes here. | 2093`-----------------------------------*/ 2094yyabortlab: 2095 yyresult = 1; 2096 goto yyreturn; 2097 2098#ifndef yyoverflow 2099/*-------------------------------------------------. 2100| yyexhaustedlab -- memory exhaustion comes here. | 2101`-------------------------------------------------*/ 2102yyexhaustedlab: 2103 yyerror (YY_("memory exhausted")); 2104 yyresult = 2; 2105 /* Fall through. */ 2106#endif 2107 2108yyreturn: 2109 if (yychar != YYEOF && yychar != YYEMPTY) 2110 yydestruct ("Cleanup: discarding lookahead", 2111 yytoken, &yylval); 2112 /* Do not reclaim the symbols of the rule which action triggered 2113 this YYABORT or YYACCEPT. */ 2114 YYPOPSTACK (yylen); 2115 YY_STACK_PRINT (yyss, yyssp); 2116 while (yyssp != yyss) 2117 { 2118 yydestruct ("Cleanup: popping", 2119 yystos[*yyssp], yyvsp); 2120 YYPOPSTACK (1); 2121 } 2122#ifndef yyoverflow 2123 if (yyss != yyssa) 2124 YYSTACK_FREE (yyss); 2125#endif 2126#if YYERROR_VERBOSE 2127 if (yymsg != yymsgbuf) 2128 YYSTACK_FREE (yymsg); 2129#endif 2130 /* Make sure YYID is used. */ 2131 return YYID (yyresult); 2132} 2133 2134 2135#line 441 "client6_parse.y" 2136 2137/* supplement routines for configuration */ 2138static int 2139add_namelist(new, headp) 2140 struct cf_namelist *new, **headp; 2141{ 2142 struct cf_namelist *ifp; 2143 2144 /* check for duplicated configuration */ 2145 for (ifp = *headp; ifp; ifp = ifp->next) { 2146 if (strcmp(ifp->name, new->name) == 0) { 2147 cpyywarn("duplicated interface: %s (ignored)", 2148 new->name); 2149 cleanup_namelist(new); 2150 return (0); 2151 } 2152 } 2153 2154 new->next = *headp; 2155 *headp = new; 2156 2157 return (0); 2158} 2159 2160/* free temporary resources */ 2161static void 2162cleanup() 2163{ 2164 cleanup_namelist(iflist_head); 2165 2166} 2167 2168static void 2169cleanup_namelist(head) 2170 struct cf_namelist *head; 2171{ 2172 struct cf_namelist *ifp, *ifp_next; 2173 2174 for (ifp = head; ifp; ifp = ifp_next) { 2175 ifp_next = ifp->next; 2176 cleanup_cflist(ifp->params); 2177 free(ifp->name); 2178 free(ifp); 2179 } 2180} 2181 2182static void 2183cleanup_cflist(p) 2184 struct cf_list *p; 2185{ 2186 struct cf_list *n; 2187 2188 if (p == NULL) 2189 return; 2190 2191 n = p->next; 2192 if (p->ptr) 2193 free(p->ptr); 2194 if (p->list) 2195 cleanup_cflist(p->list); 2196 free(p); 2197 2198 cleanup_cflist(n); 2199} 2200 2201#define config_fail() \ 2202 do { cleanup(); configure_cleanup(); return (-1); } while(0) 2203 2204int 2205cf_post_config() 2206{ 2207 if (configure_interface(iflist_head)) 2208 config_fail(); 2209 2210 if (configure_global_option()) 2211 config_fail(); 2212 2213 configure_commit(); 2214 cleanup(); 2215 return (0); 2216} 2217#undef config_fail 2218 2219void 2220cf_init() 2221{ 2222 iflist_head = NULL; 2223} 2224 2225