Implemented host dependencies

This commit is contained in:
Gunnar Beutner 2012-07-09 10:09:53 +02:00
parent 0b730a8f6e
commit 55ca6fd276
11 changed files with 417 additions and 263 deletions

View File

@ -61,3 +61,19 @@ bool Dictionary::Contains(const string& key) const
{ {
return (m_Data.find(key) != m_Data.end()); return (m_Data.find(key) != m_Data.end());
} }
/**
* Removes the specified key from the dictionary.
*
* @param key The key.
*/
void Dictionary::RemoveProperty(const string& key)
{
Dictionary::Iterator it;
it = m_Data.find(key);
if (it == m_Data.end())
return;
m_Data.erase(it);
}

View File

@ -123,6 +123,8 @@ public:
long GetLength(void) const; long GetLength(void) const;
void RemoveProperty(const string& key);
private: private:
map<string, Variant> m_Data; map<string, Variant> m_Data;
}; };

View File

@ -33,3 +33,4 @@ Dictionary::Ptr Host::GetGroups(void) const
GetConfigObject()->GetProperty("hostgroups", &value); GetConfigObject()->GetProperty("hostgroups", &value);
return value; return value;
} }

View File

@ -93,6 +93,26 @@ Dictionary::Ptr Service::GetDependencies(void) const
return value; return value;
} }
void Service::GetDependenciesRecursive(const Dictionary::Ptr& result) const {
assert(result);
Dictionary::Ptr dependencies = GetDependencies();
if (!dependencies)
return;
Dictionary::Iterator it;
for (it = dependencies->Begin(); it != dependencies->End(); it++) {
if (result->Contains(it->second))
continue;
result->SetProperty(it->second, it->second);
Service service = Service::GetByName(it->second);
service.GetDependenciesRecursive(result);
}
}
Dictionary::Ptr Service::GetGroups(void) const Dictionary::Ptr Service::GetGroups(void) const
{ {
Dictionary::Ptr value; Dictionary::Ptr value;
@ -109,24 +129,20 @@ Dictionary::Ptr Service::GetCheckers(void) const
bool Service::IsReachable(void) const bool Service::IsReachable(void) const
{ {
Dictionary::Ptr dependencies = GetDependencies(); Dictionary::Ptr dependencies = boost::make_shared<Dictionary>();
GetDependenciesRecursive(dependencies);
if (dependencies) { Dictionary::Iterator it;
Dictionary::Iterator it; for (it = dependencies->Begin(); it != dependencies->End(); it++) {
for (it = dependencies->Begin(); it != dependencies->End(); it++) { Service service = Service::GetByName(it->second);
Service service = Service::GetByName(it->second);
/* ignore ourselves */ /* ignore ourselves */
if (service.GetName() == GetName()) if (service.GetName() == GetName())
continue; continue;
if (!service.IsReachable()) if (service.GetStateType() == StateTypeHard && service.GetState() != StateOK &&
return false; service.GetState() != StateWarning)
return false;
if (service.GetStateType() == StateTypeHard && service.GetState() != StateOK &&
service.GetState() != StateWarning)
return false;
}
} }
return true; return true;
@ -346,3 +362,21 @@ bool Service::IsAllowedChecker(const string& checker) const
return false; return false;
} }
Dictionary::Ptr Service::ResolveDependencies(Host host, const Dictionary::Ptr& dependencies)
{
Dictionary::Ptr services;
host.GetConfigObject()->GetProperty("services", &services);
Dictionary::Ptr result = boost::make_shared<Dictionary>();
Dictionary::Iterator it;
for (it = dependencies->Begin(); it != dependencies->End(); it++) {
if (services && services->Contains(it->first))
result->AddUnnamedProperty(host.GetName() + "-" + it->first);
else
result->AddUnnamedProperty(it->first);
}
return result;
}

View File

@ -41,6 +41,7 @@ public:
long GetCheckInterval(void) const; long GetCheckInterval(void) const;
long GetRetryInterval(void) const; long GetRetryInterval(void) const;
Dictionary::Ptr GetDependencies(void) const; Dictionary::Ptr GetDependencies(void) const;
void GetDependenciesRecursive(const Dictionary::Ptr& result) const;
Dictionary::Ptr GetGroups(void) const; Dictionary::Ptr GetGroups(void) const;
Dictionary::Ptr GetCheckers(void) const; Dictionary::Ptr GetCheckers(void) const;
@ -82,6 +83,8 @@ public:
static ServiceStateType StateTypeFromString(const string& state); static ServiceStateType StateTypeFromString(const string& state);
static string StateTypeToString(ServiceStateType state); static string StateTypeToString(ServiceStateType state);
static Dictionary::Ptr ResolveDependencies(Host host, const Dictionary::Ptr& dependencies);
private: private:
static bool m_DependencyCacheValid; static bool m_DependencyCacheValid;
}; };

View File

@ -61,13 +61,36 @@ void CompatComponent::Stop(void)
void CompatComponent::DumpHostStatus(ofstream& fp, Host host) void CompatComponent::DumpHostStatus(ofstream& fp, Host host)
{ {
int state = 0; /* up */
Dictionary::Ptr dependencies;
if (host.GetConfigObject()->GetProperty("dependencies", &dependencies)) {
dependencies = Service::ResolveDependencies(host, dependencies);
Dictionary::Iterator it;
for (it = dependencies->Begin(); it != dependencies->End(); it++) {
Service service = Service::GetByName(it->second);
if (!service.IsReachable()) {
std::cerr << service.GetName() << " is unreachable." << std::endl;
state = 2; /* unreachable */
break;
}
if (service.GetState() != StateOK && service.GetState() != StateWarning) {
state = 1; /* down */
break;
}
}
}
fp << "hoststatus {" << "\n" fp << "hoststatus {" << "\n"
<< "\t" << "host_name=" << host.GetName() << "\n" << "\t" << "host_name=" << host.GetName() << "\n"
<< "\t" << "has_been_checked=1" << "\n" << "\t" << "has_been_checked=1" << "\n"
<< "\t" << "should_be_scheduled=1" << "\n" << "\t" << "should_be_scheduled=1" << "\n"
<< "\t" << "check_execution_time=0" << "\n" << "\t" << "check_execution_time=0" << "\n"
<< "\t" << "check_latency=0" << "\n" << "\t" << "check_latency=0" << "\n"
<< "\t" << "current_state=0" << "\n" << "\t" << "current_state=" << state << "\n"
<< "\t" << "state_type=1" << "\n" << "\t" << "state_type=1" << "\n"
<< "\t" << "last_check=" << time(NULL) << "\n" << "\t" << "last_check=" << time(NULL) << "\n"
<< "\t" << "next_check=" << time(NULL) << "\n" << "\t" << "next_check=" << time(NULL) << "\n"
@ -124,7 +147,7 @@ void CompatComponent::DumpServiceStatus(ofstream& fp, Service service)
output = text + " (" + output + ")"; output = text + " (" + output + ")";
} }
if (state >= StateUnknown) if (state > StateUnknown)
state = StateUnknown; state = StateUnknown;
fp << "servicestatus {" << "\n" fp << "servicestatus {" << "\n"

View File

@ -54,7 +54,7 @@ void ConvenienceComponent::HostAddedHandler(const ConfigItem::Ptr& item)
HostCommittedHandler(item); HostCommittedHandler(item);
} }
void ConvenienceComponent::CopyServiceAttributes(const Dictionary::Ptr& service, const ConfigItemBuilder::Ptr& builder) void ConvenienceComponent::CopyServiceAttributes(const ConfigObject::Ptr& host, const Dictionary::Ptr& service, const ConfigItemBuilder::Ptr& builder)
{ {
Dictionary::Ptr macros; Dictionary::Ptr macros;
if (service->GetProperty("macros", &macros)) if (service->GetProperty("macros", &macros))
@ -113,7 +113,7 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
builder->AddExpression("host_name", OperatorSet, item->GetName()); builder->AddExpression("host_name", OperatorSet, item->GetName());
builder->AddExpression("alias", OperatorSet, svcname); builder->AddExpression("alias", OperatorSet, svcname);
CopyServiceAttributes(host->GetProperties(), builder); CopyServiceAttributes(host, host->GetProperties(), builder);
if (svcdesc.GetType() == VariantString) { if (svcdesc.GetType() == VariantString) {
builder->AddParent(svcdesc); builder->AddParent(svcdesc);
@ -129,7 +129,12 @@ void ConvenienceComponent::HostCommittedHandler(const ConfigItem::Ptr& item)
builder->AddParent(parent); builder->AddParent(parent);
CopyServiceAttributes(service, builder); CopyServiceAttributes(host, service, builder);
Dictionary::Ptr dependencies;
if (service->GetProperty("dependencies", &dependencies))
builder->AddExpression("dependencies", OperatorPlus,
Service::ResolveDependencies(host, dependencies));
} else { } else {
throw invalid_argument("Service description must be either a string or a dictionary."); throw invalid_argument("Service description must be either a string or a dictionary.");
} }

View File

@ -34,7 +34,7 @@ public:
virtual void Stop(void); virtual void Stop(void);
private: private:
void CopyServiceAttributes(const Dictionary::Ptr& service, const ConfigItemBuilder::Ptr& builder); void CopyServiceAttributes(const ConfigObject::Ptr& host, const Dictionary::Ptr& service, const ConfigItemBuilder::Ptr& builder);
void HostAddedHandler(const ConfigItem::Ptr& item); void HostAddedHandler(const ConfigItem::Ptr& item);
void HostCommittedHandler(const ConfigItem::Ptr& item); void HostCommittedHandler(const ConfigItem::Ptr& item);
void HostRemovedHandler(const ConfigItem::Ptr& item); void HostRemovedHandler(const ConfigItem::Ptr& item);

View File

@ -53,7 +53,6 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t; typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t; typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */ /* Limits of integral types. */
#ifndef INT8_MIN #ifndef INT8_MIN
@ -84,6 +83,8 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U) #define UINT32_MAX (4294967295U)
#endif #endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */ #endif /* ! FLEXINT_H */
#ifdef __cplusplus #ifdef __cplusplus
@ -157,7 +158,15 @@ typedef void* yyscan_t;
/* Size of default input buffer. */ /* Size of default input buffer. */
#ifndef YY_BUF_SIZE #ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384 #define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif #endif
/* The state buf must be large enough to hold one state per character in the main buffer. /* The state buf must be large enough to hold one state per character in the main buffer.
@ -537,7 +546,7 @@ do { \
} while (0) } while (0)
#define YY_NO_UNISTD_H 1 #define YY_NO_UNISTD_H 1
#line 541 "config_lexer.cc" #line 550 "config_lexer.cc"
#define INITIAL 0 #define INITIAL 0
#define IN_C_COMMENT 1 #define IN_C_COMMENT 1
@ -675,7 +684,12 @@ static int input (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */ /* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE #ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192 #define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif #endif
/* Copy whatever the last rule matched to the standard output. */ /* Copy whatever the last rule matched to the standard output. */
@ -694,7 +708,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \ { \
int c = '*'; \ int c = '*'; \
unsigned n; \ size_t n; \
for ( n = 0; n < max_size && \ for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \ buf[n] = (char) c; \
@ -781,7 +795,7 @@ YY_DECL
#line 49 "config_lexer.ll" #line 49 "config_lexer.ll"
#line 785 "config_lexer.cc" #line 799 "config_lexer.cc"
yylval = yylval_param; yylval = yylval_param;
@ -998,7 +1012,7 @@ YY_RULE_SETUP
#line 80 "config_lexer.ll" #line 80 "config_lexer.ll"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 1002 "config_lexer.cc" #line 1016 "config_lexer.cc"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(IN_C_COMMENT): case YY_STATE_EOF(IN_C_COMMENT):
yyterminate(); yyterminate();
@ -1779,8 +1793,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes. * scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan * @param yybytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object. * @param yyscanner The scanner object.
* @return the newly allocated buffer state object. * @return the newly allocated buffer state object.
*/ */

View File

@ -1,10 +1,8 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* A Bison parser, made by GNU Bison 2.4.1. */ /* Bison implementation for Yacc-like parsers in C
/* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
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
@ -46,7 +44,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "2.4.1" #define YYBISON_VERSION "2.5"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@ -68,8 +66,8 @@
/* Copy the first part of user declarations. */ /* Copy the first part of user declarations. */
/* Line 189 of yacc.c */ /* Line 268 of yacc.c */
#line 73 "config_parser.cc" #line 71 "config_parser.cc"
/* Enabling traces. */ /* Enabling traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
@ -91,7 +89,7 @@
/* "%code requires" blocks. */ /* "%code requires" blocks. */
/* Line 209 of yacc.c */ /* Line 288 of yacc.c */
#line 1 "config_parser.yy" #line 1 "config_parser.yy"
/****************************************************************************** /******************************************************************************
@ -122,8 +120,8 @@ using namespace icinga;
/* Line 209 of yacc.c */ /* Line 288 of yacc.c */
#line 127 "config_parser.cc" #line 125 "config_parser.cc"
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
@ -170,7 +168,7 @@ using namespace icinga;
typedef union YYSTYPE typedef union YYSTYPE
{ {
/* Line 214 of yacc.c */ /* Line 293 of yacc.c */
#line 38 "config_parser.yy" #line 38 "config_parser.yy"
char *text; char *text;
@ -180,8 +178,8 @@ typedef union YYSTYPE
/* Line 214 of yacc.c */ /* Line 293 of yacc.c */
#line 185 "config_parser.cc" #line 183 "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 */
@ -204,7 +202,7 @@ typedef struct YYLTYPE
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
/* Line 264 of yacc.c */ /* Line 343 of yacc.c */
#line 66 "config_parser.yy" #line 66 "config_parser.yy"
@ -234,8 +232,8 @@ void ConfigCompiler::Compile(void)
/* Line 264 of yacc.c */ /* Line 343 of yacc.c */
#line 239 "config_parser.cc" #line 237 "config_parser.cc"
#ifdef short #ifdef short
# undef short # undef short
@ -285,7 +283,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_ #ifndef YY_
# if 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)
@ -338,11 +336,11 @@ YYID (yyi)
# define alloca _alloca # define alloca _alloca
# else # else
# define YYSTACK_ALLOC alloca # define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (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 */
# ifndef _STDLIB_H # ifndef EXIT_SUCCESS
# define _STDLIB_H 1 # define EXIT_SUCCESS 0
# endif # endif
# endif # endif
# endif # endif
@ -365,24 +363,24 @@ YYID (yyi)
# ifndef YYSTACK_ALLOC_MAXIMUM # ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif # endif
# if (defined __cplusplus && ! defined _STDLIB_H \ # if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \ && ! ((defined YYMALLOC || defined malloc) \
&& (defined YYFREE || defined free))) && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H # ifndef EXIT_SUCCESS
# define _STDLIB_H 1 # define EXIT_SUCCESS 0
# endif # endif
# endif # endif
# ifndef YYMALLOC # ifndef YYMALLOC
# define YYMALLOC malloc # define YYMALLOC malloc
# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif # endif
# endif # endif
# ifndef YYFREE # ifndef YYFREE
# define YYFREE free # define YYFREE free
# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER) || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */ void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif # endif
@ -413,23 +411,7 @@ union yyalloc
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM) + 2 * YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do # define YYCOPY_NEEDED 1
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
# endif
# endif
/* Relocate STACK from its old location to the new one. The /* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of local variables YYSIZE and YYSTACKSIZE give the old and new number of
@ -449,6 +431,26 @@ union yyalloc
#endif #endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from FROM to TO. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(To, From, Count) \
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
# else
# define YYCOPY(To, From, Count) \
do \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
while (YYID (0))
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */ /* YYFINAL -- State number of the termination state. */
#define YYFINAL 2 #define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */ /* YYLAST -- Last index in YYTABLE. */
@ -592,8 +594,8 @@ static const yytype_uint8 yyr2[] =
0, 4, 1, 1, 2, 0, 1, 3 0, 4, 1, 1, 2, 0, 1, 3
}; };
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
STATE-NUM when YYTABLE doesn't specify something else to do. Zero Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */ means the default is an error. */
static const yytype_uint8 yydefact[] = static const yytype_uint8 yydefact[] =
{ {
@ -638,8 +640,7 @@ static const yytype_int8 yypgoto[] =
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says. number is the opposite. If YYTABLE_NINF, syntax error. */
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -1 #define YYTABLE_NINF -1
static const yytype_uint8 yytable[] = static const yytype_uint8 yytable[] =
{ {
@ -650,6 +651,12 @@ static const yytype_uint8 yytable[] =
61, 39, 40, 60, 23, 0, 0, 59, 26 61, 39, 40, 60, 23, 0, 0, 59, 26
}; };
#define yypact_value_is_default(yystate) \
((yystate) == (-45))
#define yytable_value_is_error(yytable_value) \
YYID (0)
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
{ {
3, 4, 5, 7, 8, 9, 10, 11, 52, 0, 3, 4, 5, 7, 8, 9, 10, 11, 52, 0,
@ -684,9 +691,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily /* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC. to ease the transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */ Once GCC version 2 has supplanted version 1, this can go. However,
YYFAIL appears to be in use. Nevertheless, it is formally deprecated
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
discussed. */
#define YYFAIL goto yyerrlab #define YYFAIL goto yyerrlab
#if defined YYFAIL
/* This is here to suppress warnings from the GCC cpp's
-Wunused-macros. Normally we don't worry about that warning, but
some users do, and we want to make it easy for users to remove
YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif
#define YYRECOVERING() (!!yyerrstatus) #define YYRECOVERING() (!!yyerrstatus)
@ -696,7 +712,6 @@ do \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
yytoken = YYTRANSLATE (yychar); \
YYPOPSTACK (1); \ YYPOPSTACK (1); \
goto yybackup; \ goto yybackup; \
} \ } \
@ -743,7 +758,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */ we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if YYLTYPE_IS_TRIVIAL # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \ (Loc).first_line, (Loc).first_column, \
@ -952,7 +967,6 @@ int yydebug;
# define YYMAXDEPTH 10000 # define YYMAXDEPTH 10000
#endif #endif
#if YYERROR_VERBOSE #if YYERROR_VERBOSE
@ -1055,115 +1069,142 @@ yytnamerr (char *yyres, const char *yystr)
} }
# endif # endif
/* Copy into YYRESULT an error message about the unexpected token /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
YYCHAR while in state YYSTATE. Return the number of bytes copied, about the unexpected token YYTOKEN for the state stack whose top is
including the terminating null byte. If YYRESULT is null, do not YYSSP.
copy anything; just return the number of bytes that would be
copied. As a special case, return 0 if an ordinary "syntax error" Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
message will do. Return YYSIZE_MAXIMUM if overflow occurs during not large enough to hold the message. In that case, also set
size calculation. */ *YYMSG_ALLOC to the required number of bytes. Return 2 if the
static YYSIZE_T required number of bytes is too large to store. */
yysyntax_error (char *yyresult, int yystate, int yychar) static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{ {
int yyn = yypact[yystate]; YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = 0;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
"expected"). */
int yycount = 0;
if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) /* There are many possibilities here to consider:
return 0; - Assume YYFAIL is not used. It's too flawed to consider. See
else <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
for details. YYERROR is fine as it does not invoke this
function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
tokens because there are none.
- The only way there can be no lookahead present (in yychar) is if
this state is a consistent state with a default action. Thus,
detecting the absence of a lookahead is sufficient to determine
that there is no unexpected or expected token to report. In that
case, just report a simple "syntax error".
- Don't assume there isn't a lookahead just because this state is a
consistent state with a default action. There might have been a
previous inconsistent state, consistent state with a non-default
action, or user semantic action that manipulated yychar.
- Of course, the expected token list depends on states to have
correct lookahead information, and it depends on the parser not
to perform extra reductions after fetching a lookahead from the
scanner and before detecting a syntax error. Thus, state merging
(from LALR or IELR) and default reductions corrupt the expected
token list. However, the list is correct for canonical LR with
one exception: it will still contain any token that will not be
accepted due to an error action in a later state.
*/
if (yytoken != YYEMPTY)
{ {
int yytype = YYTRANSLATE (yychar); int yyn = yypact[*yyssp];
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); yyarg[yycount++] = yytname[yytoken];
YYSIZE_T yysize = yysize0; if (!yypact_value_is_default (yyn))
YYSIZE_T yysize1; {
int yysize_overflow = 0; /* Start YYX at -YYN if negative to avoid negative indexes in
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; YYCHECK. In other words, skip the first -YYN actions for
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; this state because they are default actions. */
int yyx; int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yyx;
# if 0 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
/* This is so xgettext sees the translatable formats that are if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
constructed on the fly. */ && !yytable_value_is_error (yytable[yyx + yyn]))
YY_("syntax error, unexpected %s"); {
YY_("syntax error, unexpected %s, expecting %s"); if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
YY_("syntax error, unexpected %s, expecting %s or %s"); {
YY_("syntax error, unexpected %s, expecting %s or %s or %s"); yycount = 1;
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); yysize = yysize0;
# endif break;
char *yyfmt; }
char const *yyf; yyarg[yycount++] = yytname[yyx];
static char const yyunexpected[] = "syntax error, unexpected %s"; yysize1 = yysize + yytnamerr (0, yytname[yyx]);
static char const yyexpecting[] = ", expecting %s"; if (! (yysize <= yysize1
static char const yyor[] = " or %s"; && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
char yyformat[sizeof yyunexpected return 2;
+ sizeof yyexpecting - 1 yysize = yysize1;
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) }
* (sizeof yyor - 1))]; }
char const *yyprefix = yyexpecting;
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn < 0 ? -yyn : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = YYLAST - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
int yycount = 1;
yyarg[0] = yytname[yytype];
yyfmt = yystpcpy (yyformat, yyunexpected);
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
yycount = 1;
yysize = yysize0;
yyformat[sizeof yyunexpected - 1] = '\0';
break;
}
yyarg[yycount++] = yytname[yyx];
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
yyfmt = yystpcpy (yyfmt, yyprefix);
yyprefix = yyor;
}
yyf = YY_(yyformat);
yysize1 = yysize + yystrlen (yyf);
yysize_overflow |= (yysize1 < yysize);
yysize = yysize1;
if (yysize_overflow)
return YYSIZE_MAXIMUM;
if (yyresult)
{
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
char *yyp = yyresult;
int yyi = 0;
while ((*yyp = *yyf) != '\0')
{
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyf += 2;
}
else
{
yyp++;
yyf++;
}
}
}
return yysize;
} }
switch (yycount)
{
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
YYCASE_(0, YY_("syntax error"));
YYCASE_(1, YY_("syntax error, unexpected %s"));
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
}
yysize1 = yysize + yystrlen (yyformat);
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
return 2;
yysize = yysize1;
if (*yymsg_alloc < yysize)
{
*yymsg_alloc = 2 * yysize;
if (! (yysize <= *yymsg_alloc
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
return 1;
}
/* Avoid sprintf, as that infringes on the user's name space.
Don't have undefined behavior even if the translation
produced a string with the wrong number of "%s"s. */
{
char *yyp = *yymsg;
int yyi = 0;
while ((*yyp = *yyformat) != '\0')
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
{
yyp += yytnamerr (yyp, yyarg[yyi++]);
yyformat += 2;
}
else
{
yyp++;
yyformat++;
}
}
return 0;
} }
#endif /* YYERROR_VERBOSE */ #endif /* YYERROR_VERBOSE */
/*-----------------------------------------------. /*-----------------------------------------------.
| Release the memory associated to this symbol. | | Release the memory associated to this symbol. |
@ -1200,6 +1241,7 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, context)
} }
} }
/* Prevent warnings from -Wmissing-prototypes. */ /* Prevent warnings from -Wmissing-prototypes. */
#ifdef YYPARSE_PARAM #ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus #if defined __STDC__ || defined __cplusplus
@ -1216,12 +1258,9 @@ int yyparse ();
#endif /* ! YYPARSE_PARAM */ #endif /* ! YYPARSE_PARAM */
/*----------.
| yyparse. |
`----------*/
/*-------------------------.
| yyparse or yypush_parse. |
`-------------------------*/
#ifdef YYPARSE_PARAM #ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \ #if (defined __STDC__ || defined __C99__FUNC__ \
@ -1285,7 +1324,7 @@ YYLTYPE yylloc;
YYLTYPE *yylsp; YYLTYPE *yylsp;
/* The locations where the error started and ended. */ /* The locations where the error started and ended. */
YYLTYPE yyerror_range[2]; YYLTYPE yyerror_range[3];
YYSIZE_T yystacksize; YYSIZE_T yystacksize;
@ -1332,7 +1371,7 @@ YYLTYPE yylloc;
yyvsp = yyvs; yyvsp = yyvs;
yylsp = yyls; yylsp = yyls;
#if YYLTYPE_IS_TRIVIAL #if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */ /* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1; yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1; yylloc.first_column = yylloc.last_column = 1;
@ -1434,7 +1473,7 @@ yybackup:
/* First try to decide what to do without reference to lookahead token. */ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate]; yyn = yypact[yystate];
if (yyn == YYPACT_NINF) if (yypact_value_is_default (yyn))
goto yydefault; goto yydefault;
/* Not known => get a lookahead token if don't already have one. */ /* Not known => get a lookahead token if don't already have one. */
@ -1465,8 +1504,8 @@ yybackup:
yyn = yytable[yyn]; yyn = yytable[yyn];
if (yyn <= 0) if (yyn <= 0)
{ {
if (yyn == 0 || yyn == YYTABLE_NINF) if (yytable_value_is_error (yyn))
goto yyerrlab; goto yyerrlab;
yyn = -yyn; yyn = -yyn;
goto yyreduce; goto yyreduce;
} }
@ -1522,7 +1561,7 @@ yyreduce:
{ {
case 6: case 6:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 103 "config_parser.yy" #line 103 "config_parser.yy"
{ {
context->HandleInclude((yyvsp[(2) - (2)].text)); context->HandleInclude((yyvsp[(2) - (2)].text));
@ -1531,7 +1570,7 @@ yyreduce:
case 7: case 7:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 108 "config_parser.yy" #line 108 "config_parser.yy"
{ {
m_Abstract = false; m_Abstract = false;
@ -1541,7 +1580,7 @@ yyreduce:
case 8: case 8:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 113 "config_parser.yy" #line 113 "config_parser.yy"
{ {
m_Item = boost::make_shared<ConfigItemBuilder>(yylloc); m_Item = boost::make_shared<ConfigItemBuilder>(yylloc);
@ -1552,7 +1591,7 @@ yyreduce:
case 9: case 9:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 119 "config_parser.yy" #line 119 "config_parser.yy"
{ {
Object::Ptr exprl_object = *(yyvsp[(8) - (8)].variant); Object::Ptr exprl_object = *(yyvsp[(8) - (8)].variant);
@ -1570,7 +1609,7 @@ yyreduce:
case 12: case 12:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 138 "config_parser.yy" #line 138 "config_parser.yy"
{ {
m_Abstract = true; m_Abstract = true;
@ -1579,7 +1618,7 @@ yyreduce:
case 13: case 13:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 142 "config_parser.yy" #line 142 "config_parser.yy"
{ {
m_Local = true; m_Local = true;
@ -1588,7 +1627,7 @@ yyreduce:
case 16: case 16:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 152 "config_parser.yy" #line 152 "config_parser.yy"
{ {
m_Item->AddParent((yyvsp[(1) - (1)].text)); m_Item->AddParent((yyvsp[(1) - (1)].text));
@ -1598,7 +1637,7 @@ yyreduce:
case 19: case 19:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 163 "config_parser.yy" #line 163 "config_parser.yy"
{ {
m_ExpressionLists.push(boost::make_shared<ExpressionList>()); m_ExpressionLists.push(boost::make_shared<ExpressionList>());
@ -1607,7 +1646,7 @@ yyreduce:
case 20: case 20:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 168 "config_parser.yy" #line 168 "config_parser.yy"
{ {
(yyval.variant) = new Variant(m_ExpressionLists.top()); (yyval.variant) = new Variant(m_ExpressionLists.top());
@ -1617,7 +1656,7 @@ yyreduce:
case 26: case 26:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 183 "config_parser.yy" #line 183 "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);
@ -1630,7 +1669,7 @@ yyreduce:
case 27: case 27:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 191 "config_parser.yy" #line 191 "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);
@ -1649,7 +1688,7 @@ yyreduce:
case 28: case 28:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 205 "config_parser.yy" #line 205 "config_parser.yy"
{ {
Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc); Expression expr((yyvsp[(1) - (1)].text), OperatorSet, (yyvsp[(1) - (1)].text), yylloc);
@ -1661,7 +1700,7 @@ yyreduce:
case 33: case 33:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 218 "config_parser.yy" #line 218 "config_parser.yy"
{ {
(yyval.op) = (yyvsp[(1) - (1)].op); (yyval.op) = (yyvsp[(1) - (1)].op);
@ -1670,7 +1709,7 @@ yyreduce:
case 34: case 34:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 224 "config_parser.yy" #line 224 "config_parser.yy"
{ {
(yyval.variant) = new Variant((yyvsp[(1) - (1)].text)); (yyval.variant) = new Variant((yyvsp[(1) - (1)].text));
@ -1680,7 +1719,7 @@ yyreduce:
case 35: case 35:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 229 "config_parser.yy" #line 229 "config_parser.yy"
{ {
(yyval.variant) = new Variant((yyvsp[(1) - (1)].num)); (yyval.variant) = new Variant((yyvsp[(1) - (1)].num));
@ -1689,7 +1728,7 @@ yyreduce:
case 36: case 36:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 233 "config_parser.yy" #line 233 "config_parser.yy"
{ {
(yyval.variant) = new Variant(); (yyval.variant) = new Variant();
@ -1698,7 +1737,7 @@ yyreduce:
case 39: case 39:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 241 "config_parser.yy" #line 241 "config_parser.yy"
{ {
(yyval.variant) = (yyvsp[(1) - (1)].variant); (yyval.variant) = (yyvsp[(1) - (1)].variant);
@ -1707,7 +1746,7 @@ yyreduce:
case 40: case 40:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 247 "config_parser.yy" #line 247 "config_parser.yy"
{ {
m_Array = boost::make_shared<Dictionary>(); m_Array = boost::make_shared<Dictionary>();
@ -1716,7 +1755,7 @@ yyreduce:
case 41: case 41:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 252 "config_parser.yy" #line 252 "config_parser.yy"
{ {
(yyval.variant) = new Variant(m_Array); (yyval.variant) = new Variant(m_Array);
@ -1726,7 +1765,7 @@ yyreduce:
case 42: case 42:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 259 "config_parser.yy" #line 259 "config_parser.yy"
{ {
m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant)); m_Array->AddUnnamedProperty(*(yyvsp[(1) - (1)].variant));
@ -1736,10 +1775,21 @@ yyreduce:
/* Line 1455 of yacc.c */ /* Line 1806 of yacc.c */
#line 1741 "config_parser.cc" #line 1780 "config_parser.cc"
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the new translation. We take the
approach of translating immediately before every use of yytoken.
One alternative is translating here after every semantic action,
but that translation would be missed if the semantic action invokes
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
incorrect destructor might then be invoked immediately. In the
case of YYERROR or YYBACKUP, subsequent parser actions might lead
to an incorrect destructor call or verbose syntax error message
before the lookahead is translated. */
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@ -1768,6 +1818,10 @@ yyreduce:
| yyerrlab -- here on detecting error | | yyerrlab -- here on detecting error |
`------------------------------------*/ `------------------------------------*/
yyerrlab: yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */ /* If not already recovering from an error, report this error. */
if (!yyerrstatus) if (!yyerrstatus)
{ {
@ -1775,41 +1829,40 @@ yyerrlab:
#if ! YYERROR_VERBOSE #if ! YYERROR_VERBOSE
yyerror (&yylloc, context, YY_("syntax error")); yyerror (&yylloc, context, YY_("syntax error"));
#else #else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{ {
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); char const *yymsgp = YY_("syntax error");
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) int yysyntax_error_status;
{ yysyntax_error_status = YYSYNTAX_ERROR;
YYSIZE_T yyalloc = 2 * yysize; if (yysyntax_error_status == 0)
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yymsgp = yymsg;
yyalloc = YYSTACK_ALLOC_MAXIMUM; else if (yysyntax_error_status == 1)
if (yymsg != yymsgbuf) {
YYSTACK_FREE (yymsg); if (yymsg != yymsgbuf)
yymsg = (char *) YYSTACK_ALLOC (yyalloc); YYSTACK_FREE (yymsg);
if (yymsg) yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
yymsg_alloc = yyalloc; if (!yymsg)
else {
{ yymsg = yymsgbuf;
yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf;
yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2;
} }
} else
{
if (0 < yysize && yysize <= yymsg_alloc) yysyntax_error_status = YYSYNTAX_ERROR;
{ yymsgp = yymsg;
(void) yysyntax_error (yymsg, yystate, yychar); }
yyerror (&yylloc, context, yymsg); }
} yyerror (&yylloc, context, yymsgp);
else if (yysyntax_error_status == 2)
{ goto yyexhaustedlab;
yyerror (&yylloc, context, YY_("syntax error"));
if (yysize != 0)
goto yyexhaustedlab;
}
} }
# undef YYSYNTAX_ERROR
#endif #endif
} }
yyerror_range[0] = yylloc; yyerror_range[1] = yylloc;
if (yyerrstatus == 3) if (yyerrstatus == 3)
{ {
@ -1846,7 +1899,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0) if (/*CONSTCOND*/ 0)
goto yyerrorlab; goto yyerrorlab;
yyerror_range[0] = yylsp[1-yylen]; yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */ this YYERROR. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@ -1865,7 +1918,7 @@ yyerrlab1:
for (;;) for (;;)
{ {
yyn = yypact[yystate]; yyn = yypact[yystate];
if (yyn != YYPACT_NINF) if (!yypact_value_is_default (yyn))
{ {
yyn += YYTERROR; yyn += YYTERROR;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
@ -1880,7 +1933,7 @@ yyerrlab1:
if (yyssp == yyss) if (yyssp == yyss)
YYABORT; YYABORT;
yyerror_range[0] = *yylsp; yyerror_range[1] = *yylsp;
yydestruct ("Error: popping", yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, context); yystos[yystate], yyvsp, yylsp, context);
YYPOPSTACK (1); YYPOPSTACK (1);
@ -1890,10 +1943,10 @@ yyerrlab1:
*++yyvsp = yylval; *++yyvsp = yylval;
yyerror_range[1] = 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
the lookahead. YYLOC is available though. */ the lookahead. YYLOC is available though. */
YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
*++yylsp = yyloc; *++yylsp = yyloc;
/* Shift the error token. */ /* Shift the error token. */
@ -1929,8 +1982,13 @@ yyexhaustedlab:
yyreturn: yyreturn:
if (yychar != YYEMPTY) if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead", {
yytoken, &yylval, &yylloc, context); /* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, &yylloc, context);
}
/* Do not reclaim the symbols of the rule which action triggered /* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */ this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen); YYPOPSTACK (yylen);
@ -1955,7 +2013,7 @@ yyreturn:
/* Line 1675 of yacc.c */ /* Line 2067 of yacc.c */
#line 272 "config_parser.yy" #line 272 "config_parser.yy"

View File

@ -1,10 +1,8 @@
/* A Bison parser, made by GNU Bison 2.5. */
/* A Bison parser, made by GNU Bison 2.4.1. */ /* Bison interface for Yacc-like parsers in C
/* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
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
@ -34,7 +32,7 @@
/* "%code requires" blocks. */ /* "%code requires" blocks. */
/* Line 1676 of yacc.c */ /* Line 2068 of yacc.c */
#line 1 "config_parser.yy" #line 1 "config_parser.yy"
/****************************************************************************** /******************************************************************************
@ -65,8 +63,8 @@ using namespace icinga;
/* Line 1676 of yacc.c */ /* Line 2068 of yacc.c */
#line 70 "config_parser.h" #line 68 "config_parser.h"
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
@ -113,7 +111,7 @@ using namespace icinga;
typedef union YYSTYPE typedef union YYSTYPE
{ {
/* Line 1676 of yacc.c */ /* Line 2068 of yacc.c */
#line 38 "config_parser.yy" #line 38 "config_parser.yy"
char *text; char *text;
@ -123,8 +121,8 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */ /* Line 2068 of yacc.c */
#line 128 "config_parser.h" #line 126 "config_parser.h"
} 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 */