Annotation of embedaddon/strongswan/src/starter/parser/parser.c, revision 1.1.1.2

1.1       misho       1: /* A Bison parser, made by GNU Bison 3.0.4.  */
                      2: 
                      3: /* Bison implementation for Yacc-like parsers in C
                      4: 
                      5:    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
                      6: 
                      7:    This program is free software: you can redistribute it and/or modify
                      8:    it under the terms of the GNU General Public License as published by
                      9:    the Free Software Foundation, either version 3 of the License, or
                     10:    (at your option) any later version.
                     11: 
                     12:    This program is distributed in the hope that it will be useful,
                     13:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15:    GNU General Public License for more details.
                     16: 
                     17:    You should have received a copy of the GNU General Public License
                     18:    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
                     19: 
                     20: /* As a special exception, you may create a larger work that contains
                     21:    part or all of the Bison parser skeleton and distribute that work
                     22:    under terms of your choice, so long as that work isn't itself a
                     23:    parser generator using the skeleton or a modified version thereof
                     24:    as a parser skeleton.  Alternatively, if you modify or redistribute
                     25:    the parser skeleton itself, you may (at your option) remove this
                     26:    special exception, which will cause the skeleton and the resulting
                     27:    Bison output files to be licensed under the GNU General Public
                     28:    License without this special exception.
                     29: 
                     30:    This special exception was added by the Free Software Foundation in
                     31:    version 2.2 of Bison.  */
                     32: 
                     33: /* C LALR(1) parser skeleton written by Richard Stallman, by
                     34:    simplifying the original so-called "semantic" parser.  */
                     35: 
                     36: /* All symbols defined below should begin with yy or YY, to avoid
                     37:    infringing on user name space.  This should be done even for local
                     38:    variables, as they might otherwise be expanded by user macros.
                     39:    There are some unavoidable exceptions within include files to
                     40:    define necessary library symbols; they are noted "INFRINGES ON
                     41:    USER NAME SPACE" below.  */
                     42: 
                     43: /* Identify Bison output.  */
                     44: #define YYBISON 1
                     45: 
                     46: /* Bison version.  */
                     47: #define YYBISON_VERSION "3.0.4"
                     48: 
                     49: /* Skeleton name.  */
                     50: #define YYSKELETON_NAME "yacc.c"
                     51: 
                     52: /* Pure parsers.  */
                     53: #define YYPURE 1
                     54: 
                     55: /* Push parsers.  */
                     56: #define YYPUSH 0
                     57: 
                     58: /* Pull parsers.  */
                     59: #define YYPULL 1
                     60: 
1.1.1.2 ! misho      61: /* Substitute the type names.  */
        !            62: #define YYSTYPE         CONF_PARSER_STYPE
1.1       misho      63: /* Substitute the variable and function names.  */
                     64: #define yyparse         conf_parser_parse
                     65: #define yylex           conf_parser_lex
                     66: #define yyerror         conf_parser_error
                     67: #define yydebug         conf_parser_debug
                     68: #define yynerrs         conf_parser_nerrs
                     69: 
                     70: 
                     71: /* Copy the first part of user declarations.  */
                     72: #line 1 "parser/parser.y" /* yacc.c:339  */
                     73: 
                     74: /*
                     75:  * Copyright (C) 2013-2014 Tobias Brunner
                     76:  * HSR Hochschule fuer Technik Rapperswil
                     77:  *
                     78:  * This program is free software; you can redistribute it and/or modify it
                     79:  * under the terms of the GNU General Public License as published by the
                     80:  * Free Software Foundation; either version 2 of the License, or (at your
                     81:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
                     82:  *
                     83:  * This program is distributed in the hope that it will be useful, but
                     84:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     85:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
                     86:  * for more details.
                     87:  */
                     88: 
                     89: #define _GNU_SOURCE /* for asprintf() */
                     90: #include <stdio.h>
                     91: 
                     92: #include <utils/parser_helper.h>
                     93: #include <settings/settings_types.h>
                     94: #include <parser/conf_parser.h>
                     95: 
                     96: #include "parser.h"
                     97: 
                     98: #define YYDEBUG 1
                     99: 
                    100: /**
                    101:  * Defined by the lexer
                    102:  */
                    103: int conf_parser_lex(YYSTYPE *lvalp, void *scanner);
                    104: int conf_parser_lex_init_extra(parser_helper_t *extra, void *scanner);
                    105: int conf_parser_lex_destroy(void *scanner);
                    106: int conf_parser_set_in(FILE *in, void *scanner);
                    107: void conf_parser_set_debug(int debug, void *scanner);
                    108: char *conf_parser_get_text(void *scanner);
                    109: int conf_parser_get_leng(void *scanner);
                    110: int conf_parser_get_lineno(void *scanner);
                    111: /* Custom functions in lexer */
                    112: bool conf_parser_open_next_file(parser_helper_t *ctx);
                    113: 
                    114: /**
                    115:  * Forward declaration
                    116:  */
                    117: static void conf_parser_error(parser_helper_t *ctx, const char *s);
                    118: 
                    119: /**
                    120:  * Make sure to call lexer with the proper context
                    121:  */
                    122: #undef yylex
1.1.1.2 ! misho     123: static int yylex(CONF_PARSER_STYPE *yylval, parser_helper_t *ctx)
1.1       misho     124: {
1.1.1.2 ! misho     125:        return conf_parser_lex(yylval, ctx->scanner);
1.1       misho     126: }
                    127: 
                    128: 
1.1.1.2 ! misho     129: #line 130 "parser/parser.c" /* yacc.c:339  */
1.1       misho     130: 
                    131: # ifndef YY_NULLPTR
                    132: #  if defined __cplusplus && 201103L <= __cplusplus
                    133: #   define YY_NULLPTR nullptr
                    134: #  else
                    135: #   define YY_NULLPTR 0
                    136: #  endif
                    137: # endif
                    138: 
                    139: /* Enabling verbose error messages.  */
                    140: #ifdef YYERROR_VERBOSE
                    141: # undef YYERROR_VERBOSE
                    142: # define YYERROR_VERBOSE 1
                    143: #else
                    144: # define YYERROR_VERBOSE 1
                    145: #endif
                    146: 
                    147: /* In a future release of Bison, this section will be replaced
                    148:    by #include "y.tab.h".  */
                    149: #ifndef YY_CONF_PARSER_PARSER_PARSER_H_INCLUDED
                    150: # define YY_CONF_PARSER_PARSER_PARSER_H_INCLUDED
                    151: /* Debug traces.  */
1.1.1.2 ! misho     152: #ifndef CONF_PARSER_DEBUG
        !           153: # if defined YYDEBUG
1.1       misho     154: #if YYDEBUG
1.1.1.2 ! misho     155: #   define CONF_PARSER_DEBUG 1
        !           156: #  else
        !           157: #   define CONF_PARSER_DEBUG 0
        !           158: #  endif
        !           159: # else /* ! defined YYDEBUG */
        !           160: #  define CONF_PARSER_DEBUG 1
        !           161: # endif /* ! defined YYDEBUG */
        !           162: #endif  /* ! defined CONF_PARSER_DEBUG */
        !           163: #if CONF_PARSER_DEBUG
1.1       misho     164: extern int conf_parser_debug;
                    165: #endif
                    166: 
                    167: /* Token type.  */
1.1.1.2 ! misho     168: #ifndef CONF_PARSER_TOKENTYPE
        !           169: # define CONF_PARSER_TOKENTYPE
        !           170:   enum conf_parser_tokentype
1.1       misho     171:   {
                    172:     STRING = 258,
                    173:     EQ = 259,
                    174:     SPACES = 260,
                    175:     NEWLINE = 261,
                    176:     CONFIG_SETUP = 262,
                    177:     CONN = 263,
                    178:     CA = 264,
                    179:     STRING_ERROR = 265
                    180:   };
                    181: #endif
                    182: /* Tokens.  */
                    183: #define STRING 258
                    184: #define EQ 259
                    185: #define SPACES 260
                    186: #define NEWLINE 261
                    187: #define CONFIG_SETUP 262
                    188: #define CONN 263
                    189: #define CA 264
                    190: #define STRING_ERROR 265
                    191: 
                    192: /* Value type.  */
1.1.1.2 ! misho     193: #if ! defined CONF_PARSER_STYPE && ! defined CONF_PARSER_STYPE_IS_DECLARED
1.1       misho     194: 
1.1.1.2 ! misho     195: union CONF_PARSER_STYPE
1.1       misho     196: {
1.1.1.2 ! misho     197: #line 78 "parser/parser.y" /* yacc.c:355  */
1.1       misho     198: 
                    199:        char *s;
                    200:        conf_parser_section_t t;
                    201: 
1.1.1.2 ! misho     202: #line 203 "parser/parser.c" /* yacc.c:355  */
1.1       misho     203: };
                    204: 
1.1.1.2 ! misho     205: typedef union CONF_PARSER_STYPE CONF_PARSER_STYPE;
        !           206: # define CONF_PARSER_STYPE_IS_TRIVIAL 1
        !           207: # define CONF_PARSER_STYPE_IS_DECLARED 1
1.1       misho     208: #endif
                    209: 
                    210: 
                    211: 
                    212: int conf_parser_parse (parser_helper_t *ctx);
1.1.1.2 ! misho     213: /* "%code provides" blocks.  */
        !           214: #line 67 "parser/parser.y" /* yacc.c:355  */
        !           215: 
        !           216:        #define YY_DECL \
        !           217:                int conf_parser_lex(CONF_PARSER_STYPE *yylval, void *yyscanner)
        !           218:        YY_DECL;
        !           219: 
        !           220: #line 221 "parser/parser.c" /* yacc.c:355  */
1.1       misho     221: 
                    222: #endif /* !YY_CONF_PARSER_PARSER_PARSER_H_INCLUDED  */
                    223: 
                    224: /* Copy the second part of user declarations.  */
                    225: 
1.1.1.2 ! misho     226: #line 227 "parser/parser.c" /* yacc.c:358  */
1.1       misho     227: 
                    228: #ifdef short
                    229: # undef short
                    230: #endif
                    231: 
                    232: #ifdef YYTYPE_UINT8
                    233: typedef YYTYPE_UINT8 yytype_uint8;
                    234: #else
                    235: typedef unsigned char yytype_uint8;
                    236: #endif
                    237: 
                    238: #ifdef YYTYPE_INT8
                    239: typedef YYTYPE_INT8 yytype_int8;
                    240: #else
                    241: typedef signed char yytype_int8;
                    242: #endif
                    243: 
                    244: #ifdef YYTYPE_UINT16
                    245: typedef YYTYPE_UINT16 yytype_uint16;
                    246: #else
                    247: typedef unsigned short int yytype_uint16;
                    248: #endif
                    249: 
                    250: #ifdef YYTYPE_INT16
                    251: typedef YYTYPE_INT16 yytype_int16;
                    252: #else
                    253: typedef short int yytype_int16;
                    254: #endif
                    255: 
                    256: #ifndef YYSIZE_T
                    257: # ifdef __SIZE_TYPE__
                    258: #  define YYSIZE_T __SIZE_TYPE__
                    259: # elif defined size_t
                    260: #  define YYSIZE_T size_t
                    261: # elif ! defined YYSIZE_T
                    262: #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
                    263: #  define YYSIZE_T size_t
                    264: # else
                    265: #  define YYSIZE_T unsigned int
                    266: # endif
                    267: #endif
                    268: 
                    269: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
                    270: 
                    271: #ifndef YY_
                    272: # if defined YYENABLE_NLS && YYENABLE_NLS
                    273: #  if ENABLE_NLS
                    274: #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
                    275: #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
                    276: #  endif
                    277: # endif
                    278: # ifndef YY_
                    279: #  define YY_(Msgid) Msgid
                    280: # endif
                    281: #endif
                    282: 
                    283: #ifndef YY_ATTRIBUTE
                    284: # if (defined __GNUC__                                               \
                    285:       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
                    286:      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
                    287: #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
                    288: # else
                    289: #  define YY_ATTRIBUTE(Spec) /* empty */
                    290: # endif
                    291: #endif
                    292: 
                    293: #ifndef YY_ATTRIBUTE_PURE
                    294: # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
                    295: #endif
                    296: 
                    297: #ifndef YY_ATTRIBUTE_UNUSED
                    298: # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
                    299: #endif
                    300: 
                    301: #if !defined _Noreturn \
                    302:      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
                    303: # if defined _MSC_VER && 1200 <= _MSC_VER
                    304: #  define _Noreturn __declspec (noreturn)
                    305: # else
                    306: #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
                    307: # endif
                    308: #endif
                    309: 
                    310: /* Suppress unused-variable warnings by "using" E.  */
                    311: #if ! defined lint || defined __GNUC__
                    312: # define YYUSE(E) ((void) (E))
                    313: #else
                    314: # define YYUSE(E) /* empty */
                    315: #endif
                    316: 
                    317: #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
                    318: /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
                    319: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
                    320:     _Pragma ("GCC diagnostic push") \
                    321:     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
                    322:     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
                    323: # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
                    324:     _Pragma ("GCC diagnostic pop")
                    325: #else
                    326: # define YY_INITIAL_VALUE(Value) Value
                    327: #endif
                    328: #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                    329: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                    330: # define YY_IGNORE_MAYBE_UNINITIALIZED_END
                    331: #endif
                    332: #ifndef YY_INITIAL_VALUE
                    333: # define YY_INITIAL_VALUE(Value) /* Nothing. */
                    334: #endif
                    335: 
                    336: 
                    337: #if ! defined yyoverflow || YYERROR_VERBOSE
                    338: 
                    339: /* The parser invokes alloca or malloc; define the necessary symbols.  */
                    340: 
                    341: # ifdef YYSTACK_USE_ALLOCA
                    342: #  if YYSTACK_USE_ALLOCA
                    343: #   ifdef __GNUC__
                    344: #    define YYSTACK_ALLOC __builtin_alloca
                    345: #   elif defined __BUILTIN_VA_ARG_INCR
                    346: #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
                    347: #   elif defined _AIX
                    348: #    define YYSTACK_ALLOC __alloca
                    349: #   elif defined _MSC_VER
                    350: #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
                    351: #    define alloca _alloca
                    352: #   else
                    353: #    define YYSTACK_ALLOC alloca
                    354: #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
                    355: #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
                    356:       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
                    357: #     ifndef EXIT_SUCCESS
                    358: #      define EXIT_SUCCESS 0
                    359: #     endif
                    360: #    endif
                    361: #   endif
                    362: #  endif
                    363: # endif
                    364: 
                    365: # ifdef YYSTACK_ALLOC
                    366:    /* Pacify GCC's 'empty if-body' warning.  */
                    367: #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
                    368: #  ifndef YYSTACK_ALLOC_MAXIMUM
                    369:     /* The OS might guarantee only one guard page at the bottom of the stack,
                    370:        and a page size can be as small as 4096 bytes.  So we cannot safely
                    371:        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
                    372:        to allow for a few compiler-allocated temporary stack slots.  */
                    373: #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
                    374: #  endif
                    375: # else
                    376: #  define YYSTACK_ALLOC YYMALLOC
                    377: #  define YYSTACK_FREE YYFREE
                    378: #  ifndef YYSTACK_ALLOC_MAXIMUM
                    379: #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
                    380: #  endif
                    381: #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
                    382:        && ! ((defined YYMALLOC || defined malloc) \
                    383:              && (defined YYFREE || defined free)))
                    384: #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
                    385: #   ifndef EXIT_SUCCESS
                    386: #    define EXIT_SUCCESS 0
                    387: #   endif
                    388: #  endif
                    389: #  ifndef YYMALLOC
                    390: #   define YYMALLOC malloc
                    391: #   if ! defined malloc && ! defined EXIT_SUCCESS
                    392: void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
                    393: #   endif
                    394: #  endif
                    395: #  ifndef YYFREE
                    396: #   define YYFREE free
                    397: #   if ! defined free && ! defined EXIT_SUCCESS
                    398: void free (void *); /* INFRINGES ON USER NAME SPACE */
                    399: #   endif
                    400: #  endif
                    401: # endif
                    402: #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
                    403: 
                    404: 
                    405: #if (! defined yyoverflow \
                    406:      && (! defined __cplusplus \
1.1.1.2 ! misho     407:          || (defined CONF_PARSER_STYPE_IS_TRIVIAL && CONF_PARSER_STYPE_IS_TRIVIAL)))
1.1       misho     408: 
                    409: /* A type that is properly aligned for any stack member.  */
                    410: union yyalloc
                    411: {
                    412:   yytype_int16 yyss_alloc;
                    413:   YYSTYPE yyvs_alloc;
                    414: };
                    415: 
                    416: /* The size of the maximum gap between one aligned stack and the next.  */
                    417: # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
                    418: 
                    419: /* The size of an array large to enough to hold all stacks, each with
                    420:    N elements.  */
                    421: # define YYSTACK_BYTES(N) \
                    422:      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
                    423:       + YYSTACK_GAP_MAXIMUM)
                    424: 
                    425: # define YYCOPY_NEEDED 1
                    426: 
                    427: /* Relocate STACK from its old location to the new one.  The
                    428:    local variables YYSIZE and YYSTACKSIZE give the old and new number of
                    429:    elements in the stack, and YYPTR gives the new location of the
                    430:    stack.  Advance YYPTR to a properly aligned location for the next
                    431:    stack.  */
                    432: # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
                    433:     do                                                                  \
                    434:       {                                                                 \
                    435:         YYSIZE_T yynewbytes;                                            \
                    436:         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
                    437:         Stack = &yyptr->Stack_alloc;                                    \
                    438:         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
                    439:         yyptr += yynewbytes / sizeof (*yyptr);                          \
                    440:       }                                                                 \
                    441:     while (0)
                    442: 
                    443: #endif
                    444: 
                    445: #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
                    446: /* Copy COUNT objects from SRC to DST.  The source and destination do
                    447:    not overlap.  */
                    448: # ifndef YYCOPY
                    449: #  if defined __GNUC__ && 1 < __GNUC__
                    450: #   define YYCOPY(Dst, Src, Count) \
                    451:       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
                    452: #  else
                    453: #   define YYCOPY(Dst, Src, Count)              \
                    454:       do                                        \
                    455:         {                                       \
                    456:           YYSIZE_T yyi;                         \
                    457:           for (yyi = 0; yyi < (Count); yyi++)   \
                    458:             (Dst)[yyi] = (Src)[yyi];            \
                    459:         }                                       \
                    460:       while (0)
                    461: #  endif
                    462: # endif
                    463: #endif /* !YYCOPY_NEEDED */
                    464: 
                    465: /* YYFINAL -- State number of the termination state.  */
                    466: #define YYFINAL  2
                    467: /* YYLAST -- Last index in YYTABLE.  */
                    468: #define YYLAST   11
                    469: 
                    470: /* YYNTOKENS -- Number of terminals.  */
                    471: #define YYNTOKENS  11
                    472: /* YYNNTS -- Number of nonterminals.  */
                    473: #define YYNNTS  8
                    474: /* YYNRULES -- Number of rules.  */
                    475: #define YYNRULES  18
                    476: /* YYNSTATES -- Number of states.  */
                    477: #define YYNSTATES  19
                    478: 
                    479: /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
                    480:    by yylex, with out-of-bounds checking.  */
                    481: #define YYUNDEFTOK  2
                    482: #define YYMAXUTOK   265
                    483: 
                    484: #define YYTRANSLATE(YYX)                                                \
                    485:   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
                    486: 
                    487: /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
                    488:    as returned by yylex, without out-of-bounds checking.  */
                    489: static const yytype_uint8 yytranslate[] =
                    490: {
                    491:        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    492:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    493:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    494:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    495:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    496:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    497:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    498:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    499:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    500:        2,     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,     1,     2,     3,     4,
                    517:        5,     6,     7,     8,     9,    10
                    518: };
                    519: 
1.1.1.2 ! misho     520: #if CONF_PARSER_DEBUG
1.1       misho     521:   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
                    522: static const yytype_uint8 yyrline[] =
                    523: {
1.1.1.2 ! misho     524:        0,   104,   104,   106,   107,   111,   112,   116,   130,   135,
        !           525:      140,   148,   151,   157,   160,   173,   185,   194,   195
1.1       misho     526: };
                    527: #endif
                    528: 
1.1.1.2 ! misho     529: #if CONF_PARSER_DEBUG || YYERROR_VERBOSE || 1
1.1       misho     530: /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
                    531:    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
                    532: static const char *const yytname[] =
                    533: {
                    534:   "$end", "error", "$undefined", "STRING", "EQ", "SPACES", "NEWLINE",
                    535:   "CONFIG_SETUP", "CONN", "CA", "STRING_ERROR", "$accept", "statements",
                    536:   "statement", "section", "section_type", "section_name", "setting",
                    537:   "value", YY_NULLPTR
                    538: };
                    539: #endif
                    540: 
                    541: # ifdef YYPRINT
                    542: /* YYTOKNUM[NUM] -- (External) token number corresponding to the
                    543:    (internal) symbol number NUM (which must be that of a token).  */
                    544: static const yytype_uint16 yytoknum[] =
                    545: {
                    546:        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
                    547:      265
                    548: };
                    549: # endif
                    550: 
                    551: #define YYPACT_NINF -3
                    552: 
                    553: #define yypact_value_is_default(Yystate) \
                    554:   (!!((Yystate) == (-3)))
                    555: 
                    556: #define YYTABLE_NINF -1
                    557: 
                    558: #define yytable_value_is_error(Yytable_value) \
                    559:   0
                    560: 
                    561:   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
                    562:      STATE-NUM.  */
                    563: static const yytype_int8 yypact[] =
                    564: {
                    565:       -3,     0,    -3,    -2,    -3,    -3,    -3,    -3,    -3,    -3,
                    566:       -1,     6,    -3,    -3,    -3,     1,    -3,     8,    -3
                    567: };
                    568: 
                    569:   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
                    570:      Performed when YYTABLE does not specify something else to do.  Zero
                    571:      means the default is an error.  */
                    572: static const yytype_uint8 yydefact[] =
                    573: {
                    574:        2,     0,     1,    13,     3,     8,     9,    10,     4,     5,
                    575:       11,    16,     6,    12,     7,    15,    17,    14,    18
                    576: };
                    577: 
                    578:   /* YYPGOTO[NTERM-NUM].  */
                    579: static const yytype_int8 yypgoto[] =
                    580: {
                    581:       -3,    -3,    -3,    -3,    -3,    -3,    -3,    -3
                    582: };
                    583: 
                    584:   /* YYDEFGOTO[NTERM-NUM].  */
                    585: static const yytype_int8 yydefgoto[] =
                    586: {
                    587:       -1,     1,     8,     9,    10,    14,    12,    17
                    588: };
                    589: 
                    590:   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
                    591:      positive, shift that token.  If negative, reduce the rule whose
                    592:      number is the opposite.  If YYTABLE_NINF, syntax error.  */
                    593: static const yytype_uint8 yytable[] =
                    594: {
                    595:        2,    11,    13,     0,    16,     3,     4,     5,     6,     7,
                    596:       15,    18
                    597: };
                    598: 
                    599: static const yytype_int8 yycheck[] =
                    600: {
                    601:        0,     3,     3,    -1,     3,     5,     6,     7,     8,     9,
                    602:        4,     3
                    603: };
                    604: 
                    605:   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
                    606:      symbol of state STATE-NUM.  */
                    607: static const yytype_uint8 yystos[] =
                    608: {
                    609:        0,    12,     0,     5,     6,     7,     8,     9,    13,    14,
                    610:       15,     3,    17,     3,    16,     4,     3,    18,     3
                    611: };
                    612: 
                    613:   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
                    614: static const yytype_uint8 yyr1[] =
                    615: {
                    616:        0,    11,    12,    12,    12,    13,    13,    14,    15,    15,
                    617:       15,    16,    16,    17,    17,    17,    17,    18,    18
                    618: };
                    619: 
                    620:   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
                    621: static const yytype_uint8 yyr2[] =
                    622: {
                    623:        0,     2,     0,     2,     2,     1,     2,     2,     1,     1,
                    624:        1,     0,     1,     0,     3,     2,     1,     1,     2
                    625: };
                    626: 
                    627: 
                    628: #define yyerrok         (yyerrstatus = 0)
                    629: #define yyclearin       (yychar = YYEMPTY)
                    630: #define YYEMPTY         (-2)
                    631: #define YYEOF           0
                    632: 
                    633: #define YYACCEPT        goto yyacceptlab
                    634: #define YYABORT         goto yyabortlab
                    635: #define YYERROR         goto yyerrorlab
                    636: 
                    637: 
                    638: #define YYRECOVERING()  (!!yyerrstatus)
                    639: 
                    640: #define YYBACKUP(Token, Value)                                  \
                    641: do                                                              \
                    642:   if (yychar == YYEMPTY)                                        \
                    643:     {                                                           \
                    644:       yychar = (Token);                                         \
                    645:       yylval = (Value);                                         \
                    646:       YYPOPSTACK (yylen);                                       \
                    647:       yystate = *yyssp;                                         \
                    648:       goto yybackup;                                            \
                    649:     }                                                           \
                    650:   else                                                          \
                    651:     {                                                           \
                    652:       yyerror (ctx, YY_("syntax error: cannot back up")); \
                    653:       YYERROR;                                                  \
                    654:     }                                                           \
                    655: while (0)
                    656: 
                    657: /* Error token number */
                    658: #define YYTERROR        1
                    659: #define YYERRCODE       256
                    660: 
                    661: 
                    662: 
                    663: /* Enable debugging if requested.  */
1.1.1.2 ! misho     664: #if CONF_PARSER_DEBUG
1.1       misho     665: 
                    666: # ifndef YYFPRINTF
                    667: #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
                    668: #  define YYFPRINTF fprintf
                    669: # endif
                    670: 
                    671: # define YYDPRINTF(Args)                        \
                    672: do {                                            \
                    673:   if (yydebug)                                  \
                    674:     YYFPRINTF Args;                             \
                    675: } while (0)
                    676: 
                    677: /* This macro is provided for backward compatibility. */
                    678: #ifndef YY_LOCATION_PRINT
                    679: # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
                    680: #endif
                    681: 
                    682: 
                    683: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
                    684: do {                                                                      \
                    685:   if (yydebug)                                                            \
                    686:     {                                                                     \
                    687:       YYFPRINTF (stderr, "%s ", Title);                                   \
                    688:       yy_symbol_print (stderr,                                            \
                    689:                   Type, Value, ctx); \
                    690:       YYFPRINTF (stderr, "\n");                                           \
                    691:     }                                                                     \
                    692: } while (0)
                    693: 
                    694: 
                    695: /*----------------------------------------.
                    696: | Print this symbol's value on YYOUTPUT.  |
                    697: `----------------------------------------*/
                    698: 
                    699: static void
                    700: yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_helper_t *ctx)
                    701: {
                    702:   FILE *yyo = yyoutput;
                    703:   YYUSE (yyo);
                    704:   YYUSE (ctx);
                    705:   if (!yyvaluep)
                    706:     return;
                    707: # ifdef YYPRINT
                    708:   if (yytype < YYNTOKENS)
                    709:     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
                    710: # endif
                    711:   YYUSE (yytype);
                    712: }
                    713: 
                    714: 
                    715: /*--------------------------------.
                    716: | Print this symbol on YYOUTPUT.  |
                    717: `--------------------------------*/
                    718: 
                    719: static void
                    720: yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parser_helper_t *ctx)
                    721: {
                    722:   YYFPRINTF (yyoutput, "%s %s (",
                    723:              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
                    724: 
                    725:   yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx);
                    726:   YYFPRINTF (yyoutput, ")");
                    727: }
                    728: 
                    729: /*------------------------------------------------------------------.
                    730: | yy_stack_print -- Print the state stack from its BOTTOM up to its |
                    731: | TOP (included).                                                   |
                    732: `------------------------------------------------------------------*/
                    733: 
                    734: static void
                    735: yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
                    736: {
                    737:   YYFPRINTF (stderr, "Stack now");
                    738:   for (; yybottom <= yytop; yybottom++)
                    739:     {
                    740:       int yybot = *yybottom;
                    741:       YYFPRINTF (stderr, " %d", yybot);
                    742:     }
                    743:   YYFPRINTF (stderr, "\n");
                    744: }
                    745: 
                    746: # define YY_STACK_PRINT(Bottom, Top)                            \
                    747: do {                                                            \
                    748:   if (yydebug)                                                  \
                    749:     yy_stack_print ((Bottom), (Top));                           \
                    750: } while (0)
                    751: 
                    752: 
                    753: /*------------------------------------------------.
                    754: | Report that the YYRULE is going to be reduced.  |
                    755: `------------------------------------------------*/
                    756: 
                    757: static void
                    758: yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parser_helper_t *ctx)
                    759: {
                    760:   unsigned long int yylno = yyrline[yyrule];
                    761:   int yynrhs = yyr2[yyrule];
                    762:   int yyi;
                    763:   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
                    764:              yyrule - 1, yylno);
                    765:   /* The symbols being reduced.  */
                    766:   for (yyi = 0; yyi < yynrhs; yyi++)
                    767:     {
                    768:       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
                    769:       yy_symbol_print (stderr,
                    770:                        yystos[yyssp[yyi + 1 - yynrhs]],
                    771:                        &(yyvsp[(yyi + 1) - (yynrhs)])
                    772:                                               , ctx);
                    773:       YYFPRINTF (stderr, "\n");
                    774:     }
                    775: }
                    776: 
                    777: # define YY_REDUCE_PRINT(Rule)          \
                    778: do {                                    \
                    779:   if (yydebug)                          \
                    780:     yy_reduce_print (yyssp, yyvsp, Rule, ctx); \
                    781: } while (0)
                    782: 
                    783: /* Nonzero means print parse trace.  It is left uninitialized so that
                    784:    multiple parsers can coexist.  */
                    785: int yydebug;
1.1.1.2 ! misho     786: #else /* !CONF_PARSER_DEBUG */
1.1       misho     787: # define YYDPRINTF(Args)
                    788: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
                    789: # define YY_STACK_PRINT(Bottom, Top)
                    790: # define YY_REDUCE_PRINT(Rule)
1.1.1.2 ! misho     791: #endif /* !CONF_PARSER_DEBUG */
1.1       misho     792: 
                    793: 
                    794: /* YYINITDEPTH -- initial size of the parser's stacks.  */
                    795: #ifndef YYINITDEPTH
                    796: # define YYINITDEPTH 200
                    797: #endif
                    798: 
                    799: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
                    800:    if the built-in stack extension method is used).
                    801: 
                    802:    Do not make this value too large; the results are undefined if
                    803:    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
                    804:    evaluated with infinite-precision integer arithmetic.  */
                    805: 
                    806: #ifndef YYMAXDEPTH
                    807: # define YYMAXDEPTH 10000
                    808: #endif
                    809: 
                    810: 
                    811: #if YYERROR_VERBOSE
                    812: 
                    813: # ifndef yystrlen
                    814: #  if defined __GLIBC__ && defined _STRING_H
                    815: #   define yystrlen strlen
                    816: #  else
                    817: /* Return the length of YYSTR.  */
                    818: static YYSIZE_T
                    819: yystrlen (const char *yystr)
                    820: {
                    821:   YYSIZE_T yylen;
                    822:   for (yylen = 0; yystr[yylen]; yylen++)
                    823:     continue;
                    824:   return yylen;
                    825: }
                    826: #  endif
                    827: # endif
                    828: 
                    829: # ifndef yystpcpy
                    830: #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
                    831: #   define yystpcpy stpcpy
                    832: #  else
                    833: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
                    834:    YYDEST.  */
                    835: static char *
                    836: yystpcpy (char *yydest, const char *yysrc)
                    837: {
                    838:   char *yyd = yydest;
                    839:   const char *yys = yysrc;
                    840: 
                    841:   while ((*yyd++ = *yys++) != '\0')
                    842:     continue;
                    843: 
                    844:   return yyd - 1;
                    845: }
                    846: #  endif
                    847: # endif
                    848: 
                    849: # ifndef yytnamerr
                    850: /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
                    851:    quotes and backslashes, so that it's suitable for yyerror.  The
                    852:    heuristic is that double-quoting is unnecessary unless the string
                    853:    contains an apostrophe, a comma, or backslash (other than
                    854:    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
                    855:    null, do not copy; instead, return the length of what the result
                    856:    would have been.  */
                    857: static YYSIZE_T
                    858: yytnamerr (char *yyres, const char *yystr)
                    859: {
                    860:   if (*yystr == '"')
                    861:     {
                    862:       YYSIZE_T yyn = 0;
                    863:       char const *yyp = yystr;
                    864: 
                    865:       for (;;)
                    866:         switch (*++yyp)
                    867:           {
                    868:           case '\'':
                    869:           case ',':
                    870:             goto do_not_strip_quotes;
                    871: 
                    872:           case '\\':
                    873:             if (*++yyp != '\\')
                    874:               goto do_not_strip_quotes;
                    875:             /* Fall through.  */
                    876:           default:
                    877:             if (yyres)
                    878:               yyres[yyn] = *yyp;
                    879:             yyn++;
                    880:             break;
                    881: 
                    882:           case '"':
                    883:             if (yyres)
                    884:               yyres[yyn] = '\0';
                    885:             return yyn;
                    886:           }
                    887:     do_not_strip_quotes: ;
                    888:     }
                    889: 
                    890:   if (! yyres)
                    891:     return yystrlen (yystr);
                    892: 
                    893:   return yystpcpy (yyres, yystr) - yyres;
                    894: }
                    895: # endif
                    896: 
                    897: /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
                    898:    about the unexpected token YYTOKEN for the state stack whose top is
                    899:    YYSSP.
                    900: 
                    901:    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
                    902:    not large enough to hold the message.  In that case, also set
                    903:    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
                    904:    required number of bytes is too large to store.  */
                    905: static int
                    906: yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                    907:                 yytype_int16 *yyssp, int yytoken)
                    908: {
                    909:   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
                    910:   YYSIZE_T yysize = yysize0;
                    911:   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
                    912:   /* Internationalized format string. */
                    913:   const char *yyformat = YY_NULLPTR;
                    914:   /* Arguments of yyformat. */
                    915:   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
                    916:   /* Number of reported tokens (one for the "unexpected", one per
                    917:      "expected"). */
                    918:   int yycount = 0;
                    919: 
                    920:   /* There are many possibilities here to consider:
                    921:      - If this state is a consistent state with a default action, then
                    922:        the only way this function was invoked is if the default action
                    923:        is an error action.  In that case, don't check for expected
                    924:        tokens because there are none.
                    925:      - The only way there can be no lookahead present (in yychar) is if
                    926:        this state is a consistent state with a default action.  Thus,
                    927:        detecting the absence of a lookahead is sufficient to determine
                    928:        that there is no unexpected or expected token to report.  In that
                    929:        case, just report a simple "syntax error".
                    930:      - Don't assume there isn't a lookahead just because this state is a
                    931:        consistent state with a default action.  There might have been a
                    932:        previous inconsistent state, consistent state with a non-default
                    933:        action, or user semantic action that manipulated yychar.
                    934:      - Of course, the expected token list depends on states to have
                    935:        correct lookahead information, and it depends on the parser not
                    936:        to perform extra reductions after fetching a lookahead from the
                    937:        scanner and before detecting a syntax error.  Thus, state merging
                    938:        (from LALR or IELR) and default reductions corrupt the expected
                    939:        token list.  However, the list is correct for canonical LR with
                    940:        one exception: it will still contain any token that will not be
                    941:        accepted due to an error action in a later state.
                    942:   */
                    943:   if (yytoken != YYEMPTY)
                    944:     {
                    945:       int yyn = yypact[*yyssp];
                    946:       yyarg[yycount++] = yytname[yytoken];
                    947:       if (!yypact_value_is_default (yyn))
                    948:         {
                    949:           /* Start YYX at -YYN if negative to avoid negative indexes in
                    950:              YYCHECK.  In other words, skip the first -YYN actions for
                    951:              this state because they are default actions.  */
                    952:           int yyxbegin = yyn < 0 ? -yyn : 0;
                    953:           /* Stay within bounds of both yycheck and yytname.  */
                    954:           int yychecklim = YYLAST - yyn + 1;
                    955:           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
                    956:           int yyx;
                    957: 
                    958:           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
                    959:             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
                    960:                 && !yytable_value_is_error (yytable[yyx + yyn]))
                    961:               {
                    962:                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
                    963:                   {
                    964:                     yycount = 1;
                    965:                     yysize = yysize0;
                    966:                     break;
                    967:                   }
                    968:                 yyarg[yycount++] = yytname[yyx];
                    969:                 {
                    970:                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
                    971:                   if (! (yysize <= yysize1
                    972:                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                    973:                     return 2;
                    974:                   yysize = yysize1;
                    975:                 }
                    976:               }
                    977:         }
                    978:     }
                    979: 
                    980:   switch (yycount)
                    981:     {
                    982: # define YYCASE_(N, S)                      \
                    983:       case N:                               \
                    984:         yyformat = S;                       \
                    985:       break
                    986:       YYCASE_(0, YY_("syntax error"));
                    987:       YYCASE_(1, YY_("syntax error, unexpected %s"));
                    988:       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
                    989:       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
                    990:       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
                    991:       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
                    992: # undef YYCASE_
                    993:     }
                    994: 
                    995:   {
                    996:     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
                    997:     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                    998:       return 2;
                    999:     yysize = yysize1;
                   1000:   }
                   1001: 
                   1002:   if (*yymsg_alloc < yysize)
                   1003:     {
                   1004:       *yymsg_alloc = 2 * yysize;
                   1005:       if (! (yysize <= *yymsg_alloc
                   1006:              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
                   1007:         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
                   1008:       return 1;
                   1009:     }
                   1010: 
                   1011:   /* Avoid sprintf, as that infringes on the user's name space.
                   1012:      Don't have undefined behavior even if the translation
                   1013:      produced a string with the wrong number of "%s"s.  */
                   1014:   {
                   1015:     char *yyp = *yymsg;
                   1016:     int yyi = 0;
                   1017:     while ((*yyp = *yyformat) != '\0')
                   1018:       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
                   1019:         {
                   1020:           yyp += yytnamerr (yyp, yyarg[yyi++]);
                   1021:           yyformat += 2;
                   1022:         }
                   1023:       else
                   1024:         {
                   1025:           yyp++;
                   1026:           yyformat++;
                   1027:         }
                   1028:   }
                   1029:   return 0;
                   1030: }
                   1031: #endif /* YYERROR_VERBOSE */
                   1032: 
                   1033: /*-----------------------------------------------.
                   1034: | Release the memory associated to this symbol.  |
                   1035: `-----------------------------------------------*/
                   1036: 
                   1037: static void
                   1038: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_helper_t *ctx)
                   1039: {
                   1040:   YYUSE (yyvaluep);
                   1041:   YYUSE (ctx);
                   1042:   if (!yymsg)
                   1043:     yymsg = "Deleting";
                   1044:   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
                   1045: 
                   1046:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                   1047:   switch (yytype)
                   1048:     {
                   1049:           case 3: /* STRING  */
1.1.1.2 ! misho    1050: #line 93 "parser/parser.y" /* yacc.c:1257  */
1.1       misho    1051:       { free(((*yyvaluep).s)); }
1.1.1.2 ! misho    1052: #line 1053 "parser/parser.c" /* yacc.c:1257  */
1.1       misho    1053:         break;
                   1054: 
                   1055:     case 16: /* section_name  */
1.1.1.2 ! misho    1056: #line 93 "parser/parser.y" /* yacc.c:1257  */
1.1       misho    1057:       { free(((*yyvaluep).s)); }
1.1.1.2 ! misho    1058: #line 1059 "parser/parser.c" /* yacc.c:1257  */
1.1       misho    1059:         break;
                   1060: 
                   1061:     case 18: /* value  */
1.1.1.2 ! misho    1062: #line 93 "parser/parser.y" /* yacc.c:1257  */
1.1       misho    1063:       { free(((*yyvaluep).s)); }
1.1.1.2 ! misho    1064: #line 1065 "parser/parser.c" /* yacc.c:1257  */
1.1       misho    1065:         break;
                   1066: 
                   1067: 
                   1068:       default:
                   1069:         break;
                   1070:     }
                   1071:   YY_IGNORE_MAYBE_UNINITIALIZED_END
                   1072: }
                   1073: 
                   1074: 
                   1075: 
                   1076: 
                   1077: /*----------.
                   1078: | yyparse.  |
                   1079: `----------*/
                   1080: 
                   1081: int
                   1082: yyparse (parser_helper_t *ctx)
                   1083: {
                   1084: /* The lookahead symbol.  */
                   1085: int yychar;
                   1086: 
                   1087: 
                   1088: /* The semantic value of the lookahead symbol.  */
                   1089: /* Default value used for initialization, for pacifying older GCCs
                   1090:    or non-GCC compilers.  */
                   1091: YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
                   1092: YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
                   1093: 
                   1094:     /* Number of syntax errors so far.  */
                   1095:     int yynerrs;
                   1096: 
                   1097:     int yystate;
                   1098:     /* Number of tokens to shift before error messages enabled.  */
                   1099:     int yyerrstatus;
                   1100: 
                   1101:     /* The stacks and their tools:
                   1102:        'yyss': related to states.
                   1103:        'yyvs': related to semantic values.
                   1104: 
                   1105:        Refer to the stacks through separate pointers, to allow yyoverflow
                   1106:        to reallocate them elsewhere.  */
                   1107: 
                   1108:     /* The state stack.  */
                   1109:     yytype_int16 yyssa[YYINITDEPTH];
                   1110:     yytype_int16 *yyss;
                   1111:     yytype_int16 *yyssp;
                   1112: 
                   1113:     /* The semantic value stack.  */
                   1114:     YYSTYPE yyvsa[YYINITDEPTH];
                   1115:     YYSTYPE *yyvs;
                   1116:     YYSTYPE *yyvsp;
                   1117: 
                   1118:     YYSIZE_T yystacksize;
                   1119: 
                   1120:   int yyn;
                   1121:   int yyresult;
                   1122:   /* Lookahead token as an internal (translated) token number.  */
                   1123:   int yytoken = 0;
                   1124:   /* The variables used to return semantic value and location from the
                   1125:      action routines.  */
                   1126:   YYSTYPE yyval;
                   1127: 
                   1128: #if YYERROR_VERBOSE
                   1129:   /* Buffer for error messages, and its allocated size.  */
                   1130:   char yymsgbuf[128];
                   1131:   char *yymsg = yymsgbuf;
                   1132:   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
                   1133: #endif
                   1134: 
                   1135: #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
                   1136: 
                   1137:   /* The number of symbols on the RHS of the reduced rule.
                   1138:      Keep to zero when no symbol should be popped.  */
                   1139:   int yylen = 0;
                   1140: 
                   1141:   yyssp = yyss = yyssa;
                   1142:   yyvsp = yyvs = yyvsa;
                   1143:   yystacksize = YYINITDEPTH;
                   1144: 
                   1145:   YYDPRINTF ((stderr, "Starting parse\n"));
                   1146: 
                   1147:   yystate = 0;
                   1148:   yyerrstatus = 0;
                   1149:   yynerrs = 0;
                   1150:   yychar = YYEMPTY; /* Cause a token to be read.  */
                   1151:   goto yysetstate;
                   1152: 
                   1153: /*------------------------------------------------------------.
                   1154: | yynewstate -- Push a new state, which is found in yystate.  |
                   1155: `------------------------------------------------------------*/
                   1156:  yynewstate:
                   1157:   /* In all cases, when you get here, the value and location stacks
                   1158:      have just been pushed.  So pushing a state here evens the stacks.  */
                   1159:   yyssp++;
                   1160: 
                   1161:  yysetstate:
                   1162:   *yyssp = yystate;
                   1163: 
                   1164:   if (yyss + yystacksize - 1 <= yyssp)
                   1165:     {
                   1166:       /* Get the current used size of the three stacks, in elements.  */
                   1167:       YYSIZE_T yysize = yyssp - yyss + 1;
                   1168: 
                   1169: #ifdef yyoverflow
                   1170:       {
                   1171:         /* Give user a chance to reallocate the stack.  Use copies of
                   1172:            these so that the &'s don't force the real ones into
                   1173:            memory.  */
                   1174:         YYSTYPE *yyvs1 = yyvs;
                   1175:         yytype_int16 *yyss1 = yyss;
                   1176: 
                   1177:         /* Each stack pointer address is followed by the size of the
                   1178:            data in use in that stack, in bytes.  This used to be a
                   1179:            conditional around just the two extra args, but that might
                   1180:            be undefined if yyoverflow is a macro.  */
                   1181:         yyoverflow (YY_("memory exhausted"),
                   1182:                     &yyss1, yysize * sizeof (*yyssp),
                   1183:                     &yyvs1, yysize * sizeof (*yyvsp),
                   1184:                     &yystacksize);
                   1185: 
                   1186:         yyss = yyss1;
                   1187:         yyvs = yyvs1;
                   1188:       }
                   1189: #else /* no yyoverflow */
                   1190: # ifndef YYSTACK_RELOCATE
                   1191:       goto yyexhaustedlab;
                   1192: # else
                   1193:       /* Extend the stack our own way.  */
                   1194:       if (YYMAXDEPTH <= yystacksize)
                   1195:         goto yyexhaustedlab;
                   1196:       yystacksize *= 2;
                   1197:       if (YYMAXDEPTH < yystacksize)
                   1198:         yystacksize = YYMAXDEPTH;
                   1199: 
                   1200:       {
                   1201:         yytype_int16 *yyss1 = yyss;
                   1202:         union yyalloc *yyptr =
                   1203:           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
                   1204:         if (! yyptr)
                   1205:           goto yyexhaustedlab;
                   1206:         YYSTACK_RELOCATE (yyss_alloc, yyss);
                   1207:         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
                   1208: #  undef YYSTACK_RELOCATE
                   1209:         if (yyss1 != yyssa)
                   1210:           YYSTACK_FREE (yyss1);
                   1211:       }
                   1212: # endif
                   1213: #endif /* no yyoverflow */
                   1214: 
                   1215:       yyssp = yyss + yysize - 1;
                   1216:       yyvsp = yyvs + yysize - 1;
                   1217: 
                   1218:       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                   1219:                   (unsigned long int) yystacksize));
                   1220: 
                   1221:       if (yyss + yystacksize - 1 <= yyssp)
                   1222:         YYABORT;
                   1223:     }
                   1224: 
                   1225:   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
                   1226: 
                   1227:   if (yystate == YYFINAL)
                   1228:     YYACCEPT;
                   1229: 
                   1230:   goto yybackup;
                   1231: 
                   1232: /*-----------.
                   1233: | yybackup.  |
                   1234: `-----------*/
                   1235: yybackup:
                   1236: 
                   1237:   /* Do appropriate processing given the current state.  Read a
                   1238:      lookahead token if we need one and don't already have one.  */
                   1239: 
                   1240:   /* First try to decide what to do without reference to lookahead token.  */
                   1241:   yyn = yypact[yystate];
                   1242:   if (yypact_value_is_default (yyn))
                   1243:     goto yydefault;
                   1244: 
                   1245:   /* Not known => get a lookahead token if don't already have one.  */
                   1246: 
                   1247:   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
                   1248:   if (yychar == YYEMPTY)
                   1249:     {
                   1250:       YYDPRINTF ((stderr, "Reading a token: "));
                   1251:       yychar = yylex (&yylval, ctx);
                   1252:     }
                   1253: 
                   1254:   if (yychar <= YYEOF)
                   1255:     {
                   1256:       yychar = yytoken = YYEOF;
                   1257:       YYDPRINTF ((stderr, "Now at end of input.\n"));
                   1258:     }
                   1259:   else
                   1260:     {
                   1261:       yytoken = YYTRANSLATE (yychar);
                   1262:       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
                   1263:     }
                   1264: 
                   1265:   /* If the proper action on seeing token YYTOKEN is to reduce or to
                   1266:      detect an error, take that action.  */
                   1267:   yyn += yytoken;
                   1268:   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
                   1269:     goto yydefault;
                   1270:   yyn = yytable[yyn];
                   1271:   if (yyn <= 0)
                   1272:     {
                   1273:       if (yytable_value_is_error (yyn))
                   1274:         goto yyerrlab;
                   1275:       yyn = -yyn;
                   1276:       goto yyreduce;
                   1277:     }
                   1278: 
                   1279:   /* Count tokens shifted since error; after three, turn off error
                   1280:      status.  */
                   1281:   if (yyerrstatus)
                   1282:     yyerrstatus--;
                   1283: 
                   1284:   /* Shift the lookahead token.  */
                   1285:   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
                   1286: 
                   1287:   /* Discard the shifted token.  */
                   1288:   yychar = YYEMPTY;
                   1289: 
                   1290:   yystate = yyn;
                   1291:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                   1292:   *++yyvsp = yylval;
                   1293:   YY_IGNORE_MAYBE_UNINITIALIZED_END
                   1294: 
                   1295:   goto yynewstate;
                   1296: 
                   1297: 
                   1298: /*-----------------------------------------------------------.
                   1299: | yydefault -- do the default action for the current state.  |
                   1300: `-----------------------------------------------------------*/
                   1301: yydefault:
                   1302:   yyn = yydefact[yystate];
                   1303:   if (yyn == 0)
                   1304:     goto yyerrlab;
                   1305:   goto yyreduce;
                   1306: 
                   1307: 
                   1308: /*-----------------------------.
                   1309: | yyreduce -- Do a reduction.  |
                   1310: `-----------------------------*/
                   1311: yyreduce:
                   1312:   /* yyn is the number of a rule to reduce with.  */
                   1313:   yylen = yyr2[yyn];
                   1314: 
                   1315:   /* If YYLEN is nonzero, implement the default value of the action:
                   1316:      '$$ = $1'.
                   1317: 
                   1318:      Otherwise, the following line sets YYVAL to garbage.
                   1319:      This behavior is undocumented and Bison
                   1320:      users should not rely upon it.  Assigning to YYVAL
                   1321:      unconditionally makes the parser a bit smaller, and it avoids a
                   1322:      GCC warning that YYVAL may be used uninitialized.  */
                   1323:   yyval = yyvsp[1-yylen];
                   1324: 
                   1325: 
                   1326:   YY_REDUCE_PRINT (yyn);
                   1327:   switch (yyn)
                   1328:     {
                   1329:         case 7:
1.1.1.2 ! misho    1330: #line 117 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1331:     {
                   1332:                if ((yyvsp[-1].t) != CONF_PARSER_CONFIG_SETUP && (!(yyvsp[0].s) || !strlen((yyvsp[0].s))))
                   1333:                {
                   1334:                        PARSER_DBG1(ctx, "section name missing");
                   1335:                        free((yyvsp[0].s));
                   1336:                        YYERROR;
                   1337:                }
                   1338:                conf_parser_t *parser = (conf_parser_t*)ctx->context;
                   1339:                parser->add_section(parser, (yyvsp[-1].t), (yyvsp[0].s));
                   1340:        }
1.1.1.2 ! misho    1341: #line 1342 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1342:     break;
                   1343: 
                   1344:   case 8:
1.1.1.2 ! misho    1345: #line 131 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1346:     {
                   1347:                (yyval.t) = CONF_PARSER_CONFIG_SETUP;
                   1348:        }
1.1.1.2 ! misho    1349: #line 1350 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1350:     break;
                   1351: 
                   1352:   case 9:
1.1.1.2 ! misho    1353: #line 136 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1354:     {
                   1355:                (yyval.t) = CONF_PARSER_CONN;
                   1356:        }
1.1.1.2 ! misho    1357: #line 1358 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1358:     break;
                   1359: 
                   1360:   case 10:
1.1.1.2 ! misho    1361: #line 141 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1362:     {
                   1363:                (yyval.t) = CONF_PARSER_CA;
                   1364:        }
1.1.1.2 ! misho    1365: #line 1366 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1366:     break;
                   1367: 
                   1368:   case 11:
1.1.1.2 ! misho    1369: #line 148 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1370:     {
                   1371:                (yyval.s) = NULL;
                   1372:        }
1.1.1.2 ! misho    1373: #line 1374 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1374:     break;
                   1375: 
                   1376:   case 12:
1.1.1.2 ! misho    1377: #line 152 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1378:     {
                   1379:                (yyval.s) = (yyvsp[0].s);
                   1380:        }
1.1.1.2 ! misho    1381: #line 1382 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1382:     break;
                   1383: 
                   1384:   case 14:
1.1.1.2 ! misho    1385: #line 161 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1386:     {
                   1387:                if (!strlen((yyvsp[-2].s)))
                   1388:                {
                   1389:                        PARSER_DBG1(ctx, "setting name can't be empty");
                   1390:                        free((yyvsp[-2].s));
                   1391:                        free((yyvsp[0].s));
                   1392:                        YYERROR;
                   1393:                }
                   1394:                conf_parser_t *parser = (conf_parser_t*)ctx->context;
                   1395:                parser->add_setting(parser, (yyvsp[-2].s), (yyvsp[0].s));
                   1396:        }
1.1.1.2 ! misho    1397: #line 1398 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1398:     break;
                   1399: 
                   1400:   case 15:
1.1.1.2 ! misho    1401: #line 174 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1402:     {
                   1403:                if (!strlen((yyvsp[-1].s)))
                   1404:                {
                   1405:                        PARSER_DBG1(ctx, "setting name can't be empty");
                   1406:                        free((yyvsp[-1].s));
                   1407:                        YYERROR;
                   1408:                }
                   1409:                conf_parser_t *parser = (conf_parser_t*)ctx->context;
                   1410:                parser->add_setting(parser, (yyvsp[-1].s), NULL);
                   1411:        }
1.1.1.2 ! misho    1412: #line 1413 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1413:     break;
                   1414: 
                   1415:   case 16:
1.1.1.2 ! misho    1416: #line 186 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1417:     {
                   1418:                PARSER_DBG1(ctx, "missing value for setting '%s'", (yyvsp[0].s));
                   1419:                free((yyvsp[0].s));
                   1420:                YYERROR;
                   1421:        }
1.1.1.2 ! misho    1422: #line 1423 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1423:     break;
                   1424: 
                   1425:   case 18:
1.1.1.2 ! misho    1426: #line 196 "parser/parser.y" /* yacc.c:1646  */
1.1       misho    1427:     {  /* just put a single space between them, use strings for more */
                   1428:                if (asprintf(&(yyval.s), "%s %s", (yyvsp[-1].s), (yyvsp[0].s)) < 0)
                   1429:                {
                   1430:                        free((yyvsp[-1].s));
                   1431:                        free((yyvsp[0].s));
                   1432:                        YYERROR;
                   1433:                }
                   1434:                free((yyvsp[-1].s));
                   1435:                free((yyvsp[0].s));
                   1436:        }
1.1.1.2 ! misho    1437: #line 1438 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1438:     break;
                   1439: 
                   1440: 
1.1.1.2 ! misho    1441: #line 1442 "parser/parser.c" /* yacc.c:1646  */
1.1       misho    1442:       default: break;
                   1443:     }
                   1444:   /* User semantic actions sometimes alter yychar, and that requires
                   1445:      that yytoken be updated with the new translation.  We take the
                   1446:      approach of translating immediately before every use of yytoken.
                   1447:      One alternative is translating here after every semantic action,
                   1448:      but that translation would be missed if the semantic action invokes
                   1449:      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
                   1450:      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
                   1451:      incorrect destructor might then be invoked immediately.  In the
                   1452:      case of YYERROR or YYBACKUP, subsequent parser actions might lead
                   1453:      to an incorrect destructor call or verbose syntax error message
                   1454:      before the lookahead is translated.  */
                   1455:   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
                   1456: 
                   1457:   YYPOPSTACK (yylen);
                   1458:   yylen = 0;
                   1459:   YY_STACK_PRINT (yyss, yyssp);
                   1460: 
                   1461:   *++yyvsp = yyval;
                   1462: 
                   1463:   /* Now 'shift' the result of the reduction.  Determine what state
                   1464:      that goes to, based on the state we popped back to and the rule
                   1465:      number reduced by.  */
                   1466: 
                   1467:   yyn = yyr1[yyn];
                   1468: 
                   1469:   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
                   1470:   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
                   1471:     yystate = yytable[yystate];
                   1472:   else
                   1473:     yystate = yydefgoto[yyn - YYNTOKENS];
                   1474: 
                   1475:   goto yynewstate;
                   1476: 
                   1477: 
                   1478: /*--------------------------------------.
                   1479: | yyerrlab -- here on detecting error.  |
                   1480: `--------------------------------------*/
                   1481: yyerrlab:
                   1482:   /* Make sure we have latest lookahead translation.  See comments at
                   1483:      user semantic actions for why this is necessary.  */
                   1484:   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
                   1485: 
                   1486:   /* If not already recovering from an error, report this error.  */
                   1487:   if (!yyerrstatus)
                   1488:     {
                   1489:       ++yynerrs;
                   1490: #if ! YYERROR_VERBOSE
                   1491:       yyerror (ctx, YY_("syntax error"));
                   1492: #else
                   1493: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                   1494:                                         yyssp, yytoken)
                   1495:       {
                   1496:         char const *yymsgp = YY_("syntax error");
                   1497:         int yysyntax_error_status;
                   1498:         yysyntax_error_status = YYSYNTAX_ERROR;
                   1499:         if (yysyntax_error_status == 0)
                   1500:           yymsgp = yymsg;
                   1501:         else if (yysyntax_error_status == 1)
                   1502:           {
                   1503:             if (yymsg != yymsgbuf)
                   1504:               YYSTACK_FREE (yymsg);
                   1505:             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
                   1506:             if (!yymsg)
                   1507:               {
                   1508:                 yymsg = yymsgbuf;
                   1509:                 yymsg_alloc = sizeof yymsgbuf;
                   1510:                 yysyntax_error_status = 2;
                   1511:               }
                   1512:             else
                   1513:               {
                   1514:                 yysyntax_error_status = YYSYNTAX_ERROR;
                   1515:                 yymsgp = yymsg;
                   1516:               }
                   1517:           }
                   1518:         yyerror (ctx, yymsgp);
                   1519:         if (yysyntax_error_status == 2)
                   1520:           goto yyexhaustedlab;
                   1521:       }
                   1522: # undef YYSYNTAX_ERROR
                   1523: #endif
                   1524:     }
                   1525: 
                   1526: 
                   1527: 
                   1528:   if (yyerrstatus == 3)
                   1529:     {
                   1530:       /* If just tried and failed to reuse lookahead token after an
                   1531:          error, discard it.  */
                   1532: 
                   1533:       if (yychar <= YYEOF)
                   1534:         {
                   1535:           /* Return failure if at end of input.  */
                   1536:           if (yychar == YYEOF)
                   1537:             YYABORT;
                   1538:         }
                   1539:       else
                   1540:         {
                   1541:           yydestruct ("Error: discarding",
                   1542:                       yytoken, &yylval, ctx);
                   1543:           yychar = YYEMPTY;
                   1544:         }
                   1545:     }
                   1546: 
                   1547:   /* Else will try to reuse lookahead token after shifting the error
                   1548:      token.  */
                   1549:   goto yyerrlab1;
                   1550: 
                   1551: 
                   1552: /*---------------------------------------------------.
                   1553: | yyerrorlab -- error raised explicitly by YYERROR.  |
                   1554: `---------------------------------------------------*/
                   1555: yyerrorlab:
                   1556: 
                   1557:   /* Pacify compilers like GCC when the user code never invokes
                   1558:      YYERROR and the label yyerrorlab therefore never appears in user
                   1559:      code.  */
                   1560:   if (/*CONSTCOND*/ 0)
                   1561:      goto yyerrorlab;
                   1562: 
                   1563:   /* Do not reclaim the symbols of the rule whose action triggered
                   1564:      this YYERROR.  */
                   1565:   YYPOPSTACK (yylen);
                   1566:   yylen = 0;
                   1567:   YY_STACK_PRINT (yyss, yyssp);
                   1568:   yystate = *yyssp;
                   1569:   goto yyerrlab1;
                   1570: 
                   1571: 
                   1572: /*-------------------------------------------------------------.
                   1573: | yyerrlab1 -- common code for both syntax error and YYERROR.  |
                   1574: `-------------------------------------------------------------*/
                   1575: yyerrlab1:
                   1576:   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
                   1577: 
                   1578:   for (;;)
                   1579:     {
                   1580:       yyn = yypact[yystate];
                   1581:       if (!yypact_value_is_default (yyn))
                   1582:         {
                   1583:           yyn += YYTERROR;
                   1584:           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
                   1585:             {
                   1586:               yyn = yytable[yyn];
                   1587:               if (0 < yyn)
                   1588:                 break;
                   1589:             }
                   1590:         }
                   1591: 
                   1592:       /* Pop the current state because it cannot handle the error token.  */
                   1593:       if (yyssp == yyss)
                   1594:         YYABORT;
                   1595: 
                   1596: 
                   1597:       yydestruct ("Error: popping",
                   1598:                   yystos[yystate], yyvsp, ctx);
                   1599:       YYPOPSTACK (1);
                   1600:       yystate = *yyssp;
                   1601:       YY_STACK_PRINT (yyss, yyssp);
                   1602:     }
                   1603: 
                   1604:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
                   1605:   *++yyvsp = yylval;
                   1606:   YY_IGNORE_MAYBE_UNINITIALIZED_END
                   1607: 
                   1608: 
                   1609:   /* Shift the error token.  */
                   1610:   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
                   1611: 
                   1612:   yystate = yyn;
                   1613:   goto yynewstate;
                   1614: 
                   1615: 
                   1616: /*-------------------------------------.
                   1617: | yyacceptlab -- YYACCEPT comes here.  |
                   1618: `-------------------------------------*/
                   1619: yyacceptlab:
                   1620:   yyresult = 0;
                   1621:   goto yyreturn;
                   1622: 
                   1623: /*-----------------------------------.
                   1624: | yyabortlab -- YYABORT comes here.  |
                   1625: `-----------------------------------*/
                   1626: yyabortlab:
                   1627:   yyresult = 1;
                   1628:   goto yyreturn;
                   1629: 
                   1630: #if !defined yyoverflow || YYERROR_VERBOSE
                   1631: /*-------------------------------------------------.
                   1632: | yyexhaustedlab -- memory exhaustion comes here.  |
                   1633: `-------------------------------------------------*/
                   1634: yyexhaustedlab:
                   1635:   yyerror (ctx, YY_("memory exhausted"));
                   1636:   yyresult = 2;
                   1637:   /* Fall through.  */
                   1638: #endif
                   1639: 
                   1640: yyreturn:
                   1641:   if (yychar != YYEMPTY)
                   1642:     {
                   1643:       /* Make sure we have latest lookahead translation.  See comments at
                   1644:          user semantic actions for why this is necessary.  */
                   1645:       yytoken = YYTRANSLATE (yychar);
                   1646:       yydestruct ("Cleanup: discarding lookahead",
                   1647:                   yytoken, &yylval, ctx);
                   1648:     }
                   1649:   /* Do not reclaim the symbols of the rule whose action triggered
                   1650:      this YYABORT or YYACCEPT.  */
                   1651:   YYPOPSTACK (yylen);
                   1652:   YY_STACK_PRINT (yyss, yyssp);
                   1653:   while (yyssp != yyss)
                   1654:     {
                   1655:       yydestruct ("Cleanup: popping",
                   1656:                   yystos[*yyssp], yyvsp, ctx);
                   1657:       YYPOPSTACK (1);
                   1658:     }
                   1659: #ifndef yyoverflow
                   1660:   if (yyss != yyssa)
                   1661:     YYSTACK_FREE (yyss);
                   1662: #endif
                   1663: #if YYERROR_VERBOSE
                   1664:   if (yymsg != yymsgbuf)
                   1665:     YYSTACK_FREE (yymsg);
                   1666: #endif
                   1667:   return yyresult;
                   1668: }
1.1.1.2 ! misho    1669: #line 208 "parser/parser.y" /* yacc.c:1906  */
1.1       misho    1670: 
                   1671: 
                   1672: /**
                   1673:  * Referenced by the generated parser
                   1674:  */
                   1675: static void conf_parser_error(parser_helper_t *ctx, const char *s)
                   1676: {
                   1677:        char *text = conf_parser_get_text(ctx->scanner);
                   1678:        int len = conf_parser_get_leng(ctx->scanner);
                   1679: 
                   1680:        if (len && text[len-1] == '\n')
                   1681:        {       /* cut off newline at the end to avoid muti-line log messages */
                   1682:                len--;
                   1683:        }
                   1684:        PARSER_DBG1(ctx, "%s [%.*s]", s, (int)len, text);
                   1685: }
                   1686: 
                   1687: /**
                   1688:  * Parse the given file
                   1689:  */
                   1690: bool conf_parser_parse_file(conf_parser_t *this, char *name)
                   1691: {
                   1692:        parser_helper_t *helper;
                   1693:        bool success = FALSE;
                   1694: 
                   1695:        helper = parser_helper_create(this);
                   1696:        helper->get_lineno = conf_parser_get_lineno;
                   1697:        if (conf_parser_lex_init_extra(helper, &helper->scanner) != 0)
                   1698:        {
                   1699:                helper->destroy(helper);
                   1700:                return FALSE;
                   1701:        }
                   1702:        helper->file_include(helper, name);
                   1703:        if (!conf_parser_open_next_file(helper))
                   1704:        {
                   1705:                DBG1(DBG_CFG, "failed to open config file '%s'", name);
                   1706:        }
                   1707:        else
                   1708:        {
                   1709:                if (getenv("DEBUG_CONF_PARSER"))
                   1710:                {
                   1711:                        yydebug = 1;
                   1712:                        conf_parser_set_debug(1, helper->scanner);
                   1713:                }
                   1714:                success = yyparse(helper) == 0;
                   1715:                if (!success)
                   1716:                {
                   1717:                        DBG1(DBG_CFG, "invalid config file '%s'", name);
                   1718:                }
                   1719:        }
                   1720:        conf_parser_lex_destroy(helper->scanner);
                   1721:        helper->destroy(helper);
                   1722:        return success;
                   1723: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>