Fixed double-free in the config parser.

This commit is contained in:
Gunnar Beutner 2013-03-26 17:26:31 +00:00
parent 5d73b69342
commit 604b57da43
2 changed files with 281 additions and 261 deletions

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 2.5. */ /* A Bison parser, made by GNU Bison 2.7. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -44,7 +44,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.5" #define YYBISON_VERSION "2.7"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -58,20 +58,20 @@
/* Pull parsers. */ /* Pull parsers. */
#define YYPULL 1 #define YYPULL 1
/* Using locations. */
#define YYLSP_NEEDED 1
/* Copy the first part of user declarations. */ /* Copy the first part of user declarations. */
/* Line 371 of yacc.c */
#line 68 "config_parser.cc"
/* Line 268 of yacc.c */ # ifndef YY_NULL
#line 71 "config_parser.cc" # if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULL nullptr
/* Enabling traces. */ # else
#ifndef YYDEBUG # define YY_NULL 0
# define YYDEBUG 0 # endif
# endif # endif
/* Enabling verbose error messages. */ /* Enabling verbose error messages. */
@ -82,14 +82,19 @@
# define YYERROR_VERBOSE 1 # define YYERROR_VERBOSE 1
#endif #endif
/* Enabling the token table. */ /* In a future release of Bison, this section will be replaced
#ifndef YYTOKEN_TABLE by #include "y.tab.h". */
# define YYTOKEN_TABLE 0 #ifndef YY_YY_CONFIG_PARSER_HH_INCLUDED
# define YY_YY_CONFIG_PARSER_HH_INCLUDED
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif #endif
/* "%code requires" blocks. */ /* "%code requires" blocks. */
/* Line 387 of yacc.c */
/* Line 288 of yacc.c */
#line 1 "config_parser.yy" #line 1 "config_parser.yy"
/****************************************************************************** /******************************************************************************
@ -133,9 +138,8 @@ using namespace icinga;
/* Line 387 of yacc.c */
/* Line 288 of yacc.c */ #line 143 "config_parser.cc"
#line 139 "config_parser.cc"
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
@ -205,12 +209,10 @@ using namespace icinga;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE
{ {
/* Line 387 of yacc.c */
/* Line 293 of yacc.c */
#line 52 "config_parser.yy" #line 52 "config_parser.yy"
char *text; char *text;
@ -220,9 +222,8 @@ typedef union YYSTYPE
icinga::TypeSpecifier type; icinga::TypeSpecifier type;
/* Line 387 of yacc.c */
/* Line 293 of yacc.c */ #line 227 "config_parser.cc"
#line 226 "config_parser.cc"
} YYSTYPE; } YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@ -243,9 +244,24 @@ typedef struct YYLTYPE
#endif #endif
/* Copy the second part of user declarations. */ #ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (ConfigCompiler *context);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
/* Line 343 of yacc.c */ #endif /* !YY_YY_CONFIG_PARSER_HH_INCLUDED */
/* Copy the second part of user declarations. */
/* Line 390 of yacc.c */
#line 99 "config_parser.yy" #line 99 "config_parser.yy"
@ -283,9 +299,8 @@ void ConfigCompiler::Compile(void)
#define scanner (context->GetScanner()) #define scanner (context->GetScanner())
/* Line 390 of yacc.c */
/* Line 343 of yacc.c */ #line 304 "config_parser.cc"
#line 289 "config_parser.cc"
#ifdef short #ifdef short
# undef short # undef short
@ -338,24 +353,24 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS # if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS # if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid) # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif # endif
# endif # endif
# ifndef YY_ # ifndef YY_
# define YY_(msgid) msgid # define YY_(Msgid) Msgid
# endif # endif
#endif #endif
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e)) # define YYUSE(E) ((void) (E))
#else #else
# define YYUSE(e) /* empty */ # define YYUSE(E) /* empty */
#endif #endif
/* Identity function, used to suppress warnings about constant conditions. */ /* Identity function, used to suppress warnings about constant conditions. */
#ifndef lint #ifndef lint
# define YYID(n) (n) # define YYID(N) (N)
#else #else
#if (defined __STDC__ || defined __C99__FUNC__ \ #if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
@ -391,6 +406,7 @@ YYID (yyi)
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS # ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0 # define EXIT_SUCCESS 0
# endif # endif
@ -484,19 +500,19 @@ union yyalloc
#endif #endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from FROM to TO. The source and destination do /* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */ not overlap. */
# ifndef YYCOPY # ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__ # if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \ # define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From))) __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else # else
# define YYCOPY(To, From, Count) \ # define YYCOPY(Dst, Src, Count) \
do \ do \
{ \ { \
YYSIZE_T yyi; \ YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \ (Dst)[yyi] = (Src)[yyi]; \
} \ } \
while (YYID (0)) while (YYID (0))
# endif # endif
@ -602,17 +618,17 @@ static const yytype_int8 yyrhs[] =
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 137, 137, 138, 141, 141, 141, 141, 144, 149, 0, 137, 137, 138, 141, 141, 141, 141, 144, 149,
155, 161, 162, 170, 169, 199, 202, 209, 208, 220, 155, 161, 162, 169, 168, 198, 201, 208, 207, 219,
221, 223, 224, 225, 228, 233, 238, 245, 254, 255, 220, 222, 223, 224, 227, 232, 237, 244, 253, 254,
262, 263, 264, 265, 266, 267, 274, 279, 274, 304, 261, 262, 263, 264, 265, 266, 273, 278, 273, 303,
305, 310, 311, 314, 318, 324, 325, 328, 335, 336, 304, 309, 310, 313, 317, 323, 324, 327, 334, 335,
340, 339, 351, 352, 354, 355, 356, 359, 367, 383, 339, 338, 350, 351, 353, 354, 355, 358, 366, 382,
384, 385, 386, 387, 394, 393, 405, 406, 408, 409, 383, 384, 385, 386, 393, 392, 404, 405, 407, 408,
413, 419, 424, 428, 432, 438, 439 412, 418, 423, 427, 431, 437, 438
}; };
#endif #endif
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE #if YYDEBUG || YYERROR_VERBOSE || 1
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
@ -632,7 +648,7 @@ static const char *const yytname[] =
"object_inherits_item", "object_inherits_specifier", "expressionlist", "object_inherits_item", "object_inherits_specifier", "expressionlist",
"$@5", "expressions", "expressions_inner", "expression", "operator", "$@5", "expressions", "expressions_inner", "expression", "operator",
"array", "$@6", "array_items", "array_items_inner", "simplevalue", "array", "$@6", "array_items", "array_items_inner", "simplevalue",
"value", 0 "value", YY_NULL
}; };
#endif #endif
@ -743,10 +759,10 @@ static const yytype_int8 yytable[] =
49 49
}; };
#define yypact_value_is_default(yystate) \ #define yypact_value_is_default(Yystate) \
((yystate) == (-72)) (!!((Yystate) == (-72)))
#define yytable_value_is_error(yytable_value) \ #define yytable_value_is_error(Yytable_value) \
YYID (0) YYID (0)
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
@ -807,11 +823,12 @@ static const yytype_uint8 yystos[] =
#define YYBACKUP(Token, Value) \ #define YYBACKUP(Token, Value) \
do \ do \
if (yychar == YYEMPTY && yylen == 1) \ if (yychar == YYEMPTY) \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
YYPOPSTACK (1); \ YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \ goto yybackup; \
} \ } \
else \ else \
@ -821,7 +838,7 @@ do \
} \ } \
while (YYID (0)) while (YYID (0))
/* Error token number */
#define YYTERROR 1 #define YYTERROR 1
#define YYERRCODE 256 #define YYERRCODE 256
@ -830,7 +847,6 @@ while (YYID (0))
If N is 0, then set CURRENT to the empty location which ends If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */ the previous symbol: RHS[0] (always defined). */
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ # define YYLLOC_DEFAULT(Current, Rhs, N) \
do \ do \
@ -851,6 +867,8 @@ while (YYID (0))
while (YYID (0)) while (YYID (0))
#endif #endif
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
/* YY_LOCATION_PRINT -- Print the location on the stream. /* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know This macro was not mandated originally: define only if we know
@ -858,10 +876,46 @@ while (YYID (0))
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
__attribute__((__unused__))
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static unsigned
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
#else
static unsigned
yy_location_print_ (yyo, yylocp)
FILE *yyo;
YYLTYPE const * const yylocp;
#endif
{
unsigned res = 0;
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
if (0 <= yylocp->first_line)
{
res += fprintf (yyo, "%d", yylocp->first_line);
if (0 <= yylocp->first_column)
res += fprintf (yyo, ".%d", yylocp->first_column);
}
if (0 <= yylocp->last_line)
{
if (yylocp->first_line < yylocp->last_line)
{
res += fprintf (yyo, "-%d", yylocp->last_line);
if (0 <= end_col)
res += fprintf (yyo, ".%d", end_col);
}
else if (0 <= end_col && yylocp->first_column < end_col)
res += fprintf (yyo, "-%d", end_col);
}
return res;
}
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ yy_location_print_ (File, &(Loc))
(Loc).first_line, (Loc).first_column, \
(Loc).last_line, (Loc).last_column)
# else # else
# define YY_LOCATION_PRINT(File, Loc) ((void) 0) # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
# endif # endif
@ -869,7 +923,6 @@ while (YYID (0))
/* YYLEX -- calling `yylex' with the right arguments. */ /* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM #ifdef YYLEX_PARAM
# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
#else #else
@ -921,6 +974,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context)
ConfigCompiler *context; ConfigCompiler *context;
#endif #endif
{ {
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep) if (!yyvaluep)
return; return;
YYUSE (yylocationp); YYUSE (yylocationp);
@ -1180,12 +1235,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken) yytype_int16 *yyssp, int yytoken)
{ {
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
YYSIZE_T yysize = yysize0; YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */ /* Internationalized format string. */
const char *yyformat = 0; const char *yyformat = YY_NULL;
/* Arguments of yyformat. */ /* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
@ -1245,7 +1299,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break; break;
} }
yyarg[yycount++] = yytname[yyx]; yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]); {
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
if (! (yysize <= yysize1 if (! (yysize <= yysize1
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM)) && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2; return 2;
@ -1253,6 +1308,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
} }
} }
} }
}
switch (yycount) switch (yycount)
{ {
@ -1269,10 +1325,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_ # undef YYCASE_
} }
yysize1 = yysize + yystrlen (yyformat); {
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2; return 2;
yysize = yysize1; yysize = yysize1;
}
if (*yymsg_alloc < yysize) if (*yymsg_alloc < yysize)
{ {
@ -1341,20 +1399,6 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
} }
/* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (ConfigCompiler *context);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
/*----------. /*----------.
@ -1386,11 +1430,40 @@ yyparse (context)
/* The lookahead symbol. */ /* The lookahead symbol. */
int yychar; int yychar;
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
/* Default value used for initialization, for pacifying older GCCs
or non-GCC compilers. */
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
static YYLTYPE yyloc_default
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
/* The semantic value of the lookahead symbol. */ /* The semantic value of the lookahead symbol. */
YYSTYPE yylval; YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* Location data for the lookahead symbol. */ /* Location data for the lookahead symbol. */
YYLTYPE yylloc; YYLTYPE yylloc = yyloc_default;
/* Number of syntax errors so far. */ /* Number of syntax errors so far. */
int yynerrs; int yynerrs;
@ -1404,7 +1477,7 @@ YYLTYPE yylloc;
`yyvs': related to semantic values. `yyvs': related to semantic values.
`yyls': related to locations. `yyls': related to locations.
Refer to the stacks thru separate pointers, to allow yyoverflow Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */ to reallocate them elsewhere. */
/* The state stack. */ /* The state stack. */
@ -1430,7 +1503,7 @@ YYLTYPE yylloc;
int yyn; int yyn;
int yyresult; int yyresult;
/* Lookahead token as an internal (translated) token number. */ /* Lookahead token as an internal (translated) token number. */
int yytoken; int yytoken = 0;
/* The variables used to return semantic value and location from the /* The variables used to return semantic value and location from the
action routines. */ action routines. */
YYSTYPE yyval; YYSTYPE yyval;
@ -1449,10 +1522,9 @@ YYLTYPE yylloc;
Keep to zero when no symbol should be popped. */ Keep to zero when no symbol should be popped. */
int yylen = 0; int yylen = 0;
yytoken = 0; yyssp = yyss = yyssa;
yyss = yyssa; yyvsp = yyvs = yyvsa;
yyvs = yyvsa; yylsp = yyls = yylsa;
yyls = yylsa;
yystacksize = YYINITDEPTH; yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n")); YYDPRINTF ((stderr, "Starting parse\n"));
@ -1461,21 +1533,7 @@ YYLTYPE yylloc;
yyerrstatus = 0; yyerrstatus = 0;
yynerrs = 0; yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = YYEMPTY; /* Cause a token to be read. */
yylsp[0] = yylloc;
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
yyssp = yyss;
yyvsp = yyvs;
yylsp = yyls;
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
#endif
goto yysetstate; goto yysetstate;
/*------------------------------------------------------------. /*------------------------------------------------------------.
@ -1621,7 +1679,9 @@ yybackup:
yychar = YYEMPTY; yychar = YYEMPTY;
yystate = yyn; yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval; *++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
*++yylsp = yylloc; *++yylsp = yylloc;
goto yynewstate; goto yynewstate;
@ -1659,8 +1719,7 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 8: case 8:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */
#line 145 "config_parser.yy" #line 145 "config_parser.yy"
{ {
context->HandleInclude((yyvsp[(2) - (2)].text), false, yylloc); context->HandleInclude((yyvsp[(2) - (2)].text), false, yylloc);
@ -1669,8 +1728,7 @@ yyreduce:
break; break;
case 9: case 9:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */
#line 150 "config_parser.yy" #line 150 "config_parser.yy"
{ {
context->HandleInclude((yyvsp[(2) - (2)].text), true, yylloc); context->HandleInclude((yyvsp[(2) - (2)].text), true, yylloc);
@ -1679,8 +1737,7 @@ yyreduce:
break; break;
case 10: case 10:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */
#line 156 "config_parser.yy" #line 156 "config_parser.yy"
{ {
context->HandleLibrary((yyvsp[(2) - (2)].text)); context->HandleLibrary((yyvsp[(2) - (2)].text));
@ -1689,19 +1746,16 @@ yyreduce:
break; break;
case 12: case 12:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */
#line 163 "config_parser.yy" #line 163 "config_parser.yy"
{ {
(yyval.text) = (yyvsp[(1) - (1)].text); (yyval.text) = (yyvsp[(1) - (1)].text);
free((yyvsp[(1) - (1)].text));
} }
break; break;
case 13: case 13:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 169 "config_parser.yy"
#line 170 "config_parser.yy"
{ {
String name = String((yyvsp[(3) - (3)].text)); String name = String((yyvsp[(3) - (3)].text));
free((yyvsp[(3) - (3)].text)); free((yyvsp[(3) - (3)].text));
@ -1719,9 +1773,8 @@ yyreduce:
break; break;
case 14: case 14:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 184 "config_parser.yy"
#line 185 "config_parser.yy"
{ {
TypeRuleList::Ptr ruleList = *(yyvsp[(6) - (6)].variant); TypeRuleList::Ptr ruleList = *(yyvsp[(6) - (6)].variant);
m_Type->GetRuleList()->AddRules(ruleList); m_Type->GetRuleList()->AddRules(ruleList);
@ -1736,36 +1789,32 @@ yyreduce:
break; break;
case 15: case 15:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 198 "config_parser.yy"
#line 199 "config_parser.yy"
{ {
(yyval.num) = 0; (yyval.num) = 0;
} }
break; break;
case 16: case 16:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 202 "config_parser.yy"
#line 203 "config_parser.yy"
{ {
(yyval.num) = 1; (yyval.num) = 1;
} }
break; break;
case 17: case 17:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 208 "config_parser.yy"
#line 209 "config_parser.yy"
{ {
m_RuleLists.push(boost::make_shared<TypeRuleList>()); m_RuleLists.push(boost::make_shared<TypeRuleList>());
} }
break; break;
case 18: case 18:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 213 "config_parser.yy"
#line 214 "config_parser.yy"
{ {
(yyval.variant) = new Value(m_RuleLists.top()); (yyval.variant) = new Value(m_RuleLists.top());
m_RuleLists.pop(); m_RuleLists.pop();
@ -1773,9 +1822,8 @@ yyreduce:
break; break;
case 24: case 24:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 228 "config_parser.yy"
#line 229 "config_parser.yy"
{ {
m_RuleLists.top()->AddRequire((yyvsp[(2) - (2)].text)); m_RuleLists.top()->AddRequire((yyvsp[(2) - (2)].text));
free((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text));
@ -1783,9 +1831,8 @@ yyreduce:
break; break;
case 25: case 25:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 233 "config_parser.yy"
#line 234 "config_parser.yy"
{ {
m_RuleLists.top()->SetValidator((yyvsp[(2) - (2)].text)); m_RuleLists.top()->SetValidator((yyvsp[(2) - (2)].text));
free((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text));
@ -1793,9 +1840,8 @@ yyreduce:
break; break;
case 26: case 26:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 238 "config_parser.yy"
#line 239 "config_parser.yy"
{ {
TypeRule rule((yyvsp[(2) - (3)].type), (yyvsp[(3) - (3)].text), TypeRuleList::Ptr(), yylloc); TypeRule rule((yyvsp[(2) - (3)].type), (yyvsp[(3) - (3)].text), TypeRuleList::Ptr(), yylloc);
free((yyvsp[(3) - (3)].text)); free((yyvsp[(3) - (3)].text));
@ -1805,9 +1851,8 @@ yyreduce:
break; break;
case 27: case 27:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 245 "config_parser.yy"
#line 246 "config_parser.yy"
{ {
TypeRule rule((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].text), *(yyvsp[(4) - (4)].variant), yylloc); TypeRule rule((yyvsp[(2) - (4)].type), (yyvsp[(3) - (4)].text), *(yyvsp[(4) - (4)].variant), yylloc);
free((yyvsp[(3) - (4)].text)); free((yyvsp[(3) - (4)].text));
@ -1817,9 +1862,8 @@ yyreduce:
break; break;
case 29: case 29:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 255 "config_parser.yy"
#line 256 "config_parser.yy"
{ {
m_Type->SetParent((yyvsp[(2) - (2)].text)); m_Type->SetParent((yyvsp[(2) - (2)].text));
free((yyvsp[(2) - (2)].text)); free((yyvsp[(2) - (2)].text));
@ -1827,18 +1871,16 @@ yyreduce:
break; break;
case 35: case 35:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 267 "config_parser.yy"
#line 268 "config_parser.yy"
{ {
(yyval.type) = (yyvsp[(1) - (1)].type); (yyval.type) = (yyvsp[(1) - (1)].type);
} }
break; break;
case 36: case 36:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 273 "config_parser.yy"
#line 274 "config_parser.yy"
{ {
m_Abstract = false; m_Abstract = false;
m_Local = false; m_Local = false;
@ -1846,9 +1888,8 @@ yyreduce:
break; break;
case 37: case 37:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 278 "config_parser.yy"
#line 279 "config_parser.yy"
{ {
m_Item = boost::make_shared<ConfigItemBuilder>(yylloc); m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
@ -1863,9 +1904,8 @@ yyreduce:
break; break;
case 38: case 38:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 290 "config_parser.yy"
#line 291 "config_parser.yy"
{ {
ExpressionList::Ptr exprl = *(yyvsp[(7) - (7)].variant); ExpressionList::Ptr exprl = *(yyvsp[(7) - (7)].variant);
delete (yyvsp[(7) - (7)].variant); delete (yyvsp[(7) - (7)].variant);
@ -1880,36 +1920,32 @@ yyreduce:
break; break;
case 40: case 40:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 305 "config_parser.yy"
#line 306 "config_parser.yy"
{ {
m_Abstract = true; m_Abstract = true;
} }
break; break;
case 43: case 43:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 314 "config_parser.yy"
#line 315 "config_parser.yy"
{ {
m_Abstract = true; m_Abstract = true;
} }
break; break;
case 44: case 44:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 318 "config_parser.yy"
#line 319 "config_parser.yy"
{ {
m_Local = true; m_Local = true;
} }
break; break;
case 47: case 47:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 328 "config_parser.yy"
#line 329 "config_parser.yy"
{ {
m_Item->AddParent((yyvsp[(1) - (1)].text)); m_Item->AddParent((yyvsp[(1) - (1)].text));
free((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text));
@ -1917,18 +1953,16 @@ yyreduce:
break; break;
case 50: case 50:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 339 "config_parser.yy"
#line 340 "config_parser.yy"
{ {
m_ExpressionLists.push(boost::make_shared<ExpressionList>()); m_ExpressionLists.push(boost::make_shared<ExpressionList>());
} }
break; break;
case 51: case 51:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 344 "config_parser.yy"
#line 345 "config_parser.yy"
{ {
(yyval.variant) = new Value(m_ExpressionLists.top()); (yyval.variant) = new Value(m_ExpressionLists.top());
m_ExpressionLists.pop(); m_ExpressionLists.pop();
@ -1936,9 +1970,8 @@ yyreduce:
break; break;
case 57: case 57:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 359 "config_parser.yy"
#line 360 "config_parser.yy"
{ {
Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc); Expression expr((yyvsp[(1) - (3)].text), (yyvsp[(2) - (3)].op), *(yyvsp[(3) - (3)].variant), yylloc);
free((yyvsp[(1) - (3)].text)); free((yyvsp[(1) - (3)].text));
@ -1949,9 +1982,8 @@ yyreduce:
break; break;
case 58: case 58:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 367 "config_parser.yy"
#line 368 "config_parser.yy"
{ {
Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc); Expression subexpr((yyvsp[(3) - (6)].text), (yyvsp[(5) - (6)].op), *(yyvsp[(6) - (6)].variant), yylloc);
free((yyvsp[(3) - (6)].text)); free((yyvsp[(3) - (6)].text));
@ -1968,27 +2000,24 @@ yyreduce:
break; break;
case 63: case 63:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 387 "config_parser.yy"
#line 388 "config_parser.yy"
{ {
(yyval.op) = (yyvsp[(1) - (1)].op); (yyval.op) = (yyvsp[(1) - (1)].op);
} }
break; break;
case 64: case 64:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 393 "config_parser.yy"
#line 394 "config_parser.yy"
{ {
m_Arrays.push(boost::make_shared<Array>()); m_Arrays.push(boost::make_shared<Array>());
} }
break; break;
case 65: case 65:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 398 "config_parser.yy"
#line 399 "config_parser.yy"
{ {
(yyval.variant) = new Value(m_Arrays.top()); (yyval.variant) = new Value(m_Arrays.top());
m_Arrays.pop(); m_Arrays.pop();
@ -1996,27 +2025,24 @@ yyreduce:
break; break;
case 69: case 69:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 409 "config_parser.yy"
#line 410 "config_parser.yy"
{ {
m_Arrays.top()->Add(*(yyvsp[(1) - (1)].variant)); m_Arrays.top()->Add(*(yyvsp[(1) - (1)].variant));
} }
break; break;
case 70: case 70:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 413 "config_parser.yy"
#line 414 "config_parser.yy"
{ {
m_Arrays.top()->Add(*(yyvsp[(3) - (3)].variant)); m_Arrays.top()->Add(*(yyvsp[(3) - (3)].variant));
} }
break; break;
case 71: case 71:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 419 "config_parser.yy"
#line 420 "config_parser.yy"
{ {
(yyval.variant) = new Value((yyvsp[(1) - (1)].text)); (yyval.variant) = new Value((yyvsp[(1) - (1)].text));
free((yyvsp[(1) - (1)].text)); free((yyvsp[(1) - (1)].text));
@ -2024,45 +2050,40 @@ yyreduce:
break; break;
case 72: case 72:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 424 "config_parser.yy"
#line 425 "config_parser.yy"
{ {
(yyval.variant) = new Value((yyvsp[(1) - (1)].num)); (yyval.variant) = new Value((yyvsp[(1) - (1)].num));
} }
break; break;
case 73: case 73:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 428 "config_parser.yy"
#line 429 "config_parser.yy"
{ {
(yyval.variant) = new Value(); (yyval.variant) = new Value();
} }
break; break;
case 74: case 74:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 432 "config_parser.yy"
#line 433 "config_parser.yy"
{ {
(yyval.variant) = (yyvsp[(1) - (1)].variant); (yyval.variant) = (yyvsp[(1) - (1)].variant);
} }
break; break;
case 76: case 76:
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 439 "config_parser.yy"
#line 440 "config_parser.yy"
{ {
(yyval.variant) = (yyvsp[(1) - (1)].variant); (yyval.variant) = (yyvsp[(1) - (1)].variant);
} }
break; break;
/* Line 1792 of yacc.c */
/* Line 1806 of yacc.c */ #line 2087 "config_parser.cc"
#line 2066 "config_parser.cc"
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires
@ -2227,7 +2248,9 @@ yyerrlab1:
YY_STACK_PRINT (yyss, yyssp); YY_STACK_PRINT (yyss, yyssp);
} }
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval; *++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
yyerror_range[2] = yylloc; yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of /* Using YYLLOC is tempting, but would change the location of
@ -2256,7 +2279,7 @@ yyabortlab:
yyresult = 1; yyresult = 1;
goto yyreturn; goto yyreturn;
#if !defined(yyoverflow) || YYERROR_VERBOSE #if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------. /*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. | | yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/ `-------------------------------------------------*/
@ -2298,8 +2321,6 @@ yyreturn:
} }
/* Line 2055 of yacc.c */
/* Line 2067 of yacc.c */ #line 443 "config_parser.yy"
#line 444 "config_parser.yy"

View File

@ -162,7 +162,6 @@ identifier: T_IDENTIFIER
| T_STRING | T_STRING
{ {
$$ = $1; $$ = $1;
free($1);
} }
; ;