1219820Sjeff/* A Bison parser, made by GNU Bison 2.3. */ 2219820Sjeff 3219820Sjeff/* Skeleton implementation for Bison's Yacc-like parsers in C 4219820Sjeff 5219820Sjeff Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 6219820Sjeff Free Software Foundation, Inc. 7219820Sjeff 8219820Sjeff This program is free software; you can redistribute it and/or modify 9219820Sjeff it under the terms of the GNU General Public License as published by 10219820Sjeff the Free Software Foundation; either version 2, or (at your option) 11219820Sjeff any later version. 12219820Sjeff 13219820Sjeff This program is distributed in the hope that it will be useful, 14219820Sjeff but WITHOUT ANY WARRANTY; without even the implied warranty of 15219820Sjeff MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16219820Sjeff GNU General Public License for more details. 17219820Sjeff 18219820Sjeff You should have received a copy of the GNU General Public License 19219820Sjeff along with this program; if not, write to the Free Software 20219820Sjeff Foundation, Inc., 51 Franklin Street, Fifth Floor, 21219820Sjeff Boston, MA 02110-1301, USA. */ 22219820Sjeff 23219820Sjeff/* As a special exception, you may create a larger work that contains 24219820Sjeff part or all of the Bison parser skeleton and distribute that work 25219820Sjeff under terms of your choice, so long as that work isn't itself a 26219820Sjeff parser generator using the skeleton or a modified version thereof 27219820Sjeff as a parser skeleton. Alternatively, if you modify or redistribute 28219820Sjeff the parser skeleton itself, you may (at your option) remove this 29219820Sjeff special exception, which will cause the skeleton and the resulting 30219820Sjeff Bison output files to be licensed under the GNU General Public 31219820Sjeff License without this special exception. 32219820Sjeff 33219820Sjeff This special exception was added by the Free Software Foundation in 34219820Sjeff version 2.2 of Bison. */ 35219820Sjeff 36219820Sjeff/* C LALR(1) parser skeleton written by Richard Stallman, by 37219820Sjeff simplifying the original so-called "semantic" parser. */ 38219820Sjeff 39219820Sjeff/* All symbols defined below should begin with yy or YY, to avoid 40219820Sjeff infringing on user name space. This should be done even for local 41219820Sjeff variables, as they might otherwise be expanded by user macros. 42219820Sjeff There are some unavoidable exceptions within include files to 43219820Sjeff define necessary library symbols; they are noted "INFRINGES ON 44219820Sjeff USER NAME SPACE" below. */ 45219820Sjeff 46219820Sjeff/* Identify Bison output. */ 47219820Sjeff#define YYBISON 1 48219820Sjeff 49219820Sjeff/* Bison version. */ 50219820Sjeff#define YYBISON_VERSION "2.3" 51219820Sjeff 52219820Sjeff/* Skeleton name. */ 53219820Sjeff#define YYSKELETON_NAME "yacc.c" 54219820Sjeff 55219820Sjeff/* Pure parsers. */ 56219820Sjeff#define YYPURE 0 57219820Sjeff 58219820Sjeff/* Using locations. */ 59219820Sjeff#define YYLSP_NEEDED 0 60219820Sjeff 61219820Sjeff/* Substitute the variable and function names. */ 62219820Sjeff#define yyparse libsdp_yyparse 63219820Sjeff#define yylex libsdp_yylex 64219820Sjeff#define yyerror libsdp_yyerror 65219820Sjeff#define yylval libsdp_yylval 66219820Sjeff#define yychar libsdp_yychar 67219820Sjeff#define yydebug libsdp_yydebug 68219820Sjeff#define yynerrs libsdp_yynerrs 69219820Sjeff 70219820Sjeff 71219820Sjeff/* Tokens. */ 72219820Sjeff#ifndef YYTOKENTYPE 73219820Sjeff# define YYTOKENTYPE 74219820Sjeff /* Put the tokens into the symbol table, so that GDB and other debuggers 75219820Sjeff know about them. */ 76219820Sjeff enum yytokentype { 77219820Sjeff USE = 258, 78219820Sjeff CLIENT = 259, 79219820Sjeff SERVER = 260, 80219820Sjeff TCP = 261, 81219820Sjeff SDP = 262, 82219820Sjeff BOTH = 263, 83219820Sjeff INT = 264, 84219820Sjeff LOG = 265, 85219820Sjeff DEST = 266, 86219820Sjeff STDERR = 267, 87219820Sjeff SYSLOG = 268, 88219820Sjeff FILENAME = 269, 89219820Sjeff NAME = 270, 90219820Sjeff LEVEL = 271, 91219820Sjeff LINE = 272 92219820Sjeff }; 93219820Sjeff#endif 94219820Sjeff/* Tokens. */ 95219820Sjeff#define USE 258 96219820Sjeff#define CLIENT 259 97219820Sjeff#define SERVER 260 98219820Sjeff#define TCP 261 99219820Sjeff#define SDP 262 100219820Sjeff#define BOTH 263 101219820Sjeff#define INT 264 102219820Sjeff#define LOG 265 103219820Sjeff#define DEST 266 104219820Sjeff#define STDERR 267 105219820Sjeff#define SYSLOG 268 106219820Sjeff#define FILENAME 269 107219820Sjeff#define NAME 270 108219820Sjeff#define LEVEL 271 109219820Sjeff#define LINE 272 110219820Sjeff 111219820Sjeff 112219820Sjeff 113219820Sjeff 114219820Sjeff/* Copy the first part of user declarations. */ 115219820Sjeff#line 39 "./config_parser.y" 116219820Sjeff 117219820Sjeff 118219820Sjeff/* header section */ 119219820Sjeff#include <stdlib.h> 120219820Sjeff#include <stdio.h> 121219820Sjeff#include <string.h> 122219820Sjeff#include "libsdp.h" 123219820Sjeff#include <sys/socket.h> 124219820Sjeff#include <netinet/in.h> 125219820Sjeff#include <arpa/inet.h> 126219820Sjeff 127219820Sjeff#define YYERROR_VERBOSE 1 128219820Sjeff 129219820Sjeffextern int yyerror(char *msg); 130219820Sjeffextern int yylex(void); 131219820Sjeffstatic int parse_err = 0; 132219820Sjeff 133219820Sjeffstruct use_family_rule *__sdp_clients_family_rules_head = NULL; 134219820Sjeffstruct use_family_rule *__sdp_clients_family_rules_tail = NULL; 135219820Sjeffstruct use_family_rule *__sdp_servers_family_rules_head = NULL; 136219820Sjeffstruct use_family_rule *__sdp_servers_family_rules_tail = NULL; 137219820Sjeff 138219820Sjeff/* some globals to store intermidiate parser state */ 139219820Sjeffstatic struct use_family_rule __sdp_rule; 140219820Sjeffstatic int current_role = 0; 141219820Sjeff 142219820Sjeffint __sdp_config_empty( 143219820Sjeff void 144219820Sjeff ) 145219820Sjeff{ 146219820Sjeff return ( (__sdp_clients_family_rules_head == NULL) && 147219820Sjeff (__sdp_servers_family_rules_head == NULL) ); 148219820Sjeff} 149219820Sjeff 150219820Sjeff/* define the address by 4 integers */ 151219820Sjeffstatic void __sdp_set_ipv4_addr(short a0, short a1, short a2, short a3) 152219820Sjeff{ 153219820Sjeff char buf[16]; 154219820Sjeff sprintf(buf,"%d.%d.%d.%d", a0, a1, a2, a3); 155219820Sjeff if (!inet_aton(buf, &( __sdp_rule.ipv4 ))) 156219820Sjeff { 157219820Sjeff parse_err = 1; 158219820Sjeff yyerror("provided address is not legal"); 159219820Sjeff } 160219820Sjeff} 161219820Sjeff 162219820Sjeffstatic void __sdp_set_prog_name_expr(char *prog_name_expr) 163219820Sjeff{ 164219820Sjeff __sdp_rule.prog_name_expr = strdup(prog_name_expr); 165219820Sjeff if (!__sdp_rule.prog_name_expr) { 166219820Sjeff yyerror("fail to allocate program name expression"); 167219820Sjeff } 168219820Sjeff} 169219820Sjeff 170219820Sjeffstatic char *__sdp_get_role_str(int role) 171219820Sjeff{ 172219820Sjeff if (role == 1) return("server"); 173219820Sjeff if (role == 2) return("client"); 174219820Sjeff return("unknown role"); 175219820Sjeff} 176219820Sjeff 177219820Sjeffextern int __sdp_min_level; 178219820Sjeff 179219820Sjeff/* dump the current state in readable format */ 180219820Sjeffstatic void __sdp_dump_config_state() { 181219820Sjeff char buf[1024]; 182219820Sjeff sprintf(buf, "CONFIG: use %s %s %s", 183219820Sjeff __sdp_get_family_str(__sdp_rule.target_family), 184219820Sjeff __sdp_get_role_str( current_role ), 185219820Sjeff __sdp_rule.prog_name_expr); 186219820Sjeff if (__sdp_rule.match_by_addr) { 187219820Sjeff if ( __sdp_rule.prefixlen != 32 ) 188219820Sjeff sprintf(buf+strlen(buf), " %s/%d", 189219820Sjeff inet_ntoa( __sdp_rule.ipv4 ), __sdp_rule.prefixlen); 190219820Sjeff else 191219820Sjeff sprintf(buf+strlen(buf), " %s", inet_ntoa( __sdp_rule.ipv4 )); 192219820Sjeff } else { 193219820Sjeff sprintf(buf+strlen(buf), " *"); 194219820Sjeff } 195219820Sjeff if (__sdp_rule.match_by_port) { 196219820Sjeff sprintf(buf+strlen(buf), ":%d",__sdp_rule.sport); 197219820Sjeff if (__sdp_rule.eport > __sdp_rule.sport) 198219820Sjeff sprintf(buf+strlen(buf), "-%d",__sdp_rule.eport); 199219820Sjeff } 200219820Sjeff else 201219820Sjeff sprintf(buf+strlen(buf), ":*"); 202219820Sjeff sprintf(buf+strlen(buf), "\n"); 203219820Sjeff __sdp_log(1, buf); 204219820Sjeff} 205219820Sjeff 206219820Sjeff/* use the above state for making a new rule */ 207219820Sjeffstatic void __sdp_add_rule() { 208219820Sjeff struct use_family_rule **p_tail, **p_head, *rule; 209219820Sjeff 210219820Sjeff if (__sdp_min_level <= 1) __sdp_dump_config_state(); 211219820Sjeff if ( current_role == 1 ) { 212219820Sjeff p_tail = &__sdp_servers_family_rules_tail; 213219820Sjeff p_head = &__sdp_servers_family_rules_head; 214219820Sjeff } else if ( current_role == 2 ) { 215219820Sjeff p_tail = &__sdp_clients_family_rules_tail; 216219820Sjeff p_head = &__sdp_clients_family_rules_head; 217219820Sjeff } else { 218219820Sjeff yyerror("ignoring unknown role"); 219219820Sjeff parse_err = 1; 220219820Sjeff return; 221219820Sjeff } 222219820Sjeff 223219820Sjeff rule = (struct use_family_rule *)malloc(sizeof(*rule)); 224219820Sjeff if (!rule) { 225219820Sjeff yyerror("fail to allocate new rule"); 226219820Sjeff parse_err = 1; 227219820Sjeff return; 228219820Sjeff } 229219820Sjeff 230219820Sjeff memset(rule, 0, sizeof(*rule)); 231219820Sjeff *rule = __sdp_rule; 232219820Sjeff rule->prev = *p_tail; 233219820Sjeff if (!(*p_head)) { 234219820Sjeff *p_head = rule; 235219820Sjeff } else { 236219820Sjeff (*p_tail)->next = rule; 237219820Sjeff } /* if */ 238219820Sjeff *p_tail = rule; 239219820Sjeff} 240219820Sjeff 241219820Sjeff 242219820Sjeff 243219820Sjeff/* Enabling traces. */ 244219820Sjeff#ifndef YYDEBUG 245219820Sjeff# define YYDEBUG 1 246219820Sjeff#endif 247219820Sjeff 248219820Sjeff/* Enabling verbose error messages. */ 249219820Sjeff#ifdef YYERROR_VERBOSE 250219820Sjeff# undef YYERROR_VERBOSE 251219820Sjeff# define YYERROR_VERBOSE 1 252219820Sjeff#else 253219820Sjeff# define YYERROR_VERBOSE 1 254219820Sjeff#endif 255219820Sjeff 256219820Sjeff/* Enabling the token table. */ 257219820Sjeff#ifndef YYTOKEN_TABLE 258219820Sjeff# define YYTOKEN_TABLE 0 259219820Sjeff#endif 260219820Sjeff 261219820Sjeff#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 262219820Sjefftypedef union YYSTYPE 263219820Sjeff#line 167 "./config_parser.y" 264219820Sjeff{ 265219820Sjeff int ival; 266219820Sjeff char *sval; 267219820Sjeff} 268219820Sjeff/* Line 193 of yacc.c. */ 269219820Sjeff#line 270 "y.tab.c" 270219820Sjeff YYSTYPE; 271219820Sjeff# define yystype YYSTYPE /* obsolescent; will be withdrawn */ 272219820Sjeff# define YYSTYPE_IS_DECLARED 1 273219820Sjeff# define YYSTYPE_IS_TRIVIAL 1 274219820Sjeff#endif 275219820Sjeff 276219820Sjeff 277219820Sjeff 278219820Sjeff/* Copy the second part of user declarations. */ 279219820Sjeff#line 192 "./config_parser.y" 280219820Sjeff 281219820Sjeff long __sdp_config_line_num; 282219820Sjeff 283219820Sjeff 284219820Sjeff/* Line 216 of yacc.c. */ 285219820Sjeff#line 286 "y.tab.c" 286219820Sjeff 287219820Sjeff#ifdef short 288219820Sjeff# undef short 289219820Sjeff#endif 290219820Sjeff 291219820Sjeff#ifdef YYTYPE_UINT8 292219820Sjefftypedef YYTYPE_UINT8 yytype_uint8; 293219820Sjeff#else 294219820Sjefftypedef unsigned char yytype_uint8; 295219820Sjeff#endif 296219820Sjeff 297219820Sjeff#ifdef YYTYPE_INT8 298219820Sjefftypedef YYTYPE_INT8 yytype_int8; 299219820Sjeff#elif (defined __STDC__ || defined __C99__FUNC__ \ 300219820Sjeff || defined __cplusplus || defined _MSC_VER) 301219820Sjefftypedef signed char yytype_int8; 302219820Sjeff#else 303219820Sjefftypedef short int yytype_int8; 304219820Sjeff#endif 305219820Sjeff 306219820Sjeff#ifdef YYTYPE_UINT16 307219820Sjefftypedef YYTYPE_UINT16 yytype_uint16; 308219820Sjeff#else 309219820Sjefftypedef unsigned short int yytype_uint16; 310219820Sjeff#endif 311219820Sjeff 312219820Sjeff#ifdef YYTYPE_INT16 313219820Sjefftypedef YYTYPE_INT16 yytype_int16; 314219820Sjeff#else 315219820Sjefftypedef short int yytype_int16; 316219820Sjeff#endif 317219820Sjeff 318219820Sjeff#ifndef YYSIZE_T 319219820Sjeff# ifdef __SIZE_TYPE__ 320219820Sjeff# define YYSIZE_T __SIZE_TYPE__ 321219820Sjeff# elif defined size_t 322219820Sjeff# define YYSIZE_T size_t 323219820Sjeff# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 324219820Sjeff || defined __cplusplus || defined _MSC_VER) 325219820Sjeff# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 326219820Sjeff# define YYSIZE_T size_t 327219820Sjeff# else 328219820Sjeff# define YYSIZE_T unsigned int 329219820Sjeff# endif 330219820Sjeff#endif 331219820Sjeff 332219820Sjeff#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 333219820Sjeff 334219820Sjeff#ifndef YY_ 335219820Sjeff# if YYENABLE_NLS 336219820Sjeff# if ENABLE_NLS 337219820Sjeff# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 338219820Sjeff# define YY_(msgid) dgettext ("bison-runtime", msgid) 339219820Sjeff# endif 340219820Sjeff# endif 341219820Sjeff# ifndef YY_ 342219820Sjeff# define YY_(msgid) msgid 343219820Sjeff# endif 344219820Sjeff#endif 345219820Sjeff 346219820Sjeff/* Suppress unused-variable warnings by "using" E. */ 347219820Sjeff#if ! defined lint || defined __GNUC__ 348219820Sjeff# define YYUSE(e) ((void) (e)) 349219820Sjeff#else 350219820Sjeff# define YYUSE(e) /* empty */ 351219820Sjeff#endif 352219820Sjeff 353219820Sjeff/* Identity function, used to suppress warnings about constant conditions. */ 354219820Sjeff#ifndef lint 355219820Sjeff# define YYID(n) (n) 356219820Sjeff#else 357219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 358219820Sjeff || defined __cplusplus || defined _MSC_VER) 359219820Sjeffstatic int 360219820SjeffYYID (int i) 361219820Sjeff#else 362219820Sjeffstatic int 363219820SjeffYYID (i) 364219820Sjeff int i; 365219820Sjeff#endif 366219820Sjeff{ 367219820Sjeff return i; 368219820Sjeff} 369219820Sjeff#endif 370219820Sjeff 371219820Sjeff#if ! defined yyoverflow || YYERROR_VERBOSE 372219820Sjeff 373219820Sjeff/* The parser invokes alloca or malloc; define the necessary symbols. */ 374219820Sjeff 375219820Sjeff# ifdef YYSTACK_USE_ALLOCA 376219820Sjeff# if YYSTACK_USE_ALLOCA 377219820Sjeff# ifdef __GNUC__ 378219820Sjeff# define YYSTACK_ALLOC __builtin_alloca 379219820Sjeff# elif defined __BUILTIN_VA_ARG_INCR 380219820Sjeff# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 381219820Sjeff# elif defined _AIX 382219820Sjeff# define YYSTACK_ALLOC __alloca 383219820Sjeff# elif defined _MSC_VER 384219820Sjeff# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 385219820Sjeff# define alloca _alloca 386219820Sjeff# else 387219820Sjeff# define YYSTACK_ALLOC alloca 388219820Sjeff# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 389219820Sjeff || defined __cplusplus || defined _MSC_VER) 390219820Sjeff# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 391219820Sjeff# ifndef _STDLIB_H 392219820Sjeff# define _STDLIB_H 1 393219820Sjeff# endif 394219820Sjeff# endif 395219820Sjeff# endif 396219820Sjeff# endif 397219820Sjeff# endif 398219820Sjeff 399219820Sjeff# ifdef YYSTACK_ALLOC 400219820Sjeff /* Pacify GCC's `empty if-body' warning. */ 401219820Sjeff# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 402219820Sjeff# ifndef YYSTACK_ALLOC_MAXIMUM 403219820Sjeff /* The OS might guarantee only one guard page at the bottom of the stack, 404219820Sjeff and a page size can be as small as 4096 bytes. So we cannot safely 405219820Sjeff invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 406219820Sjeff to allow for a few compiler-allocated temporary stack slots. */ 407219820Sjeff# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 408219820Sjeff# endif 409219820Sjeff# else 410219820Sjeff# define YYSTACK_ALLOC YYMALLOC 411219820Sjeff# define YYSTACK_FREE YYFREE 412219820Sjeff# ifndef YYSTACK_ALLOC_MAXIMUM 413219820Sjeff# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 414219820Sjeff# endif 415219820Sjeff# if (defined __cplusplus && ! defined _STDLIB_H \ 416219820Sjeff && ! ((defined YYMALLOC || defined malloc) \ 417219820Sjeff && (defined YYFREE || defined free))) 418219820Sjeff# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 419219820Sjeff# ifndef _STDLIB_H 420219820Sjeff# define _STDLIB_H 1 421219820Sjeff# endif 422219820Sjeff# endif 423219820Sjeff# ifndef YYMALLOC 424219820Sjeff# define YYMALLOC malloc 425219820Sjeff# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 426219820Sjeff || defined __cplusplus || defined _MSC_VER) 427219820Sjeffvoid *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 428219820Sjeff# endif 429219820Sjeff# endif 430219820Sjeff# ifndef YYFREE 431219820Sjeff# define YYFREE free 432219820Sjeff# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 433219820Sjeff || defined __cplusplus || defined _MSC_VER) 434219820Sjeffvoid free (void *); /* INFRINGES ON USER NAME SPACE */ 435219820Sjeff# endif 436219820Sjeff# endif 437219820Sjeff# endif 438219820Sjeff#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 439219820Sjeff 440219820Sjeff 441219820Sjeff#if (! defined yyoverflow \ 442219820Sjeff && (! defined __cplusplus \ 443219820Sjeff || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 444219820Sjeff 445219820Sjeff/* A type that is properly aligned for any stack member. */ 446219820Sjeffunion yyalloc 447219820Sjeff{ 448219820Sjeff yytype_int16 yyss; 449219820Sjeff YYSTYPE yyvs; 450219820Sjeff }; 451219820Sjeff 452219820Sjeff/* The size of the maximum gap between one aligned stack and the next. */ 453219820Sjeff# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 454219820Sjeff 455219820Sjeff/* The size of an array large to enough to hold all stacks, each with 456219820Sjeff N elements. */ 457219820Sjeff# define YYSTACK_BYTES(N) \ 458219820Sjeff ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 459219820Sjeff + YYSTACK_GAP_MAXIMUM) 460219820Sjeff 461219820Sjeff/* Copy COUNT objects from FROM to TO. The source and destination do 462219820Sjeff not overlap. */ 463219820Sjeff# ifndef YYCOPY 464219820Sjeff# if defined __GNUC__ && 1 < __GNUC__ 465219820Sjeff# define YYCOPY(To, From, Count) \ 466219820Sjeff __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 467219820Sjeff# else 468219820Sjeff# define YYCOPY(To, From, Count) \ 469219820Sjeff do \ 470219820Sjeff { \ 471219820Sjeff YYSIZE_T yyi; \ 472219820Sjeff for (yyi = 0; yyi < (Count); yyi++) \ 473219820Sjeff (To)[yyi] = (From)[yyi]; \ 474219820Sjeff } \ 475219820Sjeff while (YYID (0)) 476219820Sjeff# endif 477219820Sjeff# endif 478219820Sjeff 479219820Sjeff/* Relocate STACK from its old location to the new one. The 480219820Sjeff local variables YYSIZE and YYSTACKSIZE give the old and new number of 481219820Sjeff elements in the stack, and YYPTR gives the new location of the 482219820Sjeff stack. Advance YYPTR to a properly aligned location for the next 483219820Sjeff stack. */ 484219820Sjeff# define YYSTACK_RELOCATE(Stack) \ 485219820Sjeff do \ 486219820Sjeff { \ 487219820Sjeff YYSIZE_T yynewbytes; \ 488219820Sjeff YYCOPY (&yyptr->Stack, Stack, yysize); \ 489219820Sjeff Stack = &yyptr->Stack; \ 490219820Sjeff yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 491219820Sjeff yyptr += yynewbytes / sizeof (*yyptr); \ 492219820Sjeff } \ 493219820Sjeff while (YYID (0)) 494219820Sjeff 495219820Sjeff#endif 496219820Sjeff 497219820Sjeff/* YYFINAL -- State number of the termination state. */ 498219820Sjeff#define YYFINAL 7 499219820Sjeff/* YYLAST -- Last index in YYTABLE. */ 500219820Sjeff#define YYLAST 36 501219820Sjeff 502219820Sjeff/* YYNTOKENS -- Number of terminals. */ 503219820Sjeff#define YYNTOKENS 23 504219820Sjeff/* YYNNTS -- Number of nonterminals. */ 505219820Sjeff#define YYNNTS 17 506219820Sjeff/* YYNRULES -- Number of rules. */ 507219820Sjeff#define YYNRULES 33 508219820Sjeff/* YYNRULES -- Number of states. */ 509219820Sjeff#define YYNSTATES 53 510219820Sjeff 511219820Sjeff/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 512219820Sjeff#define YYUNDEFTOK 2 513219820Sjeff#define YYMAXUTOK 272 514219820Sjeff 515219820Sjeff#define YYTRANSLATE(YYX) \ 516219820Sjeff ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 517219820Sjeff 518219820Sjeff/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 519219820Sjeffstatic const yytype_uint8 yytranslate[] = 520219820Sjeff{ 521219820Sjeff 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 522219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 523219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 524219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 525219820Sjeff 2, 2, 19, 2, 2, 22, 21, 20, 2, 2, 526219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 18, 2, 527219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 528219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 529219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 530219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 531219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 532219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 533219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 534219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 535219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 536219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 537219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 538219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 539219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 540219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 541219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 542219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 543219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 544219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 545219820Sjeff 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 546219820Sjeff 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 547219820Sjeff 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 548219820Sjeff 15, 16, 17 549219820Sjeff}; 550219820Sjeff 551219820Sjeff#if YYDEBUG 552219820Sjeff/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 553219820Sjeff YYRHS. */ 554219820Sjeffstatic const yytype_uint8 yyprhs[] = 555219820Sjeff{ 556219820Sjeff 0, 0, 3, 5, 8, 9, 11, 14, 15, 18, 557219820Sjeff 20, 22, 26, 27, 30, 33, 36, 39, 43, 46, 558219820Sjeff 55, 57, 59, 61, 63, 65, 67, 69, 71, 75, 559219820Sjeff 77, 85, 87, 91 560219820Sjeff}; 561219820Sjeff 562219820Sjeff/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 563219820Sjeffstatic const yytype_int8 yyrhs[] = 564219820Sjeff{ 565219820Sjeff 26, 0, -1, 17, -1, 24, 17, -1, -1, 24, 566219820Sjeff -1, 25, 27, -1, -1, 27, 28, -1, 29, -1, 567219820Sjeff 33, -1, 10, 30, 24, -1, -1, 30, 31, -1, 568219820Sjeff 30, 32, -1, 11, 12, -1, 11, 13, -1, 11, 569219820Sjeff 14, 15, -1, 16, 9, -1, 3, 34, 35, 36, 570219820Sjeff 37, 18, 39, 24, -1, 6, -1, 7, -1, 8, 571219820Sjeff -1, 5, -1, 4, -1, 15, -1, 19, -1, 38, 572219820Sjeff -1, 38, 20, 9, -1, 19, -1, 9, 21, 9, 573219820Sjeff 21, 9, 21, 9, -1, 9, -1, 9, 22, 9, 574219820Sjeff -1, 19, -1 575219820Sjeff}; 576219820Sjeff 577219820Sjeff/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 578219820Sjeffstatic const yytype_uint16 yyrline[] = 579219820Sjeff{ 580219820Sjeff 0, 198, 198, 199, 201, 202, 205, 208, 209, 213, 581219820Sjeff 214, 218, 221, 222, 223, 227, 228, 229, 233, 237, 582219820Sjeff 241, 242, 243, 247, 248, 252, 253, 257, 258, 259, 583219820Sjeff 263, 267, 268, 269 584219820Sjeff}; 585219820Sjeff#endif 586219820Sjeff 587219820Sjeff#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 588219820Sjeff/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 589219820Sjeff First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 590219820Sjeffstatic const char *const yytname[] = 591219820Sjeff{ 592219820Sjeff "$end", "error", "$undefined", "\"use\"", "\"client or connect\"", 593219820Sjeff "\"server or listen\"", "\"tcp\"", "\"sdp\"", "\"both\"", 594219820Sjeff "\"integer value\"", "\"log statement\"", "\"destination\"", 595219820Sjeff "\"stderr\"", "\"syslog\"", "\"file\"", "\"a name\"", "\"min-level\"", 596219820Sjeff "\"new line\"", "':'", "'*'", "'/'", "'.'", "'-'", "$accept", "NL", 597219820Sjeff "ONL", "config", "statements", "statement", "log_statement", "log_opts", 598219820Sjeff "log_dest", "verbosity", "socket_statement", "family", "role", "program", 599219820Sjeff "address", "ipv4", "ports", 0 600219820Sjeff}; 601219820Sjeff#endif 602219820Sjeff 603219820Sjeff# ifdef YYPRINT 604219820Sjeff/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 605219820Sjeff token YYLEX-NUM. */ 606219820Sjeffstatic const yytype_uint16 yytoknum[] = 607219820Sjeff{ 608219820Sjeff 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 609219820Sjeff 265, 266, 267, 268, 269, 270, 271, 272, 58, 42, 610219820Sjeff 47, 46, 45 611219820Sjeff}; 612219820Sjeff# endif 613219820Sjeff 614219820Sjeff/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 615219820Sjeffstatic const yytype_uint8 yyr1[] = 616219820Sjeff{ 617219820Sjeff 0, 23, 24, 24, 25, 25, 26, 27, 27, 28, 618219820Sjeff 28, 29, 30, 30, 30, 31, 31, 31, 32, 33, 619219820Sjeff 34, 34, 34, 35, 35, 36, 36, 37, 37, 37, 620219820Sjeff 38, 39, 39, 39 621219820Sjeff}; 622219820Sjeff 623219820Sjeff/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 624219820Sjeffstatic const yytype_uint8 yyr2[] = 625219820Sjeff{ 626219820Sjeff 0, 2, 1, 2, 0, 1, 2, 0, 2, 1, 627219820Sjeff 1, 3, 0, 2, 2, 2, 2, 3, 2, 8, 628219820Sjeff 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 629219820Sjeff 7, 1, 3, 1 630219820Sjeff}; 631219820Sjeff 632219820Sjeff/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 633219820Sjeff STATE-NUM when YYTABLE doesn't specify something else to do. Zero 634219820Sjeff means the default is an error. */ 635219820Sjeffstatic const yytype_uint8 yydefact[] = 636219820Sjeff{ 637219820Sjeff 4, 2, 5, 7, 0, 3, 6, 1, 0, 12, 638219820Sjeff 8, 9, 10, 20, 21, 22, 0, 0, 24, 23, 639219820Sjeff 0, 0, 0, 11, 13, 14, 25, 26, 0, 15, 640219820Sjeff 16, 0, 18, 0, 29, 0, 27, 17, 0, 0, 641219820Sjeff 0, 0, 31, 33, 0, 28, 0, 0, 19, 0, 642219820Sjeff 32, 0, 30 643219820Sjeff}; 644219820Sjeff 645219820Sjeff/* YYDEFGOTO[NTERM-NUM]. */ 646219820Sjeffstatic const yytype_int8 yydefgoto[] = 647219820Sjeff{ 648219820Sjeff -1, 2, 3, 4, 6, 10, 11, 17, 24, 25, 649219820Sjeff 12, 16, 20, 28, 35, 36, 44 650219820Sjeff}; 651219820Sjeff 652219820Sjeff/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 653219820Sjeff STATE-NUM. */ 654219820Sjeff#define YYPACT_NINF -18 655219820Sjeffstatic const yytype_int8 yypact[] = 656219820Sjeff{ 657219820Sjeff -13, -18, 4, -18, 22, -18, 0, -18, 9, -18, 658219820Sjeff -18, -18, -18, -18, -18, -18, 2, -3, -18, -18, 659219820Sjeff -10, 6, 14, 4, -18, -18, -18, -18, -8, -18, 660219820Sjeff -18, 10, -18, 3, -18, 8, 11, -18, 19, -7, 661219820Sjeff 20, 12, 13, -18, -13, -18, 21, 23, 4, 15, 662219820Sjeff -18, 25, -18 663219820Sjeff}; 664219820Sjeff 665219820Sjeff/* YYPGOTO[NTERM-NUM]. */ 666219820Sjeffstatic const yytype_int8 yypgoto[] = 667219820Sjeff{ 668219820Sjeff -18, -17, -18, -18, -18, -18, -18, -18, -18, -18, 669219820Sjeff -18, -18, -18, -18, -18, -18, -18 670219820Sjeff}; 671219820Sjeff 672219820Sjeff/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 673219820Sjeff positive, shift that token. If negative, reduce the rule which 674219820Sjeff number is the opposite. If zero, do what YYDEFACT says. 675219820Sjeff If YYTABLE_NINF, syntax error. */ 676219820Sjeff#define YYTABLE_NINF -1 677219820Sjeffstatic const yytype_uint8 yytable[] = 678219820Sjeff{ 679219820Sjeff 23, 33, 42, 8, 1, 26, 18, 19, 21, 27, 680219820Sjeff 9, 34, 43, 22, 1, 13, 14, 15, 29, 30, 681219820Sjeff 31, 5, 7, 32, 38, 37, 39, 48, 41, 45, 682219820Sjeff 49, 40, 50, 46, 52, 47, 51 683219820Sjeff}; 684219820Sjeff 685219820Sjeffstatic const yytype_uint8 yycheck[] = 686219820Sjeff{ 687219820Sjeff 17, 9, 9, 3, 17, 15, 4, 5, 11, 19, 688219820Sjeff 10, 19, 19, 16, 17, 6, 7, 8, 12, 13, 689219820Sjeff 14, 17, 0, 9, 21, 15, 18, 44, 9, 9, 690219820Sjeff 9, 20, 9, 21, 9, 22, 21 691219820Sjeff}; 692219820Sjeff 693219820Sjeff/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 694219820Sjeff symbol of state STATE-NUM. */ 695219820Sjeffstatic const yytype_uint8 yystos[] = 696219820Sjeff{ 697219820Sjeff 0, 17, 24, 25, 26, 17, 27, 0, 3, 10, 698219820Sjeff 28, 29, 33, 6, 7, 8, 34, 30, 4, 5, 699219820Sjeff 35, 11, 16, 24, 31, 32, 15, 19, 36, 12, 700219820Sjeff 13, 14, 9, 9, 19, 37, 38, 15, 21, 18, 701219820Sjeff 20, 9, 9, 19, 39, 9, 21, 22, 24, 9, 702219820Sjeff 9, 21, 9 703219820Sjeff}; 704219820Sjeff 705219820Sjeff#define yyerrok (yyerrstatus = 0) 706219820Sjeff#define yyclearin (yychar = YYEMPTY) 707219820Sjeff#define YYEMPTY (-2) 708219820Sjeff#define YYEOF 0 709219820Sjeff 710219820Sjeff#define YYACCEPT goto yyacceptlab 711219820Sjeff#define YYABORT goto yyabortlab 712219820Sjeff#define YYERROR goto yyerrorlab 713219820Sjeff 714219820Sjeff 715219820Sjeff/* Like YYERROR except do call yyerror. This remains here temporarily 716219820Sjeff to ease the transition to the new meaning of YYERROR, for GCC. 717219820Sjeff Once GCC version 2 has supplanted version 1, this can go. */ 718219820Sjeff 719219820Sjeff#define YYFAIL goto yyerrlab 720219820Sjeff 721219820Sjeff#define YYRECOVERING() (!!yyerrstatus) 722219820Sjeff 723219820Sjeff#define YYBACKUP(Token, Value) \ 724219820Sjeffdo \ 725219820Sjeff if (yychar == YYEMPTY && yylen == 1) \ 726219820Sjeff { \ 727219820Sjeff yychar = (Token); \ 728219820Sjeff yylval = (Value); \ 729219820Sjeff yytoken = YYTRANSLATE (yychar); \ 730219820Sjeff YYPOPSTACK (1); \ 731219820Sjeff goto yybackup; \ 732219820Sjeff } \ 733219820Sjeff else \ 734219820Sjeff { \ 735219820Sjeff yyerror (YY_("syntax error: cannot back up")); \ 736219820Sjeff YYERROR; \ 737219820Sjeff } \ 738219820Sjeffwhile (YYID (0)) 739219820Sjeff 740219820Sjeff 741219820Sjeff#define YYTERROR 1 742219820Sjeff#define YYERRCODE 256 743219820Sjeff 744219820Sjeff 745219820Sjeff/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 746219820Sjeff If N is 0, then set CURRENT to the empty location which ends 747219820Sjeff the previous symbol: RHS[0] (always defined). */ 748219820Sjeff 749219820Sjeff#define YYRHSLOC(Rhs, K) ((Rhs)[K]) 750219820Sjeff#ifndef YYLLOC_DEFAULT 751219820Sjeff# define YYLLOC_DEFAULT(Current, Rhs, N) \ 752219820Sjeff do \ 753219820Sjeff if (YYID (N)) \ 754219820Sjeff { \ 755219820Sjeff (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 756219820Sjeff (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 757219820Sjeff (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 758219820Sjeff (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 759219820Sjeff } \ 760219820Sjeff else \ 761219820Sjeff { \ 762219820Sjeff (Current).first_line = (Current).last_line = \ 763219820Sjeff YYRHSLOC (Rhs, 0).last_line; \ 764219820Sjeff (Current).first_column = (Current).last_column = \ 765219820Sjeff YYRHSLOC (Rhs, 0).last_column; \ 766219820Sjeff } \ 767219820Sjeff while (YYID (0)) 768219820Sjeff#endif 769219820Sjeff 770219820Sjeff 771219820Sjeff/* YY_LOCATION_PRINT -- Print the location on the stream. 772219820Sjeff This macro was not mandated originally: define only if we know 773219820Sjeff we won't break user code: when these are the locations we know. */ 774219820Sjeff 775219820Sjeff#ifndef YY_LOCATION_PRINT 776219820Sjeff# if YYLTYPE_IS_TRIVIAL 777219820Sjeff# define YY_LOCATION_PRINT(File, Loc) \ 778219820Sjeff fprintf (File, "%d.%d-%d.%d", \ 779219820Sjeff (Loc).first_line, (Loc).first_column, \ 780219820Sjeff (Loc).last_line, (Loc).last_column) 781219820Sjeff# else 782219820Sjeff# define YY_LOCATION_PRINT(File, Loc) ((void) 0) 783219820Sjeff# endif 784219820Sjeff#endif 785219820Sjeff 786219820Sjeff 787219820Sjeff/* YYLEX -- calling `yylex' with the right arguments. */ 788219820Sjeff 789219820Sjeff#ifdef YYLEX_PARAM 790219820Sjeff# define YYLEX yylex (YYLEX_PARAM) 791219820Sjeff#else 792219820Sjeff# define YYLEX yylex () 793219820Sjeff#endif 794219820Sjeff 795219820Sjeff/* Enable debugging if requested. */ 796219820Sjeff#if YYDEBUG 797219820Sjeff 798219820Sjeff# ifndef YYFPRINTF 799219820Sjeff# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 800219820Sjeff# define YYFPRINTF fprintf 801219820Sjeff# endif 802219820Sjeff 803219820Sjeff# define YYDPRINTF(Args) \ 804219820Sjeffdo { \ 805219820Sjeff if (yydebug) \ 806219820Sjeff YYFPRINTF Args; \ 807219820Sjeff} while (YYID (0)) 808219820Sjeff 809219820Sjeff# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 810219820Sjeffdo { \ 811219820Sjeff if (yydebug) \ 812219820Sjeff { \ 813219820Sjeff YYFPRINTF (stderr, "%s ", Title); \ 814219820Sjeff yy_symbol_print (stderr, \ 815219820Sjeff Type, Value); \ 816219820Sjeff YYFPRINTF (stderr, "\n"); \ 817219820Sjeff } \ 818219820Sjeff} while (YYID (0)) 819219820Sjeff 820219820Sjeff 821219820Sjeff/*--------------------------------. 822219820Sjeff| Print this symbol on YYOUTPUT. | 823219820Sjeff`--------------------------------*/ 824219820Sjeff 825219820Sjeff/*ARGSUSED*/ 826219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 827219820Sjeff || defined __cplusplus || defined _MSC_VER) 828219820Sjeffstatic void 829219820Sjeffyy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 830219820Sjeff#else 831219820Sjeffstatic void 832219820Sjeffyy_symbol_value_print (yyoutput, yytype, yyvaluep) 833219820Sjeff FILE *yyoutput; 834219820Sjeff int yytype; 835219820Sjeff YYSTYPE const * const yyvaluep; 836219820Sjeff#endif 837219820Sjeff{ 838219820Sjeff if (!yyvaluep) 839219820Sjeff return; 840219820Sjeff# ifdef YYPRINT 841219820Sjeff if (yytype < YYNTOKENS) 842219820Sjeff YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 843219820Sjeff# else 844219820Sjeff YYUSE (yyoutput); 845219820Sjeff# endif 846219820Sjeff switch (yytype) 847219820Sjeff { 848219820Sjeff default: 849219820Sjeff break; 850219820Sjeff } 851219820Sjeff} 852219820Sjeff 853219820Sjeff 854219820Sjeff/*--------------------------------. 855219820Sjeff| Print this symbol on YYOUTPUT. | 856219820Sjeff`--------------------------------*/ 857219820Sjeff 858219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 859219820Sjeff || defined __cplusplus || defined _MSC_VER) 860219820Sjeffstatic void 861219820Sjeffyy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 862219820Sjeff#else 863219820Sjeffstatic void 864219820Sjeffyy_symbol_print (yyoutput, yytype, yyvaluep) 865219820Sjeff FILE *yyoutput; 866219820Sjeff int yytype; 867219820Sjeff YYSTYPE const * const yyvaluep; 868219820Sjeff#endif 869219820Sjeff{ 870219820Sjeff if (yytype < YYNTOKENS) 871219820Sjeff YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 872219820Sjeff else 873219820Sjeff YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 874219820Sjeff 875219820Sjeff yy_symbol_value_print (yyoutput, yytype, yyvaluep); 876219820Sjeff YYFPRINTF (yyoutput, ")"); 877219820Sjeff} 878219820Sjeff 879219820Sjeff/*------------------------------------------------------------------. 880219820Sjeff| yy_stack_print -- Print the state stack from its BOTTOM up to its | 881219820Sjeff| TOP (included). | 882219820Sjeff`------------------------------------------------------------------*/ 883219820Sjeff 884219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 885219820Sjeff || defined __cplusplus || defined _MSC_VER) 886219820Sjeffstatic void 887219820Sjeffyy_stack_print (yytype_int16 *bottom, yytype_int16 *top) 888219820Sjeff#else 889219820Sjeffstatic void 890219820Sjeffyy_stack_print (bottom, top) 891219820Sjeff yytype_int16 *bottom; 892219820Sjeff yytype_int16 *top; 893219820Sjeff#endif 894219820Sjeff{ 895219820Sjeff YYFPRINTF (stderr, "Stack now"); 896219820Sjeff for (; bottom <= top; ++bottom) 897219820Sjeff YYFPRINTF (stderr, " %d", *bottom); 898219820Sjeff YYFPRINTF (stderr, "\n"); 899219820Sjeff} 900219820Sjeff 901219820Sjeff# define YY_STACK_PRINT(Bottom, Top) \ 902219820Sjeffdo { \ 903219820Sjeff if (yydebug) \ 904219820Sjeff yy_stack_print ((Bottom), (Top)); \ 905219820Sjeff} while (YYID (0)) 906219820Sjeff 907219820Sjeff 908219820Sjeff/*------------------------------------------------. 909219820Sjeff| Report that the YYRULE is going to be reduced. | 910219820Sjeff`------------------------------------------------*/ 911219820Sjeff 912219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 913219820Sjeff || defined __cplusplus || defined _MSC_VER) 914219820Sjeffstatic void 915219820Sjeffyy_reduce_print (YYSTYPE *yyvsp, int yyrule) 916219820Sjeff#else 917219820Sjeffstatic void 918219820Sjeffyy_reduce_print (yyvsp, yyrule) 919219820Sjeff YYSTYPE *yyvsp; 920219820Sjeff int yyrule; 921219820Sjeff#endif 922219820Sjeff{ 923219820Sjeff int yynrhs = yyr2[yyrule]; 924219820Sjeff int yyi; 925219820Sjeff unsigned long int yylno = yyrline[yyrule]; 926219820Sjeff YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 927219820Sjeff yyrule - 1, yylno); 928219820Sjeff /* The symbols being reduced. */ 929219820Sjeff for (yyi = 0; yyi < yynrhs; yyi++) 930219820Sjeff { 931219820Sjeff fprintf (stderr, " $%d = ", yyi + 1); 932219820Sjeff yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 933219820Sjeff &(yyvsp[(yyi + 1) - (yynrhs)]) 934219820Sjeff ); 935219820Sjeff fprintf (stderr, "\n"); 936219820Sjeff } 937219820Sjeff} 938219820Sjeff 939219820Sjeff# define YY_REDUCE_PRINT(Rule) \ 940219820Sjeffdo { \ 941219820Sjeff if (yydebug) \ 942219820Sjeff yy_reduce_print (yyvsp, Rule); \ 943219820Sjeff} while (YYID (0)) 944219820Sjeff 945219820Sjeff/* Nonzero means print parse trace. It is left uninitialized so that 946219820Sjeff multiple parsers can coexist. */ 947219820Sjeffint yydebug; 948219820Sjeff#else /* !YYDEBUG */ 949219820Sjeff# define YYDPRINTF(Args) 950219820Sjeff# define YY_SYMBOL_PRINT(Title, Type, Value, Location) 951219820Sjeff# define YY_STACK_PRINT(Bottom, Top) 952219820Sjeff# define YY_REDUCE_PRINT(Rule) 953219820Sjeff#endif /* !YYDEBUG */ 954219820Sjeff 955219820Sjeff 956219820Sjeff/* YYINITDEPTH -- initial size of the parser's stacks. */ 957219820Sjeff#ifndef YYINITDEPTH 958219820Sjeff# define YYINITDEPTH 200 959219820Sjeff#endif 960219820Sjeff 961219820Sjeff/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 962219820Sjeff if the built-in stack extension method is used). 963219820Sjeff 964219820Sjeff Do not make this value too large; the results are undefined if 965219820Sjeff YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 966219820Sjeff evaluated with infinite-precision integer arithmetic. */ 967219820Sjeff 968219820Sjeff#ifndef YYMAXDEPTH 969219820Sjeff# define YYMAXDEPTH 10000 970219820Sjeff#endif 971219820Sjeff 972219820Sjeff 973219820Sjeff 974219820Sjeff#if YYERROR_VERBOSE 975219820Sjeff 976219820Sjeff# ifndef yystrlen 977219820Sjeff# if defined __GLIBC__ && defined _STRING_H 978219820Sjeff# define yystrlen strlen 979219820Sjeff# else 980219820Sjeff/* Return the length of YYSTR. */ 981219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 982219820Sjeff || defined __cplusplus || defined _MSC_VER) 983219820Sjeffstatic YYSIZE_T 984219820Sjeffyystrlen (const char *yystr) 985219820Sjeff#else 986219820Sjeffstatic YYSIZE_T 987219820Sjeffyystrlen (yystr) 988219820Sjeff const char *yystr; 989219820Sjeff#endif 990219820Sjeff{ 991219820Sjeff YYSIZE_T yylen; 992219820Sjeff for (yylen = 0; yystr[yylen]; yylen++) 993219820Sjeff continue; 994219820Sjeff return yylen; 995219820Sjeff} 996219820Sjeff# endif 997219820Sjeff# endif 998219820Sjeff 999219820Sjeff# ifndef yystpcpy 1000219820Sjeff# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1001219820Sjeff# define yystpcpy stpcpy 1002219820Sjeff# else 1003219820Sjeff/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1004219820Sjeff YYDEST. */ 1005219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 1006219820Sjeff || defined __cplusplus || defined _MSC_VER) 1007219820Sjeffstatic char * 1008219820Sjeffyystpcpy (char *yydest, const char *yysrc) 1009219820Sjeff#else 1010219820Sjeffstatic char * 1011219820Sjeffyystpcpy (yydest, yysrc) 1012219820Sjeff char *yydest; 1013219820Sjeff const char *yysrc; 1014219820Sjeff#endif 1015219820Sjeff{ 1016219820Sjeff char *yyd = yydest; 1017219820Sjeff const char *yys = yysrc; 1018219820Sjeff 1019219820Sjeff while ((*yyd++ = *yys++) != '\0') 1020219820Sjeff continue; 1021219820Sjeff 1022219820Sjeff return yyd - 1; 1023219820Sjeff} 1024219820Sjeff# endif 1025219820Sjeff# endif 1026219820Sjeff 1027219820Sjeff# ifndef yytnamerr 1028219820Sjeff/* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1029219820Sjeff quotes and backslashes, so that it's suitable for yyerror. The 1030219820Sjeff heuristic is that double-quoting is unnecessary unless the string 1031219820Sjeff contains an apostrophe, a comma, or backslash (other than 1032219820Sjeff backslash-backslash). YYSTR is taken from yytname. If YYRES is 1033219820Sjeff null, do not copy; instead, return the length of what the result 1034219820Sjeff would have been. */ 1035219820Sjeffstatic YYSIZE_T 1036219820Sjeffyytnamerr (char *yyres, const char *yystr) 1037219820Sjeff{ 1038219820Sjeff if (*yystr == '"') 1039219820Sjeff { 1040219820Sjeff YYSIZE_T yyn = 0; 1041219820Sjeff char const *yyp = yystr; 1042219820Sjeff 1043219820Sjeff for (;;) 1044219820Sjeff switch (*++yyp) 1045219820Sjeff { 1046219820Sjeff case '\'': 1047219820Sjeff case ',': 1048219820Sjeff goto do_not_strip_quotes; 1049219820Sjeff 1050219820Sjeff case '\\': 1051219820Sjeff if (*++yyp != '\\') 1052219820Sjeff goto do_not_strip_quotes; 1053219820Sjeff /* Fall through. */ 1054219820Sjeff default: 1055219820Sjeff if (yyres) 1056219820Sjeff yyres[yyn] = *yyp; 1057219820Sjeff yyn++; 1058219820Sjeff break; 1059219820Sjeff 1060219820Sjeff case '"': 1061219820Sjeff if (yyres) 1062219820Sjeff yyres[yyn] = '\0'; 1063219820Sjeff return yyn; 1064219820Sjeff } 1065219820Sjeff do_not_strip_quotes: ; 1066219820Sjeff } 1067219820Sjeff 1068219820Sjeff if (! yyres) 1069219820Sjeff return yystrlen (yystr); 1070219820Sjeff 1071219820Sjeff return yystpcpy (yyres, yystr) - yyres; 1072219820Sjeff} 1073219820Sjeff# endif 1074219820Sjeff 1075219820Sjeff/* Copy into YYRESULT an error message about the unexpected token 1076219820Sjeff YYCHAR while in state YYSTATE. Return the number of bytes copied, 1077219820Sjeff including the terminating null byte. If YYRESULT is null, do not 1078219820Sjeff copy anything; just return the number of bytes that would be 1079219820Sjeff copied. As a special case, return 0 if an ordinary "syntax error" 1080219820Sjeff message will do. Return YYSIZE_MAXIMUM if overflow occurs during 1081219820Sjeff size calculation. */ 1082219820Sjeffstatic YYSIZE_T 1083219820Sjeffyysyntax_error (char *yyresult, int yystate, int yychar) 1084219820Sjeff{ 1085219820Sjeff int yyn = yypact[yystate]; 1086219820Sjeff 1087219820Sjeff if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 1088219820Sjeff return 0; 1089219820Sjeff else 1090219820Sjeff { 1091219820Sjeff int yytype = YYTRANSLATE (yychar); 1092219820Sjeff YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 1093219820Sjeff YYSIZE_T yysize = yysize0; 1094219820Sjeff YYSIZE_T yysize1; 1095219820Sjeff int yysize_overflow = 0; 1096219820Sjeff enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1097219820Sjeff char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1098219820Sjeff int yyx; 1099219820Sjeff 1100219820Sjeff# if 0 1101219820Sjeff /* This is so xgettext sees the translatable formats that are 1102219820Sjeff constructed on the fly. */ 1103219820Sjeff YY_("syntax error, unexpected %s"); 1104219820Sjeff YY_("syntax error, unexpected %s, expecting %s"); 1105219820Sjeff YY_("syntax error, unexpected %s, expecting %s or %s"); 1106219820Sjeff YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 1107219820Sjeff YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 1108219820Sjeff# endif 1109219820Sjeff char *yyfmt; 1110219820Sjeff char const *yyf; 1111219820Sjeff static char const yyunexpected[] = "syntax error, unexpected %s"; 1112219820Sjeff static char const yyexpecting[] = ", expecting %s"; 1113219820Sjeff static char const yyor[] = " or %s"; 1114219820Sjeff char yyformat[sizeof yyunexpected 1115219820Sjeff + sizeof yyexpecting - 1 1116219820Sjeff + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 1117219820Sjeff * (sizeof yyor - 1))]; 1118219820Sjeff char const *yyprefix = yyexpecting; 1119219820Sjeff 1120219820Sjeff /* Start YYX at -YYN if negative to avoid negative indexes in 1121219820Sjeff YYCHECK. */ 1122219820Sjeff int yyxbegin = yyn < 0 ? -yyn : 0; 1123219820Sjeff 1124219820Sjeff /* Stay within bounds of both yycheck and yytname. */ 1125219820Sjeff int yychecklim = YYLAST - yyn + 1; 1126219820Sjeff int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1127219820Sjeff int yycount = 1; 1128219820Sjeff 1129219820Sjeff yyarg[0] = yytname[yytype]; 1130219820Sjeff yyfmt = yystpcpy (yyformat, yyunexpected); 1131219820Sjeff 1132219820Sjeff for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1133219820Sjeff if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 1134219820Sjeff { 1135219820Sjeff if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1136219820Sjeff { 1137219820Sjeff yycount = 1; 1138219820Sjeff yysize = yysize0; 1139219820Sjeff yyformat[sizeof yyunexpected - 1] = '\0'; 1140219820Sjeff break; 1141219820Sjeff } 1142219820Sjeff yyarg[yycount++] = yytname[yyx]; 1143219820Sjeff yysize1 = yysize + yytnamerr (0, yytname[yyx]); 1144219820Sjeff yysize_overflow |= (yysize1 < yysize); 1145219820Sjeff yysize = yysize1; 1146219820Sjeff yyfmt = yystpcpy (yyfmt, yyprefix); 1147219820Sjeff yyprefix = yyor; 1148219820Sjeff } 1149219820Sjeff 1150219820Sjeff yyf = YY_(yyformat); 1151219820Sjeff yysize1 = yysize + yystrlen (yyf); 1152219820Sjeff yysize_overflow |= (yysize1 < yysize); 1153219820Sjeff yysize = yysize1; 1154219820Sjeff 1155219820Sjeff if (yysize_overflow) 1156219820Sjeff return YYSIZE_MAXIMUM; 1157219820Sjeff 1158219820Sjeff if (yyresult) 1159219820Sjeff { 1160219820Sjeff /* Avoid sprintf, as that infringes on the user's name space. 1161219820Sjeff Don't have undefined behavior even if the translation 1162219820Sjeff produced a string with the wrong number of "%s"s. */ 1163219820Sjeff char *yyp = yyresult; 1164219820Sjeff int yyi = 0; 1165219820Sjeff while ((*yyp = *yyf) != '\0') 1166219820Sjeff { 1167219820Sjeff if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 1168219820Sjeff { 1169219820Sjeff yyp += yytnamerr (yyp, yyarg[yyi++]); 1170219820Sjeff yyf += 2; 1171219820Sjeff } 1172219820Sjeff else 1173219820Sjeff { 1174219820Sjeff yyp++; 1175219820Sjeff yyf++; 1176219820Sjeff } 1177219820Sjeff } 1178219820Sjeff } 1179219820Sjeff return yysize; 1180219820Sjeff } 1181219820Sjeff} 1182219820Sjeff#endif /* YYERROR_VERBOSE */ 1183219820Sjeff 1184219820Sjeff 1185219820Sjeff/*-----------------------------------------------. 1186219820Sjeff| Release the memory associated to this symbol. | 1187219820Sjeff`-----------------------------------------------*/ 1188219820Sjeff 1189219820Sjeff/*ARGSUSED*/ 1190219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 1191219820Sjeff || defined __cplusplus || defined _MSC_VER) 1192219820Sjeffstatic void 1193219820Sjeffyydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1194219820Sjeff#else 1195219820Sjeffstatic void 1196219820Sjeffyydestruct (yymsg, yytype, yyvaluep) 1197219820Sjeff const char *yymsg; 1198219820Sjeff int yytype; 1199219820Sjeff YYSTYPE *yyvaluep; 1200219820Sjeff#endif 1201219820Sjeff{ 1202219820Sjeff YYUSE (yyvaluep); 1203219820Sjeff 1204219820Sjeff if (!yymsg) 1205219820Sjeff yymsg = "Deleting"; 1206219820Sjeff YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1207219820Sjeff 1208219820Sjeff switch (yytype) 1209219820Sjeff { 1210219820Sjeff 1211219820Sjeff default: 1212219820Sjeff break; 1213219820Sjeff } 1214219820Sjeff} 1215219820Sjeff 1216219820Sjeff 1217219820Sjeff/* Prevent warnings from -Wmissing-prototypes. */ 1218219820Sjeff 1219219820Sjeff#ifdef YYPARSE_PARAM 1220219820Sjeff#if defined __STDC__ || defined __cplusplus 1221219820Sjeffint yyparse (void *YYPARSE_PARAM); 1222219820Sjeff#else 1223219820Sjeffint yyparse (); 1224219820Sjeff#endif 1225219820Sjeff#else /* ! YYPARSE_PARAM */ 1226219820Sjeff#if defined __STDC__ || defined __cplusplus 1227219820Sjeffint yyparse (void); 1228219820Sjeff#else 1229219820Sjeffint yyparse (); 1230219820Sjeff#endif 1231219820Sjeff#endif /* ! YYPARSE_PARAM */ 1232219820Sjeff 1233219820Sjeff 1234219820Sjeff 1235219820Sjeff/* The look-ahead symbol. */ 1236219820Sjeffint yychar; 1237219820Sjeff 1238219820Sjeff/* The semantic value of the look-ahead symbol. */ 1239219820SjeffYYSTYPE yylval; 1240219820Sjeff 1241219820Sjeff/* Number of syntax errors so far. */ 1242219820Sjeffint yynerrs; 1243219820Sjeff 1244219820Sjeff 1245219820Sjeff 1246219820Sjeff/*----------. 1247219820Sjeff| yyparse. | 1248219820Sjeff`----------*/ 1249219820Sjeff 1250219820Sjeff#ifdef YYPARSE_PARAM 1251219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 1252219820Sjeff || defined __cplusplus || defined _MSC_VER) 1253219820Sjeffint 1254219820Sjeffyyparse (void *YYPARSE_PARAM) 1255219820Sjeff#else 1256219820Sjeffint 1257219820Sjeffyyparse (YYPARSE_PARAM) 1258219820Sjeff void *YYPARSE_PARAM; 1259219820Sjeff#endif 1260219820Sjeff#else /* ! YYPARSE_PARAM */ 1261219820Sjeff#if (defined __STDC__ || defined __C99__FUNC__ \ 1262219820Sjeff || defined __cplusplus || defined _MSC_VER) 1263219820Sjeffint 1264219820Sjeffyyparse (void) 1265219820Sjeff#else 1266219820Sjeffint 1267219820Sjeffyyparse () 1268219820Sjeff 1269219820Sjeff#endif 1270219820Sjeff#endif 1271219820Sjeff{ 1272219820Sjeff 1273219820Sjeff int yystate; 1274219820Sjeff int yyn; 1275219820Sjeff int yyresult; 1276219820Sjeff /* Number of tokens to shift before error messages enabled. */ 1277219820Sjeff int yyerrstatus; 1278219820Sjeff /* Look-ahead token as an internal (translated) token number. */ 1279219820Sjeff int yytoken = 0; 1280219820Sjeff#if YYERROR_VERBOSE 1281219820Sjeff /* Buffer for error messages, and its allocated size. */ 1282219820Sjeff char yymsgbuf[128]; 1283219820Sjeff char *yymsg = yymsgbuf; 1284219820Sjeff YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1285219820Sjeff#endif 1286219820Sjeff 1287219820Sjeff /* Three stacks and their tools: 1288219820Sjeff `yyss': related to states, 1289219820Sjeff `yyvs': related to semantic values, 1290219820Sjeff `yyls': related to locations. 1291219820Sjeff 1292219820Sjeff Refer to the stacks thru separate pointers, to allow yyoverflow 1293219820Sjeff to reallocate them elsewhere. */ 1294219820Sjeff 1295219820Sjeff /* The state stack. */ 1296219820Sjeff yytype_int16 yyssa[YYINITDEPTH]; 1297219820Sjeff yytype_int16 *yyss = yyssa; 1298219820Sjeff yytype_int16 *yyssp; 1299219820Sjeff 1300219820Sjeff /* The semantic value stack. */ 1301219820Sjeff YYSTYPE yyvsa[YYINITDEPTH]; 1302219820Sjeff YYSTYPE *yyvs = yyvsa; 1303219820Sjeff YYSTYPE *yyvsp; 1304219820Sjeff 1305219820Sjeff 1306219820Sjeff 1307219820Sjeff#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1308219820Sjeff 1309219820Sjeff YYSIZE_T yystacksize = YYINITDEPTH; 1310219820Sjeff 1311219820Sjeff /* The variables used to return semantic value and location from the 1312219820Sjeff action routines. */ 1313219820Sjeff YYSTYPE yyval; 1314219820Sjeff 1315219820Sjeff 1316219820Sjeff /* The number of symbols on the RHS of the reduced rule. 1317219820Sjeff Keep to zero when no symbol should be popped. */ 1318219820Sjeff int yylen = 0; 1319219820Sjeff 1320219820Sjeff YYDPRINTF ((stderr, "Starting parse\n")); 1321219820Sjeff 1322219820Sjeff yystate = 0; 1323219820Sjeff yyerrstatus = 0; 1324219820Sjeff yynerrs = 0; 1325219820Sjeff yychar = YYEMPTY; /* Cause a token to be read. */ 1326219820Sjeff 1327219820Sjeff /* Initialize stack pointers. 1328219820Sjeff Waste one element of value and location stack 1329219820Sjeff so that they stay on the same level as the state stack. 1330219820Sjeff The wasted elements are never initialized. */ 1331219820Sjeff 1332219820Sjeff yyssp = yyss; 1333219820Sjeff yyvsp = yyvs; 1334219820Sjeff 1335219820Sjeff goto yysetstate; 1336219820Sjeff 1337219820Sjeff/*------------------------------------------------------------. 1338219820Sjeff| yynewstate -- Push a new state, which is found in yystate. | 1339219820Sjeff`------------------------------------------------------------*/ 1340219820Sjeff yynewstate: 1341219820Sjeff /* In all cases, when you get here, the value and location stacks 1342219820Sjeff have just been pushed. So pushing a state here evens the stacks. */ 1343219820Sjeff yyssp++; 1344219820Sjeff 1345219820Sjeff yysetstate: 1346219820Sjeff *yyssp = yystate; 1347219820Sjeff 1348219820Sjeff if (yyss + yystacksize - 1 <= yyssp) 1349219820Sjeff { 1350219820Sjeff /* Get the current used size of the three stacks, in elements. */ 1351219820Sjeff YYSIZE_T yysize = yyssp - yyss + 1; 1352219820Sjeff 1353219820Sjeff#ifdef yyoverflow 1354219820Sjeff { 1355219820Sjeff /* Give user a chance to reallocate the stack. Use copies of 1356219820Sjeff these so that the &'s don't force the real ones into 1357219820Sjeff memory. */ 1358219820Sjeff YYSTYPE *yyvs1 = yyvs; 1359219820Sjeff yytype_int16 *yyss1 = yyss; 1360219820Sjeff 1361219820Sjeff 1362219820Sjeff /* Each stack pointer address is followed by the size of the 1363219820Sjeff data in use in that stack, in bytes. This used to be a 1364219820Sjeff conditional around just the two extra args, but that might 1365219820Sjeff be undefined if yyoverflow is a macro. */ 1366219820Sjeff yyoverflow (YY_("memory exhausted"), 1367219820Sjeff &yyss1, yysize * sizeof (*yyssp), 1368219820Sjeff &yyvs1, yysize * sizeof (*yyvsp), 1369219820Sjeff 1370219820Sjeff &yystacksize); 1371219820Sjeff 1372219820Sjeff yyss = yyss1; 1373219820Sjeff yyvs = yyvs1; 1374219820Sjeff } 1375219820Sjeff#else /* no yyoverflow */ 1376219820Sjeff# ifndef YYSTACK_RELOCATE 1377219820Sjeff goto yyexhaustedlab; 1378219820Sjeff# else 1379219820Sjeff /* Extend the stack our own way. */ 1380219820Sjeff if (YYMAXDEPTH <= yystacksize) 1381219820Sjeff goto yyexhaustedlab; 1382219820Sjeff yystacksize *= 2; 1383219820Sjeff if (YYMAXDEPTH < yystacksize) 1384219820Sjeff yystacksize = YYMAXDEPTH; 1385219820Sjeff 1386219820Sjeff { 1387219820Sjeff yytype_int16 *yyss1 = yyss; 1388219820Sjeff union yyalloc *yyptr = 1389219820Sjeff (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1390219820Sjeff if (! yyptr) 1391219820Sjeff goto yyexhaustedlab; 1392219820Sjeff YYSTACK_RELOCATE (yyss); 1393219820Sjeff YYSTACK_RELOCATE (yyvs); 1394219820Sjeff 1395219820Sjeff# undef YYSTACK_RELOCATE 1396219820Sjeff if (yyss1 != yyssa) 1397219820Sjeff YYSTACK_FREE (yyss1); 1398219820Sjeff } 1399219820Sjeff# endif 1400219820Sjeff#endif /* no yyoverflow */ 1401219820Sjeff 1402219820Sjeff yyssp = yyss + yysize - 1; 1403219820Sjeff yyvsp = yyvs + yysize - 1; 1404219820Sjeff 1405219820Sjeff 1406219820Sjeff YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1407219820Sjeff (unsigned long int) yystacksize)); 1408219820Sjeff 1409219820Sjeff if (yyss + yystacksize - 1 <= yyssp) 1410219820Sjeff YYABORT; 1411219820Sjeff } 1412219820Sjeff 1413219820Sjeff YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1414219820Sjeff 1415219820Sjeff goto yybackup; 1416219820Sjeff 1417219820Sjeff/*-----------. 1418219820Sjeff| yybackup. | 1419219820Sjeff`-----------*/ 1420219820Sjeffyybackup: 1421219820Sjeff 1422219820Sjeff /* Do appropriate processing given the current state. Read a 1423219820Sjeff look-ahead token if we need one and don't already have one. */ 1424219820Sjeff 1425219820Sjeff /* First try to decide what to do without reference to look-ahead token. */ 1426219820Sjeff yyn = yypact[yystate]; 1427219820Sjeff if (yyn == YYPACT_NINF) 1428219820Sjeff goto yydefault; 1429219820Sjeff 1430219820Sjeff /* Not known => get a look-ahead token if don't already have one. */ 1431219820Sjeff 1432219820Sjeff /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ 1433219820Sjeff if (yychar == YYEMPTY) 1434219820Sjeff { 1435219820Sjeff YYDPRINTF ((stderr, "Reading a token: ")); 1436219820Sjeff yychar = YYLEX; 1437219820Sjeff } 1438219820Sjeff 1439219820Sjeff if (yychar <= YYEOF) 1440219820Sjeff { 1441219820Sjeff yychar = yytoken = YYEOF; 1442219820Sjeff YYDPRINTF ((stderr, "Now at end of input.\n")); 1443219820Sjeff } 1444219820Sjeff else 1445219820Sjeff { 1446219820Sjeff yytoken = YYTRANSLATE (yychar); 1447219820Sjeff YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1448219820Sjeff } 1449219820Sjeff 1450219820Sjeff /* If the proper action on seeing token YYTOKEN is to reduce or to 1451219820Sjeff detect an error, take that action. */ 1452219820Sjeff yyn += yytoken; 1453219820Sjeff if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1454219820Sjeff goto yydefault; 1455219820Sjeff yyn = yytable[yyn]; 1456219820Sjeff if (yyn <= 0) 1457219820Sjeff { 1458219820Sjeff if (yyn == 0 || yyn == YYTABLE_NINF) 1459219820Sjeff goto yyerrlab; 1460219820Sjeff yyn = -yyn; 1461219820Sjeff goto yyreduce; 1462219820Sjeff } 1463219820Sjeff 1464219820Sjeff if (yyn == YYFINAL) 1465219820Sjeff YYACCEPT; 1466219820Sjeff 1467219820Sjeff /* Count tokens shifted since error; after three, turn off error 1468219820Sjeff status. */ 1469219820Sjeff if (yyerrstatus) 1470219820Sjeff yyerrstatus--; 1471219820Sjeff 1472219820Sjeff /* Shift the look-ahead token. */ 1473219820Sjeff YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1474219820Sjeff 1475219820Sjeff /* Discard the shifted token unless it is eof. */ 1476219820Sjeff if (yychar != YYEOF) 1477219820Sjeff yychar = YYEMPTY; 1478219820Sjeff 1479219820Sjeff yystate = yyn; 1480219820Sjeff *++yyvsp = yylval; 1481219820Sjeff 1482219820Sjeff goto yynewstate; 1483219820Sjeff 1484219820Sjeff 1485219820Sjeff/*-----------------------------------------------------------. 1486219820Sjeff| yydefault -- do the default action for the current state. | 1487219820Sjeff`-----------------------------------------------------------*/ 1488219820Sjeffyydefault: 1489219820Sjeff yyn = yydefact[yystate]; 1490219820Sjeff if (yyn == 0) 1491219820Sjeff goto yyerrlab; 1492219820Sjeff goto yyreduce; 1493219820Sjeff 1494219820Sjeff 1495219820Sjeff/*-----------------------------. 1496219820Sjeff| yyreduce -- Do a reduction. | 1497219820Sjeff`-----------------------------*/ 1498219820Sjeffyyreduce: 1499219820Sjeff /* yyn is the number of a rule to reduce with. */ 1500219820Sjeff yylen = yyr2[yyn]; 1501219820Sjeff 1502219820Sjeff /* If YYLEN is nonzero, implement the default value of the action: 1503219820Sjeff `$$ = $1'. 1504219820Sjeff 1505219820Sjeff Otherwise, the following line sets YYVAL to garbage. 1506219820Sjeff This behavior is undocumented and Bison 1507219820Sjeff users should not rely upon it. Assigning to YYVAL 1508219820Sjeff unconditionally makes the parser a bit smaller, and it avoids a 1509219820Sjeff GCC warning that YYVAL may be used uninitialized. */ 1510219820Sjeff yyval = yyvsp[1-yylen]; 1511219820Sjeff 1512219820Sjeff 1513219820Sjeff YY_REDUCE_PRINT (yyn); 1514219820Sjeff switch (yyn) 1515219820Sjeff { 1516219820Sjeff case 15: 1517219820Sjeff#line 227 "./config_parser.y" 1518219820Sjeff { __sdp_log_set_log_stderr(); } 1519219820Sjeff break; 1520219820Sjeff 1521219820Sjeff case 16: 1522219820Sjeff#line 228 "./config_parser.y" 1523219820Sjeff { __sdp_log_set_log_syslog(); } 1524219820Sjeff break; 1525219820Sjeff 1526219820Sjeff case 17: 1527219820Sjeff#line 229 "./config_parser.y" 1528219820Sjeff { __sdp_log_set_log_file((yyvsp[(3) - (3)].sval)); } 1529219820Sjeff break; 1530219820Sjeff 1531219820Sjeff case 18: 1532219820Sjeff#line 233 "./config_parser.y" 1533219820Sjeff { __sdp_log_set_min_level((yyvsp[(2) - (2)].ival)); } 1534219820Sjeff break; 1535219820Sjeff 1536219820Sjeff case 19: 1537219820Sjeff#line 237 "./config_parser.y" 1538219820Sjeff { __sdp_add_rule(); } 1539219820Sjeff break; 1540219820Sjeff 1541219820Sjeff case 20: 1542219820Sjeff#line 241 "./config_parser.y" 1543219820Sjeff { __sdp_rule.target_family = USE_TCP; } 1544219820Sjeff break; 1545219820Sjeff 1546219820Sjeff case 21: 1547219820Sjeff#line 242 "./config_parser.y" 1548219820Sjeff { __sdp_rule.target_family = USE_SDP; } 1549219820Sjeff break; 1550219820Sjeff 1551219820Sjeff case 22: 1552219820Sjeff#line 243 "./config_parser.y" 1553219820Sjeff { __sdp_rule.target_family = USE_BOTH; } 1554219820Sjeff break; 1555219820Sjeff 1556219820Sjeff case 23: 1557219820Sjeff#line 247 "./config_parser.y" 1558219820Sjeff { current_role = 1; } 1559219820Sjeff break; 1560219820Sjeff 1561219820Sjeff case 24: 1562219820Sjeff#line 248 "./config_parser.y" 1563219820Sjeff { current_role = 2; } 1564219820Sjeff break; 1565219820Sjeff 1566219820Sjeff case 25: 1567219820Sjeff#line 252 "./config_parser.y" 1568219820Sjeff { __sdp_set_prog_name_expr((yyvsp[(1) - (1)].sval)); } 1569219820Sjeff break; 1570219820Sjeff 1571219820Sjeff case 26: 1572219820Sjeff#line 253 "./config_parser.y" 1573219820Sjeff { __sdp_set_prog_name_expr("*"); } 1574219820Sjeff break; 1575219820Sjeff 1576219820Sjeff case 27: 1577219820Sjeff#line 257 "./config_parser.y" 1578219820Sjeff { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = 32; } 1579219820Sjeff break; 1580219820Sjeff 1581219820Sjeff case 28: 1582219820Sjeff#line 258 "./config_parser.y" 1583219820Sjeff { __sdp_rule.match_by_addr = 1; __sdp_rule.prefixlen = (yyvsp[(3) - (3)].ival); } 1584219820Sjeff break; 1585219820Sjeff 1586219820Sjeff case 29: 1587219820Sjeff#line 259 "./config_parser.y" 1588219820Sjeff { __sdp_rule.match_by_addr = 0; __sdp_rule.prefixlen = 32; } 1589219820Sjeff break; 1590219820Sjeff 1591219820Sjeff case 30: 1592219820Sjeff#line 263 "./config_parser.y" 1593219820Sjeff { __sdp_set_ipv4_addr((yyvsp[(1) - (7)].ival),(yyvsp[(3) - (7)].ival),(yyvsp[(5) - (7)].ival),(yyvsp[(7) - (7)].ival)); } 1594219820Sjeff break; 1595219820Sjeff 1596219820Sjeff case 31: 1597219820Sjeff#line 267 "./config_parser.y" 1598219820Sjeff { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (1)].ival); __sdp_rule.eport= (yyvsp[(1) - (1)].ival); } 1599219820Sjeff break; 1600219820Sjeff 1601219820Sjeff case 32: 1602219820Sjeff#line 268 "./config_parser.y" 1603219820Sjeff { __sdp_rule.match_by_port = 1; __sdp_rule.sport= (yyvsp[(1) - (3)].ival); __sdp_rule.eport= (yyvsp[(3) - (3)].ival); } 1604219820Sjeff break; 1605219820Sjeff 1606219820Sjeff case 33: 1607219820Sjeff#line 269 "./config_parser.y" 1608219820Sjeff { __sdp_rule.match_by_port = 0; __sdp_rule.sport= 0 ; __sdp_rule.eport= 0; } 1609219820Sjeff break; 1610219820Sjeff 1611219820Sjeff 1612219820Sjeff/* Line 1267 of yacc.c. */ 1613219820Sjeff#line 1614 "y.tab.c" 1614219820Sjeff default: break; 1615219820Sjeff } 1616219820Sjeff YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 1617219820Sjeff 1618219820Sjeff YYPOPSTACK (yylen); 1619219820Sjeff yylen = 0; 1620219820Sjeff YY_STACK_PRINT (yyss, yyssp); 1621219820Sjeff 1622219820Sjeff *++yyvsp = yyval; 1623219820Sjeff 1624219820Sjeff 1625219820Sjeff /* Now `shift' the result of the reduction. Determine what state 1626219820Sjeff that goes to, based on the state we popped back to and the rule 1627219820Sjeff number reduced by. */ 1628219820Sjeff 1629219820Sjeff yyn = yyr1[yyn]; 1630219820Sjeff 1631219820Sjeff yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 1632219820Sjeff if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1633219820Sjeff yystate = yytable[yystate]; 1634219820Sjeff else 1635219820Sjeff yystate = yydefgoto[yyn - YYNTOKENS]; 1636219820Sjeff 1637219820Sjeff goto yynewstate; 1638219820Sjeff 1639219820Sjeff 1640219820Sjeff/*------------------------------------. 1641219820Sjeff| yyerrlab -- here on detecting error | 1642219820Sjeff`------------------------------------*/ 1643219820Sjeffyyerrlab: 1644219820Sjeff /* If not already recovering from an error, report this error. */ 1645219820Sjeff if (!yyerrstatus) 1646219820Sjeff { 1647219820Sjeff ++yynerrs; 1648219820Sjeff#if ! YYERROR_VERBOSE 1649219820Sjeff yyerror (YY_("syntax error")); 1650219820Sjeff#else 1651219820Sjeff { 1652219820Sjeff YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 1653219820Sjeff if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 1654219820Sjeff { 1655219820Sjeff YYSIZE_T yyalloc = 2 * yysize; 1656219820Sjeff if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 1657219820Sjeff yyalloc = YYSTACK_ALLOC_MAXIMUM; 1658219820Sjeff if (yymsg != yymsgbuf) 1659219820Sjeff YYSTACK_FREE (yymsg); 1660219820Sjeff yymsg = (char *) YYSTACK_ALLOC (yyalloc); 1661219820Sjeff if (yymsg) 1662219820Sjeff yymsg_alloc = yyalloc; 1663219820Sjeff else 1664219820Sjeff { 1665219820Sjeff yymsg = yymsgbuf; 1666219820Sjeff yymsg_alloc = sizeof yymsgbuf; 1667219820Sjeff } 1668219820Sjeff } 1669219820Sjeff 1670219820Sjeff if (0 < yysize && yysize <= yymsg_alloc) 1671219820Sjeff { 1672219820Sjeff (void) yysyntax_error (yymsg, yystate, yychar); 1673219820Sjeff yyerror (yymsg); 1674219820Sjeff } 1675219820Sjeff else 1676219820Sjeff { 1677219820Sjeff yyerror (YY_("syntax error")); 1678219820Sjeff if (yysize != 0) 1679219820Sjeff goto yyexhaustedlab; 1680219820Sjeff } 1681219820Sjeff } 1682219820Sjeff#endif 1683219820Sjeff } 1684219820Sjeff 1685219820Sjeff 1686219820Sjeff 1687219820Sjeff if (yyerrstatus == 3) 1688219820Sjeff { 1689219820Sjeff /* If just tried and failed to reuse look-ahead token after an 1690219820Sjeff error, discard it. */ 1691219820Sjeff 1692219820Sjeff if (yychar <= YYEOF) 1693219820Sjeff { 1694219820Sjeff /* Return failure if at end of input. */ 1695219820Sjeff if (yychar == YYEOF) 1696219820Sjeff YYABORT; 1697219820Sjeff } 1698219820Sjeff else 1699219820Sjeff { 1700219820Sjeff yydestruct ("Error: discarding", 1701219820Sjeff yytoken, &yylval); 1702219820Sjeff yychar = YYEMPTY; 1703219820Sjeff } 1704219820Sjeff } 1705219820Sjeff 1706219820Sjeff /* Else will try to reuse look-ahead token after shifting the error 1707219820Sjeff token. */ 1708219820Sjeff goto yyerrlab1; 1709219820Sjeff 1710219820Sjeff 1711219820Sjeff/*---------------------------------------------------. 1712219820Sjeff| yyerrorlab -- error raised explicitly by YYERROR. | 1713219820Sjeff`---------------------------------------------------*/ 1714219820Sjeffyyerrorlab: 1715219820Sjeff 1716219820Sjeff /* Pacify compilers like GCC when the user code never invokes 1717219820Sjeff YYERROR and the label yyerrorlab therefore never appears in user 1718219820Sjeff code. */ 1719219820Sjeff if (/*CONSTCOND*/ 0) 1720219820Sjeff goto yyerrorlab; 1721219820Sjeff 1722219820Sjeff /* Do not reclaim the symbols of the rule which action triggered 1723219820Sjeff this YYERROR. */ 1724219820Sjeff YYPOPSTACK (yylen); 1725219820Sjeff yylen = 0; 1726219820Sjeff YY_STACK_PRINT (yyss, yyssp); 1727219820Sjeff yystate = *yyssp; 1728219820Sjeff goto yyerrlab1; 1729219820Sjeff 1730219820Sjeff 1731219820Sjeff/*-------------------------------------------------------------. 1732219820Sjeff| yyerrlab1 -- common code for both syntax error and YYERROR. | 1733219820Sjeff`-------------------------------------------------------------*/ 1734219820Sjeffyyerrlab1: 1735219820Sjeff yyerrstatus = 3; /* Each real token shifted decrements this. */ 1736219820Sjeff 1737219820Sjeff for (;;) 1738219820Sjeff { 1739219820Sjeff yyn = yypact[yystate]; 1740219820Sjeff if (yyn != YYPACT_NINF) 1741219820Sjeff { 1742219820Sjeff yyn += YYTERROR; 1743219820Sjeff if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 1744219820Sjeff { 1745219820Sjeff yyn = yytable[yyn]; 1746219820Sjeff if (0 < yyn) 1747219820Sjeff break; 1748219820Sjeff } 1749219820Sjeff } 1750219820Sjeff 1751219820Sjeff /* Pop the current state because it cannot handle the error token. */ 1752219820Sjeff if (yyssp == yyss) 1753219820Sjeff YYABORT; 1754219820Sjeff 1755219820Sjeff 1756219820Sjeff yydestruct ("Error: popping", 1757219820Sjeff yystos[yystate], yyvsp); 1758219820Sjeff YYPOPSTACK (1); 1759219820Sjeff yystate = *yyssp; 1760219820Sjeff YY_STACK_PRINT (yyss, yyssp); 1761219820Sjeff } 1762219820Sjeff 1763219820Sjeff if (yyn == YYFINAL) 1764219820Sjeff YYACCEPT; 1765219820Sjeff 1766219820Sjeff *++yyvsp = yylval; 1767219820Sjeff 1768219820Sjeff 1769219820Sjeff /* Shift the error token. */ 1770219820Sjeff YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 1771219820Sjeff 1772219820Sjeff yystate = yyn; 1773219820Sjeff goto yynewstate; 1774219820Sjeff 1775219820Sjeff 1776219820Sjeff/*-------------------------------------. 1777219820Sjeff| yyacceptlab -- YYACCEPT comes here. | 1778219820Sjeff`-------------------------------------*/ 1779219820Sjeffyyacceptlab: 1780219820Sjeff yyresult = 0; 1781219820Sjeff goto yyreturn; 1782219820Sjeff 1783219820Sjeff/*-----------------------------------. 1784219820Sjeff| yyabortlab -- YYABORT comes here. | 1785219820Sjeff`-----------------------------------*/ 1786219820Sjeffyyabortlab: 1787219820Sjeff yyresult = 1; 1788219820Sjeff goto yyreturn; 1789219820Sjeff 1790219820Sjeff#ifndef yyoverflow 1791219820Sjeff/*-------------------------------------------------. 1792219820Sjeff| yyexhaustedlab -- memory exhaustion comes here. | 1793219820Sjeff`-------------------------------------------------*/ 1794219820Sjeffyyexhaustedlab: 1795219820Sjeff yyerror (YY_("memory exhausted")); 1796219820Sjeff yyresult = 2; 1797219820Sjeff /* Fall through. */ 1798219820Sjeff#endif 1799219820Sjeff 1800219820Sjeffyyreturn: 1801219820Sjeff if (yychar != YYEOF && yychar != YYEMPTY) 1802219820Sjeff yydestruct ("Cleanup: discarding lookahead", 1803219820Sjeff yytoken, &yylval); 1804219820Sjeff /* Do not reclaim the symbols of the rule which action triggered 1805219820Sjeff this YYABORT or YYACCEPT. */ 1806219820Sjeff YYPOPSTACK (yylen); 1807219820Sjeff YY_STACK_PRINT (yyss, yyssp); 1808219820Sjeff while (yyssp != yyss) 1809219820Sjeff { 1810219820Sjeff yydestruct ("Cleanup: popping", 1811219820Sjeff yystos[*yyssp], yyvsp); 1812219820Sjeff YYPOPSTACK (1); 1813219820Sjeff } 1814219820Sjeff#ifndef yyoverflow 1815219820Sjeff if (yyss != yyssa) 1816219820Sjeff YYSTACK_FREE (yyss); 1817219820Sjeff#endif 1818219820Sjeff#if YYERROR_VERBOSE 1819219820Sjeff if (yymsg != yymsgbuf) 1820219820Sjeff YYSTACK_FREE (yymsg); 1821219820Sjeff#endif 1822219820Sjeff /* Make sure YYID is used. */ 1823219820Sjeff return YYID (yyresult); 1824219820Sjeff} 1825219820Sjeff 1826219820Sjeff 1827219820Sjeff#line 272 "./config_parser.y" 1828219820Sjeff 1829219820Sjeff 1830219820Sjeffint yyerror(char *msg) 1831219820Sjeff{ 1832219820Sjeff /* replace the $undefined and $end if exists */ 1833219820Sjeff char *orig_msg = (char*)malloc(strlen(msg)+25); 1834219820Sjeff char *final_msg = (char*)malloc(strlen(msg)+25); 1835219820Sjeff 1836219820Sjeff strcpy(orig_msg, msg); 1837219820Sjeff 1838219820Sjeff char *word = strtok(orig_msg, " "); 1839219820Sjeff final_msg[0] = '\0'; 1840219820Sjeff while (word != NULL) { 1841219820Sjeff if (!strncmp(word, "$undefined", 10)) { 1842219820Sjeff strcat(final_msg, "unrecognized-token "); 1843219820Sjeff } else if (!strncmp(word, "$end",4)) { 1844219820Sjeff strcat(final_msg, "end-of-file "); 1845219820Sjeff } else { 1846219820Sjeff strcat(final_msg, word); 1847219820Sjeff strcat(final_msg, " "); 1848219820Sjeff } 1849219820Sjeff word = strtok(NULL, " "); 1850219820Sjeff } 1851219820Sjeff 1852219820Sjeff __sdp_log(9, "Error (line:%ld) : %s\n", __sdp_config_line_num, final_msg); 1853219820Sjeff parse_err = 1; 1854219820Sjeff 1855219820Sjeff free(orig_msg); 1856219820Sjeff free(final_msg); 1857219820Sjeff return 1; 1858219820Sjeff} 1859219820Sjeff 1860219820Sjeff#include <unistd.h> 1861219820Sjeff#include <errno.h> 1862219820Sjeff 1863219820Sjeff/* parse apollo route dump file */ 1864219820Sjeffint __sdp_parse_config (const char *fileName) { 1865219820Sjeff extern FILE * libsdp_yyin; 1866219820Sjeff 1867219820Sjeff /* open the file */ 1868219820Sjeff if (access(fileName, R_OK)) { 1869219820Sjeff printf("libsdp Error: No access to open File:%s %s\n", 1870219820Sjeff fileName, strerror(errno)); 1871219820Sjeff return(1); 1872219820Sjeff } 1873219820Sjeff 1874219820Sjeff libsdp_yyin = fopen(fileName,"r"); 1875219820Sjeff if (!libsdp_yyin) { 1876219820Sjeff printf("libsdp Error: Fail to open File:%s\n", fileName); 1877219820Sjeff return(1); 1878219820Sjeff } 1879219820Sjeff parse_err = 0; 1880219820Sjeff __sdp_config_line_num = 1; 1881219820Sjeff 1882219820Sjeff /* parse it */ 1883219820Sjeff yyparse(); 1884219820Sjeff 1885219820Sjeff fclose(libsdp_yyin); 1886219820Sjeff return(parse_err); 1887219820Sjeff} 1888219820Sjeff 1889219820Sjeff 1890219820Sjeff 1891